Patch "usb: musb: musb_cppi41: Fix cppi41_set_dma_mode() for DA8xx" has been added to the 4.13-stable tree
Subsystems (3)
This is a note to let you know that I've just added the patch titled
usb: musb: musb_cppi41: Fix cppi41_set_dma_mode() for DA8xx
to the 4.13-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
usb-musb-musb_cppi41-fix-cppi41_set_dma_mode-for-da8xx.patch
and it can be found in the queue-4.13 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
e10c5b0c773efb8643ee89d387d310584ca30830Mon Sep 17 00:00:00 2001
From: Alexandre Bailon <[email protected]>
Date: Mon, 9 Oct 2017 22:46:10 -0500
Subject: usb: musb: musb_cppi41: Fix cppi41_set_dma_mode() for DA8xx
From: Alexandre Bailon <[email protected]>
commit e10c5b0c773efb8643ee89d387d310584ca30830 upstream.
The way to configure the DMA mode on DA8xx is different from DSPS. Add a new function to configure DMA mode on DA8xx and use a callback to call the right function based on the platform.
--- drivers/usb/musb/musb_cppi41.c | 40 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-)
drivers/usb/musb/musb_cppi41.c +37 -3
@@ -26,6 +26,7 @@#define MUSB_DMA_NUM_CHANNELS 15 +#define DA8XX_USB_MODE 0x10#define DA8XX_USB_AUTOREQ 0x14#define DA8XX_USB_TEARDOWN 0x1c
@@ -41,6 +42,9 @@ struct cppi41_dma_controller {u32 tdown_reg;u32 autoreq_reg; + +void (*set_dma_mode)(struct cppi41_dma_channel *cppi41_channel, +unsigned int mode); };static void save_rx_toggle (struct cppi41_dma_channel *cppi41_channel)
@@ -355,6 +359,32 @@ static void cppi41_set_dma_mode(struct c } } +static void da8xx_set_dma_mode (struct cppi41_dma_channel *cppi41_channel, +unsigned int mode) +{ +struct cppi41_dma_controller *controller = cppi41_channel->controller; +struct musb *musb = controller->controller.musb; +unsigned int shift; +u32 port; +u32 new_mode; +u32 old_mode; + + old_mode = controller->tx_mode; + port = cppi41_channel->port_num; + + shift = (port -1 ) *4 ; +if (!cppi41_channel->is_tx) + shift +=16 ; + new_mode = old_mode & ~(3 << shift); + new_mode |= mode << shift; + +if (new_mode == old_mode) +return ; + controller->tx_mode = new_mode; +musb_writel (musb->ctrl_base,DA8XX_USB_MODE , new_mode); +} + +static void cppi41_set_autoreq_mode (struct cppi41_dma_channel *cppi41_channel,unsigned mode) {
@@ -379,6 +409,7 @@ static bool cppi41_configure_channel(str dma_addr_t dma_addr, u32 len) {struct cppi41_dma_channel *cppi41_channel = channel->private_data; +struct cppi41_dma_controller *controller = cppi41_channel->controller;struct dma_chan *dc = cppi41_channel->dc;struct dma_async_tx_descriptor *dma_desc;enum dma_transfer_direction direction;
@@ -404,7 +435,7 @@ static bool cppi41_configure_channel(strmusb_writel (musb->ctrl_base,RNDIS_REG (cppi41_channel->port_num), len);/* gen rndis */ -cppi41_set_dma_mode (cppi41_channel, + controller->set_dma_mode (cppi41_channel,EP_MODE_DMA_GEN_RNDIS );/* auto req */
@@ -413,14 +444,15 @@ static bool cppi41_configure_channel(str }else {musb_writel (musb->ctrl_base,RNDIS_REG (cppi41_channel->port_num),0 ); -cppi41_set_dma_mode (cppi41_channel, + controller->set_dma_mode (cppi41_channel,EP_MODE_DMA_TRANSPARENT );cppi41_set_autoreq_mode (cppi41_channel,EP_MODE_AUTOREQ_NONE ); } }else {/* fallback mode */ -cppi41_set_dma_mode (cppi41_channel,EP_MODE_DMA_TRANSPARENT ); + controller->set_dma_mode (cppi41_channel, +EP_MODE_DMA_TRANSPARENT );cppi41_set_autoreq_mode (cppi41_channel,EP_MODE_AUTOREQ_NONE ); len =min_t (u32, packet_sz, len); }
@@ -737,9 +769,11 @@ cppi41_dma_controller_create(struct musbif (musb->io.quirks &MUSB_DA8XX ) { controller->tdown_reg =DA8XX_USB_TEARDOWN ; controller->autoreq_reg =DA8XX_USB_AUTOREQ ; + controller->set_dma_mode = da8xx_set_dma_mode; }else { controller->tdown_reg =USB_TDOWN ; controller->autoreq_reg =USB_CTRL_AUTOREQ ; + controller->set_dma_mode = cppi41_set_dma_mode; } ret =cppi41_dma_controller_start (controller);
Patches currently in stable-queue which might be from [email protected] are
queue-4.13/usb-musb-musb_cppi41-configure-the-number-of-channels-for-da8xx.patch queue-4.13/usb-musb-musb_cppi41-fix-the-address-of-teardown-and-autoreq-registers.patch queue-4.13/usb-musb-musb_cppi41-fix-cppi41_set_dma_mode-for-da8xx.patch