mmc: fsl_esdhc_imx: add wait_dat0() support
Subsystems (2)
PATCH 1/1 mmc: fsl_esdhc_imx: add wait_dat0() support
From: Haibo Chen <[email protected]>
Add wait_dat0() support, upper layer will use this callback.
--- drivers/mmc/fsl_esdhc_imx.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
drivers/mmc/fsl_esdhc_imx.c +23 -0
@@ -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
Signature · 1 line
2.17.1
PATCH 1/1 mmc: fsl_esdhc_imx: add wait_dat0() support
Quoted 24 lines · haibo.chen at nxp.com
From: Haibo Chen <[email protected]>
Add
wait_dat0()support, upper layer will use this callback.Signed-off-by Haibo Chen <[email protected]>--- drivers/mmc/fsl_esdhc_imx.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)drivers/mmc/fsl_esdhc_imx.c +7
-0@@ -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);
drivers/mmc/fsl_esdhc_imx.c static int fsl_esdhc_set_enhanced_strobe(struct udevice *dev) · line 1665
Quoted 10 lines
drivers/mmc/fsl_esdhc_imx.c +10
-0+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 );
Fix indent.
And can't use wait_for_bit_xx()?
Best Regards,
Jaehoon Chung
Quoted 17 lines
drivers/mmc/fsl_esdhc_imx.c +6
-0+ } + +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
PATCH 1/1 mmc: fsl_esdhc_imx: add wait_dat0() support
Quoted 38 lines
-----Original Message-----
From: Jaehoon Chung [mailto:jh80.chung at samsung.com]
Sent: 2020?11?3? 5:52
To: Bough Chen <[email protected]>; Peng Fan <[email protected]>; u-boot at lists.denx.de
Cc: dl-uboot-imx <[email protected]>
Subject: Re: [PATCH] mmc:fsl_esdhc_imx: addwait_dat0()supportdrivers/mmc/fsl_esdhc_imx.c static int
Quoted 14 lines · haibo.chen at nxp.com
From: Haibo Chen <[email protected]>
Add
wait_dat0()support, upper layer will use this callback.Signed-off-by Haibo Chen <[email protected]>--- drivers/mmc/fsl_esdhc_imx.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)drivers/mmc/fsl_esdhc_imx.c +0
-0@@ -1646,6 +1646,28 @@ static intfsl_esdhc_set_enhanced_strobe(struct
Quoted 13 lines
udevice *dev) } #endif
drivers/mmc/fsl_esdhc_imx.c +11
-0+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--) {
Quoted 8 lines
drivers/mmc/fsl_esdhc_imx.c static int fsl_esdhc_set_enhanced_strobe(struct udevice *dev) · line 1665
Quoted 6 lines
drivers/mmc/fsl_esdhc_imx.c +6
-0+ dat0_high = !!(esdhc_read32 (®s->prsstat) &PRSSTAT_DAT0 ); +if (dat0_high == target_dat0_high) { + ret =0 ; +break ; + } +udelay (10 );Fix indent.
Yes, will fix.
Quoted 1 line
And can't use
wait_for_bit_xx()?
Just to align with the mmc_wait_dat0() defined in mmc-uclass.c, named fsl_esdhc_wait_dat0 should be more readable.
Best Regards
Haibo Chen
Quoted 21 lines
Best Regards,
Jaehoon Chungdrivers/mmc/fsl_esdhc_imx.c static const struct dm_mmc_ops fsl_esdhc_ops
Quoted 9 lines
drivers/mmc/fsl_esdhc_imx.c +5
-0+ } + +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= {
Quoted 7 lines
drivers/mmc/fsl_esdhc_imx.c +1
-0#if CONFIG_IS_ENABLED (MMC_HS400_ES_SUPPORT ) .set_enhanced_strobe = fsl_esdhc_set_enhanced_strobe, #endif + .wait_dat0 = fsl_esdhc_wait_dat0, };#endif
PATCH 1/1 mmc: fsl_esdhc_imx: add wait_dat0() support
In reply to Jaehoon ChungQuoted 31 lines
Subject: Re: [PATCH] mmc:
fsl_esdhc_imx: addwait_dat0()supportQuoted 28 lines · haibo.chen at nxp.com
From: Haibo Chen <[email protected]>
Add
wait_dat0()support, upper layer will use this callback.Signed-off-by Haibo Chen <[email protected]>--- drivers/mmc/fsl_esdhc_imx.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)drivers/mmc/fsl_esdhc_imx.c +0
-0@@ -1646,6 +1646,28 @@ static int fsl_esdhc_set_enhanced_strobe(structudevice *dev) } #endif
drivers/mmc/fsl_esdhc_imx.c +12
-0+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 );
Quoted 8 lines
drivers/mmc/fsl_esdhc_imx.c static int fsl_esdhc_set_enhanced_strobe(struct udevice *dev) · line 1665
Quoted 5 lines
drivers/mmc/fsl_esdhc_imx.c +5
-0+if (dat0_high == target_dat0_high) { + ret =0 ; +break ; + } +udelay (10 );Fix indent.
And can't usewait_for_bit_xx()?
+1, read_poll_timeout or similar should be used here.
Thanks,
Peng.
Quoted 21 lines
Best Regards,
Jaehoon Chungdrivers/mmc/fsl_esdhc_imx.c static const struct dm_mmc_ops fsl_esdhc_ops =
Quoted 9 lines
drivers/mmc/fsl_esdhc_imx.c +5
-0+ } + +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 ={
Quoted 7 lines
drivers/mmc/fsl_esdhc_imx.c +1
-0#if CONFIG_IS_ENABLED (MMC_HS400_ES_SUPPORT ) .set_enhanced_strobe = fsl_esdhc_set_enhanced_strobe, #endif + .wait_dat0 = fsl_esdhc_wait_dat0, };#endif
PATCH 1/1 mmc: fsl_esdhc_imx: add wait_dat0() support
Quoted 52 lines
-----Original Message-----
From: Peng Fan
Sent: 2020?11?3? 16:17
To: Jaehoon Chung <[email protected]>; Bough Chen <[email protected]>; u-boot at lists.denx.de
Cc: dl-uboot-imx <[email protected]>
Subject: RE: [PATCH] mmc:fsl_esdhc_imx: addwait_dat0()supportQuoted 20 lines
Subject: Re: [PATCH] mmc:
fsl_esdhc_imx: addwait_dat0()supportQuoted 17 lines · haibo.chen at nxp.com
From: Haibo Chen <[email protected]>
Add
wait_dat0()support, upper layer will use this callback.Signed-off-by Haibo Chen <[email protected]>--- drivers/mmc/fsl_esdhc_imx.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)(quoted diff) +0
-0
b/drivers/mmc/fsl_esdhc_imx.cindex22040c67a8..dc6a6006fa100644drivers/mmc/fsl_esdhc_imx.c +0
-0@@ -1646,6 +1646,28 @@ static intfsl_esdhc_set_enhanced_strobe(struct
udevice *dev) } #endifQuoted 10 lines
drivers/mmc/fsl_esdhc_imx.c static int fsl_esdhc_set_enhanced_strobe(struct udevice *dev)
Quoted 10 lines
drivers/mmc/fsl_esdhc_imx.c +10
-0+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. */
Quoted 2 lines
drivers/mmc/fsl_esdhc_imx.c
Quoted 2 lines
drivers/mmc/fsl_esdhc_imx.c +2
-0+while (timeout_us--) { + dat0_high = !!(esdhc_read32(®s->prsstat) &
PRSSTAT_DAT0);Quoted 8 lines
drivers/mmc/fsl_esdhc_imx.c static int fsl_esdhc_set_enhanced_strobe(struct udevice *dev) · line 1665
Quoted 5 lines
drivers/mmc/fsl_esdhc_imx.c +5
-0+if (dat0_high == target_dat0_high) { + ret =0 ; +break ; + } +udelay (10 );Fix indent.
And can't usewait_for_bit_xx()?
Quoted 1 line
+1,
read_poll_timeoutor similar should be used here.
Do not use read_poll_timeout here is because the parameter 'state' can be 0 or 1.
if use read_poll_timeout, should like this:read_poll_timeout(esdhc_read32, ®s->prsstat, tmp, !!(tmp & PRSSTAT_DAT0) == !!state, 10, timeout_us);
I think the condition is a little bit complicated, not that readable, but if you prefer this, I can do that.
Best Regards
Haibo Chen
Quoted 26 lines
Thanks,
Peng.Quoted 4 lines
Best Regards,
Jaehoon ChungQuoted 9 lines
drivers/mmc/fsl_esdhc_imx.c static const struct dm_mmc_ops
Quoted 9 lines
drivers/mmc/fsl_esdhc_imx.c +5
-0+ } + +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=Quoted 8 lines
{
Quoted 7 lines
drivers/mmc/fsl_esdhc_imx.c +1
-0#if CONFIG_IS_ENABLED (MMC_HS400_ES_SUPPORT ) .set_enhanced_strobe = fsl_esdhc_set_enhanced_strobe, #endif + .wait_dat0 = fsl_esdhc_wait_dat0, };#endif
PATCH 1/1 mmc: fsl_esdhc_imx: add wait_dat0() support
Quoted 52 lines · Bough Chen
Quoted 52 lines
-----Original Message-----
From: Peng Fan
Sent: 2020?11?3? 16:17
To: Jaehoon Chung <[email protected]>; Bough Chen <[email protected]>; u-boot at lists.denx.de
Cc: dl-uboot-imx <[email protected]>
Subject: RE: [PATCH] mmc:fsl_esdhc_imx: addwait_dat0()supportQuoted 20 lines
Subject: Re: [PATCH] mmc:
fsl_esdhc_imx: addwait_dat0()supportQuoted 17 lines · haibo.chen at nxp.com
From: Haibo Chen <[email protected]>
Add
wait_dat0()support, upper layer will use this callback.Signed-off-by Haibo Chen <[email protected]>--- drivers/mmc/fsl_esdhc_imx.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)(quoted diff) +0
-0
b/drivers/mmc/fsl_esdhc_imx.cindex22040c67a8..dc6a6006fa100644drivers/mmc/fsl_esdhc_imx.c +0
-0@@ -1646,6 +1646,28 @@ static intfsl_esdhc_set_enhanced_strobe(struct
udevice *dev) } #endifQuoted 10 lines
drivers/mmc/fsl_esdhc_imx.c static int fsl_esdhc_set_enhanced_strobe(struct udevice *dev)
Quoted 10 lines
drivers/mmc/fsl_esdhc_imx.c +10
-0+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. */
Quoted 2 lines
drivers/mmc/fsl_esdhc_imx.c
Quoted 2 lines
drivers/mmc/fsl_esdhc_imx.c +2
-0+while (timeout_us--) { + dat0_high = !!(esdhc_read32(®s->prsstat) &
PRSSTAT_DAT0);Quoted 8 lines
drivers/mmc/fsl_esdhc_imx.c static int fsl_esdhc_set_enhanced_strobe(struct udevice *dev) · line 1665
Quoted 5 lines
drivers/mmc/fsl_esdhc_imx.c +5
-0+if (dat0_high == target_dat0_high) { + ret =0 ; +break ; + } +udelay (10 );Fix indent.
And can't usewait_for_bit_xx()?
Quoted 6 lines
Quoted 1 line
+1,
read_poll_timeoutor similar should be used here.Do not use
read_poll_timeouthere is because the parameter 'state' can be 0 or 1.
if useread_poll_timeout, should like this:read_poll_timeout(esdhc_read32, ®s->prsstat, tmp, !!(tmp & PRSSTAT_DAT0) == !!state, 10, timeout_us);> I think the condition is a little bit complicated, not that readable, but if you prefer this, I can do that.
I think it's not complicated.
I don't have any objection but you can follow Peng's opinion. :)
Best Regards,
Jaehoon Chung
Quoted 30 lines
Best Regards
Haibo ChenQuoted 26 lines
Thanks,
Peng.Quoted 4 lines
Best Regards,
Jaehoon ChungQuoted 9 lines
drivers/mmc/fsl_esdhc_imx.c static const struct dm_mmc_ops
Quoted 9 lines
drivers/mmc/fsl_esdhc_imx.c +5
-0+ } + +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=Quoted 8 lines
{
Quoted 7 lines
drivers/mmc/fsl_esdhc_imx.c +1
-0#if CONFIG_IS_ENABLED (MMC_HS400_ES_SUPPORT ) .set_enhanced_strobe = fsl_esdhc_set_enhanced_strobe, #endif + .wait_dat0 = fsl_esdhc_wait_dat0, };#endif