[PATCH 0/5] hw/riscv: K230 peripheral device models

Leo Cheng <[email protected]>
Newsgroups org.nongnu.qemu-devel,org.nongnu.qemu-riscv
Message-ID <[email protected]>
The K230 machine and its watchdog are already in tree. This series adds
device models for the peripherals on the c908 little-core bus and wires them
into the machine, each with a qtest.

Patch 1 adds the DesignWare APB GPIO controller (one PLIC line per pin).
Patch 2 adds the RTC (date/time, masked alarm, periodic tick, live sub-second
count).
Patch 3 adds the IOMUX pin controller and the mailbox/IPCM block (doorbell
interrupts + hardware spinlock).
Patch 4 adds the SD/eMMC host (DesignWare dw_mmc) register model.
Patch 5 wires the devices into the k230 machine, adds two SiFive PWM instances,
a satellite-safety fault-injection qtest, and updates docs and MAINTAINERS.

Register layouts are taken from the K230 TRM v0.3.1, the upstream Linux
pinctrl-k230 driver, and the Canaan k230_sdk. Exercised by the k230 qtests
(gpio, rtc, iomux, mailbox, dwmmc, pwm, safety) under qtest-riscv64.

Based on commit f893c46 (qemu-openbios-20260707 merge); hw/riscv/k230.c and
include/hw/riscv/k230.h are unchanged from that base upstream.

Leo Cheng (5):
  hw/gpio: add K230 GPIO controller.
  hw/rtc: add K230 RTC.
  hw/misc: add K230 IOMUX and mailbox/IPCM.
  hw/sd: add K230 SD/eMMC (DesignWare dw_mmc).
  hw/riscv: wire K230 peripherals into the machine.

 MAINTAINERS                     |  12 +-
 docs/system/riscv/k230.rst      |   6 +
 hw/gpio/Kconfig                 |   3 +
 hw/gpio/k230_gpio.c             | 270 ++++++++++++++++++++++++++++
 hw/gpio/meson.build             |   1 +
 hw/gpio/trace-events            |   4 +
 hw/misc/Kconfig                 |   6 +
 hw/misc/k230_iomux.c            | 101 +++++++++++
 hw/misc/k230_mailbox.c          | 206 +++++++++++++++++++++
 hw/misc/meson.build             |   2 +
 hw/misc/trace-events            |  10 ++
 hw/riscv/Kconfig                |   7 +
 hw/riscv/k230.c                 |  89 ++++++++--
 hw/rtc/Kconfig                  |   3 +
 hw/rtc/k230_rtc.c               | 306 ++++++++++++++++++++++++++++++++
 hw/rtc/meson.build              |   1 +
 hw/rtc/trace-events             |   5 +
 hw/sd/Kconfig                   |   3 +
 hw/sd/k230_dwmmc.c              | 139 +++++++++++++++
 hw/sd/meson.build               |   1 +
 hw/sd/trace-events              |   4 +
 include/hw/gpio/k230_gpio.h     |  68 +++++++
 include/hw/misc/k230_iomux.h    |  44 +++++
 include/hw/misc/k230_mailbox.h  |  61 +++++++
 include/hw/riscv/k230.h         |  18 ++
 include/hw/rtc/k230_rtc.h       |  61 +++++++
 include/hw/sd/k230_dwmmc.h      |  61 +++++++
 tests/qtest/k230-dwmmc-test.c   |  79 +++++++++
 tests/qtest/k230-gpio-test.c    | 143 +++++++++++++++
 tests/qtest/k230-iomux-test.c   |  62 +++++++
 tests/qtest/k230-mailbox-test.c |  89 ++++++++++
 tests/qtest/k230-pwm-test.c     |  43 +++++
 tests/qtest/k230-rtc-test.c     | 188 ++++++++++++++++++++
 tests/qtest/k230-safety-test.c  | 127 +++++++++++++
 tests/qtest/meson.build         |   2 +-
 35 files changed, 2211 insertions(+), 14 deletions(-)
 create mode 100644 hw/gpio/k230_gpio.c
 create mode 100644 hw/misc/k230_iomux.c
 create mode 100644 hw/misc/k230_mailbox.c
 create mode 100644 hw/rtc/k230_rtc.c
 create mode 100644 hw/sd/k230_dwmmc.c
 create mode 100644 include/hw/gpio/k230_gpio.h
 create mode 100644 include/hw/misc/k230_iomux.h
 create mode 100644 include/hw/misc/k230_mailbox.h
 create mode 100644 include/hw/rtc/k230_rtc.h
 create mode 100644 include/hw/sd/k230_dwmmc.h
 create mode 100644 tests/qtest/k230-dwmmc-test.c
 create mode 100644 tests/qtest/k230-gpio-test.c
 create mode 100644 tests/qtest/k230-iomux-test.c
 create mode 100644 tests/qtest/k230-mailbox-test.c
 create mode 100644 tests/qtest/k230-pwm-test.c
 create mode 100644 tests/qtest/k230-rtc-test.c
 create mode 100644 tests/qtest/k230-safety-test.c

-- 
2.43.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.