Skip to content

Commit 7e2cd21

Browse files
committed
Merge tag 'tty-6.0-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
Pull tty/serial driver fixes from Greg KH: "Here are some small, and late, serial driver fixes for 6.0-rc7 to resolve some reported problems. Included in here are: - tegra icount accounting fixes, including a framework function that other drivers will be converted over to using in 6.1-rc1. - fsl_lpuart reset bugfix - 8250 omap 485 bugfix - sifive serial clock bugfix The last three patches have not shown up in linux-next due to them being added to my tree only 2 days ago, but they are tiny and self-contained and the developers say they resolve issues that they have with 6.0-rc. The other three have been in linux-next for a while with no reported issues" * tag 'tty-6.0-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: serial: sifive: enable clocks for UART when probed serial: 8250: omap: Use serial8250_em485_supported serial: fsl_lpuart: Reset prior to registration serial: tegra-tcu: Use uart_xmit_advance(), fixes icount.tx accounting serial: tegra: Use uart_xmit_advance(), fixes icount.tx accounting serial: Create uart_xmit_advance()
2 parents 1772094 + 6437920 commit 7e2cd21

File tree

6 files changed

+27
-9
lines changed

6 files changed

+27
-9
lines changed

drivers/tty/serial/8250/8250_omap.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1334,6 +1334,7 @@ static int omap8250_probe(struct platform_device *pdev)
13341334
up.port.throttle = omap_8250_throttle;
13351335
up.port.unthrottle = omap_8250_unthrottle;
13361336
up.port.rs485_config = serial8250_em485_config;
1337+
up.port.rs485_supported = serial8250_em485_supported;
13371338
up.rs485_start_tx = serial8250_em485_start_tx;
13381339
up.rs485_stop_tx = serial8250_em485_stop_tx;
13391340
up.port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_8250_CONSOLE);

drivers/tty/serial/fsl_lpuart.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2724,14 +2724,15 @@ static int lpuart_probe(struct platform_device *pdev)
27242724
lpuart_reg.cons = LPUART_CONSOLE;
27252725
handler = lpuart_int;
27262726
}
2727-
ret = uart_add_one_port(&lpuart_reg, &sport->port);
2728-
if (ret)
2729-
goto failed_attach_port;
27302727

27312728
ret = lpuart_global_reset(sport);
27322729
if (ret)
27332730
goto failed_reset;
27342731

2732+
ret = uart_add_one_port(&lpuart_reg, &sport->port);
2733+
if (ret)
2734+
goto failed_attach_port;
2735+
27352736
ret = uart_get_rs485_mode(&sport->port);
27362737
if (ret)
27372738
goto failed_get_rs485;
@@ -2747,9 +2748,9 @@ static int lpuart_probe(struct platform_device *pdev)
27472748

27482749
failed_irq_request:
27492750
failed_get_rs485:
2750-
failed_reset:
27512751
uart_remove_one_port(&lpuart_reg, &sport->port);
27522752
failed_attach_port:
2753+
failed_reset:
27532754
lpuart_disable_clks(sport);
27542755
return ret;
27552756
}

drivers/tty/serial/serial-tegra.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ static void tegra_uart_tx_dma_complete(void *args)
525525
count = tup->tx_bytes_requested - state.residue;
526526
async_tx_ack(tup->tx_dma_desc);
527527
spin_lock_irqsave(&tup->uport.lock, flags);
528-
xmit->tail = (xmit->tail + count) & (UART_XMIT_SIZE - 1);
528+
uart_xmit_advance(&tup->uport, count);
529529
tup->tx_in_progress = 0;
530530
if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
531531
uart_write_wakeup(&tup->uport);
@@ -613,7 +613,6 @@ static unsigned int tegra_uart_tx_empty(struct uart_port *u)
613613
static void tegra_uart_stop_tx(struct uart_port *u)
614614
{
615615
struct tegra_uart_port *tup = to_tegra_uport(u);
616-
struct circ_buf *xmit = &tup->uport.state->xmit;
617616
struct dma_tx_state state;
618617
unsigned int count;
619618

@@ -624,7 +623,7 @@ static void tegra_uart_stop_tx(struct uart_port *u)
624623
dmaengine_tx_status(tup->tx_dma_chan, tup->tx_cookie, &state);
625624
count = tup->tx_bytes_requested - state.residue;
626625
async_tx_ack(tup->tx_dma_desc);
627-
xmit->tail = (xmit->tail + count) & (UART_XMIT_SIZE - 1);
626+
uart_xmit_advance(&tup->uport, count);
628627
tup->tx_in_progress = 0;
629628
}
630629

drivers/tty/serial/sifive.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -945,7 +945,7 @@ static int sifive_serial_probe(struct platform_device *pdev)
945945
return PTR_ERR(base);
946946
}
947947

948-
clk = devm_clk_get(&pdev->dev, NULL);
948+
clk = devm_clk_get_enabled(&pdev->dev, NULL);
949949
if (IS_ERR(clk)) {
950950
dev_err(&pdev->dev, "unable to find controller clock\n");
951951
return PTR_ERR(clk);

drivers/tty/serial/tegra-tcu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ static void tegra_tcu_uart_start_tx(struct uart_port *port)
101101
break;
102102

103103
tegra_tcu_write(tcu, &xmit->buf[xmit->tail], count);
104-
xmit->tail = (xmit->tail + count) & (UART_XMIT_SIZE - 1);
104+
uart_xmit_advance(port, count);
105105
}
106106

107107
uart_write_wakeup(port);

include/linux/serial_core.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,23 @@ struct uart_state {
624624
/* number of characters left in xmit buffer before we ask for more */
625625
#define WAKEUP_CHARS 256
626626

627+
/**
628+
* uart_xmit_advance - Advance xmit buffer and account Tx'ed chars
629+
* @up: uart_port structure describing the port
630+
* @chars: number of characters sent
631+
*
632+
* This function advances the tail of circular xmit buffer by the number of
633+
* @chars transmitted and handles accounting of transmitted bytes (into
634+
* @up's icount.tx).
635+
*/
636+
static inline void uart_xmit_advance(struct uart_port *up, unsigned int chars)
637+
{
638+
struct circ_buf *xmit = &up->state->xmit;
639+
640+
xmit->tail = (xmit->tail + chars) & (UART_XMIT_SIZE - 1);
641+
up->icount.tx += chars;
642+
}
643+
627644
struct module;
628645
struct tty_driver;
629646

0 commit comments

Comments
 (0)