mmc: mtk-sd: implement waiting for DAT0 line state
Subsystems (2)
PATCH 1/1 mmc: mtk-sd: implement waiting for DAT0 line state
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/[email protected]/
--- drivers/mmc/mtk-sd.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
drivers/mmc/mtk-sd.c +15 -0
@@ -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 = {
Signature · 1 line
2.31.1
Quoted 9 lines · Julien Masson
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_initand 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_switchcall.
Quoted 6 lines
By adding the support of
wait_dat0(), we now don't need to mdelay duringmmc_initanymore.Signed-off-by Julien Masson <[email protected]>
Best Regards,
Jaehoon Chung
Quoted 38 lines
--- drivers/mmc/mtk-sd.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)drivers/mmc/mtk-sd.c +15
-0@@ -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 = {
Quoted 9 lines · Julien Masson
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_initand 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_switchcall.
Quoted 7 lines
By adding the support of
wait_dat0(), we now don't need to mdelay duringmmc_initanymore.[1]: https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
Signed-off-by Julien Masson <[email protected]>Reviewed-by Jaehoon Chung <[email protected]>
Applied to u-boot/next, thanks!
Signature · 1 line
Tom