From: Manjunath Goudar manjunath.gou...@linaro.org
Separate the Atmel host controller driver from ehci-hcd host code
so that it can be built as a separate driver module.
This work is part of enabling multi-platform kernels on ARM;
however, note that other changes are still needed before Atmel can be
booted with a multi-platform kernel. This is currently planned for
Linux-3.11.
With the infrastructure added by Alan Stern in patch 3e0232039
USB: EHCI: prepare to make ehci-hcd a library module, we can
avoid this problem by turning a bus glue into a separate
module, as we do here for the Atmel bus glue.
In V3:
-Detailed commit message added here about why this patch is required.
-Replaced hcd_name string ehci-atmel to atmel-ehci.
-In Makefile inserted Blank line that separates the EHCI drivers from the
following non-EHCI drivers.
-Export ehci_shutdown symbol as it is needed by the Atmel driver.
-Eliminated ehci_atmel_setup routine beacuse hcd registers
directly setting in ehci_atmel_drv_probe function.
In V2:
Resolved below compiler error.
drivers/usb/host/ehci-atmel.c: In function 'ehci_atmel_drv_remove':
drivers/usb/host/ehci-atmel.c:167: error: implicit declaration of function
'ehci_shutdown'
Signed-off-by: Manjunath Goudar manjunath.gou...@linaro.org
Cc: Alan Stern st...@rowland.harvard.edu
Cc: Greg KH g...@kroah.com
Cc: Andrew Victor li...@maxim.org.za
Cc: Nicolas Ferre nicolas.fe...@atmel.com
Cc: Jean-Christophe Plagniol-Villard plagn...@jcrosoft.com
Cc: linux-usb@vger.kernel.org
Cc: linux-ker...@vger.kernel.org
Signed-off-by: Arnd Bergmann a...@arndb.de
---
drivers/usb/host/Kconfig | 8
drivers/usb/host/Makefile | 1 +
drivers/usb/host/ehci-atmel.c | 85 ---
drivers/usb/host/ehci-hcd.c | 6 +--
4 files changed, 50 insertions(+), 50 deletions(-)
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 01c1acb..8c564aa 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -181,6 +181,14 @@ config USB_EHCI_HCD_SPEAR
Enables support for the on-chip EHCI controller on
ST SPEAr chips.
+config USB_EHCI_HCD_AT91
+tristate Support for Atmel on-chip EHCI USB controller
+depends on USB_EHCI_HCD ARCH_AT91
+default y
+---help---
+ Enables support for the on-chip EHCI controller on
+ Atmel chips.
+
config USB_EHCI_MSM
bool Support for MSM on-chip EHCI USB controller
depends on USB_EHCI_HCD ARCH_MSM
diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
index 3d895b5..368d3eb 100644
--- a/drivers/usb/host/Makefile
+++ b/drivers/usb/host/Makefile
@@ -31,6 +31,7 @@ obj-$(CONFIG_USB_EHCI_HCD_OMAP) += ehci-omap.o
obj-$(CONFIG_USB_EHCI_HCD_ORION) += ehci-orion.o
obj-$(CONFIG_USB_EHCI_HCD_SPEAR) += ehci-spear.o
obj-$(CONFIG_USB_EHCI_S5P) += ehci-s5p.o
+obj-$(CONFIG_USB_EHCI_HCD_AT91) += ehci-atmel.o
obj-$(CONFIG_USB_OXU210HP_HCD) += oxu210hp-hcd.o
obj-$(CONFIG_USB_ISP116X_HCD) += isp116x-hcd.o
diff --git a/drivers/usb/host/ehci-atmel.c b/drivers/usb/host/ehci-atmel.c
index f3beac4..9ce1217 100644
--- a/drivers/usb/host/ehci-atmel.c
+++ b/drivers/usb/host/ehci-atmel.c
@@ -15,6 +15,19 @@
#include linux/platform_device.h
#include linux/of.h
#include linux/of_platform.h
+#include linux/kernel.h
+#include linux/module.h
+#include linux/usb.h
+#include linux/usb/hcd.h
+#include linux/io.h
+#include linux/dma-mapping.h
+
+#include ehci.h
+
+#define DRIVER_DESC EHCI atmel driver
+
+static const char hcd_name[] = ehci-atmel;
+static struct hc_driver __read_mostly ehci_atmel_hc_driver;
/* interface and function clocks */
static struct clk *iclk, *fclk;
@@ -50,51 +63,6 @@ static void atmel_stop_ehci(struct platform_device *pdev)
/*-*/
-static int ehci_atmel_setup(struct usb_hcd *hcd)
-{
- struct ehci_hcd *ehci = hcd_to_ehci(hcd);
-
- /* registers start at offset 0x0 */
- ehci-caps = hcd-regs;
-
- return ehci_setup(hcd);
-}
-
-static const struct hc_driver ehci_atmel_hc_driver = {
- .description= hcd_name,
- .product_desc = Atmel EHCI UHP HS,
- .hcd_priv_size = sizeof(struct ehci_hcd),
-
- /* generic hardware linkage */
- .irq= ehci_irq,
- .flags = HCD_MEMORY | HCD_USB2,
-
- /* basic lifecycle operations */
- .reset = ehci_atmel_setup,
- .start = ehci_run,
- .stop = ehci_stop,
- .shutdown = ehci_shutdown,
-
- /* managing i/o requests and associated device resources */
- .urb_enqueue= ehci_urb_enqueue,
- .urb_dequeue= ehci_urb_dequeue,
- .endpoint_disable = ehci_endpoint_disable,
- .endpoint_reset = ehci_endpoint_reset,
-
-