[PATCH v2 0/4] rockchip: sdhci: Fix reinit and add HS400 Enhanced Strobe support

Alper Nebi Yasak alpernebiyasak at gmail.com
Tue Jan 11 14:39:27 CET 2022


My rk3399-gru-kevin has some problems with the eMMC. The board can boot
to U-Boot proper with the eMMC working at a low speed, but trying to
reinitialize it with "mmc dev 0" or "mmc rescan" makes it unusable. If
the HS400 mode is enabled, it times out while executing tuning and
doesn't even start at a working state.

To work around these errors, I had implemented support for the HS400
Enhanced Strobe mode as the first version of this series. I have also
managed the fix the issue above (related to power-cycling the eMMC PHY),
which exposed another one with this series: reinitialization at lower
speeds fail if the ES bit is set. Since fixing that needed changes to
this series I decided to send the previous fix as part of this instead
of as an independent patch.

To test, I'm building with the following configs enabled:

    +CONFIG_MMC_SPEED_MODE_SET=y
     [...]
     CONFIG_MMC_PWRSEQ=y
    +CONFIG_MMC_IO_VOLTAGE=y
    +CONFIG_MMC_UHS_SUPPORT=y
    +CONFIG_MMC_HS400_ES_SUPPORT=y
    +CONFIG_MMC_HS400_SUPPORT=y
     CONFIG_MMC_DW=y
     CONFIG_MMC_DW_ROCKCHIP=y
     CONFIG_MMC_SDHCI=y
    +CONFIG_MMC_SDHCI_SDMA=y
     CONFIG_MMC_SDHCI_ROCKCHIP=y

and running roughly:

    $ mmc rescan [0|1|3|10|11|12]
    $ mmc info
    $ mmc part
    $ load mmc 0:1 0xd0000000 256MiB.bin
    $ load mmc 0:1 0xd0000000 16MiB.bin
    $ load mmc 0:1 0xd0000000 8MiB.bin

I used to test by loading different sizes from a very big file (~7GiB),
but that's slower than reading fixed-size files for some reason I don't
know. I thought loading full files would be a better test so I switched
to those. Here's the differences in info and speeds I get with this:

    Mode                   | Bus Speed    | Bus Width
    -----------------------+--------------+--------------
    MMC Legacy             | 25000000     | 8-bit
    MMC High Speed (26MHz) | 26000000     | 8-bit
    MMC High Speed (52MHz) | 52000000     | 8-bit
    HS200 (200MHz)         | 200000000    | 8-bit
    HS400 (200MHz)         | 200000000    | 8-bit DDR
    HS400ES (200MHz)       | 200000000    | 8-bit DDR

    Mode                   | 256 MiB Load | 16 MiB Load  | 8 MiB Load
    -----------------------+--------------+--------------+--------------
    MMC Legacy             | ~22.1  MiB/s | ~21.9  MiB/s | ~21.6  MiB/s
    MMC High Speed (26MHz) | ~22.1  MiB/s | ~21.9  MiB/s | ~21.6  MiB/s
    MMC High Speed (52MHz) | ~43.7  MiB/s | ~42.8  MiB/s | ~41.7  MiB/s
    HS200 (200MHz)         | ~161.2 MiB/s | ~149.5 MiB/s | ~137.9 MiB/s
    HS400 (200MHz)         | ~254.5 MiB/s | ~235.3 MiB/s | ~216.2 MiB/s
    HS400ES (200MHz)       | ~254.7 MiB/s | ~238.8 MiB/s | ~216.2 MiB/s

Hope I haven't missed anything. Enabling the configs above for each
board is left to board maintainers as I can't test on those boards.

As an aside, I want to further clean up this driver when I have the time
(it's a weird combination of what could be three different drivers), but
wanted to send this as it at least gets the driver to a working state.

Changes in v2:
- Add patch to fix PHY power cycling at higher speeds
- Unset ES bit in rk3399 set_control_reg() to fix a reinit issue
- Don't use unnecessary & for function pointer in ops struct
- Rename rk3399_set_enhanced_strobe -> rk3399_sdhci_set_enhanced_strobe
- Rename rk3568_set_enhanced_strobe -> rk3568_sdhci_set_enhanced_strobe
- Let set_enhanced_strobe() unset the ES bit if mode is not HS400_ES
- Rewrote cover letter

v1: https://patchwork.ozlabs.org/project/uboot/list/?series=269768

Alper Nebi Yasak (4):
  mmc: sdhci: Add HS400 Enhanced Strobe support
  rockchip: sdhci: Fix RK3399 eMMC PHY power cycling
  rockchip: sdhci: Add HS400 Enhanced Strobe support for RK3399
  rockchip: sdhci: Add HS400 Enhanced Strobe support for RK3568

 drivers/mmc/rockchip_sdhci.c | 121 ++++++++++++++++++++++++++++++++---
 drivers/mmc/sdhci.c          |  18 ++++++
 include/sdhci.h              |   1 +
 3 files changed, 130 insertions(+), 10 deletions(-)

-- 
2.34.1



More information about the U-Boot mailing list