diff mbox

[U-Boot,09/12] x86: dfi-bt700: Add xHCI USB hub reset

Message ID 20170717140329.8199-9-sr@denx.de
State Superseded
Delegated to: Bin Meng
Headers show

Commit Message

Stefan Roese July 17, 2017, 2:03 p.m. UTC
The xHCI USB hub is connected to an GPIO on the DFI BayTrail SoM. For
correct operation, it needs to get reset upon power-up. Otherwise it
may happen that the hub is not detected after a software reboot.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
---
 board/dfi/dfi-bt700/Kconfig     |  1 +
 board/dfi/dfi-bt700/dfi-bt700.c | 27 +++++++++++++++++++++++++++
 2 files changed, 28 insertions(+)

Comments

Bin Meng July 18, 2017, 1:15 a.m. UTC | #1
On Mon, Jul 17, 2017 at 10:03 PM, Stefan Roese <sr@denx.de> wrote:
> The xHCI USB hub is connected to an GPIO on the DFI BayTrail SoM. For
> correct operation, it needs to get reset upon power-up. Otherwise it
> may happen that the hub is not detected after a software reboot.
>
> Signed-off-by: Stefan Roese <sr@denx.de>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Bin Meng <bmeng.cn@gmail.com>
> ---
>  board/dfi/dfi-bt700/Kconfig     |  1 +
>  board/dfi/dfi-bt700/dfi-bt700.c | 27 +++++++++++++++++++++++++++
>  2 files changed, 28 insertions(+)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
diff mbox

Patch

diff --git a/board/dfi/dfi-bt700/Kconfig b/board/dfi/dfi-bt700/Kconfig
index 88c4ddeee9..58a0188f87 100644
--- a/board/dfi/dfi-bt700/Kconfig
+++ b/board/dfi/dfi-bt700/Kconfig
@@ -20,6 +20,7 @@  config BOARD_SPECIFIC_OPTIONS # dummy
 	select X86_RESET_VECTOR if !EFI_STUB
 	select INTEL_BAYTRAIL
 	select BOARD_ROMSIZE_KB_8192
+	select BOARD_LATE_INIT
 
 config PCIE_ECAM_BASE
 	default 0xe0000000
diff --git a/board/dfi/dfi-bt700/dfi-bt700.c b/board/dfi/dfi-bt700/dfi-bt700.c
index 8645bdc795..3dd2036d11 100644
--- a/board/dfi/dfi-bt700/dfi-bt700.c
+++ b/board/dfi/dfi-bt700/dfi-bt700.c
@@ -28,3 +28,30 @@  int board_early_init_f(void)
 
 	return 0;
 }
+
+int board_late_init(void)
+{
+	struct gpio_desc desc;
+	int ret;
+
+	ret = dm_gpio_lookup_name("F10", &desc);
+	if (ret)
+		debug("gpio ret=%d\n", ret);
+	ret = dm_gpio_request(&desc, "xhci_hub_reset");
+	if (ret)
+		debug("gpio_request ret=%d\n", ret);
+	ret = dm_gpio_set_dir_flags(&desc, GPIOD_IS_OUT);
+	if (ret)
+		debug("gpio dir ret=%d\n", ret);
+
+	/* Pull xHCI hub reset to low (active low) */
+	dm_gpio_set_value(&desc, 0);
+
+	/* Wait at least 5 ms, so lets choose 10 to be safe */
+	mdelay(10);
+
+	/* Pull xHCI hub reset to high (active low) */
+	dm_gpio_set_value(&desc, 1);
+
+	return 0;
+}