aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandre Bailon <abailon@baylibre.com>2017-10-09 23:46:09 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-10-17 05:42:51 -0400
commitbfa53e0e366b98185fadb03f7916d1538cb90ebd (patch)
tree123ab972a97777eeb75458ec51a5d8bd81f1a326
parent0c3aae9bd59978fb8c3557d7883380bef0f2cfa1 (diff)
usb: musb: musb_cppi41: Fix the address of teardown and autoreq registers
The DA8xx and DSPS platforms don't use the same address for few registers. On Da8xx, this is causing some issues (e.g. teardown that doesn't work). Configure the address of the register during the init and use them instead of constants. Cc: stable@vger.kernel.org # v4.12+ Reported-by: nsekhar@ti.com Signed-off-by: Alexandre Bailon <abailon@baylibre.com> Tested-by: Sekhar Nori <nsekhar@ti.com> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/musb/musb_cppi41.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/drivers/usb/musb/musb_cppi41.c b/drivers/usb/musb/musb_cppi41.c
index ba255280a624..d66416a27146 100644
--- a/drivers/usb/musb/musb_cppi41.c
+++ b/drivers/usb/musb/musb_cppi41.c
@@ -26,6 +26,9 @@
26 26
27#define MUSB_DMA_NUM_CHANNELS 15 27#define MUSB_DMA_NUM_CHANNELS 15
28 28
29#define DA8XX_USB_AUTOREQ 0x14
30#define DA8XX_USB_TEARDOWN 0x1c
31
29struct cppi41_dma_controller { 32struct cppi41_dma_controller {
30 struct dma_controller controller; 33 struct dma_controller controller;
31 struct cppi41_dma_channel rx_channel[MUSB_DMA_NUM_CHANNELS]; 34 struct cppi41_dma_channel rx_channel[MUSB_DMA_NUM_CHANNELS];
@@ -35,6 +38,9 @@ struct cppi41_dma_controller {
35 u32 rx_mode; 38 u32 rx_mode;
36 u32 tx_mode; 39 u32 tx_mode;
37 u32 auto_req; 40 u32 auto_req;
41
42 u32 tdown_reg;
43 u32 autoreq_reg;
38}; 44};
39 45
40static void save_rx_toggle(struct cppi41_dma_channel *cppi41_channel) 46static void save_rx_toggle(struct cppi41_dma_channel *cppi41_channel)
@@ -364,8 +370,8 @@ static void cppi41_set_autoreq_mode(struct cppi41_dma_channel *cppi41_channel,
364 if (new_mode == old_mode) 370 if (new_mode == old_mode)
365 return; 371 return;
366 controller->auto_req = new_mode; 372 controller->auto_req = new_mode;
367 musb_writel(controller->controller.musb->ctrl_base, USB_CTRL_AUTOREQ, 373 musb_writel(controller->controller.musb->ctrl_base,
368 new_mode); 374 controller->autoreq_reg, new_mode);
369} 375}
370 376
371static bool cppi41_configure_channel(struct dma_channel *channel, 377static bool cppi41_configure_channel(struct dma_channel *channel,
@@ -581,12 +587,13 @@ static int cppi41_dma_channel_abort(struct dma_channel *channel)
581 587
582 do { 588 do {
583 if (is_tx) 589 if (is_tx)
584 musb_writel(musb->ctrl_base, USB_TDOWN, tdbit); 590 musb_writel(musb->ctrl_base, controller->tdown_reg,
591 tdbit);
585 ret = dmaengine_terminate_all(cppi41_channel->dc); 592 ret = dmaengine_terminate_all(cppi41_channel->dc);
586 } while (ret == -EAGAIN); 593 } while (ret == -EAGAIN);
587 594
588 if (is_tx) { 595 if (is_tx) {
589 musb_writel(musb->ctrl_base, USB_TDOWN, tdbit); 596 musb_writel(musb->ctrl_base, controller->tdown_reg, tdbit);
590 597
591 csr = musb_readw(epio, MUSB_TXCSR); 598 csr = musb_readw(epio, MUSB_TXCSR);
592 if (csr & MUSB_TXCSR_TXPKTRDY) { 599 if (csr & MUSB_TXCSR_TXPKTRDY) {
@@ -727,6 +734,14 @@ cppi41_dma_controller_create(struct musb *musb, void __iomem *base)
727 controller->controller.is_compatible = cppi41_is_compatible; 734 controller->controller.is_compatible = cppi41_is_compatible;
728 controller->controller.musb = musb; 735 controller->controller.musb = musb;
729 736
737 if (musb->io.quirks & MUSB_DA8XX) {
738 controller->tdown_reg = DA8XX_USB_TEARDOWN;
739 controller->autoreq_reg = DA8XX_USB_AUTOREQ;
740 } else {
741 controller->tdown_reg = USB_TDOWN;
742 controller->autoreq_reg = USB_CTRL_AUTOREQ;
743 }
744
730 ret = cppi41_dma_controller_start(controller); 745 ret = cppi41_dma_controller_start(controller);
731 if (ret) 746 if (ret)
732 goto plat_get_fail; 747 goto plat_get_fail;