aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2010-08-10 07:22:08 -0400
committerJiri Kosina <jkosina@suse.cz>2010-08-10 07:22:08 -0400
commitfb8231a8b139035476f2a8aaac837d0099b66dad (patch)
tree2875806beb96ea0cdab292146767a5085721dc6a /drivers/usb
parent426d31071ac476ea62c62656b242930c17b58c00 (diff)
parentf6cec0ae58c17522a7bc4e2f39dae19f199ab534 (diff)
Merge branch 'master' into for-next
Conflicts: arch/arm/mach-omap1/board-nokia770.c
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/Kconfig3
-rw-r--r--drivers/usb/gadget/f_audio.c6
-rw-r--r--drivers/usb/gadget/fsl_qe_udc.c1
-rw-r--r--drivers/usb/gadget/gmidi.c2
-rw-r--r--drivers/usb/host/ohci-hcd.c7
-rw-r--r--drivers/usb/host/ohci-jz4740.c276
-rw-r--r--drivers/usb/host/sl811_cs.c24
7 files changed, 299 insertions, 20 deletions
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index 6a58cb1330c..4aa00e6e57a 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -45,7 +45,8 @@ config USB_ARCH_HAS_OHCI
45 default y if STB03xxx 45 default y if STB03xxx
46 default y if PPC_MPC52xx 46 default y if PPC_MPC52xx
47 # MIPS: 47 # MIPS:
48 default y if SOC_AU1X00 48 default y if MIPS_ALCHEMY
49 default y if MACH_JZ4740
49 # SH: 50 # SH:
50 default y if CPU_SUBTYPE_SH7720 51 default y if CPU_SUBTYPE_SH7720
51 default y if CPU_SUBTYPE_SH7721 52 default y if CPU_SUBTYPE_SH7721
diff --git a/drivers/usb/gadget/f_audio.c b/drivers/usb/gadget/f_audio.c
index b91115f84b1..1f48ceb55a7 100644
--- a/drivers/usb/gadget/f_audio.c
+++ b/drivers/usb/gadget/f_audio.c
@@ -61,7 +61,7 @@ DECLARE_UAC_AC_HEADER_DESCRIPTOR(2);
61#define UAC_DT_TOTAL_LENGTH (UAC_DT_AC_HEADER_LENGTH + UAC_DT_INPUT_TERMINAL_SIZE \ 61#define UAC_DT_TOTAL_LENGTH (UAC_DT_AC_HEADER_LENGTH + UAC_DT_INPUT_TERMINAL_SIZE \
62 + UAC_DT_OUTPUT_TERMINAL_SIZE + UAC_DT_FEATURE_UNIT_SIZE(0)) 62 + UAC_DT_OUTPUT_TERMINAL_SIZE + UAC_DT_FEATURE_UNIT_SIZE(0))
63/* B.3.2 Class-Specific AC Interface Descriptor */ 63/* B.3.2 Class-Specific AC Interface Descriptor */
64static struct uac_ac_header_descriptor_v1_2 ac_header_desc = { 64static struct uac1_ac_header_descriptor_2 ac_header_desc = {
65 .bLength = UAC_DT_AC_HEADER_LENGTH, 65 .bLength = UAC_DT_AC_HEADER_LENGTH,
66 .bDescriptorType = USB_DT_CS_INTERFACE, 66 .bDescriptorType = USB_DT_CS_INTERFACE,
67 .bDescriptorSubtype = UAC_HEADER, 67 .bDescriptorSubtype = UAC_HEADER,
@@ -125,7 +125,7 @@ static struct usb_audio_control_selector feature_unit = {
125}; 125};
126 126
127#define OUTPUT_TERMINAL_ID 3 127#define OUTPUT_TERMINAL_ID 3
128static struct uac_output_terminal_descriptor_v1 output_terminal_desc = { 128static struct uac1_output_terminal_descriptor output_terminal_desc = {
129 .bLength = UAC_DT_OUTPUT_TERMINAL_SIZE, 129 .bLength = UAC_DT_OUTPUT_TERMINAL_SIZE,
130 .bDescriptorType = USB_DT_CS_INTERFACE, 130 .bDescriptorType = USB_DT_CS_INTERFACE,
131 .bDescriptorSubtype = UAC_OUTPUT_TERMINAL, 131 .bDescriptorSubtype = UAC_OUTPUT_TERMINAL,
@@ -155,7 +155,7 @@ static struct usb_interface_descriptor as_interface_alt_1_desc = {
155}; 155};
156 156
157/* B.4.2 Class-Specific AS Interface Descriptor */ 157/* B.4.2 Class-Specific AS Interface Descriptor */
158static struct uac_as_header_descriptor_v1 as_header_desc = { 158static struct uac1_as_header_descriptor as_header_desc = {
159 .bLength = UAC_DT_AS_HEADER_SIZE, 159 .bLength = UAC_DT_AS_HEADER_SIZE,
160 .bDescriptorType = USB_DT_CS_INTERFACE, 160 .bDescriptorType = USB_DT_CS_INTERFACE,
161 .bDescriptorSubtype = UAC_AS_GENERAL, 161 .bDescriptorSubtype = UAC_AS_GENERAL,
diff --git a/drivers/usb/gadget/fsl_qe_udc.c b/drivers/usb/gadget/fsl_qe_udc.c
index 82506ca297d..9648b75f028 100644
--- a/drivers/usb/gadget/fsl_qe_udc.c
+++ b/drivers/usb/gadget/fsl_qe_udc.c
@@ -32,6 +32,7 @@
32#include <linux/interrupt.h> 32#include <linux/interrupt.h>
33#include <linux/io.h> 33#include <linux/io.h>
34#include <linux/moduleparam.h> 34#include <linux/moduleparam.h>
35#include <linux/of_address.h>
35#include <linux/of_platform.h> 36#include <linux/of_platform.h>
36#include <linux/dma-mapping.h> 37#include <linux/dma-mapping.h>
37#include <linux/usb/ch9.h> 38#include <linux/usb/ch9.h>
diff --git a/drivers/usb/gadget/gmidi.c b/drivers/usb/gadget/gmidi.c
index 2b56ce62185..b7bf88019b0 100644
--- a/drivers/usb/gadget/gmidi.c
+++ b/drivers/usb/gadget/gmidi.c
@@ -238,7 +238,7 @@ static const struct usb_interface_descriptor ac_interface_desc = {
238}; 238};
239 239
240/* B.3.2 Class-Specific AC Interface Descriptor */ 240/* B.3.2 Class-Specific AC Interface Descriptor */
241static const struct uac_ac_header_descriptor_v1_1 ac_header_desc = { 241static const struct uac1_ac_header_descriptor_1 ac_header_desc = {
242 .bLength = UAC_DT_AC_HEADER_SIZE(1), 242 .bLength = UAC_DT_AC_HEADER_SIZE(1),
243 .bDescriptorType = USB_DT_CS_INTERFACE, 243 .bDescriptorType = USB_DT_CS_INTERFACE,
244 .bDescriptorSubtype = USB_MS_HEADER, 244 .bDescriptorSubtype = USB_MS_HEADER,
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index fc576557d8a..02864a237a2 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -1031,7 +1031,7 @@ MODULE_LICENSE ("GPL");
1031#define PLATFORM_DRIVER ohci_hcd_ep93xx_driver 1031#define PLATFORM_DRIVER ohci_hcd_ep93xx_driver
1032#endif 1032#endif
1033 1033
1034#ifdef CONFIG_SOC_AU1X00 1034#ifdef CONFIG_MIPS_ALCHEMY
1035#include "ohci-au1xxx.c" 1035#include "ohci-au1xxx.c"
1036#define PLATFORM_DRIVER ohci_hcd_au1xxx_driver 1036#define PLATFORM_DRIVER ohci_hcd_au1xxx_driver
1037#endif 1037#endif
@@ -1095,6 +1095,11 @@ MODULE_LICENSE ("GPL");
1095#define TMIO_OHCI_DRIVER ohci_hcd_tmio_driver 1095#define TMIO_OHCI_DRIVER ohci_hcd_tmio_driver
1096#endif 1096#endif
1097 1097
1098#ifdef CONFIG_MACH_JZ4740
1099#include "ohci-jz4740.c"
1100#define PLATFORM_DRIVER ohci_hcd_jz4740_driver
1101#endif
1102
1098#if !defined(PCI_DRIVER) && \ 1103#if !defined(PCI_DRIVER) && \
1099 !defined(PLATFORM_DRIVER) && \ 1104 !defined(PLATFORM_DRIVER) && \
1100 !defined(OMAP1_PLATFORM_DRIVER) && \ 1105 !defined(OMAP1_PLATFORM_DRIVER) && \
diff --git a/drivers/usb/host/ohci-jz4740.c b/drivers/usb/host/ohci-jz4740.c
new file mode 100644
index 00000000000..10e1872f3ab
--- /dev/null
+++ b/drivers/usb/host/ohci-jz4740.c
@@ -0,0 +1,276 @@
1/*
2 * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de>
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * You should have received a copy of the GNU General Public License along
10 * with this program; if not, write to the Free Software Foundation, Inc.,
11 * 675 Mass Ave, Cambridge, MA 02139, USA.
12 *
13 */
14
15#include <linux/platform_device.h>
16#include <linux/clk.h>
17#include <linux/regulator/consumer.h>
18
19struct jz4740_ohci_hcd {
20 struct ohci_hcd ohci_hcd;
21
22 struct regulator *vbus;
23 bool vbus_enabled;
24 struct clk *clk;
25};
26
27static inline struct jz4740_ohci_hcd *hcd_to_jz4740_hcd(struct usb_hcd *hcd)
28{
29 return (struct jz4740_ohci_hcd *)(hcd->hcd_priv);
30}
31
32static inline struct usb_hcd *jz4740_hcd_to_hcd(struct jz4740_ohci_hcd *jz4740_ohci)
33{
34 return container_of((void *)jz4740_ohci, struct usb_hcd, hcd_priv);
35}
36
37static int ohci_jz4740_start(struct usb_hcd *hcd)
38{
39 struct ohci_hcd *ohci = hcd_to_ohci(hcd);
40 int ret;
41
42 ret = ohci_init(ohci);
43 if (ret < 0)
44 return ret;
45
46 ohci->num_ports = 1;
47
48 ret = ohci_run(ohci);
49 if (ret < 0) {
50 dev_err(hcd->self.controller, "Can not start %s",
51 hcd->self.bus_name);
52 ohci_stop(hcd);
53 return ret;
54 }
55 return 0;
56}
57
58static int ohci_jz4740_set_vbus_power(struct jz4740_ohci_hcd *jz4740_ohci,
59 bool enabled)
60{
61 int ret = 0;
62
63 if (!jz4740_ohci->vbus)
64 return 0;
65
66 if (enabled && !jz4740_ohci->vbus_enabled) {
67 ret = regulator_enable(jz4740_ohci->vbus);
68 if (ret)
69 dev_err(jz4740_hcd_to_hcd(jz4740_ohci)->self.controller,
70 "Could not power vbus\n");
71 } else if (!enabled && jz4740_ohci->vbus_enabled) {
72 ret = regulator_disable(jz4740_ohci->vbus);
73 }
74
75 if (ret == 0)
76 jz4740_ohci->vbus_enabled = enabled;
77
78 return ret;
79}
80
81static int ohci_jz4740_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
82 u16 wIndex, char *buf, u16 wLength)
83{
84 struct jz4740_ohci_hcd *jz4740_ohci = hcd_to_jz4740_hcd(hcd);
85 int ret;
86
87 switch (typeReq) {
88 case SetHubFeature:
89 if (wValue == USB_PORT_FEAT_POWER)
90 ret = ohci_jz4740_set_vbus_power(jz4740_ohci, true);
91 break;
92 case ClearHubFeature:
93 if (wValue == USB_PORT_FEAT_POWER)
94 ret = ohci_jz4740_set_vbus_power(jz4740_ohci, false);
95 break;
96 }
97
98 if (ret)
99 return ret;
100
101 return ohci_hub_control(hcd, typeReq, wValue, wIndex, buf, wLength);
102}
103
104
105static const struct hc_driver ohci_jz4740_hc_driver = {
106 .description = hcd_name,
107 .product_desc = "JZ4740 OHCI",
108 .hcd_priv_size = sizeof(struct jz4740_ohci_hcd),
109
110 /*
111 * generic hardware linkage
112 */
113 .irq = ohci_irq,
114 .flags = HCD_USB11 | HCD_MEMORY,
115
116 /*
117 * basic lifecycle operations
118 */
119 .start = ohci_jz4740_start,
120 .stop = ohci_stop,
121 .shutdown = ohci_shutdown,
122
123 /*
124 * managing i/o requests and associated device resources
125 */
126 .urb_enqueue = ohci_urb_enqueue,
127 .urb_dequeue = ohci_urb_dequeue,
128 .endpoint_disable = ohci_endpoint_disable,
129
130 /*
131 * scheduling support
132 */
133 .get_frame_number = ohci_get_frame,
134
135 /*
136 * root hub support
137 */
138 .hub_status_data = ohci_hub_status_data,
139 .hub_control = ohci_jz4740_hub_control,
140#ifdef CONFIG_PM
141 .bus_suspend = ohci_bus_suspend,
142 .bus_resume = ohci_bus_resume,
143#endif
144 .start_port_reset = ohci_start_port_reset,
145};
146
147
148static __devinit int jz4740_ohci_probe(struct platform_device *pdev)
149{
150 int ret;
151 struct usb_hcd *hcd;
152 struct jz4740_ohci_hcd *jz4740_ohci;
153 struct resource *res;
154 int irq;
155
156 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
157
158 if (!res) {
159 dev_err(&pdev->dev, "Failed to get platform resource\n");
160 return -ENOENT;
161 }
162
163 irq = platform_get_irq(pdev, 0);
164 if (irq < 0) {
165 dev_err(&pdev->dev, "Failed to get platform irq\n");
166 return irq;
167 }
168
169 hcd = usb_create_hcd(&ohci_jz4740_hc_driver, &pdev->dev, "jz4740");
170 if (!hcd) {
171 dev_err(&pdev->dev, "Failed to create hcd.\n");
172 return -ENOMEM;
173 }
174
175 jz4740_ohci = hcd_to_jz4740_hcd(hcd);
176
177 res = request_mem_region(res->start, resource_size(res), hcd_name);
178 if (!res) {
179 dev_err(&pdev->dev, "Failed to request mem region.\n");
180 ret = -EBUSY;
181 goto err_free;
182 }
183
184 hcd->rsrc_start = res->start;
185 hcd->rsrc_len = resource_size(res);
186 hcd->regs = ioremap(res->start, resource_size(res));
187
188 if (!hcd->regs) {
189 dev_err(&pdev->dev, "Failed to ioremap registers.\n");
190 ret = -EBUSY;
191 goto err_release_mem;
192 }
193
194 jz4740_ohci->clk = clk_get(&pdev->dev, "uhc");
195 if (IS_ERR(jz4740_ohci->clk)) {
196 ret = PTR_ERR(jz4740_ohci->clk);
197 dev_err(&pdev->dev, "Failed to get clock: %d\n", ret);
198 goto err_iounmap;
199 }
200
201 jz4740_ohci->vbus = regulator_get(&pdev->dev, "vbus");
202 if (IS_ERR(jz4740_ohci->vbus))
203 jz4740_ohci->vbus = NULL;
204
205
206 clk_set_rate(jz4740_ohci->clk, 48000000);
207 clk_enable(jz4740_ohci->clk);
208 if (jz4740_ohci->vbus)
209 ohci_jz4740_set_vbus_power(jz4740_ohci, true);
210
211 platform_set_drvdata(pdev, hcd);
212
213 ohci_hcd_init(hcd_to_ohci(hcd));
214
215 ret = usb_add_hcd(hcd, irq, 0);
216 if (ret) {
217 dev_err(&pdev->dev, "Failed to add hcd: %d\n", ret);
218 goto err_disable;
219 }
220
221 return 0;
222
223err_disable:
224 platform_set_drvdata(pdev, NULL);
225 if (jz4740_ohci->vbus) {
226 regulator_disable(jz4740_ohci->vbus);
227 regulator_put(jz4740_ohci->vbus);
228 }
229 clk_disable(jz4740_ohci->clk);
230
231 clk_put(jz4740_ohci->clk);
232err_iounmap:
233 iounmap(hcd->regs);
234err_release_mem:
235 release_mem_region(res->start, resource_size(res));
236err_free:
237 usb_put_hcd(hcd);
238
239 return ret;
240}
241
242static __devexit int jz4740_ohci_remove(struct platform_device *pdev)
243{
244 struct usb_hcd *hcd = platform_get_drvdata(pdev);
245 struct jz4740_ohci_hcd *jz4740_ohci = hcd_to_jz4740_hcd(hcd);
246
247 usb_remove_hcd(hcd);
248
249 platform_set_drvdata(pdev, NULL);
250
251 if (jz4740_ohci->vbus) {
252 regulator_disable(jz4740_ohci->vbus);
253 regulator_put(jz4740_ohci->vbus);
254 }
255
256 clk_disable(jz4740_ohci->clk);
257 clk_put(jz4740_ohci->clk);
258
259 iounmap(hcd->regs);
260 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
261
262 usb_put_hcd(hcd);
263
264 return 0;
265}
266
267static struct platform_driver ohci_hcd_jz4740_driver = {
268 .probe = jz4740_ohci_probe,
269 .remove = __devexit_p(jz4740_ohci_remove),
270 .driver = {
271 .name = "jz4740-ohci",
272 .owner = THIS_MODULE,
273 },
274};
275
276MODULE_ALIAS("platfrom:jz4740-ohci");
diff --git a/drivers/usb/host/sl811_cs.c b/drivers/usb/host/sl811_cs.c
index 58cb73c8420..0e13a00eb2e 100644
--- a/drivers/usb/host/sl811_cs.c
+++ b/drivers/usb/host/sl811_cs.c
@@ -20,7 +20,6 @@
20#include <linux/ioport.h> 20#include <linux/ioport.h>
21#include <linux/platform_device.h> 21#include <linux/platform_device.h>
22 22
23#include <pcmcia/cs_types.h>
24#include <pcmcia/cs.h> 23#include <pcmcia/cs.h>
25#include <pcmcia/cistpl.h> 24#include <pcmcia/cistpl.h>
26#include <pcmcia/cisreg.h> 25#include <pcmcia/cisreg.h>
@@ -43,8 +42,6 @@ MODULE_LICENSE("GPL");
43/* VARIABLES */ 42/* VARIABLES */
44/*====================================================================*/ 43/*====================================================================*/
45 44
46static const char driver_name[DEV_NAME_LEN] = "sl811_cs";
47
48typedef struct local_info_t { 45typedef struct local_info_t {
49 struct pcmcia_device *p_dev; 46 struct pcmcia_device *p_dev;
50} local_info_t; 47} local_info_t;
@@ -165,16 +162,16 @@ static int sl811_cs_config_check(struct pcmcia_device *p_dev,
165 p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 162 p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
166 163
167 /* IO window settings */ 164 /* IO window settings */
168 p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; 165 p_dev->resource[0]->end = p_dev->resource[1]->end = 0;
169 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 166 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
170 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 167 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
168 p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK;
171 169
172 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 170 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
173 p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; 171 p_dev->resource[0]->start = io->win[0].base;
174 p_dev->io.BasePort1 = io->win[0].base; 172 p_dev->resource[0]->end = io->win[0].len;
175 p_dev->io.NumPorts1 = io->win[0].len;
176 173
177 return pcmcia_request_io(p_dev, &p_dev->io); 174 return pcmcia_request_io(p_dev);
178 } 175 }
179 pcmcia_disable_device(p_dev); 176 pcmcia_disable_device(p_dev);
180 return -ENODEV; 177 return -ENODEV;
@@ -192,7 +189,7 @@ static int sl811_cs_config(struct pcmcia_device *link)
192 goto failed; 189 goto failed;
193 190
194 /* require an IRQ and two registers */ 191 /* require an IRQ and two registers */
195 if (!link->io.NumPorts1 || link->io.NumPorts1 < 2) 192 if (resource_size(link->resource[0]) < 2)
196 goto failed; 193 goto failed;
197 194
198 if (!link->irq) 195 if (!link->irq)
@@ -207,11 +204,10 @@ static int sl811_cs_config(struct pcmcia_device *link)
207 if (link->conf.Vpp) 204 if (link->conf.Vpp)
208 printk(", Vpp %d.%d", link->conf.Vpp/10, link->conf.Vpp%10); 205 printk(", Vpp %d.%d", link->conf.Vpp/10, link->conf.Vpp%10);
209 printk(", irq %d", link->irq); 206 printk(", irq %d", link->irq);
210 printk(", io 0x%04x-0x%04x", link->io.BasePort1, 207 printk(", io %pR", link->resource[0]);
211 link->io.BasePort1+link->io.NumPorts1-1);
212 printk("\n"); 208 printk("\n");
213 209
214 if (sl811_hc_init(parent, link->io.BasePort1, link->irq) 210 if (sl811_hc_init(parent, link->resource[0]->start, link->irq)
215 < 0) { 211 < 0) {
216failed: 212failed:
217 printk(KERN_WARNING "sl811_cs_config failed\n"); 213 printk(KERN_WARNING "sl811_cs_config failed\n");
@@ -246,7 +242,7 @@ MODULE_DEVICE_TABLE(pcmcia, sl811_ids);
246static struct pcmcia_driver sl811_cs_driver = { 242static struct pcmcia_driver sl811_cs_driver = {
247 .owner = THIS_MODULE, 243 .owner = THIS_MODULE,
248 .drv = { 244 .drv = {
249 .name = (char *)driver_name, 245 .name = "sl811_cs",
250 }, 246 },
251 .probe = sl811_cs_probe, 247 .probe = sl811_cs_probe,
252 .remove = sl811_cs_detach, 248 .remove = sl811_cs_detach,