imx: imx8mq: handle ESDHC in mxc_get_clock
Subsystems (3)
PATCH 1/1 imx: imx8mq: handle ESDHC in mxc_get_clock
fsl_esdhc_imx driver will call "mxc_get_clock(MXC_ESDHC_CLK + dev->seq)", however mxc_get_clock wrongly handle MXC_ESDHC_CLK as root clk and cause sd card could not be detected in U-Boot proper, as below:
"Loading Environment from MMC... unable to select a mode"
Handle MXC_ESDHC_CLK in mxc_get_clock to fix the issue.
--- arch/arm/mach-imx/imx8m/clock_imx8mq.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
arch/arm/mach-imx/imx8m/clock_imx8mq.c +9 -5
@@ -326,16 +326,20 @@ unsigned int mxc_get_clock(enum mxc_clock clk) {u32 val; -if (clk ==MXC_ARM_CLK ) +switch (clk) { +case MXC_ARM_CLK :return get_root_clk (ARM_A53_CLK_ROOT ); - -if (clk ==MXC_IPG_CLK ) { +case MXC_IPG_CLK :clock_get_target_val (IPG_CLK_ROOT , &val); val = val &0x3 ;return get_root_clk (AHB_CLK_ROOT ) / (val +1 ); +case MXC_ESDHC_CLK : +return get_root_clk (USDHC1_CLK_ROOT ); +case MXC_ESDHC2_CLK : +return get_root_clk (USDHC2_CLK_ROOT ); +default : +return get_root_clk (clk); } - -return get_root_clk (clk); }u32 imx_get_uartclk (void )
Signature · 1 line
2.16.4
PATCH 1/1 imx: imx8mq: handle ESDHC in mxc_get_clock
Hi Peng,
Quoted 9 lines · Peng Fan
fsl_esdhc_imxdriver will call "mxc_get_clock(MXC_ESDHC_CLK + dev->seq)", howevermxc_get_clockwrongly handleMXC_ESDHC_CLKas root clk and cause sd card could not be detected in U-Boot proper, as below:
"Loading Environment from MMC... unable to select a mode"Handle
MXC_ESDHC_CLKinmxc_get_clockto fix the issue.Signed-off-by Peng Fan <[email protected]>
This fixes SD card and eMMC access on i.MX8MQ based SolidRun Hummingboard Pulse.
Thanks,
baruch
Quoted 24 lines
--- arch/arm/mach-imx/imx8m/clock_imx8mq.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)arch/arm/mach-imx/imx8m/clock_imx8mq.c +5
-3@@ -326,16 +326,20 @@ unsigned int mxc_get_clock(enum mxc_clock clk) {u32 val; -if (clk ==MXC_ARM_CLK ) +switch (clk) { +case MXC_ARM_CLK :return get_root_clk (ARM_A53_CLK_ROOT ); - -if (clk ==MXC_IPG_CLK ) { +case MXC_IPG_CLK :clock_get_target_val (IPG_CLK_ROOT , &val); val = val &0x3 ;return get_root_clk (AHB_CLK_ROOT ) / (val +1 ); +case MXC_ESDHC_CLK : +return get_root_clk (USDHC1_CLK_ROOT );
arch/arm/mach-imx/imx8m/clock_imx8mq.c unsigned int mxc_get_clock(enum mxc_clock clk) · line 345
Quoted 10 lines
arch/arm/mach-imx/imx8m/clock_imx8mq.c +4
-2+case MXC_ESDHC2_CLK : +return get_root_clk (USDHC2_CLK_ROOT ); +default : +return get_root_clk (clk); } - -return get_root_clk (clk); }u32 imx_get_uartclk (void )
--
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
PATCH 1/1 imx: imx8mq: handle ESDHC in mxc_get_clock
Hi Stefano, Peng,
Quoted 7 lines · Baruch Siach
Quoted 6 lines · Peng Fan
fsl_esdhc_imxdriver will call "mxc_get_clock(MXC_ESDHC_CLK + dev->seq)", howevermxc_get_clockwrongly handleMXC_ESDHC_CLKas root clk and cause sd card could not be detected in U-Boot proper, as below:
"Loading Environment from MMC... unable to select a mode"
Quoted 8 lines
Quoted 3 lines
Handle
MXC_ESDHC_CLKinmxc_get_clockto fix the issue.Signed-off-by Peng Fan <[email protected]>This fixes SD card and eMMC access on i.MX8MQ based SolidRun Hummingboard Pulse.
Tested-by Baruch Siach <[email protected]>
This patch missed v2020.01 unfortunately. I see it marked as "Awaiting Upstream" in patchwork (patch 1207464), but I could not find it queued anywhere. Am I missing anything?
baruch
Quoted 33 lines
Quoted 33 lines
--- arch/arm/mach-imx/imx8m/clock_imx8mq.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)arch/arm/mach-imx/imx8m/clock_imx8mq.c +9
-5@@ -326,16 +326,20 @@ unsigned int mxc_get_clock(enum mxc_clock clk) {u32 val; -if (clk ==MXC_ARM_CLK ) +switch (clk) { +case MXC_ARM_CLK :return get_root_clk (ARM_A53_CLK_ROOT ); - -if (clk ==MXC_IPG_CLK ) { +case MXC_IPG_CLK :clock_get_target_val (IPG_CLK_ROOT , &val); val = val &0x3 ;return get_root_clk (AHB_CLK_ROOT ) / (val +1 ); +case MXC_ESDHC_CLK : +return get_root_clk (USDHC1_CLK_ROOT ); +case MXC_ESDHC2_CLK : +return get_root_clk (USDHC2_CLK_ROOT ); +default : +return get_root_clk (clk); } - -return get_root_clk (clk); }
Quoted 1 line
arch/arm/mach-imx/imx8m/clock_imx8mq.c unsigned int mxc_get_clock(enum mxc_clock clk) · line 345
Quoted 1 line
arch/arm/mach-imx/imx8m/clock_imx8mq.c +0
-0u32 imx_get_uartclk (void )
--
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
PATCH 1/1 imx: imx8mq: handle ESDHC in mxc_get_clock
Quoted 14 lines · Baruch Siach
Hi Stefano, Peng,
Quoted 11 lines · Baruch Siach
Quoted 9 lines · Peng Fan
fsl_esdhc_imxdriver will call "mxc_get_clock(MXC_ESDHC_CLK + dev->seq)", howevermxc_get_clockwrongly handleMXC_ESDHC_CLKas root clk and cause sd card could not be detected in U-Boot proper, as below:
"Loading Environment from MMC... unable to select a mode"Handle
MXC_ESDHC_CLKinmxc_get_clockto fix the issue.Signed-off-by Peng Fan <[email protected]>
Quoted 8 lines
Quoted 4 lines
This fixes SD card and eMMC access on i.MX8MQ based SolidRun Hummingboard Pulse.
Tested-by Baruch Siach <[email protected]>This patch missed v2020.01 unfortunately. I see it marked as "Awaiting Upstream" in patchwork (patch 1207464), but I could not find it queued anywhere. Am I missing anything?
I cannot see it, too. I can just pick it up and push it to -master.
Stefano
Quoted 44 lines
baruch
Quoted 33 lines
Quoted 33 lines
--- arch/arm/mach-imx/imx8m/clock_imx8mq.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)arch/arm/mach-imx/imx8m/clock_imx8mq.c +9
-5@@ -326,16 +326,20 @@ unsigned int mxc_get_clock(enum mxc_clock clk) {u32 val; -if (clk ==MXC_ARM_CLK ) +switch (clk) { +case MXC_ARM_CLK :return get_root_clk (ARM_A53_CLK_ROOT ); - -if (clk ==MXC_IPG_CLK ) { +case MXC_IPG_CLK :clock_get_target_val (IPG_CLK_ROOT , &val); val = val &0x3 ;return get_root_clk (AHB_CLK_ROOT ) / (val +1 ); +case MXC_ESDHC_CLK : +return get_root_clk (USDHC1_CLK_ROOT ); +case MXC_ESDHC2_CLK : +return get_root_clk (USDHC2_CLK_ROOT ); +default : +return get_root_clk (clk); } - -return get_root_clk (clk); }Quoted 1 line
arch/arm/mach-imx/imx8m/clock_imx8mq.c unsigned int mxc_get_clock(enum mxc_clock clk) · line 345
Quoted 1 line
arch/arm/mach-imx/imx8m/clock_imx8mq.c +0
-0u32 imx_get_uartclk (void )--
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
Signature · 5 lines
===================================================================== 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 =====================================================================
Fabio Estevam
reviewerPATCH 1/1 imx: imx8mq: handle ESDHC in mxc_get_clock
In reply to Peng FanHi Peng,
Quoted 10 lines · Peng Fan
fsl_esdhc_imxdriver will call "mxc_get_clock(MXC_ESDHC_CLK + dev->seq)", howevermxc_get_clockwrongly handleMXC_ESDHC_CLKas root clk and cause sd card could not be detected in U-Boot proper, as below:
"Loading Environment from MMC... unable to select a mode"Handle
MXC_ESDHC_CLKinmxc_get_clockto fix the issue.Signed-off-by Peng Fan <[email protected]>
Thanks for the fix:
Stefano,
This one is a bug fix for 2020.01
Thanks