1 // SPDX-License-Identifier: GPL-2.0+
3 * (C) Copyright 2019 Rockchip Electronics Co., Ltd.
11 #include <asm/arch-rockchip/boot_mode.h>
12 #include <asm/arch-rockchip/clock.h>
13 #include <asm/arch-rockchip/periph.h>
14 #include <power/regulator.h>
16 DECLARE_GLOBAL_DATA_PTR;
18 __weak int rk_board_late_init(void)
23 int board_late_init(void)
27 return rk_board_late_init();
34 #ifdef CONFIG_DM_REGULATOR
35 ret = regulators_enable_boot_on(false);
37 debug("%s: Cannot enable boot on regulator\n", __func__);
43 #if !defined(CONFIG_SYS_DCACHE_OFF) && !defined(CONFIG_ARM64)
44 void enable_caches(void)
46 /* Enable D-cache. I-cache is already enabled in start.S */
51 #if defined(CONFIG_USB_GADGET) && defined(CONFIG_USB_GADGET_DWC2_OTG)
53 #include <usb/dwc2_udc.h>
55 static struct dwc2_plat_otg_data otg_data = {
61 int board_usb_init(int index, enum usb_init_type init)
66 const void *blob = gd->fdt_blob;
68 /* find the usb_otg node */
69 node = fdt_node_offset_by_compatible(blob, -1, "snps,dwc2");
72 mode = fdt_getprop(blob, node, "dr_mode", NULL);
73 if (mode && strcmp(mode, "otg") == 0) {
78 node = fdt_node_offset_by_compatible(blob, node, "snps,dwc2");
81 debug("Not found usb_otg device\n");
84 otg_data.regs_otg = fdtdec_get_addr(blob, node, "reg");
86 return dwc2_udc_probe(&otg_data);
89 int board_usb_cleanup(int index, enum usb_init_type init)
95 #if CONFIG_IS_ENABLED(FASTBOOT)
96 int fastboot_set_reboot_flag(void)
98 printf("Setting reboot to fastboot flag ...\n");
99 /* Set boot mode to fastboot */
100 writel(BOOT_FASTBOOT, CONFIG_ROCKCHIP_BOOT_MODE_REG);