USB: XHCI: Add xHCI host controller stack driver
Subsystems (5)
cover USB: XHCI: Add xHCI host controller stack driver
This change adds necessary xHCI host controller stack layer. This stack will eventually interact with SoC specific USB 3.0 controller drivers to enable USB 3.0 support on different boards.
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 and a temporary config change to test things finally on smdk5250.
Vivek Gautam (7):
arm: exynos5250: Define CONFIG_SYS_CACHELINE_SIZE
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
temp: ARM: EXYNOS5: 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 | 90 ++ common/usb.c | 27 +- drivers/usb/host/Makefile | 4 + drivers/usb/host/xhci-exynos5.c | 324 ++++++ drivers/usb/host/xhci-mem.c | 731 ++++++++++++++ drivers/usb/host/xhci-ring.c | 899 +++++++++++++++++ drivers/usb/host/xhci.c | 1040 +++++++++++++++++++ drivers/usb/host/xhci.h | 1281 ++++++++++++++++++++++++ include/configs/exynos5250-dt.h | 7 + include/fdtdec.h | 2 + include/linux/usb/dwc3.h | 190 ++++ include/usb.h | 9 +- lib/fdtdec.c | 2 + 17 files changed, 4650 insertions(+), 3 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 1/7 arm: exynos5250: Define CONFIG_SYS_CACHELINE_SIZE
XHCI stack driver needs this to align buffers to
CacheLine boundary. So define the same to be '64'
--- include/configs/exynos5250-dt.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
include/configs/exynos5250-dt.h +2 -0
@@ -54,6 +54,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 2/7 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.
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.
--- common/usb.c | 27 +- drivers/usb/host/Makefile | 3 + drivers/usb/host/xhci-mem.c | 731 ++++++++++++++++++++++++ drivers/usb/host/xhci-ring.c | 899 +++++++++++++++++++++++++++++ drivers/usb/host/xhci.c | 1040 ++++++++++++++++++++++++++++++++++ drivers/usb/host/xhci.h | 1281 ++++++++++++++++++++++++++++++++++++++++++ include/usb.h | 9 +- 7 files changed, 3987 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 +25 -2
@@ -818,6 +818,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..
@@ -830,6 +840,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 ;
@@ -860,7 +881,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;
@@ -877,6 +898,7 @@ int usb_new_device(struct usb_device *dev) dev->epmaxpacketin[0 ] =64 ; dev->epmaxpacketout[0 ] =64 ; +#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" );
@@ -889,11 +911,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
@@ -58,6 +58,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 +731 -0
731 lines not on this page · raw message
drivers/usb/host/xhci-ring.c new file +899 -0
899 lines not on this page · raw message
drivers/usb/host/xhci.c new file +1040 -0
1,040 lines not on this page · raw message
drivers/usb/host/xhci.h new file +1281 -0
260 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 3/7 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.
--- arch/arm/include/asm/arch-exynos/cpu.h | 8 + arch/arm/include/asm/arch-exynos/xhci-exynos.h | 90 +++++++ drivers/usb/host/Makefile | 1 + drivers/usb/host/xhci-exynos5.c | 324 ++++++++++++++++++++++++ include/linux/usb/dwc3.h | 190 ++++++++++++++ 5 files changed, 613 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
@@ -64,6 +64,8 @@#define EXYNOS4_DP_BASE DEVICE_NOT_AVAILABLE#define EXYNOS4_SPI_ISP_BASE DEVICE_NOT_AVAILABLE#define EXYNOS4_ACE_SFR_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
@@ -99,6 +101,8 @@#define EXYNOS4X12_SPI_BASE DEVICE_NOT_AVAILABLE#define EXYNOS4X12_SPI_ISP_BASE DEVICE_NOT_AVAILABLE#define EXYNOS4X12_ACE_SFR_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
@@ -118,6 +122,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
@@ -232,7 +238,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 +90 -0
90 lines not on this page · raw message
drivers/usb/host/Makefile +1 -0
@@ -60,6 +60,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 +324 -0
324 lines not on this page · raw message
include/linux/usb/dwc3.h new file +190 -0
190 lines not on this page · raw message
Signature · 1 line
1.7.6.5
PATCH 4/7 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.
--- 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
@@ -75,6 +75,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
@@ -863,6 +863,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 5/7 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.
--- include/fdtdec.h | 2 ++ lib/fdtdec.c | 2 ++ 2 files changed, 4 insertions(+), 0 deletions(-)
include/fdtdec.h +2 -0
@@ -87,7 +87,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
@@ -60,7 +60,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 6/7 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.
--- 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 7/7 temp: ARM: EXYNOS5: 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.
--- include/configs/exynos5250-dt.h | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
include/configs/exynos5250-dt.h +5 -0
@@ -150,8 +150,13 @@/* 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
cover USB: XHCI: Add xHCI host controller stack driver
In reply to Vivek GautamVivek
Quoted 36 lines · Vivek Gautam
This change adds necessary xHCI host controller stack layer. This stack will eventually interact with SoC specific USB 3.0 controller drivers to enable USB 3.0 support on different boards.
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 and a temporary config change to test things finally on smdk5250.
Vivek Gautam (7):
arm: exynos5250: DefineCONFIG_SYS_CACHELINE_SIZE
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
temp: ARM: EXYNOS5: 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 | 90 ++ common/usb.c | 27 +- drivers/usb/host/Makefile | 4 + drivers/usb/host/xhci-exynos5.c | 324 ++++++ drivers/usb/host/xhci-mem.c | 731 ++++++++++++++ drivers/usb/host/xhci-ring.c | 899 +++++++++++++++++ drivers/usb/host/xhci.c | 1040 +++++++++++++++++++ drivers/usb/host/xhci.h | 1281 ++++++++++++++++++++++++ include/configs/exynos5250-dt.h | 7 + include/fdtdec.h | 2 + include/linux/usb/dwc3.h | 190 ++++ include/usb.h | 9 +- lib/fdtdec.c | 2 +
Quoted 9 lines
17 files changed, 4650 insertions(+), 3 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
I have done similar work for the DWC and xHCI back port. We seem to have two different implementations.
See my V3 patch series. If you want the initial patch sets or v2 let me know.
http://patchwork.ozlabs.org/patch/256451/
http://patchwork.ozlabs.org/patch/256449/
3/7 is waiting approval
http://patchwork.ozlabs.org/patch/256452/
http://patchwork.ozlabs.org/patch/256450/
6/7 is waiting approval
http://patchwork.ozlabs.org/patch/256453/
Marek
Please let us know which xHCI/DWC implementation you would like to have in main line.
Dan
Signature · 2 lines
------------------ Dan Murphy
cover USB: XHCI: Add xHCI host controller stack driver
Dear Dan Murphy,
Quoted 61 lines
Vivek
Quoted 37 lines · Vivek Gautam
This change adds necessary xHCI host controller stack layer. This stack will eventually interact with SoC specific USB 3.0 controller drivers to enable USB 3.0 support on different boards.
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 and a temporary config change to test things finally on smdk5250.
Vivek Gautam (7):
arm: exynos5250: DefineCONFIG_SYS_CACHELINE_SIZE
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
temp: ARM: EXYNOS5: 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 | 90 ++ common/usb.c | 27 +- drivers/usb/host/Makefile | 4 + drivers/usb/host/xhci-exynos5.c | 324 ++++++ drivers/usb/host/xhci-mem.c | 731 ++++++++++++++ drivers/usb/host/xhci-ring.c | 899 +++++++++++++++++ drivers/usb/host/xhci.c | 1040 +++++++++++++++++++ drivers/usb/host/xhci.h | 1281 ++++++++++++++++++++++++ include/configs/exynos5250-dt.h | 7 + include/fdtdec.h | 2 + include/linux/usb/dwc3.h | 190 ++++ include/usb.h | 9 +- lib/fdtdec.c | 2 +Quoted 8 lines
17 files changed, 4650 insertions(+), 3 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.hI have done similar work for the DWC and xHCI back port. We seem to have two different implementations.
See my V3 patch series. If you want the initial patch sets or v2 let me know. http://patchwork.ozlabs.org/patch/256451/
http://patchwork.ozlabs.org/patch/256449/
3/7 is waiting approval
http://patchwork.ozlabs.org/patch/256452/
http://patchwork.ozlabs.org/patch/256450/
6/7 is waiting approval
http://patchwork.ozlabs.org/patch/256453/
Quoted 4 lines
Marek
Please let us know which xHCI/DWC implementation you would like to have in main line.
I'd like you two to have a discussion, of course we're not having two separate stacks. So far, Dans' stack looks better, since it can be nicely re-synced with Linux and it fairy contained. On the other hand, I like how Vivek's stack is so small in size and Vivek worked on it for a long time now, so it's already fairy well debugged.
What I'd like to see is Vivek's version merged into Dan's version, that should be easy (by the looks of it) and then this combined version merged mainline. This should hopefully retain the easy possibility to update the USB3 code from Linux. It should also cut down the time it will take to get Dan's code into working state (since that's done in Vivek's tree already).
Now you can flame me to death.
Best regards,
Marek Vasut
cover USB: XHCI: Add xHCI host controller stack driver
Hi Marek,
Quoted 65 lines · Marek Vasut
Dear Dan Murphy,
Quoted 63 lines
Vivek
Quoted 37 lines · Vivek Gautam
This change adds necessary xHCI host controller stack layer. This stack will eventually interact with SoC specific USB 3.0 controller drivers to enable USB 3.0 support on different boards.
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 and a temporary config change to test things finally on smdk5250.
Vivek Gautam (7):
arm: exynos5250: DefineCONFIG_SYS_CACHELINE_SIZE
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
temp: ARM: EXYNOS5: 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 | 90 ++ common/usb.c | 27 +- drivers/usb/host/Makefile | 4 + drivers/usb/host/xhci-exynos5.c | 324 ++++++ drivers/usb/host/xhci-mem.c | 731 ++++++++++++++ drivers/usb/host/xhci-ring.c | 899 +++++++++++++++++ drivers/usb/host/xhci.c | 1040 +++++++++++++++++++ drivers/usb/host/xhci.h | 1281 ++++++++++++++++++++++++ include/configs/exynos5250-dt.h | 7 + include/fdtdec.h | 2 + include/linux/usb/dwc3.h | 190 ++++ include/usb.h | 9 +- lib/fdtdec.c | 2 +Quoted 8 lines
17 files changed, 4650 insertions(+), 3 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.hI have done similar work for the DWC and xHCI back port. We seem to have two different implementations.
See my V3 patch series. If you want the initial patch sets or v2 let me know. http://patchwork.ozlabs.org/patch/256451/
http://patchwork.ozlabs.org/patch/256449/
3/7 is waiting approval
http://patchwork.ozlabs.org/patch/256452/
http://patchwork.ozlabs.org/patch/256450/
6/7 is waiting approval
http://patchwork.ozlabs.org/patch/256453/Marek
Quoted 8 lines
Quoted 2 lines
Please let us know which xHCI/DWC implementation you would like to have in main line.
I'd like you two to have a discussion, of course we're not having two separate stacks. So far, Dans' stack looks better, since it can be nicely re-synced with Linux and it fairy contained. On the other hand, I like how Vivek's stack is so small in size and Vivek worked on it for a long time now, so it's already fairy well debugged.
Very well said. I can see Dan's stack is nicely sync'ed with Linux (with ifdef's ;-) which i am sure are going to vanish down the line) I had a initial look at Dan's patches, which have backported DWC3 and XHCI, but i am sure we are going to
need some amount of code to be put in usb core framework (common/usb*.c), if we are going to enable complete xHCI (super speed) support.
For DWC3, i leave it to you, as to how much code we want to pull in. Ofcourse my driver for exynos did some basic DWC3 initialization, making it hard for other vendors who are using DWC3 to resuse the code.
Quoted 6 lines
What I'd like to see is Vivek's version merged into Dan's version, that should be easy (by the looks of it) and then this combined version merged mainline. This should hopefully retain the easy possibility to update the USB3 code from Linux. It should also cut down the time it will take to get Dan's code into working state (since that's done in Vivek's tree already).
We can go ahead merging the two versions. But i do have few doubts with how Dan is
structuring things.
Better i comment on his patches and clear my doubts.
Dear Dan,
Please suggest on how you are planning going ahead and merging the two versions of xHCI stack.
Quoted 2 lines
Now you can flame me to death.
Signature · 2 lines
Best Regards Vivek
cover USB: XHCI: Add xHCI host controller stack driver
Hi Vivek,
[...]
Quoted 6 lines
Very well said. I can see Dan's stack is nicely sync'ed with Linux (with ifdef's ;-) which i am sure are going to vanish down the line) I had a initial look at Dan's patches, which have backported DWC3 and XHCI, but i am sure we are going to
need some amount of code to be put in usb core framework (common/usb*.c), if we are going to enable complete xHCI (super speed) support.
Absolutely, you have that part though ;-)
Quoted 3 lines
For DWC3, i leave it to you, as to how much code we want to pull in. Ofcourse my driver for exynos did some basic DWC3 initialization, making it hard for other vendors who are using DWC3 to resuse the code.
Exynos also uses dwc3 ?
Quoted 11 lines
Quoted 6 lines
What I'd like to see is Vivek's version merged into Dan's version, that should be easy (by the looks of it) and then this combined version merged mainline. This should hopefully retain the easy possibility to update the USB3 code from Linux. It should also cut down the time it will take to get Dan's code into working state (since that's done in Vivek's tree already).
We can go ahead merging the two versions. But i do have few doubts with how Dan is
structuring things.
Better i comment on his patches and clear my doubts.
Thanks.
Quoted 6 lines
Dear Dan,
Please suggest on how you are planning going ahead and merging the two versions of xHCI stack.
Quoted 1 line
Now you can flame me to death.
Best regards,
Marek Vasut
cover USB: XHCI: Add xHCI host controller stack driver
In reply to Vivek GautamVivek
Quoted 5 lines · Vivek Gautam
Dear Dan,
Please suggest on how you are planning going ahead and merging the two versions of xHCI stack.
<snip>
Sorry for the delay on the reply US holiday.
I need to dive into your code and see exactly what you were doing and how to meld the two code bases together.
If we could get the basic XHCI stack running from the kernel then at least the OMAP and Exynos can share the same code base like in the kernel.
Please go ahead and pick apart the xHCI patches that I sent in for RFC.
Dan
Quoted 4 lines
Quoted 1 line
Now you can flame me to death.
Signature · 2 lines
------------------ Dan Murphy
cover USB: XHCI: Add xHCI host controller stack driver
Hi Dan,
I've just had a quick glance over the patches you referenced, so please let me know if I'm making wrong assumptions. Your approach seems to be to copy the relevant drivers (especially the whole XHCI stack) from Linux whole and then make as few modifications as possible to make them run under U-Boot. Is the code you posted actually functional in its current state, i.e. can you access USB devices through an XHCI controller?
I think you would need to make major architectural changes to the driver stack to make it functional under U-Boot. Linux assumes an asynchronous, interrupt-driven event model where multiple USB transfers can be enqueued/completed in parallel. Without interrupts and kernel threads/completions, you will essentially have to rework the whole event handling to use some kind of polling mechanism and eventually get back to the single-fire, synchronous USB transfers that the U-Boot USB core stack expects. Your approach seems to be focused on changing as little as possible, but I fear that by the time you have a working solution you will have made so many changes that simply "syncing back up" to a new release of Linux will be very hard. You will also need to take the whole nightmare of cache invalidation into account which Linux easily side-steps through uncacheable memory mappings (and maintain correctness when you pull in new updates from it).
Vivek has started out with the same Linux stack, but then cut away everything that wasn't essential to U-Boot's requirements, reducing code size and complexity to a more manageable chunk. I think in the long run it would be easier to have a smaller stack that we have to maintain ourselves than trying to keep a copy of Linux in sync that has still been so heavily modified that it takes a lot of effort to backport stuff. I have worked with Vivek's stack and can confirm that it's reasonably fast and functional... there are still a few buggy edge cases here and there, but at least USB storage and network booting works with all devices we tested.
I don't know very much about the gadget side which you also seem to be tackling, but I wouldn't be surprised if you are going to have a hard time with the same issues there as well (interrupt/event model, data cache consistency). Abstracting out the DWC3 stuff and sharing it between Exynos/OMAP/... certainly sounds sensible, although I think that when you cut away all the non-U-Boot-relevant parts there may only be one or two dozen lines left to share.
Just my two cents.
cover USB: XHCI: Add xHCI host controller stack driver
Julius
Quoted 45 lines · Julius Werner
Hi Dan,
I've just had a quick glance over the patches you referenced, so please let me know if I'm making wrong assumptions. Your approach seems to be to copy the relevant drivers (especially the whole XHCI stack) from Linux whole and then make as few modifications as possible to make them run under U-Boot. Is the code you posted actually functional in its current state, i.e. can you access USB devices through an XHCI controller?
I think you would need to make major architectural changes to the driver stack to make it functional under U-Boot. Linux assumes an asynchronous, interrupt-driven event model where multiple USB transfers can be enqueued/completed in parallel. Without interrupts and kernel threads/completions, you will essentially have to rework the whole event handling to use some kind of polling mechanism and eventually get back to the single-fire, synchronous USB transfers that the U-Boot USB core stack expects. Your approach seems to be focused on changing as little as possible, but I fear that by the time you have a working solution you will have made so many changes that simply "syncing back up" to a new release of Linux will be very hard. You will also need to take the whole nightmare of cache invalidation into account which Linux easily side-steps through uncacheable memory mappings (and maintain correctness when you pull in new updates from it).
Vivek has started out with the same Linux stack, but then cut away everything that wasn't essential to U-Boot's requirements, reducing code size and complexity to a more manageable chunk. I think in the long run it would be easier to have a smaller stack that we have to maintain ourselves than trying to keep a copy of Linux in sync that has still been so heavily modified that it takes a lot of effort to backport stuff. I have worked with Vivek's stack and can confirm that it's reasonably fast and functional... there are still a few buggy edge cases here and there, but at least USB storage and network booting works with all devices we tested.
I don't know very much about the gadget side which you also seem to be tackling, but I wouldn't be surprised if you are going to have a hard time with the same issues there as well (interrupt/event model, data cache consistency). Abstracting out the DWC3 stuff and sharing it between Exynos/OMAP/... certainly sounds sensible, although I think that when you cut away all the non-U-Boot-relevant parts there may only be one or two dozen lines left to share.
Quoted 1 line
Just my two cents.
There is nothing you said that I will debate.
There are definite architectural issues in back porting the xHCI linux stack back to uBoot. And we do have to consider the size of the code stack as well.
I would honestly like to see the dwc code broken out like the musb-new code was broken out. As Vivek pointed out the DWC3 was done for exynos only so we should make that more general anyway. We do have a working gadget implementation on the DWC but the patch set is not ready for prime time.
There is also some USB header problems that I tried to address in RFC
http://patchwork.ozlabs.org/patch/256451/
Feedback is always welcome on this as this has a direct impact on this code set.
What I will attempt to do is take my dwc patches and rebase Vivek's xhci code on top of that to see the issues.
Dan
Signature · 2 lines
------------------ Dan Murphy
cover USB: XHCI: Add xHCI host controller stack driver
In reply to Vivek GautamVivek
Quoted 36 lines · Vivek Gautam
This change adds necessary xHCI host controller stack layer. This stack will eventually interact with SoC specific USB 3.0 controller drivers to enable USB 3.0 support on different boards.
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 and a temporary config change to test things finally on smdk5250.
Vivek Gautam (7):
arm: exynos5250: DefineCONFIG_SYS_CACHELINE_SIZE
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
temp: ARM: EXYNOS5: 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 | 90 ++ common/usb.c | 27 +- drivers/usb/host/Makefile | 4 + drivers/usb/host/xhci-exynos5.c | 324 ++++++ drivers/usb/host/xhci-mem.c | 731 ++++++++++++++ drivers/usb/host/xhci-ring.c | 899 +++++++++++++++++ drivers/usb/host/xhci.c | 1040 +++++++++++++++++++ drivers/usb/host/xhci.h | 1281 ++++++++++++++++++++++++ include/configs/exynos5250-dt.h | 7 + include/fdtdec.h | 2 + include/linux/usb/dwc3.h | 190 ++++ include/usb.h | 9 +- lib/fdtdec.c | 2 +
Quoted 9 lines
17 files changed, 4650 insertions(+), 3 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
Did you have an updated patch set for the xHCI code?
I have a working implementation on top of this patchset for the OMAP5 device.
So we probably should go with this patch set instead of trying to back port the full xHCI stack from the kernel.
Dan
Signature · 2 lines
------------------ Dan Murphy
cover USB: XHCI: Add xHCI host controller stack driver
Hi Dan,
Quoted 48 lines · Dan Murphy
Vivek
Quoted 36 lines · Vivek Gautam
This change adds necessary xHCI host controller stack layer. This stack will eventually interact with SoC specific USB 3.0 controller drivers to enable USB 3.0 support on different boards.
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 and a temporary config change to test things finally on smdk5250.
Vivek Gautam (7):
arm: exynos5250: DefineCONFIG_SYS_CACHELINE_SIZE
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
temp: ARM: EXYNOS5: 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 | 90 ++ common/usb.c | 27 +- drivers/usb/host/Makefile | 4 + drivers/usb/host/xhci-exynos5.c | 324 ++++++ drivers/usb/host/xhci-mem.c | 731 ++++++++++++++ drivers/usb/host/xhci-ring.c | 899 +++++++++++++++++ drivers/usb/host/xhci.c | 1040 +++++++++++++++++++ drivers/usb/host/xhci.h | 1281 ++++++++++++++++++++++++ include/configs/exynos5250-dt.h | 7 + include/fdtdec.h | 2 + include/linux/usb/dwc3.h | 190 ++++ include/usb.h | 9 +- lib/fdtdec.c | 2 +Quoted 9 lines
17 files changed, 4650 insertions(+), 3 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
Quoted 1 line
Did you have an updated patch set for the xHCI code?
At this point of time, we would have one or two fixes on top of this version of patches for xHCI.
I can post those patches patches based on this series, so that you can just pick up those. But they are
more of some BUG case handling and all.
Quoted 2 lines
I have a working implementation on top of this patchset for the OMAP5 device.
Great!! so may be once you are ready you can post, and i can add the exynos part to the dwc3 and test things at my end.
Quoted 2 lines
So we probably should go with this patch set instead of trying to back port the full xHCI stack from the kernel.
Cool.
Quoted 11 lines
Dan
--
------------------
Dan Murphy_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
Signature · 2 lines
Best Regards Vivek
cover USB: XHCI: Add xHCI host controller stack driver
Vivek
On 07/31/2013 08:55 AM, Vivek Gautam wrote:
<snip>
Quoted 6 lines
Did you have an updated patch set for the xHCI code?
At this point of time, we would have one or two fixes on top of this version of patches for xHCI.
I can post those patches patches based on this series, so that you can just pick up those. But they are
more of some BUG case handling and all.
Great! Please cc me on these and I can pick them up directly. I have one change in the xhci.h file where I had to add the
#include <asm/io.h>
Because readl and writel were giving me an implicit declaration warning when building.
I have other comments on the code but nothing operational more nit picky. I will wait for the updated patchset
Quoted 3 lines
Quoted 1 line
I have a working implementation on top of this patchset for the OMAP5 device.
Great!! so may be once you are ready you can post, and i can add the exynos part to the dwc3 and test things at my end.
Well for now we can keep the dwc code where it is in the processor specific files.
The dwc work will take a little bit of time and I would prefer to have the xHCI stack pulled in and rework the omap and exynos xhci files when the dwc code was brought in.
Quoted 15 lines
Quoted 1 line
So we probably should go with this patch set instead of trying to back port the full xHCI stack from the kernel.
Cool.
Quoted 10 lines
Dan
--
------------------
Dan Murphy_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
Signature · 2 lines
------------------ Dan Murphy