mbox series

[0/2,for,2018.03] RPi: Drain RX queue on setbrg

Message ID 20180306131327.61174-1-agraf@suse.de
Headers show
Series RPi: Drain RX queue on setbrg | expand

Message

Alexander Graf March 6, 2018, 1:13 p.m. UTC
We had a few reports coming in from people that had their autoboot chain
aborted after pinmuxing support was added for the RPi.

The culprit is easy: The UARTs may have been enabled before, but muxed
to an incorrect pin. That pin may have pulled the RX line down which again
lead to lots of zero bytes gathered in the RX buffer.

The easy fix for that is to drain the RX queue every time we set the baud
rate.

This patch set is the minimally intrusive fix for the RPi. We may want to
do that generically for all serial devices later.

Alexander Graf (2):
  serial_bcm283x_mu: Flush RX queue after setting baud rate
  bcm283x_pl011: Flush RX queue after setting baud rate

 drivers/serial/serial_bcm283x_mu.c     |  8 +++++++-
 drivers/serial/serial_bcm283x_pl011.c  | 25 ++++++++++++++++++++++++-
 drivers/serial/serial_pl01x.c          | 10 +++++-----
 drivers/serial/serial_pl01x_internal.h |  7 ++++++-
 4 files changed, 42 insertions(+), 8 deletions(-)

Comments

Peter Robinson March 7, 2018, 1:07 p.m. UTC | #1
On Tue, Mar 6, 2018 at 1:13 PM, Alexander Graf <agraf@suse.de> wrote:
> We had a few reports coming in from people that had their autoboot chain
> aborted after pinmuxing support was added for the RPi.
>
> The culprit is easy: The UARTs may have been enabled before, but muxed
> to an incorrect pin. That pin may have pulled the RX line down which again
> lead to lots of zero bytes gathered in the RX buffer.
>
> The easy fix for that is to drain the RX queue every time we set the baud
> rate.
>
> This patch set is the minimally intrusive fix for the RPi. We may want to
> do that generically for all serial devices later.
>
> Alexander Graf (2):
>   serial_bcm283x_mu: Flush RX queue after setting baud rate
>   bcm283x_pl011: Flush RX queue after setting baud rate

This causes mixed effects for me, a regression on the RPi2 using the
pl011, but fixes the issue on the RPi3. Both my RPi2 have serial
console and playing with the enable in config.txt doesn't seem to have
any effect on whether they auto boot or not but with it commented out
I seem to get more random chars.

Peter
Alexander Graf March 7, 2018, 1:40 p.m. UTC | #2
On 03/07/2018 02:07 PM, Peter Robinson wrote:
> On Tue, Mar 6, 2018 at 1:13 PM, Alexander Graf <agraf@suse.de> wrote:
>> We had a few reports coming in from people that had their autoboot chain
>> aborted after pinmuxing support was added for the RPi.
>>
>> The culprit is easy: The UARTs may have been enabled before, but muxed
>> to an incorrect pin. That pin may have pulled the RX line down which again
>> lead to lots of zero bytes gathered in the RX buffer.
>>
>> The easy fix for that is to drain the RX queue every time we set the baud
>> rate.
>>
>> This patch set is the minimally intrusive fix for the RPi. We may want to
>> do that generically for all serial devices later.
>>
>> Alexander Graf (2):
>>    serial_bcm283x_mu: Flush RX queue after setting baud rate
>>    bcm283x_pl011: Flush RX queue after setting baud rate
> This causes mixed effects for me, a regression on the RPi2 using the
> pl011, but fixes the issue on the RPi3. Both my RPi2 have serial
> console and playing with the enable in config.txt doesn't seem to have
> any effect on whether they auto boot or not but with it commented out
> I seem to get more random chars.

Thanks a lot for testing! I'll try it on a rpi2 later tonight and check 
why it's failing.


Alex