[U-Boot] [PATCH v3 06/10] board; ti: am57xx: turn on USB clocks

Jean-Jacques Hiblot jjhiblot at ti.com
Mon Mar 26 13:50:29 UTC 2018


From: Vignesh R <vigneshr at ti.com>

Enable USB clocks in late init stage to support ports under DM_USB.

Signed-off-by: Vignesh R <vigneshr at ti.com>

Signed-off-by: Jean-Jacques Hiblot <jjhiblot at ti.com>
---

Changes in v3: None
Changes in v2:
- am57xx boards: when DM_USB is used, turn on the required USB clocks

 board/ti/am57xx/board.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/board/ti/am57xx/board.c b/board/ti/am57xx/board.c
index 5bd8778..cd53776 100644
--- a/board/ti/am57xx/board.c
+++ b/board/ti/am57xx/board.c
@@ -676,6 +676,19 @@ out:
 	return;
 }
 
+#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)
 {
 	setup_board_eeprom_env();
@@ -715,6 +728,12 @@ int board_late_init(void)
 	board_ti_set_ethaddr(2);
 #endif
 
+#if CONFIG_IS_ENABLED(DM_USB) && CONFIG_IS_ENABLED(OF_CONTROL)
+	if (device_okay("/ocp/omap_dwc3_1 at 48880000"))
+		enable_usb_clocks(0);
+	if (device_okay("/ocp/omap_dwc3_2 at 488c0000"))
+		enable_usb_clocks(1);
+#endif
 	return 0;
 }
 
-- 
2.7.4



More information about the U-Boot mailing list