You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2026/10/15 11:41:59 UTC
(nuttx) branch master updated (bc862acb935 -> 3ffd832cf23)
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang781216 pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
from bc862acb935 net/tcp: fix use-after-free race and nullptr dereference in tcp_timer
new a02257f67b7 arch/arm/rm57: Add TI Hercules RM57L843 and LAUNCHXL2-RM57L support
new 3ffd832cf23 Documentation/rm57: Update the RM57 and LAUNCHXL2-RM57L pages
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../arm/rm57/boards/rm57l843-launchxl2/index.rst | 533 +++
Documentation/platforms/arm/rm57/index.rst | 516 +++
arch/arm/Kconfig | 13 +
arch/arm/include/rm57/chip.h | 65 +
arch/arm/include/rm57/irq.h | 91 +
arch/arm/include/rm57/rm57_adc_ioctl.h | 281 ++
arch/arm/include/rm57/rm57l843_irq.h | 199 +
arch/arm/src/rm57/CMakeLists.txt | 88 +
arch/arm/src/rm57/Kconfig | 1873 ++++++++++
arch/arm/src/rm57/Make.defs | 92 +
arch/arm/src/rm57/chip.h | 44 +
arch/arm/src/rm57/hardware/rm57_adc.h | 598 +++
arch/arm/src/rm57/hardware/rm57_ccm.h | 121 +
arch/arm/src/rm57/hardware/rm57_dcan.h | 350 ++
arch/arm/src/rm57/hardware/rm57_dma.h | 475 +++
arch/arm/src/rm57/hardware/rm57_efc.h | 134 +
arch/arm/src/rm57/hardware/rm57_esm.h | 211 ++
arch/arm/src/rm57/hardware/rm57_ethernet.h | 600 +++
arch/arm/src/rm57/hardware/rm57_flash.h | 80 +
arch/arm/src/rm57/hardware/rm57_gio.h | 137 +
arch/arm/src/rm57/hardware/rm57_i2c.h | 169 +
arch/arm/src/rm57/hardware/rm57_iomm.h | 139 +
arch/arm/src/rm57/hardware/rm57_l2ramw.h | 180 +
arch/arm/src/rm57/hardware/rm57_mibspi.h | 484 +++
arch/arm/src/rm57/hardware/rm57_pbist.h | 194 +
arch/arm/src/rm57/hardware/rm57_pcr.h | 168 +
arch/arm/src/rm57/hardware/rm57_pinmux.h | 57 +
arch/arm/src/rm57/hardware/rm57_rti.h | 153 +
arch/arm/src/rm57/hardware/rm57_sci.h | 370 ++
arch/arm/src/rm57/hardware/rm57_stc.h | 197 +
arch/arm/src/rm57/hardware/rm57_sys.h | 494 +++
arch/arm/src/rm57/hardware/rm57_vim.h | 213 ++
arch/arm/src/rm57/hardware/rm57l843_memorymap.h | 151 +
arch/arm/src/rm57/hardware/rm57l843_pinmux.h | 3881 ++++++++++++++++++++
arch/arm/src/rm57/rm57_adc.c | 3391 +++++++++++++++++
arch/arm/src/rm57/rm57_adc.h | 207 ++
arch/arm/src/rm57/rm57_adc_temp.c | 504 +++
arch/arm/src/rm57/rm57_boot.c | 267 ++
arch/arm/src/rm57/rm57_boot.h | 60 +
arch/arm/src/rm57/rm57_clockconfig.c | 296 ++
arch/arm/src/rm57/rm57_clockconfig.h | 49 +
arch/arm/src/rm57/rm57_coreinit.S | 165 +
arch/arm/src/rm57/rm57_dcan.c | 1870 ++++++++++
arch/arm/src/rm57/rm57_dcan.h | 265 ++
arch/arm/src/rm57/rm57_dcan_chardev.c | 667 ++++
arch/arm/src/rm57/rm57_dcan_sock.c | 615 ++++
arch/arm/src/rm57/rm57_dma.c | 534 +++
arch/arm/src/rm57/rm57_dma.h | 214 ++
arch/arm/src/rm57/rm57_errata.c | 297 ++
arch/arm/src/rm57/rm57_esm.c | 219 ++
arch/arm/src/rm57/rm57_esm.h | 64 +
arch/arm/src/rm57/rm57_ethernet.c | 2197 +++++++++++
arch/arm/src/rm57/rm57_ethernet.h | 78 +
arch/arm/src/rm57/rm57_gio.c | 243 ++
arch/arm/src/rm57/rm57_gio.h | 256 ++
arch/arm/src/rm57/rm57_gioirq.c | 297 ++
arch/arm/src/rm57/rm57_i2c.c | 1119 ++++++
arch/arm/src/rm57/rm57_i2c.h | 157 +
arch/arm/src/rm57/rm57_iomm.c | 198 +
arch/arm/src/rm57/rm57_iomm.h | 90 +
arch/arm/src/rm57/rm57_irq.c | 321 ++
arch/arm/src/rm57/rm57_irq.h | 65 +
arch/arm/src/rm57/rm57_lin.c | 389 ++
arch/arm/src/rm57/rm57_lin.h | 179 +
arch/arm/src/rm57/rm57_lowputc.c | 350 ++
arch/arm/src/rm57/rm57_lowputc.h | 113 +
arch/arm/src/rm57/rm57_mdio.c | 235 ++
arch/arm/src/rm57/rm57_mdio.h | 166 +
arch/arm/src/rm57/rm57_mibspi.c | 1719 +++++++++
arch/arm/src/rm57/rm57_mibspi.h | 181 +
arch/arm/src/rm57/rm57_mpuinit.c | 103 +
arch/arm/src/rm57/rm57_mpuinit.h | 117 +
arch/arm/src/rm57/rm57_netinitialize.c | 85 +
arch/arm/src/rm57/rm57_selftest.c | 1273 +++++++
arch/arm/src/rm57/rm57_selftest.h | 161 +
arch/arm/src/rm57/rm57_serial.c | 1809 +++++++++
arch/arm/src/rm57/rm57_timerisr.c | 233 ++
boards/Kconfig | 14 +
boards/arm/rm57/rm57l843-launchxl2/CMakeLists.txt | 25 +
boards/arm/rm57/rm57l843-launchxl2/Kconfig | 8 +
.../rm57/rm57l843-launchxl2/configs/adc/defconfig | 47 +
.../rm57l843-launchxl2/configs/buttons/defconfig | 38 +
.../rm57/rm57l843-launchxl2/configs/can/defconfig | 38 +
.../rm57l843-launchxl2/configs/candma/defconfig | 41 +
.../rm57l843-launchxl2/configs/cansock/defconfig | 47 +
.../rm57/rm57l843-launchxl2/configs/eth/defconfig | 59 +
.../rm57l843-launchxl2/configs/ethnsh/defconfig | 64 +
.../rm57/rm57l843-launchxl2/configs/i2c/defconfig | 45 +
.../rm57/rm57l843-launchxl2/configs/nsh/defconfig | 34 +
.../rm57l843-launchxl2/configs/scidma/defconfig | 58 +
.../rm57l843-launchxl2/configs/scitest/defconfig | 42 +
.../rm57l843-launchxl2/configs/selftest/defconfig | 39 +
.../rm57/rm57l843-launchxl2/configs/spi/defconfig | 45 +
.../rm57l843-launchxl2/configs/spitest/defconfig | 46 +
.../rm57/rm57l843-launchxl2/configs/temp/defconfig | 58 +
boards/arm/rm57/rm57l843-launchxl2/include/board.h | 388 ++
.../arm/rm57/rm57l843-launchxl2/scripts/Make.defs | 43 +
.../rm57/rm57l843-launchxl2/scripts/flash-sram.ld | 149 +
.../arm/rm57/rm57l843-launchxl2/src/CMakeLists.txt | 55 +
boards/arm/rm57/rm57l843-launchxl2/src/Makefile | 59 +
boards/arm/rm57/rm57l843-launchxl2/src/rm57_adc.c | 216 ++
.../rm57/rm57l843-launchxl2/src/rm57_autoleds.c | 89 +
.../arm/rm57/rm57l843-launchxl2/src/rm57_bringup.c | 192 +
.../arm/rm57/rm57l843-launchxl2/src/rm57_buttons.c | 187 +
boards/arm/rm57/rm57l843-launchxl2/src/rm57_can.c | 157 +
.../rm57/rm57l843-launchxl2/src/rm57_ethernet.c | 148 +
boards/arm/rm57/rm57l843-launchxl2/src/rm57_i2c.c | 329 ++
.../rm57/rm57l843-launchxl2/src/rm57_initialize.c | 95 +
boards/arm/rm57/rm57l843-launchxl2/src/rm57_spi.c | 456 +++
.../rm57/rm57l843-launchxl2/src/rm57_userleds.c | 81 +
.../rm57l843-launchxl2/src/rm57l843-launchxl2.h | 173 +
drivers/net/Kconfig | 3 +
include/nuttx/analog/ioctl.h | 5 +
include/nuttx/net/mii.h | 8 +
114 files changed, 38750 insertions(+)
create mode 100644 Documentation/platforms/arm/rm57/boards/rm57l843-launchxl2/index.rst
create mode 100644 Documentation/platforms/arm/rm57/index.rst
create mode 100644 arch/arm/include/rm57/chip.h
create mode 100644 arch/arm/include/rm57/irq.h
create mode 100644 arch/arm/include/rm57/rm57_adc_ioctl.h
create mode 100644 arch/arm/include/rm57/rm57l843_irq.h
create mode 100644 arch/arm/src/rm57/CMakeLists.txt
create mode 100644 arch/arm/src/rm57/Kconfig
create mode 100644 arch/arm/src/rm57/Make.defs
create mode 100644 arch/arm/src/rm57/chip.h
create mode 100644 arch/arm/src/rm57/hardware/rm57_adc.h
create mode 100644 arch/arm/src/rm57/hardware/rm57_ccm.h
create mode 100644 arch/arm/src/rm57/hardware/rm57_dcan.h
create mode 100644 arch/arm/src/rm57/hardware/rm57_dma.h
create mode 100644 arch/arm/src/rm57/hardware/rm57_efc.h
create mode 100644 arch/arm/src/rm57/hardware/rm57_esm.h
create mode 100644 arch/arm/src/rm57/hardware/rm57_ethernet.h
create mode 100644 arch/arm/src/rm57/hardware/rm57_flash.h
create mode 100644 arch/arm/src/rm57/hardware/rm57_gio.h
create mode 100644 arch/arm/src/rm57/hardware/rm57_i2c.h
create mode 100644 arch/arm/src/rm57/hardware/rm57_iomm.h
create mode 100644 arch/arm/src/rm57/hardware/rm57_l2ramw.h
create mode 100644 arch/arm/src/rm57/hardware/rm57_mibspi.h
create mode 100644 arch/arm/src/rm57/hardware/rm57_pbist.h
create mode 100644 arch/arm/src/rm57/hardware/rm57_pcr.h
create mode 100644 arch/arm/src/rm57/hardware/rm57_pinmux.h
create mode 100644 arch/arm/src/rm57/hardware/rm57_rti.h
create mode 100644 arch/arm/src/rm57/hardware/rm57_sci.h
create mode 100644 arch/arm/src/rm57/hardware/rm57_stc.h
create mode 100644 arch/arm/src/rm57/hardware/rm57_sys.h
create mode 100644 arch/arm/src/rm57/hardware/rm57_vim.h
create mode 100644 arch/arm/src/rm57/hardware/rm57l843_memorymap.h
create mode 100644 arch/arm/src/rm57/hardware/rm57l843_pinmux.h
create mode 100644 arch/arm/src/rm57/rm57_adc.c
create mode 100644 arch/arm/src/rm57/rm57_adc.h
create mode 100644 arch/arm/src/rm57/rm57_adc_temp.c
create mode 100644 arch/arm/src/rm57/rm57_boot.c
create mode 100644 arch/arm/src/rm57/rm57_boot.h
create mode 100644 arch/arm/src/rm57/rm57_clockconfig.c
create mode 100644 arch/arm/src/rm57/rm57_clockconfig.h
create mode 100644 arch/arm/src/rm57/rm57_coreinit.S
create mode 100644 arch/arm/src/rm57/rm57_dcan.c
create mode 100644 arch/arm/src/rm57/rm57_dcan.h
create mode 100644 arch/arm/src/rm57/rm57_dcan_chardev.c
create mode 100644 arch/arm/src/rm57/rm57_dcan_sock.c
create mode 100644 arch/arm/src/rm57/rm57_dma.c
create mode 100644 arch/arm/src/rm57/rm57_dma.h
create mode 100644 arch/arm/src/rm57/rm57_errata.c
create mode 100644 arch/arm/src/rm57/rm57_esm.c
create mode 100644 arch/arm/src/rm57/rm57_esm.h
create mode 100644 arch/arm/src/rm57/rm57_ethernet.c
create mode 100644 arch/arm/src/rm57/rm57_ethernet.h
create mode 100644 arch/arm/src/rm57/rm57_gio.c
create mode 100644 arch/arm/src/rm57/rm57_gio.h
create mode 100644 arch/arm/src/rm57/rm57_gioirq.c
create mode 100644 arch/arm/src/rm57/rm57_i2c.c
create mode 100644 arch/arm/src/rm57/rm57_i2c.h
create mode 100644 arch/arm/src/rm57/rm57_iomm.c
create mode 100644 arch/arm/src/rm57/rm57_iomm.h
create mode 100644 arch/arm/src/rm57/rm57_irq.c
create mode 100644 arch/arm/src/rm57/rm57_irq.h
create mode 100644 arch/arm/src/rm57/rm57_lin.c
create mode 100644 arch/arm/src/rm57/rm57_lin.h
create mode 100644 arch/arm/src/rm57/rm57_lowputc.c
create mode 100644 arch/arm/src/rm57/rm57_lowputc.h
create mode 100644 arch/arm/src/rm57/rm57_mdio.c
create mode 100644 arch/arm/src/rm57/rm57_mdio.h
create mode 100644 arch/arm/src/rm57/rm57_mibspi.c
create mode 100644 arch/arm/src/rm57/rm57_mibspi.h
create mode 100644 arch/arm/src/rm57/rm57_mpuinit.c
create mode 100644 arch/arm/src/rm57/rm57_mpuinit.h
create mode 100644 arch/arm/src/rm57/rm57_netinitialize.c
create mode 100644 arch/arm/src/rm57/rm57_selftest.c
create mode 100644 arch/arm/src/rm57/rm57_selftest.h
create mode 100644 arch/arm/src/rm57/rm57_serial.c
create mode 100644 arch/arm/src/rm57/rm57_timerisr.c
create mode 100644 boards/arm/rm57/rm57l843-launchxl2/CMakeLists.txt
create mode 100644 boards/arm/rm57/rm57l843-launchxl2/Kconfig
create mode 100644 boards/arm/rm57/rm57l843-launchxl2/configs/adc/defconfig
create mode 100644 boards/arm/rm57/rm57l843-launchxl2/configs/buttons/defconfig
create mode 100644 boards/arm/rm57/rm57l843-launchxl2/configs/can/defconfig
create mode 100644 boards/arm/rm57/rm57l843-launchxl2/configs/candma/defconfig
create mode 100644 boards/arm/rm57/rm57l843-launchxl2/configs/cansock/defconfig
create mode 100644 boards/arm/rm57/rm57l843-launchxl2/configs/eth/defconfig
create mode 100644 boards/arm/rm57/rm57l843-launchxl2/configs/ethnsh/defconfig
create mode 100644 boards/arm/rm57/rm57l843-launchxl2/configs/i2c/defconfig
create mode 100644 boards/arm/rm57/rm57l843-launchxl2/configs/nsh/defconfig
create mode 100644 boards/arm/rm57/rm57l843-launchxl2/configs/scidma/defconfig
create mode 100644 boards/arm/rm57/rm57l843-launchxl2/configs/scitest/defconfig
create mode 100644 boards/arm/rm57/rm57l843-launchxl2/configs/selftest/defconfig
create mode 100644 boards/arm/rm57/rm57l843-launchxl2/configs/spi/defconfig
create mode 100644 boards/arm/rm57/rm57l843-launchxl2/configs/spitest/defconfig
create mode 100644 boards/arm/rm57/rm57l843-launchxl2/configs/temp/defconfig
create mode 100644 boards/arm/rm57/rm57l843-launchxl2/include/board.h
create mode 100644 boards/arm/rm57/rm57l843-launchxl2/scripts/Make.defs
create mode 100644 boards/arm/rm57/rm57l843-launchxl2/scripts/flash-sram.ld
create mode 100644 boards/arm/rm57/rm57l843-launchxl2/src/CMakeLists.txt
create mode 100644 boards/arm/rm57/rm57l843-launchxl2/src/Makefile
create mode 100644 boards/arm/rm57/rm57l843-launchxl2/src/rm57_adc.c
create mode 100644 boards/arm/rm57/rm57l843-launchxl2/src/rm57_autoleds.c
create mode 100644 boards/arm/rm57/rm57l843-launchxl2/src/rm57_bringup.c
create mode 100644 boards/arm/rm57/rm57l843-launchxl2/src/rm57_buttons.c
create mode 100644 boards/arm/rm57/rm57l843-launchxl2/src/rm57_can.c
create mode 100644 boards/arm/rm57/rm57l843-launchxl2/src/rm57_ethernet.c
create mode 100644 boards/arm/rm57/rm57l843-launchxl2/src/rm57_i2c.c
create mode 100644 boards/arm/rm57/rm57l843-launchxl2/src/rm57_initialize.c
create mode 100644 boards/arm/rm57/rm57l843-launchxl2/src/rm57_spi.c
create mode 100644 boards/arm/rm57/rm57l843-launchxl2/src/rm57_userleds.c
create mode 100644 boards/arm/rm57/rm57l843-launchxl2/src/rm57l843-launchxl2.h
(nuttx) 02/02: Documentation/rm57: Update the RM57 and LAUNCHXL2-RM57L pages
Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 3ffd832cf23b8679b979fb2f620e60d3cfd0766c
Author: Mahmut Sami ÖZMEN <ma...@gmail.com>
AuthorDate: Thu Oct 15 01:01:19 2026 +0300
Documentation/rm57: Update the RM57 and LAUNCHXL2-RM57L pages
The RM57 pages were written during the first bring-up and no longer
matched the code. They listed MibSPI, I2C, ESM and PBIST/STC as missing,
said buttons were not supported, gave the alternate MII balls instead of
the ones the board uses, and did not mention half of the board
configurations.
Chip page:
- Add Core, ESM, self test, GIO interrupts, MibSPI and I2C to the
peripheral table, and say for each row how it was tested (on
hardware, loopback only, or build only).
- Leave only peripherals that are really not implemented in the todo.
- Add short Safety diagnostics, MibSPI and I2C sections.
- EMAC: the board is MII only; add the measured iperf throughput
(19.4Mbit/s TX, 9.2Mbit/s RX) and the DHCP retry note.
- Fix the AD1EVT note: the board takes MII_RX_ER from U5, not N19.
Board page:
- Document the buttons and the LED polarity.
- Pin table: use the dedicated MII balls from the schematic, and add the
PHY clock and control lines, MibSPI1/3 and I2C1/2.
- Add the buttons, can, candma, cansock, ethnsh, spi, spitest and i2c
configurations, plus the SCI3 loopback in scidma.
- Explain the 38400 baud console in ethnsh, and add the errata GCM#60
debugger hint.
Checked with docutils: no errors apart from the Sphinx-only directives.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Mahmut Sami ÖZMEN <ma...@gmail.com>
---
.../arm/rm57/boards/rm57l843-launchxl2/index.rst | 190 +++++++++++++++++----
Documentation/platforms/arm/rm57/index.rst | 142 ++++++++++++---
2 files changed, 270 insertions(+), 62 deletions(-)
diff --git a/Documentation/platforms/arm/rm57/boards/rm57l843-launchxl2/index.rst b/Documentation/platforms/arm/rm57/boards/rm57l843-launchxl2/index.rst
index 9e41b929867..61d907c2ef4 100644
--- a/Documentation/platforms/arm/rm57/boards/rm57l843-launchxl2/index.rst
+++ b/Documentation/platforms/arm/rm57/boards/rm57l843-launchxl2/index.rst
@@ -12,16 +12,14 @@ than any particular application.
.. warning::
- This board port is new and experimental. The serial console (SCI1),
- the two user LEDs, the DMA controller, DCAN, and EMAC/MDIO (Ethernet)
- are currently supported; button support and most other on-chip
- peripherals are not yet implemented. Some of the values documented
- below (PLL/clock configuration, LED polarity, JTAG IDCODE, and for
- Ethernet the exact PHY ball assignments and RMII clock source) were
- taken from TI's HALCoGen-generated reference project or from the
- RM57L843 datasheet rather than confirmed against this specific
- board's schematic — see the comments in
- ``boards/arm/rm57/rm57l843-launchxl2/include/board.h`` for details.
+ This board port is new. The console, LEDs, buttons, serial DMA,
+ Ethernet, ADC, temperature sensors and start-up diagnostics are tested
+ on this board. DCAN, MibSPI and I2C are only tested in their internal
+ loopback modes, because the LaunchPad has no CAN transceiver and no
+ SPI or I2C device. Pin assignments were checked against the board
+ schematic (SPRR397). The PLL values come from TI's HALCoGen project,
+ and the CAN bit timing and the I2C transfer times measured on the
+ board confirm them.
Features
========
@@ -31,7 +29,10 @@ Features
PLL/GCLK) in the current clock configuration
* 4 MB of on-chip program flash, 512 KB of on-chip SRAM
* Onboard XDS110 debug probe (JTAG)
-* 2 user LEDs
+* 2 user LEDs and 2 user buttons
+* 10/100 Ethernet (DP83630 PHY, MII)
+* MibSPI1 and MibSPI3 on the BoosterPack headers; I2C1 and I2C2 on the
+ BoosterPack and proto headers (no pull-up resistors on the board)
* SCI1 wired up as the serial console; SCI2-SCI4 are supported by the
driver but not enabled by this board's default configuration (and
SCI2-SCI4 pin-mux is not programmed by this board port - see the
@@ -46,10 +47,9 @@ Features
.. note::
- Peripherals that are part of the RM57L843 chip itself (N2HET, MibSPI,
- I2C, the ESM diagnostic module, PBIST/STC self-test, etc.) but are
- not yet wired up by this board port are tracked on the
- :doc:`RM57 chip documentation page </platforms/arm/rm57/index>`.
+ The :doc:`RM57 chip documentation page </platforms/arm/rm57/index>`
+ lists the chip peripherals that are not implemented yet (N2HET, ePWM,
+ eCAP, eQEP and others).
Buttons and LEDs
================
@@ -58,12 +58,19 @@ LEDs
----
The LAUNCHXL2-RM57L has two user LEDs, labeled **B6** and **B7** on the
-board silkscreen, driven by GIOB[6] and GIOB[7] respectively.
+board silkscreen, driven by GIOB[6] and GIOB[7] respectively. They are
+active high. With ``CONFIG_ARCH_LEDS`` NuttX uses them to show the OS
+state; otherwise they are available through ``CONFIG_USERLED``.
Buttons
-------
-Button support is not yet implemented by this board port.
+The two user buttons, **B4** and **B5**, are on GIOB[4] and GIOB[5]. They
+are active low and use the internal pull-up. They are supported through
+``board_buttons()``, and with ``CONFIG_ARCH_IRQBUTTONS`` and
+``CONFIG_RM57_GIO_IRQ`` through ``board_button_irq()`` with an interrupt
+on both edges. The ``buttons`` configuration has a small demo: holding
+B4 lights LED B6, and holding B5 lights LED B7.
Pin Mapping
===========
@@ -95,18 +102,42 @@ Only the pins used by the currently supported peripherals are listed.
* - F1
- GIOB[7]
- User LED B7
- * - V5 / G3
- - MDIO_CLK / MDIO_D
- - MDIO bus shared by the EMAC's PHY (DP83630, address 1)
- * - D19 / E18 / R2 / J19 / J18
- - MII_TX_CLK / MII_TXD[3:0]
- - EMAC transmit, MII mode
- * - H19 / F3 / B4
- - MII_TXEN / MII_COL / MII_CRS
- - EMAC transmit control, MII mode
- * - K19 / H18 / G19 / A14 / P1 / B11 / N19
- - MII_RXCLK / MII_RXD[3:0] / MII_RX_DV / MII_RX_ER
- - EMAC receive, MII mode
+ * - (n/a)
+ - GIOB[4] / GIOB[5]
+ - User buttons B4 / B5, active low
+ * - T9 / F4
+ - MDCLK / MDIO
+ - MDIO bus to the DP83630 PHY (address 1)
+ * - U7 / U8 / R1 / T2 / G4 / E4
+ - MII_TX_CLK / MII_TXD[0:3] / MII_TXEN
+ - EMAC transmit
+ * - T4 / U4 / T3 / U3 / V3 / U6 / U5
+ - MII_RXCLK / MII_RXD[0:3] / MII_RX_DV / MII_RX_ER
+ - EMAC receive
+ * - W4 / V4
+ - MII_COL / MII_CRS
+ - EMAC collision and carrier sense
+ * - A12
+ - ECLK1
+ - 25MHz reference clock for the PHY (the PHY has no crystal)
+ * - E1 / A6
+ - GIOA[3] / GIOA[4]
+ - PHY power-down and reset, driven at bring-up
+ * - J5.7 / J6.6 / J6.7
+ - MIBSPI1CLK / SIMO / SOMI
+ - MibSPI1, BoosterPack site 2. Chip selects nCS[0:2] on J6.3, J6.8,
+ J6.9
+ * - J1.7 / J2.6 / J2.7
+ - MIBSPI3CLK / SIMO / SOMI
+ - MibSPI3, BoosterPack site 1. Chip selects nCS[0:3] on J5.5, J2.3,
+ J2.8, J2.9 (nCS[2:3] only when I2C1 is disabled)
+ * - B2 / C3
+ - I2C1 SDA / SCL
+ - J2.8 / J2.9, taken from MibSPI3 nCS[2:3] when ``CONFIG_RM57_I2C1``
+ is enabled
+ * - G17 / G16
+ - I2C2 SDA / SCL
+ - Proto header J10.9 / J10.8
* - T19
- AD1IN[6]
- On-board 1k trim potentiometer U10 (wiper, with 4700pF to GND);
@@ -126,12 +157,11 @@ Only the pins used by the currently supported peripherals are listed.
.. note::
- The EMAC/MDIO ball assignments above are this port's default choice
- among two alternate-ball options the RM57L843 offers for nearly every
- MII signal (see the ``BOARD_PINMUX_EMAC`` comment in ``board.h``) and
- are **not** independently confirmed against the LAUNCHXL2-RM57L
- schematic. RMII mode uses a smaller subset of these balls (see
- ``board.h``) plus K19 as the RMII 50MHz reference clock input.
+ Most MII signals can also be routed to an alternate ball. This board
+ connects the PHY to the dedicated balls listed above, which are the
+ reset defaults; the alternates go to the BoosterPack headers (see
+ the ``BOARD_PINMUX_EMAC`` comment in ``board.h``). The PHY is strapped
+ for MII, so RMII cannot be used on this board.
.. note::
@@ -150,6 +180,11 @@ SCI1 is used as the serial console. The default configuration is:
* 9600 baud, 8 data bits, no parity, 2 stop bits
+The console goes over the XDS110's USB serial port. ``ethnsh`` uses
+38400 baud, because a slow console makes network warnings costly. Rates
+above 38400 are not recommended: the baud divider has no fractional
+part, so 115200 is off by 1.7%.
+
The baud rate and stop bits are configurable via ``CONFIG_SCI1_BAUD`` and
``CONFIG_SCI1_2STOP``.
@@ -180,13 +215,30 @@ usable here). OpenOCD can be used with a Cortex-R5 (``cortex_r4`` driver)
target configuration that routes through the ICEpick-C, followed by GDB
to load and debug the image.
+On Rev B silicon, errata GCM#60 (SPNZ233B) can leave VCLK at the wrong
+rate after an external reset, and the debugger causes one each time it
+connects. If something works after a power cycle but not under the
+debugger (Ethernet is the most likely), suspect this first.
+
Configurations
==============
nsh
---
-Basic NuttShell configuration (console enabled on SCI1, at 9600 baud).
+Basic NuttShell configuration (console enabled on SCI1, at 9600 baud),
+with ``ostest``::
+
+ nsh> ostest
+
+buttons
+-------
+
+``nsh`` with ``CONFIG_ARCH_BUTTONS``, ``CONFIG_ARCH_IRQBUTTONS`` and
+``CONFIG_RM57_GIO_IRQ``, and with ``CONFIG_ARCH_LEDS`` disabled so that
+the board code controls the LEDs. While B4 is held, LED B6 is lit, and while B5 is
+held, LED B7 is lit. The LEDs are switched from the GIO interrupt
+handler, so this checks the whole GIO interrupt path.
scitest
-------
@@ -226,6 +278,30 @@ console input from stalling behind that threshold, RTI compare 1 calls
console and the test ports therefore behave the same as in ``scitest``,
only with the transfers themselves done by DMA.
+SCI3 is also put in internal loopback (``CONFIG_RM57_SCI3_LOOPBACK``),
+so ``/dev/ttyS1`` receives what it sends without any wiring. This is how
+the DMA receive path was tested on the board.
+
+can, candma, cansock
+--------------------
+
+NuttShell with DCAN1 in loopback test mode (``CONFIG_RM57_DCAN_LOOPBACK``),
+so the controller receives its own frames while still driving the TX
+ball (A10) for a logic analyzer. No transceiver or bus is needed.
+
+* ``can``: character driver ``/dev/can0`` with the ``can`` example::
+
+ nsh> can -n 8
+
+* ``candma``: the same, with the IF3 DMA receive path
+ (``CONFIG_RM57_DCAN1_RX_IF3DMA``, experimental).
+* ``cansock``: SocketCAN interface ``can0`` with ``candump`` and
+ ``cansend``::
+
+ nsh> ifup can0
+ nsh> candump can0 &
+ nsh> cansend can0 123#DEADBEEF
+
eth
---
@@ -242,7 +318,22 @@ page), NSH's automatic network initialization
If the network doesn't come up automatically, check ``ifconfig eth0``
for the assigned address and bring the link up manually with
-``ifup eth0`` / ``ifdown eth0``.
+``ifup eth0`` / ``ifdown eth0``. Some routers ignore the first DHCP
+requests after the link comes up, so ``CONFIG_NETUTILS_DHCPC_RETRIES``
+is set to 10.
+
+ethnsh
+------
+
+``eth`` plus a telnet server for NSH, ``iperf`` and a small web server,
+with the console at 38400 baud. From a PC on the same network::
+
+ $ telnet <board-ip>
+ $ iperf -c <board-ip> # board receives: nsh> iperf -s
+ $ iperf -s # board transmits: nsh> iperf -c <pc-ip>
+
+The best results measured on the board are 19.4Mbit/s transmit and
+9.2Mbit/s receive.
adc
---
@@ -363,6 +454,31 @@ other direction.
``sensortest`` - it opens ``O_NONBLOCK`` - works. Use it, or open the node
non-blocking yourself.
+spi, spitest
+------------
+
+NuttShell with MibSPI1 (compatibility mode with DMA) and MibSPI3
+(multi-buffer mode), registered as ``/dev/spi1`` and ``/dev/spi3``, and
+the ``spi`` tool. ``spitest`` also enables ``CONFIG_RM57_MIBSPI_LOOPBACK``,
+which runs a loopback test on both buses at boot and prints one ``ok`` or
+error line per pattern. To try a real exchange, connect SIMO to SOMI
+(J6.6 to J6.7 for MibSPI1) and run::
+
+ nsh> spi exch -b 1 -x 4 deadbeef
+
+i2c
+---
+
+NuttShell with I2C1 and I2C2, registered as ``/dev/i2c1`` and
+``/dev/i2c2``, and the ``i2c`` tool. ``CONFIG_RM57_I2C_LOOPBACK`` runs the
+digital loopback test on both buses at 100kHz and 400kHz at boot. Each
+bus ends with ``I2Cn: loopback self-test passed (0 failed)``. Enabling
+I2C1 takes
+MibSPI3 nCS[2:3] away. Real devices need external pull-up resistors::
+
+ nsh> i2c bus
+ nsh> i2c dev -b 2 0x03 0x77
+
selftest
--------
diff --git a/Documentation/platforms/arm/rm57/index.rst b/Documentation/platforms/arm/rm57/index.rst
index 70c577aa236..c5e24a6a76f 100644
--- a/Documentation/platforms/arm/rm57/index.rst
+++ b/Documentation/platforms/arm/rm57/index.rst
@@ -11,14 +11,12 @@ NuttX currently supports the **RM57L843** part.
.. warning::
- Support for this chip family is new and experimental. Only the
- SCI/LIN (serial), DMA, GIO (LED), DCAN, and EMAC/MDIO (Ethernet)
- peripherals have been brought up so far; the PLL/clock configuration
- values, JTAG IDCODE, LED polarity, and (for Ethernet) the exact PHY
- pin assignments and RMII clock source have not all been independently
- confirmed against hardware/schematics. See the
- :doc:`board documentation <boards/rm57l843-launchxl2/index>` for
- details.
+ Support for this chip family is new and has been tested on a single
+ LAUNCHXL2-RM57L (RM57L843 Rev B). The table below says how far each
+ peripheral was tested. Where it says *loopback only*, the
+ peripheral's internal loopback mode was used: the driver logic is
+ tested, but nothing at the pins (signal timing, a real device, a real
+ bus) has been checked.
Peripheral Support
==================
@@ -28,11 +26,22 @@ The following list indicates RM57 peripherals currently supported in NuttX:
============== =====
Peripheral Notes
============== =====
+Core Lockstep-safe start-up, PLL (300MHz GCLK, 150MHz HCLK,
+ 75MHz VCLK), SRAM ECC, MPU, VIM interrupt controller and
+ RTI system tick. Tested on hardware with ``ostest``.
+ESM Error Signalling Module. With
+ ``CONFIG_ARMV7R_DECODEFIQ`` a FIQ handler reports and
+ clears group 1/2 errors (``CONFIG_RM57_ESM_PANIC`` panics
+ instead). Tested on hardware. See `Safety diagnostics`_.
+Self test Optional start-up diagnostics (``CONFIG_RM57_SELFTEST``):
+ PBIST, STC/LBIST, CCM-R5F, eFuse, L2RAMW. Tested on
+ hardware, including fault injection.
SCI SCI1-SCI4. SCI1/LIN1 and SCI2/LIN2 are dual-role SCI/LIN
modules; the serial driver always runs them in SCI
compatibility mode (GCR1 LIN_MODE=0). Interrupt-driven by
default; optional RX/TX DMA (see `Serial DMA`_ below).
- Used for the console.
+ Used for the console. Tested on hardware: console with and
+ without DMA, SCI3 in internal loopback with DMA.
LIN Configuration and polled-transfer scaffold only
(``CONFIG_RM57_LIN``, requires ``CONFIG_EXPERIMENTAL``) -
not a complete LIN protocol stack. See
@@ -45,8 +54,16 @@ DCAN All four DCAN (Bosch D_CAN, CAN 2.0A/B) controllers
(``CONFIG_RM57_DCANn``). Per instance either a character
device (``/dev/can<n>``) or a SocketCAN network interface
(``can<n>``); both frontends can coexist in one image on
- different instances. See `DCAN`_ below.
-GIO General purpose I/O, used for LEDs
+ different instances. See `DCAN`_ below. Loopback only (the
+ board has no CAN transceiver).
+GIO General purpose I/O with pin interrupts
+ (``CONFIG_RM57_GIO_IRQ``). Used for the LEDs and buttons.
+ Tested on hardware.
+MibSPI SPI master on all five MibSPI modules
+ (``CONFIG_RM57_MIBSPIn``). See `MibSPI`_ below. Loopback
+ only.
+I2C I2C1 and I2C2 master (``CONFIG_RM57_I2Cn``). See `I2C`_
+ below. Loopback only.
ADC Both MibADC modules (``CONFIG_RM57_ADC1`` /
``CONFIG_RM57_ADC2``), 10- or 12-bit. Each of a module's
three conversion groups is registered as its own
@@ -55,17 +72,81 @@ ADC Both MibADC modules (``CONFIG_RM57_ADC1`` /
enhanced channel selection mode are all supported, along with
the three on-die temperature sensors
(``CONFIG_RM57_ADC_TEMPSENSOR``). See `ADC (MibADC)`_ below.
+ Conversions and temperature sensors tested on hardware;
+ DMA, self test and magnitude compare are build-tested only.
EMAC 10/100 Ethernet MAC + EMAC Control module + MDIO
(``CONFIG_RM57_EMAC``). Single netdev interface (``eth0``),
MII or RMII (``RM57_EMAC_MII`` / ``RM57_EMAC_RMII``). See
- `EMAC/MDIO (Ethernet)`_ below.
+ `EMAC/MDIO (Ethernet)`_ below. MII tested on hardware.
============== =====
.. todo::
- Many peripherals available on the RM57L843 (N2HET, MibSPI, I2C,
- the ESM diagnostic module, PBIST/STC self-test, etc.) are not yet
- implemented. Contributions are welcome.
+ Not implemented yet: N2HET, ePWM, eCAP, eQEP, EMIF, the CRC module,
+ the RTI digital watchdog and flash programming. Contributions are
+ welcome.
+
+Safety diagnostics
+==================
+
+``CONFIG_RM57_SELFTEST`` runs the start-up diagnostics before the OS
+starts: an ESM group 3 check, the PBIST ROM tests (with the errata
+PBIST#4 workaround), the STC self-check and CPU logic BIST, the four
+CCM-R5F diagnostics in all three modes, the eFuse controller tests
+(power-on reset only), and the L2RAMW ECC and address decode tests. The
+result of each test is printed on the console. A failing test drives
+nERROR, and with ``CONFIG_RM57_SELFTEST_HALT_ON_FAIL`` stops the boot.
+
+The CCM-R5F is off while a debugger is attached, so the ROM tests, the
+STC and the CCM diagnostics report ``skipped`` in a debug session. The
+``CONFIG_RM57_SELFTEST_INJECT_*`` options inject one fault per build to
+check that the detection path works. All five injected faults were
+detected on the board. The ``selftest`` board configuration shows the
+console output.
+
+At run time, VIM channel 0 (the ESM high-level interrupt) is hard-wired
+to FIQ. With ``CONFIG_ARMV7R_DECODEFIQ`` the ESM handler decodes,
+reports and clears each pending channel. Without that option the FIQ
+vector does nothing, and a latched nonmaskable group 2 error is never
+acknowledged.
+
+MibSPI
+======
+
+All five MibSPI modules work as SPI masters through the standard
+``spi_dev_s`` interface. Each module can be set up in one of three ways:
+
+- compatibility mode with polled transfers (default);
+- compatibility mode with DMA (``CONFIG_RM57_MIBSPIn_DMA``);
+- multi-buffer mode using transfer group 0
+ (``CONFIG_RM57_MIBSPIn_MULTIBUF``).
+
+Chip selects are driven as GIO. On this board only MibSPI1 and MibSPI3
+are routed to headers, and they are registered as ``/dev/spi1`` and
+``/dev/spi3``.
+
+``CONFIG_RM57_MIBSPI_LOOPBACK`` adds a start-up test. It uses
+``SPIGCR1.LOOPBACK`` and sends patterns of 1 to 1000 words, 8 and 16 bits
+wide, at 1MHz and 37.5MHz, then reads them back. Every mode passes this
+test on both modules. Internal loopback cannot show the clock polarity
+and phase at the pins, so the CPOL/CPHA mapping and the real SPICLK rate
+are not measured yet.
+
+I2C
+===
+
+I2C1 and I2C2 work as interrupt-driven masters through ``i2c_master_s``
+(standard and fast mode, repeated START, ``I2C_M_NOSTART``,
+``CONFIG_I2C_RESET``). Slave mode and DMA are not supported. The
+LAUNCHXL2-RM57L has no I2C pull-up resistors, so a real bus needs
+external ones (2.2k to 4.7k).
+
+``CONFIG_RM57_I2C_LOOPBACK`` adds a start-up test that uses digital
+loopback (``MDR.DLB``) on each bus at 100kHz and 400kHz. On the board,
+all tests pass, and a timed 2048-byte write takes 101% of the nominal
+time. Digital loopback only works for master transmit, so master
+receive, real ACK/NACK handling and the SCL timing at the pin are not
+measured yet.
DCAN
====
@@ -109,7 +190,10 @@ at CMOS levels, so a real bus needs an external transceiver, while the
loopback test mode still drives the TX ball for logic-analyzer capture.
The board configurations ``can`` (character driver,
loopback self-test), ``cansock`` (SocketCAN with candump/cansend) and
-``candma`` (IF3 DMA receive path) are provided.
+``candma`` (IF3 DMA receive path) are provided. In loopback on the board,
+``can -n 8`` receives all 8 frames, and the bit timing the driver
+computes is the same as HALCoGen's. A real bus (ACK from another node,
+arbitration, bus-off recovery) has not been tested.
Serial DMA
==========
@@ -214,8 +298,9 @@ or two GIOB pins. The Event group has no such choice: it is always started
by its trigger source, so only the source and its edge are configurable.
When the ADxEVT pin is not used as a trigger it can serve as a general
-purpose I/O through the ``ANIOC_RM57_EVTPIN`` ioctl. Note that AD1EVT shares
-ball N19 with the Ethernet MII_RX_ER signal, so it is unavailable when
+purpose I/O through the ``ANIOC_RM57_EVTPIN`` ioctl. AD1EVT is on ball N19,
+which can also carry MII_RX_ER. The LAUNCHXL2-RM57L takes MII_RX_ER from its
+dedicated ball U5 instead, so AD1EVT is still available when
``CONFIG_RM57_EMAC`` is enabled.
Result transfer
@@ -369,14 +454,13 @@ channel that halted between the driver reading its tail and appending a
new descriptor.
``CONFIG_RM57_EMAC_MII`` / ``CONFIG_RM57_EMAC_RMII`` select the PHY
-interface mode; the LAUNCHXL2-RM57L's DP83630 PHY is wired for MII, while
-the IOMM reset default is RMII, so MII must be explicitly selected to
-match that board. The EMAC's internal logic clock (``VCLKA4_DIVR_EMAC``)
+interface mode. The IOMM reset default is RMII, but the LAUNCHXL2-RM57L's
+DP83630 PHY is strapped for MII with no way to change it, so that board
+must select MII. The EMAC's internal logic clock (``VCLKA4_DIVR_EMAC``)
must be exactly 25MHz for MII or 50MHz for RMII (SPNS215 Section 6.6.3);
-see the ``BOARD_VCLKA4_*`` comment in the board's ``board.h`` for how
-each mode's clock is derived and the caveat on the RMII (PLL2-sourced)
-path, which this port has not independently verified against real
-hardware.
+see the ``BOARD_VCLKA4_*`` comment in the board's ``board.h``. Only MII
+has been tested on hardware. The RMII path (clocked from PLL2) builds,
+but no board available to this port wires RMII.
The MDIO module addresses up to 32 PHYs (``CONFIG_RM57_EMAC_PHYADDR``,
default 1) over a single-transaction register interface
@@ -414,6 +498,14 @@ board bring-up; without ``CONFIG_NETDEV_LATEINIT`` the interface
self-registers via ``arm_netinitialize()`` with a fixed placeholder
address (``02:00:00:00:00:01``) instead.
+Tested on the LAUNCHXL2-RM57L at 100Mbit/s full duplex: DHCP, ping (RTT
+2-7ms through a home router), DNS, NSH over telnet and HTTP all work.
+With ``iperf`` the best measured TCP throughput is 19.4Mbit/s for
+transmit (board as client) and 9.2Mbit/s for receive (board as server).
+After a 10MB transfer, every EMAC error counter reads zero. On some boots
+the DHCP server does not answer the first DISCOVERs, so the ``eth``
+configuration raises ``CONFIG_NETUTILS_DHCPC_RETRIES`` to 10.
+
Supported Boards
=================
(nuttx) 01/02: arch/arm/rm57: Add TI Hercules RM57L843 and LAUNCHXL2-RM57L support
Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit a02257f67b7bbe63d4c9adeb86ea811accd492d7
Author: Mahmut Sami ÖZMEN <ma...@gmail.com>
AuthorDate: Wed Oct 14 23:58:23 2026 +0300
arch/arm/rm57: Add TI Hercules RM57L843 and LAUNCHXL2-RM57L support
Add a new chip family, the TI Hercules RM57L843 (dual Cortex-R5F in
lockstep, 4MB flash, 512KB ECC SRAM), and the LAUNCHXL2-RM57L LaunchPad.
The RM57 register layout is shared with TMS570, so every register map
was cross-checked against the TRM (SPNU562A), the datasheet (SPNS215),
the errata (SPNZ233B) and TI's HALCoGen sources.
Core and boot:
- Lockstep-safe CPU register init, PLL1 300MHz GCLK / 150MHz HCLK /
75MHz VCLK, flash wait states, SRAM ECC and peripheral RAM auto-init.
- MPU: flash is mapped Device/XN except the programmed extent and the
image is padded to 64KB, so speculative fetches never reach blank
flash (whose missing ECC otherwise latches ESM group 2 channel 3).
- VIM interrupt controller (single-bit REQMASKSET/REQMASKCLR writes),
RTI system tick, and ESM with a real FIQ handler that reports and
clears group 1/2 errors, optionally panicking.
- Optional start-up diagnostics (CONFIG_RM57_SELFTEST): ESM group 3
check, PBIST ROM tests with the errata PBIST#4 workaround, STC
self-check and CPU LBIST, the four CCM-R5F diagnostics in all three
modes, eFuse, L2RAMW ECC and address decode, plus fault-injection
options that prove each detection path.
Peripherals:
- IOMM pin multiplexing; GIO with second-level pin interrupt decoding.
- SCI1-4 serial driver with optional per-port RX/TX DMA and an RTI
driven RX DMA flush; DMA controller driver; LIN scaffold
(CONFIG_RM57_LIN, depends on EXPERIMENTAL).
- DCAN1-4: character driver or SocketCAN per instance, with PIO, IF3
interrupt or IF3 DMA (EXPERIMENTAL) receive paths and ECC-protected
message RAM.
- EMAC + MDIO network driver: MII, DP83630 PHY clocked from ECLK1, CPPI
descriptor rings in CPPI RAM, multicast hash filter.
- MibADC1/2: each of the three conversion groups as /dev/adcN, offset
calibration, self test, magnitude compare, hardware triggers and ADC1
DMA; the three on-die temperature sensors with OTP calibration,
exposed as character devices or through UORB.
- MibSPI1-5 SPI master in compatibility (polled or DMA) or multi-buffer
mode, with an internal-loopback start-up test.
- I2C1/2 interrupt-driven master with a digital-loopback start-up test.
Shared files only gain additions: arch/arm/Kconfig and boards/Kconfig
(new chip and board), drivers/net/Kconfig and include/nuttx/net/mii.h
(DP83630 PHY), include/nuttx/analog/ioctl.h (RM57 ADC ioctl range).
Board support: user LEDs B6/B7, IRQ-driven buttons B4/B5, PHY power-up
and reset, a MAC address derived from the die ID, and the nsh, buttons,
scitest, scidma, can, candma, cansock, eth, ethnsh, adc, temp, spi,
spitest, i2c and selftest configurations, with chip and board
documentation.
Tested on a LAUNCHXL2-RM57L (RM57L843 Rev B) through the on-board
XDS110: ostest, LEDs/buttons, console over SCI DMA, DCAN in loopback,
Ethernet up to 19.4 Mbit/s TX and 9.2 Mbit/s RX with iperf, ADC and
temperature sensors, MibSPI and I2C in loopback, and all start-up
diagnostics including fault injection. Details are in the PR.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Mahmut Sami ÖZMEN <ma...@gmail.com>
---
.../arm/rm57/boards/rm57l843-launchxl2/index.rst | 417 +++
Documentation/platforms/arm/rm57/index.rst | 424 +++
arch/arm/Kconfig | 13 +
arch/arm/include/rm57/chip.h | 65 +
arch/arm/include/rm57/irq.h | 91 +
arch/arm/include/rm57/rm57_adc_ioctl.h | 281 ++
arch/arm/include/rm57/rm57l843_irq.h | 199 +
arch/arm/src/rm57/CMakeLists.txt | 88 +
arch/arm/src/rm57/Kconfig | 1873 ++++++++++
arch/arm/src/rm57/Make.defs | 92 +
arch/arm/src/rm57/chip.h | 44 +
arch/arm/src/rm57/hardware/rm57_adc.h | 598 +++
arch/arm/src/rm57/hardware/rm57_ccm.h | 121 +
arch/arm/src/rm57/hardware/rm57_dcan.h | 350 ++
arch/arm/src/rm57/hardware/rm57_dma.h | 475 +++
arch/arm/src/rm57/hardware/rm57_efc.h | 134 +
arch/arm/src/rm57/hardware/rm57_esm.h | 211 ++
arch/arm/src/rm57/hardware/rm57_ethernet.h | 600 +++
arch/arm/src/rm57/hardware/rm57_flash.h | 80 +
arch/arm/src/rm57/hardware/rm57_gio.h | 137 +
arch/arm/src/rm57/hardware/rm57_i2c.h | 169 +
arch/arm/src/rm57/hardware/rm57_iomm.h | 139 +
arch/arm/src/rm57/hardware/rm57_l2ramw.h | 180 +
arch/arm/src/rm57/hardware/rm57_mibspi.h | 484 +++
arch/arm/src/rm57/hardware/rm57_pbist.h | 194 +
arch/arm/src/rm57/hardware/rm57_pcr.h | 168 +
arch/arm/src/rm57/hardware/rm57_pinmux.h | 57 +
arch/arm/src/rm57/hardware/rm57_rti.h | 153 +
arch/arm/src/rm57/hardware/rm57_sci.h | 370 ++
arch/arm/src/rm57/hardware/rm57_stc.h | 197 +
arch/arm/src/rm57/hardware/rm57_sys.h | 494 +++
arch/arm/src/rm57/hardware/rm57_vim.h | 213 ++
arch/arm/src/rm57/hardware/rm57l843_memorymap.h | 151 +
arch/arm/src/rm57/hardware/rm57l843_pinmux.h | 3881 ++++++++++++++++++++
arch/arm/src/rm57/rm57_adc.c | 3391 +++++++++++++++++
arch/arm/src/rm57/rm57_adc.h | 207 ++
arch/arm/src/rm57/rm57_adc_temp.c | 504 +++
arch/arm/src/rm57/rm57_boot.c | 267 ++
arch/arm/src/rm57/rm57_boot.h | 60 +
arch/arm/src/rm57/rm57_clockconfig.c | 296 ++
arch/arm/src/rm57/rm57_clockconfig.h | 49 +
arch/arm/src/rm57/rm57_coreinit.S | 165 +
arch/arm/src/rm57/rm57_dcan.c | 1870 ++++++++++
arch/arm/src/rm57/rm57_dcan.h | 265 ++
arch/arm/src/rm57/rm57_dcan_chardev.c | 667 ++++
arch/arm/src/rm57/rm57_dcan_sock.c | 615 ++++
arch/arm/src/rm57/rm57_dma.c | 534 +++
arch/arm/src/rm57/rm57_dma.h | 214 ++
arch/arm/src/rm57/rm57_errata.c | 297 ++
arch/arm/src/rm57/rm57_esm.c | 219 ++
arch/arm/src/rm57/rm57_esm.h | 64 +
arch/arm/src/rm57/rm57_ethernet.c | 2197 +++++++++++
arch/arm/src/rm57/rm57_ethernet.h | 78 +
arch/arm/src/rm57/rm57_gio.c | 243 ++
arch/arm/src/rm57/rm57_gio.h | 256 ++
arch/arm/src/rm57/rm57_gioirq.c | 297 ++
arch/arm/src/rm57/rm57_i2c.c | 1119 ++++++
arch/arm/src/rm57/rm57_i2c.h | 157 +
arch/arm/src/rm57/rm57_iomm.c | 198 +
arch/arm/src/rm57/rm57_iomm.h | 90 +
arch/arm/src/rm57/rm57_irq.c | 321 ++
arch/arm/src/rm57/rm57_irq.h | 65 +
arch/arm/src/rm57/rm57_lin.c | 389 ++
arch/arm/src/rm57/rm57_lin.h | 179 +
arch/arm/src/rm57/rm57_lowputc.c | 350 ++
arch/arm/src/rm57/rm57_lowputc.h | 113 +
arch/arm/src/rm57/rm57_mdio.c | 235 ++
arch/arm/src/rm57/rm57_mdio.h | 166 +
arch/arm/src/rm57/rm57_mibspi.c | 1719 +++++++++
arch/arm/src/rm57/rm57_mibspi.h | 181 +
arch/arm/src/rm57/rm57_mpuinit.c | 103 +
arch/arm/src/rm57/rm57_mpuinit.h | 117 +
arch/arm/src/rm57/rm57_netinitialize.c | 85 +
arch/arm/src/rm57/rm57_selftest.c | 1273 +++++++
arch/arm/src/rm57/rm57_selftest.h | 161 +
arch/arm/src/rm57/rm57_serial.c | 1809 +++++++++
arch/arm/src/rm57/rm57_timerisr.c | 233 ++
boards/Kconfig | 14 +
boards/arm/rm57/rm57l843-launchxl2/CMakeLists.txt | 25 +
boards/arm/rm57/rm57l843-launchxl2/Kconfig | 8 +
.../rm57/rm57l843-launchxl2/configs/adc/defconfig | 47 +
.../rm57l843-launchxl2/configs/buttons/defconfig | 38 +
.../rm57/rm57l843-launchxl2/configs/can/defconfig | 38 +
.../rm57l843-launchxl2/configs/candma/defconfig | 41 +
.../rm57l843-launchxl2/configs/cansock/defconfig | 47 +
.../rm57/rm57l843-launchxl2/configs/eth/defconfig | 59 +
.../rm57l843-launchxl2/configs/ethnsh/defconfig | 64 +
.../rm57/rm57l843-launchxl2/configs/i2c/defconfig | 45 +
.../rm57/rm57l843-launchxl2/configs/nsh/defconfig | 34 +
.../rm57l843-launchxl2/configs/scidma/defconfig | 58 +
.../rm57l843-launchxl2/configs/scitest/defconfig | 42 +
.../rm57l843-launchxl2/configs/selftest/defconfig | 39 +
.../rm57/rm57l843-launchxl2/configs/spi/defconfig | 45 +
.../rm57l843-launchxl2/configs/spitest/defconfig | 46 +
.../rm57/rm57l843-launchxl2/configs/temp/defconfig | 58 +
boards/arm/rm57/rm57l843-launchxl2/include/board.h | 388 ++
.../arm/rm57/rm57l843-launchxl2/scripts/Make.defs | 43 +
.../rm57/rm57l843-launchxl2/scripts/flash-sram.ld | 149 +
.../arm/rm57/rm57l843-launchxl2/src/CMakeLists.txt | 55 +
boards/arm/rm57/rm57l843-launchxl2/src/Makefile | 59 +
boards/arm/rm57/rm57l843-launchxl2/src/rm57_adc.c | 216 ++
.../rm57/rm57l843-launchxl2/src/rm57_autoleds.c | 89 +
.../arm/rm57/rm57l843-launchxl2/src/rm57_bringup.c | 192 +
.../arm/rm57/rm57l843-launchxl2/src/rm57_buttons.c | 187 +
boards/arm/rm57/rm57l843-launchxl2/src/rm57_can.c | 157 +
.../rm57/rm57l843-launchxl2/src/rm57_ethernet.c | 148 +
boards/arm/rm57/rm57l843-launchxl2/src/rm57_i2c.c | 329 ++
.../rm57/rm57l843-launchxl2/src/rm57_initialize.c | 95 +
boards/arm/rm57/rm57l843-launchxl2/src/rm57_spi.c | 456 +++
.../rm57/rm57l843-launchxl2/src/rm57_userleds.c | 81 +
.../rm57l843-launchxl2/src/rm57l843-launchxl2.h | 173 +
drivers/net/Kconfig | 3 +
include/nuttx/analog/ioctl.h | 5 +
include/nuttx/net/mii.h | 8 +
114 files changed, 38542 insertions(+)
diff --git a/Documentation/platforms/arm/rm57/boards/rm57l843-launchxl2/index.rst b/Documentation/platforms/arm/rm57/boards/rm57l843-launchxl2/index.rst
new file mode 100644
index 00000000000..9e41b929867
--- /dev/null
+++ b/Documentation/platforms/arm/rm57/boards/rm57l843-launchxl2/index.rst
@@ -0,0 +1,417 @@
+=====================
+LAUNCHXL2-RM57L
+=====================
+
+.. tags:: chip:rm57, arch:armv7-r, vendor:ti
+
+The `LAUNCHXL2-RM57L <https://www.ti.com/tool/LAUNCHXL2-RM57L>`__ is a
+LaunchPad-format evaluation board from Texas Instruments built around the
+Hercules RM57L843 safety microcontroller (dual Cortex-R5F cores in
+lockstep). It's aimed at evaluating TI's Hercules safety MCU family rather
+than any particular application.
+
+.. warning::
+
+ This board port is new and experimental. The serial console (SCI1),
+ the two user LEDs, the DMA controller, DCAN, and EMAC/MDIO (Ethernet)
+ are currently supported; button support and most other on-chip
+ peripherals are not yet implemented. Some of the values documented
+ below (PLL/clock configuration, LED polarity, JTAG IDCODE, and for
+ Ethernet the exact PHY ball assignments and RMII clock source) were
+ taken from TI's HALCoGen-generated reference project or from the
+ RM57L843 datasheet rather than confirmed against this specific
+ board's schematic — see the comments in
+ ``boards/arm/rm57/rm57l843-launchxl2/include/board.h`` for details.
+
+Features
+========
+
+* TI Hercules RM57L843 microcontroller
+* Dual-core lockstep ARM Cortex-R5F, running at 150 MHz HCLK (300 MHz
+ PLL/GCLK) in the current clock configuration
+* 4 MB of on-chip program flash, 512 KB of on-chip SRAM
+* Onboard XDS110 debug probe (JTAG)
+* 2 user LEDs
+* SCI1 wired up as the serial console; SCI2-SCI4 are supported by the
+ driver but not enabled by this board's default configuration (and
+ SCI2-SCI4 pin-mux is not programmed by this board port - see the
+ `Pin Mapping`_ note below)
+* Both MibADC modules, with analog inputs broken out on the BoosterPack
+ and edge headers and the ADC reference tied to the 3.3V analog supply
+* An on-board trim potentiometer wired to AD1IN[6], which gives the ADC an
+ adjustable 0V to +3V3 input with no external wiring (see the ``adc``
+ configuration below)
+* Three on-die temperature sensors, read through the ADC and calibrated from
+ factory data in OTP
+
+.. note::
+
+ Peripherals that are part of the RM57L843 chip itself (N2HET, MibSPI,
+ I2C, the ESM diagnostic module, PBIST/STC self-test, etc.) but are
+ not yet wired up by this board port are tracked on the
+ :doc:`RM57 chip documentation page </platforms/arm/rm57/index>`.
+
+Buttons and LEDs
+================
+
+LEDs
+----
+
+The LAUNCHXL2-RM57L has two user LEDs, labeled **B6** and **B7** on the
+board silkscreen, driven by GIOB[6] and GIOB[7] respectively.
+
+Buttons
+-------
+
+Button support is not yet implemented by this board port.
+
+Pin Mapping
+===========
+
+Only the pins used by the currently supported peripherals are listed.
+
+.. list-table::
+ :widths: auto
+ :header-rows: 1
+
+ * - Pin
+ - Signal
+ - Notes
+ * - (n/a)
+ - LIN1RX / LIN1TX
+ - SCI1, used as the serial console
+ * - P4 / T5
+ - LIN2RX / LIN2TX
+ - SCI2, multiplexed away from N2HET2[19]/N2HET2[20]
+ * - W3 / N2
+ - SCI3RX / SCI3TX
+ - SCI3, multiplexed away from N2HET1[6]/N2HET1[13]
+ * - A13 / B13
+ - SCI4RX / SCI4TX
+ - SCI4, multiplexed away from N2HET1[17]/N2HET1[19]
+ * - J2
+ - GIOB[6]
+ - User LED B6
+ * - F1
+ - GIOB[7]
+ - User LED B7
+ * - V5 / G3
+ - MDIO_CLK / MDIO_D
+ - MDIO bus shared by the EMAC's PHY (DP83630, address 1)
+ * - D19 / E18 / R2 / J19 / J18
+ - MII_TX_CLK / MII_TXD[3:0]
+ - EMAC transmit, MII mode
+ * - H19 / F3 / B4
+ - MII_TXEN / MII_COL / MII_CRS
+ - EMAC transmit control, MII mode
+ * - K19 / H18 / G19 / A14 / P1 / B11 / N19
+ - MII_RXCLK / MII_RXD[3:0] / MII_RX_DV / MII_RX_ER
+ - EMAC receive, MII mode
+ * - T19
+ - AD1IN[6]
+ - On-board 1k trim potentiometer U10 (wiper, with 4700pF to GND);
+ sweeps 0V to +3V3. ADC1 only - this ball has no AD2IN function
+ * - J1-2 / J1-6
+ - AD1IN[16] / AD2IN[0], AD1IN[17] / AD2IN[1]
+ - Analog inputs on the BoosterPack header, shared between both ADCs
+ * - J3-3 / J3-4
+ - AD1IN[0], AD1IN[7]
+ - Analog inputs on the BoosterPack header, ADC1 only
+ * - J3-5 to J3-8
+ - AD1IN[18:21] / AD2IN[2:5]
+ - Analog inputs on the BoosterPack header, shared between both ADCs
+ * - V15 / V16
+ - ADREFHI / ADREFLO
+ - ADC reference, tied to VCCAD (3.3V) and VSSAD through 0 ohm links
+
+.. note::
+
+ The EMAC/MDIO ball assignments above are this port's default choice
+ among two alternate-ball options the RM57L843 offers for nearly every
+ MII signal (see the ``BOARD_PINMUX_EMAC`` comment in ``board.h``) and
+ are **not** independently confirmed against the LAUNCHXL2-RM57L
+ schematic. RMII mode uses a smaller subset of these balls (see
+ ``board.h``) plus K19 as the RMII 50MHz reference clock input.
+
+.. note::
+
+ The RM57L843 SCI1/LIN1 pins are used at their reset-default (primary)
+ function, so no pin-mux configuration is required for the console.
+ Header/connector pin numbers for LIN1RX/LIN1TX have not been confirmed
+ against the LAUNCHXL2-RM57L schematic. SCI2/LIN2, SCI3 and SCI4 share
+ their balls with N2HET1/N2HET2 and are re-multiplexed at boot by
+ ``BOARD_PINMUX_INITIALIZER`` in ``include/board.h``, but only when the
+ corresponding ``CONFIG_RM57_SCIn`` is selected.
+
+Serial Console
+==============
+
+SCI1 is used as the serial console. The default configuration is:
+
+* 9600 baud, 8 data bits, no parity, 2 stop bits
+
+The baud rate and stop bits are configurable via ``CONFIG_SCI1_BAUD`` and
+``CONFIG_SCI1_2STOP``.
+
+Additional SCI ports (SCI2-SCI4) can be enabled via
+``CONFIG_RM57_SCI2``/``RM57_SCI3``/``RM57_SCI4``, which also pulls their
+RX/TX balls into the pin-mux table applied at boot; whichever one is *not*
+selected as the console (``CONFIG_SCIn_SERIAL_CONSOLE``) is registered as
+``/dev/ttyS0``, ``/dev/ttyS1``, etc. in SCI1-SCI4 order. SCI1/LIN1 and
+SCI2/LIN2 are dual-role SCI/LIN modules; the serial driver always runs
+them in SCI-compatibility mode. See
+:doc:`the RM57 chip documentation </platforms/arm/rm57/index>` for the
+serial RX/TX DMA options and the LIN configuration scaffold.
+
+Power Supply
+============
+
+The LAUNCHXL2-RM57L can be powered over USB through the onboard XDS110
+debug probe. Consult the
+`LAUNCHXL2-RM57L user's guide <https://www.ti.com/tool/LAUNCHXL2-RM57L>`_
+for the full range of supported input voltages.
+
+Debugging
+=========
+
+The board's onboard XDS110 probe exposes a JTAG interface (Hercules'
+ICEpick-C JTAG router is JTAG-only; XDS110's default SWD mode is not
+usable here). OpenOCD can be used with a Cortex-R5 (``cortex_r4`` driver)
+target configuration that routes through the ICEpick-C, followed by GDB
+to load and debug the image.
+
+Configurations
+==============
+
+nsh
+---
+
+Basic NuttShell configuration (console enabled on SCI1, at 9600 baud).
+
+scitest
+-------
+
+NuttShell plus all four SCI ports, for exercising the serial driver and
+the SCI pin multiplexing. SCI1 remains the console (9600 baud, 8N2, on
+the XDS110 backchannel); SCI2, SCI3 and SCI4 come up at 115200 baud, 8N1
+and are registered as ``/dev/ttyS0``, ``/dev/ttyS1`` and ``/dev/ttyS2``
+respectively. Their RX/TX balls are multiplexed at boot (see the Pin
+Mapping table above), so they must be wired to a USB-serial adapter, or
+looped back to each other, to be useful.
+
+``CONFIG_SERIAL_TERMIOS`` is enabled, and the ``serialblaster``,
+``serialrx`` and ``termios`` examples are built in::
+
+ nsh> serialrx /dev/ttyS1 1000 # count 1000 received bytes
+ nsh> serialblaster /dev/ttyS1 # transmit continuously
+ nsh> echo hello > /dev/ttyS2 # one-shot write
+
+Both ``serialrx`` and ``serialblaster`` take the device path as their
+first argument and default to ``/dev/ttyS0``.
+
+scidma
+------
+
+Identical to ``scitest``, except that all four SCI ports - the console
+included - run with both RX and TX DMA
+(``CONFIG_RM57_SCIn_RXDMA``/``TXDMA``, eight DMA channels in total).
+The two configurations are an A/B pair for the same serial tests.
+
+RX DMA hands received bytes to the upper half when the DMA half/full
+interrupt fires, i.e. only after ``CONFIG_RM57_SERIAL_RXDMA_BUFFER_SIZE
+/ 2`` bytes (32 by default). To keep short messages and interactive
+console input from stalling behind that threshold, RTI compare 1 calls
+``rm57_serial_dma_poll()`` at ``CONFIG_RM57_SERIAL_RXDMA_POLL_HZ``
+(1 kHz here), bounding the extra latency by one poll period. Both the
+console and the test ports therefore behave the same as in ``scitest``,
+only with the transfers themselves done by DMA.
+
+eth
+---
+
+NuttShell plus the EMAC (``CONFIG_RM57_EMAC=y``, MII mode, DP83630 PHY
+at address 1), with the full IPv4 stack (TCP/UDP/ICMP/ARP),
+``CONFIG_NETDEV_LATEINIT`` (so board bring-up can derive a real,
+die-ID-based MAC address before registering the interface - see
+`EMAC/MDIO (Ethernet) <#emac-mdio-ethernet>`_ on the chip documentation
+page), NSH's automatic network initialization
+(``CONFIG_NSH_NETINIT``, DHCP by default), and the ``ping`` utility::
+
+ nsh> ifconfig
+ nsh> ping 192.168.1.1
+
+If the network doesn't come up automatically, check ``ifconfig eth0``
+for the assigned address and bring the link up manually with
+``ifup eth0`` / ``ifdown eth0``.
+
+adc
+---
+
+NuttShell plus both MibADC modules (``CONFIG_RM57_ADC1=y`` and
+``CONFIG_RM57_ADC2=y``, 12-bit) and the ``adc`` example. Offset
+calibration runs at bring-up and the magnitude comparators are built in.
+
+``/dev/adc0`` is ADC1 Group1 converting AD1IN[6], which the board wires to
+the wiper of trim potentiometer U10. The pot's ends sit on +3V3 and GND, so
+turning it sweeps the input across the full conversion range and **this
+configuration needs no external wiring at all**::
+
+ nsh> adc -n 10
+
+Readings should track the pot from close to 0 at one end to close to 4095
+at the other, since ADREFHI is the 3.3V analog supply, and hold to within
+about one LSB at a fixed setting.
+
+The offset calibration reports itself on the boot log when
+``CONFIG_DEBUG_ANALOG_INFO`` is on, and is worth a glance the first time a
+board runs::
+
+ rm57_adc_calibrate: ADC1: calibration offset -1, correction 1
+ rm57_adc_calibrate: ADC2: calibration offset 0, correction 0
+
+A correction of a couple of LSB is what a healthy converter looks like. A
+large one means the calibration conversion is not sampling properly, and since
+the hardware adds that value to *every* subsequent result, it would shift the
+whole channel.
+
+The three on-die temperature sensors are enabled in this configuration too and
+show up as character devices::
+
+ nsh> ls /dev/temp*
+ /dev/temp0
+ /dev/temp1
+ /dev/temp2
+ nsh> hexdump /dev/temp0 -n 12
+
+``/dev/temp0`` is sensor 1 on ADC1, ``/dev/temp1`` and ``/dev/temp2`` are
+sensors 2 and 3 on ADC2. A read returns a ``struct rm57_adc_temp_s``: the raw
+code, the temperature in milli-Celsius and the flag saying the OTP calibration
+was usable. All three read the same die, so at idle they should agree within a
+few degrees, sitting somewhat above room temperature. Warming the package with
+a finger should move them within a second or two.
+
+Turning on ``CONFIG_RM57_ADC_TEMP_UORB`` (with ``CONFIG_SYSTEM_SENSORTEST``)
+replaces those nodes with UORB ones instead - that is what the ``temp``
+configuration below does.
+
+``/dev/adc1`` is ADC2 Group1 converting AD2IN[0]. That ball is shared with
+AD1IN[16] and comes out on J1-2, so it floats until something drives it;
+J1-1 (+3V3) and J3-2 (GND) sit next to it on the BoosterPack header, which
+is enough to check both rails with a single jumper.
+
+.. note::
+
+ Both groups use ``_ACQ=30``, a sampling window of 32 ADCLK cycles or
+ about 3.4µs, rather than the 8 the Kconfig defaults to. The trim pot
+ presents up to 250 ohms at its wiper and drives the 4700pF capacitor at
+ the pin, an RC of roughly 1.2µs, and a window of about three time
+ constants keeps the settling error near one LSB even when AD1IN[6] is
+ converted in sequence with channels at very different voltages. The
+ datasheet minimum, ``td(SH)`` of 0.2µs, is far below either value.
+
+temp
+----
+
+The ``adc`` configuration with the three on-die temperature sensors published
+through the sensor framework instead of as character devices
+(``CONFIG_RM57_ADC_TEMP_UORB``), plus ``sensortest`` to read them and the
+sensor subsystem's debug output so the boot log carries each sensor's factory
+calibration::
+
+ nsh> ls /dev/uorb
+ sensor_temp0
+ sensor_temp1
+ sensor_temp2
+ nsh> sensortest -n 5 temp0
+
+``sensor_temp0`` is sensor 1 on ADC1; ``sensor_temp1`` and ``sensor_temp2``
+are sensors 2 and 3 on ADC2. All three read the same die at different points
+on it. On a board idling at a room temperature of about 22°C they read 41.6°C,
+40.0°C and 44.7°C a minute after reset, stable to about ±0.2°C - one LSB - so
+a few degrees of spread between them is normal and not a fault.
+
+During bring-up the boot log is the more informative half. Each sensor's three
+OTP calibration points are printed as they were read, along with a trial
+conversion::
+
+ Sensor 1 OTP point 1: 233K (-40150 mC) reads 1427
+ Sensor 1 OTP point 2: 303K (29850 mC) reads 1879
+ Sensor 1 OTP point 3: 398K (124850 mC) reads 2461
+ Sensor 1 reads raw 1923, 37032 mC
+
+So the device is characterised at -40°C, +30°C and +125°C, and the reading
+rises with temperature at roughly six codes per degree. Blank OTP reads as
+``0xffff``; a "temperature" outside the 200-500K plausibility window is
+rejected, and would suggest the OTP region is being fetched as normal memory
+with errata L2FMC#5 substituting instruction opcodes for the data.
+
+Note that the trial conversion above reads lower than the numbers further up -
+37.0°C against 41.6°C - because it runs a second after reset, before the die
+has warmed to its idle temperature. That drift is itself a check on the sign
+of the calibration. Pressing a finger on the package makes all three readings
+*fall*, which is also right: the die runs hotter than skin, so a finger is a
+heatsink rather than a heat source. Use hot air if you want to confirm the
+other direction.
+
+.. note::
+
+ Reading one of these nodes with ``cat`` will hang, and that is the sensor
+ framework's fetch model rather than a driver fault: a fetch-mode sensor
+ produces a sample only when someone asks for one, and the upper half parks
+ a blocking reader on a semaphore that nothing in that model can post.
+ ``sensor_poll()`` handles the non-blocking case instead, which is why
+ ``sensortest`` - it opens ``O_NONBLOCK`` - works. Use it, or open the node
+ non-blocking yourself.
+
+selftest
+--------
+
+The ``nsh`` configuration with the start-up safety diagnostics enabled
+(``CONFIG_RM57_SELFTEST`` and its sub-options). Before the OS starts, the
+boot code runs:
+
+* a check that no ESM group 3 error survived the reset;
+* the PBIST ROM tests, preceded by the workaround for errata PBIST#4;
+* the STC self-check and the CPU logic BIST (125 intervals by default). Each
+ of the two ends in a CPU-only reset, so the boot code is entered three
+ times;
+* the four CCM-R5F diagnostics (CPU compare, VIM compare, inactivity monitor
+ and power domain monitor) in self-test, error forcing and self-test error
+ forcing mode;
+* the eFuse controller stuck-at-zero and ECC self-tests, after a power-on
+ reset only;
+* the L2RAMW ECC (single-bit and double-bit) and redundant address decode
+ diagnostics.
+
+The outcome is printed on the console before the NuttShell banner::
+
+ SELFTEST: reset cause 00008028 power-on cpu external
+ SELFTEST: ESM group3: PASS
+ SELFTEST: PBIST ROM init: PASS
+ SELFTEST: PBIST ROM: PASS
+ SELFTEST: STC self-check: PASS
+ SELFTEST: STC CPU LBIST: PASS
+ SELFTEST: CCM CPU compare: PASS
+ SELFTEST: CCM VIM compare: PASS
+ SELFTEST: CCM inactivity: PASS
+ SELFTEST: CCM power domain: PASS
+ SELFTEST: eFuse: PASS
+ SELFTEST: L2RAM ECC: PASS
+ SELFTEST: L2RAM addr decode: PASS
+
+A failing diagnostic prints ``SELFTEST FAIL: <name> step ... info ...``,
+drives nERROR active and, with ``CONFIG_RM57_SELFTEST_HALT_ON_FAIL``, stops
+there.
+
+.. note::
+
+ Several diagnostics force a real error, so the nERROR LED flashes briefly
+ on every boot. The CCM-R5F is disabled while a debugger is attached, so
+ the ROM tests, the STC and the CCM diagnostics are reported as ``skipped``
+ in a debug session.
+
+The ``CONFIG_RM57_SELFTEST_INJECT_*`` choice injects one fault per build to
+prove that the detection path works: a RAM algorithm on a ROM group, an STC
+time-out, a wrong eFuse self-test signature, a CPU compare mismatch or an
+L2RAM double-bit error. The last two are left pending and are reported at
+run time by the ESM handler as group 2 channel 2 and channel 7.
diff --git a/Documentation/platforms/arm/rm57/index.rst b/Documentation/platforms/arm/rm57/index.rst
new file mode 100644
index 00000000000..70c577aa236
--- /dev/null
+++ b/Documentation/platforms/arm/rm57/index.rst
@@ -0,0 +1,424 @@
+================
+TI/Hercules RM57
+================
+
+.. tags:: chip:rm57, arch:armv7-r
+
+The RM57 is part of TI's Hercules family of ARM Cortex-R5F safety
+microcontrollers, aimed at applications that need lockstep execution and
+built-in self-test (industrial, medical, and automotive safety systems).
+NuttX currently supports the **RM57L843** part.
+
+.. warning::
+
+ Support for this chip family is new and experimental. Only the
+ SCI/LIN (serial), DMA, GIO (LED), DCAN, and EMAC/MDIO (Ethernet)
+ peripherals have been brought up so far; the PLL/clock configuration
+ values, JTAG IDCODE, LED polarity, and (for Ethernet) the exact PHY
+ pin assignments and RMII clock source have not all been independently
+ confirmed against hardware/schematics. See the
+ :doc:`board documentation <boards/rm57l843-launchxl2/index>` for
+ details.
+
+Peripheral Support
+==================
+
+The following list indicates RM57 peripherals currently supported in NuttX:
+
+============== =====
+Peripheral Notes
+============== =====
+SCI SCI1-SCI4. SCI1/LIN1 and SCI2/LIN2 are dual-role SCI/LIN
+ modules; the serial driver always runs them in SCI
+ compatibility mode (GCR1 LIN_MODE=0). Interrupt-driven by
+ default; optional RX/TX DMA (see `Serial DMA`_ below).
+ Used for the console.
+LIN Configuration and polled-transfer scaffold only
+ (``CONFIG_RM57_LIN``, requires ``CONFIG_EXPERIMENTAL``) -
+ not a complete LIN protocol stack. See
+ ``arch/arm/src/rm57/rm57_lin.h`` for what is and is not
+ implemented.
+DMA 32-channel, 48-request-line DMA controller
+ (``CONFIG_RM57_DMA``). Used by the serial driver's RX/TX
+ DMA options and by the DCAN IF3 DMA receive path.
+DCAN All four DCAN (Bosch D_CAN, CAN 2.0A/B) controllers
+ (``CONFIG_RM57_DCANn``). Per instance either a character
+ device (``/dev/can<n>``) or a SocketCAN network interface
+ (``can<n>``); both frontends can coexist in one image on
+ different instances. See `DCAN`_ below.
+GIO General purpose I/O, used for LEDs
+ADC Both MibADC modules (``CONFIG_RM57_ADC1`` /
+ ``CONFIG_RM57_ADC2``), 10- or 12-bit. Each of a module's
+ three conversion groups is registered as its own
+ ``/dev/adcN``. Calibration, self test, magnitude compare
+ interrupts, hardware triggers, DMA result transfer and the
+ enhanced channel selection mode are all supported, along with
+ the three on-die temperature sensors
+ (``CONFIG_RM57_ADC_TEMPSENSOR``). See `ADC (MibADC)`_ below.
+EMAC 10/100 Ethernet MAC + EMAC Control module + MDIO
+ (``CONFIG_RM57_EMAC``). Single netdev interface (``eth0``),
+ MII or RMII (``RM57_EMAC_MII`` / ``RM57_EMAC_RMII``). See
+ `EMAC/MDIO (Ethernet)`_ below.
+============== =====
+
+.. todo::
+
+ Many peripherals available on the RM57L843 (N2HET, MibSPI, I2C,
+ the ESM diagnostic module, PBIST/STC self-test, etc.) are not yet
+ implemented. Contributions are welcome.
+
+DCAN
+====
+
+Each of the four DCAN controllers has 64 ECC-protected message objects.
+The driver partitions them into a transmit FIFO at the top of the range
+(``CONFIG_RM57_DCAN_TXFIFO_DEPTH``, default 8) and receive filter FIFOs
+below it (``CONFIG_RM57_DCAN_RXFIFO_DEPTH`` objects per acceptance
+filter, up to ``CONFIG_RM57_DCAN_NFILTERS_MAX`` filters, with an
+accept-everything filter installed while no user filter is active).
+Message-object interrupts for reception are routed to the DCAN's level 1
+interrupt line, transmission and status/error to level 0.
+
+Per instance, ``RM57_DCANn_CHARDRIVER`` selects the classic character
+driver (bit timing, acceptance filter, loopback/silent mode, bus-off
+recovery, NART and ABOM ioctls; error reporting with
+``CONFIG_CAN_ERRORS``) and ``RM57_DCANn_SOCKET`` selects SocketCAN
+(``candump``/``cansend`` work out of the box; error frames with
+``CONFIG_NET_CAN_ERRORS``, bit timing via ``SIOCGCANBITRATE`` /
+``SIOCSCANBITRATE``).
+
+Three receive paths are available per instance:
+
+- ``RM57_DCANn_RX_PIO`` (default): interrupt per message, read through
+ interface register set 2.
+- ``RM57_DCANn_RX_IF3IRQ``: the message handler auto-copies received
+ objects into interface register set 3; the dedicated IF3 interrupt
+ reads them without any interface-register busy-wait.
+- ``RM57_DCANn_RX_IF3DMA`` (``CONFIG_EXPERIMENTAL``): as above, but a
+ DMA channel in auto-initiation mode moves the IF3 image to memory;
+ a watchdog guards against lost request pulses.
+
+The CAN clock (VCLKA1) is mapped to VCLK (75 MHz with the default board
+clocking); the bit-timing search targets a 75% sample point, matching
+TI's HALCoGen defaults (500 kbit/s -> BRP=10, TSEG1=10, TSEG2=4).
+DCAN1-DCAN3 use dedicated balls (A10/B10, H2/H1, M18/M19); DCAN4 is
+pin-multiplexed with GIOB[2] and GIOB[3] (F2/W10) and the board claims
+those balls when ``RM57_DCAN4`` is enabled. The LAUNCHXL2-RM57L has no
+CAN transceiver on board - every DCAN ball runs to a BoosterPack header
+at CMOS levels, so a real bus needs an external transceiver, while the
+loopback test mode still drives the TX ball for logic-analyzer capture.
+The board configurations ``can`` (character driver,
+loopback self-test), ``cansock`` (SocketCAN with candump/cansend) and
+``candma`` (IF3 DMA receive path) are provided.
+
+Serial DMA
+==========
+
+Each SCI port can optionally use the DMA controller for RX and/or TX,
+independently, via ``CONFIG_RM57_SCIn_RXDMA`` / ``CONFIG_RM57_SCIn_TXDMA``
+(n = 1-4; both require ``CONFIG_RM57_DMA``). Because SCI1/LIN1 and
+SCI2/LIN2 are run in SCI-compatibility mode (single-buffer, MBUF_MODE=0),
+the SCI module generates one DMA request per byte in each direction (TRM
+SPNU562A section 28.2.3) - there is no multi-byte burst transfer for a
+single UART frame.
+
+RX DMA writes into a per-port circular ring buffer sized by
+``CONFIG_RM57_SERIAL_RXDMA_BUFFER_SIZE`` (rounded up to a multiple of the
+Cortex-R5's 32-byte D-cache line size). New bytes are picked up when the
+DMA half/full ("HBC"/"BTC") interrupt fires, which alone would leave
+short, infrequent messages sitting in the ring buffer until it is half
+full. Unlike, say, the STM32 USART, the SCI has no idle-line interrupt
+to signal the end of a shorter burst, so ``rm57_serial_dma_poll()``
+flushes the rings instead.
+
+``CONFIG_RM57_SERIAL_RXDMA_POLL`` (enabled by default whenever a port
+uses RX DMA) dedicates **RTI compare 1** to calling it at
+``CONFIG_RM57_SERIAL_RXDMA_POLL_HZ`` (1 kHz by default), which bounds
+the added receive latency by one poll period and is what makes an RX
+DMA console usable interactively. Compare 1 shares free-running counter
+0 with the system tick on compare 0, so no additional timer hardware is
+consumed. Disable the option if every RX DMA port is used purely for
+bulk transfers and the interrupt is not wanted.
+
+The underlying hardware DMA request lines used are fixed per SCI
+instance (datasheet SPNS215C Table 6-41):
+
+================ ========== ==========
+SCI instance RX request TX request
+================ ========== ==========
+SCI1/LIN1 28 29
+SCI3 30 31
+SCI2/LIN2 40 41
+SCI4 42 43
+================ ========== ==========
+
+ADC (MibADC)
+============
+
+The RM57L843 has two MibADC modules. ADC1 serves 32 analog inputs and ADC2
+serves 25, of which 16 are the same balls ADC1 sees. Both are successive
+approximation converters that run at either 10- or 12-bit resolution, and
+both are enabled independently with ``CONFIG_RM57_ADC1`` and
+``CONFIG_RM57_ADC2``.
+
+Conversion groups
+-----------------
+
+Each module contains three independent conversion groups - the Event group,
+Group1 and Group2. A group owns its channel selection mask, trigger source,
+sampling window, slice of the results memory and VIM interrupt channel, so
+the driver registers each enabled group as a separate character device.
+Devices are numbered ``/dev/adc0`` upwards in the order the groups are
+enabled, ADC1 before ADC2 and Event before Group1 before Group2.
+
+A group is enabled with ``CONFIG_RM57_ADCn_EV``, ``..._G1`` or ``..._G2``,
+and configured with the options underneath it: ``..._CHANMASK`` selects the
+channels, ``..._ACQ`` the sampling window, ``..._BUFS`` its share of the
+results memory, ``..._THRESHOLD`` how many results accumulate before the
+group interrupts, and ``..._CONTINUOUS`` whether the channels are converted
+once per trigger or continuously.
+
+Results memory
+--------------
+
+Each module has a 64-word results RAM that its three groups divide between
+them. The hardware allocates it in *pairs* of buffers through a single
+register, so the split is computed for the whole module from every group's
+``..._BUFS`` value. The Event group and Group1 counts must therefore be even,
+and a module's three groups must not ask for more than 64 words in total;
+both rules are checked at compile time.
+
+The RAM is auto-initialized to zero at start-up through the system module's
+memory initialization controller, which is what makes it safe to switch on
+the parity checking enabled by default with ``CONFIG_RM57_ADC_PARITY``. A
+parity error is reported to the Error Signalling Module.
+
+Conversion clock
+----------------
+
+ADCLK is VCLK divided by a prescaler. Rather than expose the divider,
+``CONFIG_RM57_ADCn_CLOCK`` names the wanted frequency and the driver derives
+the prescaler from ``BOARD_VCLK_FREQUENCY``, rounding so the result never
+exceeds the request. SPNS215 specifies a ``tc(ADCLK)`` of at least 33ns, an
+ADCLK ceiling of 30MHz, which is asserted at compile time. The default of
+9.375MHz is VCLK/8 on a board running VCLK at 75MHz.
+
+Triggering
+----------
+
+Group1 and Group2 are software triggered by default: writing the channel
+selection starts a conversion. Setting ``CONFIG_RM57_ADCn_Gx_HWTRIG`` makes
+them wait for one of eight hardware sources instead, selected with
+``..._TRIGSRC`` - the ADxEVT pin, four N2HET1 outputs, an RTI compare match
+or two GIOB pins. The Event group has no such choice: it is always started
+by its trigger source, so only the source and its edge are configurable.
+
+When the ADxEVT pin is not used as a trigger it can serve as a general
+purpose I/O through the ``ANIOC_RM57_EVTPIN`` ioctl. Note that AD1EVT shares
+ball N19 with the Ethernet MII_RX_ER signal, so it is unavailable when
+``CONFIG_RM57_EMAC`` is enabled.
+
+Result transfer
+---------------
+
+By default a group's interrupt handler drains the results FIFO and hands
+each sample to the upper half. Selecting ``CONFIG_RM57_ADC1_Gx_DMA`` moves
+them with the DMA controller instead, into a two-half ring that lets the ADC
+fill one half while the other is delivered as a batch. ADC1 has dedicated
+DMA request lines; ADC2's are alternate functions shared with MibSPI1 and
+MibSPI3 and would need the system module's request source mux reprogrammed,
+so ADC2 has no DMA option.
+
+Calibration and diagnostics
+---------------------------
+
+With ``CONFIG_RM57_ADC_CALIBRATE`` (the default) the driver runs the offset
+error calibration when a module's first group is registered: four internal
+reference voltages are converted, and the deviation of their average from
+mid scale is loaded into the correction register that the hardware adds to
+every subsequent result. ``ANIOC_RM57_CALIBRATE`` repeats it on demand and
+``ANIOC_RM57_MIDPOINTCAL`` runs the differential variant, which cancels the
+mismatch of the internal bridge resistors.
+
+``ANIOC_RM57_SELFTEST`` drives each reference onto one input through an
+internal test resistor and classifies the channel as healthy, open, or
+shorted to ground or supply.
+
+``CONFIG_RM57_ADC_MAGCOMP`` builds support for the three hardware magnitude
+comparators of each module, which interrupt when a monitored channel crosses
+a threshold - either a fixed value or the latest result of a second channel.
+The generic ``ANIOC_WDOG_UPPER`` and ``ANIOC_WDOG_LOWER`` commands are backed
+by the first two of them.
+
+Channel order
+-------------
+
+Channels are normally converted in ascending channel number. ADC1 also
+supports a look-up table based order, built with
+``CONFIG_RM57_ADC_ENHANCED_CHSEL`` and loaded through
+``ANIOC_RM57_SET_CHNSEQ``, which converts an arbitrary user-defined sequence
+and can drive an external analog multiplexer alongside it. ADC2 does not
+implement this mode.
+
+On-chip temperature sensors
+---------------------------
+
+The device carries three on-die temperature sensors, each multiplexed onto one
+ADC channel: sensor 1 on ADC1 channel 31, sensors 2 and 3 on ADC2 channels 31
+and 30. They are enabled with ``CONFIG_RM57_ADC_TEMPSENSOR`` and selected
+individually with ``CONFIG_RM57_ADC_TEMP1`` to ``..._TEMP3``.
+
+Out of reset all three are powered down and their channels are wired to the
+external balls instead, so the driver has to release them and re-mux them
+through the IOMM. Sensor 1 shares its channel with the ``AD1IN[31]`` ball
+(T13), which means enabling it gives up that ball as an analog input; sensors
+2 and 3 sit on channels that have no ball at all, so they cost nothing.
+
+Readings are calibrated. During device test TI records three
+(ADC reading, temperature) points per sensor in OTP, and the driver reads them
+back and interpolates, so results come out in real degrees Celsius rather than
+raw codes. The calibration was taken with ADREFHI at 3.3V, which is what this
+board supplies, so no scaling correction is applied. If OTP holds no usable
+calibration the driver reports the raw reading and refuses to invent a
+temperature.
+
+By default each enabled sensor is registered as a character device,
+``CONFIG_RM57_ADC_TEMP_PATH`` with the device number appended - ``/dev/temp0``
+and upwards, numbered from ``CONFIG_RM57_ADC_TEMP_DEVNO``. One ``read()``
+returns a whole ``struct rm57_adc_temp_s``::
+
+ struct rm57_adc_temp_s temp;
+ int fd = open("/dev/temp0", O_RDONLY);
+
+ read(fd, &temp, sizeof(temp));
+ if (temp.calibrated)
+ {
+ printf("%d.%03d C\n", temp.millicel / 1000, abs(temp.millicel % 1000));
+ }
+
+Every read runs a fresh conversion and none of them reports end of file, so
+read a fixed length rather than pointing ``cat`` at the node.
+
+``CONFIG_RM57_ADC_TEMP_UORB`` swaps that for the sensor framework, registering
+each sensor as ``/dev/uorb/sensor_tempN`` instead::
+
+ nsh> sensortest -n 5 temp0
+
+That is the friendlier interface - ``poll()`` and the ``sensortest``
+application come with it - but it selects ``CONFIG_SENSORS`` and pulls in the
+whole UORB upper half, which is a lot to carry for a die temperature. It also
+costs the calibration flag, since ``struct sensor_temp`` has nowhere to put
+it: an uncalibrated sensor fails the read with ``ENODATA`` rather than handing
+back a qualified reading.
+
+Blocking reads are not among what it buys, though. These sensors are
+fetch-mode, and the upper half serves a blocking reader by parking it on a
+per-subscriber semaphore that only a pushing driver ever posts - so a
+fetch-mode node must be opened ``O_NONBLOCK``, which is what ``sensortest``
+does and what ``sensor_poll()`` is written to accommodate. Pointing ``cat`` at
+one of these nodes hangs.
+
+The type is ``SENSOR_TYPE_TEMPERATURE`` rather than
+``SENSOR_TYPE_AMBIENT_TEMPERATURE``: these sensors measure the junction, not
+the room. Readings are fetched on demand - a conversion runs when someone
+reads - so there is no sampling period to configure and ``SNIOC_SET_INTERVAL``
+is accepted and ignored.
+
+Under either arrangement the sensors are also reachable through the
+``ANIOC_RM57_GET_TEMP`` ioctl on any ``/dev/adcN``, which fills in the same
+``struct rm57_adc_temp_s``.
+
+A temperature reading borrows one conversion group for the duration of a
+single conversion, saving and restoring its channel selection, mode and
+interrupt enables. A group that is converting continuously therefore loses a
+few microseconds of sampling to each temperature read.
+
+Shared channels
+---------------
+
+16 channels are wired to both modules. When both convert the same ball their
+sampling windows must either match exactly or not overlap at all, with at
+least two ADC cycles between them (TRM SPNU562A section 22.1). The simplest
+way to satisfy this is to give both groups the same ``..._ACQ`` value.
+
+The board configuration ``rm57l843-launchxl2:adc`` exercises ADC1 Group1 and
+ADC2 Group1 with the ``adc`` example.
+
+EMAC/MDIO (Ethernet)
+=====================
+
+The RM57L843 has a single 10/100 Ethernet MAC built from three sub-blocks
+(SPNU562A chapter 31): the EMAC module itself (TX/RX CPPI DMA engines,
+statistics, MAC address/hash filtering), the EMAC Control module (VIM
+interrupt pacing/routing), and the MDIO module (a shared PHY management
+bus, independent of the MAC). ``CONFIG_RM57_EMAC`` enables all three
+together and registers one ``netdev_register()`` interface
+(``NET_LL_ETHERNET``) - there is no separate character-device frontend,
+unlike DCAN.
+
+Descriptor rings (TX: ``CONFIG_RM57_EMAC_NTXDESC``, default 8; RX:
+``CONFIG_RM57_EMAC_NRXDESC``, default 16) live in the EMAC's internal 8KB
+CPPI RAM, which this port's MPU maps as non-cacheable device memory, so
+descriptor fields need no cache maintenance. Packet buffers are ordinary
+cacheable SRAM; TX uses a small zero-copy free-buffer pool (buffers are
+swapped into ``dev->d_buf``, not copied) while RX buffers are fixed 1:1
+with RX descriptors and processed synchronously in place. Both rings are
+managed as CPPI "append to a running queue" chains (SPNU562A Section
+31.2.6.2), including the documented EOQ-race recovery for restarting a
+channel that halted between the driver reading its tail and appending a
+new descriptor.
+
+``CONFIG_RM57_EMAC_MII`` / ``CONFIG_RM57_EMAC_RMII`` select the PHY
+interface mode; the LAUNCHXL2-RM57L's DP83630 PHY is wired for MII, while
+the IOMM reset default is RMII, so MII must be explicitly selected to
+match that board. The EMAC's internal logic clock (``VCLKA4_DIVR_EMAC``)
+must be exactly 25MHz for MII or 50MHz for RMII (SPNS215 Section 6.6.3);
+see the ``BOARD_VCLKA4_*`` comment in the board's ``board.h`` for how
+each mode's clock is derived and the caveat on the RMII (PLL2-sourced)
+path, which this port has not independently verified against real
+hardware.
+
+The MDIO module addresses up to 32 PHYs (``CONFIG_RM57_EMAC_PHYADDR``,
+default 1) over a single-transaction register interface
+(``USERACCESS0``), and generates a link-change interrupt
+(``LINKINT0``, routed through the ``C0_MISC_PULSE`` VIM channel) that
+this driver always keeps enabled for its own ``netdev_carrier_on/off``
+tracking; ``CONFIG_RM57_EMAC_PHY_INTERRUPT`` additionally exposes that
+event to userspace via ``SIOCMIINOTIFY``/``phy_notify``.
+``CONFIG_RM57_EMAC_AUTONEG`` (default) negotiates speed/duplex; disabling
+it forces the mode selected by ``CONFIG_RM57_EMAC_ETHFD`` /
+``CONFIG_RM57_EMAC_ETH100MBPS``. ``CONFIG_RM57_EMAC_LOOPBACK`` sets
+``MACCONTROL.LOOPBACK`` and skips the PHY link wait entirely, so the
+descriptor ring and interrupt path can be exercised standalone without a
+PHY or cable - the Ethernet equivalent of ``RM57_DCAN_LOOPBACK``.
+
+Multicast group membership (``CONFIG_NET_MCASTGROUP``) is implemented via
+the EMAC's 64-bit hash address table (SPNU562A Section 31.5.37, 6-bit
+XOR-fold of the destination address), with a per-bit reference count
+since two joined addresses can hash to the same bit.
+
+The four EMAC Control module interrupt pulses this device routes to the
+VIM (SPNS215 Table 6-39) are, in channel order: ``C0_MISC_PULSE`` (76,
+statistics/host-error/MDIO events), ``C0_TX_PULSE`` (77, TX completion),
+``C0_THRESH_PULSE`` (78, RX flow-control threshold - not used by this
+driver), ``C0_RX_PULSE`` (79, RX completion). Each ISR follows the
+disable-service-acknowledge-reenable discipline SPNU562A Section
+31.2.17.3 documents: the top-half clears the relevant EMAC Control
+enable bit and defers to the low-priority work queue, which does the
+real work, writes the ``MACEOIVECTOR`` acknowledge key, then re-enables
+the source last.
+
+The ``eth`` board configuration (``CONFIG_NETDEV_LATEINIT``) derives a
+locally-administered MAC address from the device's unique die ID at
+board bring-up; without ``CONFIG_NETDEV_LATEINIT`` the interface
+self-registers via ``arm_netinitialize()`` with a fixed placeholder
+address (``02:00:00:00:00:01``) instead.
+
+Supported Boards
+=================
+
+.. toctree::
+ :glob:
+ :maxdepth: 1
+
+ boards/*/*
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index be209af3edd..a75074f1312 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -816,6 +816,15 @@ config ARCH_CHIP_TMS570
---help---
TI TMS570 family
+config ARCH_CHIP_RM57
+ bool "TI Hercules RM57"
+ select ARCH_HAVE_LOWVECTORS
+ select ARCH_HAVE_FETCHADD
+ select ARMV7R_MEMINIT
+ select ARMV7R_HAVE_DECODEFIQ
+ ---help---
+ TI Hercules RM57 family (ARM Cortex-R5F)
+
config ARCH_CHIP_TIVA
bool "TI Tiva"
select ARCH_HAVE_MPU
@@ -1401,6 +1410,7 @@ config ARCH_CHIP
default "stm32wl5" if ARCH_CHIP_STM32WL5
default "str71x" if ARCH_CHIP_STR71X
default "tms570" if ARCH_CHIP_TMS570
+ default "rm57" if ARCH_CHIP_RM57
default "xmc4" if ARCH_CHIP_XMC4
default "mx8mp" if ARCH_CHIP_MX8MP
default "cxd56xx" if ARCH_CHIP_CXD56XX
@@ -1978,6 +1988,9 @@ endif
if ARCH_CHIP_TMS570
source "arch/arm/src/tms570/Kconfig"
endif
+if ARCH_CHIP_RM57
+source "arch/arm/src/rm57/Kconfig"
+endif
if ARCH_CHIP_XMC4
source "arch/arm/src/xmc4/Kconfig"
endif
diff --git a/arch/arm/include/rm57/chip.h b/arch/arm/include/rm57/chip.h
new file mode 100644
index 00000000000..ebcc6fe65cb
--- /dev/null
+++ b/arch/arm/include/rm57/chip.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+ * arch/arm/include/rm57/chip.h
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+#ifndef __ARCH_ARM_INCLUDE_RM57_CHIP_H
+#define __ARCH_ARM_INCLUDE_RM57_CHIP_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Pre-processor Prototypes
+ ****************************************************************************/
+
+/* Values below are taken from TI's HALCoGen project for RM57L843; the
+ * peripheral counts follow the VIM channel table in rm57l843_irq.h.
+ */
+
+#if defined(CONFIG_ARCH_CHIP_RM57L843)
+# undef RM57_CORTEX_R4 /* Not Cortex-R4 family */
+# undef RM57_CORTEX_R4F /* Not Cortex-R4F family */
+# undef RM57_CORTEX_R5 /* Not Cortex-R5 family */
+# define RM57_CORTEX_R5F 1 /* Cortex-R5F family */
+
+/* 4MB Program FLASH */
+# define RM57_PFLASH (4096*1024)
+# define RM57_SRAM (512*1024) /* 512KB SRAM */
+
+/* DCAN1-4 (VIM req 16/29, 35/42, 45/55, 113/117) */
+# define RM57_NCAN 4
+
+/* SCI1(LIN1)/SCI2/SCI3/SCI4 */
+# define RM57_NSCI 4
+
+/* MibSPI1-5 (VIM req 12/26, 30, 37/38, 49/54, 53/56) */
+# define RM57_NMIBSPI 5
+
+/* GIO Port A, Port B */
+# define RM57_NGIOPORT 2
+#else
+# error Unrecognized RM57 chip
+#endif
+
+#endif /* __ARCH_ARM_INCLUDE_RM57_CHIP_H */
diff --git a/arch/arm/include/rm57/irq.h b/arch/arm/include/rm57/irq.h
new file mode 100644
index 00000000000..d781c1e966d
--- /dev/null
+++ b/arch/arm/include/rm57/irq.h
@@ -0,0 +1,91 @@
+/****************************************************************************
+ * arch/arm/include/rm57/irq.h
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/* This file should never be included directly but, rather,
+ * only indirectly through nuttx/irq.h
+ */
+
+#ifndef __ARCH_ARM_INCLUDE_RM57_IRQ_H
+#define __ARCH_ARM_INCLUDE_RM57_IRQ_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <arch/rm57/chip.h>
+
+/****************************************************************************
+ * Pre-processor Prototypes
+ ****************************************************************************/
+
+/* The VIM interrupt vector table has one phantom vector plus a set of
+ * real interrupt channels, per the classic Hercules VIM layout (see
+ * arch/arm/include/tms570/irq.h for the sibling family's equivalent).
+ */
+
+#define RM57_VECT_PHANTOM 0 /* The first is the "phantom" interrupt */
+
+/* Default channel assignments are MCU-dependent */
+
+#if defined(CONFIG_ARCH_CHIP_RM57L843)
+# include <arch/rm57/rm57l843_irq.h>
+#else
+# error "Unrecognized Hercules RM57 chip"
+#endif
+
+/* Total number of IRQ numbers.
+ * Includes all channels plus GIO second-level interrupts (if enabled).
+ * Excludes the phantom vector. Zero corresponds to channel 0, vector 1.
+ */
+
+#define NR_IRQS (RM57_IRQ_NCHANNELS + RM57_NGIO_IRQS)
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+#ifdef __cplusplus
+#define EXTERN extern "C"
+extern "C"
+{
+#else
+#define EXTERN extern
+#endif
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+#undef EXTERN
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+#endif /* __ARCH_ARM_INCLUDE_RM57_IRQ_H */
diff --git a/arch/arm/include/rm57/rm57_adc_ioctl.h b/arch/arm/include/rm57/rm57_adc_ioctl.h
new file mode 100644
index 00000000000..415fbe6d033
--- /dev/null
+++ b/arch/arm/include/rm57/rm57_adc_ioctl.h
@@ -0,0 +1,281 @@
+/****************************************************************************
+ * arch/arm/include/rm57/rm57_adc_ioctl.h
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+#ifndef __ARCH_ARM_INCLUDE_RM57_RM57_ADC_IOCTL_H
+#define __ARCH_ARM_INCLUDE_RM57_RM57_ADC_IOCTL_H
+
+/* The MibADC's application-visible interface: the RM57-specific ioctl
+ * commands accepted by any /dev/adcN, the types they take, and the constants
+ * needed to fill those types in. This is the header an application
+ * includes, as <arch/chip/rm57_adc_ioctl.h>; the driver's own
+ * arch/arm/src/rm57/rm57_adc.h includes it and adds the in-kernel entry
+ * points on top.
+ *
+ * The generic ANIOC_* commands work too. ANIOC_TRIGGER starts a conversion
+ * sequence, ANIOC_GET_NCHANNELS returns the number of channels selected in
+ * the group, and ANIOC_WDOG_UPPER/LOWER map onto magnitude comparators 0
+ * and 1 of the owning module when CONFIG_RM57_ADC_MAGCOMP is enabled.
+ */
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/analog/ioctl.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* Module identifiers */
+
+#define RM57_ADC_MODULE1 0
+#define RM57_ADC_MODULE2 1
+#define RM57_ADC_NMODULES 2
+
+/* Conversion groups. Note that arch/arm/include/rm57/rm57l843_irq.h calls
+ * the Event group "GROUP0".
+ */
+
+#define RM57_ADC_GROUP_EV 0 /* Event group */
+#define RM57_ADC_GROUP_G1 1 /* Group1 */
+#define RM57_ADC_GROUP_G2 2 /* Group2 */
+#define RM57_ADC_NGROUPS 3
+
+/* Magnitude comparators per module */
+
+#define RM57_ADC_NMAGCOMP 3
+
+/* Look-up table entries per group in the enhanced channel selection mode */
+
+#define RM57_ADC_LUT_NENTRIES 32
+
+/* On-die temperature sensors, and the number of factory calibration points
+ * recorded for each of them.
+ */
+
+#define RM57_ADC_NTEMPSENSORS 3
+#define RM57_ADC_TEMPCAL_NPOINTS 3
+
+/* Hardware trigger sources for the default trigger set (SPNS215). The
+ * alternate set is selected by the PINMUX_ALT_ADC_TRIGGER control.
+ */
+
+#define ADC_TRIGSRC_EVT 0 /* ADxEVT pin */
+#define ADC_TRIGSRC_N2HET1_8 1
+#define ADC_TRIGSRC_N2HET1_10 2
+#define ADC_TRIGSRC_RTI_COMP0 3
+#define ADC_TRIGSRC_N2HET1_12 4
+#define ADC_TRIGSRC_N2HET1_14 5
+#define ADC_TRIGSRC_GIOB_0 6
+#define ADC_TRIGSRC_GIOB_1 7
+
+/* RM57-specific ioctl commands. The command range is reserved in
+ * include/nuttx/analog/ioctl.h as AN_RM57_FIRST/AN_RM57_NCMDS.
+ */
+
+/* Start/stop conversions on this group. IN: None. */
+
+#define ANIOC_RM57_START _ANIOC(AN_RM57_FIRST + 0)
+#define ANIOC_RM57_STOP _ANIOC(AN_RM57_FIRST + 1)
+
+/* Set the group's channel selection mask.
+ * IN: uint32_t bit mask of channels
+ */
+
+#define ANIOC_RM57_SET_CHANMASK _ANIOC(AN_RM57_FIRST + 2)
+
+/* Configure the group's conversion mode.
+ * IN: const struct rm57_adc_grpcfg_s *
+ */
+
+#define ANIOC_RM57_SET_GRPCFG _ANIOC(AN_RM57_FIRST + 3)
+
+/* Run the offset error calibration sequence on the owning module.
+ * IN: None, or a struct rm57_adc_calib_s * to receive the raw results.
+ */
+
+#define ANIOC_RM57_CALIBRATE _ANIOC(AN_RM57_FIRST + 4)
+
+/* Run the differential mid-point calibration sequence.
+ * IN: struct rm57_adc_calib_s * (may be NULL)
+ */
+
+#define ANIOC_RM57_MIDPOINTCAL _ANIOC(AN_RM57_FIRST + 5)
+
+/* Read back or override the module's offset correction value, the quantity
+ * the hardware adds to every conversion result. Both directions use the
+ * same signed convention as struct rm57_adc_calib_s.correction: the get
+ * sign extends ADCALR out of the module's resolution, and the set truncates
+ * back into it.
+ *
+ * IN: int32_t * (get) / int32_t (set)
+ */
+
+#define ANIOC_RM57_GET_OFFSET _ANIOC(AN_RM57_FIRST + 6)
+#define ANIOC_RM57_SET_OFFSET _ANIOC(AN_RM57_FIRST + 7)
+
+/* Run the input channel open/short self test.
+ * IN: struct rm57_adc_selftest_s *
+ */
+
+#define ANIOC_RM57_SELFTEST _ANIOC(AN_RM57_FIRST + 8)
+
+/* Configure one magnitude comparator.
+ * IN: const struct rm57_adc_magcomp_s *
+ */
+
+#define ANIOC_RM57_SET_MAGCOMP _ANIOC(AN_RM57_FIRST + 9)
+
+/* Load a free-order channel conversion sequence into this group's look-up
+ * table and enable the enhanced channel selection mode (ADC1 only).
+ * IN: const struct rm57_adc_chnseq_s *, or NULL for sequential mode.
+ */
+
+#define ANIOC_RM57_SET_CHNSEQ _ANIOC(AN_RM57_FIRST + 10)
+
+/* Access the module's ADEVT pin when it is used as a GPIO.
+ * IN: struct rm57_adc_evtpin_s *
+ */
+
+#define ANIOC_RM57_EVTPIN _ANIOC(AN_RM57_FIRST + 11)
+
+/* Convert one on-die temperature sensor, reporting raw and calibrated value.
+ * IN/OUT: struct rm57_adc_temp_s * (caller sets .sensor)
+ */
+
+#define ANIOC_RM57_GET_TEMP _ANIOC(AN_RM57_FIRST + 12)
+
+/* Self test verdicts, reported in struct rm57_adc_selftest_s.status */
+
+#define RM57_ADC_SELFTEST_OK 0 /* Channel behaves normally */
+#define RM57_ADC_SELFTEST_OPEN 1 /* Channel appears open */
+#define RM57_ADC_SELFTEST_SHORT_GND 2 /* Channel shorted to ground */
+#define RM57_ADC_SELFTEST_SHORT_PWR 3 /* Channel shorted to supply */
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+/* Runtime configuration of one conversion group */
+
+struct rm57_adc_grpcfg_s
+{
+ uint32_t chanmask; /* Channels to convert (bit n = AD<m>IN[n]) */
+ uint16_t acq; /* Sampling window: SW = acq + 2 ADCLK cycles */
+ uint16_t threshold; /* Results to accumulate before interrupting */
+ uint8_t trigsrc; /* ADC_TRIGSRC_* hardware trigger source */
+ bool hwtrig; /* True: hardware triggered, false: software */
+ bool rising; /* Trigger edge when hwtrig is set */
+ bool bothedges; /* Trigger on either edge when hwtrig is set */
+ bool continuous; /* Convert continuously rather than once */
+ bool freeze; /* Allow this group to be frozen by another group */
+ bool ovrwrite; /* Overwrite results memory on overrun */
+ bool dischargeen; /* Enable sample capacitor discharge */
+ uint8_t dischargecyc; /* Discharge duration in ADCLK cycles */
+};
+
+/* Raw calibration conversion results. The four entries correspond to the
+ * BRIDGE_EN/HILO combinations of TRM Table 22-2, in that order.
+ */
+
+struct rm57_adc_calib_s
+{
+ uint16_t raw[4]; /* Raw conversions of each reference voltage */
+ int16_t offset; /* Computed offset error (pre-negation) */
+ int16_t correction; /* Value written to ADCALR (2's complement) */
+};
+
+/* Self test of a single input channel. 'lo' and 'hi' are the conversions
+ * obtained with ADREFLO and ADREFHI driven onto the channel through the
+ * internal test resistor; 'status' summarises them.
+ */
+
+struct rm57_adc_selftest_s
+{
+ uint8_t channel; /* IN: Channel to test */
+ uint16_t lo; /* OUT: Conversion with ADREFLO applied */
+ uint16_t hi; /* OUT: Conversion with ADREFHI applied */
+ uint8_t status; /* OUT: RM57_ADC_SELFTEST_* */
+};
+
+/* One magnitude comparator. When 'usechannel' is set the monitored channel
+ * is compared against the last conversion of 'cmpchannel' instead of the
+ * fixed 'threshold'.
+ */
+
+struct rm57_adc_magcomp_s
+{
+ uint8_t index; /* Comparator to configure, 0-2 */
+ bool enable; /* False disables the comparator */
+ uint8_t channel; /* Channel whose result is monitored */
+ uint16_t threshold; /* Compare value */
+ bool greater; /* True: interrupt when result >= threshold */
+ bool usechannel; /* Compare against cmpchannel, not threshold */
+ uint8_t cmpchannel; /* Channel supplying the compare value */
+};
+
+/* A free-order channel conversion sequence for the enhanced channel
+ * selection mode. 'nentries' may not exceed RM57_ADC_LUT_NENTRIES.
+ */
+
+struct rm57_adc_chnseq_s
+{
+ uint8_t nentries; /* Number of LUT entries used */
+ uint8_t channel[RM57_ADC_LUT_NENTRIES]; /* Internal mux selection */
+ uint8_t extsel[RM57_ADC_LUT_NENTRIES]; /* External mux selection */
+};
+
+/* One reading from an on-die temperature sensor. 'millicel' is only
+ * meaningful when 'calibrated' is set; without usable factory calibration in
+ * OTP the driver reports the raw conversion and leaves the temperature zero
+ * rather than inventing one.
+ */
+
+struct rm57_adc_temp_s
+{
+ uint8_t sensor; /* IN: 0, 1 or 2 */
+ uint16_t raw; /* OUT: raw conversion result */
+ int32_t millicel; /* OUT: temperature in milli-Celsius */
+ bool calibrated; /* OUT: OTP calibration was usable */
+};
+
+/* ADEVT pin access. Setting 'output' configures the pin as an output and
+ * drives 'value'; otherwise the pin is an input and 'value' is updated with
+ * the level read back.
+ */
+
+struct rm57_adc_evtpin_s
+{
+ bool output; /* IN: Drive the pin rather than read it */
+ bool value; /* IN/OUT: Level to drive, or level read */
+ bool opendrain; /* IN: Enable open drain output */
+ bool pullen; /* IN: Enable the pull resistor (input only) */
+ bool pullup; /* IN: Pull up rather than down */
+};
+
+#endif /* __ARCH_ARM_INCLUDE_RM57_RM57_ADC_IOCTL_H */
diff --git a/arch/arm/include/rm57/rm57l843_irq.h b/arch/arm/include/rm57/rm57l843_irq.h
new file mode 100644
index 00000000000..4bb7764bbf6
--- /dev/null
+++ b/arch/arm/include/rm57/rm57l843_irq.h
@@ -0,0 +1,199 @@
+/****************************************************************************
+ * arch/arm/include/rm57/rm57l843_irq.h
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/* This file should never be included directly but, rather,
+ * only indirectly through nuttx/irq.h
+ */
+
+/* VIM channel -> peripheral request assignment is a fixed hardware
+ * property, extracted directly from TI's HALCoGen project file rather
+ * than assumed from TMS570 parity. The project's VIM_CHANNELx_MAPPING
+ * values confirm HALCoGen configured the default identity mapping
+ * (channel N carries request N) - if a future board re-maps channels
+ * via vimChannelMap(), this table describes the *request* identity, and
+ * the active *channel* routing must be re-derived from that call.
+ *
+ * Channel 127 has no dedicated request (always phantomInterrupt) and
+ * must not be used, mirroring the sibling TMS570_IRQ_NCHANNELS pattern.
+ */
+
+#ifndef __ARCH_ARM_INCLUDE_RM57_RM57L843_IRQ_H
+#define __ARCH_ARM_INCLUDE_RM57_RM57L843_IRQ_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Pre-processor Prototypes
+ ****************************************************************************/
+
+#define RM57_IRQ_NCHANNELS 127 /* The "phantom" vector is followed by 127
+ * real channels; channel 127 is reserved
+ * (always phantomInterrupt) */
+
+/* Default channel (=request) assignments, from RM57L_Contents.dil */
+
+#define RM57_REQ_ESMHIGH 0 /* ESM High level interrupt (FIQ) */
+#define RM57_REQ_RTICOMPARE0 2 /* RTI compare interrupt 0 */
+#define RM57_REQ_RTICOMPARE1 3 /* RTI compare interrupt 1 */
+#define RM57_REQ_RTICOMPARE2 4 /* RTI compare interrupt 2 */
+#define RM57_REQ_RTICOMPARE3 5 /* RTI compare interrupt 3 */
+#define RM57_REQ_RTIOVERFLOW0 6 /* RTI overflow interrupt 0 */
+#define RM57_REQ_RTIOVERFLOW1 7 /* RTI overflow interrupt 1 */
+#define RM57_REQ_RTITIMEBASE 8 /* RTI timebase interrupt */
+#define RM57_REQ_GIOHIGH 9 /* GIO high level interrupt */
+#define RM57_REQ_HET1HIGH 10 /* HET1 high level interrupt */
+#define RM57_REQ_MIBSPI1HIGH 12 /* MibSPI1 high level interrupt */
+#define RM57_REQ_LIN1HIGH 13 /* LIN1/SCI1 high level interrupt */
+#define RM57_REQ_ADC1GROUP0 14 /* ADC1 group 0 interrupt */
+#define RM57_REQ_ADC1GROUP1 15 /* ADC1 group 1 interrupt */
+#define RM57_REQ_CAN1HIGH 16 /* DCAN1 high level interrupt */
+#define RM57_REQ_SPI2HIGH 17 /* SPI2 high level interrupt */
+#define RM57_REQ_CRC 19 /* CRC interrupt */
+#define RM57_REQ_ESMLOW 20 /* ESM Low level interrupt */
+#define RM57_REQ_GIOLOW 23 /* GIO low level interrupt */
+#define RM57_REQ_HET1LOW 24 /* HET1 low level interrupt */
+#define RM57_REQ_MIBSPI1LOW 26 /* MibSPI1 low level interrupt */
+#define RM57_REQ_LIN1LOW 27 /* LIN1/SCI1 low level interrupt */
+#define RM57_REQ_ADC1GROUP2 28 /* ADC1 group 2 interrupt */
+#define RM57_REQ_CAN1LOW 29 /* DCAN1 low level interrupt */
+#define RM57_REQ_MIBSPI2LOW 30 /* MibSPI2 low level interrupt */
+#define RM57_REQ_ADC1MAGCOMP 31 /* MibADC1 magnitude compare */
+#define RM57_REQ_DMAFTCA 33 /* DMA FTCA interrupt */
+#define RM57_REQ_DMALFSA 34 /* DMA LFSA interrupt */
+#define RM57_REQ_CAN2HIGH 35 /* DCAN2 high level interrupt */
+#define RM57_REQ_MIBSPI3HIGH 37 /* MibSPI3 high level interrupt */
+#define RM57_REQ_MIBSPI3LOW 38 /* MibSPI3 low level interrupt */
+#define RM57_REQ_DMAHBCA 39 /* DMA HBCA interrupt */
+#define RM57_REQ_DMABTCA 40 /* DMA BTCA interrupt */
+#define RM57_REQ_CAN2LOW 42 /* DCAN2 low level interrupt */
+#define RM57_REQ_CAN1IF3 44 /* DCAN1 IF3 interrupt */
+#define RM57_REQ_CAN3HIGH 45 /* DCAN3 high level interrupt */
+#define RM57_REQ_CAN2IF3 46 /* DCAN2 IF3 interrupt */
+#define RM57_REQ_MIBSPI4HIGH 49 /* MibSPI4 high level interrupt */
+#define RM57_REQ_ADC2GROUP0 50 /* ADC2 group 0 interrupt */
+#define RM57_REQ_ADC2GROUP1 51 /* ADC2 group 1 interrupt */
+#define RM57_REQ_MIBSPI5HIGH 53 /* MibSPI5 high level interrupt */
+#define RM57_REQ_MIBSPI4LOW 54 /* MibSPI4 low level interrupt */
+#define RM57_REQ_CAN3LOW 55 /* DCAN3 low level interrupt */
+#define RM57_REQ_MIBSPI5LOW 56 /* MibSPI5 low level interrupt */
+#define RM57_REQ_ADC2GROUP2 57 /* ADC2 group 2 interrupt */
+#define RM57_REQ_ADC2MAGCOMP 59 /* MibADC2 magnitude compare */
+#define RM57_REQ_CAN3IF3 60 /* DCAN3 IF3 interrupt */
+#define RM57_REQ_HET2HIGH 63 /* HET2 high level interrupt */
+#define RM57_REQ_SCI3HIGH 64 /* SCI3 high level interrupt */
+#define RM57_REQ_I2C 66 /* I2C interrupt */
+#define RM57_REQ_HET2LOW 73 /* HET2 low level interrupt */
+
+/* Channel 74 pairs with RM57_REQ_SCI3HIGH (64) above - it is SCI3's low
+ * level interrupt (SCI3 has no LIN capability, hence "LIN-less" in the
+ * original HALCoGen project comment this was transcribed from; that
+ * phrasing does not fit SCI2/LIN2, which is a full dual-role module).
+ */
+#define RM57_REQ_SCI3LOW 74 /* SCI3 low level interrupt */
+
+/* Channels 76-79 are the four EMAC Control Module interrupt pulses
+ * (SPNS215 Table 6-39): C0_MISC_PULSE, C0_TX_PULSE, C0_THRESH_PULSE and
+ * C0_RX_PULSE, in that channel order. C0_MISC_PULSE carries STATPEND,
+ * HOSTPEND and both MDIO interrupts (LINKINT0, USERINT0); see
+ * hardware/rm57_ethernet.h for the EMAC_MACINVECTOR/MACEOIVECTOR decode.
+ */
+
+#define RM57_REQ_EMACMISC 76 /* EMAC C0_MISC_PULSE (stats/host/MDIO) */
+#define RM57_REQ_EMACTX 77 /* EMAC C0_TX_PULSE (Tx completion) */
+#define RM57_REQ_EMACTHRESH 78 /* EMAC C0_THRESH_PULSE (Rx flow threshold) */
+#define RM57_REQ_EMACRX 79 /* EMAC C0_RX_PULSE (Rx completion) */
+#define RM57_REQ_DCC1DONE 82 /* DCC1 done interrupt */
+#define RM57_REQ_DCC2DONE 83 /* DCC2 done interrupt */
+#define RM57_REQ_ETPWM1 90 /* ETPWM1 interrupt */
+#define RM57_REQ_ETPWM1TZ 91 /* ETPWM1 trip-zone interrupt */
+#define RM57_REQ_ETPWM2 92 /* ETPWM2 interrupt */
+#define RM57_REQ_ETPWM2TZ 93 /* ETPWM2 trip-zone interrupt */
+#define RM57_REQ_ETPWM3 94 /* ETPWM3 interrupt */
+#define RM57_REQ_ETPWM3TZ 95 /* ETPWM3 trip-zone interrupt */
+#define RM57_REQ_ETPWM4 96 /* ETPWM4 interrupt */
+#define RM57_REQ_ETPWM4TZ 97 /* ETPWM4 trip-zone interrupt */
+#define RM57_REQ_ETPWM5 98 /* ETPWM5 interrupt */
+#define RM57_REQ_ETPWM5TZ 99 /* ETPWM5 trip-zone interrupt */
+#define RM57_REQ_ETPWM6 100 /* ETPWM6 interrupt */
+#define RM57_REQ_ETPWM6TZ 101 /* ETPWM6 trip-zone interrupt */
+#define RM57_REQ_ETPWM7 102 /* ETPWM7 interrupt */
+#define RM57_REQ_ETPWM7TZ 103 /* ETPWM7 trip-zone interrupt */
+#define RM57_REQ_ECAP1 104 /* ECAP1 interrupt */
+#define RM57_REQ_ECAP2 105 /* ECAP2 interrupt */
+#define RM57_REQ_ECAP3 106 /* ECAP3 interrupt */
+#define RM57_REQ_ECAP4 107 /* ECAP4 interrupt */
+#define RM57_REQ_ECAP5 108 /* ECAP5 interrupt */
+#define RM57_REQ_ECAP6 109 /* ECAP6 interrupt */
+#define RM57_REQ_EQEP1 110 /* EQEP1 interrupt */
+#define RM57_REQ_EQEP2 111 /* EQEP2 interrupt */
+#define RM57_REQ_CAN4HIGH 113 /* DCAN4 high level interrupt */
+#define RM57_REQ_I2C2 114 /* I2C2 interrupt */
+#define RM57_REQ_LIN2HIGH 115 /* LIN2 high level interrupt */
+#define RM57_REQ_SCI4HIGH 116 /* SCI4 high level interrupt */
+#define RM57_REQ_CAN4LOW 117 /* DCAN4 low level interrupt */
+#define RM57_REQ_LIN2LOW 118 /* LIN2 low level interrupt */
+#define RM57_REQ_SCI4LOW 119 /* SCI4 low level interrupt */
+#define RM57_REQ_CAN4IF3 120 /* DCAN4 IF3 interrupt */
+#define RM57_REQ_CRC2 121 /* CRC2 interrupt */
+#define RM57_REQ_EPCFULL 124 /* EPC FIFO full interrupt */
+
+/* Second-level GIO pin interrupt demux, enabled by CONFIG_RM57_GIO_IRQ.
+ * RM57L843 has only 2 GIO ports (A, B), unlike TMS570's up to 4/8, so
+ * only GIOA0-7/GIOB0-7 are allocated here.
+ *
+ * These numbers start at RM57_IRQ_NCHANNELS (127), which is free because
+ * VIM channels 0-126 occupy IRQs 0-126 and channel 127 is reserved. That
+ * keeps the whole block inside NR_IRQS, which irq.h computes as
+ * RM57_IRQ_NCHANNELS + RM57_NGIO_IRQS. The sibling TMS570 header bases
+ * this block at NCHANNELS+1 instead, which pushes its last GIO IRQ one
+ * past NR_IRQS where irq_attach()/irq_dispatch() reject it.
+ */
+
+#ifdef CONFIG_RM57_GIO_IRQ
+# define RM57_IRQ_GIOA0 (RM57_IRQ_NCHANNELS+0)
+# define RM57_IRQ_GIOA1 (RM57_IRQ_NCHANNELS+1)
+# define RM57_IRQ_GIOA2 (RM57_IRQ_NCHANNELS+2)
+# define RM57_IRQ_GIOA3 (RM57_IRQ_NCHANNELS+3)
+# define RM57_IRQ_GIOA4 (RM57_IRQ_NCHANNELS+4)
+# define RM57_IRQ_GIOA5 (RM57_IRQ_NCHANNELS+5)
+# define RM57_IRQ_GIOA6 (RM57_IRQ_NCHANNELS+6)
+# define RM57_IRQ_GIOA7 (RM57_IRQ_NCHANNELS+7)
+
+# define RM57_IRQ_GIOB0 (RM57_IRQ_NCHANNELS+8)
+# define RM57_IRQ_GIOB1 (RM57_IRQ_NCHANNELS+9)
+# define RM57_IRQ_GIOB2 (RM57_IRQ_NCHANNELS+10)
+# define RM57_IRQ_GIOB3 (RM57_IRQ_NCHANNELS+11)
+# define RM57_IRQ_GIOB4 (RM57_IRQ_NCHANNELS+12)
+# define RM57_IRQ_GIOB5 (RM57_IRQ_NCHANNELS+13)
+# define RM57_IRQ_GIOB6 (RM57_IRQ_NCHANNELS+14)
+# define RM57_IRQ_GIOB7 (RM57_IRQ_NCHANNELS+15)
+
+# define RM57_NGIO_IRQS 16
+#else
+# define RM57_NGIO_IRQS 0
+#endif
+
+#endif /* __ARCH_ARM_INCLUDE_RM57_RM57L843_IRQ_H */
diff --git a/arch/arm/src/rm57/CMakeLists.txt b/arch/arm/src/rm57/CMakeLists.txt
new file mode 100644
index 00000000000..898a0209260
--- /dev/null
+++ b/arch/arm/src/rm57/CMakeLists.txt
@@ -0,0 +1,88 @@
+# ##############################################################################
+# arch/arm/src/rm57/CMakeLists.txt
+#
+# SPDX-License-Identifier: Apache-2.0
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more contributor
+# license agreements. See the NOTICE file distributed with this work for
+# additional information regarding copyright ownership. The ASF licenses this
+# file to you under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+#
+# ##############################################################################
+
+set(SRCS
+ rm57_boot.c
+ rm57_clockconfig.c
+ rm57_mpuinit.c
+ rm57_gio.c
+ rm57_gioirq.c
+ rm57_irq.c
+ rm57_lowputc.c
+ rm57_serial.c
+ rm57_esm.c
+ rm57_iomm.c
+ rm57_coreinit.S)
+
+if(CONFIG_RM57_SELFTEST)
+ list(APPEND SRCS rm57_selftest.c)
+ if(CONFIG_RM57_SELFTEST_PBIST_ROM)
+ list(APPEND SRCS rm57_errata.c)
+ endif()
+endif()
+
+if(NOT CONFIG_SCHED_TICKLESS)
+ list(APPEND SRCS rm57_timerisr.c)
+endif()
+
+if(CONFIG_RM57_DMA)
+ list(APPEND SRCS rm57_dma.c)
+endif()
+
+if(CONFIG_RM57_LIN)
+ list(APPEND SRCS rm57_lin.c)
+endif()
+
+if(CONFIG_RM57_MIBSPI)
+ list(APPEND SRCS rm57_mibspi.c)
+endif()
+
+if(CONFIG_RM57_I2C)
+ list(APPEND SRCS rm57_i2c.c)
+endif()
+
+if(CONFIG_RM57_ADC)
+ list(APPEND SRCS rm57_adc.c)
+ if(CONFIG_RM57_ADC_TEMPSENSOR)
+ list(APPEND SRCS rm57_adc_temp.c)
+ endif()
+endif()
+
+if(CONFIG_RM57_DCAN)
+ list(APPEND SRCS rm57_dcan.c)
+ if(CONFIG_CAN)
+ list(APPEND SRCS rm57_dcan_chardev.c)
+ endif()
+ if(CONFIG_NET_CAN)
+ list(APPEND SRCS rm57_dcan_sock.c)
+ endif()
+endif()
+
+if(CONFIG_RM57_EMAC)
+ list(APPEND SRCS rm57_ethernet.c rm57_mdio.c)
+endif()
+
+if(CONFIG_NET AND NOT CONFIG_NETDEV_LATEINIT)
+ list(APPEND SRCS rm57_netinitialize.c)
+endif()
+
+target_sources(arch PRIVATE ${SRCS})
diff --git a/arch/arm/src/rm57/Kconfig b/arch/arm/src/rm57/Kconfig
new file mode 100644
index 00000000000..53407d7f645
--- /dev/null
+++ b/arch/arm/src/rm57/Kconfig
@@ -0,0 +1,1873 @@
+#
+# For a description of the syntax of this configuration file,
+# see the file kconfig-language.txt in the NuttX tools repository.
+#
+
+if ARCH_CHIP_RM57
+
+comment "RM57 Configuration Options"
+
+# Chip Selection
+
+choice
+ prompt "TI Hercules RM57 Chip Selection"
+ default ARCH_CHIP_RM57L843
+
+config ARCH_CHIP_RM57L843
+ bool "TI RM57L843"
+ select ARCH_CORTEXR5
+ select ARCH_HAVE_FPU
+
+endchoice # TI Hercules RM57 Chip Selection
+
+menu "RM57 Peripheral Support"
+
+config RM57_SCI1
+ bool "Serial Communication Interface 1 (SCI1/LIN1, SCI-compatibility mode)"
+ default n
+ select SCI1_SERIALDRIVER
+ select ARCH_HAVE_SERIAL_TERMIOS
+
+config RM57_SCI2
+ bool "Serial Communication Interface 2 (SCI2/LIN2, SCI-compatibility mode)"
+ default n
+ select SCI2_SERIALDRIVER
+ select ARCH_HAVE_SERIAL_TERMIOS
+
+config RM57_SCI3
+ bool "Serial Communication Interface 3 (SCI3)"
+ default n
+ select SCI3_SERIALDRIVER
+ select ARCH_HAVE_SERIAL_TERMIOS
+
+config RM57_SCI4
+ bool "Serial Communication Interface 4 (SCI4)"
+ default n
+ select SCI4_SERIALDRIVER
+ select ARCH_HAVE_SERIAL_TERMIOS
+
+config RM57_DMA
+ bool "DMA controller (32-channel, 48 request lines)"
+ default n
+ ---help---
+ Enable the general-purpose DMA controller driver. Required by the
+ RM57_SCIn_RXDMA/TXDMA serial DMA options.
+
+config RM57_SCI1_RXDMA
+ bool "SCI1/LIN1 receive DMA"
+ default n
+ depends on RM57_SCI1 && RM57_DMA
+ select SERIAL_RXDMA
+
+config RM57_SCI1_TXDMA
+ bool "SCI1/LIN1 transmit DMA"
+ default n
+ depends on RM57_SCI1 && RM57_DMA
+ select SERIAL_TXDMA
+
+config RM57_SCI2_RXDMA
+ bool "SCI2/LIN2 receive DMA"
+ default n
+ depends on RM57_SCI2 && RM57_DMA
+ select SERIAL_RXDMA
+
+config RM57_SCI2_TXDMA
+ bool "SCI2/LIN2 transmit DMA"
+ default n
+ depends on RM57_SCI2 && RM57_DMA
+ select SERIAL_TXDMA
+
+config RM57_SCI3_RXDMA
+ bool "SCI3 receive DMA"
+ default n
+ depends on RM57_SCI3 && RM57_DMA
+ select SERIAL_RXDMA
+
+config RM57_SCI3_TXDMA
+ bool "SCI3 transmit DMA"
+ default n
+ depends on RM57_SCI3 && RM57_DMA
+ select SERIAL_TXDMA
+
+config RM57_SCI4_RXDMA
+ bool "SCI4 receive DMA"
+ default n
+ depends on RM57_SCI4 && RM57_DMA
+ select SERIAL_RXDMA
+
+config RM57_SCI4_TXDMA
+ bool "SCI4 transmit DMA"
+ default n
+ depends on RM57_SCI4 && RM57_DMA
+ select SERIAL_TXDMA
+
+config RM57_SCI2_LOOPBACK
+ bool "SCI2/LIN2 internal loopback (self test)"
+ default n
+ depends on RM57_SCI2 && !SCI2_SERIAL_CONSOLE
+ ---help---
+ Set SCIGCR1.LOOPBACK so the transmitter is tied to the receiver
+ inside the module (TRM 29.4 "self test"). Anything written to
+ the port comes straight back on its own receiver and the RX/TX
+ balls are ignored, which exercises the full TX and RX paths -
+ DMA included - without any external wiring or knowledge of the
+ board's header pinout. For bring-up and testing only.
+
+config RM57_SCI3_LOOPBACK
+ bool "SCI3 internal loopback (self test)"
+ default n
+ depends on RM57_SCI3 && !SCI3_SERIAL_CONSOLE
+ ---help---
+ See RM57_SCI2_LOOPBACK.
+
+config RM57_SCI4_LOOPBACK
+ bool "SCI4 internal loopback (self test)"
+ default n
+ depends on RM57_SCI4 && !SCI4_SERIAL_CONSOLE
+ ---help---
+ See RM57_SCI2_LOOPBACK.
+
+config RM57_LIN
+ bool "LIN 2.x driver scaffold (LIN1/LIN2 modules)"
+ default n
+ depends on EXPERIMENTAL
+ ---help---
+ Configuration and polled transfer foundation for LIN-mode
+ operation of the SCI1/LIN1 and SCI2/LIN2 dual-role modules (see
+ rm57_lin.h). Not integrated with the serial upper half, and not
+ a complete LIN protocol stack - see rm57_lin.h for what is and
+ is not implemented.
+
+ A LIN module cannot be used simultaneously in SCI mode
+ (RM57_SCI1/RM57_SCI2) and LIN mode; this is a runtime choice,
+ not enforced here, since e.g. SCI1 could run in SCI mode while
+ SCI2/LIN2 runs in LIN mode.
+
+config RM57_GIO_IRQ
+ bool "GIO pin interrupts"
+ default n
+ ---help---
+ Build in support for a second level of interrupt decoding for
+ GIO pins. Required for CONFIG_ARCH_IRQBUTTONS on this chip.
+
+config RM57_ESM_PANIC
+ bool "Panic on ESM error"
+ default n
+ depends on ARMV7R_DECODEFIQ
+ ---help---
+ Call PANIC() after reporting a latched ESM error instead of
+ clearing it and continuing. Leave this off while debugging so
+ that the channel report reaches the console and the system keeps
+ running.
+
+config RM57_SELFTEST
+ bool "Start-up diagnostics (CCM-R5F, STC, PBIST, eFuse, L2RAMW)"
+ default n
+ select ARMV7R_DECODEFIQ
+ ---help---
+ Run the device's safety diagnostics on every boot, before the OS
+ starts, and print the outcome on the console.
+
+ Several of the diagnostics deliberately raise an ESM error to
+ prove that it would be reported, which pulses the nERROR pin low
+ for the ESM low time on each boot.
+
+ This also builds in the ESM FIQ handler (ARMV7R_DECODEFIQ), so
+ that a lockstep compare error at run time - an ESM group2,
+ non-maskable error - is reported instead of leaving FIQ asserted.
+
+if RM57_SELFTEST
+
+config RM57_SELFTEST_HALT_ON_FAIL
+ bool "Halt if a diagnostic fails"
+ default y
+ ---help---
+ On a failed diagnostic, report it, drive nERROR low and stop.
+ Deselect only for bring-up: the system then carries on booting on
+ a device that has just shown itself to be faulty.
+
+config RM57_SELFTEST_CCM
+ bool "CCM-R5F self-test and error forcing"
+ default y
+ ---help---
+ Self-test, self-test error forcing and error forcing of the four
+ CCM-R5F diagnostics: CPU compare, VIM compare, checker CPU
+ inactivity and power domain inactivity. Skipped while a debugger
+ has halting debug enabled, because the CCM-R5F is then off.
+
+config RM57_SELFTEST_PBIST_ROM
+ bool "PBIST and STC ROM tests"
+ default n
+ ---help---
+ Apply the errata PBIST#4/STC#30 ROM initialization workaround and
+ then check the PBIST ROM and the STC ROMs with both triple-read
+ algorithms. Should be enabled whenever RM57_SELFTEST_STC is: on
+ revision A silicon the CPU self-test can hang without it.
+
+config RM57_SELFTEST_STC
+ bool "CPU logic BIST (STC1)"
+ default n
+ ---help---
+ Run the self-test controller's signature compare self-check and
+ then the CPU LBIST on both lockstep cores. Each of the two runs
+ ends in a CPU reset, so the boot code is entered three times.
+ Skipped while a debugger is attached.
+
+config RM57_SELFTEST_STC_INTERVALS
+ int "CPU logic BIST intervals"
+ default 125
+ range 2 125
+ depends on RM57_SELFTEST_STC
+ ---help---
+ Number of STC1 segment 0 test intervals to run, starting from
+ interval 0. All 125 give 95.5% coverage in about 2 ms at
+ STCCLK = 100 MHz; 40 give 90% in about 0.65 ms.
+
+config RM57_SELFTEST_EFUSE
+ bool "eFuse controller checks"
+ default n
+ ---help---
+ Check the outcome of the eFuse autoload and run the stuck-at-zero
+ test and the ECC logic self-test. Runs after a power-on reset
+ only.
+
+config RM57_SELFTEST_EFUSE_NO_NERROR
+ bool "eFuse stuck-at-zero test without nERROR"
+ default n
+ depends on RM57_SELFTEST_EFUSE
+ ---help---
+ Use the reduced stuck-at-zero test that leaves out the autoload
+ error (ESM group3) path and therefore does not pull nERROR low.
+
+config RM57_SELFTEST_L2RAM
+ bool "L2RAMW ECC and address decode diagnostics"
+ default n
+ ---help---
+ Exercise the L2RAMW's read and write SECDED blocks with one-bit
+ and two-bit errors, and its redundant address decode comparator,
+ using the module's built-in test stimulus. No RAM is modified.
+
+config RM57_SELFTEST_FORCE_FAIL
+ int "Force a diagnostic to fail (-1 = none)"
+ default -1
+ range -1 11
+ ---help---
+ Treat the diagnostic with this index (see RM57_ST_* in
+ rm57_selftest.h) as failed even though it passed. For testing
+ the failure path only.
+
+choice
+ prompt "Fault injection"
+ default RM57_SELFTEST_INJECT_NONE
+ ---help---
+ Deliberately create one real fault on every boot to show that the
+ corresponding diagnostic, and the response to it, work. Unlike
+ RM57_SELFTEST_FORCE_FAIL this exercises the detecting hardware.
+ For testing only: the board will not boot normally.
+
+config RM57_SELFTEST_INJECT_NONE
+ bool "None"
+
+config RM57_SELFTEST_INJECT_PBIST_ALGO
+ bool "PBIST: RAM algorithm on a ROM"
+ depends on RM57_SELFTEST_PBIST_ROM
+ ---help---
+ Expected: "SELFTEST FAIL: PBIST ROM step 000000f1", halt.
+
+config RM57_SELFTEST_INJECT_STC_TIMEOUT
+ bool "STC: impossible timeout on the CPU LBIST run"
+ depends on RM57_SELFTEST_STC
+ ---help---
+ Expected: "SELFTEST FAIL: STC CPU LBIST step 00000002" with the
+ timeout bit (bit 2) set in the second info word, halt.
+
+config RM57_SELFTEST_INJECT_EFUSE_SIGNATURE
+ bool "eFuse: wrong ECC self-test signature"
+ depends on RM57_SELFTEST_EFUSE
+ ---help---
+ Expected after a power-on reset: "SELFTEST FAIL: eFuse step
+ 00000003", halt.
+
+config RM57_SELFTEST_INJECT_CCM_MISMATCH
+ bool "CCM-R5F: real CPU compare mismatch, left pending"
+ depends on RM57_SELFTEST_CCM
+ ---help---
+ Inverts one of CPU1's compared signals through CCMPOLCNTRL.
+ Expected: all diagnostics pass, then the run-time ESM handler
+ reports "ESM: group 2 channel 2" and nERROR stays low.
+
+config RM57_SELFTEST_INJECT_L2RAM_2BIT
+ bool "L2RAMW: two-bit ECC error, left pending"
+ depends on RM57_SELFTEST_L2RAM
+ ---help---
+ Expected: all diagnostics pass, then the run-time ESM handler
+ reports "ESM: group 2 channel 7" and nERROR stays low.
+
+endchoice # Fault injection
+
+endif # RM57_SELFTEST
+
+config RM57_SERIAL_RXDMA_BUFFER_SIZE
+ int "RX DMA buffer size"
+ default 64
+ depends on RM57_SCI1_RXDMA || RM57_SCI2_RXDMA || RM57_SCI3_RXDMA || \
+ RM57_SCI4_RXDMA
+ ---help---
+ The DMA buffer size when using RX DMA. This buffer is used to
+ receive data on the SCI while waiting for the application to
+ claim it. Rounded up to a multiple of the 32-byte Cortex-R5
+ D-cache line size.
+
+config RM57_SERIAL_RXDMA_POLL
+ bool "Periodic RX DMA flush"
+ default y
+ depends on RM57_SCI1_RXDMA || RM57_SCI2_RXDMA || RM57_SCI3_RXDMA || \
+ RM57_SCI4_RXDMA
+ ---help---
+ RX DMA hands received bytes to the upper half only when the
+ DMA half/full interrupt fires, that is, after half of
+ RM57_SERIAL_RXDMA_BUFFER_SIZE bytes. The SCI has no idle-line
+ interrupt to signal the end of a shorter burst, so this option
+ dedicates RTI compare 1 to calling rm57_serial_dma_poll()
+ periodically, which bounds the added receive latency by the
+ poll period.
+
+ Leave this enabled unless every RX DMA port is used purely for
+ bulk transfers; without it, a short message sits in the ring
+ buffer until enough further bytes arrive, and an RX DMA console
+ is unusable interactively.
+
+config RM57_SERIAL_RXDMA_POLL_HZ
+ int "RX DMA flush frequency (Hz)"
+ default 1000
+ range 1 100000
+ depends on RM57_SERIAL_RXDMA_POLL
+ ---help---
+ How often the RX DMA rings are flushed, in Hz. The worst-case
+ added receive latency is one poll period; the cost is one short
+ interrupt at this rate, which checks one pointer per enabled
+ port and returns when nothing was received.
+
+config RM57_DCAN
+ bool
+ default n
+ ---help---
+ Hidden umbrella symbol selected by any RM57_DCANn instance;
+ pulls the shared DCAN core driver into the build.
+
+menuconfig RM57_DCAN1
+ bool "DCAN1 CAN controller"
+ default n
+ select RM57_DCAN
+
+if RM57_DCAN1
+
+choice
+ prompt "DCAN1 driver framework"
+ default RM57_DCAN1_CHARDRIVER
+
+config RM57_DCAN1_CHARDRIVER
+ bool "Character device driver (/dev/can<n>)"
+ select CAN
+ select CAN_TXREADY
+ select CAN_USE_RTR
+ select ARCH_HAVE_CAN_ERRORS
+
+config RM57_DCAN1_SOCKET
+ bool "SocketCAN network driver"
+ depends on NET_CAN
+ select NET_CAN_HAVE_ERRORS
+
+endchoice # DCAN1 driver framework
+
+config RM57_DCAN1_BAUD
+ int "DCAN1 initial bit rate"
+ default 500000
+ range 1000 1000000
+
+choice
+ prompt "DCAN1 RX path"
+ default RM57_DCAN1_RX_PIO
+
+config RM57_DCAN1_RX_PIO
+ bool "IF2 programmed I/O (interrupt per message)"
+
+config RM57_DCAN1_RX_IF3IRQ
+ bool "IF3 auto-update with IF3 interrupt"
+
+config RM57_DCAN1_RX_IF3DMA
+ bool "IF3 auto-update with DMA (EXPERIMENTAL)"
+ depends on RM57_DMA && EXPERIMENTAL
+
+endchoice # DCAN1 RX path
+
+endif # RM57_DCAN1
+
+menuconfig RM57_DCAN2
+ bool "DCAN2 CAN controller"
+ default n
+ select RM57_DCAN
+
+if RM57_DCAN2
+
+choice
+ prompt "DCAN2 driver framework"
+ default RM57_DCAN2_CHARDRIVER
+
+config RM57_DCAN2_CHARDRIVER
+ bool "Character device driver (/dev/can<n>)"
+ select CAN
+ select CAN_TXREADY
+ select CAN_USE_RTR
+ select ARCH_HAVE_CAN_ERRORS
+
+config RM57_DCAN2_SOCKET
+ bool "SocketCAN network driver"
+ depends on NET_CAN
+ select NET_CAN_HAVE_ERRORS
+
+endchoice # DCAN2 driver framework
+
+config RM57_DCAN2_BAUD
+ int "DCAN2 initial bit rate"
+ default 500000
+ range 1000 1000000
+
+choice
+ prompt "DCAN2 RX path"
+ default RM57_DCAN2_RX_PIO
+
+config RM57_DCAN2_RX_PIO
+ bool "IF2 programmed I/O (interrupt per message)"
+
+config RM57_DCAN2_RX_IF3IRQ
+ bool "IF3 auto-update with IF3 interrupt"
+
+config RM57_DCAN2_RX_IF3DMA
+ bool "IF3 auto-update with DMA (EXPERIMENTAL)"
+ depends on RM57_DMA && EXPERIMENTAL
+
+endchoice # DCAN2 RX path
+
+endif # RM57_DCAN2
+
+menuconfig RM57_DCAN3
+ bool "DCAN3 CAN controller"
+ default n
+ select RM57_DCAN
+
+if RM57_DCAN3
+
+choice
+ prompt "DCAN3 driver framework"
+ default RM57_DCAN3_CHARDRIVER
+
+config RM57_DCAN3_CHARDRIVER
+ bool "Character device driver (/dev/can<n>)"
+ select CAN
+ select CAN_TXREADY
+ select CAN_USE_RTR
+ select ARCH_HAVE_CAN_ERRORS
+
+config RM57_DCAN3_SOCKET
+ bool "SocketCAN network driver"
+ depends on NET_CAN
+ select NET_CAN_HAVE_ERRORS
+
+endchoice # DCAN3 driver framework
+
+config RM57_DCAN3_BAUD
+ int "DCAN3 initial bit rate"
+ default 500000
+ range 1000 1000000
+
+choice
+ prompt "DCAN3 RX path"
+ default RM57_DCAN3_RX_PIO
+
+config RM57_DCAN3_RX_PIO
+ bool "IF2 programmed I/O (interrupt per message)"
+
+config RM57_DCAN3_RX_IF3IRQ
+ bool "IF3 auto-update with IF3 interrupt"
+
+config RM57_DCAN3_RX_IF3DMA
+ bool "IF3 auto-update with DMA (EXPERIMENTAL)"
+ depends on RM57_DMA && EXPERIMENTAL
+
+endchoice # DCAN3 RX path
+
+endif # RM57_DCAN3
+
+menuconfig RM57_DCAN4
+ bool "DCAN4 CAN controller"
+ default n
+ select RM57_DCAN
+ ---help---
+ DCAN4 pins are shared with GIOB[2] (ball F2, CAN4 TX) and
+ GIOB[3] (ball W10, CAN4 RX). The board pinmux claims them for
+ CAN when this option is enabled.
+
+if RM57_DCAN4
+
+choice
+ prompt "DCAN4 driver framework"
+ default RM57_DCAN4_CHARDRIVER
+
+config RM57_DCAN4_CHARDRIVER
+ bool "Character device driver (/dev/can<n>)"
+ select CAN
+ select CAN_TXREADY
+ select CAN_USE_RTR
+ select ARCH_HAVE_CAN_ERRORS
+
+config RM57_DCAN4_SOCKET
+ bool "SocketCAN network driver"
+ depends on NET_CAN
+ select NET_CAN_HAVE_ERRORS
+
+endchoice # DCAN4 driver framework
+
+config RM57_DCAN4_BAUD
+ int "DCAN4 initial bit rate"
+ default 500000
+ range 1000 1000000
+
+choice
+ prompt "DCAN4 RX path"
+ default RM57_DCAN4_RX_PIO
+
+config RM57_DCAN4_RX_PIO
+ bool "IF2 programmed I/O (interrupt per message)"
+
+config RM57_DCAN4_RX_IF3IRQ
+ bool "IF3 auto-update with IF3 interrupt"
+
+config RM57_DCAN4_RX_IF3DMA
+ bool "IF3 auto-update with DMA (EXPERIMENTAL)"
+ depends on RM57_DMA && EXPERIMENTAL
+
+endchoice # DCAN4 RX path
+
+endif # RM57_DCAN4
+
+if RM57_DCAN
+
+config RM57_DCAN_TXFIFO_DEPTH
+ int "DCAN TX FIFO depth (mailboxes per instance)"
+ default 8
+ range 1 32
+ ---help---
+ Number of message objects reserved for transmission, taken
+ from the top of the 64-mailbox range so that RX filters keep
+ the (higher priority) low mailbox numbers.
+
+config RM57_DCAN_RXFIFO_DEPTH
+ int "DCAN RX FIFO depth (mailboxes per filter)"
+ default 8
+ range 1 32
+ ---help---
+ Number of message objects chained (EoB) into the receive FIFO
+ of each acceptance filter, including the default catch-all
+ filter installed when no user filter is active.
+
+config RM57_DCAN_NFILTERS_MAX
+ int "DCAN maximum concurrent acceptance filters"
+ default 4
+ range 1 8
+
+config RM57_DCAN_IF3_NFRAMES
+ int "DCAN IF3 DMA ring size (frames)"
+ default 16
+ range 2 64
+ depends on RM57_DCAN1_RX_IF3DMA || RM57_DCAN2_RX_IF3DMA || \
+ RM57_DCAN3_RX_IF3DMA || RM57_DCAN4_RX_IF3DMA
+
+config RM57_DCAN_SECDED
+ bool "DCAN message RAM SECDED (ECC)"
+ default y
+ ---help---
+ Keep the message RAM single-error-correction/double-error-
+ detection logic enabled (CTL.PMD). Disable only for
+ bring-up debugging; parity events are reported through the
+ CAN error reporting path when enabled.
+
+config RM57_DCAN_LOOPBACK
+ bool "DCAN internal loopback at setup (self-test)"
+ default n
+ ---help---
+ Enter internal loopback test mode (TEST.LBack) as part of
+ controller setup so the driver can be exercised without a
+ transceiver or bus. Frames are looped back internally; the
+ CAN_TX pin stays recessive. Can also be controlled at
+ runtime via CANIOC_SET_CONNMODES.
+
+endif # RM57_DCAN
+
+config RM57_MIBSPI
+ bool
+ default n
+ select ARCH_HAVE_SPI_BITORDER
+ ---help---
+ Hidden umbrella symbol selected by any RM57_MIBSPIn instance;
+ pulls the shared MibSPI driver into the build.
+
+config RM57_MIBSPI1
+ bool "MibSPI1 (SPI master)"
+ default n
+ select RM57_MIBSPI
+ select SPI
+ ---help---
+ Multi-buffered SPI module 1 as an SPI master. SPICLK, SIMO[0]
+ and SOMI[0] are dedicated balls (F18, F19, G18).
+
+config RM57_MIBSPI2
+ bool "MibSPI2 (SPI master)"
+ default n
+ select RM57_MIBSPI
+ select SPI
+ ---help---
+ Multi-buffered SPI module 2 as an SPI master. All of its
+ signals are alternate functions of N2HET2 balls, so the board
+ pin-mux table has to route them. Two chip selects only.
+
+config RM57_MIBSPI3
+ bool "MibSPI3 (SPI master)"
+ default n
+ select RM57_MIBSPI
+ select SPI
+ ---help---
+ Multi-buffered SPI module 3 as an SPI master. Its balls reset
+ to their MibSPI3 function.
+
+config RM57_MIBSPI4
+ bool "MibSPI4 (SPI master)"
+ default n
+ select RM57_MIBSPI
+ select SPI
+ ---help---
+ Multi-buffered SPI module 4 as an SPI master. All of its
+ signals are alternate functions of N2HET1 balls, so the board
+ pin-mux table has to route them.
+
+config RM57_MIBSPI5
+ bool "MibSPI5 (SPI master)"
+ default n
+ select RM57_MIBSPI
+ select SPI
+ ---help---
+ Multi-buffered SPI module 5 as an SPI master, on SIMO[0] and
+ SOMI[0] only; the parallel data lines are not used. Its balls
+ reset to their MibSPI5 function.
+
+config RM57_MIBSPI_MULTIBUF
+ bool
+ default n
+ ---help---
+ Hidden symbol selected by any RM57_MIBSPIn_MULTIBUF; pulls the
+ multi-buffer transfer path into the driver.
+
+config RM57_MIBSPI1_MULTIBUF
+ bool "MibSPI1 multi-buffer mode"
+ default n
+ depends on RM57_MIBSPI1
+ select RM57_MIBSPI_MULTIBUF
+ ---help---
+ Run MibSPI1 in multi-buffer mode instead of compatibility mode.
+ Transfers go through the module's buffer RAM in passes of up to
+ 255 words (extended 256-buffer mode), one interrupt per pass
+ instead of one register round-trip per word. The mode is fixed
+ at initialization: switching it re-initializes the buffer RAM.
+
+config RM57_MIBSPI2_MULTIBUF
+ bool "MibSPI2 multi-buffer mode"
+ default n
+ depends on RM57_MIBSPI2
+ select RM57_MIBSPI_MULTIBUF
+ ---help---
+ As RM57_MIBSPI1_MULTIBUF, in passes of up to 128 words.
+
+config RM57_MIBSPI3_MULTIBUF
+ bool "MibSPI3 multi-buffer mode"
+ default n
+ depends on RM57_MIBSPI3
+ select RM57_MIBSPI_MULTIBUF
+ ---help---
+ As RM57_MIBSPI1_MULTIBUF, in passes of up to 128 words.
+
+config RM57_MIBSPI4_MULTIBUF
+ bool "MibSPI4 multi-buffer mode"
+ default n
+ depends on RM57_MIBSPI4
+ select RM57_MIBSPI_MULTIBUF
+ ---help---
+ As RM57_MIBSPI1_MULTIBUF, in passes of up to 128 words.
+
+config RM57_MIBSPI5_MULTIBUF
+ bool "MibSPI5 multi-buffer mode"
+ default n
+ depends on RM57_MIBSPI5
+ select RM57_MIBSPI_MULTIBUF
+ ---help---
+ As RM57_MIBSPI1_MULTIBUF, in passes of up to 128 words.
+
+config RM57_MIBSPI_DMA
+ bool
+ default n
+ select RM57_DMA
+ ---help---
+ Hidden symbol selected by any RM57_MIBSPIn_DMA; pulls the
+ compatibility-mode DMA path into the driver.
+
+config RM57_MIBSPI1_DMA
+ bool "MibSPI1 DMA (compatibility mode)"
+ default n
+ depends on RM57_MIBSPI1 && !RM57_MIBSPI1_MULTIBUF
+ select RM57_MIBSPI_DMA
+ ---help---
+ Move compatibility-mode transfers of RM57_MIBSPI_DMATHRESHOLD
+ words or more by DMA, on request lines 1 (TX) and 0 (RX),
+ instead of polling every word. The caller sleeps until the
+ receive channel completes.
+
+config RM57_MIBSPI2_DMA
+ bool "MibSPI2 DMA (compatibility mode)"
+ default n
+ depends on RM57_MIBSPI2 && !RM57_MIBSPI2_MULTIBUF
+ select RM57_MIBSPI_DMA
+ ---help---
+ As RM57_MIBSPI1_DMA, on request lines 3 (TX) and 2 (RX).
+
+config RM57_MIBSPI3_DMA
+ bool "MibSPI3 DMA (compatibility mode)"
+ default n
+ depends on RM57_MIBSPI3 && !RM57_MIBSPI3_MULTIBUF
+ select RM57_MIBSPI_DMA
+ ---help---
+ As RM57_MIBSPI1_DMA, on request lines 15 (TX) and 14 (RX).
+ Line 14 is shared with the MibADC2 event trigger DMA request;
+ the two cannot be used together.
+
+config RM57_MIBSPI_DMATHRESHOLD
+ int "MibSPI DMA threshold (words)"
+ default 16
+ depends on RM57_MIBSPI_DMA
+ ---help---
+ Shorter transfers are polled: setting up two channels and
+ sleeping costs more than the transfer itself.
+
+config RM57_MIBSPI_DMABUFSIZE
+ int "MibSPI DMA bounce buffer size (words)"
+ default 256
+ range 16 8176
+ depends on RM57_MIBSPI_DMA
+ ---help---
+ DMA goes through a cache-line-aligned transmit and receive
+ buffer of this many 16-bit words per module, so that the
+ caller's buffers need no particular alignment. Longer
+ transfers are split into blocks of this size.
+
+config RM57_MIBSPI_LOOPBACK
+ bool "MibSPI internal loopback (self-test)"
+ default n
+ depends on RM57_MIBSPI
+ ---help---
+ Set SPIGCR1.LOOPBACK on every enabled MibSPI module: transmit
+ data is fed back to the receiver inside the module, SPICLK
+ stays at its idle level and nothing reaches the pins. Lets the
+ driver be exercised with nothing connected - the
+ RM57_DCAN_LOOPBACK equivalent for SPI.
+
+config RM57_I2C
+ bool
+ default n
+ select I2C
+ select ARCH_HAVE_I2CRESET
+ ---help---
+ Hidden umbrella symbol selected by any RM57_I2Cn instance;
+ pulls the shared I2C master driver into the build.
+
+config RM57_I2C1
+ bool "I2C1 (I2C master)"
+ default n
+ select RM57_I2C
+ ---help---
+ I2C module 1 as an interrupt-driven master. SDA and SCL are
+ alternate functions of balls B2 and C3, which reset to
+ MIBSPI3NCS[2] and MIBSPI3NCS[3]; the board pin-mux table has
+ to route them, and MibSPI3 loses those two chip selects.
+
+config RM57_I2C2
+ bool "I2C2 (I2C master)"
+ default n
+ select RM57_I2C
+ ---help---
+ I2C module 2 as an interrupt-driven master. SDA and SCL are
+ alternate functions of balls G17 and G16, which reset to
+ MIBSPI5SIMO[3] and MIBSPI5SOMI[3].
+
+config RM57_I2C_TIMEOUT_MS
+ int "I2C transfer timeout slack (ms)"
+ default 20
+ depends on RM57_I2C
+ ---help---
+ Added to four times the nominal duration of every transfer
+ segment before it is abandoned and the module reset. Also
+ bounds how long a transfer waits for the bus to go idle.
+ Raise it for slaves that stretch the clock for long.
+
+config RM57_I2C_LOOPBACK
+ bool "I2C digital loopback (self-test)"
+ default n
+ depends on RM57_I2C
+ ---help---
+ Let the board run every enabled I2C module through its
+ digital loopback mode (I2CMDR.DLB) at start-up: the module
+ addresses itself, so master-transmit transfers complete and
+ the bytes come back through the receive register with
+ nothing connected to the bus. Only the transmit path is
+ covered; master receive needs a real slave.
+
+config RM57_ADC
+ bool
+ default n
+ ---help---
+ Hidden umbrella symbol selected by any RM57_ADCn instance;
+ pulls the shared MibADC driver into the build.
+
+config RM57_ADC_HAVE_DMA
+ bool
+ default n
+ ---help---
+ Hidden symbol selected by any conversion group configured to
+ move its results with the DMA controller.
+
+menuconfig RM57_ADC1
+ bool "MibADC1 (32 channels)"
+ default n
+ select RM57_ADC
+ select ADC
+ select ANALOG
+ ---help---
+ TI MibADC module 1, a 10/12-bit successive approximation
+ converter with 32 analog inputs and three independent
+ conversion groups.
+
+if RM57_ADC1
+
+choice
+ prompt "ADC1 resolution"
+ default RM57_ADC1_12BIT
+ ---help---
+ Resolution of the converter core. This is a module-wide
+ setting: all three conversion groups share it.
+
+config RM57_ADC1_12BIT
+ bool "12-bit"
+
+config RM57_ADC1_10BIT
+ bool "10-bit"
+
+endchoice # ADC1 resolution
+
+config RM57_ADC1_CLOCK
+ int "ADC1 conversion clock (Hz)"
+ default 9375000
+ range 2400000 30000000
+ ---help---
+ Target ADCLK frequency. The prescaler is computed from
+ BOARD_VCLK_FREQUENCY as ADCLK = VCLK / (PS + 1) and rounded so
+ the result never exceeds this value. SPNS215 specifies
+ tc(ADCLK) >= 33ns, i.e. an ADCLK ceiling of 30MHz, which is
+ checked at compile time.
+
+menuconfig RM57_ADC1_EV
+ bool "ADC1 Event group"
+ default n
+ ---help---
+ Expose the ADC1 Event group as its own /dev/adcN character device.
+ The group has an independent channel selection, trigger source,
+ sampling window, results FIFO and interrupt (VIM channel
+ RM57_REQ_ADC1GROUP0).
+
+if RM57_ADC1_EV
+
+config RM57_ADC1_EV_CHANMASK
+ hex "ADC1 Event group channel mask"
+ default 0x1
+ ---help---
+ Bit mask of the analog inputs converted by this group; bit n
+ selects AD1IN[n]. In the default sequential mode the selected
+ channels are converted in ascending channel number.
+
+config RM57_ADC1_EV_BUFS
+ int "ADC1 Event group result buffers"
+ default 16
+ range 0 64
+ ---help---
+ Words of the module's 64-word results RAM reserved for this
+ group. The Event group and Group1 counts must be even because
+ ADBNDCR allocates the memory in pairs, and the three groups of
+ one module must not ask for more than 64 words in total. Both
+ rules are checked at compile time.
+
+config RM57_ADC1_EV_THRESHOLD
+ int "ADC1 Event group interrupt threshold"
+ default 8
+ range 1 511
+ ---help---
+ How many conversion results accumulate before the group raises
+ its threshold interrupt. Larger values reduce the interrupt
+ rate but need a correspondingly larger result buffer count.
+
+config RM57_ADC1_EV_ACQ
+ int "ADC1 Event group acquisition time"
+ default 8
+ range 1 4095
+ ---help---
+ Sampling window in ADCLK cycles minus two: SW = ACQ + 2, and the
+ hardware requires SW >= 3. The input impedance sets the real
+ minimum - see the sample and hold timings in SPNS215. When both
+ modules convert a shared channel their windows must either match
+ exactly or not overlap at all (TRM section 22.1).
+
+config RM57_ADC1_EV_CONTINUOUS
+ bool "ADC1 Event group continuous conversion"
+ default n
+ ---help---
+ Convert the selected channels continuously instead of once per
+ trigger. Continuous groups report results through the threshold
+ interrupt; single-shot groups use the conversion end interrupt.
+
+config RM57_ADC1_EV_FREEZE
+ bool "ADC1 Event group freeze enable"
+ default n
+ ---help---
+ Allow this group's conversion sequence to be suspended while
+ another group of the same module is serviced, resuming from
+ where it stopped afterwards.
+
+config RM57_ADC1_EV_OVRWRITE
+ bool "ADC1 Event group overwrite on overrun"
+ default n
+ ---help---
+ Let the ADC overwrite the oldest results when this group's
+ memory fills up. Without it the group stalls until the
+ application has read the memory out.
+
+# The Event group has no hardware trigger enable bit - bit 3 of ADEVMODECR
+# is reserved, where Group1 and Group2 have HW_TRIG - because it is always
+# started by its trigger source. Only the source and its edge are
+# selectable.
+
+config RM57_ADC1_EV_TRIGSRC
+ int "ADC1 Event group trigger source"
+ default 0
+ range 0 7
+ ---help---
+ Hardware trigger source: 0 = AD1EVT pin, 1 = N2HET1[8],
+ 2 = N2HET1[10], 3 = RTI compare 0, 4 = N2HET1[12],
+ 5 = N2HET1[14], 6 = GIOB[0], 7 = GIOB[1]. A second set of
+ sources is reachable through the ALT_ADC_TRIGGER pin mux
+ control; see SPNS215.
+
+config RM57_ADC1_EV_RISING
+ bool "ADC1 Event group trigger on rising edge"
+ default y
+ ---help---
+ Trigger on the low-to-high transition of the selected source
+ rather than the high-to-low transition.
+
+config RM57_ADC1_EV_DMA
+ bool "ADC1 Event group DMA result transfer"
+ default n
+ depends on RM57_DMA
+ select RM57_ADC_HAVE_DMA
+ ---help---
+ Move conversion results out of the group's FIFO with the DMA
+ controller (request line DMA_REQ_MIBADC1_EVT) instead of reading
+ them in the interrupt handler, and deliver them to the upper
+ half in batches.
+
+config RM57_ADC1_EV_DMA_NSAMPLES
+ int "ADC1 Event group DMA samples per transfer"
+ default 16
+ range 1 256
+ depends on RM57_ADC1_EV_DMA
+ ---help---
+ Results delivered per DMA callback. The landing buffer holds
+ two of these so the ADC can fill one half while the other is
+ being handed to the upper half. Two constraints are checked
+ at compile time: it must not exceed
+ RM57_ADC_DMA_MAXSAMPLES, which sizes the scratch arrays the
+ callback puts on the interrupt stack, and it must be a
+ multiple of eight so each half of the ring is a whole number
+ of D-cache lines.
+
+endif # RM57_ADC1_EV
+
+menuconfig RM57_ADC1_G1
+ bool "ADC1 Group1"
+ default n
+ ---help---
+ Expose the ADC1 Group1 as its own /dev/adcN character device.
+ The group has an independent channel selection, trigger source,
+ sampling window, results FIFO and interrupt (VIM channel
+ RM57_REQ_ADC1GROUP1).
+
+if RM57_ADC1_G1
+
+config RM57_ADC1_G1_CHANMASK
+ hex "ADC1 Group1 channel mask"
+ default 0x1
+ ---help---
+ Bit mask of the analog inputs converted by this group; bit n
+ selects AD1IN[n]. In the default sequential mode the selected
+ channels are converted in ascending channel number.
+
+config RM57_ADC1_G1_BUFS
+ int "ADC1 Group1 result buffers"
+ default 16
+ range 0 64
+ ---help---
+ Words of the module's 64-word results RAM reserved for this
+ group. The Event group and Group1 counts must be even because
+ ADBNDCR allocates the memory in pairs, and the three groups of
+ one module must not ask for more than 64 words in total. Both
+ rules are checked at compile time.
+
+config RM57_ADC1_G1_THRESHOLD
+ int "ADC1 Group1 interrupt threshold"
+ default 8
+ range 1 511
+ ---help---
+ How many conversion results accumulate before the group raises
+ its threshold interrupt. Larger values reduce the interrupt
+ rate but need a correspondingly larger result buffer count.
+
+config RM57_ADC1_G1_ACQ
+ int "ADC1 Group1 acquisition time"
+ default 8
+ range 1 4095
+ ---help---
+ Sampling window in ADCLK cycles minus two: SW = ACQ + 2, and the
+ hardware requires SW >= 3. The input impedance sets the real
+ minimum - see the sample and hold timings in SPNS215. When both
+ modules convert a shared channel their windows must either match
+ exactly or not overlap at all (TRM section 22.1).
+
+config RM57_ADC1_G1_CONTINUOUS
+ bool "ADC1 Group1 continuous conversion"
+ default n
+ ---help---
+ Convert the selected channels continuously instead of once per
+ trigger. Continuous groups report results through the threshold
+ interrupt; single-shot groups use the conversion end interrupt.
+
+config RM57_ADC1_G1_FREEZE
+ bool "ADC1 Group1 freeze enable"
+ default n
+ ---help---
+ Allow this group's conversion sequence to be suspended while
+ another group of the same module is serviced, resuming from
+ where it stopped afterwards.
+
+config RM57_ADC1_G1_OVRWRITE
+ bool "ADC1 Group1 overwrite on overrun"
+ default n
+ ---help---
+ Let the ADC overwrite the oldest results when this group's
+ memory fills up. Without it the group stalls until the
+ application has read the memory out.
+
+config RM57_ADC1_G1_HWTRIG
+ bool "ADC1 Group1 hardware triggered"
+ default n
+ ---help---
+ Start conversions from a hardware event rather than from a write
+ to the channel select register.
+
+config RM57_ADC1_G1_TRIGSRC
+ int "ADC1 Group1 trigger source"
+ default 0
+ range 0 7
+ depends on RM57_ADC1_G1_HWTRIG
+ ---help---
+ Hardware trigger source: 0 = AD1EVT pin, 1 = N2HET1[8],
+ 2 = N2HET1[10], 3 = RTI compare 0, 4 = N2HET1[12],
+ 5 = N2HET1[14], 6 = GIOB[0], 7 = GIOB[1]. A second set of
+ sources is reachable through the ALT_ADC_TRIGGER pin mux
+ control; see SPNS215.
+
+config RM57_ADC1_G1_RISING
+ bool "ADC1 Group1 trigger on rising edge"
+ default y
+ depends on RM57_ADC1_G1_HWTRIG
+ ---help---
+ Trigger on the low-to-high transition of the selected source
+ rather than the high-to-low transition.
+
+config RM57_ADC1_G1_DMA
+ bool "ADC1 Group1 DMA result transfer"
+ default n
+ depends on RM57_DMA
+ select RM57_ADC_HAVE_DMA
+ ---help---
+ Move conversion results out of the group's FIFO with the DMA
+ controller (request line DMA_REQ_MIBADC1_G1) instead of reading
+ them in the interrupt handler, and deliver them to the upper
+ half in batches.
+
+config RM57_ADC1_G1_DMA_NSAMPLES
+ int "ADC1 Group1 DMA samples per transfer"
+ default 16
+ range 1 256
+ depends on RM57_ADC1_G1_DMA
+ ---help---
+ Results delivered per DMA callback. The landing buffer holds
+ two of these so the ADC can fill one half while the other is
+ being handed to the upper half. Two constraints are checked
+ at compile time: it must not exceed
+ RM57_ADC_DMA_MAXSAMPLES, which sizes the scratch arrays the
+ callback puts on the interrupt stack, and it must be a
+ multiple of eight so each half of the ring is a whole number
+ of D-cache lines.
+
+endif # RM57_ADC1_G1
+
+menuconfig RM57_ADC1_G2
+ bool "ADC1 Group2"
+ default n
+ ---help---
+ Expose the ADC1 Group2 as its own /dev/adcN character device.
+ The group has an independent channel selection, trigger source,
+ sampling window, results FIFO and interrupt (VIM channel
+ RM57_REQ_ADC1GROUP2).
+
+if RM57_ADC1_G2
+
+config RM57_ADC1_G2_CHANMASK
+ hex "ADC1 Group2 channel mask"
+ default 0x1
+ ---help---
+ Bit mask of the analog inputs converted by this group; bit n
+ selects AD1IN[n]. In the default sequential mode the selected
+ channels are converted in ascending channel number.
+
+config RM57_ADC1_G2_BUFS
+ int "ADC1 Group2 result buffers"
+ default 16
+ range 0 64
+ ---help---
+ Words of the module's 64-word results RAM reserved for this
+ group. The Event group and Group1 counts must be even because
+ ADBNDCR allocates the memory in pairs, and the three groups of
+ one module must not ask for more than 64 words in total. Both
+ rules are checked at compile time.
+
+config RM57_ADC1_G2_THRESHOLD
+ int "ADC1 Group2 interrupt threshold"
+ default 8
+ range 1 511
+ ---help---
+ How many conversion results accumulate before the group raises
+ its threshold interrupt. Larger values reduce the interrupt
+ rate but need a correspondingly larger result buffer count.
+
+config RM57_ADC1_G2_ACQ
+ int "ADC1 Group2 acquisition time"
+ default 8
+ range 1 4095
+ ---help---
+ Sampling window in ADCLK cycles minus two: SW = ACQ + 2, and the
+ hardware requires SW >= 3. The input impedance sets the real
+ minimum - see the sample and hold timings in SPNS215. When both
+ modules convert a shared channel their windows must either match
+ exactly or not overlap at all (TRM section 22.1).
+
+config RM57_ADC1_G2_CONTINUOUS
+ bool "ADC1 Group2 continuous conversion"
+ default n
+ ---help---
+ Convert the selected channels continuously instead of once per
+ trigger. Continuous groups report results through the threshold
+ interrupt; single-shot groups use the conversion end interrupt.
+
+config RM57_ADC1_G2_FREEZE
+ bool "ADC1 Group2 freeze enable"
+ default n
+ ---help---
+ Allow this group's conversion sequence to be suspended while
+ another group of the same module is serviced, resuming from
+ where it stopped afterwards.
+
+config RM57_ADC1_G2_OVRWRITE
+ bool "ADC1 Group2 overwrite on overrun"
+ default n
+ ---help---
+ Let the ADC overwrite the oldest results when this group's
+ memory fills up. Without it the group stalls until the
+ application has read the memory out.
+
+config RM57_ADC1_G2_HWTRIG
+ bool "ADC1 Group2 hardware triggered"
+ default n
+ ---help---
+ Start conversions from a hardware event rather than from a write
+ to the channel select register.
+
+config RM57_ADC1_G2_TRIGSRC
+ int "ADC1 Group2 trigger source"
+ default 0
+ range 0 7
+ depends on RM57_ADC1_G2_HWTRIG
+ ---help---
+ Hardware trigger source: 0 = AD1EVT pin, 1 = N2HET1[8],
+ 2 = N2HET1[10], 3 = RTI compare 0, 4 = N2HET1[12],
+ 5 = N2HET1[14], 6 = GIOB[0], 7 = GIOB[1]. A second set of
+ sources is reachable through the ALT_ADC_TRIGGER pin mux
+ control; see SPNS215.
+
+config RM57_ADC1_G2_RISING
+ bool "ADC1 Group2 trigger on rising edge"
+ default y
+ depends on RM57_ADC1_G2_HWTRIG
+ ---help---
+ Trigger on the low-to-high transition of the selected source
+ rather than the high-to-low transition.
+
+config RM57_ADC1_G2_DMA
+ bool "ADC1 Group2 DMA result transfer"
+ default n
+ depends on RM57_DMA
+ select RM57_ADC_HAVE_DMA
+ ---help---
+ Move conversion results out of the group's FIFO with the DMA
+ controller (request line DMA_REQ_MIBADC1_G2) instead of reading
+ them in the interrupt handler, and deliver them to the upper
+ half in batches.
+
+config RM57_ADC1_G2_DMA_NSAMPLES
+ int "ADC1 Group2 DMA samples per transfer"
+ default 16
+ range 1 256
+ depends on RM57_ADC1_G2_DMA
+ ---help---
+ Results delivered per DMA callback. The landing buffer holds
+ two of these so the ADC can fill one half while the other is
+ being handed to the upper half. Two constraints are checked
+ at compile time: it must not exceed
+ RM57_ADC_DMA_MAXSAMPLES, which sizes the scratch arrays the
+ callback puts on the interrupt stack, and it must be a
+ multiple of eight so each half of the ring is a whole number
+ of D-cache lines.
+
+endif # RM57_ADC1_G2
+endif # RM57_ADC1
+
+menuconfig RM57_ADC2
+ bool "MibADC2 (25 channels)"
+ default n
+ select RM57_ADC
+ select ADC
+ select ANALOG
+ ---help---
+ TI MibADC module 2, a 10/12-bit successive approximation
+ converter with 25 analog inputs and three independent
+ conversion groups.
+ ADC2 shares 16 of its inputs with ADC1; when both modules
+ convert a shared channel their sampling windows must either
+ match exactly or not overlap (TRM SPNU562A section 22.1).
+
+if RM57_ADC2
+
+choice
+ prompt "ADC2 resolution"
+ default RM57_ADC2_12BIT
+ ---help---
+ Resolution of the converter core. This is a module-wide
+ setting: all three conversion groups share it.
+
+config RM57_ADC2_12BIT
+ bool "12-bit"
+
+config RM57_ADC2_10BIT
+ bool "10-bit"
+
+endchoice # ADC2 resolution
+
+config RM57_ADC2_CLOCK
+ int "ADC2 conversion clock (Hz)"
+ default 9375000
+ range 2400000 30000000
+ ---help---
+ Target ADCLK frequency. The prescaler is computed from
+ BOARD_VCLK_FREQUENCY as ADCLK = VCLK / (PS + 1) and rounded so
+ the result never exceeds this value. SPNS215 specifies
+ tc(ADCLK) >= 33ns, i.e. an ADCLK ceiling of 30MHz, which is
+ checked at compile time.
+
+menuconfig RM57_ADC2_EV
+ bool "ADC2 Event group"
+ default n
+ ---help---
+ Expose the ADC2 Event group as its own /dev/adcN character device.
+ The group has an independent channel selection, trigger source,
+ sampling window, results FIFO and interrupt (VIM channel
+ RM57_REQ_ADC2GROUP0).
+
+if RM57_ADC2_EV
+
+config RM57_ADC2_EV_CHANMASK
+ hex "ADC2 Event group channel mask"
+ default 0x1
+ ---help---
+ Bit mask of the analog inputs converted by this group; bit n
+ selects AD2IN[n]. In the default sequential mode the selected
+ channels are converted in ascending channel number.
+
+config RM57_ADC2_EV_BUFS
+ int "ADC2 Event group result buffers"
+ default 16
+ range 0 64
+ ---help---
+ Words of the module's 64-word results RAM reserved for this
+ group. The Event group and Group1 counts must be even because
+ ADBNDCR allocates the memory in pairs, and the three groups of
+ one module must not ask for more than 64 words in total. Both
+ rules are checked at compile time.
+
+config RM57_ADC2_EV_THRESHOLD
+ int "ADC2 Event group interrupt threshold"
+ default 8
+ range 1 511
+ ---help---
+ How many conversion results accumulate before the group raises
+ its threshold interrupt. Larger values reduce the interrupt
+ rate but need a correspondingly larger result buffer count.
+
+config RM57_ADC2_EV_ACQ
+ int "ADC2 Event group acquisition time"
+ default 8
+ range 1 4095
+ ---help---
+ Sampling window in ADCLK cycles minus two: SW = ACQ + 2, and the
+ hardware requires SW >= 3. The input impedance sets the real
+ minimum - see the sample and hold timings in SPNS215. When both
+ modules convert a shared channel their windows must either match
+ exactly or not overlap at all (TRM section 22.1).
+
+config RM57_ADC2_EV_CONTINUOUS
+ bool "ADC2 Event group continuous conversion"
+ default n
+ ---help---
+ Convert the selected channels continuously instead of once per
+ trigger. Continuous groups report results through the threshold
+ interrupt; single-shot groups use the conversion end interrupt.
+
+config RM57_ADC2_EV_FREEZE
+ bool "ADC2 Event group freeze enable"
+ default n
+ ---help---
+ Allow this group's conversion sequence to be suspended while
+ another group of the same module is serviced, resuming from
+ where it stopped afterwards.
+
+config RM57_ADC2_EV_OVRWRITE
+ bool "ADC2 Event group overwrite on overrun"
+ default n
+ ---help---
+ Let the ADC overwrite the oldest results when this group's
+ memory fills up. Without it the group stalls until the
+ application has read the memory out.
+
+# The Event group has no hardware trigger enable bit - bit 3 of ADEVMODECR
+# is reserved, where Group1 and Group2 have HW_TRIG - because it is always
+# started by its trigger source. Only the source and its edge are
+# selectable.
+
+config RM57_ADC2_EV_TRIGSRC
+ int "ADC2 Event group trigger source"
+ default 0
+ range 0 7
+ ---help---
+ Hardware trigger source: 0 = AD2EVT pin, 1 = N2HET1[8],
+ 2 = N2HET1[10], 3 = RTI compare 0, 4 = N2HET1[12],
+ 5 = N2HET1[14], 6 = GIOB[0], 7 = GIOB[1]. A second set of
+ sources is reachable through the ALT_ADC_TRIGGER pin mux
+ control; see SPNS215.
+
+config RM57_ADC2_EV_RISING
+ bool "ADC2 Event group trigger on rising edge"
+ default y
+ ---help---
+ Trigger on the low-to-high transition of the selected source
+ rather than the high-to-low transition.
+
+# ADC2's DMA request lines are alternate functions shared with MibSPI1 and
+# MibSPI3 (lines 14, 16 and 17), so selecting them needs the system module's
+# DMA request source mux to be reprogrammed. That is not implemented, and
+# ADC2 therefore has no DMA option.
+
+endif # RM57_ADC2_EV
+
+menuconfig RM57_ADC2_G1
+ bool "ADC2 Group1"
+ default n
+ ---help---
+ Expose the ADC2 Group1 as its own /dev/adcN character device.
+ The group has an independent channel selection, trigger source,
+ sampling window, results FIFO and interrupt (VIM channel
+ RM57_REQ_ADC2GROUP1).
+
+if RM57_ADC2_G1
+
+config RM57_ADC2_G1_CHANMASK
+ hex "ADC2 Group1 channel mask"
+ default 0x1
+ ---help---
+ Bit mask of the analog inputs converted by this group; bit n
+ selects AD2IN[n]. In the default sequential mode the selected
+ channels are converted in ascending channel number.
+
+config RM57_ADC2_G1_BUFS
+ int "ADC2 Group1 result buffers"
+ default 16
+ range 0 64
+ ---help---
+ Words of the module's 64-word results RAM reserved for this
+ group. The Event group and Group1 counts must be even because
+ ADBNDCR allocates the memory in pairs, and the three groups of
+ one module must not ask for more than 64 words in total. Both
+ rules are checked at compile time.
+
+config RM57_ADC2_G1_THRESHOLD
+ int "ADC2 Group1 interrupt threshold"
+ default 8
+ range 1 511
+ ---help---
+ How many conversion results accumulate before the group raises
+ its threshold interrupt. Larger values reduce the interrupt
+ rate but need a correspondingly larger result buffer count.
+
+config RM57_ADC2_G1_ACQ
+ int "ADC2 Group1 acquisition time"
+ default 8
+ range 1 4095
+ ---help---
+ Sampling window in ADCLK cycles minus two: SW = ACQ + 2, and the
+ hardware requires SW >= 3. The input impedance sets the real
+ minimum - see the sample and hold timings in SPNS215. When both
+ modules convert a shared channel their windows must either match
+ exactly or not overlap at all (TRM section 22.1).
+
+config RM57_ADC2_G1_CONTINUOUS
+ bool "ADC2 Group1 continuous conversion"
+ default n
+ ---help---
+ Convert the selected channels continuously instead of once per
+ trigger. Continuous groups report results through the threshold
+ interrupt; single-shot groups use the conversion end interrupt.
+
+config RM57_ADC2_G1_FREEZE
+ bool "ADC2 Group1 freeze enable"
+ default n
+ ---help---
+ Allow this group's conversion sequence to be suspended while
+ another group of the same module is serviced, resuming from
+ where it stopped afterwards.
+
+config RM57_ADC2_G1_OVRWRITE
+ bool "ADC2 Group1 overwrite on overrun"
+ default n
+ ---help---
+ Let the ADC overwrite the oldest results when this group's
+ memory fills up. Without it the group stalls until the
+ application has read the memory out.
+
+config RM57_ADC2_G1_HWTRIG
+ bool "ADC2 Group1 hardware triggered"
+ default n
+ ---help---
+ Start conversions from a hardware event rather than from a write
+ to the channel select register.
+
+config RM57_ADC2_G1_TRIGSRC
+ int "ADC2 Group1 trigger source"
+ default 0
+ range 0 7
+ depends on RM57_ADC2_G1_HWTRIG
+ ---help---
+ Hardware trigger source: 0 = AD2EVT pin, 1 = N2HET1[8],
+ 2 = N2HET1[10], 3 = RTI compare 0, 4 = N2HET1[12],
+ 5 = N2HET1[14], 6 = GIOB[0], 7 = GIOB[1]. A second set of
+ sources is reachable through the ALT_ADC_TRIGGER pin mux
+ control; see SPNS215.
+
+config RM57_ADC2_G1_RISING
+ bool "ADC2 Group1 trigger on rising edge"
+ default y
+ depends on RM57_ADC2_G1_HWTRIG
+ ---help---
+ Trigger on the low-to-high transition of the selected source
+ rather than the high-to-low transition.
+
+# ADC2's DMA request lines are alternate functions shared with MibSPI1 and
+# MibSPI3 (lines 14, 16 and 17), so selecting them needs the system module's
+# DMA request source mux to be reprogrammed. That is not implemented, and
+# ADC2 therefore has no DMA option.
+
+endif # RM57_ADC2_G1
+
+menuconfig RM57_ADC2_G2
+ bool "ADC2 Group2"
+ default n
+ ---help---
+ Expose the ADC2 Group2 as its own /dev/adcN character device.
+ The group has an independent channel selection, trigger source,
+ sampling window, results FIFO and interrupt (VIM channel
+ RM57_REQ_ADC2GROUP2).
+
+if RM57_ADC2_G2
+
+config RM57_ADC2_G2_CHANMASK
+ hex "ADC2 Group2 channel mask"
+ default 0x1
+ ---help---
+ Bit mask of the analog inputs converted by this group; bit n
+ selects AD2IN[n]. In the default sequential mode the selected
+ channels are converted in ascending channel number.
+
+config RM57_ADC2_G2_BUFS
+ int "ADC2 Group2 result buffers"
+ default 16
+ range 0 64
+ ---help---
+ Words of the module's 64-word results RAM reserved for this
+ group. The Event group and Group1 counts must be even because
+ ADBNDCR allocates the memory in pairs, and the three groups of
+ one module must not ask for more than 64 words in total. Both
+ rules are checked at compile time.
+
+config RM57_ADC2_G2_THRESHOLD
+ int "ADC2 Group2 interrupt threshold"
+ default 8
+ range 1 511
+ ---help---
+ How many conversion results accumulate before the group raises
+ its threshold interrupt. Larger values reduce the interrupt
+ rate but need a correspondingly larger result buffer count.
+
+config RM57_ADC2_G2_ACQ
+ int "ADC2 Group2 acquisition time"
+ default 8
+ range 1 4095
+ ---help---
+ Sampling window in ADCLK cycles minus two: SW = ACQ + 2, and the
+ hardware requires SW >= 3. The input impedance sets the real
+ minimum - see the sample and hold timings in SPNS215. When both
+ modules convert a shared channel their windows must either match
+ exactly or not overlap at all (TRM section 22.1).
+
+config RM57_ADC2_G2_CONTINUOUS
+ bool "ADC2 Group2 continuous conversion"
+ default n
+ ---help---
+ Convert the selected channels continuously instead of once per
+ trigger. Continuous groups report results through the threshold
+ interrupt; single-shot groups use the conversion end interrupt.
+
+config RM57_ADC2_G2_FREEZE
+ bool "ADC2 Group2 freeze enable"
+ default n
+ ---help---
+ Allow this group's conversion sequence to be suspended while
+ another group of the same module is serviced, resuming from
+ where it stopped afterwards.
+
+config RM57_ADC2_G2_OVRWRITE
+ bool "ADC2 Group2 overwrite on overrun"
+ default n
+ ---help---
+ Let the ADC overwrite the oldest results when this group's
+ memory fills up. Without it the group stalls until the
+ application has read the memory out.
+
+config RM57_ADC2_G2_HWTRIG
+ bool "ADC2 Group2 hardware triggered"
+ default n
+ ---help---
+ Start conversions from a hardware event rather than from a write
+ to the channel select register.
+
+config RM57_ADC2_G2_TRIGSRC
+ int "ADC2 Group2 trigger source"
+ default 0
+ range 0 7
+ depends on RM57_ADC2_G2_HWTRIG
+ ---help---
+ Hardware trigger source: 0 = AD2EVT pin, 1 = N2HET1[8],
+ 2 = N2HET1[10], 3 = RTI compare 0, 4 = N2HET1[12],
+ 5 = N2HET1[14], 6 = GIOB[0], 7 = GIOB[1]. A second set of
+ sources is reachable through the ALT_ADC_TRIGGER pin mux
+ control; see SPNS215.
+
+config RM57_ADC2_G2_RISING
+ bool "ADC2 Group2 trigger on rising edge"
+ default y
+ depends on RM57_ADC2_G2_HWTRIG
+ ---help---
+ Trigger on the low-to-high transition of the selected source
+ rather than the high-to-low transition.
+
+# ADC2's DMA request lines are alternate functions shared with MibSPI1 and
+# MibSPI3 (lines 14, 16 and 17), so selecting them needs the system module's
+# DMA request source mux to be reprogrammed. That is not implemented, and
+# ADC2 therefore has no DMA option.
+
+endif # RM57_ADC2_G2
+endif # RM57_ADC2
+
+if RM57_ADC
+
+config RM57_ADC_CALIBRATE
+ bool "Calibrate the ADC at initialization"
+ default y
+ ---help---
+ Run the offset error calibration sequence when the first group
+ of a module is registered. Four internal reference voltages are
+ converted and the deviation of their average from mid scale is
+ loaded into ADCALR, which the hardware then adds to every
+ conversion result (TRM SPNU562A section 22.2.6.1).
+
+config RM57_ADC_MAGCOMP
+ bool "Magnitude compare interrupts"
+ default n
+ ---help---
+ Build support for the three hardware magnitude comparators of
+ each module, which interrupt when a monitored channel's result
+ crosses a threshold. This also backs the generic
+ ANIOC_WDOG_UPPER and ANIOC_WDOG_LOWER commands, which claim
+ comparators 0 and 1 of the owning module - so two groups of
+ one module cannot both use the generic watchdog without
+ overwriting each other.
+
+ The comparators have their own VIM channel, separate from the
+ conversion group interrupts, and the driver attaches a handler
+ to it. There is no notification path for an analog watchdog
+ in the NuttX ADC upper half, though, so a crossing is
+ acknowledged and counted rather than reported to the
+ application.
+
+config RM57_ADC_ENHANCED_CHSEL
+ bool "Enhanced channel selection mode"
+ default n
+ depends on RM57_ADC1
+ ---help---
+ Build support for the look-up table based conversion order,
+ which converts channels in an arbitrary user-defined sequence
+ rather than in ascending channel number. Only ADC1 implements
+ this mode (TRM SPNU562A section 22.2.2.2).
+
+config RM57_ADC_PARITY
+ bool "Results RAM parity checking"
+ default y
+ ---help---
+ Enable the parity check on the conversion results RAM. A parity
+ error is reported to the Error Signalling Module and the failing
+ address is latched in ADPARADDR. The RAM is auto-initialized
+ before the check is switched on so untouched buffers cannot
+ report spurious errors.
+
+config RM57_ADC_TEMPSENSOR
+ bool "On-chip temperature sensors"
+ default n
+ ---help---
+ Three on-die temperature sensors, each multiplexed onto one ADC
+ channel: sensor 1 on ADC1 channel 31, sensors 2 and 3 on ADC2
+ channels 31 and 30 (TRM SPNU562A section 6.5.13). The driver
+ releases them from power down, routes them onto their channels,
+ and applies the factory calibration recorded in TI OTP so
+ readings come out in real degrees Celsius.
+
+if RM57_ADC_TEMPSENSOR
+
+config RM57_ADC_TEMP1
+ bool "Temperature sensor 1 (ADC1 channel 31)"
+ default y
+ depends on RM57_ADC1
+ ---help---
+ Sensor 1 shares its channel with the AD1IN[31] ball, so
+ enabling it makes that ball unavailable as an analog input.
+
+config RM57_ADC_TEMP2
+ bool "Temperature sensor 2 (ADC2 channel 31)"
+ default y
+ depends on RM57_ADC2
+
+config RM57_ADC_TEMP3
+ bool "Temperature sensor 3 (ADC2 channel 30)"
+ default y
+ depends on RM57_ADC2
+
+config RM57_ADC_TEMP_UORB
+ bool "Publish as UORB sensor nodes"
+ default n
+ select SENSORS
+ ---help---
+ Register each enabled sensor with the UORB sensor framework as
+ /dev/uorb/sensor_tempN, readable with the sensortest
+ application. This pulls in the whole sensor upper half, so it
+ is worth having only on a board that speaks UORB already.
+
+ Without it each sensor is a plain character device instead, and
+ one read() returns a whole struct rm57_adc_temp_s. Either way
+ the sensors also stay reachable through the ANIOC_RM57_GET_TEMP
+ ioctl on any /dev/adcN.
+
+config RM57_ADC_TEMP_PATH
+ string "Temperature device path prefix"
+ default "/dev/temp"
+ depends on !RM57_ADC_TEMP_UORB
+ ---help---
+ Prefix of the character device registered for each sensor; the
+ device number is appended, giving /dev/temp0 and upwards with
+ the default.
+
+config RM57_ADC_TEMP_DEVNO
+ int "First device number"
+ default 0
+ range 0 32
+ ---help---
+ Device number given to the first enabled sensor; the others
+ follow in order. Sensors of the same type must not share a
+ device number, so shift this if something else on the board
+ already registers a temperature sensor.
+
+endif # RM57_ADC_TEMPSENSOR
+
+config RM57_ADC_DMA_MAXSAMPLES
+ int "Maximum DMA samples per callback"
+ default 32
+ range 1 256
+ depends on RM57_ADC_HAVE_DMA
+ ---help---
+ Upper bound on any group's DMA samples per transfer. It sizes
+ the scratch arrays the DMA callback uses to hand a batch to the
+ upper half, so keep it as small as the configuration allows.
+
+endif # RM57_ADC
+
+menuconfig RM57_EMAC
+ bool "Ethernet MAC (EMAC/MDIO)"
+ default n
+ select NETDEVICES
+ select ARCH_HAVE_PHY
+ select ARCH_HAVE_NETDEV_STATISTICS
+ depends on ARCH_CHIP_RM57L843
+ ---help---
+ TI CPSW-lite 10/100 Ethernet MAC, EMAC Control module and
+ MDIO module. There is exactly one EMAC on this device.
+
+if RM57_EMAC
+
+choice
+ prompt "PHY interface mode"
+ default RM57_EMAC_MII
+ ---help---
+ The LAUNCHXL2-RM57L carries a DP83630 PHY wired for MII; the
+ reset default IOMM selection is RMII, so MII must be
+ explicitly selected here to match that board.
+
+config RM57_EMAC_MII
+ bool "MII"
+
+config RM57_EMAC_RMII
+ bool "RMII"
+ ---help---
+ See the BOARD_VCLKA4_* comment in the board's board.h: this
+ port does not independently verify the PLL2-derived 50MHz
+ clock RMII requires and it should be measured on real
+ hardware before relying on this mode.
+
+endchoice # PHY interface mode
+
+config RM57_EMAC_PHYADDR
+ int "PHY address"
+ default 1
+ range 0 31
+
+config RM57_EMAC_NTXDESC
+ int "Number of TX descriptors"
+ default 8
+ range 2 128
+
+config RM57_EMAC_NRXDESC
+ int "Number of RX descriptors"
+ default 16
+ range 2 128
+
+config RM57_EMAC_MDIO_FREQ
+ int "MDIO clock (Hz)"
+ default 1000000
+ range 100000 2500000
+ ---help---
+ SPNU562A Section 31.2.1: typical operation is 1MHz; the MDIO
+ module is specified to run up to 2.5MHz.
+
+config RM57_EMAC_AUTONEG
+ bool "Autonegotiation"
+ default y
+
+config RM57_EMAC_ETHFD
+ bool "Full duplex"
+ default n
+ depends on !RM57_EMAC_AUTONEG
+
+config RM57_EMAC_ETH100MBPS
+ bool "100 Mbps"
+ default n
+ depends on !RM57_EMAC_AUTONEG
+
+config RM57_EMAC_PHY_INTERRUPT
+ bool "PHY link-change interrupt (MDIO LINKINT0)"
+ default y
+ select ARCH_PHY_INTERRUPT
+ ---help---
+ Enables SIOCMIINOTIFY / phy_notify support. This driver
+ always enables the underlying MDIO link-change interrupt for
+ its own netdev_carrier_on/off tracking regardless of this
+ setting; this option only gates whether a phy_notify
+ subscriber can also attach to link events.
+
+config RM57_EMAC_LOOPBACK
+ bool "MAC internal loopback at ifup (self-test)"
+ default n
+ ---help---
+ Set MACCONTROL.LOOPBACK and skip the PHY link wait entirely,
+ so the descriptor ring and interrupt path can be exercised
+ standalone without a PHY or cable - the RM57_DCAN_LOOPBACK
+ equivalent for Ethernet.
+
+config RM57_EMAC_PROMISC
+ bool "Promiscuous mode (RXMBPENABLE.RXCAFEN)"
+ default n
+ ---help---
+ Copy every frame the PHY delivers to RX channel 0, instead of
+ only those matching the MAC address filter plus broadcast.
+ Debug aid: if traffic is only received with this set, the
+ problem is in the address filter (MACINDEX/MACADDRHI/MACADDRLO
+ or RXUNICASTSET) rather than in the PHY, the descriptor ring or
+ the interrupt path. Leave it off in production - it hands the
+ CPU every frame on the segment.
+
+config RM57_EMAC_REGDEBUG
+ bool "Register-level debug"
+ default n
+ depends on DEBUG_NET_INFO
+
+endif # RM57_EMAC
+
+endmenu # RM57 Peripheral Support
+
+endif # ARCH_CHIP_RM57
diff --git a/arch/arm/src/rm57/Make.defs b/arch/arm/src/rm57/Make.defs
new file mode 100644
index 00000000000..7d34eff3322
--- /dev/null
+++ b/arch/arm/src/rm57/Make.defs
@@ -0,0 +1,92 @@
+############################################################################
+# arch/arm/src/rm57/Make.defs
+#
+# SPDX-License-Identifier: Apache-2.0
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership. The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+############################################################################
+
+include armv7-r/Make.defs
+
+# RM57-specific C source files
+
+CHIP_CSRCS = rm57_boot.c rm57_clockconfig.c rm57_mpuinit.c rm57_gio.c
+CHIP_CSRCS += rm57_gioirq.c
+CHIP_CSRCS += rm57_irq.c rm57_lowputc.c rm57_serial.c rm57_esm.c
+CHIP_CSRCS += rm57_iomm.c
+
+ifeq ($(CONFIG_RM57_SELFTEST),y)
+CHIP_CSRCS += rm57_selftest.c
+ifeq ($(CONFIG_RM57_SELFTEST_PBIST_ROM),y)
+CHIP_CSRCS += rm57_errata.c
+endif
+endif
+
+CHIP_ASRCS = rm57_coreinit.S
+
+# Configuration dependent C and assembly language files
+
+ifneq ($(CONFIG_SCHED_TICKLESS),y)
+CHIP_CSRCS += rm57_timerisr.c
+endif
+
+ifeq ($(CONFIG_RM57_DMA),y)
+CHIP_CSRCS += rm57_dma.c
+endif
+
+ifeq ($(CONFIG_RM57_LIN),y)
+CHIP_CSRCS += rm57_lin.c
+endif
+
+ifeq ($(CONFIG_RM57_MIBSPI),y)
+CHIP_CSRCS += rm57_mibspi.c
+endif
+
+ifeq ($(CONFIG_RM57_I2C),y)
+CHIP_CSRCS += rm57_i2c.c
+endif
+
+ifeq ($(CONFIG_RM57_ADC),y)
+CHIP_CSRCS += rm57_adc.c
+ifeq ($(CONFIG_RM57_ADC_TEMPSENSOR),y)
+CHIP_CSRCS += rm57_adc_temp.c
+endif
+endif
+
+ifeq ($(CONFIG_RM57_DCAN),y)
+CHIP_CSRCS += rm57_dcan.c
+ifeq ($(CONFIG_CAN),y)
+CHIP_CSRCS += rm57_dcan_chardev.c
+endif
+ifeq ($(CONFIG_NET_CAN),y)
+CHIP_CSRCS += rm57_dcan_sock.c
+endif
+endif
+
+ifeq ($(CONFIG_RM57_EMAC),y)
+CHIP_CSRCS += rm57_ethernet.c rm57_mdio.c
+endif
+
+ifeq ($(CONFIG_NET),y)
+ifneq ($(CONFIG_NETDEV_LATEINIT),y)
+CHIP_CSRCS += rm57_netinitialize.c
+endif
+endif
+
+# RM57 has no GIC - it uses the classic Hercules VIM interrupt controller
+
+CMN_CSRCS := $(filter-out arm_gicv2.c arm_gicv2_dump.c, $(CMN_CSRCS))
diff --git a/arch/arm/src/rm57/chip.h b/arch/arm/src/rm57/chip.h
new file mode 100644
index 00000000000..12c670cce9e
--- /dev/null
+++ b/arch/arm/src/rm57/chip.h
@@ -0,0 +1,44 @@
+/****************************************************************************
+ * arch/arm/src/rm57/chip.h
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_RM57_CHIP_H
+#define __ARCH_ARM_SRC_RM57_CHIP_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <arch/rm57/chip.h>
+
+#include "hardware/rm57l843_memorymap.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* Cache line sizes (in bytes) */
+
+#define ARMV7A_DCACHE_LINESIZE 32 /* 32 bytes (8 words) */
+#define ARMV7A_ICACHE_LINESIZE 32 /* 32 bytes (8 words) */
+
+#endif /* __ARCH_ARM_SRC_RM57_CHIP_H */
diff --git a/arch/arm/src/rm57/hardware/rm57_adc.h b/arch/arm/src/rm57/hardware/rm57_adc.h
new file mode 100644
index 00000000000..1d8ba16aaf5
--- /dev/null
+++ b/arch/arm/src/rm57/hardware/rm57_adc.h
@@ -0,0 +1,598 @@
+/****************************************************************************
+ * arch/arm/src/rm57/hardware/rm57_adc.h
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_RM57_HARDWARE_RM57_ADC_H
+#define __ARCH_ARM_SRC_RM57_HARDWARE_RM57_ADC_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <arch/chip/rm57_adc_ioctl.h>
+
+#include "hardware/rm57l843_memorymap.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* MibADC register map, TRM SPNU562A Table 22-6. Offsets are relative to
+ * RM57_ADC1_BASE / RM57_ADC2_BASE. All registers are 32-bit and word
+ * aligned; 8-, 16- and 32-bit accesses are allowed.
+ *
+ * Three conversion groups share the register frame: the Event group (which
+ * the interrupt header calls "GROUP0"), Group1 and Group2. Most group
+ * registers come as an EV/G1/G2 triple with a 4-byte stride, so the driver
+ * indexes them with the RM57_ADC_*_OFFSET(g) helpers at the end of this
+ * block rather than naming all three.
+ */
+
+/* Register offsets *********************************************************/
+
+#define RM57_ADC_RSTCR_OFFSET 0x0000 /* Reset control */
+#define RM57_ADC_OPMODECR_OFFSET 0x0004 /* Operating mode control */
+#define RM57_ADC_CLOCKCR_OFFSET 0x0008 /* Clock control (prescaler) */
+#define RM57_ADC_CALCR_OFFSET 0x000c /* Calibration mode control */
+
+#define RM57_ADC_EVMODECR_OFFSET 0x0010 /* Event group operating mode */
+#define RM57_ADC_G1MODECR_OFFSET 0x0014 /* Group1 operating mode */
+#define RM57_ADC_G2MODECR_OFFSET 0x0018 /* Group2 operating mode */
+
+#define RM57_ADC_EVSRC_OFFSET 0x001c /* Event group trigger source */
+#define RM57_ADC_G1SRC_OFFSET 0x0020 /* Group1 trigger source */
+#define RM57_ADC_G2SRC_OFFSET 0x0024 /* Group2 trigger source */
+
+#define RM57_ADC_EVINTENA_OFFSET 0x0028 /* Event group interrupt enable */
+#define RM57_ADC_G1INTENA_OFFSET 0x002c /* Group1 interrupt enable */
+#define RM57_ADC_G2INTENA_OFFSET 0x0030 /* Group2 interrupt enable */
+
+#define RM57_ADC_EVINTFLG_OFFSET 0x0034 /* Event group interrupt flags */
+#define RM57_ADC_G1INTFLG_OFFSET 0x0038 /* Group1 interrupt flags */
+#define RM57_ADC_G2INTFLG_OFFSET 0x003c /* Group2 interrupt flags */
+
+#define RM57_ADC_EVTHRINTCR_OFFSET 0x0040 /* Event group threshold count */
+#define RM57_ADC_G1THRINTCR_OFFSET 0x0044 /* Group1 threshold count */
+#define RM57_ADC_G2THRINTCR_OFFSET 0x0048 /* Group2 threshold count */
+
+#define RM57_ADC_EVDMACR_OFFSET 0x004c /* Event group DMA control */
+#define RM57_ADC_G1DMACR_OFFSET 0x0050 /* Group1 DMA control */
+#define RM57_ADC_G2DMACR_OFFSET 0x0054 /* Group2 DMA control */
+
+#define RM57_ADC_BNDCR_OFFSET 0x0058 /* Results memory boundaries */
+#define RM57_ADC_BNDEND_OFFSET 0x005c /* Results memory size */
+
+#define RM57_ADC_EVSAMP_OFFSET 0x0060 /* Event group sample window */
+#define RM57_ADC_G1SAMP_OFFSET 0x0064 /* Group1 sample window */
+#define RM57_ADC_G2SAMP_OFFSET 0x0068 /* Group2 sample window */
+
+#define RM57_ADC_EVSR_OFFSET 0x006c /* Event group status */
+#define RM57_ADC_G1SR_OFFSET 0x0070 /* Group1 status */
+#define RM57_ADC_G2SR_OFFSET 0x0074 /* Group2 status */
+
+#define RM57_ADC_EVSEL_OFFSET 0x0078 /* Event group channel select */
+#define RM57_ADC_G1SEL_OFFSET 0x007c /* Group1 channel select */
+#define RM57_ADC_G2SEL_OFFSET 0x0080 /* Group2 channel select */
+
+#define RM57_ADC_CALR_OFFSET 0x0084 /* Calibration / offset error */
+#define RM57_ADC_SMSTATE_OFFSET 0x0088 /* State machine status */
+#define RM57_ADC_LASTCONV_OFFSET 0x008c /* Channel last conversion value */
+
+/* Group results FIFOs. Reading any address inside a group's range pops one
+ * conversion result out of that group's results memory.
+ */
+
+#define RM57_ADC_EVBUFFER_OFFSET 0x0090 /* Event group FIFO (0x90-0xaf) */
+#define RM57_ADC_G1BUFFER_OFFSET 0x00b0 /* Group1 FIFO (0xb0-0xcf) */
+#define RM57_ADC_G2BUFFER_OFFSET 0x00d0 /* Group2 FIFO (0xd0-0xef) */
+
+/* Emulation FIFOs return the next result without popping it or disturbing
+ * any status flag.
+ */
+
+#define RM57_ADC_EVEMUBUFFER_OFFSET 0x00f0 /* Event group emulation FIFO */
+#define RM57_ADC_G1EMUBUFFER_OFFSET 0x00f4 /* Group1 emulation FIFO */
+#define RM57_ADC_G2EMUBUFFER_OFFSET 0x00f8 /* Group2 emulation FIFO */
+
+/* ADEVT pin (AD1EVT/AD2EVT) general purpose I/O control */
+
+#define RM57_ADC_EVTDIR_OFFSET 0x00fc /* ADEVT direction */
+#define RM57_ADC_EVTOUT_OFFSET 0x0100 /* ADEVT output value */
+#define RM57_ADC_EVTIN_OFFSET 0x0104 /* ADEVT input value */
+#define RM57_ADC_EVTSET_OFFSET 0x0108 /* ADEVT set */
+#define RM57_ADC_EVTCLR_OFFSET 0x010c /* ADEVT clear */
+#define RM57_ADC_EVTPDR_OFFSET 0x0110 /* ADEVT open drain enable */
+#define RM57_ADC_EVTPDIS_OFFSET 0x0114 /* ADEVT pull control disable */
+#define RM57_ADC_EVTPSEL_OFFSET 0x0118 /* ADEVT pull select */
+
+#define RM57_ADC_EVSAMPDISEN_OFFSET 0x011c /* Event grp sample cap discharge */
+#define RM57_ADC_G1SAMPDISEN_OFFSET 0x0120 /* Group1 sample cap discharge */
+#define RM57_ADC_G2SAMPDISEN_OFFSET 0x0124 /* Group2 sample cap discharge */
+
+/* Magnitude compare interrupts. Three comparators per module; the control
+ * and mask registers alternate on an 8-byte stride.
+ */
+
+#define RM57_ADC_MAGINT1CR_OFFSET 0x0128 /* Magnitude compare 1 control */
+#define RM57_ADC_MAGINT1MASK_OFFSET 0x012c /* Magnitude compare 1 mask */
+#define RM57_ADC_MAGINT2CR_OFFSET 0x0130 /* Magnitude compare 2 control */
+#define RM57_ADC_MAGINT2MASK_OFFSET 0x0134 /* Magnitude compare 2 mask */
+#define RM57_ADC_MAGINT3CR_OFFSET 0x0138 /* Magnitude compare 3 control */
+#define RM57_ADC_MAGINT3MASK_OFFSET 0x013c /* Magnitude compare 3 mask */
+
+#define RM57_ADC_MAGINTENASET_OFFSET 0x0158 /* Magnitude int enable set */
+#define RM57_ADC_MAGINTENACLR_OFFSET 0x015c /* Magnitude int enable clear */
+#define RM57_ADC_MAGINTFLG_OFFSET 0x0160 /* Magnitude int flags */
+#define RM57_ADC_MAGINTOFF_OFFSET 0x0164 /* Magnitude int offset (index) */
+
+#define RM57_ADC_EVFIFORESETCR_OFFSET 0x0168 /* Event group FIFO reset */
+#define RM57_ADC_G1FIFORESETCR_OFFSET 0x016c /* Group1 FIFO reset */
+#define RM57_ADC_G2FIFORESETCR_OFFSET 0x0170 /* Group2 FIFO reset */
+
+#define RM57_ADC_EVRAMWRADDR_OFFSET 0x0174 /* Event group RAM write pointer */
+#define RM57_ADC_G1RAMWRADDR_OFFSET 0x0178 /* Group1 RAM write pointer */
+#define RM57_ADC_G2RAMWRADDR_OFFSET 0x017c /* Group2 RAM write pointer */
+
+#define RM57_ADC_PARCR_OFFSET 0x0180 /* Parity control */
+#define RM57_ADC_PARADDR_OFFSET 0x0184 /* Parity error address */
+#define RM57_ADC_PWRUPDLYCTRL_OFFSET 0x0188 /* Power-up delay control */
+
+/* Enhanced channel selection mode (ADC1 only) */
+
+#define RM57_ADC_EVCHNSELMODE_OFFSET 0x0190 /* Event grp channel select mode */
+#define RM57_ADC_G1CHNSELMODE_OFFSET 0x0194 /* Group1 channel select mode */
+#define RM57_ADC_G2CHNSELMODE_OFFSET 0x0198 /* Group2 channel select mode */
+
+#define RM57_ADC_EVCURRCOUNT_OFFSET 0x019c /* Event group LUT index */
+#define RM57_ADC_EVMAXCOUNT_OFFSET 0x01a0 /* Event group LUT max count */
+#define RM57_ADC_G1CURRCOUNT_OFFSET 0x01a4 /* Group1 LUT index */
+#define RM57_ADC_G1MAXCOUNT_OFFSET 0x01a8 /* Group1 LUT max count */
+#define RM57_ADC_G2CURRCOUNT_OFFSET 0x01ac /* Group2 LUT index */
+#define RM57_ADC_G2MAXCOUNT_OFFSET 0x01b0 /* Group2 LUT max count */
+
+/* RM57_ADC_GROUP_EV/_G1/_G2 and RM57_ADC_NGROUPS match this EV/G1/G2
+ * register ordering; they are part of the application interface, so they are
+ * defined in <arch/chip/rm57_adc_ioctl.h> above.
+ */
+
+/* Per-group register offset helpers. Every group register triple starts at
+ * the Event group offset and advances 4 bytes per group, except the result
+ * FIFOs (0x20 apart) and the LUT count registers (8 apart).
+ */
+
+#define RM57_ADC_MODECR_OFFSET(g) (RM57_ADC_EVMODECR_OFFSET + ((g) << 2))
+#define RM57_ADC_SRC_OFFSET(g) (RM57_ADC_EVSRC_OFFSET + ((g) << 2))
+#define RM57_ADC_INTENA_OFFSET(g) (RM57_ADC_EVINTENA_OFFSET + ((g) << 2))
+#define RM57_ADC_INTFLG_OFFSET(g) (RM57_ADC_EVINTFLG_OFFSET + ((g) << 2))
+#define RM57_ADC_THRINTCR_OFFSET(g) (RM57_ADC_EVTHRINTCR_OFFSET + ((g) << 2))
+#define RM57_ADC_DMACR_OFFSET(g) (RM57_ADC_EVDMACR_OFFSET + ((g) << 2))
+#define RM57_ADC_SAMP_OFFSET(g) (RM57_ADC_EVSAMP_OFFSET + ((g) << 2))
+#define RM57_ADC_SR_OFFSET(g) (RM57_ADC_EVSR_OFFSET + ((g) << 2))
+#define RM57_ADC_SEL_OFFSET(g) (RM57_ADC_EVSEL_OFFSET + ((g) << 2))
+#define RM57_ADC_BUFFER_OFFSET(g) (RM57_ADC_EVBUFFER_OFFSET + ((g) << 5))
+#define RM57_ADC_EMUBUFFER_OFFSET(g) (RM57_ADC_EVEMUBUFFER_OFFSET + ((g) << 2))
+#define RM57_ADC_SAMPDISEN_OFFSET(g) (RM57_ADC_EVSAMPDISEN_OFFSET + ((g) << 2))
+#define RM57_ADC_FIFORESETCR_OFFSET(g) \
+ (RM57_ADC_EVFIFORESETCR_OFFSET + ((g) << 2))
+#define RM57_ADC_RAMWRADDR_OFFSET(g) (RM57_ADC_EVRAMWRADDR_OFFSET + ((g) << 2))
+#define RM57_ADC_CHNSELMODE_OFFSET(g) \
+ (RM57_ADC_EVCHNSELMODE_OFFSET + ((g) << 2))
+#define RM57_ADC_CURRCOUNT_OFFSET(g) (RM57_ADC_EVCURRCOUNT_OFFSET + ((g) << 3))
+#define RM57_ADC_MAXCOUNT_OFFSET(g) (RM57_ADC_EVMAXCOUNT_OFFSET + ((g) << 3))
+
+/* Magnitude compare registers are indexed 0-2 on an 8-byte stride; the count
+ * itself is RM57_ADC_NMAGCOMP in the exported header.
+ */
+
+#define RM57_ADC_MAGINTCR_OFFSET(n) (RM57_ADC_MAGINT1CR_OFFSET + ((n) << 3))
+#define RM57_ADC_MAGINTMASK_OFFSET(n) \
+ (RM57_ADC_MAGINT1MASK_OFFSET + ((n) << 3))
+
+/* Register bit definitions *************************************************/
+
+/* ADC Reset Control Register (ADRSTCR), offset 0x0000. Privileged write. */
+
+#define ADC_RSTCR_RESET (1 << 0) /* Bit 0: Module reset */
+
+/* ADC Operating Mode Control Register (ADOPMODECR), offset 0x0004 */
+
+#define ADC_OPMODECR_ADC_EN (1 << 0) /* Bit 0: ADC enable */
+#define ADC_OPMODECR_IDLE_PWRDN (1 << 4) /* Bit 4: Power down when idle */
+#define ADC_OPMODECR_POWERDOWN (1 << 8) /* Bit 8: ADC core power down */
+#define ADC_OPMODECR_RAM_TEST_EN (1 << 16) /* Bit 16: Results RAM test mode */
+#define ADC_OPMODECR_CHN_TEST_SHIFT (17) /* Bits 17-20: Channel impedance test */
+#define ADC_OPMODECR_CHN_TEST_MASK (15 << ADC_OPMODECR_CHN_TEST_SHIFT)
+# define ADC_OPMODECR_CHN_TEST_DIS (10 << ADC_OPMODECR_CHN_TEST_SHIFT)
+# define ADC_OPMODECR_CHN_TEST_ENA (5 << ADC_OPMODECR_CHN_TEST_SHIFT)
+#define ADC_OPMODECR_COS (1 << 24) /* Bit 24: Continue on suspend */
+#define ADC_OPMODECR_12BIT (1 << 31) /* Bit 31: 0=10-bit, 1=12-bit */
+
+/* ADC Clock Control Register (ADCLOCKCR), offset 0x0008.
+ * ADCLK period = VCLK period x (PS + 1).
+ */
+
+#define ADC_CLOCKCR_PS_SHIFT (0) /* Bits 0-4: Clock prescaler */
+#define ADC_CLOCKCR_PS_MASK (31 << ADC_CLOCKCR_PS_SHIFT)
+# define ADC_CLOCKCR_PS(n) ((uint32_t)(n) << ADC_CLOCKCR_PS_SHIFT)
+
+/* ADC Calibration Mode Control Register (ADCALCR), offset 0x000c */
+
+#define ADC_CALCR_CAL_EN (1 << 0) /* Bit 0: Calibration enable */
+#define ADC_CALCR_HILO (1 << 8) /* Bit 8: Reference voltage select */
+#define ADC_CALCR_BRIDGE_EN (1 << 9) /* Bit 9: Bridge enable */
+#define ADC_CALCR_CAL_ST (1 << 16) /* Bit 16: Start; self-clears */
+#define ADC_CALCR_SELF_TEST (1 << 24) /* Bit 24: Self test enable */
+
+/* Calibration reference voltage selection (TRM Table 22-2). Valid only
+ * while CAL_EN is set and SELF_TEST is clear.
+ */
+
+#define ADC_CALCR_REF_MIDHI (0) /* (HI*R1+LO*R2)/(R1+R2) */
+#define ADC_CALCR_REF_MIDLO (ADC_CALCR_HILO) /* (LO*R1+HI*R2)/(R1+R2) */
+#define ADC_CALCR_REF_LO (ADC_CALCR_BRIDGE_EN)
+#define ADC_CALCR_REF_HI (ADC_CALCR_BRIDGE_EN | ADC_CALCR_HILO)
+
+/* Group Operating Mode Control Registers (ADEVMODECR/ADG1MODECR/ADG2MODECR),
+ * offsets 0x0010/0x0014/0x0018. DATA_FMT is 12-bit-mode only; 8BIT is
+ * 10-bit-mode only.
+ *
+ * TRM Table 22-12 gives no bit numbers for these fields, because the layout
+ * differs between the 10- and 12-bit configurations, so the positions come
+ * from Figures 22-24 to 22-27. Bit 3 is HW_TRIG for Group1 and Group2 but
+ * reserved for the Event group, which is always started by its trigger
+ * source.
+ */
+
+#define ADC_MODECR_FRZ (1 << 0) /* Bit 0: Freeze enable */
+#define ADC_MODECR_MODE_CONT (1 << 1) /* Bit 1: Continuous conversion */
+#define ADC_MODECR_8BIT (1 << 2) /* Bit 2: 8-bit read (10-bit mode) */
+#define ADC_MODECR_HW_TRIG (1 << 3) /* Bit 3: Hardware triggered */
+#define ADC_MODECR_OVR_RAM_IGN (1 << 4) /* Bit 4: Overwrite on overrun */
+#define ADC_MODECR_CHID (1 << 5) /* Bit 5: Channel id in FIFO read */
+#define ADC_MODECR_DATA_FMT_SHIFT (8) /* Bits 8-9: Read data format */
+#define ADC_MODECR_DATA_FMT_MASK (3 << ADC_MODECR_DATA_FMT_SHIFT)
+# define ADC_MODECR_DATA_FMT_12BIT (0 << ADC_MODECR_DATA_FMT_SHIFT)
+# define ADC_MODECR_DATA_FMT_10BIT (1 << ADC_MODECR_DATA_FMT_SHIFT)
+# define ADC_MODECR_DATA_FMT_8BIT (2 << ADC_MODECR_DATA_FMT_SHIFT)
+#define ADC_MODECR_NORESET_CHNSEL (1 << 16) /* Bit 16: No RAM reset on chnsel */
+
+/* Group Trigger Source Select Registers (ADEVSRC/ADG1SRC/ADG2SRC),
+ * offsets 0x001c/0x0020/0x0024.
+ */
+
+#define ADC_SRC_SRC_SHIFT (0) /* Bits 0-2: Trigger source */
+#define ADC_SRC_SRC_MASK (7 << ADC_SRC_SRC_SHIFT)
+# define ADC_SRC_SRC(n) ((uint32_t)(n) << ADC_SRC_SRC_SHIFT)
+#define ADC_SRC_EDG_SEL (1 << 3) /* Bit 3: 1=rising, 0=falling */
+#define ADC_SRC_EDG_BOTH (1 << 4) /* Bit 4: Trigger on both edges */
+
+/* The ADC_TRIGSRC_* source values that go in this field are part of the
+ * application interface and live in <arch/chip/rm57_adc_ioctl.h>.
+ */
+
+/* Group Interrupt Enable Registers (ADEVINTENA/ADG1INTENA/ADG2INTENA),
+ * offsets 0x0028/0x002c/0x0030.
+ */
+
+#define ADC_INTENA_THR (1 << 0) /* Bit 0: Threshold interrupt */
+#define ADC_INTENA_OVR (1 << 1) /* Bit 1: Memory overrun interrupt */
+#define ADC_INTENA_END (1 << 3) /* Bit 3: Conversion end interrupt */
+
+#define ADC_INTENA_ALL (ADC_INTENA_THR | ADC_INTENA_OVR | \
+ ADC_INTENA_END)
+
+/* Group Interrupt Flag Registers (ADEVINTFLG/ADG1INTFLG/ADG2INTFLG),
+ * offsets 0x0034/0x0038/0x003c. THR and END are write-1-to-clear; EMPTY
+ * and OVERRUN are read-only status.
+ */
+
+#define ADC_INTFLG_THR (1 << 0) /* Bit 0: Threshold reached (W1C) */
+#define ADC_INTFLG_MEM_OVERRUN (1 << 1) /* Bit 1: Memory overrun (RO) */
+#define ADC_INTFLG_MEM_EMPTY (1 << 2) /* Bit 2: Memory empty (RO) */
+#define ADC_INTFLG_END (1 << 3) /* Bit 3: Conversion end (W1C) */
+
+#define ADC_INTFLG_CLRALL (ADC_INTFLG_THR | ADC_INTFLG_END)
+
+/* Group Threshold Interrupt Control Registers
+ * (ADEVTHRINTCR/ADG1THRINTCR/ADG2THRINTCR), offsets 0x0040/0x0044/0x0048.
+ * The threshold is a signed 9-bit down-counter that may go negative.
+ */
+
+#define ADC_THRINTCR_THR_SHIFT (0) /* Bits 0-8: Threshold counter */
+#define ADC_THRINTCR_THR_MASK (0x1ff << ADC_THRINTCR_THR_SHIFT)
+# define ADC_THRINTCR_THR(n) ((uint32_t)(n) << ADC_THRINTCR_THR_SHIFT)
+
+/* Group DMA Control Registers (ADEVDMACR/ADG1DMACR/ADG2DMACR),
+ * offsets 0x004c/0x0050/0x0054.
+ */
+
+#define ADC_DMACR_DMA_EN (1 << 0) /* Bit 0: DMA request enable */
+#define ADC_DMACR_BLK_XFER (1 << 2) /* Bit 2: Block transfer mode */
+#define ADC_DMACR_DMA_END (1 << 3) /* Bit 3: Request on group end */
+#define ADC_DMACR_BLOCKS_SHIFT (16) /* Bits 16-24: Block size */
+#define ADC_DMACR_BLOCKS_MASK (0x1ff << ADC_DMACR_BLOCKS_SHIFT)
+# define ADC_DMACR_BLOCKS(n) ((uint32_t)(n) << ADC_DMACR_BLOCKS_SHIFT)
+
+/* ADC Results Memory Configuration Register (ADBNDCR), offset 0x0058.
+ * Boundaries are expressed in *pairs* of result buffers: the Event group
+ * gets 2 x BNDA buffers and Group1 gets 2 x (BNDB - BNDA); Group2 takes the
+ * remainder up to the size selected by ADBNDEND.
+ */
+
+#define ADC_BNDCR_BNDB_SHIFT (0) /* Bits 0-8: Event+Group1 pairs */
+#define ADC_BNDCR_BNDB_MASK (0x1ff << ADC_BNDCR_BNDB_SHIFT)
+# define ADC_BNDCR_BNDB(n) ((uint32_t)(n) << ADC_BNDCR_BNDB_SHIFT)
+#define ADC_BNDCR_BNDA_SHIFT (16) /* Bits 16-24: Event group pairs */
+#define ADC_BNDCR_BNDA_MASK (0x1ff << ADC_BNDCR_BNDA_SHIFT)
+# define ADC_BNDCR_BNDA(n) ((uint32_t)(n) << ADC_BNDCR_BNDA_SHIFT)
+
+/* ADC Results Memory Size Configuration Register (ADBNDEND), offset 0x005c */
+
+#define ADC_BNDEND_SHIFT (0) /* Bits 0-2: Memory size select */
+#define ADC_BNDEND_MASK (7 << ADC_BNDEND_SHIFT)
+# define ADC_BNDEND_64WORDS (2 << ADC_BNDEND_SHIFT)
+#define ADC_BNDEND_BUF_INIT_ACTIVE (1 << 16) /* Bit 16: Auto-init in progress */
+
+/* Total number of conversion result buffers in the ADC results RAM */
+
+#define RM57_ADC_NRESULTBUFS 64
+
+/* Group Sampling Time Configuration Registers (ADEVSAMP/ADG1SAMP/ADG2SAMP),
+ * offsets 0x0060/0x0064/0x0068. Sampling window = ACQ + 2 ADCLK cycles and
+ * must be at least 3 ADCLK cycles.
+ */
+
+#define ADC_SAMP_ACQ_SHIFT (0) /* Bits 0-11: Acquisition time */
+#define ADC_SAMP_ACQ_MASK (0xfff << ADC_SAMP_ACQ_SHIFT)
+# define ADC_SAMP_ACQ(n) ((uint32_t)(n) << ADC_SAMP_ACQ_SHIFT)
+
+#define ADC_SAMP_ACQ_MIN 1 /* SW = ACQ + 2 >= 3 */
+
+/* Group Status Registers (ADEVSR/ADG1SR/ADG2SR),
+ * offsets 0x006c/0x0070/0x0074.
+ */
+
+#define ADC_SR_END (1 << 0) /* Bit 0: Conversion end (W1C) */
+#define ADC_SR_STOP (1 << 1) /* Bit 1: Conversions frozen */
+#define ADC_SR_BUSY (1 << 2) /* Bit 2: Conversion in progress */
+#define ADC_SR_MEM_EMPTY (1 << 3) /* Bit 3: Results memory empty */
+
+/* ADC Calibration and Error Offset Correction Register (ADCALR),
+ * offset 0x0084. 12 bits wide in 12-bit mode, 10 bits in 10-bit mode.
+ */
+
+#define ADC_CALR_12BIT_MASK (0xfff)
+#define ADC_CALR_10BIT_MASK (0x3ff)
+
+/* ADC State Machine Status Register (ADSMSTATE), offset 0x0088 */
+
+#define ADC_SMSTATE_SHIFT (0) /* Bits 0-3: Current state */
+#define ADC_SMSTATE_MASK (15 << ADC_SMSTATE_SHIFT)
+
+/* Conversion result format when read from a group FIFO (ADxxBUFFER). The
+ * layout differs between 12- and 10-bit module configurations (TRM Figures
+ * 22-4 and 22-5).
+ */
+
+#define ADC_FIFO_12BIT_DR_MASK (0xfff) /* Bits 0-11: Result */
+#define ADC_FIFO_12BIT_CHID_SHIFT (16) /* Bits 16-20: Channel id */
+#define ADC_FIFO_12BIT_CHID_MASK (0x1f << ADC_FIFO_12BIT_CHID_SHIFT)
+#define ADC_FIFO_12BIT_EMPTY (1 << 31) /* Bit 31: FIFO was empty */
+
+#define ADC_FIFO_10BIT_DR_MASK (0x3ff) /* Bits 0-9: Result */
+#define ADC_FIFO_10BIT_CHID_SHIFT (10) /* Bits 10-14: Channel id */
+#define ADC_FIFO_10BIT_CHID_MASK (0x1f << ADC_FIFO_10BIT_CHID_SHIFT)
+
+/* The empty flag moves with the rest of the word: it is the top bit of the
+ * 32-bit result in 12-bit mode but the top bit of the 16-bit result in
+ * 10-bit mode, where bits 31-16 read as zero (TRM Figures 22-60 and 22-61).
+ * Testing bit 31 unconditionally would therefore never see an empty FIFO on
+ * a 10-bit module.
+ */
+
+#define ADC_FIFO_10BIT_EMPTY (1 << 15) /* Bit 15: FIFO was empty */
+
+/* ADEVT pin control registers, offsets 0x00fc-0x0118. Each holds a single
+ * bit 0 controlling the module's ADEVT pin.
+ */
+
+#define ADC_EVT_BIT (1 << 0) /* Bit 0: ADEVT pin */
+
+/* Group Sample Cap Discharge Control Registers
+ * (ADEVSAMPDISEN/ADG1SAMPDISEN/ADG2SAMPDISEN), offsets 0x011c/0x0120/0x0124.
+ */
+
+#define ADC_SAMPDISEN_EN (1 << 0) /* Bit 0: Discharge enable */
+#define ADC_SAMPDISEN_CYC_SHIFT (8) /* Bits 8-15: Discharge cycles */
+#define ADC_SAMPDISEN_CYC_MASK (0xff << ADC_SAMPDISEN_CYC_SHIFT)
+# define ADC_SAMPDISEN_CYC(n) ((uint32_t)(n) << ADC_SAMPDISEN_CYC_SHIFT)
+
+/* Magnitude Compare Interrupt Control Registers (ADMAGINTxCR), offsets
+ * 0x0128/0x0130/0x0138. The field layout differs between 12- and 10-bit
+ * module configurations (TRM Figures 22-83 and 22-84).
+ */
+
+#define ADC_MAGINTCR12_MAG_CHID_SHIFT (0) /* Bits 0-4: Monitored chan */
+#define ADC_MAGINTCR12_MAG_CHID_MASK (0x1f << ADC_MAGINTCR12_MAG_CHID_SHIFT)
+#define ADC_MAGINTCR12_COMP_CHID_SHIFT (8) /* Bits 8-12: Compare chan */
+#define ADC_MAGINTCR12_COMP_CHID_MASK (0x1f << ADC_MAGINTCR12_COMP_CHID_SHIFT)
+#define ADC_MAGINTCR12_CMP_GE_LT (1 << 14) /* Bit 14: 1=>=, 0=< */
+#define ADC_MAGINTCR12_CHN_THR_COMP (1 << 15) /* Bit 15: Compare vs channel */
+#define ADC_MAGINTCR12_MAG_THR_SHIFT (16) /* Bits 16-27: Threshold */
+#define ADC_MAGINTCR12_MAG_THR_MASK (0xfff << ADC_MAGINTCR12_MAG_THR_SHIFT)
+
+#define ADC_MAGINTCR10_CMP_GE_LT (1 << 0) /* Bit 0: 1=>=, 0=< */
+#define ADC_MAGINTCR10_CHN_THR_COMP (1 << 1) /* Bit 1: Compare vs channel */
+#define ADC_MAGINTCR10_COMP_CHID_SHIFT (8) /* Bits 8-12: Compare chan */
+#define ADC_MAGINTCR10_COMP_CHID_MASK (0x1f << ADC_MAGINTCR10_COMP_CHID_SHIFT)
+#define ADC_MAGINTCR10_MAG_THR_SHIFT (16) /* Bits 16-25: Threshold */
+#define ADC_MAGINTCR10_MAG_THR_MASK (0x3ff << ADC_MAGINTCR10_MAG_THR_SHIFT)
+#define ADC_MAGINTCR10_MAG_CHID_SHIFT (26) /* Bits 26-30: Monitored ch */
+#define ADC_MAGINTCR10_MAG_CHID_MASK (0x1f << ADC_MAGINTCR10_MAG_CHID_SHIFT)
+
+/* Magnitude Compare Interrupt Enable Set/Clear, Flag and Offset registers,
+ * offsets 0x0158/0x015c/0x0160/0x0164. One bit per comparator.
+ */
+
+#define ADC_MAGINT(n) (1 << (n)) /* Comparator n, 0-2 */
+#define ADC_MAGINT_ALL (7)
+
+#define ADC_MAGINTOFF_SHIFT (0) /* Bits 0-3: Highest priority */
+#define ADC_MAGINTOFF_MASK (15 << ADC_MAGINTOFF_SHIFT)
+
+/* Group FIFO Reset Control Registers, offsets 0x0168/0x016c/0x0170. The bit
+ * self-clears and always reads as zero.
+ */
+
+#define ADC_FIFORESETCR_RESET (1 << 0) /* Bit 0: Reset group FIFO */
+
+/* Group RAM Write Address Registers, offsets 0x0174/0x0178/0x017c. Holds
+ * the buffer number the next conversion result will be written to.
+ */
+
+#define ADC_RAMWRADDR_SHIFT (0) /* Bits 0-8: Buffer number */
+#define ADC_RAMWRADDR_MASK (0x1ff << ADC_RAMWRADDR_SHIFT)
+
+/* ADC Parity Control Register (ADPARCR), offset 0x0180. Privileged write.
+ * PARITY_ENA is inverted logic: 5h disables the check, every other value
+ * enables it. Reset value is 5h, i.e. parity checking off.
+ */
+
+#define ADC_PARCR_PARITY_SHIFT (0) /* Bits 0-3: Parity enable */
+#define ADC_PARCR_PARITY_MASK (15 << ADC_PARCR_PARITY_SHIFT)
+# define ADC_PARCR_PARITY_DISABLE (5 << ADC_PARCR_PARITY_SHIFT)
+# define ADC_PARCR_PARITY_ENABLE (10 << ADC_PARCR_PARITY_SHIFT)
+#define ADC_PARCR_TEST (1 << 8) /* Bit 8: Map parity bits */
+
+/* ADC Power-Up Delay Control Register (ADPWRUPDLYCTRL), offset 0x0188 */
+
+#define ADC_PWRUPDLY_SHIFT (0) /* Bits 0-9: VCLK cycles */
+#define ADC_PWRUPDLY_MASK (0x3ff << ADC_PWRUPDLY_SHIFT)
+# define ADC_PWRUPDLY(n) ((uint32_t)(n) << ADC_PWRUPDLY_SHIFT)
+
+/* Group Channel Selection Mode Control Registers, offsets
+ * 0x0190/0x0194/0x0198. Enhanced mode is implemented on ADC1 only.
+ */
+
+#define ADC_CHNSELMODE_SHIFT (0) /* Bits 0-3: Enhanced mode */
+#define ADC_CHNSELMODE_MASK (15 << ADC_CHNSELMODE_SHIFT)
+# define ADC_CHNSELMODE_SEQUENTIAL (5 << ADC_CHNSELMODE_SHIFT)
+# define ADC_CHNSELMODE_ENHANCED (10 << ADC_CHNSELMODE_SHIFT)
+
+/* Group LUT index and maximum count registers, offsets 0x019c-0x01b0 */
+
+#define ADC_COUNT_SHIFT (0) /* Bits 0-4: LUT index/limit */
+#define ADC_COUNT_MASK (0x1f << ADC_COUNT_SHIFT)
+
+/* Enhanced channel selection look-up table. Each conversion group owns 32
+ * word-aligned entries; the Event group's table comes first, then Group1's,
+ * then Group2's (TRM Figure 22-11).
+ */
+
+#define RM57_ADC_LUT_GROUP_OFFSET(g) ((g) * RM57_ADC_LUT_NENTRIES * 4)
+
+#define ADC_LUT_INT_CHN_SHIFT (0) /* Bits 0-4: Internal mux select */
+#define ADC_LUT_INT_CHN_MASK (0x1f << ADC_LUT_INT_CHN_SHIFT)
+# define ADC_LUT_INT_CHN(n) ((uint32_t)(n) << ADC_LUT_INT_CHN_SHIFT)
+#define ADC_LUT_EXT_CHN_SHIFT (8) /* Bits 8-12: External mux select */
+#define ADC_LUT_EXT_CHN_MASK (0x1f << ADC_LUT_EXT_CHN_SHIFT)
+# define ADC_LUT_EXT_CHN(n) ((uint32_t)(n) << ADC_LUT_EXT_CHN_SHIFT)
+
+/* Channel counts. ADC1 has 32 inputs; ADC2 has 25, of which 16 are shared
+ * with ADC1 (TRM Figure 22-1).
+ */
+
+#define RM57_ADC1_NCHANNELS 32
+#define RM57_ADC2_NCHANNELS 25
+
+/* Selectable channels, as a mask rather than a count. ADC2 needs this
+ * because its channel select register is not simply the low 25 bits: the top
+ * two bits address the on-die temperature sensors, which have no external
+ * ball at all. ADC1's channel 31 doubles as temperature sensor 1 and is a
+ * real ball (T13), selected between the two by the IOMM.
+ */
+
+#define RM57_ADC1_VALIDMASK 0xffffffff
+#define RM57_ADC2_VALIDMASK 0xc1ffffff
+
+/* On-die temperature sensors (TRM SPNU562A section 6.5.13). Three sensors,
+ * each multiplexed onto one ADC channel. Selecting the sensor rather than
+ * the ball, and releasing all three from power down, is done through the
+ * IOMM - see the PINMUX_TEMP* entries in rm57l843_pinmux.h.
+ */
+
+#define RM57_ADC_TEMP1_MODULE 0 /* ADC1 */
+#define RM57_ADC_TEMP1_CHANNEL 31
+#define RM57_ADC_TEMP2_MODULE 1 /* ADC2 */
+#define RM57_ADC_TEMP2_CHANNEL 31
+#define RM57_ADC_TEMP3_MODULE 1 /* ADC2 */
+#define RM57_ADC_TEMP3_CHANNEL 30
+
+/* Factory calibration for the temperature sensors, recorded in TI OTP bank 0
+ * during device test (TRM SPNU562A section 7.5.2.5). Each sensor gets three
+ * (temperature, ADC reading) points, every field 16 bits wide, measured with
+ * ADREFHI at 3.3V, and each point is one 32-bit word.
+ *
+ * Two things about the layout differ from what TRM Figure 7-7 suggests, and
+ * both were established by reading a real device rather than deduced:
+ *
+ * - The temperature is the *low* half of the word and the ADC reading the
+ * high half, the opposite way round from the figure's byte assignment.
+ * Most likely the image is laid out for the big-endian configuration
+ * TI's own tools default to; whatever the reason, a little-endian
+ * 32-bit load yields the two fields in this order.
+ * - The three points are not in temperature order. Silicon records them
+ * as +30C, -40C and +125C, in that sequence, so they have to be sorted
+ * before anything can interpolate between them.
+ *
+ * For reference, one RM57L843 reads (Kelvin, code): sensor 1 (303, 1879),
+ * (233, 1427), (398, 2461); sensors 2 and 3 the same temperatures with their
+ * own codes. That is about 6 codes per degree, rising with temperature.
+ *
+ * Reading OTP is a plain load - there is no flash mode to enter - but the
+ * region must not be mapped as "normal" memory or errata L2FMC#5 returns the
+ * instruction opcode instead of the data. rm57_periph_region() maps this
+ * address range strongly-ordered, so the workaround is already in place.
+ */
+
+#define RM57_ADC_TEMPCAL_BASE(n) (0xf0080310 + ((n) * 0x10))
+
+#define RM57_ADC_TEMPCAL_KELVIN_MASK (0xffff) /* Bits 0-15: Kelvin */
+#define RM57_ADC_TEMPCAL_VAL_SHIFT (16) /* Bits 16-31: ADC reading */
+#define RM57_ADC_TEMPCAL_VAL_MASK (0xffff << RM57_ADC_TEMPCAL_VAL_SHIFT)
+
+#define RM57_ADC_TEMPCAL_BLANK 0xffff /* Unprogrammed OTP reads as this */
+
+/* Plausibility bounds on a calibration temperature. The device is tested
+ * between -40C and 125C, so anything far outside that is not a temperature -
+ * which is the signature of OTP being read through errata L2FMC#5.
+ */
+
+#define RM57_ADC_TEMPCAL_MINK 200 /* -73C */
+#define RM57_ADC_TEMPCAL_MAXK 500 /* 227C */
+
+/* Absolute zero in milli-Celsius, for the Kelvin to Celsius conversion */
+
+#define RM57_ADC_ZEROC_MILLIK 273150
+
+#endif /* __ARCH_ARM_SRC_RM57_HARDWARE_RM57_ADC_H */
diff --git a/arch/arm/src/rm57/hardware/rm57_ccm.h b/arch/arm/src/rm57/hardware/rm57_ccm.h
new file mode 100644
index 00000000000..2d8a6451ee7
--- /dev/null
+++ b/arch/arm/src/rm57/hardware/rm57_ccm.h
@@ -0,0 +1,121 @@
+/****************************************************************************
+ * arch/arm/src/rm57/hardware/rm57_ccm.h
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/* CPU Compare Module for Cortex-R5F (CCM-R5F), SPNU562A chapter 13.
+ *
+ * Four independent diagnostics share one register layout, each with its
+ * own status/key register pair:
+ *
+ * 1 - CPU output compare (ESM group2 channel 2)
+ * 2 - VIM output compare (ESM group2 channel 25)
+ * 3 - checker CPU inactivity (ESM group2 channel 26)
+ * 4 - power domain inactivity (ESM group2 channel 28)
+ *
+ * Offsets follow TRM Table 13-7 and match HALCoGen's HL_reg_ccmr5.h. Note
+ * that the pairs are not evenly spaced: CCMPOLCNTRL sits between pair 3
+ * and pair 4.
+ */
+
+#ifndef __ARCH_ARM_SRC_RM57_HARDWARE_RM57_CCM_H
+#define __ARCH_ARM_SRC_RM57_HARDWARE_RM57_CCM_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include "hardware/rm57l843_memorymap.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* Register Offsets *********************************************************/
+
+/* Status Register 1 (CPU compare) */
+#define RM57_CCM_SR1_OFFSET 0x0000
+#define RM57_CCM_KEYR1_OFFSET 0x0004 /* Key Register 1 */
+
+/* Status Register 2 (VIM compare) */
+#define RM57_CCM_SR2_OFFSET 0x0008
+#define RM57_CCM_KEYR2_OFFSET 0x000c /* Key Register 2 */
+
+/* Status Register 3 (inactivity) */
+#define RM57_CCM_SR3_OFFSET 0x0010
+#define RM57_CCM_KEYR3_OFFSET 0x0014 /* Key Register 3 */
+#define RM57_CCM_POLCNTRL_OFFSET 0x0018 /* Polarity Control Register */
+
+/* Status Register 4 (power domain) */
+#define RM57_CCM_SR4_OFFSET 0x001c
+#define RM57_CCM_KEYR4_OFFSET 0x0020 /* Key Register 4 */
+
+/* Power Domain Status Register 0 */
+#define RM57_CCM_PDSTAT0_OFFSET 0x0024
+
+/* Register Addresses *******************************************************/
+
+#define RM57_CCM_SR1 (RM57_CCM_BASE + RM57_CCM_SR1_OFFSET)
+#define RM57_CCM_KEYR1 (RM57_CCM_BASE + RM57_CCM_KEYR1_OFFSET)
+#define RM57_CCM_SR2 (RM57_CCM_BASE + RM57_CCM_SR2_OFFSET)
+#define RM57_CCM_KEYR2 (RM57_CCM_BASE + RM57_CCM_KEYR2_OFFSET)
+#define RM57_CCM_SR3 (RM57_CCM_BASE + RM57_CCM_SR3_OFFSET)
+#define RM57_CCM_KEYR3 (RM57_CCM_BASE + RM57_CCM_KEYR3_OFFSET)
+#define RM57_CCM_POLCNTRL (RM57_CCM_BASE + RM57_CCM_POLCNTRL_OFFSET)
+#define RM57_CCM_SR4 (RM57_CCM_BASE + RM57_CCM_SR4_OFFSET)
+#define RM57_CCM_KEYR4 (RM57_CCM_BASE + RM57_CCM_KEYR4_OFFSET)
+#define RM57_CCM_PDSTAT0 (RM57_CCM_BASE + RM57_CCM_PDSTAT0_OFFSET)
+
+/* Register Bit-Field Definitions *******************************************/
+
+/* Status Registers 1-4 (identical layout) */
+
+#define CCM_SR_STE (1 << 0) /* Bit 0: Self-test error */
+
+/* Bit 1: Error type, 1=mismatch test */
+#define CCM_SR_STET (1 << 1)
+#define CCM_SR_STC (1 << 8) /* Bit 8: Self-test complete */
+
+/* Bit 16: Compare error (W1C) */
+#define CCM_SR_CMPE (1 << 16)
+
+/* Key Registers 1-4 (identical layout). Error forcing and self-test error
+ * forcing last one clock cycle and then revert to CCM_KEYR_LOCKSTEP on
+ * their own; self-test stays selected until software writes another key.
+ */
+
+#define CCM_KEYR_MKEY_MASK (0x0f) /* Bits 0-3: Mode key */
+#define CCM_KEYR_LOCKSTEP (0x00) /* Active compare lockstep */
+#define CCM_KEYR_SELFTEST (0x06) /* Self-test */
+#define CCM_KEYR_ERRFORCE (0x09) /* Error forcing */
+#define CCM_KEYR_STERRFORCE (0x0f) /* Self-test error forcing */
+
+/* Polarity Control Register */
+
+/* Bits 0-7: CPU1 signal invert */
+#define CCM_POLCNTRL_INVERT_MASK (0xff)
+
+/* Power Domain Status Register 0 */
+
+#define CCM_PDSTAT0_HTU2_MASK (3 << 2) /* Bits 2-3: HTU2 transaction */
+#define CCM_PDSTAT0_DMM_MASK (3 << 4) /* Bits 4-5: DMM transaction */
+
+#endif /* __ARCH_ARM_SRC_RM57_HARDWARE_RM57_CCM_H */
diff --git a/arch/arm/src/rm57/hardware/rm57_dcan.h b/arch/arm/src/rm57/hardware/rm57_dcan.h
new file mode 100644
index 00000000000..f64732c76a3
--- /dev/null
+++ b/arch/arm/src/rm57/hardware/rm57_dcan.h
@@ -0,0 +1,350 @@
+/****************************************************************************
+ * arch/arm/src/rm57/hardware/rm57_dcan.h
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/* DCAN (Bosch D_CAN) register layout for the RM57L843, transcribed from
+ * SPNU562A chapter 26 and cross-checked against TI's HALCoGen
+ * HL_reg_can.h. All four instances (DCAN1-DCAN4) share this layout and
+ * have 64 message objects each.
+ *
+ * The IFxCMD register is documented as four byte fields (MsgNum, STAT,
+ * CMD); on this port it is always accessed as a single 32-bit register.
+ * The Hercules peripheral bus is BE-32, so sub-word accesses swap byte
+ * lanes on the little-endian R5F (see the note in rm57_sci.h) - full-word
+ * accesses see the register exactly as drawn in the TRM figures.
+ */
+
+#ifndef __ARCH_ARM_SRC_RM57_HARDWARE_RM57_DCAN_H
+#define __ARCH_ARM_SRC_RM57_HARDWARE_RM57_DCAN_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include "hardware/rm57l843_memorymap.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* Message objects **********************************************************/
+
+#define RM57_DCAN_NMSGOBJ 64 /* Message objects per instance */
+
+/* Message RAM addressing: object n (1..64) lives at RAM base + n * 0x20;
+ * object 64 wraps to offset 0. The ECC bits of object n are memory
+ * mapped at RAM base + 0x1000 + n * 0x20 (SECDED diagnostic mode only).
+ * The RAM is only CPU-visible in Debug/Suspend or RAM Direct Access mode;
+ * normal operation goes through the IF1/IF2/IF3 register sets.
+ */
+
+#define RM57_DCAN_RAM_MBOX(ram,n) ((ram) + (((n) & 63) << 5))
+#define RM57_DCAN_RAM_ECC(ram,n) ((ram) + 0x1000 + (((n) & 63) << 5))
+
+/* Register Offsets *********************************************************/
+
+#define RM57_DCAN_CTL_OFFSET 0x0000 /* CAN Control Register */
+#define RM57_DCAN_ES_OFFSET 0x0004 /* Error and Status Register */
+#define RM57_DCAN_ERRC_OFFSET 0x0008 /* Error Counter Register */
+#define RM57_DCAN_BTR_OFFSET 0x000c /* Bit Timing Register */
+#define RM57_DCAN_INT_OFFSET 0x0010 /* Interrupt Register */
+#define RM57_DCAN_TEST_OFFSET 0x0014 /* Test Register */
+#define RM57_DCAN_PERR_OFFSET 0x001c /* Parity/SECDED Error Code Register */
+#define RM57_DCAN_REL_OFFSET 0x0020 /* Core Release Register */
+#define RM57_DCAN_ECCDIAG_OFFSET 0x0024 /* ECC Diagnostic Register */
+#define RM57_DCAN_ECCDIAGSTAT_OFFSET 0x0028 /* ECC Diagnostic Status Register */
+#define RM57_DCAN_ECCCS_OFFSET 0x002c /* ECC Control and Status Register */
+#define RM57_DCAN_ECCSERR_OFFSET 0x0030 /* ECC Single-Bit Error Code Register */
+#define RM57_DCAN_ABOTR_OFFSET 0x0080 /* Auto-Bus-On Time Register */
+#define RM57_DCAN_TXRQX_OFFSET 0x0084 /* Transmission Request X (summary) */
+#define RM57_DCAN_NWDATX_OFFSET 0x0098 /* New Data X (summary) */
+#define RM57_DCAN_INTPNDX_OFFSET 0x00ac /* Interrupt Pending X (summary) */
+#define RM57_DCAN_MSGVALX_OFFSET 0x00c0 /* Message Valid X (summary) */
+
+/* TXRQ12/34/56/78, NWDAT12/34/56/78, INTPND12/34/56/78, MSGVAL12/34/56/78
+ * and INTMUX12/34/56/78: four consecutive registers each, g = 0-3.
+ */
+
+#define RM57_DCAN_TXRQ_OFFSET(g) (0x0088 + ((g) << 2))
+#define RM57_DCAN_NWDAT_OFFSET(g) (0x009c + ((g) << 2))
+#define RM57_DCAN_INTPND_OFFSET(g) (0x00b0 + ((g) << 2))
+#define RM57_DCAN_MSGVAL_OFFSET(g) (0x00c4 + ((g) << 2))
+#define RM57_DCAN_INTMUX_OFFSET(g) (0x00d8 + ((g) << 2))
+
+/* IF1/IF2 interface register sets. RM57_DCAN_IF1 / RM57_DCAN_IF2 may be
+ * passed as the 'ifbase' offset to the IF register macros.
+ */
+
+#define RM57_DCAN_IF1 0x0100
+#define RM57_DCAN_IF2 0x0120
+
+#define RM57_DCAN_IFCMD_OFFSET(if) ((if) + 0x0000) /* IFx Command Register */
+#define RM57_DCAN_IFMSK_OFFSET(if) ((if) + 0x0004) /* IFx Mask Register */
+#define RM57_DCAN_IFARB_OFFSET(if) ((if) + 0x0008) /* IFx Arbitration Register */
+#define RM57_DCAN_IFMCTL_OFFSET(if) ((if) + 0x000c) /* IFx Message Control Register */
+#define RM57_DCAN_IFDATA_OFFSET(if) ((if) + 0x0010) /* IFx Data A (bytes 0-3) */
+#define RM57_DCAN_IFDATB_OFFSET(if) ((if) + 0x0014) /* IFx Data B (bytes 4-7) */
+
+#define RM57_DCAN_IF1CMD_OFFSET 0x0100 /* IF1 Command Register */
+#define RM57_DCAN_IF1MSK_OFFSET 0x0104 /* IF1 Mask Register */
+#define RM57_DCAN_IF1ARB_OFFSET 0x0108 /* IF1 Arbitration Register */
+#define RM57_DCAN_IF1MCTL_OFFSET 0x010c /* IF1 Message Control Register */
+#define RM57_DCAN_IF1DATA_OFFSET 0x0110 /* IF1 Data A Register */
+#define RM57_DCAN_IF1DATB_OFFSET 0x0114 /* IF1 Data B Register */
+#define RM57_DCAN_IF2CMD_OFFSET 0x0120 /* IF2 Command Register */
+#define RM57_DCAN_IF2MSK_OFFSET 0x0124 /* IF2 Mask Register */
+#define RM57_DCAN_IF2ARB_OFFSET 0x0128 /* IF2 Arbitration Register */
+#define RM57_DCAN_IF2MCTL_OFFSET 0x012c /* IF2 Message Control Register */
+#define RM57_DCAN_IF2DATA_OFFSET 0x0130 /* IF2 Data A Register */
+#define RM57_DCAN_IF2DATB_OFFSET 0x0134 /* IF2 Data B Register */
+
+/* IF3 auto-update interface register set (read-only mirror + control) */
+
+#define RM57_DCAN_IF3OBS_OFFSET 0x0140 /* IF3 Observation Register */
+#define RM57_DCAN_IF3MSK_OFFSET 0x0144 /* IF3 Mask Register (RO) */
+#define RM57_DCAN_IF3ARB_OFFSET 0x0148 /* IF3 Arbitration Register (RO) */
+#define RM57_DCAN_IF3MCTL_OFFSET 0x014c /* IF3 Message Control Register (RO) */
+#define RM57_DCAN_IF3DATA_OFFSET 0x0150 /* IF3 Data A Register (RO) */
+#define RM57_DCAN_IF3DATB_OFFSET 0x0154 /* IF3 Data B Register (RO) */
+
+/* IF3 Update Enable registers IF3UPD12/34/56/78, g = 0-3 */
+
+#define RM57_DCAN_IF3UPD_OFFSET(g) (0x0160 + ((g) << 2))
+
+#define RM57_DCAN_TIOC_OFFSET 0x01e0 /* CAN TX IO Control Register */
+#define RM57_DCAN_RIOC_OFFSET 0x01e4 /* CAN RX IO Control Register */
+
+/* Mailbox group helpers for the TXRQ/NWDAT/INTPND/MSGVAL/INTMUX/IF3UPD
+ * register arrays: mailbox n (1..64) is bit (n-1) % 32 of group (n-1) / 32.
+ */
+
+#define RM57_DCAN_MBOX_GROUP(n) (((n) - 1) >> 5)
+#define RM57_DCAN_MBOX_BIT(n) (1u << (((n) - 1) & 31))
+
+/* Register Bit-Field Definitions *******************************************/
+
+/* CAN Control Register (CTL) */
+
+#define DCAN_CTL_INIT (1 << 0) /* Initialization mode */
+#define DCAN_CTL_IE0 (1 << 1) /* Interrupt line 0 enable */
+#define DCAN_CTL_SIE (1 << 2) /* Status change interrupt enable */
+#define DCAN_CTL_EIE (1 << 3) /* Error interrupt enable */
+#define DCAN_CTL_DAR (1 << 5) /* Disable automatic retransmission */
+#define DCAN_CTL_CCE (1 << 6) /* Configuration change enable */
+#define DCAN_CTL_TEST (1 << 7) /* Test mode enable */
+#define DCAN_CTL_IDS (1 << 8) /* Interruption debug support */
+#define DCAN_CTL_ABO (1 << 9) /* Auto-Bus-On enable */
+#define DCAN_CTL_PMD_SHIFT 10 /* SECDED mode: 0x5 = disabled */
+#define DCAN_CTL_PMD_MASK (15 << DCAN_CTL_PMD_SHIFT)
+#define DCAN_CTL_PMD_DISABLE (5 << DCAN_CTL_PMD_SHIFT)
+#define DCAN_CTL_PMD_ENABLE (10 << DCAN_CTL_PMD_SHIFT)
+#define DCAN_CTL_SWR (1 << 15) /* Software reset */
+#define DCAN_CTL_INITDBG (1 << 16) /* Init state while debug access */
+#define DCAN_CTL_IE1 (1 << 17) /* Interrupt line 1 enable */
+#define DCAN_CTL_DE1 (1 << 18) /* DMA request line IF1 enable */
+#define DCAN_CTL_DE2 (1 << 19) /* DMA request line IF2 enable */
+#define DCAN_CTL_DE3 (1 << 20) /* DMA request line IF3 enable */
+#define DCAN_CTL_PDR (1 << 24) /* Request local power down */
+#define DCAN_CTL_WUBA (1 << 25) /* Wake up on bus activity */
+
+/* Error and Status Register (ES). Reading clears WakeUpPnd/PER/RxOK/TxOK
+ * and sets LEC to 7 - service with a single read.
+ */
+
+#define DCAN_ES_LEC_SHIFT 0 /* Last error code */
+#define DCAN_ES_LEC_MASK (7 << DCAN_ES_LEC_SHIFT)
+# define DCAN_ES_LEC_NONE (0 << DCAN_ES_LEC_SHIFT)
+# define DCAN_ES_LEC_STUFF (1 << DCAN_ES_LEC_SHIFT)
+# define DCAN_ES_LEC_FORM (2 << DCAN_ES_LEC_SHIFT)
+# define DCAN_ES_LEC_ACK (3 << DCAN_ES_LEC_SHIFT)
+# define DCAN_ES_LEC_BIT1 (4 << DCAN_ES_LEC_SHIFT)
+# define DCAN_ES_LEC_BIT0 (5 << DCAN_ES_LEC_SHIFT)
+# define DCAN_ES_LEC_CRC (6 << DCAN_ES_LEC_SHIFT)
+# define DCAN_ES_LEC_NOEVENT (7 << DCAN_ES_LEC_SHIFT)
+#define DCAN_ES_TXOK (1 << 3) /* Transmitted successfully */
+#define DCAN_ES_RXOK (1 << 4) /* Received successfully */
+#define DCAN_ES_EPASS (1 << 5) /* Error passive state */
+#define DCAN_ES_EWARN (1 << 6) /* Warning state (counter >= 96) */
+#define DCAN_ES_BOFF (1 << 7) /* Bus-Off state */
+#define DCAN_ES_PER (1 << 8) /* Parity/SECDED error detected */
+#define DCAN_ES_WAKEUPPND (1 << 9) /* Wake up pending */
+#define DCAN_ES_PDA (1 << 10) /* Power down acknowledge */
+
+/* Error Counter Register (ERRC) */
+
+#define DCAN_ERRC_TEC_SHIFT 0 /* Transmit error counter */
+#define DCAN_ERRC_TEC_MASK (0xff << DCAN_ERRC_TEC_SHIFT)
+#define DCAN_ERRC_REC_SHIFT 8 /* Receive error counter */
+#define DCAN_ERRC_REC_MASK (0x7f << DCAN_ERRC_REC_SHIFT)
+#define DCAN_ERRC_RP (1 << 15) /* Receive error passive */
+
+/* Bit Timing Register (BTR). All fields are programmed as (value - 1).
+ * Writable only with CTL.INIT and CTL.CCE both set. Total bit time is
+ * 8..25 tq; effective prescaler BRP+1 + 64*BRPE spans 1..1024.
+ */
+
+#define DCAN_BTR_BRP_SHIFT 0 /* Baud rate prescaler */
+#define DCAN_BTR_BRP_MASK (0x3f << DCAN_BTR_BRP_SHIFT)
+#define DCAN_BTR_BRP(n) (((n) & 0x3f) << DCAN_BTR_BRP_SHIFT)
+#define DCAN_BTR_SJW_SHIFT 6 /* Synchronization jump width */
+#define DCAN_BTR_SJW_MASK (3 << DCAN_BTR_SJW_SHIFT)
+#define DCAN_BTR_SJW(n) (((n) & 3) << DCAN_BTR_SJW_SHIFT)
+#define DCAN_BTR_TSEG1_SHIFT 8 /* Segment before sample point */
+#define DCAN_BTR_TSEG1_MASK (15 << DCAN_BTR_TSEG1_SHIFT)
+#define DCAN_BTR_TSEG1(n) (((n) & 15) << DCAN_BTR_TSEG1_SHIFT)
+#define DCAN_BTR_TSEG2_SHIFT 12 /* Segment after sample point */
+#define DCAN_BTR_TSEG2_MASK (7 << DCAN_BTR_TSEG2_SHIFT)
+#define DCAN_BTR_TSEG2(n) (((n) & 7) << DCAN_BTR_TSEG2_SHIFT)
+#define DCAN_BTR_BRPE_SHIFT 16 /* Prescaler extension */
+#define DCAN_BTR_BRPE_MASK (15 << DCAN_BTR_BRPE_SHIFT)
+#define DCAN_BTR_BRPE(n) (((n) & 15) << DCAN_BTR_BRPE_SHIFT)
+
+/* Interrupt Register (INT) */
+
+#define DCAN_INT_INT0ID_SHIFT 0 /* Line 0: mbox 1..64 or status */
+#define DCAN_INT_INT0ID_MASK (0xffff << DCAN_INT_INT0ID_SHIFT)
+#define DCAN_INT_INT0ID_STATUS 0x8000 /* ES register updated */
+#define DCAN_INT_INT1ID_SHIFT 16 /* Line 1: mbox 1..64 */
+#define DCAN_INT_INT1ID_MASK (0xff << DCAN_INT_INT1ID_SHIFT)
+
+/* Test Register (TEST). Writable only with CTL.TEST set. */
+
+#define DCAN_TEST_SILENT (1 << 3) /* Silent (bus monitor) mode */
+#define DCAN_TEST_LBACK (1 << 4) /* Internal loopback mode */
+#define DCAN_TEST_TX_SHIFT 5 /* CAN_TX pin control */
+#define DCAN_TEST_TX_MASK (3 << DCAN_TEST_TX_SHIFT)
+#define DCAN_TEST_RX (1 << 7) /* CAN_RX pin monitor */
+#define DCAN_TEST_EXL (1 << 8) /* External loopback mode */
+#define DCAN_TEST_RDA (1 << 9) /* RAM direct access enable */
+
+/* Parity Error Code Register (PERR) */
+
+#define DCAN_PERR_MSGNUM_SHIFT 0 /* Erroneous message object */
+#define DCAN_PERR_MSGNUM_MASK (0xff << DCAN_PERR_MSGNUM_SHIFT)
+#define DCAN_PERR_WORDNUM_SHIFT 8 /* Erroneous word (0..5) */
+#define DCAN_PERR_WORDNUM_MASK (7 << DCAN_PERR_WORDNUM_SHIFT)
+
+/* ECC Diagnostic Register (ECCDIAG): 0x5 disables diagnostic mode */
+
+#define DCAN_ECCDIAG_SHIFT 0
+#define DCAN_ECCDIAG_MASK (15 << DCAN_ECCDIAG_SHIFT)
+#define DCAN_ECCDIAG_DISABLE (5 << DCAN_ECCDIAG_SHIFT)
+#define DCAN_ECCDIAG_ENABLE (10 << DCAN_ECCDIAG_SHIFT)
+
+/* ECC Diagnostic Status Register (ECCDIAG_STAT) */
+
+#define DCAN_ECCDIAGSTAT_SEFLG (1 << 0) /* Single-bit error (diag mode) */
+#define DCAN_ECCDIAGSTAT_DEFLG (1 << 8) /* Double-bit error (diag mode) */
+
+/* ECC Control and Status Register (ECC_CS) */
+
+#define DCAN_ECCCS_ECCMODE_SHIFT 0 /* 0xA enables SBE correction */
+#define DCAN_ECCCS_ECCMODE_MASK (15 << DCAN_ECCCS_ECCMODE_SHIFT)
+#define DCAN_ECCCS_ECCMODE_ENABLE (10 << DCAN_ECCCS_ECCMODE_SHIFT)
+#define DCAN_ECCCS_SBERR (1 << 8) /* Single-bit error detected */
+#define DCAN_ECCCS_DEDIS (1 << 16) /* Disable double-bit detection */
+
+/* ECC Single-Bit Error Code Register (ECC_SERR) */
+
+#define DCAN_ECCSERR_MSGNUM_SHIFT 0
+#define DCAN_ECCSERR_MSGNUM_MASK (0xff << DCAN_ECCSERR_MSGNUM_SHIFT)
+
+/* IF1/IF2 Command Register (IFxCMD). Writing the message number starts
+ * the transfer; the register set is write-protected while BUSY is set.
+ */
+
+#define DCAN_IFCMD_MSGNUM_SHIFT 0 /* Message object 1..64 */
+#define DCAN_IFCMD_MSGNUM_MASK (0xff << DCAN_IFCMD_MSGNUM_SHIFT)
+#define DCAN_IFCMD_MSGNUM(n) (((n) & 0xff) << DCAN_IFCMD_MSGNUM_SHIFT)
+#define DCAN_IFCMD_DMAACTIVE (1 << 14) /* Request DMA after transfer */
+#define DCAN_IFCMD_BUSY (1 << 15) /* Transfer in progress */
+#define DCAN_IFCMD_DATAB (1 << 16) /* Transfer data bytes 4-7 */
+#define DCAN_IFCMD_DATAA (1 << 17) /* Transfer data bytes 0-3 */
+#define DCAN_IFCMD_TXRQST (1 << 18) /* WR: set TxRqst; RD: clear NewDat */
+#define DCAN_IFCMD_CLRINTPND (1 << 19) /* RD: clear IntPnd */
+#define DCAN_IFCMD_CONTROL (1 << 20) /* Transfer control bits */
+#define DCAN_IFCMD_ARB (1 << 21) /* Transfer arbitration bits */
+#define DCAN_IFCMD_MASK (1 << 22) /* Transfer mask bits */
+#define DCAN_IFCMD_WR (1 << 23) /* 1: IF -> RAM, 0: RAM -> IF */
+
+/* IF1/IF2/IF3 Mask Register (IFxMSK) */
+
+#define DCAN_IFMSK_MSK_SHIFT 0 /* Identifier mask */
+#define DCAN_IFMSK_MSK_MASK (0x1fffffff << DCAN_IFMSK_MSK_SHIFT)
+#define DCAN_IFMSK_MSK_STD_SHIFT 18 /* 11-bit ID mask position */
+#define DCAN_IFMSK_MDIR (1 << 30) /* Use Dir for filtering */
+#define DCAN_IFMSK_MXTD (1 << 31) /* Use IDE for filtering */
+
+/* IF1/IF2/IF3 Arbitration Register (IFxARB) */
+
+#define DCAN_IFARB_ID_SHIFT 0 /* 29-bit extended identifier */
+#define DCAN_IFARB_ID_MASK (0x1fffffff << DCAN_IFARB_ID_SHIFT)
+#define DCAN_IFARB_ID_STD_SHIFT 18 /* 11-bit ID at bits 28:18 */
+#define DCAN_IFARB_DIR (1 << 29) /* 1 = transmit object */
+#define DCAN_IFARB_XTD (1 << 30) /* Extended identifier */
+#define DCAN_IFARB_MSGVAL (1 << 31) /* Message object valid */
+
+/* IF1/IF2/IF3 Message Control Register (IFxMCTL) */
+
+#define DCAN_IFMCTL_DLC_SHIFT 0 /* Data length code 0..8 */
+#define DCAN_IFMCTL_DLC_MASK (15 << DCAN_IFMCTL_DLC_SHIFT)
+#define DCAN_IFMCTL_EOB (1 << 7) /* End of FIFO block */
+#define DCAN_IFMCTL_TXRQST (1 << 8) /* Transmit request pending */
+#define DCAN_IFMCTL_RMTEN (1 << 9) /* Remote frame sets TxRqst */
+#define DCAN_IFMCTL_RXIE (1 << 10) /* Receive interrupt enable */
+#define DCAN_IFMCTL_TXIE (1 << 11) /* Transmit interrupt enable */
+#define DCAN_IFMCTL_UMASK (1 << 12) /* Use acceptance mask */
+#define DCAN_IFMCTL_INTPND (1 << 13) /* Interrupt pending */
+#define DCAN_IFMCTL_MSGLST (1 << 14) /* Message lost (RX overwrite) */
+#define DCAN_IFMCTL_NEWDAT (1 << 15) /* New data available */
+
+/* IF3 Observation Register (IF3OBS). The low observation flags select
+ * which IF3 sections must be read (each byte at least once) before the
+ * hardware re-arms IF3 with the next queued message object; the status
+ * flags report the sections still unread in the current cycle.
+ */
+
+#define DCAN_IF3OBS_MASK_OBS (1 << 0) /* Mask section must be read */
+#define DCAN_IF3OBS_ARB_OBS (1 << 1) /* Arbitration must be read */
+#define DCAN_IF3OBS_CTRL_OBS (1 << 2) /* Message control must be read */
+#define DCAN_IF3OBS_DATAA_OBS (1 << 3) /* Data A must be read */
+#define DCAN_IF3OBS_DATAB_OBS (1 << 4) /* Data B must be read */
+#define DCAN_IF3OBS_SM (1 << 8) /* Mask section unread */
+#define DCAN_IF3OBS_SA (1 << 9) /* Arbitration unread */
+#define DCAN_IF3OBS_SC (1 << 10) /* Control unread */
+#define DCAN_IF3OBS_SDA (1 << 11) /* Data A unread */
+#define DCAN_IF3OBS_SDB (1 << 12) /* Data B unread */
+#define DCAN_IF3OBS_UPD (1 << 15) /* New data loaded into IF3 */
+
+/* TX/RX IO Control Registers (TIOC/RIOC). Writable only with CTL.INIT
+ * set; Func/Dir/OD are forced to functional values when INIT is cleared.
+ */
+
+#define DCAN_IOC_IN (1 << 0) /* Pin input value */
+#define DCAN_IOC_OUT (1 << 1) /* Pin output value (GIO mode) */
+#define DCAN_IOC_DIR (1 << 2) /* Pin direction (GIO mode) */
+#define DCAN_IOC_FUNC (1 << 3) /* 1 = CAN functional mode */
+#define DCAN_IOC_OD (1 << 16) /* Open drain enable */
+#define DCAN_IOC_PD (1 << 17) /* Pull disable */
+#define DCAN_IOC_PU (1 << 18) /* Pullup select */
+
+#endif /* __ARCH_ARM_SRC_RM57_HARDWARE_RM57_DCAN_H */
diff --git a/arch/arm/src/rm57/hardware/rm57_dma.h b/arch/arm/src/rm57/hardware/rm57_dma.h
new file mode 100644
index 00000000000..460699de3fb
--- /dev/null
+++ b/arch/arm/src/rm57/hardware/rm57_dma.h
@@ -0,0 +1,475 @@
+/****************************************************************************
+ * arch/arm/src/rm57/hardware/rm57_dma.h
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/* Register offsets and bit fields below are transcribed from TI's TRM
+ * (SPNU562A, chapter 20 "Direct Memory Access Controller (DMA) Module"),
+ * not assumed from another Hercules part - the RM57L843 DMA controller
+ * (32 channels, 48 hardware requests, 2 ports) differs materially from
+ * TMS570LS04x's smaller DMA instance.
+ */
+
+#ifndef __ARCH_ARM_SRC_RM57_HARDWARE_RM57_DMA_H
+#define __ARCH_ARM_SRC_RM57_HARDWARE_RM57_DMA_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include "hardware/rm57l843_memorymap.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* DMA Control Register Offsets */
+
+#define RM57_DMA_GCTRL_OFFSET 0x0000 /* Global Control Register */
+#define RM57_DMA_PEND_OFFSET 0x0004 /* Channel Pending Register */
+#define RM57_DMA_FBREG_OFFSET 0x0008 /* Fall Back Register */
+#define RM57_DMA_DMASTAT_OFFSET 0x000c /* DMA Status Register */
+#define RM57_DMA_DMAREVID_OFFSET 0x0010 /* DMA Revision ID Register */
+#define RM57_DMA_HWCHENAS_OFFSET 0x0014 /* HW Channel Enable Set/Status */
+#define RM57_DMA_HWCHENAR_OFFSET 0x001c /* HW Channel Enable Reset/Status */
+#define RM57_DMA_SWCHENAS_OFFSET 0x0024 /* SW Channel Enable Set/Status */
+#define RM57_DMA_SWCHENAR_OFFSET 0x002c /* SW Channel Enable Reset/Status */
+#define RM57_DMA_CHPRIOS_OFFSET 0x0034 /* Channel Priority Set */
+#define RM57_DMA_CHPRIOR_OFFSET 0x003c /* Channel Priority Reset */
+#define RM57_DMA_GCHIENAS_OFFSET 0x0044 /* Global Channel Interrupt Enable Set */
+#define RM57_DMA_GCHIENAR_OFFSET 0x004c /* Global Channel Interrupt Enable Reset */
+
+/* DMA Request Assignment Registers: DREQASI(n) covers channels
+ * 4n..4n+3 (n = 0..7), see RM57_DMA_DREQASI_CHSHIFT() below.
+ */
+
+#define RM57_DMA_DREQASI_OFFSET(n) (0x0054 + ((n) << 2))
+
+/* Port Assignment Registers: PAR(n) covers channels 8n..8n+7 (n = 0..3),
+ * see RM57_DMA_PAR_CHSHIFT() below.
+ */
+
+#define RM57_DMA_PAR_OFFSET(n) (0x0094 + ((n) << 2))
+
+#define RM57_DMA_FTCMAP_OFFSET 0x00b4 /* FTC Interrupt Mapping (Group A/B) */
+#define RM57_DMA_LFSMAP_OFFSET 0x00bc /* LFS Interrupt Mapping (Group A/B) */
+#define RM57_DMA_HBCMAP_OFFSET 0x00c4 /* HBC Interrupt Mapping (Group A/B) */
+#define RM57_DMA_BTCMAP_OFFSET 0x00cc /* BTC Interrupt Mapping (Group A/B) */
+#define RM57_DMA_BERMAP_OFFSET 0x00d4 /* BER Interrupt Mapping (Group A/B) */
+#define RM57_DMA_FTCINTENAS_OFFSET 0x00dc /* FTC Interrupt Enable Set */
+#define RM57_DMA_FTCINTENAR_OFFSET 0x00e4 /* FTC Interrupt Enable Reset */
+#define RM57_DMA_LFSINTENAS_OFFSET 0x00ec /* LFS Interrupt Enable Set */
+#define RM57_DMA_LFSINTENAR_OFFSET 0x00f4 /* LFS Interrupt Enable Reset */
+#define RM57_DMA_HBCINTENAS_OFFSET 0x00fc /* HBC Interrupt Enable Set */
+#define RM57_DMA_HBCINTENAR_OFFSET 0x0104 /* HBC Interrupt Enable Reset */
+#define RM57_DMA_BTCINTENAS_OFFSET 0x010c /* BTC Interrupt Enable Set */
+#define RM57_DMA_BTCINTENAR_OFFSET 0x0114 /* BTC Interrupt Enable Reset */
+#define RM57_DMA_GINTFLAG_OFFSET 0x011c /* Global Interrupt Flag (OR of FTC/LFS/HBC/BTC) */
+#define RM57_DMA_FTCFLAG_OFFSET 0x0124 /* FTC Interrupt Flag (W1C) */
+#define RM57_DMA_LFSFLAG_OFFSET 0x012c /* LFS Interrupt Flag (W1C) */
+#define RM57_DMA_HBCFLAG_OFFSET 0x0134 /* HBC Interrupt Flag (W1C) */
+#define RM57_DMA_BTCFLAG_OFFSET 0x013c /* BTC Interrupt Flag (W1C) */
+#define RM57_DMA_BERFLAG_OFFSET 0x0144 /* BER Interrupt Flag (W1C) */
+#define RM57_DMA_FTCAOFFSET_OFFSET 0x014c /* FTCA channel offset (Group A) */
+#define RM57_DMA_LFSAOFFSET_OFFSET 0x0150 /* LFSA channel offset (Group A) */
+#define RM57_DMA_HBCAOFFSET_OFFSET 0x0154 /* HBCA channel offset (Group A) */
+#define RM57_DMA_BTCAOFFSET_OFFSET 0x0158 /* BTCA channel offset (Group A) */
+#define RM57_DMA_BERAOFFSET_OFFSET 0x015c /* BERA channel offset (Group A) */
+#define RM57_DMA_FTCBOFFSET_OFFSET 0x0160 /* FTCB channel offset (Group B) */
+#define RM57_DMA_LFSBOFFSET_OFFSET 0x0164 /* LFSB channel offset (Group B) */
+#define RM57_DMA_HBCBOFFSET_OFFSET 0x0168 /* HBCB channel offset (Group B) */
+#define RM57_DMA_BTCBOFFSET_OFFSET 0x016c /* BTCB channel offset (Group B) */
+#define RM57_DMA_BERBOFFSET_OFFSET 0x0170 /* BERB channel offset (Group B) */
+#define RM57_DMA_PTCRL_OFFSET 0x0178 /* Port Control Register */
+#define RM57_DMA_RTCTRL_OFFSET 0x017c /* RAM Test Control Register */
+#define RM57_DMA_DCTRL_OFFSET 0x0180 /* Debug Control Register */
+#define RM57_DMA_WPR_OFFSET 0x0184 /* Watch Point Register */
+#define RM57_DMA_WMR_OFFSET 0x0188 /* Watch Mask Register */
+#define RM57_DMA_FAACSADDR_OFFSET 0x018c /* Fifo A Active Channel Source Address Register */
+#define RM57_DMA_FAACDADDR_OFFSET 0x0190 /* Fifo A Active Channel Destination Address Register */
+#define RM57_DMA_FAACTC_OFFSET 0x0194 /* Fifo A Active Channel Transfer Address Register */
+#define RM57_DMA_FBACSADDR_OFFSET 0x0198 /* Fifo B Active Channel Source Address Register */
+#define RM57_DMA_FBACDADDR_OFFSET 0x019c /* Fifo B Active Channel Destination Address Register */
+#define RM57_DMA_FBACTC_OFFSET 0x01a0 /* Fifo B Active Channel Transfer Address Register */
+#define RM57_DMA_DMAPECR_OFFSET 0x01a8 /* DMA Parity Control Register */
+#define RM57_DMA_DMAPAR_OFFSET 0x01ac /* DMA Parity Error Address Register */
+#define RM57_DMA_DMAMPCTRL1_OFFSET 0x01b0 /* DMA Memory Protection Control Register 1 */
+#define RM57_DMA_DMAMPST1_OFFSET 0x01b4 /* DMA Memory Protection Status Register 1 */
+#define RM57_DMA_DMAMPR0S_OFFSET 0x01b8 /* DMA Memory Protection Region 0 Start Address Register */
+#define RM57_DMA_DMAMPR0E_OFFSET 0x01bc /* DMA Memory Protection Region 0 End Address Register */
+#define RM57_DMA_DMAMPR1S_OFFSET 0x01c0 /* DMA Memory Protection Region 1 Start Address Register */
+#define RM57_DMA_DMAMPR1E_OFFSET 0x01c4 /* DMA Memory Protection Region 1 End Address Register */
+#define RM57_DMA_DMAMPR2S_OFFSET 0x01c8 /* DMA Memory Protection Region 2 Start Address Register */
+#define RM57_DMA_DMAMPR2E_OFFSET 0x01cc /* DMA Memory Protection Region 2 End Address Register */
+#define RM57_DMA_DMAMPR3S_OFFSET 0x01d0 /* DMA Memory Protection Region 3 Start Address Register */
+#define RM57_DMA_DMAMPR3E_OFFSET 0x01d4 /* DMA Memory Protection Region 3 End Address Register */
+#define RM57_DMA_DMAMPCTRL2_OFFSET 0x01d8 /* DMA Memory Protection Control Register 2 */
+#define RM57_DMA_DMAMPST2_OFFSET 0x01dc /* DMA Memory Protection Status Register 2 */
+#define RM57_DMA_DMAMPR4S_OFFSET 0x01e0 /* DMA Memory Protection Region 4 Start Address Register */
+#define RM57_DMA_DMAMPR4E_OFFSET 0x01e4 /* DMA Memory Protection Region 4 End Address Register */
+#define RM57_DMA_DMAMPR5S_OFFSET 0x01e8 /* DMA Memory Protection Region 5 Start Address Register */
+#define RM57_DMA_DMAMPR5E_OFFSET 0x01ec /* DMA Memory Protection Region 5 End Address Register */
+#define RM57_DMA_DMAMPR6S_OFFSET 0x01f0 /* DMA Memory Protection Region 6 Start Address Register */
+#define RM57_DMA_DMAMPR6E_OFFSET 0x01f4 /* DMA Memory Protection Region 6 End Address Register */
+#define RM57_DMA_DMAMPR7S_OFFSET 0x01f8 /* DMA Memory Protection Region 7 Start Address Register */
+#define RM57_DMA_DMAMPR7E_OFFSET 0x01fc /* DMA Memory Protection Region 7 End Address Register */
+#define RM57_DMA_DMASECCCTRL_OFFSET 0x0228 /* DMA Single-bit ECC Control Register */
+#define RM57_DMA_DMAECCSBE_OFFSET 0x0230 /* DMA ECC Single-bit Error Address Register */
+#define RM57_DMA_FIFOASTATREG_OFFSET 0x0240 /* FIFO A Status Register */
+#define RM57_DMA_FIFOBSTATREG_OFFSET 0x0244 /* FIFO B Status Register */
+#define RM57_DMA_DMAREQPS1_OFFSET 0x0330 /* DMA Request Polarity Select Register 1 */
+#define RM57_DMA_DMAREQPS0_OFFSET 0x0334 /* DMA Request Polarity Select Register 0 */
+#define RM57_DMA_TERECTRL_OFFSET 0x0340 /* TER Event Control Register */
+#define RM57_DMA_TERFLAG_OFFSET 0x0344 /* TER Event Flag Register */
+#define RM57_DMA_TERROFFSET_OFFSET 0x0348 /* TER Event Channel Offset Register */
+
+/* Many DMA registers pack one status/control bit per channel (bit n =
+ * channel n, TRM Figures 20-20/20-21/20-23..20-30/20-43..20-59/20-103/
+ * 20-104/20-105/20-106/20-108): PEND, DMASTAT, HWCHENAS/R, SWCHENAS/R,
+ * CHPRIOS/R, GCHIENAS/R, FTCMAP/LFSMAP/HBCMAP/BTCMAP/BERMAP,
+ * FTCINTENAS/R, LFSINTENAS/R, HBCINTENAS/R, BTCINTENAS/R, GINTFLAG,
+ * FTCFLAG/LFSFLAG/HBCFLAG/BTCFLAG/BERFLAG, FIFOASTATREG, FIFOBSTATREG,
+ * DMAREQPS0/1 (request lines, not channels), TERFLAG.
+ */
+
+#define DMA_CHANNEL_BIT(n) ((uint32_t)1 << (n))
+
+/* Channel offset registers (FTCAOFFSET, LFSAOFFSET, HBCAOFFSET,
+ * BTCAOFFSET, BERAOFFSET, FTCBOFFSET, LFSBOFFSET, HBCBOFFSET,
+ * BTCBOFFSET, BERBOFFSET, TERROFFSET; TRM Figures 20-60..20-67/20-109):
+ * bits 7-6 sbz, bits 5-0 hold the channel causing the pending interrupt
+ * (0 = none, n+1 = channel n); reading the register clears the
+ * corresponding flag bit for the highest-priority pending channel.
+ */
+
+#define DMA_INTOFFSET_CHANNEL_SHIFT (0)
+#define DMA_INTOFFSET_CHANNEL_MASK (0x3f << DMA_INTOFFSET_CHANNEL_SHIFT)
+# define DMA_INTOFFSET_NONE (0)
+# define DMA_INTOFFSET_CHANNEL(n) ((uint32_t)(n) + 1)
+
+/* DMA Revision ID Register (DMAREVID) */
+
+#define DMA_DMAREVID_MINOR_SHIFT (0) /* Bits 5-0: Minor revision */
+#define DMA_DMAREVID_MINOR_MASK (0x3f << DMA_DMAREVID_MINOR_SHIFT)
+#define DMA_DMAREVID_MAJOR_SHIFT (8) /* Bits 10-8: Major revision */
+#define DMA_DMAREVID_MAJOR_MASK (0x7 << DMA_DMAREVID_MAJOR_SHIFT)
+#define DMA_DMAREVID_FUNC_SHIFT (16) /* Bits 27-16: Module family (A0Dh) */
+#define DMA_DMAREVID_FUNC_MASK (0xfff << DMA_DMAREVID_FUNC_SHIFT)
+#define DMA_DMAREVID_SCHEME_SHIFT (30) /* Bits 31-30: REVID scheme */
+#define DMA_DMAREVID_SCHEME_MASK (0x3 << DMA_DMAREVID_SCHEME_SHIFT)
+
+/* Global Control Register (GCTRL) bits */
+
+#define DMA_GCTRL_DMARES (1 << 0) /* Bit 0: Software reset */
+#define DMA_GCTRL_DEBUGMODE_SHIFT (8)
+#define DMA_GCTRL_DEBUGMODE_MASK (3 << DMA_GCTRL_DEBUGMODE_SHIFT)
+#define DMA_GCTRL_BUS_BUSY (1 << 14) /* Bit 14: External bus busy (read-only) */
+#define DMA_GCTRL_DMA_EN (1 << 16) /* Bit 16: DMA enable */
+
+/* DMA Request Assignment Registers (DREQASI0-7): each register packs 4
+ * channels; within the register, channel (4n+k)'s 6-bit ASI field sits at
+ * bit offset (24 - 8*k) for k = 0..3 (TRM Figure 20-31/20-32).
+ */
+
+#define DMA_DREQASI_FIELD_MASK (0x3f)
+# define RM57_DMA_DREQASI_CHSHIFT(ch) (24 - 8 * ((ch) & 3))
+
+/* Port Assignment Registers (PAR0-3): each register packs 8 channels in
+ * 4-bit fields, with channel (8n+k) at bit offset 4*(7-k) - i.e. channel
+ * 8n+0 occupies the most significant nibble. This matches the position
+ * HALCoGen computes in dmaSetCtrlPacket():
+ *
+ * i = channel / 8; j = channel % 8; j = 7 - j; j = j * 4;
+ * dmaREG->PAR[i] = (PAR[i] & ~(0xf << j)) | (PORTASGN << j);
+ *
+ * The field value encoding below is transcribed from the TRM's
+ * value/description table.
+ */
+
+# define RM57_DMA_PAR_CHSHIFT(ch) (4 * (7 - ((ch) & 7)))
+#define DMA_PAR_FIELD_MASK (0xf)
+
+#define DMA_PAR_AB_A_RD_B_WR (0x1) /* Port A+B combined: A=read, B=write (used for TX: SRAM->peripheral) */
+#define DMA_PAR_A_ONLY (0x2) /* Port A only (memory-to-memory) */
+#define DMA_PAR_B_ONLY (0x3) /* Port B only */
+#define DMA_PAR_AB_B_RD_A_WR (0x0) /* Port A+B combined: B=read, A=write (used for RX: peripheral->SRAM; also the hardware reset default) */
+
+/* Port Control Register (PTCRL) */
+
+#define DMA_PTCRL_PSFRLQ (1 << 0) /* Bit 0: Low-priority queue: 0=fixed, 1=rotate */
+#define DMA_PTCRL_PSFRHQ (1 << 1) /* Bit 1: High-priority queue: 0=fixed, 1=rotate */
+#define DMA_PTCRL_BYA (1 << 2) /* Bit 2: Bypass FIFO A (limit depth to 1 element) */
+#define DMA_PTCRL_PENDA (1 << 8) /* Bit 8: Port A transfers pending (read-only) */
+#define DMA_PTCRL_BYB (1 << 18) /* Bit 18: Bypass FIFO B (limit depth to 1 element) */
+#define DMA_PTCRL_PENDB (1 << 24) /* Bit 24: Port B transfers pending (read-only) */
+
+/* RAM Test Control Register (RTCTRL) */
+
+#define DMA_RTCTRL_RTC (1 << 0) /* Bit 0: open write access to reserved control-packet RAM */
+
+/* Debug Control Register (DCTRL) */
+
+#define DMA_DCTRL_DBGEN (1 << 0) /* Bit 0: Debug/watch point enable (debugger only) */
+#define DMA_DCTRL_DMADBGS (1 << 16) /* Bit 16: Watch point hit (W1C) */
+#define DMA_DCTRL_CHNUM_SHIFT (24) /* Bits 28-24: Channel that matched the watch point */
+#define DMA_DCTRL_CHNUM_MASK (0x1f << DMA_DCTRL_CHNUM_SHIFT)
+
+/* DMA Control Packet Layout (control-packet RAM base = RM57_DMARAM_BASE)
+ *
+ * Primary control packet for channel n is at RM57_DMARAM_BASE + n*0x20;
+ * the read-only working control packet for channel n is at
+ * RM57_DMARAM_BASE + 0x800 + n*0x10 (TRM Figure 20-5, sections 20.3.2.*).
+ *
+ * Note the two strides differ: a primary packet is eight words wide
+ * (ISADDR/IDADDR/ITCOUNT/reserved/CHCTRL/EIOFF/FIOFF/reserved) while a
+ * working packet is only four (CSADDR/CDADDR/CTCOUNT/reserved). Using the
+ * primary stride for both put every working packet except channel 0's at
+ * the wrong address, so rm57_dmaresidual() always read back zero.
+ */
+
+#define RM57_DMA_PCP_STRIDE 0x0020
+#define RM57_DMA_WCP_STRIDE 0x0010
+#define RM57_DMA_WORKING_CP_OFFSET 0x0800
+
+#define RM57_DMA_PCP_ISADDR_OFFSET 0x00 /* Initial Source Address */
+#define RM57_DMA_PCP_IDADDR_OFFSET 0x04 /* Initial Destination Address */
+#define RM57_DMA_PCP_ITCOUNT_OFFSET 0x08 /* Initial Transfer Count (frames|elements) */
+#define RM57_DMA_PCP_CHCTRL_OFFSET 0x10 /* Channel Control */
+#define RM57_DMA_PCP_EIOFF_OFFSET 0x14 /* Element Index Offset */
+#define RM57_DMA_PCP_FIOFF_OFFSET 0x18 /* Frame Index Offset */
+
+#define RM57_DMA_WCP_CSADDR_OFFSET 0x00 /* Current Source Address (read-only) */
+#define RM57_DMA_WCP_CDADDR_OFFSET 0x04 /* Current Destination Address (read-only) */
+#define RM57_DMA_WCP_CTCOUNT_OFFSET 0x08 /* Current Transfer Count = residual (read-only) */
+
+/* Initial/Current Transfer Count Register (ITCOUNT/CTCOUNT): 13-bit frame
+ * count and 13-bit element count (TRM 20.3.2.3/20.3.2.9).
+ */
+
+#define DMA_TCOUNT_ETCOUNT_SHIFT (0)
+#define DMA_TCOUNT_ETCOUNT_MASK (0x1fff << DMA_TCOUNT_ETCOUNT_SHIFT)
+# define DMA_TCOUNT_ETCOUNT(n) ((uint32_t)(n) << DMA_TCOUNT_ETCOUNT_SHIFT)
+#define DMA_TCOUNT_FTCOUNT_SHIFT (16)
+#define DMA_TCOUNT_FTCOUNT_MASK (0x1fff << DMA_TCOUNT_FTCOUNT_SHIFT)
+# define DMA_TCOUNT_FTCOUNT(n) ((uint32_t)(n) << DMA_TCOUNT_FTCOUNT_SHIFT)
+
+/* Channel Control Register (CHCTRL, TRM Figure 20-113/Table 20-103) */
+
+#define DMA_CHCTRL_AIM (1 << 0) /* Bit 0: Auto-initiation mode */
+#define DMA_CHCTRL_ADDMW_SHIFT (1) /* Bits 2-1: Addressing mode write */
+#define DMA_CHCTRL_ADDMW_MASK (3 << DMA_CHCTRL_ADDMW_SHIFT)
+# define DMA_CHCTRL_ADDMW_CONST (0 << DMA_CHCTRL_ADDMW_SHIFT)
+# define DMA_CHCTRL_ADDMW_INCR (1 << DMA_CHCTRL_ADDMW_SHIFT)
+# define DMA_CHCTRL_ADDMW_INDEXED (3 << DMA_CHCTRL_ADDMW_SHIFT)
+#define DMA_CHCTRL_ADDMR_SHIFT (3) /* Bits 4-3: Addressing mode read */
+#define DMA_CHCTRL_ADDMR_MASK (3 << DMA_CHCTRL_ADDMR_SHIFT)
+# define DMA_CHCTRL_ADDMR_CONST (0 << DMA_CHCTRL_ADDMR_SHIFT)
+# define DMA_CHCTRL_ADDMR_INCR (1 << DMA_CHCTRL_ADDMR_SHIFT)
+# define DMA_CHCTRL_ADDMR_INDEXED (3 << DMA_CHCTRL_ADDMR_SHIFT)
+#define DMA_CHCTRL_TTYPE (1 << 8) /* Bit 8: 0=frame trigger, 1=block trigger */
+#define DMA_CHCTRL_WES_SHIFT (12) /* Bits 13-12: Write element size */
+#define DMA_CHCTRL_WES_MASK (3 << DMA_CHCTRL_WES_SHIFT)
+# define DMA_CHCTRL_WES_8BIT (0 << DMA_CHCTRL_WES_SHIFT)
+# define DMA_CHCTRL_WES_16BIT (1 << DMA_CHCTRL_WES_SHIFT)
+# define DMA_CHCTRL_WES_32BIT (2 << DMA_CHCTRL_WES_SHIFT)
+# define DMA_CHCTRL_WES_64BIT (3 << DMA_CHCTRL_WES_SHIFT)
+#define DMA_CHCTRL_RES_SHIFT (14) /* Bits 15-14: Read element size */
+#define DMA_CHCTRL_RES_MASK (3 << DMA_CHCTRL_RES_SHIFT)
+# define DMA_CHCTRL_RES_8BIT (0 << DMA_CHCTRL_RES_SHIFT)
+# define DMA_CHCTRL_RES_16BIT (1 << DMA_CHCTRL_RES_SHIFT)
+# define DMA_CHCTRL_RES_32BIT (2 << DMA_CHCTRL_RES_SHIFT)
+# define DMA_CHCTRL_RES_64BIT (3 << DMA_CHCTRL_RES_SHIFT)
+#define DMA_CHCTRL_CHAIN_SHIFT (16) /* Bits 21-16: Chained channel (0=none, n+1=channel n) */
+#define DMA_CHCTRL_CHAIN_MASK (0x3f << DMA_CHCTRL_CHAIN_SHIFT)
+# define DMA_CHCTRL_CHAIN(n) (((uint32_t)(n) + 1) << DMA_CHCTRL_CHAIN_SHIFT)
+# define DMA_CHCTRL_CHAIN_NONE (0 << DMA_CHCTRL_CHAIN_SHIFT)
+
+/* Element/Frame Index Offset Registers (EIOFF/FIOFF): 13-bit source and
+ * destination byte offsets (TRM 20.3.2.5/20.3.2.6). Unused by the serial
+ * RX/TX DMA scheme in this port (element size is fixed at 1 byte with
+ * post-increment addressing), provided for completeness.
+ */
+
+#define DMA_IOFF_SRC_SHIFT (0)
+#define DMA_IOFF_SRC_MASK (0x1fff << DMA_IOFF_SRC_SHIFT)
+#define DMA_IOFF_DST_SHIFT (16)
+#define DMA_IOFF_DST_MASK (0x1fff << DMA_IOFF_DST_SHIFT)
+
+/* FIFO A/B Active Channel Transfer Count Registers (FAACTC/FBACTC) share
+ * the same 13-bit frame/element count layout as ITCOUNT/CTCOUNT - reuse
+ * the DMA_TCOUNT_* macros above.
+ */
+
+/* ECC Control Register (DMAPECR, offset 0x1a8). Any ECC_ENA value other
+ * than 5h enables ECC.
+ */
+
+#define DMA_DMAPECR_ECC_ENA_SHIFT (0) /* Bits 3-0: ECC enable */
+#define DMA_DMAPECR_ECC_ENA_MASK (0xf << DMA_DMAPECR_ECC_ENA_SHIFT)
+# define DMA_DMAPECR_ECC_DISABLE (0x5 << DMA_DMAPECR_ECC_ENA_SHIFT)
+# define DMA_DMAPECR_ECC_ENABLE (0xa << DMA_DMAPECR_ECC_ENA_SHIFT)
+#define DMA_DMAPECR_TEST (1 << 8) /* Bit 8: Memory-map the parity bits */
+#define DMA_DMAPECR_ERRA (1 << 16) /* Bit 16: 1=disable DMA immediately on parity error */
+
+/* DMA ECC Error Address Register (DMAPAR, offset 0x1ac) */
+
+#define DMA_DMAPAR_ERRORADDRESS_SHIFT (0) /* Bits 11-0: address of first ECC error */
+#define DMA_DMAPAR_ERRORADDRESS_MASK (0xfff << DMA_DMAPAR_ERRORADDRESS_SHIFT)
+#define DMA_DMAPAR_EDFLAG (1 << 24) /* Bit 24: ECC error detected (W1C) */
+
+/* Memory Protection Control Registers (DMAMPCTRL1 covers regions 0-3,
+ * DMAMPCTRL2 covers regions 4-7): each region occupies an 8-bit lane at
+ * bit offset 8*r, where r is the *local* region index (0-3) within
+ * whichever of the two registers is being accessed (TRM Figures 20-81/
+ * 20-91).
+ */
+
+#define DMA_MPCTRL_REGENA(r) ((uint32_t)1 << (8 * (r)))
+#define DMA_MPCTRL_REGAP_SHIFT(r) (8 * (r) + 1)
+#define DMA_MPCTRL_REGAP_MASK(r) (0x3 << DMA_MPCTRL_REGAP_SHIFT(r))
+# define DMA_MPCTRL_REGAP_ALL (0x0) /* All accesses allowed */
+# define DMA_MPCTRL_REGAP_RO (0x1) /* Read only */
+# define DMA_MPCTRL_REGAP_WO (0x2) /* Write only */
+# define DMA_MPCTRL_REGAP_NONE (0x3) /* No accesses allowed */
+#define DMA_MPCTRL_INTENA(r) ((uint32_t)1 << (8 * (r) + 3))
+#define DMA_MPCTRL_INTAB(r) ((uint32_t)1 << (8 * (r) + 4)) /* 0=Group A (VIM) 1=Group B (2nd CPU) */
+
+/* Memory Protection Status Registers (DMAMPST1 covers regions 0-3,
+ * DMAMPST2 covers regions 4-7): one W1C fault flag per region, at the
+ * same 8-bit lane offset used above (TRM Figures 20-82/20-92).
+ */
+
+#define DMA_MPST_REGFT(r) ((uint32_t)1 << (8 * (r)))
+
+/* Memory Protection Region Start/End Address Registers (DMAMPRnS/DMAMPRnE,
+ * n = 0..7): plain 32-bit addresses. The start address is truncated down
+ * to the nearest word; the end address is rounded up to the nearest word
+ * (64-bit word if the channel uses 64-bit transfers).
+ */
+
+/* DMA Single-Bit ECC Control Register (DMASECCCTRL) */
+
+#define DMA_DMASECCCTRL_EDACMODE_SHIFT (0) /* Bits 3-0: SBE correction */
+#define DMA_DMASECCCTRL_EDACMODE_MASK (0xf << DMA_DMASECCCTRL_EDACMODE_SHIFT)
+# define DMA_DMASECCCTRL_EDACMODE_DIS (0x5 << DMA_DMASECCCTRL_EDACMODE_SHIFT)
+# define DMA_DMASECCCTRL_EDACMODE_EN (0xa << DMA_DMASECCCTRL_EDACMODE_SHIFT)
+#define DMA_DMASECCCTRL_SBE_EVT_EN_SHIFT (8) /* Bits 11-8: SBE event to ESM */
+#define DMA_DMASECCCTRL_SBE_EVT_EN_MASK (0xf << DMA_DMASECCCTRL_SBE_EVT_EN_SHIFT)
+# define DMA_DMASECCCTRL_SBE_EVT_DIS (0x5 << DMA_DMASECCCTRL_SBE_EVT_EN_SHIFT)
+# define DMA_DMASECCCTRL_SBE_EVT_EN (0xa << DMA_DMASECCCTRL_SBE_EVT_EN_SHIFT)
+#define DMA_DMASECCCTRL_SBERR (1 << 16) /* Bit 16: SBE occurred and was corrected (W1C) */
+
+/* DMA ECC Single-Bit Error Address Register (DMAECCSBE) */
+
+#define DMA_DMAECCSBE_ERRORADDRESS_SHIFT (0) /* Bits 11-0: RAM address of first SBE */
+#define DMA_DMAECCSBE_ERRORADDRESS_MASK (0xfff << DMA_DMAECCSBE_ERRORADDRESS_SHIFT)
+
+/* Transaction Parity Error Event Control Register (TERECTRL) */
+
+#define DMA_TERECTRL_TER_EN_SHIFT (0) /* Bits 3-0: TER detection enable */
+#define DMA_TERECTRL_TER_EN_MASK (0xf << DMA_TERECTRL_TER_EN_SHIFT)
+# define DMA_TERECTRL_TER_DISABLE (0x5 << DMA_TERECTRL_TER_EN_SHIFT)
+# define DMA_TERECTRL_TER_ENABLE (0xa << DMA_TERECTRL_TER_EN_SHIFT)
+#define DMA_TERECTRL_TER_ERR (1 << 16) /* Bit 16: Transaction parity error occurred (W1C) */
+
+/* DMA hardware request line numbers (SPNS215C Table 6-41 "DMA Request
+ * Line Connection", pages 121-123; default 1:1 DREQASI mapping). These
+ * are *request* numbers, passed to rm57_dmachannel() - they are not
+ * channel numbers.
+ *
+ * Several lines are shared by multiple peripherals (a hardware OR of
+ * sources); the application must ensure only one source per shared line
+ * is enabled at a time. Each macro below is named after one canonical
+ * source; "alt:" in the comment lists the other sources sharing that
+ * same DMAREQ line, for reference.
+ */
+
+#define DMA_REQ_MIBSPI1_1 0 /* MIBSPI1[1] (SPI1 rx, compatibility mode) */
+#define DMA_REQ_MIBSPI1_0 1 /* MIBSPI1[0] (SPI1 tx, compatibility mode) */
+#define DMA_REQ_MIBSPI2_1 2 /* MIBSPI2[1] (SPI2 rx, compatibility mode) */
+#define DMA_REQ_MIBSPI2_0 3 /* MIBSPI2[0] (SPI2 tx, compatibility mode) */
+#define DMA_REQ_MIBSPI1_2 4 /* MIBSPI1[2]; alt: MIBSPI3[2], DCAN2 IF3 */
+#define DMA_REQ_MIBSPI1_3 5 /* MIBSPI1[3]; alt: MIBSPI3[3], DCAN2 IF2 */
+#define DMA_REQ_DCAN1_IF2 6 /* DCAN1 IF2; alt: MIBSPI5[2] */
+#define DMA_REQ_MIBADC1_EVT 7 /* MIBADC1 event; alt: MIBSPI5[3] */
+#define DMA_REQ_MIBSPI1_4 8 /* MIBSPI1[4]; alt: MIBSPI3[4], DCAN1 IF1 */
+#define DMA_REQ_MIBSPI1_5 9 /* MIBSPI1[5]; alt: MIBSPI3[5], DCAN2 IF1 */
+#define DMA_REQ_MIBADC1_G1 10 /* MIBADC1 G1; alt: MIBSPI5[4] */
+#define DMA_REQ_MIBADC1_G2 11 /* MIBADC1 G2; alt: MIBSPI5[5] */
+#define DMA_REQ_RTI1_0 12 /* RTI1 DMAREQ0; alt: MIBSPI1[6], MIBSPI3[6] */
+#define DMA_REQ_RTI1_1 13 /* RTI1 DMAREQ1; alt: MIBSPI1[7], MIBSPI3[7] */
+#define DMA_REQ_MIBSPI3_1 14 /* MIBSPI3[1]; alt: MibADC2 event, MIBSPI5[6] */
+#define DMA_REQ_MIBSPI3_0 15 /* MIBSPI3[0]; alt: MIBSPI5[7] */
+#define DMA_REQ_MIBSPI1_8 16 /* MIBSPI1[8]; alt: MIBSPI3[8], DCAN1 IF3, MibADC2 G1 */
+#define DMA_REQ_MIBSPI1_9 17 /* MIBSPI1[9]; alt: MIBSPI3[9], DCAN3 IF1, MibADC2 G2 */
+#define DMA_REQ_RTI1_2 18 /* RTI1 DMAREQ2; alt: MIBSPI5[8] */
+#define DMA_REQ_RTI1_3 19 /* RTI1 DMAREQ3; alt: MIBSPI5[9] */
+#define DMA_REQ_NHET1_4 20 /* NHET1 DMAREQ[4]; alt: NHET2 DMAREQ[4], DCAN3 IF2 */
+#define DMA_REQ_NHET1_5 21 /* NHET1 DMAREQ[5]; alt: NHET2 DMAREQ[5], DCAN3 IF3 */
+#define DMA_REQ_MIBSPI1_10 22 /* MIBSPI1[10]; alt: MIBSPI3[10], MIBSPI5[10] */
+#define DMA_REQ_MIBSPI1_11 23 /* MIBSPI1[11]; alt: MIBSPI3[11], MIBSPI5[11] */
+#define DMA_REQ_NHET1_6 24 /* NHET1 DMAREQ[6]; alt: NHET2 DMAREQ[6], MIBSPI5[12] */
+#define DMA_REQ_NHET1_7 25 /* NHET1 DMAREQ[7]; alt: NHET2 DMAREQ[7], MIBSPI5[13] */
+#define DMA_REQ_CRC1_0 26 /* CRC1 DMAREQ[0]; alt: MIBSPI1[12], MIBSPI3[12] */
+#define DMA_REQ_CRC1_1 27 /* CRC1 DMAREQ[1]; alt: MIBSPI1[13], MIBSPI3[13] */
+#define DMA_REQ_LIN1RX 28 /* SCI1/LIN1 receive; alt: MIBSPI5[14] */
+#define DMA_REQ_LIN1TX 29 /* SCI1/LIN1 transmit; alt: MIBSPI5[15] */
+#define DMA_REQ_SCI3RX 30 /* SCI3 receive; alt: MIBSPI1[14], MIBSPI3[14], MIBSPI5[1] */
+#define DMA_REQ_SCI3TX 31 /* SCI3 transmit; alt: MIBSPI1[15], MIBSPI3[15], MIBSPI5[0] */
+#define DMA_REQ_I2C2RX 32 /* I2C2 receive; alt: ePWM1_SOCA, MIBSPI2[2], MIBSPI4[2], GIOA[0] */
+#define DMA_REQ_I2C2TX 33 /* I2C2 transmit; alt: ePWM1_SOCB, MIBSPI2[3], MIBSPI4[3], GIOA[1] */
+#define DMA_REQ_EPWM2_SOCA 34 /* ePWM2_SOCA; alt: MIBSPI2[4], MIBSPI4[4], GIOA[2] */
+#define DMA_REQ_EPWM2_SOCB 35 /* ePWM2_SOCB; alt: MIBSPI2[5], MIBSPI4[5], GIOA[3] */
+#define DMA_REQ_EPWM3_SOCA 36 /* ePWM3_SOCA; alt: MIBSPI2[6], MIBSPI4[6], GIOA[4] */
+#define DMA_REQ_EPWM3_SOCB 37 /* ePWM3_SOCB; alt: MIBSPI2[7], MIBSPI4[7], GIOA[5] */
+#define DMA_REQ_CRC2_0 38 /* CRC2 DMAREQ[0]; alt: ePWM4_SOCA, MIBSPI2[8], MIBSPI4[8], GIOA[6] */
+#define DMA_REQ_CRC2_1 39 /* CRC2 DMAREQ[1]; alt: ePWM4_SOCB, MIBSPI2[9], MIBSPI4[9], GIOA[7] */
+#define DMA_REQ_LIN2RX 40 /* SCI2/LIN2 receive; alt: ePWM5_SOCA, MIBSPI2[10], MIBSPI4[10], GIOB[0] */
+#define DMA_REQ_LIN2TX 41 /* SCI2/LIN2 transmit; alt: ePWM5_SOCB, MIBSPI2[11], MIBSPI4[11], GIOB[1] */
+#define DMA_REQ_SCI4RX 42 /* SCI4 receive; alt: ePWM6_SOCA, MIBSPI2[12], MIBSPI4[12], GIOB[2] */
+#define DMA_REQ_SCI4TX 43 /* SCI4 transmit; alt: ePWM6_SOCB, MIBSPI2[13], MIBSPI4[13], GIOB[3] */
+#define DMA_REQ_EPWM7_SOCA 44 /* ePWM7_SOCA; alt: MIBSPI2[14], MIBSPI4[14], GIOB[4] */
+#define DMA_REQ_EPWM7_SOCB 45 /* ePWM7_SOCB; alt: MIBSPI2[15], MIBSPI4[15], GIOB[5], DCAN4 IF1 */
+#define DMA_REQ_GIOB_6 46 /* GIOB[6]; alt: DCAN4 IF2 */
+#define DMA_REQ_GIOB_7 47 /* GIOB[7]; alt: DCAN4 IF3 */
+
+/* DCAN interface DMA request aliases. Each of these lines is shared with
+ * the MibSPI/NHET/ePWM/GIO sources named in the table above - the
+ * application must ensure only one source per DMAREQ line is enabled at
+ * any time (SPNS215C table 6-41).
+ */
+
+#define DMA_REQ_DCAN1_IF1 8 /* alt of DMA_REQ_MIBSPI1_4 */
+#define DMA_REQ_DCAN1_IF3 16 /* alt of DMA_REQ_MIBSPI1_8 */
+#define DMA_REQ_DCAN2_IF1 9 /* alt of DMA_REQ_MIBSPI1_5 */
+#define DMA_REQ_DCAN2_IF2 5 /* alt of DMA_REQ_MIBSPI1_3 */
+#define DMA_REQ_DCAN2_IF3 4 /* alt of DMA_REQ_MIBSPI1_2 */
+#define DMA_REQ_DCAN3_IF1 17 /* alt of DMA_REQ_MIBSPI1_9 */
+#define DMA_REQ_DCAN3_IF2 20 /* alt of DMA_REQ_NHET1_4 */
+#define DMA_REQ_DCAN3_IF3 21 /* alt of DMA_REQ_NHET1_5 */
+#define DMA_REQ_DCAN4_IF1 45 /* alt of DMA_REQ_EPWM7_SOCB */
+#define DMA_REQ_DCAN4_IF2 46 /* alt of DMA_REQ_GIOB_6 */
+#define DMA_REQ_DCAN4_IF3 47 /* alt of DMA_REQ_GIOB_7 */
+
+#define RM57_DMA_NCHANNELS 32
+#define RM57_DMA_NREQUESTS 48
+
+#endif /* __ARCH_ARM_SRC_RM57_HARDWARE_RM57_DMA_H */
diff --git a/arch/arm/src/rm57/hardware/rm57_efc.h b/arch/arm/src/rm57/hardware/rm57_efc.h
new file mode 100644
index 00000000000..e9be4e53f13
--- /dev/null
+++ b/arch/arm/src/rm57/hardware/rm57_efc.h
@@ -0,0 +1,134 @@
+/****************************************************************************
+ * arch/arm/src/rm57/hardware/rm57_efc.h
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/* eFuse Controller (EFC), SPNU562A chapter 37.
+ *
+ * The eFuses are loaded and ECC-checked by hardware during power-on reset;
+ * software only inspects the outcome and exercises the error paths.
+ * Offsets follow TRM Table 37-2 and match HALCoGen's HL_reg_efc.h.
+ */
+
+#ifndef __ARCH_ARM_SRC_RM57_HARDWARE_RM57_EFC_H
+#define __ARCH_ARM_SRC_RM57_HARDWARE_RM57_EFC_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include "hardware/rm57l843_memorymap.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* Register Offsets *********************************************************/
+
+#define RM57_EFC_BOUND_OFFSET 0x001c /* Boundary Control Register */
+#define RM57_EFC_PINS_OFFSET 0x002c /* Pins Register */
+#define RM57_EFC_ERRSTAT_OFFSET 0x003c /* Error Status Register */
+#define RM57_EFC_STCY_OFFSET 0x0048 /* Self Test Cycles Register */
+#define RM57_EFC_STSIG_OFFSET 0x004c /* Self Test Signature Register */
+
+/* Register Addresses *******************************************************/
+
+#define RM57_EFC_BOUND (RM57_EFC_BASE + RM57_EFC_BOUND_OFFSET)
+#define RM57_EFC_PINS (RM57_EFC_BASE + RM57_EFC_PINS_OFFSET)
+#define RM57_EFC_ERRSTAT (RM57_EFC_BASE + RM57_EFC_ERRSTAT_OFFSET)
+#define RM57_EFC_STCY (RM57_EFC_BASE + RM57_EFC_STCY_OFFSET)
+#define RM57_EFC_STSIG (RM57_EFC_BASE + RM57_EFC_STSIG_OFFSET)
+
+/* Register Bit-Field Definitions *******************************************/
+
+/* Boundary Control Register */
+
+/* Bits 0-3: Input enable key */
+#define EFC_BOUND_INPUT_ENABLE (0x0f << 0)
+
+/* Bit 13: Start ECC self-test */
+#define EFC_BOUND_SELFTEST_ENABLE (1 << 13)
+
+/* Bit 14: Drive autoload error */
+#define EFC_BOUND_AUTOLOAD_OE (1 << 14)
+
+/* Bit 15: Drive instruction error */
+#define EFC_BOUND_INSTR_OE (1 << 15)
+
+/* Bit 16: Drive single-bit error */
+#define EFC_BOUND_SINGLEBIT_OE (1 << 16)
+
+/* Bit 17: Drive self-test error */
+#define EFC_BOUND_SELFTEST_OE (1 << 17)
+
+/* Bit 18: ESM group3 channel 1 */
+#define EFC_BOUND_AUTOLOAD_ERR (1 << 18)
+#define EFC_BOUND_INSTR_ERR (1 << 19) /* Bit 19: Not routed to ESM */
+
+/* Bit 20: ESM group1 channel 40 */
+#define EFC_BOUND_SINGLEBIT_ERR (1 << 20)
+
+/* Bit 21: ESM group1 channel 41 */
+#define EFC_BOUND_SELFTEST_ERR (1 << 21)
+
+#define EFC_BOUND_OE_ALL (0x0f << 14)
+
+/* Values prescribed by TRM 37.3.2.4 / 37.3.2.5 */
+
+/* All four errors, nERROR low */
+#define EFC_BOUND_STUCKZERO_A (0x003fc000)
+
+/* Without the autoload error */
+#define EFC_BOUND_STUCKZERO_B (0x003bc000)
+
+/* Drive all four low again */
+#define EFC_BOUND_STUCKZERO_CLEAR (0x003c0000)
+#define EFC_BOUND_SELFTEST_START (0x0000200f)
+
+/* Pins Register */
+
+/* Bit 10: Uncorrectable autoload */
+#define EFC_PINS_AUTOLOAD_ERR (1 << 10)
+#define EFC_PINS_INSTR_ERR (1 << 11) /* Bit 11: Instruction error */
+
+/* Bit 12: Corrected single bit */
+#define EFC_PINS_SINGLEBIT_ERR (1 << 12)
+
+/* Bit 14: ECC self-test failed */
+#define EFC_PINS_SELFTEST_ERR (1 << 14)
+#define EFC_PINS_SELFTEST_DONE (1 << 15) /* Bit 15: ECC self-test done */
+
+/* Error Status Register */
+
+#define EFC_ERRSTAT_CODE_MASK (0x1f << 0) /* Bits 0-4: Error code */
+# define EFC_ERRSTAT_CODE_NONE (0x00)
+
+/* Uncorrectable autoload error */
+# define EFC_ERRSTAT_CODE_MULTIBIT (0x05)
+# define EFC_ERRSTAT_CODE_SINGLEBIT (0x15) /* Corrected single-bit error */
+#define EFC_ERRSTAT_INSTR_DONE (1 << 5) /* Bit 5: Instruction done */
+
+/* ECC self-test parameters (TRM 37.3.2.5) */
+
+#define EFC_STCY_VALUE (0x00000258)
+#define EFC_STSIG_VALUE (0x5362f97f)
+
+#endif /* __ARCH_ARM_SRC_RM57_HARDWARE_RM57_EFC_H */
diff --git a/arch/arm/src/rm57/hardware/rm57_esm.h b/arch/arm/src/rm57/hardware/rm57_esm.h
new file mode 100644
index 00000000000..45dc30e3d38
--- /dev/null
+++ b/arch/arm/src/rm57/hardware/rm57_esm.h
@@ -0,0 +1,211 @@
+/****************************************************************************
+ * arch/arm/src/rm57/hardware/rm57_esm.h
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/* Register layout taken from TI's HALCoGen HL_reg_esm.h for
+ * RM57L843 - matches TMS570's ESM address (0xfffff500). See
+ * rm57_esm.c for the early-boot ESM quiesce sequence.
+ */
+
+#ifndef __ARCH_ARM_SRC_RM57_HARDWARE_RM57_ESM_H
+#define __ARCH_ARM_SRC_RM57_HARDWARE_RM57_ESM_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include "hardware/rm57l843_memorymap.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* Register Offsets *********************************************************/
+
+#define RM57_ESM_EEPAPR1_OFFSET 0x0000 /* Error Enable Primary Register 1 */
+
+/* Error Disable Primary Register 1 */
+#define RM57_ESM_DEPAPR1_OFFSET 0x0004
+
+/* Interrupt Enable Set/Status Register 1 */
+#define RM57_ESM_IESR1_OFFSET 0x0008
+
+/* Interrupt Enable Clear Register 1 */
+#define RM57_ESM_IECR1_OFFSET 0x000c
+#define RM57_ESM_ILSR1_OFFSET 0x0010 /* Interrupt Level Set Register 1 */
+
+/* Interrupt Level Clear Register 1 */
+#define RM57_ESM_ILCR1_OFFSET 0x0014
+
+/* Status Register 1, n=0..2 */
+#define RM57_ESM_SR1_OFFSET(n) (0x0018 + ((n) << 2))
+#define RM57_ESM_EPSR_OFFSET 0x0024 /* Error Pin Status Register */
+#define RM57_ESM_IOFFHR_OFFSET 0x0028 /* Interrupt Offset High Register */
+#define RM57_ESM_IOFFLR_OFFSET 0x002c /* Interrupt Offset Low Register */
+#define RM57_ESM_LTCR_OFFSET 0x0030 /* Low Time Counter Register */
+
+/* Low Time Counter Preload Register */
+#define RM57_ESM_LTCPR_OFFSET 0x0034
+#define RM57_ESM_EKR_OFFSET 0x0038 /* Error Key Register */
+#define RM57_ESM_SSR2_OFFSET 0x003c /* Status Shadow Register 2 */
+
+/* Interrupt Enable Primary Status Register 4 */
+#define RM57_ESM_IEPSR4_OFFSET 0x0040
+
+/* Interrupt Enable Primary Clear Register 4 */
+#define RM57_ESM_IEPCR4_OFFSET 0x0044
+
+/* Interrupt Enable Set/Status Register 4 */
+#define RM57_ESM_IESR4_OFFSET 0x0048
+
+/* Interrupt Enable Clear Register 4 */
+#define RM57_ESM_IECR4_OFFSET 0x004c
+#define RM57_ESM_ILSR4_OFFSET 0x0050 /* Interrupt Level Set Register 4 */
+
+/* Interrupt Level Clear Register 4 */
+#define RM57_ESM_ILCR4_OFFSET 0x0054
+
+/* Status Register 4, n=0..2 */
+#define RM57_ESM_SR4_OFFSET(n) (0x0058 + ((n) << 2))
+
+/* Interrupt Enable Primary Status Register 7 */
+#define RM57_ESM_IEPSR7_OFFSET 0x0080
+
+/* Interrupt Enable Primary Clear Register 7 */
+#define RM57_ESM_IEPCR7_OFFSET 0x0084
+
+/* Interrupt Enable Set/Status Register 7 */
+#define RM57_ESM_IESR7_OFFSET 0x0088
+
+/* Interrupt Enable Clear Register 7 */
+#define RM57_ESM_IECR7_OFFSET 0x008c
+#define RM57_ESM_ILSR7_OFFSET 0x0090 /* Interrupt Level Set Register 7 */
+
+/* Interrupt Level Clear Register 7 */
+#define RM57_ESM_ILCR7_OFFSET 0x0094
+
+/* Status Register 7, n=0..2 */
+#define RM57_ESM_SR7_OFFSET(n) (0x0098 + ((n) << 2))
+
+/* Register Addresses *******************************************************/
+
+#define RM57_ESM_EEPAPR1 (RM57_ESM_BASE + RM57_ESM_EEPAPR1_OFFSET)
+#define RM57_ESM_DEPAPR1 (RM57_ESM_BASE + RM57_ESM_DEPAPR1_OFFSET)
+#define RM57_ESM_IESR1 (RM57_ESM_BASE + RM57_ESM_IESR1_OFFSET)
+#define RM57_ESM_IECR1 (RM57_ESM_BASE + RM57_ESM_IECR1_OFFSET)
+#define RM57_ESM_ILSR1 (RM57_ESM_BASE + RM57_ESM_ILSR1_OFFSET)
+#define RM57_ESM_ILCR1 (RM57_ESM_BASE + RM57_ESM_ILCR1_OFFSET)
+#define RM57_ESM_EPSR (RM57_ESM_BASE + RM57_ESM_EPSR_OFFSET)
+#define RM57_ESM_IOFFHR (RM57_ESM_BASE + RM57_ESM_IOFFHR_OFFSET)
+#define RM57_ESM_IOFFLR (RM57_ESM_BASE + RM57_ESM_IOFFLR_OFFSET)
+#define RM57_ESM_LTCR (RM57_ESM_BASE + RM57_ESM_LTCR_OFFSET)
+#define RM57_ESM_LTCPR (RM57_ESM_BASE + RM57_ESM_LTCPR_OFFSET)
+#define RM57_ESM_EKR (RM57_ESM_BASE + RM57_ESM_EKR_OFFSET)
+#define RM57_ESM_SR1(n) (RM57_ESM_BASE + RM57_ESM_SR1_OFFSET(n))
+#define RM57_ESM_SR2 RM57_ESM_SR1(1)
+#define RM57_ESM_SR3 RM57_ESM_SR1(2)
+#define RM57_ESM_SSR2 (RM57_ESM_BASE + RM57_ESM_SSR2_OFFSET)
+#define RM57_ESM_IEPSR4 (RM57_ESM_BASE + RM57_ESM_IEPSR4_OFFSET)
+#define RM57_ESM_IEPCR4 (RM57_ESM_BASE + RM57_ESM_IEPCR4_OFFSET)
+#define RM57_ESM_IESR4 (RM57_ESM_BASE + RM57_ESM_IESR4_OFFSET)
+#define RM57_ESM_IECR4 (RM57_ESM_BASE + RM57_ESM_IECR4_OFFSET)
+#define RM57_ESM_ILSR4 (RM57_ESM_BASE + RM57_ESM_ILSR4_OFFSET)
+#define RM57_ESM_ILCR4 (RM57_ESM_BASE + RM57_ESM_ILCR4_OFFSET)
+#define RM57_ESM_SR4(n) (RM57_ESM_BASE + RM57_ESM_SR4_OFFSET(n))
+#define RM57_ESM_IEPSR7 (RM57_ESM_BASE + RM57_ESM_IEPSR7_OFFSET)
+#define RM57_ESM_IEPCR7 (RM57_ESM_BASE + RM57_ESM_IEPCR7_OFFSET)
+#define RM57_ESM_IESR7 (RM57_ESM_BASE + RM57_ESM_IESR7_OFFSET)
+#define RM57_ESM_IECR7 (RM57_ESM_BASE + RM57_ESM_IECR7_OFFSET)
+#define RM57_ESM_ILSR7 (RM57_ESM_BASE + RM57_ESM_ILSR7_OFFSET)
+#define RM57_ESM_ILCR7 (RM57_ESM_BASE + RM57_ESM_ILCR7_OFFSET)
+#define RM57_ESM_SR7(n) (RM57_ESM_BASE + RM57_ESM_SR7_OFFSET(n))
+
+/* Register Bit-Field Definitions *******************************************/
+
+/* Interrupt Offset High/Low Registers (IOFFHR/IOFFLR)
+ *
+ * The offset registers report the highest-priority pending channel on the
+ * high-level (FIQ) and low-level (IRQ) lines respectively. Zero means no
+ * interrupt is pending; otherwise the value encodes both the error group
+ * and the channel within it, in the banded layout below (SPNU562A
+ * Table 16-13). Group2 outranks group1, and within a group channel 0 has
+ * the highest priority.
+ *
+ * Reading an offset register clears the corresponding flag in ESMSR2 only.
+ * Group1 flags survive the read and must be cleared by writing a 1 to the
+ * matching bit of SR1/SR4/SR7, or the source keeps re-asserting.
+ */
+
+#define ESM_IOFF_MASK (0xff) /* Bits 0-7: channel/group code */
+#define ESM_IOFF_NONE (0x00) /* No interrupt pending */
+
+#define ESM_IOFF_GRP1_LO_FIRST (0x01) /* 0x01-0x20: group1, ch 0-31 */
+#define ESM_IOFF_GRP1_LO_LAST (0x20)
+#define ESM_IOFF_GRP2_FIRST (0x21) /* 0x21-0x40: group2, ch 0-31 */
+#define ESM_IOFF_GRP2_LAST (0x40)
+#define ESM_IOFF_GRP1_MID_FIRST (0x41) /* 0x41-0x60: group1, ch 32-63 */
+#define ESM_IOFF_GRP1_MID_LAST (0x60)
+#define ESM_IOFF_GRP1_HI_FIRST (0x81) /* 0x81-0xa0: group1, ch 64-95 */
+#define ESM_IOFF_GRP1_HI_LAST (0xa0)
+
+/* Error Pin Status Register */
+
+#define ESM_EPSR_EPSF (1 << 0) /* Bit 0: 1 = nERROR pin inactive */
+
+/* Error Key Register */
+
+#define ESM_EKR_NORMAL (0x00) /* Normal mode */
+#define ESM_EKR_RELEASE (0x05) /* Release nERROR once LTC expires */
+#define ESM_EKR_FORCE (0x0a) /* Error forcing: drive nERROR low */
+
+/* Channel assignments used by the start-up diagnostics (SPNS215C
+ * Table 6-45). Group1 channel n lives in SR1 (0-31), SR4 (32-63) or SR7
+ * (64-95) at bit (n % 32); group2 is SR2/SSR2 and group3 is SR3.
+ */
+
+#define ESM_G1_CPU_SELFTEST (27) /* Cortex-R5F LBIST (STC1) error */
+#define ESM_G1_CCM_SELFTEST (31) /* CCM-R5F self-test error */
+#define ESM_G1_PD_COMPARE (38) /* Power domain compare error */
+#define ESM_G1_PD_SELFTEST (39) /* Power domain self-test error */
+#define ESM_G1_EFUSE_ERROR (40) /* eFuse farm EFC error */
+#define ESM_G1_EFUSE_SELFTEST (41) /* eFuse farm self-test error */
+#define ESM_G1_INTERCONNECT (52) /* CPU interconnect global error */
+#define ESM_G1_N2HET_SELFTEST (54) /* N2HET LBIST (STC2) error */
+#define ESM_G1_CCM_STATUS (92) /* CCM-R5F operating status */
+
+#define ESM_G2_CCM_CPU (2) /* CCM-R5F CPU compare error */
+#define ESM_G2_CPU_BUSERR (3) /* Cortex-R5F fatal bus error */
+#define ESM_G2_L2RAMW_TYPEB (7) /* L2RAMW uncorrectable type B */
+#define ESM_G2_CCM_VIM (25) /* CCM-R5F VIM compare error */
+#define ESM_G2_CCM_INACTIVITY (26) /* CPU1 AXIM bus monitor failure */
+#define ESM_G2_CCM_PD (28) /* CCM-R5F power domain monitor */
+
+#define ESM_G3_EFUSE_AUTOLOAD (1) /* eFuse farm autoload error */
+
+#define ESM_CHANBIT(n) (1 << ((n) % 32))
+
+/* Channels per status register, and the total the offset encoding spans */
+
+#define ESM_CHANS_PER_REG (32)
+#define ESM_NCHANNELS (128)
+
+#endif /* __ARCH_ARM_SRC_RM57_HARDWARE_RM57_ESM_H */
diff --git a/arch/arm/src/rm57/hardware/rm57_ethernet.h b/arch/arm/src/rm57/hardware/rm57_ethernet.h
new file mode 100644
index 00000000000..c489c899413
--- /dev/null
+++ b/arch/arm/src/rm57/hardware/rm57_ethernet.h
@@ -0,0 +1,600 @@
+/****************************************************************************
+ * arch/arm/src/rm57/hardware/rm57_ethernet.h
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/* EMAC / EMAC Control Module / MDIO register layout for the RM57L843,
+ * transcribed from SPNU562A chapter 31 ("EMAC/MDIO Module") and
+ * cross-checked against TI's HALCoGen HL_hw_emac.h, HL_hw_emac_ctrl.h and
+ * HL_hw_mdio.h.
+ *
+ * This device implements a single-core CPSW-lite subsystem: only "core 0"
+ * exists, so only the C0xxx EMAC Control registers and USERACCESS0 /
+ * USERPHYSEL0 MDIO registers are meaningful. HALCoGen's EMAC_CTRL_CnRXEN()
+ * style macros are inherited from a multi-core EMAC variant used on other
+ * TI parts and do not apply here - this header only defines the C0
+ * registers that actually exist on RM57L843.
+ *
+ * NOTE: HALCoGen's HL_hw_emac.h defines EMAC_NETOCTETS at offset 0x208,
+ * but SPNU562A Section 31.5.50.33 documents the Network Octet Frames
+ * Register (NETOCTETS) at offset 0x280; offset 0x208 is actually
+ * RXMCASTFRAMES (Section 31.5.50.3). This appears to be a transcription
+ * error in the HALCoGen header. This file uses the TRM-documented value.
+ */
+
+#ifndef __ARCH_ARM_SRC_RM57_HARDWARE_RM57_ETHERNET_H
+#define __ARCH_ARM_SRC_RM57_HARDWARE_RM57_ETHERNET_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <stdint.h>
+#include "hardware/rm57l843_memorymap.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* CPPI buffer descriptor memory ********************************************/
+
+/* 8KB internal CPPI RAM, holding 4-word (16-byte) buffer descriptors.
+ * Shared between the TX and RX descriptor rings by software convention;
+ * the hardware does not partition it.
+ */
+
+#define RM57_EMAC_CPPI_RAM_SIZE 8192
+#define RM57_EMAC_DESC_SIZE 16 /* 4 words per descriptor */
+#define RM57_EMAC_MAX_DESC (RM57_EMAC_CPPI_RAM_SIZE / RM57_EMAC_DESC_SIZE)
+
+/* EMAC Control Module Register Offsets (base RM57_EMAC_CTRL_BASE) **********/
+
+/* SPNU562A Table 31-10. Only channel 0 (C0) registers exist on this
+ * device; this device has no C1/C2 cores.
+ */
+
+#define RM57_EMAC_CTRL_REVID_OFFSET 0x00
+#define RM57_EMAC_CTRL_SOFTRESET_OFFSET 0x04
+#define RM57_EMAC_CTRL_INTCONTROL_OFFSET 0x0c
+#define RM57_EMAC_CTRL_C0RXTHRESHEN_OFFSET 0x10
+#define RM57_EMAC_CTRL_C0RXEN_OFFSET 0x14
+#define RM57_EMAC_CTRL_C0TXEN_OFFSET 0x18
+#define RM57_EMAC_CTRL_C0MISCEN_OFFSET 0x1c
+#define RM57_EMAC_CTRL_C0RXTHRESHSTAT_OFFSET 0x40
+#define RM57_EMAC_CTRL_C0RXSTAT_OFFSET 0x44
+#define RM57_EMAC_CTRL_C0TXSTAT_OFFSET 0x48
+#define RM57_EMAC_CTRL_C0MISCSTAT_OFFSET 0x4c
+#define RM57_EMAC_CTRL_C0RXIMAX_OFFSET 0x70
+#define RM57_EMAC_CTRL_C0TXIMAX_OFFSET 0x74
+
+/* EMAC Control Module Register Addresses ***********************************/
+
+#define RM57_EMAC_CTRL_REVID (RM57_EMAC_CTRL_BASE + RM57_EMAC_CTRL_REVID_OFFSET)
+#define RM57_EMAC_CTRL_SOFTRESET (RM57_EMAC_CTRL_BASE + RM57_EMAC_CTRL_SOFTRESET_OFFSET)
+#define RM57_EMAC_CTRL_INTCONTROL (RM57_EMAC_CTRL_BASE + RM57_EMAC_CTRL_INTCONTROL_OFFSET)
+#define RM57_EMAC_CTRL_C0RXTHRESHEN (RM57_EMAC_CTRL_BASE + RM57_EMAC_CTRL_C0RXTHRESHEN_OFFSET)
+#define RM57_EMAC_CTRL_C0RXEN (RM57_EMAC_CTRL_BASE + RM57_EMAC_CTRL_C0RXEN_OFFSET)
+#define RM57_EMAC_CTRL_C0TXEN (RM57_EMAC_CTRL_BASE + RM57_EMAC_CTRL_C0TXEN_OFFSET)
+#define RM57_EMAC_CTRL_C0MISCEN (RM57_EMAC_CTRL_BASE + RM57_EMAC_CTRL_C0MISCEN_OFFSET)
+#define RM57_EMAC_CTRL_C0RXTHRESHSTAT (RM57_EMAC_CTRL_BASE + RM57_EMAC_CTRL_C0RXTHRESHSTAT_OFFSET)
+#define RM57_EMAC_CTRL_C0RXSTAT (RM57_EMAC_CTRL_BASE + RM57_EMAC_CTRL_C0RXSTAT_OFFSET)
+#define RM57_EMAC_CTRL_C0TXSTAT (RM57_EMAC_CTRL_BASE + RM57_EMAC_CTRL_C0TXSTAT_OFFSET)
+#define RM57_EMAC_CTRL_C0MISCSTAT (RM57_EMAC_CTRL_BASE + RM57_EMAC_CTRL_C0MISCSTAT_OFFSET)
+#define RM57_EMAC_CTRL_C0RXIMAX (RM57_EMAC_CTRL_BASE + RM57_EMAC_CTRL_C0RXIMAX_OFFSET)
+#define RM57_EMAC_CTRL_C0TXIMAX (RM57_EMAC_CTRL_BASE + RM57_EMAC_CTRL_C0TXIMAX_OFFSET)
+
+/* EMAC_CTRL_SOFTRESET */
+
+#define EMAC_CTRL_SOFTRESET_RESET (1 << 0)
+
+/* EMAC_CTRL_INTCONTROL */
+
+#define EMAC_CTRL_INTCONTROL_INTPACEEN_SHIFT 16
+#define EMAC_CTRL_INTCONTROL_INTPACEEN_MASK (3 << EMAC_CTRL_INTCONTROL_INTPACEEN_SHIFT)
+#define EMAC_CTRL_INTCONTROL_INTPRESCALE_SHIFT 0
+#define EMAC_CTRL_INTCONTROL_INTPRESCALE_MASK (0xfff << EMAC_CTRL_INTCONTROL_INTPRESCALE_SHIFT)
+
+/* EMAC_CTRL_C0RXTHRESHEN / C0RXEN / C0TXEN - one bit per DMA channel 0-7 */
+
+#define EMAC_CTRL_C0CHEN(n) (1 << (n))
+
+/* EMAC_CTRL_C0MISCEN / C0MISCSTAT - Section 31.3.7 */
+
+#define EMAC_CTRL_C0MISC_USERINT0EN (1 << 0)
+#define EMAC_CTRL_C0MISC_LINKINT0EN (1 << 1)
+#define EMAC_CTRL_C0MISC_HOSTPENDEN (1 << 2)
+#define EMAC_CTRL_C0MISC_STATPENDEN (1 << 3)
+
+/* MDIO Register Offsets (base RM57_MDIO_BASE) ******************************/
+
+#define RM57_MDIO_REVID_OFFSET 0x00
+#define RM57_MDIO_CONTROL_OFFSET 0x04
+#define RM57_MDIO_ALIVE_OFFSET 0x08
+#define RM57_MDIO_LINK_OFFSET 0x0c
+#define RM57_MDIO_LINKINTRAW_OFFSET 0x10
+#define RM57_MDIO_LINKINTMASKED_OFFSET 0x14
+#define RM57_MDIO_USERINTRAW_OFFSET 0x20
+#define RM57_MDIO_USERINTMASKED_OFFSET 0x24
+#define RM57_MDIO_USERINTMASKSET_OFFSET 0x28
+#define RM57_MDIO_USERINTMASKCLEAR_OFFSET 0x2c
+#define RM57_MDIO_USERACCESS0_OFFSET 0x80
+#define RM57_MDIO_USERPHYSEL0_OFFSET 0x84
+#define RM57_MDIO_USERACCESS1_OFFSET 0x88
+#define RM57_MDIO_USERPHYSEL1_OFFSET 0x8c
+
+/* MDIO Register Addresses **************************************************/
+
+#define RM57_MDIO_REVID (RM57_MDIO_BASE + RM57_MDIO_REVID_OFFSET)
+#define RM57_MDIO_CONTROL (RM57_MDIO_BASE + RM57_MDIO_CONTROL_OFFSET)
+#define RM57_MDIO_ALIVE (RM57_MDIO_BASE + RM57_MDIO_ALIVE_OFFSET)
+#define RM57_MDIO_LINK (RM57_MDIO_BASE + RM57_MDIO_LINK_OFFSET)
+#define RM57_MDIO_LINKINTRAW (RM57_MDIO_BASE + RM57_MDIO_LINKINTRAW_OFFSET)
+#define RM57_MDIO_LINKINTMASKED (RM57_MDIO_BASE + RM57_MDIO_LINKINTMASKED_OFFSET)
+#define RM57_MDIO_USERINTRAW (RM57_MDIO_BASE + RM57_MDIO_USERINTRAW_OFFSET)
+#define RM57_MDIO_USERINTMASKED (RM57_MDIO_BASE + RM57_MDIO_USERINTMASKED_OFFSET)
+#define RM57_MDIO_USERINTMASKSET (RM57_MDIO_BASE + RM57_MDIO_USERINTMASKSET_OFFSET)
+#define RM57_MDIO_USERINTMASKCLEAR (RM57_MDIO_BASE + RM57_MDIO_USERINTMASKCLEAR_OFFSET)
+#define RM57_MDIO_USERACCESS0 (RM57_MDIO_BASE + RM57_MDIO_USERACCESS0_OFFSET)
+#define RM57_MDIO_USERPHYSEL0 (RM57_MDIO_BASE + RM57_MDIO_USERPHYSEL0_OFFSET)
+#define RM57_MDIO_USERACCESS1 (RM57_MDIO_BASE + RM57_MDIO_USERACCESS1_OFFSET)
+#define RM57_MDIO_USERPHYSEL1 (RM57_MDIO_BASE + RM57_MDIO_USERPHYSEL1_OFFSET)
+
+/* MDIO_CONTROL - Section 31.4.2 */
+
+#define MDIO_CONTROL_CLKDIV_SHIFT 0
+#define MDIO_CONTROL_CLKDIV_MASK (0xffff << MDIO_CONTROL_CLKDIV_SHIFT)
+#define MDIO_CONTROL_CLKDIV(n) (((n) & 0xffff) << MDIO_CONTROL_CLKDIV_SHIFT)
+#define MDIO_CONTROL_FAULTENB (1 << 18)
+#define MDIO_CONTROL_FAULT (1 << 19)
+#define MDIO_CONTROL_PREAMBLE (1 << 20) /* 1 = no preamble on access */
+#define MDIO_CONTROL_HIGHEST_USER_CHANNEL_SHIFT 24
+#define MDIO_CONTROL_HIGHEST_USER_CHANNEL_MASK (0x1f << MDIO_CONTROL_HIGHEST_USER_CHANNEL_SHIFT)
+#define MDIO_CONTROL_ENABLE (1 << 30)
+#define MDIO_CONTROL_IDLE (1u << 31)
+
+/* MDIO_ALIVE / MDIO_LINK - one bit per PHY address 0-31 */
+
+#define MDIO_ALIVE_PHY(n) (1u << (n))
+#define MDIO_LINK_PHY(n) (1u << (n))
+
+/* MDIO_LINKINTRAW / LINKINTMASKED - bit n = USERPHYSELn */
+
+#define MDIO_LINKINT_USERPHY0 (1 << 0)
+#define MDIO_LINKINT_USERPHY1 (1 << 1)
+
+/* MDIO_USERINTRAW / USERINTMASKED / USERINTMASKSET / USERINTMASKCLEAR -
+ * bit 0 = USERACCESS0, bit 1 = USERACCESS1
+ */
+
+#define MDIO_USERINT_USERACCESS0 (1 << 0)
+#define MDIO_USERINT_USERACCESS1 (1 << 1)
+
+/* MDIO_USERACCESS0 / USERACCESS1 - Section 31.4.11 */
+
+#define MDIO_USERACCESS_DATA_SHIFT 0
+#define MDIO_USERACCESS_DATA_MASK (0xffff << MDIO_USERACCESS_DATA_SHIFT)
+#define MDIO_USERACCESS_PHYADR_SHIFT 16
+#define MDIO_USERACCESS_PHYADR_MASK (0x1f << MDIO_USERACCESS_PHYADR_SHIFT)
+#define MDIO_USERACCESS_PHYADR(n) (((n) & 0x1f) << MDIO_USERACCESS_PHYADR_SHIFT)
+#define MDIO_USERACCESS_REGADR_SHIFT 21
+#define MDIO_USERACCESS_REGADR_MASK (0x1f << MDIO_USERACCESS_REGADR_SHIFT)
+#define MDIO_USERACCESS_REGADR(n) (((n) & 0x1f) << MDIO_USERACCESS_REGADR_SHIFT)
+#define MDIO_USERACCESS_ACK (1 << 29)
+#define MDIO_USERACCESS_WRITE (1 << 30)
+#define MDIO_USERACCESS_READ (0 << 30)
+#define MDIO_USERACCESS_GO (1u << 31)
+
+/* MDIO_USERPHYSEL0 / USERPHYSEL1 - Section 31.4.12 */
+
+#define MDIO_USERPHYSEL_PHYADRMON_SHIFT 0
+#define MDIO_USERPHYSEL_PHYADRMON_MASK (0x1f << MDIO_USERPHYSEL_PHYADRMON_SHIFT)
+#define MDIO_USERPHYSEL_PHYADRMON(n) (((n) & 0x1f) << MDIO_USERPHYSEL_PHYADRMON_SHIFT)
+#define MDIO_USERPHYSEL_LINKINTENB (1 << 6)
+#define MDIO_USERPHYSEL_LINKSEL (1 << 7)
+
+/* EMAC Register Offsets (base RM57_EMAC_BASE) ******************************/
+
+#define RM57_EMAC_TXREVID_OFFSET 0x000
+#define RM57_EMAC_TXCONTROL_OFFSET 0x004
+#define RM57_EMAC_TXTEARDOWN_OFFSET 0x008
+#define RM57_EMAC_RXREVID_OFFSET 0x010
+#define RM57_EMAC_RXCONTROL_OFFSET 0x014
+#define RM57_EMAC_RXTEARDOWN_OFFSET 0x018
+#define RM57_EMAC_TXINTSTATRAW_OFFSET 0x080
+#define RM57_EMAC_TXINTSTATMASKED_OFFSET 0x084
+#define RM57_EMAC_TXINTMASKSET_OFFSET 0x088
+#define RM57_EMAC_TXINTMASKCLEAR_OFFSET 0x08c
+#define RM57_EMAC_MACINVECTOR_OFFSET 0x090
+#define RM57_EMAC_MACEOIVECTOR_OFFSET 0x094
+#define RM57_EMAC_RXINTSTATRAW_OFFSET 0x0a0
+#define RM57_EMAC_RXINTSTATMASKED_OFFSET 0x0a4
+#define RM57_EMAC_RXINTMASKSET_OFFSET 0x0a8
+#define RM57_EMAC_RXINTMASKCLEAR_OFFSET 0x0ac
+#define RM57_EMAC_MACINTSTATRAW_OFFSET 0x0b0
+#define RM57_EMAC_MACINTSTATMASKED_OFFSET 0x0b4
+#define RM57_EMAC_MACINTMASKSET_OFFSET 0x0b8
+#define RM57_EMAC_MACINTMASKCLEAR_OFFSET 0x0bc
+#define RM57_EMAC_RXMBPENABLE_OFFSET 0x100
+#define RM57_EMAC_RXUNICASTSET_OFFSET 0x104
+#define RM57_EMAC_RXUNICASTCLEAR_OFFSET 0x108
+#define RM57_EMAC_RXMAXLEN_OFFSET 0x10c
+#define RM57_EMAC_RXBUFFEROFFSET_OFFSET 0x110
+#define RM57_EMAC_RXFILTERLOWTHRESH_OFFSET 0x114
+#define RM57_EMAC_RXFLOWTHRESH_OFFSET(n) (0x120 + ((n) << 2))
+#define RM57_EMAC_RXFREEBUFFER_OFFSET(n) (0x140 + ((n) << 2))
+#define RM57_EMAC_MACCONTROL_OFFSET 0x160
+#define RM57_EMAC_MACSTATUS_OFFSET 0x164
+#define RM57_EMAC_EMCONTROL_OFFSET 0x168
+#define RM57_EMAC_FIFOCONTROL_OFFSET 0x16c
+#define RM57_EMAC_MACCONFIG_OFFSET 0x170
+#define RM57_EMAC_SOFTRESET_OFFSET 0x174
+#define RM57_EMAC_MACSRCADDRLO_OFFSET 0x1d0
+#define RM57_EMAC_MACSRCADDRHI_OFFSET 0x1d4
+#define RM57_EMAC_MACHASH1_OFFSET 0x1d8
+#define RM57_EMAC_MACHASH2_OFFSET 0x1dc
+#define RM57_EMAC_BOFFTEST_OFFSET 0x1e0
+#define RM57_EMAC_TPACETEST_OFFSET 0x1e4
+#define RM57_EMAC_RXPAUSE_OFFSET 0x1e8
+#define RM57_EMAC_TXPAUSE_OFFSET 0x1ec
+
+/* Network statistics registers - Section 31.5.50 */
+
+#define RM57_EMAC_RXGOODFRAMES_OFFSET 0x200
+#define RM57_EMAC_RXBCASTFRAMES_OFFSET 0x204
+#define RM57_EMAC_RXMCASTFRAMES_OFFSET 0x208
+#define RM57_EMAC_RXPAUSEFRAMES_OFFSET 0x20c
+#define RM57_EMAC_RXCRCERRORS_OFFSET 0x210
+#define RM57_EMAC_RXALIGNCODEERRORS_OFFSET 0x214
+#define RM57_EMAC_RXOVERSIZED_OFFSET 0x218
+#define RM57_EMAC_RXJABBER_OFFSET 0x21c
+#define RM57_EMAC_RXUNDERSIZED_OFFSET 0x220
+#define RM57_EMAC_RXFRAGMENTS_OFFSET 0x224
+#define RM57_EMAC_RXFILTERED_OFFSET 0x228
+#define RM57_EMAC_RXQOSFILTERED_OFFSET 0x22c
+#define RM57_EMAC_RXOCTETS_OFFSET 0x230
+#define RM57_EMAC_TXGOODFRAMES_OFFSET 0x234
+#define RM57_EMAC_TXBCASTFRAMES_OFFSET 0x238
+#define RM57_EMAC_TXMCASTFRAMES_OFFSET 0x23c
+#define RM57_EMAC_TXPAUSEFRAMES_OFFSET 0x240
+#define RM57_EMAC_TXDEFERRED_OFFSET 0x244
+#define RM57_EMAC_TXCOLLISION_OFFSET 0x248
+#define RM57_EMAC_TXSINGLECOLL_OFFSET 0x24c
+#define RM57_EMAC_TXMULTICOLL_OFFSET 0x250
+#define RM57_EMAC_TXEXCESSIVECOLL_OFFSET 0x254
+#define RM57_EMAC_TXLATECOLL_OFFSET 0x258
+#define RM57_EMAC_TXUNDERRUN_OFFSET 0x25c
+#define RM57_EMAC_TXCARRIERSENSE_OFFSET 0x260
+#define RM57_EMAC_TXOCTETS_OFFSET 0x264
+#define RM57_EMAC_FRAME64_OFFSET 0x268
+#define RM57_EMAC_FRAME65T127_OFFSET 0x26c
+#define RM57_EMAC_FRAME128T255_OFFSET 0x270
+#define RM57_EMAC_FRAME256T511_OFFSET 0x274
+#define RM57_EMAC_FRAME512T1023_OFFSET 0x278
+#define RM57_EMAC_FRAME1024TUP_OFFSET 0x27c
+
+/* NETOCTETS: TRM Section 31.5.50.33 documents offset 0x280. HALCoGen's
+ * HL_hw_emac.h defines EMAC_NETOCTETS as 0x208, which collides with
+ * RXMCASTFRAMES - this is a transcription error in the vendor header
+ * (see the file header note above). 0x280 is used here.
+ */
+
+#define RM57_EMAC_NETOCTETS_OFFSET 0x280
+#define RM57_EMAC_RXSOFOVERRUNS_OFFSET 0x284
+#define RM57_EMAC_RXMOFOVERRUNS_OFFSET 0x288
+#define RM57_EMAC_RXDMAOVERRUNS_OFFSET 0x28c
+
+#define RM57_EMAC_MACADDRLO_OFFSET 0x500
+#define RM57_EMAC_MACADDRHI_OFFSET 0x504
+#define RM57_EMAC_MACINDEX_OFFSET 0x508
+
+#define RM57_EMAC_TXHDP_OFFSET(n) (0x600 + ((n) << 2))
+#define RM57_EMAC_RXHDP_OFFSET(n) (0x620 + ((n) << 2))
+#define RM57_EMAC_TXCP_OFFSET(n) (0x640 + ((n) << 2))
+#define RM57_EMAC_RXCP_OFFSET(n) (0x660 + ((n) << 2))
+
+/* EMAC Register Addresses **************************************************/
+
+#define RM57_EMAC_TXREVID (RM57_EMAC_BASE + RM57_EMAC_TXREVID_OFFSET)
+#define RM57_EMAC_TXCONTROL (RM57_EMAC_BASE + RM57_EMAC_TXCONTROL_OFFSET)
+#define RM57_EMAC_TXTEARDOWN (RM57_EMAC_BASE + RM57_EMAC_TXTEARDOWN_OFFSET)
+#define RM57_EMAC_RXREVID (RM57_EMAC_BASE + RM57_EMAC_RXREVID_OFFSET)
+#define RM57_EMAC_RXCONTROL (RM57_EMAC_BASE + RM57_EMAC_RXCONTROL_OFFSET)
+#define RM57_EMAC_RXTEARDOWN (RM57_EMAC_BASE + RM57_EMAC_RXTEARDOWN_OFFSET)
+#define RM57_EMAC_TXINTSTATRAW (RM57_EMAC_BASE + RM57_EMAC_TXINTSTATRAW_OFFSET)
+#define RM57_EMAC_TXINTSTATMASKED (RM57_EMAC_BASE + RM57_EMAC_TXINTSTATMASKED_OFFSET)
+#define RM57_EMAC_TXINTMASKSET (RM57_EMAC_BASE + RM57_EMAC_TXINTMASKSET_OFFSET)
+#define RM57_EMAC_TXINTMASKCLEAR (RM57_EMAC_BASE + RM57_EMAC_TXINTMASKCLEAR_OFFSET)
+#define RM57_EMAC_MACINVECTOR (RM57_EMAC_BASE + RM57_EMAC_MACINVECTOR_OFFSET)
+#define RM57_EMAC_MACEOIVECTOR (RM57_EMAC_BASE + RM57_EMAC_MACEOIVECTOR_OFFSET)
+#define RM57_EMAC_RXINTSTATRAW (RM57_EMAC_BASE + RM57_EMAC_RXINTSTATRAW_OFFSET)
+#define RM57_EMAC_RXINTSTATMASKED (RM57_EMAC_BASE + RM57_EMAC_RXINTSTATMASKED_OFFSET)
+#define RM57_EMAC_RXINTMASKSET (RM57_EMAC_BASE + RM57_EMAC_RXINTMASKSET_OFFSET)
+#define RM57_EMAC_RXINTMASKCLEAR (RM57_EMAC_BASE + RM57_EMAC_RXINTMASKCLEAR_OFFSET)
+#define RM57_EMAC_MACINTSTATRAW (RM57_EMAC_BASE + RM57_EMAC_MACINTSTATRAW_OFFSET)
+#define RM57_EMAC_MACINTSTATMASKED (RM57_EMAC_BASE + RM57_EMAC_MACINTSTATMASKED_OFFSET)
+#define RM57_EMAC_MACINTMASKSET (RM57_EMAC_BASE + RM57_EMAC_MACINTMASKSET_OFFSET)
+#define RM57_EMAC_MACINTMASKCLEAR (RM57_EMAC_BASE + RM57_EMAC_MACINTMASKCLEAR_OFFSET)
+#define RM57_EMAC_RXMBPENABLE (RM57_EMAC_BASE + RM57_EMAC_RXMBPENABLE_OFFSET)
+#define RM57_EMAC_RXUNICASTSET (RM57_EMAC_BASE + RM57_EMAC_RXUNICASTSET_OFFSET)
+#define RM57_EMAC_RXUNICASTCLEAR (RM57_EMAC_BASE + RM57_EMAC_RXUNICASTCLEAR_OFFSET)
+#define RM57_EMAC_RXMAXLEN (RM57_EMAC_BASE + RM57_EMAC_RXMAXLEN_OFFSET)
+#define RM57_EMAC_RXBUFFEROFFSET (RM57_EMAC_BASE + RM57_EMAC_RXBUFFEROFFSET_OFFSET)
+#define RM57_EMAC_RXFILTERLOWTHRESH (RM57_EMAC_BASE + RM57_EMAC_RXFILTERLOWTHRESH_OFFSET)
+#define RM57_EMAC_RXFLOWTHRESH(n) (RM57_EMAC_BASE + RM57_EMAC_RXFLOWTHRESH_OFFSET(n))
+#define RM57_EMAC_RXFREEBUFFER(n) (RM57_EMAC_BASE + RM57_EMAC_RXFREEBUFFER_OFFSET(n))
+#define RM57_EMAC_MACCONTROL (RM57_EMAC_BASE + RM57_EMAC_MACCONTROL_OFFSET)
+#define RM57_EMAC_MACSTATUS (RM57_EMAC_BASE + RM57_EMAC_MACSTATUS_OFFSET)
+#define RM57_EMAC_EMCONTROL (RM57_EMAC_BASE + RM57_EMAC_EMCONTROL_OFFSET)
+#define RM57_EMAC_FIFOCONTROL (RM57_EMAC_BASE + RM57_EMAC_FIFOCONTROL_OFFSET)
+#define RM57_EMAC_MACCONFIG (RM57_EMAC_BASE + RM57_EMAC_MACCONFIG_OFFSET)
+#define RM57_EMAC_SOFTRESET (RM57_EMAC_BASE + RM57_EMAC_SOFTRESET_OFFSET)
+#define RM57_EMAC_MACSRCADDRLO (RM57_EMAC_BASE + RM57_EMAC_MACSRCADDRLO_OFFSET)
+#define RM57_EMAC_MACSRCADDRHI (RM57_EMAC_BASE + RM57_EMAC_MACSRCADDRHI_OFFSET)
+#define RM57_EMAC_MACHASH1 (RM57_EMAC_BASE + RM57_EMAC_MACHASH1_OFFSET)
+#define RM57_EMAC_MACHASH2 (RM57_EMAC_BASE + RM57_EMAC_MACHASH2_OFFSET)
+#define RM57_EMAC_BOFFTEST (RM57_EMAC_BASE + RM57_EMAC_BOFFTEST_OFFSET)
+#define RM57_EMAC_TPACETEST (RM57_EMAC_BASE + RM57_EMAC_TPACETEST_OFFSET)
+#define RM57_EMAC_RXPAUSE (RM57_EMAC_BASE + RM57_EMAC_RXPAUSE_OFFSET)
+#define RM57_EMAC_TXPAUSE (RM57_EMAC_BASE + RM57_EMAC_TXPAUSE_OFFSET)
+
+#define RM57_EMAC_RXGOODFRAMES (RM57_EMAC_BASE + RM57_EMAC_RXGOODFRAMES_OFFSET)
+#define RM57_EMAC_RXBCASTFRAMES (RM57_EMAC_BASE + RM57_EMAC_RXBCASTFRAMES_OFFSET)
+#define RM57_EMAC_RXMCASTFRAMES (RM57_EMAC_BASE + RM57_EMAC_RXMCASTFRAMES_OFFSET)
+#define RM57_EMAC_RXPAUSEFRAMES (RM57_EMAC_BASE + RM57_EMAC_RXPAUSEFRAMES_OFFSET)
+#define RM57_EMAC_RXCRCERRORS (RM57_EMAC_BASE + RM57_EMAC_RXCRCERRORS_OFFSET)
+#define RM57_EMAC_RXALIGNCODEERRORS (RM57_EMAC_BASE + RM57_EMAC_RXALIGNCODEERRORS_OFFSET)
+#define RM57_EMAC_RXOVERSIZED (RM57_EMAC_BASE + RM57_EMAC_RXOVERSIZED_OFFSET)
+#define RM57_EMAC_RXJABBER (RM57_EMAC_BASE + RM57_EMAC_RXJABBER_OFFSET)
+#define RM57_EMAC_RXUNDERSIZED (RM57_EMAC_BASE + RM57_EMAC_RXUNDERSIZED_OFFSET)
+#define RM57_EMAC_RXFRAGMENTS (RM57_EMAC_BASE + RM57_EMAC_RXFRAGMENTS_OFFSET)
+#define RM57_EMAC_RXFILTERED (RM57_EMAC_BASE + RM57_EMAC_RXFILTERED_OFFSET)
+#define RM57_EMAC_RXQOSFILTERED (RM57_EMAC_BASE + RM57_EMAC_RXQOSFILTERED_OFFSET)
+#define RM57_EMAC_RXOCTETS (RM57_EMAC_BASE + RM57_EMAC_RXOCTETS_OFFSET)
+#define RM57_EMAC_TXGOODFRAMES (RM57_EMAC_BASE + RM57_EMAC_TXGOODFRAMES_OFFSET)
+#define RM57_EMAC_TXBCASTFRAMES (RM57_EMAC_BASE + RM57_EMAC_TXBCASTFRAMES_OFFSET)
+#define RM57_EMAC_TXMCASTFRAMES (RM57_EMAC_BASE + RM57_EMAC_TXMCASTFRAMES_OFFSET)
+#define RM57_EMAC_TXPAUSEFRAMES (RM57_EMAC_BASE + RM57_EMAC_TXPAUSEFRAMES_OFFSET)
+#define RM57_EMAC_TXDEFERRED (RM57_EMAC_BASE + RM57_EMAC_TXDEFERRED_OFFSET)
+#define RM57_EMAC_TXCOLLISION (RM57_EMAC_BASE + RM57_EMAC_TXCOLLISION_OFFSET)
+#define RM57_EMAC_TXSINGLECOLL (RM57_EMAC_BASE + RM57_EMAC_TXSINGLECOLL_OFFSET)
+#define RM57_EMAC_TXMULTICOLL (RM57_EMAC_BASE + RM57_EMAC_TXMULTICOLL_OFFSET)
+#define RM57_EMAC_TXEXCESSIVECOLL (RM57_EMAC_BASE + RM57_EMAC_TXEXCESSIVECOLL_OFFSET)
+#define RM57_EMAC_TXLATECOLL (RM57_EMAC_BASE + RM57_EMAC_TXLATECOLL_OFFSET)
+#define RM57_EMAC_TXUNDERRUN (RM57_EMAC_BASE + RM57_EMAC_TXUNDERRUN_OFFSET)
+#define RM57_EMAC_TXCARRIERSENSE (RM57_EMAC_BASE + RM57_EMAC_TXCARRIERSENSE_OFFSET)
+#define RM57_EMAC_TXOCTETS (RM57_EMAC_BASE + RM57_EMAC_TXOCTETS_OFFSET)
+#define RM57_EMAC_FRAME64 (RM57_EMAC_BASE + RM57_EMAC_FRAME64_OFFSET)
+#define RM57_EMAC_FRAME65T127 (RM57_EMAC_BASE + RM57_EMAC_FRAME65T127_OFFSET)
+#define RM57_EMAC_FRAME128T255 (RM57_EMAC_BASE + RM57_EMAC_FRAME128T255_OFFSET)
+#define RM57_EMAC_FRAME256T511 (RM57_EMAC_BASE + RM57_EMAC_FRAME256T511_OFFSET)
+#define RM57_EMAC_FRAME512T1023 (RM57_EMAC_BASE + RM57_EMAC_FRAME512T1023_OFFSET)
+#define RM57_EMAC_FRAME1024TUP (RM57_EMAC_BASE + RM57_EMAC_FRAME1024TUP_OFFSET)
+#define RM57_EMAC_NETOCTETS (RM57_EMAC_BASE + RM57_EMAC_NETOCTETS_OFFSET)
+#define RM57_EMAC_RXSOFOVERRUNS (RM57_EMAC_BASE + RM57_EMAC_RXSOFOVERRUNS_OFFSET)
+#define RM57_EMAC_RXMOFOVERRUNS (RM57_EMAC_BASE + RM57_EMAC_RXMOFOVERRUNS_OFFSET)
+#define RM57_EMAC_RXDMAOVERRUNS (RM57_EMAC_BASE + RM57_EMAC_RXDMAOVERRUNS_OFFSET)
+
+#define RM57_EMAC_MACADDRLO (RM57_EMAC_BASE + RM57_EMAC_MACADDRLO_OFFSET)
+#define RM57_EMAC_MACADDRHI (RM57_EMAC_BASE + RM57_EMAC_MACADDRHI_OFFSET)
+#define RM57_EMAC_MACINDEX (RM57_EMAC_BASE + RM57_EMAC_MACINDEX_OFFSET)
+
+#define RM57_EMAC_TXHDP(n) (RM57_EMAC_BASE + RM57_EMAC_TXHDP_OFFSET(n))
+#define RM57_EMAC_RXHDP(n) (RM57_EMAC_BASE + RM57_EMAC_RXHDP_OFFSET(n))
+#define RM57_EMAC_TXCP(n) (RM57_EMAC_BASE + RM57_EMAC_TXCP_OFFSET(n))
+#define RM57_EMAC_RXCP(n) (RM57_EMAC_BASE + RM57_EMAC_RXCP_OFFSET(n))
+
+/* EMAC_TXCONTROL / RXCONTROL */
+
+#define EMAC_TXCONTROL_TXEN (1 << 0)
+#define EMAC_RXCONTROL_RXEN (1 << 0)
+
+/* EMAC_TXTEARDOWN / RXTEARDOWN */
+
+#define EMAC_TEARDOWN_CH_SHIFT 0
+#define EMAC_TEARDOWN_CH_MASK (7 << EMAC_TEARDOWN_CH_SHIFT)
+#define EMAC_TEARDOWN_CH(n) (((n) & 7) << EMAC_TEARDOWN_CH_SHIFT)
+
+/* EMAC_TXINTSTATRAW / TXINTSTATMASKED / TXINTMASKSET / TXINTMASKCLEAR -
+ * one bit per TX channel 0-7
+ */
+
+#define EMAC_TXCH(n) (1 << (n))
+
+/* EMAC_RXINTSTATRAW / RXINTSTATMASKED / RXINTMASKSET / RXINTMASKCLEAR -
+ * bits 0-7 = RX channel pend, bits 8-15 = RX channel threshold pend
+ */
+
+#define EMAC_RXCH(n) (1 << (n))
+#define EMAC_RXCH_THRESH(n) (1 << ((n) + 8))
+
+/* EMAC_MACINVECTOR - Section 31.5.11 */
+
+#define EMAC_MACINVECTOR_RXPEND_SHIFT 0
+#define EMAC_MACINVECTOR_RXPEND_MASK (0xff << EMAC_MACINVECTOR_RXPEND_SHIFT)
+#define EMAC_MACINVECTOR_RXTHRESHPEND_SHIFT 8
+#define EMAC_MACINVECTOR_RXTHRESHPEND_MASK (0xff << EMAC_MACINVECTOR_RXTHRESHPEND_SHIFT)
+#define EMAC_MACINVECTOR_TXPEND_SHIFT 16
+#define EMAC_MACINVECTOR_TXPEND_MASK (0xff << EMAC_MACINVECTOR_TXPEND_SHIFT)
+#define EMAC_MACINVECTOR_USERINT0 (1 << 24)
+#define EMAC_MACINVECTOR_LINKINT0 (1 << 25)
+#define EMAC_MACINVECTOR_HOSTPEND (1 << 26)
+#define EMAC_MACINVECTOR_STATPEND (1 << 27)
+
+/* EMAC_MACEOIVECTOR - Section 31.5.12. Acknowledge keys written after
+ * servicing an interrupt; each key corresponds to one of the four VIM
+ * pulse lines this device routes (C0RXTHRESH/C0RX/C0TX/C0MISC).
+ */
+
+#define EMAC_MACEOIVECTOR_C0RXTHRESH 0x0
+#define EMAC_MACEOIVECTOR_C0RX 0x1
+#define EMAC_MACEOIVECTOR_C0TX 0x2
+#define EMAC_MACEOIVECTOR_C0MISC 0x3
+
+/* EMAC_RXMBPENABLE - Section 31.5.21 */
+
+#define EMAC_RXMBPENABLE_RXMULTCH_SHIFT 0
+#define EMAC_RXMBPENABLE_RXMULTCH_MASK (7 << EMAC_RXMBPENABLE_RXMULTCH_SHIFT)
+#define EMAC_RXMBPENABLE_RXMULTCH(n) (((n) & 7) << EMAC_RXMBPENABLE_RXMULTCH_SHIFT)
+#define EMAC_RXMBPENABLE_RXMULTEN (1 << 5)
+#define EMAC_RXMBPENABLE_RXBROADCH_SHIFT 8
+#define EMAC_RXMBPENABLE_RXBROADCH_MASK (7 << EMAC_RXMBPENABLE_RXBROADCH_SHIFT)
+#define EMAC_RXMBPENABLE_RXBROADCH(n) (((n) & 7) << EMAC_RXMBPENABLE_RXBROADCH_SHIFT)
+#define EMAC_RXMBPENABLE_RXBROADEN (1 << 13)
+#define EMAC_RXMBPENABLE_RXPROMCH_SHIFT 16
+#define EMAC_RXMBPENABLE_RXPROMCH_MASK (7 << EMAC_RXMBPENABLE_RXPROMCH_SHIFT)
+#define EMAC_RXMBPENABLE_RXPROMCH(n) (((n) & 7) << EMAC_RXMBPENABLE_RXPROMCH_SHIFT)
+#define EMAC_RXMBPENABLE_RXCAFEN (1 << 21)
+#define EMAC_RXMBPENABLE_RXCEFEN (1 << 22)
+#define EMAC_RXMBPENABLE_RXCSFEN (1 << 23)
+#define EMAC_RXMBPENABLE_RXCMFEN (1 << 24)
+#define EMAC_RXMBPENABLE_RXNOCHAIN (1 << 28)
+#define EMAC_RXMBPENABLE_RXQOSEN (1 << 29)
+#define EMAC_RXMBPENABLE_RXPASSCRC (1 << 30)
+
+/* EMAC_RXUNICASTSET / RXUNICASTCLEAR - one bit per RX channel 0-7 */
+
+#define EMAC_RXUNICAST_CH(n) (1 << (n))
+
+/* EMAC_MACCONTROL - Section 31.5.29 */
+
+#define EMAC_MACCONTROL_FULLDUPLEX (1 << 0)
+#define EMAC_MACCONTROL_LOOPBACK (1 << 1)
+#define EMAC_MACCONTROL_RXBUFFERFLOWEN (1 << 3)
+#define EMAC_MACCONTROL_TXFLOWEN (1 << 4)
+#define EMAC_MACCONTROL_GMIIEN (1 << 5)
+#define EMAC_MACCONTROL_TXPACE (1 << 6)
+#define EMAC_MACCONTROL_TXPTYPE (1 << 9)
+#define EMAC_MACCONTROL_TXSHORTGAPEN (1 << 10)
+#define EMAC_MACCONTROL_CMDIDLE (1 << 11)
+#define EMAC_MACCONTROL_RXOWNERSHIP (1 << 13)
+#define EMAC_MACCONTROL_RXOFFLENBLOCK (1 << 14)
+#define EMAC_MACCONTROL_RMIISPEED (1 << 15) /* 1 = 100Mbps, 0 = 10Mbps */
+
+/* EMAC_MACSTATUS - Section 31.5.30 */
+
+#define EMAC_MACSTATUS_TXFLOWACT (1 << 0)
+#define EMAC_MACSTATUS_RXFLOWACT (1 << 1)
+#define EMAC_MACSTATUS_RXQOSACT (1 << 2)
+#define EMAC_MACSTATUS_RXERRCH_SHIFT 8
+#define EMAC_MACSTATUS_RXERRCH_MASK (7 << EMAC_MACSTATUS_RXERRCH_SHIFT)
+#define EMAC_MACSTATUS_RXERRCODE_SHIFT 12
+#define EMAC_MACSTATUS_RXERRCODE_MASK (15 << EMAC_MACSTATUS_RXERRCODE_SHIFT)
+#define EMAC_MACSTATUS_TXERRCH_SHIFT 16
+#define EMAC_MACSTATUS_TXERRCH_MASK (7 << EMAC_MACSTATUS_TXERRCH_SHIFT)
+#define EMAC_MACSTATUS_TXERRCODE_SHIFT 20
+#define EMAC_MACSTATUS_TXERRCODE_MASK (15 << EMAC_MACSTATUS_TXERRCODE_SHIFT)
+#define EMAC_MACSTATUS_IDLE (1u << 31)
+
+/* EMAC_EMCONTROL - Section 31.5.31 */
+
+#define EMAC_EMCONTROL_FREE (1 << 0)
+#define EMAC_EMCONTROL_SOFT (1 << 1)
+
+/* EMAC_SOFTRESET */
+
+#define EMAC_SOFTRESET_RESET (1 << 0)
+
+/* EMAC_MACINTSTATRAW / MACINTSTATMASKED / MACINTMASKSET / MACINTMASKCLEAR -
+ * Section 31.5.17-31.5.20. MASKSET/MASKCLEAR are W1S/W1C; STATRAW/
+ * STATMASKED are plain read-only status.
+ */
+
+#define EMAC_MACINT_STATPEND (1 << 0)
+#define EMAC_MACINT_HOSTPEND (1 << 1)
+
+/* EMAC_MACADDRLO - Section 31.5.43 */
+
+#define EMAC_MACADDRLO_MACADDR1_SHIFT 0
+#define EMAC_MACADDRLO_MACADDR1_MASK (0xff << EMAC_MACADDRLO_MACADDR1_SHIFT)
+#define EMAC_MACADDRLO_MACADDR0_SHIFT 8
+#define EMAC_MACADDRLO_MACADDR0_MASK (0xff << EMAC_MACADDRLO_MACADDR0_SHIFT)
+#define EMAC_MACADDRLO_CHANNEL_SHIFT 16
+#define EMAC_MACADDRLO_CHANNEL_MASK (7 << EMAC_MACADDRLO_CHANNEL_SHIFT)
+#define EMAC_MACADDRLO_CHANNEL(n) (((n) & 7) << EMAC_MACADDRLO_CHANNEL_SHIFT)
+#define EMAC_MACADDRLO_MATCHFILT (1 << 19)
+#define EMAC_MACADDRLO_VALID (1 << 20)
+
+/* EMAC_MACADDRHI - MACADDR2 = MSB ... MACADDR5 = LSB of the upper 4 bytes */
+
+#define EMAC_MACADDRHI_MACADDR5_SHIFT 0
+#define EMAC_MACADDRHI_MACADDR4_SHIFT 8
+#define EMAC_MACADDRHI_MACADDR3_SHIFT 16
+#define EMAC_MACADDRHI_MACADDR2_SHIFT 24
+
+/****************************************************************************
+ * Public Type Definitions
+ ****************************************************************************/
+
+/* CPPI buffer descriptor - SPNU562A Section 31.2.6.4 / 31.2.6.5. Common
+ * layout for both TX and RX descriptors; some flag bits are only valid
+ * on one side (noted below). This structure is naturally 16 bytes with
+ * standard ARM alignment (no padding introduced by the compiler); instances
+ * live in the EMAC's internal CPPI RAM, which is mapped by this port's MPU
+ * as strongly-ordered/non-cacheable device memory (see rm57_mpuinit.h), so
+ * no D-cache maintenance is required for descriptor fields - only for the
+ * SRAM packet buffers they point to.
+ */
+
+struct rm57_emac_desc_s
+{
+ volatile struct rm57_emac_desc_s *next; /* Next descriptor pointer (0 = last) */
+ volatile uint8_t *buffer; /* Byte-aligned packet buffer pointer */
+
+ /* Word 2: "Buffer Offset(MSW) and Length(LSW)" (TRM Example 31-1). On
+ * this little-endian target the first-declared of a pair of uint16_t
+ * fields lands in the word's low half, so buflen (the LSW) has to be
+ * declared before bufoff (the MSW) - the reverse of their natural
+ * reading order - or the hardware reads buflen as the offset and
+ * bufoff as the length. Getting this backwards has EMAC report a
+ * transmit host error with MACSTATUS.TXERRCODE = 5 ("zero buffer
+ * length"), since bufoff is always 0.
+ */
+
+ volatile uint16_t buflen; /* Valid bytes in this buffer */
+ volatile uint16_t bufoff; /* Unused leading bytes (SOP desc only) */
+
+ volatile uint32_t flags_pktlen; /* Flags (bits 31-16) | packet length (bits 15-0) */
+};
+
+/* rm57_emac_desc_s.flags_pktlen flag bits (upper 16 bits) */
+
+#define EMAC_DESC_PKTLEN_MASK 0x0000ffff
+#define EMAC_DESC_PASSCRC 0x04000000
+#define EMAC_DESC_TDOWNCMPLT 0x08000000
+#define EMAC_DESC_EOQ 0x10000000
+#define EMAC_DESC_OWNER 0x20000000
+#define EMAC_DESC_EOP 0x40000000
+#define EMAC_DESC_SOP 0x80000000
+
+/* Additional RX-only status flags (valid on the EOP descriptor) */
+
+#define EMAC_DESC_RX_NOMATCH 0x00010000
+#define EMAC_DESC_RX_CRCERROR 0x00020000
+#define EMAC_DESC_RX_ALIGNERROR 0x00040000
+#define EMAC_DESC_RX_CODEERROR 0x00080000
+#define EMAC_DESC_RX_OVERRUN 0x00100000
+#define EMAC_DESC_RX_CONTROL 0x00200000
+#define EMAC_DESC_RX_UNDERSIZED 0x00400000
+#define EMAC_DESC_RX_FRAGMENT 0x00800000
+#define EMAC_DESC_RX_OVERSIZE 0x01000000
+#define EMAC_DESC_RX_JABBER 0x02000000
+
+#endif /* __ARCH_ARM_SRC_RM57_HARDWARE_RM57_ETHERNET_H */
diff --git a/arch/arm/src/rm57/hardware/rm57_flash.h b/arch/arm/src/rm57/hardware/rm57_flash.h
new file mode 100644
index 00000000000..bd926a7b94f
--- /dev/null
+++ b/arch/arm/src/rm57/hardware/rm57_flash.h
@@ -0,0 +1,80 @@
+/****************************************************************************
+ * arch/arm/src/rm57/hardware/rm57_flash.h
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/* Register layout taken from TI's HALCoGen HL_reg_flash.h for
+ * RM57L843 - matches TMS570's Flash Wrapper address (0xfff87000). Used
+ * for flash read-access wait-state configuration during clock/PLL
+ * setup (a higher CPU clock requires more flash wait states).
+ */
+
+#ifndef __ARCH_ARM_SRC_RM57_HARDWARE_RM57_FLASH_H
+#define __ARCH_ARM_SRC_RM57_HARDWARE_RM57_FLASH_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include "hardware/rm57l843_memorymap.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* Register Offsets *********************************************************/
+
+/* Flash Read Control Register */
+#define RM57_FLASH_FRDCNTL_OFFSET 0x0000
+
+/* EEPROM/Flash EDAC Control Register 1 */
+#define RM57_FLASH_FEDACCTRL1_OFFSET 0x0008
+
+/* Flash Bank Primary Address Tag Register */
+#define RM57_FLASH_FPRIM_ADD_TAG_OFFSET 0x0028
+
+/* Flash Bank Access Control Register */
+#define RM57_FLASH_FBAC_OFFSET 0x003c
+
+/* Flash Bank Power Mode Register */
+#define RM57_FLASH_FBPWRMODE_OFFSET 0x0040
+
+/* Flash Bank Power Mode Status Register */
+#define RM57_FLASH_FBPRDY_OFFSET 0x0044
+
+/* Register Addresses *******************************************************/
+
+#define RM57_FLASH_FRDCNTL (RM57_FWRAP_BASE + RM57_FLASH_FRDCNTL_OFFSET)
+#define RM57_FLASH_FEDACCTRL1 (RM57_FWRAP_BASE + RM57_FLASH_FEDACCTRL1_OFFSET)
+#define RM57_FLASH_FBAC (RM57_FWRAP_BASE + RM57_FLASH_FBAC_OFFSET)
+#define RM57_FLASH_FBPWRMODE (RM57_FWRAP_BASE + RM57_FLASH_FBPWRMODE_OFFSET)
+#define RM57_FLASH_FBPRDY (RM57_FWRAP_BASE + RM57_FLASH_FBPRDY_OFFSET)
+
+/* Register Bit-Field Definitions *******************************************/
+
+/* Flash Read Control Register */
+
+/* Bits 8-11: Random read wait-states */
+#define FLASH_FRDCNTL_RWAIT_SHIFT (8)
+#define FLASH_FRDCNTL_RWAIT_MASK (0xf << FLASH_FRDCNTL_RWAIT_SHIFT)
+# define FLASH_FRDCNTL_RWAIT(n) ((uint32_t)(n) << FLASH_FRDCNTL_RWAIT_SHIFT)
+
+#endif /* __ARCH_ARM_SRC_RM57_HARDWARE_RM57_FLASH_H */
diff --git a/arch/arm/src/rm57/hardware/rm57_gio.h b/arch/arm/src/rm57/hardware/rm57_gio.h
new file mode 100644
index 00000000000..aec082405bf
--- /dev/null
+++ b/arch/arm/src/rm57/hardware/rm57_gio.h
@@ -0,0 +1,137 @@
+/****************************************************************************
+ * arch/arm/src/rm57/hardware/rm57_gio.h
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/* Register layout for RM57L843 GIO, per TI's HALCoGen HL_reg_gio.h -
+ * matches TMS570's GIO layout/address (0xfff7bc00).
+ */
+
+#ifndef __ARCH_ARM_SRC_RM57_HARDWARE_RM57_GIO_H
+#define __ARCH_ARM_SRC_RM57_HARDWARE_RM57_GIO_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include "hardware/rm57l843_memorymap.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#define RM57_NPORTS 2 /* GIO Port A, Port B */
+
+/* GIO Module Register Offsets **********************************************/
+
+#define RM57_GIO_GCR0_OFFSET 0x0000 /* Global Control Register */
+#define RM57_GIO_INTDET_OFFSET 0x0008 /* Interrupt Detect Register */
+#define RM57_GIO_POL_OFFSET 0x000c /* Interrupt Polarity Register */
+#define RM57_GIO_ENASET_OFFSET 0x0010 /* Interrupt Enable Set Register */
+#define RM57_GIO_ENACLR_OFFSET 0x0014 /* Interrupt Enable Clear Register */
+#define RM57_GIO_LVLSET_OFFSET 0x0018 /* Interrupt Priority Set Register */
+#define RM57_GIO_LVLCLR_OFFSET 0x001c /* Interrupt Priority Clear Register */
+#define RM57_GIO_FLG_OFFSET 0x0020 /* Interrupt Flag Register */
+#define RM57_GIO_OFF1_OFFSET 0x0024 /* Interrupt Offset 1 Register */
+#define RM57_GIO_OFF2_OFFSET 0x0028 /* Interrupt Offset 2 Register */
+#define RM57_GIO_EMU1_OFFSET 0x002c /* Emulation 1 Register */
+#define RM57_GIO_EMU2_OFFSET 0x0030 /* Emulation 2 Register */
+
+/* GIO Port Register Offsets (relative to each gioPORTx base) ***************/
+
+#define RM57_GIO_DIR_OFFSET 0x0000 /* Data Direction Register */
+#define RM57_GIO_DIN_OFFSET 0x0004 /* Data Input Register */
+#define RM57_GIO_DOUT_OFFSET 0x0008 /* Data Output Register */
+#define RM57_GIO_DSET_OFFSET 0x000c /* Data Output Set Register */
+#define RM57_GIO_DCLR_OFFSET 0x0010 /* Data Output Clear Register */
+#define RM57_GIO_PDR_OFFSET 0x0014 /* Open Drain Register */
+#define RM57_GIO_PULDIS_OFFSET 0x0018 /* Pullup Disable Register */
+#define RM57_GIO_PSL_OFFSET 0x001c /* Pull Up/Down Selection Register */
+
+/* Register Addresses *******************************************************/
+
+#define RM57_GIO_GCR0 (RM57_GIO_BASE + RM57_GIO_GCR0_OFFSET)
+#define RM57_GIO_INTDET (RM57_GIO_BASE + RM57_GIO_INTDET_OFFSET)
+#define RM57_GIO_POL (RM57_GIO_BASE + RM57_GIO_POL_OFFSET)
+#define RM57_GIO_ENASET (RM57_GIO_BASE + RM57_GIO_ENASET_OFFSET)
+#define RM57_GIO_ENACLR (RM57_GIO_BASE + RM57_GIO_ENACLR_OFFSET)
+#define RM57_GIO_LVLSET (RM57_GIO_BASE + RM57_GIO_LVLSET_OFFSET)
+#define RM57_GIO_LVLCLR (RM57_GIO_BASE + RM57_GIO_LVLCLR_OFFSET)
+#define RM57_GIO_FLG (RM57_GIO_BASE + RM57_GIO_FLG_OFFSET)
+#define RM57_GIO_OFF1 (RM57_GIO_BASE + RM57_GIO_OFF1_OFFSET)
+#define RM57_GIO_OFF2 (RM57_GIO_BASE + RM57_GIO_OFF2_OFFSET)
+#define RM57_GIO_EMU1 (RM57_GIO_BASE + RM57_GIO_EMU1_OFFSET)
+#define RM57_GIO_EMU2 (RM57_GIO_BASE + RM57_GIO_EMU2_OFFSET)
+
+/* Port n base address: Port A and Port B are 0x20 bytes apart */
+#define RM57_GIO_PORTBASE(n) (RM57_GIO_PORTA_BASE + ((n) << 5))
+
+/* GIO Interrupt Enable Set/Clear and Priority Set/Clear Registers: one byte
+ * per port, one bit per pin within the byte. The Set and Clear registers of
+ * a pair share the same layout; writing a 1 acts, writing a 0 is ignored.
+ */
+
+#define GIO_ENASET_PORT_SHIFT(p) ((p) << 3)
+#define GIO_ENASET_PORT_PIN(p,n) (1 << (GIO_ENASET_PORT_SHIFT(p) + (n)))
+#define GIO_ENACLR_PORT_SHIFT(p) ((p) << 3)
+#define GIO_ENACLR_PORT_PIN(p,n) (1 << (GIO_ENACLR_PORT_SHIFT(p) + (n)))
+#define GIO_LVLSET_PORT_SHIFT(p) ((p) << 3)
+#define GIO_LVLSET_PORT_PIN(p,n) (1 << (GIO_LVLSET_PORT_SHIFT(p) + (n)))
+#define GIO_LVLCLR_PORT_SHIFT(p) ((p) << 3)
+#define GIO_LVLCLR_PORT_PIN(p,n) (1 << (GIO_LVLCLR_PORT_SHIFT(p) + (n)))
+
+/* GIO Interrupt Polarity / Detect / Flag Registers: same one-byte-per-port,
+ * one-bit-per-pin layout as the ENA/LVL registers above. A GIOFLG bit is
+ * cleared by writing a 1 to it (or by reading the corresponding offset
+ * register); writing a 0 has no effect.
+ */
+
+#define GIO_POL_PORT_SHIFT(p) ((p) << 3)
+#define GIO_POL_PORT_PIN(p,n) (1 << (GIO_POL_PORT_SHIFT(p) + (n)))
+#define GIO_INTDET_PORT_SHIFT(p) ((p) << 3)
+#define GIO_INTDET_PORT_PIN(p,n) (1 << (GIO_INTDET_PORT_SHIFT(p) + (n)))
+#define GIO_FLG_PORT_SHIFT(p) ((p) << 3)
+#define GIO_FLG_PORT_PIN(p,n) (1 << (GIO_FLG_PORT_SHIFT(p) + (n)))
+
+/* Register Bit-Field Definitions *******************************************/
+
+/* Global Control Register */
+
+/* Bit 0: Take GIO module out of reset */
+#define GIO_GCR0_RESET (1 << 0)
+
+/* Interrupt Offset Registers (OFF1/OFF2): 0 means no interrupt pending;
+ * a nonzero value is (port << 3 | pin) + 1 for the highest-priority
+ * pending pin. OFF1 reports the level A (high level) pins, OFF2 the
+ * level B (low level) pins. Reading an offset register clears it, the
+ * matching EMUn mirror, and the corresponding GIOFLG bit, so the register
+ * can be read in a loop until it returns zero to drain every pending pin.
+ * EMU1/EMU2 are non-destructive mirrors intended for debugger reads.
+ */
+
+#define GIO_OFF_NONE (0x00) /* No interrupt pending */
+
+/* Per-pin bitmasks for GIOA0-GIOA7/GIOB0-GIOB7 are computed at the
+ * pinset-encoding level (see rm57_gio_pinmask() / GIO_PINn in
+ * rm57_gio.h), not duplicated here.
+ */
+
+#endif /* __ARCH_ARM_SRC_RM57_HARDWARE_RM57_GIO_H */
diff --git a/arch/arm/src/rm57/hardware/rm57_i2c.h b/arch/arm/src/rm57/hardware/rm57_i2c.h
new file mode 100644
index 00000000000..0dc9d8fab0c
--- /dev/null
+++ b/arch/arm/src/rm57/hardware/rm57_i2c.h
@@ -0,0 +1,169 @@
+/****************************************************************************
+ * arch/arm/src/rm57/hardware/rm57_i2c.h
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_RM57_HARDWARE_RM57_I2C_H
+#define __ARCH_ARM_SRC_RM57_HARDWARE_RM57_I2C_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include "hardware/rm57l843_memorymap.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* The offsets below are those of SPNU562A Table 30-3, cross-checked against
+ * the field order of HALCoGen's i2cBASE_t; the two agree.
+ * Only the low 16 bits of every register are implemented.
+ */
+
+/* I2C Register Offsets *****************************************************/
+
+#define RM57_I2C_OAR_OFFSET 0x0000 /* Own Address */
+#define RM57_I2C_IMR_OFFSET 0x0004 /* Interrupt Mask */
+#define RM57_I2C_STR_OFFSET 0x0008 /* Status */
+#define RM57_I2C_CKL_OFFSET 0x000c /* Clock Divider Low */
+#define RM57_I2C_CKH_OFFSET 0x0010 /* Clock Divider High */
+#define RM57_I2C_CNT_OFFSET 0x0014 /* Data Count */
+#define RM57_I2C_DRR_OFFSET 0x0018 /* Data Receive */
+#define RM57_I2C_SAR_OFFSET 0x001c /* Slave Address */
+#define RM57_I2C_DXR_OFFSET 0x0020 /* Data Transmit */
+#define RM57_I2C_MDR_OFFSET 0x0024 /* Mode */
+#define RM57_I2C_IVR_OFFSET 0x0028 /* Interrupt Vector */
+#define RM57_I2C_EMDR_OFFSET 0x002c /* Extended Mode */
+#define RM57_I2C_PSC_OFFSET 0x0030 /* Prescale */
+#define RM57_I2C_PID1_OFFSET 0x0034 /* Peripheral ID 1 */
+#define RM57_I2C_PID2_OFFSET 0x0038 /* Peripheral ID 2 */
+#define RM57_I2C_DMACR_OFFSET 0x003c /* DMA Control */
+#define RM57_I2C_PFNC_OFFSET 0x0048 /* Pin Function */
+#define RM57_I2C_PDIR_OFFSET 0x004c /* Pin Direction */
+#define RM57_I2C_DIN_OFFSET 0x0050 /* Pin Data In */
+#define RM57_I2C_DOUT_OFFSET 0x0054 /* Pin Data Out */
+#define RM57_I2C_DSET_OFFSET 0x0058 /* Pin Data Set */
+#define RM57_I2C_DCLR_OFFSET 0x005c /* Pin Data Clear */
+#define RM57_I2C_PDR_OFFSET 0x0060 /* Pin Open Drain */
+#define RM57_I2C_PDIS_OFFSET 0x0064 /* Pin Pull Disable */
+#define RM57_I2C_PSEL_OFFSET 0x0068 /* Pin Pull Select */
+#define RM57_I2C_SRS_OFFSET 0x006c /* Pin Slew Rate Select */
+
+/* I2C Register Bit Definitions *********************************************/
+
+/* Own Address and Slave Address: 7-bit addresses use bits 0-6 only */
+
+#define I2C_ADDR_MASK 0x03ff /* Bits 0-9: OA / SA */
+
+/* Interrupt Mask (IMR) and the matching flags in Status (STR) */
+
+#define I2C_INT_AL (1 << 0) /* Bit 0: Arbitration lost */
+#define I2C_INT_NACK (1 << 1) /* Bit 1: No acknowledge */
+#define I2C_INT_ARDY (1 << 2) /* Bit 2: Register access ready */
+#define I2C_INT_RXRDY (1 << 3) /* Bit 3: Receive data ready */
+#define I2C_INT_TXRDY (1 << 4) /* Bit 4: Transmit data ready */
+#define I2C_INT_SCD (1 << 5) /* Bit 5: Stop condition detected */
+#define I2C_INT_AAS (1 << 6) /* Bit 6: Addressed as slave */
+
+/* Status (STR), beyond the interrupt flags above. AL, NACK, ARDY, RXRDY,
+ * SCD, NACKSNT and SDIR are write-1-to-clear; writing 1 to TXRDY sets it.
+ */
+
+#define I2C_STR_AD0 (1 << 8) /* Bit 8: General call detected */
+#define I2C_STR_AAS (1 << 9) /* Bit 9: Addressed as slave */
+#define I2C_STR_XSMT (1 << 10) /* Bit 10: Transmit shift empty (0 = underflow) */
+#define I2C_STR_RSFULL (1 << 11) /* Bit 11: Receive overrun */
+#define I2C_STR_BB (1 << 12) /* Bit 12: Bus busy */
+#define I2C_STR_NACKSNT (1 << 13) /* Bit 13: NACK sent */
+#define I2C_STR_SDIR (1 << 14) /* Bit 14: Slave direction */
+
+#define I2C_STR_W1C (I2C_INT_AL | I2C_INT_NACK | I2C_INT_ARDY | \
+ I2C_INT_RXRDY | I2C_INT_SCD | \
+ I2C_STR_NACKSNT | I2C_STR_SDIR)
+
+/* Data Count: a count of 0 means 65536 bytes */
+
+#define I2C_CNT_MAX 0xffff
+
+/* Mode (MDR) */
+
+#define I2C_MDR_BC_SHIFT 0 /* Bits 0-2: Bit count */
+#define I2C_MDR_BC_MASK (7 << I2C_MDR_BC_SHIFT)
+# define I2C_MDR_BC_8BITS (0 << I2C_MDR_BC_SHIFT)
+#define I2C_MDR_FDF (1 << 3) /* Bit 3: Free data format */
+#define I2C_MDR_STB (1 << 4) /* Bit 4: START byte mode */
+#define I2C_MDR_NIRS (1 << 5) /* Bit 5: Out of reset */
+#define I2C_MDR_DLB (1 << 6) /* Bit 6: Digital loopback */
+#define I2C_MDR_RM (1 << 7) /* Bit 7: Repeat mode */
+#define I2C_MDR_XA (1 << 8) /* Bit 8: 10-bit addressing */
+#define I2C_MDR_TRX (1 << 9) /* Bit 9: Transmitter */
+#define I2C_MDR_MST (1 << 10) /* Bit 10: Master */
+#define I2C_MDR_STP (1 << 11) /* Bit 11: Generate STOP */
+#define I2C_MDR_STT (1 << 13) /* Bit 13: Generate START */
+#define I2C_MDR_FREE (1 << 14) /* Bit 14: Run free on emulation halt */
+#define I2C_MDR_NACKMOD (1 << 15) /* Bit 15: NACK the next byte */
+
+/* Interrupt Vector (IVR). Reading it clears the AL, NACK and SCD flags of
+ * the code returned, provided that interrupt is enabled.
+ */
+
+#define I2C_IVR_INTCODE_SHIFT 0 /* Bits 0-2: Highest pending interrupt */
+#define I2C_IVR_INTCODE_MASK (7 << I2C_IVR_INTCODE_SHIFT)
+# define I2C_IVR_NONE 0
+# define I2C_IVR_AL 1
+# define I2C_IVR_NACK 2
+# define I2C_IVR_ARDY 3
+# define I2C_IVR_RXRDY 4
+# define I2C_IVR_TXRDY 5
+# define I2C_IVR_SCD 6
+# define I2C_IVR_AAS 7
+
+/* Extended Mode (EMDR). BCM resets to 1. */
+
+#define I2C_EMDR_BCM (1 << 0) /* Bit 0: Backwards compatibility */
+#define I2C_EMDR_IGNACK (1 << 1) /* Bit 1: Ignore NACK (master TX) */
+
+/* Prescale (PSC): module clock = VCLK / (PSC + 1), 6.7-13.3 MHz */
+
+#define I2C_PSC_MASK 0xff
+
+/* DMA Control (DMACR). Both bits reset to 1. HALCoGen's enum i2cDMA puts
+ * them at 0x20 / 0x10, which does not match SPNU562A Figure 30-29.
+ */
+
+#define I2C_DMACR_RXDMAEN (1 << 0) /* Bit 0: Receive DMA event */
+#define I2C_DMACR_TXDMAEN (1 << 1) /* Bit 1: Transmit DMA event */
+
+/* Pin Function (PFNC) */
+
+#define I2C_PFNC_GIO (1 << 0) /* Bit 0: SDA and SCL are GIO pins */
+
+/* Per-pin bits shared by PDIR, DIN, DOUT, DSET, DCLR, PDR, PDIS, PSEL and
+ * SRS. PDIS resets to 1 (pulls off). PDR's polarity is documented both
+ * ways in SPNU562A (Section 30.5.6 vs Table 30-32), so the driver never
+ * relies on it and emulates open drain with the direction bit instead.
+ */
+
+#define I2C_PIN_SCL (1 << 0) /* Bit 0: SCL */
+#define I2C_PIN_SDA (1 << 1) /* Bit 1: SDA */
+
+#endif /* __ARCH_ARM_SRC_RM57_HARDWARE_RM57_I2C_H */
diff --git a/arch/arm/src/rm57/hardware/rm57_iomm.h b/arch/arm/src/rm57/hardware/rm57_iomm.h
new file mode 100644
index 00000000000..c58411666e3
--- /dev/null
+++ b/arch/arm/src/rm57/hardware/rm57_iomm.h
@@ -0,0 +1,139 @@
+/****************************************************************************
+ * arch/arm/src/rm57/hardware/rm57_iomm.h
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/* References:
+ * RM57Lx 16/32-Bit RISC Flash Microcontroller, Technical Reference Manual,
+ * Texas Instruments, Literature Number: SPNU562
+ *
+ * Register offsets were cross-checked against TI's HALCoGen-generated
+ * HL_reg_pinmux.h for RM57L843. RM57L843 has considerably more pin
+ * multiplexing control registers than the TMS570LS devices, and they are
+ * split into three separate, non-contiguous regions (see below).
+ */
+
+#ifndef __ARCH_ARM_SRC_RM57_HARDWARE_RM57_IOMM_H
+#define __ARCH_ARM_SRC_RM57_HARDWARE_RM57_IOMM_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include "hardware/rm57l843_memorymap.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* Register Offsets *********************************************************/
+
+#define RM57_IOMM_REVISION_OFFSET 0x0000 /* Revision Register */
+#define RM57_IOMM_BOOT_OFFSET 0x0020 /* Boot Mode Register */
+#define RM57_IOMM_KICK0_OFFSET 0x0038 /* Kicker Register 0 */
+#define RM57_IOMM_KICK1_OFFSET 0x003c /* Kicker Register 1 */
+#define RM57_IOMM_ERRRAWSTATUS_OFFSET 0x00e0 /* Error Raw Status / Set Register */
+#define RM57_IOMM_ERRSTATUS_OFFSET 0x00e4 /* Error Enabled Status / Clear Register */
+#define RM57_IOMM_ERRENABLE_OFFSET 0x00e8 /* Error Signaling Enable Register */
+#define RM57_IOMM_ERRENABLECLR_OFFSET 0x00ec /* Error Signaling Enable Clear Register */
+#define RM57_IOMM_FAULTADDRESS_OFFSET 0x00f4 /* Fault Address Register */
+#define RM57_IOMM_FAULTSTATUS_OFFSET 0x00f8 /* Fault Status Register */
+#define RM57_IOMM_FAULTCLR_OFFSET 0x00fc /* Fault Clear Register */
+
+/* Pin Multiplexing Control Registers.
+ *
+ * The PINMMR registers are indexed as a single array starting at offset
+ * 0x0110, but only three sub-ranges of that array are implemented:
+ *
+ * INDEX OFFSET RANGE CONTENTS
+ * 0 - 37 0x0110-0x01a4 Output (ball) pin multiplexing control
+ * 38 - 79 0x01a8-0x024c Reserved
+ * 80 - 99 0x0250-0x029c Input pin multiplexing control
+ * 100 - 159 0x02a0-0x038c Reserved
+ * 160 - 179 0x0390-0x03dc Special functionality control
+ *
+ * Reading or writing an index in a reserved range has no effect. The
+ * chip-specific pinmux header (rm57l843_pinmux.h) defines the index, shift
+ * and value of every pin function, so the individual register indices do
+ * not need to be spelled out here.
+ */
+
+#define RM57_IOMM_PINMMR_OFFSET(n) (0x0110 + ((unsigned int)(n) << 2))
+
+#define RM57_IOMM_PINMMR_OUT_FIRST 0 /* First output mux index */
+#define RM57_IOMM_PINMMR_OUT_LAST 37 /* Last output mux index */
+#define RM57_IOMM_PINMMR_IN_FIRST 80 /* First input mux index */
+#define RM57_IOMM_PINMMR_IN_LAST 99 /* Last input mux index */
+#define RM57_IOMM_PINMMR_SPCL_FIRST 160 /* First special function index */
+#define RM57_IOMM_PINMMR_SPCL_LAST 179 /* Last special function index */
+
+/* Register Addresses *******************************************************/
+
+#define RM57_IOMM_REVISION (RM57_IOMM_BASE+RM57_IOMM_REVISION_OFFSET)
+#define RM57_IOMM_BOOT (RM57_IOMM_BASE+RM57_IOMM_BOOT_OFFSET)
+#define RM57_IOMM_KICK0 (RM57_IOMM_BASE+RM57_IOMM_KICK0_OFFSET)
+#define RM57_IOMM_KICK1 (RM57_IOMM_BASE+RM57_IOMM_KICK1_OFFSET)
+#define RM57_IOMM_ERRRAWSTATUS (RM57_IOMM_BASE+RM57_IOMM_ERRRAWSTATUS_OFFSET)
+#define RM57_IOMM_ERRSTATUS (RM57_IOMM_BASE+RM57_IOMM_ERRSTATUS_OFFSET)
+#define RM57_IOMM_ERRENABLE (RM57_IOMM_BASE+RM57_IOMM_ERRENABLE_OFFSET)
+#define RM57_IOMM_ERRENABLECLR (RM57_IOMM_BASE+RM57_IOMM_ERRENABLECLR_OFFSET)
+#define RM57_IOMM_FAULTADDRESS (RM57_IOMM_BASE+RM57_IOMM_FAULTADDRESS_OFFSET)
+#define RM57_IOMM_FAULTSTATUS (RM57_IOMM_BASE+RM57_IOMM_FAULTSTATUS_OFFSET)
+#define RM57_IOMM_FAULTCLR (RM57_IOMM_BASE+RM57_IOMM_FAULTCLR_OFFSET)
+
+#define RM57_IOMM_PINMMR(n) (RM57_IOMM_BASE+RM57_IOMM_PINMMR_OFFSET(n))
+
+/* Register Bit-Field Definitions *******************************************/
+
+/* Kicker Register 0 and 1.
+ *
+ * The PINMMR registers are write-protected until the two kicker registers
+ * are written with the unlock values below, in order. Writing any other
+ * value to either register locks them again.
+ */
+
+#define IOMM_KICK0_UNLOCK 0x83e70b13 /* Unlock value */
+#define IOMM_KICK0_LOCK 0x00000000 /* Any other value locks */
+
+#define IOMM_KICK1_UNLOCK 0x95a4f1e0 /* Unlock value */
+#define IOMM_KICK1_LOCK 0x00000000 /* Any other value locks */
+
+/* Error Raw Status/Set, Error Enabled Status/Clear, Error Signaling Enable,
+ * Error Signaling Enable Clear, Fault Address, Fault Status and Fault Clear
+ * Registers.
+ *
+ * These registers report accesses that violate the kicker write protection
+ * or the privilege mode of the accessing master. Their bit assignments are
+ * not used by this port; refer to SPNU562 if error signaling is needed.
+ */
+
+/* Pin Multiplexing Control Register n.
+ *
+ * Each PINMMR register holds four 8-bit fields, one per multiplexed ball
+ * (or per input signal / special function). Exactly one bit of a field
+ * should be set to select the corresponding function.
+ */
+
+#define IOMM_PINMMR_PINSHIFT(n) (((n) & 3) << 3)
+#define IOMM_PINMMR_PINMASK(n) (0xff << IOMM_PINMMR_PINSHIFT(n))
+# define IOMM_PINMMR_PINVALUE(n,v) ((uint32_t)(v) << IOMM_PINMMR_PINSHIFT(n))
+
+#endif /* __ARCH_ARM_SRC_RM57_HARDWARE_RM57_IOMM_H */
diff --git a/arch/arm/src/rm57/hardware/rm57_l2ramw.h b/arch/arm/src/rm57/hardware/rm57_l2ramw.h
new file mode 100644
index 00000000000..9d522779a45
--- /dev/null
+++ b/arch/arm/src/rm57/hardware/rm57_l2ramw.h
@@ -0,0 +1,180 @@
+/****************************************************************************
+ * arch/arm/src/rm57/hardware/rm57_l2ramw.h
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/* Level 2 RAM wrapper (L2RAMW), SPNU562A chapter 8.
+ *
+ * Besides ECC and parity control this module carries its own diagnostic
+ * stimulus registers: a data/ECC vector is written to DIAG_DATA_VECTOR_x /
+ * DIAG_ECC and pushed through both SECDED blocks and the redundant address
+ * decode compare with one RAMTEST trigger. The outcome appears in
+ * RAMERRSTATUS and on ESM group2 channel 7 - no RAM cell is corrupted and
+ * no data abort is taken, unlike the TCRAM scheme on Cortex-R4 parts.
+ *
+ * Offsets follow TRM Table 8-2 and match HALCoGen's HL_reg_l2ramw.h.
+ */
+
+#ifndef __ARCH_ARM_SRC_RM57_HARDWARE_RM57_L2RAMW_H
+#define __ARCH_ARM_SRC_RM57_HARDWARE_RM57_L2RAMW_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include "hardware/rm57l843_memorymap.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* Register Offsets *********************************************************/
+
+#define RM57_L2RAMW_RAMCTRL_OFFSET 0x0000 /* Module Control Register */
+#define RM57_L2RAMW_RAMERRSTATUS_OFFSET 0x0010 /* Error Status Register */
+
+/* Diagnostic Data Vector High */
+#define RM57_L2RAMW_DIAGDATAH_OFFSET 0x0024
+
+/* Diagnostic Data Vector Low */
+#define RM57_L2RAMW_DIAGDATAL_OFFSET 0x0028
+#define RM57_L2RAMW_DIAGECC_OFFSET 0x002c /* Diagnostic ECC Vector */
+#define RM57_L2RAMW_RAMTEST_OFFSET 0x0030 /* RAM Test Register */
+
+/* Address Decode Vector Test */
+#define RM57_L2RAMW_RAMADDRDECVECT_OFFSET 0x0038
+#define RM57_L2RAMW_MEMINITDOMAIN_OFFSET 0x003c /* Memory Init Domain */
+
+/* Bank to Domain Mapping 0 */
+#define RM57_L2RAMW_BANKDOMAINMAP0_OFFSET 0x0044
+
+/* Bank to Domain Mapping 1 */
+#define RM57_L2RAMW_BANKDOMAINMAP1_OFFSET 0x0048
+
+/* Register Addresses *******************************************************/
+
+#define RM57_L2RAMW_RAMCTRL \
+ (RM57_L2RAMW_BASE + RM57_L2RAMW_RAMCTRL_OFFSET)
+#define RM57_L2RAMW_RAMERRSTATUS \
+ (RM57_L2RAMW_BASE + RM57_L2RAMW_RAMERRSTATUS_OFFSET)
+#define RM57_L2RAMW_DIAGDATAH \
+ (RM57_L2RAMW_BASE + RM57_L2RAMW_DIAGDATAH_OFFSET)
+#define RM57_L2RAMW_DIAGDATAL \
+ (RM57_L2RAMW_BASE + RM57_L2RAMW_DIAGDATAL_OFFSET)
+#define RM57_L2RAMW_DIAGECC \
+ (RM57_L2RAMW_BASE + RM57_L2RAMW_DIAGECC_OFFSET)
+#define RM57_L2RAMW_RAMTEST \
+ (RM57_L2RAMW_BASE + RM57_L2RAMW_RAMTEST_OFFSET)
+#define RM57_L2RAMW_RAMADDRDECVECT \
+ (RM57_L2RAMW_BASE + RM57_L2RAMW_RAMADDRDECVECT_OFFSET)
+
+/* Register Bit-Field Definitions *******************************************/
+
+/* Module Control Register */
+
+/* Bits 0-3: ECC detect */
+#define L2RAMW_RAMCTRL_ECC_DETECT_MASK (0x0f << 0)
+# define L2RAMW_RAMCTRL_ECC_DETECT_DIS (0x05 << 0) /* Only 5h disables */
+# define L2RAMW_RAMCTRL_ECC_DETECT_ENA (0x0a << 0)
+
+/* Bit 4: Capture write SERR */
+#define L2RAMW_RAMCTRL_CPUWSC (1 << 4)
+
+/* Bit 8: ECC memory writable */
+#define L2RAMW_RAMCTRL_ECC_WR_EN (1 << 8)
+
+/* Bit 12: ESM on scrub error */
+#define L2RAMW_RAMCTRL_EEMMS (1 << 12)
+
+/* Bits 16-19: Ah disables */
+#define L2RAMW_RAMCTRL_ADDR_PAR_DIS_MASK (0x0f << 16)
+
+/* Bit 20: Memory scrubbing */
+#define L2RAMW_RAMCTRL_MSE (1 << 20)
+#define L2RAMW_RAMCTRL_ADDR_PAR_OVR_MASK (0x0f << 24) /* Bits 24-27 */
+#define L2RAMW_RAMCTRL_EMU_TRACE_DIS (1 << 30)
+
+/* Error Status Register (all flags W1C) */
+
+#define L2RAMW_ERR_CPUWE (1 << 0) /* CPU write ECC single error */
+#define L2RAMW_ERR_REME (1 << 1) /* Read SECDED malfunction */
+#define L2RAMW_ERR_ADE (1 << 2) /* Redundant address decode */
+#define L2RAMW_ERR_WEME (1 << 3) /* Write SECDED malfunction */
+#define L2RAMW_ERR_ADDE (1 << 4) /* Address decode, diagnostic */
+#define L2RAMW_ERR_CPUWDE (1 << 5) /* CPU write ECC double error */
+
+/* Read-modify-write double error */
+#define L2RAMW_ERR_RMWDE (1 << 7)
+#define L2RAMW_ERR_PACE (1 << 8) /* Address/control parity */
+#define L2RAMW_ERR_MME (1 << 9) /* Write data merged mux */
+
+/* Read SECDED malf., diagnostic */
+#define L2RAMW_ERR_REMDE (1 << 10)
+
+/* Write SECDED malf., diagnostic */
+#define L2RAMW_ERR_WEMDE (1 << 11)
+#define L2RAMW_ERR_MMDE (1 << 12) /* Merged mux, diagnostic */
+#define L2RAMW_ERR_MIE (1 << 13) /* Memory initialization */
+#define L2RAMW_ERR_CPEOI (1 << 15) /* Command parity on idle */
+#define L2RAMW_ERR_MSACP (1 << 16) /* Scrubbing addr/ctrl parity */
+#define L2RAMW_ERR_MSRA (1 << 17) /* Scrubbing address decode */
+
+/* Scrubbing SECDED malfunction */
+#define L2RAMW_ERR_MSSM (1 << 18)
+
+/* Diagnostic write single-bit */
+#define L2RAMW_ERR_DWSE (1 << 19)
+
+/* Diagnostic write double-bit */
+#define L2RAMW_ERR_DWDE (1 << 20)
+#define L2RAMW_ERR_DRSE (1 << 21) /* Diagnostic read single-bit */
+#define L2RAMW_ERR_DRDE (1 << 22) /* Diagnostic read double-bit */
+
+/* The diagnostic flags that must all be clear before RAMTEST will accept
+ * a trigger (TRM 8.2.6): bits 22, 21, 20, 19, 12, 11, 10 and 4.
+ */
+
+#define L2RAMW_ERR_DIAG_ALL (L2RAMW_ERR_DRDE | L2RAMW_ERR_DRSE | \
+ L2RAMW_ERR_DWDE | L2RAMW_ERR_DWSE | \
+ L2RAMW_ERR_MMDE | L2RAMW_ERR_WEMDE | \
+ L2RAMW_ERR_REMDE | L2RAMW_ERR_ADDE)
+
+/* RAM Test Register */
+
+/* Bits 0-3: Test enable key */
+#define L2RAMW_RAMTEST_ENABLE_MASK (0x0f << 0)
+# define L2RAMW_RAMTEST_ENABLE (0x0a << 0)
+# define L2RAMW_RAMTEST_DISABLE (0x05 << 0)
+#define L2RAMW_RAMTEST_MODE_MASK (3 << 6) /* Bits 6-7: Test mode */
+# define L2RAMW_RAMTEST_MODE_INEQ (1 << 6) /* Inequality check */
+# define L2RAMW_RAMTEST_MODE_EQ (2 << 6) /* Equality check */
+
+/* Bit 8: Trigger, self-clearing */
+#define L2RAMW_RAMTEST_TRIGGER (1 << 8)
+
+/* The ECC of an all-zero 64-bit word is 0x0c in every byte lane (TRM
+ * 8.2.3), so these are the DIAG_ECC values that present a clean word and
+ * a word with one or two flipped ECC bits.
+ */
+
+#define L2RAMW_DIAGECC_ZERO (0x0c)
+
+#endif /* __ARCH_ARM_SRC_RM57_HARDWARE_RM57_L2RAMW_H */
diff --git a/arch/arm/src/rm57/hardware/rm57_mibspi.h b/arch/arm/src/rm57/hardware/rm57_mibspi.h
new file mode 100644
index 00000000000..8b4c44fed8d
--- /dev/null
+++ b/arch/arm/src/rm57/hardware/rm57_mibspi.h
@@ -0,0 +1,484 @@
+/****************************************************************************
+ * arch/arm/src/rm57/hardware/rm57_mibspi.h
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_RM57_HARDWARE_RM57_MIBSPI_H
+#define __ARCH_ARM_SRC_RM57_HARDWARE_RM57_MIBSPI_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include "hardware/rm57l843_memorymap.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* The offsets below are those of SPNU562A Table 27-8, cross-checked against
+ * the field order of HALCoGen's mibspiBASE_t. The two
+ * agree everywhere except SBERRADDR0, which HALCoGen pads out to an
+ * unaligned 0x152 and Table 27-8 misprints the same way; the register's own
+ * figure (27-85) places it at 0x14c, right after SBERRADDR1.
+ */
+
+#define RM57_NMIBSPI_TG 8 /* Usable transfer groups */
+#define RM57_NMIBSPI_DMA 8 /* MibSPI DMA channels */
+#define RM57_NMIBSPI_CS 6 /* Chip selects (2 on MibSPI2) */
+
+/* Multi-buffer RAM depth (SPNS215C Section 7.11.2). Only MibSPI1
+ * implements the extended buffer mode that doubles it.
+ */
+
+#define RM57_MIBSPI_NBUF 128
+#define RM57_MIBSPI_NBUF_EXTENDED 256
+
+/* MibSPI Register Offsets **************************************************/
+
+#define RM57_MIBSPI_GCR0_OFFSET 0x0000 /* Global Control Register 0 */
+#define RM57_MIBSPI_GCR1_OFFSET 0x0004 /* Global Control Register 1 */
+#define RM57_MIBSPI_INT0_OFFSET 0x0008 /* Interrupt Register */
+#define RM57_MIBSPI_LVL_OFFSET 0x000c /* Interrupt Level Register */
+#define RM57_MIBSPI_FLG_OFFSET 0x0010 /* Flag Register */
+#define RM57_MIBSPI_PC0_OFFSET 0x0014 /* Pin Control 0: Function */
+#define RM57_MIBSPI_PC1_OFFSET 0x0018 /* Pin Control 1: Direction */
+#define RM57_MIBSPI_PC2_OFFSET 0x001c /* Pin Control 2: Data In */
+#define RM57_MIBSPI_PC3_OFFSET 0x0020 /* Pin Control 3: Data Out */
+#define RM57_MIBSPI_PC4_OFFSET 0x0024 /* Pin Control 4: Data Out Set */
+#define RM57_MIBSPI_PC5_OFFSET 0x0028 /* Pin Control 5: Data Out Clear */
+#define RM57_MIBSPI_PC6_OFFSET 0x002c /* Pin Control 6: Open Drain */
+#define RM57_MIBSPI_PC7_OFFSET 0x0030 /* Pin Control 7: Pull Disable */
+#define RM57_MIBSPI_PC8_OFFSET 0x0034 /* Pin Control 8: Pull Select */
+#define RM57_MIBSPI_DAT0_OFFSET 0x0038 /* Transmit Data Register 0 */
+#define RM57_MIBSPI_DAT1_OFFSET 0x003c /* Transmit Data Register 1 */
+#define RM57_MIBSPI_BUF_OFFSET 0x0040 /* Receive Buffer Register */
+#define RM57_MIBSPI_EMU_OFFSET 0x0044 /* Emulation Register */
+#define RM57_MIBSPI_DELAY_OFFSET 0x0048 /* Delay Register */
+#define RM57_MIBSPI_DEF_OFFSET 0x004c /* Default Chip Select Register */
+#define RM57_MIBSPI_FMT_OFFSET(n) (0x0050 + ((n) << 2))
+#define RM57_MIBSPI_FMT0_OFFSET 0x0050 /* Data Format Register 0 */
+#define RM57_MIBSPI_FMT1_OFFSET 0x0054 /* Data Format Register 1 */
+#define RM57_MIBSPI_FMT2_OFFSET 0x0058 /* Data Format Register 2 */
+#define RM57_MIBSPI_FMT3_OFFSET 0x005c /* Data Format Register 3 */
+#define RM57_MIBSPI_INTVECT0_OFFSET 0x0060 /* Interrupt Vector 0 */
+#define RM57_MIBSPI_INTVECT1_OFFSET 0x0064 /* Interrupt Vector 1 */
+#define RM57_MIBSPI_PC9_OFFSET 0x0068 /* Pin Control 9: Slew Rate (MibSPI2) */
+#define RM57_MIBSPI_PMCTRL_OFFSET 0x006c /* Parallel/Modulo Mode Control */
+
+/* Everything from here on is only accessible in multi-buffer mode */
+
+#define RM57_MIBSPI_MIBSPIE_OFFSET 0x0070 /* Multi-buffer Mode Enable */
+#define RM57_MIBSPI_TGITENST_OFFSET 0x0074 /* TG Interrupt Enable Set */
+#define RM57_MIBSPI_TGITENCR_OFFSET 0x0078 /* TG Interrupt Enable Clear */
+#define RM57_MIBSPI_TGITLVST_OFFSET 0x007c /* TG Interrupt Level Set */
+#define RM57_MIBSPI_TGITLVCR_OFFSET 0x0080 /* TG Interrupt Level Clear */
+#define RM57_MIBSPI_TGINTFLG_OFFSET 0x0084 /* TG Interrupt Flag */
+#define RM57_MIBSPI_TICKCNT_OFFSET 0x0090 /* Tick Count Register */
+#define RM57_MIBSPI_LTGPEND_OFFSET 0x0094 /* Last TG End Pointer */
+
+/* TG control n = 0..15, DMA channel control and count n = 0..7 */
+
+#define RM57_MIBSPI_TGCTRL_OFFSET(n) (0x0098 + ((n) << 2))
+#define RM57_MIBSPI_DMACTRL_OFFSET(n) (0x00d8 + ((n) << 2))
+#define RM57_MIBSPI_DMACOUNT_OFFSET(n) (0x00f8 + ((n) << 2))
+#define RM57_MIBSPI_DMACNTLEN_OFFSET 0x0118 /* DMA Large Count */
+#define RM57_MIBSPI_PARECCCTRL_OFFSET 0x0120 /* Parity/ECC Control */
+#define RM57_MIBSPI_PARECCSTAT_OFFSET 0x0124 /* Parity/ECC Status */
+#define RM57_MIBSPI_UERRADDR1_OFFSET 0x0128 /* Uncorrectable Error Address, RXRAM */
+#define RM57_MIBSPI_UERRADDR0_OFFSET 0x012c /* Uncorrectable Error Address, TXRAM */
+#define RM57_MIBSPI_RXOVRNADDR_OFFSET 0x0130 /* RXRAM Overrun Buffer Address */
+#define RM57_MIBSPI_IOLPBKTSTCR_OFFSET 0x0134 /* I/O Loopback Test Control */
+#define RM57_MIBSPI_EXTPRESCALE1_OFFSET 0x0138 /* Extended Prescale 1 (FMT0, FMT1) */
+#define RM57_MIBSPI_EXTPRESCALE2_OFFSET 0x013c /* Extended Prescale 2 (FMT2, FMT3) */
+#define RM57_MIBSPI_ECCDIAGCTRL_OFFSET 0x0140 /* ECC Diagnostic Control */
+#define RM57_MIBSPI_ECCDIAGSTAT_OFFSET 0x0144 /* ECC Diagnostic Status */
+#define RM57_MIBSPI_SBERRADDR1_OFFSET 0x0148 /* Single-Bit Error Address, RXRAM */
+#define RM57_MIBSPI_SBERRADDR0_OFFSET 0x014c /* Single-Bit Error Address, TXRAM */
+
+/* Multi-buffer RAM *********************************************************/
+
+/* One 32-bit word per buffer in each bank. The receive bank starts where
+ * the transmit bank ends, so its offset doubles with the extended buffer
+ * mode (SPNU562A Figures 27-90 and 27-91).
+ */
+
+#define RM57_MIBSPI_TXRAM_OFFSET(n) ((n) << 2)
+#define RM57_MIBSPI_RXRAM_OFFSET(n) (0x0200 + ((n) << 2))
+#define RM57_MIBSPI_RXRAM_EXT_OFFSET(n) (0x0400 + ((n) << 2))
+
+/* MibSPI Register Bit Definitions ******************************************/
+
+/* Global Control Register 0 */
+
+#define MIBSPI_GCR0_NRESET (1 << 0) /* Bit 0: Out of reset */
+
+/* Global Control Register 1 */
+
+#define MIBSPI_GCR1_MASTER (1 << 0) /* Bit 0: SIMO out, SOMI in */
+#define MIBSPI_GCR1_CLKMOD (1 << 1) /* Bit 1: Internal clock */
+#define MIBSPI_GCR1_POWERDOWN (1 << 8) /* Bit 8: Local power-down */
+#define MIBSPI_GCR1_LOOPBACK (1 << 16) /* Bit 16: Internal loopback */
+#define MIBSPI_GCR1_SPIEN (1 << 24) /* Bit 24: Transfers enabled */
+
+/* Interrupt Register, Interrupt Level Register and Flag Register share the
+ * layout of their low 10 bits.
+ */
+
+#define MIBSPI_INT_DLENERR (1 << 0) /* Bit 0: Data length error */
+#define MIBSPI_INT_TIMEOUT (1 << 1) /* Bit 1: ENA time-out */
+#define MIBSPI_INT_PARERR (1 << 2) /* Bit 2: Parity error */
+#define MIBSPI_INT_DESYNC (1 << 3) /* Bit 3: Slave desynchronized */
+#define MIBSPI_INT_BITERR (1 << 4) /* Bit 4: Bit error */
+#define MIBSPI_INT_RXOVRN (1 << 6) /* Bit 6: Receive overrun */
+#define MIBSPI_INT_RX (1 << 8) /* Bit 8: Receive buffer full */
+#define MIBSPI_INT_TX (1 << 9) /* Bit 9: Transmit buffer empty */
+
+#define MIBSPI_INT_ALLERRORS (MIBSPI_INT_DLENERR | MIBSPI_INT_TIMEOUT | \
+ MIBSPI_INT_PARERR | MIBSPI_INT_DESYNC | \
+ MIBSPI_INT_BITERR | MIBSPI_INT_RXOVRN)
+
+#define MIBSPI_INT0_DMAREQEN (1 << 16) /* Bit 16: DMA requests (INT0 only) */
+#define MIBSPI_INT0_ENABLEHIGHZ (1 << 24) /* Bit 24: ENA high-Z (INT0 only) */
+
+#define MIBSPI_FLG_BUFINITACTIVE (1 << 24) /* Bit 24: RAM init running (FLG only) */
+
+/* Pin Control Registers 0-8. All nine share this layout; PC9 uses the
+ * CLK, SIMO0 and SOMI0 positions only. Bits 16 and 24 mirror SIMO0 and
+ * SOMI0, so on a 1-bit data path only bits 10 and 11 need to be written.
+ */
+
+#define MIBSPI_PC_SCS_SHIFT (0) /* Bits 0-7: Chip selects */
+#define MIBSPI_PC_SCS_MASK (0xff << MIBSPI_PC_SCS_SHIFT)
+# define MIBSPI_PC_SCS(n) (1 << (n))
+#define MIBSPI_PC_ENA (1 << 8) /* Bit 8: SPIENA */
+#define MIBSPI_PC_CLK (1 << 9) /* Bit 9: SPICLK */
+#define MIBSPI_PC_SIMO0 (1 << 10) /* Bit 10: SPISIMO[0] */
+#define MIBSPI_PC_SOMI0 (1 << 11) /* Bit 11: SPISOMI[0] */
+#define MIBSPI_PC_SIMO_SHIFT (16) /* Bits 16-23: SPISIMO[7:0] */
+#define MIBSPI_PC_SIMO_MASK (0xff << MIBSPI_PC_SIMO_SHIFT)
+# define MIBSPI_PC_SIMO(n) (1 << (MIBSPI_PC_SIMO_SHIFT + (n)))
+#define MIBSPI_PC_SOMI_SHIFT (24) /* Bits 24-31: SPISOMI[7:0] */
+#define MIBSPI_PC_SOMI_MASK (0xff << MIBSPI_PC_SOMI_SHIFT)
+# define MIBSPI_PC_SOMI(n) (1 << (MIBSPI_PC_SOMI_SHIFT + (n)))
+
+/* Transmit Data Register 0 */
+
+#define MIBSPI_DAT0_TXDATA_MASK (0xffff)
+
+/* Transmit Data Register 1, and each word of the transmit RAM. BUFMODE
+ * and LOCK exist only in the RAM words.
+ */
+
+#define MIBSPI_DAT1_TXDATA_SHIFT (0) /* Bits 0-15: Transmit data */
+#define MIBSPI_DAT1_TXDATA_MASK (0xffff << MIBSPI_DAT1_TXDATA_SHIFT)
+#define MIBSPI_DAT1_CSNR_SHIFT (16) /* Bits 16-23: Chip select mask */
+#define MIBSPI_DAT1_CSNR_MASK (0xff << MIBSPI_DAT1_CSNR_SHIFT)
+# define MIBSPI_DAT1_CSNR(n) ((uint32_t)(n) << MIBSPI_DAT1_CSNR_SHIFT)
+#define MIBSPI_DAT1_DFSEL_SHIFT (24) /* Bits 24-25: Data format */
+#define MIBSPI_DAT1_DFSEL_MASK (3 << MIBSPI_DAT1_DFSEL_SHIFT)
+# define MIBSPI_DAT1_DFSEL(n) ((uint32_t)(n) << MIBSPI_DAT1_DFSEL_SHIFT)
+#define MIBSPI_DAT1_WDEL (1 << 26) /* Bit 26: Insert WDELAY */
+#define MIBSPI_DAT1_CSHOLD (1 << 28) /* Bit 28: Hold chip select */
+
+#define MIBSPI_TXRAM_LOCK (1 << 27) /* Bit 27: Lock next buffer */
+#define MIBSPI_TXRAM_BUFMODE_SHIFT (29) /* Bits 29-31: Buffer mode */
+#define MIBSPI_TXRAM_BUFMODE_MASK (7 << MIBSPI_TXRAM_BUFMODE_SHIFT)
+# define MIBSPI_TXRAM_BUFMODE_DISABLED (0 << MIBSPI_TXRAM_BUFMODE_SHIFT)
+# define MIBSPI_TXRAM_BUFMODE_SKIP_TX (1 << MIBSPI_TXRAM_BUFMODE_SHIFT) /* Skip until TXFULL */
+# define MIBSPI_TXRAM_BUFMODE_SKIP_RX (2 << MIBSPI_TXRAM_BUFMODE_SHIFT) /* Skip until RXEMPTY */
+# define MIBSPI_TXRAM_BUFMODE_SKIP_TXRX (3 << MIBSPI_TXRAM_BUFMODE_SHIFT) /* Skip until both */
+# define MIBSPI_TXRAM_BUFMODE_CONTINUOUS (4 << MIBSPI_TXRAM_BUFMODE_SHIFT)
+# define MIBSPI_TXRAM_BUFMODE_WAIT_TX (5 << MIBSPI_TXRAM_BUFMODE_SHIFT) /* Suspend until TXFULL */
+# define MIBSPI_TXRAM_BUFMODE_WAIT_RX (6 << MIBSPI_TXRAM_BUFMODE_SHIFT) /* Suspend until RXEMPTY */
+# define MIBSPI_TXRAM_BUFMODE_WAIT_TXRX (7 << MIBSPI_TXRAM_BUFMODE_SHIFT) /* Suspend until both */
+
+/* Receive Buffer Register, Emulation Register and each word of the receive
+ * RAM.
+ */
+
+#define MIBSPI_BUF_RXDATA_SHIFT (0) /* Bits 0-15: Receive data */
+#define MIBSPI_BUF_RXDATA_MASK (0xffff << MIBSPI_BUF_RXDATA_SHIFT)
+#define MIBSPI_BUF_LCSNR_SHIFT (16) /* Bits 16-23: Last chip select */
+#define MIBSPI_BUF_LCSNR_MASK (0xff << MIBSPI_BUF_LCSNR_SHIFT)
+#define MIBSPI_BUF_DLENERR (1 << 24) /* Bit 24: Data length error */
+#define MIBSPI_BUF_TIMEOUT (1 << 25) /* Bit 25: ENA time-out */
+#define MIBSPI_BUF_PARITYERR (1 << 26) /* Bit 26: Parity error */
+#define MIBSPI_BUF_DESYNC (1 << 27) /* Bit 27: Slave desynchronized */
+#define MIBSPI_BUF_BITERR (1 << 28) /* Bit 28: Bit error */
+#define MIBSPI_BUF_TXFULL (1 << 29) /* Bit 29: Transmit buffer full */
+#define MIBSPI_BUF_RXOVR (1 << 30) /* Bit 30: Receive overrun */
+#define MIBSPI_BUF_RXEMPTY (1 << 31) /* Bit 31: Nothing received */
+
+#define MIBSPI_BUF_ALLERRORS (MIBSPI_BUF_DLENERR | MIBSPI_BUF_TIMEOUT | \
+ MIBSPI_BUF_PARITYERR | MIBSPI_BUF_DESYNC | \
+ MIBSPI_BUF_BITERR | MIBSPI_BUF_RXOVR)
+
+/* Delay Register. The first two count VCLK cycles, the last two SPICLK
+ * cycles.
+ */
+
+#define MIBSPI_DELAY_C2EDELAY_SHIFT (0) /* Bits 0-7: CS active to ENA time-out */
+#define MIBSPI_DELAY_C2EDELAY_MASK (0xff << MIBSPI_DELAY_C2EDELAY_SHIFT)
+# define MIBSPI_DELAY_C2EDELAY(n) ((uint32_t)(n) << MIBSPI_DELAY_C2EDELAY_SHIFT)
+#define MIBSPI_DELAY_T2EDELAY_SHIFT (8) /* Bits 8-15: Transmit end to ENA time-out */
+#define MIBSPI_DELAY_T2EDELAY_MASK (0xff << MIBSPI_DELAY_T2EDELAY_SHIFT)
+# define MIBSPI_DELAY_T2EDELAY(n) ((uint32_t)(n) << MIBSPI_DELAY_T2EDELAY_SHIFT)
+#define MIBSPI_DELAY_T2CDELAY_SHIFT (16) /* Bits 16-23: Transmit end to CS inactive */
+#define MIBSPI_DELAY_T2CDELAY_MASK (0xff << MIBSPI_DELAY_T2CDELAY_SHIFT)
+# define MIBSPI_DELAY_T2CDELAY(n) ((uint32_t)(n) << MIBSPI_DELAY_T2CDELAY_SHIFT)
+#define MIBSPI_DELAY_C2TDELAY_SHIFT (24) /* Bits 24-31: CS active to transmit start */
+#define MIBSPI_DELAY_C2TDELAY_MASK (0xff << MIBSPI_DELAY_C2TDELAY_SHIFT)
+# define MIBSPI_DELAY_C2TDELAY(n) ((uint32_t)(n) << MIBSPI_DELAY_C2TDELAY_SHIFT)
+
+/* Default Chip Select Register */
+
+#define MIBSPI_DEF_CSDEF_MASK (0xff)
+
+/* Data Format Registers 0-3.
+ *
+ * PHASE is the inverse of the usual CPHA: with PHASE = 0 data changes on
+ * the first clock edge and is sampled on the second, which is CPHA = 1
+ * (SPNU562A Table 27-3). POLARITY matches CPOL.
+ */
+
+#define MIBSPI_FMT_CHARLEN_SHIFT (0) /* Bits 0-4: Word length, 2-16 */
+#define MIBSPI_FMT_CHARLEN_MASK (0x1f << MIBSPI_FMT_CHARLEN_SHIFT)
+# define MIBSPI_FMT_CHARLEN(n) ((uint32_t)(n) << MIBSPI_FMT_CHARLEN_SHIFT)
+#define MIBSPI_FMT_PRESCALE_SHIFT (8) /* Bits 8-15: SPICLK = VCLK / (n + 1) */
+#define MIBSPI_FMT_PRESCALE_MASK (0xff << MIBSPI_FMT_PRESCALE_SHIFT)
+# define MIBSPI_FMT_PRESCALE(n) ((uint32_t)(n) << MIBSPI_FMT_PRESCALE_SHIFT)
+#define MIBSPI_FMT_PHASE (1 << 16) /* Bit 16: Clock delayed half a cycle */
+#define MIBSPI_FMT_POLARITY (1 << 17) /* Bit 17: Clock idles high */
+#define MIBSPI_FMT_DISCSTIMERS (1 << 18) /* Bit 18: No C2TDELAY/T2CDELAY */
+#define MIBSPI_FMT_HDUPLEXENA (1 << 19) /* Bit 19: Half duplex on SIMO */
+#define MIBSPI_FMT_SHIFTDIR (1 << 20) /* Bit 20: LSB first */
+#define MIBSPI_FMT_WAITENA (1 << 21) /* Bit 21: Master waits for ENA */
+#define MIBSPI_FMT_PARITYENA (1 << 22) /* Bit 22: Parity bit appended */
+#define MIBSPI_FMT_PARPOL (1 << 23) /* Bit 23: Odd parity */
+#define MIBSPI_FMT_WDELAY_SHIFT (24) /* Bits 24-31: Delay between words */
+#define MIBSPI_FMT_WDELAY_MASK (0xff << MIBSPI_FMT_WDELAY_SHIFT)
+# define MIBSPI_FMT_WDELAY(n) ((uint32_t)(n) << MIBSPI_FMT_WDELAY_SHIFT)
+
+#define MIBSPI_FMT_CHARLEN_MIN 2
+#define MIBSPI_FMT_CHARLEN_MAX 16
+
+/* Interrupt Vector 0 and 1 */
+
+#define MIBSPI_INTVECT_SUSPEND (1 << 0) /* Bit 0: TG suspended, not finished */
+#define MIBSPI_INTVECT_SHIFT (1) /* Bits 1-5: Pending source */
+#define MIBSPI_INTVECT_MASK (0x1f << MIBSPI_INTVECT_SHIFT)
+# define MIBSPI_INTVECT_NONE (0x00 << MIBSPI_INTVECT_SHIFT)
+# define MIBSPI_INTVECT_TG(n) (((uint32_t)(n) + 1) << MIBSPI_INTVECT_SHIFT)
+# define MIBSPI_INTVECT_ERROR (0x11 << MIBSPI_INTVECT_SHIFT)
+# define MIBSPI_INTVECT_RX (0x12 << MIBSPI_INTVECT_SHIFT) /* Compatibility mode */
+# define MIBSPI_INTVECT_RXOVRN (0x13 << MIBSPI_INTVECT_SHIFT)
+# define MIBSPI_INTVECT_TX (0x14 << MIBSPI_INTVECT_SHIFT) /* Compatibility mode */
+
+/* Parallel/Modulo Mode Control Register: one byte per data format. Modulo
+ * mode is not implemented on this device.
+ */
+
+#define MIBSPI_PMCTRL_PMODE_SHIFT(n) ((n) << 3) /* Bits 0-1 of byte n */
+#define MIBSPI_PMCTRL_PMODE_MASK(n) (3 << MIBSPI_PMCTRL_PMODE_SHIFT(n))
+# define MIBSPI_PMCTRL_PMODE_1LINE(n) (0 << MIBSPI_PMCTRL_PMODE_SHIFT(n))
+# define MIBSPI_PMCTRL_PMODE_2LINE(n) (1 << MIBSPI_PMCTRL_PMODE_SHIFT(n))
+# define MIBSPI_PMCTRL_PMODE_4LINE(n) (2 << MIBSPI_PMCTRL_PMODE_SHIFT(n))
+# define MIBSPI_PMCTRL_PMODE_8LINE(n) (3 << MIBSPI_PMCTRL_PMODE_SHIFT(n))
+
+/* Multi-buffer Mode Enable Register */
+
+#define MIBSPI_MIBSPIE_MSPIENA (1 << 0) /* Bit 0: Multi-buffer mode */
+#define MIBSPI_MIBSPIE_EXTBUF_SHIFT (8) /* Bits 8-11: Extended buffer key */
+#define MIBSPI_MIBSPIE_EXTBUF_MASK (0xf << MIBSPI_MIBSPIE_EXTBUF_SHIFT)
+# define MIBSPI_MIBSPIE_EXTBUF_DISABLE (0x5 << MIBSPI_MIBSPIE_EXTBUF_SHIFT) /* 128 buffers */
+# define MIBSPI_MIBSPIE_EXTBUF_ENABLE (0xa << MIBSPI_MIBSPIE_EXTBUF_SHIFT) /* 256 buffers */
+#define MIBSPI_MIBSPIE_RXRAMACCESS (1 << 16)
+
+/* TG Interrupt Enable Set/Clear, Level Set/Clear and Flag Registers: the
+ * "suspended" bits for TG0-15 in the low half, the "finished" bits in the
+ * high half.
+ */
+
+#define MIBSPI_TGINT_SUS(n) (1 << (n))
+#define MIBSPI_TGINT_RDY(n) (1 << (16 + (n)))
+
+/* Tick Count Register */
+
+#define MIBSPI_TICKCNT_TICKVALUE_SHIFT (0) /* Bits 0-15: Reload value */
+#define MIBSPI_TICKCNT_TICKVALUE_MASK (0xffff << MIBSPI_TICKCNT_TICKVALUE_SHIFT)
+#define MIBSPI_TICKCNT_CLKCTRL_SHIFT (28) /* Bits 28-29: SPICLK of format n */
+#define MIBSPI_TICKCNT_CLKCTRL_MASK (3 << MIBSPI_TICKCNT_CLKCTRL_SHIFT)
+# define MIBSPI_TICKCNT_CLKCTRL(n) ((uint32_t)(n) << MIBSPI_TICKCNT_CLKCTRL_SHIFT)
+#define MIBSPI_TICKCNT_RELOAD (1 << 30) /* Bit 30: Reload now */
+#define MIBSPI_TICKCNT_TICKENA (1 << 31) /* Bit 31: Counter enabled */
+
+/* Last TG End Pointer */
+
+#define MIBSPI_LTGPEND_LPEND_SHIFT (8) /* Bits 8-15: Last buffer of last TG */
+#define MIBSPI_LTGPEND_LPEND_MASK (0xff << MIBSPI_LTGPEND_LPEND_SHIFT)
+# define MIBSPI_LTGPEND_LPEND(n) ((uint32_t)(n) << MIBSPI_LTGPEND_LPEND_SHIFT)
+#define MIBSPI_LTGPEND_TGINSERVICE_SHIFT (24) /* Bits 24-28: TG in service + 1 */
+#define MIBSPI_LTGPEND_TGINSERVICE_MASK (0x1f << MIBSPI_LTGPEND_TGINSERVICE_SHIFT)
+
+/* TG Control Registers */
+
+#define MIBSPI_TGCTRL_PCURRENT_SHIFT (0) /* Bits 0-7: Current buffer */
+#define MIBSPI_TGCTRL_PCURRENT_MASK (0xff << MIBSPI_TGCTRL_PCURRENT_SHIFT)
+#define MIBSPI_TGCTRL_PSTART_SHIFT (8) /* Bits 8-15: First buffer */
+#define MIBSPI_TGCTRL_PSTART_MASK (0xff << MIBSPI_TGCTRL_PSTART_SHIFT)
+# define MIBSPI_TGCTRL_PSTART(n) ((uint32_t)(n) << MIBSPI_TGCTRL_PSTART_SHIFT)
+#define MIBSPI_TGCTRL_TRIGSRC_SHIFT (16) /* Bits 16-19: Trigger source */
+#define MIBSPI_TGCTRL_TRIGSRC_MASK (0xf << MIBSPI_TGCTRL_TRIGSRC_SHIFT)
+# define MIBSPI_TGCTRL_TRIGSRC_NONE (0x0 << MIBSPI_TGCTRL_TRIGSRC_SHIFT)
+# define MIBSPI_TGCTRL_TRIGSRC_EXT(n) (((uint32_t)(n) + 1) << MIBSPI_TGCTRL_TRIGSRC_SHIFT)
+# define MIBSPI_TGCTRL_TRIGSRC_TICK (0xf << MIBSPI_TGCTRL_TRIGSRC_SHIFT)
+#define MIBSPI_TGCTRL_TRIGEVT_SHIFT (20) /* Bits 20-23: Trigger event */
+#define MIBSPI_TGCTRL_TRIGEVT_MASK (0xf << MIBSPI_TGCTRL_TRIGEVT_SHIFT)
+# define MIBSPI_TGCTRL_TRIGEVT_NEVER (0 << MIBSPI_TGCTRL_TRIGEVT_SHIFT)
+# define MIBSPI_TGCTRL_TRIGEVT_RISING (1 << MIBSPI_TGCTRL_TRIGEVT_SHIFT)
+# define MIBSPI_TGCTRL_TRIGEVT_FALLING (2 << MIBSPI_TGCTRL_TRIGEVT_SHIFT)
+# define MIBSPI_TGCTRL_TRIGEVT_BOTH (3 << MIBSPI_TGCTRL_TRIGEVT_SHIFT)
+# define MIBSPI_TGCTRL_TRIGEVT_HIGH (5 << MIBSPI_TGCTRL_TRIGEVT_SHIFT)
+# define MIBSPI_TGCTRL_TRIGEVT_LOW (6 << MIBSPI_TGCTRL_TRIGEVT_SHIFT)
+# define MIBSPI_TGCTRL_TRIGEVT_ALWAYS (7 << MIBSPI_TGCTRL_TRIGEVT_SHIFT)
+#define MIBSPI_TGCTRL_TGTD (1 << 28) /* Bit 28: Triggered, pending or in service */
+#define MIBSPI_TGCTRL_PRST (1 << 29) /* Bit 29: Retrigger restarts the TG */
+#define MIBSPI_TGCTRL_ONESHOT (1 << 30) /* Bit 30: Disable after one pass */
+#define MIBSPI_TGCTRL_TGENA (1 << 31) /* Bit 31: TG enabled */
+
+/* DMA Channel Control Registers */
+
+#define MIBSPI_DMACTRL_COUNT_SHIFT (0) /* Bits 0-5: Remaining transfers */
+#define MIBSPI_DMACTRL_COUNT_MASK (0x3f << MIBSPI_DMACTRL_COUNT_SHIFT)
+#define MIBSPI_DMACTRL_COUNTBIT17 (1 << 6) /* Bit 6: Bit 16 of DMAxCOUNT.COUNT */
+#define MIBSPI_DMACTRL_ICOUNT_SHIFT (8) /* Bits 8-12: Transfers - 1 */
+#define MIBSPI_DMACTRL_ICOUNT_MASK (0x1f << MIBSPI_DMACTRL_ICOUNT_SHIFT)
+# define MIBSPI_DMACTRL_ICOUNT(n) ((uint32_t)(n) << MIBSPI_DMACTRL_ICOUNT_SHIFT)
+#define MIBSPI_DMACTRL_NOBRK (1 << 13) /* Bit 13: Do not interleave other buffers */
+#define MIBSPI_DMACTRL_TXDMAENA (1 << 14) /* Bit 14: Transmit requests */
+#define MIBSPI_DMACTRL_RXDMAENA (1 << 15) /* Bit 15: Receive requests */
+#define MIBSPI_DMACTRL_TXDMAMAP_SHIFT (16) /* Bits 16-19: Module request line, TX */
+#define MIBSPI_DMACTRL_TXDMAMAP_MASK (0xf << MIBSPI_DMACTRL_TXDMAMAP_SHIFT)
+# define MIBSPI_DMACTRL_TXDMAMAP(n) ((uint32_t)(n) << MIBSPI_DMACTRL_TXDMAMAP_SHIFT)
+#define MIBSPI_DMACTRL_RXDMAMAP_SHIFT (20) /* Bits 20-23: Module request line, RX */
+#define MIBSPI_DMACTRL_RXDMAMAP_MASK (0xf << MIBSPI_DMACTRL_RXDMAMAP_SHIFT)
+# define MIBSPI_DMACTRL_RXDMAMAP(n) ((uint32_t)(n) << MIBSPI_DMACTRL_RXDMAMAP_SHIFT)
+#define MIBSPI_DMACTRL_BUFID_SHIFT (24) /* Bits 24-30: Buffer served */
+#define MIBSPI_DMACTRL_BUFID_MASK (0x7f << MIBSPI_DMACTRL_BUFID_SHIFT)
+# define MIBSPI_DMACTRL_BUFID(n) ((uint32_t)(n) << MIBSPI_DMACTRL_BUFID_SHIFT)
+#define MIBSPI_DMACTRL_ONESHOT (1 << 31) /* Bit 31: Disable after ICOUNT+1 */
+
+/* DMAxCOUNT Registers. Used in place of the DMAxCTRL counters once
+ * DMACNTLEN.LARGECOUNT is set.
+ */
+
+#define MIBSPI_DMACOUNT_COUNT_SHIFT (0) /* Bits 0-15: Remaining transfers */
+#define MIBSPI_DMACOUNT_COUNT_MASK (0xffff << MIBSPI_DMACOUNT_COUNT_SHIFT)
+#define MIBSPI_DMACOUNT_ICOUNT_SHIFT (16) /* Bits 16-31: Transfers - 1 */
+#define MIBSPI_DMACOUNT_ICOUNT_MASK (0xffff << MIBSPI_DMACOUNT_ICOUNT_SHIFT)
+# define MIBSPI_DMACOUNT_ICOUNT(n) ((uint32_t)(n) << MIBSPI_DMACOUNT_ICOUNT_SHIFT)
+
+/* DMA Large Count Register */
+
+#define MIBSPI_DMACNTLEN_LARGECOUNT (1 << 0) /* Bit 0: Use DMAxCOUNT */
+
+/* Parity/ECC Control Register.
+ *
+ * EDEN is a key field whose only "off" value is 5h, which is also its
+ * reset value: any other pattern - 0h included - turns detection on.
+ * HALCoGen writes 5h under a comment that says "enable".
+ */
+
+#define MIBSPI_PARECCCTRL_EDEN_SHIFT (0) /* Bits 0-3: Error detection key */
+#define MIBSPI_PARECCCTRL_EDEN_MASK (0xf << MIBSPI_PARECCCTRL_EDEN_SHIFT)
+# define MIBSPI_PARECCCTRL_EDEN_DISABLE (0x5 << MIBSPI_PARECCCTRL_EDEN_SHIFT)
+# define MIBSPI_PARECCCTRL_EDEN_ENABLE (0xa << MIBSPI_PARECCCTRL_EDEN_SHIFT)
+#define MIBSPI_PARECCCTRL_PTESTEN (1 << 8) /* Bit 8: Parity/ECC bits memory mapped */
+#define MIBSPI_PARECCCTRL_EDACMODE_SHIFT (16) /* Bits 16-19: Single-bit correction key */
+#define MIBSPI_PARECCCTRL_EDACMODE_MASK (0xf << MIBSPI_PARECCCTRL_EDACMODE_SHIFT)
+# define MIBSPI_PARECCCTRL_EDACMODE_DISABLE (0x5 << MIBSPI_PARECCCTRL_EDACMODE_SHIFT)
+# define MIBSPI_PARECCCTRL_EDACMODE_ENABLE (0xa << MIBSPI_PARECCCTRL_EDACMODE_SHIFT)
+#define MIBSPI_PARECCCTRL_SBEEVTEN_SHIFT (24) /* Bits 24-27: Single-bit event key */
+#define MIBSPI_PARECCCTRL_SBEEVTEN_MASK (0xf << MIBSPI_PARECCCTRL_SBEEVTEN_SHIFT)
+# define MIBSPI_PARECCCTRL_SBEEVTEN_DISABLE (0x5 << MIBSPI_PARECCCTRL_SBEEVTEN_SHIFT)
+# define MIBSPI_PARECCCTRL_SBEEVTEN_ENABLE (0xa << MIBSPI_PARECCCTRL_SBEEVTEN_SHIFT)
+
+/* Parity/ECC Status Register */
+
+#define MIBSPI_PARECCSTAT_UERRFLG0 (1 << 0) /* Bit 0: Uncorrectable error, TXRAM */
+#define MIBSPI_PARECCSTAT_UERRFLG1 (1 << 1) /* Bit 1: Uncorrectable error, RXRAM */
+#define MIBSPI_PARECCSTAT_SBEFLG0 (1 << 8) /* Bit 8: Single-bit error, TXRAM */
+#define MIBSPI_PARECCSTAT_SBEFLG1 (1 << 9) /* Bit 9: Single-bit error, RXRAM */
+
+/* Error address registers (UERRADDR0/1, SBERRADDR0/1) */
+
+#define MIBSPI_ERRADDR_MASK (0x7ff)
+
+/* RXRAM Overrun Buffer Address Register */
+
+#define MIBSPI_RXOVRNADDR_MASK (0x3ff)
+
+/* I/O Loopback Test Control Register */
+
+#define MIBSPI_IOLPBKTSTCR_RXPENA (1 << 0) /* Bit 0: Analog loopback via receive pin */
+#define MIBSPI_IOLPBKTSTCR_LPBKTYPE (1 << 1) /* Bit 1: Analog rather than digital */
+#define MIBSPI_IOLPBKTSTCR_CTRLSCSPINERR (1 << 2) /* Bit 2: Inject chip select error */
+#define MIBSPI_IOLPBKTSTCR_ERRSCSPIN_SHIFT (3) /* Bits 3-5: Chip select to corrupt */
+#define MIBSPI_IOLPBKTSTCR_ERRSCSPIN_MASK (7 << MIBSPI_IOLPBKTSTCR_ERRSCSPIN_SHIFT)
+#define MIBSPI_IOLPBKTSTCR_ENA_SHIFT (8) /* Bits 8-11: Loopback key */
+#define MIBSPI_IOLPBKTSTCR_ENA_MASK (0xf << MIBSPI_IOLPBKTSTCR_ENA_SHIFT)
+# define MIBSPI_IOLPBKTSTCR_ENA_DISABLE (0x5 << MIBSPI_IOLPBKTSTCR_ENA_SHIFT)
+# define MIBSPI_IOLPBKTSTCR_ENA_ENABLE (0xa << MIBSPI_IOLPBKTSTCR_ENA_SHIFT)
+#define MIBSPI_IOLPBKTSTCR_CTRLDLENERR (1 << 16) /* Bit 16: Inject data length error */
+#define MIBSPI_IOLPBKTSTCR_CTRLTIMEOUT (1 << 17) /* Bit 17: Inject ENA time-out */
+#define MIBSPI_IOLPBKTSTCR_CTRLPARERR (1 << 18) /* Bit 18: Inject parity error */
+#define MIBSPI_IOLPBKTSTCR_CTRLDESYNC (1 << 19) /* Bit 19: Inject desync error */
+#define MIBSPI_IOLPBKTSTCR_CTRLBITERR (1 << 20) /* Bit 20: Inject bit error */
+#define MIBSPI_IOLPBKTSTCR_SCSFAILFLG (1 << 24) /* Bit 24: Chip select miscompare */
+
+/* Extended Prescale Registers 1 and 2. The low 8 bits of each field alias
+ * the PRESCALE field of the matching SPIFMTn, and writing that field clears
+ * the upper three bits here - so this has to be written after SPIFMTn.
+ */
+
+#define MIBSPI_EXTPRESCALE_LO_SHIFT (0) /* Bits 0-10: FMT0 (reg 1), FMT2 (reg 2) */
+#define MIBSPI_EXTPRESCALE_LO_MASK (0x7ff << MIBSPI_EXTPRESCALE_LO_SHIFT)
+# define MIBSPI_EXTPRESCALE_LO(n) ((uint32_t)(n) << MIBSPI_EXTPRESCALE_LO_SHIFT)
+#define MIBSPI_EXTPRESCALE_HI_SHIFT (16) /* Bits 16-26: FMT1 (reg 1), FMT3 (reg 2) */
+#define MIBSPI_EXTPRESCALE_HI_MASK (0x7ff << MIBSPI_EXTPRESCALE_HI_SHIFT)
+# define MIBSPI_EXTPRESCALE_HI(n) ((uint32_t)(n) << MIBSPI_EXTPRESCALE_HI_SHIFT)
+
+#define MIBSPI_PRESCALE_MAX 0xff /* SPIFMTn alone */
+#define MIBSPI_EXTPRESCALE_MAX 0x7ff /* With the extended register */
+
+/* ECC Diagnostic Control and Status Registers */
+
+#define MIBSPI_ECCDIAGCTRL_EN_MASK (0xf)
+# define MIBSPI_ECCDIAGCTRL_EN_ENABLE (0x5) /* Note: 5h enables here */
+# define MIBSPI_ECCDIAGCTRL_EN_DISABLE (0xa)
+
+#define MIBSPI_ECCDIAGSTAT_SEFLG0 (1 << 0) /* Bit 0: Single-bit error, TXRAM */
+#define MIBSPI_ECCDIAGSTAT_SEFLG1 (1 << 1) /* Bit 1: Single-bit error, RXRAM */
+#define MIBSPI_ECCDIAGSTAT_DEFLG0 (1 << 16) /* Bit 16: Double-bit error, TXRAM */
+#define MIBSPI_ECCDIAGSTAT_DEFLG1 (1 << 17) /* Bit 17: Double-bit error, RXRAM */
+
+#endif /* __ARCH_ARM_SRC_RM57_HARDWARE_RM57_MIBSPI_H */
\ No newline at end of file
diff --git a/arch/arm/src/rm57/hardware/rm57_pbist.h b/arch/arm/src/rm57/hardware/rm57_pbist.h
new file mode 100644
index 00000000000..579f1df64ad
--- /dev/null
+++ b/arch/arm/src/rm57/hardware/rm57_pbist.h
@@ -0,0 +1,194 @@
+/****************************************************************************
+ * arch/arm/src/rm57/hardware/rm57_pbist.h
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/* Programmable Built-In Self-Test (PBIST) controller, SPNU562A chapter 9.
+ *
+ * The register frame is only clocked - and so only accessible - once
+ * PBIST_PACT has been written, and that in turn needs the controller
+ * enabled through MSINENA/MSTGCR in the system module.
+ *
+ * Offsets follow TRM Table 9-1, expressed from the 0xffffe400 controller
+ * base; HALCoGen's HL_reg_pbist.h maps the same registers from 0xffffe560.
+ * RAM group numbers and the two algorithm masks are TRM Tables 2-5/2-6.
+ */
+
+#ifndef __ARCH_ARM_SRC_RM57_HARDWARE_RM57_PBIST_H
+#define __ARCH_ARM_SRC_RM57_HARDWARE_RM57_PBIST_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include "hardware/rm57l843_memorymap.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* Register Offsets *********************************************************/
+
+#define RM57_PBIST_RAMT_OFFSET 0x0160 /* RAM Configuration Register */
+#define RM57_PBIST_DLR_OFFSET 0x0164 /* Datalogger Register */
+
+/* Activate/Clock Enable Register */
+#define RM57_PBIST_PACT_OFFSET 0x0180
+#define RM57_PBIST_ID_OFFSET 0x0184 /* PBIST ID Register */
+#define RM57_PBIST_OVER_OFFSET 0x0188 /* Override Register */
+#define RM57_PBIST_FSRF0_OFFSET 0x0190 /* Fail Status Fail Register 0 */
+#define RM57_PBIST_FSRF1_OFFSET 0x0194 /* Fail Status Fail Register 1 */
+#define RM57_PBIST_FSRC0_OFFSET 0x0198 /* Fail Status Count Register 0 */
+#define RM57_PBIST_FSRC1_OFFSET 0x019c /* Fail Status Count Register 1 */
+
+/* Fail Status Address Register 0 */
+#define RM57_PBIST_FSRA0_OFFSET 0x01a0
+
+/* Fail Status Address Register 1 */
+#define RM57_PBIST_FSRA1_OFFSET 0x01a4
+#define RM57_PBIST_FSRDL0_OFFSET 0x01a8 /* Fail Status Data Register 0 */
+#define RM57_PBIST_FSRDL1_OFFSET 0x01b0 /* Fail Status Data Register 1 */
+#define RM57_PBIST_ROM_OFFSET 0x01c0 /* ROM Mask Register */
+#define RM57_PBIST_ALGO_OFFSET 0x01c4 /* ROM Algorithm Mask Register */
+#define RM57_PBIST_RINFOL_OFFSET 0x01c8 /* RAM Info Mask Lower Register */
+#define RM57_PBIST_RINFOU_OFFSET 0x01cc /* RAM Info Mask Upper Register */
+
+/* Register Addresses *******************************************************/
+
+#define RM57_PBIST_RAMT (RM57_PBIST_BASE + RM57_PBIST_RAMT_OFFSET)
+#define RM57_PBIST_DLR (RM57_PBIST_BASE + RM57_PBIST_DLR_OFFSET)
+#define RM57_PBIST_PACT (RM57_PBIST_BASE + RM57_PBIST_PACT_OFFSET)
+#define RM57_PBIST_ID (RM57_PBIST_BASE + RM57_PBIST_ID_OFFSET)
+#define RM57_PBIST_OVER (RM57_PBIST_BASE + RM57_PBIST_OVER_OFFSET)
+#define RM57_PBIST_FSRF0 (RM57_PBIST_BASE + RM57_PBIST_FSRF0_OFFSET)
+#define RM57_PBIST_FSRF1 (RM57_PBIST_BASE + RM57_PBIST_FSRF1_OFFSET)
+#define RM57_PBIST_FSRC0 (RM57_PBIST_BASE + RM57_PBIST_FSRC0_OFFSET)
+#define RM57_PBIST_FSRC1 (RM57_PBIST_BASE + RM57_PBIST_FSRC1_OFFSET)
+#define RM57_PBIST_FSRA0 (RM57_PBIST_BASE + RM57_PBIST_FSRA0_OFFSET)
+#define RM57_PBIST_FSRA1 (RM57_PBIST_BASE + RM57_PBIST_FSRA1_OFFSET)
+#define RM57_PBIST_FSRDL0 (RM57_PBIST_BASE + RM57_PBIST_FSRDL0_OFFSET)
+#define RM57_PBIST_FSRDL1 (RM57_PBIST_BASE + RM57_PBIST_FSRDL1_OFFSET)
+#define RM57_PBIST_ROM (RM57_PBIST_BASE + RM57_PBIST_ROM_OFFSET)
+#define RM57_PBIST_ALGO (RM57_PBIST_BASE + RM57_PBIST_ALGO_OFFSET)
+#define RM57_PBIST_RINFOL (RM57_PBIST_BASE + RM57_PBIST_RINFOL_OFFSET)
+#define RM57_PBIST_RINFOU (RM57_PBIST_BASE + RM57_PBIST_RINFOU_OFFSET)
+
+/* Register Bit-Field Definitions *******************************************/
+
+/* RAM Configuration Register (identifies the memory that failed) */
+
+/* Bits 16-23: Return data select */
+#define PBIST_RAMT_RDS_SHIFT (16)
+#define PBIST_RAMT_RDS_MASK (0xff << PBIST_RAMT_RDS_SHIFT)
+
+/* Bits 24-31: RAM group select */
+#define PBIST_RAMT_RGS_SHIFT (24)
+#define PBIST_RAMT_RGS_MASK (0xff << PBIST_RAMT_RGS_SHIFT)
+
+/* Datalogger Register. Bit 3 is reserved and resets to 1; TI's own code
+ * starts a ROM-based run by writing just DLR2|DLR4 (0x14).
+ */
+
+#define PBIST_DLR_DLR2 (1 << 2) /* Bit 2: ROM-based testing */
+#define PBIST_DLR_DLR4 (1 << 4) /* Bit 4: Config access (CPU) */
+#define PBIST_DLR_START (PBIST_DLR_DLR2 | PBIST_DLR_DLR4)
+
+/* Activate/Clock Enable Register. The TRM documents only bit 0, but both
+ * HALCoGen and the SafeTI library write 3; bit 1 gates the ROM clock.
+ */
+
+#define PBIST_PACT_PACT0 (1 << 0) /* Bit 0: Internal clocks */
+#define PBIST_PACT_PACT1 (1 << 1) /* Bit 1: ROM clock */
+#define PBIST_PACT_ENABLE (PBIST_PACT_PACT0 | PBIST_PACT_PACT1)
+
+/* Override Register */
+
+/* Bit 0: ROM overrides RINFOx */
+#define PBIST_OVER_OVER0 (1 << 0)
+
+/* Fail Status Fail Registers 0/1 */
+
+/* Bit 0: Failure on this port */
+#define PBIST_FSRF (1 << 0)
+
+/* ROM Mask Register */
+
+#define PBIST_ROM_MASK (3 << 0)
+# define PBIST_ROM_NONE (0 << 0)
+# define PBIST_ROM_RINFO (1 << 0) /* RAM group info from ROM */
+# define PBIST_ROM_ALGO (2 << 0) /* Algorithm info from ROM */
+# define PBIST_ROM_BOTH (3 << 0) /* Both, for application test */
+
+/* ROM Algorithm Mask Register (TRM Table 2-6) */
+
+#define PBIST_ALGO_TRIPLE_SLOW (1 << 0) /* triple_read_slow_read, ROM */
+#define PBIST_ALGO_TRIPLE_FAST (1 << 1) /* triple_read_fast_read, ROM */
+#define PBIST_ALGO_MARCH13N_DP (1 << 2) /* March13N, two-port RAM */
+#define PBIST_ALGO_MARCH13N_SP (1 << 3) /* March13N, single-port RAM */
+
+/* RAM groups (TRM Table 2-5). Group n is bit (n - 1) of the 64-bit
+ * RINFOU:RINFOL pair.
+ */
+
+#define PBIST_GROUP(n) (1ull << ((n) - 1))
+
+#define PBIST_GROUP_PBIST_ROM PBIST_GROUP(1)
+#define PBIST_GROUP_STC1_1_ROM PBIST_GROUP(2)
+#define PBIST_GROUP_STC1_2_ROM PBIST_GROUP(3)
+#define PBIST_GROUP_STC2_ROM PBIST_GROUP(4)
+#define PBIST_GROUP_AWM1 PBIST_GROUP(5)
+#define PBIST_GROUP_DCAN1 PBIST_GROUP(6)
+#define PBIST_GROUP_DCAN2 PBIST_GROUP(7)
+#define PBIST_GROUP_DMA PBIST_GROUP(8)
+#define PBIST_GROUP_HTU1 PBIST_GROUP(9)
+#define PBIST_GROUP_MIBSPI1 PBIST_GROUP(10)
+#define PBIST_GROUP_MIBSPI2 PBIST_GROUP(11)
+#define PBIST_GROUP_MIBSPI3 PBIST_GROUP(12)
+#define PBIST_GROUP_N2HET1 PBIST_GROUP(13)
+#define PBIST_GROUP_VIM PBIST_GROUP(14)
+#define PBIST_GROUP_RTP PBIST_GROUP(16)
+#define PBIST_GROUP_ATB PBIST_GROUP(17)
+#define PBIST_GROUP_AWM2 PBIST_GROUP(18)
+#define PBIST_GROUP_DCAN3 PBIST_GROUP(19)
+#define PBIST_GROUP_DCAN4 PBIST_GROUP(20)
+#define PBIST_GROUP_HTU2 PBIST_GROUP(21)
+#define PBIST_GROUP_MIBSPI4 PBIST_GROUP(22)
+#define PBIST_GROUP_MIBSPI5 PBIST_GROUP(23)
+#define PBIST_GROUP_N2HET2 PBIST_GROUP(24)
+#define PBIST_GROUP_EMAC_STATE PBIST_GROUP(27)
+#define PBIST_GROUP_EMAC_FIFO PBIST_GROUP(28)
+#define PBIST_GROUP_L2RAMW_1 PBIST_GROUP(29)
+#define PBIST_GROUP_L2RAMW_2 PBIST_GROUP(30)
+#define PBIST_GROUP_ICACHE PBIST_GROUP(31)
+#define PBIST_GROUP_DCACHE PBIST_GROUP(32)
+#define PBIST_GROUP_EMAC_CPPI PBIST_GROUP(36)
+#define PBIST_GROUP_DCACHE_DIRTY PBIST_GROUP(37)
+
+#define PBIST_GROUPS_ROM (PBIST_GROUP_PBIST_ROM | \
+ PBIST_GROUP_STC1_1_ROM | \
+ PBIST_GROUP_STC1_2_ROM | \
+ PBIST_GROUP_STC2_ROM)
+
+/* PBIST ROM clock ceiling (SPNS215C 6.13.1) */
+
+#define PBIST_MAX_ROMCLK (82500000)
+
+#endif /* __ARCH_ARM_SRC_RM57_HARDWARE_RM57_PBIST_H */
diff --git a/arch/arm/src/rm57/hardware/rm57_pcr.h b/arch/arm/src/rm57/hardware/rm57_pcr.h
new file mode 100644
index 00000000000..80a7288cadb
--- /dev/null
+++ b/arch/arm/src/rm57/hardware/rm57_pcr.h
@@ -0,0 +1,168 @@
+/****************************************************************************
+ * arch/arm/src/rm57/hardware/rm57_pcr.h
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/* Register layout taken from TI's HALCoGen HL_reg_pcr.h for
+ * RM57L843. Note RM57's PCR frame 1 (0xffff1000) is at a different
+ * address than TMS570LS04x's PCR (0xffffe000) - do not assume parity.
+ * RM57L843 also has three PCR frames (pcrREG1/2/3) vs. TMS570's one.
+ */
+
+#ifndef __ARCH_ARM_SRC_RM57_HARDWARE_RM57_PCR_H
+#define __ARCH_ARM_SRC_RM57_HARDWARE_RM57_PCR_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include "hardware/rm57l843_memorymap.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* Register Offsets *********************************************************/
+
+/* Peripheral Memory Protection Set Register 0 */
+#define RM57_PCR_PMPROTSET0_OFFSET 0x0000
+
+/* Peripheral Memory Protection Set Register 1 */
+#define RM57_PCR_PMPROTSET1_OFFSET 0x0004
+
+/* Peripheral Memory Protection Clear Register 0 */
+#define RM57_PCR_PMPROTCLR0_OFFSET 0x0010
+
+/* Peripheral Memory Protection Clear Register 1 */
+#define RM57_PCR_PMPROTCLR1_OFFSET 0x0014
+
+/* Peripheral Protection Set Register 0 */
+#define RM57_PCR_PPROTSET0_OFFSET 0x0020
+
+/* Peripheral Protection Set Register 1 */
+#define RM57_PCR_PPROTSET1_OFFSET 0x0024
+
+/* Peripheral Protection Set Register 2 */
+#define RM57_PCR_PPROTSET2_OFFSET 0x0028
+
+/* Peripheral Protection Set Register 3 */
+#define RM57_PCR_PPROTSET3_OFFSET 0x002c
+
+/* Peripheral Protection Clear Register 0 */
+#define RM57_PCR_PPROTCLR0_OFFSET 0x0040
+
+/* Peripheral Protection Clear Register 1 */
+#define RM57_PCR_PPROTCLR1_OFFSET 0x0044
+
+/* Peripheral Protection Clear Register 2 */
+#define RM57_PCR_PPROTCLR2_OFFSET 0x0048
+
+/* Peripheral Protection Clear Register 3 */
+#define RM57_PCR_PPROTCLR3_OFFSET 0x004c
+
+/* Peripheral Clock Set Power-Down Register 0 */
+#define RM57_PCR_PCSPWRDWNSET0_OFFSET 0x0060
+
+/* Peripheral Clock Set Power-Down Register 1 */
+#define RM57_PCR_PCSPWRDWNSET1_OFFSET 0x0064
+
+/* Peripheral Clock Clear Power-Down Register 0 */
+#define RM57_PCR_PCSPWRDWNCLR0_OFFSET 0x0070
+
+/* Peripheral Clock Clear Power-Down Register 1 */
+#define RM57_PCR_PCSPWRDWNCLR1_OFFSET 0x0074
+
+/* Peripheral Set Power-Down Register 0 */
+#define RM57_PCR_PSPWRDWNSET0_OFFSET 0x0080
+
+/* Peripheral Set Power-Down Register 1 */
+#define RM57_PCR_PSPWRDWNSET1_OFFSET 0x0084
+
+/* Peripheral Set Power-Down Register 2 */
+#define RM57_PCR_PSPWRDWNSET2_OFFSET 0x0088
+
+/* Peripheral Set Power-Down Register 3 */
+#define RM57_PCR_PSPWRDWNSET3_OFFSET 0x008c
+
+/* Peripheral Clear Power-Down Register 0 */
+#define RM57_PCR_PSPWRDWNCLR0_OFFSET 0x00a0
+
+/* Peripheral Clear Power-Down Register 1 */
+#define RM57_PCR_PSPWRDWNCLR1_OFFSET 0x00a4
+
+/* Peripheral Clear Power-Down Register 2 */
+#define RM57_PCR_PSPWRDWNCLR2_OFFSET 0x00a8
+
+/* Peripheral Clear Power-Down Register 3 */
+#define RM57_PCR_PSPWRDWNCLR3_OFFSET 0x00ac
+
+/* Peripheral Domain Set Power-Down Register */
+#define RM57_PCR_PDPWRDWNSET_OFFSET 0x00c0
+
+/* Peripheral Domain Clear Power-Down Register */
+#define RM57_PCR_PDPWRDWNCLR_OFFSET 0x00c4
+
+/* Register Addresses (PCR frame 1) *****************************************/
+
+#define RM57_PCR1_PSPWRDWNSET0 (RM57_PCR1_BASE + RM57_PCR_PSPWRDWNSET0_OFFSET)
+#define RM57_PCR1_PSPWRDWNSET1 (RM57_PCR1_BASE + RM57_PCR_PSPWRDWNSET1_OFFSET)
+#define RM57_PCR1_PSPWRDWNSET2 (RM57_PCR1_BASE + RM57_PCR_PSPWRDWNSET2_OFFSET)
+#define RM57_PCR1_PSPWRDWNSET3 (RM57_PCR1_BASE + RM57_PCR_PSPWRDWNSET3_OFFSET)
+#define RM57_PCR1_PSPWRDWNCLR0 (RM57_PCR1_BASE + RM57_PCR_PSPWRDWNCLR0_OFFSET)
+#define RM57_PCR1_PSPWRDWNCLR1 (RM57_PCR1_BASE + RM57_PCR_PSPWRDWNCLR1_OFFSET)
+#define RM57_PCR1_PSPWRDWNCLR2 (RM57_PCR1_BASE + RM57_PCR_PSPWRDWNCLR2_OFFSET)
+#define RM57_PCR1_PSPWRDWNCLR3 (RM57_PCR1_BASE + RM57_PCR_PSPWRDWNCLR3_OFFSET)
+
+/* Register Addresses (PCR frame 2) *****************************************/
+
+/* PCR2 gates the EMAC/EMAC Control/MDIO (PS[29]-PS[31]) and the Ethernet
+ * CPPI RAM (PCS[41]) - see SPNS215 "Registers/Memories under PCR2". The
+ * PCS registers are the peripheral *clock* power-down controls (as
+ * opposed to PS, which gate the peripheral *register* power-down), and
+ * are only defined here because the Ethernet CPPI RAM is the first
+ * peripheral this port brings up that lives in a PCS-gated quadrant.
+ */
+
+#define RM57_PCR2_PSPWRDWNSET0 (RM57_PCR2_BASE + RM57_PCR_PSPWRDWNSET0_OFFSET)
+#define RM57_PCR2_PSPWRDWNSET1 (RM57_PCR2_BASE + RM57_PCR_PSPWRDWNSET1_OFFSET)
+#define RM57_PCR2_PSPWRDWNSET2 (RM57_PCR2_BASE + RM57_PCR_PSPWRDWNSET2_OFFSET)
+#define RM57_PCR2_PSPWRDWNSET3 (RM57_PCR2_BASE + RM57_PCR_PSPWRDWNSET3_OFFSET)
+#define RM57_PCR2_PSPWRDWNCLR0 (RM57_PCR2_BASE + RM57_PCR_PSPWRDWNCLR0_OFFSET)
+#define RM57_PCR2_PSPWRDWNCLR1 (RM57_PCR2_BASE + RM57_PCR_PSPWRDWNCLR1_OFFSET)
+#define RM57_PCR2_PSPWRDWNCLR2 (RM57_PCR2_BASE + RM57_PCR_PSPWRDWNCLR2_OFFSET)
+#define RM57_PCR2_PSPWRDWNCLR3 (RM57_PCR2_BASE + RM57_PCR_PSPWRDWNCLR3_OFFSET)
+#define RM57_PCR2_PCSPWRDWNSET0 (RM57_PCR2_BASE + RM57_PCR_PCSPWRDWNSET0_OFFSET)
+#define RM57_PCR2_PCSPWRDWNSET1 (RM57_PCR2_BASE + RM57_PCR_PCSPWRDWNSET1_OFFSET)
+#define RM57_PCR2_PCSPWRDWNCLR0 (RM57_PCR2_BASE + RM57_PCR_PCSPWRDWNCLR0_OFFSET)
+#define RM57_PCR2_PCSPWRDWNCLR1 (RM57_PCR2_BASE + RM57_PCR_PCSPWRDWNCLR1_OFFSET)
+
+/* Register Addresses (PCR frame 3) *****************************************/
+
+#define RM57_PCR3_PSPWRDWNSET0 (RM57_PCR3_BASE + RM57_PCR_PSPWRDWNSET0_OFFSET)
+#define RM57_PCR3_PSPWRDWNSET1 (RM57_PCR3_BASE + RM57_PCR_PSPWRDWNSET1_OFFSET)
+#define RM57_PCR3_PSPWRDWNSET2 (RM57_PCR3_BASE + RM57_PCR_PSPWRDWNSET2_OFFSET)
+#define RM57_PCR3_PSPWRDWNSET3 (RM57_PCR3_BASE + RM57_PCR_PSPWRDWNSET3_OFFSET)
+#define RM57_PCR3_PSPWRDWNCLR0 (RM57_PCR3_BASE + RM57_PCR_PSPWRDWNCLR0_OFFSET)
+#define RM57_PCR3_PSPWRDWNCLR1 (RM57_PCR3_BASE + RM57_PCR_PSPWRDWNCLR1_OFFSET)
+#define RM57_PCR3_PSPWRDWNCLR2 (RM57_PCR3_BASE + RM57_PCR_PSPWRDWNCLR2_OFFSET)
+#define RM57_PCR3_PSPWRDWNCLR3 (RM57_PCR3_BASE + RM57_PCR_PSPWRDWNCLR3_OFFSET)
+
+#endif /* __ARCH_ARM_SRC_RM57_HARDWARE_RM57_PCR_H */
diff --git a/arch/arm/src/rm57/hardware/rm57_pinmux.h b/arch/arm/src/rm57/hardware/rm57_pinmux.h
new file mode 100644
index 00000000000..e8992176445
--- /dev/null
+++ b/arch/arm/src/rm57/hardware/rm57_pinmux.h
@@ -0,0 +1,57 @@
+/****************************************************************************
+ * arch/arm/src/rm57/hardware/rm57_pinmux.h
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_RM57_HARDWARE_RM57_PINMUX_H
+#define __ARCH_ARM_SRC_RM57_HARDWARE_RM57_PINMUX_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+
+#if defined(CONFIG_ARCH_CHIP_RM57L843)
+# include "hardware/rm57l843_pinmux.h"
+#else
+# error "Unrecognized RM57 chip"
+#endif
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+/* The chip-specific pinmux header above defines one initializer of this type
+ * per selectable pin function, named PINMUX_<ball>_<function>_PIN. A board
+ * lists the ones it needs in BOARD_PINMUX_INITIALIZER; see
+ * arch/arm/src/rm57/rm57_iomm.h.
+ */
+
+struct rm57_pinmux_s
+{
+ uint8_t mmrndx; /* Index of the PINMMR register, 0-37, 80-99 or 160-179 */
+ uint8_t shift; /* Shift value to isolate the field in that register */
+ uint8_t value; /* The new value for the field */
+};
+
+#endif /* __ARCH_ARM_SRC_RM57_HARDWARE_RM57_PINMUX_H */
diff --git a/arch/arm/src/rm57/hardware/rm57_rti.h b/arch/arm/src/rm57/hardware/rm57_rti.h
new file mode 100644
index 00000000000..63f85de007b
--- /dev/null
+++ b/arch/arm/src/rm57/hardware/rm57_rti.h
@@ -0,0 +1,153 @@
+/****************************************************************************
+ * arch/arm/src/rm57/hardware/rm57_rti.h
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/* Register layout taken from TI's HALCoGen HL_reg_rti.h for
+ * RM57L843 - matches TMS570's RTI+DWWD address (0xfffffc00). Used for
+ * the NuttX system tick.
+ */
+
+#ifndef __ARCH_ARM_SRC_RM57_HARDWARE_RM57_RTI_H
+#define __ARCH_ARM_SRC_RM57_HARDWARE_RM57_RTI_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include "hardware/rm57l843_memorymap.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* Register Offsets *********************************************************/
+
+#define RM57_RTI_GCTRL_OFFSET 0x0000 /* Global Control Register */
+#define RM57_RTI_TBCTRL_OFFSET 0x0004 /* Timebase Control Register */
+#define RM57_RTI_CAPCTRL_OFFSET 0x0008 /* Capture Control Register */
+#define RM57_RTI_COMPCTRL_OFFSET 0x000c /* Compare Control Register */
+
+/* Counter x block (x = 0, 1), block size 0x20 */
+
+/* Free Running Counter x */
+#define RM57_RTI_FRCx_OFFSET(x) (0x0010 + ((x) << 5))
+#define RM57_RTI_UCx_OFFSET(x) (0x0014 + ((x) << 5)) /* Up Counter x */
+
+/* Compare Up Counter x */
+#define RM57_RTI_CPUCx_OFFSET(x) (0x0018 + ((x) << 5))
+
+/* Capture Free Running Counter x */
+#define RM57_RTI_CAFRCx_OFFSET(x) (0x0020 + ((x) << 5))
+
+/* Capture Up Counter x */
+#define RM57_RTI_CAUCx_OFFSET(x) (0x0024 + ((x) << 5))
+
+/* Compare x block (x = 0..3), block size 0x08 */
+
+#define RM57_RTI_COMPx_OFFSET(x) (0x0050 + ((x) << 3)) /* Compare x */
+
+/* Update Compare x */
+#define RM57_RTI_UDCPx_OFFSET(x) (0x0054 + ((x) << 3))
+
+/* External Clock Timebase Low Compare Register */
+#define RM57_RTI_TBLCOMP_OFFSET 0x0070
+
+/* External Clock Timebase High Compare Register */
+#define RM57_RTI_TBHCOMP_OFFSET 0x0074
+#define RM57_RTI_SETINTENA_OFFSET 0x0080 /* Set/Status Interrupt Register */
+
+/* Clear/Status Interrupt Register */
+#define RM57_RTI_CLEARINTENA_OFFSET 0x0084
+#define RM57_RTI_INTFLAG_OFFSET 0x0088 /* Interrupt Flag Register */
+
+/* Digital Watchdog Control Register */
+#define RM57_RTI_DWDCTRL_OFFSET 0x0090
+
+/* Digital Watchdog Preload Register */
+#define RM57_RTI_DWDPRLD_OFFSET 0x0094
+#define RM57_RTI_WDSTATUS_OFFSET 0x0098 /* Watchdog Status Register */
+#define RM57_RTI_WDKEY_OFFSET 0x009c /* Watchdog Key Register */
+#define RM57_RTI_DWDCNTR_OFFSET 0x00a0 /* Digital Watchdog Down Counter */
+
+/* Windowed Watchdog Reaction Control */
+#define RM57_RTI_WWDRXNCTRL_OFFSET 0x00a4
+
+/* Windowed Watchdog Window Size Control */
+#define RM57_RTI_WWDSIZECTRL_OFFSET 0x00a8
+
+/* Compare Interrupt Clear Enable Register */
+#define RM57_RTI_INTCLRENABLE_OFFSET 0x00ac
+#define RM57_RTI_COMP0CLR_OFFSET 0x00b0 /* Compare 0 Clear Register */
+#define RM57_RTI_COMP1CLR_OFFSET 0x00b4 /* Compare 1 Clear Register */
+#define RM57_RTI_COMP2CLR_OFFSET 0x00b8 /* Compare 2 Clear Register */
+#define RM57_RTI_COMP3CLR_OFFSET 0x00bc /* Compare 3 Clear Register */
+
+/* Register Addresses (RTI1, counter/compare block 0) ***********************/
+
+#define RM57_RTI_GCTRL (RM57_RTI1_BASE + RM57_RTI_GCTRL_OFFSET)
+#define RM57_RTI_TBCTRL (RM57_RTI1_BASE + RM57_RTI_TBCTRL_OFFSET)
+#define RM57_RTI_CAPCTRL (RM57_RTI1_BASE + RM57_RTI_CAPCTRL_OFFSET)
+#define RM57_RTI_COMPCTRL (RM57_RTI1_BASE + RM57_RTI_COMPCTRL_OFFSET)
+#define RM57_RTI_FRC0 (RM57_RTI1_BASE + RM57_RTI_FRCx_OFFSET(0))
+#define RM57_RTI_UC0 (RM57_RTI1_BASE + RM57_RTI_UCx_OFFSET(0))
+#define RM57_RTI_CPUC0 (RM57_RTI1_BASE + RM57_RTI_CPUCx_OFFSET(0))
+#define RM57_RTI_COMP0 (RM57_RTI1_BASE + RM57_RTI_COMPx_OFFSET(0))
+#define RM57_RTI_UDCP0 (RM57_RTI1_BASE + RM57_RTI_UDCPx_OFFSET(0))
+#define RM57_RTI_COMP1 (RM57_RTI1_BASE + RM57_RTI_COMPx_OFFSET(1))
+#define RM57_RTI_UDCP1 (RM57_RTI1_BASE + RM57_RTI_UDCPx_OFFSET(1))
+#define RM57_RTI_SETINTENA (RM57_RTI1_BASE + RM57_RTI_SETINTENA_OFFSET)
+#define RM57_RTI_CLEARINTENA (RM57_RTI1_BASE + RM57_RTI_CLEARINTENA_OFFSET)
+#define RM57_RTI_INTFLAG (RM57_RTI1_BASE + RM57_RTI_INTFLAG_OFFSET)
+
+/* Register Bit-Field Definitions *******************************************/
+
+/* Global Control Register */
+
+/* Bit 0: Enable counter block 0 */
+#define RTI_GCTRL_CNT0EN (1 << 0)
+
+/* Bit 1: Enable counter block 1 */
+#define RTI_GCTRL_CNT1EN (1 << 1)
+
+/* Compare Control Register.
+ *
+ * Each compare selects the free-running counter it is compared against:
+ * 0 selects counter 0, 1 selects counter 1.
+ */
+
+#define RTI_COMPCTRL_COMPSEL(n) (1 << ((n) << 2))
+# define RTI_COMPCTRL_COMPSEL0 RTI_COMPCTRL_COMPSEL(0)
+# define RTI_COMPCTRL_COMPSEL1 RTI_COMPCTRL_COMPSEL(1)
+# define RTI_COMPCTRL_COMPSEL2 RTI_COMPCTRL_COMPSEL(2)
+# define RTI_COMPCTRL_COMPSEL3 RTI_COMPCTRL_COMPSEL(3)
+
+/* Compare/interrupt bits (SETINTENA/CLEARINTENA/INTFLAG) */
+
+#define RTI_INT_COMPARE0 (1 << 0)
+#define RTI_INT_COMPARE1 (1 << 1)
+#define RTI_INT_COMPARE2 (1 << 2)
+#define RTI_INT_COMPARE3 (1 << 3)
+#define RTI_INT_OVERFLOW0 (1 << 16)
+#define RTI_INT_OVERFLOW1 (1 << 17)
+#define RTI_INT_TIMEBASE (1 << 18)
+
+#endif /* __ARCH_ARM_SRC_RM57_HARDWARE_RM57_RTI_H */
diff --git a/arch/arm/src/rm57/hardware/rm57_sci.h b/arch/arm/src/rm57/hardware/rm57_sci.h
new file mode 100644
index 00000000000..2a570482fe2
--- /dev/null
+++ b/arch/arm/src/rm57/hardware/rm57_sci.h
@@ -0,0 +1,370 @@
+/****************************************************************************
+ * arch/arm/src/rm57/hardware/rm57_sci.h
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/* Register layout taken from TI's HALCoGen HL_reg_sci.h for
+ * RM57L843. RM57L843 has four SCI instances (SCI1/LIN1, SCI2, SCI3,
+ * SCI4) vs. TMS570LS's one or two - see rm57l843_memorymap.h for the
+ * per-instance base addresses.
+ */
+
+#ifndef __ARCH_ARM_SRC_RM57_HARDWARE_RM57_SCI_H
+#define __ARCH_ARM_SRC_RM57_HARDWARE_RM57_SCI_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include "hardware/rm57l843_memorymap.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* Register Offsets *********************************************************/
+
+#define RM57_SCI_GCR0_OFFSET 0x0000 /* Global Control Register 0 */
+#define RM57_SCI_GCR1_OFFSET 0x0004 /* Global Control Register 1 */
+
+/* Global Control Register 2 (LIN mode only) */
+#define RM57_SCI_GCR2_OFFSET 0x0008
+
+/* Set Interrupt Enable Register */
+#define RM57_SCI_SETINT_OFFSET 0x000c
+
+/* Clear Interrupt Enable Register */
+#define RM57_SCI_CLEARINT_OFFSET 0x0010
+#define RM57_SCI_SETINTLVL_OFFSET 0x0014 /* Set Interrupt Level Register */
+
+/* Clear Interrupt Level Register */
+#define RM57_SCI_CLEARINTLVL_OFFSET 0x0018
+#define RM57_SCI_FLR_OFFSET 0x001c /* Interrupt Flag Register */
+#define RM57_SCI_INTVECT0_OFFSET 0x0020 /* Interrupt Vector Offset 0 */
+#define RM57_SCI_INTVECT1_OFFSET 0x0024 /* Interrupt Vector Offset 1 */
+#define RM57_SCI_FORMAT_OFFSET 0x0028 /* Format Control Register */
+#define RM57_SCI_BRS_OFFSET 0x002c /* Baud Rate Selection Register */
+#define RM57_SCI_ED_OFFSET 0x0030 /* Emulation Register */
+#define RM57_SCI_RD_OFFSET 0x0034 /* Receive Data Buffer */
+#define RM57_SCI_TD_OFFSET 0x0038 /* Transmit Data Buffer */
+#define RM57_SCI_PIO0_OFFSET 0x003c /* Pin Function Register */
+#define RM57_SCI_PIO1_OFFSET 0x0040 /* Pin Direction Register */
+#define RM57_SCI_PIO2_OFFSET 0x0044 /* Pin Data In Register */
+#define RM57_SCI_PIO3_OFFSET 0x0048 /* Pin Data Out Register */
+#define RM57_SCI_PIO4_OFFSET 0x004c /* Pin Data Set Register */
+#define RM57_SCI_PIO5_OFFSET 0x0050 /* Pin Data Clr Register */
+
+/* Pin Open Drain Output Enable Register */
+#define RM57_SCI_PIO6_OFFSET 0x0054
+
+/* Pin Pullup/Pulldown Disable Register */
+#define RM57_SCI_PIO7_OFFSET 0x0058
+
+/* Pin Pullup/Pulldown Selection Register */
+#define RM57_SCI_PIO8_OFFSET 0x005c
+
+/* LIN-mode registers (valid when SCI_GCR1_LIN_MODE is set; SCI1/LIN1 and
+ * SCI2/LIN2 only - SCI3/SCI4 are SCI-only and do not implement these).
+ */
+
+#define RM57_SCI_LINCOMPARE_OFFSET 0x0060 /* LIN Compare Register */
+#define RM57_SCI_LINRD0_OFFSET 0x0064 /* LIN Receive Buffer 0 */
+#define RM57_SCI_LINRD1_OFFSET 0x0068 /* LIN Receive Buffer 1 */
+#define RM57_SCI_LINMASK_OFFSET 0x006c /* LIN Mask Register */
+#define RM57_SCI_LINID_OFFSET 0x0070 /* LIN Identification Register */
+#define RM57_SCI_LINTD0_OFFSET 0x0074 /* LIN Transmit Buffer 0 */
+#define RM57_SCI_LINTD1_OFFSET 0x0078 /* LIN Transmit Buffer 1 */
+#define RM57_SCI_MBRS_OFFSET 0x007c /* Maximum Baud Rate Selection */
+#define RM57_SCI_IODFTCTRL_OFFSET 0x0090 /* I/O Error Enable Register */
+
+/* Byte lane of the 8-bit RX/TX data within the 32-bit RD/TD registers, as
+ * seen by the DMA controller when it performs an 8-bit access.
+ *
+ * The RD/TD data byte lives in bits 7:0 of the 32-bit register. This
+ * image runs LE32 (no CONFIG_ENDIAN_BIG, no boot-time endian switch in
+ * rm57_boot.c), and the same LE32 mode applies to every bus master,
+ * including the DMA controller, so the data byte for an 8-bit DMA access
+ * is at the register's +0 address.
+ *
+ * Do NOT use OpenOCD's "ti_be_32_quirks 1" setting as evidence for a +3
+ * byte-lane offset here: that quirk is specific to how the JTAG/DAP debug
+ * port presents byte lanes for sub-word memory accesses made *through the
+ * debugger*, and says nothing about how the CPU/DMA controller address
+ * bytes during normal program execution.
+ */
+
+#define RM57_SCI_RD_DMA_OFFSET (RM57_SCI_RD_OFFSET + 0)
+#define RM57_SCI_TD_DMA_OFFSET (RM57_SCI_TD_OFFSET + 0)
+
+/* Register Bit-Field Definitions *******************************************/
+
+/* Global Control Register 0 */
+
+/* Bit 0: Take SCI out of reset */
+#define SCI_GCR0_RESET (1 << 0)
+
+/* Global Control Register 1 */
+
+/* Bit 0: 0=idle-line, 1=addr-bit mode */
+#define SCI_GCR1_COMM_MODE (1 << 0)
+
+/* Bit 1: Asynchronous timing mode */
+#define SCI_GCR1_TIMING_MODE (1 << 1)
+#define SCI_GCR1_PARITY_ENA (1 << 2) /* Bit 2: Parity enable */
+#define SCI_GCR1_PARITY (1 << 3) /* Bit 3: 0=odd, 1=even */
+
+/* Bit 4: 0=1 stop bit, 1=2 stop bits */
+#define SCI_GCR1_STOP (1 << 4)
+
+/* Bit 5: Clock signal source (LIN mode) */
+#define SCI_GCR1_CLOCK (1 << 5)
+#define SCI_GCR1_LIN_MODE (1 << 6) /* Bit 6: 0=SCI, 1=LIN */
+
+/* Bit 7: Software reset, active low */
+#define SCI_GCR1_SWRST (1 << 7)
+
+/* Bit 8: Sleep mode enable (multiprocessor communication). NOTE: this
+ * bit was previously (incorrectly) defined here as SCI_GCR1_CTYPE - per
+ * TRM SPNU562A section 28.6.2 (SCIGCR1) bit 8 is SLEEP, bit 9 is ADAPT,
+ * and CTYPE/HGEN_CTRL are actually bits 11/12 (redefined below). Nothing
+ * in-tree referenced the old (wrong) values.
+ */
+#define SCI_GCR1_SLEEP (1 << 8)
+
+/* Bit 9: Adaptive baud rate mode enable (LIN mode) */
+#define SCI_GCR1_ADAPT (1 << 9)
+
+/* Bit 10: Multi-buffer mode enable (LIN mode) */
+#define SCI_GCR1_MBUF_MODE (1 << 10)
+
+/* Bit 11: LIN checksum type, 0=classic, 1=enhanced */
+#define SCI_GCR1_CTYPE (1 << 11)
+
+/* Bit 12: LIN hardware header generation/comparison control */
+#define SCI_GCR1_HGEN_CTRL (1 << 12)
+
+/* Bit 13: LIN extended frame (stop bit extension) */
+#define SCI_GCR1_STOPEXT (1 << 13)
+#define SCI_GCR1_RXENA (1 << 24) /* Bit 24: Receiver enable */
+
+/* Bit 25: Transmitter enable */
+#define SCI_GCR1_TXENA (1 << 25)
+#define SCI_GCR1_LOOPBACK (1 << 16) /* Bit 16: Loop back enable */
+
+/* Bit 17: Continue on suspend (emulation) */
+#define SCI_GCR1_CONT (1 << 17)
+
+/* Global Control Register 2 (LIN mode only) */
+
+#define SCI_GCR2_POWERDOWN (1 << 0) /* Bit 0: Local low-power mode request */
+#define SCI_GCR2_GENWU (1 << 8) /* Bit 8: Generate wakeup signal (LIN master) */
+#define SCI_GCR2_SC (1 << 16) /* Bit 16: Send checksum byte */
+#define SCI_GCR2_CC (1 << 17) /* Bit 17: Compare checksum byte */
+
+/* Interrupt Flag / Set / Clear Register bits (common to SETINT/CLEARINT/
+ * FLR) - values confirmed from TI's HALCoGen HL_sci.h sciInterrupt_t
+ * enum, not guessed
+ */
+
+#define SCI_INT_BREAK (0x00000001) /* Break detect */
+#define SCI_INT_WAKE (0x00000002) /* Wakeup */
+#define SCI_INT_TX (0x00000100) /* Transmit buffer ready */
+#define SCI_INT_RX (0x00000200) /* Receive buffer ready */
+#define SCI_INT_TXDMA (1 << 16) /* Bit 16: Set/clear TX DMA request */
+#define SCI_INT_RXDMA (1 << 17) /* Bit 17: Set/clear RX DMA request */
+#define SCI_INT_RXDMAALL (1 << 18) /* Bit 18: RX DMA for address+data frames */
+#define SCI_INT_ID (1 << 13) /* Bit 13: LIN identifier interrupt */
+#define SCI_INT_PE (0x01000000) /* Parity error */
+#define SCI_INT_OE (0x02000000) /* Overrun error */
+#define SCI_INT_FE (0x04000000) /* Framing error */
+#define SCI_INT_ALLINTS (0xff0023d3)
+
+/* Baud Rate Selection Register: P (integer divider, bits 0-23), M (4-bit
+ * fractional divider, bits 24-27), U (super-fractional divider, bits
+ * 28-30)
+ */
+
+#define SCI_BRS_P_SHIFT (0)
+#define SCI_BRS_P_MASK (0x00ffffff << SCI_BRS_P_SHIFT)
+# define SCI_BRS_P(n) ((uint32_t)(n) << SCI_BRS_P_SHIFT)
+#define SCI_BRS_M_SHIFT (24)
+#define SCI_BRS_M_MASK (15 << SCI_BRS_M_SHIFT)
+# define SCI_BRS_M(n) ((uint32_t)(n) << SCI_BRS_M_SHIFT)
+#define SCI_BRS_U_SHIFT (28)
+#define SCI_BRS_U_MASK (7 << SCI_BRS_U_SHIFT)
+# define SCI_BRS_U(n) ((uint32_t)(n) << SCI_BRS_U_SHIFT)
+
+/* Format Control Register: frame length control, bits 0-2 (nbits - 1) */
+
+#define SCI_FORMAT_CHAR_SHIFT (0)
+#define SCI_FORMAT_CHAR_MASK (7 << SCI_FORMAT_CHAR_SHIFT)
+# define SCI_FORMAT_CHAR(n) ((uint32_t)(n) << SCI_FORMAT_CHAR_SHIFT)
+
+/* Pin Function Register (PIO0): confirmed from HL_sci.h
+ * SCI3_PIO0_CONFIGVALUE = (1<<2)|(1<<1)
+ */
+
+#define SCI_PIO_RX (1 << 1) /* Bit 1: RX pin */
+#define SCI_PIO_TX (1 << 2) /* Bit 2: TX pin */
+
+/* SCI Flags Register (FLR) - same bit positions as SETINT/CLEARINT above,
+ * plus status-only bits below. NOT independently derivable from
+ * HL_reg_sci.h (which only gives register offsets, not TRM-documented
+ * bit tables); reused from tms570_sci.h since both TMS570 and RM57 share
+ * the same underlying Hercules SCI IP block (confirmed by the GCR1 bit
+ * positions matching exactly against the HALCoGen SCI3_GCR1_CONFIGVALUE
+ * decode above).
+ */
+
+/* Bit 0: Break detect flag */
+#define SCI_FLR_BRKDT (1 << 0)
+#define SCI_FLR_WAKEUP (1 << 1) /* Bit 1: Wake-up flag */
+
+/* Bit 2: SCI receiver in idle state */
+#define SCI_FLR_IDLE (1 << 2)
+#define SCI_FLR_BUSY (1 << 3) /* Bit 3: Bus busy flag */
+#define SCI_FLR_TIMEOUT (1 << 4) /* Bit 4: Timeout flag */
+
+/* Bit 8: Transmit buffer ready flag */
+#define SCI_FLR_TXRDY (1 << 8)
+
+/* Bit 9: Receive buffer ready flag */
+#define SCI_FLR_RXRDY (1 << 9)
+
+/* Bit 11: Transmitter empty flag */
+#define SCI_FLR_TXEMPTY (1 << 11)
+
+/* Bit 24: Parity error flag */
+#define SCI_FLR_PE (1 << 24)
+
+/* Bit 25: Overrun error flag */
+#define SCI_FLR_OE (1 << 25)
+
+/* Bit 26: Framing error flag */
+#define SCI_FLR_FE (1 << 26)
+
+/* LIN-mode-only flags (SCIFLR) - reused from tms570_sci.h, see note
+ * above; only meaningful when SCI_GCR1_LIN_MODE is set.
+ */
+
+#define SCI_FLR_TOAWUS (1 << 6) /* Bit 6: Timeout after wakeup signal */
+#define SCI_FLR_TOA3WUS (1 << 7) /* Bit 7: Timeout after 3 wakeup signals */
+#define SCI_FLR_TXWAKE (1 << 10) /* Bit 10: Transmit wakeup signal flag */
+#define SCI_FLR_RXWAKE (1 << 12) /* Bit 12: Received data is an address (sleep mode) */
+#define SCI_FLR_IDTX (1 << 13) /* Bit 13: TX ID match flag */
+#define SCI_FLR_IDRX (1 << 14) /* Bit 14: RX ID match flag */
+#define SCI_FLR_NRE (1 << 27) /* Bit 27: No-response error flag */
+#define SCI_FLR_ISFE (1 << 28) /* Bit 28: Inconsistent sync field error flag */
+#define SCI_FLR_CE (1 << 29) /* Bit 29: Checksum error flag */
+#define SCI_FLR_PBE (1 << 30) /* Bit 30: Physical bus error flag */
+#define SCI_FLR_BE (1U << 31) /* Bit 31: Bit error flag */
+
+/* SCI Interrupt Vector Offset Registers (INTVECT0/1): priority-encoded
+ * pending-interrupt code, cleared on read (same source table as
+ * tms570_sci.h - see note above)
+ */
+
+#define SCI_INTVECT_MASK (0x1f)
+# define SCI_INTVECT_NONE (0)
+# define SCI_INTVECT_WAKEUP (1)
+# define SCI_INTVECT_ISFE (2)
+# define SCI_INTVECT_PE (3)
+# define SCI_INTVECT_ID (4)
+# define SCI_INTVECT_PBE (5)
+# define SCI_INTVECT_FE (6)
+# define SCI_INTVECT_BRKDT (7)
+# define SCI_INTVECT_CE (8)
+# define SCI_INTVECT_OE (9)
+# define SCI_INTVECT_BE (10)
+# define SCI_INTVECT_RX (11)
+# define SCI_INTVECT_TX (12)
+# define SCI_INTVECT_NRE (13)
+# define SCI_INTVECT_TOAWUS (14)
+# define SCI_INTVECT_TOA3WUS (15)
+# define SCI_INTVECT_TIMEOUT (16)
+
+/* Receive/Transmit Data Buffer */
+
+#define SCI_RD_MASK (0xff)
+#define SCI_TD_MASK (0xff)
+
+/* LIN Compare Register (LINCOMPARE, offset 0x60): synch delimiter/break
+ * extension, LIN mode only.
+ */
+
+#define SCI_LINCOMPARE_SBREAK_SHIFT (0)
+#define SCI_LINCOMPARE_SBREAK_MASK (7 << SCI_LINCOMPARE_SBREAK_SHIFT)
+# define SCI_LINCOMPARE_SBREAK(n) ((uint32_t)(n) << SCI_LINCOMPARE_SBREAK_SHIFT)
+#define SCI_LINCOMPARE_SDEL_SHIFT (16)
+#define SCI_LINCOMPARE_SDEL_MASK (3 << SCI_LINCOMPARE_SDEL_SHIFT)
+# define SCI_LINCOMPARE_SDEL(n) ((uint32_t)(n) << SCI_LINCOMPARE_SDEL_SHIFT)
+
+/* LIN Receive Buffer Registers (LINRD0 offset 0x64, LINRD1 offset 0x68):
+ * each holds 4 bytes of an up-to-8-byte LIN response, byte 0 (earliest
+ * received) in the MSB. RD<n> is response data byte <n+1>.
+ */
+
+#define SCI_LINRD_BYTE0_SHIFT (24)
+#define SCI_LINRD_BYTE1_SHIFT (16)
+#define SCI_LINRD_BYTE2_SHIFT (8)
+#define SCI_LINRD_BYTE3_SHIFT (0)
+#define SCI_LINRD_BYTE_MASK (0xff)
+
+/* LIN Mask Register (LINMASK, offset 0x6c) */
+
+#define SCI_LINMASK_TXIDMASK_SHIFT (0)
+#define SCI_LINMASK_TXIDMASK_MASK (0xff << SCI_LINMASK_TXIDMASK_SHIFT)
+# define SCI_LINMASK_TXIDMASK(n) ((uint32_t)(n) << SCI_LINMASK_TXIDMASK_SHIFT)
+#define SCI_LINMASK_RXIDMASK_SHIFT (16)
+#define SCI_LINMASK_RXIDMASK_MASK (0xff << SCI_LINMASK_RXIDMASK_SHIFT)
+# define SCI_LINMASK_RXIDMASK(n) ((uint32_t)(n) << SCI_LINMASK_RXIDMASK_SHIFT)
+
+/* LIN Identification Register (LINID, offset 0x70) */
+
+#define SCI_LINID_IDBYTE_SHIFT (0)
+#define SCI_LINID_IDBYTE_MASK (0xff << SCI_LINID_IDBYTE_SHIFT)
+# define SCI_LINID_IDBYTE(n) ((uint32_t)(n) << SCI_LINID_IDBYTE_SHIFT)
+#define SCI_LINID_SLAVETASK_SHIFT (8)
+#define SCI_LINID_SLAVETASK_MASK (0xff << SCI_LINID_SLAVETASK_SHIFT)
+# define SCI_LINID_SLAVETASK(n) ((uint32_t)(n) << SCI_LINID_SLAVETASK_SHIFT)
+#define SCI_LINID_RECEIVEDID_SHIFT (16)
+#define SCI_LINID_RECEIVEDID_MASK (0xff << SCI_LINID_RECEIVEDID_SHIFT)
+
+/* LIN Transmit Buffer Registers (LINTD0 offset 0x74, LINTD1 offset 0x78):
+ * same byte packing as LINRD0/1 above (byte 0 in the MSB).
+ */
+
+#define SCI_LINTD_BYTE0_SHIFT (24)
+#define SCI_LINTD_BYTE1_SHIFT (16)
+#define SCI_LINTD_BYTE2_SHIFT (8)
+#define SCI_LINTD_BYTE3_SHIFT (0)
+#define SCI_LINTD_BYTE_MASK (0xff)
+
+/* Maximum Baud Rate Selection Register (MBRS, offset 0x7c): 13-bit
+ * prescaler used by a LIN slave's adaptive baud rate detection (ADAPT
+ * bit). Not used when ADAPT=0 (fixed baud rate, matching the SCI BRS
+ * setup used elsewhere in this port).
+ */
+
+#define SCI_MBRS_MASK (0x1fff)
+# define SCI_MBRS(n) ((uint32_t)(n) & SCI_MBRS_MASK)
+
+#endif /* __ARCH_ARM_SRC_RM57_HARDWARE_RM57_SCI_H */
diff --git a/arch/arm/src/rm57/hardware/rm57_stc.h b/arch/arm/src/rm57/hardware/rm57_stc.h
new file mode 100644
index 00000000000..d3c95246b74
--- /dev/null
+++ b/arch/arm/src/rm57/hardware/rm57_stc.h
@@ -0,0 +1,197 @@
+/****************************************************************************
+ * arch/arm/src/rm57/hardware/rm57_stc.h
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/* Self-Test Controller (STC), SPNU562A chapter 10.
+ *
+ * STC1 runs LBIST on the two lockstep Cortex-R5F cores (segment 0, 125
+ * intervals) and on the uSCU (segment 1, 3 intervals). STC2 does the same
+ * for the two N2HETs (57 intervals). A CPU self-test always ends in a CPU
+ * reset - not a system reset - so STCGSTAT/STCFSTAT/STCSCSCR survive it and
+ * are how the reset handler finds out what just ran.
+ *
+ * Offsets follow TRM Table 10-8. HALCoGen's HL_reg_stc.h names 0x0c
+ * STCCADDR and 0x40 STCCADDR1; the TRM calls them STCCADDR1 (core 1) and
+ * STCCADDR2 (core 2), which is what is used here.
+ */
+
+#ifndef __ARCH_ARM_SRC_RM57_HARDWARE_RM57_STC_H
+#define __ARCH_ARM_SRC_RM57_HARDWARE_RM57_STC_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include "hardware/rm57l843_memorymap.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* Register Offsets *********************************************************/
+
+#define RM57_STC_GCR0_OFFSET 0x0000 /* Global Control Register 0 */
+#define RM57_STC_GCR1_OFFSET 0x0004 /* Global Control Register 1 */
+
+/* Timeout Counter Preload Register */
+#define RM57_STC_TPR_OFFSET 0x0008
+#define RM57_STC_CADDR1_OFFSET 0x000c /* Current ROM Address, core 1 */
+
+/* Current Interval Count Register */
+#define RM57_STC_CICR_OFFSET 0x0010
+#define RM57_STC_GSTAT_OFFSET 0x0014 /* Global Status Register */
+#define RM57_STC_FSTAT_OFFSET 0x0018 /* Fail Status Register */
+
+/* Current MISR registers, n=0..3 */
+
+#define RM57_STC_CORE1_MISR_OFFSET(n) (0x001c + ((n) << 2))
+#define RM57_STC_CORE2_MISR_OFFSET(n) (0x002c + ((n) << 2))
+
+#define RM57_STC_SCSCR_OFFSET 0x003c /* Signature Compare Self-Check */
+#define RM57_STC_CADDR2_OFFSET 0x0040 /* Current ROM Address, core 2 */
+#define RM57_STC_CLKDIV_OFFSET 0x0044 /* Clock Divider Register */
+
+/* Segment First Preload Register */
+#define RM57_STC_SEGPLR_OFFSET 0x0048
+
+/* Register Addresses *******************************************************/
+
+#define RM57_STC1_GCR0 (RM57_STC1_BASE + RM57_STC_GCR0_OFFSET)
+#define RM57_STC1_GCR1 (RM57_STC1_BASE + RM57_STC_GCR1_OFFSET)
+#define RM57_STC1_TPR (RM57_STC1_BASE + RM57_STC_TPR_OFFSET)
+#define RM57_STC1_CADDR1 (RM57_STC1_BASE + RM57_STC_CADDR1_OFFSET)
+#define RM57_STC1_CICR (RM57_STC1_BASE + RM57_STC_CICR_OFFSET)
+#define RM57_STC1_GSTAT (RM57_STC1_BASE + RM57_STC_GSTAT_OFFSET)
+#define RM57_STC1_FSTAT (RM57_STC1_BASE + RM57_STC_FSTAT_OFFSET)
+#define RM57_STC1_SCSCR (RM57_STC1_BASE + RM57_STC_SCSCR_OFFSET)
+#define RM57_STC1_CADDR2 (RM57_STC1_BASE + RM57_STC_CADDR2_OFFSET)
+#define RM57_STC1_CLKDIV (RM57_STC1_BASE + RM57_STC_CLKDIV_OFFSET)
+#define RM57_STC1_SEGPLR (RM57_STC1_BASE + RM57_STC_SEGPLR_OFFSET)
+
+#define RM57_STC2_GCR0 (RM57_STC2_BASE + RM57_STC_GCR0_OFFSET)
+#define RM57_STC2_GCR1 (RM57_STC2_BASE + RM57_STC_GCR1_OFFSET)
+#define RM57_STC2_TPR (RM57_STC2_BASE + RM57_STC_TPR_OFFSET)
+#define RM57_STC2_GSTAT (RM57_STC2_BASE + RM57_STC_GSTAT_OFFSET)
+#define RM57_STC2_FSTAT (RM57_STC2_BASE + RM57_STC_FSTAT_OFFSET)
+#define RM57_STC2_SCSCR (RM57_STC2_BASE + RM57_STC_SCSCR_OFFSET)
+#define RM57_STC2_CLKDIV (RM57_STC2_BASE + RM57_STC_CLKDIV_OFFSET)
+
+/* Register Bit-Field Definitions *******************************************/
+
+/* Global Control Register 0 */
+
+#define STC_GCR0_RS_CNT_MASK (3 << 0) /* Bits 0-1: Restart/continue */
+
+/* Continue from last interval */
+# define STC_GCR0_RS_CNT_CONTINUE (0 << 0)
+# define STC_GCR0_RS_CNT_RESTART (1 << 0) /* Restart from interval 0 */
+
+/* Bits 8-10: Capture idle cycle */
+#define STC_GCR0_CAP_IDLE_SHIFT (8)
+#define STC_GCR0_CAP_IDLE_MASK (7 << STC_GCR0_CAP_IDLE_SHIFT)
+#define STC_GCR0_INTCOUNT_SHIFT (16) /* Bits 16-31: Interval count */
+#define STC_GCR0_INTCOUNT_MASK (0xffff << STC_GCR0_INTCOUNT_SHIFT)
+# define STC_GCR0_INTCOUNT(n) ((uint32_t)(n) << STC_GCR0_INTCOUNT_SHIFT)
+
+/* Global Control Register 1. SEG0_CORE_SEL must be written before STC_ENA
+ * and ignores further writes until the run completes.
+ */
+
+#define STC_GCR1_ENA_MASK (0x0f << 0) /* Bits 0-3: Enable key */
+# define STC_GCR1_ENA_ENABLE (0x0a << 0)
+# define STC_GCR1_ENA_DISABLE (0x05 << 0)
+
+/* Bits 8-11: Segment 0 cores */
+#define STC_GCR1_CORE_SEL_MASK (0x0f << 8)
+# define STC_GCR1_CORE_SEL_BOTH (0x00 << 8) /* Both cores in parallel */
+# define STC_GCR1_CORE_SEL_CORE1 (0x05 << 8)
+# define STC_GCR1_CORE_SEL_CORE2 (0x0a << 8)
+
+/* Timeout Counter Preload Register. Errata STC#26: reverts to its reset
+ * value at the end of every run, so it has to be rewritten each time.
+ */
+
+#define STC_TPR_MAX (0xffffffff)
+
+/* Current Interval Count Register */
+
+#define STC_CICR_CORE1_MASK (0xffff << 0)
+#define STC_CICR_CORE2_SHIFT (16)
+#define STC_CICR_CORE2_MASK (0xffff << STC_CICR_CORE2_SHIFT)
+
+/* Global Status Register (both flags W1C, reset only by power-on reset) */
+
+#define STC_GSTAT_TEST_DONE (1 << 0) /* Bit 0: Run completed */
+#define STC_GSTAT_TEST_FAIL (1 << 1) /* Bit 1: Run failed */
+
+/* Bits 8-11: 0xa while a run is active */
+#define STC_GSTAT_ST_ACTIVE_MASK (0x0f << 8)
+# define STC_GSTAT_ST_ACTIVE (0x0a << 8)
+
+/* Fail Status Register (flags W1C, reset only by power-on reset) */
+
+/* Bit 0: Core 1 MISR mismatch */
+#define STC_FSTAT_CORE1_FAIL (1 << 0)
+
+/* Bit 1: Core 2 MISR mismatch */
+#define STC_FSTAT_CORE2_FAIL (1 << 1)
+#define STC_FSTAT_TO_ERR (1 << 2) /* Bit 2: Timeout */
+#define STC_FSTAT_FSEG_ID_SHIFT (3) /* Bits 3-4: Failed segment */
+#define STC_FSTAT_FSEG_ID_MASK (3 << STC_FSTAT_FSEG_ID_SHIFT)
+
+/* Signature Compare Self-Check Register (reset by system reset, so it
+ * survives the CPU reset that ends a run)
+ */
+
+#define STC_SCSCR_KEY_MASK (0x0f << 0) /* Bits 0-3: Self-check key */
+# define STC_SCSCR_KEY_ENABLE (0x0a << 0)
+# define STC_SCSCR_KEY_DISABLE (0x05 << 0)
+
+/* Bit 4: Insert stuck-at fault */
+#define STC_SCSCR_FAULT_INS (1 << 4)
+
+/* Clock Divider Register. Only honoured while the CLKDIV field of the
+ * system module's STCLKDIV register (SYS2, 0xffffe108) is zero.
+ */
+
+/* Bits 16-18: Segment 1, /(n+1) */
+#define STC_CLKDIV_CLKDIV1_SHIFT (16)
+#define STC_CLKDIV_CLKDIV1_MASK (7 << STC_CLKDIV_CLKDIV1_SHIFT)
+# define STC_CLKDIV_CLKDIV1(n) ((uint32_t)(n) << STC_CLKDIV_CLKDIV1_SHIFT)
+
+/* Bits 24-26: Segment 0, /(n+1) */
+#define STC_CLKDIV_CLKDIV0_SHIFT (24)
+#define STC_CLKDIV_CLKDIV0_MASK (7 << STC_CLKDIV_CLKDIV0_SHIFT)
+# define STC_CLKDIV_CLKDIV0(n) ((uint32_t)(n) << STC_CLKDIV_CLKDIV0_SHIFT)
+
+/* Segment First Preload Register */
+
+#define STC_SEGPLR_SEGID_MASK (3 << 0) /* Bits 0-1: First segment */
+
+/* Interval counts (TRM Table 10-1), STCCLK ceiling (SPNS215C 6.5.5.2) */
+
+#define STC1_SEG0_NINTERVALS (125)
+#define STC1_SEG1_NINTERVALS (3)
+#define STC2_NINTERVALS (57)
+#define STC_MAX_STCCLK (110000000)
+
+#endif /* __ARCH_ARM_SRC_RM57_HARDWARE_RM57_STC_H */
diff --git a/arch/arm/src/rm57/hardware/rm57_sys.h b/arch/arm/src/rm57/hardware/rm57_sys.h
new file mode 100644
index 00000000000..67713359207
--- /dev/null
+++ b/arch/arm/src/rm57/hardware/rm57_sys.h
@@ -0,0 +1,494 @@
+/****************************************************************************
+ * arch/arm/src/rm57/hardware/rm57_sys.h
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/* Register layout taken from TI's HALCoGen HL_reg_system.h for
+ * RM57L843. System Frame 1 (systemREG1, 0xffffff00) and Frame 2
+ * (systemREG2, 0xffffe100) match TMS570's addresses - this is common
+ * Hercules "SYS" module infrastructure. Field-level PLL/clock values
+ * (BOARD_PLL_* etc) are supplied per-board (arch/board/board.h), not
+ * here.
+ */
+
+#ifndef __ARCH_ARM_SRC_RM57_HARDWARE_RM57_SYS_H
+#define __ARCH_ARM_SRC_RM57_HARDWARE_RM57_SYS_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include "hardware/rm57l843_memorymap.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* System Frame 1 Register Offsets ******************************************/
+
+#define RM57_SYS_SYSPC1_OFFSET 0x0000 /* SYS Pin Control Register 1 */
+#define RM57_SYS_SYSPC2_OFFSET 0x0004 /* SYS Pin Control Register 2 */
+#define RM57_SYS_SYSPC3_OFFSET 0x0008 /* SYS Pin Control Register 3 */
+#define RM57_SYS_SYSPC4_OFFSET 0x000c /* SYS Pin Control Register 4 */
+#define RM57_SYS_SYSPC5_OFFSET 0x0010 /* SYS Pin Control Register 5 */
+#define RM57_SYS_SYSPC6_OFFSET 0x0014 /* SYS Pin Control Register 6 */
+#define RM57_SYS_SYSPC7_OFFSET 0x0018 /* SYS Pin Control Register 7 */
+#define RM57_SYS_SYSPC8_OFFSET 0x001c /* SYS Pin Control Register 8 */
+#define RM57_SYS_SYSPC9_OFFSET 0x0020 /* SYS Pin Control Register 9 */
+#define RM57_SYS_CSDIS_OFFSET 0x0030 /* Clock Source Disable Register */
+
+/* Clock Source Disable Set Register */
+#define RM57_SYS_CSDISSET_OFFSET 0x0034
+
+/* Clock Source Disable Clear Register */
+#define RM57_SYS_CSDISCLR_OFFSET 0x0038
+#define RM57_SYS_CDDIS_OFFSET 0x003c /* Clock Domain Disable Register */
+
+/* Clock Domain Disable Set Register */
+#define RM57_SYS_CDDISSET_OFFSET 0x0040
+
+/* Clock Domain Disable Clear Register */
+#define RM57_SYS_CDDISCLR_OFFSET 0x0044
+
+/* GCLK, HCLK, VCLK, VCLK2 Source Register */
+#define RM57_SYS_GHVSRC_OFFSET 0x0048
+
+/* Peripheral Asynchronous Clock Source Register */
+#define RM57_SYS_VCLKASRC_OFFSET 0x004c
+#define RM57_SYS_RCLKSRC_OFFSET 0x0050 /* RTI Clock Source Register */
+
+/* Clock Source Valid Status Register */
+#define RM57_SYS_CSVSTAT_OFFSET 0x0054
+
+/* Memory Self-Test Global Control Register */
+#define RM57_SYS_MSTGCR_OFFSET 0x0058
+
+/* Memory Hardware Initialization Global Control Register */
+#define RM57_SYS_MINITGCR_OFFSET 0x005c
+
+/* Memory Self-Test/Initialization Enable Register */
+#define RM57_SYS_MSINENA_OFFSET 0x0060
+
+/* Memory Self-Test Fail Status Register */
+#define RM57_SYS_MSTFAIL_OFFSET 0x0064
+#define RM57_SYS_MSTCGSTAT_OFFSET 0x0068 /* MSTC Global Status Register */
+
+/* Memory Hardware Initialization Status Register */
+#define RM57_SYS_MINISTAT_OFFSET 0x006c
+#define RM57_SYS_PLLCTL1_OFFSET 0x0070 /* PLL Control Register 1 */
+#define RM57_SYS_PLLCTL2_OFFSET 0x0074 /* PLL Control Register 2 */
+#define RM57_SYS_SYSPC10_OFFSET 0x0078 /* SYS Pin Control Register 10 */
+
+/* Die Identification Register, Lower Word */
+#define RM57_SYS_DIEIDL_OFFSET 0x007c
+
+/* Die Identification Register, Upper Word */
+#define RM57_SYS_DIEIDH_OFFSET 0x0080
+
+/* LPO/Clock Monitor Control Register */
+#define RM57_SYS_LPOMONCTL_OFFSET 0x0088
+#define RM57_SYS_CLKTEST_OFFSET 0x008c /* Clock Test Register */
+#define RM57_SYS_DFTCTRLREG1_OFFSET 0x0090 /* DFT Control Register 1 */
+#define RM57_SYS_DFTCTRLREG2_OFFSET 0x0094 /* DFT Control Register 2 */
+#define RM57_SYS_GPREG1_OFFSET 0x00a0 /* General Purpose Register */
+
+/* System Software Interrupt Request 1 Register */
+#define RM57_SYS_SSIR1_OFFSET 0x00b0
+
+/* System Software Interrupt Request 2 Register */
+#define RM57_SYS_SSIR2_OFFSET 0x00b4
+
+/* System Software Interrupt Request 3 Register */
+#define RM57_SYS_SSIR3_OFFSET 0x00b8
+
+/* System Software Interrupt Request 4 Register */
+#define RM57_SYS_SSIR4_OFFSET 0x00bc
+#define RM57_SYS_RAMGCR_OFFSET 0x00c0 /* RAM Control Register */
+
+/* Bus Matrix Module Control Register 1 */
+#define RM57_SYS_BMMCR1_OFFSET 0x00c4
+#define RM57_SYS_CPURSTCR_OFFSET 0x00cc /* CPU Reset Control Register */
+#define RM57_SYS_CLKCNTL_OFFSET 0x00d0 /* Clock Control Register */
+#define RM57_SYS_ECPCNTL_OFFSET 0x00d4 /* ECP Control Register */
+#define RM57_SYS_DEVCR1_OFFSET 0x00dc /* DEV Parity Control Register 1 */
+
+/* System Exception Control Register */
+#define RM57_SYS_SYSECR_OFFSET 0x00e0
+
+/* System Exception Status Register */
+#define RM57_SYS_SYSESR_OFFSET 0x00e4
+
+/* System Test Abort Status Register */
+#define RM57_SYS_SYSTASR_OFFSET 0x00e8
+#define RM57_SYS_GBLSTAT_OFFSET 0x00ec /* Global Status Register */
+
+/* Device Identification Register */
+#define RM57_SYS_DEVID_OFFSET 0x00f0
+
+/* Software Interrupt Vector Register */
+#define RM57_SYS_SSIVEC_OFFSET 0x00f4
+
+/* System Software Interrupt Flag Register */
+#define RM57_SYS_SSIF_OFFSET 0x00f8
+
+/* System Frame 2 Register Offsets ******************************************/
+
+#define RM57_SYS2_PLLCTL3_OFFSET 0x0000 /* PLL Control Register 3 */
+#define RM57_SYS2_STCCLKDIV_OFFSET 0x0008 /* STC Clock Divider Register */
+#define RM57_SYS2_ECPCNTL_OFFSET 0x0024 /* ECP Control Register */
+#define RM57_SYS2_ECPCNTL1_OFFSET 0x0028 /* ECP Control Register 1 */
+
+/* Peripheral Asynchronous Clock 2 Control Register */
+#define RM57_SYS2_CLK2CNTRL_OFFSET 0x003c
+
+/* Peripheral Asynchronous Clock Control Register */
+#define RM57_SYS2_VCLKACON1_OFFSET 0x0040
+#define RM57_SYS2_HCLKCNTL_OFFSET 0x0054 /* HCLK Control Register */
+#define RM57_SYS2_CLKSLIP_OFFSET 0x0070 /* Clock Slip Register */
+#define RM57_SYS2_EFC_CTLEN_OFFSET 0x00ec /* EFC Control Enable Register */
+
+/* Register Addresses (System Frame 1) **************************************/
+
+#define RM57_SYS_CSDIS (RM57_SYS1_BASE + RM57_SYS_CSDIS_OFFSET)
+#define RM57_SYS_CSDISSET (RM57_SYS1_BASE + RM57_SYS_CSDISSET_OFFSET)
+#define RM57_SYS_CSDISCLR (RM57_SYS1_BASE + RM57_SYS_CSDISCLR_OFFSET)
+#define RM57_SYS_CDDIS (RM57_SYS1_BASE + RM57_SYS_CDDIS_OFFSET)
+#define RM57_SYS_CDDISSET (RM57_SYS1_BASE + RM57_SYS_CDDISSET_OFFSET)
+#define RM57_SYS_CDDISCLR (RM57_SYS1_BASE + RM57_SYS_CDDISCLR_OFFSET)
+#define RM57_SYS_GHVSRC (RM57_SYS1_BASE + RM57_SYS_GHVSRC_OFFSET)
+#define RM57_SYS_VCLKASRC (RM57_SYS1_BASE + RM57_SYS_VCLKASRC_OFFSET)
+#define RM57_SYS_RCLKSRC (RM57_SYS1_BASE + RM57_SYS_RCLKSRC_OFFSET)
+#define RM57_SYS_CSVSTAT (RM57_SYS1_BASE + RM57_SYS_CSVSTAT_OFFSET)
+#define RM57_SYS_MSTGCR (RM57_SYS1_BASE + RM57_SYS_MSTGCR_OFFSET)
+#define RM57_SYS_MINITGCR (RM57_SYS1_BASE + RM57_SYS_MINITGCR_OFFSET)
+#define RM57_SYS_MSINENA (RM57_SYS1_BASE + RM57_SYS_MSINENA_OFFSET)
+#define RM57_SYS_MSTCGSTAT (RM57_SYS1_BASE + RM57_SYS_MSTCGSTAT_OFFSET)
+#define RM57_SYS_MINISTAT (RM57_SYS1_BASE + RM57_SYS_MINISTAT_OFFSET)
+#define RM57_SYS_PLLCTL1 (RM57_SYS1_BASE + RM57_SYS_PLLCTL1_OFFSET)
+#define RM57_SYS_PLLCTL2 (RM57_SYS1_BASE + RM57_SYS_PLLCTL2_OFFSET)
+#define RM57_SYS_GPREG1 (RM57_SYS1_BASE + RM57_SYS_GPREG1_OFFSET)
+#define RM57_SYS_RAMGCR (RM57_SYS1_BASE + RM57_SYS_RAMGCR_OFFSET)
+#define RM57_SYS_CPURSTCR (RM57_SYS1_BASE + RM57_SYS_CPURSTCR_OFFSET)
+#define RM57_SYS_CLKCNTL (RM57_SYS1_BASE + RM57_SYS_CLKCNTL_OFFSET)
+#define RM57_SYS_SYSPC1 (RM57_SYS1_BASE + RM57_SYS_SYSPC1_OFFSET)
+#define RM57_SYS_ECPCNTL (RM57_SYS1_BASE + RM57_SYS_ECPCNTL_OFFSET)
+#define RM57_SYS_SYSECR (RM57_SYS1_BASE + RM57_SYS_SYSECR_OFFSET)
+#define RM57_SYS_SYSESR (RM57_SYS1_BASE + RM57_SYS_SYSESR_OFFSET)
+#define RM57_SYS_GBLSTAT (RM57_SYS1_BASE + RM57_SYS_GBLSTAT_OFFSET)
+#define RM57_SYS_DEVID (RM57_SYS1_BASE + RM57_SYS_DEVID_OFFSET)
+
+/* Register Addresses (System Frame 2) **************************************/
+
+#define RM57_SYS2_PLLCTL3 (RM57_SYS2_BASE + RM57_SYS2_PLLCTL3_OFFSET)
+#define RM57_SYS2_STCCLKDIV (RM57_SYS2_BASE + RM57_SYS2_STCCLKDIV_OFFSET)
+#define RM57_SYS2_CLK2CNTRL (RM57_SYS2_BASE + RM57_SYS2_CLK2CNTRL_OFFSET)
+#define RM57_SYS2_VCLKACON1 (RM57_SYS2_BASE + RM57_SYS2_VCLKACON1_OFFSET)
+#define RM57_SYS2_HCLKCNTL (RM57_SYS2_BASE + RM57_SYS2_HCLKCNTL_OFFSET)
+
+/* Register Bit-Field Definitions *******************************************/
+
+/* Clock Source Disable / Domain Disable Registers */
+
+#define SYS_CSDIS_CLKSR0OFF (1 << 0) /* Bit 0: Oscillator */
+#define SYS_CSDIS_CLKSR1OFF (1 << 1) /* Bit 1: PLL1 */
+#define SYS_CSDIS_CLKSR3OFF (1 << 3) /* Bit 3: External clock in */
+#define SYS_CSDIS_CLKSR4OFF (1 << 4) /* Bit 4: Low-freq LPO */
+#define SYS_CSDIS_CLKSR5OFF (1 << 5) /* Bit 5: High-freq LPO */
+#define SYS_CSDIS_CLKSR6OFF (1 << 6) /* Bit 6: PLL2 */
+
+/* Bit 7: External clock in 2 */
+#define SYS_CSDIS_CLKSR7OFF (1 << 7)
+
+#define SYS_CDDIS_GCLKOFF (1 << 0) /* Bit 0: GCLK domain off */
+
+/* Bit 1: HCLK/VCLK_sys domains off */
+#define SYS_CDDIS_HCLKOFF (1 << 1)
+
+/* Bit 2: VCLK_periph domain off */
+#define SYS_CDDIS_VCLKPOFF (1 << 2)
+#define SYS_CDDIS_VCLK2OFF (1 << 3) /* Bit 3: VCLK2 domain off */
+#define SYS_CDDIS_VCLKA1OFF (1 << 4) /* Bit 4: VCLKA1 domain off */
+#define SYS_CDDIS_VCLKA2OFF (1 << 5) /* Bit 5: VCLKA2 domain off */
+#define SYS_CDDIS_RTICLK1OFF (1 << 6) /* Bit 6: RTICLK1 domain off */
+#define SYS_CDDIS_VCLK3OFF (1 << 8) /* Bit 8: VCLK3 domain off (EMAC MDIO bus clock) */
+#define SYS_CDDIS_VCLKA4OFF (1 << 11) /* Bit 11: VCLKA4 domain off (EMAC clock) */
+
+/* SYS Pin Control Register 1 (SYSPC1) and ECP Control Register (ECPCNTL).
+ *
+ * Together these drive the ECLK1 terminal, which on some boards is the
+ * only clock source an external device has (see BOARD_ECLK1_DIV in the
+ * board's board.h). SPNU562A Section 2.4.6.3: "The actual clock output
+ * on ECLK1 is enabled by setting the ECP CLK FUN bit of the SYSPC1
+ * control register. By default, the ECLK1 terminal is in GIO mode."
+ */
+
+#define SYS_SYSPC1_ECPCLKFUN (1 << 0) /* Bit 0: 0=GIO, 1=clock output */
+
+#define SYS_ECPCNTL_ECPDIV_SHIFT (0) /* Bits 0-15: ECLK = source/(ECPDIV+1) */
+#define SYS_ECPCNTL_ECPDIV_MASK (0xffff << SYS_ECPCNTL_ECPDIV_SHIFT)
+# define SYS_ECPCNTL_ECPDIV(n) ((uint32_t)(n) << SYS_ECPCNTL_ECPDIV_SHIFT)
+
+/* Bit 23: 0=ECLK stops in JTAG suspend, 1=ECLK keeps running */
+
+#define SYS_ECPCNTL_ECPCOS (1 << 23)
+
+/* Bit 24: 0=VCLK is the ECP clock source, 1=OSCIN */
+
+#define SYS_ECPCNTL_ECPSSEL (1 << 24)
+
+/* GCLK, HCLK, VCLK, VCLK2 Source Register clock source aliases */
+
+#define SYS_CLKSRC_OSC 0
+#define SYS_CLKSRC_PLL1 1
+#define SYS_CLKSRC_EXTERNAL1 3
+#define SYS_CLKSRC_LPOLOW 4
+#define SYS_CLKSRC_LPOHIGH 5
+#define SYS_CLKSRC_PLL2 6
+#define SYS_CLKSRC_EXTERNAL2 7
+#define SYS_CLKSRC_VCLK 9
+
+/* Bits 0-3: GCLK/HCLK/VCLK/VCLK2 current source */
+#define SYS_GHVSRC_GHVSRC_SHIFT (0)
+#define SYS_GHVSRC_GHVSRC_MASK (15 << SYS_GHVSRC_GHVSRC_SHIFT)
+# define SYS_GHVSRC_GHVSRC_SRC(n) ((uint32_t)(n) << SYS_GHVSRC_GHVSRC_SHIFT)
+
+/* Bits 16-19: HCLK/VCLK/VCLK2 source on wakeup */
+#define SYS_GHVSRC_HVLPM_SHIFT (16)
+#define SYS_GHVSRC_HVLPM_MASK (15 << SYS_GHVSRC_HVLPM_SHIFT)
+# define SYS_GHVSRC_HVLPM(n) ((uint32_t)(n) << SYS_GHVSRC_HVLPM_SHIFT)
+
+/* Bits 24-27: GCLK/HCLK/VCLK/VCLK2 source on wakeup */
+#define SYS_GHVSRC_GHVWAKE_SHIFT (24)
+#define SYS_GHVSRC_GHVWAKE_MASK (15 << SYS_GHVSRC_GHVWAKE_SHIFT)
+# define SYS_GHVSRC_GHVWAKE(n) ((uint32_t)(n) << SYS_GHVSRC_GHVWAKE_SHIFT)
+
+/* RTI Clock Source Register */
+
+/* Bits 0-3: RTI clock1 source */
+#define SYS_RCLKSRC_RTI1SRC_SHIFT (0)
+#define SYS_RCLKSRC_RTI1SRC_MASK (15 << SYS_RCLKSRC_RTI1SRC_SHIFT)
+# define SYS_RCLKSRC_RTI1SRC(n) ((uint32_t)(n) << SYS_RCLKSRC_RTI1SRC_SHIFT)
+
+/* Bits 8-9: RTI clock1 divider */
+#define SYS_RCLKSRC_RTI1DIV_SHIFT (8)
+#define SYS_RCLKSRC_RTI1DIV_MASK (3 << SYS_RCLKSRC_RTI1DIV_SHIFT)
+# define SYS_RCLKSRC_RTI1DIV_DIV1 (0 << SYS_RCLKSRC_RTI1DIV_SHIFT)
+# define SYS_RCLKSRC_RTI1DIV_DIV2 (1 << SYS_RCLKSRC_RTI1DIV_SHIFT)
+# define SYS_RCLKSRC_RTI1DIV_DIV4 (2 << SYS_RCLKSRC_RTI1DIV_SHIFT)
+# define SYS_RCLKSRC_RTI1DIV_DIV8 (3 << SYS_RCLKSRC_RTI1DIV_SHIFT)
+
+/* Peripheral Asynchronous Clock Source Register (VCLKASRC). VCLKA1 is
+ * the DCAN CAN_CLK; VCLKA2 feeds other asynchronous peripherals. Both
+ * take the SYS_CLKSRC_* encodings.
+ */
+
+/* Bits 0-3: VCLKA1 source */
+#define SYS_VCLKASRC_VCLKA1S_SHIFT (0)
+#define SYS_VCLKASRC_VCLKA1S_MASK (15 << SYS_VCLKASRC_VCLKA1S_SHIFT)
+# define SYS_VCLKASRC_VCLKA1S(n) ((uint32_t)(n) << SYS_VCLKASRC_VCLKA1S_SHIFT)
+
+/* Bits 8-11: VCLKA2 source */
+#define SYS_VCLKASRC_VCLKA2S_SHIFT (8)
+#define SYS_VCLKASRC_VCLKA2S_MASK (15 << SYS_VCLKASRC_VCLKA2S_SHIFT)
+# define SYS_VCLKASRC_VCLKA2S(n) ((uint32_t)(n) << SYS_VCLKASRC_VCLKA2S_SHIFT)
+
+/* Clock 2 Control Register (CLK2CNTRL). Only the VCLK3 ratio field is
+ * implemented on this device; bits 11-4 are reserved (HALCoGen writes a
+ * fixed pattern there for family-wide compatibility, but SPNU562A
+ * documents them as reserved on this part).
+ */
+
+/* Bits 0-3: VCLK3 ratio (VCLK3 = HCLK / (n + 1)). VCLK3 clocks the
+ * EMAC MDIO module's clock divider input.
+ */
+#define SYS2_CLK2CNTRL_VCLK3R_SHIFT (0)
+#define SYS2_CLK2CNTRL_VCLK3R_MASK (15 << SYS2_CLK2CNTRL_VCLK3R_SHIFT)
+# define SYS2_CLK2CNTRL_VCLK3R(n) ((uint32_t)(n) << SYS2_CLK2CNTRL_VCLK3R_SHIFT)
+
+/* Peripheral Asynchronous Clock Configuration 1 Register (VCLKACON1).
+ * Only the VCLKA4 fields (bits 26-16) are implemented on this device;
+ * bits 15-0 are reserved (this register's lower half carries a VCLKA3
+ * domain on other Hercules family members, but RM57L843 has no VCLKA3).
+ * VCLKA4_DIVR is the EMAC's internal logic clock (VCLKA4_DIVR_EMAC in
+ * SPNS215 Section 6.6.3): MII requires 25MHz, RMII requires 50MHz.
+ */
+
+/* Bits 19-16: VCLKA4 source. Values 0-7 select clock source0-7 (see
+ * SYS_CLKSRC_* aliases above); values 8h-Fh all select VCLK or a divided
+ * VCLK per the device-specific data manual (SPNS215 Table 6-17: 0x8-0xD
+ * = VCLK, 0xE = PLL2 post_ODCLK/8, 0xF = PLL2 post_ODCLK/16).
+ */
+#define SYS2_VCLKACON1_VCLKA4S_SHIFT (16)
+#define SYS2_VCLKACON1_VCLKA4S_MASK (15 << SYS2_VCLKACON1_VCLKA4S_SHIFT)
+# define SYS2_VCLKACON1_VCLKA4S(n) ((uint32_t)(n) << SYS2_VCLKACON1_VCLKA4S_SHIFT)
+
+/* Bit 20: disable the prescaled VCLKA4 clock on VCLKA4_DIVR */
+#define SYS2_VCLKACON1_VCLKA4_DIV_CDDIS (1 << 20)
+
+/* Bits 26-24: VCLKA4 divider (VCLKA4_DIVR = VCLKA4 / (n + 1)) */
+#define SYS2_VCLKACON1_VCLKA4R_SHIFT (24)
+#define SYS2_VCLKACON1_VCLKA4R_MASK (7 << SYS2_VCLKACON1_VCLKA4R_SHIFT)
+# define SYS2_VCLKACON1_VCLKA4R(n) ((uint32_t)(n) << SYS2_VCLKACON1_VCLKA4R_SHIFT)
+
+/* Memory Self-Test / Hardware Init Global Control Registers (ECC RAM init) */
+
+/* Bits 0-3: Memory self-test global enable key */
+#define SYS_MSTGCR_MSTGENA_SHIFT (0)
+#define SYS_MSTGCR_MSTGENA_MASK (15 << SYS_MSTGCR_MSTGENA_SHIFT)
+# define SYS_MSTGCR_MSTGENA_ENABLE (10 << SYS_MSTGCR_MSTGENA_SHIFT)
+# define SYS_MSTGCR_MSTGENA_DISABLE (5 << SYS_MSTGCR_MSTGENA_SHIFT)
+
+/* Bits 8-9: PBIST ROM clock prescaler. SPNU562A Table 2-39 divides GCLK1,
+ * SPNS215C 6.13.1 says HCLK; /4 stays under the 82.5 MHz ROM clock limit
+ * on either reading with GCLK1 at 300 MHz.
+ */
+#define SYS_MSTGCR_ROMDIV_SHIFT (8)
+#define SYS_MSTGCR_ROMDIV_MASK (3 << SYS_MSTGCR_ROMDIV_SHIFT)
+# define SYS_MSTGCR_ROMDIV_DIV1 (0 << SYS_MSTGCR_ROMDIV_SHIFT)
+# define SYS_MSTGCR_ROMDIV_DIV2 (1 << SYS_MSTGCR_ROMDIV_SHIFT)
+# define SYS_MSTGCR_ROMDIV_DIV4 (2 << SYS_MSTGCR_ROMDIV_SHIFT)
+# define SYS_MSTGCR_ROMDIV_DIV8 (3 << SYS_MSTGCR_ROMDIV_SHIFT)
+
+/* Memory Self-Test/Initialization Enable Register. In self-test mode
+ * bit 0 enables the (single) PBIST controller; in initialization mode
+ * each bit selects one memory for hardware auto-initialization.
+ */
+#define SYS_MSINENA_PBIST (1 << 0)
+#define SYS_MSINENA_L2RAM (1 << 0)
+
+/* Bits 0-7: Memory hardware init key */
+#define SYS_MINITGCR_MASK (0xff)
+# define SYS_MINITGCR_ENABLE (0x0a)
+# define SYS_MINITGCR_DISABLE (0x05)
+
+/* Bit 0: Memory self-test done */
+#define SYS_MSTCGSTAT_MSTDONE (1 << 0)
+
+/* Bit 8: Hardware init of all memory done */
+#define SYS_MSTCGSTAT_MINIDONE (1 << 8)
+
+/* PLL Control Register 1 */
+
+/* Bits 0-15: PLL multiplication factor */
+#define SYS_PLLCTL1_PLLMUL_SHIFT (0)
+#define SYS_PLLCTL1_PLLMUL_MASK (0xffff << SYS_PLLCTL1_PLLMUL_SHIFT)
+# define SYS_PLLCTL1_PLLMUL(n) ((uint32_t)(n) << SYS_PLLCTL1_PLLMUL_SHIFT)
+
+/* Bits 16-21: Reference clock divider */
+#define SYS_PLLCTL1_REFCLKDIV_SHIFT (16)
+#define SYS_PLLCTL1_REFCLKDIV_MASK (0x3f << SYS_PLLCTL1_REFCLKDIV_SHIFT)
+# define SYS_PLLCTL1_REFCLKDIV(n) ((uint32_t)(n) << \
+ SYS_PLLCTL1_REFCLKDIV_SHIFT)
+
+/* Bit 23: Reset on oscillator fail */
+#define SYS_PLLCTL1_ROF (1 << 23)
+
+/* Bits 24-28: PLL output clock divider */
+#define SYS_PLLCTL1_PLLDIV_SHIFT (24)
+#define SYS_PLLCTL1_PLLDIV_MASK (0x1f << SYS_PLLCTL1_PLLDIV_SHIFT)
+# define SYS_PLLCTL1_PLLDIV(n) ((uint32_t)(n) << SYS_PLLCTL1_PLLDIV_SHIFT)
+
+/* Bit 31: Reset on PLL slip */
+#define SYS_PLLCTL1_ROS (1 << 31)
+
+/* PLL Control Register 2 */
+
+/* Bits 0-8: Spreading amount */
+#define SYS_PLLCTL2_SPRAMOUNT_SHIFT (0)
+#define SYS_PLLCTL2_SPRAMOUNT_MASK (0xff << SYS_PLLCTL2_SPRAMOUNT_SHIFT)
+# define SYS_PLLCTL2_SPRAMOUNT(n) ((uint32_t)(n) << \
+ SYS_PLLCTL2_SPRAMOUNT_SHIFT)
+
+/* Bits 9-11: Internal PLL output divider */
+#define SYS_PLLCTL2_ODPLL_SHIFT (9)
+#define SYS_PLLCTL2_ODPLL_MASK (7 << SYS_PLLCTL2_ODPLL_SHIFT)
+# define SYS_PLLCTL2_ODPLL(n) ((uint32_t)(n) << SYS_PLLCTL2_ODPLL_SHIFT)
+
+/* Bits 12-20: Multiplier correction (freq modulation) */
+#define SYS_PLLCTL2_MULMOD_SHIFT (12)
+#define SYS_PLLCTL2_MULMOD_MASK (0x1ff << SYS_PLLCTL2_MULMOD_SHIFT)
+# define SYS_PLLCTL2_MULMOD(n) ((uint32_t)(n) << SYS_PLLCTL2_MULMOD_SHIFT)
+
+/* Bit 31: Frequency modulation enable */
+#define SYS_PLLCTL2_FMENA (1 << 31)
+
+/* PLL Control Register 3 (System Frame 2) */
+
+/* Bits 0-4: PLL2 output clock divider */
+#define SYS2_PLLCTL3_PLLDIV_SHIFT (0)
+#define SYS2_PLLCTL3_PLLDIV_MASK (0x1f << SYS2_PLLCTL3_PLLDIV_SHIFT)
+# define SYS2_PLLCTL3_PLLDIV(n) ((uint32_t)(n) << SYS2_PLLCTL3_PLLDIV_SHIFT)
+
+/* Bits 9-11: PLL2 internal output divider */
+#define SYS2_PLLCTL3_ODPLL2_SHIFT (9)
+#define SYS2_PLLCTL3_ODPLL2_MASK (7 << SYS2_PLLCTL3_ODPLL2_SHIFT)
+# define SYS2_PLLCTL3_ODPLL2(n) ((uint32_t)(n) << SYS2_PLLCTL3_ODPLL2_SHIFT)
+
+/* Bits 16-31: PLL2 multiplication factor */
+#define SYS2_PLLCTL3_PLLMUL2_SHIFT (16)
+#define SYS2_PLLCTL3_PLLMUL2_MASK (0xffff << SYS2_PLLCTL3_PLLMUL2_SHIFT)
+# define SYS2_PLLCTL3_PLLMUL2(n) ((uint32_t)(n) << \
+ SYS2_PLLCTL3_PLLMUL2_SHIFT)
+
+/* CPU Logic BIST Clock Prescaler (System Frame 2, offset 0x08). When
+ * non-zero this overrides the per-segment dividers in the STC module's own
+ * STCCLKDIV register.
+ */
+
+/* Bits 24-26: STCCLK = GCLK1 / (n + 1) */
+#define SYS2_STCCLKDIV_CLKDIV_SHIFT (24)
+#define SYS2_STCCLKDIV_CLKDIV_MASK (7 << SYS2_STCCLKDIV_CLKDIV_SHIFT)
+# define SYS2_STCCLKDIV_CLKDIV(n) ((uint32_t)(n) << \
+ SYS2_STCCLKDIV_CLKDIV_SHIFT)
+
+/* CPU Reset Control Register */
+
+/* Bit 0: Toggling resets the CPU only */
+#define SYS_CPURSTCR_CPURESET (1 << 0)
+
+/* System Exception Status Register (reset cause, all flags W1C). PORST
+ * survives every reset; the others read 0 after a power-on reset and are
+ * otherwise sticky, so more than one can be set at a time.
+ *
+ * Bit 6 is "reserved" in SPNU562A Figure 2-53 yet drawn as clearable, and
+ * TI's SafeTI library treats it as a second CPU reset flag on this part,
+ * so both are covered by SYS_SYSESR_CPURST_ALL.
+ */
+
+#define SYS_SYSESR_EXTRST (1 << 3) /* Bit 3: External (nRST) */
+#define SYS_SYSESR_SWRST (1 << 4) /* Bit 4: Software reset */
+#define SYS_SYSESR_CPURST (1 << 5) /* Bit 5: CPU reset (STC) */
+#define SYS_SYSESR_CPURST1 (1 << 6) /* Bit 6: See above */
+#define SYS_SYSESR_ICSTRST (1 << 7) /* Bit 7: Interconnect test */
+#define SYS_SYSESR_DBGRST (1 << 11) /* Bit 11: Debugger reset */
+#define SYS_SYSESR_WDRST (1 << 13) /* Bit 13: Watchdog reset */
+#define SYS_SYSESR_OSCRST (1 << 14) /* Bit 14: Osc fail/PLL slip */
+#define SYS_SYSESR_PORST (1 << 15) /* Bit 15: Power-on reset */
+
+#define SYS_SYSESR_CPURST_ALL (SYS_SYSESR_CPURST | SYS_SYSESR_CPURST1)
+#define SYS_SYSESR_ALL (0xe8f8)
+
+/* System Exception Control Register (software reset) */
+
+/* Bit 15: Software reset request */
+#define SYS_SYSECR_RESET (1 << 15)
+
+#endif /* __ARCH_ARM_SRC_RM57_HARDWARE_RM57_SYS_H */
diff --git a/arch/arm/src/rm57/hardware/rm57_vim.h b/arch/arm/src/rm57/hardware/rm57_vim.h
new file mode 100644
index 00000000000..63144d9f142
--- /dev/null
+++ b/arch/arm/src/rm57/hardware/rm57_vim.h
@@ -0,0 +1,213 @@
+/****************************************************************************
+ * arch/arm/src/rm57/hardware/rm57_vim.h
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/* Register layout taken from TI's HALCoGen HL_reg_vim.h for
+ * RM57L843. Note RM57's VIM register frame (0xfffffd00) is at a
+ * different address than TMS570LS04x's VIM (0xfffffe00) - do not assume
+ * parity with the sibling tms570_vim.h.
+ */
+
+#ifndef __ARCH_ARM_SRC_RM57_HARDWARE_RM57_VIM_H
+#define __ARCH_ARM_SRC_RM57_HARDWARE_RM57_VIM_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include "hardware/rm57l843_memorymap.h"
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* VIM has 128 total channel slots: one phantom + 127 real channels
+ * (channel 127 has no dedicated vector, per the HALCoGen s_vim_init table)
+ */
+
+#define VIM_CHANNELS 128
+
+/* Helpers for indexing into the 4 groups of 32-bit-per-channel
+ * registers (FIRQPRn/INTREQn/REQMASKSETn/REQMASKCLRn/WAKEMASKSETn/
+ * WAKEMASKCLRn)
+ */
+
+#define VIM_REGNDX(ch) ((ch) >> 5)
+#define VIM_REGBIT(ch) ((ch) & 31)
+
+/* Register Offsets *********************************************************/
+
+#define RM57_VIM_ECCSTAT_OFFSET 0x00ec /* ECC Status Register */
+#define RM57_VIM_ECCCTL_OFFSET 0x00f0 /* ECC Control Register */
+
+/* Uncorrectable Error Address Register */
+#define RM57_VIM_UERRADDR_OFFSET 0x00f4
+
+/* Fall-Back Address Register */
+#define RM57_VIM_FBVECADDR_OFFSET 0x00f8
+
+/* Single Bit Error Address Register */
+#define RM57_VIM_SBERRADDR_OFFSET 0x00fc
+
+/* IRQ Index Offset Vector Register */
+#define RM57_VIM_IRQINDEX_OFFSET 0x0100
+
+/* FIQ Index Offset Vector Register */
+#define RM57_VIM_FIQINDEX_OFFSET 0x0104
+
+/* FIQ/IRQ Program Register 0 */
+#define RM57_VIM_FIRQPR0_OFFSET 0x0110
+
+/* FIQ/IRQ Program Register 1 */
+#define RM57_VIM_FIRQPR1_OFFSET 0x0114
+
+/* FIQ/IRQ Program Register 2 */
+#define RM57_VIM_FIRQPR2_OFFSET 0x0118
+
+/* FIQ/IRQ Program Register 3 */
+#define RM57_VIM_FIRQPR3_OFFSET 0x011c
+
+/* Pending Interrupt Read Location Register 0 */
+#define RM57_VIM_INTREQ0_OFFSET 0x0120
+
+/* Pending Interrupt Read Location Register 1 */
+#define RM57_VIM_INTREQ1_OFFSET 0x0124
+
+/* Pending Interrupt Read Location Register 2 */
+#define RM57_VIM_INTREQ2_OFFSET 0x0128
+
+/* Pending Interrupt Read Location Register 3 */
+#define RM57_VIM_INTREQ3_OFFSET 0x012c
+
+/* Interrupt Enable Set Register 0 */
+#define RM57_VIM_REQMASKSET0_OFFSET 0x0130
+
+/* Interrupt Enable Set Register 1 */
+#define RM57_VIM_REQMASKSET1_OFFSET 0x0134
+
+/* Interrupt Enable Set Register 2 */
+#define RM57_VIM_REQMASKSET2_OFFSET 0x0138
+
+/* Interrupt Enable Set Register 3 */
+#define RM57_VIM_REQMASKSET3_OFFSET 0x013c
+
+/* Interrupt Enable Clear Register 0 */
+#define RM57_VIM_REQMASKCLR0_OFFSET 0x0140
+
+/* Interrupt Enable Clear Register 1 */
+#define RM57_VIM_REQMASKCLR1_OFFSET 0x0144
+
+/* Interrupt Enable Clear Register 2 */
+#define RM57_VIM_REQMASKCLR2_OFFSET 0x0148
+
+/* Interrupt Enable Clear Register 3 */
+#define RM57_VIM_REQMASKCLR3_OFFSET 0x014c
+
+/* Wake-up Enable Set Register 0 */
+#define RM57_VIM_WAKEMASKSET0_OFFSET 0x0150
+
+/* Wake-up Enable Set Register 1 */
+#define RM57_VIM_WAKEMASKSET1_OFFSET 0x0154
+
+/* Wake-up Enable Set Register 2 */
+#define RM57_VIM_WAKEMASKSET2_OFFSET 0x0158
+
+/* Wake-up Enable Set Register 3 */
+#define RM57_VIM_WAKEMASKSET3_OFFSET 0x015c
+
+/* Wake-up Enable Clear Register 0 */
+#define RM57_VIM_WAKEMASKCLR0_OFFSET 0x0160
+
+/* Wake-up Enable Clear Register 1 */
+#define RM57_VIM_WAKEMASKCLR1_OFFSET 0x0164
+
+/* Wake-up Enable Clear Register 2 */
+#define RM57_VIM_WAKEMASKCLR2_OFFSET 0x0168
+
+/* Wake-up Enable Clear Register 3 */
+#define RM57_VIM_WAKEMASKCLR3_OFFSET 0x016c
+
+/* IRQ Interrupt Vector Register */
+#define RM57_VIM_IRQVECREG_OFFSET 0x0170
+
+/* FIQ Interrupt Vector Register */
+#define RM57_VIM_FIQVECREG_OFFSET 0x0174
+#define RM57_VIM_CAPEVT_OFFSET 0x0178 /* Capture Event Register */
+
+/* Channel Control Register n/4, n=0..31 */
+#define RM57_VIM_CHANCTRL_OFFSET(n) (0x0180 + (((n) >> 2) << 2))
+
+/* Register Addresses *******************************************************/
+
+#define RM57_VIM_ECCSTAT (RM57_VIM_BASE + RM57_VIM_ECCSTAT_OFFSET)
+#define RM57_VIM_ECCCTL (RM57_VIM_BASE + RM57_VIM_ECCCTL_OFFSET)
+#define RM57_VIM_UERRADDR (RM57_VIM_BASE + RM57_VIM_UERRADDR_OFFSET)
+#define RM57_VIM_FBVECADDR (RM57_VIM_BASE + RM57_VIM_FBVECADDR_OFFSET)
+#define RM57_VIM_SBERRADDR (RM57_VIM_BASE + RM57_VIM_SBERRADDR_OFFSET)
+#define RM57_VIM_IRQINDEX (RM57_VIM_BASE + RM57_VIM_IRQINDEX_OFFSET)
+#define RM57_VIM_FIQINDEX (RM57_VIM_BASE + RM57_VIM_FIQINDEX_OFFSET)
+#define RM57_VIM_FIRQPR0 (RM57_VIM_BASE + RM57_VIM_FIRQPR0_OFFSET)
+#define RM57_VIM_FIRQPR1 (RM57_VIM_BASE + RM57_VIM_FIRQPR1_OFFSET)
+#define RM57_VIM_FIRQPR2 (RM57_VIM_BASE + RM57_VIM_FIRQPR2_OFFSET)
+#define RM57_VIM_FIRQPR3 (RM57_VIM_BASE + RM57_VIM_FIRQPR3_OFFSET)
+#define RM57_VIM_INTREQ0 (RM57_VIM_BASE + RM57_VIM_INTREQ0_OFFSET)
+#define RM57_VIM_INTREQ1 (RM57_VIM_BASE + RM57_VIM_INTREQ1_OFFSET)
+#define RM57_VIM_INTREQ2 (RM57_VIM_BASE + RM57_VIM_INTREQ2_OFFSET)
+#define RM57_VIM_INTREQ3 (RM57_VIM_BASE + RM57_VIM_INTREQ3_OFFSET)
+#define RM57_VIM_REQMASKSET0 (RM57_VIM_BASE + RM57_VIM_REQMASKSET0_OFFSET)
+#define RM57_VIM_REQMASKSET1 (RM57_VIM_BASE + RM57_VIM_REQMASKSET1_OFFSET)
+#define RM57_VIM_REQMASKSET2 (RM57_VIM_BASE + RM57_VIM_REQMASKSET2_OFFSET)
+#define RM57_VIM_REQMASKSET3 (RM57_VIM_BASE + RM57_VIM_REQMASKSET3_OFFSET)
+#define RM57_VIM_REQMASKCLR0 (RM57_VIM_BASE + RM57_VIM_REQMASKCLR0_OFFSET)
+#define RM57_VIM_REQMASKCLR1 (RM57_VIM_BASE + RM57_VIM_REQMASKCLR1_OFFSET)
+#define RM57_VIM_REQMASKCLR2 (RM57_VIM_BASE + RM57_VIM_REQMASKCLR2_OFFSET)
+#define RM57_VIM_REQMASKCLR3 (RM57_VIM_BASE + RM57_VIM_REQMASKCLR3_OFFSET)
+#define RM57_VIM_IRQVECREG (RM57_VIM_BASE + RM57_VIM_IRQVECREG_OFFSET)
+#define RM57_VIM_FIQVECREG (RM57_VIM_BASE + RM57_VIM_FIQVECREG_OFFSET)
+#define RM57_VIM_CAPEVT (RM57_VIM_BASE + RM57_VIM_CAPEVT_OFFSET)
+#define RM57_VIM_CHANCTRL(n) (RM57_VIM_BASE + RM57_VIM_CHANCTRL_OFFSET(n))
+
+/* Generic register-group accessors, indexed by VIM_REGNDX(channel) */
+
+#define RM57_VIM_FIRQPR(n) (RM57_VIM_BASE + 0x0110 + ((n) << 2))
+#define RM57_VIM_REQMASKSET(n) (RM57_VIM_BASE + 0x0130 + ((n) << 2))
+#define RM57_VIM_REQMASKCLR(n) (RM57_VIM_BASE + 0x0140 + ((n) << 2))
+
+/* Register Bit-Field Definitions *******************************************/
+
+/* ECC Control Register: default HALCoGen init value, Errata VIM#28
+ * workaround (disable single-bit correction)
+ */
+
+#define VIM_ECCCTL_INIT (((uint32_t)0xa << 0) | ((uint32_t)0x5 << 16))
+
+/* FIQ/IRQ Program Registers: 0 = IRQ, 1 = FIQ (per channel bit) */
+
+#define VIM_FIRQPR_IRQ 0
+#define VIM_FIRQPR_FIQ 1
+
+/* IRQ/FIQ Index Offset Vector Registers */
+
+#define VIM_IRQINDEX_MASK (0x000000ff)
+#define VIM_FIQINDEX_MASK (0x000000ff)
+
+#endif /* __ARCH_ARM_SRC_RM57_HARDWARE_RM57_VIM_H */
diff --git a/arch/arm/src/rm57/hardware/rm57l843_memorymap.h b/arch/arm/src/rm57/hardware/rm57l843_memorymap.h
new file mode 100644
index 00000000000..8e11ef146ce
--- /dev/null
+++ b/arch/arm/src/rm57/hardware/rm57l843_memorymap.h
@@ -0,0 +1,151 @@
+/****************************************************************************
+ * arch/arm/src/rm57/hardware/rm57l843_memorymap.h
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/* Base addresses below are taken directly from TI's HALCoGen-generated
+ * register headers for RM57L843, not assumed from TMS570
+ * parity - several peripheral base addresses differ between the two
+ * Hercules generations (VIM, PCR, and pinmux in particular).
+ */
+
+#ifndef __ARCH_ARM_SRC_RM57_HARDWARE_RM57L843_MEMORYMAP_H
+#define __ARCH_ARM_SRC_RM57_HARDWARE_RM57L843_MEMORYMAP_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* Memory Map Overview */
+
+/* 0x00000000-0x003fffff: Program FLASH (4MB) */
+#define RM57_FLASH_BASE 0x00000000
+
+/* 0x08000000-0x0807ffff: RAM (512KB) */
+#define RM57_RAM_BASE 0x08000000
+
+/* Peripheral Control Registers */
+
+#define RM57_GIO_BASE 0xfff7bc00 /* GIO */
+#define RM57_GIO_PORTA_BASE 0xfff7bc34 /* GIO Port A */
+#define RM57_GIO_PORTB_BASE 0xfff7bc54 /* GIO Port B */
+#define RM57_ADC1_BASE 0xfff7c000 /* MibADC1 */
+#define RM57_ADC2_BASE 0xfff7c200 /* MibADC2 */
+#define RM57_I2C1_BASE 0xfff7d400 /* I2C1 */
+#define RM57_I2C2_BASE 0xfff7d500 /* I2C2 */
+#define RM57_DCAN1_BASE 0xfff7dc00 /* DCAN1 */
+#define RM57_DCAN2_BASE 0xfff7de00 /* DCAN2 */
+#define RM57_DCAN3_BASE 0xfff7e000 /* DCAN3 */
+#define RM57_DCAN4_BASE 0xfff7e200 /* DCAN4 */
+#define RM57_SCI1_BASE 0xfff7e400 /* SCI1/LIN1 */
+#define RM57_SCI1_PORT_BASE 0xfff7e440 /* SCI1 GIO port */
+#define RM57_SCI3_BASE 0xfff7e500 /* SCI3 */
+#define RM57_SCI3_PORT_BASE 0xfff7e540 /* SCI3 GIO port */
+#define RM57_SCI2_BASE 0xfff7e600 /* SCI2 */
+#define RM57_SCI2_PORT_BASE 0xfff7e640 /* SCI2 GIO port */
+#define RM57_SCI4_BASE 0xfff7e700 /* SCI4 */
+#define RM57_SCI4_PORT_BASE 0xfff7e740 /* SCI4 GIO port */
+#define RM57_MIBSPI1_BASE 0xfff7f400 /* MibSPI1 */
+#define RM57_MIBSPI2_BASE 0xfff7f600 /* MibSPI2 */
+#define RM57_MIBSPI3_BASE 0xfff7f800 /* MibSPI3 */
+#define RM57_MIBSPI4_BASE 0xfff7fa00 /* MibSPI4 */
+#define RM57_MIBSPI5_BASE 0xfff7fc00 /* MibSPI5 */
+
+/* MibSPI multi-buffer RAM: the transmit bank followed by the receive bank,
+ * accessible only once the module is in multi-buffer mode.
+ */
+
+#define RM57_MIBSPI4_RAM_BASE 0xff060000 /* MibSPI4 buffer RAM */
+#define RM57_MIBSPI2_RAM_BASE 0xff080000 /* MibSPI2 buffer RAM */
+#define RM57_MIBSPI5_RAM_BASE 0xff0a0000 /* MibSPI5 buffer RAM */
+#define RM57_MIBSPI3_RAM_BASE 0xff0c0000 /* MibSPI3 buffer RAM */
+#define RM57_MIBSPI1_RAM_BASE 0xff0e0000 /* MibSPI1 buffer RAM */
+
+/* DCAN message RAM. Memory mapped only in Debug/Suspend or RAM Direct
+ * Access mode; normal accesses go through the DCAN IFx register sets.
+ */
+
+#define RM57_DCAN4_RAM_BASE 0xff180000 /* DCAN4 mailbox RAM */
+#define RM57_DCAN3_RAM_BASE 0xff1a0000 /* DCAN3 mailbox RAM */
+#define RM57_DCAN2_RAM_BASE 0xff1c0000 /* DCAN2 mailbox RAM */
+#define RM57_DCAN1_RAM_BASE 0xff1e0000 /* DCAN1 mailbox RAM */
+
+/* MibADC conversion results RAM. 64 words per module, partitioned between
+ * the Event/Group1/Group2 conversion groups by ADBNDCR. The parity bits are
+ * mapped 4KB above the RAM base and are only writable while ADPARCR.TEST is
+ * set. The look-up tables used by the enhanced channel selection mode sit
+ * 8KB above the RAM base; only ADC1 implements that mode (TRM SPNU562A
+ * sections 22.2.2.2.2 and 22.2.7).
+ */
+
+#define RM57_ADC2_RAM_BASE 0xff3a0000 /* ADC2 results RAM */
+#define RM57_ADC2_PARRAM_BASE 0xff3a1000 /* ADC2 results RAM parity */
+#define RM57_ADC1_RAM_BASE 0xff3e0000 /* ADC1 results RAM */
+#define RM57_ADC1_PARRAM_BASE 0xff3e1000 /* ADC1 results RAM parity */
+#define RM57_ADC1_LUT_BASE 0xff3e2000 /* ADC1 channel select LUT */
+
+/* System Modules Control Registers and Memories */
+
+#define RM57_DMARAM_BASE 0xfff80000 /* DMA control packet RAM */
+#define RM57_VIMRAM_BASE 0xfff82000 /* VIM RAM */
+#define RM57_FWRAP_BASE 0xfff87000 /* Flash Wrapper */
+#define RM57_PCR1_BASE 0xffff1000 /* PCR frame 1 */
+
+#define RM57_IOMM_BASE 0xffff1c00 /* I/O mux and control */
+#define RM57_PCR3_BASE 0xfff78000 /* PCR frame 3 */
+
+/* PCR frame 2, mirrored bus */
+#define RM57_PCR2_BASE 0xfcff1000
+
+/* System Module - Frame 2 */
+#define RM57_SYS2_BASE 0xffffe100
+#define RM57_PBIST_BASE 0xffffe400 /* PBIST controller */
+#define RM57_STC1_BASE 0xffffe600 /* STC1: CPU LBIST */
+#define RM57_STC2_BASE 0xffff0800 /* STC2: N2HET LBIST */
+#define RM57_EFC_BASE 0xfff8c000 /* eFuse controller */
+#define RM57_ESM_BASE 0xfffff500 /* ESM */
+#define RM57_CCM_BASE 0xfffff600 /* CCM-R5F */
+#define RM57_L2RAMW_BASE 0xfffff900 /* Level 2 RAM wrapper */
+#define RM57_RTI1_BASE 0xfffffc00 /* RTI + DWWD */
+#define RM57_VIM_BASE 0xfffffd00 /* VIM */
+
+/* System Module - Frame 1 */
+#define RM57_SYS1_BASE 0xffffff00
+#define RM57_ECLK_PORT_BASE 0xffffff04 /* ECLK GIO port */
+#define RM57_DMA_BASE 0xfffff000 /* DMA control registers */
+
+/* Ethernet (EMAC / EMAC Control / MDIO). These live under PCR2's PS[29]-
+ * PS[31] segments and the CPPI RAM under PCR2's PCS[41] segment - outside
+ * every other peripheral base in this file, which is why they are not
+ * grouped with the PCR1-gated peripherals above.
+ */
+
+#define RM57_EMAC_CPPI_RAM_BASE 0xfc520000 /* Ethernet CPPI descriptor RAM */
+#define RM57_EMAC_BASE 0xfcf78000 /* EMAC */
+#define RM57_EMAC_CTRL_BASE 0xfcf78800 /* EMAC Control */
+#define RM57_MDIO_BASE 0xfcf78900 /* MDIO */
+
+#endif /* __ARCH_ARM_SRC_RM57_HARDWARE_RM57L843_MEMORYMAP_H */
diff --git a/arch/arm/src/rm57/hardware/rm57l843_pinmux.h b/arch/arm/src/rm57/hardware/rm57l843_pinmux.h
new file mode 100644
index 00000000000..83ee962bea2
--- /dev/null
+++ b/arch/arm/src/rm57/hardware/rm57l843_pinmux.h
@@ -0,0 +1,3881 @@
+/****************************************************************************
+ * arch/arm/src/rm57/hardware/rm57l843_pinmux.h
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/* References:
+ * RM57Lx 16/32-Bit RISC Flash Microcontroller, Technical Reference Manual,
+ * Texas Instruments, Literature Number: SPNU562
+ *
+ * The pin function encodings below were converted from TI's HALCoGen
+ * output for RM57L843 for the 337-ball ZWT
+ * package. HALCoGen's header supplies only the bit position of each field;
+ * the PINMMR register index of every field comes from the assignments in
+ * its muxInit().
+ *
+ * Each definition below describes one function of one ball (or one input
+ * signal source, or one special-function setting) as the triple needed by
+ * struct rm57_pinmux_s:
+ *
+ * _PINMMR Index of the PINMMR register holding the field
+ * _SHIFT Bit position of the field within that register
+ * _VALUE Field value selecting this function
+ * _PIN Brace initializer combining the three
+ *
+ * A ball is left in its reset (default) function unless a definition for
+ * one of its alternate functions is placed in the board pin-mux table, so
+ * only the pins a board actually re-purposes need to be listed there.
+ */
+
+#ifndef __ARCH_ARM_SRC_RM57_HARDWARE_RM57L843_PINMUX_H
+#define __ARCH_ARM_SRC_RM57_HARDWARE_RM57L843_PINMUX_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* Output Pin Multiplexing (PINMMR0-37) *************************************/
+
+/* One 8-bit field per multiplexed ball. The functions available on each
+ * ball are listed above its definitions, ordered by field value; the
+ * function with value 0x01 is the reset default for most balls.
+ */
+
+/* PINMMR0: N19[0], D4[8], D5[16], C4[24] */
+
+/* Ball N19: AD1EVT (0x01), MII_RX_ER (0x04), RMII_RX_ER (0x08), nTZ1_1
+ * (0x20)
+ */
+
+#define PINMUX_N19_AD1EVT_PINMMR 0
+#define PINMUX_N19_AD1EVT_SHIFT 0
+#define PINMUX_N19_AD1EVT_VALUE 0x01
+#define PINMUX_N19_AD1EVT_PIN {0, 0, 0x01}
+
+#define PINMUX_N19_MII_RX_ER_PINMMR 0
+#define PINMUX_N19_MII_RX_ER_SHIFT 0
+#define PINMUX_N19_MII_RX_ER_VALUE 0x04
+#define PINMUX_N19_MII_RX_ER_PIN {0, 0, 0x04}
+
+#define PINMUX_N19_RMII_RX_ER_PINMMR 0
+#define PINMUX_N19_RMII_RX_ER_SHIFT 0
+#define PINMUX_N19_RMII_RX_ER_VALUE 0x08
+#define PINMUX_N19_RMII_RX_ER_PIN {0, 0, 0x08}
+
+#define PINMUX_N19_NTZ1_1_PINMMR 0
+#define PINMUX_N19_NTZ1_1_SHIFT 0
+#define PINMUX_N19_NTZ1_1_VALUE 0x20
+#define PINMUX_N19_NTZ1_1_PIN {0, 0, 0x20}
+
+/* Ball D4: EMIF_ADDR_00 (0x01), N2HET2_01 (0x04) */
+
+#define PINMUX_D4_EMIF_ADDR_00_PINMMR 0
+#define PINMUX_D4_EMIF_ADDR_00_SHIFT 8
+#define PINMUX_D4_EMIF_ADDR_00_VALUE 0x01
+#define PINMUX_D4_EMIF_ADDR_00_PIN {0, 8, 0x01}
+
+#define PINMUX_D4_N2HET2_01_PINMMR 0
+#define PINMUX_D4_N2HET2_01_SHIFT 8
+#define PINMUX_D4_N2HET2_01_VALUE 0x04
+#define PINMUX_D4_N2HET2_01_PIN {0, 8, 0x04}
+
+/* Ball D5: EMIF_ADDR_01 (0x01), N2HET2_03 (0x04) */
+
+#define PINMUX_D5_EMIF_ADDR_01_PINMMR 0
+#define PINMUX_D5_EMIF_ADDR_01_SHIFT 16
+#define PINMUX_D5_EMIF_ADDR_01_VALUE 0x01
+#define PINMUX_D5_EMIF_ADDR_01_PIN {0, 16, 0x01}
+
+#define PINMUX_D5_N2HET2_03_PINMMR 0
+#define PINMUX_D5_N2HET2_03_SHIFT 16
+#define PINMUX_D5_N2HET2_03_VALUE 0x04
+#define PINMUX_D5_N2HET2_03_PIN {0, 16, 0x04}
+
+/* Ball C4: EMIF_ADDR_06 (0x01), RTP_DATA_13 (0x02), N2HET2_11 (0x04) */
+
+#define PINMUX_C4_EMIF_ADDR_06_PINMMR 0
+#define PINMUX_C4_EMIF_ADDR_06_SHIFT 24
+#define PINMUX_C4_EMIF_ADDR_06_VALUE 0x01
+#define PINMUX_C4_EMIF_ADDR_06_PIN {0, 24, 0x01}
+
+#define PINMUX_C4_RTP_DATA_13_PINMMR 0
+#define PINMUX_C4_RTP_DATA_13_SHIFT 24
+#define PINMUX_C4_RTP_DATA_13_VALUE 0x02
+#define PINMUX_C4_RTP_DATA_13_PIN {0, 24, 0x02}
+
+#define PINMUX_C4_N2HET2_11_PINMMR 0
+#define PINMUX_C4_N2HET2_11_SHIFT 24
+#define PINMUX_C4_N2HET2_11_VALUE 0x04
+#define PINMUX_C4_N2HET2_11_PIN {0, 24, 0x04}
+
+/* PINMMR1: C5[0], C6[8], C7[16], C8[24] */
+
+/* Ball C5: EMIF_ADDR_07 (0x01), RTP_DATA_12 (0x02), N2HET2_13 (0x04) */
+
+#define PINMUX_C5_EMIF_ADDR_07_PINMMR 1
+#define PINMUX_C5_EMIF_ADDR_07_SHIFT 0
+#define PINMUX_C5_EMIF_ADDR_07_VALUE 0x01
+#define PINMUX_C5_EMIF_ADDR_07_PIN {1, 0, 0x01}
+
+#define PINMUX_C5_RTP_DATA_12_PINMMR 1
+#define PINMUX_C5_RTP_DATA_12_SHIFT 0
+#define PINMUX_C5_RTP_DATA_12_VALUE 0x02
+#define PINMUX_C5_RTP_DATA_12_PIN {1, 0, 0x02}
+
+#define PINMUX_C5_N2HET2_13_PINMMR 1
+#define PINMUX_C5_N2HET2_13_SHIFT 0
+#define PINMUX_C5_N2HET2_13_VALUE 0x04
+#define PINMUX_C5_N2HET2_13_PIN {1, 0, 0x04}
+
+/* Ball C6: EMIF_ADDR_08 (0x01), RTP_DATA_11 (0x02), N2HET2_15 (0x04) */
+
+#define PINMUX_C6_EMIF_ADDR_08_PINMMR 1
+#define PINMUX_C6_EMIF_ADDR_08_SHIFT 8
+#define PINMUX_C6_EMIF_ADDR_08_VALUE 0x01
+#define PINMUX_C6_EMIF_ADDR_08_PIN {1, 8, 0x01}
+
+#define PINMUX_C6_RTP_DATA_11_PINMMR 1
+#define PINMUX_C6_RTP_DATA_11_SHIFT 8
+#define PINMUX_C6_RTP_DATA_11_VALUE 0x02
+#define PINMUX_C6_RTP_DATA_11_PIN {1, 8, 0x02}
+
+#define PINMUX_C6_N2HET2_15_PINMMR 1
+#define PINMUX_C6_N2HET2_15_SHIFT 8
+#define PINMUX_C6_N2HET2_15_VALUE 0x04
+#define PINMUX_C6_N2HET2_15_PIN {1, 8, 0x04}
+
+/* Ball C7: EMIF_ADDR_09 (0x01), RTP_DATA_10 (0x02) */
+
+#define PINMUX_C7_EMIF_ADDR_09_PINMMR 1
+#define PINMUX_C7_EMIF_ADDR_09_SHIFT 16
+#define PINMUX_C7_EMIF_ADDR_09_VALUE 0x01
+#define PINMUX_C7_EMIF_ADDR_09_PIN {1, 16, 0x01}
+
+#define PINMUX_C7_RTP_DATA_10_PINMMR 1
+#define PINMUX_C7_RTP_DATA_10_SHIFT 16
+#define PINMUX_C7_RTP_DATA_10_VALUE 0x02
+#define PINMUX_C7_RTP_DATA_10_PIN {1, 16, 0x02}
+
+/* Ball C8: EMIF_ADDR_10 (0x01), RTP_DATA_09 (0x02) */
+
+#define PINMUX_C8_EMIF_ADDR_10_PINMMR 1
+#define PINMUX_C8_EMIF_ADDR_10_SHIFT 24
+#define PINMUX_C8_EMIF_ADDR_10_VALUE 0x01
+#define PINMUX_C8_EMIF_ADDR_10_PIN {1, 24, 0x01}
+
+#define PINMUX_C8_RTP_DATA_09_PINMMR 1
+#define PINMUX_C8_RTP_DATA_09_SHIFT 24
+#define PINMUX_C8_RTP_DATA_09_VALUE 0x02
+#define PINMUX_C8_RTP_DATA_09_PIN {1, 24, 0x02}
+
+/* PINMMR2: C9[0], C10[8], C11[16], C12[24] */
+
+/* Ball C9: EMIF_ADDR_11 (0x01), RTP_DATA_08 (0x02) */
+
+#define PINMUX_C9_EMIF_ADDR_11_PINMMR 2
+#define PINMUX_C9_EMIF_ADDR_11_SHIFT 0
+#define PINMUX_C9_EMIF_ADDR_11_VALUE 0x01
+#define PINMUX_C9_EMIF_ADDR_11_PIN {2, 0, 0x01}
+
+#define PINMUX_C9_RTP_DATA_08_PINMMR 2
+#define PINMUX_C9_RTP_DATA_08_SHIFT 0
+#define PINMUX_C9_RTP_DATA_08_VALUE 0x02
+#define PINMUX_C9_RTP_DATA_08_PIN {2, 0, 0x02}
+
+/* Ball C10: EMIF_ADDR_12 (0x01), RTP_DATA_06 (0x02) */
+
+#define PINMUX_C10_EMIF_ADDR_12_PINMMR 2
+#define PINMUX_C10_EMIF_ADDR_12_SHIFT 8
+#define PINMUX_C10_EMIF_ADDR_12_VALUE 0x01
+#define PINMUX_C10_EMIF_ADDR_12_PIN {2, 8, 0x01}
+
+#define PINMUX_C10_RTP_DATA_06_PINMMR 2
+#define PINMUX_C10_RTP_DATA_06_SHIFT 8
+#define PINMUX_C10_RTP_DATA_06_VALUE 0x02
+#define PINMUX_C10_RTP_DATA_06_PIN {2, 8, 0x02}
+
+/* Ball C11: EMIF_ADDR_13 (0x01), RTP_DATA_05 (0x02) */
+
+#define PINMUX_C11_EMIF_ADDR_13_PINMMR 2
+#define PINMUX_C11_EMIF_ADDR_13_SHIFT 16
+#define PINMUX_C11_EMIF_ADDR_13_VALUE 0x01
+#define PINMUX_C11_EMIF_ADDR_13_PIN {2, 16, 0x01}
+
+#define PINMUX_C11_RTP_DATA_05_PINMMR 2
+#define PINMUX_C11_RTP_DATA_05_SHIFT 16
+#define PINMUX_C11_RTP_DATA_05_VALUE 0x02
+#define PINMUX_C11_RTP_DATA_05_PIN {2, 16, 0x02}
+
+/* Ball C12: EMIF_ADDR_14 (0x01), RTP_DATA_04 (0x02) */
+
+#define PINMUX_C12_EMIF_ADDR_14_PINMMR 2
+#define PINMUX_C12_EMIF_ADDR_14_SHIFT 24
+#define PINMUX_C12_EMIF_ADDR_14_VALUE 0x01
+#define PINMUX_C12_EMIF_ADDR_14_PIN {2, 24, 0x01}
+
+#define PINMUX_C12_RTP_DATA_04_PINMMR 2
+#define PINMUX_C12_RTP_DATA_04_SHIFT 24
+#define PINMUX_C12_RTP_DATA_04_VALUE 0x02
+#define PINMUX_C12_RTP_DATA_04_PIN {2, 24, 0x02}
+
+/* PINMMR3: C13[0], D14[8], C14[16], D15[24] */
+
+/* Ball C13: EMIF_ADDR_15 (0x01), RTP_DATA_03 (0x02) */
+
+#define PINMUX_C13_EMIF_ADDR_15_PINMMR 3
+#define PINMUX_C13_EMIF_ADDR_15_SHIFT 0
+#define PINMUX_C13_EMIF_ADDR_15_VALUE 0x01
+#define PINMUX_C13_EMIF_ADDR_15_PIN {3, 0, 0x01}
+
+#define PINMUX_C13_RTP_DATA_03_PINMMR 3
+#define PINMUX_C13_RTP_DATA_03_SHIFT 0
+#define PINMUX_C13_RTP_DATA_03_VALUE 0x02
+#define PINMUX_C13_RTP_DATA_03_PIN {3, 0, 0x02}
+
+/* Ball D14: EMIF_ADDR_16 (0x01), RTP_DATA_02 (0x02) */
+
+#define PINMUX_D14_EMIF_ADDR_16_PINMMR 3
+#define PINMUX_D14_EMIF_ADDR_16_SHIFT 8
+#define PINMUX_D14_EMIF_ADDR_16_VALUE 0x01
+#define PINMUX_D14_EMIF_ADDR_16_PIN {3, 8, 0x01}
+
+#define PINMUX_D14_RTP_DATA_02_PINMMR 3
+#define PINMUX_D14_RTP_DATA_02_SHIFT 8
+#define PINMUX_D14_RTP_DATA_02_VALUE 0x02
+#define PINMUX_D14_RTP_DATA_02_PIN {3, 8, 0x02}
+
+/* Ball C14: EMIF_ADDR_17 (0x01), RTP_DATA_01 (0x02) */
+
+#define PINMUX_C14_EMIF_ADDR_17_PINMMR 3
+#define PINMUX_C14_EMIF_ADDR_17_SHIFT 16
+#define PINMUX_C14_EMIF_ADDR_17_VALUE 0x01
+#define PINMUX_C14_EMIF_ADDR_17_PIN {3, 16, 0x01}
+
+#define PINMUX_C14_RTP_DATA_01_PINMMR 3
+#define PINMUX_C14_RTP_DATA_01_SHIFT 16
+#define PINMUX_C14_RTP_DATA_01_VALUE 0x02
+#define PINMUX_C14_RTP_DATA_01_PIN {3, 16, 0x02}
+
+/* Ball D15: EMIF_ADDR_18 (0x01), RTP_DATA_00 (0x02) */
+
+#define PINMUX_D15_EMIF_ADDR_18_PINMMR 3
+#define PINMUX_D15_EMIF_ADDR_18_SHIFT 24
+#define PINMUX_D15_EMIF_ADDR_18_VALUE 0x01
+#define PINMUX_D15_EMIF_ADDR_18_PIN {3, 24, 0x01}
+
+#define PINMUX_D15_RTP_DATA_00_PINMMR 3
+#define PINMUX_D15_RTP_DATA_00_SHIFT 24
+#define PINMUX_D15_RTP_DATA_00_VALUE 0x02
+#define PINMUX_D15_RTP_DATA_00_PIN {3, 24, 0x02}
+
+/* PINMMR4: C15[0], C16[8], C17[16] */
+
+/* Ball C15: EMIF_ADDR_19 (0x01), RTP_nENA (0x02) */
+
+#define PINMUX_C15_EMIF_ADDR_19_PINMMR 4
+#define PINMUX_C15_EMIF_ADDR_19_SHIFT 0
+#define PINMUX_C15_EMIF_ADDR_19_VALUE 0x01
+#define PINMUX_C15_EMIF_ADDR_19_PIN {4, 0, 0x01}
+
+#define PINMUX_C15_RTP_NENA_PINMMR 4
+#define PINMUX_C15_RTP_NENA_SHIFT 0
+#define PINMUX_C15_RTP_NENA_VALUE 0x02
+#define PINMUX_C15_RTP_NENA_PIN {4, 0, 0x02}
+
+/* Ball C16: EMIF_ADDR_20 (0x01), RTP_nSYNC (0x02) */
+
+#define PINMUX_C16_EMIF_ADDR_20_PINMMR 4
+#define PINMUX_C16_EMIF_ADDR_20_SHIFT 8
+#define PINMUX_C16_EMIF_ADDR_20_VALUE 0x01
+#define PINMUX_C16_EMIF_ADDR_20_PIN {4, 8, 0x01}
+
+#define PINMUX_C16_RTP_NSYNC_PINMMR 4
+#define PINMUX_C16_RTP_NSYNC_SHIFT 8
+#define PINMUX_C16_RTP_NSYNC_VALUE 0x02
+#define PINMUX_C16_RTP_NSYNC_PIN {4, 8, 0x02}
+
+/* Ball C17: EMIF_ADDR_21 (0x01), RTP_CLK (0x02) */
+
+#define PINMUX_C17_EMIF_ADDR_21_PINMMR 4
+#define PINMUX_C17_EMIF_ADDR_21_SHIFT 16
+#define PINMUX_C17_EMIF_ADDR_21_VALUE 0x01
+#define PINMUX_C17_EMIF_ADDR_21_PIN {4, 16, 0x01}
+
+#define PINMUX_C17_RTP_CLK_PINMMR 4
+#define PINMUX_C17_RTP_CLK_SHIFT 16
+#define PINMUX_C17_RTP_CLK_VALUE 0x02
+#define PINMUX_C17_RTP_CLK_PIN {4, 16, 0x02}
+
+/* PINMMR8: D16[24] */
+
+/* Ball D16: EMIF_BA_1 (0x01), 8_25 (0x02), N2HET2_05 (0x04) */
... 29461 lines suppressed ...