driver: usdhc: add option to disable 1.8v
When 1.8V is disabled, sdhc can only communicate at low speed. But this can save the external circuit for switching between 3.3V and 1.8V, which is very practical in costdown scenarios. Signed-off-by: Frank Li <lgl88911@163.com>
This commit is contained in:
parent
f69a38162a
commit
42333dc282
|
@ -388,6 +388,8 @@ struct usdhc_config {
|
|||
uint8_t detect_pin;
|
||||
gpio_dt_flags_t detect_flags;
|
||||
|
||||
bool no_1_8_v;
|
||||
|
||||
uint32_t data_timeout;
|
||||
/* Data timeout value
|
||||
*/
|
||||
|
@ -2339,8 +2341,10 @@ static int usdhc_sd_init(struct usdhc_priv *priv)
|
|||
/* allow user select the work voltage, if not select,
|
||||
* sdmmc will handle it automatically
|
||||
*/
|
||||
if (USDHC_SUPPORT_V180_FLAG != SDMMCHOST_NOT_SUPPORT) {
|
||||
app_cmd_41_arg |= SD_OCR_SWITCH_18_REQ_FLAG;
|
||||
if (priv->config->no_1_8_v == false) {
|
||||
if (USDHC_SUPPORT_V180_FLAG != SDMMCHOST_NOT_SUPPORT) {
|
||||
app_cmd_41_arg |= SD_OCR_SWITCH_18_REQ_FLAG;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check card's supported interface condition. */
|
||||
|
@ -2387,9 +2391,12 @@ APP_SEND_OP_COND_AGAIN:
|
|||
if (cmd->response[0U] & SD_OCR_CARD_CAP_FLAG) {
|
||||
priv->card_info.card_flags |= SDHC_HIGH_CAPACITY_FLAG;
|
||||
}
|
||||
/* 1.8V support */
|
||||
if (cmd->response[0U] & SD_OCR_SWITCH_18_ACCEPT_FLAG) {
|
||||
priv->card_info.card_flags |= SDHC_1800MV_FLAG;
|
||||
|
||||
if (priv->config->no_1_8_v == false) {
|
||||
/* 1.8V support */
|
||||
if (cmd->response[0U] & SD_OCR_SWITCH_18_ACCEPT_FLAG) {
|
||||
priv->card_info.card_flags |= SDHC_1800MV_FLAG;
|
||||
}
|
||||
}
|
||||
priv->card_info.raw_ocr = cmd->response[0U];
|
||||
} else {
|
||||
|
@ -2831,6 +2838,7 @@ static int disk_usdhc_init(const struct device *dev)
|
|||
.nusdhc = n, \
|
||||
DISK_ACCESS_USDHC_INIT_PWR(n) \
|
||||
DISK_ACCESS_USDHC_INIT_CD(n) \
|
||||
.no_1_8_v = DT_INST_PROP(n, no_1_8_v), \
|
||||
.data_timeout = USDHC_DATA_TIMEOUT, \
|
||||
.endian = USDHC_LITTLE_ENDIAN, \
|
||||
.read_watermark = USDHC_READ_WATERMARK_LEVEL, \
|
||||
|
|
|
@ -27,5 +27,12 @@ properties:
|
|||
property value should ensure the flags properly describe the signal
|
||||
that is presented to the driver.
|
||||
|
||||
no-1-8-v:
|
||||
type: boolean
|
||||
required: false
|
||||
description:
|
||||
When the external SD card circuit does not support 1.8V, add this
|
||||
property to disable 1.8v card voltage of SD card controller.
|
||||
|
||||
label:
|
||||
required: true
|
||||
|
|
Loading…
Reference in a new issue