Skip to contentSkip to conversation

sdcard: cleanup the SD_SPEC version

PATCH In review Philippe Mathieu-Daudé 2 participants 12 messages Jun 7, 2018 – Jun 8, 2018

lore
Share & tools
lore
#0 lore raw

v2 cover sdcard: cleanup the SD_SPEC version

Since v2:
- heavy documentation improvements
- squashed previous 3+4 "add spec_version property default to v2" for atomicity
- SSI/SD patch downgraded to RFC
- added Alistair R-b tags

v1: http://lists.nongnu.org/archive/html/qemu-devel/2018-06/msg00388.html

Hi,

This series adds a 'spec_version' property to the SD Card device, to allow to limit some commands to specific spec version range (some firmwares use this feature to detect which spec version the card implements).

This [v2: does NOT] restore the SSI/SD support of the Stellaris LM3S6965EVB board, which allow to stress the SD Card code with a nice integration test (waiting for another series to get merged to add the Avocado test):

    $ qemu-system-arm -M lm3s6965evb -serial stdio \
      -kernel sd_card.bin -sd sdcard.img

SD Card Example Program
Type 'help' for help.

/> ls
Open
listing

----A 2012/04/25 17:44 12 README.TXT

1 File(s), 12 bytes total
0 Dir(s), 61182K bytes free

/> cat README.TXT
Hello World

See:
http://lists.nongnu.org/archive/html/qemu-devel/2012-04/msg03790.html
http://lists.nongnu.org/archive/html/qemu-devel/2018-06/msg00353.html

Regards,

Phil.

[----] : patches are identical
[####] : number of functional differences between upstream/downstream patch [down] : patch is downstream-only
The flags [FC] indicate (F)unctional and (C)ontextual differences, respectively

001/8:[----] [--] 'sdcard: Update the Configuration Register (SCR) to Spec Version 1.10' 002/8:[----] [--] 'sdcard: Allow commands valid in SPI mode'
003/8:[0017] [FC] 'sdcard: Add a 'spec_version' property'
004/8:[down] 'sdcard: Set Spec v2.00 as default'
005/8:[----] [--] 'hw/sd/ssi-sd: Force cards connected in SPI mode to use Spec v1.10' 006/8:[----] [--] 'sdcard: Disable SEND_IF_COND (CMD8) for Spec v1' 007/8:[----] [--] 'sdcard: Reflect when the Spec v3 is supported in the Config Register (SCR)' 008/8:[----] [--] 'sdcard: Disable CMD19/CMD23 for Spec v2'

Philippe Mathieu-Daudé (7):
sdcard: Update the Configuration Register (SCR) to Spec Version 1.10
sdcard: Allow commands valid in SPI mode
sdcard: Add a 'spec_version' property, default to Spec v2.00
sdcard: Disable SEND_IF_COND (CMD8) for Spec v1
sdcard: Reflect when the Spec v3 is supported in the Config Register (SCR)
sdcard: Disable CMD19/CMD23 for Spec v2
hw/sd/ssi-sd: Force cards connected in SPI mode to use Spec v1.10

 include/hw/sd/sd.h |  6 ++++++
 hw/sd/sd.c         | 50 +++++++++++++++++++++++++++++-----------------
 hw/sd/ssi-sd.c     |  2 ++
 3 files changed, 40 insertions(+), 18 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH v2 1/7 sdcard: Update the Configuration Register (SCR) to Spec Version 1.10

The initial implementation is based on the Specs v1.10 (see a1bb27b1e98).

However the SCR is anouncing the card being v1.01.

The new chapters added in version 1.10 are:

4.3.10 Switch function command

Switch function command (CMD6) 1 is used to switch or expand memory card functions. [...]
This is a new feature, introduced in SD physical Layer Specification Version 1.10. Therefore, cards that are compatible with earlier versions of the spec do not support it. The host shall check the "SD_SPEC" field in the SCR register to recognize what version of the spec the card complies with before using CMD6. It is mandatory for SD memory card of Ver1.10 to support CMD6.

4.3.11 High-Speed mode (25MB/sec interface speed)

Though the Rev 1.01 SD memory card supports up to 12.5MB/sec interface speed, the speed of 25MB/sec is necessary to support increasing performance needs of the host and because of memory size which continues to grow.
To achieve 25MB/sec interface speed, clock rate is increased to 50MHz and CLK/CMD/DAT signal timing and circuit conditions are reconsidered and changed from Physical Layer Specification Version 1.01.

4.3.12 Command system (This chapter is newly added in version 1.10)

SD commands CMD34-37, CMD50, CMD57 are reserved for SD command system expansion via the switch command.
[These commands] will be considered as illegal commands (as defined in revision 1.01 of the SD physical layer specification).

The SWITCH_FUNCTION is implemented since the first commit, a1bb27b1e98.

The 25MB/sec High-Speed mode was already updated in d7ecb867529.

The current implementation does not implements CMD34-37, CMD50 and CMD57, thus these commands already return ILLEGAL.

With this patch, the SCR register now matches the description of the header:

* SD Memory Card emulation as defined in the "SD Memory Card Physical
* layer specification, Version 1.10."

---
 hw/sd/sd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/sd/sd.c +2 -2
index 7af19fa06c..e1218d1fb6 100644
@@ -310,8 +310,8 @@ static void sd_ocr_powerup(void *opaque)
 
 static void sd_set_scr(SDState *sd)
 {
-    sd->scr[0] = (0 << 4)       /* SCR version 1.0 */
-                 | 0;           /* Spec Versions 1.0 and 1.01 */
+    sd->scr[0] = (0 << 4)       /* SCR structure version 1.0 */
+                 | 1;           /* Spec Version 1.10 */
     sd->scr[1] = (2 << 4)       /* SDSC Card (Security Version 1.01) */
                  | 0b0101;      /* 1-bit or 4-bit width bus modes */
     sd->scr[2] = 0x00;          /* Extended Security is not supported. */
Signature · 1 line
2.17.1
#2 lore raw

PATCH v2 2/7 sdcard: Allow commands valid in SPI mode

In reply to Philippe Mathieu-Daudé
Quoted 1 line

From the "Physical Layer Simplified Specification Version 1.10"

Chapter 7.3 "SPI Mode Transaction Packets"
Table 57: "Commands and arguments"

---
 hw/sd/sd.c | 14 --------------
 1 file changed, 14 deletions(-)
hw/sd/sd.c +0 -14
index e1218d1fb6..80e70dd93e 100644
@@ -960,8 +960,6 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)
         return sd_illegal;
 
     case 6:	/* CMD6:   SWITCH_FUNCTION */
-        if (sd->spi)
-            goto bad_cmd;
         switch (sd->mode) {
         case sd_data_transfer_mode:
             sd_function_switch(sd, req.arg);
@@ -1190,9 +1188,6 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)
 
     /* Block write commands (Class 4) */
     case 24:	/* CMD24:  WRITE_SINGLE_BLOCK */
-        if (sd->spi) {
-            goto unimplemented_spi_cmd;
-        }
         switch (sd->state) {
         case sd_transfer_state:
             /* Writing in SPI mode not implemented.  */
@@ -1217,9 +1212,6 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)
         break;
 
     case 25:	/* CMD25:  WRITE_MULTIPLE_BLOCK */
-        if (sd->spi) {
-            goto unimplemented_spi_cmd;
-        }
         switch (sd->state) {
         case sd_transfer_state:
             /* Writing in SPI mode not implemented.  */
@@ -1259,9 +1251,6 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)
         break;
 
     case 27:	/* CMD27:  PROGRAM_CSD */
-        if (sd->spi) {
-            goto unimplemented_spi_cmd;
-        }
         switch (sd->state) {
         case sd_transfer_state:
             sd->state = sd_receivingdata_state;
@@ -1371,9 +1360,6 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)
 
     /* Lock card commands (Class 7) */
     case 42:	/* CMD42:  LOCK_UNLOCK */
-        if (sd->spi) {
-            goto unimplemented_spi_cmd;
-        }
         switch (sd->state) {
         case sd_transfer_state:
             sd->state = sd_receivingdata_state;
Signature · 1 line
2.17.1
#3 lore raw

PATCH v2 3/7 sdcard: Add a 'spec_version' property, default to Spec v2.00

In reply to Philippe Mathieu-Daudé

As of this commit, the Spec v1 is not working, and all controllers expect the cards to be conformant to Spec v2.

---
 include/hw/sd/sd.h |  5 +++++
 hw/sd/sd.c         | 23 ++++++++++++++++++++---
 2 files changed, 25 insertions(+), 3 deletions(-)
include/hw/sd/sd.h +5 -0
index 9bdb3c9285..7c6ad3c8f1 100644
@@ -54,6 +54,11 @@
 #define APP_CMD			(1 << 5)
 #define AKE_SEQ_ERROR		(1 << 3)
 
+enum SDPhySpecificationVersion {
+    SD_PHY_SPECv1_10_VERS     = 1,
+    SD_PHY_SPECv2_00_VERS     = 2,
+};
+
 typedef enum {
     SD_VOLTAGE_0_4V     = 400,  /* currently not supported */
     SD_VOLTAGE_1_8V     = 1800,
hw/sd/sd.c +20 -3
index 80e70dd93e..1ae085de69 100644
@@ -1,9 +1,10 @@
 /*
  * SD Memory Card emulation as defined in the "SD Memory Card Physical
- * layer specification, Version 1.10."
+ * layer specification, Version 2.00."
  *
  * Copyright (c) 2006 Andrzej Zaborowski  <[email protected]>
  * Copyright (c) 2007 CodeSourcery
+ * Copyright (c) 2018 Philippe Mathieu-Daudé <[email protected]>
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -91,6 +92,7 @@ struct SDState {
     uint8_t sd_status[64];
 
     /* Configurable properties */
+    uint8_t spec_version;
     BlockBackend *blk;
     bool spi;
 
@@ -310,8 +312,12 @@ static void sd_ocr_powerup(void *opaque)
 
 static void sd_set_scr(SDState *sd)
 {
-    sd->scr[0] = (0 << 4)       /* SCR structure version 1.0 */
-                 | 1;           /* Spec Version 1.10 */
+    sd->scr[0] = 0 << 4;        /* SCR structure version 1.0 */
+    if (sd->spec_version == SD_PHY_SPECv1_10_VERS) {
+        sd->scr[0] |= 1;        /* Spec Version 1.10 */
+    } else {
+        sd->scr[0] |= 2;        /* Spec Version 2.00 */
+    }
     sd->scr[1] = (2 << 4)       /* SDSC Card (Security Version 1.01) */
                  | 0b0101;      /* 1-bit or 4-bit width bus modes */
     sd->scr[2] = 0x00;          /* Extended Security is not supported. */
@@ -2058,6 +2064,15 @@ static void sd_realize(DeviceState *dev, Error **errp)
 
     sd->proto_name = sd->spi ? "SPI" : "SD";
 
+    switch (sd->spec_version) {
+    case SD_PHY_SPECv1_10_VERS
+     ... SD_PHY_SPECv2_00_VERS:
+        break;
+    default:
+        error_setg(errp, "Invalid SD card Spec version: %u", sd->spec_version);
+        return;
+    }
+
     if (sd->blk && blk_is_read_only(sd->blk)) {
         error_setg(errp, "Cannot use read-only drive as SD card");
         return;
@@ -2074,6 +2089,8 @@ static void sd_realize(DeviceState *dev, Error **errp)
 }
 
 static Property sd_properties[] = {
+    DEFINE_PROP_UINT8("spec_version", SDState,
+                      spec_version, SD_PHY_SPECv2_00_VERS),
     DEFINE_PROP_DRIVE("drive", SDState, blk),
     /* We do not model the chip select pin, so allow the board to select
      * whether card should be in SSI or MMC/SD mode.  It is also up to the
Signature · 1 line
2.17.1
#4 lore raw

PATCH v2 4/7 sdcard: Disable SEND_IF_COND (CMD8) for Spec v1

In reply to Philippe Mathieu-Daudé

CMD8 is "Reserved" in Spec v1.10.

Spec v2.00 introduces the SEND_IF_COND command:

6.4.1 Power Up

CMD8 is newly added in the Physical Layer Specification Version 2.00 to support multiple voltage ranges and used to check whether the card supports supplied voltage. The version 2.00 or later host shall issue CMD8 and verify voltage before card initialization. The host that does not support CMD8 shall supply high voltage range.

Message-Id: [email protected]

---
 hw/sd/sd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/sd/sd.c +3 -1
index 1ae085de69..3ec0f71f24 100644
@@ -1018,7 +1018,9 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)
         break;
 
     case 8:	/* CMD8:   SEND_IF_COND */
-        /* Physical Layer Specification Version 2.00 command */
+        if (sd->spec_version < SD_PHY_SPECv2_00_VERS) {
+            break;
+        }
         if (sd->state != sd_idle_state) {
             break;
         }
Signature · 1 line
2.17.1
#5 lore raw

PATCH v2 5/7 sdcard: Reflect when the Spec v3 is supported in the Config Register (SCR)

In reply to Philippe Mathieu-Daudé
---
 include/hw/sd/sd.h | 1 +
 hw/sd/sd.c         | 7 +++++--
 2 files changed, 6 insertions(+), 2 deletions(-)
include/hw/sd/sd.h +1 -0
index 7c6ad3c8f1..b865aafc33 100644
@@ -57,6 +57,7 @@
 enum SDPhySpecificationVersion {
     SD_PHY_SPECv1_10_VERS     = 1,
     SD_PHY_SPECv2_00_VERS     = 2,
+    SD_PHY_SPECv3_01_VERS     = 3,
 };
 
 typedef enum {
hw/sd/sd.c +5 -2
index 3ec0f71f24..4e49a3827a 100644
@@ -316,11 +316,14 @@ static void sd_set_scr(SDState *sd)
     if (sd->spec_version == SD_PHY_SPECv1_10_VERS) {
         sd->scr[0] |= 1;        /* Spec Version 1.10 */
     } else {
-        sd->scr[0] |= 2;        /* Spec Version 2.00 */
+        sd->scr[0] |= 2;        /* Spec Version 2.00 or Version 3.0X */
     }
     sd->scr[1] = (2 << 4)       /* SDSC Card (Security Version 1.01) */
                  | 0b0101;      /* 1-bit or 4-bit width bus modes */
     sd->scr[2] = 0x00;          /* Extended Security is not supported. */
+    if (sd->spec_version >= SD_PHY_SPECv3_01_VERS) {
+        sd->scr[2] |= 1 << 7;   /* Spec Version 3.0X */
+    }
     sd->scr[3] = 0x00;
     /* reserved for manufacturer usage */
     sd->scr[4] = 0x00;
@@ -2068,7 +2071,7 @@ static void sd_realize(DeviceState *dev, Error **errp)
 
     switch (sd->spec_version) {
     case SD_PHY_SPECv1_10_VERS
-     ... SD_PHY_SPECv2_00_VERS:
+     ... SD_PHY_SPECv3_01_VERS:
         break;
     default:
         error_setg(errp, "Invalid SD card Spec version: %u", sd->spec_version);
Signature · 1 line
2.17.1
#6 lore raw

PATCH v2 6/7 sdcard: Disable CMD19/CMD23 for Spec v2

In reply to Philippe Mathieu-Daudé

These commands got introduced by Spec v3
(see 0c3fb03f7ec and 4481bbc79d2).

---
 hw/sd/sd.c | 6 ++++++
 1 file changed, 6 insertions(+)
hw/sd/sd.c +6 -0
index 4e49a3827a..540bccb8d1 100644
@@ -1179,6 +1179,9 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)
         break;
 
     case 19:    /* CMD19: SEND_TUNING_BLOCK (SD) */
+        if (sd->spec_version < SD_PHY_SPECv3_01_VERS) {
+            break;
+        }
         if (sd->state == sd_transfer_state) {
             sd->state = sd_sendingdata_state;
             sd->data_offset = 0;
@@ -1187,6 +1190,9 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)
         break;
 
     case 23:    /* CMD23: SET_BLOCK_COUNT */
+        if (sd->spec_version < SD_PHY_SPECv3_01_VERS) {
+            break;
+        }
         switch (sd->state) {
         case sd_transfer_state:
             sd->multi_blk_cnt = req.arg;
Signature · 1 line
2.17.1
#7 lore raw

RFC PATCH v2 7/7 hw/sd/ssi-sd: Force cards connected in SPI mode to use Spec v1.10

In reply to Philippe Mathieu-Daudé

Due to physical restriction in SPI mode the maximum transfer speed is limited. All the extensions added after Spec v3 are simply not supported in SPI mode:

7.1 Introduction

The SPI mode consists of a secondary communication protocol that is offered by Flash-based SD Memory Cards. This mode is a subset of the SD Memory Card protocol, designed to communicate with a SPI channel, commonly found in Motorola's (and lately a few other vendors') microcontrollers. The interface is selected during the first reset command after power up (CMD0) and cannot be changed once the part is powered on.
The SPI standard defines the physical link only, and not the complete data transfer protocol. The SD Memory Card SPI implementation uses a subset of the SD Memory Card protocol and command set. The advantage of the SPI mode is the capability of using an off-the-shelf host, hence reducing the design-in effort to minimum. The disadvantage is the loss of performance of the SPI mode versus SD mode (e.g. Single data line and hardware CS signal per card).
The commands and functions in SD mode defined after the Version 2.00 are not supported in SPI mode. The card may respond to the commands and functions even if the card is in SPI mode but host should not use them in SPI mode.

Some firmwares use the CMD8 in SPI mode to poll which Spec version the SD card supports.

7.2.1 Mode Selection and Initialization (SPI mode)

The SD Card is powered up in the SD mode. It will enter SPI mode if the CS signal is asserted (negative) during the reception of the reset command (CMD0). If the card recognizes that the SD mode is required it will not respond to the command and remain in the SD mode. If SPI mode is required, the card will switch to SPI and respond with the SPI mode R1 response.
The only way to return to the SD mode is by entering the power cycle. In SPI mode, the SD Card protocol state machine in SD mode is not observed. All the SD Card commands supported in SPI mode are always available. [...]
If the card indicates an illegal command, the card is legacy and does not support CMD8. If the card supports CMD8 and can operate on the supplied voltage, the response echoes back the supply voltage and the check pattern that were set in the command argument.

The NuttX RTOS use it too:

    /* Check for SDHC Version 2.x.  CMD 8 is reserved on SD version 1.0 and
     * MMC.
     */
    finfo("Send CMD8\n");
    result = mmcsd_sendcmd(slot, &g_cmd8, 0x1aa);
    if (result == MMCSD_SPIR1_IDLESTATE)
      ...
    /* Check for SDC version 1.x or MMC */
    else
      ...

See https://bitbucket.org/nuttx/nuttx/src/nuttx-7.25/drivers/mmcsd/mmcsd_spi.c?mmcsd_spi.c-1645#mmcsd_spi.c-1645

The Stellaris LM3S6965EVB board is the only model using SD cards in SPI mode. The firmware found to work with the board expect the card to be following Spec v1 to work, and is the only one stressing the v1 code path of the SD card model.
Thus it seems clever to restrict SPI connected cards to use Spec v1.

---
This change would be better in the lm3s6965evb_init() rathar than here in ssi-sd.

As suggested by Peter and Thomas here:
http://lists.nongnu.org/archive/html/qemu-devel/2018-05/msg06616.html

We can use -device sd-card,spec_version=1 to avoid this change.

$ arm-softmmu/qemu-system-arm \
      -M lm3s6965evb -nodefaults \
      -serial stdio \
      -kernel sd_card.bin \
      -drive file=sdcard.img,id=mycard,if=none \
      -device sd-card,spi=true,spec_version=1,drive=mycard 
qemu-system-arm: warning: nic stellaris_enet.0 has no peer
SD Card Example Program
Type 'help' for help.

/> ls
Open
listing

----A 2012/04/25 17:44 12 README.TXT

1 File(s), 12 bytes total
0 Dir(s), 61182K bytes free

/> cat README.TXT
Hello World

/>

Even if there are still 2 cards...

(qemu) info qtree
bus: main-system-bus
type System
dev: pl022, id ""

    gpio-out "sysbus-irq" 1
    mmio 0000000040008000/0000000000001000
    bus: ssi
      type SSI
      dev: ssd0323, id ""
        gpio-in "" 1
        gpio-in "ssi-gpio-cs" 1
      dev: ssi-sd, id ""
        gpio-in "ssi-gpio-cs" 1
        bus: sd-bus
          type sd-bus
          dev: sd-card, id ""
            spec_version = 1 (0x1)
            drive = "mycard"
            spi = true
          dev: sd-card, id ""
            spec_version = 2 (0x2)
            drive = ""
            spi = true
 hw/sd/ssi-sd.c | 2 ++
 1 file changed, 2 insertions(+)
hw/sd/ssi-sd.c +2 -0
index 96542ecd62..82470a12e2 100644
@@ -252,6 +252,8 @@ static void ssi_sd_realize(SSISlave *d, Error **errp)
     /* FIXME use a qdev drive property instead of drive_get_next() */
     dinfo = drive_get_next(IF_SD);
     carddev = qdev_create(&s->sdbus.qbus, TYPE_SD_CARD);
+    object_property_set_uint(OBJECT(carddev),
+                             SD_PHY_SPECv1_10_VERS, "spec_version", &err);
     if (dinfo) {
         qdev_prop_set_drive(carddev, "drive", blk_by_legacy_dinfo(dinfo), &err);
     }
Signature · 1 line
2.17.1
#8 lore raw

Re: [Qemu-arm] [RFC PATCH v2 7/7] hw/sd/ssi-sd: Force cards connected in SPI mode to use Spec v1.10

Quoted 3 lines · Philippe Mathieu-Daudé

Due to physical restriction in SPI mode the maximum transfer speed is limited. All the extensions added after Spec v3 are simply not supported in SPI mode:

You say here that SPI mode doesn't support extensions added "after spec v3"...

Quoted 11 lines

7.1 Introduction

The SPI mode consists of a secondary communication protocol that is offered by Flash-based SD Memory Cards. This mode is a subset of the SD Memory Card protocol, designed to communicate with a SPI channel, commonly found in Motorola's (and lately a few other vendors') microcontrollers. The interface is selected during the first reset command after power up (CMD0) and cannot be changed once the part is powered on.
The SPI standard defines the physical link only, and not the complete data transfer protocol. The SD Memory Card SPI

Quoted 8 lines

implementation uses a subset of the SD Memory Card protocol and command set. The advantage of the SPI mode is the capability of using an off-the-shelf host, hence reducing the design-in effort to minimum. The disadvantage is the loss of performance of the SPI mode versus SD mode (e.g. Single data line and hardware CS signal per card).
The commands and functions in SD mode defined after the Version 2.00 are not supported in SPI mode.

...but here quote the spec which says that commands defined after version 2.00 are not supported in SPI mode...

and then the patch itself enforces spec 1.10, rather than 2. So I'm confused.

Quoted 38 lines

The card may respond to the
commands and functions even if the card is in SPI mode but host should not use them in SPI mode.

Some firmwares use the CMD8 in SPI mode to poll which Spec version the SD card supports.

7.2.1 Mode Selection and Initialization (SPI mode)

The SD Card is powered up in the SD mode. It will enter SPI mode if the CS signal is asserted (negative) during the reception of the reset command (CMD0). If the card recognizes that the SD mode is required it will not respond to the command and remain in the SD mode. If SPI mode is required, the card will switch to SPI and respond with the SPI mode R1 response.
The only way to return to the SD mode is by entering the power cycle. In SPI mode, the SD Card protocol state machine in SD mode is not observed. All the SD Card commands supported in SPI mode are always available. [...]
If the card indicates an illegal command, the card is legacy and does not support CMD8. If the card supports CMD8 and can operate on the supplied voltage, the response echoes back the supply voltage and the check pattern that were set in the command argument.

The NuttX RTOS use it too:

    /* Check for SDHC Version 2.x.  CMD 8 is reserved on SD version 1.0 and
     * MMC.
     */
    finfo("Send CMD8\n");
    result = mmcsd_sendcmd(slot, &g_cmd8, 0x1aa);
    if (result == MMCSD_SPIR1_IDLESTATE)
      ...
    /* Check for SDC version 1.x or MMC */
    else
      ...
Quoted 1 line

See https://bitbucket.org/nuttx/nuttx/src/nuttx-7.25/drivers/mmcsd/mmcsd_spi.c?mmcsd_spi.c-1645#mmcsd_spi.c-1645

This seems reasonable guest behaviour, and it's what the spec says to do. Why do we need to enforce 1.10 to get things to work?

thanks
-- PMM

#9 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 5 lines · Philippe Mathieu-Daudé

Since v2:
- heavy documentation improvements
- squashed previous 3+4 "add spec_version property default to v2" for atomicity
- SSI/SD patch downgraded to RFC
- added Alistair R-b tags

Patches missing review: #1 and #4 (#6 being RFC waits for comments).

#10 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 6 lines · Philippe Mathieu-Daudé

Since v2:
- heavy documentation improvements
- squashed previous 3+4 "add spec_version property default to v2" for atomicity
- SSI/SD patch downgraded to RFC
- added Alistair R-b tags

Quoted 8 lines

Philippe Mathieu-Daudé (7):
sdcard: Update the Configuration Register (SCR) to Spec Version 1.10
sdcard: Allow commands valid in SPI mode
sdcard: Add a 'spec_version' property, default to Spec v2.00
sdcard: Disable SEND_IF_COND (CMD8) for Spec v1
sdcard: Reflect when the Spec v3 is supported in the Config Register (SCR)
sdcard: Disable CMD19/CMD23 for Spec v2
hw/sd/ssi-sd: Force cards connected in SPI mode to use Spec v1.10

Hi; I've applied patches 1-6 to target-arm.next. 7 I had a question about.

thanks
-- PMM

#11 lore raw
Quoted 16 lines · Peter Maydell
Quoted 6 lines · Philippe Mathieu-Daudé

Since v2:
- heavy documentation improvements
- squashed previous 3+4 "add spec_version property default to v2" for atomicity
- SSI/SD patch downgraded to RFC
- added Alistair R-b tags

Quoted 8 lines

Philippe Mathieu-Daudé (7):
sdcard: Update the Configuration Register (SCR) to Spec Version 1.10
sdcard: Allow commands valid in SPI mode
sdcard: Add a 'spec_version' property, default to Spec v2.00
sdcard: Disable SEND_IF_COND (CMD8) for Spec v1
sdcard: Reflect when the Spec v3 is supported in the Config Register (SCR)
sdcard: Disable CMD19/CMD23 for Spec v2
hw/sd/ssi-sd: Force cards connected in SPI mode to use Spec v1.10

Quoted 2 lines

Hi; I've applied patches 1-6 to target-arm.next. 7 I had a question about.

Thanks!