[PATCH 4/4] spec: Add Mini UART and PL011 drivers to build spec

2023-08-28 Thread Utkarsh Verma
This commit updates the build spec to include the new UART drivers for
PL011 and Mini UART.
---
 spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml | 1 -
 spec/build/bsps/obj.yml | 7 ---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml 
b/spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml
index a579c094ba..3c58c48ba2 100644
--- a/spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml
+++ b/spec/build/bsps/aarch64/raspberrypi/bspraspberrypi4.yml
@@ -58,7 +58,6 @@ source:
 - bsps/shared/dev/irq/arm-gicv2-get-attributes.c
 - bsps/shared/dev/serial/console-termios-init.c
 - bsps/shared/dev/serial/console-termios.c
-- bsps/shared/dev/serial/arm-pl011.c
 - bsps/shared/dev/getentropy/getentropy-cpucounter.c
 - bsps/shared/dev/btimer/btimer-cpucounter.c
 - bsps/shared/irq/irq-default-handler.c
diff --git a/spec/build/bsps/obj.yml b/spec/build/bsps/obj.yml
index 6f76e9bb7c..7eab5c008b 100644
--- a/spec/build/bsps/obj.yml
+++ b/spec/build/bsps/obj.yml
@@ -55,8 +55,8 @@ install:
   - bsps/include/libchip/wd80x3.h
 - destination: ${BSP_INCLUDEDIR}/dev/serial
   source:
-  - bsps/include/dev/serial/arm-pl011-regs.h
-  - bsps/include/dev/serial/arm-pl011.h
+  - bsps/include/dev/serial/pl011.h
+  - bsps/include/dev/serial/mini-uart.h
 - destination: ${BSP_INCLUDEDIR}/rtems/zilog
   source:
   - bsps/include/rtems/zilog/z8036.h
@@ -96,7 +96,8 @@ source:
 - bsps/shared/dev/rtc/m48t08_reg8.c
 - bsps/shared/dev/rtc/mcp7940m.c
 - bsps/shared/dev/rtc/rtcprobe.c
-- bsps/shared/dev/serial/arm-pl011.c
+- bsps/shared/dev/serial/pl011.c
+- bsps/shared/dev/serial/mini-uart.c
 - bsps/shared/dev/serial/ns16550-context.c
 - bsps/shared/dev/serial/ns16550.c
 - bsps/shared/dev/serial/serprobe.c
-- 
2.41.0

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 3/4] bsps: Update BSPs to use the new PL011 driver

2023-08-28 Thread Utkarsh Verma
This commit updates the existing BSPs to use the new PL011 driver.
---
 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 +-
 6 files changed, 43 insertions(+), 43 deletions(-)

diff --git a/bsps/aarch64/a53/console/console.c 
b/bsps/aarch64/a53/console/console.c
index 1854909c98..4535882e95 100644
--- a/bsps/aarch64/a53/console/console.c
+++ b/bsps/aarch64/a53/console/console.c
@@ -37,14 +37,14 @@
 #include 
 
 #include 
-#include 
+#include 
 #include 
 
 #include 
 
-arm_pl011_context a53_qemu_vpl011_context = {
-  .base = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER("PL011"),
-  .regs = (volatile pl011 *) BSP_A53_QEMU_VPL011_BASE,
+pl011_context a53_qemu_vpl011_context = {
+  .context = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER("PL011"),
+  .regs_base = BSP_A53_QEMU_VPL011_BASE,
   .initial_baud = 115200
 };
 
@@ -52,8 +52,8 @@ const console_device console_device_table[] = {
   {
 .device_file = "/dev/ttyS0",
 .probe = console_device_probe_default,
-.handler = &arm_pl011_fns,
-.context = &a53_qemu_vpl011_context.base
+.handler = &pl011_handler,
+.context = &a53_qemu_vpl011_context.context
   }
 };
 
@@ -61,7 +61,7 @@ const size_t console_device_count = 
RTEMS_ARRAY_SIZE(console_device_table);
 
 static void output_char( char c )
 {
-  arm_pl011_write_polled(&a53_qemu_vpl011_context.base, c);
+  pl011_write_char_polled(&a53_qemu_vpl011_context.context, c);
 }
 
 BSP_output_char_function_type BSP_output_char = output_char;
diff --git a/bsps/aarch64/a72/console/console.c 
b/bsps/aarch64/a72/console/console.c
index 08532d68cd..7c1c92483d 100644
--- a/bsps/aarch64/a72/console/console.c
+++ b/bsps/aarch64/a72/console/console.c
@@ -37,14 +37,14 @@
 #include 
 
 #include 
-#include 
+#include 
 #include 
 
 #include 
 
-arm_pl011_context a72_qemu_vpl011_context = {
-  .base = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER("PL011"),
-  .regs = (volatile pl011 *) BSP_A72_QEMU_VPL011_BASE,
+pl011_context a72_qemu_vpl011_context = {
+  .context = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER("PL011"),
+  .regs_base = BSP_A72_QEMU_VPL011_BASE,
   .initial_baud = 115200
 };
 
@@ -52,8 +52,8 @@ const console_device console_device_table[] = {
   {
 .device_file = "/dev/ttyS0",
 .probe = console_device_probe_default,
-.handler = &arm_pl011_fns,
-.context = &a72_qemu_vpl011_context.base
+.handler = &pl011_handler,
+.context = &a72_qemu_vpl011_context.context
   }
 };
 
@@ -61,7 +61,7 @@ const size_t console_device_count = 
RTEMS_ARRAY_SIZE(console_device_table);
 
 static void output_char( char c )
 {
-  arm_pl011_write_polled(&a72_qemu_vpl011_context.base, c);
+  pl011_write_char_polled(&a72_qemu_vpl011_context.context, c);
 }
 
 BSP_output_char_function_type BSP_output_char = output_char;
diff --git a/bsps/aarch64/raspberrypi/console/console.c 
b/bsps/aarch64/raspberrypi/console/console.c
index 73bb0036ff..54c50260a0 100644
--- a/bsps/aarch64/raspberrypi/console/console.c
+++ b/bsps/aarch64/raspberrypi/console/console.c
@@ -37,14 +37,14 @@
 #include 
 
 #include 
-#include 
+#include 
 #include 
 
 #include 
 
-arm_pl011_context raspberrypi_4_context = {
-  .base = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER("PL011"),
-  .regs = (volatile pl011 *) BSP_RPI4_PL011_BASE,
+pl011_context raspberrypi_4_context = {
+  .context = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER("PL011"),
+  .regs_base = BSP_RPI4_PL011_BASE,
   .initial_baud = 115200
 };
 
@@ -52,8 +52,8 @@ const console_device console_device_table[] = {
   {
 .device_file = "/dev/ttyS0",
 .probe = console_device_probe_default,
-.handler = &arm_pl011_fns,
-.context = &raspberrypi_4_context.base
+.handler = &pl011_handler,
+.context = &raspberrypi_4_context.context
   }
 };
 
@@ -61,7 +61,7 @@ const size_t console_device_count = 
RTEMS_ARRAY_SIZE(console_device_table);
 
 static void output_char( char c )
 {
-  arm_pl011_write_polled(&raspberrypi_4_context.base, c);
+  pl011_write_char_polled(&raspberrypi_4_context.context, c);
 }
 
 BSP_output_char_function_type BSP_output_char = output_char;
diff --git a/bsps/arm/raspberrypi/console/console-config.c 
b/bsps/arm/raspberrypi/console/console-config.c
index 6b8eb80aa4..2fb571b0e9 100644
--- a/bsps/arm/raspberrypi/console/console-config.c
+++ b/bsps/arm/raspberrypi/console/console-config.c
@@ -25,7 +25,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 #include 
@@ -46,19 +46,19 @@
 #define MINIUART  "/dev/ttyS0"
 #define FBCONS"/dev/fbcons"
 
-arm_pl011_context pl011_context;
-ns16550_context mini_uart_context;
+pl011_context uart0;
+ns16550_context uart1;
 
 rpi_fb_context fb_context;
 
 static void output_char_pl011(char

[PATCH 2/4] bsps/shared: Add new Mini UART driver

2023-08-28 Thread Utkarsh Verma
This commit adds a new driver for the Mini UART peripheral present on
Raspberry Pi devices. It implements the termios API with support for
setting attributes. It supports interrupts through the
BSP_CONSOLE_USE_INTERRUPTS macro.
---
 bsps/include/dev/serial/mini-uart.h |  54 +
 bsps/shared/dev/serial/mini-uart.c  | 316 
 2 files changed, 370 insertions(+)
 create mode 100644 bsps/include/dev/serial/mini-uart.h
 create mode 100644 bsps/shared/dev/serial/mini-uart.c

diff --git a/bsps/include/dev/serial/mini-uart.h 
b/bsps/include/dev/serial/mini-uart.h
new file mode 100644
index 00..7fce5d0d97
--- /dev/null
+++ b/bsps/include/dev/serial/mini-uart.h
@@ -0,0 +1,54 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/*
+ * Copyright (C) 2023 Utkarsh Verma
+ *
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef LIBBSP_SHARED_DEV_SERIAL_MINI_UART_H
+#define LIBBSP_SHARED_DEV_SERIAL_MINI_UART_H
+
+#include 
+#include 
+#include 
+#include 
+
+typedef struct {
+rtems_termios_device_context context;
+const uintptr_t regs_base;
+const uint32_t clock;
+const uint32_t initial_baud;
+const rtems_vector_number irq;
+
+#ifdef BSP_CONSOLE_USE_INTERRUPTS
+volatile int tx_queued_chars;
+#endif
+} mini_uart_context;
+
+extern const rtems_termios_device_handler mini_uart_handler;
+
+void mini_uart_write_char_polled(const rtems_termios_device_context* context,
+ const char ch);
+
+#endif /* LIBBSP_SHARED_DEV_SERIAL_MINI_UART_H */
diff --git a/bsps/shared/dev/serial/mini-uart.c 
b/bsps/shared/dev/serial/mini-uart.c
new file mode 100644
index 00..e84d7e786e
--- /dev/null
+++ b/bsps/shared/dev/serial/mini-uart.c
@@ -0,0 +1,316 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/*
+ * Copyright (C) 2023 Utkarsh Verma
+ *
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "dev/serial/mini-uart.h"
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define REG(addr) *(volatile uint32_t *)(addr)
+
+/*
+ * NOTE:
+ * The datasheet will specify swapped bits for RX and TX interrupts in IER_REG,
+ * which is incorrect. The correct values are used here.
+ */
+#define IO_REG(base)  REG(base + 0x00)
+#define IO_REG_DATA_MASK  BSP_MSK32(0, 7)
+#define IER_REG(base) REG(base + 0x04)
+#define IER_REG_RXE   BSP_BIT32(0)
+

[PATCH 1/4] bsps/shared: Add new PL011 driver with IRQ support

2023-08-28 Thread Utkarsh Verma
This commit adds a new driver for the PL011. It uses the termios API
with support for setting attributes and interrupts. Interrupts can be
enabled using the BSP_CONSOLE_USE_INTERRUPTS macro.
---
 bsps/include/dev/serial/arm-pl011-regs.h  | 143 --
 .../dev/serial/{arm-pl011.h => pl011.h}   |  62 +--
 bsps/shared/dev/serial/arm-pl011.c| 104 
 bsps/shared/dev/serial/pl011.c| 470 ++
 4 files changed, 503 insertions(+), 276 deletions(-)
 delete mode 100644 bsps/include/dev/serial/arm-pl011-regs.h
 rename bsps/include/dev/serial/{arm-pl011.h => pl011.h} (51%)
 delete mode 100644 bsps/shared/dev/serial/arm-pl011.c
 create mode 100644 bsps/shared/dev/serial/pl011.c

diff --git a/bsps/include/dev/serial/arm-pl011-regs.h 
b/bsps/include/dev/serial/arm-pl011-regs.h
deleted file mode 100644
index d6ea9ae11a..00
--- a/bsps/include/dev/serial/arm-pl011-regs.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/* SPDX-License-Identifier: BSD-2-Clause */
-
-/**
- *  @file
- *
- *  @ingroup RTEMSBSPsARMShared
- *
- *  @brief ARM PL011 Register definitions
- */
-
-/*
- * Copyright (c) 2013 embedded brains GmbH & Co. KG
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *notice, this list of conditions and the following disclaimer in the
- *documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LIBBSP_ARM_SHARED_ARM_PL011_REGS_H
-#define LIBBSP_ARM_SHARED_ARM_PL011_REGS_H
-
-#include 
-
-typedef struct {
-  uint32_t uartdr;
-#define PL011_UARTDR_OE BSP_BIT32(11)
-#define PL011_UARTDR_BE BSP_BIT32(10)
-#define PL011_UARTDR_PE BSP_BIT32(9)
-#define PL011_UARTDR_FE BSP_BIT32(8)
-#define PL011_UARTDR_DATA(val) BSP_FLD32(val, 0, 7)
-#define PL011_UARTDR_DATA_GET(reg) BSP_FLD32GET(reg, 0, 7)
-#define PL011_UARTDR_DATA_SET(reg, val) BSP_FLD32SET(reg, val, 0, 7)
-  uint32_t uartrsr_uartecr;
-#define PL011_UARTRSR_UARTECR_OE BSP_BIT32(3)
-#define PL011_UARTRSR_UARTECR_BE BSP_BIT32(2)
-#define PL011_UARTRSR_UARTECR_PE BSP_BIT32(1)
-#define PL011_UARTRSR_UARTECR_FE BSP_BIT32(0)
-  uint32_t reserved_08[4];
-  uint32_t uartfr;
-#define PL011_UARTFR_RI BSP_BIT32(8)
-#define PL011_UARTFR_TXFE BSP_BIT32(7)
-#define PL011_UARTFR_RXFF BSP_BIT32(6)
-#define PL011_UARTFR_TXFF BSP_BIT32(5)
-#define PL011_UARTFR_RXFE BSP_BIT32(4)
-#define PL011_UARTFR_BUSY BSP_BIT32(3)
-#define PL011_UARTFR_DCD BSP_BIT32(2)
-#define PL011_UARTFR_DSR BSP_BIT32(1)
-#define PL011_UARTFR_CTS BSP_BIT32(0)
-  uint32_t reserved_1c;
-  uint32_t uartilpr;
-#define PL011_UARTILPR_ILPDVSR(val) BSP_FLD32(val, 0, 7)
-#define PL011_UARTILPR_ILPDVSR_GET(reg) BSP_FLD32GET(reg, 0, 7)
-#define PL011_UARTILPR_ILPDVSR_SET(reg, val) BSP_FLD32SET(reg, val, 0, 7)
-  uint32_t uartibrd;
-#define PL011_UARTIBRD_BAUD_DIVINT(val) BSP_FLD32(val, 0, 15)
-#define PL011_UARTIBRD_BAUD_DIVINT_GET(reg) BSP_FLD32GET(reg, 0, 15)
-#define PL011_UARTIBRD_BAUD_DIVINT_SET(reg, val) BSP_FLD32SET(reg, val, 0, 15)
-  uint32_t uartfbrd;
-#define PL011_UARTFBRD_BAUD_DIVFRAC(val) BSP_FLD32(val, 0, 5)
-#define PL011_UARTFBRD_BAUD_DIVFRAC_GET(reg) BSP_FLD32GET(reg, 0, 5)
-#define PL011_UARTFBRD_BAUD_DIVFRAC_SET(reg, val) BSP_FLD32SET(reg, val, 0, 5)
-  uint32_t uartlcr_h;
-#define PL011_UARTLCR_H_SPS BSP_BIT32(7)
-#define PL011_UARTLCR_H_WLEN(val) BSP_FLD32(val, 5, 6)
-#define PL011_UARTLCR_H_WLEN_GET(reg) BSP_FLD32GET(reg, 5, 6)
-#define PL011_UARTLCR_H_WLEN_SET(reg, val) BSP_FLD32SET(reg, val, 5, 6)
-#define PL011_UARTLCR_H_WLEN_5 0x00U
-#define PL011_UARTLCR_H_WLEN_6 0x01U
-#define PL011_UARTLCR_H_WLEN_7 0x02U
-#define PL011_UARTLCR_H_WLEN_8 0x03U
-#define PL011_UARTLCR_H_FEN BSP_BIT32(4)
-#define PL011_UARTLCR_H_STP2 BSP_BIT32(3)
-#define PL011_UARTLCR_H_EPS BSP_BIT32(2)
-#define PL011_UARTLCR_H_PEN BSP_BIT32(1)
-#define PL011_UARTLCR_H_BRK BSP_BIT32(0)
-  uint32_t uartcr;
-#define PL011_UARTCR_CTSEN BSP_BIT32(15)
-#d

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

2023-08-28 Thread Utkarsh Verma
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

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [RSB PATCH] rtems/tools: Shell execute fixes

2023-08-28 Thread Joel Sherrill
Looks ok to push

On Mon, Aug 28, 2023, 9:14 PM  wrote:

> From: Chris Johns 
>
> Updates #4951
> ---
>  rtems/config/tools/rtems-tools-6.cfg | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/rtems/config/tools/rtems-tools-6.cfg
> b/rtems/config/tools/rtems-tools-6.cfg
> index 6eed755..b360f7e 100644
> --- a/rtems/config/tools/rtems-tools-6.cfg
> +++ b/rtems/config/tools/rtems-tools-6.cfg
> @@ -10,14 +10,14 @@
>   %define rtems_tools_source rtems-tools-%{rtems_tools_version}
>   %define rtems_tools_ext xz
>  %else
> - %define rtems_tools_version 349bbd96543365e830e5ef5e851765e4b742a8a4
> + %define rtems_tools_version 3ea0c249346fda427bf0d3c169aa3e7c2a521df8
>   %define rtems_tools_ext bz2
>  %endif
>
>  %define rtems_tools_source rtems-tools-%{rtems_tools_version}
>  %source set rtems-tools
> https://git.rtems.org/rtems-tools/snapshot/%{rtems_tools_source}.tar.%{rtems_tools_ext}
>  %hash   sha512 rtems-tools-%{rtems_tools_version}.tar.bz2 \
> -
>  
> qb5EC4gWfahYLPliYk+mNRsgzaDuouqiRq6GURb8v0Pk4J6Uo6IiKrB6dPvqVPO+wh9Omb1xCs+86W/+fj8sZg==
> +
>  
> +wrMxGHJp5cd/hpgoGwTH65IvwZQsAWOb8JNmDZKdFqUbhUuUYq1zK1p5NJnvCUkHudxgDmghAe/5kaFE5DJ4w==
>
>  #
>  # Optionally enable/disable building the RTEMS Tools via the command line.
> --
> 2.37.1
>
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

[RSB PATCH] rtems/tools: Shell execute fixes

2023-08-28 Thread chrisj
From: Chris Johns 

Updates #4951
---
 rtems/config/tools/rtems-tools-6.cfg | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/rtems/config/tools/rtems-tools-6.cfg 
b/rtems/config/tools/rtems-tools-6.cfg
index 6eed755..b360f7e 100644
--- a/rtems/config/tools/rtems-tools-6.cfg
+++ b/rtems/config/tools/rtems-tools-6.cfg
@@ -10,14 +10,14 @@
  %define rtems_tools_source rtems-tools-%{rtems_tools_version}
  %define rtems_tools_ext xz
 %else
- %define rtems_tools_version 349bbd96543365e830e5ef5e851765e4b742a8a4
+ %define rtems_tools_version 3ea0c249346fda427bf0d3c169aa3e7c2a521df8
  %define rtems_tools_ext bz2
 %endif
 
 %define rtems_tools_source rtems-tools-%{rtems_tools_version}
 %source set rtems-tools 
https://git.rtems.org/rtems-tools/snapshot/%{rtems_tools_source}.tar.%{rtems_tools_ext}
 %hash   sha512 rtems-tools-%{rtems_tools_version}.tar.bz2 \
-   
qb5EC4gWfahYLPliYk+mNRsgzaDuouqiRq6GURb8v0Pk4J6Uo6IiKrB6dPvqVPO+wh9Omb1xCs+86W/+fj8sZg==
+   
+wrMxGHJp5cd/hpgoGwTH65IvwZQsAWOb8JNmDZKdFqUbhUuUYq1zK1p5NJnvCUkHudxgDmghAe/5kaFE5DJ4w==
 
 #
 # Optionally enable/disable building the RTEMS Tools via the command line.
-- 
2.37.1

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH 2/5] testsuites/libtests: Remove floats from libdl tests

2023-08-28 Thread Kinsey Moore
(cross posted from discord) I did some digging and it looks like the right
macros/defines to gate on are CPU_SOFTWARE_FP and CPU_HARDWARE_FP. The FP
code in the loadable module should only be present if at least one of those
is available and the definition in the host binary should only be present
if the former is true. It looks like these aren't set correctly in at least
some cases.

Kinsey

On Mon, Aug 28, 2023 at 10:35 AM Alex White  wrote:

> On Mon, Aug 28, 2023 at 10:31 AM Sam Price  wrote:
> >
> > Nevermind that would be done at the linker and not at compile time.
>
> I searched for some way to check if soft float routines are being used,
> but I
> couldn't find anything.
>
> Maybe we just remove the conditional altogether? I don't think it's a
> problem
> to have an extra print statement on targets that use hardware floating
> point
> instructions. This would simplify the code and make it more portable.
>
> Alex
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH 2/5] testsuites/libtests: Remove floats from libdl tests

2023-08-28 Thread Alex White
On Mon, Aug 28, 2023 at 10:31 AM Sam Price  wrote:
>
> Nevermind that would be done at the linker and not at compile time.

I searched for some way to check if soft float routines are being used, but I
couldn't find anything.

Maybe we just remove the conditional altogether? I don't think it's a problem
to have an extra print statement on targets that use hardware floating point
instructions. This would simplify the code and make it more portable.

Alex
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH 2/5] testsuites/libtests: Remove floats from libdl tests

2023-08-28 Thread Sam Price
Nevermind that would be done at the linker and not at compile time.

On Mon, Aug 28, 2023 at 11:04 AM Sam Price  wrote:
>
> Just curious instead of doing #ifdef __microblaze__
> could you do
> #ifndef __extendsfdf2
>
> Or something similar to determine if the floating point symbols are known?
>
> This would make it more portable.
>
> On Mon, Aug 28, 2023 at 10:11 AM Alex White  wrote:
> >
> > On Sun, Aug 27, 2023 at 11:48 PM Chris Johns  wrote:
> > >
> > > On 28/8/2023 2:12 pm, Alex White wrote:
> > > > On Sun, Aug 27, 2023 at 8:38 PM Chris Johns  wrote:
> > > >> The floats need to stay to make sure there are no issues with this 
> > > >> type. I see
> > > >> the tests with floats as valid.
> > > >>
> > > >> Is the only missing function `__extendsfdf2`?
> > > >
> > > > Yes, that is the only missing function. If I change the floats to 
> > > > doubles, the
> > > > need for `__extendsfdf2` goes away and the tests pass. Is that an 
> > > > acceptable
> > > > solution?
> > >
> > > I would happy with doubles being added so they are tested as well but 
> > > that is
> > > also outside the scope of your effort :)
> > >
> > > Is it easier to add a Microblaze conditional for the use of a double to 
> > > the base
> > > image and to forced the symbol to be linked in?
> >
> > I don't think it's too hard to add a conditional to the base image. For
> > instance, this modification to dl07 is enough to make it pass on MicroBlaze:
> >
> > diff --git a/testsuites/libtests/dl07/init.c 
> > b/testsuites/libtests/dl07/init.c
> > index 8db106ba29..7fb1500660 100644
> > --- a/testsuites/libtests/dl07/init.c
> > +++ b/testsuites/libtests/dl07/init.c
> > @@ -67,6 +67,14 @@ static void Init(rtems_task_argument arg)
> >
> >TEST_BEGIN();
> >
> > +#ifdef __microblaze__
> > +  /* This is just here to link `__extendsfdf2` into the base image. */
> > +  {
> > +float f = 0.;
> > +printf("f: %f\n", f);
> > +  }
> > +#endif /* __microblaze__ */
> > +
> >te = rtems_tarfs_load("/", (void *)TARFILE_START, (size_t)TARFILE_SIZE);
> >if (te != 0)
> >{
> >
> > Is that what you were thinking?
> >
> > Alex
> > ___
> > devel mailing list
> > devel@rtems.org
> > http://lists.rtems.org/mailman/listinfo/devel
>
>
>
> --
> Sincerely,
>
> Sam Price



-- 
Sincerely,

Sam Price
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH 2/5] testsuites/libtests: Remove floats from libdl tests

2023-08-28 Thread Sam Price
Just curious instead of doing #ifdef __microblaze__
could you do
#ifndef __extendsfdf2

Or something similar to determine if the floating point symbols are known?

This would make it more portable.

On Mon, Aug 28, 2023 at 10:11 AM Alex White  wrote:
>
> On Sun, Aug 27, 2023 at 11:48 PM Chris Johns  wrote:
> >
> > On 28/8/2023 2:12 pm, Alex White wrote:
> > > On Sun, Aug 27, 2023 at 8:38 PM Chris Johns  wrote:
> > >> The floats need to stay to make sure there are no issues with this type. 
> > >> I see
> > >> the tests with floats as valid.
> > >>
> > >> Is the only missing function `__extendsfdf2`?
> > >
> > > Yes, that is the only missing function. If I change the floats to 
> > > doubles, the
> > > need for `__extendsfdf2` goes away and the tests pass. Is that an 
> > > acceptable
> > > solution?
> >
> > I would happy with doubles being added so they are tested as well but that 
> > is
> > also outside the scope of your effort :)
> >
> > Is it easier to add a Microblaze conditional for the use of a double to the 
> > base
> > image and to forced the symbol to be linked in?
>
> I don't think it's too hard to add a conditional to the base image. For
> instance, this modification to dl07 is enough to make it pass on MicroBlaze:
>
> diff --git a/testsuites/libtests/dl07/init.c b/testsuites/libtests/dl07/init.c
> index 8db106ba29..7fb1500660 100644
> --- a/testsuites/libtests/dl07/init.c
> +++ b/testsuites/libtests/dl07/init.c
> @@ -67,6 +67,14 @@ static void Init(rtems_task_argument arg)
>
>TEST_BEGIN();
>
> +#ifdef __microblaze__
> +  /* This is just here to link `__extendsfdf2` into the base image. */
> +  {
> +float f = 0.;
> +printf("f: %f\n", f);
> +  }
> +#endif /* __microblaze__ */
> +
>te = rtems_tarfs_load("/", (void *)TARFILE_START, (size_t)TARFILE_SIZE);
>if (te != 0)
>{
>
> Is that what you were thinking?
>
> Alex
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel



-- 
Sincerely,

Sam Price
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH 2/5] testsuites/libtests: Remove floats from libdl tests

2023-08-28 Thread Alex White
On Sun, Aug 27, 2023 at 11:48 PM Chris Johns  wrote:
>
> On 28/8/2023 2:12 pm, Alex White wrote:
> > On Sun, Aug 27, 2023 at 8:38 PM Chris Johns  wrote:
> >> The floats need to stay to make sure there are no issues with this type. I 
> >> see
> >> the tests with floats as valid.
> >>
> >> Is the only missing function `__extendsfdf2`?
> >
> > Yes, that is the only missing function. If I change the floats to doubles, 
> > the
> > need for `__extendsfdf2` goes away and the tests pass. Is that an acceptable
> > solution?
>
> I would happy with doubles being added so they are tested as well but that is
> also outside the scope of your effort :)
>
> Is it easier to add a Microblaze conditional for the use of a double to the 
> base
> image and to forced the symbol to be linked in?

I don't think it's too hard to add a conditional to the base image. For
instance, this modification to dl07 is enough to make it pass on MicroBlaze:

diff --git a/testsuites/libtests/dl07/init.c b/testsuites/libtests/dl07/init.c
index 8db106ba29..7fb1500660 100644
--- a/testsuites/libtests/dl07/init.c
+++ b/testsuites/libtests/dl07/init.c
@@ -67,6 +67,14 @@ static void Init(rtems_task_argument arg)
 
   TEST_BEGIN();
 
+#ifdef __microblaze__
+  /* This is just here to link `__extendsfdf2` into the base image. */
+  {
+float f = 0.;
+printf("f: %f\n", f);
+  }
+#endif /* __microblaze__ */
+
   te = rtems_tarfs_load("/", (void *)TARFILE_START, (size_t)TARFILE_SIZE);
   if (te != 0)
   {

Is that what you were thinking?

Alex
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel