serial: 8250: dma related fixes
Subsystems (3)
cover serial: 8250: dma related fixes
Heikki Krogerus (3):
serial: 8250: don't change the fifo trigger level when using dma
serial: 8250_dw: don't limit DMA support to ACPI
serial: 8250_dw: provide a filter for DMA channel detection
drivers/tty/serial/8250/8250_core.c | 2 +- drivers/tty/serial/8250/8250_dw.c | 34 ++++++++++++++++++++++++---------- 2 files changed, 25 insertions(+), 11 deletions(-)
Signature · 1 line
1.8.4.rc3
PATCH 1/3 serial: 8250: don't change the fifo trigger level when using dma
DMA engines usually expect the fifo trigger level to be aligned with the burst size. It should not be changed even with small baud rates. This will fix an issue with Designware DMA engine where the data can not be transferred over UART with lower baud rates then 2400.
--- drivers/tty/serial/8250/8250_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/8250/8250_core.c +1 -1
@@ -2322,7 +2322,7 @@ serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios,if (up->capabilities &UART_CAP_FIFO && port->fifosize >1 ) { fcr = uart_config[port->type].fcr; -if (baud <2400 || fifo_bug) { +if ((baud <2400 && !up->dma) || fifo_bug) { fcr &= ~UART_FCR_TRIGGER_MASK ; fcr |=UART_FCR_TRIGGER_1 ; }
Signature · 1 line
1.8.4.rc3
PATCH 2/3 serial: 8250_dw: don't limit DMA support to ACPI
In reply to Heikki KrogerusIt should be available for DT users as well. This does not enable DMA by default except with ACPI. DT users can enable DMA based on a property.
--- drivers/tty/serial/8250/8250_dw.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/tty/serial/8250/8250_dw.c +10 -10
@@ -56,11 +56,12 @@struct dw8250_data { -int last_lcr; -int last_mcr; -int line; -struct clk *clk; -u8 usr_reg; +u8 usr_reg; +int last_lcr; +int last_mcr; +int line; +struct clk *clk; +struct uart_8250_dma dma; };static inline int dw8250_modify_msr (struct uart_port *p,int offset,int value)
@@ -241,7 +242,8 @@ static int dw8250_probe_of(struct uart_port *p, }#ifdef CONFIG_ACPI -static int dw8250_probe_acpi (struct uart_8250_port *up) +static int dw8250_probe_acpi (struct uart_8250_port *up, +struct dw8250_data *data) {const struct acpi_device_id *id;struct uart_port *p = &up->port;
@@ -260,9 +262,7 @@ static int dw8250_probe_acpi(struct uart_8250_port *up)if (!p->uartclk) p->uartclk = (unsigned int )id->driver_data; - up->dma =devm_kzalloc (p->dev,sizeof (*up->dma),GFP_KERNEL ); -if (!up->dma) -return -ENOMEM ; + up->dma = &data->dma; up->dma->rxconf.src_maxburst = p->fifosize /4 ; up->dma->txconf.dst_maxburst = p->fifosize /4 ;
@@ -324,7 +324,7 @@ static int dw8250_probe(struct platform_device *pdev)if (err)return err; }else if (ACPI_HANDLE (&pdev->dev)) { - err =dw8250_probe_acpi (&uart); + err =dw8250_probe_acpi (&uart, data);if (err)return err; }else {
Signature · 1 line
1.8.4.rc3
PATCH 3/3 serial: 8250_dw: provide a filter for DMA channel detection
In reply to Heikki KrogerusThe channel IDs are set to -1 by default. It will prevent dmaengine from trying to provide the first free channel if it fails to allocate exclusive channel. This will fix an issue with ACPI enumerated UARTs that do not support DMA but still end up getting a DMA channel incorrectly.
--- drivers/tty/serial/8250/8250_dw.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/tty/serial/8250/8250_dw.c +14 -0
@@ -154,6 +154,14 @@ dw8250_do_pm(struct uart_port *port, unsigned int state, unsigned int old)pm_runtime_put_sync_suspend (port->dev); } +static bool dw8250_dma_filter (struct dma_chan *chan,void *param) +{ +struct dw8250_data *data = param; + +return chan->chan_id == data->dma.tx_chan_id || + chan->chan_id == data->dma.rx_chan_id; +} +static void dw8250_setup_port (struct uart_8250_port *up) {struct uart_port *p = &up->port;
@@ -314,6 +322,12 @@ static int dw8250_probe(struct platform_device *pdev) uart.port.uartclk =clk_get_rate (data->clk); } + data->dma.rx_chan_id =-1 ; + data->dma.tx_chan_id =-1 ; + data->dma.rx_param = data; + data->dma.tx_param = data; + data->dma.fn = dw8250_dma_filter; + uart.port.iotype =UPIO_MEM ; uart.port.serial_in = dw8250_serial_in; uart.port.serial_out = dw8250_serial_out;
Signature · 1 line
1.8.4.rc3