Skip to contentSkip to conversation

USB: EHCI: make ehci-spear a separate driver

PATCH Superseded Alan Stern 1 participant 1 message Feb 20, 2013 1 message not in the archive

lore
Share & tools
lore

Alan Stern

author
#1 lore raw

PATCH v2 1/8 USB: EHCI: make ehci-spear a separate driver

In reply to a message not in the archive
Quoted 9 lines · Manjunath Goudar

Separate the SPEAr host controller driver from ehci-hcd host code into its own driver module.

In V2:
Replaced spear as SPEAr everywhere, leaving functions/variables/config options.

drivers/usb/host/Kconfig config USB_EHCI_HCD_OMAP · line 171

Quoted 10 lines
drivers/usb/host/Kconfig +7 -0
@@ -162,6 +162,14 @@ config USB_EHCI_HCD_OMAP
 	  Enables support for the on-chip EHCI controller on
 	  OMAP3 and later chips.
 
+config USB_EHCI_HCD_SPEAR
+        tristate "Support for ST SPEAr on-chip EHCI USB controller"
+        depends on USB_EHCI_HCD && PLAT_SPEAR
+        default y
+        ---help---
+          Enables support for the on-chip EHCI controller on
+          ST SPEAr chips.

Is it a good idea to make this option interactive? That might cause people to disable it by mistake.

drivers/usb/host/Makefile obj-$(CONFIG_USB_EHCI_HCD) += ehci-hcd.o · line 30

Quoted 8 lines
drivers/usb/host/Makefile +1 -1
@@ -27,7 +27,7 @@ obj-$(CONFIG_USB_EHCI_HCD)	+= ehci-hcd.o
 obj-$(CONFIG_USB_EHCI_PCI)	+= ehci-pci.o
 obj-$(CONFIG_USB_EHCI_HCD_PLATFORM)	+= ehci-platform.o
 obj-$(CONFIG_USB_EHCI_MXC)	+= ehci-mxc.o
-
+obj-$(CONFIG_USB_EHCI_HCD_SPEAR)+= ehci-spear.o

Please don't eliminate the blank line that separates the EHCI drivers from the following non-EHCI drivers.

Quoted 10 lines
drivers/usb/host/Makefile +0 -0
 obj-$(CONFIG_USB_OXU210HP_HCD)	+= oxu210hp-hcd.o
 obj-$(CONFIG_USB_ISP116X_HCD)	+= isp116x-hcd.o
 obj-$(CONFIG_USB_ISP1362_HCD)	+= isp1362-hcd.o
drivers/usb/host/ehci-spear.c +1 -0
 
+static const char hcd_name[] = "ehci-SPEAr";

drivers/usb/host/ehci-spear.c static struct platform_driver spear_ehci_hcd_driver = { · line 191

Quoted 5 lines
drivers/usb/host/ehci-spear.c +1 -1
@@ -209,11 +188,35 @@ static struct platform_driver spear_ehci_hcd_driver = {
 	.remove		= spear_ehci_hcd_drv_remove,
 	.shutdown	= usb_hcd_platform_shutdown,
 	.driver		= {
-		.name = "spear-ehci",
+		.name = hcd_name,

You must not change the driver's name. It won't work on non-DT systems; the platform bus relies on matching drivers to devices by comparing their names.

drivers/usb/host/ehci-spear.c static struct platform_driver spear_ehci_hcd_driver = { · line 219

Quoted 7 lines
drivers/usb/host/ehci-spear.c +0 -1
 		.bus = &platform_bus_type,
 		.pm = &ehci_spear_pm_ops,
 		.of_match_table = of_match_ptr(spear_ehci_id_table),
 	}
 };
 
-MODULE_ALIAS("platform:spear-ehci");

You must not remove the MODULE_ALIAS.

drivers/usb/host/ehci-spear.c static struct platform_driver spear_ehci_hcd_driver = { · line 200

Quoted 3 lines
drivers/usb/host/ehci-spear.c +3 -0
+static const struct ehci_driver_overrides spear_overrides __initdata = {
+	.reset = ehci_spear_setup,
+};

You forgot to use the .extra_priv_size field. It will allow the driver to be simplified by storing the "clk" field of struct spear_ehci in the private part of the ehci_hcd structure.

Also, you can completely eliminate the ehci_spear_setup routine if you move the lines

	/* registers start at offset 0x0 */
	ehci->caps = hcd->regs;

into spear_ehci_hcd_drv_probe.

drivers/usb/host/ehci-spear.c static struct platform_driver spear_ehci_hcd_driver = { · line 202

Quoted 2 lines
drivers/usb/host/ehci-spear.c +2 -0
+MODULE_DESCRIPTION(DRIVER_DESC);
+MODULE_LICENSE("GPL");

There probably should be a MODULE_AUTHOR field, yes?

Alan Stern