From: Stefan Roese Date: Tue, 18 Jul 2017 14:10:49 +0200 Subject: [U-Boot] [PATCH 09/11 v2] x86: dfi-bt700: Add xHCI USB support In-Reply-To: <20170718121051.14716-1-sr@denx.de> References: <20170718121051.14716-1-sr@denx.de> Message-ID: <20170718121051.14716-9-sr@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Change from EHCI to xHCI on the DFI BayTrail SoM. 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. This patch also configures this GPIO in the dts for correct operation. Signed-off-by: Stefan Roese Cc: Simon Glass Reviewed-by: Bin Meng --- v2: - Squashed 2 patches into one as suggested by Bin - Added Bin's reviewed-by arch/x86/dts/dfi-bt700.dtsi | 12 ++++++++++++ board/dfi/dfi-bt700/Kconfig | 1 + board/dfi/dfi-bt700/dfi-bt700.c | 27 +++++++++++++++++++++++++++ 3 files changed, 40 insertions(+) diff --git a/arch/x86/dts/dfi-bt700.dtsi b/arch/x86/dts/dfi-bt700.dtsi index 04aa95ad52..b62e00ff1f 100644 --- a/arch/x86/dts/dfi-bt700.dtsi +++ b/arch/x86/dts/dfi-bt700.dtsi @@ -47,6 +47,15 @@ pad-offset = <0x3a0>; mode-func = <1>; }; + + xhci_hub_reset: usb_ulpi_stp at 0 { + gpio-offset = <0xa0 10>; + pad-offset = <0x23b0>; + mode-func = <0>; + mode-gpio; + output-value = <1>; + direction = ; + }; }; chosen { @@ -261,6 +270,9 @@ fsp,enable-spi; fsp,enable-sata; fsp,sata-mode = ; +#ifdef CONFIG_USB_XHCI_HCD + fsp,enable-xhci; +#endif fsp,lpe-mode = ; fsp,lpss-sio-mode = ; fsp,enable-dma0; 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; +} -- 2.13.3