
Am 16.08.2016 um 05:30 schrieb Stephen Warren swarren@wwwdotorg.org:
On 08/15/2016 09:48 AM, 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 by checking whether the RX pin is mapped to GPIO15 and disables the mini uart if it is not mapped properly.
That way we can leave the driver enabled in the tree and can determine during runtime whether serial is usable or not, having a single binary that allows for uart and non-uart operation.
Acked-by: Stephen Warren swarren@wwwdotorg.org
Nits:
I'd hope for a core DM feature to disable statically created devices rather than re-implementing it per driver, so we don't have to re-invent this each time we need it. Still, we can refactor this later if it turns out to be more generally useful.
Perhaps a separate patch for the raw serial driver feature (serial_bcm283x_mu.h, serial_bcm283x_mu.c), and the board-specific logic (all the other files)?
I was thinking about it, but figured that these two lines of code are so heavily intertwined with the fact that you want to actually set the disabled property. So I decided against splitting them out - it wouldn't benefit readability, bisectability or revertability (which are the usual reasons for splitting patches).
Alex