* [PATCH 1/2] mmc: fsl_esdhc: Set fallback mode to 1-bit @ 2022-05-11 18:27 ` Pali Rohár 2022-05-11 18:27 ` [PATCH 2/2] mmc: fsl_esdhc: Add new config option for default fallback mode Pali Rohár 2022-05-16 23:39 ` [PATCH 1/2] mmc: fsl_esdhc: Set fallback mode to 1-bit Jaehoon Chung 0 siblings, 2 replies; 6+ messages in thread From: Pali Rohár @ 2022-05-11 18:27 UTC (permalink / raw) To: Peng Fan, Jaehoon Chung, Priyanka Jain, Sinan Akman; +Cc: u-boot 8-bit mode is not supported by SD cards and on P2020 are four SDHC pins shared with SPI (so if P2020 board have also SPI then only 4-bit SDHC mode is provided). So 8-bit SDHC mode is really bad default. When max bus width is not provided then set mode to 1-bit. This mode is supported by all cards, so it is the best option for fallback mode. Also P2020 bootrom sets mode to 1-bit when booting from SD/MMC card. Signed-off-by: Pali Rohár <pali@kernel.org> --- drivers/mmc/fsl_esdhc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c index 3b3587bd8d72..834f8933b0c6 100644 --- a/drivers/mmc/fsl_esdhc.c +++ b/drivers/mmc/fsl_esdhc.c @@ -963,9 +963,8 @@ int fsl_esdhc_initialize(struct bd_info *bis, struct fsl_esdhc_cfg *cfg) } else if (cfg->max_bus_width == 1) { mmc_cfg->host_caps |= MMC_MODE_1BIT; } else { - mmc_cfg->host_caps |= MMC_MODE_1BIT | MMC_MODE_4BIT | - MMC_MODE_8BIT; - printf("No max bus width provided. Assume 8-bit supported.\n"); + mmc_cfg->host_caps |= MMC_MODE_1BIT; + printf("No max bus width provided. Fallback to 1-bit mode.\n"); } if (IS_ENABLED(CONFIG_ESDHC_DETECT_8_BIT_QUIRK)) -- 2.20.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] mmc: fsl_esdhc: Add new config option for default fallback mode 2022-05-11 18:27 ` [PATCH 1/2] mmc: fsl_esdhc: Set fallback mode to 1-bit Pali Rohár @ 2022-05-11 18:27 ` Pali Rohár 2022-05-16 23:40 ` Jaehoon Chung 2022-05-16 23:39 ` [PATCH 1/2] mmc: fsl_esdhc: Set fallback mode to 1-bit Jaehoon Chung 1 sibling, 1 reply; 6+ messages in thread From: Pali Rohár @ 2022-05-11 18:27 UTC (permalink / raw) To: Peng Fan, Jaehoon Chung, Priyanka Jain, Sinan Akman; +Cc: u-boot Currently default fallback SDHC mode is 1-bit. Add new config option CONFIG_SYS_FSL_ESDHC_DEFAULT_BUS_WIDTH to allow specifying default fallback mode. This is useful e.g. for SPL builds which loads other parts from SD card during boot process. Signed-off-by: Pali Rohár <pali@kernel.org> --- drivers/mmc/Kconfig | 5 +++++ drivers/mmc/fsl_esdhc.c | 1 + 2 files changed, 6 insertions(+) diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig index f04cc44e1973..df15dff6248f 100644 --- a/drivers/mmc/Kconfig +++ b/drivers/mmc/Kconfig @@ -826,6 +826,11 @@ config FSL_ESDHC_VS33_NOT_SUPPORT For eSDHC, power supply is through peripheral circuit. 3.3V support is common. Select this if 3.3V power supply not supported. +config SYS_FSL_ESDHC_DEFAULT_BUS_WIDTH + int + depends on FSL_ESDHC + default 1 + config FSL_ESDHC_IMX bool "Freescale/NXP i.MX eSDHC controller support" help diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c index 834f8933b0c6..a4c22942c2be 100644 --- a/drivers/mmc/fsl_esdhc.c +++ b/drivers/mmc/fsl_esdhc.c @@ -988,6 +988,7 @@ int fsl_esdhc_mmc_init(struct bd_info *bis) cfg = calloc(sizeof(struct fsl_esdhc_cfg), 1); cfg->esdhc_base = CONFIG_SYS_FSL_ESDHC_ADDR; + cfg->max_bus_width = CONFIG_SYS_FSL_ESDHC_DEFAULT_BUS_WIDTH; /* Prefer peripheral clock which provides higher frequency. */ if (gd->arch.sdhc_per_clk) cfg->sdhc_clk = gd->arch.sdhc_per_clk; -- 2.20.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] mmc: fsl_esdhc: Add new config option for default fallback mode 2022-05-11 18:27 ` [PATCH 2/2] mmc: fsl_esdhc: Add new config option for default fallback mode Pali Rohár @ 2022-05-16 23:40 ` Jaehoon Chung 2022-05-17 7:27 ` Pali Rohár 0 siblings, 1 reply; 6+ messages in thread From: Jaehoon Chung @ 2022-05-16 23:40 UTC (permalink / raw) To: Pali Rohár, Peng Fan, Priyanka Jain, Sinan Akman; +Cc: u-boot On 5/12/22 03:27, Pali Rohár wrote: > Currently default fallback SDHC mode is 1-bit. Add new config option > CONFIG_SYS_FSL_ESDHC_DEFAULT_BUS_WIDTH to allow specifying default fallback > mode. This is useful e.g. for SPL builds which loads other parts from SD > card during boot process. > > Signed-off-by: Pali Rohár <pali@kernel.org> > --- > drivers/mmc/Kconfig | 5 +++++ > drivers/mmc/fsl_esdhc.c | 1 + > 2 files changed, 6 insertions(+) > > diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig > index f04cc44e1973..df15dff6248f 100644 > --- a/drivers/mmc/Kconfig > +++ b/drivers/mmc/Kconfig > @@ -826,6 +826,11 @@ config FSL_ESDHC_VS33_NOT_SUPPORT > For eSDHC, power supply is through peripheral circuit. 3.3V support is > common. Select this if 3.3V power supply not supported. > > +config SYS_FSL_ESDHC_DEFAULT_BUS_WIDTH > + int > + depends on FSL_ESDHC > + default 1 Is there any reason not to use dt? Best Regards, Jaehoon Chung > + > config FSL_ESDHC_IMX > bool "Freescale/NXP i.MX eSDHC controller support" > help > diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c > index 834f8933b0c6..a4c22942c2be 100644 > --- a/drivers/mmc/fsl_esdhc.c > +++ b/drivers/mmc/fsl_esdhc.c > @@ -988,6 +988,7 @@ int fsl_esdhc_mmc_init(struct bd_info *bis) > > cfg = calloc(sizeof(struct fsl_esdhc_cfg), 1); > cfg->esdhc_base = CONFIG_SYS_FSL_ESDHC_ADDR; > + cfg->max_bus_width = CONFIG_SYS_FSL_ESDHC_DEFAULT_BUS_WIDTH; > /* Prefer peripheral clock which provides higher frequency. */ > if (gd->arch.sdhc_per_clk) > cfg->sdhc_clk = gd->arch.sdhc_per_clk; ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] mmc: fsl_esdhc: Add new config option for default fallback mode 2022-05-16 23:40 ` Jaehoon Chung @ 2022-05-17 7:27 ` Pali Rohár 2022-05-17 9:20 ` Jaehoon Chung 0 siblings, 1 reply; 6+ messages in thread From: Pali Rohár @ 2022-05-17 7:27 UTC (permalink / raw) To: Jaehoon Chung; +Cc: Peng Fan, Priyanka Jain, Sinan Akman, u-boot On Tuesday 17 May 2022 08:40:48 Jaehoon Chung wrote: > On 5/12/22 03:27, Pali Rohár wrote: > > Currently default fallback SDHC mode is 1-bit. Add new config option > > CONFIG_SYS_FSL_ESDHC_DEFAULT_BUS_WIDTH to allow specifying default fallback > > mode. This is useful e.g. for SPL builds which loads other parts from SD > > card during boot process. > > > > Signed-off-by: Pali Rohár <pali@kernel.org> > > --- > > drivers/mmc/Kconfig | 5 +++++ > > drivers/mmc/fsl_esdhc.c | 1 + > > 2 files changed, 6 insertions(+) > > > > diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig > > index f04cc44e1973..df15dff6248f 100644 > > --- a/drivers/mmc/Kconfig > > +++ b/drivers/mmc/Kconfig > > @@ -826,6 +826,11 @@ config FSL_ESDHC_VS33_NOT_SUPPORT > > For eSDHC, power supply is through peripheral circuit. 3.3V support is > > common. Select this if 3.3V power supply not supported. > > > > +config SYS_FSL_ESDHC_DEFAULT_BUS_WIDTH > > + int > > + depends on FSL_ESDHC > > + default 1 > > Is there any reason not to use dt? This is fallback value for function fsl_esdhc_mmc_init() which is called when DT is not parsed or used (yet). E.g. this applies for P2020 SPL. > Best Regards, > Jaehoon Chung > > > + > > config FSL_ESDHC_IMX > > bool "Freescale/NXP i.MX eSDHC controller support" > > help > > diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c > > index 834f8933b0c6..a4c22942c2be 100644 > > --- a/drivers/mmc/fsl_esdhc.c > > +++ b/drivers/mmc/fsl_esdhc.c > > @@ -988,6 +988,7 @@ int fsl_esdhc_mmc_init(struct bd_info *bis) > > > > cfg = calloc(sizeof(struct fsl_esdhc_cfg), 1); > > cfg->esdhc_base = CONFIG_SYS_FSL_ESDHC_ADDR; > > + cfg->max_bus_width = CONFIG_SYS_FSL_ESDHC_DEFAULT_BUS_WIDTH; > > /* Prefer peripheral clock which provides higher frequency. */ > > if (gd->arch.sdhc_per_clk) > > cfg->sdhc_clk = gd->arch.sdhc_per_clk; > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] mmc: fsl_esdhc: Add new config option for default fallback mode 2022-05-17 7:27 ` Pali Rohár @ 2022-05-17 9:20 ` Jaehoon Chung 0 siblings, 0 replies; 6+ messages in thread From: Jaehoon Chung @ 2022-05-17 9:20 UTC (permalink / raw) To: Pali Rohár; +Cc: Peng Fan, Priyanka Jain, Sinan Akman, u-boot On 5/17/22 16:27, Pali Rohár wrote: > On Tuesday 17 May 2022 08:40:48 Jaehoon Chung wrote: >> On 5/12/22 03:27, Pali Rohár wrote: >>> Currently default fallback SDHC mode is 1-bit. Add new config option >>> CONFIG_SYS_FSL_ESDHC_DEFAULT_BUS_WIDTH to allow specifying default fallback >>> mode. This is useful e.g. for SPL builds which loads other parts from SD >>> card during boot process. >>> >>> Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com> Best Regards, Jaehoon Chung >>> --- >>> drivers/mmc/Kconfig | 5 +++++ >>> drivers/mmc/fsl_esdhc.c | 1 + >>> 2 files changed, 6 insertions(+) >>> >>> diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig >>> index f04cc44e1973..df15dff6248f 100644 >>> --- a/drivers/mmc/Kconfig >>> +++ b/drivers/mmc/Kconfig >>> @@ -826,6 +826,11 @@ config FSL_ESDHC_VS33_NOT_SUPPORT >>> For eSDHC, power supply is through peripheral circuit. 3.3V support is >>> common. Select this if 3.3V power supply not supported. >>> >>> +config SYS_FSL_ESDHC_DEFAULT_BUS_WIDTH >>> + int >>> + depends on FSL_ESDHC >>> + default 1 >> >> Is there any reason not to use dt? > > This is fallback value for function fsl_esdhc_mmc_init() which is called > when DT is not parsed or used (yet). E.g. this applies for P2020 SPL. > >> Best Regards, >> Jaehoon Chung >> >>> + >>> config FSL_ESDHC_IMX >>> bool "Freescale/NXP i.MX eSDHC controller support" >>> help >>> diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c >>> index 834f8933b0c6..a4c22942c2be 100644 >>> --- a/drivers/mmc/fsl_esdhc.c >>> +++ b/drivers/mmc/fsl_esdhc.c >>> @@ -988,6 +988,7 @@ int fsl_esdhc_mmc_init(struct bd_info *bis) >>> >>> cfg = calloc(sizeof(struct fsl_esdhc_cfg), 1); >>> cfg->esdhc_base = CONFIG_SYS_FSL_ESDHC_ADDR; >>> + cfg->max_bus_width = CONFIG_SYS_FSL_ESDHC_DEFAULT_BUS_WIDTH; >>> /* Prefer peripheral clock which provides higher frequency. */ >>> if (gd->arch.sdhc_per_clk) >>> cfg->sdhc_clk = gd->arch.sdhc_per_clk; >> > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] mmc: fsl_esdhc: Set fallback mode to 1-bit 2022-05-11 18:27 ` [PATCH 1/2] mmc: fsl_esdhc: Set fallback mode to 1-bit Pali Rohár 2022-05-11 18:27 ` [PATCH 2/2] mmc: fsl_esdhc: Add new config option for default fallback mode Pali Rohár @ 2022-05-16 23:39 ` Jaehoon Chung 1 sibling, 0 replies; 6+ messages in thread From: Jaehoon Chung @ 2022-05-16 23:39 UTC (permalink / raw) To: Pali Rohár, Peng Fan, Priyanka Jain, Sinan Akman; +Cc: u-boot On 5/12/22 03:27, Pali Rohár wrote: > 8-bit mode is not supported by SD cards and on P2020 are four SDHC pins > shared with SPI (so if P2020 board have also SPI then only 4-bit SDHC mode > is provided). So 8-bit SDHC mode is really bad default. > > When max bus width is not provided then set mode to 1-bit. This mode is > supported by all cards, so it is the best option for fallback mode. > > Also P2020 bootrom sets mode to 1-bit when booting from SD/MMC card. > > Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com> Add minor comment. > --- > drivers/mmc/fsl_esdhc.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c > index 3b3587bd8d72..834f8933b0c6 100644 > --- a/drivers/mmc/fsl_esdhc.c > +++ b/drivers/mmc/fsl_esdhc.c > @@ -963,9 +963,8 @@ int fsl_esdhc_initialize(struct bd_info *bis, struct fsl_esdhc_cfg *cfg) > } else if (cfg->max_bus_width == 1) { > mmc_cfg->host_caps |= MMC_MODE_1BIT; > } else { > - mmc_cfg->host_caps |= MMC_MODE_1BIT | MMC_MODE_4BIT | > - MMC_MODE_8BIT; > - printf("No max bus width provided. Assume 8-bit supported.\n"); > + mmc_cfg->host_caps |= MMC_MODE_1BIT; I'm not sure that it really needs to use "|". Best Regards, Jaehoon Chung > + printf("No max bus width provided. Fallback to 1-bit mode.\n"); > } > > if (IS_ENABLED(CONFIG_ESDHC_DETECT_8_BIT_QUIRK)) ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-05-17 9:21 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <CGME20220511182733epcas1p1e986f0fecb5b3f736b5a0c7a15c5608a@epcas1p1.samsung.com> 2022-05-11 18:27 ` [PATCH 1/2] mmc: fsl_esdhc: Set fallback mode to 1-bit Pali Rohár 2022-05-11 18:27 ` [PATCH 2/2] mmc: fsl_esdhc: Add new config option for default fallback mode Pali Rohár 2022-05-16 23:40 ` Jaehoon Chung 2022-05-17 7:27 ` Pali Rohár 2022-05-17 9:20 ` Jaehoon Chung 2022-05-16 23:39 ` [PATCH 1/2] mmc: fsl_esdhc: Set fallback mode to 1-bit Jaehoon Chung
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.