[U-Boot] [PATCH] serial: bcm283x_mu: Detect disabled serial device

Stephen Warren swarren at wwwdotorg.org
Mon Aug 1 17:20:45 CEST 2016


On 07/29/2016 03:49 PM, Alexander Graf wrote:
> On the raspberry pi, you can disable the serial port to gain dynamic frequency
> scaling which can get handy at times.
>
> However, in such a configuration the serial controller gets its rx queue filled
> up with zero bytes which then happily get transmitted on to whoever calls
> getc() today.
>
> This patch adds detection logic for that case and disables the mini uart if it
> sends a zero byte during probe. That way we can leave the driver enabled in the
> tree and can determine during runtime whether serial is usable or not.

I don't think this is the correct approach; it is quite possible and 
legal to receive a NULL character (which with this HW IIRC can also be 
triggered by a break condition on the line) even when the UART is fully 
operational. This could lead to false detection, and end up disabling 
the UART when it should not.

Rather, I would suggest detecting this condition based on some register 
content. The most direct might be to check the pinmux for the UART's RX 
pin, or perhaps whether the UART itself has been initialized.


More information about the U-Boot mailing list