diff options
author | Alexandre Bailon <abailon@baylibre.com> | 2017-02-06 23:53:53 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-02-09 07:35:05 -0500 |
commit | 03158f90155bcd6126b2636fca5b38fe96e5cbda (patch) | |
tree | 274b013bad96a9e4179033f7a17d24989ed87813 /drivers | |
parent | ed232c0b4bebcb7325fbf38a21bcf4f6a8c0153f (diff) |
usb: musb: cppi_dma: Clean up cppi structure
A pointer to musb is now present in the dma_controller structure.
Remove the one present in cppi structure.
Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/musb/cppi_dma.c | 26 | ||||
-rw-r--r-- | drivers/usb/musb/cppi_dma.h | 1 |
2 files changed, 13 insertions, 14 deletions
diff --git a/drivers/usb/musb/cppi_dma.c b/drivers/usb/musb/cppi_dma.c index 1ae48e64e975..c4fabe952ca6 100644 --- a/drivers/usb/musb/cppi_dma.c +++ b/drivers/usb/musb/cppi_dma.c | |||
@@ -224,7 +224,7 @@ static void cppi_controller_stop(struct cppi *controller) | |||
224 | int i; | 224 | int i; |
225 | struct musb *musb; | 225 | struct musb *musb; |
226 | 226 | ||
227 | musb = controller->musb; | 227 | musb = controller->controller.musb; |
228 | 228 | ||
229 | tibase = controller->tibase; | 229 | tibase = controller->tibase; |
230 | /* DISABLE INDIVIDUAL CHANNEL Interrupts */ | 230 | /* DISABLE INDIVIDUAL CHANNEL Interrupts */ |
@@ -288,7 +288,7 @@ cppi_channel_allocate(struct dma_controller *c, | |||
288 | 288 | ||
289 | controller = container_of(c, struct cppi, controller); | 289 | controller = container_of(c, struct cppi, controller); |
290 | tibase = controller->tibase; | 290 | tibase = controller->tibase; |
291 | musb = controller->musb; | 291 | musb = c->musb; |
292 | 292 | ||
293 | /* ep0 doesn't use DMA; remember cppi indices are 0..N-1 */ | 293 | /* ep0 doesn't use DMA; remember cppi indices are 0..N-1 */ |
294 | index = ep->epnum - 1; | 294 | index = ep->epnum - 1; |
@@ -336,7 +336,7 @@ static void cppi_channel_release(struct dma_channel *channel) | |||
336 | c = container_of(channel, struct cppi_channel, channel); | 336 | c = container_of(channel, struct cppi_channel, channel); |
337 | tibase = c->controller->tibase; | 337 | tibase = c->controller->tibase; |
338 | if (!c->hw_ep) | 338 | if (!c->hw_ep) |
339 | musb_dbg(c->controller->musb, | 339 | musb_dbg(c->controller->controller.musb, |
340 | "releasing idle DMA channel %p", c); | 340 | "releasing idle DMA channel %p", c); |
341 | else if (!c->transmit) | 341 | else if (!c->transmit) |
342 | core_rxirq_enable(tibase, c->index + 1); | 342 | core_rxirq_enable(tibase, c->index + 1); |
@@ -355,7 +355,7 @@ cppi_dump_rx(int level, struct cppi_channel *c, const char *tag) | |||
355 | 355 | ||
356 | musb_ep_select(base, c->index + 1); | 356 | musb_ep_select(base, c->index + 1); |
357 | 357 | ||
358 | musb_dbg(c->controller->musb, | 358 | musb_dbg(c->controller->controller.musb, |
359 | "RX DMA%d%s: %d left, csr %04x, " | 359 | "RX DMA%d%s: %d left, csr %04x, " |
360 | "%08x H%08x S%08x C%08x, " | 360 | "%08x H%08x S%08x C%08x, " |
361 | "B%08x L%08x %08x .. %08x", | 361 | "B%08x L%08x %08x .. %08x", |
@@ -385,7 +385,7 @@ cppi_dump_tx(int level, struct cppi_channel *c, const char *tag) | |||
385 | 385 | ||
386 | musb_ep_select(base, c->index + 1); | 386 | musb_ep_select(base, c->index + 1); |
387 | 387 | ||
388 | musb_dbg(c->controller->musb, | 388 | musb_dbg(c->controller->controller.musb, |
389 | "TX DMA%d%s: csr %04x, " | 389 | "TX DMA%d%s: csr %04x, " |
390 | "H%08x S%08x C%08x %08x, " | 390 | "H%08x S%08x C%08x %08x, " |
391 | "F%08x L%08x .. %08x", | 391 | "F%08x L%08x .. %08x", |
@@ -954,7 +954,7 @@ static int cppi_channel_program(struct dma_channel *ch, | |||
954 | 954 | ||
955 | cppi_ch = container_of(ch, struct cppi_channel, channel); | 955 | cppi_ch = container_of(ch, struct cppi_channel, channel); |
956 | controller = cppi_ch->controller; | 956 | controller = cppi_ch->controller; |
957 | musb = controller->musb; | 957 | musb = controller->controller.musb; |
958 | 958 | ||
959 | switch (ch->status) { | 959 | switch (ch->status) { |
960 | case MUSB_DMA_STATUS_BUS_ABORT: | 960 | case MUSB_DMA_STATUS_BUS_ABORT: |
@@ -1009,7 +1009,7 @@ static bool cppi_rx_scan(struct cppi *cppi, unsigned ch) | |||
1009 | int i; | 1009 | int i; |
1010 | dma_addr_t safe2ack; | 1010 | dma_addr_t safe2ack; |
1011 | void __iomem *regs = rx->hw_ep->regs; | 1011 | void __iomem *regs = rx->hw_ep->regs; |
1012 | struct musb *musb = cppi->musb; | 1012 | struct musb *musb = cppi->controller.musb; |
1013 | 1013 | ||
1014 | cppi_dump_rx(6, rx, "/K"); | 1014 | cppi_dump_rx(6, rx, "/K"); |
1015 | 1015 | ||
@@ -1121,7 +1121,7 @@ static bool cppi_rx_scan(struct cppi *cppi, unsigned ch) | |||
1121 | * setting it here "should" be racey, but seems to work | 1121 | * setting it here "should" be racey, but seems to work |
1122 | */ | 1122 | */ |
1123 | csr = musb_readw(rx->hw_ep->regs, MUSB_RXCSR); | 1123 | csr = musb_readw(rx->hw_ep->regs, MUSB_RXCSR); |
1124 | if (is_host_active(cppi->musb) | 1124 | if (is_host_active(cppi->controller.musb) |
1125 | && bd | 1125 | && bd |
1126 | && !(csr & MUSB_RXCSR_H_REQPKT)) { | 1126 | && !(csr & MUSB_RXCSR_H_REQPKT)) { |
1127 | csr |= MUSB_RXCSR_H_REQPKT; | 1127 | csr |= MUSB_RXCSR_H_REQPKT; |
@@ -1311,7 +1311,7 @@ cppi_dma_controller_create(struct musb *musb, void __iomem *mregs) | |||
1311 | controller->mregs = mregs; | 1311 | controller->mregs = mregs; |
1312 | controller->tibase = mregs - DAVINCI_BASE_OFFSET; | 1312 | controller->tibase = mregs - DAVINCI_BASE_OFFSET; |
1313 | 1313 | ||
1314 | controller->musb = musb; | 1314 | controller->controller.musb = musb; |
1315 | controller->controller.channel_alloc = cppi_channel_allocate; | 1315 | controller->controller.channel_alloc = cppi_channel_allocate; |
1316 | controller->controller.channel_release = cppi_channel_release; | 1316 | controller->controller.channel_release = cppi_channel_release; |
1317 | controller->controller.channel_program = cppi_channel_program; | 1317 | controller->controller.channel_program = cppi_channel_program; |
@@ -1323,7 +1323,7 @@ cppi_dma_controller_create(struct musb *musb, void __iomem *mregs) | |||
1323 | 1323 | ||
1324 | /* setup BufferPool */ | 1324 | /* setup BufferPool */ |
1325 | controller->pool = dma_pool_create("cppi", | 1325 | controller->pool = dma_pool_create("cppi", |
1326 | controller->musb->controller, | 1326 | controller->controller.musb->controller, |
1327 | sizeof(struct cppi_descriptor), | 1327 | sizeof(struct cppi_descriptor), |
1328 | CPPI_DESCRIPTOR_ALIGN, 0); | 1328 | CPPI_DESCRIPTOR_ALIGN, 0); |
1329 | if (!controller->pool) { | 1329 | if (!controller->pool) { |
@@ -1357,7 +1357,7 @@ void cppi_dma_controller_destroy(struct dma_controller *c) | |||
1357 | cppi_controller_stop(cppi); | 1357 | cppi_controller_stop(cppi); |
1358 | 1358 | ||
1359 | if (cppi->irq) | 1359 | if (cppi->irq) |
1360 | free_irq(cppi->irq, cppi->musb); | 1360 | free_irq(cppi->irq, cppi->controller.musb); |
1361 | 1361 | ||
1362 | /* assert: caller stopped the controller first */ | 1362 | /* assert: caller stopped the controller first */ |
1363 | dma_pool_destroy(cppi->pool); | 1363 | dma_pool_destroy(cppi->pool); |
@@ -1469,7 +1469,7 @@ static int cppi_channel_abort(struct dma_channel *channel) | |||
1469 | core_rxirq_disable(tibase, cppi_ch->index + 1); | 1469 | core_rxirq_disable(tibase, cppi_ch->index + 1); |
1470 | 1470 | ||
1471 | /* for host, ensure ReqPkt is never set again */ | 1471 | /* for host, ensure ReqPkt is never set again */ |
1472 | if (is_host_active(cppi_ch->controller->musb)) { | 1472 | if (is_host_active(cppi_ch->controller->controller.musb)) { |
1473 | value = musb_readl(tibase, DAVINCI_AUTOREQ_REG); | 1473 | value = musb_readl(tibase, DAVINCI_AUTOREQ_REG); |
1474 | value &= ~((0x3) << (cppi_ch->index * 2)); | 1474 | value &= ~((0x3) << (cppi_ch->index * 2)); |
1475 | musb_writel(tibase, DAVINCI_AUTOREQ_REG, value); | 1475 | musb_writel(tibase, DAVINCI_AUTOREQ_REG, value); |
@@ -1478,7 +1478,7 @@ static int cppi_channel_abort(struct dma_channel *channel) | |||
1478 | csr = musb_readw(regs, MUSB_RXCSR); | 1478 | csr = musb_readw(regs, MUSB_RXCSR); |
1479 | 1479 | ||
1480 | /* for host, clear (just) ReqPkt at end of current packet(s) */ | 1480 | /* for host, clear (just) ReqPkt at end of current packet(s) */ |
1481 | if (is_host_active(cppi_ch->controller->musb)) { | 1481 | if (is_host_active(cppi_ch->controller->controller.musb)) { |
1482 | csr |= MUSB_RXCSR_H_WZC_BITS; | 1482 | csr |= MUSB_RXCSR_H_WZC_BITS; |
1483 | csr &= ~MUSB_RXCSR_H_REQPKT; | 1483 | csr &= ~MUSB_RXCSR_H_REQPKT; |
1484 | } else | 1484 | } else |
diff --git a/drivers/usb/musb/cppi_dma.h b/drivers/usb/musb/cppi_dma.h index 7fdfb71a8f09..9bb7c5e45c85 100644 --- a/drivers/usb/musb/cppi_dma.h +++ b/drivers/usb/musb/cppi_dma.h | |||
@@ -107,7 +107,6 @@ struct cppi_channel { | |||
107 | /* CPPI DMA controller object */ | 107 | /* CPPI DMA controller object */ |
108 | struct cppi { | 108 | struct cppi { |
109 | struct dma_controller controller; | 109 | struct dma_controller controller; |
110 | struct musb *musb; | ||
111 | void __iomem *mregs; /* Mentor regs */ | 110 | void __iomem *mregs; /* Mentor regs */ |
112 | void __iomem *tibase; /* TI/CPPI regs */ | 111 | void __iomem *tibase; /* TI/CPPI regs */ |
113 | 112 | ||