Revert "mmc: fsl_esdhc: fix sd/mmc ddr mode clock setting issue"
PATCH 1/1 Revert "mmc: fsl_esdhc: fix sd/mmc ddr mode clock setting issue"
This reverts commit 72a89e0da5ac6a4ab929b15a2b656f04f50767f6, which causes the imx53 HSC to hang as the eMMC is not working properly anymore.
The exact error message:
MMC write: dev # 0, block # 2, count 927 ... mmc write failed 0 blocks written: ERROR
imx53 is not using the DDR mode.
Debugging of pre_div and div generation showed that those values are generated in a way, which is not matching the ones from working setup.
As the original patch was performing code refactoring, let's revert this change, so all imx53 boards would work again.
--- drivers/mmc/fsl_esdhc.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-)
drivers/mmc/fsl_esdhc.c +5 -18
@@ -621,31 +621,18 @@ static void set_sysctl(struct fsl_esdhc_priv *priv, struct mmc *mmc, uint clock)#else int pre_div =2 ;#endif +int ddr_pre_div = mmc->ddr_mode ?2 :1 ;int sdhc_clk = priv->sdhc_clk;uint clk; -/* -* For ddr mode, usdhc need to enable DDR mode first, after select -* this DDR mode, usdhc will automatically divide the usdhc clock -*/ -if (mmc->ddr_mode) { -writel (readl (®s->mixctrl) |MIX_CTRL_DDREN , ®s->mixctrl); - sdhc_clk >>=1 ; - } -if (clock < mmc->cfg->f_min) clock = mmc->cfg->f_min; -if (sdhc_clk /16 > clock) { -for (; pre_div <256 ; pre_div *=2 ) -if ((sdhc_clk / pre_div) <= (clock *16 )) -break ; - }else - pre_div =1 ; +while (sdhc_clk / (16 * pre_div * ddr_pre_div) > clock && pre_div <256 ) + pre_div *=2 ; -for (div =1 ; div <=16 ; div++) -if ((sdhc_clk / (div * pre_div)) <= clock) -break ; +while (sdhc_clk / (div * pre_div * ddr_pre_div) > clock && div <16 ) + div++; pre_div >>=1 ; div -=1 ;
Signature · 1 line
2.11.0
PATCH 1/1 Revert "mmc: fsl_esdhc: fix sd/mmc ddr mode clock setting issue"
Hi Lukasz,
Quoted 10 lines
Subject: [PATCH] Revert "mmc:
fsl_esdhc: fix sd/mmc ddr mode clock setting issue"This reverts commit
72a89e0da5ac6a4ab929b15a2b656f04f50767f6, which causes the imx53 HSC to hang as the eMMC is not working properly anymore.The exact error message:
MMC write: dev # 0, block # 2, count 927 ... mmc write failed 0 blocks written: ERROR
Quoted 7 lines
imx53 is not using the DDR mode.
Debugging of
pre_divand div generation showed that those values are generated in a way, which is not matching the ones from working setup.As the original patch was performing code refactoring, let's revert this change, so all imx53 boards would work again.
Could you share what is the clock value for your board?
Thanks,
Peng.
Quoted 49 lines
Signed-off-by Lukasz Majewski <[email protected]>--- drivers/mmc/fsl_esdhc.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-)drivers/mmc/fsl_esdhc.c index renamed from drivers/mmc/fsl_esdhc.c +0
-0
1b7de74a72..377b2673a3100644drivers/mmc/fsl_esdhc.c +0
-0@@ -621,31 +621,18 @@ static void set_sysctl(struct fsl_esdhc_priv *priv,struct mmc *mmc, uint clock) #else
drivers/mmc/fsl_esdhc.c +5
-19int pre_div =2 ;#endif +int ddr_pre_div = mmc->ddr_mode ?2 :1 ;int sdhc_clk = priv->sdhc_clk;uint clk; -/* -* For ddr mode, usdhc need to enable DDR mode first, after select -* this DDR mode, usdhc will automatically divide the usdhc clock -*/ -if (mmc->ddr_mode) { -writel (readl (®s->mixctrl) |MIX_CTRL_DDREN , ®s->mixctrl); - sdhc_clk >>=1 ; - } -if (clock < mmc->cfg->f_min) clock = mmc->cfg->f_min; -if (sdhc_clk /16 > clock) { -for (; pre_div <256 ; pre_div *=2 ) -if ((sdhc_clk / pre_div) <= (clock *16 )) -break ; - }else - pre_div =1 ; +while (sdhc_clk / (16 * pre_div * ddr_pre_div) > clock && pre_div <256 ) + pre_div *=2 ; -for (div =1 ; div <=16 ; div++) -if ((sdhc_clk / (div * pre_div)) <= clock) -break ; +while (sdhc_clk / (div * pre_div * ddr_pre_div) > clock && div <16 ) + div++; pre_div >>=1 ; div -=1 ; --2.11.0
PATCH 1/1 Revert "mmc: fsl_esdhc: fix sd/mmc ddr mode clock setting issue"
Hi Peng,
Quoted 15 lines
Hi Lukasz,
Quoted 13 lines
Subject: [PATCH] Revert "mmc:
fsl_esdhc: fix sd/mmc ddr mode clock setting issue"This reverts commit
72a89e0da5ac6a4ab929b15a2b656f04f50767f6, which causes the imx53 HSC to hang as the eMMC is not working properly anymore.The exact error message:
MMC write: dev # 0, block # 2, count 927 ... mmc write failed 0 blocks written: ERRORimx53 is not using the DDR mode.
Quoted 8 lines
Quoted 6 lines
Debugging of
pre_divand div generation showed that those values are generated in a way, which is not matching the ones from working setup.As the original patch was performing code refactoring, let's revert this change, so all imx53 boards would work again.
Could you share what is the clock value for your board?
Sure, no problem:
Working setup:
--------------
MMC:set_sysctl: pre_div = 2 mmc->ddr: 0 sdhc_clk: 80000000
pre_div: 8 div: 12 set_sysctl: clk: 2240FSL_SDHC: 0
Loading Environment from MMC...set_sysctl: pre_div = 2 mmc->ddr: 0 sdhc_clk: 80000000
pre_div: 8 div: 12 set_sysctl: clk: 2240
set_sysctl: pre_div = 2 mmc->ddr: 0 sdhc_clk: 80000000
pre_div: 8 div: 12 set_sysctl: clk: 2240
set_sysctl: pre_div = 2 mmc->ddr: 0 sdhc_clk: 80000000
pre_div: 1 div: 1 set_sysctl: clk: 272
set_sysctl: pre_div = 2 mmc->ddr: 0 sdhc_clk: 80000000
pre_div: 1 div: 0 set_sysctl: clk: 256
Broken:
-------
MMC:set_sysctl: pre_div = 2 mmc->ddr: 0 sdhc_clk: 80000000
pre_div: 8 div: 12 set_sysctl: clk: 2240FSL_SDHC: 0
Loading Environment from MMC...set_sysctl: pre_div = 2 mmc->ddr: 0 sdhc_clk: 80000000
pre_div: 8 div: 12 set_sysctl: clk: 2240
set_sysctl: pre_div = 2 mmc->ddr: 0 sdhc_clk: 80000000
pre_div: 8 div: 12 set_sysctl: clk: 2240
set_sysctl: pre_div = 2 mmc->ddr: 0 sdhc_clk: 80000000
pre_div: 0 div: 3 set_sysctl: clk: 48
set_sysctl: pre_div = 2 mmc->ddr: 0 sdhc_clk: 80000000
pre_div: 0 div: 1 set_sysctl: clk: 16
(Please also find attached patch to reproduce debug output).
Quoted 54 lines
Thanks,
Peng.Quoted 50 lines
Signed-off-by Lukasz Majewski <[email protected]>--- drivers/mmc/fsl_esdhc.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-)drivers/mmc/fsl_esdhc.c index renamed from drivers/mmc/fsl_esdhc.c +0
-0
1b7de74a72..377b2673a3100644drivers/mmc/fsl_esdhc.c +1
-2@@ -621,31 +621,18 @@ static void set_sysctl(struct fsl_esdhc_priv *priv, struct mmc *mmc, uint clock) #elseint pre_div =2 ;#endif +int ddr_pre_div = mmc->ddr_mode ?2 :1 ;int sdhc_clk = priv->sdhc_clk;uint clk; -/* -* For ddr mode, usdhc need to enable DDR mode first, after select
drivers/mmc/fsl_esdhc.c +0
-1-* this DDR mode, usdhc will automatically divide the usdhc clock
drivers/mmc/fsl_esdhc.c +0
-3-*/ -if (mmc->ddr_mode) { - writel(readl(®s->mixctrl) | MIX_CTRL_DDREN,
®s->mixctrl);drivers/mmc/fsl_esdhc.c +1
-9- sdhc_clk >>=1 ; - } -if (clock < mmc->cfg->f_min) clock = mmc->cfg->f_min; -if (sdhc_clk /16 > clock) { -for (; pre_div <256 ; pre_div *=2 ) -if ((sdhc_clk / pre_div) <= (clock *16 )) -break ; - }else - pre_div =1 ; + while (sdhc_clk / (16 * pre_div * ddr_pre_div) > clock &&
pre_div< 256)drivers/mmc/fsl_esdhc.c +2
-3+ pre_div *=2 ; -for (div =1 ; div <=16 ; div++) -if ((sdhc_clk / (div * pre_div)) <= clock) -break ; + while (sdhc_clk / (div * pre_div * ddr_pre_div) > clock &&div < 16)
drivers/mmc/fsl_esdhc.c +1
-0+ div++;
Quoted 5 lines
Quoted 4 lines
drivers/mmc/fsl_esdhc.c +0
-1pre_div >>=1 ; div -=1 ; --2.11.0
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-WIP.patch
Type: text/x-patch
Size: 1199 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190508/a02ee699/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190508/a02ee699/attachment.sig>
PATCH 1/1 Revert "mmc: fsl_esdhc: fix sd/mmc ddr mode clock setting issue"
Quoted 64 lines · On Wed, 8 May 2019 08:19:45 +0200 Lukasz Majewski <[email protected]> wrote:
Hi Peng,
Quoted 15 lines
Hi Lukasz,
Quoted 13 lines
Subject: [PATCH] Revert "mmc:
fsl_esdhc: fix sd/mmc ddr mode clock setting issue"This reverts commit
72a89e0da5ac6a4ab929b15a2b656f04f50767f6, which causes the imx53 HSC to hang as the eMMC is not working properly anymore.The exact error message:
MMC write: dev # 0, block # 2, count 927 ... mmc write failed 0 blocks written: ERRORimx53 is not using the DDR mode.
Quoted 8 lines
Quoted 6 lines
Debugging of
pre_divand div generation showed that those values are generated in a way, which is not matching the ones from working setup.As the original patch was performing code refactoring, let's revert this change, so all imx53 boards would work again.
Could you share what is the clock value for your board?
Sure, no problem:
Working setup:
--------------MMC:
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240FSL_SDHC: 0
Loading Environment from MMC...set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 1 div: 1set_sysctl: clk: 272
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 1 div: 0set_sysctl: clk: 256Broken:
-------
MMC:set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240FSL_SDHC: 0
Loading Environment from MMC...set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240
Quoted 9 lines
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 0 div: 3set_sysctl: clk: 48
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 0 div: 1set_sysctl: clk: 16(Please also find attached patch to reproduce debug output).
And maybe the most important question - why it was necessary to refactor this code?
Parts responsible for calculating pre_div and div seems not related to ddr problem (one spot issue is div <= 16 , but in the original code it was div < 16)?
Quoted 65 lines
Quoted 54 lines
Thanks,
Peng.Quoted 50 lines
Signed-off-by Lukasz Majewski <[email protected]>--- drivers/mmc/fsl_esdhc.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-)drivers/mmc/fsl_esdhc.c +1
-2@@ -621,31 +621,18 @@ static void set_sysctl(struct fsl_esdhc_priv *priv, struct mmc *mmc, uint clock) #elseint pre_div =2 ;#endif +int ddr_pre_div = mmc->ddr_mode ?2 :1 ;int sdhc_clk = priv->sdhc_clk;uint clk; -/* -* For ddr mode, usdhc need to enable DDR mode first, after select
drivers/mmc/fsl_esdhc.c +0
-1-* this DDR mode, usdhc will automatically divide the usdhc clock
drivers/mmc/fsl_esdhc.c +0
-3-*/ -if (mmc->ddr_mode) { - writel(readl(®s->mixctrl) | MIX_CTRL_DDREN,
®s->mixctrl);drivers/mmc/fsl_esdhc.c +1
-9- sdhc_clk >>=1 ; - } -if (clock < mmc->cfg->f_min) clock = mmc->cfg->f_min; -if (sdhc_clk /16 > clock) { -for (; pre_div <256 ; pre_div *=2 ) -if ((sdhc_clk / pre_div) <= (clock *16 )) -break ; - }else - pre_div =1 ; + while (sdhc_clk / (16 * pre_div * ddr_pre_div) > clock &&
pre_div< 256)drivers/mmc/fsl_esdhc.c +2
-3+ pre_div *=2 ; -for (div =1 ; div <=16 ; div++) -if ((sdhc_clk / (div * pre_div)) <= clock) -break ; + while (sdhc_clk / (div * pre_div * ddr_pre_div) > clock&& div < 16)
drivers/mmc/fsl_esdhc.c +1
-0+ div++;Quoted 5 lines
Quoted 4 lines
drivers/mmc/fsl_esdhc.c +0
-1pre_div >>=1 ; div -=1 ; --2.11.0
Best regards,
Quoted 8 lines
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190508/185091df/attachment.sig>
PATCH 1/1 Revert "mmc: fsl_esdhc: fix sd/mmc ddr mode clock setting issue"
Quoted 77 lines
Subject: Re: [PATCH] Revert "mmc:
fsl_esdhc: fix sd/mmc ddr mode clock setting issue"Quoted 71 lines · On Wed, 8 May 2019 08:19:45 +0200 Lukasz Majewski <[email protected]> wrote:
Hi Peng,
Quoted 15 lines
Hi Lukasz,
Quoted 13 lines
Subject: [PATCH] Revert "mmc:
fsl_esdhc: fix sd/mmc ddr mode clock setting issue"This reverts commit
72a89e0da5ac6a4ab929b15a2b656f04f50767f6, which causes the imx53 HSC to hang as the eMMC is not working properly anymore.The exact error message:
MMC write: dev # 0, block # 2, count 927 ... mmc write failed 0 blocks written: ERRORimx53 is not using the DDR mode.
Quoted 8 lines
Quoted 6 lines
Debugging of
pre_divand div generation showed that those values are generated in a way, which is not matching the ones from working setup.As the original patch was performing code refactoring, let's revert this change, so all imx53 boards would work again.
Could you share what is the clock value for your board?
Sure, no problem:
Working setup:
--------------MMC:
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240FSL_SDHC: 0
Loading Environment from MMC...set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 1 div: 1set_sysctl: clk: 272
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 1 div: 0set_sysctl: clk: 256Broken:
-------
MMC:set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240FSL_SDHC: 0
Loading Environment from MMC...set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 0 div: 3set_sysctl: clk: 48
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 0 div: 1set_sysctl: clk: 16
Quoted 8 lines
Quoted 2 lines
(Please also find attached patch to reproduce debug output).
And maybe the most important question - why it was necessary to refactor this code?
Parts responsible for calculating
pre_divand div seems not related to ddr problem (one spot issue is div <= 16 , but in the original code it was div < 16)?
This patch is mostly to support HS400 DDR_EN mode,
But after I check more, seems it is not a right fix, sorry for this regression.
It does almost the same calculation as before code expect writel(readl(®s->mixctrl) | MIX_CTRL_DDREN, ®s->mixctrl);
and one condition break others.
So the fix for you is
drivers/mmc/fsl_esdhc.c +1 -2
@@ -640,8 +640,7 @@ static void set_sysctl(struct fsl_esdhc_priv *priv, struct mmc *mmc, uint clock)for (; pre_div <256 ; pre_div *=2 )if ((sdhc_clk / pre_div) <= (clock *16 ))break ; - }else - pre_div =1 ; + }for (div =1 ; div <=16 ; div++)if ((sdhc_clk / (div * pre_div)) <= clock)
With this patch, the i.MX8 HS400 will work@100MHz not 200MHz, But it not hang anyway. To fix the i.MX8, need define ARCH_MXC, I'll add a new patch for ARCH_MXC part for i.MX family.
Regards,
Peng.
Quoted 89 lines
Quoted 64 lines
Quoted 55 lines
Thanks,
Peng.Quoted 50 lines
Signed-off-by Lukasz Majewski <[email protected]>--- drivers/mmc/fsl_esdhc.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-)drivers/mmc/fsl_esdhc.c +1
-2@@ -621,31 +621,18 @@ static void set_sysctl(struct fsl_esdhc_priv *priv, struct mmc *mmc, uint clock) #elseint pre_div =2 ;#endif +int ddr_pre_div = mmc->ddr_mode ?2 :1 ;int sdhc_clk = priv->sdhc_clk;uint clk; -/* -* For ddr mode, usdhc need to enable DDR mode first, after select
drivers/mmc/fsl_esdhc.c +0
-1-* this DDR mode, usdhc will automatically divide the usdhc clock
drivers/mmc/fsl_esdhc.c +0
-3-*/ -if (mmc->ddr_mode) { - writel(readl(®s->mixctrl) | MIX_CTRL_DDREN,
®s->mixctrl);drivers/mmc/fsl_esdhc.c +1
-9- sdhc_clk >>=1 ; - } -if (clock < mmc->cfg->f_min) clock = mmc->cfg->f_min; -if (sdhc_clk /16 > clock) { -for (; pre_div <256 ; pre_div *=2 ) -if ((sdhc_clk / pre_div) <= (clock *16 )) -break ; - }else - pre_div =1 ; + while (sdhc_clk / (16 * pre_div * ddr_pre_div) > clock &&
pre_div< 256)drivers/mmc/fsl_esdhc.c +2
-3+ pre_div *=2 ; -for (div =1 ; div <=16 ; div++) -if ((sdhc_clk / (div * pre_div)) <= clock) -break ; + while (sdhc_clk / (div * pre_div * ddr_pre_div) > clock&& div < 16)
drivers/mmc/fsl_esdhc.c +1
-0+ div++;Quoted 5 lines
Quoted 4 lines
drivers/mmc/fsl_esdhc.c +0
-1pre_div >>=1 ; div -=1 ; --2.11.0
Quoted 7 lines
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk
Quoted 3 lines
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.deBest regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de
PATCH 1/1 Revert "mmc: fsl_esdhc: fix sd/mmc ddr mode clock setting issue"
Hi Peng,
Quoted 113 lines
Quoted 80 lines
Subject: Re: [PATCH] Revert "mmc:
fsl_esdhc: fix sd/mmc ddr mode clock setting issue"Quoted 64 lines · On Wed, 8 May 2019 08:19:45 +0200 Lukasz Majewski <[email protected]> wrote:
Hi Peng,
Quoted 15 lines
Hi Lukasz,
Quoted 13 lines
Subject: [PATCH] Revert "mmc:
fsl_esdhc: fix sd/mmc ddr mode clock setting issue"This reverts commit
72a89e0da5ac6a4ab929b15a2b656f04f50767f6, which causes the imx53 HSC to hang as the eMMC is not working properly anymore.The exact error message:
MMC write: dev # 0, block # 2, count 927 ... mmc write failed 0 blocks written: ERRORimx53 is not using the DDR mode.
Quoted 8 lines
Quoted 6 lines
Debugging of
pre_divand div generation showed that those values are generated in a way, which is not matching the ones from working setup.As the original patch was performing code refactoring, let's revert this change, so all imx53 boards would work again.
Could you share what is the clock value for your board?
Sure, no problem:
Working setup:
--------------MMC:
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240FSL_SDHC: 0
Loading Environment from MMC...set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 1 div: 1set_sysctl: clk: 272
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 1 div: 0set_sysctl: clk: 256Broken:
-------
MMC:set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240FSL_SDHC: 0
Loading Environment from MMC...set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240Quoted 9 lines
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 0 div: 3set_sysctl: clk: 48
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 0 div: 1set_sysctl: clk: 16(Please also find attached patch to reproduce debug output).
Quoted 6 lines
And maybe the most important question - why it was necessary to refactor this code?
Parts responsible for calculating
pre_divand div seems not related to ddr problem (one spot issue is div <= 16 , but in the original code it was div < 16)?This patch is mostly to support HS400
DDR_ENmode,
But after I check more, seems it is not a right fix, sorry for this regression.It does almost the same calculation as before code expect
writel(readl(®s->mixctrl) | MIX_CTRL_DDREN, ®s->mixctrl);and one condition break others.
So the fix for you is
drivers/mmc/fsl_esdhc.c +1
-2@@ -640,8 +640,7 @@ static void set_sysctl(struct fsl_esdhc_priv *priv, struct mmc *mmc, uint clock) for (; pre_div < 256; pre_div *=2 )if ((sdhc_clk / pre_div) <= (clock *16 ))break ; - }else - pre_div =1 ; + }for (div =1 ; div <=16 ; div++)if ((sdhc_clk / (div * pre_div)) <= clock)
Quoted 4 lines
With this patch, the i.MX8 HS400 will work at 100MHz not 200MHz, But it not hang anyway. To fix the i.MX8, need define
ARCH_MXC, I'll add a new patch forARCH_MXCpart for i.MX family.
Thanks for the explanation.
I'm just wondering if we shall revert the original patch and wait for proper fix for IMX8 or will you prepare a separate patch to fix the current mainline (so the "revert" patch can be dropped) ?
Quoted 93 lines
Regards,
Peng.Quoted 90 lines
Quoted 65 lines
Quoted 56 lines
Thanks,
Peng.Quoted 51 lines
Signed-off-by Lukasz Majewski <[email protected]>--- drivers/mmc/fsl_esdhc.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-)drivers/mmc/fsl_esdhc.c +0
-0@@ -621,31 +621,18 @@ static void set_sysctl(struct
fsl_esdhc_priv*priv, struct mmc *mmc, uint clock) #elsedrivers/mmc/fsl_esdhc.c +1
-2int pre_div =2 ;#endif +int ddr_pre_div = mmc->ddr_mode ?2 :1 ;int sdhc_clk = priv->sdhc_clk;uint clk; -/* -* For ddr mode, usdhc need to enable DDR mode first, after select
drivers/mmc/fsl_esdhc.c +0
-1-* this DDR mode, usdhc will automatically divide the usdhc clock
drivers/mmc/fsl_esdhc.c +0
-3-*/ -if (mmc->ddr_mode) { - writel(readl(®s->mixctrl) |
MIX_CTRL_DDREN,®s->mixctrl);drivers/mmc/fsl_esdhc.c +0
-6- sdhc_clk >>=1 ; - } -if (clock < mmc->cfg->f_min) clock = mmc->cfg->f_min; -if (sdhc_clk /16 > clock) { -for (; pre_div <256 ; pre_div *=2 ) - if ((sdhc_clk / pre_div) <= (clock *16))
drivers/mmc/fsl_esdhc.c +1
-3-break ; - }else - pre_div =1 ; + while (sdhc_clk / (16 * pre_div * ddr_pre_div) >clock &&
pre_div< 256)drivers/mmc/fsl_esdhc.c +2
-3+ pre_div *=2 ; -for (div =1 ; div <=16 ; div++) -if ((sdhc_clk / (div * pre_div)) <= clock) -break ; + while (sdhc_clk / (div * pre_div * ddr_pre_div) >clock && div < 16)
drivers/mmc/fsl_esdhc.c +1
-0+ div++;Quoted 5 lines
Quoted 4 lines
drivers/mmc/fsl_esdhc.c +0
-1pre_div >>=1 ; div -=1 ; --2.11.0
Quoted 7 lines
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk
Quoted 3 lines
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.deBest regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190508/11abbade/attachment.sig>
PATCH 1/1 Revert "mmc: fsl_esdhc: fix sd/mmc ddr mode clock setting issue"
Quoted 134 lines
-----Original Message-----
From: Lukasz Majewski [mailto:lukma at denx.de]
Sent: 2019年5月8日 19:38
To: Peng Fan <[email protected]>
Cc: u-boot at lists.denx.de; Tom Rini <[email protected]>; Marcel Ziswiler <[email protected]>; Fabio Estevam <[email protected]>; dl-uboot-imx <[email protected]>; sbabic at denx.de; Stefan Agner <[email protected]>; BOUGH CHEN <[email protected]>; Ye Li <[email protected]>
Subject: Re: [PATCH] Revert "mmc:fsl_esdhc: fix sd/mmc ddr mode clock setting issue"Hi Peng,
Quoted 112 lines
Quoted 80 lines
Subject: Re: [PATCH] Revert "mmc:
fsl_esdhc: fix sd/mmc ddr mode clock setting issue"Quoted 64 lines · On Wed, 8 May 2019 08:19:45 +0200 Lukasz Majewski <[email protected]> wrote:
Hi Peng,
Quoted 15 lines
Hi Lukasz,
Quoted 13 lines
Subject: [PATCH] Revert "mmc:
fsl_esdhc: fix sd/mmc ddr mode clock setting issue"This reverts commit
72a89e0da5ac6a4ab929b15a2b656f04f50767f6, which causes the imx53 HSC to hang as the eMMC is not working properly anymore.The exact error message:
MMC write: dev # 0, block # 2, count 927 ... mmc write failed 0 blocks written: ERRORimx53 is not using the DDR mode.
Quoted 8 lines
Quoted 6 lines
Debugging of
pre_divand div generation showed that those values are generated in a way, which is not matching the ones from working setup.As the original patch was performing code refactoring, let's revert this change, so all imx53 boards would work again.
Could you share what is the clock value for your board?
Sure, no problem:
Working setup:
--------------MMC:
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240FSL_SDHC: 0
Loading Environment from MMC...set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 1 div: 1set_sysctl: clk: 272
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 1 div: 0set_sysctl: clk: 256Broken:
-------
MMC:set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240FSL_SDHC: 0
Loading Environment from MMC...set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240Quoted 9 lines
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 0 div: 3set_sysctl: clk: 48
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 0 div: 1set_sysctl: clk: 16(Please also find attached patch to reproduce debug output).
Quoted 6 lines
And maybe the most important question - why it was necessary to refactor this code?
Parts responsible for calculating
pre_divand div seems not related to ddr problem (one spot issue is div <= 16 , but in the original code it was div < 16)?This patch is mostly to support HS400
DDR_ENmode, But after I check more, seems it is not a right fix, sorry for this regression.It does almost the same calculation as before code expect
writel(readl(®s->mixctrl) | MIX_CTRL_DDREN, ®s->mixctrl);and one condition break others.
So the fix for you is
drivers/mmc/fsl_esdhc.c index renamed from drivers/mmc/fsl_esdhc.c +0
-0
1b7de74a72..3347fbe738100644drivers/mmc/fsl_esdhc.c +1
-2@@ -640,8 +640,7 @@ static void set_sysctl(struct fsl_esdhc_priv *priv, struct mmc *mmc, uint clock) for (; pre_div < 256; pre_div *=2 )if ((sdhc_clk / pre_div) <= (clock *16 ))break ; - }else - pre_div =1 ; + }for (div =1 ; div <=16 ; div++)if ((sdhc_clk / (div * pre_div)) <= clock)Quoted 4 lines
With this patch, the i.MX8 HS400 will work at 100MHz not 200MHz, But it not hang anyway. To fix the i.MX8, need define
ARCH_MXC, I'll add a new patch forARCH_MXCpart for i.MX family.Thanks for the explanation.
Quoted 3 lines
I'm just wondering if we shall revert the original patch and wait for proper fix for IMX8 or will you prepare a separate patch to fix the current mainline (so the "revert" patch can be dropped) ?
When we add the patch, we do not take the i.mx53 case into consideration. Sorry for this mistake. I prefer add a fix patch rather than 'revert', because I notice there is a claim in the RM:
If setting SDCLKFS and DVS can generate same clock frequency,(For example, in SDR mode, SDCLKFS = 01h is same as DVS = 01h.) SDCLKFS is highly recommended.
For both these methods, the current one or the previous one, the code prefer DVS rather than SDCLKFS, not align with the RM suggestion. So this time I plan to re-write the code to follow the RM suggestion. I will send a patch these week.
Regards,
Bough Chen
Quoted 107 lines
Quoted 94 lines
Regards,
Peng.Quoted 90 lines
Quoted 65 lines
Quoted 56 lines
Thanks,
Peng.Quoted 51 lines
Signed-off-by Lukasz Majewski <[email protected]>--- drivers/mmc/fsl_esdhc.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-)drivers/mmc/fsl_esdhc.c +0
-0@@ -621,31 +621,18 @@ static void set_sysctl(struct
fsl_esdhc_priv*priv, struct mmc *mmc, uint clock) #elsedrivers/mmc/fsl_esdhc.c +1
-2int pre_div =2 ;#endif +int ddr_pre_div = mmc->ddr_mode ?2 :1 ;int sdhc_clk = priv->sdhc_clk;uint clk; -/* -* For ddr mode, usdhc need to enable DDR mode first, after select
drivers/mmc/fsl_esdhc.c +0
-1-* this DDR mode, usdhc will automatically divide the usdhc clock
drivers/mmc/fsl_esdhc.c +0
-3-*/ -if (mmc->ddr_mode) { - writel(readl(®s->mixctrl) |
MIX_CTRL_DDREN,®s->mixctrl);drivers/mmc/fsl_esdhc.c +0
-6- sdhc_clk >>=1 ; - } -if (clock < mmc->cfg->f_min) clock = mmc->cfg->f_min; -if (sdhc_clk /16 > clock) { -for (; pre_div <256 ; pre_div *=2 ) - if ((sdhc_clk / pre_div) <= (clock *16))
drivers/mmc/fsl_esdhc.c +1
-3-break ; - }else - pre_div =1 ; + while (sdhc_clk / (16 * pre_div * ddr_pre_div) >clock &&
pre_div< 256)drivers/mmc/fsl_esdhc.c +2
-3+ pre_div *=2 ; -for (div =1 ; div <=16 ; div++) -if ((sdhc_clk / (div * pre_div)) <= clock) -break ; + while (sdhc_clk / (div * pre_div * ddr_pre_div) >clock && div < 16)
drivers/mmc/fsl_esdhc.c +1
-0+ div++;Quoted 5 lines
Quoted 4 lines
drivers/mmc/fsl_esdhc.c +0
-1pre_div >>=1 ; div -=1 ; --2.11.0
Quoted 7 lines
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk
Quoted 3 lines
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.deBest regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.deBest regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de
PATCH 1/1 Revert "mmc: fsl_esdhc: fix sd/mmc ddr mode clock setting issue"
Quoted 144 lines · On Wed, 8 May 2019 13:03:58 +0000 BOUGH CHEN <[email protected]> wrote:
Quoted 136 lines
-----Original Message-----
From: Lukasz Majewski [mailto:lukma at denx.de]
Sent: 2019年5月8日 19:38
To: Peng Fan <[email protected]>
Cc: u-boot at lists.denx.de; Tom Rini <[email protected]>; Marcel Ziswiler <[email protected]>; Fabio Estevam <[email protected]>; dl-uboot-imx <[email protected]>; sbabic at denx.de; Stefan Agner <[email protected]>; BOUGH CHEN <[email protected]>; Ye Li <[email protected]>
Subject: Re: [PATCH] Revert "mmc:fsl_esdhc: fix sd/mmc ddr mode clock setting issue"Hi Peng,
Quoted 115 lines
Quoted 82 lines
Subject: Re: [PATCH] Revert "mmc:
fsl_esdhc: fix sd/mmc ddr mode clock setting issue"Quoted 66 lines · On Wed, 8 May 2019 08:19:45 +0200 Lukasz Majewski <[email protected]> wrote:
Hi Peng,
Quoted 20 lines
Hi Lukasz,
Quoted 18 lines
Subject: [PATCH] Revert "mmc:
fsl_esdhc: fix sd/mmc ddr mode clock setting issue"This reverts commit
72a89e0da5ac6a4ab929b15a2b656f04f50767f6, which causes the imx53 HSC to hang as the eMMC is not working properly anymore.The exact error message:
MMC write: dev # 0, block # 2, count 927 ... mmc write failed 0 blocks written: ERRORimx53 is not using the DDR mode.
Debugging of
pre_divand div generation showed that those values are generated in a way, which is not matching the ones from working setup.Quoted 5 lines
Quoted 3 lines
As the original patch was performing code refactoring, let's revert this change, so all imx53 boards would work again.
Could you share what is the clock value for your board?
Sure, no problem:
Working setup:
--------------MMC:
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240FSL_SDHC: 0
Loading Environment from MMC...set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 1 div: 1set_sysctl: clk: 272
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 1 div: 0set_sysctl: clk: 256Broken:
-------
MMC:set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240FSL_SDHC: 0
Loading Environment from MMC...set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240Quoted 9 lines
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 0 div: 3set_sysctl: clk: 48
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 0 div: 1set_sysctl: clk: 16(Please also find attached patch to reproduce debug output).
Quoted 6 lines
And maybe the most important question - why it was necessary to refactor this code?
Parts responsible for calculating
pre_divand div seems not related to ddr problem (one spot issue is div <= 16 , but in the original code it was div < 16)?This patch is mostly to support HS400
DDR_ENmode, But after I check more, seems it is not a right fix, sorry for this regression.It does almost the same calculation as before code expect
writel(readl(®s->mixctrl) | MIX_CTRL_DDREN, ®s->mixctrl);and one condition break others.
So the fix for you is
drivers/mmc/fsl_esdhc.c +1
-2@@ -640,8 +640,7 @@ static void set_sysctl(struct fsl_esdhc_priv *priv, struct mmc *mmc, uint clock) for (; pre_div < 256; pre_div *=2 )if ((sdhc_clk / pre_div) <= (clock *16 ))break ; - }else - pre_div =1 ; + }for (div =1 ; div <=16 ; div++)if ((sdhc_clk / (div * pre_div)) <= clock)Quoted 4 lines
With this patch, the i.MX8 HS400 will work at 100MHz not 200MHz, But it not hang anyway. To fix the i.MX8, need define
ARCH_MXC, I'll add a new patch forARCH_MXCpart for i.MX family.Thanks for the explanation.
Quoted 3 lines
I'm just wondering if we shall revert the original patch and wait for proper fix for IMX8 or will you prepare a separate patch to fix the current mainline (so the "revert" patch can be dropped) ?
When we add the patch, we do not take the i.mx53 case into consideration. Sorry for this mistake. I prefer add a fix patch rather than 'revert', because I notice there is a claim in the RM:
Quoted 9 lines
If setting SDCLKFS and DVS can generate same clock frequency,(For
example, in SDR mode, SDCLKFS = 01h is same as DVS = 01h.) SDCLKFS is highly recommended.For both these methods, the current one or the previous one, the code prefer DVS rather than SDCLKFS, not align with the RM suggestion. So this time I plan to re-write the code to follow the RM suggestion. I will send a patch these week.
Ok. Thanks for the update.
I'm looking forward to test your patch.
Quoted 113 lines
Regards,
Bough ChenQuoted 110 lines
Quoted 96 lines
Regards,
Peng.Quoted 92 lines
Quoted 66 lines
Quoted 57 lines
Thanks,
Peng.Quoted 52 lines
Signed-off-by Lukasz Majewski <[email protected]>--- drivers/mmc/fsl_esdhc.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-)(quoted diff) +0
-0
b/drivers/mmc/fsl_esdhc.cindex1b7de74a72..377b2673a3100644 ---a/drivers/mmc/fsl_esdhc.c
+++b/drivers/mmc/fsl_esdhc.c(quoted diff) +0
-0@@ -621,31 +621,18 @@ static void set_sysctl(struct
fsl_esdhc_priv*priv, struct mmc *mmc, uint clock) #else(quoted diff) +1
-2int pre_div = 2; #endif + int ddr_pre_div = mmc->ddr_mode ? 2 : 1; int sdhc_clk = priv->sdhc_clk; uint clk; - /* - * For ddr mode, usdhc need to enable DDR modefirst, after select
(quoted diff) +0
-1- * this DDR mode, usdhc will automaticallydivide the usdhc clock
(quoted diff) +0
-3- */ - if (mmc->ddr_mode) { - writel(readl(®s->mixctrl) |
MIX_CTRL_DDREN,®s->mixctrl);(quoted diff) +0
-6- sdhc_clk >>= 1; - } - if (clock < mmc->cfg->f_min) clock = mmc->cfg->f_min; - if (sdhc_clk / 16 > clock) { - for (; pre_div < 256; pre_div *= 2) - if ((sdhc_clk / pre_div) <=(clock * 16))
drivers/mmc/fsl_esdhc.c +1
-3-break ; - }else - pre_div =1 ; + while (sdhc_clk / (16 * pre_div * ddr_pre_div) >clock &&
pre_div< 256)(quoted diff) +1
-2+ pre_div *= 2; - for (div = 1; div <= 16; div++) - if ((sdhc_clk / (div * pre_div)) <=clock)
(quoted diff) +1
-1- break; + while (sdhc_clk / (div * pre_div * ddr_pre_div) >clock && div < 16)
(quoted diff) +1
-0+ div++;Quoted 5 lines
Quoted 4 lines
(quoted diff) +0
-1pre_div >>= 1; div -= 1; --2.11.0
Quoted 8 lines
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director:
WolfgangDenk
Quoted 3 lines
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80
Email: lukma at denx.deBest regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
(+49)-8142-66989-80 Email: lukma at denx.deBest regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190508/ef550c93/attachment.sig>
PATCH 1/1 Revert "mmc: fsl_esdhc: fix sd/mmc ddr mode clock setting issue"
In reply to Lukasz MajewskiQuoted 88 lines
-----Original Message-----
From: Lukasz Majewski [mailto:lukma at denx.de]
Sent: 2019年5月8日 14:38
To: Peng Fan <[email protected]>
Cc: u-boot at lists.denx.de; Tom Rini <[email protected]>; Marcel Ziswiler <[email protected]>; Fabio Estevam <[email protected]>; dl-uboot-imx <[email protected]>; sbabic at denx.de; Stefan Agner <[email protected]>; BOUGH CHEN <[email protected]>; Ye Li <[email protected]>
Subject: Re: [PATCH] Revert "mmc:fsl_esdhc: fix sd/mmc ddr mode clock setting issue"Quoted 71 lines · On Wed, 8 May 2019 08:19:45 +0200 Lukasz Majewski <[email protected]> wrote:
Hi Peng,
Quoted 15 lines
Hi Lukasz,
Quoted 13 lines
Subject: [PATCH] Revert "mmc:
fsl_esdhc: fix sd/mmc ddr mode clock setting issue"This reverts commit
72a89e0da5ac6a4ab929b15a2b656f04f50767f6, which causes the imx53 HSC to hang as the eMMC is not working properly anymore.The exact error message:
MMC write: dev # 0, block # 2, count 927 ... mmc write failed 0 blocks written: ERRORimx53 is not using the DDR mode.
Quoted 8 lines
Quoted 6 lines
Debugging of
pre_divand div generation showed that those values are generated in a way, which is not matching the ones from working setup.As the original patch was performing code refactoring, let's revert this change, so all imx53 boards would work again.
Could you share what is the clock value for your board?
Sure, no problem:
Working setup:
--------------MMC:
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240FSL_SDHC: 0
Loading Environment from MMC...set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 1 div: 1set_sysctl: clk: 272
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 1 div: 0set_sysctl: clk: 256Broken:
-------
MMC:set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240FSL_SDHC: 0
Loading Environment from MMC...set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 0 div: 3set_sysctl: clk: 48
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 0 div: 1set_sysctl: clk: 16
Quoted 8 lines
Quoted 2 lines
(Please also find attached patch to reproduce debug output).
And maybe the most important question - why it was necessary to refactor this code?
Parts responsible for calculating
pre_divand div seems not related to ddr problem (one spot issue is div <= 16 , but in the original code it was div < 16)?
Could you help verify whether the patch fixes you issue?
index 1b7de74a72..3347fbe738 100644
drivers/mmc/fsl_esdhc.c +1 -2
@@ -640,8 +640,7 @@ static void set_sysctl(struct fsl_esdhc_priv *priv, struct mmc *mmc, uint clock)for (; pre_div <256 ; pre_div *=2 )if ((sdhc_clk / pre_div) <= (clock *16 ))break ; - }else - pre_div =1 ; + }for (div =1 ; div <=16 ; div++)if ((sdhc_clk / (div * pre_div)) <= clock)
Thanks,
Peng.
Quoted 89 lines
Quoted 64 lines
Quoted 55 lines
Thanks,
Peng.Quoted 50 lines
Signed-off-by Lukasz Majewski <[email protected]>--- drivers/mmc/fsl_esdhc.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-)drivers/mmc/fsl_esdhc.c +1
-2@@ -621,31 +621,18 @@ static void set_sysctl(struct fsl_esdhc_priv *priv, struct mmc *mmc, uint clock) #elseint pre_div =2 ;#endif +int ddr_pre_div = mmc->ddr_mode ?2 :1 ;int sdhc_clk = priv->sdhc_clk;uint clk; -/* -* For ddr mode, usdhc need to enable DDR mode first, after select
drivers/mmc/fsl_esdhc.c +0
-1-* this DDR mode, usdhc will automatically divide the usdhc clock
drivers/mmc/fsl_esdhc.c +0
-3-*/ -if (mmc->ddr_mode) { - writel(readl(®s->mixctrl) | MIX_CTRL_DDREN,
®s->mixctrl);drivers/mmc/fsl_esdhc.c +1
-9- sdhc_clk >>=1 ; - } -if (clock < mmc->cfg->f_min) clock = mmc->cfg->f_min; -if (sdhc_clk /16 > clock) { -for (; pre_div <256 ; pre_div *=2 ) -if ((sdhc_clk / pre_div) <= (clock *16 )) -break ; - }else - pre_div =1 ; + while (sdhc_clk / (16 * pre_div * ddr_pre_div) > clock &&
pre_div< 256)drivers/mmc/fsl_esdhc.c +2
-3+ pre_div *=2 ; -for (div =1 ; div <=16 ; div++) -if ((sdhc_clk / (div * pre_div)) <= clock) -break ; + while (sdhc_clk / (div * pre_div * ddr_pre_div) > clock&& div < 16)
drivers/mmc/fsl_esdhc.c +1
-0+ div++;Quoted 5 lines
Quoted 4 lines
drivers/mmc/fsl_esdhc.c +0
-1pre_div >>=1 ; div -=1 ; --2.11.0
Quoted 7 lines
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk
Quoted 3 lines
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.deBest regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de
PATCH 1/1 Revert "mmc: fsl_esdhc: fix sd/mmc ddr mode clock setting issue"
Quoted 102 lines · On Wed, 8 May 2019 13:59:14 +0000 Peng Fan <[email protected]> wrote:
Quoted 89 lines
-----Original Message-----
From: Lukasz Majewski [mailto:lukma at denx.de]
Sent: 2019年5月8日 14:38
To: Peng Fan <[email protected]>
Cc: u-boot at lists.denx.de; Tom Rini <[email protected]>; Marcel Ziswiler <[email protected]>; Fabio Estevam <[email protected]>; dl-uboot-imx <[email protected]>; sbabic at denx.de; Stefan Agner <[email protected]>; BOUGH CHEN <[email protected]>; Ye Li <[email protected]>
Subject: Re: [PATCH] Revert "mmc:fsl_esdhc: fix sd/mmc ddr mode clock setting issue"Quoted 64 lines · On Wed, 8 May 2019 08:19:45 +0200 Lukasz Majewski <[email protected]> wrote:
Hi Peng,
Quoted 15 lines
Hi Lukasz,
Quoted 13 lines
Subject: [PATCH] Revert "mmc:
fsl_esdhc: fix sd/mmc ddr mode clock setting issue"This reverts commit
72a89e0da5ac6a4ab929b15a2b656f04f50767f6, which causes the imx53 HSC to hang as the eMMC is not working properly anymore.The exact error message:
MMC write: dev # 0, block # 2, count 927 ... mmc write failed 0 blocks written: ERRORimx53 is not using the DDR mode.
Quoted 8 lines
Quoted 6 lines
Debugging of
pre_divand div generation showed that those values are generated in a way, which is not matching the ones from working setup.As the original patch was performing code refactoring, let's revert this change, so all imx53 boards would work again.
Could you share what is the clock value for your board?
Sure, no problem:
Working setup:
--------------MMC:
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240FSL_SDHC: 0
Loading Environment from MMC...set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 1 div: 1set_sysctl: clk: 272
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 1 div: 0set_sysctl: clk: 256Broken:
-------
MMC:set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240FSL_SDHC: 0
Loading Environment from MMC...set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240Quoted 9 lines
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 0 div: 3set_sysctl: clk: 48
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 0 div: 1set_sysctl: clk: 16(Please also find attached patch to reproduce debug output).
Quoted 6 lines
And maybe the most important question - why it was necessary to refactor this code?
Parts responsible for calculating
pre_divand div seems not related to ddr problem (one spot issue is div <= 16 , but in the original code it was div < 16)?Could you help verify whether the patch fixes you issue?
index
1b7de74a72..3347fbe738100644
drivers/mmc/fsl_esdhc.c static void set_sysctl(struct fsl_esdhc_priv · line 643
Quoted 6 lines
drivers/mmc/fsl_esdhc.c +1
-2@@ -640,8 +640,7 @@ static void set_sysctl(struct fsl_esdhc_priv *priv, struct mmc *mmc, uint clock) for (; pre_div < 256; pre_div *=2 )if ((sdhc_clk / pre_div) <= (clock *16 ))break ; - }else - pre_div =1 ; + }
Please examine this code thoroughly and provide patch.
The
} else
pre_div = 1;
was added there for a purpose, so I'm wondering why it can be easily removed now.
drivers/mmc/fsl_esdhc.c static void set_sysctl(struct fsl_esdhc_priv *priv, struct mmc *mmc, uint clock)
Quoted 4 lines
drivers/mmc/fsl_esdhc.c +0
-0for (div =1 ; div <=16 ; div++)if ((sdhc_clk / (div * pre_div)) <= clock)
As I've stated above - is the above for() correct?
In the original code it was div < 16, but here it is div <= 16.
Quoted 94 lines
Thanks,
Peng.Quoted 90 lines
Quoted 65 lines
Quoted 56 lines
Thanks,
Peng.Quoted 51 lines
Signed-off-by Lukasz Majewski <[email protected]>--- drivers/mmc/fsl_esdhc.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-)drivers/mmc/fsl_esdhc.c +0
-0@@ -621,31 +621,18 @@ static void set_sysctl(struct
fsl_esdhc_priv*priv, struct mmc *mmc, uint clock) #elsedrivers/mmc/fsl_esdhc.c +1
-2int pre_div =2 ;#endif +int ddr_pre_div = mmc->ddr_mode ?2 :1 ;int sdhc_clk = priv->sdhc_clk;uint clk; -/* -* For ddr mode, usdhc need to enable DDR mode first, after select
drivers/mmc/fsl_esdhc.c +0
-1-* this DDR mode, usdhc will automatically divide the usdhc clock
drivers/mmc/fsl_esdhc.c +0
-3-*/ -if (mmc->ddr_mode) { - writel(readl(®s->mixctrl) |
MIX_CTRL_DDREN,®s->mixctrl);drivers/mmc/fsl_esdhc.c +0
-6- sdhc_clk >>=1 ; - } -if (clock < mmc->cfg->f_min) clock = mmc->cfg->f_min; -if (sdhc_clk /16 > clock) { -for (; pre_div <256 ; pre_div *=2 ) - if ((sdhc_clk / pre_div) <= (clock *16))
drivers/mmc/fsl_esdhc.c +1
-3-break ; - }else - pre_div =1 ; + while (sdhc_clk / (16 * pre_div * ddr_pre_div) >clock &&
pre_div< 256)drivers/mmc/fsl_esdhc.c +2
-3+ pre_div *=2 ; -for (div =1 ; div <=16 ; div++) -if ((sdhc_clk / (div * pre_div)) <= clock) -break ; + while (sdhc_clk / (div * pre_div * ddr_pre_div) >clock && div < 16)
drivers/mmc/fsl_esdhc.c +1
-0+ div++;Quoted 5 lines
Quoted 4 lines
drivers/mmc/fsl_esdhc.c +0
-1pre_div >>=1 ; div -=1 ; --2.11.0
Quoted 7 lines
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk
Quoted 3 lines
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.deBest regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190508/1466773c/attachment.sig>
PATCH 1/1 Revert "mmc: fsl_esdhc: fix sd/mmc ddr mode clock setting issue"
Quoted 106 lines
Subject: Re: [PATCH] Revert "mmc:
fsl_esdhc: fix sd/mmc ddr mode clock setting issue"Quoted 8 lines · On Wed, 8 May 2019 13:59:14 +0000 Peng Fan <[email protected]> wrote:
Quoted 8 lines
-----Original Message-----
From: Lukasz Majewski [mailto:lukma at denx.de]
Sent: 2019年5月8日 14:38
To: Peng Fan <[email protected]>
Cc: u-boot at lists.denx.de; Tom Rini <[email protected]>; Marcel Ziswiler <[email protected]>; Fabio Estevam <[email protected]>; dl-uboot-imx <[email protected]>; sbabic at denx.de; Stefan Agner <[email protected]>; BOUGHCHEN
Quoted 7 lines
Quoted 7 lines
<[email protected]>; Ye Li <[email protected]>
Subject: Re: [PATCH] Revert "mmc:fsl_esdhc: fix sd/mmc ddr mode clock setting issue"On Wed, 8 May 2019 08:19:45 +0200
Lukasz Majewski <[email protected]> wrote:Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Hi Peng,
Quoted 6 lines
Hi Lukasz,
Quoted 4 lines
Subject: [PATCH] Revert "mmc:
fsl_esdhc: fix sd/mmc ddr mode clock setting issue"This reverts commit
72a89e0da5ac6a4ab929b15a2b656f04f50767f6,Quoted 75 lines
Quoted 66 lines
Quoted 56 lines
Quoted 9 lines
Quoted 9 lines
which causes the imx53 HSC to hang as the eMMC is not working properly anymore.
The exact error message:
MMC write: dev # 0, block # 2, count 927 ... mmc write failed 0 blocks written: ERRORimx53 is not using the DDR mode.
Quoted 8 lines
Quoted 6 lines
Debugging of
pre_divand div generation showed that those values are generated in a way, which is not matching the ones from working setup.As the original patch was performing code refactoring, let's revert this change, so all imx53 boards would work again.
Could you share what is the clock value for your board?
Sure, no problem:
Working setup:
--------------MMC:
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240FSL_SDHC: 0
Loading Environment from MMC...set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 1 div: 1set_sysctl: clk: 272
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 1 div: 0set_sysctl: clk: 256Broken:
-------
MMC:set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240FSL_SDHC: 0
Loading Environment from MMC...set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240Quoted 9 lines
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 0 div: 3set_sysctl: clk: 48
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 0 div: 1set_sysctl: clk: 16(Please also find attached patch to reproduce debug output).
Quoted 6 lines
And maybe the most important question - why it was necessary to refactor this code?
Parts responsible for calculating
pre_divand div seems not related to ddr problem (one spot issue is div <= 16 , but in the original code it was div < 16)?Could you help verify whether the patch fixes you issue?
Quoted 12 lines
drivers/mmc/fsl_esdhc.c static void set_sysctl(struct fsl_esdhc_priv · line 643
Quoted 10 lines
index
1b7de74a72..3347fbe738100644drivers/mmc/fsl_esdhc.c +1
-2@@ -640,8 +640,7 @@ static void set_sysctl(struct fsl_esdhc_priv *priv, struct mmc *mmc, uint clock) for (; pre_div < 256; pre_div *=2 )if ((sdhc_clk / pre_div) <= (clock *16 ))break ; - }else - pre_div =1 ; + }Please examine this code thoroughly and provide patch.
The pre_div should not override the initialization value at the beginning of the function.
Quoted 7 lines
The
} elsepre_div = 1;was added there for a purpose, so I'm wondering why it can be easily removed now.
The else was wrongly added. It is not correct.
Quoted 9 lines
drivers/mmc/fsl_esdhc.c static void set_sysctl(struct fsl_esdhc_priv *priv, struct mmc *mmc, uint clock)
Quoted 5 lines
drivers/mmc/fsl_esdhc.c +0
-0for (div =1 ; div <=16 ; div++)if ((sdhc_clk / (div * pre_div)) <= clock)As I've stated above - is the above
for()correct?In the original code it was div < 16, but here it is div <= 16.
Checking i.MX53 SDHC DVS, it supports [1,16], so should use "<=16", other i.MX has same.
Divisor:
This register is used to provide a more exact divisor to generate the desired SD clock frequency.
NOTE: The divider can even support odd divisor without deterioration of duty cycle. The setting are as following:0x0 Divisor by 10x1 Divisor by 20xe Divisor by 150xf Divisor by 16
Regards,
Peng.
Quoted 109 lines
Quoted 95 lines
Thanks,
Peng.Quoted 90 lines
Quoted 65 lines
Quoted 56 lines
Thanks,
Peng.Quoted 51 lines
Signed-off-by Lukasz Majewski <[email protected]>--- drivers/mmc/fsl_esdhc.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-)drivers/mmc/fsl_esdhc.c +0
-0@@ -621,31 +621,18 @@ static void set_sysctl(struct
fsl_esdhc_priv*priv, struct mmc *mmc, uint clock) #elsedrivers/mmc/fsl_esdhc.c +1
-2int pre_div =2 ;#endif +int ddr_pre_div = mmc->ddr_mode ?2 :1 ;int sdhc_clk = priv->sdhc_clk;uint clk; -/* -* For ddr mode, usdhc need to enable DDR mode first, after select
drivers/mmc/fsl_esdhc.c +0
-1-* this DDR mode, usdhc will automatically divide the usdhc clock
drivers/mmc/fsl_esdhc.c +0
-3-*/ -if (mmc->ddr_mode) { - writel(readl(®s->mixctrl) |
MIX_CTRL_DDREN,®s->mixctrl);drivers/mmc/fsl_esdhc.c +0
-6- sdhc_clk >>=1 ; - } -if (clock < mmc->cfg->f_min) clock = mmc->cfg->f_min; -if (sdhc_clk /16 > clock) { -for (; pre_div <256 ; pre_div *=2 ) - if ((sdhc_clk / pre_div) <= (clock *16))
drivers/mmc/fsl_esdhc.c +1
-3-break ; - }else - pre_div =1 ; + while (sdhc_clk / (16 * pre_div * ddr_pre_div) >clock &&
pre_div< 256)drivers/mmc/fsl_esdhc.c +2
-3+ pre_div *=2 ; -for (div =1 ; div <=16 ; div++) -if ((sdhc_clk / (div * pre_div)) <= clock) -break ; + while (sdhc_clk / (div * pre_div * ddr_pre_div) >clock && div < 16)
drivers/mmc/fsl_esdhc.c +1
-0+ div++;Quoted 5 lines
Quoted 4 lines
drivers/mmc/fsl_esdhc.c +0
-1pre_div >>=1 ; div -=1 ; --2.11.0
Quoted 7 lines
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk
Quoted 3 lines
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.deBest regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.deBest regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de
PATCH 1/1 Revert "mmc: fsl_esdhc: fix sd/mmc ddr mode clock setting issue"
Quoted 142 lines
Subject: RE: [PATCH] Revert "mmc:
fsl_esdhc: fix sd/mmc ddr mode clock setting issue"Quoted 107 lines
Subject: Re: [PATCH] Revert "mmc:
fsl_esdhc: fix sd/mmc ddr mode clock setting issue"Quoted 8 lines · On Wed, 8 May 2019 13:59:14 +0000 Peng Fan <[email protected]> wrote:
Quoted 8 lines
-----Original Message-----
From: Lukasz Majewski [mailto:lukma at denx.de]
Sent: 2019年5月8日 14:38
To: Peng Fan <[email protected]>
Cc: u-boot at lists.denx.de; Tom Rini <[email protected]>; Marcel Ziswiler <[email protected]>; Fabio Estevam <[email protected]>; dl-uboot-imx <[email protected]>; sbabic at denx.de; Stefan Agner <[email protected]>; BOUGHCHEN
Quoted 7 lines
Quoted 7 lines
<[email protected]>; Ye Li <[email protected]>
Subject: Re: [PATCH] Revert "mmc:fsl_esdhc: fix sd/mmc ddr mode clock setting issue"On Wed, 8 May 2019 08:19:45 +0200
Lukasz Majewski <[email protected]> wrote:Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Hi Peng,
Quoted 6 lines
Hi Lukasz,
Quoted 4 lines
Subject: [PATCH] Revert "mmc:
fsl_esdhc: fix sd/mmc ddr mode clock setting issue"This reverts commit
72a89e0da5ac6a4ab929b15a2b656f04f50767f6,Quoted 76 lines
Quoted 67 lines
Quoted 57 lines
Quoted 10 lines
Quoted 10 lines
which causes the imx53 HSC to hang as the eMMC is not working properly anymore.
The exact error message:
MMC write: dev # 0, block # 2, count 927 ... mmc write failed
0 blocks written: ERRORimx53 is not using the DDR mode.
Quoted 8 lines
Quoted 6 lines
Debugging of
pre_divand div generation showed that those values are generated in a way, which is not matching the ones from working setup.As the original patch was performing code refactoring, let's revert this change, so all imx53 boards would work again.
Could you share what is the clock value for your board?
Sure, no problem:
Working setup:
--------------MMC:
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240FSL_SDHC: 0
Loading Environment from MMC...set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 1 div: 1set_sysctl: clk: 272
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 1 div: 0set_sysctl: clk: 256Broken:
-------
MMC:set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240FSL_SDHC: 0
Loading Environment from MMC...set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240Quoted 9 lines
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 0 div: 3set_sysctl: clk: 48
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 0 div: 1set_sysctl: clk: 16(Please also find attached patch to reproduce debug output).
Quoted 6 lines
And maybe the most important question - why it was necessary to refactor this code?
Parts responsible for calculating
pre_divand div seems not related to ddr problem (one spot issue is div <= 16 , but in the original code it was div < 16)?Could you help verify whether the patch fixes you issue?
Quoted 12 lines
drivers/mmc/fsl_esdhc.c static void set_sysctl(struct fsl_esdhc_priv · line 643
Quoted 10 lines
index
1b7de74a72..3347fbe738100644drivers/mmc/fsl_esdhc.c +1
-2@@ -640,8 +640,7 @@ static void set_sysctl(struct fsl_esdhc_priv *priv, struct mmc *mmc, uint clock) for (; pre_div < 256; pre_div *=2 )if ((sdhc_clk / pre_div) <= (clock *16 ))break ; - }else - pre_div =1 ; + }Please examine this code thoroughly and provide patch.
The
pre_divshould not override the initialization value at the beginning of the function.Quoted 7 lines
The
} elsepre_div = 1;was added there for a purpose, so I'm wondering why it can be easily removed now.
The else was wrongly added. It is not correct.
Quoted 6 lines
Quoted 5 lines
drivers/mmc/fsl_esdhc.c +0
-0for (div =1 ; div <=16 ; div++)if ((sdhc_clk / (div * pre_div)) <= clock)
Quoted 6 lines
Quoted 3 lines
As I've stated above - is the above
for()correct?In the original code it was div < 16, but here it is div <= 16.
Checking i.MX53 SDHC DVS, it supports [1,16], so should use "<=16", other i.MX has same.
Should use "<16". Will pick up your revert to avoid regression.
Thanks,
Peng.
Quoted 128 lines
Divisor:
This register is used to provide a more exact divisor to generate the desired SD clock frequency.
NOTE: The divider can even support odd divisor without deterioration of duty cycle.
The setting are as following:0x0Divisor by 10x1Divisor by 20xeDivisor by 150xfDivisor by 16Regards,
Peng.Quoted 71 lines
Quoted 71 lines
Thanks,
Peng.Quoted 66 lines
Quoted 66 lines
Quoted 62 lines
Thanks,
Peng.Quoted 56 lines
Signed-off-by Lukasz Majewski <[email protected]>--- drivers/mmc/fsl_esdhc.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-)(quoted diff) +0
-0
b/drivers/mmc/fsl_esdhc.cindex1b7de74a72..377b2673a3100644drivers/mmc/fsl_esdhc.c +0
-0@@ -621,31 +621,18 @@ static void set_sysctl(struct
fsl_esdhc_priv*priv, struct mmc *mmc, uint clock) #elsedrivers/mmc/fsl_esdhc.c +1
-2int pre_div =2 ;#endif +int ddr_pre_div = mmc->ddr_mode ?2 :1 ;int sdhc_clk = priv->sdhc_clk;uint clk; -/* -* For ddr mode, usdhc need to enable DDR mode first, after select
drivers/mmc/fsl_esdhc.c +0
-1-* this DDR mode, usdhc will automatically divide the usdhc clock
drivers/mmc/fsl_esdhc.c +0
-3-*/ -if (mmc->ddr_mode) { - writel(readl(®s->mixctrl) |
MIX_CTRL_DDREN,®s->mixctrl);drivers/mmc/fsl_esdhc.c +0
-6- sdhc_clk >>=1 ; - } -if (clock < mmc->cfg->f_min) clock = mmc->cfg->f_min; -if (sdhc_clk /16 > clock) { -for (; pre_div <256 ; pre_div *=2 ) - if ((sdhc_clk / pre_div) <= (clock *16))
drivers/mmc/fsl_esdhc.c +1
-3-break ; - }else - pre_div =1 ; + while (sdhc_clk / (16 * pre_div * ddr_pre_div) >clock &&
pre_div< 256)drivers/mmc/fsl_esdhc.c +2
-3+ pre_div *=2 ; -for (div =1 ; div <=16 ; div++) -if ((sdhc_clk / (div * pre_div)) <= clock) -break ; + while (sdhc_clk / (div * pre_div * ddr_pre_div) >clock && div < 16)
drivers/mmc/fsl_esdhc.c +1
-1+ div++; pre_div >>=1 ; div -=1 ; --2.11.0
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director:
Wolfgang
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Denk
Quoted 2 lines
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80
Email:
Quoted 19 lines
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
lukma at denx.de
Best regards,
Quoted 8 lines
Quoted 8 lines
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.deQuoted 7 lines
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk
Quoted 3 lines
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de
PATCH 1/1 Revert "mmc: fsl_esdhc: fix sd/mmc ddr mode clock setting issue"
Hi Lukasz,
Do you expect me to pick this patch, just see this patch was delegated to Stefano?
Regards,
Peng.
Quoted 289 lines
Subject: RE: [PATCH] Revert "mmc:
fsl_esdhc: fix sd/mmc ddr mode clock setting issue"Quoted 143 lines
Subject: RE: [PATCH] Revert "mmc:
fsl_esdhc: fix sd/mmc ddr mode clock setting issue"Quoted 107 lines
Subject: Re: [PATCH] Revert "mmc:
fsl_esdhc: fix sd/mmc ddr mode clock setting issue"Quoted 8 lines · On Wed, 8 May 2019 13:59:14 +0000 Peng Fan <[email protected]> wrote:
Quoted 8 lines
-----Original Message-----
From: Lukasz Majewski [mailto:lukma at denx.de]
Sent: 2019年5月8日 14:38
To: Peng Fan <[email protected]>
Cc: u-boot at lists.denx.de; Tom Rini <[email protected]>; Marcel Ziswiler <[email protected]>; Fabio Estevam <[email protected]>; dl-uboot-imx <[email protected]>; sbabic at denx.de; Stefan Agner <[email protected]>; BOUGHCHEN
Quoted 7 lines
Quoted 7 lines
<[email protected]>; Ye Li <[email protected]>
Subject: Re: [PATCH] Revert "mmc:fsl_esdhc: fix sd/mmc ddr mode clock setting issue"On Wed, 8 May 2019 08:19:45 +0200 Lukasz Majewski
<[email protected]> wrote:Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Hi Peng,
Quoted 6 lines
Hi Lukasz,
Quoted 4 lines
Subject: [PATCH] Revert "mmc:
fsl_esdhc: fix sd/mmc ddr mode clock setting issue"This reverts commit
72a89e0da5ac6a4ab929b15a2b656f04f50767f6,Quoted 76 lines
Quoted 67 lines
Quoted 57 lines
Quoted 10 lines
Quoted 10 lines
which causes the imx53 HSC to hang as the eMMC is not working properly anymore.
The exact error message:
MMC write: dev # 0, block # 2, count 927 ... mmc write failed
0 blocks written: ERRORimx53 is not using the DDR mode.
Quoted 8 lines
Quoted 6 lines
Debugging of
pre_divand div generation showed that those values are generated in a way, which is not matching the ones from working setup.As the original patch was performing code refactoring, let's revert this change, so all imx53 boards would work again.
Could you share what is the clock value for your board?
Sure, no problem:
Working setup:
--------------MMC:
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240FSL_SDHC: 0
Loading Environment from MMC...set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 1 div: 1set_sysctl: clk: 272
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 1 div: 0set_sysctl: clk: 256Broken:
-------
MMC:set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240FSL_SDHC: 0
Loading Environment from MMC...set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240Quoted 9 lines
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 0 div: 3set_sysctl: clk: 48
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 0 div: 1set_sysctl: clk: 16(Please also find attached patch to reproduce debug output).
Quoted 6 lines
And maybe the most important question - why it was necessary to refactor this code?
Parts responsible for calculating
pre_divand div seems not related to ddr problem (one spot issue is div <= 16 , but in the original code it was div < 16)?Could you help verify whether the patch fixes you issue?
Quoted 13 lines
drivers/mmc/fsl_esdhc.c static void set_sysctl(struct fsl_esdhc_priv · line 644
Quoted 11 lines
index
1b7de74a72..3347fbe738100644drivers/mmc/fsl_esdhc.c +1
-2@@ -640,8 +640,7 @@ static void set_sysctl(struct fsl_esdhc_priv *priv, struct mmc *mmc, uint clock) for (; pre_div < 256; pre_div *=2 )if ((sdhc_clk / pre_div) <= (clock *16 ))break ; - }else - pre_div =1 ; + }Please examine this code thoroughly and provide patch.
The
pre_divshould not override the initialization value at the beginning of the function.Quoted 7 lines
The
} elsepre_div = 1;was added there for a purpose, so I'm wondering why it can be easily removed now.
The else was wrongly added. It is not correct.
Quoted 6 lines
Quoted 5 lines
drivers/mmc/fsl_esdhc.c +0
-0for (div =1 ; div <=16 ; div++)if ((sdhc_clk / (div * pre_div)) <= clock)Quoted 6 lines
Quoted 3 lines
As I've stated above - is the above
for()correct?In the original code it was div < 16, but here it is div <= 16.
Checking i.MX53 SDHC DVS, it supports [1,16], so should use "<=16", other i.MX has same.
Should use "<16". Will pick up your revert to avoid regression.
Thanks,
Peng.Quoted 90 lines
Divisor:
This register is used to provide a more exact divisor to generate the desired SD clock frequency.
NOTE: The divider can even support odd divisor without deterioration of duty cycle.
The setting are as following:0x0Divisor by 10x1Divisor by 20xeDivisor by 150xfDivisor by 16Regards,
Peng.Quoted 75 lines
Quoted 75 lines
Thanks,
Peng.Quoted 70 lines
Quoted 70 lines
Quoted 57 lines
Thanks,
Peng.Quoted 52 lines
Signed-off-by Lukasz Majewski <[email protected]>--- drivers/mmc/fsl_esdhc.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-)(quoted diff) +0
-0
b/drivers/mmc/fsl_esdhc.cindex1b7de74a72..377b2673a3100644drivers/mmc/fsl_esdhc.c +0
-0@@ -621,31 +621,18 @@ static void set_sysctl(struct
fsl_esdhc_priv*priv, struct mmc *mmc, uint clock) #elsedrivers/mmc/fsl_esdhc.c +1
-2int pre_div =2 ;#endif +int ddr_pre_div = mmc->ddr_mode ?2 :1 ;int sdhc_clk = priv->sdhc_clk;uint clk; -/* -* For ddr mode, usdhc need to enable DDR mode first, after select
drivers/mmc/fsl_esdhc.c +0
-1-* this DDR mode, usdhc will automatically divide the usdhc clock
drivers/mmc/fsl_esdhc.c +0
-3-*/ -if (mmc->ddr_mode) { - writel(readl(®s->mixctrl) |
MIX_CTRL_DDREN,®s->mixctrl);drivers/mmc/fsl_esdhc.c +0
-6- sdhc_clk >>=1 ; - } -if (clock < mmc->cfg->f_min) clock = mmc->cfg->f_min; -if (sdhc_clk /16 > clock) { -for (; pre_div <256 ; pre_div *=2 ) - if ((sdhc_clk / pre_div) <= (clock *16))
drivers/mmc/fsl_esdhc.c +1
-3-break ; - }else - pre_div =1 ; + while (sdhc_clk / (16 * pre_div * ddr_pre_div) >clock &&
pre_div< 256)drivers/mmc/fsl_esdhc.c +2
-3+ pre_div *=2 ; -for (div =1 ; div <=16 ; div++) -if ((sdhc_clk / (div * pre_div)) <= clock) -break ; + while (sdhc_clk / (div * pre_div * ddr_pre_div) >clock && div < 16)
drivers/mmc/fsl_esdhc.c +1
-0+ div++;Quoted 5 lines
Quoted 4 lines
drivers/mmc/fsl_esdhc.c +0
-1pre_div >>=1 ; div -=1 ; --2.11.0
Best regards,
Lukasz Majewski
Quoted 20 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
--
DENX Software Engineering GmbH, Managing Director:
Wolfgang
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Denk
Quoted 2 lines
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80
Email:
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 1 line
lukma at denx.de
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director:
Wolfgang
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
(+49)-8142-66989-80 Email:
Quoted 17 lines
Quoted 5 lines
Quoted 1 line
Quoted 1 line
lukma at denx.de
Quoted 7 lines
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk
Quoted 4 lines
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de
PATCH 1/1 Revert "mmc: fsl_esdhc: fix sd/mmc ddr mode clock setting issue"
Hi Peng,
Quoted 4 lines
Hi Lukasz,
Do you expect me to pick this patch, just see this patch was delegated to Stefano?
I think that you shall decide with Stefano who would take this patch.
For me there is no difference, I would just like to have it in main line ASAP (depends who prepare PR first).
Quoted 300 lines
Regards,
Peng.Quoted 296 lines
Subject: RE: [PATCH] Revert "mmc:
fsl_esdhc: fix sd/mmc ddr mode clock setting issue"Quoted 146 lines
Subject: RE: [PATCH] Revert "mmc:
fsl_esdhc: fix sd/mmc ddr mode clock setting issue"Quoted 110 lines
Subject: Re: [PATCH] Revert "mmc:
fsl_esdhc: fix sd/mmc ddr mode clock setting issue"Quoted 9 lines · On Wed, 8 May 2019 13:59:14 +0000 Peng Fan <[email protected]> wrote:
Quoted 9 lines
-----Original Message-----
From: Lukasz Majewski [mailto:lukma at denx.de]
Sent: 2019年5月8日 14:38
To: Peng Fan <[email protected]>
Cc: u-boot at lists.denx.de; Tom Rini <[email protected]>; Marcel Ziswiler <[email protected]>; Fabio Estevam <[email protected]>; dl-uboot-imx <[email protected]>; sbabic at denx.de; Stefan Agner <[email protected]>; BOUGHCHEN
Quoted 7 lines
Quoted 7 lines
<[email protected]>; Ye Li <[email protected]>
Subject: Re: [PATCH] Revert "mmc:fsl_esdhc: fix sd/mmc ddr mode clock setting issue"On Wed, 8 May 2019 08:19:45 +0200 Lukasz Majewski <[email protected]> wrote:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Hi Peng,
Quoted 6 lines
Hi Lukasz,
Quoted 4 lines
Subject: [PATCH] Revert "mmc:
fsl_esdhc: fix sd/mmc ddr mode clock setting issue"This reverts commit
72a89e0da5ac6a4ab929b15a2b656f04f50767f6,Quoted 78 lines
Quoted 69 lines
Quoted 62 lines
Quoted 14 lines
Quoted 14 lines
which causes the imx53 HSC to hang as the eMMC is not working properly anymore.
The exact error message:
MMC write: dev # 0, block # 2, count 927 ... mmc write failed
0 blocks written: ERRORimx53 is not using the DDR mode.
Debugging of
pre_divand div generation showed that those values are generated in a way, which is not matching the ones from working setup.Quoted 6 lines
Quoted 3 lines
As the original patch was performing code refactoring, let's revert this change, so all imx53 boards would work again.
Could you share what is the clock value for your
board?Sure, no problem:
Working setup:
--------------MMC:
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240FSL_SDHC: 0
Loading Environment from MMC...set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 1 div: 1set_sysctl: clk: 272
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 1 div: 0set_sysctl: clk: 256Broken:
-------
MMC:set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240FSL_SDHC: 0
Loading Environment from MMC...set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 0 div: 3set_sysctl: clk: 48Quoted 6 lines
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 0 div: 1set_sysctl: clk: 16(Please also find attached patch to reproduce debug output).
Quoted 6 lines
And maybe the most important question - why it was necessary to refactor this code?
Parts responsible for calculating
pre_divand div seems not related to ddr problem (one spot issue is div <= 16 , but in the original code it was div < 16)?Could you help verify whether the patch fixes you issue?
Quoted 13 lines
drivers/mmc/fsl_esdhc.c static void set_sysctl(struct fsl_esdhc_priv *priv, struct mmc *mmc, uint clock) · line 643
Quoted 11 lines
index
1b7de74a72..3347fbe738100644drivers/mmc/fsl_esdhc.c +0
-0@@ -640,8 +640,7 @@ static void set_sysctl(struct fsl_esdhc_priv *priv, struct mmc *mmc, uint clock) for (;
pre_div< 256;pre_div*=
2) if ((sdhc_clk/pre_div) <= (clock * 16))break;drivers/mmc/fsl_esdhc.c +1
-2- }else - pre_div =1 ; + }Please examine this code thoroughly and provide patch.
The
pre_divshould not override the initialization value at the beginning of the function.Quoted 7 lines
The
} elsepre_div = 1;was added there for a purpose, so I'm wondering why it can be easily removed now.
The else was wrongly added. It is not correct.
Quoted 6 lines
Quoted 5 lines
for (div = 1; div <= 16; div++) if ((sdhc_clk / (div * pre_div)) <= clock)Quoted 7 lines
Quoted 4 lines
As I've stated above - is the above
for()correct?In the original code it was div < 16, but here it is div <= 16.
Checking i.MX53 SDHC DVS, it supports [1,16], so should use "<=16", other i.MX has same.
Should use "<16". Will pick up your revert to avoid regression.
Thanks,
Peng.Quoted 93 lines
Divisor:
This register is used to provide a more exact divisor to generate the desired SD clock frequency.
NOTE: The divider can even support odd divisor without deterioration of duty cycle.
The setting are as following:0x0Divisor by 10x1Divisor by 20xeDivisor by 150xfDivisor by 16Regards,
Peng.Quoted 78 lines
Quoted 78 lines
Thanks,
Peng.Quoted 73 lines
Quoted 73 lines
Quoted 58 lines
Thanks,
Peng.Quoted 53 lines
Signed-off-by Lukasz Majewski <[email protected]>--- drivers/mmc/fsl_esdhc.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-)(quoted diff) +0
-0
b/drivers/mmc/fsl_esdhc.cindex1b7de74a72..377b2673a3100644drivers/mmc/fsl_esdhc.c +1
-2@@ -621,31 +621,18 @@ static void set_sysctl(struct fsl_esdhc_priv *priv, struct mmc *mmc, uint clock) #else int pre_div = 2;#endif +int ddr_pre_div = mmc->ddr_mode ?2 :1 ;int sdhc_clk = priv->sdhc_clk;uint clk; -/* -* For ddr mode, usdhc need to enable DDR mode first, after select
drivers/mmc/fsl_esdhc.c +0
-1-* this DDR mode, usdhc will automatically divide the usdhc clock
drivers/mmc/fsl_esdhc.c +0
-3-*/ -if (mmc->ddr_mode) { - writel(readl(®s->mixctrl) |
MIX_CTRL_DDREN,®s->mixctrl);drivers/mmc/fsl_esdhc.c +0
-6- sdhc_clk >>=1 ; - } -if (clock < mmc->cfg->f_min) clock = mmc->cfg->f_min; -if (sdhc_clk /16 > clock) { -for (; pre_div <256 ; pre_div *=2 ) - if ((sdhc_clk / pre_div) <=(clock * 16))
drivers/mmc/fsl_esdhc.c +1
-3-break ; - }else - pre_div =1 ; + while (sdhc_clk / (16 * pre_div *
ddr_pre_div) > clock &&pre_div< 256)drivers/mmc/fsl_esdhc.c +1
-2+ pre_div *=2 ; -for (div =1 ; div <=16 ; div++) - if ((sdhc_clk / (div * pre_div)) <=clock)
drivers/mmc/fsl_esdhc.c +1
-1-break ; + while (sdhc_clk / (div * pre_div *
ddr_pre_div) > clock && div < 16)drivers/mmc/fsl_esdhc.c +1
-0+ div++;Quoted 5 lines
Quoted 4 lines
drivers/mmc/fsl_esdhc.c +0
-1pre_div >>=1 ; div -=1 ; --2.11.0
Best regards,
Lukasz Majewski
--
Quoted 19 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
DENX Software Engineering GmbH, Managing Director:
Wolfgang
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Denk
Quoted 3 lines
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
(+49)-8142-66989-80Email:
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 1 line
lukma at denx.de
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director:
Wolfgang
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
(+49)-8142-66989-80 Email:
Quoted 18 lines
Quoted 5 lines
Quoted 1 line
Quoted 1 line
lukma at denx.de
Quoted 8 lines
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director:
WolfgangDenk
Quoted 4 lines
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190520/a7eed713/attachment-0001.sig>
PATCH 1/1 Revert "mmc: fsl_esdhc: fix sd/mmc ddr mode clock setting issue"
Hi Lukasz,
Quoted 7 lines
Subject: Re: [PATCH] Revert "mmc:
fsl_esdhc: fix sd/mmc ddr mode clock setting issue"Hi Peng,
Quoted 2 lines
Hi Lukasz,
Quoted 7 lines
Quoted 2 lines
Do you expect me to pick this patch, just see this patch was delegated to Stefano?
I think that you shall decide with Stefano who would take this patch.
For me there is no difference, I would just like to have it in main line ASAP (depends who prepare PR first).
ok. I'll send a PR to Tom today after CI done. I was waiting IT to fix my ssh push issue, so delayed. I still have to use my github to PR (:
Regards,
Peng.
Quoted 312 lines
Quoted 298 lines
Regards,
Peng.Quoted 293 lines
Subject: RE: [PATCH] Revert "mmc:
fsl_esdhc: fix sd/mmc ddr mode clock setting issue"Quoted 145 lines
Subject: RE: [PATCH] Revert "mmc:
fsl_esdhc: fix sd/mmc ddr mode clock setting issue"Quoted 109 lines
Subject: Re: [PATCH] Revert "mmc:
fsl_esdhc: fix sd/mmc ddr mode clock setting issue"Quoted 9 lines · On Wed, 8 May 2019 13:59:14 +0000 Peng Fan <[email protected]> wrote:
Quoted 9 lines
-----Original Message-----
From: Lukasz Majewski [mailto:lukma at denx.de]
Sent: 2019年5月8日 14:38
To: Peng Fan <[email protected]>
Cc: u-boot at lists.denx.de; Tom Rini <[email protected]>; Marcel Ziswiler <[email protected]>; Fabio Estevam <[email protected]>; dl-uboot-imx <[email protected]>; sbabic at denx.de; Stefan Agner <[email protected]>; BOUGHCHEN
Quoted 7 lines
Quoted 7 lines
<[email protected]>; Ye Li <[email protected]>
Subject: Re: [PATCH] Revert "mmc:fsl_esdhc: fix sd/mmc ddr mode clock setting issue"On Wed, 8 May 2019 08:19:45 +0200 Lukasz Majewski <[email protected]> wrote:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Hi Peng,
Quoted 6 lines
Hi Lukasz,
Quoted 4 lines
Subject: [PATCH] Revert "mmc:
fsl_esdhc: fix sd/mmc ddr mode clock setting issue"This reverts commit
72a89e0da5ac6a4ab929b15a2b656f04f50767f6,Quoted 77 lines
Quoted 68 lines
Quoted 61 lines
Quoted 14 lines
Quoted 14 lines
which causes the imx53 HSC to hang as the eMMC is not working properly anymore.
The exact error message:
MMC write: dev # 0, block # 2, count 927 ... mmc write failed
0 blocks written: ERRORimx53 is not using the DDR mode.
Debugging of
pre_divand div generation showed that those values are generated in a way, which is not matching the ones from working setup.Quoted 5 lines
Quoted 3 lines
As the original patch was performing code refactoring, let's revert this change, so all imx53 boards would work again.
Could you share what is the clock value for your board?
Sure, no problem:
Working setup:
--------------MMC:
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240FSL_SDHC: 0
Loading Environment from MMC...set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 1 div: 1set_sysctl: clk: 272
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 1 div: 0set_sysctl: clk: 256Broken:
-------
MMC:set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240FSL_SDHC: 0
Loading Environment from MMC...set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 0 div: 3set_sysctl: clk: 48Quoted 6 lines
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 0 div: 1set_sysctl: clk: 16(Please also find attached patch to reproduce debug output).
Quoted 6 lines
And maybe the most important question - why it was necessary to refactor this code?
Parts responsible for calculating
pre_divand div seems not related to ddr problem (one spot issue is div <= 16 , but in the original code it was div < 16)?Could you help verify whether the patch fixes you issue?
Quoted 13 lines
drivers/mmc/fsl_esdhc.c static void set_sysctl(struct fsl_esdhc_priv *priv, struct mmc *mmc, uint clock) · line 643
Quoted 11 lines
index
1b7de74a72..3347fbe738100644drivers/mmc/fsl_esdhc.c +0
-0@@ -640,8 +640,7 @@ static void set_sysctl(struct fsl_esdhc_priv *priv, struct mmc *mmc, uint clock) for (;
pre_div< 256;pre_div*=
2) if ((sdhc_clk/pre_div) <= (clock * 16))break;drivers/mmc/fsl_esdhc.c +1
-2- }else - pre_div =1 ; + }Please examine this code thoroughly and provide patch.
The
pre_divshould not override the initialization value at the beginning of the function.Quoted 7 lines
The
} elsepre_div = 1;was added there for a purpose, so I'm wondering why it can be easily removed now.
The else was wrongly added. It is not correct.
Quoted 6 lines
Quoted 5 lines
for (div = 1; div <= 16; div++) if ((sdhc_clk / (div * pre_div)) <= clock)Quoted 6 lines
Quoted 3 lines
As I've stated above - is the above
for()correct?In the original code it was div < 16, but here it is div <= 16.
Checking i.MX53 SDHC DVS, it supports [1,16], so should use "<=16", other i.MX has same.
Should use "<16". Will pick up your revert to avoid regression.
Thanks,
Peng.Quoted 92 lines
Divisor:
This register is used to provide a more exact divisor to generate the desired SD clock frequency.
NOTE: The divider can even support odd divisor without deterioration of duty cycle.
The setting are as following:0x0Divisor by 10x1Divisor by 20xeDivisor by 150xfDivisor by 16Regards,
Peng.Quoted 77 lines
Quoted 77 lines
Thanks,
Peng.Quoted 72 lines
Quoted 72 lines
Quoted 57 lines
Thanks,
Peng.Quoted 52 lines
Signed-off-by Lukasz Majewski <[email protected]>--- drivers/mmc/fsl_esdhc.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-)(quoted diff) +0
-0
b/drivers/mmc/fsl_esdhc.cindex1b7de74a72..377b2673a3100644drivers/mmc/fsl_esdhc.c +1
-2@@ -621,31 +621,18 @@ static void set_sysctl(struct fsl_esdhc_priv *priv, struct mmc *mmc, uint clock) #else int pre_div = 2; #endif +int ddr_pre_div = mmc->ddr_mode ?2 :1 ;int sdhc_clk = priv->sdhc_clk;uint clk; -/* -* For ddr mode, usdhc need to enable DDR mode first, after select
drivers/mmc/fsl_esdhc.c +0
-1-* this DDR mode, usdhc will automatically divide the usdhc clock
drivers/mmc/fsl_esdhc.c +0
-3-*/ -if (mmc->ddr_mode) { - writel(readl(®s->mixctrl) |
MIX_CTRL_DDREN,®s->mixctrl);drivers/mmc/fsl_esdhc.c +0
-6- sdhc_clk >>=1 ; - } -if (clock < mmc->cfg->f_min) clock = mmc->cfg->f_min; -if (sdhc_clk /16 > clock) { -for (; pre_div <256 ; pre_div *=2 ) - if ((sdhc_clk / pre_div) <=(clock * 16))
drivers/mmc/fsl_esdhc.c +1
-3-break ; - }else - pre_div =1 ; + while (sdhc_clk / (16 * pre_div *
ddr_pre_div) > clock &&pre_div< 256)drivers/mmc/fsl_esdhc.c +1
-2+ pre_div *=2 ; -for (div =1 ; div <=16 ; div++) - if ((sdhc_clk / (div * pre_div)) <=clock)
drivers/mmc/fsl_esdhc.c +1
-1-break ; + while (sdhc_clk / (div * pre_div *
ddr_pre_div) > clock && div < 16)drivers/mmc/fsl_esdhc.c +1
-0+ div++;Quoted 5 lines
Quoted 4 lines
drivers/mmc/fsl_esdhc.c +0
-1pre_div >>=1 ; div -=1 ; --2.11.0
Best regards,
Lukasz Majewski
--
Quoted 19 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
DENX Software Engineering GmbH, Managing Director:
Wolfgang
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Denk
Quoted 3 lines
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
(+49)-8142-66989-80Email:
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 1 line
lukma at denx.de
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director:
Wolfgang
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
(+49)-8142-66989-80 Email:
Quoted 18 lines
Quoted 5 lines
Quoted 1 line
Quoted 1 line
lukma at denx.de
Quoted 8 lines
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director:
WolfgangDenk
Quoted 4 lines
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.deBest regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de
PATCH 1/1 Revert "mmc: fsl_esdhc: fix sd/mmc ddr mode clock setting issue"
Hi Peng,
Quoted 12 lines
Hi Lukasz,
Quoted 10 lines
Subject: Re: [PATCH] Revert "mmc:
fsl_esdhc: fix sd/mmc ddr mode clock setting issue"Hi Peng,
Quoted 4 lines
Hi Lukasz,
Do you expect me to pick this patch, just see this patch was delegated to Stefano?
Quoted 7 lines
Quoted 5 lines
I think that you shall decide with Stefano who would take this patch.
For me there is no difference, I would just like to have it in main line ASAP (depends who prepare PR first).
ok. I'll send a PR to Tom today after CI done.
Great. Thanks.
Quoted 3 lines
I was waiting IT to
fix my ssh push issue, so delayed. I still have to use my github to PR (:
I do know this topic well ... (Large companies have very strict rules regarding perceiving firewalls).
Quoted 323 lines
Regards,
Peng.Quoted 319 lines
Quoted 305 lines
Regards,
Peng.Quoted 300 lines
Subject: RE: [PATCH] Revert "mmc:
fsl_esdhc: fix sd/mmc ddr mode clock setting issue"Quoted 146 lines
Subject: RE: [PATCH] Revert "mmc:
fsl_esdhc: fix sd/mmc ddr mode clock setting issue"Quoted 110 lines
Subject: Re: [PATCH] Revert "mmc:
fsl_esdhc: fix sd/mmc ddr mode clock setting issue"Quoted 9 lines · On Wed, 8 May 2019 13:59:14 +0000 Peng Fan <[email protected]> wrote:
Quoted 9 lines
-----Original Message-----
From: Lukasz Majewski [mailto:lukma at denx.de]
Sent: 2019年5月8日 14:38
To: Peng Fan <[email protected]>
Cc: u-boot at lists.denx.de; Tom Rini <[email protected]>; Marcel Ziswiler <[email protected]>; Fabio Estevam <[email protected]>; dl-uboot-imx <[email protected]>; sbabic at denx.de; Stefan Agner <[email protected]>; BOUGHCHEN
Quoted 7 lines
Quoted 7 lines
<[email protected]>; Ye Li <[email protected]>
Subject: Re: [PATCH] Revert "mmc:fsl_esdhc: fix sd/mmc ddr mode clock setting issue"On Wed, 8 May 2019 08:19:45 +0200 Lukasz Majewski <[email protected]> wrote:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Hi Peng,
Quoted 6 lines
Hi Lukasz,
Quoted 4 lines
Subject: [PATCH] Revert "mmc:
fsl_esdhc: fix sd/mmc ddr mode clock setting issue"This reverts commit
72a89e0da5ac6a4ab929b15a2b656f04f50767f6,Quoted 78 lines
Quoted 69 lines
Quoted 62 lines
Quoted 14 lines
Quoted 14 lines
which causes the imx53 HSC to hang as the eMMC is not working properly anymore.
The exact error message:
MMC write: dev # 0, block # 2, count 927 ... mmc write failed
0 blocks written: ERRORimx53 is not using the DDR mode.
Debugging of
pre_divand div generation showed that those values are generated in a way, which is not matching the ones from working setup.Quoted 6 lines
Quoted 3 lines
As the original patch was performing code refactoring, let's revert this change, so all imx53 boards would work again.
Could you share what is the clock value for your
board?Sure, no problem:
Working setup:
--------------MMC:
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240FSL_SDHC: 0
Loading Environment from MMC...set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 1 div: 1set_sysctl: clk: 272
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 1 div: 0set_sysctl: clk: 256Broken:
-------
MMC:set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240FSL_SDHC: 0
Loading Environment from MMC...set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 8 div: 12set_sysctl: clk: 2240
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 0 div: 3set_sysctl: clk: 48Quoted 6 lines
set_sysctl:pre_div= 2mmc->ddr: 0sdhc_clk: 80000000
pre_div: 0 div: 1set_sysctl: clk: 16(Please also find attached patch to reproduce debug output).
Quoted 6 lines
And maybe the most important question - why it was necessary to refactor this code?
Parts responsible for calculating
pre_divand div seems not related to ddr problem (one spot issue is div <= 16 , but in the original code it was div < 16)?Could you help verify whether the patch fixes you issue?
Quoted 13 lines
drivers/mmc/fsl_esdhc.c
Quoted 11 lines
index
1b7de74a72..3347fbe738100644drivers/mmc/fsl_esdhc.c +0
-0@@ -640,8 +640,7 @@ static void set_sysctl(struct fsl_esdhc_priv *priv, struct mmc *mmc, uint clock) for (;
pre_div< 256;pre_div*=
2) if ((sdhc_clk/pre_div) <= (clock * 16))break;drivers/mmc/fsl_esdhc.c +1
-2- }else - pre_div =1 ; + }Please examine this code thoroughly and provide patch.
The
pre_divshould not override the initialization value at the beginning of the function.Quoted 7 lines
The
} elsepre_div = 1;was added there for a purpose, so I'm wondering why it can be easily removed now.
The else was wrongly added. It is not correct.
Quoted 6 lines
Quoted 5 lines
for (div = 1; div <= 16; div++) if ((sdhc_clk / (div * pre_div)) <= clock)Quoted 7 lines
Quoted 4 lines
As I've stated above - is the above
for()correct?In the original code it was div < 16, but here it is div <= 16.
Checking i.MX53 SDHC DVS, it supports [1,16], so should use "<=16", other i.MX has same.
Should use "<16". Will pick up your revert to avoid regression.
Thanks,
Peng.Quoted 95 lines
Divisor:
This register is used to provide a more exact divisor to generate the desired SD clock frequency.
NOTE: The divider can even support odd divisor without deterioration of duty cycle.
The setting are as following:0x0Divisor by 10x1Divisor by 20xeDivisor by 150xfDivisor by 16Regards,
Peng.Quoted 80 lines
Quoted 80 lines
Thanks,
Peng.Quoted 75 lines
Quoted 75 lines
Quoted 60 lines
Thanks,
Peng.Quoted 55 lines
Signed-off-by Lukasz Majewski <[email protected]>--- drivers/mmc/fsl_esdhc.c | 23+++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-)
(quoted diff) +0
-0
b/drivers/mmc/fsl_esdhc.cindex1b7de74a72..377b2673a3100644drivers/mmc/fsl_esdhc.c +0
-0@@ -621,31 +621,18 @@ static void
set_sysctl(struct fsl_esdhc_priv *priv, struct mmc *mmc, uint clock)#else intpre_div= 2; #endifdrivers/mmc/fsl_esdhc.c +1
-2+int ddr_pre_div = mmc->ddr_mode ?2 :1 ;int sdhc_clk = priv->sdhc_clk;uint clk; -/* -* For ddr mode, usdhc need to enable DDR mode first, after select
drivers/mmc/fsl_esdhc.c +0
-1-* this DDR mode, usdhc will automatically divide the usdhc clock
drivers/mmc/fsl_esdhc.c +0
-3-*/ -if (mmc->ddr_mode) { - writel(readl(®s->mixctrl) |
MIX_CTRL_DDREN,®s->mixctrl);drivers/mmc/fsl_esdhc.c +0
-5- sdhc_clk >>=1 ; - } -if (clock < mmc->cfg->f_min) clock = mmc->cfg->f_min; - if (sdhc_clk / 16 > clock) { - for (; pre_div < 256; pre_div *=2)
drivers/mmc/fsl_esdhc.c +0
-1- if ((sdhc_clk / pre_div)<= (clock * 16))
drivers/mmc/fsl_esdhc.c +1
-3-break ; - }else - pre_div =1 ; + while (sdhc_clk / (16 * pre_div *
ddr_pre_div) > clock &&pre_div< 256)drivers/mmc/fsl_esdhc.c +1
-2+ pre_div *=2 ; -for (div =1 ; div <=16 ; div++) - if ((sdhc_clk / (div * pre_div))<= clock)
drivers/mmc/fsl_esdhc.c +1
-1-break ; + while (sdhc_clk / (div * pre_div *
ddr_pre_div) > clock && div < 16)drivers/mmc/fsl_esdhc.c +1
-0+ div++;Quoted 5 lines
Quoted 4 lines
drivers/mmc/fsl_esdhc.c +0
-1pre_div >>=1 ; div -=1 ; --2.11.0
Best regards,
Lukasz Majewski
--
Quoted 21 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
DENX Software Engineering GmbH, Managing
Director:Wolfgang
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Denk
Quoted 3 lines
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
(+49)-8142-66989-80Email:
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 1 line
lukma at denx.de
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing
Director:Wolfgang
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
(+49)-8142-66989-80 Email:
Quoted 18 lines
Quoted 5 lines
Quoted 1 line
Quoted 1 line
lukma at denx.de
Quoted 8 lines
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director:
WolfgangDenk
Quoted 4 lines
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.deBest regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190520/7de80f41/attachment.sig>