* [PATCH] mmc: mtk-sd: implement waiting for DAT0 line state
@ 2021-11-05 13:34 ` Julien Masson
2021-11-09 4:24 ` Jaehoon Chung
2021-11-18 19:16 ` Tom Rini
0 siblings, 2 replies; 3+ messages in thread
From: Julien Masson @ 2021-11-05 13:34 UTC (permalink / raw)
To: u-boot
Cc: Jaehoon Chung, Peng Fan, Chunfeng Yun, Weijie Gao, Ryder Lee,
GSS_MTK_Uboot_upstream, Mattijs Korpershoek, Fabien Parent
With the recent changes on mmc driver, we saw that the boot is ~5 secs
longer compared to v2021.07 on mediatek platforms.
This regression is seen during mmc_init and caused by the following
patch [1].
Indeed since we did not support poll dat0, we fulfilled the condition
of [1] and a delay of 500 ms was added for every __mmc_switch call.
By adding the support of wait_dat0(), we now don't need to mdelay
during mmc_init anymore.
[1]: https://patchwork.ozlabs.org/project/uboot/patch/1629192034-64056-1-git-send-email-ye.li@nxp.com/
Signed-off-by: Julien Masson <jmasson@baylibre.com>
---
drivers/mmc/mtk-sd.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/drivers/mmc/mtk-sd.c b/drivers/mmc/mtk-sd.c
index 8599f095bc..97182ffd7f 100644
--- a/drivers/mmc/mtk-sd.c
+++ b/drivers/mmc/mtk-sd.c
@@ -1724,6 +1724,20 @@ static int msdc_drv_bind(struct udevice *dev)
return mmc_bind(dev, &plat->mmc, &plat->cfg);
}
+static int msdc_ops_wait_dat0(struct udevice *dev, int state, int timeout_us)
+{
+ struct msdc_host *host = dev_get_priv(dev);
+ int ret;
+ u32 reg;
+
+ ret = readl_poll_sleep_timeout(&host->base->msdc_ps, reg,
+ !!(reg & MSDC_PS_DAT0) == !!state,
+ 1000, /* 1 ms */
+ timeout_us);
+
+ return ret;
+}
+
static const struct dm_mmc_ops msdc_ops = {
.send_cmd = msdc_ops_send_cmd,
.set_ios = msdc_ops_set_ios,
@@ -1732,6 +1746,7 @@ static const struct dm_mmc_ops msdc_ops = {
#ifdef MMC_SUPPORTS_TUNING
.execute_tuning = msdc_execute_tuning,
#endif
+ .wait_dat0 = msdc_ops_wait_dat0,
};
static const struct msdc_compatible mt7620_compat = {
--
2.31.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mmc: mtk-sd: implement waiting for DAT0 line state
2021-11-05 13:34 ` [PATCH] mmc: mtk-sd: implement waiting for DAT0 line state Julien Masson
@ 2021-11-09 4:24 ` Jaehoon Chung
2021-11-18 19:16 ` Tom Rini
1 sibling, 0 replies; 3+ messages in thread
From: Jaehoon Chung @ 2021-11-09 4:24 UTC (permalink / raw)
To: Julien Masson, u-boot
Cc: Peng Fan, Chunfeng Yun, Weijie Gao, Ryder Lee,
GSS_MTK_Uboot_upstream, Mattijs Korpershoek, Fabien Parent
On 11/5/21 10:34 PM, Julien Masson wrote:
> With the recent changes on mmc driver, we saw that the boot is ~5 secs
> longer compared to v2021.07 on mediatek platforms.
>
> This regression is seen during mmc_init and caused by the following
> patch [1].
>
> Indeed since we did not support poll dat0, we fulfilled the condition
> of [1] and a delay of 500 ms was added for every __mmc_switch call.
>
> By adding the support of wait_dat0(), we now don't need to mdelay
> during mmc_init anymore.
>
> [1]: https://protect2.fireeye.com/v1/url?k=553fefc7-0aa4d6e8-553e6488-0cc47a31cdf8-658c3df5220dc893&q=1&e=badb6c30-0546-4072-80c5-a772143bc5ee&u=https%3A%2F%2Fpatchwork.ozlabs.org%2Fproject%2Fuboot%2Fpatch%2F1629192034-64056-1-git-send-email-ye.li%40nxp.com%2F
>
> Signed-off-by: Julien Masson <jmasson@baylibre.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
Best Regards,
Jaehoon Chung
> ---
> drivers/mmc/mtk-sd.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/drivers/mmc/mtk-sd.c b/drivers/mmc/mtk-sd.c
> index 8599f095bc..97182ffd7f 100644
> --- a/drivers/mmc/mtk-sd.c
> +++ b/drivers/mmc/mtk-sd.c
> @@ -1724,6 +1724,20 @@ static int msdc_drv_bind(struct udevice *dev)
> return mmc_bind(dev, &plat->mmc, &plat->cfg);
> }
>
> +static int msdc_ops_wait_dat0(struct udevice *dev, int state, int timeout_us)
> +{
> + struct msdc_host *host = dev_get_priv(dev);
> + int ret;
> + u32 reg;
> +
> + ret = readl_poll_sleep_timeout(&host->base->msdc_ps, reg,
> + !!(reg & MSDC_PS_DAT0) == !!state,
> + 1000, /* 1 ms */
> + timeout_us);
> +
> + return ret;
> +}
> +
> static const struct dm_mmc_ops msdc_ops = {
> .send_cmd = msdc_ops_send_cmd,
> .set_ios = msdc_ops_set_ios,
> @@ -1732,6 +1746,7 @@ static const struct dm_mmc_ops msdc_ops = {
> #ifdef MMC_SUPPORTS_TUNING
> .execute_tuning = msdc_execute_tuning,
> #endif
> + .wait_dat0 = msdc_ops_wait_dat0,
> };
>
> static const struct msdc_compatible mt7620_compat = {
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mmc: mtk-sd: implement waiting for DAT0 line state
2021-11-05 13:34 ` [PATCH] mmc: mtk-sd: implement waiting for DAT0 line state Julien Masson
2021-11-09 4:24 ` Jaehoon Chung
@ 2021-11-18 19:16 ` Tom Rini
1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2021-11-18 19:16 UTC (permalink / raw)
To: Julien Masson
Cc: u-boot, Jaehoon Chung, Peng Fan, Chunfeng Yun, Weijie Gao,
Ryder Lee, GSS_MTK_Uboot_upstream, Mattijs Korpershoek,
Fabien Parent
[-- Attachment #1: Type: text/plain, Size: 803 bytes --]
On Fri, Nov 05, 2021 at 02:34:14PM +0100, Julien Masson wrote:
> With the recent changes on mmc driver, we saw that the boot is ~5 secs
> longer compared to v2021.07 on mediatek platforms.
>
> This regression is seen during mmc_init and caused by the following
> patch [1].
>
> Indeed since we did not support poll dat0, we fulfilled the condition
> of [1] and a delay of 500 ms was added for every __mmc_switch call.
>
> By adding the support of wait_dat0(), we now don't need to mdelay
> during mmc_init anymore.
>
> [1]: https://patchwork.ozlabs.org/project/uboot/patch/1629192034-64056-1-git-send-email-ye.li@nxp.com/
>
> Signed-off-by: Julien Masson <jmasson@baylibre.com>
> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
Applied to u-boot/next, thanks!
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-11-18 19:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20211105134105epcas1p316549d76f459e83010b1cd77e207d5c2@epcas1p3.samsung.com>
2021-11-05 13:34 ` [PATCH] mmc: mtk-sd: implement waiting for DAT0 line state Julien Masson
2021-11-09 4:24 ` Jaehoon Chung
2021-11-18 19:16 ` Tom Rini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox