1 --- a/drivers/usb/host/ehci-hcd.c
2 +++ b/drivers/usb/host/ehci-hcd.c
3 @@ -1342,6 +1342,7 @@ MODULE_LICENSE ("GPL");
4 !IS_ENABLED(CONFIG_USB_EHCI_HCD_PLATFORM) && \
5 !IS_ENABLED(CONFIG_USB_CHIPIDEA_HOST) && \
6 !IS_ENABLED(CONFIG_USB_EHCI_MXC) && \
7 + !IS_ENABLED(CONFIG_USB_EHCI_CNS21XX) && \
8 !defined(PLATFORM_DRIVER) && \
9 !defined(PS3_SYSTEM_BUS_DRIVER) && \
10 !defined(OF_PLATFORM_DRIVER) && \
12 +++ b/drivers/usb/host/ehci-cns21xx.c
15 + * Copyright (c) 2008 Cavium Networks
16 + * Copyright (c) 2010-2013 Gabor Juhos <juhosg@openwrt.org>
18 + * This file is free software; you can redistribute it and/or modify
19 + * it under the terms of the GNU General Public License, Version 2, as
20 + * published by the Free Software Foundation.
23 +#include <linux/kernel.h>
24 +#include <linux/module.h>
25 +#include <linux/io.h>
26 +#include <linux/platform_device.h>
27 +#include <linux/irq.h>
28 +#include <linux/usb.h>
29 +#include <linux/usb/hcd.h>
31 +#include <mach/cns21xx.h>
35 +#define DRIVER_NAME "cns21xx-ehci"
37 +static const char hcd_name[] = "ehci-cns21xx";
38 +static struct hc_driver __read_mostly ehci_cns21xx_hc_driver;
40 +static void ehci_cns21xx_init_hc(void)
42 + void __iomem *base = (void __iomem *) CNS21XX_EHCI_CONFIG_BASE_VIRT;
44 + __raw_writel(0x106, base + 0x04);
45 + __raw_writel((3 << 5) | 0x2000, base + 0x40);
49 +static int ehci_cns21xx_probe(struct platform_device *pdev)
51 + struct usb_hcd *hcd;
52 + struct ehci_hcd *ehci;
53 + struct resource *res;
57 + irq = platform_get_irq(pdev, 0);
59 + dev_dbg(&pdev->dev, "no IRQ specified for %s\n",
60 + dev_name(&pdev->dev));
64 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
66 + dev_dbg(&pdev->dev, "no base address specified for %s\n",
67 + dev_name(&pdev->dev));
71 + hcd = usb_create_hcd(&ehci_cns21xx_hc_driver, &pdev->dev,
72 + dev_name(&pdev->dev));
76 + hcd->rsrc_start = res->start;
77 + hcd->rsrc_len = res->end - res->start + 1;
79 + hcd->regs = devm_ioremap_resource(&pdev->dev, res);
80 + if (IS_ERR(hcd->regs)) {
81 + ret = PTR_ERR(hcd->regs);
85 + ehci_cns21xx_init_hc();
87 + ehci = hcd_to_ehci(hcd);
88 + ehci->caps = hcd->regs;
90 + ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
94 + platform_set_drvdata(pdev, hcd);
104 +static int ehci_cns21xx_remove(struct platform_device *pdev)
106 + struct usb_hcd *hcd = platform_get_drvdata(pdev);
108 + usb_remove_hcd(hcd);
114 +static struct platform_driver ehci_cns21xx_driver = {
115 + .probe = ehci_cns21xx_probe,
116 + .remove = ehci_cns21xx_remove,
117 + .shutdown = usb_hcd_platform_shutdown,
119 + .owner = THIS_MODULE,
120 + .name = DRIVER_NAME,
124 +static int __init ehci_cns21xx_init(void)
126 + if (usb_disabled())
129 + ehci_init_driver(&ehci_cns21xx_hc_driver, NULL);
131 + return platform_driver_register(&ehci_cns21xx_driver);
133 +module_init(ehci_cns21xx_init);
135 +static void __exit ehci_cns21xx_exit(void)
137 + platform_driver_unregister(&ehci_cns21xx_driver);
139 +module_exit(ehci_cns21xx_exit);
141 +MODULE_DESCRIPTION("Cavium Networks CNS21xx built-in EHCI controller driver");
142 +MODULE_ALIAS("platform:" DRIVER_NAME);
143 +MODULE_LICENSE("GPL v2");
144 --- a/arch/arm/Kconfig
145 +++ b/arch/arm/Kconfig
146 @@ -382,6 +382,7 @@ config ARCH_CNS21XX
147 select ARCH_REQUIRE_GPIOLIB
148 select ARM_L1_CACHE_SHIFT_4
149 select USB_ARCH_HAS_OHCI
150 + select USB_ARCH_HAS_EHCI
152 Support for Cavium Networks CNS21xx family.
154 --- a/drivers/usb/host/Kconfig
155 +++ b/drivers/usb/host/Kconfig
156 @@ -219,6 +219,14 @@ config USB_W90X900_EHCI
158 Enables support for the W90X900 USB controller
160 +config USB_EHCI_CNS21XX
161 + tristate "EHCI support for the Cavium CNS21XX SoCs"
162 + depends on ARCH_CNS21XX
165 + Enables support for the built-in EHCI controller of the
166 + Cavium CNS21xx SoCs.
168 config USB_CNS3XXX_EHCI
169 bool "Cavium CNS3XXX EHCI Module (DEPRECATED)"
170 depends on USB_EHCI_HCD && ARCH_CNS3XXX
171 --- a/drivers/usb/host/Makefile
172 +++ b/drivers/usb/host/Makefile
173 @@ -27,6 +27,7 @@ obj-$(CONFIG_USB_EHCI_HCD) += ehci-hcd.o
174 obj-$(CONFIG_USB_EHCI_PCI) += ehci-pci.o
175 obj-$(CONFIG_USB_EHCI_HCD_PLATFORM) += ehci-platform.o
176 obj-$(CONFIG_USB_EHCI_MXC) += ehci-mxc.o
177 +obj-$(CONFIG_USB_EHCI_CNS21XX) += ehci-cns21xx.o
179 obj-$(CONFIG_USB_OXU210HP_HCD) += oxu210hp-hcd.o
180 obj-$(CONFIG_USB_ISP116X_HCD) += isp116x-hcd.o