diff options
Diffstat (limited to 'drivers/usb/musb')
-rw-r--r-- | drivers/usb/musb/cppi_dma.c | 10 | ||||
-rw-r--r-- | drivers/usb/musb/musb_core.c | 4 | ||||
-rw-r--r-- | drivers/usb/musb/musb_gadget.c | 79 | ||||
-rw-r--r-- | drivers/usb/musb/musb_gadget_ep0.c | 3 | ||||
-rw-r--r-- | drivers/usb/musb/musb_host.c | 5 | ||||
-rw-r--r-- | drivers/usb/musb/omap2430.c | 2 | ||||
-rw-r--r-- | drivers/usb/musb/omap2430.h | 2 | ||||
-rw-r--r-- | drivers/usb/musb/tusb6010_omap.c | 4 |
8 files changed, 51 insertions, 58 deletions
diff --git a/drivers/usb/musb/cppi_dma.c b/drivers/usb/musb/cppi_dma.c index c3577bbbae6c..ef2332a9941d 100644 --- a/drivers/usb/musb/cppi_dma.c +++ b/drivers/usb/musb/cppi_dma.c | |||
@@ -1442,11 +1442,6 @@ static int cppi_channel_abort(struct dma_channel *channel) | |||
1442 | musb_writew(regs, MUSB_TXCSR, value); | 1442 | musb_writew(regs, MUSB_TXCSR, value); |
1443 | musb_writew(regs, MUSB_TXCSR, value); | 1443 | musb_writew(regs, MUSB_TXCSR, value); |
1444 | 1444 | ||
1445 | /* re-enable interrupt */ | ||
1446 | if (enabled) | ||
1447 | musb_writel(tibase, DAVINCI_TXCPPI_INTENAB_REG, | ||
1448 | (1 << cppi_ch->index)); | ||
1449 | |||
1450 | /* While we scrub the TX state RAM, ensure that we clean | 1445 | /* While we scrub the TX state RAM, ensure that we clean |
1451 | * up any interrupt that's currently asserted: | 1446 | * up any interrupt that's currently asserted: |
1452 | * 1. Write to completion Ptr value 0x1(bit 0 set) | 1447 | * 1. Write to completion Ptr value 0x1(bit 0 set) |
@@ -1459,6 +1454,11 @@ static int cppi_channel_abort(struct dma_channel *channel) | |||
1459 | cppi_reset_tx(tx_ram, 1); | 1454 | cppi_reset_tx(tx_ram, 1); |
1460 | musb_writel(&tx_ram->tx_complete, 0, 0); | 1455 | musb_writel(&tx_ram->tx_complete, 0, 0); |
1461 | 1456 | ||
1457 | /* re-enable interrupt */ | ||
1458 | if (enabled) | ||
1459 | musb_writel(tibase, DAVINCI_TXCPPI_INTENAB_REG, | ||
1460 | (1 << cppi_ch->index)); | ||
1461 | |||
1462 | cppi_dump_tx(5, cppi_ch, " (done teardown)"); | 1462 | cppi_dump_tx(5, cppi_ch, " (done teardown)"); |
1463 | 1463 | ||
1464 | /* REVISIT tx side _should_ clean up the same way | 1464 | /* REVISIT tx side _should_ clean up the same way |
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 3a61ddb62bd2..547e0e390726 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
@@ -1450,7 +1450,7 @@ static int __init musb_core_init(u16 musb_type, struct musb *musb) | |||
1450 | #endif | 1450 | #endif |
1451 | 1451 | ||
1452 | if (hw_ep->max_packet_sz_tx) { | 1452 | if (hw_ep->max_packet_sz_tx) { |
1453 | printk(KERN_DEBUG | 1453 | DBG(1, |
1454 | "%s: hw_ep %d%s, %smax %d\n", | 1454 | "%s: hw_ep %d%s, %smax %d\n", |
1455 | musb_driver_name, i, | 1455 | musb_driver_name, i, |
1456 | hw_ep->is_shared_fifo ? "shared" : "tx", | 1456 | hw_ep->is_shared_fifo ? "shared" : "tx", |
@@ -1459,7 +1459,7 @@ static int __init musb_core_init(u16 musb_type, struct musb *musb) | |||
1459 | hw_ep->max_packet_sz_tx); | 1459 | hw_ep->max_packet_sz_tx); |
1460 | } | 1460 | } |
1461 | if (hw_ep->max_packet_sz_rx && !hw_ep->is_shared_fifo) { | 1461 | if (hw_ep->max_packet_sz_rx && !hw_ep->is_shared_fifo) { |
1462 | printk(KERN_DEBUG | 1462 | DBG(1, |
1463 | "%s: hw_ep %d%s, %smax %d\n", | 1463 | "%s: hw_ep %d%s, %smax %d\n", |
1464 | musb_driver_name, i, | 1464 | musb_driver_name, i, |
1465 | "rx", | 1465 | "rx", |
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index 8b3c4e2ed7b8..74073f9a43f0 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c | |||
@@ -4,6 +4,7 @@ | |||
4 | * Copyright 2005 Mentor Graphics Corporation | 4 | * Copyright 2005 Mentor Graphics Corporation |
5 | * Copyright (C) 2005-2006 by Texas Instruments | 5 | * Copyright (C) 2005-2006 by Texas Instruments |
6 | * Copyright (C) 2006-2007 Nokia Corporation | 6 | * Copyright (C) 2006-2007 Nokia Corporation |
7 | * Copyright (C) 2009 MontaVista Software, Inc. <source@mvista.com> | ||
7 | * | 8 | * |
8 | * This program is free software; you can redistribute it and/or | 9 | * This program is free software; you can redistribute it and/or |
9 | * modify it under the terms of the GNU General Public License | 10 | * modify it under the terms of the GNU General Public License |
@@ -436,14 +437,6 @@ void musb_g_tx(struct musb *musb, u8 epnum) | |||
436 | csr |= MUSB_TXCSR_P_WZC_BITS; | 437 | csr |= MUSB_TXCSR_P_WZC_BITS; |
437 | csr &= ~MUSB_TXCSR_P_SENTSTALL; | 438 | csr &= ~MUSB_TXCSR_P_SENTSTALL; |
438 | musb_writew(epio, MUSB_TXCSR, csr); | 439 | musb_writew(epio, MUSB_TXCSR, csr); |
439 | if (dma_channel_status(dma) == MUSB_DMA_STATUS_BUSY) { | ||
440 | dma->status = MUSB_DMA_STATUS_CORE_ABORT; | ||
441 | musb->dma_controller->channel_abort(dma); | ||
442 | } | ||
443 | |||
444 | if (request) | ||
445 | musb_g_giveback(musb_ep, request, -EPIPE); | ||
446 | |||
447 | break; | 440 | break; |
448 | } | 441 | } |
449 | 442 | ||
@@ -582,15 +575,25 @@ void musb_g_tx(struct musb *musb, u8 epnum) | |||
582 | */ | 575 | */ |
583 | static void rxstate(struct musb *musb, struct musb_request *req) | 576 | static void rxstate(struct musb *musb, struct musb_request *req) |
584 | { | 577 | { |
585 | u16 csr = 0; | ||
586 | const u8 epnum = req->epnum; | 578 | const u8 epnum = req->epnum; |
587 | struct usb_request *request = &req->request; | 579 | struct usb_request *request = &req->request; |
588 | struct musb_ep *musb_ep = &musb->endpoints[epnum].ep_out; | 580 | struct musb_ep *musb_ep = &musb->endpoints[epnum].ep_out; |
589 | void __iomem *epio = musb->endpoints[epnum].regs; | 581 | void __iomem *epio = musb->endpoints[epnum].regs; |
590 | unsigned fifo_count = 0; | 582 | unsigned fifo_count = 0; |
591 | u16 len = musb_ep->packet_sz; | 583 | u16 len = musb_ep->packet_sz; |
584 | u16 csr = musb_readw(epio, MUSB_RXCSR); | ||
592 | 585 | ||
593 | csr = musb_readw(epio, MUSB_RXCSR); | 586 | /* We shouldn't get here while DMA is active, but we do... */ |
587 | if (dma_channel_status(musb_ep->dma) == MUSB_DMA_STATUS_BUSY) { | ||
588 | DBG(4, "DMA pending...\n"); | ||
589 | return; | ||
590 | } | ||
591 | |||
592 | if (csr & MUSB_RXCSR_P_SENDSTALL) { | ||
593 | DBG(5, "%s stalling, RXCSR %04x\n", | ||
594 | musb_ep->end_point.name, csr); | ||
595 | return; | ||
596 | } | ||
594 | 597 | ||
595 | if (is_cppi_enabled() && musb_ep->dma) { | 598 | if (is_cppi_enabled() && musb_ep->dma) { |
596 | struct dma_controller *c = musb->dma_controller; | 599 | struct dma_controller *c = musb->dma_controller; |
@@ -761,19 +764,10 @@ void musb_g_rx(struct musb *musb, u8 epnum) | |||
761 | csr, dma ? " (dma)" : "", request); | 764 | csr, dma ? " (dma)" : "", request); |
762 | 765 | ||
763 | if (csr & MUSB_RXCSR_P_SENTSTALL) { | 766 | if (csr & MUSB_RXCSR_P_SENTSTALL) { |
764 | if (dma_channel_status(dma) == MUSB_DMA_STATUS_BUSY) { | ||
765 | dma->status = MUSB_DMA_STATUS_CORE_ABORT; | ||
766 | (void) musb->dma_controller->channel_abort(dma); | ||
767 | request->actual += musb_ep->dma->actual_len; | ||
768 | } | ||
769 | |||
770 | csr |= MUSB_RXCSR_P_WZC_BITS; | 767 | csr |= MUSB_RXCSR_P_WZC_BITS; |
771 | csr &= ~MUSB_RXCSR_P_SENTSTALL; | 768 | csr &= ~MUSB_RXCSR_P_SENTSTALL; |
772 | musb_writew(epio, MUSB_RXCSR, csr); | 769 | musb_writew(epio, MUSB_RXCSR, csr); |
773 | 770 | return; | |
774 | if (request) | ||
775 | musb_g_giveback(musb_ep, request, -EPIPE); | ||
776 | goto done; | ||
777 | } | 771 | } |
778 | 772 | ||
779 | if (csr & MUSB_RXCSR_P_OVERRUN) { | 773 | if (csr & MUSB_RXCSR_P_OVERRUN) { |
@@ -795,7 +789,7 @@ void musb_g_rx(struct musb *musb, u8 epnum) | |||
795 | DBG((csr & MUSB_RXCSR_DMAENAB) ? 4 : 1, | 789 | DBG((csr & MUSB_RXCSR_DMAENAB) ? 4 : 1, |
796 | "%s busy, csr %04x\n", | 790 | "%s busy, csr %04x\n", |
797 | musb_ep->end_point.name, csr); | 791 | musb_ep->end_point.name, csr); |
798 | goto done; | 792 | return; |
799 | } | 793 | } |
800 | 794 | ||
801 | if (dma && (csr & MUSB_RXCSR_DMAENAB)) { | 795 | if (dma && (csr & MUSB_RXCSR_DMAENAB)) { |
@@ -826,22 +820,15 @@ void musb_g_rx(struct musb *musb, u8 epnum) | |||
826 | if ((request->actual < request->length) | 820 | if ((request->actual < request->length) |
827 | && (musb_ep->dma->actual_len | 821 | && (musb_ep->dma->actual_len |
828 | == musb_ep->packet_sz)) | 822 | == musb_ep->packet_sz)) |
829 | goto done; | 823 | return; |
830 | #endif | 824 | #endif |
831 | musb_g_giveback(musb_ep, request, 0); | 825 | musb_g_giveback(musb_ep, request, 0); |
832 | 826 | ||
833 | request = next_request(musb_ep); | 827 | request = next_request(musb_ep); |
834 | if (!request) | 828 | if (!request) |
835 | goto done; | 829 | return; |
836 | |||
837 | /* don't start more i/o till the stall clears */ | ||
838 | musb_ep_select(mbase, epnum); | ||
839 | csr = musb_readw(epio, MUSB_RXCSR); | ||
840 | if (csr & MUSB_RXCSR_P_SENDSTALL) | ||
841 | goto done; | ||
842 | } | 830 | } |
843 | 831 | ||
844 | |||
845 | /* analyze request if the ep is hot */ | 832 | /* analyze request if the ep is hot */ |
846 | if (request) | 833 | if (request) |
847 | rxstate(musb, to_musb_request(request)); | 834 | rxstate(musb, to_musb_request(request)); |
@@ -849,8 +836,6 @@ void musb_g_rx(struct musb *musb, u8 epnum) | |||
849 | DBG(3, "packet waiting for %s%s request\n", | 836 | DBG(3, "packet waiting for %s%s request\n", |
850 | musb_ep->desc ? "" : "inactive ", | 837 | musb_ep->desc ? "" : "inactive ", |
851 | musb_ep->end_point.name); | 838 | musb_ep->end_point.name); |
852 | |||
853 | done: | ||
854 | return; | 839 | return; |
855 | } | 840 | } |
856 | 841 | ||
@@ -1244,7 +1229,7 @@ int musb_gadget_set_halt(struct usb_ep *ep, int value) | |||
1244 | void __iomem *mbase; | 1229 | void __iomem *mbase; |
1245 | unsigned long flags; | 1230 | unsigned long flags; |
1246 | u16 csr; | 1231 | u16 csr; |
1247 | struct musb_request *request = NULL; | 1232 | struct musb_request *request; |
1248 | int status = 0; | 1233 | int status = 0; |
1249 | 1234 | ||
1250 | if (!ep) | 1235 | if (!ep) |
@@ -1260,24 +1245,29 @@ int musb_gadget_set_halt(struct usb_ep *ep, int value) | |||
1260 | 1245 | ||
1261 | musb_ep_select(mbase, epnum); | 1246 | musb_ep_select(mbase, epnum); |
1262 | 1247 | ||
1263 | /* cannot portably stall with non-empty FIFO */ | ||
1264 | request = to_musb_request(next_request(musb_ep)); | 1248 | request = to_musb_request(next_request(musb_ep)); |
1265 | if (value && musb_ep->is_in) { | 1249 | if (value) { |
1266 | csr = musb_readw(epio, MUSB_TXCSR); | 1250 | if (request) { |
1267 | if (csr & MUSB_TXCSR_FIFONOTEMPTY) { | 1251 | DBG(3, "request in progress, cannot halt %s\n", |
1268 | DBG(3, "%s fifo busy, cannot halt\n", ep->name); | 1252 | ep->name); |
1269 | spin_unlock_irqrestore(&musb->lock, flags); | 1253 | status = -EAGAIN; |
1270 | return -EAGAIN; | 1254 | goto done; |
1255 | } | ||
1256 | /* Cannot portably stall with non-empty FIFO */ | ||
1257 | if (musb_ep->is_in) { | ||
1258 | csr = musb_readw(epio, MUSB_TXCSR); | ||
1259 | if (csr & MUSB_TXCSR_FIFONOTEMPTY) { | ||
1260 | DBG(3, "FIFO busy, cannot halt %s\n", ep->name); | ||
1261 | status = -EAGAIN; | ||
1262 | goto done; | ||
1263 | } | ||
1271 | } | 1264 | } |
1272 | |||
1273 | } | 1265 | } |
1274 | 1266 | ||
1275 | /* set/clear the stall and toggle bits */ | 1267 | /* set/clear the stall and toggle bits */ |
1276 | DBG(2, "%s: %s stall\n", ep->name, value ? "set" : "clear"); | 1268 | DBG(2, "%s: %s stall\n", ep->name, value ? "set" : "clear"); |
1277 | if (musb_ep->is_in) { | 1269 | if (musb_ep->is_in) { |
1278 | csr = musb_readw(epio, MUSB_TXCSR); | 1270 | csr = musb_readw(epio, MUSB_TXCSR); |
1279 | if (csr & MUSB_TXCSR_FIFONOTEMPTY) | ||
1280 | csr |= MUSB_TXCSR_FLUSHFIFO; | ||
1281 | csr |= MUSB_TXCSR_P_WZC_BITS | 1271 | csr |= MUSB_TXCSR_P_WZC_BITS |
1282 | | MUSB_TXCSR_CLRDATATOG; | 1272 | | MUSB_TXCSR_CLRDATATOG; |
1283 | if (value) | 1273 | if (value) |
@@ -1300,14 +1290,13 @@ int musb_gadget_set_halt(struct usb_ep *ep, int value) | |||
1300 | musb_writew(epio, MUSB_RXCSR, csr); | 1290 | musb_writew(epio, MUSB_RXCSR, csr); |
1301 | } | 1291 | } |
1302 | 1292 | ||
1303 | done: | ||
1304 | |||
1305 | /* maybe start the first request in the queue */ | 1293 | /* maybe start the first request in the queue */ |
1306 | if (!musb_ep->busy && !value && request) { | 1294 | if (!musb_ep->busy && !value && request) { |
1307 | DBG(3, "restarting the request\n"); | 1295 | DBG(3, "restarting the request\n"); |
1308 | musb_ep_restart(musb, request); | 1296 | musb_ep_restart(musb, request); |
1309 | } | 1297 | } |
1310 | 1298 | ||
1299 | done: | ||
1311 | spin_unlock_irqrestore(&musb->lock, flags); | 1300 | spin_unlock_irqrestore(&musb->lock, flags); |
1312 | return status; | 1301 | return status; |
1313 | } | 1302 | } |
diff --git a/drivers/usb/musb/musb_gadget_ep0.c b/drivers/usb/musb/musb_gadget_ep0.c index 7a6778675ad3..522efb31b56b 100644 --- a/drivers/usb/musb/musb_gadget_ep0.c +++ b/drivers/usb/musb/musb_gadget_ep0.c | |||
@@ -511,7 +511,8 @@ static void ep0_txstate(struct musb *musb) | |||
511 | 511 | ||
512 | /* update the flags */ | 512 | /* update the flags */ |
513 | if (fifo_count < MUSB_MAX_END0_PACKET | 513 | if (fifo_count < MUSB_MAX_END0_PACKET |
514 | || request->actual == request->length) { | 514 | || (request->actual == request->length |
515 | && !request->zero)) { | ||
515 | musb->ep0_state = MUSB_EP0_STAGE_STATUSOUT; | 516 | musb->ep0_state = MUSB_EP0_STAGE_STATUSOUT; |
516 | csr |= MUSB_CSR0_P_DATAEND; | 517 | csr |= MUSB_CSR0_P_DATAEND; |
517 | } else | 518 | } else |
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c index cf94511485f2..e3ab40a966eb 100644 --- a/drivers/usb/musb/musb_host.c +++ b/drivers/usb/musb/musb_host.c | |||
@@ -1301,8 +1301,11 @@ void musb_host_tx(struct musb *musb, u8 epnum) | |||
1301 | return; | 1301 | return; |
1302 | } else if (usb_pipeisoc(pipe) && dma) { | 1302 | } else if (usb_pipeisoc(pipe) && dma) { |
1303 | if (musb_tx_dma_program(musb->dma_controller, hw_ep, qh, urb, | 1303 | if (musb_tx_dma_program(musb->dma_controller, hw_ep, qh, urb, |
1304 | offset, length)) | 1304 | offset, length)) { |
1305 | if (is_cppi_enabled() || tusb_dma_omap()) | ||
1306 | musb_h_tx_dma_start(hw_ep); | ||
1305 | return; | 1307 | return; |
1308 | } | ||
1306 | } else if (tx_csr & MUSB_TXCSR_DMAENAB) { | 1309 | } else if (tx_csr & MUSB_TXCSR_DMAENAB) { |
1307 | DBG(1, "not complete, but DMA enabled?\n"); | 1310 | DBG(1, "not complete, but DMA enabled?\n"); |
1308 | return; | 1311 | return; |
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index 34875201ee04..6761d2088db8 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c | |||
@@ -35,7 +35,7 @@ | |||
35 | 35 | ||
36 | #include <asm/mach-types.h> | 36 | #include <asm/mach-types.h> |
37 | #include <mach/hardware.h> | 37 | #include <mach/hardware.h> |
38 | #include <mach/mux.h> | 38 | #include <plat/mux.h> |
39 | 39 | ||
40 | #include "musb_core.h" | 40 | #include "musb_core.h" |
41 | #include "omap2430.h" | 41 | #include "omap2430.h" |
diff --git a/drivers/usb/musb/omap2430.h b/drivers/usb/musb/omap2430.h index dc7670718cd2..fbede7798aed 100644 --- a/drivers/usb/musb/omap2430.h +++ b/drivers/usb/musb/omap2430.h | |||
@@ -12,7 +12,7 @@ | |||
12 | 12 | ||
13 | #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3430) | 13 | #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3430) |
14 | #include <mach/hardware.h> | 14 | #include <mach/hardware.h> |
15 | #include <mach/usb.h> | 15 | #include <plat/usb.h> |
16 | 16 | ||
17 | /* | 17 | /* |
18 | * OMAP2430-specific definitions | 18 | * OMAP2430-specific definitions |
diff --git a/drivers/usb/musb/tusb6010_omap.c b/drivers/usb/musb/tusb6010_omap.c index 7e073a0d7ac9..e13c77052e5e 100644 --- a/drivers/usb/musb/tusb6010_omap.c +++ b/drivers/usb/musb/tusb6010_omap.c | |||
@@ -15,8 +15,8 @@ | |||
15 | #include <linux/usb.h> | 15 | #include <linux/usb.h> |
16 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
17 | #include <linux/dma-mapping.h> | 17 | #include <linux/dma-mapping.h> |
18 | #include <mach/dma.h> | 18 | #include <plat/dma.h> |
19 | #include <mach/mux.h> | 19 | #include <plat/mux.h> |
20 | 20 | ||
21 | #include "musb_core.h" | 21 | #include "musb_core.h" |
22 | 22 | ||