Re: [Qemu-devel] [PATCH v4 00/20] SDCard: bugfixes, support UHS-I (part 5)

2018-03-03 Thread Philippe Mathieu-Daudé
Hi Peter,

On 02/22/2018 11:31 AM, Peter Maydell wrote:
> On 15 February 2018 at 22:13, Philippe Mathieu-Daudé  wrote:
>> Some refactors, few bugfixes, better SD/SPI support.
>>
>> With this series apply, machines can use SD cards in UHS-I mode.
>> (mostly imported from Alistair Francis work)
>>
>> MMC mode split out for another series,
>> so UHS enabled MMC cards are still not usable:
>>
>>   kernel: mmc0: SDHCI controller on PCI [:00:05.0] using ADMA
>>   kernel: sd 0:0:0:0: Attached scsi generic sg0 type 0
>>   kernel: mmc0: Skipping voltage switch
>>   [mmc kthread looping]
>>
>> Since v3:
>> - simpler SPI handling, improved descriptions (Alistair review)
>> - inverted patches 16/17 order
>>
>> Since v2:
>> - split again in 2... other part is cleanup/tracing
>>
>> Since v1:
>> - rewrote mostly all patches to keep it simpler.
>>
>> $ git backport-diff
>> 001/20:[] [-C] 'sdcard: Don't always set the high capacity bit'
>> 002/20:[] [-C] 'sdcard: update the CSD CRC register regardless the CSD 
>> structure version'
>> 003/20:[] [-C] 'sdcard: fix the 'maximum data transfer rate' to 25MHz'
>> 004/20:[] [-C] 'sdcard: clean the SCR register and add few comments'
>> 005/20:[] [--] 'sdcard: remove commands from unsupported old MMC 
>> specification'
>> 006/20:[] [--] 'sdcard: simplify using the ldst API'
>> 007/20:[0008] [FC] 'sdcard: use the correct masked OCR in the R3 reply'
>> 008/20:[] [-C] 'sdcard: use the registerfields API for the CARD_STATUS 
>> register masks'
>> 009/20:[] [--] 'sdcard: handle CMD54 (SDIO)'
>> 010/20:[down] 'sdcard: handle the Security Specification commands'
>> 011/20:[down] 'sdcard: use a more descriptive label 'unimplemented_spi_cmd''
>> 012/20:[0034] [FC] 'sdcard: handles more commands in SPI mode'
>> 013/20:[] [--] 'sdcard: check the card is in correct state for APP CMD 
>> (CMD55)'
>> 014/20:[] [--] 'sdcard: warn if host uses an incorrect address for APP 
>> CMD (CMD55)'
>> 015/20:[] [--] 'sdcard: simplify SEND_IF_COND (CMD8)'
>> 016/20:[] [--] 'sdcard: simplify SD_SEND_OP_COND (ACMD41)'
>> 017/20:[] [--] 'sdcard: add SD SEND_TUNING_BLOCK (CMD19)'
>> 018/20:[] [--] 'sdcard: implement the UHS-I SWITCH_FUNCTION entries 
>> (Spec v3)'
>> 019/20:[] [-C] 'sdcard: add a 'uhs' property, update the OCR register 
>> ACCEPT_SWITCH_1V8 bit'
>> 020/20:[] [--] 'sdcard: add an enum for the SD PHY Spec version'
> 
> I've applied patches 1 to 16 to target-arm.next.

Thanks!

> Removing the CMD11 support worries me a bit -- presumably it was put there
> because some guest actually uses it -- but my test images seem to
> still boot OK...

Yes you are right, this command was available in the first MMC specs but
not included in the SD specs. The SD/MMC differences are not always easy
to track and implement, the last series is supposed to handle MMC in a
clearer way, I'll see to restore this command once there.

> 
> thanks
> -- PMM
> 



Re: [Qemu-devel] [PATCH v4 00/20] SDCard: bugfixes, support UHS-I (part 5)

2018-02-22 Thread Peter Maydell
On 15 February 2018 at 22:13, Philippe Mathieu-Daudé  wrote:
> Some refactors, few bugfixes, better SD/SPI support.
>
> With this series apply, machines can use SD cards in UHS-I mode.
> (mostly imported from Alistair Francis work)
>
> MMC mode split out for another series,
> so UHS enabled MMC cards are still not usable:
>
>   kernel: mmc0: SDHCI controller on PCI [:00:05.0] using ADMA
>   kernel: sd 0:0:0:0: Attached scsi generic sg0 type 0
>   kernel: mmc0: Skipping voltage switch
>   [mmc kthread looping]
>
> Since v3:
> - simpler SPI handling, improved descriptions (Alistair review)
> - inverted patches 16/17 order
>
> Since v2:
> - split again in 2... other part is cleanup/tracing
>
> Since v1:
> - rewrote mostly all patches to keep it simpler.
>
> $ git backport-diff
> 001/20:[] [-C] 'sdcard: Don't always set the high capacity bit'
> 002/20:[] [-C] 'sdcard: update the CSD CRC register regardless the CSD 
> structure version'
> 003/20:[] [-C] 'sdcard: fix the 'maximum data transfer rate' to 25MHz'
> 004/20:[] [-C] 'sdcard: clean the SCR register and add few comments'
> 005/20:[] [--] 'sdcard: remove commands from unsupported old MMC 
> specification'
> 006/20:[] [--] 'sdcard: simplify using the ldst API'
> 007/20:[0008] [FC] 'sdcard: use the correct masked OCR in the R3 reply'
> 008/20:[] [-C] 'sdcard: use the registerfields API for the CARD_STATUS 
> register masks'
> 009/20:[] [--] 'sdcard: handle CMD54 (SDIO)'
> 010/20:[down] 'sdcard: handle the Security Specification commands'
> 011/20:[down] 'sdcard: use a more descriptive label 'unimplemented_spi_cmd''
> 012/20:[0034] [FC] 'sdcard: handles more commands in SPI mode'
> 013/20:[] [--] 'sdcard: check the card is in correct state for APP CMD 
> (CMD55)'
> 014/20:[] [--] 'sdcard: warn if host uses an incorrect address for APP 
> CMD (CMD55)'
> 015/20:[] [--] 'sdcard: simplify SEND_IF_COND (CMD8)'
> 016/20:[] [--] 'sdcard: simplify SD_SEND_OP_COND (ACMD41)'
> 017/20:[] [--] 'sdcard: add SD SEND_TUNING_BLOCK (CMD19)'
> 018/20:[] [--] 'sdcard: implement the UHS-I SWITCH_FUNCTION entries (Spec 
> v3)'
> 019/20:[] [-C] 'sdcard: add a 'uhs' property, update the OCR register 
> ACCEPT_SWITCH_1V8 bit'
> 020/20:[] [--] 'sdcard: add an enum for the SD PHY Spec version'

I've applied patches 1 to 16 to target-arm.next.

Removing the CMD11 support worries me a bit -- presumably it was put there
because some guest actually uses it -- but my test images seem to
still boot OK...

thanks
-- PMM



Re: [Qemu-devel] [PATCH v4 00/20] SDCard: bugfixes, support UHS-I (part 5)

2018-02-22 Thread Philippe Mathieu-Daudé
ping? :)

On 02/15/2018 07:13 PM, Philippe Mathieu-Daudé wrote:
> Some refactors, few bugfixes, better SD/SPI support.
> 
> With this series apply, machines can use SD cards in UHS-I mode.
> (mostly imported from Alistair Francis work)
> 
> MMC mode split out for another series,
> so UHS enabled MMC cards are still not usable:
> 
>   kernel: mmc0: SDHCI controller on PCI [:00:05.0] using ADMA
>   kernel: sd 0:0:0:0: Attached scsi generic sg0 type 0
>   kernel: mmc0: Skipping voltage switch
>   [mmc kthread looping]
> 
> Since v3:
> - simpler SPI handling, improved descriptions (Alistair review)
> - inverted patches 16/17 order
> 
> Since v2:
> - split again in 2... other part is cleanup/tracing
> 
> Since v1:
> - rewrote mostly all patches to keep it simpler.
> 
> $ git backport-diff
> 001/20:[] [-C] 'sdcard: Don't always set the high capacity bit'
> 002/20:[] [-C] 'sdcard: update the CSD CRC register regardless the CSD 
> structure version'
> 003/20:[] [-C] 'sdcard: fix the 'maximum data transfer rate' to 25MHz'
> 004/20:[] [-C] 'sdcard: clean the SCR register and add few comments'
> 005/20:[] [--] 'sdcard: remove commands from unsupported old MMC 
> specification'
> 006/20:[] [--] 'sdcard: simplify using the ldst API'
> 007/20:[0008] [FC] 'sdcard: use the correct masked OCR in the R3 reply'
> 008/20:[] [-C] 'sdcard: use the registerfields API for the CARD_STATUS 
> register masks'
> 009/20:[] [--] 'sdcard: handle CMD54 (SDIO)'
> 010/20:[down] 'sdcard: handle the Security Specification commands'
> 011/20:[down] 'sdcard: use a more descriptive label 'unimplemented_spi_cmd''
> 012/20:[0034] [FC] 'sdcard: handles more commands in SPI mode'
> 013/20:[] [--] 'sdcard: check the card is in correct state for APP CMD 
> (CMD55)'
> 014/20:[] [--] 'sdcard: warn if host uses an incorrect address for APP 
> CMD (CMD55)'
> 015/20:[] [--] 'sdcard: simplify SEND_IF_COND (CMD8)'
> 016/20:[] [--] 'sdcard: simplify SD_SEND_OP_COND (ACMD41)'
> 017/20:[] [--] 'sdcard: add SD SEND_TUNING_BLOCK (CMD19)'
> 018/20:[] [--] 'sdcard: implement the UHS-I SWITCH_FUNCTION entries (Spec 
> v3)'
> 019/20:[] [-C] 'sdcard: add a 'uhs' property, update the OCR register 
> ACCEPT_SWITCH_1V8 bit'
> 020/20:[] [--] 'sdcard: add an enum for the SD PHY Spec version'
> 
> Based-on: 20180215220540.6556-12-f4...@amsat.org
> 
> Philippe Mathieu-Daudé (20):
>   sdcard: Don't always set the high capacity bit
>   sdcard: update the CSD CRC register regardless the CSD structure
> version
>   sdcard: fix the 'maximum data transfer rate' to 25MHz
>   sdcard: clean the SCR register and add few comments
>   sdcard: remove commands from unsupported old MMC specification
>   sdcard: simplify using the ldst API
>   sdcard: use the correct masked OCR in the R3 reply
>   sdcard: use the registerfields API for the CARD_STATUS register masks
>   sdcard: handle CMD54 (SDIO)
>   sdcard: handle the Security Specification commands
>   sdcard: use a more descriptive label 'unimplemented_spi_cmd'
>   sdcard: handles more commands in SPI mode
>   sdcard: check the card is in correct state for APP CMD (CMD55)
>   sdcard: warn if host uses an incorrect address for APP CMD (CMD55)
>   sdcard: simplify SEND_IF_COND (CMD8)
>   sdcard: simplify SD_SEND_OP_COND (ACMD41)
>   sdcard: add SD SEND_TUNING_BLOCK (CMD19)
>   sdcard: implement the UHS-I SWITCH_FUNCTION entries (Spec v3)
>   sdcard: add a 'uhs' property, update the OCR register
> ACCEPT_SWITCH_1V8 bit
>   sdcard: add an enum for the SD PHY Spec version
> 
>  hw/sd/sd.c | 498 
> -
>  hw/sd/trace-events |   1 +
>  2 files changed, 343 insertions(+), 156 deletions(-)
>