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

Utkarsh Verma utkarsh at bitbanged.com
Tue Aug 29 04:45:11 UTC 2023


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 <rtems/bspIo.h>
 
 #include <bsp.h>
-#include <dev/serial/arm-pl011.h>
+#include <dev/serial/pl011.h>
 #include <bsp/console-termios.h>
 
 #include <bspopts.h>
 
-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 <rtems/bspIo.h>
 
 #include <bsp.h>
-#include <dev/serial/arm-pl011.h>
+#include <dev/serial/pl011.h>
 #include <bsp/console-termios.h>
 
 #include <bspopts.h>
 
-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 <rtems/bspIo.h>
 
 #include <bsp.h>
-#include <dev/serial/arm-pl011.h>
+#include <dev/serial/pl011.h>
 #include <bsp/console-termios.h>
 
 #include <bspopts.h>
 
-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 <libchip/serial.h>
 #include <libfdt.h>
 #include <libchip/ns16550.h>
-#include <dev/serial/arm-pl011.h>
+#include <dev/serial/pl011.h>
 
 #include <bspopts.h>
 #include <bsp/usart.h>
@@ -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 c)
 {
-  arm_pl011_write_polled(&pl011_context.base, c);
+  pl011_write_char_polled(&uart0.context, c);
 }
 
 static void output_char_mini_uart(char c)
 {
-  ns16550_polled_putchar(&mini_uart_context.base, c);
+  ns16550_polled_putchar(&uart1.base, c);
 }
 
 void output_char_fb(char c)
@@ -83,9 +83,9 @@ static void init_ctx_arm_pl011(
   int node
 )
 {
-  arm_pl011_context *ctx = &pl011_context;
+  pl011_context *ctx = &uart0;
   rtems_termios_device_context_initialize(&ctx->base, "PL011UART");
-  ctx->regs = raspberrypi_get_reg_of_node(fdt, node);
+  ctx->regs_base = raspberrypi_get_reg_of_node(fdt, node);
 }
 
 static uint32_t calculate_baud_divisor(
@@ -106,8 +106,8 @@ static void init_ctx_mini_uart(
   int len;
   ns16550_context *ctx;
 
-  memset(&mini_uart_context, 0, sizeof(mini_uart_context));
-  ctx = &mini_uart_context;
+  memset(&uart1, 0, sizeof(uart1));
+  ctx = &uart1;
 
   rtems_termios_device_context_initialize(&ctx->base, "MiniUART");
 
@@ -221,16 +221,16 @@ rtems_status_code console_initialize(
   uart_probe();
   rtems_termios_device_install(
     PL011,
-    &arm_pl011_fns,
+    &pl011_handler,
     NULL,
-    &pl011_context.base
+    &uart0.context
   );
 
   rtems_termios_device_install(
     MINIUART,
     &ns16550_handler_polled,
     NULL,
-    &mini_uart_context.base
+    &uart1.base
   );
 
   register_fb();
@@ -248,4 +248,4 @@ RTEMS_SYSINIT_ITEM(
   uart_probe,
   RTEMS_SYSINIT_BSP_START,
   RTEMS_SYSINIT_ORDER_LAST_BUT_5
-);
\ No newline at end of file
+);
diff --git a/bsps/arm/realview-pbx-a9/include/bsp/console.h b/bsps/arm/realview-pbx-a9/include/bsp/console.h
index 8f578983c3..b33692856b 100644
--- a/bsps/arm/realview-pbx-a9/include/bsp/console.h
+++ b/bsps/arm/realview-pbx-a9/include/bsp/console.h
@@ -28,13 +28,13 @@
 #ifndef LIBBSP_ARM_REALVIEW_PBX_A9_BSP_CONSOLE_H
 #define LIBBSP_ARM_REALVIEW_PBX_A9_BSP_CONSOLE_H
 
-#include <dev/serial/arm-pl011.h>
+#include <dev/serial/pl011.h>
 
 #ifdef __cplusplus
 extern "C" {
 #endif /* __cplusplus */
 
-extern arm_pl011_context rvpbx_pl011_context;
+extern pl011_context rvpbx_pl011_context;
 
 bool rvpbx_pl011_probe(rtems_termios_device_context *base);
 
diff --git a/bsps/arm/xen/console/console.c b/bsps/arm/xen/console/console.c
index 05eceae438..f735c98fa4 100644
--- a/bsps/arm/xen/console/console.c
+++ b/bsps/arm/xen/console/console.c
@@ -29,15 +29,15 @@
 #include <rtems/bspIo.h>
 
 #include <bsp.h>
-#include <dev/serial/arm-pl011.h>
+#include <dev/serial/pl011.h>
 #include <bsp/console-termios.h>
 #include <bsp/irq-generic.h>
 
 #include <bspopts.h>
 
-arm_pl011_context xen_vpl011_context = {
-  .base = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER("PL011"),
-  .regs = (volatile pl011 *) BSP_XEN_VPL011_BASE,
+pl011_context xen_vpl011_context = {
+  .context = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER("PL011"),
+  .regs_base = BSP_XEN_VPL011_BASE,
   .irq = GUEST_VPL011_SPI,
   .initial_baud = 115200
 };
@@ -46,8 +46,8 @@ const console_device console_device_table[] = {
   {
     .device_file = "/dev/ttyS0",
     .probe = console_device_probe_default,
-    .handler = &arm_pl011_fns,
-    .context = &xen_vpl011_context.base
+    .handler = &pl011_handler,
+    .context = &xen_vpl011_context.context
   }
 };
 
@@ -55,7 +55,7 @@ const size_t console_device_count = RTEMS_ARRAY_SIZE(console_device_table);
 
 static void output_char( char c )
 {
-  arm_pl011_write_polled(&xen_vpl011_context.base, c);
+  pl011_write_char_polled(&xen_vpl011_context.context, c);
 }
 
 BSP_output_char_function_type BSP_output_char = output_char;
-- 
2.41.0



More information about the devel mailing list