Skip to content

Commit d1834ba

Browse files
andy-shevgregkh
authored andcommitted
serial: 8250_dma: adjust DMA address of the UART
Some UARTs, e.g. one is used in Intel Quark, have a different address base for DMA operations. Introduce an additional field (per RX and TX DMA channels) in struct uart_8250_dma to cover those cases. Reviewed-by: Heikki Krogerus <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]> Tested-by: Bryan O'Donoghue <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 8d17047 commit d1834ba

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

drivers/tty/serial/8250/8250.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ struct uart_8250_dma {
3333
struct dma_chan *rxchan;
3434
struct dma_chan *txchan;
3535

36+
/* Device address base for DMA operations */
37+
phys_addr_t rx_dma_addr;
38+
phys_addr_t tx_dma_addr;
39+
40+
/* DMA address of the buffer in memory */
3641
dma_addr_t rx_addr;
3742
dma_addr_t tx_addr;
3843

drivers/tty/serial/8250/8250_dma.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,18 +150,22 @@ EXPORT_SYMBOL_GPL(serial8250_rx_dma_flush);
150150
int serial8250_request_dma(struct uart_8250_port *p)
151151
{
152152
struct uart_8250_dma *dma = p->dma;
153+
phys_addr_t rx_dma_addr = dma->rx_dma_addr ?
154+
dma->rx_dma_addr : p->port.mapbase;
155+
phys_addr_t tx_dma_addr = dma->tx_dma_addr ?
156+
dma->tx_dma_addr : p->port.mapbase;
153157
dma_cap_mask_t mask;
154158
struct dma_slave_caps caps;
155159
int ret;
156160

157161
/* Default slave configuration parameters */
158162
dma->rxconf.direction = DMA_DEV_TO_MEM;
159163
dma->rxconf.src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE;
160-
dma->rxconf.src_addr = p->port.mapbase + UART_RX;
164+
dma->rxconf.src_addr = rx_dma_addr + UART_RX;
161165

162166
dma->txconf.direction = DMA_MEM_TO_DEV;
163167
dma->txconf.dst_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE;
164-
dma->txconf.dst_addr = p->port.mapbase + UART_TX;
168+
dma->txconf.dst_addr = tx_dma_addr + UART_TX;
165169

166170
dma_cap_zero(mask);
167171
dma_cap_set(DMA_SLAVE, mask);

0 commit comments

Comments
 (0)