* [PATCH v2] mmc: fsl_esdhc_imx: add wait_dat0() support
@ 2020-11-03 7:20 haibo.chen at nxp.com
0 siblings, 0 replies; 4+ messages in thread
From: haibo.chen at nxp.com @ 2020-11-03 7:20 UTC (permalink / raw)
To: u-boot
From: Haibo Chen <haibo.chen@nxp.com>
Add wait_dat0() support, upper layer will use this callback.
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
---
drivers/mmc/fsl_esdhc_imx.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/drivers/mmc/fsl_esdhc_imx.c b/drivers/mmc/fsl_esdhc_imx.c
index 22040c67a8..3843d61d71 100644
--- a/drivers/mmc/fsl_esdhc_imx.c
+++ b/drivers/mmc/fsl_esdhc_imx.c
@@ -1646,6 +1646,28 @@ static int fsl_esdhc_set_enhanced_strobe(struct udevice *dev)
}
#endif
+static int fsl_esdhc_wait_dat0(struct udevice *dev, int state,
+ int timeout_us)
+{
+ int ret = -ETIMEDOUT;
+ bool dat0_high;
+ bool target_dat0_high = !!state;
+ struct fsl_esdhc_priv *priv = dev_get_priv(dev);
+ struct fsl_esdhc *regs = priv->esdhc_regs;
+
+ timeout_us = DIV_ROUND_UP(timeout_us, 10); /* check every 10 us. */
+ while (timeout_us--) {
+ dat0_high = !!(esdhc_read32(®s->prsstat) & PRSSTAT_DAT0);
+ if (dat0_high == target_dat0_high) {
+ ret = 0;
+ break;
+ }
+ udelay(10);
+ }
+
+ return ret;
+}
+
static const struct dm_mmc_ops fsl_esdhc_ops = {
.get_cd = fsl_esdhc_get_cd,
.send_cmd = fsl_esdhc_send_cmd,
@@ -1656,6 +1678,7 @@ static const struct dm_mmc_ops fsl_esdhc_ops = {
#if CONFIG_IS_ENABLED(MMC_HS400_ES_SUPPORT)
.set_enhanced_strobe = fsl_esdhc_set_enhanced_strobe,
#endif
+ .wait_dat0 = fsl_esdhc_wait_dat0,
};
#endif
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2] mmc: fsl_esdhc_imx: add wait_dat0() support
@ 2020-11-05 6:57 ` haibo.chen at nxp.com
2020-11-05 7:53 ` Jaehoon Chung
2020-12-08 7:59 ` sbabic at denx.de
0 siblings, 2 replies; 4+ messages in thread
From: haibo.chen at nxp.com @ 2020-11-05 6:57 UTC (permalink / raw)
To: u-boot
From: Haibo Chen <haibo.chen@nxp.com>
Add wait_dat0() support, upper layer will use this callback.
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
---
drivers/mmc/fsl_esdhc_imx.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/drivers/mmc/fsl_esdhc_imx.c b/drivers/mmc/fsl_esdhc_imx.c
index 22040c67a8..29592d1f2c 100644
--- a/drivers/mmc/fsl_esdhc_imx.c
+++ b/drivers/mmc/fsl_esdhc_imx.c
@@ -1646,6 +1646,20 @@ static int fsl_esdhc_set_enhanced_strobe(struct udevice *dev)
}
#endif
+static int fsl_esdhc_wait_dat0(struct udevice *dev, int state,
+ int timeout_us)
+{
+ int ret;
+ u32 tmp;
+ struct fsl_esdhc_priv *priv = dev_get_priv(dev);
+ struct fsl_esdhc *regs = priv->esdhc_regs;
+
+ ret = readx_poll_timeout(esdhc_read32, ®s->prsstat, tmp,
+ !!(tmp & PRSSTAT_DAT0) == !!state,
+ timeout_us);
+ return ret;
+}
+
static const struct dm_mmc_ops fsl_esdhc_ops = {
.get_cd = fsl_esdhc_get_cd,
.send_cmd = fsl_esdhc_send_cmd,
@@ -1656,6 +1670,7 @@ static const struct dm_mmc_ops fsl_esdhc_ops = {
#if CONFIG_IS_ENABLED(MMC_HS400_ES_SUPPORT)
.set_enhanced_strobe = fsl_esdhc_set_enhanced_strobe,
#endif
+ .wait_dat0 = fsl_esdhc_wait_dat0,
};
#endif
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2] mmc: fsl_esdhc_imx: add wait_dat0() support
2020-11-05 6:57 ` [PATCH v2] mmc: fsl_esdhc_imx: add wait_dat0() support haibo.chen at nxp.com
@ 2020-11-05 7:53 ` Jaehoon Chung
2020-12-08 7:59 ` sbabic at denx.de
1 sibling, 0 replies; 4+ messages in thread
From: Jaehoon Chung @ 2020-11-05 7:53 UTC (permalink / raw)
To: u-boot
Dear Haibo,
On 11/5/20 3:57 PM, haibo.chen at nxp.com wrote:
> From: Haibo Chen <haibo.chen@nxp.com>
>
> Add wait_dat0() support, upper layer will use this callback.
>
> Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
Best Regards,
Jaehoon Chung
> ---
> drivers/mmc/fsl_esdhc_imx.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/drivers/mmc/fsl_esdhc_imx.c b/drivers/mmc/fsl_esdhc_imx.c
> index 22040c67a8..29592d1f2c 100644
> --- a/drivers/mmc/fsl_esdhc_imx.c
> +++ b/drivers/mmc/fsl_esdhc_imx.c
> @@ -1646,6 +1646,20 @@ static int fsl_esdhc_set_enhanced_strobe(struct udevice *dev)
> }
> #endif
>
> +static int fsl_esdhc_wait_dat0(struct udevice *dev, int state,
> + int timeout_us)
> +{
> + int ret;
> + u32 tmp;
> + struct fsl_esdhc_priv *priv = dev_get_priv(dev);
> + struct fsl_esdhc *regs = priv->esdhc_regs;
> +
> + ret = readx_poll_timeout(esdhc_read32, ®s->prsstat, tmp,
> + !!(tmp & PRSSTAT_DAT0) == !!state,
> + timeout_us);
> + return ret;
> +}
> +
> static const struct dm_mmc_ops fsl_esdhc_ops = {
> .get_cd = fsl_esdhc_get_cd,
> .send_cmd = fsl_esdhc_send_cmd,
> @@ -1656,6 +1670,7 @@ static const struct dm_mmc_ops fsl_esdhc_ops = {
> #if CONFIG_IS_ENABLED(MMC_HS400_ES_SUPPORT)
> .set_enhanced_strobe = fsl_esdhc_set_enhanced_strobe,
> #endif
> + .wait_dat0 = fsl_esdhc_wait_dat0,
> };
> #endif
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] mmc: fsl_esdhc_imx: add wait_dat0() support
2020-11-05 6:57 ` [PATCH v2] mmc: fsl_esdhc_imx: add wait_dat0() support haibo.chen at nxp.com
2020-11-05 7:53 ` Jaehoon Chung
@ 2020-12-08 7:59 ` sbabic at denx.de
1 sibling, 0 replies; 4+ messages in thread
From: sbabic at denx.de @ 2020-12-08 7:59 UTC (permalink / raw)
To: u-boot
> From: Haibo Chen <haibo.chen@nxp.com>
> Add wait_dat0() support, upper layer will use this callback.
> Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-12-08 7:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20201105070339epcas1p1a0df36ec52ce7707affb41dd5eb8c12b@epcas1p1.samsung.com>
2020-11-05 6:57 ` [PATCH v2] mmc: fsl_esdhc_imx: add wait_dat0() support haibo.chen at nxp.com
2020-11-05 7:53 ` Jaehoon Chung
2020-12-08 7:59 ` sbabic at denx.de
2020-11-03 7:20 haibo.chen at nxp.com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox