diff mbox series

[U-Boot,v1,1/6] board: ti: dra7xx-evm: turn on USB clocks in late init stage

Message ID 1515160243-19815-2-git-send-email-jjhiblot@ti.com
State Superseded
Delegated to: Marek Vasut
Headers show
Series Add support for DM_USB for TI's DRA7 platforms | expand

Commit Message

Jean-Jacques Hiblot Jan. 5, 2018, 1:50 p.m. UTC
For USB ports that use the Driver Model, turn on the clocks during the
late init stage.

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

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

Comments

Tom Rini Jan. 9, 2018, 7:18 p.m. UTC | #1
On Fri, Jan 05, 2018 at 02:50:38PM +0100, Jean-Jacques Hiblot wrote:

> For USB ports that use the Driver Model, turn on the clocks during the
> late init stage.
> 
> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>

Reviewed-by: Tom Rini <trini@konsulko.com>
diff mbox series

Patch

diff --git a/board/ti/dra7xx/evm.c b/board/ti/dra7xx/evm.c
index 6bcfa48..7f363b6 100644
--- a/board/ti/dra7xx/evm.c
+++ b/board/ti/dra7xx/evm.c
@@ -643,6 +643,19 @@  int dram_init_banksize(void)
 	return 0;
 }
 
+#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
@@ -680,6 +693,12 @@  int board_late_init(void)
 	if (board_is_dra71x_evm())
 		palmas_i2c_write_u8(LP873X_I2C_SLAVE_ADDR, 0x9, 0x7);
 #endif
+#if CONFIG_IS_ENABLED(DM_USB) && CONFIG_IS_ENABLED(OF_CONTROL)
+	if (device_okay("/ocp/omap_dwc3_1@48880000"))
+		enable_usb_clocks(0);
+	if (device_okay("/ocp/omap_dwc3_2@488c0000"))
+		enable_usb_clocks(1);
+#endif
 	return 0;
 }