diff options
author | Alexandre Bailon <abailon@baylibre.com> | 2017-02-06 23:53:54 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-02-09 07:35:05 -0500 |
commit | 995ee0eab88df44bfb73fcafe600affb0d73f7c5 (patch) | |
tree | cab8b8a19effee419450ac51bf5cb4d0f0a2530e | |
parent | 03158f90155bcd6126b2636fca5b38fe96e5cbda (diff) |
usb: musb: cppi_dma: Clean up cppi41_dma_controller structure
A pointer to musb is now present in the dma_controller structure.
Remove the one present in cppi41_dma_controller 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>
-rw-r--r-- | drivers/usb/musb/musb_cppi41.c | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/drivers/usb/musb/musb_cppi41.c b/drivers/usb/musb/musb_cppi41.c index 1fe7eaeb097b..00e272bfee39 100644 --- a/drivers/usb/musb/musb_cppi41.c +++ b/drivers/usb/musb/musb_cppi41.c | |||
@@ -30,7 +30,6 @@ struct cppi41_dma_controller { | |||
30 | struct dma_controller controller; | 30 | struct dma_controller controller; |
31 | struct cppi41_dma_channel rx_channel[MUSB_DMA_NUM_CHANNELS]; | 31 | struct cppi41_dma_channel rx_channel[MUSB_DMA_NUM_CHANNELS]; |
32 | struct cppi41_dma_channel tx_channel[MUSB_DMA_NUM_CHANNELS]; | 32 | struct cppi41_dma_channel tx_channel[MUSB_DMA_NUM_CHANNELS]; |
33 | struct musb *musb; | ||
34 | struct hrtimer early_tx; | 33 | struct hrtimer early_tx; |
35 | struct list_head early_tx_list; | 34 | struct list_head early_tx_list; |
36 | u32 rx_mode; | 35 | u32 rx_mode; |
@@ -45,7 +44,7 @@ static void save_rx_toggle(struct cppi41_dma_channel *cppi41_channel) | |||
45 | 44 | ||
46 | if (cppi41_channel->is_tx) | 45 | if (cppi41_channel->is_tx) |
47 | return; | 46 | return; |
48 | if (!is_host_active(cppi41_channel->controller->musb)) | 47 | if (!is_host_active(cppi41_channel->controller->controller.musb)) |
49 | return; | 48 | return; |
50 | 49 | ||
51 | csr = musb_readw(cppi41_channel->hw_ep->regs, MUSB_RXCSR); | 50 | csr = musb_readw(cppi41_channel->hw_ep->regs, MUSB_RXCSR); |
@@ -78,8 +77,7 @@ static void update_rx_toggle(struct cppi41_dma_channel *cppi41_channel) | |||
78 | if (!toggle && toggle == cppi41_channel->usb_toggle) { | 77 | if (!toggle && toggle == cppi41_channel->usb_toggle) { |
79 | csr |= MUSB_RXCSR_H_DATATOGGLE | MUSB_RXCSR_H_WR_DATATOGGLE; | 78 | csr |= MUSB_RXCSR_H_DATATOGGLE | MUSB_RXCSR_H_WR_DATATOGGLE; |
80 | musb_writew(cppi41_channel->hw_ep->regs, MUSB_RXCSR, csr); | 79 | musb_writew(cppi41_channel->hw_ep->regs, MUSB_RXCSR, csr); |
81 | musb_dbg(cppi41_channel->controller->musb, | 80 | musb_dbg(musb, "Restoring DATA1 toggle."); |
82 | "Restoring DATA1 toggle."); | ||
83 | } | 81 | } |
84 | 82 | ||
85 | cppi41_channel->usb_toggle = toggle; | 83 | cppi41_channel->usb_toggle = toggle; |
@@ -180,7 +178,7 @@ static enum hrtimer_restart cppi41_recheck_tx_req(struct hrtimer *timer) | |||
180 | 178 | ||
181 | controller = container_of(timer, struct cppi41_dma_controller, | 179 | controller = container_of(timer, struct cppi41_dma_controller, |
182 | early_tx); | 180 | early_tx); |
183 | musb = controller->musb; | 181 | musb = controller->controller.musb; |
184 | 182 | ||
185 | spin_lock_irqsave(&musb->lock, flags); | 183 | spin_lock_irqsave(&musb->lock, flags); |
186 | list_for_each_entry_safe(cppi41_channel, n, &controller->early_tx_list, | 184 | list_for_each_entry_safe(cppi41_channel, n, &controller->early_tx_list, |
@@ -309,6 +307,7 @@ static void cppi41_set_dma_mode(struct cppi41_dma_channel *cppi41_channel, | |||
309 | unsigned mode) | 307 | unsigned mode) |
310 | { | 308 | { |
311 | struct cppi41_dma_controller *controller = cppi41_channel->controller; | 309 | struct cppi41_dma_controller *controller = cppi41_channel->controller; |
310 | struct musb *musb = controller->controller.musb; | ||
312 | u32 port; | 311 | u32 port; |
313 | u32 new_mode; | 312 | u32 new_mode; |
314 | u32 old_mode; | 313 | u32 old_mode; |
@@ -324,12 +323,10 @@ static void cppi41_set_dma_mode(struct cppi41_dma_channel *cppi41_channel, | |||
324 | return; | 323 | return; |
325 | if (cppi41_channel->is_tx) { | 324 | if (cppi41_channel->is_tx) { |
326 | controller->tx_mode = new_mode; | 325 | controller->tx_mode = new_mode; |
327 | musb_writel(controller->musb->ctrl_base, USB_CTRL_TX_MODE, | 326 | musb_writel(musb->ctrl_base, USB_CTRL_TX_MODE, new_mode); |
328 | new_mode); | ||
329 | } else { | 327 | } else { |
330 | controller->rx_mode = new_mode; | 328 | controller->rx_mode = new_mode; |
331 | musb_writel(controller->musb->ctrl_base, USB_CTRL_RX_MODE, | 329 | musb_writel(musb->ctrl_base, USB_CTRL_RX_MODE, new_mode); |
332 | new_mode); | ||
333 | } | 330 | } |
334 | } | 331 | } |
335 | 332 | ||
@@ -348,7 +345,8 @@ static void cppi41_set_autoreq_mode(struct cppi41_dma_channel *cppi41_channel, | |||
348 | if (new_mode == old_mode) | 345 | if (new_mode == old_mode) |
349 | return; | 346 | return; |
350 | controller->auto_req = new_mode; | 347 | controller->auto_req = new_mode; |
351 | musb_writel(controller->musb->ctrl_base, USB_CTRL_AUTOREQ, new_mode); | 348 | musb_writel(controller->controller.musb->ctrl_base, USB_CTRL_AUTOREQ, |
349 | new_mode); | ||
352 | } | 350 | } |
353 | 351 | ||
354 | static bool cppi41_configure_channel(struct dma_channel *channel, | 352 | static bool cppi41_configure_channel(struct dma_channel *channel, |
@@ -359,7 +357,7 @@ static bool cppi41_configure_channel(struct dma_channel *channel, | |||
359 | struct dma_chan *dc = cppi41_channel->dc; | 357 | struct dma_chan *dc = cppi41_channel->dc; |
360 | struct dma_async_tx_descriptor *dma_desc; | 358 | struct dma_async_tx_descriptor *dma_desc; |
361 | enum dma_transfer_direction direction; | 359 | enum dma_transfer_direction direction; |
362 | struct musb *musb = cppi41_channel->controller->musb; | 360 | struct musb *musb = cppi41_channel->controller->controller.musb; |
363 | unsigned use_gen_rndis = 0; | 361 | unsigned use_gen_rndis = 0; |
364 | 362 | ||
365 | cppi41_channel->buf_addr = dma_addr; | 363 | cppi41_channel->buf_addr = dma_addr; |
@@ -472,7 +470,7 @@ static int cppi41_dma_channel_program(struct dma_channel *channel, | |||
472 | BUG_ON(channel->status == MUSB_DMA_STATUS_UNKNOWN || | 470 | BUG_ON(channel->status == MUSB_DMA_STATUS_UNKNOWN || |
473 | channel->status == MUSB_DMA_STATUS_BUSY); | 471 | channel->status == MUSB_DMA_STATUS_BUSY); |
474 | 472 | ||
475 | if (is_host_active(cppi41_channel->controller->musb)) { | 473 | if (is_host_active(cppi41_channel->controller->controller.musb)) { |
476 | if (cppi41_channel->is_tx) | 474 | if (cppi41_channel->is_tx) |
477 | hb_mult = cppi41_channel->hw_ep->out_qh->hb_mult; | 475 | hb_mult = cppi41_channel->hw_ep->out_qh->hb_mult; |
478 | else | 476 | else |
@@ -497,7 +495,7 @@ static int cppi41_is_compatible(struct dma_channel *channel, u16 maxpacket, | |||
497 | { | 495 | { |
498 | struct cppi41_dma_channel *cppi41_channel = channel->private_data; | 496 | struct cppi41_dma_channel *cppi41_channel = channel->private_data; |
499 | struct cppi41_dma_controller *controller = cppi41_channel->controller; | 497 | struct cppi41_dma_controller *controller = cppi41_channel->controller; |
500 | struct musb *musb = controller->musb; | 498 | struct musb *musb = controller->controller.musb; |
501 | 499 | ||
502 | if (is_host_active(musb)) { | 500 | if (is_host_active(musb)) { |
503 | WARN_ON(1); | 501 | WARN_ON(1); |
@@ -515,7 +513,7 @@ static int cppi41_dma_channel_abort(struct dma_channel *channel) | |||
515 | { | 513 | { |
516 | struct cppi41_dma_channel *cppi41_channel = channel->private_data; | 514 | struct cppi41_dma_channel *cppi41_channel = channel->private_data; |
517 | struct cppi41_dma_controller *controller = cppi41_channel->controller; | 515 | struct cppi41_dma_controller *controller = cppi41_channel->controller; |
518 | struct musb *musb = controller->musb; | 516 | struct musb *musb = controller->controller.musb; |
519 | void __iomem *epio = cppi41_channel->hw_ep->regs; | 517 | void __iomem *epio = cppi41_channel->hw_ep->regs; |
520 | int tdbit; | 518 | int tdbit; |
521 | int ret; | 519 | int ret; |
@@ -600,7 +598,7 @@ static void cppi41_dma_controller_stop(struct cppi41_dma_controller *controller) | |||
600 | 598 | ||
601 | static int cppi41_dma_controller_start(struct cppi41_dma_controller *controller) | 599 | static int cppi41_dma_controller_start(struct cppi41_dma_controller *controller) |
602 | { | 600 | { |
603 | struct musb *musb = controller->musb; | 601 | struct musb *musb = controller->controller.musb; |
604 | struct device *dev = musb->controller; | 602 | struct device *dev = musb->controller; |
605 | struct device_node *np = dev->parent->of_node; | 603 | struct device_node *np = dev->parent->of_node; |
606 | struct cppi41_dma_channel *cppi41_channel; | 604 | struct cppi41_dma_channel *cppi41_channel; |
@@ -695,7 +693,6 @@ cppi41_dma_controller_create(struct musb *musb, void __iomem *base) | |||
695 | hrtimer_init(&controller->early_tx, CLOCK_MONOTONIC, HRTIMER_MODE_REL); | 693 | hrtimer_init(&controller->early_tx, CLOCK_MONOTONIC, HRTIMER_MODE_REL); |
696 | controller->early_tx.function = cppi41_recheck_tx_req; | 694 | controller->early_tx.function = cppi41_recheck_tx_req; |
697 | INIT_LIST_HEAD(&controller->early_tx_list); | 695 | INIT_LIST_HEAD(&controller->early_tx_list); |
698 | controller->musb = musb; | ||
699 | 696 | ||
700 | controller->controller.channel_alloc = cppi41_dma_channel_allocate; | 697 | controller->controller.channel_alloc = cppi41_dma_channel_allocate; |
701 | controller->controller.channel_release = cppi41_dma_channel_release; | 698 | controller->controller.channel_release = cppi41_dma_channel_release; |