[U-Boot] [PATCH] serial: bcm283x_mu: Detect disabled serial device
Alexander Graf
agraf at suse.de
Mon Aug 1 17:31:04 CEST 2016
> On 01 Aug 2016, at 16:20, Stephen Warren <swarren at wwwdotorg.org> wrote:
>
> 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.
Right, that’s why I tried to be very careful about the detection and only have it triggered when the very first byte ever received is a null byte. Any bytes after that don’t affect it.
> 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.
Hmm. I can try and dig through the documentation again to see whether there is a way.
Alex
More information about the U-Boot
mailing list