Commit 03158f90 authored by Alexandre Bailon's avatar Alexandre Bailon Committed by Greg Kroah-Hartman

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: default avatarAlexandre Bailon <abailon@baylibre.com>
Signed-off-by: default avatarBin Liu <b-liu@ti.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ed232c0b
...@@ -224,7 +224,7 @@ static void cppi_controller_stop(struct cppi *controller) ...@@ -224,7 +224,7 @@ static void cppi_controller_stop(struct cppi *controller)
int i; int i;
struct musb *musb; struct musb *musb;
musb = controller->musb; musb = controller->controller.musb;
tibase = controller->tibase; tibase = controller->tibase;
/* DISABLE INDIVIDUAL CHANNEL Interrupts */ /* DISABLE INDIVIDUAL CHANNEL Interrupts */
...@@ -288,7 +288,7 @@ cppi_channel_allocate(struct dma_controller *c, ...@@ -288,7 +288,7 @@ cppi_channel_allocate(struct dma_controller *c,
controller = container_of(c, struct cppi, controller); controller = container_of(c, struct cppi, controller);
tibase = controller->tibase; tibase = controller->tibase;
musb = controller->musb; musb = c->musb;
/* ep0 doesn't use DMA; remember cppi indices are 0..N-1 */ /* ep0 doesn't use DMA; remember cppi indices are 0..N-1 */
index = ep->epnum - 1; index = ep->epnum - 1;
...@@ -336,7 +336,7 @@ static void cppi_channel_release(struct dma_channel *channel) ...@@ -336,7 +336,7 @@ static void cppi_channel_release(struct dma_channel *channel)
c = container_of(channel, struct cppi_channel, channel); c = container_of(channel, struct cppi_channel, channel);
tibase = c->controller->tibase; tibase = c->controller->tibase;
if (!c->hw_ep) if (!c->hw_ep)
musb_dbg(c->controller->musb, musb_dbg(c->controller->controller.musb,
"releasing idle DMA channel %p", c); "releasing idle DMA channel %p", c);
else if (!c->transmit) else if (!c->transmit)
core_rxirq_enable(tibase, c->index + 1); core_rxirq_enable(tibase, c->index + 1);
...@@ -355,7 +355,7 @@ cppi_dump_rx(int level, struct cppi_channel *c, const char *tag) ...@@ -355,7 +355,7 @@ cppi_dump_rx(int level, struct cppi_channel *c, const char *tag)
musb_ep_select(base, c->index + 1); musb_ep_select(base, c->index + 1);
musb_dbg(c->controller->musb, musb_dbg(c->controller->controller.musb,
"RX DMA%d%s: %d left, csr %04x, " "RX DMA%d%s: %d left, csr %04x, "
"%08x H%08x S%08x C%08x, " "%08x H%08x S%08x C%08x, "
"B%08x L%08x %08x .. %08x", "B%08x L%08x %08x .. %08x",
...@@ -385,7 +385,7 @@ cppi_dump_tx(int level, struct cppi_channel *c, const char *tag) ...@@ -385,7 +385,7 @@ cppi_dump_tx(int level, struct cppi_channel *c, const char *tag)
musb_ep_select(base, c->index + 1); musb_ep_select(base, c->index + 1);
musb_dbg(c->controller->musb, musb_dbg(c->controller->controller.musb,
"TX DMA%d%s: csr %04x, " "TX DMA%d%s: csr %04x, "
"H%08x S%08x C%08x %08x, " "H%08x S%08x C%08x %08x, "
"F%08x L%08x .. %08x", "F%08x L%08x .. %08x",
...@@ -954,7 +954,7 @@ static int cppi_channel_program(struct dma_channel *ch, ...@@ -954,7 +954,7 @@ static int cppi_channel_program(struct dma_channel *ch,
cppi_ch = container_of(ch, struct cppi_channel, channel); cppi_ch = container_of(ch, struct cppi_channel, channel);
controller = cppi_ch->controller; controller = cppi_ch->controller;
musb = controller->musb; musb = controller->controller.musb;
switch (ch->status) { switch (ch->status) {
case MUSB_DMA_STATUS_BUS_ABORT: case MUSB_DMA_STATUS_BUS_ABORT:
...@@ -1009,7 +1009,7 @@ static bool cppi_rx_scan(struct cppi *cppi, unsigned ch) ...@@ -1009,7 +1009,7 @@ static bool cppi_rx_scan(struct cppi *cppi, unsigned ch)
int i; int i;
dma_addr_t safe2ack; dma_addr_t safe2ack;
void __iomem *regs = rx->hw_ep->regs; void __iomem *regs = rx->hw_ep->regs;
struct musb *musb = cppi->musb; struct musb *musb = cppi->controller.musb;
cppi_dump_rx(6, rx, "/K"); cppi_dump_rx(6, rx, "/K");
...@@ -1121,7 +1121,7 @@ static bool cppi_rx_scan(struct cppi *cppi, unsigned ch) ...@@ -1121,7 +1121,7 @@ static bool cppi_rx_scan(struct cppi *cppi, unsigned ch)
* setting it here "should" be racey, but seems to work * setting it here "should" be racey, but seems to work
*/ */
csr = musb_readw(rx->hw_ep->regs, MUSB_RXCSR); csr = musb_readw(rx->hw_ep->regs, MUSB_RXCSR);
if (is_host_active(cppi->musb) if (is_host_active(cppi->controller.musb)
&& bd && bd
&& !(csr & MUSB_RXCSR_H_REQPKT)) { && !(csr & MUSB_RXCSR_H_REQPKT)) {
csr |= MUSB_RXCSR_H_REQPKT; csr |= MUSB_RXCSR_H_REQPKT;
...@@ -1311,7 +1311,7 @@ cppi_dma_controller_create(struct musb *musb, void __iomem *mregs) ...@@ -1311,7 +1311,7 @@ cppi_dma_controller_create(struct musb *musb, void __iomem *mregs)
controller->mregs = mregs; controller->mregs = mregs;
controller->tibase = mregs - DAVINCI_BASE_OFFSET; controller->tibase = mregs - DAVINCI_BASE_OFFSET;
controller->musb = musb; controller->controller.musb = musb;
controller->controller.channel_alloc = cppi_channel_allocate; controller->controller.channel_alloc = cppi_channel_allocate;
controller->controller.channel_release = cppi_channel_release; controller->controller.channel_release = cppi_channel_release;
controller->controller.channel_program = cppi_channel_program; controller->controller.channel_program = cppi_channel_program;
...@@ -1323,7 +1323,7 @@ cppi_dma_controller_create(struct musb *musb, void __iomem *mregs) ...@@ -1323,7 +1323,7 @@ cppi_dma_controller_create(struct musb *musb, void __iomem *mregs)
/* setup BufferPool */ /* setup BufferPool */
controller->pool = dma_pool_create("cppi", controller->pool = dma_pool_create("cppi",
controller->musb->controller, controller->controller.musb->controller,
sizeof(struct cppi_descriptor), sizeof(struct cppi_descriptor),
CPPI_DESCRIPTOR_ALIGN, 0); CPPI_DESCRIPTOR_ALIGN, 0);
if (!controller->pool) { if (!controller->pool) {
...@@ -1357,7 +1357,7 @@ void cppi_dma_controller_destroy(struct dma_controller *c) ...@@ -1357,7 +1357,7 @@ void cppi_dma_controller_destroy(struct dma_controller *c)
cppi_controller_stop(cppi); cppi_controller_stop(cppi);
if (cppi->irq) if (cppi->irq)
free_irq(cppi->irq, cppi->musb); free_irq(cppi->irq, cppi->controller.musb);
/* assert: caller stopped the controller first */ /* assert: caller stopped the controller first */
dma_pool_destroy(cppi->pool); dma_pool_destroy(cppi->pool);
...@@ -1469,7 +1469,7 @@ static int cppi_channel_abort(struct dma_channel *channel) ...@@ -1469,7 +1469,7 @@ static int cppi_channel_abort(struct dma_channel *channel)
core_rxirq_disable(tibase, cppi_ch->index + 1); core_rxirq_disable(tibase, cppi_ch->index + 1);
/* for host, ensure ReqPkt is never set again */ /* for host, ensure ReqPkt is never set again */
if (is_host_active(cppi_ch->controller->musb)) { if (is_host_active(cppi_ch->controller->controller.musb)) {
value = musb_readl(tibase, DAVINCI_AUTOREQ_REG); value = musb_readl(tibase, DAVINCI_AUTOREQ_REG);
value &= ~((0x3) << (cppi_ch->index * 2)); value &= ~((0x3) << (cppi_ch->index * 2));
musb_writel(tibase, DAVINCI_AUTOREQ_REG, value); musb_writel(tibase, DAVINCI_AUTOREQ_REG, value);
...@@ -1478,7 +1478,7 @@ static int cppi_channel_abort(struct dma_channel *channel) ...@@ -1478,7 +1478,7 @@ static int cppi_channel_abort(struct dma_channel *channel)
csr = musb_readw(regs, MUSB_RXCSR); csr = musb_readw(regs, MUSB_RXCSR);
/* for host, clear (just) ReqPkt at end of current packet(s) */ /* for host, clear (just) ReqPkt at end of current packet(s) */
if (is_host_active(cppi_ch->controller->musb)) { if (is_host_active(cppi_ch->controller->controller.musb)) {
csr |= MUSB_RXCSR_H_WZC_BITS; csr |= MUSB_RXCSR_H_WZC_BITS;
csr &= ~MUSB_RXCSR_H_REQPKT; csr &= ~MUSB_RXCSR_H_REQPKT;
} else } else
......
...@@ -107,7 +107,6 @@ struct cppi_channel { ...@@ -107,7 +107,6 @@ struct cppi_channel {
/* CPPI DMA controller object */ /* CPPI DMA controller object */
struct cppi { struct cppi {
struct dma_controller controller; struct dma_controller controller;
struct musb *musb;
void __iomem *mregs; /* Mentor regs */ void __iomem *mregs; /* Mentor regs */
void __iomem *tibase; /* TI/CPPI regs */ void __iomem *tibase; /* TI/CPPI regs */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment