[PATCH 0/4] New UART drivers for PL011 and Mini UART

Utkarsh Verma utkarsh at bitbanged.com
Wed Sep 6 03:01:51 UTC 2023


A gentle reminder.

Regards,
Utkarsh

On Thu, Aug 31, 2023 at 10:02 AM Utkarsh Verma <utkarsh at bitbanged.com>
wrote:

> A gentle reminder for this patch. Please have a look at this and let me
> know what changes are required. Once this is merged, I have a few more
> patches building upon this.
>
> Regards,
> Utkarsh
>
> On Wed, Aug 30, 2023 at 9:47 AM Utkarsh Verma <utkarsh at bitbanged.com>
> wrote:
>
>> This patch series adds two drivers, PL011 and Mini UART. Both support
>> interrupts and implement the termios API.
>>
>> Why add a new driver for the PL011 when we already have one?
>>
>> The existing driver is a very basic one and uses memory-mapped structs
>> to access the registers. This proved to be problematic for the
>> 'aarch64/raspberrypi4b' BSP as the RPi 4B's MMU does not reserve the
>> entirety of the space required by the PL011 register struct.
>>
>> Even the existing driver doesn't use all the struct members. So, in the
>> new driver, macros were used instead. This has the benefit of minimalism
>> and ensures that we only add tested features to the driver.
>>
>> This driver builds upon the PL011 driver present in the Xilinx Versal
>> BSP and addresses the IRQ startup hack.
>>
>> In short, the new PL011 driver has the features provided by the
>> existing driver, and it meshes well with the termios API.
>>
>> Lastly, there's one thing I need feedback on. The PL011 has a hardware
>> limitation which requires me to invoke the IRQ handler manually, the
>> first time. For this, I need access to the `tty` struct in the
>> `write_buffer` function.
>>
>>
>> https://github.com/UtkarshVerma/rtems/blob/uart-drivers/bsps/shared/dev/serial/pl011.c#L301
>>
>> For now, I store the tty in the device context and then pass the context
>> to the IRQ handler. Is this a good approach? Are there better ways to do
>> this?
>>
>> For convenience, feel free to check out my GitHub fork which has these
>> changes:
>>
>> https://github.com/UtkarshVerma/rtems/tree/uart-drivers
>>
>> Utkarsh Verma (4):
>>   bsps/shared: Add new PL011 driver with IRQ support
>>   bsps/shared: Add new Mini UART driver
>>   spec: Add Mini UART and PL011 drivers to build spec
>>   bsps: Update BSPs to use the new PL011 driver
>>
>>  bsps/aarch64/a53/console/console.c            |  15 +-
>>  bsps/aarch64/a72/console/console.c            |  15 +-
>>  bsps/aarch64/raspberrypi/console/console.c    |  29 +-
>>  bsps/arm/raspberrypi/console/console-config.c |  27 +-
>>  .../realview-pbx-a9/console/console-polled.c  |   5 +-
>>  .../arm/realview-pbx-a9/include/bsp/console.h |   4 +-
>>  bsps/arm/xen/console/console.c                |  15 +-
>>  bsps/include/dev/serial/arm-pl011-regs.h      | 143 ------
>>  .../dev/serial/{arm-pl011.h => mini-uart.h}   |  52 +-
>>  bsps/include/dev/serial/pl011.h               |  68 +++
>>  bsps/shared/dev/serial/arm-pl011.c            | 104 ----
>>  bsps/shared/dev/serial/mini-uart.c            | 316 ++++++++++++
>>  bsps/shared/dev/serial/pl011.c                | 470 ++++++++++++++++++
>>  .../aarch64/raspberrypi/bspraspberrypi4.yml   |   1 -
>>  spec/build/bsps/obj.yml                       |   7 +-
>>  15 files changed, 934 insertions(+), 337 deletions(-)
>>  delete mode 100644 bsps/include/dev/serial/arm-pl011-regs.h
>>  rename bsps/include/dev/serial/{arm-pl011.h => mini-uart.h} (64%)
>>  create mode 100644 bsps/include/dev/serial/pl011.h
>>  delete mode 100644 bsps/shared/dev/serial/arm-pl011.c
>>  create mode 100644 bsps/shared/dev/serial/mini-uart.c
>>  create mode 100644 bsps/shared/dev/serial/pl011.c
>>
>> --
>> 2.41.0
>>
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20230906/8f6db4a5/attachment.htm>


More information about the devel mailing list