1 --- a/drivers/usb/host/ohci-hcd.c
2 +++ b/drivers/usb/host/ohci-hcd.c
3 @@ -589,7 +589,6 @@ static int ohci_run (struct ohci_hcd *oh
5 /* boot firmware should have set this up (5.1.1.3.1) */
8 val = ohci_readl (ohci, &ohci->regs->fminterval);
9 ohci->fminterval = val & 0x3fff;
10 if (ohci->fminterval != FI)
11 @@ -673,6 +672,9 @@ retry:
13 periodic_reinit (ohci);
15 + if (ohci->flags & OHCI_QUIRK_INIT_FMINTERVAL)
16 + ohci_writel (ohci, ohci->fminterval, &ohci->regs->fminterval);
18 /* some OHCI implementations are finicky about how they init.
19 * bogus values here mean not even enumeration could work.
21 @@ -1067,6 +1069,11 @@ MODULE_LICENSE ("GPL");
22 #define PLATFORM_DRIVER ohci_hcd_da8xx_driver
25 +#ifdef CONFIG_ARCH_CNS21XX
26 +#include "ohci-cns21xx.c"
27 +#define PLATFORM_DRIVER ohci_cns21xx_driver
30 #if defined(CONFIG_CPU_SUBTYPE_SH7720) || \
31 defined(CONFIG_CPU_SUBTYPE_SH7721) || \
32 defined(CONFIG_CPU_SUBTYPE_SH7763) || \
34 +++ b/drivers/usb/host/ohci-cns21xx.c
37 + * Copyright (c) 2008 Cavium Networks
38 + * Copyright (c) 2010 Gabor Juhos <juhosg@openwrt.org>
40 + * This file is free software; you can redistribute it and/or modify
41 + * it under the terms of the GNU General Public License, Version 2, as
42 + * published by the Free Software Foundation.
45 +#include <linux/platform_device.h>
47 +#include <mach/cns21xx.h>
49 +#define DRIVER_NAME "cns21xx-ohci"
51 +static int __devinit cns21xx_ohci_start(struct usb_hcd *hcd)
53 + struct ohci_hcd *ohci = hcd_to_ohci(hcd);
56 + ret = ohci_init(ohci);
60 + ret = ohci_run(ohci);
62 + err("can't start %s", ohci_to_hcd(ohci)->self.bus_name);
73 +static const struct hc_driver ohci_cns21xx_hc_driver = {
74 + .description = hcd_name,
75 + .product_desc = "cns21xx-ohci",
76 + .hcd_priv_size = sizeof(struct ohci_hcd),
79 + * generic hardware linkage
82 + .flags = HCD_USB11 | HCD_MEMORY,
85 + * basic lifecycle operations
87 + .start = cns21xx_ohci_start,
89 + .shutdown = ohci_shutdown,
92 + * managing i/o requests and associated device resources
94 + .urb_enqueue = ohci_urb_enqueue,
95 + .urb_dequeue = ohci_urb_dequeue,
96 + .endpoint_disable = ohci_endpoint_disable,
99 + * scheduling support
101 + .get_frame_number = ohci_get_frame,
106 + .hub_status_data = ohci_hub_status_data,
107 + .hub_control = ohci_hub_control,
108 + .start_port_reset = ohci_start_port_reset,
111 +static void cns21xx_ohci_init_hc(void)
113 + __raw_writel(0x146, CNS21XX_OHCI_CONFIG_BASE_VIRT + 0x04);
114 + __raw_writel(0x200, CNS21XX_OHCI_CONFIG_BASE_VIRT + 0x44);
118 +static int ohci_cns21xx_probe(struct platform_device *pdev)
120 + struct usb_hcd *hcd;
121 + struct resource *res;
122 + struct ohci_hcd *ohci;
126 + if (usb_disabled())
129 + res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
131 + dev_dbg(&pdev->dev, "no IRQ specified for %s\n",
132 + dev_name(&pdev->dev));
137 + hcd = usb_create_hcd(&ohci_cns21xx_hc_driver, &pdev->dev,
138 + dev_name(&pdev->dev));
142 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
144 + dev_dbg(&pdev->dev, "no base address specified for %s\n",
145 + dev_name(&pdev->dev));
149 + hcd->rsrc_start = res->start;
150 + hcd->rsrc_len = res->end - res->start + 1;
152 + if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
153 + dev_dbg(&pdev->dev, "controller already in use\n");
158 + hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
160 + dev_dbg(&pdev->dev, "error mapping memory\n");
162 + goto err_release_region;
165 + cns21xx_ohci_init_hc();
167 + ohci = hcd_to_ohci(hcd);
168 + ohci->flags |= OHCI_QUIRK_INIT_FMINTERVAL;
169 + ohci_hcd_init(ohci);
171 + ret = usb_add_hcd(hcd, irq, IRQF_DISABLED);
175 + platform_set_drvdata(pdev, hcd);
179 + iounmap(hcd->regs);
181 + release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
187 +static int ohci_cns21xx_remove(struct platform_device *pdev)
189 + struct usb_hcd *hcd = platform_get_drvdata(pdev);
191 + usb_remove_hcd(hcd);
192 + iounmap(hcd->regs);
193 + release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
195 + platform_set_drvdata(pdev, NULL);
200 +static struct platform_driver ohci_cns21xx_driver = {
201 + .probe = ohci_cns21xx_probe,
202 + .remove = ohci_cns21xx_remove,
203 + .shutdown = usb_hcd_platform_shutdown,
205 + .owner = THIS_MODULE,
206 + .name = DRIVER_NAME,
210 +MODULE_ALIAS("platform:" DRIVER_NAME);
211 --- a/drivers/usb/host/ohci.h
212 +++ b/drivers/usb/host/ohci.h
213 @@ -404,6 +404,7 @@ struct ohci_hcd {
214 #define OHCI_QUIRK_AMD_ISO 0x200 /* ISO transfers*/
215 #define OHCI_QUIRK_AMD_PREFETCH 0x400 /* pre-fetch for ISO transfer */
216 #define OHCI_QUIRK_SHUTDOWN 0x800 /* nVidia power bug */
217 +#define OHCI_QUIRK_INIT_FMINTERVAL 0x1000 /* fminterval must be initialized */
218 // there are also chip quirks/bugs in init logic
220 struct work_struct nec_work; /* Worker for NEC quirk */
221 --- a/arch/arm/Kconfig
222 +++ b/arch/arm/Kconfig
223 @@ -299,6 +299,7 @@ config ARCH_CNS21XX
225 select ARCH_REQUIRE_GPIOLIB
226 select ARM_L1_CACHE_SHIFT_4
227 + select USB_ARCH_HAS_OHCI
229 Support for Cavium Networks CNS21xx family.