67 lines
1.3 KiB
C
67 lines
1.3 KiB
C
/*
|
|
* SPDX-License-Identifier: GPL-2.0+
|
|
*
|
|
* (C) Copyright 2020 Rockchip Electronics Co., Ltd
|
|
*/
|
|
|
|
#include <common.h>
|
|
#include <dm.h>
|
|
#include <dwc3-uboot.h>
|
|
#include <usb.h>
|
|
#include <dm.h>
|
|
#include <wdt.h>
|
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
int rk_board_late_init(void)
|
|
{
|
|
#ifdef CONFIG_HW_WATCHDOG
|
|
int ret;
|
|
struct udevice *dev;
|
|
ret = uclass_get_device(UCLASS_WDT, 0, &dev);
|
|
if (!ret) {
|
|
if (env_get_yesno("watchdog"))
|
|
wdt_start(dev, 15000, 0);
|
|
else
|
|
wdt_stop(dev);
|
|
}
|
|
#endif
|
|
return 0;
|
|
}
|
|
|
|
int rk_board_init(void)
|
|
{
|
|
#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_ROCKCHIP_DMC_FSP)
|
|
u32 ret = 0;
|
|
struct udevice *dev;
|
|
ret = uclass_get_device_by_driver(UCLASS_DMC, DM_GET_DRIVER(dmc_fsp), &dev);
|
|
if (ret) {
|
|
printf("dmc_fsp failed, ret=%d\n", ret);
|
|
return 0;
|
|
}
|
|
#endif
|
|
return 0;
|
|
}
|
|
|
|
#ifdef CONFIG_USB_DWC3
|
|
static struct dwc3_device dwc3_device_data = {
|
|
.maximum_speed = USB_SPEED_HIGH,
|
|
.base = 0xfcc00000,
|
|
.dr_mode = USB_DR_MODE_PERIPHERAL,
|
|
.index = 0,
|
|
.dis_u2_susphy_quirk = 1,
|
|
.usb2_phyif_utmi_width = 16,
|
|
};
|
|
|
|
int usb_gadget_handle_interrupts(void)
|
|
{
|
|
dwc3_uboot_handle_interrupt(0);
|
|
return 0;
|
|
}
|
|
|
|
int board_usb_init(int index, enum usb_init_type init)
|
|
{
|
|
return dwc3_uboot_init(&dwc3_device_data);
|
|
}
|
|
#endif
|