This series adds a device model for the K230 power management unit (PMU)
and wires it into the K230 SoC.
The PMU (K230 TRM V0.3.1 chapter 14) controls the core power-on/off path
through two PMIC output pads and reports six PAD inputs plus RTC
interrupts to the CPU. This minimal model covers the APB register bank
with TRM reset values and write masks, interrupt detection state
(PAD64..PAD69 inputs setting PMU_INT_STATE, the interrupt line following
PMU_INT_STATE & PMU_INT0_TO_CPU, W1C clear) and the PAD70/PAD71 outputs
driven by PMU_SYSCTRL_REG. Long/short press timing, edge counting and
debounce are intentionally left for a follow-up.
Patch 1 adds the device model, patch 2 wires it into the K230 SoC
(MMIO 0x91000000, small-core PLIC source 81) and patch 3 adds qtest
coverage. The k230 qtests pass under qtest-riscv64.
JunWei Li (3):
hw/misc: add K230 PMU device
hw/riscv: wire up K230 PMU in the SoC
tests/qtest: add k230-pmu-test
MAINTAINERS | 3 +
hw/misc/Kconfig | 3 +
hw/misc/k230_pmu.c | 242 ++++++++++++++++++++++++++++++++++++
hw/misc/meson.build | 1 +
hw/riscv/Kconfig | 1 +
hw/riscv/k230.c | 12 +-
include/hw/misc/k230_pmu.h | 71 +++++++++++
include/hw/riscv/k230.h | 3 +
tests/qtest/k230-pmu-test.c | 136 ++++++++++++++++++++
tests/qtest/meson.build | 3 +-
10 files changed, 471 insertions(+), 4 deletions(-)
create mode 100644 hw/misc/k230_pmu.c
create mode 100644 include/hw/misc/k230_pmu.h
create mode 100644 tests/qtest/k230-pmu-test.c
--
2.20.1