driver: usdhc: fix spec 1.0 sdcard can't work

The SD Card below Physical Layer 1.10 does not support CMD6.
When usdhc_sd_init is executed, it will fail to exit due to
execution of CMD6, causing the SD Card to not work normally.

For different SD Card Physical Layer specifications,
the following modifications have been made:
Version 1.10 and above support CMD6.
Version 3.0 and above support CMD6 Group 3 (driver strength
and current limit) .

Signed-off-by: Frank Li <lgl88911@163.com>
This commit is contained in:
Frank Li 2021-03-31 21:55:24 +08:00 committed by Maureen Helm
commit 664aaf0bdc

View file

@ -2534,20 +2534,22 @@ APP_SEND_OP_COND_AGAIN:
usdhc_set_bus_width(base, USDHC_DATA_BUS_WIDTH_4BIT);
}
/* set sd card driver strength */
ret = usdhc_select_fun(priv, SD_GRP_DRIVER_STRENGTH_MODE,
priv->card_info.driver_strength);
if (ret) {
LOG_ERR("Set SD driver strehgth failed: %d\r\n", ret);
return ret;
}
if (priv->card_info.version >= SD_SPEC_VER3_0) {
/* set sd card driver strength */
ret = usdhc_select_fun(priv, SD_GRP_DRIVER_STRENGTH_MODE,
priv->card_info.driver_strength);
if (ret) {
LOG_ERR("Set SD driver strehgth failed: %d\r\n", ret);
return ret;
}
/* set sd card current limit */
ret = usdhc_select_fun(priv, SD_GRP_CURRENT_LIMIT_MODE,
priv->card_info.max_current);
if (ret) {
LOG_ERR("Set SD current limit failed: %d\r\n", ret);
return ret;
/* set sd card current limit */
ret = usdhc_select_fun(priv, SD_GRP_CURRENT_LIMIT_MODE,
priv->card_info.max_current);
if (ret) {
LOG_ERR("Set SD current limit failed: %d\r\n", ret);
return ret;
}
}
/* set block size */
@ -2560,11 +2562,13 @@ APP_SEND_OP_COND_AGAIN:
return -EIO;
}
/* select bus timing */
ret = usdhc_select_bus_timing(priv);
if (ret) {
LOG_ERR("Select bus timing failed: %d\r\n", ret);
return ret;
if (priv->card_info.version > SD_SPEC_VER1_0) {
/* select bus timing */
ret = usdhc_select_bus_timing(priv);
if (ret) {
LOG_ERR("Select bus timing failed: %d\r\n", ret);
return ret;
}
}
retry = 10;