xref: /OK3568_Linux_fs/u-boot/board/forlinx/ok3568/ok3568.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  * SPDX-License-Identifier:     GPL-2.0+
3  *
4  * (C) Copyright 2020 Rockchip Electronics Co., Ltd
5  */
6 
7 #include <common.h>
8 #include <dm.h>
9 #include <dwc3-uboot.h>
10 #include <usb.h>
11 
12 DECLARE_GLOBAL_DATA_PTR;
13 
rk_board_init(void)14 int rk_board_init(void)
15 {
16 #if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_ROCKCHIP_DMC_FSP)
17 	u32 ret = 0;
18 	struct udevice *dev;
19 	ret = uclass_get_device_by_driver(UCLASS_DMC, DM_GET_DRIVER(dmc_fsp), &dev);
20 	if (ret) {
21 		printf("dmc_fsp failed, ret=%d\n", ret);
22 		return 0;
23 	}
24 #endif
25 	return 0;
26 }
27 
28 #ifdef CONFIG_USB_DWC3
29 static struct dwc3_device dwc3_device_data = {
30 	.maximum_speed = USB_SPEED_HIGH,
31 	.base = 0xfcc00000,
32 	.dr_mode = USB_DR_MODE_PERIPHERAL,
33 	.index = 0,
34 	.dis_u2_susphy_quirk = 1,
35 	.usb2_phyif_utmi_width = 16,
36 };
37 
usb_gadget_handle_interrupts(void)38 int usb_gadget_handle_interrupts(void)
39 {
40 	dwc3_uboot_handle_interrupt(0);
41 	return 0;
42 }
43 
board_usb_init(int index,enum usb_init_type init)44 int board_usb_init(int index, enum usb_init_type init)
45 {
46 	return dwc3_uboot_init(&dwc3_device_data);
47 }
48 #endif
49