Skip to content

Commit 186cd8b

Browse files
jbrun3tstorulf
authored andcommitted
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: Kevin Hilman <[email protected]> Signed-off-by: Jerome Brunet <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
1 parent 7485865 commit 186cd8b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

drivers/mmc/host/meson-gx-mmc.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676

7777
#define SD_EMMC_STATUS 0x48
7878
#define STATUS_BUSY BIT(31)
79+
#define STATUS_DATI GENMASK(23, 16)
7980

8081
#define SD_EMMC_IRQ_EN 0x4c
8182
#define IRQ_RXD_ERR_MASK GENMASK(7, 0)
@@ -902,13 +903,25 @@ static void meson_mmc_cfg_init(struct meson_host *host)
902903
writel(cfg, host->regs + SD_EMMC_CFG);
903904
}
904905

906+
static int meson_mmc_card_busy(struct mmc_host *mmc)
907+
{
908+
struct meson_host *host = mmc_priv(mmc);
909+
u32 regval;
910+
911+
regval = readl(host->regs + SD_EMMC_STATUS);
912+
913+
/* We are only interrested in lines 0 to 3, so mask the other ones */
914+
return !(FIELD_GET(STATUS_DATI, regval) & 0xf);
915+
}
916+
905917
static const struct mmc_host_ops meson_mmc_ops = {
906918
.request = meson_mmc_request,
907919
.set_ios = meson_mmc_set_ios,
908920
.get_cd = meson_mmc_get_cd,
909921
.pre_req = meson_mmc_pre_req,
910922
.post_req = meson_mmc_post_req,
911923
.execute_tuning = meson_mmc_execute_tuning,
924+
.card_busy = meson_mmc_card_busy,
912925
};
913926

914927
static int meson_mmc_probe(struct platform_device *pdev)

0 commit comments

Comments
 (0)