USB: XHCI: Add xHCI host controller stack driver
Subsystems (6)
v3 cover USB: XHCI: Add xHCI host controller stack driver
Based on 'master' branch of u-boot-usb tree.
The series also includes patches to support xHCI on exynos5250, including required driver, device tree changes.
Changes since V2:
- Added patch to move 'bmRequestType' (Table 9-2, Ch9) definitions from EHCI header file to usb_defs.h so that XHCI can also use it:
usb: Move 'bmRequestType' USB device request macros from EHCI header
- Added patches to rework the Vbus GPIO setup for ehci and xhci in exynos SoCs:
exynos: usb: Switch USB VBUS GPIOs to be device tree configured
exynos: dts: Add USB VBUS GPIOs to the device tree
- Added the top commit history for drivers/usb/host/xhci* of Linux kernel version 3.4 from where the xHCI code was initially imported.
- Replaced GPL license with new SPDX license GPL-2.0+.
- Moved this "asm/io.h" file inclusion to xhci.h
- Reworked 'return -1' globally to return meaningful error numbers.
- Added required comment in common/usb.c for not calling first get_descriptor request for XHCI.
Julius Werner (2):
exynos: usb: Switch USB VBUS GPIOs to be device tree configured
exynos: dts: Add USB VBUS GPIOs to the device tree
Vivek Gautam (8):
usb: Move 'bmRequestType' USB device request macros from EHCI header
USB: xHCI: Add stack support for xHCI
USB: XHCI: Add xHCI host controller support for Exynos5
arm: exynos: Add methods to control power to USB 3.0 PHY
exynos5: dts: Add COMPAT string data for USB 3.0 PHY and XHCI
exynos5: dts: Add device node for XHCI
config: arm: exynos5250: Define CONFIG_SYS_CACHELINE_SIZE
temp: config: exynos5250: Enable xHCI support for Exynos5
arch/arm/cpu/armv7/exynos/power.c | 22 + arch/arm/dts/exynos5250.dtsi | 12 + arch/arm/include/asm/arch-exynos/cpu.h | 8 + arch/arm/include/asm/arch-exynos/power.h | 5 + arch/arm/include/asm/arch-exynos/xhci-exynos.h | 88 ++ board/samsung/dts/exynos5250-smdk5250.dts | 4 + board/samsung/dts/exynos5250-snow.dts | 8 + board/samsung/smdk5250/exynos5-dt.c | 19 - common/usb.c | 33 +- drivers/usb/host/Makefile | 4 + drivers/usb/host/ehci-exynos.c | 11 + drivers/usb/host/ehci.h | 16 - drivers/usb/host/xhci-exynos5.c | 327 ++++++ drivers/usb/host/xhci-mem.c | 720 ++++++++++++++ drivers/usb/host/xhci-ring.c | 939 ++++++++++++++++++ drivers/usb/host/xhci.c | 1030 +++++++++++++++++++ drivers/usb/host/xhci.h | 1255 ++++++++++++++++++++++++ include/configs/exynos5250-dt.h | 7 +- include/fdtdec.h | 2 + include/linux/usb/dwc3.h | 188 ++++ include/usb.h | 9 +- include/usb_defs.h | 19 + lib/fdtdec.c | 2 + 23 files changed, 4688 insertions(+), 40 deletions(-) create mode 100644 arch/arm/include/asm/arch-exynos/xhci-exynos.h create mode 100644 drivers/usb/host/xhci-exynos5.c create mode 100644 drivers/usb/host/xhci-mem.c create mode 100644 drivers/usb/host/xhci-ring.c create mode 100644 drivers/usb/host/xhci.c create mode 100644 drivers/usb/host/xhci.h create mode 100644 include/linux/usb/dwc3.h
Signature · 1 line
1.7.6.5
PATCH v3 1/10 usb: Move 'bmRequestType' USB device request macros from EHCI header
Macros defining bmRequestType field of USB device request, given in table 9.2 USB 2.0 spec, are rather generic macros which can be further used by other Host controller stacks. So moving them to usb_defs header.
---
Changes since v2:
- This patch is newly added in this version of the series.
drivers/usb/host/ehci.h | 16 ---------------- include/usb_defs.h | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 16 deletions(-)
drivers/usb/host/ehci.h +0 -16
@@ -28,22 +28,6 @@#define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS 2#endif -/* (shifted) direction/type/recipient from the USB 2.0 spec, table 9.2 */ -#define DeviceRequest \ - ((USB_DIR_IN | USB_TYPE_STANDARD | USB_RECIP_DEVICE) << 8) - -#define DeviceOutRequest \ - ((USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_DEVICE) << 8) - -#define InterfaceRequest \ - ((USB_DIR_IN | USB_TYPE_STANDARD | USB_RECIP_INTERFACE) << 8) - -#define EndpointRequest \ - ((USB_DIR_IN | USB_TYPE_STANDARD | USB_RECIP_INTERFACE) << 8) - -#define EndpointOutRequest \ - ((USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_INTERFACE) << 8) -/* * Register Space. */
include/usb_defs.h +19 -0
@@ -63,6 +63,25 @@#define USB_DIR_OUT 0#define USB_DIR_IN 0x80 +/* +* bmRequestType: USB Device Requests, table 9.2 USB 2.0 spec. +* (shifted) direction/type/recipient. +*/ +#define DeviceRequest \ + ((USB_DIR_IN | USB_TYPE_STANDARD | USB_RECIP_DEVICE) << 8) + +#define DeviceOutRequest \ + ((USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_DEVICE) << 8) + +#define InterfaceRequest \ + ((USB_DIR_IN | USB_TYPE_STANDARD | USB_RECIP_INTERFACE) << 8) + +#define EndpointRequest \ + ((USB_DIR_IN | USB_TYPE_STANDARD | USB_RECIP_INTERFACE) << 8) + +#define EndpointOutRequest \ + ((USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_INTERFACE) << 8) +/* Descriptor types */ #define USB_DT_DEVICE 0x01#define USB_DT_CONFIG 0x02
Signature · 1 line
1.7.6.5
PATCH v3 1/10 usb: Move 'bmRequestType' USB device request macros from EHCI header
Dear Vivek Gautam,
Quoted 11 lines
Macros defining bmRequestType field of USB device request, given in table 9.2 USB 2.0 spec, are rather generic macros which can be further used by other Host controller stacks. So moving them to
usb_defsheader.Signed-off-by Vivek Gautam <[email protected]>Cc Julius Werner <[email protected]>Cc Simon Glass <[email protected]>Cc Minkyu Kang <[email protected]>Cc Dan Murphy <[email protected]>Cc Marek Vasut <[email protected]>
Why not just use include/usb.h ?
Best regards,
Marek Vasut
PATCH v3 1/10 usb: Move 'bmRequestType' USB device request macros from EHCI header
Hi Marek,
Quoted 7 lines · Marek Vasut
Dear Vivek Gautam,
Quoted 5 lines
Macros defining bmRequestType field of USB device request, given in table 9.2 USB 2.0 spec, are rather generic macros which can be further used by other Host controller stacks. So moving them to
usb_defsheader.
Quoted 8 lines
Quoted 6 lines
Signed-off-by Vivek Gautam <[email protected]>Cc Julius Werner <[email protected]>Cc Simon Glass <[email protected]>Cc Minkyu Kang <[email protected]>Cc Dan Murphy <[email protected]>Cc Marek Vasut <[email protected]>Why not just use
include/usb.h?
The bit field definitions for usb-types usb-recipient, and directions are itself defined in usb_defs.h;
so i thought of keeping their combination just below it, so that it would not be difficult to reference.
Please let me know if you want me to move them to include/usb.h
Quoted 3 lines
Best regards,
Marek Vasut
Signature · 2 lines
Best Regards Vivek
PATCH v3 1/10 usb: Move 'bmRequestType' USB device request macros from EHCI header
Dear Vivek Gautam,
Quoted 17 lines
Hi Marek,
Quoted 14 lines · Marek Vasut
Dear Vivek Gautam,
Quoted 11 lines
Macros defining bmRequestType field of USB device request, given in table 9.2 USB 2.0 spec, are rather generic macros which can be further used by other Host controller stacks. So moving them to
usb_defsheader.Signed-off-by Vivek Gautam <[email protected]>Cc Julius Werner <[email protected]>Cc Simon Glass <[email protected]>Cc Minkyu Kang <[email protected]>Cc Dan Murphy <[email protected]>Cc Marek Vasut <[email protected]>
Quoted 8 lines
Quoted 1 line
Why not just use
include/usb.h?The bit field definitions for usb-types usb-recipient, and directions are itself defined in
usb_defs.h;
so i thought of keeping their combination just below it, so that it would not be difficult to reference.Please let me know if you want me to move them to
include/usb.h
Ah, we already have usb_defs.h , then this is OK. The headers are mess and will eventually need cleanup too, not in this patchset of course.
Best regards,
Marek Vasut
PATCH v3 2/10 USB: xHCI: Add stack support for xHCI
In reply to Vivek GautamThis adds stack layer for eXtensible Host Controller Interface which facilitates use of USB 3.0 in host mode.
Adapting xHCI host controller driver in linux-kernel by Sarah Sharp to needs in u-boot.
Initial porting from Linux kernel version 3.4, with following top commit history of drivers/usb/host/xhci* :
cf84055 xHCI: Cleanup isoc transfer ring when TD length mismatch found
This adds the basic xHCI host controller driver with bare minimum features:
- Control/Bulk transfer support has been added with required infrastructure for necessary xHC data structures.
- Stream protocol hasn't been supported yet.
- No support for quirky devices has been added.
---
Changes since v2:
- Added the top commit history for drivers/usb/host/xhci* of Linux kernel version 3.4 from where the xHCI code was initially imported.
- Replaced GPL license with new SPDX license GPL-2.0+.
- Moved this "asm/io.h" file inclusion to xhci.h
- Reworked 'return -1' globally to return meaningful error numbers.
common/usb.c | 33 +- drivers/usb/host/Makefile | 3 + drivers/usb/host/xhci-mem.c | 720 ++++++++++++++++++++++++ drivers/usb/host/xhci-ring.c | 939 +++++++++++++++++++++++++++++++ drivers/usb/host/xhci.c | 1030 ++++++++++++++++++++++++++++++++++ drivers/usb/host/xhci.h | 1255 ++++++++++++++++++++++++++++++++++++++++++ include/usb.h | 9 +- 7 files changed, 3986 insertions(+), 3 deletions(-) create mode 100644 drivers/usb/host/xhci-mem.c create mode 100644 drivers/usb/host/xhci-ring.c create mode 100644 drivers/usb/host/xhci.c create mode 100644 drivers/usb/host/xhci.h
common/usb.c +31 -2
@@ -855,6 +855,16 @@ void usb_free_device(void) }/* +* XHCI issues Enable Slot command and thereafter +* allocates device contexts. Provide a weak alias +* function for the purpose, so that XHCI overrides it +* and EHCI/OHCI just work out of the box. +*/ +__weak int usb_alloc_device (struct usb_device *udev) +{ +return 0 ; +} +/* * By the time we get here, the device has gotten a new device ID * and is in the default state. We need to identify the thing and * get the ball rolling..
@@ -867,6 +877,17 @@ int usb_new_device(struct usb_device *dev)int tmp; ALLOC_CACHE_ALIGN_BUFFER(unsigned char, tmpbuf, USB_BUFSIZ); +/* +* Allocate usb 3.0 device context. +* USB 3.0 (xHCI) protocol tries to allocate device slot +* and related data structures first. This call does that. +* Refer to sec 4.3.2 in xHCI spec rev1.0 +*/ +if (usb_alloc_device (dev)) { +printf ("Cannot allocate device context to get SLOT_ID\n" ); +return -1 ; + } +/* We still haven't set the Address yet */ addr = dev->devnum; dev->devnum =0 ;
@@ -897,7 +918,7 @@ int usb_new_device(struct usb_device *dev)* http://sourceforge.net/mailarchive/forum.php? * thread_id=5729457&forum_id=5398 */ -struct usb_device_descriptor *desc; +__maybe_unused struct usb_device_descriptor *desc;int port =-1 ;struct usb_device *parent = dev->parent;unsigned short portstatus;
@@ -914,6 +935,13 @@ int usb_new_device(struct usb_device *dev) dev->epmaxpacketin[0 ] =64 ; dev->epmaxpacketout[0 ] =64 ; +/* +* XHCI needs to issue a Address device command to setup +* proper device context structures, before it can interact +* with the device. So a get_descriptor will fail before any +* of that is done for XHCI unlike EHCI. +*/ +#ifndef CONFIG_USB_XHCI err =usb_get_descriptor (dev,USB_DT_DEVICE ,0 , desc,64 );if (err <0 ) {debug ("usb_new_device: usb_get_descriptor() failed\n" );
@@ -926,11 +954,12 @@ int usb_new_device(struct usb_device *dev)* to differentiate between HUB and DEVICE. */ dev->descriptor.bDeviceClass = desc->bDeviceClass; +#endif -/* find the port number we're at */ if (parent) {int j; +/* find the port number we're at */ for (j =0 ; j < parent->maxchild; j++) {if (parent->children[j] == dev) { port = j;
drivers/usb/host/Makefile +3 -0
@@ -42,6 +42,9 @@ COBJS-$(CONFIG_USB_EHCI_SPEAR) += ehci-spear.o COBJS-$(CONFIG_USB_EHCI_TEGRA) += ehci-tegra.o COBJS-$(CONFIG_USB_EHCI_VCT) += ehci-vct.o +# xhci +COBJS-$(CONFIG_USB_XHCI) += xhci.o xhci-mem.o xhci-ring.o + COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS))
drivers/usb/host/xhci-mem.c new file +720 -0
720 lines not on this page · raw message
drivers/usb/host/xhci-ring.c new file +939 -0
939 lines not on this page · raw message
drivers/usb/host/xhci.c new file +1030 -0
1,030 lines not on this page · raw message
drivers/usb/host/xhci.h new file +1255 -0
235 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.7.6.5
Part of the diff is not shown here. View the raw message.
PATCH v3 2/10 USB: xHCI: Add stack support for xHCI
Marek and Vivek
Quoted 11 lines · Vivek Gautam
This adds stack layer for eXtensible Host Controller Interface which facilitates use of USB 3.0 in host mode.
Adapting xHCI host controller driver in linux-kernel by Sarah Sharp to needs in u-boot.
Initial porting from Linux kernel version 3.4, with following top commit history of
drivers/usb/host/xhci*:
cf84055 xHCI: Cleanup isoc transfer ring when TD length mismatch found
<snip>
I am checking with Sarah Sharp on the stability of the xHCI stack in 3.4.
I talked to her @ LPC and she eluded that 3.8 was a stable stack. But I asked for her comments off line. I will give her a couple days to respond.
Otherwise I am rebasing my code on top of these and testing this out.
Sorry for the delay on review and comment but I was travelling last week and did not have the oppourtunity to review or test.
Dan
Signature · 2 lines
------------------ Dan Murphy
PATCH v3 2/10 USB: xHCI: Add stack support for xHCI
Dear Dan Murphy,
Quoted 17 lines
Marek and Vivek
Quoted 9 lines · Vivek Gautam
This adds stack layer for eXtensible Host Controller Interface which facilitates use of USB 3.0 in host mode.
Adapting xHCI host controller driver in linux-kernel by Sarah Sharp to needs in u-boot.
Initial porting from Linux kernel version 3.4, with following top commit history of
drivers/usb/host/xhci*:
cf84055 xHCI: Cleanup isoc transfer ring when TD length mismatch found<snip>
I am checking with Sarah Sharp on the stability of the xHCI stack in 3.4.
Quoted 7 lines
I talked to her @ LPC and she eluded that 3.8 was a stable stack. But I asked for her comments off line. I will give her a couple days to respond.
Otherwise I am rebasing my code on top of these and testing this out.
Sorry for the delay on review and comment but I was travelling last week and did not have the oppourtunity to review or test.
Thanks. Let's see where this goes.
Best regards,
Marek Vasut
PATCH v3 3/10 USB: XHCI: Add xHCI host controller support for Exynos5
In reply to Vivek GautamThis adds driver layer for xHCI controller in Samsung's exynos5 soc. This interacts with xHCI host controller stack.
---
Changes since v2:
- Replaced GPL license with new SPDX license GPL-2.0+.
arch/arm/include/asm/arch-exynos/cpu.h | 8 + arch/arm/include/asm/arch-exynos/xhci-exynos.h | 88 +++++++ drivers/usb/host/Makefile | 1 + drivers/usb/host/xhci-exynos5.c | 316 ++++++++++++++++++++++++ include/linux/usb/dwc3.h | 188 ++++++++++++++ 5 files changed, 601 insertions(+), 0 deletions(-) create mode 100644 arch/arm/include/asm/arch-exynos/xhci-exynos.h create mode 100644 drivers/usb/host/xhci-exynos5.c create mode 100644 include/linux/usb/dwc3.h
arch/arm/include/asm/arch-exynos/cpu.h +8 -0
@@ -50,6 +50,8 @@#define EXYNOS4_SPI_ISP_BASE DEVICE_NOT_AVAILABLE#define EXYNOS4_ACE_SFR_BASE DEVICE_NOT_AVAILABLE#define EXYNOS4_DMC_PHY_BASE DEVICE_NOT_AVAILABLE +#define EXYNOS4_USB_HOST_XHCI_BASE DEVICE_NOT_AVAILABLE +#define EXYNOS4_USB3PHY_BASE DEVICE_NOT_AVAILABLE/* EXYNOS4X12 */ #define EXYNOS4X12_GPIO_PART3_BASE 0x03860000
@@ -85,6 +87,8 @@#define EXYNOS4X12_SPI_ISP_BASE DEVICE_NOT_AVAILABLE#define EXYNOS4X12_ACE_SFR_BASE DEVICE_NOT_AVAILABLE#define EXYNOS4X12_DMC_PHY_BASE DEVICE_NOT_AVAILABLE +#define EXYNOS4X12_USB_HOST_XHCI_BASE DEVICE_NOT_AVAILABLE +#define EXYNOS4X12_USB3PHY_BASE DEVICE_NOT_AVAILABLE/* EXYNOS5 Common*/ #define EXYNOS5_I2C_SPACING 0x10000
@@ -103,6 +107,8 @@#define EXYNOS5_DMC_CTRL_BASE 0x10DD0000#define EXYNOS5_GPIO_PART1_BASE 0x11400000#define EXYNOS5_MIPI_DSIM_BASE 0x11D00000 +#define EXYNOS5_USB_HOST_XHCI_BASE 0x12000000 +#define EXYNOS5_USB3PHY_BASE 0x12100000#define EXYNOS5_USB_HOST_EHCI_BASE 0x12110000#define EXYNOS5_USBPHY_BASE 0x12130000#define EXYNOS5_USBOTG_BASE 0x12140000
@@ -217,7 +223,9 @@ SAMSUNG_BASE(swreset, SWRESET) SAMSUNG_BASE(timer, PWMTIMER_BASE) SAMSUNG_BASE(uart, UART_BASE) SAMSUNG_BASE(usb_phy, USBPHY_BASE) +SAMSUNG_BASE(usb3_phy, USB3PHY_BASE) SAMSUNG_BASE(usb_ehci, USB_HOST_EHCI_BASE) +SAMSUNG_BASE(usb_xhci, USB_HOST_XHCI_BASE) SAMSUNG_BASE(usb_otg, USBOTG_BASE) SAMSUNG_BASE(watchdog, WATCHDOG_BASE)SAMSUNG_BASE (power,POWER_BASE )
arch/arm/include/asm/arch-exynos/xhci-exynos.h new file +88 -0
88 lines not on this page · raw message
drivers/usb/host/Makefile +1 -0
@@ -44,6 +44,7 @@ COBJS-$(CONFIG_USB_EHCI_VCT) += ehci-vct.o # xhci COBJS-$(CONFIG_USB_XHCI) += xhci.o xhci-mem.o xhci-ring.o +COBJS-$(CONFIG_USB_XHCI_EXYNOS) += xhci-exynos5.o COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c)
drivers/usb/host/xhci-exynos5.c new file +316 -0
316 lines not on this page · raw message
include/linux/usb/dwc3.h new file +188 -0
188 lines not on this page · raw message
Signature · 1 line
1.7.6.5
PATCH v3 4/10 arm: exynos: Add methods to control power to USB 3.0 PHY
In reply to Vivek GautamAdding methods to turn on/off power to USB3.0 type PHY as and when required by the controller.
---
Changes since v2:
- Nothing.
arch/arm/cpu/armv7/exynos/power.c | 22 ++++++++++++++++++++++ arch/arm/include/asm/arch-exynos/power.h | 5 +++++ 2 files changed, 27 insertions(+), 0 deletions(-)
arch/arm/cpu/armv7/exynos/power.c +22 -0
@@ -59,6 +59,28 @@ void set_usbhost_phy_ctrl(unsigned int enable)exynos5_set_usbhost_phy_ctrl (enable); } +static void exynos5_set_usbdrd_phy_ctrl (unsigned int enable) +{ +struct exynos5_power *power = + (struct exynos5_power *)samsung_get_base_power (); + +if (enable) { +/* Enabling USBDRD_PHY */ +setbits_le32 (&power->usbdrd_phy_control, +POWER_USB_DRD_PHY_CTRL_EN ); + }else { +/* Disabling USBDRD_PHY */ +clrbits_le32 (&power->usbdrd_phy_control, +POWER_USB_DRD_PHY_CTRL_EN ); + } +} + +void set_usbdrd_phy_ctrl (unsigned int enable) +{ +if (cpu_is_exynos5 ()) +exynos5_set_usbdrd_phy_ctrl (enable); +} +static void exynos5_dp_phy_control (unsigned int enable) {unsigned int cfg;
arch/arm/include/asm/arch-exynos/power.h +5 -0
@@ -847,6 +847,11 @@ void set_hw_thermal_trip(void);#define POWER_USB_HOST_PHY_CTRL_EN (1 << 0)#define POWER_USB_HOST_PHY_CTRL_DISABLE (0 << 0) +void set_usbdrd_phy_ctrl (unsigned int enable); + +#define POWER_USB_DRD_PHY_CTRL_EN (1 << 0) +#define POWER_USB_DRD_PHY_CTRL_DISABLE (0 << 0) +void set_dp_phy_ctrl (unsigned int enable);#define EXYNOS_DP_PHY_ENABLE (1 << 0)
Signature · 1 line
1.7.6.5
PATCH v3 5/10 exynos5: dts: Add COMPAT string data for USB 3.0 PHY and XHCI
In reply to Vivek GautamAdding required compatible string for xHCI host controller as well as USB 3.0 PHY to enable dt support for usb 3.0 on exynos5.
---
Changes since v2:
- Nothing.
include/fdtdec.h | 2 ++ lib/fdtdec.c | 2 ++ 2 files changed, 4 insertions(+), 0 deletions(-)
include/fdtdec.h +2 -0
@@ -73,7 +73,9 @@ enum fdt_compat_id {COMPAT_GOOGLE_CROS_EC ,/* Google CROS_EC Protocol */ COMPAT_GOOGLE_CROS_EC_KEYB ,/* Google CROS_EC Keyboard */ COMPAT_SAMSUNG_EXYNOS_EHCI ,/* Exynos EHCI controller */ +COMPAT_SAMSUNG_EXYNOS5_XHCI ,/* Exynos5 XHCI controller */ COMPAT_SAMSUNG_EXYNOS_USB_PHY ,/* Exynos phy controller for usb2.0 */ +COMPAT_SAMSUNG_EXYNOS5_USB3_PHY ,/* Exynos phy controller for usb3.0 */ COMPAT_SAMSUNG_EXYNOS_TMU ,/* Exynos TMU */ COMPAT_SAMSUNG_EXYNOS_FIMD ,/* Exynos Display controller */ COMPAT_SAMSUNG_EXYNOS5_DP, /* Exynos Display port controller */
lib/fdtdec.c +2 -0
@@ -46,7 +46,9 @@ static const char * const compat_names[COMPAT_COUNT] = {COMPAT (GOOGLE_CROS_EC ,"google,cros-ec" ),COMPAT (GOOGLE_CROS_EC_KEYB ,"google,cros-ec-keyb" ),COMPAT (SAMSUNG_EXYNOS_EHCI ,"samsung,exynos-ehci" ), +COMPAT (SAMSUNG_EXYNOS5_XHCI ,"samsung,exynos5250-xhci" ),COMPAT (SAMSUNG_EXYNOS_USB_PHY ,"samsung,exynos-usb-phy" ), +COMPAT (SAMSUNG_EXYNOS5_USB3_PHY ,"samsung,exynos5250-usb3-phy" ),COMPAT (SAMSUNG_EXYNOS_TMU ,"samsung,exynos-tmu" ),COMPAT (SAMSUNG_EXYNOS_FIMD ,"samsung,exynos-fimd" ), COMPAT(SAMSUNG_EXYNOS5_DP, "samsung,exynos5-dp"),
Signature · 1 line
1.7.6.5
PATCH v3 6/10 exynos5: dts: Add device node for XHCI
In reply to Vivek GautamAdding device node for xhci host controller to enable usb 3.0 on exynos5250.
---
Changes since v2:
- Nothing.
arch/arm/dts/exynos5250.dtsi | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-)
arch/arm/dts/exynos5250.dtsi +12 -0
@@ -139,6 +139,18 @@ interrupts = <0 130 0>; }; + xhci at 12000000 { + compatible = "samsung,exynos5250-xhci"; + reg = <0x12000000 0x10000>; + #address-cells = <1>; + #size-cells = <1>; + + phy { + compatible = "samsung,exynos5250-usb3-phy"; + reg = <0x12100000 0x100>; + }; + }; + ehci at 12110000 { compatible = "samsung,exynos-ehci"; reg = <0x12110000 0x100>;
Signature · 1 line
1.7.6.5
PATCH v3 7/10 config: arm: exynos5250: Define CONFIG_SYS_CACHELINE_SIZE
In reply to Vivek GautamXHCI stack driver needs this to align buffers to
CacheLine boundary. So define the same to be '64'
---
Changes since v2:
- Nothing
include/configs/exynos5250-dt.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
include/configs/exynos5250-dt.h +2 -0
@@ -37,6 +37,8 @@/* Keep L2 Cache Disabled */ #define CONFIG_SYS_DCACHE_OFF +#define CONFIG_SYS_CACHELINE_SIZE 64 +/* Enable ACE acceleration for SHA1 and SHA256 */ #define CONFIG_EXYNOS_ACE_SHA #define CONFIG_SHA_HW_ACCEL
Signature · 1 line
1.7.6.5
PATCH v3 8/10 temp: config: exynos5250: Enable xHCI support for Exynos5
In reply to Vivek GautamThis enables support for xHCI host controller on Exynos5 and further disables EHCI support, to make sure only one host controller is enabled at a time, since right now using two controllers at a time is not possible with current usb core infrastructure.
Anyone who wants to enable EHCI support again needs to enable CONFIG_USB_EHCI, CONFIG_USB_EHCI_EXYNOS once again in exynos5-dt config.
---
Changes since v2:
- Eliminating the EHCI configs rather than just commenting them.
include/configs/exynos5250-dt.h | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
include/configs/exynos5250-dt.h +3 -2
@@ -134,8 +134,9 @@/* USB */ #define CONFIG_CMD_USB -#define CONFIG_USB_EHCI -#define CONFIG_USB_EHCI_EXYNOS +#define CONFIG_USB_XHCI +#define CONFIG_USB_XHCI_EXYNOS +#define CONFIG_SYS_USB_XHCI_MAX_ROOT_PORTS 2#define CONFIG_USB_STORAGE /* USB boot mode */
Signature · 1 line
1.7.6.5
PATCH v3 9/10 exynos: usb: Switch USB VBUS GPIOs to be device tree configured
In reply to Vivek GautamFrom: Julius Werner <[email protected]>
Some Exynos boards, such as the SMDK5250, control USB port power through a GPIO pin. For now this had been hardcoded in the exynos5-dt board file, but not all boards use the same pin, requiring local changes to support different boards.
This patch moves the GPIO initialization into the USB host controller drivers which they belong to, and uses the samsung,vbus-gpio parameter in the device tree to configure it.
---
Changes since v2:
- This patch is newly added in this version of the series.
board/samsung/smdk5250/exynos5-dt.c | 19 ------------------- drivers/usb/host/ehci-exynos.c | 11 +++++++++++ drivers/usb/host/xhci-exynos5.c | 11 +++++++++++ 3 files changed, 22 insertions(+), 19 deletions(-)
board/samsung/smdk5250/exynos5-dt.c +0 -19
@@ -61,22 +61,6 @@ struct local_info {static struct local_info local; -#ifdef CONFIG_USB_EHCI_EXYNOS -int board_usb_vbus_init (void ) -{ -struct exynos5_gpio_part1 *gpio1 = (struct exynos5_gpio_part1 *) -samsung_get_base_gpio_part1 (); - -/* Enable VBUS power switch */ -s5p_gpio_direction_output (&gpio1->x2,6 ,1 ); - -/* VBUS turn ON time */ -mdelay (3 ); - -return 0 ; -} -#endif -#ifdef CONFIG_SOUND_MAX98095 static void board_enable_audio_codec (void ) {
@@ -122,9 +106,6 @@ int board_init(void)if (board_init_cros_ec_devices (gd->fdt_blob))return -1 ; -#ifdef CONFIG_USB_EHCI_EXYNOS -board_usb_vbus_init (); -#endif #ifdef CONFIG_SOUND_MAX98095 board_enable_audio_codec ();#endif
drivers/usb/host/ehci-exynos.c +11 -0
@@ -16,6 +16,7 @@#include <asm/arch/ehci.h> #include <asm/arch/system.h> #include <asm/arch/power.h> +#include <asm/gpio.h> #include <asm-generic/errno.h> #include <linux/compat.h> #include "ehci.h"
@@ -30,6 +31,7 @@ DECLARE_GLOBAL_DATA_PTR;struct exynos_ehci {struct exynos_usb_phy *usb;struct ehci_hccr *hcd; +struct fdt_gpio_state vbus_gpio; };static struct exynos_ehci exynos;
@@ -58,6 +60,9 @@ static int exynos_usb_parse_dt(const void *blob, struct exynos_ehci *exynos) exynos->hcd = (struct ehci_hccr *)addr; +/* Vbus gpio */ +fdtdec_decode_gpio (blob, node,"samsung,vbus-gpio" , &exynos->vbus_gpio); + depth =0 ; node =fdtdec_next_compatible_subnode (blob, node,COMPAT_SAMSUNG_EXYNOS_USB_PHY , &depth);
@@ -150,6 +155,12 @@ int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor) ctx->hcd = (struct ehci_hccr *)samsung_get_base_usb_ehci ();#endif +#ifdef CONFIG_OF_CONTROL +/* setup the Vbus gpio here */ +if (!fdtdec_setup_gpio (&ctx->vbus_gpio)) +gpio_direction_output (ctx->vbus_gpio.gpio,1 ); +#endif +setup_usb_phy (ctx->usb); *hccr = ctx->hcd;
drivers/usb/host/xhci-exynos5.c +11 -0
@@ -22,6 +22,7 @@#include <asm/arch/cpu.h> #include <asm/arch/power.h> #include <asm/arch/xhci-exynos.h> +#include <asm/gpio.h> #include <asm-generic/errno.h> #include <linux/compat.h> #include <linux/usb/dwc3.h>
@@ -39,6 +40,7 @@ struct exynos_xhci {struct exynos_usb3_phy *usb3_phy;struct xhci_hccr *hcd;struct dwc3 *dwc3_reg; +struct fdt_gpio_state vbus_gpio; };static struct exynos_xhci exynos;
@@ -66,6 +68,9 @@ static int exynos_usb3_parse_dt(const void *blob, struct exynos_xhci *exynos) } exynos->hcd = (struct xhci_hccr *)addr; +/* Vbus gpio */ +fdtdec_decode_gpio (blob, node,"samsung,vbus-gpio" , &exynos->vbus_gpio); + depth =0 ; node =fdtdec_next_compatible_subnode (blob, node,COMPAT_SAMSUNG_EXYNOS5_USB3_PHY , &depth);
@@ -291,6 +296,12 @@ int xhci_hcd_init(int index, struct xhci_hccr **hccr, struct xhci_hcor **hcor) ctx->dwc3_reg = (struct dwc3 *)((char *)(ctx->hcd) +DWC3_REG_OFFSET ); +#ifdef CONFIG_OF_CONTROL +/* setup the Vbus gpio here */ +if (!fdtdec_setup_gpio (&ctx->vbus_gpio)) +gpio_direction_output (ctx->vbus_gpio.gpio,1 ); +#endif + ret =exynos_xhci_core_init (ctx);if (ret) {puts ("XHCI: failed to initialize controller\n" );
Signature · 1 line
1.7.6.5
PATCH v3 10/10 exynos: dts: Add USB VBUS GPIOs to the device tree
In reply to Vivek GautamFrom: Julius Werner <[email protected]>
This patch adds a new samsung,vbus-gpio parameter to the device tree, in preparation of replacing the currently hardcoded VBUS GPIO mechanism in exynos5-dt.c with a device tree controlled solution, just as it already exists in the Linux kernel.
---
Changes since v2:
- This patch is newly added in this version of the series.
board/samsung/dts/exynos5250-smdk5250.dts | 4 ++++ board/samsung/dts/exynos5250-snow.dts | 8 ++++++++ 2 files changed, 12 insertions(+), 0 deletions(-)
board/samsung/dts/exynos5250-smdk5250.dts +4 -0
@@ -145,4 +145,8 @@ mmc at 12230000 { status = "disabled"; }; + + ehci at 12110000 { + samsung,vbus-gpio = <&gpio 0xbe 0>; /* X26 */ + }; };
board/samsung/dts/exynos5250-snow.dts +8 -0
@@ -109,6 +109,14 @@ status = "disabled"; }; + ehci at 12110000 { + samsung,vbus-gpio = <&gpio 0xb1 0>; /* X11 */ + }; + + xhci at 12000000 { + samsung,vbus-gpio = <&gpio 0xbf 0>; /* X27 */ + }; + tmu at 10060000 { samsung,min-temp = <25>; samsung,max-temp = <125>;
Signature · 1 line
1.7.6.5
v3 cover USB: XHCI: Add xHCI host controller stack driver
In reply to Vivek Gautam+ Marek, Dan, Julius, Simon and Vikas for this cover patch ;-)
Quoted 74 lines · Vivek Gautam
Based on 'master' branch of u-boot-usb tree.
The series also includes patches to support xHCI on exynos5250, including required driver, device tree changes.
Changes since V2:
- Added patch to move 'bmRequestType' (Table 9-2, Ch9) definitions from EHCI header file tousb_defs.hso that XHCI can also use it:
usb: Move 'bmRequestType' USB device request macros from EHCI header
- Added patches to rework the Vbus GPIO setup for ehci and xhci in exynos SoCs:
exynos: usb: Switch USB VBUS GPIOs to be device tree configured
exynos: dts: Add USB VBUS GPIOs to the device tree
- Added the top commit history fordrivers/usb/host/xhci*of Linux kernel version 3.4 from where the xHCI code was initially imported.
- Replaced GPL license with new SPDX license GPL-2.0+.
- Moved this "asm/io.h" file inclusion toxhci.h
- Reworked 'return -1' globally to return meaningful error numbers.
- Added required comment incommon/usb.cfor not calling firstget_descriptorrequest for XHCI.Julius Werner (2):
exynos: usb: Switch USB VBUS GPIOs to be device tree configured
exynos: dts: Add USB VBUS GPIOs to the device treeVivek Gautam (8):
usb: Move 'bmRequestType' USB device request macros from EHCI header
USB: xHCI: Add stack support for xHCI
USB: XHCI: Add xHCI host controller support for Exynos5
arm: exynos: Add methods to control power to USB 3.0 PHY
exynos5: dts: Add COMPAT string data for USB 3.0 PHY and XHCI
exynos5: dts: Add device node for XHCI
config: arm: exynos5250: DefineCONFIG_SYS_CACHELINE_SIZE
temp: config: exynos5250: Enable xHCI support for Exynos5arch/arm/cpu/armv7/exynos/power.c | 22 + arch/arm/dts/exynos5250.dtsi | 12 + arch/arm/include/asm/arch-exynos/cpu.h | 8 + arch/arm/include/asm/arch-exynos/power.h | 5 + arch/arm/include/asm/arch-exynos/xhci-exynos.h | 88 ++ board/samsung/dts/exynos5250-smdk5250.dts | 4 + board/samsung/dts/exynos5250-snow.dts | 8 + board/samsung/smdk5250/exynos5-dt.c | 19 - common/usb.c | 33 +- drivers/usb/host/Makefile | 4 + drivers/usb/host/ehci-exynos.c | 11 + drivers/usb/host/ehci.h | 16 - drivers/usb/host/xhci-exynos5.c | 327 ++++++ drivers/usb/host/xhci-mem.c | 720 ++++++++++++++ drivers/usb/host/xhci-ring.c | 939 ++++++++++++++++++ drivers/usb/host/xhci.c | 1030 +++++++++++++++++++ drivers/usb/host/xhci.h | 1255 ++++++++++++++++++++++++ include/configs/exynos5250-dt.h | 7 +- include/fdtdec.h | 2 + include/linux/usb/dwc3.h | 188 ++++ include/usb.h | 9 +- include/usb_defs.h | 19 + lib/fdtdec.c | 2 + 23 files changed, 4688 insertions(+), 40 deletions(-) create mode 100644 arch/arm/include/asm/arch-exynos/xhci-exynos.h create mode 100644 drivers/usb/host/xhci-exynos5.c create mode 100644 drivers/usb/host/xhci-mem.c create mode 100644 drivers/usb/host/xhci-ring.c create mode 100644 drivers/usb/host/xhci.c create mode 100644 drivers/usb/host/xhci.h create mode 100644 include/linux/usb/dwc3.h--
1.7.6.5_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
Signature · 2 lines
Best Regards Vivek
v3 cover USB: XHCI: Add xHCI host controller stack driver
Hi Minkyu,
do you want to pick the exynos adjustments (04..10/10) via -samsung tree or shall I take the whole set via -usb ? I'd be inclined to the later, since it will make things easier to keep in sync, but it might produce a merge conflict. Nonetheless, I'd like to apply this only for -next.
Thanks!
v3 cover USB: XHCI: Add xHCI host controller stack driver
Dear Marek Vasut,
Quoted 9 lines · Marek Vasut
Hi Minkyu,
do you want to pick the exynos adjustments (04..10/10) via -samsung tree or shall I take the whole set via -usb ? I'd be inclined to the later, since it
will make things easier to keep in sync, but it might produce a merge conflict.
Nonetheless, I'd like to apply this only for -next.
OK.
Please take patchset to -usb.
Quoted 7 lines
Thanks!
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
Thanks,
Minkyu Kang.
Signature · 2 lines
from. prom. www.promsoft.net
v3 cover USB: XHCI: Add xHCI host controller stack driver
In reply to Vivek GautamDear Vivek Gautam,
Quoted 2 lines
+ Marek, Dan, Julius, Simon and Vikas for this cover patch ;-)
[...]
Thanks, I have the patches lined up. Just waiting for Dans' talk with Sarah. Maybe we should put her on CC too next time so she can rip us to shreds for our mistakes in the implementation ? :)
Best regards,
Marek Vasut
v3 cover USB: XHCI: Add xHCI host controller stack driver
Marek
Quoted 4 lines · Marek Vasut
Dear Vivek Gautam,
Quoted 2 lines
+ Marek, Dan, Julius, Simon and Vikas for this cover patch ;-)
Quoted 8 lines
[...]
Thanks, I have the patches lined up. Just waiting for Dans' talk with Sarah. Maybe we should put her on CC too next time so she can rip us to shreds for our mistakes in the implementation ? :)
Best regards,
Marek Vasut
Did you line up the OMAP5 patches as well?
I have verified that v3 of these patches (at least the first 3 with the OMAP5 patches on top are functional.
No changes to the OMAP patches just removed the single header file patch that Vivek graciously fixed in his code.
Dan
Signature · 2 lines
------------------ Dan Murphy
v3 cover USB: XHCI: Add xHCI host controller stack driver
Dear Dan Murphy,
Quoted 18 lines
Marek
Quoted 4 lines · Marek Vasut
Dear Vivek Gautam,
Quoted 1 line
+ Marek, Dan, Julius, Simon and Vikas for this cover patch ;-)
Quoted 8 lines
[...]
Thanks, I have the patches lined up. Just waiting for Dans' talk with Sarah. Maybe we should put her on CC too next time so she can rip us to shreds for our mistakes in the implementation ? :)
Best regards,
Marek VasutDid you line up the OMAP5 patches as well?
Quoted 7 lines
I have verified that v3 of these patches (at least the first 3 with the OMAP5 patches on top are functional.
No changes to the OMAP patches just removed the single header file patch that Vivek graciously fixed in his code.
Tested-by Dan Murphy <[email protected]>
I have no OMAP5, but I'm OK with them too.
Best regards,
Marek Vasut
v3 cover USB: XHCI: Add xHCI host controller stack driver
In reply to Marek VasutHi Marek,
Quoted 9 lines · Marek Vasut
Dear Vivek Gautam,
Quoted 2 lines
+ Marek, Dan, Julius, Simon and Vikas for this cover patch ;-)
[...]
Thanks, I have the patches lined up. Just waiting for Dans' talk with Sarah. Maybe we should put her on CC too next time so she can rip us to shreds for our mistakes in the implementation ? :)
Yeah, of-course. Always welcome for improvements.
Do you want me to CC Sarah here in this thread itself, or should i re-spin the patches keeping her in CC. :-)
Quoted 3 lines
Best regards,
Marek Vasut
Signature · 2 lines
Best Regards Vivek
v3 cover USB: XHCI: Add xHCI host controller stack driver
Dear Vivek Gautam,
Quoted 9 lines
Hi Marek,
Quoted 6 lines · Marek Vasut
Dear Vivek Gautam,
Quoted 1 line
+ Marek, Dan, Julius, Simon and Vikas for this cover patch ;-)
[...]
Quoted 7 lines
Quoted 3 lines
Thanks, I have the patches lined up. Just waiting for Dans' talk with Sarah. Maybe we should put her on CC too next time so she can rip us to shreds for our mistakes in the implementation ? :)
Yeah, of-course. Always welcome for improvements.
Do you want me to CC Sarah here in this thread itself, or should i re-spin the patches keeping her in CC. :-)
Let's wait for Dan a bit.
Best regards,
Marek Vasut
v3 cover USB: XHCI: Add xHCI host controller stack driver
Quoted 15 lines · Marek Vasut
Dear Vivek Gautam,
Quoted 13 lines
Hi Marek,
Quoted 9 lines · Marek Vasut
Dear Vivek Gautam,
Quoted 1 line
+ Marek, Dan, Julius, Simon and Vikas for this cover patch ;-)
[...]
Thanks, I have the patches lined up. Just waiting for Dans' talk with Sarah. Maybe we should put her on CC too next time so she can rip us to shreds for our mistakes in the implementation ? :)
Quoted 5 lines
Quoted 3 lines
Yeah, of-course. Always welcome for improvements.
Do you want me to CC Sarah here in this thread itself, or should i re-spin the patches keeping her in CC. :-)Let's wait for Dan a bit.
Ok
Signature · 2 lines
Best Regards Vivek
v3 cover USB: XHCI: Add xHCI host controller stack driver
Marek
Quoted 11 lines · Vivek Gautam
Quoted 10 lines · Marek Vasut
Dear Vivek Gautam,
Quoted 8 lines
Hi Marek,
Quoted 5 lines · Marek Vasut
Dear Vivek Gautam,
Quoted 1 line
+ Marek, Dan, Julius, Simon and Vikas for this cover patch ;-)
[...]
Quoted 11 lines
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
Thanks, I have the patches lined up. Just waiting for Dans' talk with Sarah. Maybe we should put her on CC too next time so she can rip us to shreds for our mistakes in the implementation ? :)
Yeah, of-course. Always welcome for improvements.
Do you want me to CC Sarah here in this thread itself, or should i re-spin the patches keeping her in CC. :-)Let's wait for Dan a bit.
Ok
I have not received any feedback from Sarah.
So if you want to pull the code in we can and then just fix issues as we move forward.
Dan
Signature · 2 lines
------------------ Dan Murphy
v3 cover USB: XHCI: Add xHCI host controller stack driver
Hi Dan, Vivek,
Quoted 23 lines
Marek
Quoted 20 lines · Vivek Gautam
Quoted 19 lines · Marek Vasut
Dear Vivek Gautam,
Quoted 16 lines
Hi Marek,
Quoted 9 lines · Marek Vasut
Dear Vivek Gautam,
Quoted 1 line
+ Marek, Dan, Julius, Simon and Vikas for this cover patch ;-)
[...]
Thanks, I have the patches lined up. Just waiting for Dans' talk with Sarah. Maybe we should put her on CC too next time so she can rip us to shreds for our mistakes in the implementation ? :)
Yeah, of-course. Always welcome for improvements.
Do you want me to CC Sarah here in this thread itself, or should i re-spin the patches keeping her in CC. :-)
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
Let's wait for Dan a bit.
Ok
I have not received any feedback from Sarah.
So if you want to pull the code in we can and then just fix issues as we move forward.
Applied the XHCI series. Applied OMAP series. Both are in usb/next and pushed. Can you run them and see what's broken?
Thanks!
Best regards,
Marek Vasut