.. | .. |
---|
246 | 246 | * ...also allow sending for SDMMC_CMD_VOLT_SWITCH where busy is |
---|
247 | 247 | * expected. |
---|
248 | 248 | */ |
---|
249 | | -#ifdef CONFIG_ROCKCHIP_THUNDER_BOOT |
---|
| 249 | +#ifdef CONFIG_ROCKCHIP_THUNDER_BOOT_MMC |
---|
250 | 250 | if (host->slot->mmc->restrict_caps & RESTRICT_CARD_TYPE_EMMC) |
---|
251 | 251 | delay = 0; |
---|
252 | 252 | #endif |
---|
.. | .. |
---|
1508 | 1508 | |
---|
1509 | 1509 | switch (ios->power_mode) { |
---|
1510 | 1510 | case MMC_POWER_UP: |
---|
| 1511 | + if (!IS_ERR_OR_NULL(slot->host->pinctrl)) |
---|
| 1512 | + pinctrl_select_state(slot->host->pinctrl, slot->host->idle_state); |
---|
| 1513 | + |
---|
1511 | 1514 | if (!IS_ERR(mmc->supply.vmmc)) { |
---|
1512 | 1515 | ret = mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, |
---|
1513 | 1516 | ios->vdd); |
---|
.. | .. |
---|
1524 | 1527 | mci_writel(slot->host, PWREN, regs); |
---|
1525 | 1528 | break; |
---|
1526 | 1529 | case MMC_POWER_ON: |
---|
| 1530 | + if (!IS_ERR_OR_NULL(slot->host->pinctrl)) |
---|
| 1531 | + pinctrl_select_state(slot->host->pinctrl, slot->host->normal_state); |
---|
| 1532 | + |
---|
1527 | 1533 | if (!slot->host->vqmmc_enabled) { |
---|
1528 | 1534 | if (!IS_ERR(mmc->supply.vqmmc)) { |
---|
1529 | 1535 | ret = regulator_enable(mmc->supply.vqmmc); |
---|
.. | .. |
---|
1548 | 1554 | |
---|
1549 | 1555 | break; |
---|
1550 | 1556 | case MMC_POWER_OFF: |
---|
| 1557 | + if (!IS_ERR_OR_NULL(slot->host->pinctrl)) |
---|
| 1558 | + pinctrl_select_state(slot->host->pinctrl, slot->host->idle_state); |
---|
| 1559 | + |
---|
1551 | 1560 | /* Turn clock off before power goes down */ |
---|
1552 | 1561 | dw_mci_setup_bus(slot, false); |
---|
1553 | 1562 | |
---|
.. | .. |
---|
3272 | 3281 | return ERR_PTR(ret); |
---|
3273 | 3282 | } |
---|
3274 | 3283 | |
---|
| 3284 | + host->pinctrl = devm_pinctrl_get(host->dev); |
---|
| 3285 | + if (!IS_ERR(host->pinctrl)) { |
---|
| 3286 | + host->normal_state = pinctrl_lookup_state(host->pinctrl, "normal"); |
---|
| 3287 | + if (IS_ERR(host->normal_state)) |
---|
| 3288 | + dev_warn(dev, "No normal pinctrl state\n"); |
---|
| 3289 | + |
---|
| 3290 | + host->idle_state = pinctrl_lookup_state(host->pinctrl, "idle"); |
---|
| 3291 | + if (IS_ERR(host->idle_state)) |
---|
| 3292 | + dev_warn(dev, "No idle pinctrl state\n"); |
---|
| 3293 | + |
---|
| 3294 | + if (!IS_ERR(host->normal_state) && !IS_ERR(host->idle_state)) |
---|
| 3295 | + pinctrl_select_state(host->pinctrl, host->idle_state); |
---|
| 3296 | + else |
---|
| 3297 | + host->pinctrl = NULL; |
---|
| 3298 | + } |
---|
| 3299 | + |
---|
3275 | 3300 | return pdata; |
---|
3276 | 3301 | } |
---|
3277 | 3302 | |
---|
.. | .. |
---|
3329 | 3354 | return ret; |
---|
3330 | 3355 | } |
---|
3331 | 3356 | } |
---|
3332 | | -#ifdef CONFIG_ROCKCHIP_THUNDER_BOOT |
---|
| 3357 | +#ifdef CONFIG_ROCKCHIP_THUNDER_BOOT_MMC |
---|
3333 | 3358 | if (device_property_read_bool(host->dev, "supports-emmc")) { |
---|
3334 | 3359 | if (readl_poll_timeout(host->regs + SDMMC_STATUS, |
---|
3335 | 3360 | fifo_size, |
---|