[U-Boot] [RFC 02/10] nvidia, tegra: new USB hardware init interface

Mateusz Zalega
2013-08-06T10:50:34Z

This commit postpones initialization of USB hardware until
usb_board_init() is called by a command implementation
(ie. do_dfu()) or a driver.

Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Tom Warren <twarren@nvidia.com>
---
arch/arm/include/asm/arch-tegra/usb.h | 3 +--
board/nvidia/common/board.c | 14 ++++++++++----
2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/arch/arm/include/asm/arch-tegra/usb.h b/arch/arm/include/asm/arch-tegra/usb.h
index f66257c..a1efd07 100644
--- a/arch/arm/include/asm/arch-tegra/usb.h
+++ b/arch/arm/include/asm/arch-tegra/usb.h
@@ -131,8 +131,7 @@
/* USB3_IF_USB_PHY_VBUS_SENSORS_0 */
#define VBUS_VLD_STS (1 << 26)

-
/* Setup USB on the board */
-int board_usb_init(const void *blob);
+int usb_process_devicetree(const void *blob);

#endif /* _TEGRA_USB_H_ */
diff --git a/board/nvidia/common/board.c b/board/nvidia/common/board.c
index 126e56e..cdb02ee 100644
--- a/board/nvidia/common/board.c
+++ b/board/nvidia/common/board.c
@@ -32,6 +32,7 @@
#ifdef CONFIG_USB_EHCI_TEGRA
#include <asm/arch-tegra/usb.h>
#include <asm/arch/usb.h>
+#include <usb.h>
#endif
#ifdef CONFIG_TEGRA_MMC
#include <asm/arch-tegra/tegra_mmc.h>
@@ -151,10 +152,6 @@ int board_init(void)
# endif /* CONFIG_TEGRA_PMU */
#endif /* CONFIG_SYS_I2C_TEGRA */

-#ifdef CONFIG_USB_EHCI_TEGRA
- pin_mux_usb();
- board_usb_init(gd->fdt_blob);
-#endif
#ifdef CONFIG_LCD
tegra_lcd_check_next_stage(gd->fdt_blob, 0);
#endif
@@ -257,3 +254,12 @@ void pad_init_mmc(struct mmc_host *host)
#endif /* T30 */
}
#endif /* MMC */
+
+#ifdef CONFIG_USB_EHCI_TEGRA
+int board_usb_init(enum board_usb_init_type what_to_init)
+{
+ pin_mux_usb();
+ usb_process_devicetree(gd->fdt_blob);
+ return 0;
+}
+#endif
--
1.8.2.1