Hi,
Thanks to Daniel Henrique Barboza for reviewing v2. This v3 addresses
all the comments you raised on patch 1/2; patch 2/2 (the qtest) is
unchanged.
The Kendryte K230 SoC contains two APB GPIO controllers derived from
the Synopsys DesignWare APB GPIO (the Linux gpio-k230 driver is itself
based on gpio-dwapb.c, and shares the same register layout), with a
Canaan-specific compatible ("canaan,k230-apb-gpio") and hardlock
integration. This series implements the device model, wires it into
the K230 SoC, and adds qtest coverage.
Changes in v3 (patch 1/2 only):
* Removed the unused `intstatus` field from the device state, the
vmstate description and the reset hook.
* Moved `qemu/osdep.h` out of k230_gpio.h and into k230_gpio.c as the
first include.
* Flattened the nested `if` blocks in the SWPORTA_DDR and SWPORTA_CTL
write paths with an early `continue`, reducing the indentation by two
levels. `curr_level` and `pol` are now declared at the top of
k230_gpio_write() to avoid mid-block declarations after the
`continue`.
Links to previous versions:
v2 cover: https://lore.kernel.org/qemu-devel/tencent_1EE6F17A514580093D329A6B4BA43B7D7506@qq.com/
v2 1/2: https://lore.kernel.org/qemu-devel/tencent_7080159426F5C824AE07916CF4FF9944EB08@qq.com/
v2 2/2: https://lore.kernel.org/qemu-devel/tencent_76E410D79348037AB2CC88758B8A5B932907@qq.com/
v1 cover: https://lore.kernel.org/qemu-devel/tencent_B90E44EAD06F6676AF9B572898242037BB0A@qq.com/
guochun wang (2):
hw/gpio: add K230 GPIO controller model
tests/qtest: add K230 GPIO controller test
MAINTAINERS | 3 +
hw/gpio/Kconfig | 3 +
hw/gpio/k230_gpio.c | 362 ++++++++++++++++++++++++
hw/gpio/meson.build | 1 +
hw/riscv/Kconfig | 1 +
hw/riscv/k230.c | 27 +-
include/hw/gpio/k230_gpio.h | 71 +++++
include/hw/riscv/k230.h | 5 +
tests/qtest/k230-gpio-test.c | 521 +++++++++++++++++++++++++++++++++++
tests/qtest/meson.build | 2 +-
10 files changed, 989 insertions(+), 7 deletions(-)
create mode 100644 hw/gpio/k230_gpio.c
create mode 100644 include/hw/gpio/k230_gpio.h
create mode 100644 tests/qtest/k230-gpio-test.c
--
2.43.0