[PATCH v3 01/10] Move ARM PL011 UART driver

Kinsey Moore kinsey.moore at oarcorp.com
Sun Oct 4 04:18:45 UTC 2020


This UART driver is now needed for BSPs other than ARM.
---
 bsps/arm/headers.am                                          | 2 --
 bsps/arm/raspberrypi/console/console-config.c                | 2 +-
 bsps/arm/realview-pbx-a9/include/bsp/console.h               | 2 +-
 bsps/arm/xen/console/console.c                               | 2 +-
 bsps/headers.am                                              | 5 +++++
 .../{arm/include/bsp => include/dev/serial}/arm-pl011-regs.h | 0
 bsps/{arm/include/bsp => include/dev/serial}/arm-pl011.h     | 2 +-
 bsps/{arm/shared => shared/dev}/serial/arm-pl011.c           | 2 +-
 c/src/lib/libbsp/arm/raspberrypi/Makefile.am                 | 2 +-
 c/src/lib/libbsp/arm/realview-pbx-a9/Makefile.am             | 2 +-
 c/src/lib/libbsp/arm/xen/Makefile.am                         | 2 +-
 spec/build/bsps/arm/grp.yml                                  | 2 --
 spec/build/bsps/arm/raspberrypi/obj.yml                      | 1 -
 spec/build/bsps/arm/realview-pbx-a9/bsprealviewpbxa9.yml     | 1 -
 spec/build/bsps/arm/xen/bspxen.yml                           | 1 -
 spec/build/bsps/obj.yml                                      | 5 +++++
 16 files changed, 18 insertions(+), 15 deletions(-)
 rename bsps/{arm/include/bsp => include/dev/serial}/arm-pl011-regs.h (100%)
 rename bsps/{arm/include/bsp => include/dev/serial}/arm-pl011.h (96%)
 rename bsps/{arm/shared => shared/dev}/serial/arm-pl011.c (98%)

diff --git a/bsps/arm/headers.am b/bsps/arm/headers.am
index 3d2b09effa..f0d498c8f4 100644
--- a/bsps/arm/headers.am
+++ b/bsps/arm/headers.am
@@ -21,8 +21,6 @@ include_bsp_HEADERS += ../../../../../bsps/arm/include/bsp/arm-gic-irq.h
 include_bsp_HEADERS += ../../../../../bsps/arm/include/bsp/arm-gic-regs.h
 include_bsp_HEADERS += ../../../../../bsps/arm/include/bsp/arm-gic-tm27.h
 include_bsp_HEADERS += ../../../../../bsps/arm/include/bsp/arm-gic.h
-include_bsp_HEADERS += ../../../../../bsps/arm/include/bsp/arm-pl011-regs.h
-include_bsp_HEADERS += ../../../../../bsps/arm/include/bsp/arm-pl011.h
 include_bsp_HEADERS += ../../../../../bsps/arm/include/bsp/arm-pl050-regs.h
 include_bsp_HEADERS += ../../../../../bsps/arm/include/bsp/arm-pl050.h
 include_bsp_HEADERS += ../../../../../bsps/arm/include/bsp/arm-pl111-fb.h
diff --git a/bsps/arm/raspberrypi/console/console-config.c b/bsps/arm/raspberrypi/console/console-config.c
index bb0b596019..6b8eb80aa4 100644
--- a/bsps/arm/raspberrypi/console/console-config.c
+++ b/bsps/arm/raspberrypi/console/console-config.c
@@ -25,13 +25,13 @@
 #include <libchip/serial.h>
 #include <libfdt.h>
 #include <libchip/ns16550.h>
+#include <dev/serial/arm-pl011.h>
 
 #include <bspopts.h>
 #include <bsp/usart.h>
 #include <bsp/raspberrypi.h>
 #include <bsp/fbcons.h>
 #include <bsp.h>
-#include <bsp/arm-pl011.h>
 #include <bsp/console-termios.h>
 #include <bsp/fdt.h>
 #include <bsp/fatal.h>
diff --git a/bsps/arm/realview-pbx-a9/include/bsp/console.h b/bsps/arm/realview-pbx-a9/include/bsp/console.h
index da2e4099e2..2019fc2509 100644
--- a/bsps/arm/realview-pbx-a9/include/bsp/console.h
+++ b/bsps/arm/realview-pbx-a9/include/bsp/console.h
@@ -15,7 +15,7 @@
 #ifndef LIBBSP_ARM_REALVIEW_PBX_A9_BSP_CONSOLE_H
 #define LIBBSP_ARM_REALVIEW_PBX_A9_BSP_CONSOLE_H
 
-#include <bsp/arm-pl011.h>
+#include <dev/serial/arm-pl011.h>
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/bsps/arm/xen/console/console.c b/bsps/arm/xen/console/console.c
index 786b98f3ba..05eceae438 100644
--- a/bsps/arm/xen/console/console.c
+++ b/bsps/arm/xen/console/console.c
@@ -29,7 +29,7 @@
 #include <rtems/bspIo.h>
 
 #include <bsp.h>
-#include <bsp/arm-pl011.h>
+#include <dev/serial/arm-pl011.h>
 #include <bsp/console-termios.h>
 #include <bsp/irq-generic.h>
 
diff --git a/bsps/headers.am b/bsps/headers.am
index 5af7e43b4a..aaf13284bd 100644
--- a/bsps/headers.am
+++ b/bsps/headers.am
@@ -21,6 +21,11 @@ include_bsp_HEADERS += ../../bsps/include/bsp/u-boot.h
 include_bsp_HEADERS += ../../bsps/include/bsp/uart-output-char.h
 include_bsp_HEADERS += ../../bsps/include/bsp/utility.h
 
+include_dev_serialdir = $(includedir)/dev/serial
+include_dev_serial_HEADERS =
+include_dev_serial_HEADERS += ../../bsps/include/dev/serial/arm-pl011-regs.h
+include_dev_serial_HEADERS += ../../bsps/include/dev/serial/arm-pl011.h
+
 include_grlibdir = $(includedir)/grlib
 include_grlib_HEADERS =
 include_grlib_HEADERS += ../../bsps/include/grlib/ahbstat.h
diff --git a/bsps/arm/include/bsp/arm-pl011-regs.h b/bsps/include/dev/serial/arm-pl011-regs.h
similarity index 100%
rename from bsps/arm/include/bsp/arm-pl011-regs.h
rename to bsps/include/dev/serial/arm-pl011-regs.h
diff --git a/bsps/arm/include/bsp/arm-pl011.h b/bsps/include/dev/serial/arm-pl011.h
similarity index 96%
rename from bsps/arm/include/bsp/arm-pl011.h
rename to bsps/include/dev/serial/arm-pl011.h
index 49ff413581..c7e65656a3 100644
--- a/bsps/arm/include/bsp/arm-pl011.h
+++ b/bsps/include/dev/serial/arm-pl011.h
@@ -25,7 +25,7 @@
 
 #include <rtems/termiostypes.h>
 
-#include <bsp/arm-pl011-regs.h>
+#include <dev/serial/arm-pl011-regs.h>
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/bsps/arm/shared/serial/arm-pl011.c b/bsps/shared/dev/serial/arm-pl011.c
similarity index 98%
rename from bsps/arm/shared/serial/arm-pl011.c
rename to bsps/shared/dev/serial/arm-pl011.c
index 44a409e551..c3cbab6f3e 100644
--- a/bsps/arm/shared/serial/arm-pl011.c
+++ b/bsps/shared/dev/serial/arm-pl011.c
@@ -12,7 +12,7 @@
  * http://www.rtems.org/license/LICENSE.
  */
 
-#include <bsp/arm-pl011.h>
+#include <dev/serial/arm-pl011.h>
 
 static volatile pl011 *pl011_get_regs(rtems_termios_device_context *base)
 {
diff --git a/c/src/lib/libbsp/arm/raspberrypi/Makefile.am b/c/src/lib/libbsp/arm/raspberrypi/Makefile.am
index 48c346d3a3..01f44a7636 100644
--- a/c/src/lib/libbsp/arm/raspberrypi/Makefile.am
+++ b/c/src/lib/libbsp/arm/raspberrypi/Makefile.am
@@ -64,7 +64,7 @@ librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/raspberrypi/irq/irq.c
 
 # Console
 librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/serial/console-termios.c
-librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/shared/serial/arm-pl011.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/serial/arm-pl011.c
 librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/raspberrypi/console/console-config.c
 librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/raspberrypi/console/fb.c
 librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/raspberrypi/console/fbcons.c
diff --git a/c/src/lib/libbsp/arm/realview-pbx-a9/Makefile.am b/c/src/lib/libbsp/arm/realview-pbx-a9/Makefile.am
index d5549275be..77b7db4cca 100644
--- a/c/src/lib/libbsp/arm/realview-pbx-a9/Makefile.am
+++ b/c/src/lib/libbsp/arm/realview-pbx-a9/Makefile.am
@@ -62,7 +62,7 @@ librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/shared/irq/irq-gic.c
 librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/serial/console-termios-init.c
 librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/serial/console-termios.c
 librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/serial/getserialmouseps2.c
-librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/shared/serial/arm-pl011.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/serial/arm-pl011.c
 librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/shared/serial/arm-pl050.c
 librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/realview-pbx-a9/console/console-config.c
 librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/realview-pbx-a9/console/console-polled.c
diff --git a/c/src/lib/libbsp/arm/xen/Makefile.am b/c/src/lib/libbsp/arm/xen/Makefile.am
index fecb665af4..18cce5ec29 100644
--- a/c/src/lib/libbsp/arm/xen/Makefile.am
+++ b/c/src/lib/libbsp/arm/xen/Makefile.am
@@ -39,7 +39,7 @@ librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/shared/irq/irq-gic.c
 librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/xen/console/console.c
 librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/serial/console-termios.c
 librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/serial/console-termios-init.c
-librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/shared/serial/arm-pl011.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/serial/arm-pl011.c
 # timer
 librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/btimer/btimer-stub.c
 
diff --git a/spec/build/bsps/arm/grp.yml b/spec/build/bsps/arm/grp.yml
index 2bf0b82423..b6fcb56a25 100644
--- a/spec/build/bsps/arm/grp.yml
+++ b/spec/build/bsps/arm/grp.yml
@@ -26,8 +26,6 @@ install:
   - bsps/arm/include/bsp/arm-gic-regs.h
   - bsps/arm/include/bsp/arm-gic-tm27.h
   - bsps/arm/include/bsp/arm-gic.h
-  - bsps/arm/include/bsp/arm-pl011-regs.h
-  - bsps/arm/include/bsp/arm-pl011.h
   - bsps/arm/include/bsp/arm-pl050-regs.h
   - bsps/arm/include/bsp/arm-pl050.h
   - bsps/arm/include/bsp/arm-pl111-fb.h
diff --git a/spec/build/bsps/arm/raspberrypi/obj.yml b/spec/build/bsps/arm/raspberrypi/obj.yml
index 45180cdd5f..a120d8007b 100644
--- a/spec/build/bsps/arm/raspberrypi/obj.yml
+++ b/spec/build/bsps/arm/raspberrypi/obj.yml
@@ -47,7 +47,6 @@ source:
 - bsps/arm/shared/cache/cache-v7ar-disable-data.S
 - bsps/arm/shared/cp15/arm-cp15-set-exception-handler.c
 - bsps/arm/shared/cp15/arm-cp15-set-ttb-entries.c
-- bsps/arm/shared/serial/arm-pl011.c
 - bsps/arm/shared/start/bsp-start-memcpy.S
 - bsps/shared/dev/cpucounter/cpucounterfrequency.c
 - bsps/shared/dev/cpucounter/cpucounterread.c
diff --git a/spec/build/bsps/arm/realview-pbx-a9/bsprealviewpbxa9.yml b/spec/build/bsps/arm/realview-pbx-a9/bsprealviewpbxa9.yml
index 2721152b93..9b24f8eae2 100644
--- a/spec/build/bsps/arm/realview-pbx-a9/bsprealviewpbxa9.yml
+++ b/spec/build/bsps/arm/realview-pbx-a9/bsprealviewpbxa9.yml
@@ -68,7 +68,6 @@ source:
 - bsps/arm/shared/cp15/arm-cp15-set-ttb-entries.c
 - bsps/arm/shared/fb/arm-pl111.c
 - bsps/arm/shared/irq/irq-gic.c
-- bsps/arm/shared/serial/arm-pl011.c
 - bsps/arm/shared/serial/arm-pl050.c
 - bsps/arm/shared/start/bsp-start-memcpy.S
 - bsps/shared/dev/btimer/btimer-stub.c
diff --git a/spec/build/bsps/arm/xen/bspxen.yml b/spec/build/bsps/arm/xen/bspxen.yml
index e469170e34..df14fcce66 100644
--- a/spec/build/bsps/arm/xen/bspxen.yml
+++ b/spec/build/bsps/arm/xen/bspxen.yml
@@ -60,7 +60,6 @@ source:
 - bsps/arm/shared/cp15/arm-cp15-set-exception-handler.c
 - bsps/arm/shared/cp15/arm-cp15-set-ttb-entries.c
 - bsps/arm/shared/irq/irq-gic.c
-- bsps/arm/shared/serial/arm-pl011.c
 - bsps/arm/shared/start/bsp-start-memcpy.S
 - bsps/arm/xen/console/console.c
 - bsps/arm/xen/start/bspstart.c
diff --git a/spec/build/bsps/obj.yml b/spec/build/bsps/obj.yml
index 8809238057..29084a70b8 100644
--- a/spec/build/bsps/obj.yml
+++ b/spec/build/bsps/obj.yml
@@ -52,6 +52,10 @@ install:
   - bsps/include/libchip/spi-sd-card.h
   - bsps/include/libchip/wd80x3.h
   - bsps/include/libchip/z85c30.h
+- destination: ${BSP_INCLUDEDIR}/dev/serial
+  source:
+  - bsps/include/dev/serial/arm-pl011-regs.h
+  - bsps/include/dev/serial/arm-pl011.h
 - destination: ${BSP_INCLUDEDIR}/rtems/zilog
   source:
   - bsps/include/rtems/zilog/z8036.h
@@ -91,6 +95,7 @@ source:
 - bsps/shared/dev/rtc/mc146818a.c
 - bsps/shared/dev/rtc/mc146818a_ioreg.c
 - bsps/shared/dev/rtc/rtcprobe.c
+- bsps/shared/dev/serial/arm-pl011.c
 - bsps/shared/dev/serial/mc68681_baud.c
 - bsps/shared/dev/serial/mc68681.c
 - bsps/shared/dev/serial/mc68681_reg2.c
-- 
2.20.1



More information about the devel mailing list