aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorFelipe Balbi <balbi@ti.com>2011-08-15 12:02:25 -0400
committerFelipe Balbi <balbi@ti.com>2011-08-15 12:02:25 -0400
commit200b0182f95a1f97c9fefee88707fb15ce87c22d (patch)
treea4ad1cacfeb07258aeb862c6505cd93560d7adb6 /drivers/usb
parentce7e9065958191e6b7ca49d7ed0e1099c486d198 (diff)
parent6193d6997c90535af8f8491fc0019f785a3322b0 (diff)
Merge branch 'fixes' into for-greg
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/gadget/f_phonet.c1
-rw-r--r--drivers/usb/musb/blackfin.c1
-rw-r--r--drivers/usb/musb/cppi_dma.c26
-rw-r--r--drivers/usb/musb/musb_core.h12
-rw-r--r--drivers/usb/musb/musb_gadget.c4
-rw-r--r--drivers/usb/musb/musb_regs.h6
-rw-r--r--drivers/usb/musb/tusb6010.c1
-rw-r--r--drivers/usb/musb/tusb6010_omap.c1
-rw-r--r--drivers/usb/musb/ux500_dma.c38
9 files changed, 57 insertions, 33 deletions
diff --git a/drivers/usb/gadget/f_phonet.c b/drivers/usb/gadget/f_phonet.c
index 8f8d3f6cd89e..8f3eab1af885 100644
--- a/drivers/usb/gadget/f_phonet.c
+++ b/drivers/usb/gadget/f_phonet.c
@@ -434,6 +434,7 @@ static int pn_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
434 config_ep_by_speed(gadget, f, fp->out_ep)) { 434 config_ep_by_speed(gadget, f, fp->out_ep)) {
435 fp->in_ep->desc = NULL; 435 fp->in_ep->desc = NULL;
436 fp->out_ep->desc = NULL; 436 fp->out_ep->desc = NULL;
437 spin_unlock(&port->lock);
437 return -EINVAL; 438 return -EINVAL;
438 } 439 }
439 usb_ep_enable(fp->out_ep); 440 usb_ep_enable(fp->out_ep);
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c
index ae8c39617743..5e7cfba5b079 100644
--- a/drivers/usb/musb/blackfin.c
+++ b/drivers/usb/musb/blackfin.c
@@ -17,6 +17,7 @@
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19#include <linux/dma-mapping.h> 19#include <linux/dma-mapping.h>
20#include <linux/prefetch.h>
20 21
21#include <asm/cacheflush.h> 22#include <asm/cacheflush.h>
22 23
diff --git a/drivers/usb/musb/cppi_dma.c b/drivers/usb/musb/cppi_dma.c
index 149f3f310a0a..318fb4e8a885 100644
--- a/drivers/usb/musb/cppi_dma.c
+++ b/drivers/usb/musb/cppi_dma.c
@@ -226,8 +226,10 @@ static int cppi_controller_stop(struct dma_controller *c)
226 struct cppi *controller; 226 struct cppi *controller;
227 void __iomem *tibase; 227 void __iomem *tibase;
228 int i; 228 int i;
229 struct musb *musb;
229 230
230 controller = container_of(c, struct cppi, controller); 231 controller = container_of(c, struct cppi, controller);
232 musb = controller->musb;
231 233
232 tibase = controller->tibase; 234 tibase = controller->tibase;
233 /* DISABLE INDIVIDUAL CHANNEL Interrupts */ 235 /* DISABLE INDIVIDUAL CHANNEL Interrupts */
@@ -289,9 +291,11 @@ cppi_channel_allocate(struct dma_controller *c,
289 u8 index; 291 u8 index;
290 struct cppi_channel *cppi_ch; 292 struct cppi_channel *cppi_ch;
291 void __iomem *tibase; 293 void __iomem *tibase;
294 struct musb *musb;
292 295
293 controller = container_of(c, struct cppi, controller); 296 controller = container_of(c, struct cppi, controller);
294 tibase = controller->tibase; 297 tibase = controller->tibase;
298 musb = controller->musb;
295 299
296 /* ep0 doesn't use DMA; remember cppi indices are 0..N-1 */ 300 /* ep0 doesn't use DMA; remember cppi indices are 0..N-1 */
297 index = ep->epnum - 1; 301 index = ep->epnum - 1;
@@ -339,7 +343,8 @@ static void cppi_channel_release(struct dma_channel *channel)
339 c = container_of(channel, struct cppi_channel, channel); 343 c = container_of(channel, struct cppi_channel, channel);
340 tibase = c->controller->tibase; 344 tibase = c->controller->tibase;
341 if (!c->hw_ep) 345 if (!c->hw_ep)
342 dev_dbg(musb->controller, "releasing idle DMA channel %p\n", c); 346 dev_dbg(c->controller->musb->controller,
347 "releasing idle DMA channel %p\n", c);
343 else if (!c->transmit) 348 else if (!c->transmit)
344 core_rxirq_enable(tibase, c->index + 1); 349 core_rxirq_enable(tibase, c->index + 1);
345 350
@@ -357,10 +362,11 @@ cppi_dump_rx(int level, struct cppi_channel *c, const char *tag)
357 362
358 musb_ep_select(base, c->index + 1); 363 musb_ep_select(base, c->index + 1);
359 364
360 DBG(level, "RX DMA%d%s: %d left, csr %04x, " 365 dev_dbg(c->controller->musb->controller,
361 "%08x H%08x S%08x C%08x, " 366 "RX DMA%d%s: %d left, csr %04x, "
362 "B%08x L%08x %08x .. %08x" 367 "%08x H%08x S%08x C%08x, "
363 "\n", 368 "B%08x L%08x %08x .. %08x"
369 "\n",
364 c->index, tag, 370 c->index, tag,
365 musb_readl(c->controller->tibase, 371 musb_readl(c->controller->tibase,
366 DAVINCI_RXCPPI_BUFCNT0_REG + 4 * c->index), 372 DAVINCI_RXCPPI_BUFCNT0_REG + 4 * c->index),
@@ -387,10 +393,11 @@ cppi_dump_tx(int level, struct cppi_channel *c, const char *tag)
387 393
388 musb_ep_select(base, c->index + 1); 394 musb_ep_select(base, c->index + 1);
389 395
390 DBG(level, "TX DMA%d%s: csr %04x, " 396 dev_dbg(c->controller->musb->controller,
391 "H%08x S%08x C%08x %08x, " 397 "TX DMA%d%s: csr %04x, "
392 "F%08x L%08x .. %08x" 398 "H%08x S%08x C%08x %08x, "
393 "\n", 399 "F%08x L%08x .. %08x"
400 "\n",
394 c->index, tag, 401 c->index, tag,
395 musb_readw(c->hw_ep->regs, MUSB_TXCSR), 402 musb_readw(c->hw_ep->regs, MUSB_TXCSR),
396 403
@@ -1022,6 +1029,7 @@ static bool cppi_rx_scan(struct cppi *cppi, unsigned ch)
1022 int i; 1029 int i;
1023 dma_addr_t safe2ack; 1030 dma_addr_t safe2ack;
1024 void __iomem *regs = rx->hw_ep->regs; 1031 void __iomem *regs = rx->hw_ep->regs;
1032 struct musb *musb = cppi->musb;
1025 1033
1026 cppi_dump_rx(6, rx, "/K"); 1034 cppi_dump_rx(6, rx, "/K");
1027 1035
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index 668eeef601ae..b3c065ab9dbc 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -172,7 +172,8 @@ enum musb_g_ep0_state {
172#endif 172#endif
173 173
174/* TUSB mapping: "flat" plus ep0 special cases */ 174/* TUSB mapping: "flat" plus ep0 special cases */
175#if defined(CONFIG_USB_MUSB_TUSB6010) 175#if defined(CONFIG_USB_MUSB_TUSB6010) || \
176 defined(CONFIG_USB_MUSB_TUSB6010_MODULE)
176#define musb_ep_select(_mbase, _epnum) \ 177#define musb_ep_select(_mbase, _epnum) \
177 musb_writeb((_mbase), MUSB_INDEX, (_epnum)) 178 musb_writeb((_mbase), MUSB_INDEX, (_epnum))
178#define MUSB_EP_OFFSET MUSB_TUSB_OFFSET 179#define MUSB_EP_OFFSET MUSB_TUSB_OFFSET
@@ -241,7 +242,8 @@ struct musb_hw_ep {
241 void __iomem *fifo; 242 void __iomem *fifo;
242 void __iomem *regs; 243 void __iomem *regs;
243 244
244#ifdef CONFIG_USB_MUSB_TUSB6010 245#if defined(CONFIG_USB_MUSB_TUSB6010) || \
246 defined(CONFIG_USB_MUSB_TUSB6010_MODULE)
245 void __iomem *conf; 247 void __iomem *conf;
246#endif 248#endif
247 249
@@ -258,7 +260,8 @@ struct musb_hw_ep {
258 struct dma_channel *tx_channel; 260 struct dma_channel *tx_channel;
259 struct dma_channel *rx_channel; 261 struct dma_channel *rx_channel;
260 262
261#ifdef CONFIG_USB_MUSB_TUSB6010 263#if defined(CONFIG_USB_MUSB_TUSB6010) || \
264 defined(CONFIG_USB_MUSB_TUSB6010_MODULE)
262 /* TUSB has "asynchronous" and "synchronous" dma modes */ 265 /* TUSB has "asynchronous" and "synchronous" dma modes */
263 dma_addr_t fifo_async; 266 dma_addr_t fifo_async;
264 dma_addr_t fifo_sync; 267 dma_addr_t fifo_sync;
@@ -356,7 +359,8 @@ struct musb {
356 void __iomem *ctrl_base; 359 void __iomem *ctrl_base;
357 void __iomem *mregs; 360 void __iomem *mregs;
358 361
359#ifdef CONFIG_USB_MUSB_TUSB6010 362#if defined(CONFIG_USB_MUSB_TUSB6010) || \
363 defined(CONFIG_USB_MUSB_TUSB6010_MODULE)
360 dma_addr_t async; 364 dma_addr_t async;
361 dma_addr_t sync; 365 dma_addr_t sync;
362 void __iomem *sync_va; 366 void __iomem *sync_va;
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index 8c41a2e6ea77..e81820370d6f 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -1856,6 +1856,7 @@ int __init musb_gadget_setup(struct musb *musb)
1856 1856
1857 return 0; 1857 return 0;
1858err: 1858err:
1859 musb->g.dev.parent = NULL;
1859 device_unregister(&musb->g.dev); 1860 device_unregister(&musb->g.dev);
1860 return status; 1861 return status;
1861} 1862}
@@ -1863,7 +1864,8 @@ err:
1863void musb_gadget_cleanup(struct musb *musb) 1864void musb_gadget_cleanup(struct musb *musb)
1864{ 1865{
1865 usb_del_gadget_udc(&musb->g); 1866 usb_del_gadget_udc(&musb->g);
1866 device_unregister(&musb->g.dev); 1867 if (musb->g.dev.parent)
1868 device_unregister(&musb->g.dev);
1867} 1869}
1868 1870
1869/* 1871/*
diff --git a/drivers/usb/musb/musb_regs.h b/drivers/usb/musb/musb_regs.h
index 82410703dcd3..03f2655af290 100644
--- a/drivers/usb/musb/musb_regs.h
+++ b/drivers/usb/musb/musb_regs.h
@@ -234,7 +234,8 @@
234#define MUSB_TESTMODE 0x0F /* 8 bit */ 234#define MUSB_TESTMODE 0x0F /* 8 bit */
235 235
236/* Get offset for a given FIFO from musb->mregs */ 236/* Get offset for a given FIFO from musb->mregs */
237#ifdef CONFIG_USB_MUSB_TUSB6010 237#if defined(CONFIG_USB_MUSB_TUSB6010) || \
238 defined(CONFIG_USB_MUSB_TUSB6010_MODULE)
238#define MUSB_FIFO_OFFSET(epnum) (0x200 + ((epnum) * 0x20)) 239#define MUSB_FIFO_OFFSET(epnum) (0x200 + ((epnum) * 0x20))
239#else 240#else
240#define MUSB_FIFO_OFFSET(epnum) (0x20 + ((epnum) * 4)) 241#define MUSB_FIFO_OFFSET(epnum) (0x20 + ((epnum) * 4))
@@ -295,7 +296,8 @@
295#define MUSB_FLAT_OFFSET(_epnum, _offset) \ 296#define MUSB_FLAT_OFFSET(_epnum, _offset) \
296 (0x100 + (0x10*(_epnum)) + (_offset)) 297 (0x100 + (0x10*(_epnum)) + (_offset))
297 298
298#ifdef CONFIG_USB_MUSB_TUSB6010 299#if defined(CONFIG_USB_MUSB_TUSB6010) || \
300 defined(CONFIG_USB_MUSB_TUSB6010_MODULE)
299/* TUSB6010 EP0 configuration register is special */ 301/* TUSB6010 EP0 configuration register is special */
300#define MUSB_TUSB_OFFSET(_epnum, _offset) \ 302#define MUSB_TUSB_OFFSET(_epnum, _offset) \
301 (0x10 + _offset) 303 (0x10 + _offset)
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c
index 9eec41fbf3a4..ec1480191f78 100644
--- a/drivers/usb/musb/tusb6010.c
+++ b/drivers/usb/musb/tusb6010.c
@@ -18,6 +18,7 @@
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/errno.h> 19#include <linux/errno.h>
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/prefetch.h>
21#include <linux/usb.h> 22#include <linux/usb.h>
22#include <linux/irq.h> 23#include <linux/irq.h>
23#include <linux/platform_device.h> 24#include <linux/platform_device.h>
diff --git a/drivers/usb/musb/tusb6010_omap.c b/drivers/usb/musb/tusb6010_omap.c
index 07c8a73dfe41..b67b4bc596c1 100644
--- a/drivers/usb/musb/tusb6010_omap.c
+++ b/drivers/usb/musb/tusb6010_omap.c
@@ -20,6 +20,7 @@
20#include <plat/mux.h> 20#include <plat/mux.h>
21 21
22#include "musb_core.h" 22#include "musb_core.h"
23#include "tusb6010.h"
23 24
24#define to_chdat(c) ((struct tusb_omap_dma_ch *)(c)->private_data) 25#define to_chdat(c) ((struct tusb_omap_dma_ch *)(c)->private_data)
25 26
diff --git a/drivers/usb/musb/ux500_dma.c b/drivers/usb/musb/ux500_dma.c
index cecace411832..ef4333f4bbe0 100644
--- a/drivers/usb/musb/ux500_dma.c
+++ b/drivers/usb/musb/ux500_dma.c
@@ -65,7 +65,8 @@ static void ux500_tx_work(struct work_struct *data)
65 struct musb *musb = hw_ep->musb; 65 struct musb *musb = hw_ep->musb;
66 unsigned long flags; 66 unsigned long flags;
67 67
68 DBG(4, "DMA tx transfer done on hw_ep=%d\n", hw_ep->epnum); 68 dev_dbg(musb->controller, "DMA tx transfer done on hw_ep=%d\n",
69 hw_ep->epnum);
69 70
70 spin_lock_irqsave(&musb->lock, flags); 71 spin_lock_irqsave(&musb->lock, flags);
71 ux500_channel->channel.actual_len = ux500_channel->cur_len; 72 ux500_channel->channel.actual_len = ux500_channel->cur_len;
@@ -84,7 +85,8 @@ static void ux500_rx_work(struct work_struct *data)
84 struct musb *musb = hw_ep->musb; 85 struct musb *musb = hw_ep->musb;
85 unsigned long flags; 86 unsigned long flags;
86 87
87 DBG(4, "DMA rx transfer done on hw_ep=%d\n", hw_ep->epnum); 88 dev_dbg(musb->controller, "DMA rx transfer done on hw_ep=%d\n",
89 hw_ep->epnum);
88 90
89 spin_lock_irqsave(&musb->lock, flags); 91 spin_lock_irqsave(&musb->lock, flags);
90 ux500_channel->channel.actual_len = ux500_channel->cur_len; 92 ux500_channel->channel.actual_len = ux500_channel->cur_len;
@@ -116,9 +118,11 @@ static bool ux500_configure_channel(struct dma_channel *channel,
116 enum dma_slave_buswidth addr_width; 118 enum dma_slave_buswidth addr_width;
117 dma_addr_t usb_fifo_addr = (MUSB_FIFO_OFFSET(hw_ep->epnum) + 119 dma_addr_t usb_fifo_addr = (MUSB_FIFO_OFFSET(hw_ep->epnum) +
118 ux500_channel->controller->phy_base); 120 ux500_channel->controller->phy_base);
121 struct musb *musb = ux500_channel->controller->private_data;
119 122
120 DBG(4, "packet_sz=%d, mode=%d, dma_addr=0x%x, len=%d is_tx=%d\n", 123 dev_dbg(musb->controller,
121 packet_sz, mode, dma_addr, len, ux500_channel->is_tx); 124 "packet_sz=%d, mode=%d, dma_addr=0x%x, len=%d is_tx=%d\n",
125 packet_sz, mode, dma_addr, len, ux500_channel->is_tx);
122 126
123 ux500_channel->cur_len = len; 127 ux500_channel->cur_len = len;
124 128
@@ -133,15 +137,13 @@ static bool ux500_configure_channel(struct dma_channel *channel,
133 DMA_SLAVE_BUSWIDTH_4_BYTES; 137 DMA_SLAVE_BUSWIDTH_4_BYTES;
134 138
135 slave_conf.direction = direction; 139 slave_conf.direction = direction;
136 if (direction == DMA_FROM_DEVICE) { 140 slave_conf.src_addr = usb_fifo_addr;
137 slave_conf.src_addr = usb_fifo_addr; 141 slave_conf.src_addr_width = addr_width;
138 slave_conf.src_addr_width = addr_width; 142 slave_conf.src_maxburst = 16;
139 slave_conf.src_maxburst = 16; 143 slave_conf.dst_addr = usb_fifo_addr;
140 } else { 144 slave_conf.dst_addr_width = addr_width;
141 slave_conf.dst_addr = usb_fifo_addr; 145 slave_conf.dst_maxburst = 16;
142 slave_conf.dst_addr_width = addr_width; 146
143 slave_conf.dst_maxburst = 16;
144 }
145 dma_chan->device->device_control(dma_chan, DMA_SLAVE_CONFIG, 147 dma_chan->device->device_control(dma_chan, DMA_SLAVE_CONFIG,
146 (unsigned long) &slave_conf); 148 (unsigned long) &slave_conf);
147 149
@@ -166,6 +168,7 @@ static struct dma_channel *ux500_dma_channel_allocate(struct dma_controller *c,
166 struct ux500_dma_controller *controller = container_of(c, 168 struct ux500_dma_controller *controller = container_of(c,
167 struct ux500_dma_controller, controller); 169 struct ux500_dma_controller, controller);
168 struct ux500_dma_channel *ux500_channel = NULL; 170 struct ux500_dma_channel *ux500_channel = NULL;
171 struct musb *musb = controller->private_data;
169 u8 ch_num = hw_ep->epnum - 1; 172 u8 ch_num = hw_ep->epnum - 1;
170 u32 max_ch; 173 u32 max_ch;
171 174
@@ -192,7 +195,7 @@ static struct dma_channel *ux500_dma_channel_allocate(struct dma_controller *c,
192 ux500_channel->hw_ep = hw_ep; 195 ux500_channel->hw_ep = hw_ep;
193 ux500_channel->is_allocated = 1; 196 ux500_channel->is_allocated = 1;
194 197
195 DBG(7, "hw_ep=%d, is_tx=0x%x, channel=%d\n", 198 dev_dbg(musb->controller, "hw_ep=%d, is_tx=0x%x, channel=%d\n",
196 hw_ep->epnum, is_tx, ch_num); 199 hw_ep->epnum, is_tx, ch_num);
197 200
198 return &(ux500_channel->channel); 201 return &(ux500_channel->channel);
@@ -201,8 +204,9 @@ static struct dma_channel *ux500_dma_channel_allocate(struct dma_controller *c,
201static void ux500_dma_channel_release(struct dma_channel *channel) 204static void ux500_dma_channel_release(struct dma_channel *channel)
202{ 205{
203 struct ux500_dma_channel *ux500_channel = channel->private_data; 206 struct ux500_dma_channel *ux500_channel = channel->private_data;
207 struct musb *musb = ux500_channel->controller->private_data;
204 208
205 DBG(7, "channel=%d\n", ux500_channel->ch_num); 209 dev_dbg(musb->controller, "channel=%d\n", ux500_channel->ch_num);
206 210
207 if (ux500_channel->is_allocated) { 211 if (ux500_channel->is_allocated) {
208 ux500_channel->is_allocated = 0; 212 ux500_channel->is_allocated = 0;
@@ -252,8 +256,8 @@ static int ux500_dma_channel_abort(struct dma_channel *channel)
252 void __iomem *epio = musb->endpoints[ux500_channel->hw_ep->epnum].regs; 256 void __iomem *epio = musb->endpoints[ux500_channel->hw_ep->epnum].regs;
253 u16 csr; 257 u16 csr;
254 258
255 DBG(4, "channel=%d, is_tx=%d\n", ux500_channel->ch_num, 259 dev_dbg(musb->controller, "channel=%d, is_tx=%d\n",
256 ux500_channel->is_tx); 260 ux500_channel->ch_num, ux500_channel->is_tx);
257 261
258 if (channel->status == MUSB_DMA_STATUS_BUSY) { 262 if (channel->status == MUSB_DMA_STATUS_BUSY) {
259 if (ux500_channel->is_tx) { 263 if (ux500_channel->is_tx) {