Skip to content

Commit 565dd11

Browse files
geertugregkh
authored andcommitted
serial: sh-sci: Switch to generic DMA residue handling
Convert the SCI driver from the SHDMAE-specific partial DMA transfer handling to the generic dmaengine residual data framework. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 3e14670 commit 565dd11

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

drivers/tty/serial/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,7 @@ config SERIAL_SH_SCI_CONSOLE
743743

744744
config SERIAL_SH_SCI_DMA
745745
bool "DMA support"
746-
depends on SERIAL_SH_SCI && SH_DMAE
746+
depends on SERIAL_SH_SCI && DMA_ENGINE
747747

748748
config SERIAL_PNX8XXX
749749
bool "Enable PNX8XXX SoCs' UART Support"

drivers/tty/serial/sh-sci.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1438,6 +1438,8 @@ static void work_fn_rx(struct work_struct *work)
14381438
struct sci_port *s = container_of(work, struct sci_port, work_rx);
14391439
struct uart_port *port = &s->port;
14401440
struct dma_async_tx_descriptor *desc;
1441+
struct dma_tx_state state;
1442+
enum dma_status status;
14411443
int new;
14421444

14431445
if (s->active_rx == s->cookie_rx[0]) {
@@ -1451,21 +1453,21 @@ static void work_fn_rx(struct work_struct *work)
14511453
}
14521454
desc = s->desc_rx[new];
14531455

1454-
if (dma_async_is_tx_complete(s->chan_rx, s->active_rx, NULL, NULL) !=
1455-
DMA_COMPLETE) {
1456+
status = dmaengine_tx_status(s->chan_rx, s->active_rx, &state);
1457+
if (status != DMA_COMPLETE) {
14561458
/* Handle incomplete DMA receive */
14571459
struct dma_chan *chan = s->chan_rx;
1458-
struct shdma_desc *sh_desc = container_of(desc,
1459-
struct shdma_desc, async_tx);
14601460
unsigned long flags;
1461+
unsigned int read;
14611462
int count;
14621463

14631464
dmaengine_terminate_all(chan);
1464-
dev_dbg(port->dev, "Read %zu bytes with cookie %d\n",
1465-
sh_desc->partial, sh_desc->cookie);
1465+
read = sg_dma_len(&s->sg_rx[new]) - state.residue;
1466+
dev_dbg(port->dev, "Read %u bytes with cookie %d\n", read,
1467+
s->active_rx);
14661468

14671469
spin_lock_irqsave(&port->lock, flags);
1468-
count = sci_dma_rx_push(s, sh_desc->partial);
1470+
count = sci_dma_rx_push(s, read);
14691471
spin_unlock_irqrestore(&port->lock, flags);
14701472

14711473
if (count)

0 commit comments

Comments
 (0)