.. | .. |
---|
1468 | 1468 | { |
---|
1469 | 1469 | struct dw_mci_slot *slot = mmc_priv(mmc); |
---|
1470 | 1470 | const struct dw_mci_drv_data *drv_data = slot->host->drv_data; |
---|
1471 | | - u32 regs; |
---|
| 1471 | + u32 regs, power_off_delay; |
---|
1472 | 1472 | int ret; |
---|
1473 | 1473 | |
---|
1474 | 1474 | switch (ios->bus_width) { |
---|
.. | .. |
---|
1507 | 1507 | |
---|
1508 | 1508 | switch (ios->power_mode) { |
---|
1509 | 1509 | case MMC_POWER_UP: |
---|
1510 | | - if (!IS_ERR_OR_NULL(slot->host->pinctrl)) |
---|
1511 | | - pinctrl_select_state(slot->host->pinctrl, slot->host->idle_state); |
---|
| 1510 | + if (dw_mci_get_cd(mmc) && !IS_ERR_OR_NULL(slot->host->pinctrl)) { |
---|
| 1511 | + if (!pinctrl_select_state(slot->host->pinctrl, slot->host->idle_state)) { |
---|
| 1512 | + if (device_property_read_u32(slot->host->dev, "power-off-delay-ms", |
---|
| 1513 | + &power_off_delay)) |
---|
| 1514 | + power_off_delay = 200; |
---|
| 1515 | + msleep(power_off_delay); |
---|
| 1516 | + } |
---|
| 1517 | + } |
---|
1512 | 1518 | |
---|
1513 | 1519 | if (!IS_ERR(mmc->supply.vmmc)) { |
---|
1514 | 1520 | ret = mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, |
---|