public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/3] sunxi: Add INITIAL_USB_SCAN_DELAY Kconfig option
@ 2016-04-02 19:10 Hans de Goede
  2016-04-02 19:10 ` [U-Boot] [PATCH 2/3] sunxi: Set DCDC1 to 3.3V on the Sinovoip BPI M3 Hans de Goede
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Hans de Goede @ 2016-04-02 19:10 UTC (permalink / raw)
  To: u-boot

Some boards have on board usb devices which need longer then the USB
spec's 1 second to connect from board powerup. Add a config option which
when non 0 adds an extra delay before the first usb bus scan.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 arch/arm/mach-sunxi/usb_phy.c | 7 +++++++
 board/sunxi/Kconfig           | 9 +++++++++
 2 files changed, 16 insertions(+)

diff --git a/arch/arm/mach-sunxi/usb_phy.c b/arch/arm/mach-sunxi/usb_phy.c
index b258ce4..f9993d2 100644
--- a/arch/arm/mach-sunxi/usb_phy.c
+++ b/arch/arm/mach-sunxi/usb_phy.c
@@ -85,6 +85,8 @@ static struct sunxi_usb_phy {
 #endif
 };
 
+static int initial_usb_scan_delay = CONFIG_INITIAL_USB_SCAN_DELAY;
+
 static int get_vbus_gpio(int index)
 {
 	switch (index) {
@@ -269,6 +271,11 @@ void sunxi_usb_phy_power_on(int index)
 {
 	struct sunxi_usb_phy *phy = &sunxi_usb_phy[index];
 
+	if (initial_usb_scan_delay) {
+		mdelay(initial_usb_scan_delay);
+		initial_usb_scan_delay = 0;
+	}
+
 	phy->power_on_count++;
 	if (phy->power_on_count != 1)
 		return;
diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig
index 464fa0f..2b0d1df 100644
--- a/board/sunxi/Kconfig
+++ b/board/sunxi/Kconfig
@@ -312,6 +312,15 @@ config MMC_SUNXI_SLOT_EXTRA
 	slot or emmc on mmc1 - mmc3. Setting this to 1, 2 or 3 will enable
 	support for this.
 
+config INITIAL_USB_SCAN_DELAY
+	int "delay initial usb scan by x ms to allow builtin devices to init"
+	default 0
+	---help---
+	Some boards have on board usb devices which need longer then the
+	USB spec's 1 second to connect from board powerup. Set this config
+	option to a non 0 value to add an extra delay before the first usb
+	bus scan.
+
 config USB0_VBUS_PIN
 	string "Vbus enable pin for usb0 (otg)"
 	default ""
-- 
2.7.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-04-09 11:59 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-02 19:10 [U-Boot] [PATCH 1/3] sunxi: Add INITIAL_USB_SCAN_DELAY Kconfig option Hans de Goede
2016-04-02 19:10 ` [U-Boot] [PATCH 2/3] sunxi: Set DCDC1 to 3.3V on the Sinovoip BPI M3 Hans de Goede
2016-04-05  9:42   ` Ian Campbell
2016-04-02 19:10 ` [U-Boot] [PATCH 3/3] sunxi: Enable usb ports " Hans de Goede
2016-04-05  9:44   ` Ian Campbell
2016-04-05  9:51     ` Hans de Goede
2016-04-05 10:44       ` Ian Campbell
2016-04-09 11:59         ` Hans de Goede
2016-04-05  9:42 ` [U-Boot] [PATCH 1/3] sunxi: Add INITIAL_USB_SCAN_DELAY Kconfig option Ian Campbell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox