aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r--drivers/usb/gadget/Kconfig1
-rw-r--r--drivers/usb/gadget/ether.c9
-rw-r--r--drivers/usb/gadget/fsl_udc_core.c2
-rw-r--r--drivers/usb/gadget/imx_udc.c8
-rw-r--r--drivers/usb/gadget/r8a66597-udc.h105
5 files changed, 70 insertions, 55 deletions
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index 33351312327f..a18e3c5dd82e 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -223,6 +223,7 @@ config USB_OTG
223config USB_GADGET_PXA25X 223config USB_GADGET_PXA25X
224 boolean "PXA 25x or IXP 4xx" 224 boolean "PXA 25x or IXP 4xx"
225 depends on (ARCH_PXA && PXA25x) || ARCH_IXP4XX 225 depends on (ARCH_PXA && PXA25x) || ARCH_IXP4XX
226 select USB_OTG_UTILS
226 help 227 help
227 Intel's PXA 25x series XScale ARM-5TE processors include 228 Intel's PXA 25x series XScale ARM-5TE processors include
228 an integrated full speed USB 1.1 device controller. The 229 an integrated full speed USB 1.1 device controller. The
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index f37de283d0ab..167cb2a8ecef 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -61,11 +61,6 @@
61 * simpler, Microsoft pushes their own approach: RNDIS. The published 61 * simpler, Microsoft pushes their own approach: RNDIS. The published
62 * RNDIS specs are ambiguous and appear to be incomplete, and are also 62 * RNDIS specs are ambiguous and appear to be incomplete, and are also
63 * needlessly complex. They borrow more from CDC ACM than CDC ECM. 63 * needlessly complex. They borrow more from CDC ACM than CDC ECM.
64 *
65 * While CDC ECM, CDC Subset, and RNDIS are designed to extend the ethernet
66 * interface to the target, CDC EEM was designed to use ethernet over the USB
67 * link between the host and target. CDC EEM is implemented as an alternative
68 * to those other protocols when that communication model is more appropriate
69 */ 64 */
70 65
71#define DRIVER_DESC "Ethernet Gadget" 66#define DRIVER_DESC "Ethernet Gadget"
@@ -157,8 +152,8 @@ static inline bool has_rndis(void)
157#define RNDIS_PRODUCT_NUM 0xa4a2 /* Ethernet/RNDIS Gadget */ 152#define RNDIS_PRODUCT_NUM 0xa4a2 /* Ethernet/RNDIS Gadget */
158 153
159/* For EEM gadgets */ 154/* For EEM gadgets */
160#define EEM_VENDOR_NUM 0x0525 /* INVALID - NEEDS TO BE ALLOCATED */ 155#define EEM_VENDOR_NUM 0x1d6b /* Linux Foundation */
161#define EEM_PRODUCT_NUM 0xa4a1 /* INVALID - NEEDS TO BE ALLOCATED */ 156#define EEM_PRODUCT_NUM 0x0102 /* EEM Gadget */
162 157
163/*-------------------------------------------------------------------------*/ 158/*-------------------------------------------------------------------------*/
164 159
diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c
index 42a74b8a0bb8..fa3d142ba64d 100644
--- a/drivers/usb/gadget/fsl_udc_core.c
+++ b/drivers/usb/gadget/fsl_udc_core.c
@@ -2139,7 +2139,7 @@ static int fsl_proc_read(char *page, char **start, off_t off, int count,
2139static void fsl_udc_release(struct device *dev) 2139static void fsl_udc_release(struct device *dev)
2140{ 2140{
2141 complete(udc_controller->done); 2141 complete(udc_controller->done);
2142 dma_free_coherent(dev, udc_controller->ep_qh_size, 2142 dma_free_coherent(dev->parent, udc_controller->ep_qh_size,
2143 udc_controller->ep_qh, udc_controller->ep_qh_dma); 2143 udc_controller->ep_qh, udc_controller->ep_qh_dma);
2144 kfree(udc_controller); 2144 kfree(udc_controller);
2145} 2145}
diff --git a/drivers/usb/gadget/imx_udc.c b/drivers/usb/gadget/imx_udc.c
index c52a681f376c..01ee0b9bc957 100644
--- a/drivers/usb/gadget/imx_udc.c
+++ b/drivers/usb/gadget/imx_udc.c
@@ -1402,7 +1402,8 @@ static int __init imx_udc_probe(struct platform_device *pdev)
1402 struct clk *clk; 1402 struct clk *clk;
1403 void __iomem *base; 1403 void __iomem *base;
1404 int ret = 0; 1404 int ret = 0;
1405 int i, res_size; 1405 int i;
1406 resource_size_t res_size;
1406 1407
1407 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1408 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1408 if (!res) { 1409 if (!res) {
@@ -1416,7 +1417,7 @@ static int __init imx_udc_probe(struct platform_device *pdev)
1416 return -ENODEV; 1417 return -ENODEV;
1417 } 1418 }
1418 1419
1419 res_size = res->end - res->start + 1; 1420 res_size = resource_size(res);
1420 if (!request_mem_region(res->start, res_size, res->name)) { 1421 if (!request_mem_region(res->start, res_size, res->name)) {
1421 dev_err(&pdev->dev, "can't allocate %d bytes at %d address\n", 1422 dev_err(&pdev->dev, "can't allocate %d bytes at %d address\n",
1422 res_size, res->start); 1423 res_size, res->start);
@@ -1527,8 +1528,7 @@ static int __exit imx_udc_remove(struct platform_device *pdev)
1527 clk_disable(imx_usb->clk); 1528 clk_disable(imx_usb->clk);
1528 iounmap(imx_usb->base); 1529 iounmap(imx_usb->base);
1529 1530
1530 release_mem_region(imx_usb->res->start, 1531 release_mem_region(imx_usb->res->start, resource_size(imx_usb->res));
1531 imx_usb->res->end - imx_usb->res->start + 1);
1532 1532
1533 if (pdata->exit) 1533 if (pdata->exit)
1534 pdata->exit(&pdev->dev); 1534 pdata->exit(&pdev->dev);
diff --git a/drivers/usb/gadget/r8a66597-udc.h b/drivers/usb/gadget/r8a66597-udc.h
index 03087e7b9190..9a537aa07968 100644
--- a/drivers/usb/gadget/r8a66597-udc.h
+++ b/drivers/usb/gadget/r8a66597-udc.h
@@ -131,31 +131,48 @@ static inline u16 r8a66597_read(struct r8a66597 *r8a66597, unsigned long offset)
131} 131}
132 132
133static inline void r8a66597_read_fifo(struct r8a66597 *r8a66597, 133static inline void r8a66597_read_fifo(struct r8a66597 *r8a66597,
134 unsigned long offset, u16 *buf, 134 unsigned long offset,
135 unsigned char *buf,
135 int len) 136 int len)
136{ 137{
138 unsigned long fifoaddr = r8a66597->reg + offset;
139 unsigned int data;
140 int i;
141
137 if (r8a66597->pdata->on_chip) { 142 if (r8a66597->pdata->on_chip) {
138 unsigned long fifoaddr = r8a66597->reg + offset; 143 /* 32-bit accesses for on_chip controllers */
139 unsigned long count; 144
140 union { 145 /* aligned buf case */
141 unsigned long dword; 146 if (len >= 4 && !((unsigned long)buf & 0x03)) {
142 unsigned char byte[4]; 147 insl(fifoaddr, buf, len / 4);
143 } data; 148 buf += len & ~0x03;
144 unsigned char *pb; 149 len &= 0x03;
145 int i; 150 }
146 151
147 count = len / 4; 152 /* unaligned buf case */
148 insl(fifoaddr, buf, count); 153 for (i = 0; i < len; i++) {
149 154 if (!(i & 0x03))
150 if (len & 0x00000003) { 155 data = inl(fifoaddr);
151 data.dword = inl(fifoaddr); 156
152 pb = (unsigned char *)buf + count * 4; 157 buf[i] = (data >> ((i & 0x03) * 8)) & 0xff;
153 for (i = 0; i < (len & 0x00000003); i++)
154 pb[i] = data.byte[i];
155 } 158 }
156 } else { 159 } else {
157 len = (len + 1) / 2; 160 /* 16-bit accesses for external controllers */
158 insw(r8a66597->reg + offset, buf, len); 161
162 /* aligned buf case */
163 if (len >= 2 && !((unsigned long)buf & 0x01)) {
164 insw(fifoaddr, buf, len / 2);
165 buf += len & ~0x01;
166 len &= 0x01;
167 }
168
169 /* unaligned buf case */
170 for (i = 0; i < len; i++) {
171 if (!(i & 0x01))
172 data = inw(fifoaddr);
173
174 buf[i] = (data >> ((i & 0x01) * 8)) & 0xff;
175 }
159 } 176 }
160} 177}
161 178
@@ -166,38 +183,40 @@ static inline void r8a66597_write(struct r8a66597 *r8a66597, u16 val,
166} 183}
167 184
168static inline void r8a66597_write_fifo(struct r8a66597 *r8a66597, 185static inline void r8a66597_write_fifo(struct r8a66597 *r8a66597,
169 unsigned long offset, u16 *buf, 186 unsigned long offset,
187 unsigned char *buf,
170 int len) 188 int len)
171{ 189{
172 unsigned long fifoaddr = r8a66597->reg + offset; 190 unsigned long fifoaddr = r8a66597->reg + offset;
191 int adj = 0;
192 int i;
173 193
174 if (r8a66597->pdata->on_chip) { 194 if (r8a66597->pdata->on_chip) {
175 unsigned long count; 195 /* 32-bit access only if buf is 32-bit aligned */
176 unsigned char *pb; 196 if (len >= 4 && !((unsigned long)buf & 0x03)) {
177 int i; 197 outsl(fifoaddr, buf, len / 4);
178 198 buf += len & ~0x03;
179 count = len / 4; 199 len &= 0x03;
180 outsl(fifoaddr, buf, count);
181
182 if (len & 0x00000003) {
183 pb = (unsigned char *)buf + count * 4;
184 for (i = 0; i < (len & 0x00000003); i++) {
185 if (r8a66597_read(r8a66597, CFIFOSEL) & BIGEND)
186 outb(pb[i], fifoaddr + i);
187 else
188 outb(pb[i], fifoaddr + 3 - i);
189 }
190 } 200 }
191 } else { 201 } else {
192 int odd = len & 0x0001; 202 /* 16-bit access only if buf is 16-bit aligned */
193 203 if (len >= 2 && !((unsigned long)buf & 0x01)) {
194 len = len / 2; 204 outsw(fifoaddr, buf, len / 2);
195 outsw(fifoaddr, buf, len); 205 buf += len & ~0x01;
196 if (unlikely(odd)) { 206 len &= 0x01;
197 buf = &buf[len];
198 outb((unsigned char)*buf, fifoaddr);
199 } 207 }
200 } 208 }
209
210 /* adjust fifo address in the little endian case */
211 if (!(r8a66597_read(r8a66597, CFIFOSEL) & BIGEND)) {
212 if (r8a66597->pdata->on_chip)
213 adj = 0x03; /* 32-bit wide */
214 else
215 adj = 0x01; /* 16-bit wide */
216 }
217
218 for (i = 0; i < len; i++)
219 outb(buf[i], fifoaddr + adj - (i & adj));
201} 220}
202 221
203static inline void r8a66597_mdfy(struct r8a66597 *r8a66597, 222static inline void r8a66597_mdfy(struct r8a66597 *r8a66597,