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:
parent
28ac1f70bf
commit
664aaf0bdc
1 changed files with 22 additions and 18 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue