Skip to contentSkip to conversation

ARM: vt8500: Update vt8500-ehci driver to support device tree.

PATCH Superseded Tony Prisk 3 participants 5 messages Jul 20, 2012 – Jul 21, 2012

Subsystems (7)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Tony Prisk

author
#0 lore raw

PATCH v2 1/2 ARM: vt8500: Update vt8500-ehci driver to support device tree.

---
 .../devicetree/bindings/usb/vt8500-ehci.txt        |   10 ++++++++++
 drivers/usb/host/ehci-vt8500.c                     |    9 +++++++++
 2 files changed, 19 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/vt8500-ehci.txt
Documentation/devicetree/bindings/usb/vt8500-ehci.txt new file +10 -0
new file mode 100644
index 0000000..74f75c6
@@ -0,0 +1,10 @@
+VIA VT8500 and Wondermedia WM8xxx SoC USB controllers.
+
+Required properties:
+ - compatible: Should be "via,vt8500-ehci" or "wm,prizm-ehci".
+
+usb: ehci at D8007100 {
+	compatible = "wm,prizm-ehci", "usb-ehci";
+	reg = <0xD8007100 0x200>;
+	interrupts = <1>;
+};
drivers/usb/host/ehci-vt8500.c +9 -0
index c1eda73..4ba8f0c 100644
@@ -16,6 +16,7 @@
  *
  */
 
+#include <linux/of.h>
 #include <linux/platform_device.h>
 
 static int ehci_update_device(struct usb_hcd *hcd, struct usb_device *udev)
@@ -162,6 +163,12 @@ static int vt8500_ehci_drv_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static const struct of_device_id vt8500_ehci_ids[] = {
+	{ .compatible = "via,vt8500-ehci", },
+	{ .compatible = "wm,prizm-ehci", },
+	{}
+};
+
 static struct platform_driver vt8500_ehci_driver = {
 	.probe		= vt8500_ehci_drv_probe,
 	.remove		= vt8500_ehci_drv_remove,
@@ -169,7 +176,9 @@ static struct platform_driver vt8500_ehci_driver = {
 	.driver = {
 		.name	= "vt8500-ehci",
 		.owner	= THIS_MODULE,
+		.of_match_table = of_match_ptr(vt8500_ehci_ids),
 	}
 };
 
 MODULE_ALIAS("platform:vt8500-ehci");
+MODULE_DEVICE_TABLE(of, vt8500_ehci_ids);
Signature · 1 line
1.7.2.5
author
#1 lore raw

PATCH v2 2/2 ARM: vt8500: Add support for UHCI companion controller

Add support for a generic non-pci UHCI companion controller. Existing board files for arch-vt8500 updated to include UHCI support.

---
 arch/arm/mach-vt8500/devices-vt8500.c |    5 +
 arch/arm/mach-vt8500/devices-wm8505.c |    4 +
 arch/arm/mach-vt8500/devices.c        |   11 +++
 arch/arm/mach-vt8500/devices.h        |    1 +
 drivers/usb/host/Kconfig              |   12 ++-
 drivers/usb/host/uhci-hcd.c           |    5 +
 drivers/usb/host/uhci-platform.c      |  157 +++++++++++++++++++++++++++++++++
 7 files changed, 193 insertions(+), 2 deletions(-)
 create mode 100644 drivers/usb/host/uhci-platform.c
arch/arm/mach-vt8500/devices-vt8500.c +5 -0
index 19519ae..def7fe3 100644
@@ -48,6 +48,11 @@ void __init vt8500_set_resources(void)
 	tmp[1] = wmt_irq_res(IRQ_EHCI);
 	wmt_res_add(&vt8500_device_ehci, tmp, 2);
 
+	/* vt8500 uses a single IRQ for both EHCI and UHCI controllers */
+	tmp[0] = wmt_mmio_res(VT8500_UHCI_BASE, SZ_512);
+	tmp[1] = wmt_irq_res(IRQ_EHCI);
+	wmt_res_add(&vt8500_device_uhci, tmp, 2);
+
 	tmp[0] = wmt_mmio_res(VT8500_GEGEA_BASE, SZ_256);
 	wmt_res_add(&vt8500_device_ge_rops, tmp, 1);
 
arch/arm/mach-vt8500/devices-wm8505.c +4 -0
index db4594e..c810454 100644
@@ -55,6 +55,10 @@ void __init wm8505_set_resources(void)
 	tmp[1] = wmt_irq_res(IRQ_EHCI);
 	wmt_res_add(&vt8500_device_ehci, tmp, 2);
 
+	tmp[0] = wmt_mmio_res(WM8505_UHCI_BASE, SZ_512);
+	tmp[1] = wmt_irq_res(IRQ_UHCI);
+	wmt_res_add(&vt8500_device_uhci, tmp, 2);
+
 	tmp[0] = wmt_mmio_res(WM8505_GEGEA_BASE, SZ_256);
 	wmt_res_add(&vt8500_device_ge_rops, tmp, 1);
 
arch/arm/mach-vt8500/devices.c +11 -0
index 1fcdc36..46ff82d 100644
@@ -204,6 +204,17 @@ struct platform_device vt8500_device_ehci = {
 	},
 };
 
+static u64 uhci_dma_mask = DMA_BIT_MASK(32);
+
+struct platform_device vt8500_device_uhci = {
+	.name		= "platform-uhci",
+	.id		= 0,
+	.dev		= {
+		.dma_mask	= &uhci_dma_mask,
+		.coherent_dma_mask = DMA_BIT_MASK(32),
+	},
+};
+
 struct platform_device vt8500_device_ge_rops = {
 	.name		= "wmt_ge_rops",
 	.id		= -1,
arch/arm/mach-vt8500/devices.h +1 -0
index 188d4e1..0e6d9f9 100644
@@ -81,6 +81,7 @@ extern struct platform_device vt8500_device_uart5;
 extern struct platform_device vt8500_device_lcdc;
 extern struct platform_device vt8500_device_wm8505_fb;
 extern struct platform_device vt8500_device_ehci;
+extern struct platform_device vt8500_device_uhci;
 extern struct platform_device vt8500_device_ge_rops;
 extern struct platform_device vt8500_device_pwm;
 extern struct platform_device vt8500_device_pwmbl;
drivers/usb/host/Kconfig +10 -2
index 83e58df..3d153d0 100644
@@ -450,7 +450,7 @@ config USB_OHCI_LITTLE_ENDIAN
 
 config USB_UHCI_HCD
 	tristate "UHCI HCD (most Intel and VIA) support"
-	depends on USB && (PCI || SPARC_LEON)
+	depends on USB && (PCI || SPARC_LEON || ARCH_VT8500)
 	---help---
 	  The Universal Host Controller Interface is a standard by Intel for
 	  accessing the USB hardware in the PC (which is also called the USB
@@ -468,7 +468,15 @@ config USB_UHCI_HCD
 config USB_UHCI_SUPPORT_NON_PCI_HC
 	bool
 	depends on USB_UHCI_HCD
-	default y if SPARC_LEON
+	default y if (SPARC_LEON || ARCH_VT8500)
+
+config USB_UHCI_PLATFORM
+	bool "Generic UHCI Platform Driver support"
+	depends on USB_UHCI_SUPPORT_NON_PCI_HC
+	default y if ARCH_VT8500
+	---help---
+	  Enable support for generic UHCI platform devices that require no
+	  additional configuration.
 
 config USB_UHCI_BIG_ENDIAN_MMIO
 	bool
drivers/usb/host/uhci-hcd.c +5 -0
index e4db350..4b9e9ab 100644
@@ -846,6 +846,11 @@ static const char hcd_name[] = "uhci_hcd";
 #define PLATFORM_DRIVER		uhci_grlib_driver
 #endif
 
+#ifdef CONFIG_USB_UHCI_PLATFORM
+#include "uhci-platform.c"
+#define PLATFORM_DRIVER		uhci_platform_driver
+#endif
+
 #if !defined(PCI_DRIVER) && !defined(PLATFORM_DRIVER)
 #error "missing bus glue for uhci-hcd"
 #endif
drivers/usb/host/uhci-platform.c new file +157 -0

157 lines not on this page · raw message

Signature · 1 line
1.7.2.5
#2 lore raw

PATCH v2 2/2 ARM: vt8500: Add support for UHCI companion controller

Quoted 5 lines · Tony Prisk

Add support for a generic non-pci UHCI companion controller. Existing board files for arch-vt8500 updated to include UHCI support.

Looks almost good, but

* please add a binding document
* cc the maintainers and usb mailing list
* the "of-uhci" string does not seem appropriate:

drivers/usb/host/uhci-platform.c line 146

Quoted 4 lines
drivers/usb/host/uhci-platform.c new file +4 -0
+static const struct of_device_id platform_uhci_ids[] = {
+	{ .compatible = "of-uhci", },
+	{}
+};

The of- part is clearly meaningless in the binding that is about of devices. Using usb-uhci would be more appropriate I think, but maybe someone can come up with an even better name. Which consortium or company created uhci?

Arnd

#3 lore raw

PATCH v2 2/2 ARM: vt8500: Add support for UHCI companion controller

Hello.

Quoted 9 lines · Arnd Bergmann

drivers/usb/host/uhci-platform.c line 146

Quoted 4 lines
drivers/usb/host/uhci-platform.c new file +4 -0
+static const struct of_device_id platform_uhci_ids[] = {
+	{ .compatible = "of-uhci", },
+	{}
+};

The of- part is clearly meaningless in the binding that is about of devices. Using usb-uhci would be more appropriate I think, but maybe someone can come up with an even better name. Which consortium or company created uhci?

UHCI is Intel's spec.

WBR, Sergei

#4 lore raw

PATCH v2 1/2 ARM: vt8500: Update vt8500-ehci driver to support device tree.

In reply to Tony Prisk
Quoted 6 lines · Tony Prisk
---
 .../devicetree/bindings/usb/vt8500-ehci.txt        |   10 ++++++++++
 drivers/usb/host/ehci-vt8500.c                     |    9 +++++++++
 2 files changed, 19 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/vt8500-ehci.txt

As mentioned, you need to Cc the USB mailing list and the EHCI maintainers:

$ ./scripts/get_maintainer.pl drivers/usb/host/ehci-vt8500.c -f
Alan Stern <[email protected]> (maintainer:USB EHCI DRIVER)
Greg Kroah-Hartman <[email protected]> (supporter:USB SUBSYSTEM)
linux-usb at vger.kernel.org (open list:USB EHCI DRIVER)
linux-kernel at vger.kernel.org (open list)

Documentation/devicetree/bindings/usb/vt8500-ehci.txt line 4

Quoted 10 lines
Documentation/devicetree/bindings/usb/vt8500-ehci.txt new file +4 -0
new file mode 100644
index 0000000..74f75c6
@@ -0,0 +1,10 @@
+VIA VT8500 and Wondermedia WM8xxx SoC USB controllers.
+
+Required properties:
+ - compatible: Should be "via,vt8500-ehci" or "wm,prizm-ehci".

I would list the interrupts and reg properties as required as well, and you can mention that there must be exactly one interrupt and one reg resource with a length of 0x200 bytes.

Arnd