diff mbox series

[v4,07/25] sdhci: add a 'dma' shortcut property

Message ID 20180103183418.23730-8-f4bug@amsat.org
State Superseded, archived
Headers show
Series SDHCI: add qtests and fix few issues | expand

Commit Message

Philippe Mathieu-Daudé Jan. 3, 2018, 6:34 p.m. UTC
disabling it disables all DMAs at once.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 include/hw/sd/sdhci.h | 1 +
 hw/sd/sdhci.c         | 5 +++++
 2 files changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/include/hw/sd/sdhci.h b/include/hw/sd/sdhci.h
index 4a9c3e9175..bac37f9e11 100644
--- a/include/hw/sd/sdhci.h
+++ b/include/hw/sd/sdhci.h
@@ -101,6 +101,7 @@  typedef struct SDHCIState {
     bool     pending_insert_state;
     /* Configurable properties */
     bool pending_insert_quirk; /* Quirk for Raspberry Pi card insert int */
+    bool dma; /* shortcut for sdma + adma* */
     uint8_t spec_version;
     struct {
         /* v1 */
diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
index 8692798021..cc1e28fa61 100644
--- a/hw/sd/sdhci.c
+++ b/hw/sd/sdhci.c
@@ -1178,6 +1178,10 @@  static void sdhci_init_readonly_registers(SDHCIState *s, Error **errp)
     }
     s->version = (SDHC_HCVER_VENDOR << 8) | (s->spec_version - 1);
 
+    if (!s->dma) {
+        s->cap.sdma = s->cap.adma1 = s->cap.adma2 = false;
+    }
+
     if (s->capareg == UINT64_MAX) {
         sdhci_init_capareg(s, errp);
     }
@@ -1312,6 +1316,7 @@  static Property sdhci_properties[] = {
      * Possible values: 512, 1024, 2048 bytes */
     DEFINE_PROP_UINT16("max-block-length", SDHCIState, cap.max_blk_len, 512),
     /* DMA */
+    DEFINE_PROP_BOOL("dma", SDHCIState, dma, true), /* shortcut */
     DEFINE_PROP_BOOL("sdma", SDHCIState, cap.sdma, true),
     DEFINE_PROP_BOOL("adma1", SDHCIState, cap.adma1, false),
     DEFINE_PROP_BOOL("adma2", SDHCIState, cap.adma2, true),