Message ID | 20180603000827.30872-2-f4bug@amsat.org |
---|---|
State | New |
Headers | show |
Series | [1/8] sdcard: Update the Configuration Register (SCR) to Spec Version 1.10 | expand |
On 3 June 2018 at 01:08, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote: > This 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." Can you provide a brief justification in the commit message of why it makes more sense for us to advertise as 1.10, please? (eg a summary of the 1.01 to 1.10 differences and a note that we already implement them) thanks -- PMM
Hi Peter, On 06/07/2018 08:00 AM, Peter Maydell wrote: > On 3 June 2018 at 01:08, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote: >> This 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." > > Can you provide a brief justification in the commit message > of why it makes more sense for us to advertise as 1.10, please? > > (eg a summary of the 1.01 to 1.10 differences and a note > that we already implement them) The only differences I found are: 4.3.11 High-Speed mode (25MB/sec interface speed) (This chapter is newly added in version 1.10) 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 current codebase is a mix of v1 registers and v2 commands (which were added slowly without updating all registers). As of now v1 is broken (See the lm3s6965evb machine can not use the card) and all users are using v2. My goal with these series is to also support v3. It might be more obvious to first enforce the current implementation is v2, then restore v1 support and go for v3. I think this is doable by an easy rebase of this series (keep v2 and restore v1). Do you think this is better? Regards, Phil.
On 7 June 2018 at 16:14, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote: > The current codebase is a mix of v1 registers and v2 commands (which > were added slowly without updating all registers). > As of now v1 is broken (See the lm3s6965evb machine can not use the > card) and all users are using v2. > My goal with these series is to also support v3. > > It might be more obvious to first enforce the current implementation is > v2, then restore v1 support and go for v3. I think this is doable by an > easy rebase of this series (keep v2 and restore v1). > > Do you think this is better? I don't have a strong opinion (you have a better grasp of the specs than me); I'd just like justification for why we do what we do in the commit messages and/or comments as appropriate. thanks -- PMM
On 06/07/2018 12:14 PM, Philippe Mathieu-Daudé wrote: > On 06/07/2018 08:00 AM, Peter Maydell wrote: >> On 3 June 2018 at 01:08, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote: >>> This 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." >> >> Can you provide a brief justification in the commit message >> of why it makes more sense for us to advertise as 1.10, please? >> >> (eg a summary of the 1.01 to 1.10 differences and a note >> that we already implement them) > > The only differences I found are: And I shamefully missed: 4.3.10 Switch function command (This chapter is newly added in version 1.10) 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) > (This chapter is newly added in version 1.10) > > 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).
diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 7af19fa06c..e1218d1fb6 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -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. */
This 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." Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> --- hw/sd/sd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)