USB: Add support for Xilinx USB host controller
Subsystems (4)
PATCH 1/1 USB: Add support for Xilinx USB host controller
Add bus glue driver for Xilinx USB host controller. The controller can be configured as HS only or HS/FS hybrid. The driver uses the device tree file to configure the driver according to the setting in the hardware system.
This driver has been tested with usbtest using the NET2280 PCI card.
---
V1 - Updated per comments from Benjamin Herrenschmidt
<[email protected]> and Grant Likely <[email protected]>.
--- Documentation/powerpc/dts-bindings/xilinx.txt | 11 + drivers/usb/host/Kconfig | 15 +- drivers/usb/host/ehci-hcd.c | 5 + drivers/usb/host/ehci-xilinx-of.c | 302 +++++++++++++++++++++++++ 4 files changed, 331 insertions(+), 2 deletions(-) create mode 100644 drivers/usb/host/ehci-xilinx-of.c
Documentation/powerpc/dts-bindings/xilinx.txt +11 -0
@@ -292,4 +292,15 @@ - reg-offset : A value of 3 is required - reg-shift : A value of 2 is required + vii) Xilinx USB Host controller + + The Xilinx USB host controller is EHCI compatible but with a different + base address for the EHCI registers, and it is always a big-endian + USB Host controller. The hardware can be configured as high speed only, + or high speed/full speed hybrid. + + Required properties: + - xlnx,support-usb-fs: A value 0 means the core is built as high speed + only. A value 1 means the core also supports + full speed devices.
drivers/usb/host/Kconfig +13 -2
@@ -90,14 +90,25 @@ config USB_EHCI_TT_NEWSCHED config USB_EHCI_BIG_ENDIAN_MMIO bool - depends on USB_EHCI_HCD && (PPC_CELLEB || PPC_PS3 || 440EPX || ARCH_IXP4XX) + depends on USB_EHCI_HCD && (PPC_CELLEB || PPC_PS3 || 440EPX || ARCH_IXP4XX || XPS_USB_HCD_XILINX) default y config USB_EHCI_BIG_ENDIAN_DESC bool - depends on USB_EHCI_HCD && (440EPX || ARCH_IXP4XX) + depends on USB_EHCI_HCD && (440EPX || ARCH_IXP4XX || XPS_USB_HCD_XILINX) default y +config XPS_USB_HCD_XILINX + bool "Use Xilinx usb host EHCI controller core" + depends on USB_EHCI_HCD && (PPC32 || MICROBLAZE) + select USB_EHCI_BIG_ENDIAN_DESC + select USB_EHCI_BIG_ENDIAN_MMIO + ---help--- + Xilinx xps USB host controller core is EHCI compilant and has + transaction translator built-in. It can be configured to either + support both high speed and full speed devices, or high speed + devices only. + config USB_EHCI_FSL bool "Support for Freescale on-chip EHCI USB controller" depends on USB_EHCI_HCD && FSL_SOC
drivers/usb/host/ehci-hcd.c +5 -0
@@ -1107,6 +1107,11 @@ MODULE_LICENSE ("GPL");#define OF_PLATFORM_DRIVER ehci_hcd_ppc_of_driver#endif +#ifdef CONFIG_XPS_USB_HCD_XILINX +#include "ehci-xilinx-of.c" +#define OF_PLATFORM_DRIVER ehci_hcd_xilinx_of_driver +#endif +#ifdef CONFIG_PLAT_ORION #include "ehci-orion.c" #define PLATFORM_DRIVER ehci_orion_driver
drivers/usb/host/ehci-xilinx-of.c new file +302 -0
302 lines not on this page · raw message
Signature · 5 lines
1.5.6.6 This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.
Quoted 2 lines · Julie Zhu
Add bus glue driver for Xilinx USB host controller. The controller can be configured as HS only or HS/FS hybrid. The driver uses the device tree fi=
le
Quoted 1 line
to configure the driver according to the setting in the hardware system.
Looks good, one minor nit....
Quoted 2 lines
+static struct
of_device_idehci_hcd_xilinx_of_match[] =3D {
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 {.compatible =3D "xlnx,xps-usb-host-1.00.a"=
,},
Quoted 1 line
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 {.compatible =3D "xlnx,xps-usb-host-1.01.a"=
,},
Quoted 1 line
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 {.compatible =3D "xlnx,xps-usb-host-1.02.a"=
,},
Quoted 2 lines
+ =A0 =A0 =A0 {},
+};
Ideally, 1.01 and 1.02 device tree nodes would also claim compatibility with the original 1.00.a version (assuming of course that it really is register level compatible) making the 2nd and 3rd lines redundant, but that's just a minor nit and this doesn't hurt anything. Do what you prefer.
Cheers,
g.
--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
drivers/usb/host/ehci-xilinx-of.c line 234
Quoted 3 lines · Julie Zhu
drivers/usb/host/ehci-xilinx-of.c new file +3
-0+iounmap (hcd->regs); +err_ioremap: +irq_dispose_mapping (irq);
You missed that one too :-)
I'm actually considering making irq_dispose_mapping() a private API and rename it to something like __irq_dispose_mapping() :-)
I think the only reasonable use case for it is when re-allocating MSIs to avoid using the whole virq space.
Cheers,
Ben.
Quoted 10 lines · Benjamin Herrenschmidt
drivers/usb/host/ehci-xilinx-of.c line 234
Quoted 3 lines · Julie Zhu
drivers/usb/host/ehci-xilinx-of.c new file +3
-0+iounmap (hcd->regs); +err_ioremap: +irq_dispose_mapping (irq);You missed that one too :-)
I'm actually considering making
irq_dispose_mapping()a private API and rename it to something like__irq_dispose_mapping():-)
I.e. turning irq_dispose_mapping() into nop, and __-prefixed (private) variant would actually dispose irq mapping?
The nop part is important, because otherwise having no cleanup variant of an allocation/mapping routine feels odd and might raise questions by non-ppc people (e.g. subsystem maintainers when they see no cleanup path for such a call).
And if we'll want to refcount irq mappings in the future, some drivers will be ready without modifications, i.e. the ones that got irq_dispose_mapping() wrong:
$ git grep irq_dispose drivers/ | wc -l 42
Thanks,
Signature · 3 lines
Anton Vorontsov email: [email protected] irc://irc.freenode.net/bd2
Quoted 15 lines · Anton Vorontsov
Quoted 10 lines · Benjamin Herrenschmidt
drivers/usb/host/ehci-xilinx-of.c line 234
Quoted 3 lines · Julie Zhu
drivers/usb/host/ehci-xilinx-of.c new file +3
-0+iounmap (hcd->regs); +err_ioremap: +irq_dispose_mapping (irq);You missed that one too :-)
I'm actually considering making
irq_dispose_mapping()a private API and rename it to something like__irq_dispose_mapping():-)I.e. turning
irq_dispose_mapping()into nop, and __-prefixed (private) variant would actually dispose irq mapping?
Quoted 8 lines
The nop part is important, because otherwise having no cleanup variant of an allocation/mapping routine feels odd and might raise questions by non-ppc people (e.g. subsystem maintainers when they see no cleanup path for such a call).
And if we'll want to refcount irq mappings in the future, some drivers will be ready without modifications, i.e. the ones that got
irq_dispose_mapping()wrong:
Yup. I agree. I'll look into it
Ben.