The Kendryte K230 contains two Synopsys DesignWare Core Mobile Storage
Host Controllers. The K230 machine currently exposes their MMIO ranges
as unimplemented devices, so software cannot access SD storage.

This series adds a K230 SDHCIv3 model based on the generic SDHCI model.
The model reuses the generic commands, PIO, SDMA and ADMA2 data paths
and provides the K230 0x1000-byte register layout. It implements the
documented capability and reset values, read-only Preset Value and
extension pointer registers, writable backing storage for most PHY and
vendor registers, and an always-ready PHY_PWRGOOD status bit required by
the K230 SDK reset sequence. It is worth noting that K230 documentation
describes an SDHCI v4.20 controller, while the generic QEMU SDHCI does not
support ADMA3. So this model reports v3 and does not advertise ADMA3.

Testing:
  - scripts/checkpatch.pl: 0 errors, 0 warnings, 747 lines checked
  - qemu:qtest-riscv64/k230-sdhci-test: 3 subtests passed
  - Linux direct boot: both controllers detected, r/w and e2fsck passed

Xin Xie (3):
  hw/sd: add Kendryte K230 SDHCI controller
  hw/riscv: enable SDHCI controllers on K230
  tests/qtest: add K230 SDHCI tests

 MAINTAINERS                   |   3 +
 docs/system/riscv/k230.rst    |   6 +-
 hw/riscv/Kconfig              |   1 +
 hw/riscv/k230.c               |  34 +++-
 hw/sd/Kconfig                 |   4 +
 hw/sd/k230_sdhci.c            | 311 ++++++++++++++++++++++++++++++++++
 hw/sd/meson.build             |   1 +
 include/hw/riscv/k230.h       |   4 +
 include/hw/sd/k230_sdhci.h    |  82 +++++++++
 tests/qtest/k230-sdhci-test.c | 214 +++++++++++++++++++++++
 tests/qtest/meson.build       |   5 +-
 11 files changed, 656 insertions(+), 9 deletions(-)
 create mode 100644 hw/sd/k230_sdhci.c
 create mode 100644 include/hw/sd/k230_sdhci.h
 create mode 100644 tests/qtest/k230-sdhci-test.c

-- 
2.43.0


Reply via email to