serial: samsung: use dma_ops of DMA if attached
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): CGME20210622034818epcas5p3837ce2315f5c57980576f10b8fc7efeb@epcas5p3.samsung.com
PATCH v2 1/1 serial: samsung: use dma_ops of DMA if attached
When DMA is used for TX and RX by serial driver, it should pass the DMA device pointer to DMA API instead of UART device pointer.
This patch is necessary to fix the SMMU page faults which is observed when a DMA(with SMMU enabled) is attached to UART for transfer.
--- drivers/tty/serial/samsung_tty.c | 62 +++++++++++++++++++++++++------- 1 file changed, 50 insertions(+), 12 deletions(-)
drivers/tty/serial/samsung_tty.c +50 -12
@@ -284,8 +284,13 @@ static void s3c24xx_serial_stop_tx(struct uart_port *port)struct s3c24xx_uart_dma *dma = ourport->dma;struct circ_buf *xmit = &port->state->xmit;struct dma_tx_state state; +struct device *dma_map_ops_dev = ourport->port.dev;int count; +/* Pick dma_ops of DMA device if DMA device is attached */ +if (dma && dma->tx_chan) + dma_map_ops_dev = dma->tx_chan->device->dev; +if (!ourport->tx_enabled)return ;
@@ -305,7 +310,7 @@ static void s3c24xx_serial_stop_tx(struct uart_port *port)dmaengine_pause (dma->tx_chan);dmaengine_tx_status (dma->tx_chan, dma->tx_cookie, &state);dmaengine_terminate_all (dma->tx_chan); -dma_sync_single_for_cpu (ourport->port.dev, +dma_sync_single_for_cpu (dma_map_ops_dev, dma->tx_transfer_addr, dma->tx_size,DMA_TO_DEVICE );async_tx_ack (dma->tx_desc); count = dma->tx_bytes_requested - state.residue;
@@ -331,14 +336,19 @@ static void s3c24xx_serial_tx_dma_complete(void *args)struct circ_buf *xmit = &port->state->xmit;struct s3c24xx_uart_dma *dma = ourport->dma;struct dma_tx_state state; +struct device *dma_map_ops_dev = ourport->port.dev;unsigned long flags;int count; +/* Pick dma_ops of DMA device if DMA device is attached */ +if (dma && dma->tx_chan) + dma_map_ops_dev = dma->tx_chan->device->dev; +dmaengine_tx_status (dma->tx_chan, dma->tx_cookie, &state); count = dma->tx_bytes_requested - state.residue;async_tx_ack (dma->tx_desc); -dma_sync_single_for_cpu (ourport->port.dev, dma->tx_transfer_addr, +dma_sync_single_for_cpu (dma_map_ops_dev, dma->tx_transfer_addr, dma->tx_size,DMA_TO_DEVICE );spin_lock_irqsave (&port->lock, flags);
@@ -436,6 +446,11 @@ static int s3c24xx_serial_start_tx_dma(struct s3c24xx_uart_port *ourport,struct uart_port *port = &ourport->port;struct circ_buf *xmit = &port->state->xmit;struct s3c24xx_uart_dma *dma = ourport->dma; +struct device *dma_map_ops_dev = ourport->port.dev; + +/* Pick dma_ops of DMA device if DMA device is attached */ +if (dma && dma->tx_chan) + dma_map_ops_dev = dma->tx_chan->device->dev;if (ourport->tx_mode !=S3C24XX_TX_DMA )enable_tx_dma (ourport);
@@ -443,7 +458,7 @@ static int s3c24xx_serial_start_tx_dma(struct s3c24xx_uart_port *ourport, dma->tx_size = count & ~(dma_get_cache_alignment () -1 ); dma->tx_transfer_addr = dma->tx_addr + xmit->tail; -dma_sync_single_for_device (ourport->port.dev, dma->tx_transfer_addr, +dma_sync_single_for_device (dma_map_ops_dev, dma->tx_transfer_addr, dma->tx_size,DMA_TO_DEVICE ); dma->tx_desc = dmaengine_prep_slave_single(dma->tx_chan,
@@ -510,12 +525,17 @@ static void s3c24xx_uart_copy_rx_to_tty(struct s3c24xx_uart_port *ourport, struct tty_port *tty, int count) {struct s3c24xx_uart_dma *dma = ourport->dma; +struct device *dma_map_ops_dev = ourport->port.dev;int copied; +/* Pick dma_ops of DMA device if DMA device is attached */ +if (dma && dma->rx_chan) + dma_map_ops_dev = dma->rx_chan->device->dev; +if (!count)return ; -dma_sync_single_for_cpu (ourport->port.dev, dma->rx_addr, +dma_sync_single_for_cpu (dma_map_ops_dev, dma->rx_addr, dma->rx_size,DMA_FROM_DEVICE ); ourport->port.icount.rx += count;
@@ -635,8 +655,13 @@ static void s3c24xx_serial_rx_dma_complete(void *args)static void s3c64xx_start_rx_dma (struct s3c24xx_uart_port *ourport) {struct s3c24xx_uart_dma *dma = ourport->dma; +struct device *dma_map_ops_dev = ourport->port.dev; + +/* Pick dma_ops of DMA device if DMA device is attached */ +if (dma && dma->rx_chan) + dma_map_ops_dev = dma->rx_chan->device->dev; -dma_sync_single_for_device (ourport->port.dev, dma->rx_addr, +dma_sync_single_for_device (dma_map_ops_dev, dma->rx_addr, dma->rx_size,DMA_FROM_DEVICE ); dma->rx_desc = dmaengine_prep_slave_single(dma->rx_chan,
@@ -1045,6 +1070,7 @@ static int s3c24xx_serial_request_dma(struct s3c24xx_uart_port *p)struct s3c24xx_uart_dma *dma = p->dma;struct dma_slave_caps dma_caps;const char *reason =NULL ; +struct device *dma_map_ops_dev = p->port.dev;int ret;/* Default slave configuration parameters */
@@ -1102,18 +1128,25 @@ static int s3c24xx_serial_request_dma(struct s3c24xx_uart_port *p) goto err_release_tx; } - dma->rx_addr =dma_map_single (p->port.dev, dma->rx_buf, +/* Pick dma_ops of DMA device if DMA device is attached */ +if (dma && dma->rx_chan) + dma_map_ops_dev = dma->rx_chan->device->dev; + + dma->rx_addr =dma_map_single (dma_map_ops_dev, dma->rx_buf, dma->rx_size,DMA_FROM_DEVICE ); -if (dma_mapping_error (p->port.dev, dma->rx_addr)) { +if (dma_mapping_error (dma_map_ops_dev, dma->rx_addr)) { reason ="DMA mapping error for RX buffer" ; ret = -EIO ; goto err_free_rx; } +/* Pick dma_ops of DMA device if DMA device is attached */ +if (dma && dma->tx_chan) + dma_map_ops_dev = dma->tx_chan->device->dev;/* TX buffer */ - dma->tx_addr =dma_map_single (p->port.dev, p->port.state->xmit.buf, + dma->tx_addr =dma_map_single (dma_map_ops_dev, p->port.state->xmit.buf,UART_XMIT_SIZE ,DMA_TO_DEVICE ); -if (dma_mapping_error (p->port.dev, dma->tx_addr)) { +if (dma_mapping_error (dma_map_ops_dev, dma->tx_addr)) { reason ="DMA mapping error for TX buffer" ; ret = -EIO ; goto err_unmap_rx;
@@ -1122,7 +1155,9 @@ static int s3c24xx_serial_request_dma(struct s3c24xx_uart_port *p)return 0 ; err_unmap_rx: -dma_unmap_single (p->port.dev, dma->rx_addr, dma->rx_size, +if (dma->rx_chan) + dma_map_ops_dev = dma->rx_chan->device->dev; +dma_unmap_single (dma_map_ops_dev, dma->rx_addr, dma->rx_size,DMA_FROM_DEVICE ); err_free_rx:kfree (dma->rx_buf);
@@ -1139,10 +1174,12 @@ static int s3c24xx_serial_request_dma(struct s3c24xx_uart_port *p)static void s3c24xx_serial_release_dma (struct s3c24xx_uart_port *p) {struct s3c24xx_uart_dma *dma = p->dma; +struct device *dma_map_ops_dev = p->port.dev;if (dma->rx_chan) { + dma_map_ops_dev = dma->rx_chan->device->dev;dmaengine_terminate_all (dma->rx_chan); -dma_unmap_single (p->port.dev, dma->rx_addr, +dma_unmap_single (dma_map_ops_dev, dma->rx_addr, dma->rx_size,DMA_FROM_DEVICE );kfree (dma->rx_buf);dma_release_channel (dma->rx_chan);
@@ -1150,8 +1187,9 @@ static void s3c24xx_serial_release_dma(struct s3c24xx_uart_port *p) }if (dma->tx_chan) { + dma_map_ops_dev = dma->tx_chan->device->dev;dmaengine_terminate_all (dma->tx_chan); -dma_unmap_single (p->port.dev, dma->tx_addr, +dma_unmap_single (dma_map_ops_dev, dma->tx_addr,UART_XMIT_SIZE ,DMA_TO_DEVICE );dma_release_channel (dma->tx_chan); dma->tx_chan =NULL ;
Signature · 1 line
2.17.1
Greg KH
maintainerQuoted 194 lines · Tamseel Shams
When DMA is used for TX and RX by serial driver, it should pass the DMA device pointer to DMA API instead of UART device pointer.
This patch is necessary to fix the SMMU page faults which is observed when a DMA(with SMMU enabled) is attached to UART for transfer.
Signed-off-by Tamseel Shams <[email protected]>Signed-off-by Ajay Kumar <[email protected]>--- drivers/tty/serial/samsung_tty.c | 62 +++++++++++++++++++++++++------- 1 file changed, 50 insertions(+), 12 deletions(-)drivers/tty/serial/samsung_tty.c +50
-12@@ -284,8 +284,13 @@ static void s3c24xx_serial_stop_tx(struct uart_port *port)struct s3c24xx_uart_dma *dma = ourport->dma;struct circ_buf *xmit = &port->state->xmit;struct dma_tx_state state; +struct device *dma_map_ops_dev = ourport->port.dev;int count; +/* Pick dma_ops of DMA device if DMA device is attached */ +if (dma && dma->tx_chan) + dma_map_ops_dev = dma->tx_chan->device->dev; +if (!ourport->tx_enabled)return ;@@ -305,7 +310,7 @@ static void s3c24xx_serial_stop_tx(struct uart_port *port)dmaengine_pause (dma->tx_chan);dmaengine_tx_status (dma->tx_chan, dma->tx_cookie, &state);dmaengine_terminate_all (dma->tx_chan); -dma_sync_single_for_cpu (ourport->port.dev, +dma_sync_single_for_cpu (dma_map_ops_dev, dma->tx_transfer_addr, dma->tx_size,DMA_TO_DEVICE );async_tx_ack (dma->tx_desc); count = dma->tx_bytes_requested - state.residue;@@ -331,14 +336,19 @@ static void s3c24xx_serial_tx_dma_complete(void *args)struct circ_buf *xmit = &port->state->xmit;struct s3c24xx_uart_dma *dma = ourport->dma;struct dma_tx_state state; +struct device *dma_map_ops_dev = ourport->port.dev;unsigned long flags;int count; +/* Pick dma_ops of DMA device if DMA device is attached */ +if (dma && dma->tx_chan) + dma_map_ops_dev = dma->tx_chan->device->dev; +dmaengine_tx_status (dma->tx_chan, dma->tx_cookie, &state); count = dma->tx_bytes_requested - state.residue;async_tx_ack (dma->tx_desc); -dma_sync_single_for_cpu (ourport->port.dev, dma->tx_transfer_addr, +dma_sync_single_for_cpu (dma_map_ops_dev, dma->tx_transfer_addr, dma->tx_size,DMA_TO_DEVICE );spin_lock_irqsave (&port->lock, flags);@@ -436,6 +446,11 @@ static int s3c24xx_serial_start_tx_dma(struct s3c24xx_uart_port *ourport,struct uart_port *port = &ourport->port;struct circ_buf *xmit = &port->state->xmit;struct s3c24xx_uart_dma *dma = ourport->dma; +struct device *dma_map_ops_dev = ourport->port.dev; + +/* Pick dma_ops of DMA device if DMA device is attached */ +if (dma && dma->tx_chan) + dma_map_ops_dev = dma->tx_chan->device->dev;if (ourport->tx_mode !=S3C24XX_TX_DMA )enable_tx_dma (ourport);@@ -443,7 +458,7 @@ static int s3c24xx_serial_start_tx_dma(struct s3c24xx_uart_port *ourport, dma->tx_size = count & ~(dma_get_cache_alignment () -1 ); dma->tx_transfer_addr = dma->tx_addr + xmit->tail; -dma_sync_single_for_device (ourport->port.dev, dma->tx_transfer_addr, +dma_sync_single_for_device (dma_map_ops_dev, dma->tx_transfer_addr, dma->tx_size,DMA_TO_DEVICE ); dma->tx_desc = dmaengine_prep_slave_single(dma->tx_chan,@@ -510,12 +525,17 @@ static void s3c24xx_uart_copy_rx_to_tty(struct s3c24xx_uart_port *ourport, struct tty_port *tty, int count) {struct s3c24xx_uart_dma *dma = ourport->dma; +struct device *dma_map_ops_dev = ourport->port.dev;int copied; +/* Pick dma_ops of DMA device if DMA device is attached */ +if (dma && dma->rx_chan) + dma_map_ops_dev = dma->rx_chan->device->dev; +if (!count)return ; -dma_sync_single_for_cpu (ourport->port.dev, dma->rx_addr, +dma_sync_single_for_cpu (dma_map_ops_dev, dma->rx_addr, dma->rx_size,DMA_FROM_DEVICE ); ourport->port.icount.rx += count;@@ -635,8 +655,13 @@ static void s3c24xx_serial_rx_dma_complete(void *args)static void s3c64xx_start_rx_dma (struct s3c24xx_uart_port *ourport) {struct s3c24xx_uart_dma *dma = ourport->dma; +struct device *dma_map_ops_dev = ourport->port.dev; + +/* Pick dma_ops of DMA device if DMA device is attached */ +if (dma && dma->rx_chan) + dma_map_ops_dev = dma->rx_chan->device->dev; -dma_sync_single_for_device (ourport->port.dev, dma->rx_addr, +dma_sync_single_for_device (dma_map_ops_dev, dma->rx_addr, dma->rx_size,DMA_FROM_DEVICE ); dma->rx_desc = dmaengine_prep_slave_single(dma->rx_chan,@@ -1045,6 +1070,7 @@ static int s3c24xx_serial_request_dma(struct s3c24xx_uart_port *p)struct s3c24xx_uart_dma *dma = p->dma;struct dma_slave_caps dma_caps;const char *reason =NULL ; +struct device *dma_map_ops_dev = p->port.dev;int ret;/* Default slave configuration parameters */ @@ -1102,18 +1128,25 @@ static int s3c24xx_serial_request_dma(struct s3c24xx_uart_port *p) goto err_release_tx; } - dma->rx_addr =dma_map_single (p->port.dev, dma->rx_buf, +/* Pick dma_ops of DMA device if DMA device is attached */ +if (dma && dma->rx_chan) + dma_map_ops_dev = dma->rx_chan->device->dev; + + dma->rx_addr =dma_map_single (dma_map_ops_dev, dma->rx_buf, dma->rx_size,DMA_FROM_DEVICE ); -if (dma_mapping_error (p->port.dev, dma->rx_addr)) { +if (dma_mapping_error (dma_map_ops_dev, dma->rx_addr)) { reason ="DMA mapping error for RX buffer" ; ret = -EIO ; goto err_free_rx; } +/* Pick dma_ops of DMA device if DMA device is attached */ +if (dma && dma->tx_chan) + dma_map_ops_dev = dma->tx_chan->device->dev;/* TX buffer */ - dma->tx_addr =dma_map_single (p->port.dev, p->port.state->xmit.buf, + dma->tx_addr =dma_map_single (dma_map_ops_dev, p->port.state->xmit.buf,UART_XMIT_SIZE ,DMA_TO_DEVICE ); -if (dma_mapping_error (p->port.dev, dma->tx_addr)) { +if (dma_mapping_error (dma_map_ops_dev, dma->tx_addr)) { reason ="DMA mapping error for TX buffer" ; ret = -EIO ; goto err_unmap_rx;@@ -1122,7 +1155,9 @@ static int s3c24xx_serial_request_dma(struct s3c24xx_uart_port *p)return 0 ; err_unmap_rx: -dma_unmap_single (p->port.dev, dma->rx_addr, dma->rx_size, +if (dma->rx_chan) + dma_map_ops_dev = dma->rx_chan->device->dev; +dma_unmap_single (dma_map_ops_dev, dma->rx_addr, dma->rx_size,DMA_FROM_DEVICE ); err_free_rx:kfree (dma->rx_buf);@@ -1139,10 +1174,12 @@ static int s3c24xx_serial_request_dma(struct s3c24xx_uart_port *p)static void s3c24xx_serial_release_dma (struct s3c24xx_uart_port *p) {struct s3c24xx_uart_dma *dma = p->dma; +struct device *dma_map_ops_dev = p->port.dev;if (dma->rx_chan) { + dma_map_ops_dev = dma->rx_chan->device->dev;dmaengine_terminate_all (dma->rx_chan); -dma_unmap_single (p->port.dev, dma->rx_addr, +dma_unmap_single (dma_map_ops_dev, dma->rx_addr, dma->rx_size,DMA_FROM_DEVICE );kfree (dma->rx_buf);dma_release_channel (dma->rx_chan);@@ -1150,8 +1187,9 @@ static void s3c24xx_serial_release_dma(struct s3c24xx_uart_port *p) }if (dma->tx_chan) { + dma_map_ops_dev = dma->tx_chan->device->dev;dmaengine_terminate_all (dma->tx_chan); -dma_unmap_single (p->port.dev, dma->tx_addr, +dma_unmap_single (dma_map_ops_dev, dma->tx_addr,UART_XMIT_SIZE ,DMA_TO_DEVICE );dma_release_channel (dma->tx_chan); dma->tx_chan =NULL ;Signature · 1 line
2.17.1
Hi,
This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree.
You are receiving this message because of the following common error(s) as indicated below:
- This looks like a new version of a previously submitted patch, but you did not list below the --- line any changes from the previous version. Please read the section entitled "The canonical patch format" in the kernel file, Documentation/SubmittingPatches for what needs to be done here to properly describe this.
If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers.
thanks,
greg k-h's patch email bot
Quoted 228 lines
drivers/tty/serial/samsung_tty.c static void s3c24xx_serial_stop_tx(struct uart_port
Quoted 20 lines
When DMA is used for TX and RX by serial driver, it should pass the DMA device pointer to DMA API instead of UART device pointer.
This patch is necessary to fix the SMMU page faults which is observed when a DMA(with SMMU enabled) is attached to UART for transfer.
Signed-off-by Tamseel Shams <[email protected]>Signed-off-by Ajay Kumar <[email protected]>--- drivers/tty/serial/samsung_tty.c | 62 +++++++++++++++++++++++++------- 1 file changed, 50 insertions(+), 12 deletions(-)drivers/tty/serial/samsung_tty.c +0
-0@@ -284,8 +284,13 @@ static void s3c24xx_serial_stop_tx(struct uart_port*port)
drivers/tty/serial/samsung_tty.c static void s3c24xx_serial_stop_tx(struct uart_port
Quoted 14 lines
drivers/tty/serial/samsung_tty.c +5
-0struct s3c24xx_uart_dma *dma = ourport->dma;struct circ_buf *xmit = &port->state->xmit;struct dma_tx_state state; +struct device *dma_map_ops_dev = ourport->port.dev;int count; +/* Pick dma_ops of DMA device if DMA device is attached */ +if (dma && dma->tx_chan) + dma_map_ops_dev = dma->tx_chan->device->dev; +if (!ourport->tx_enabled)return ;@@ -305,7 +310,7 @@ static void s3c24xx_serial_stop_tx(struct uart_port*port)
drivers/tty/serial/samsung_tty.c static void s3c24xx_serial_stop_tx(struct uart_port *port)
Quoted 6 lines
drivers/tty/serial/samsung_tty.c +1
-1dmaengine_pause (dma->tx_chan);dmaengine_tx_status (dma->tx_chan, dma->tx_cookie, &state);dmaengine_terminate_all (dma->tx_chan); - dma_sync_single_for_cpu(ourport->port.dev, + dma_sync_single_for_cpu(dma_map_ops_dev, dma->tx_transfer_addr, dma->tx_size,
DMA_TO_DEVICE);drivers/tty/serial/samsung_tty.c static void s3c24xx_serial_stop_tx(struct uart_port · line 316
Quoted 2 lines
drivers/tty/serial/samsung_tty.c +0
-0async_tx_ack (dma->tx_desc); count = dma->tx_bytes_requested - state.residue; @@ -331,14+336,19
drivers/tty/serial/samsung_tty.c static int s3c24xx_serial_start_tx_dma(struct
Quoted 34 lines
@@ static void
s3c24xx_serial_tx_dma_complete(void *args)drivers/tty/serial/samsung_tty.c +6
-1struct circ_buf *xmit = &port->state->xmit;struct s3c24xx_uart_dma *dma = ourport->dma;struct dma_tx_state state; +struct device *dma_map_ops_dev = ourport->port.dev;unsigned long flags;int count; +/* Pick dma_ops of DMA device if DMA device is attached */ +if (dma && dma->tx_chan) + dma_map_ops_dev = dma->tx_chan->device->dev; +dmaengine_tx_status (dma->tx_chan, dma->tx_cookie, &state); count = dma->tx_bytes_requested - state.residue;async_tx_ack (dma->tx_desc); -dma_sync_single_for_cpu (ourport->port.dev, dma->tx_transfer_addr, +dma_sync_single_for_cpu (dma_map_ops_dev, dma->tx_transfer_addr, dma->tx_size,DMA_TO_DEVICE ); spin_lock_irqsave(&port->lock, flags); @@ -436,6 +446,11 @@ staticint s3c24xx_serial_start_tx_dma(struct
s3c24xx_uart_port*ourport,drivers/tty/serial/samsung_tty.c +5
-0struct uart_port *port = &ourport->port;struct circ_buf *xmit = &port->state->xmit;struct s3c24xx_uart_dma *dma = ourport->dma; +struct device *dma_map_ops_dev = ourport->port.dev; + +/* Pick dma_ops of DMA device if DMA device is attached */ +if (dma && dma->tx_chan) + dma_map_ops_dev = dma->tx_chan->device->dev;if (ourport->tx_mode !=S3C24XX_TX_DMA )enable_tx_dma (ourport);@@ -443,7 +458,7 @@ static int s3c24xx_serial_start_tx_dma(struct
s3c24xx_uart_port*ourport,drivers/tty/serial/samsung_tty.c static void s3c24xx_uart_copy_rx_to_tty(struct
Quoted 11 lines
drivers/tty/serial/samsung_tty.c +1
-1dma->tx_size = count & ~(dma_get_cache_alignment () -1 ); dma->tx_transfer_addr = dma->tx_addr + xmit->tail; -dma_sync_single_for_device (ourport->port.dev, dma- tx_transfer_addr, +dma_sync_single_for_device (dma_map_ops_dev, dma- tx_transfer_addr, dma->tx_size,DMA_TO_DEVICE );drivers/tty/serial/samsung_tty.c +0
-0dma->tx_desc = dmaengine_prep_slave_single(dma->tx_chan,@@ -510,12 +525,17 @@ static void s3c24xx_uart_copy_rx_to_tty(struct
s3c24xx_uart_port*ourport,drivers/tty/serial/samsung_tty.c static int s3c24xx_serial_request_dma(struct
Quoted 34 lines
drivers/tty/serial/samsung_tty.c +12
-2struct tty_port *tty, int count) {struct s3c24xx_uart_dma *dma = ourport->dma; +struct device *dma_map_ops_dev = ourport->port.dev;int copied; +/* Pick dma_ops of DMA device if DMA device is attached */ +if (dma && dma->rx_chan) + dma_map_ops_dev = dma->rx_chan->device->dev; +if (!count)return ; -dma_sync_single_for_cpu (ourport->port.dev, dma->rx_addr, +dma_sync_single_for_cpu (dma_map_ops_dev, dma->rx_addr, dma->rx_size,DMA_FROM_DEVICE ); ourport->port.icount.rx += count;@@ -635,8 +655,13 @@ static void s3c24xx_serial_rx_dma_complete(void *args) static void s3c64xx_start_rx_dma(struct s3c24xx_uart_port *ourport) {struct s3c24xx_uart_dma *dma = ourport->dma; +struct device *dma_map_ops_dev = ourport->port.dev; + +/* Pick dma_ops of DMA device if DMA device is attached */ +if (dma && dma->rx_chan) + dma_map_ops_dev = dma->rx_chan->device->dev; -dma_sync_single_for_device (ourport->port.dev, dma->rx_addr, +dma_sync_single_for_device (dma_map_ops_dev, dma->rx_addr, dma->rx_size,DMA_FROM_DEVICE ); dma->rx_desc = dmaengine_prep_slave_single(dma->rx_chan,@@ -1045,6 +1070,7 @@ static int s3c24xx_serial_request_dma(struct
s3c24xx_uart_port*p)drivers/tty/serial/samsung_tty.c static int s3c24xx_serial_request_dma(struct s3c24xx_uart_port *p)
Quoted 7 lines
drivers/tty/serial/samsung_tty.c +1
-0struct s3c24xx_uart_dma *dma = p->dma;struct dma_slave_caps dma_caps;const char *reason =NULL ; +struct device *dma_map_ops_dev = p->port.dev;int ret; /* Default slave configuration parameters */ @@ -1102,18 +1128,25@@
drivers/tty/serial/samsung_tty.c static int s3c24xx_serial_request_dma(struct
Quoted 32 lines
static int
s3c24xx_serial_request_dma(struct s3c24xx_uart_port *p)drivers/tty/serial/samsung_tty.c +12
-4goto err_release_tx; } - dma->rx_addr =dma_map_single (p->port.dev, dma->rx_buf, +/* Pick dma_ops of DMA device if DMA device is attached */ +if (dma && dma->rx_chan) + dma_map_ops_dev = dma->rx_chan->device->dev; + + dma->rx_addr =dma_map_single (dma_map_ops_dev, dma->rx_buf, dma->rx_size,DMA_FROM_DEVICE ); -if (dma_mapping_error (p->port.dev, dma->rx_addr)) { +if (dma_mapping_error (dma_map_ops_dev, dma->rx_addr)) { reason ="DMA mapping error for RX buffer" ; ret = -EIO ; goto err_free_rx; } +/* Pick dma_ops of DMA device if DMA device is attached */ +if (dma && dma->tx_chan) + dma_map_ops_dev = dma->tx_chan->device->dev;/* TX buffer */ - dma->tx_addr =dma_map_single (p->port.dev, p->port.state->xmit.buf, + dma->tx_addr =dma_map_single (dma_map_ops_dev, +p->port.state->xmit.buf,UART_XMIT_SIZE ,DMA_TO_DEVICE ); -if (dma_mapping_error (p->port.dev, dma->tx_addr)) { +if (dma_mapping_error (dma_map_ops_dev, dma->tx_addr)) { reason ="DMA mapping error for TX buffer" ; ret = -EIO ; goto err_unmap_rx;@@ -1122,7 +1155,9 @@ static int s3c24xx_serial_request_dma(struct
s3c24xx_uart_port*p)drivers/tty/serial/samsung_tty.c static void s3c24xx_serial_release_dma(struct
Quoted 25 lines
drivers/tty/serial/samsung_tty.c +3
-1return 0 ; err_unmap_rx: -dma_unmap_single (p->port.dev, dma->rx_addr, dma->rx_size, +if (dma->rx_chan) + dma_map_ops_dev = dma->rx_chan->device->dev; +dma_unmap_single (dma_map_ops_dev, dma->rx_addr, dma->rx_size,DMA_FROM_DEVICE ); err_free_rx:kfree (dma->rx_buf);@@ -1139,10 +1174,12 @@ static int s3c24xx_serial_request_dma(struct
s3c24xx_uart_port*p) static voids3c24xx_serial_release_dma(struct s3c24xx_uart_port *p){drivers/tty/serial/samsung_tty.c +3
-1struct s3c24xx_uart_dma *dma = p->dma; +struct device *dma_map_ops_dev = p->port.dev;if (dma->rx_chan) { + dma_map_ops_dev = dma->rx_chan->device->dev;dmaengine_terminate_all (dma->rx_chan); -dma_unmap_single (p->port.dev, dma->rx_addr, +dma_unmap_single (dma_map_ops_dev, dma->rx_addr, dma->rx_size,DMA_FROM_DEVICE );kfree (dma->rx_buf);dma_release_channel (dma->rx_chan);@@ -1150,8 +1187,9 @@ static void s3c24xx_serial_release_dma(struct
s3c24xx_uart_port*p)Quoted 11 lines
drivers/tty/serial/samsung_tty.c +2
-2}if (dma->tx_chan) { + dma_map_ops_dev = dma->tx_chan->device->dev;dmaengine_terminate_all (dma->tx_chan); -dma_unmap_single (p->port.dev, dma->tx_addr, +dma_unmap_single (dma_map_ops_dev, dma->tx_addr,UART_XMIT_SIZE ,DMA_TO_DEVICE );dma_release_channel (dma->tx_chan); dma->tx_chan =NULL ; --Quoted 2 lines
2.17.1
Hi,
This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree.
You are receiving this message because of the following common error(s) as indicated below:
- This looks like a new version of a previously submitted patch, but you did not list below the --- line any changes from the previous version. Please read the section entitled "The canonical patch format" in the kernel file,
Documentation/SubmittingPatchesfor what needs to be done here to properly describe this.
Quoted 8 lines
If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers.
thanks,
greg k-h's patch email bot
Hi Greg,
Sorry for not mentioning the change from previous version. I will update the patch and post the new version.
Thanks & Regards,
Tamseel Shams
Quoted 42 lines · Tamseel Shams
When DMA is used for TX and RX by serial driver, it should pass the DMA device pointer to DMA API instead of UART device pointer.
This patch is necessary to fix the SMMU page faults which is observed when a DMA(with SMMU enabled) is attached to UART for transfer.
Signed-off-by Tamseel Shams <[email protected]>Signed-off-by Ajay Kumar <[email protected]>--- drivers/tty/serial/samsung_tty.c | 62 +++++++++++++++++++++++++------- 1 file changed, 50 insertions(+), 12 deletions(-)drivers/tty/serial/samsung_tty.c +6
-1@@ -284,8 +284,13 @@ static void s3c24xx_serial_stop_tx(struct uart_port *port)struct s3c24xx_uart_dma *dma = ourport->dma;struct circ_buf *xmit = &port->state->xmit;struct dma_tx_state state; +struct device *dma_map_ops_dev = ourport->port.dev;int count; +/* Pick dma_ops of DMA device if DMA device is attached */ +if (dma && dma->tx_chan) + dma_map_ops_dev = dma->tx_chan->device->dev; +if (!ourport->tx_enabled)return ;@@ -305,7 +310,7 @@ static void s3c24xx_serial_stop_tx(struct uart_port *port)dmaengine_pause (dma->tx_chan);dmaengine_tx_status (dma->tx_chan, dma->tx_cookie, &state);dmaengine_terminate_all (dma->tx_chan); -dma_sync_single_for_cpu (ourport->port.dev, +dma_sync_single_for_cpu (dma_map_ops_dev, dma->tx_transfer_addr, dma->tx_size,DMA_TO_DEVICE );async_tx_ack (dma->tx_desc); count = dma->tx_bytes_requested - state.residue;
drivers/tty/serial/samsung_tty.c static void s3c24xx_serial_tx_dma_complete(void *args) · line 344
Quoted 9 lines
drivers/tty/serial/samsung_tty.c +3
-0@@ -331,14 +336,19 @@ static void s3c24xx_serial_tx_dma_complete(void *args)struct circ_buf *xmit = &port->state->xmit;struct s3c24xx_uart_dma *dma = ourport->dma;struct dma_tx_state state; +struct device *dma_map_ops_dev = ourport->port.dev;unsigned long flags;int count; +/* Pick dma_ops of DMA device if DMA device is attached */ +if (dma && dma->tx_chan)
Clearly you don't need most of these checks, if any. For example here you're already dereferencing dma->tx_chan unconditionally a couple of lines below.
AFAICS it should simply be a case of hard-coding the correct device for all of the DMA API calls without any of this silly conditional assignment. If it's even possible to reach the point of making a DMA API call when you don't have a valid DMA channel (and thus it would be pointless anyway), that implies a more general issue with the structure of the code which deserves fixing in its own right.
Robin.
Quoted 141 lines
drivers/tty/serial/samsung_tty.c +41
-11+ dma_map_ops_dev = dma->tx_chan->device->dev; +dmaengine_tx_status (dma->tx_chan, dma->tx_cookie, &state); count = dma->tx_bytes_requested - state.residue;async_tx_ack (dma->tx_desc); -dma_sync_single_for_cpu (ourport->port.dev, dma->tx_transfer_addr, +dma_sync_single_for_cpu (dma_map_ops_dev, dma->tx_transfer_addr, dma->tx_size,DMA_TO_DEVICE );spin_lock_irqsave (&port->lock, flags);@@ -436,6 +446,11 @@ static int s3c24xx_serial_start_tx_dma(struct s3c24xx_uart_port *ourport,struct uart_port *port = &ourport->port;struct circ_buf *xmit = &port->state->xmit;struct s3c24xx_uart_dma *dma = ourport->dma; +struct device *dma_map_ops_dev = ourport->port.dev; + +/* Pick dma_ops of DMA device if DMA device is attached */ +if (dma && dma->tx_chan) + dma_map_ops_dev = dma->tx_chan->device->dev;if (ourport->tx_mode !=S3C24XX_TX_DMA )enable_tx_dma (ourport);@@ -443,7 +458,7 @@ static int s3c24xx_serial_start_tx_dma(struct s3c24xx_uart_port *ourport, dma->tx_size = count & ~(dma_get_cache_alignment () -1 ); dma->tx_transfer_addr = dma->tx_addr + xmit->tail; -dma_sync_single_for_device (ourport->port.dev, dma->tx_transfer_addr, +dma_sync_single_for_device (dma_map_ops_dev, dma->tx_transfer_addr, dma->tx_size,DMA_TO_DEVICE ); dma->tx_desc = dmaengine_prep_slave_single(dma->tx_chan,@@ -510,12 +525,17 @@ static void s3c24xx_uart_copy_rx_to_tty(struct s3c24xx_uart_port *ourport, struct tty_port *tty, int count) {struct s3c24xx_uart_dma *dma = ourport->dma; +struct device *dma_map_ops_dev = ourport->port.dev;int copied; +/* Pick dma_ops of DMA device if DMA device is attached */ +if (dma && dma->rx_chan) + dma_map_ops_dev = dma->rx_chan->device->dev; +if (!count)return ; -dma_sync_single_for_cpu (ourport->port.dev, dma->rx_addr, +dma_sync_single_for_cpu (dma_map_ops_dev, dma->rx_addr, dma->rx_size,DMA_FROM_DEVICE ); ourport->port.icount.rx += count;@@ -635,8 +655,13 @@ static void s3c24xx_serial_rx_dma_complete(void *args)static void s3c64xx_start_rx_dma (struct s3c24xx_uart_port *ourport) {struct s3c24xx_uart_dma *dma = ourport->dma; +struct device *dma_map_ops_dev = ourport->port.dev; + +/* Pick dma_ops of DMA device if DMA device is attached */ +if (dma && dma->rx_chan) + dma_map_ops_dev = dma->rx_chan->device->dev; -dma_sync_single_for_device (ourport->port.dev, dma->rx_addr, +dma_sync_single_for_device (dma_map_ops_dev, dma->rx_addr, dma->rx_size,DMA_FROM_DEVICE ); dma->rx_desc = dmaengine_prep_slave_single(dma->rx_chan,@@ -1045,6 +1070,7 @@ static int s3c24xx_serial_request_dma(struct s3c24xx_uart_port *p)struct s3c24xx_uart_dma *dma = p->dma;struct dma_slave_caps dma_caps;const char *reason =NULL ; +struct device *dma_map_ops_dev = p->port.dev;int ret;/* Default slave configuration parameters */ @@ -1102,18 +1128,25 @@ static int s3c24xx_serial_request_dma(struct s3c24xx_uart_port *p) goto err_release_tx; } - dma->rx_addr =dma_map_single (p->port.dev, dma->rx_buf, +/* Pick dma_ops of DMA device if DMA device is attached */ +if (dma && dma->rx_chan) + dma_map_ops_dev = dma->rx_chan->device->dev; + + dma->rx_addr =dma_map_single (dma_map_ops_dev, dma->rx_buf, dma->rx_size,DMA_FROM_DEVICE ); -if (dma_mapping_error (p->port.dev, dma->rx_addr)) { +if (dma_mapping_error (dma_map_ops_dev, dma->rx_addr)) { reason ="DMA mapping error for RX buffer" ; ret = -EIO ; goto err_free_rx; } +/* Pick dma_ops of DMA device if DMA device is attached */ +if (dma && dma->tx_chan) + dma_map_ops_dev = dma->tx_chan->device->dev;/* TX buffer */ - dma->tx_addr =dma_map_single (p->port.dev, p->port.state->xmit.buf, + dma->tx_addr =dma_map_single (dma_map_ops_dev, p->port.state->xmit.buf,UART_XMIT_SIZE ,DMA_TO_DEVICE ); -if (dma_mapping_error (p->port.dev, dma->tx_addr)) { +if (dma_mapping_error (dma_map_ops_dev, dma->tx_addr)) { reason ="DMA mapping error for TX buffer" ; ret = -EIO ; goto err_unmap_rx;@@ -1122,7 +1155,9 @@ static int s3c24xx_serial_request_dma(struct s3c24xx_uart_port *p)return 0 ; err_unmap_rx: -dma_unmap_single (p->port.dev, dma->rx_addr, dma->rx_size, +if (dma->rx_chan) + dma_map_ops_dev = dma->rx_chan->device->dev; +dma_unmap_single (dma_map_ops_dev, dma->rx_addr, dma->rx_size,DMA_FROM_DEVICE ); err_free_rx:kfree (dma->rx_buf);@@ -1139,10 +1174,12 @@ static int s3c24xx_serial_request_dma(struct s3c24xx_uart_port *p)static void s3c24xx_serial_release_dma (struct s3c24xx_uart_port *p) {struct s3c24xx_uart_dma *dma = p->dma; +struct device *dma_map_ops_dev = p->port.dev;if (dma->rx_chan) { + dma_map_ops_dev = dma->rx_chan->device->dev;dmaengine_terminate_all (dma->rx_chan); -dma_unmap_single (p->port.dev, dma->rx_addr, +dma_unmap_single (dma_map_ops_dev, dma->rx_addr, dma->rx_size,DMA_FROM_DEVICE );kfree (dma->rx_buf);dma_release_channel (dma->rx_chan);@@ -1150,8 +1187,9 @@ static void s3c24xx_serial_release_dma(struct s3c24xx_uart_port *p) }if (dma->tx_chan) { + dma_map_ops_dev = dma->tx_chan->device->dev;dmaengine_terminate_all (dma->tx_chan); -dma_unmap_single (p->port.dev, dma->tx_addr, +dma_unmap_single (dma_map_ops_dev, dma->tx_addr,UART_XMIT_SIZE ,DMA_TO_DEVICE );dma_release_channel (dma->tx_chan); dma->tx_chan =NULL ;
Quoted 59 lines · Tamseel Shams
drivers/tty/serial/samsung_tty.c static void s3c24xx_serial_stop_tx(struct uart_port
Quoted 18 lines
When DMA is used for TX and RX by serial driver, it should pass the DMA device pointer to DMA API instead of UART device pointer.
This patch is necessary to fix the SMMU page faults which is observed when a DMA(with SMMU enabled) is attached to UART for transfer.
Signed-off-by Tamseel Shams <[email protected]>Signed-off-by Ajay Kumar <[email protected]>--- drivers/tty/serial/samsung_tty.c | 62 +++++++++++++++++++++++++------- 1 file changed, 50 insertions(+), 12 deletions(-)drivers/tty/serial/samsung_tty.c +0
-0@@ -284,8 +284,13 @@ static void s3c24xx_serial_stop_tx(struct uart_port*port)
drivers/tty/serial/samsung_tty.c static void s3c24xx_serial_stop_tx(struct uart_port
Quoted 14 lines
drivers/tty/serial/samsung_tty.c +5
-0struct s3c24xx_uart_dma *dma = ourport->dma;struct circ_buf *xmit = &port->state->xmit;struct dma_tx_state state; +struct device *dma_map_ops_dev = ourport->port.dev;int count; +/* Pick dma_ops of DMA device if DMA device is attached */ +if (dma && dma->tx_chan) + dma_map_ops_dev = dma->tx_chan->device->dev; +if (!ourport->tx_enabled)return ;@@ -305,7 +310,7 @@ static void s3c24xx_serial_stop_tx(struct uart_port*port)
drivers/tty/serial/samsung_tty.c static void s3c24xx_serial_stop_tx(struct uart_port *port)
Quoted 6 lines
drivers/tty/serial/samsung_tty.c +1
-1dmaengine_pause (dma->tx_chan);dmaengine_tx_status (dma->tx_chan, dma->tx_cookie, &state);dmaengine_terminate_all (dma->tx_chan); - dma_sync_single_for_cpu(ourport->port.dev, + dma_sync_single_for_cpu(dma_map_ops_dev, dma->tx_transfer_addr, dma->tx_size,
DMA_TO_DEVICE);drivers/tty/serial/samsung_tty.c static void s3c24xx_serial_tx_dma_complete(void *args) · line 344
Quoted 12 lines
drivers/tty/serial/samsung_tty.c +4
-0async_tx_ack (dma->tx_desc); count = dma->tx_bytes_requested - state.residue; @@ -331,14 +336,19 @@ static void s3c24xx_serial_tx_dma_complete(void *args) struct circ_buf *xmit = &port->state->xmit;struct s3c24xx_uart_dma *dma = ourport->dma;struct dma_tx_state state; +struct device *dma_map_ops_dev = ourport->port.dev;unsigned long flags;int count; +/* Pick dma_ops of DMA device if DMA device is attached */ +if (dma && dma->tx_chan)Clearly you don't need most of these checks, if any. For example here you're already dereferencing
dma->tx_chanunconditionally a couple of lines below.
Quoted 9 lines
AFAICS it should simply be a case of hard-coding the correct device for all of the DMA API calls without any of this silly conditional assignment. If it's even possible to reach the point of making a DMA API call when you don't have a valid DMA channel (and thus it would be pointless anyway), that implies a more general issue with the structure of the code which deserves fixing in its own right.
Robin.
Yes, this looks like a perfect solution to remove the conditional assignments and instead directly assign the DMA device pointer.
Quoted 142 lines
drivers/tty/serial/samsung_tty.c static int s3c24xx_serial_start_tx_dma(struct
Quoted 24 lines
drivers/tty/serial/samsung_tty.c +3
-1+ dma_map_ops_dev = dma->tx_chan->device->dev; +dmaengine_tx_status (dma->tx_chan, dma->tx_cookie, &state); count = dma->tx_bytes_requested - state.residue;async_tx_ack (dma->tx_desc); -dma_sync_single_for_cpu (ourport->port.dev, dma->tx_transfer_addr, +dma_sync_single_for_cpu (dma_map_ops_dev, dma->tx_transfer_addr, dma->tx_size,DMA_TO_DEVICE ); spin_lock_irqsave(&port->lock, flags); @@ -436,6 +446,11 @@ staticint s3c24xx_serial_start_tx_dma(struct
s3c24xx_uart_port*ourport,
structuart_port*port =&ourport->port;
structcirc_buf*xmit =&port->state->xmit; structs3c24xx_uart_dma*dma =ourport->dma;drivers/tty/serial/samsung_tty.c +5
-0+struct device *dma_map_ops_dev = ourport->port.dev; + +/* Pick dma_ops of DMA device if DMA device is attached */ +if (dma && dma->tx_chan) + dma_map_ops_dev = dma->tx_chan->device->dev;if (ourport->tx_mode !=S3C24XX_TX_DMA )enable_tx_dma (ourport);@@ -443,7 +458,7 @@ static int s3c24xx_serial_start_tx_dma(struct
s3c24xx_uart_port*ourport,drivers/tty/serial/samsung_tty.c static void s3c24xx_uart_copy_rx_to_tty(struct
Quoted 11 lines
drivers/tty/serial/samsung_tty.c +1
-1dma->tx_size = count & ~(dma_get_cache_alignment () -1 ); dma->tx_transfer_addr = dma->tx_addr + xmit->tail; -dma_sync_single_for_device (ourport->port.dev, dma- tx_transfer_addr, +dma_sync_single_for_device (dma_map_ops_dev, dma- tx_transfer_addr, dma->tx_size,DMA_TO_DEVICE );
dma->tx_desc= dmaengine_prep_slave_single(dma->tx_chan,drivers/tty/serial/samsung_tty.c +0
-0@@ -510,12 +525,17 @@ static void s3c24xx_uart_copy_rx_to_tty(struct
s3c24xx_uart_port*ourport,drivers/tty/serial/samsung_tty.c static void s3c24xx_serial_rx_dma_complete(void
Quoted 19 lines
drivers/tty/serial/samsung_tty.c +6
-1struct tty_port *tty, int count) {struct s3c24xx_uart_dma *dma = ourport->dma; +struct device *dma_map_ops_dev = ourport->port.dev;int copied; +/* Pick dma_ops of DMA device if DMA device is attached */ +if (dma && dma->rx_chan) + dma_map_ops_dev = dma->rx_chan->device->dev; +if (!count)return ; -dma_sync_single_for_cpu (ourport->port.dev, dma->rx_addr, +dma_sync_single_for_cpu (dma_map_ops_dev, dma->rx_addr, dma->rx_size,DMA_FROM_DEVICE ); ourport->port.icount.rx += count;@@ -635,8 +655,13 @@ static void s3c24xx_serial_rx_dma_complete(void*args)
drivers/tty/serial/samsung_tty.c static int s3c24xx_serial_request_dma(struct
Quoted 15 lines
drivers/tty/serial/samsung_tty.c +6
-1static void s3c64xx_start_rx_dma (struct s3c24xx_uart_port *ourport) {struct s3c24xx_uart_dma *dma = ourport->dma; +struct device *dma_map_ops_dev = ourport->port.dev; + +/* Pick dma_ops of DMA device if DMA device is attached */ +if (dma && dma->rx_chan) + dma_map_ops_dev = dma->rx_chan->device->dev; -dma_sync_single_for_device (ourport->port.dev, dma->rx_addr, +dma_sync_single_for_device (dma_map_ops_dev, dma->rx_addr, dma->rx_size,DMA_FROM_DEVICE ); dma->rx_desc = dmaengine_prep_slave_single(dma->rx_chan,@@ -1045,6 +1070,7 @@ static int s3c24xx_serial_request_dma(struct
s3c24xx_uart_port*p)drivers/tty/serial/samsung_tty.c static int s3c24xx_serial_request_dma(struct
Quoted 39 lines
drivers/tty/serial/samsung_tty.c +1
-0struct s3c24xx_uart_dma *dma = p->dma;struct dma_slave_caps dma_caps;const char *reason =NULL ; +struct device *dma_map_ops_dev = p->port.dev;int ret; /* Default slave configuration parameters */ @@ -1102,18 +1128,25@@ static int
s3c24xx_serial_request_dma(struct s3c24xx_uart_port *p)
gotoerr_release_tx;
}drivers/tty/serial/samsung_tty.c +12
-4- dma->rx_addr =dma_map_single (p->port.dev, dma->rx_buf, +/* Pick dma_ops of DMA device if DMA device is attached */ +if (dma && dma->rx_chan) + dma_map_ops_dev = dma->rx_chan->device->dev; + + dma->rx_addr =dma_map_single (dma_map_ops_dev, dma->rx_buf, dma->rx_size,DMA_FROM_DEVICE ); -if (dma_mapping_error (p->port.dev, dma->rx_addr)) { +if (dma_mapping_error (dma_map_ops_dev, dma->rx_addr)) { reason ="DMA mapping error for RX buffer" ; ret = -EIO ; goto err_free_rx; } +/* Pick dma_ops of DMA device if DMA device is attached */ +if (dma && dma->tx_chan) + dma_map_ops_dev = dma->tx_chan->device->dev;/* TX buffer */ - dma->tx_addr =dma_map_single (p->port.dev, p->port.state->xmit.buf, + dma->tx_addr =dma_map_single (dma_map_ops_dev, +p->port.state->xmit.buf,UART_XMIT_SIZE ,DMA_TO_DEVICE ); -if (dma_mapping_error (p->port.dev, dma->tx_addr)) { +if (dma_mapping_error (dma_map_ops_dev, dma->tx_addr)) { reason ="DMA mapping error for TX buffer" ; ret = -EIO ; goto err_unmap_rx;@@ -1122,7 +1155,9 @@ static int s3c24xx_serial_request_dma(struct
s3c24xx_uart_port*p)drivers/tty/serial/samsung_tty.c static int s3c24xx_serial_request_dma(struct
Quoted 11 lines
drivers/tty/serial/samsung_tty.c +3
-1return 0 ; err_unmap_rx: -dma_unmap_single (p->port.dev, dma->rx_addr, dma->rx_size, +if (dma->rx_chan) + dma_map_ops_dev = dma->rx_chan->device->dev; +dma_unmap_single (dma_map_ops_dev, dma->rx_addr, dma->rx_size,DMA_FROM_DEVICE ); err_free_rx:kfree (dma->rx_buf);@@ -1139,10 +1174,12 @@ static int s3c24xx_serial_request_dma(struct
s3c24xx_uart_port*p)drivers/tty/serial/samsung_tty.c static void s3c24xx_serial_release_dma(struct
Quoted 14 lines
drivers/tty/serial/samsung_tty.c +3
-1static void s3c24xx_serial_release_dma (struct s3c24xx_uart_port *p) {struct s3c24xx_uart_dma *dma = p->dma; +struct device *dma_map_ops_dev = p->port.dev;if (dma->rx_chan) { + dma_map_ops_dev = dma->rx_chan->device->dev;dmaengine_terminate_all (dma->rx_chan); -dma_unmap_single (p->port.dev, dma->rx_addr, +dma_unmap_single (dma_map_ops_dev, dma->rx_addr, dma->rx_size,DMA_FROM_DEVICE );kfree (dma->rx_buf);dma_release_channel (dma->rx_chan);@@ -1150,8 +1187,9 @@ static void s3c24xx_serial_release_dma(struct
s3c24xx_uart_port*p)Quoted 2 lines
drivers/tty/serial/samsung_tty.c +0
-0}
Quoted 9 lines
drivers/tty/serial/samsung_tty.c static void s3c24xx_serial_release_dma(struct s3c24xx_uart_port *p) · line 1195
Quoted 9 lines
drivers/tty/serial/samsung_tty.c +2
-1if (dma->tx_chan) { + dma_map_ops_dev = dma->tx_chan->device->dev;dmaengine_terminate_all (dma->tx_chan); -dma_unmap_single (p->port.dev, dma->tx_addr, +dma_unmap_single (dma_map_ops_dev, dma->tx_addr,UART_XMIT_SIZE ,DMA_TO_DEVICE );dma_release_channel (dma->tx_chan); dma->tx_chan =NULL ;
Thanks & Regards,
Tamseel Shams