[U-Boot] [PATCH] board: rpi4: fix instantiating PL011 driver

Mark Dapoz md at dapoz.ca
Mon Nov 18 06:46:40 UTC 2019


> On 19-Nov-8, at 12:23 PM, Matthias Brugger <matthias.bgg at gmail.com> wrote:
> 
> On 27/09/2019 07:39, Mark Dapoz wrote:
>> The bcm283x PL011 serial driver is hard coded to allow connections only
>> for UART0.  This prevents using any of the other UARTs as the U-boot
>> console.
>> 
>> The bcm283x serial driver is updated to allow connections to any of the
>> PL011 devices.  The initialization logic has been updated as follows:
>> 
>>     - a GPIO pinlist is extracted from the device tree for the device
>>     - each pin is compared against a function assignment table
>>     - if the pin is found in the table and the currently assigned GPIO
>>       function doesn't match, the device is unavailable
>>     - if the function matches the table entry or the pin is not listed
>>       the table, the device is available
>> 
>> The function assignment table contains entries for UART0 to ensure it
>> is multiplexed to GPIO pins 14 and 15.
>> 
> 
> Which is what we already check right now, correct?

Yes, the existing behaviour is maintained.

> 
>> This logic allows GPIO 14 and 15 to be multiplexed between the miniUART
>> and the PL011 UART by the board's loader.
>> 
> 
> Maybe I'm too tired, but I don't see where this is done. I can just see that you
> changed the function to check if PL011 uses GPIO15 as ALT0 to a different
> function which checks the same. Can you please explain.

The pin list for GPIO14 and GPIO15 is checked if they are using ALT0 before
indicating that PL011 is available since that’s the only PL011 device that is
multiplexed with another serial port.  All other PL011 devices are assumed to be
available and the function returns true.   The DTS will determine which PL011’s
are enabled by setting the “status” property.

> 
>> An error in the default clock rate has also been fixed.  If the device
>> tree entry for the serial device doesn't specify a "clocks" property,
>> the default frequency of 1Hz was used.  The default has been changed
>> to 48MHz.
> 
> If doesn't that mean that we don't have a valid DTS?
> If this still makes sense then please split this out into a separate patch.

The generic PL011 driver in drivers/serial/serial_pl01x.c is looking for the
“clock” property but the DTS for the Pi has a “clocks” property instead.
When the driver can’t find the “clock” property, it uses a default value of 1Hz.
The PL011 driver wrapper for the Pi just changes it to 48MHz.

-mark


More information about the U-Boot mailing list