[PATCH 0/4] New UART drivers for PL011 and Mini UART
Utkarsh Verma
utkarsh at bitbanged.com
Tue Aug 29 04:44:38 UTC 2023
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
bsps: Update BSPs to use the new PL011 driver
spec: Add Mini UART and PL011 drivers to build spec
bsps/aarch64/a53/console/console.c | 14 +-
bsps/aarch64/a72/console/console.c | 14 +-
bsps/aarch64/raspberrypi/console/console.c | 14 +-
bsps/arm/raspberrypi/console/console-config.c | 26 +-
.../arm/realview-pbx-a9/include/bsp/console.h | 4 +-
bsps/arm/xen/console/console.c | 14 +-
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 +-
14 files changed, 922 insertions(+), 325 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
More information about the devel
mailing list