Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1373732 > unrolled thread

[PATCH v1 07/12] serial: 8250_dma: adjust DMA address of the UART

Started byAndy Shevchenko <andriy.shevchenko@linux.intel.com>
First post2016-04-07 22:40 +0200
Last post2016-04-08 02:30 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v1 07/12] serial: 8250_dma: adjust DMA address of the UART Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-04-07 22:40 +0200
    Re: [PATCH v1 07/12] serial: 8250_dma: adjust DMA address of the UART Peter Hurley <peter@hurleysoftware.com> - 2016-04-08 02:30 +0200

#1373732 — [PATCH v1 07/12] serial: 8250_dma: adjust DMA address of the UART

FromAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Date2016-04-07 22:40 +0200
Subject[PATCH v1 07/12] serial: 8250_dma: adjust DMA address of the UART
Message-ID<rloSD-YH-33@gated-at.bofh.it>
Some UARTs, e.g. one is used in Intel Quark, have a different address base for
DMA operations. Introduce an additional field in struct uart_8250_dma to cover
those cases.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/tty/serial/8250/8250.h     | 2 ++
 drivers/tty/serial/8250/8250_dma.c | 5 +++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/8250/8250.h b/drivers/tty/serial/8250/8250.h
index 047a7ba..040deb2 100644
--- a/drivers/tty/serial/8250/8250.h
+++ b/drivers/tty/serial/8250/8250.h
@@ -31,6 +31,8 @@ struct uart_8250_dma {
 	struct dma_chan		*rxchan;
 	struct dma_chan		*txchan;
 
+	phys_addr_t		dma_addr;
+
 	dma_addr_t		rx_addr;
 	dma_addr_t		tx_addr;
 
diff --git a/drivers/tty/serial/8250/8250_dma.c b/drivers/tty/serial/8250/8250_dma.c
index b134bec..a314492 100644
--- a/drivers/tty/serial/8250/8250_dma.c
+++ b/drivers/tty/serial/8250/8250_dma.c
@@ -164,16 +164,17 @@ int serial8250_rx_dma(struct uart_8250_port *p, unsigned int iir)
 int serial8250_request_dma(struct uart_8250_port *p)
 {
 	struct uart_8250_dma	*dma = p->dma;
+	phys_addr_t dma_addr = dma->dma_addr ? dma->dma_addr : p->port.mapbase;
 	dma_cap_mask_t		mask;
 
 	/* Default slave configuration parameters */
 	dma->rxconf.direction		= DMA_DEV_TO_MEM;
 	dma->rxconf.src_addr_width	= DMA_SLAVE_BUSWIDTH_1_BYTE;
-	dma->rxconf.src_addr		= p->port.mapbase + UART_RX;
+	dma->rxconf.src_addr		= dma_addr + UART_RX;
 
 	dma->txconf.direction		= DMA_MEM_TO_DEV;
 	dma->txconf.dst_addr_width	= DMA_SLAVE_BUSWIDTH_1_BYTE;
-	dma->txconf.dst_addr		= p->port.mapbase + UART_TX;
+	dma->txconf.dst_addr		= dma_addr + UART_TX;
 
 	dma_cap_zero(mask);
 	dma_cap_set(DMA_SLAVE, mask);
-- 
2.8.0.rc3

[toc] | [next] | [standalone]


#1373873

FromPeter Hurley <peter@hurleysoftware.com>
Date2016-04-08 02:30 +0200
Message-ID<rlste-3DX-37@gated-at.bofh.it>
In reply to#1373732
On 04/07/2016 01:37 PM, Andy Shevchenko wrote:
> Some UARTs, e.g. one is used in Intel Quark, have a different address base for
> DMA operations. Introduce an additional field in struct uart_8250_dma to cover
> those cases.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/tty/serial/8250/8250.h     | 2 ++
>  drivers/tty/serial/8250/8250_dma.c | 5 +++--
>  2 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/tty/serial/8250/8250.h b/drivers/tty/serial/8250/8250.h
> index 047a7ba..040deb2 100644
> --- a/drivers/tty/serial/8250/8250.h
> +++ b/drivers/tty/serial/8250/8250.h
> @@ -31,6 +31,8 @@ struct uart_8250_dma {
>  	struct dma_chan		*rxchan;
>  	struct dma_chan		*txchan;
>  
> +	phys_addr_t		dma_addr;
> +

Let's add separate rx and tx device addrs.


>  	dma_addr_t		rx_addr;
>  	dma_addr_t		tx_addr;
>  
> diff --git a/drivers/tty/serial/8250/8250_dma.c b/drivers/tty/serial/8250/8250_dma.c
> index b134bec..a314492 100644
> --- a/drivers/tty/serial/8250/8250_dma.c
> +++ b/drivers/tty/serial/8250/8250_dma.c
> @@ -164,16 +164,17 @@ int serial8250_rx_dma(struct uart_8250_port *p, unsigned int iir)
>  int serial8250_request_dma(struct uart_8250_port *p)
>  {
>  	struct uart_8250_dma	*dma = p->dma;
> +	phys_addr_t dma_addr = dma->dma_addr ? dma->dma_addr : p->port.mapbase;
>  	dma_cap_mask_t		mask;
>  
>  	/* Default slave configuration parameters */
>  	dma->rxconf.direction		= DMA_DEV_TO_MEM;
>  	dma->rxconf.src_addr_width	= DMA_SLAVE_BUSWIDTH_1_BYTE;
> -	dma->rxconf.src_addr		= p->port.mapbase + UART_RX;
> +	dma->rxconf.src_addr		= dma_addr + UART_RX;
>  
>  	dma->txconf.direction		= DMA_MEM_TO_DEV;
>  	dma->txconf.dst_addr_width	= DMA_SLAVE_BUSWIDTH_1_BYTE;
> -	dma->txconf.dst_addr		= p->port.mapbase + UART_TX;
> +	dma->txconf.dst_addr		= dma_addr + UART_TX;
>  
>  	dma_cap_zero(mask);
>  	dma_cap_set(DMA_SLAVE, mask);
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web