aboutsummaryrefslogtreecommitdiff
path: root/board/ti/am43xx
diff options
context:
space:
mode:
authorJean-Jacques Hiblot2018-12-04 11:30:51 +0100
committerMarek Vasut2018-12-14 17:59:09 +0100
commit347631bcddbfb3041b84e9b3a1812b4874c66b2d (patch)
tree9118f906b40fc1400c56ef9e4759c8893bd45298 /board/ti/am43xx
parent1ce5f1f933b6b3e0994b4b7d198afe0198442888 (diff)
board: ti: am43xx: turn on USB clocks
Enable USB clocks in late init stage to support ports under DM_USB. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> Reviewed-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'board/ti/am43xx')
-rw-r--r--board/ti/am43xx/board.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/board/ti/am43xx/board.c b/board/ti/am43xx/board.c
index 31bc0f49a48..536c5b88ed5 100644
--- a/board/ti/am43xx/board.c
+++ b/board/ti/am43xx/board.c
@@ -705,6 +705,19 @@ int board_init(void)
}
#ifdef CONFIG_BOARD_LATE_INIT
+#if CONFIG_IS_ENABLED(DM_USB) && CONFIG_IS_ENABLED(OF_CONTROL)
+static int device_okay(const char *path)
+{
+ int node;
+
+ node = fdt_path_offset(gd->fdt_blob, path);
+ if (node < 0)
+ return 0;
+
+ return fdtdec_get_is_enabled(gd->fdt_blob, node);
+}
+#endif
+
int board_late_init(void)
{
#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
@@ -717,10 +730,18 @@ int board_late_init(void)
if (get_device_type() == HS_DEVICE)
env_set("boot_fit", "1");
#endif
+
+#if CONFIG_IS_ENABLED(DM_USB) && CONFIG_IS_ENABLED(OF_CONTROL)
+ if (device_okay("/ocp/omap_dwc3@48380000"))
+ enable_usb_clocks(0);
+ if (device_okay("/ocp/omap_dwc3@483c0000"))
+ enable_usb_clocks(1);
+#endif
return 0;
}
#endif
+#if !CONFIG_IS_ENABLED(DM_USB_GADGET)
#ifdef CONFIG_USB_DWC3
static struct dwc3_device usb_otg_ss1 = {
.maximum_speed = USB_SPEED_HIGH,
@@ -823,6 +844,7 @@ int board_usb_cleanup(int index, enum usb_init_type init)
return 0;
}
#endif /* defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_XHCI_OMAP) */
+#endif /* !CONFIG_IS_ENABLED(DM_USB_GADGET) */
#ifdef CONFIG_DRIVER_TI_CPSW