[generic] add some missing 2.6.39 kernel symbols observed on x86/generic builds
[openwrt.git] / target / linux / cns21xx / patches-2.6.36 / 103-cns21xx-usb-ohci-support.patch
1 --- a/drivers/usb/host/ohci-hcd.c
2 +++ b/drivers/usb/host/ohci-hcd.c
3 @@ -583,7 +583,6 @@ static int ohci_run (struct ohci_hcd *oh
4
5 /* boot firmware should have set this up (5.1.1.3.1) */
6 if (first) {
7 -
8 val = ohci_readl (ohci, &ohci->regs->fminterval);
9 ohci->fminterval = val & 0x3fff;
10 if (ohci->fminterval != FI)
11 @@ -667,6 +666,9 @@ retry:
12
13 periodic_reinit (ohci);
14
15 + if (ohci->flags & OHCI_QUIRK_INIT_FMINTERVAL)
16 + ohci_writel (ohci, ohci->fminterval, &ohci->regs->fminterval);
17 +
18 /* some OHCI implementations are finicky about how they init.
19 * bogus values here mean not even enumeration could work.
20 */
21 @@ -1061,6 +1063,11 @@ MODULE_LICENSE ("GPL");
22 #define PLATFORM_DRIVER ohci_hcd_da8xx_driver
23 #endif
24
25 +#ifdef CONFIG_ARCH_CNS21XX
26 +#include "ohci-cns21xx.c"
27 +#define PLATFORM_DRIVER ohci_cns21xx_driver
28 +#endif
29 +
30 #if defined(CONFIG_CPU_SUBTYPE_SH7720) || \
31 defined(CONFIG_CPU_SUBTYPE_SH7721) || \
32 defined(CONFIG_CPU_SUBTYPE_SH7763) || \
33 --- /dev/null
34 +++ b/drivers/usb/host/ohci-cns21xx.c
35 @@ -0,0 +1,175 @@
36 +/*
37 + * Copyright (c) 2008 Cavium Networks
38 + * Copyright (c) 2010 Gabor Juhos <juhosg@openwrt.org>
39 + *
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.
43 + */
44 +
45 +#include <linux/platform_device.h>
46 +
47 +#include <mach/cns21xx.h>
48 +
49 +#define DRIVER_NAME "cns21xx-ohci"
50 +
51 +static int __devinit cns21xx_ohci_start(struct usb_hcd *hcd)
52 +{
53 + struct ohci_hcd *ohci = hcd_to_ohci(hcd);
54 + int ret;
55 +
56 + ret = ohci_init(ohci);
57 + if (ret)
58 + return ret;
59 +
60 + ret = ohci_run(ohci);
61 + if (ret) {
62 + err("can't start %s", ohci_to_hcd(ohci)->self.bus_name);
63 + goto err;
64 + }
65 +
66 + return 0;
67 +
68 +err:
69 + ohci_stop(hcd);
70 + return ret;
71 +}
72 +
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),
77 +
78 + /*
79 + * generic hardware linkage
80 + */
81 + .irq = ohci_irq,
82 + .flags = HCD_USB11 | HCD_MEMORY,
83 +
84 + /*
85 + * basic lifecycle operations
86 + */
87 + .start = cns21xx_ohci_start,
88 + .stop = ohci_stop,
89 + .shutdown = ohci_shutdown,
90 +
91 + /*
92 + * managing i/o requests and associated device resources
93 + */
94 + .urb_enqueue = ohci_urb_enqueue,
95 + .urb_dequeue = ohci_urb_dequeue,
96 + .endpoint_disable = ohci_endpoint_disable,
97 +
98 + /*
99 + * scheduling support
100 + */
101 + .get_frame_number = ohci_get_frame,
102 +
103 + /*
104 + * root hub support
105 + */
106 + .hub_status_data = ohci_hub_status_data,
107 + .hub_control = ohci_hub_control,
108 + .start_port_reset = ohci_start_port_reset,
109 +};
110 +
111 +static void cns21xx_ohci_init_hc(void)
112 +{
113 + __raw_writel(0x146, CNS21XX_OHCI_CONFIG_BASE_VIRT + 0x04);
114 + __raw_writel(0x200, CNS21XX_OHCI_CONFIG_BASE_VIRT + 0x44);
115 + msleep(100);
116 +}
117 +
118 +static int ohci_cns21xx_probe(struct platform_device *pdev)
119 +{
120 + struct usb_hcd *hcd;
121 + struct resource *res;
122 + struct ohci_hcd *ohci;
123 + int irq;
124 + int ret;
125 +
126 + if (usb_disabled())
127 + return -ENODEV;
128 +
129 + res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
130 + if (!res) {
131 + dev_dbg(&pdev->dev, "no IRQ specified for %s\n",
132 + dev_name(&pdev->dev));
133 + return -ENODEV;
134 + }
135 + irq = res->start;
136 +
137 + hcd = usb_create_hcd(&ohci_cns21xx_hc_driver, &pdev->dev,
138 + dev_name(&pdev->dev));
139 + if (!hcd)
140 + return -ENOMEM;
141 +
142 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
143 + if (!res) {
144 + dev_dbg(&pdev->dev, "no base address specified for %s\n",
145 + dev_name(&pdev->dev));
146 + ret = -ENODEV;
147 + goto err_put_hcd;
148 + }
149 + hcd->rsrc_start = res->start;
150 + hcd->rsrc_len = res->end - res->start + 1;
151 +
152 + if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
153 + dev_dbg(&pdev->dev, "controller already in use\n");
154 + ret = -EBUSY;
155 + goto err_put_hcd;
156 + }
157 +
158 + hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
159 + if (!hcd->regs) {
160 + dev_dbg(&pdev->dev, "error mapping memory\n");
161 + ret = -EFAULT;
162 + goto err_release_region;
163 + }
164 +
165 + cns21xx_ohci_init_hc();
166 +
167 + ohci = hcd_to_ohci(hcd);
168 + ohci->flags |= OHCI_QUIRK_INIT_FMINTERVAL;
169 + ohci_hcd_init(ohci);
170 +
171 + ret = usb_add_hcd(hcd, irq, IRQF_DISABLED);
172 + if (ret)
173 + goto err_unmap;
174 +
175 + platform_set_drvdata(pdev, hcd);
176 + return 0;
177 +
178 +err_unmap:
179 + iounmap(hcd->regs);
180 +err_release_region:
181 + release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
182 +err_put_hcd:
183 + usb_put_hcd(hcd);
184 + return ret;
185 +}
186 +
187 +static int ohci_cns21xx_remove(struct platform_device *pdev)
188 +{
189 + struct usb_hcd *hcd = platform_get_drvdata(pdev);
190 +
191 + usb_remove_hcd(hcd);
192 + iounmap(hcd->regs);
193 + release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
194 + usb_put_hcd(hcd);
195 + platform_set_drvdata(pdev, NULL);
196 +
197 + return 0;
198 +}
199 +
200 +static struct platform_driver ohci_cns21xx_driver = {
201 + .probe = ohci_cns21xx_probe,
202 + .remove = ohci_cns21xx_remove,
203 + .shutdown = usb_hcd_platform_shutdown,
204 + .driver = {
205 + .owner = THIS_MODULE,
206 + .name = DRIVER_NAME,
207 + },
208 +};
209 +
210 +MODULE_ALIAS("platform:" DRIVER_NAME);
211 --- a/drivers/usb/host/ohci.h
212 +++ b/drivers/usb/host/ohci.h
213 @@ -403,6 +403,7 @@ struct ohci_hcd {
214 #define OHCI_QUIRK_HUB_POWER 0x100 /* distrust firmware power/oc setup */
215 #define OHCI_QUIRK_AMD_ISO 0x200 /* ISO transfers*/
216 #define OHCI_QUIRK_AMD_PREFETCH 0x400 /* pre-fetch for ISO transfer */
217 +#define OHCI_QUIRK_INIT_FMINTERVAL 0x800 /* fminterval must be initialized */
218 // there are also chip quirks/bugs in init logic
219
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
224 select PLAT_FA_GPIO
225 select ARCH_REQUIRE_GPIOLIB
226 select ARM_L1_CACHE_SHIFT_4
227 + select USB_ARCH_HAS_OHCI
228 help
229 Support for Cavium Networks CNS21xx family.
230
This page took 0.052606 seconds and 5 git commands to generate.