serial: 8250: Fix THRE flag usage for CAP_MINI
PATCH v2 1/1 serial: 8250: Fix THRE flag usage for CAP_MINI
The BCM2835 MINI UART has non-standard THRE semantics. Conventionally the bit means that the FIFO is empty (although there may still be a byte in the transmit register), but on 2835 it indicates that the FIFO is not full. This causes interrupts after every byte is transmitted, with the FIFO providing some interrupt latency tolerance.
A consequence of this difference is that the usual strategy of writing multiple bytes into the TX FIFO after checking THRE once is unsafe. In the worst case of 7 bytes in the FIFO, writing 8 bytes loses all but the first since by then the FIFO is full.
There is an HFIFO ("Hidden FIFO") capability that causes the transmit loop to terminate when both THRE and TEMT are set, i.e. when the TX block is completely idle. This is unnecessarily cautious, potentially causing gaps in transmission.
Add a new conditional to the transmit loop, predicated on CAP_MINI, that exits when THRE is no longer set (the FIFO is full). This allows the FIFO to fill quickly but subsequent writes are paced by the transmission rate.
---
Changes in v2:
Add review tags.
drivers/tty/serial/8250/8250_port.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/tty/serial/8250/8250_port.c +4 -0
@@ -1764,6 +1764,10 @@ void serial8250_tx_chars(struct uart_8250_port *up)if ((up->capabilities &UART_CAP_HFIFO ) && (serial_in (up,UART_LSR ) &BOTH_EMPTY ) !=BOTH_EMPTY )break ; +/* The BCM2835 MINI UART THRE bit is really a not-full bit. */ +if ((up->capabilities &UART_CAP_MINI ) && + !(serial_in (up,UART_LSR ) &UART_LSR_THRE )) +break ; }while (--count >0 );if (uart_circ_chars_pending (xmit) <WAKEUP_CHARS )
Signature · 1 line
1.9.1
Hello,
Quoted 6 lines · Phil Elwell
Signed-off-by Phil Elwell <[email protected]>Acked-by Eric Anholt <[email protected]>---
Changes in v2:
Add review tags.
nitpick: The order of lines in the Sob area matter and you should add your Sob at the end. So as it was you adding the ack by Eric and Andy, it should look as follows:
. Note that this comment is very picky, quite some people don't get it right and I never saw a maintainer refuse a patch because of this. So this probably doesn't warrant a v3 :-)
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
Phil Elwell
Acked-by Mika Penttilä Tested-by Mika Penttilä Acked-by Steve Twiss Tested-by Steve TwissQuoted 10 lines · Uwe Kleine-König
Hello,
Quoted 6 lines · Phil Elwell
Signed-off-by Phil Elwell <[email protected]>Acked-by Eric Anholt <[email protected]>Acked-by Andy Shevchenko <[email protected]>---
Changes in v2:
Add review tags.
Quoted 7 lines
nitpick: The order of lines in the Sob area matter and you should add your Sob at the end. So as it was you adding the ack by Eric and Andy, it should look as follows:
Acked-by Eric Anholt <[email protected]>Acked-by Andy Shevchenko <[email protected]>Signed-off-by Phil Elwell <[email protected]>
Really? I thought the submitter went first and the final merger went last, with other reviewers in-between, like this:
commit 6df765dca378bddf994cfd2044acafa501bd800f
Author: Uwe Kleine-König <[email protected]>
Date: Wed May 24 21:38:46 2017 +0200
serial: imx: ensure UCR3 and UFCR are setup correctly
[...]
Quoted 7 lines
. Note that this comment is very picky, quite some people don't get it right and I never saw a maintainer refuse a patch because of this. So this probably doesn't warrant a v3 :-)
Best regards
Uwe
_______________________________________________
linux-rpi-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rpi-kernel
Quoted 17 lines · Phil Elwell
Quoted 16 lines · Uwe Kleine-König
Hello,
Quoted 6 lines · Phil Elwell
Signed-off-by Phil Elwell <[email protected]>Acked-by Eric Anholt <[email protected]>Acked-by Andy Shevchenko <[email protected]>---
Changes in v2:
Add review tags.nitpick: The order of lines in the Sob area matter and you should add
your Sob at the end. So as it was you adding the ack by Eric and Andy,
it should look as follows:
Quoted 6 lines
Quoted 3 lines
Acked-by Eric Anholt <[email protected]>Acked-by Andy Shevchenko <[email protected]>Signed-off-by Phil Elwell <[email protected]>Really? I thought the submitter went first and the final merger went last, with other reviewers in-between, like this:
There is a difference between two, i.e. who has added tags in your case and below one? I guess whoever adds them, adds before their own SoB tag.
Quoted 28 lines
commit
6df765dca378bddf994cfd2044acafa501bd800f
Author: Uwe Kleine-König <[email protected]> Date: Wed May 24 21:38:46 2017 +0200serial: imx: ensure UCR3 and UFCR are setup correctly
[...]
Fixes e61c38d85b73 ("serial: imx: setup DCEDTE early andensure DCD and RI irqs to be off")
Signed-off-by Uwe Kleine-König <[email protected]e>
Acked-by Mika Penttilä <[email protected]>Tested-by Mika Penttilä <[email protected]>Acked-by Steve Twiss <[email protected]>Tested-by Steve Twiss <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>Quoted 9 lines
. Note that this comment is very picky, quite some people don't get it
right and I never saw a maintainer refuse a patch because of this. So
this probably doesn't warrant a v3 :-)Best regards
Uwe
Signature · 7 lines
Andy Shevchenko <[email protected]> Intel Finland Oy _______________________________________________ linux-rpi-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-rpi-kernel
Quoted 14 lines · Uwe Kleine-König
Hello,
Quoted 6 lines · Phil Elwell
Signed-off-by Phil Elwell <[email protected]>Acked-by Eric Anholt <[email protected]>Acked-by Andy Shevchenko <[email protected]>---
Changes in v2:
Add review tags.nitpick: The order of lines in the Sob area matter and you should add your Sob at the end. So as it was you adding the ack by Eric and Andy, it should look as follows:
Quoted 7 lines
Acked-by Eric Anholt <[email protected]>Acked-by Andy Shevchenko <[email protected]>Signed-off-by Phil Elwell <[email protected]>. Note that this comment is very picky, quite some people don't get it right and I never saw a maintainer refuse a patch because of this. So this probably doesn't warrant a v3 :-)
Yeah, it's easily learned when one is using
% git commit -s [--amend]
Signature · 7 lines
Andy Shevchenko <[email protected]> Intel Finland Oy _______________________________________________ linux-rpi-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-rpi-kernel
Hello,
Quoted 20 lines · Phil Elwell
Quoted 7 lines · Uwe Kleine-König
nitpick: The order of lines in the Sob area matter and you should add your Sob at the end. So as it was you adding the ack by Eric and Andy, it should look as follows:
Really? I thought the submitter went first and the final merger went last, with other reviewers in-between, like this:
commit
6df765dca378bddf994cfd2044acafa501bd800f
Author: Uwe Kleine-König <[email protected]>
Date: Wed May 24 21:38:46 2017 +0200serial: imx: ensure UCR3 and UFCR are setup correctly
[...]
Quoted 7 lines
Fixes e61c38d85b73 ("serial: imx: setup DCEDTE early and ensure DCD and RI irqs to be off")Signed-off-by Uwe Kleine-König <[email protected]>Acked-by Steve Twiss <[email protected]>Tested-by Steve Twiss <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Right, I would expect that it was Greg who added the Acked and Tested-by tags when reading this.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |