diff options
author | Jerome Brunet <jbrunet@baylibre.com> | 2017-08-28 10:29:11 -0400 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@linaro.org> | 2017-08-30 09:03:50 -0400 |
commit | 186cd8b7f586250cc0bb20b1c2c2586895dede7e (patch) | |
tree | e172eff6f030f0dbe6916b665a4977af810eadd4 | |
parent | 74858655cbff055a4e716634f0d656b8f1ff7a9f (diff) |
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 <khilman@baylibre.com>
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
-rw-r--r-- | drivers/mmc/host/meson-gx-mmc.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c index 3914c3a82cc4..40fa7ae64c72 100644 --- a/drivers/mmc/host/meson-gx-mmc.c +++ b/drivers/mmc/host/meson-gx-mmc.c | |||
@@ -76,6 +76,7 @@ | |||
76 | 76 | ||
77 | #define SD_EMMC_STATUS 0x48 | 77 | #define SD_EMMC_STATUS 0x48 |
78 | #define STATUS_BUSY BIT(31) | 78 | #define STATUS_BUSY BIT(31) |
79 | #define STATUS_DATI GENMASK(23, 16) | ||
79 | 80 | ||
80 | #define SD_EMMC_IRQ_EN 0x4c | 81 | #define SD_EMMC_IRQ_EN 0x4c |
81 | #define IRQ_RXD_ERR_MASK GENMASK(7, 0) | 82 | #define IRQ_RXD_ERR_MASK GENMASK(7, 0) |
@@ -902,6 +903,17 @@ static void meson_mmc_cfg_init(struct meson_host *host) | |||
902 | writel(cfg, host->regs + SD_EMMC_CFG); | 903 | writel(cfg, host->regs + SD_EMMC_CFG); |
903 | } | 904 | } |
904 | 905 | ||
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 | |||
905 | static const struct mmc_host_ops meson_mmc_ops = { | 917 | static const struct mmc_host_ops meson_mmc_ops = { |
906 | .request = meson_mmc_request, | 918 | .request = meson_mmc_request, |
907 | .set_ios = meson_mmc_set_ios, | 919 | .set_ios = meson_mmc_set_ios, |
@@ -909,6 +921,7 @@ static const struct mmc_host_ops meson_mmc_ops = { | |||
909 | .pre_req = meson_mmc_pre_req, | 921 | .pre_req = meson_mmc_pre_req, |
910 | .post_req = meson_mmc_post_req, | 922 | .post_req = meson_mmc_post_req, |
911 | .execute_tuning = meson_mmc_execute_tuning, | 923 | .execute_tuning = meson_mmc_execute_tuning, |
924 | .card_busy = meson_mmc_card_busy, | ||
912 | }; | 925 | }; |
913 | 926 | ||
914 | static int meson_mmc_probe(struct platform_device *pdev) | 927 | static int meson_mmc_probe(struct platform_device *pdev) |