Skip to content

RFC riscv: Add initial support for Espressif ESP32-P4

Vítor Hugo Silva linux-devicetree linux-fsdevel linux-mm linux-riscv linux-serial lkml 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest19 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/19riscv: Prepare ESP32-P4 early CLIC trap vectorsarch/riscv/Kconfig.socs arch/riscv/kernel/entry.S arch/riscv/kernel/head.S+28 -00 replies
2/19riscv: Handle ESP32-P4 CLIC trap contextarch/riscv/include/asm/asm-prototypes.h arch/riscv/include/asm/ptrace.h arch/riscv/kernel/asm-offsets.c +2 more+76 -00 replies
3/19dt-bindings: interrupt-controller: Add Espressif ESP32-P4 CLICDocumentation/devicetree/bindings/interrupt-controller/esp,esp32p4-clic.yaml+53 -00 replies
4/19irqchip: Add Espressif ESP32-P4 CLIC supportdrivers/irqchip/Makefile drivers/irqchip/irq-esp32p4-clic.c+179 -00 replies
5/19dt-bindings: interrupt-controller: Add Espressif ESP32-P4 interrupt matrixDocumentation/devicetree/bindings/interrupt-controller/esp,esp32p4-intmtx.yaml+67 -00 replies
6/19irqchip: Add Espressif ESP32-P4 interrupt matrix supportdrivers/irqchip/Makefile drivers/irqchip/irq-esp32p4-intmtx.c+140 -00 replies
7/19dt-bindings: timer: Add Espressif ESP32-P4 CLINTDocumentation/devicetree/bindings/timer/sifive,clint.yaml+28 -00 replies
8/19clocksource/drivers/timer-clint: Add Espressif ESP32-P4 supportdrivers/clocksource/timer-clint.c+53 -40 replies
9/19dt-bindings: serial: Add Espressif ESP32-P4 UARTDocumentation/devicetree/bindings/serial/esp,esp32-uart.yaml+3 -10 replies
10/19serial: esp32: Restore the ESP32 UART driverdrivers/tty/serial/Kconfig drivers/tty/serial/Makefile drivers/tty/serial/esp32_uart.c+793 -00 replies
11/19serial: esp32: Add support for the ESP32-P4 UARTdrivers/tty/serial/Kconfig drivers/tty/serial/esp32_uart.c+151 -220 replies
12/19serial: esp32: Rearm TX interrupts when the FIFO is fulldrivers/tty/serial/esp32_uart.c+8 -40 replies
13/19serial: esp32: Add early console support for ESP32-P4drivers/tty/serial/esp32_uart.c+40 -100 replies
14/19riscv: Synchronize instructions written to ESP32-P4 PSRAMarch/riscv/include/asm/cacheflush.h arch/riscv/kernel/patch.c arch/riscv/kernel/signal.c +3 more+160 -70 replies
15/19riscv: Align init data to the ESP32-P4 PMP granularityarch/riscv/kernel/vmlinux.lds.S+4 -00 replies
16/19dt-bindings: riscv: Add Waveshare ESP32-P4-Module-DEV-KITDocumentation/devicetree/bindings/riscv/espressif.yaml+22 -00 replies
17/19dt-bindings: riscv: cpus: Document Espressif ESP32-P4 HP hartsDocumentation/devicetree/bindings/riscv/cpus.yaml+14 -30 replies
18/19riscv: dts: Add Waveshare ESP32-P4-Module-DEV-KITarch/riscv/boot/dts/Makefile arch/riscv/boot/dts/espressif/Makefile arch/riscv/boot/dts/espressif/esp32p4-waveshare-module-dev-kit.dts +1 more+113 -00 replies
19/19MAINTAINERS: Add the Espressif ESP32-P4 platformMAINTAINERS+14 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH RFC 00/19] riscv: Add initial support for Espressif ESP32-P4

Hello,

This series of patches adds the initial support for the Espressif's ESP32-P4 on the Waveshare ESP32-P4-Module-DEV-KIT. It boots in M-mode on a RV32 NOMMU kernel with one HP hart.

The series adds CLIC trap handling, drivers for clic and for interrupt matrix, and extends the CLINT timer driver. It restores a previously removed ESP32 UART driver with ESP32-P4 UART support and early console support. It also synchronizes the instructions written to the PSRAM, aligns the init data to the ESP32-P4 PMP granularity, and it adds DT bindings and the board devicetree.

The boot firmware initializes PSRAM, loads the kernel, DTB and the initramfs from the microSD, and it supplies the timebase-frequency before jumping into the kernel.

The bootloader source and microSD boot instructions are available at:
https://github.com/pushdword/waveshare-esp32-p4-bootloader/blob/390880e881208ab16aa16eb520b3e5ea0c63c0a2/README.md

I tested this series on the hardware, the Waveshare ESP32-P4-Module-DEV-KIT with the ESP32-P4 revision v3.2 with 32MB of PSRAM. The kernel booted to the UART shell from the initramfs. The /proc/interrupts showed the CLINT IRQ's increased, UART0 interrupts were routed through the interrupts matrix.

It would be nice to you all send feedback on restoring the interrupted CLIC level before irq_exit_rcu() and the interface for propagating instruction-cache sync failures to NOMMU executable loading, and signal setup.

AI disclaimer: I have used 6.2-Sol to assist development and to assist debug/troubleshoot some ongoing issues. I have used Codex's 6-Sol with Daybreak Blue enabled to generate peer-review-like report to pinpoint potential security issues regarding the patches. I manually reviewed and validated each change, including the AI-assisted changes. I also manually tested each change on the hardware as described above.

Vítor Hugo Silva (19):
riscv: Prepare ESP32-P4 early CLIC trap vectors
riscv: Handle ESP32-P4 CLIC trap context
dt-bindings: interrupt-controller: Add Espressif ESP32-P4 CLIC
irqchip: Add Espressif ESP32-P4 CLIC support
dt-bindings: interrupt-controller: Add Espressif ESP32-P4 interrupt
matrix
irqchip: Add Espressif ESP32-P4 interrupt matrix support
dt-bindings: timer: Add Espressif ESP32-P4 CLINT clocksource/drivers/timer-clint: Add Espressif ESP32-P4 support
dt-bindings: serial: Add Espressif ESP32-P4 UART
serial: esp32: Restore the ESP32 UART driver
serial: esp32: Add support for the ESP32-P4 UART
serial: esp32: Rearm TX interrupts when the FIFO is full
serial: esp32: Add early console support for ESP32-P4
riscv: Synchronize instructions written to ESP32-P4 PSRAM
riscv: Align init data to the ESP32-P4 PMP granularity
dt-bindings: riscv: Add Waveshare ESP32-P4-Module-DEV-KIT
dt-bindings: riscv: cpus: Document Espressif ESP32-P4 HP harts
riscv: dts: Add Waveshare ESP32-P4-Module-DEV-KIT
MAINTAINERS: Add the Espressif ESP32-P4 platform

 .../esp,esp32p4-clic.yaml                     |  53 +
 .../esp,esp32p4-intmtx.yaml                   |  67 ++
 .../devicetree/bindings/riscv/cpus.yaml       |  17 +-
 .../devicetree/bindings/riscv/espressif.yaml  |  22 +
 .../bindings/serial/esp,esp32-uart.yaml       |   4 +-
 .../bindings/timer/sifive,clint.yaml          |  28 +
 MAINTAINERS                                   |  14 +
 arch/riscv/Kconfig.socs                       |   9 +
 arch/riscv/boot/dts/Makefile                  |   1 +
 arch/riscv/boot/dts/espressif/Makefile        |   2 +
 .../esp32p4-waveshare-module-dev-kit.dts      |  46 +
 arch/riscv/boot/dts/espressif/esp32p4.dtsi    |  64 ++
 arch/riscv/include/asm/asm-prototypes.h       |   4 +
 arch/riscv/include/asm/cacheflush.h           |   6 +
 arch/riscv/include/asm/ptrace.h               |   4 +
 arch/riscv/kernel/asm-offsets.c               |   3 +
 arch/riscv/kernel/entry.S                     |  67 ++
 arch/riscv/kernel/head.S                      |  13 +
 arch/riscv/kernel/patch.c                     | 132 ++-
 arch/riscv/kernel/signal.c                    |   6 +-
 arch/riscv/kernel/traps.c                     |   4 +
 arch/riscv/kernel/vmlinux.lds.S               |   4 +
 drivers/clocksource/timer-clint.c             |  57 +-
 drivers/irqchip/Makefile                      |   2 +
 drivers/irqchip/irq-esp32p4-clic.c            | 178 ++++
 drivers/irqchip/irq-esp32p4-intmtx.c          | 139 +++
 drivers/tty/serial/Kconfig                    |  15 +
 drivers/tty/serial/Makefile                   |   1 +
 drivers/tty/serial/esp32_uart.c               | 940 ++++++++++++++++++
 fs/binfmt_flat.c                              |   6 +-
 fs/exec.c                                     |  10 +-
 include/linux/cacheflush.h                    |   7 +
 32 files changed, 1910 insertions(+), 15 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/esp,esp32p4-clic.yaml
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/esp,esp32p4-intmtx.yaml
 create mode 100644 Documentation/devicetree/bindings/riscv/espressif.yaml
 create mode 100644 arch/riscv/boot/dts/espressif/Makefile
 create mode 100644 arch/riscv/boot/dts/espressif/esp32p4-waveshare-module-dev-kit.dts
 create mode 100644 arch/riscv/boot/dts/espressif/esp32p4.dtsi
 create mode 100644 drivers/irqchip/irq-esp32p4-clic.c
 create mode 100644 drivers/irqchip/irq-esp32p4-intmtx.c
 create mode 100644 drivers/tty/serial/esp32_uart.c

base-commit: aebb7274476403040d582c61478df8f4a7bf9cd3

Signature · 1 line
2.56.1