Commit 186cd8b7 authored by Jerome Brunet's avatar Jerome Brunet Committed by Ulf Hansson

mmc: meson-gx: implement card_busy callback

Implement the card_busy callback to be able to verify that the
card is done dealing with voltage switch, when the support is
added later on.
Reviewed-by: default avatarKevin Hilman <khilman@baylibre.com>
Signed-off-by: default avatarJerome Brunet <jbrunet@baylibre.com>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent 74858655
...@@ -76,6 +76,7 @@ ...@@ -76,6 +76,7 @@
#define SD_EMMC_STATUS 0x48 #define SD_EMMC_STATUS 0x48
#define STATUS_BUSY BIT(31) #define STATUS_BUSY BIT(31)
#define STATUS_DATI GENMASK(23, 16)
#define SD_EMMC_IRQ_EN 0x4c #define SD_EMMC_IRQ_EN 0x4c
#define IRQ_RXD_ERR_MASK GENMASK(7, 0) #define IRQ_RXD_ERR_MASK GENMASK(7, 0)
...@@ -902,6 +903,17 @@ static void meson_mmc_cfg_init(struct meson_host *host) ...@@ -902,6 +903,17 @@ static void meson_mmc_cfg_init(struct meson_host *host)
writel(cfg, host->regs + SD_EMMC_CFG); writel(cfg, host->regs + SD_EMMC_CFG);
} }
static int meson_mmc_card_busy(struct mmc_host *mmc)
{
struct meson_host *host = mmc_priv(mmc);
u32 regval;
regval = readl(host->regs + SD_EMMC_STATUS);
/* We are only interrested in lines 0 to 3, so mask the other ones */
return !(FIELD_GET(STATUS_DATI, regval) & 0xf);
}
static const struct mmc_host_ops meson_mmc_ops = { static const struct mmc_host_ops meson_mmc_ops = {
.request = meson_mmc_request, .request = meson_mmc_request,
.set_ios = meson_mmc_set_ios, .set_ios = meson_mmc_set_ios,
...@@ -909,6 +921,7 @@ static const struct mmc_host_ops meson_mmc_ops = { ...@@ -909,6 +921,7 @@ static const struct mmc_host_ops meson_mmc_ops = {
.pre_req = meson_mmc_pre_req, .pre_req = meson_mmc_pre_req,
.post_req = meson_mmc_post_req, .post_req = meson_mmc_post_req,
.execute_tuning = meson_mmc_execute_tuning, .execute_tuning = meson_mmc_execute_tuning,
.card_busy = meson_mmc_card_busy,
}; };
static int meson_mmc_probe(struct platform_device *pdev) static int meson_mmc_probe(struct platform_device *pdev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment