1 /*
2 * SPDX-License-Identifier: GPL-2.0+
3 *
4 * (C) Copyright 2022 Rockchip Electronics Co., Ltd
5 */
6
7 #include <common.h>
8 #include <asm/io.h>
9 #include <dwc3-uboot.h>
10 #include <usb.h>
11
12 DECLARE_GLOBAL_DATA_PTR;
13
14 #ifdef CONFIG_USB_DWC3
15 static struct dwc3_device dwc3_device_data = {
16 .maximum_speed = USB_SPEED_HIGH,
17 .base = 0xffb00000,
18 .dr_mode = USB_DR_MODE_PERIPHERAL,
19 .index = 0,
20 .dis_u2_susphy_quirk = 1,
21 .usb2_phyif_utmi_width = 16,
22 };
23
usb_gadget_handle_interrupts(void)24 int usb_gadget_handle_interrupts(void)
25 {
26 dwc3_uboot_handle_interrupt(0);
27 return 0;
28 }
29
board_usb_init(int index,enum usb_init_type init)30 int board_usb_init(int index, enum usb_init_type init)
31 {
32 writel(0x01ff0000, 0xff000050); /* Resume usb2 phy to normal mode */
33 return dwc3_uboot_init(&dwc3_device_data);
34 }
35 #endif
36