Skip to contentSkip to conversation

arm: imx: imx8mm: correct unrecognized fracpll frequency

PATCH New Andrey Zhizhikin 3 participants 7 messages May 1, 2021 – Jun 9, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm: imx: imx8mm: correct unrecognized fracpll frequency

Frequency requested by ddrphy_init_set_dfi_clk from fracpll uses MHZ() macro, which expands the value provided to the Hz range without taking into account the precise Hz setting. This causes the frequency of 266 MHz not ot be found in the imx8mm_fracpll_tbl, since it is entered there with a precise Hz value. This in turn causes the boot hang in SPL, as proper DDR fracpll frequency cannot be determined.

Correct the value in imx8mm_fracpll_tbl to match the one expanded by MHZ(266) macro, rounding it down to MHz range only.

Cc Stefano Babic <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc "NXP i.MX U-Boot Team" <[email protected]>
Cc Peng Fan <[email protected]>
Cc Simon Glass <[email protected]>
Fixes 825ab6b406 ("driver: ddr: Refine the ddr init driver on imx8m")
---
 arch/arm/mach-imx/imx8m/clock_imx8mm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/mach-imx/imx8m/clock_imx8mm.c +3 -3
index 029d06f27f..86ff2b9cc9 100644
@@ -54,7 +54,7 @@ static struct imx_int_pll_rate_table imx8mm_fracpll_tbl[] = {
 	PLL_1443X_RATE(600000000U, 300, 3, 2, 0),
 	PLL_1443X_RATE(594000000U, 99, 1, 2, 0),
 	PLL_1443X_RATE(400000000U, 300, 9, 1, 0),
-	PLL_1443X_RATE(266666667U, 400, 9, 2, 0),
+	PLL_1443X_RATE(266000000U, 400, 9, 2, 0),
 	PLL_1443X_RATE(167000000U, 334, 3, 4, 0),
 	PLL_1443X_RATE(100000000U, 300, 9, 3, 0),
 };
@@ -72,7 +72,7 @@ static int fracpll_configure(enum pll_clocks pll, u32 freq)
 	}
 
 	if (i == ARRAY_SIZE(imx8mm_fracpll_tbl)) {
-		printf("No matched freq table %u\n", freq);
+		printf("%s: No matched freq table %u\n", __func__, freq);
 		return -EINVAL;
 	}
 
@@ -148,7 +148,7 @@ void dram_enable_bypass(ulong clk_val)
 	}
 
 	if (i == ARRAY_SIZE(imx8mm_dram_bypass_tbl)) {
-		printf("No matched freq table %lu\n", clk_val);
+		printf("%s: No matched freq table %lu\n", __func__, clk_val);
 		return;
 	}
 
Signature · 1 line
2.25.1
reviewer
#1 lore raw

PATCH 1/1 arm: imx: imx8mm: correct unrecognized fracpll frequency

Quoted 11 lines · Andrey Zhizhikin

Frequency requested by ddrphy_init_set_dfi_clk from fracpll uses MHZ() macro, which expands the value provided to the Hz range without taking into account the precise Hz setting. This causes the frequency of 266 MHz not ot be found in the imx8mm_fracpll_tbl, since it is entered there with a precise Hz value. This in turn causes the boot hang in SPL, as proper DDR fracpll frequency cannot be determined.

Correct the value in imx8mm_fracpll_tbl to match the one expanded by MHZ(266) macro, rounding it down to MHz range only.

Quoted 8 lines
Cc Stefano Babic <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc "NXP i.MX U-Boot Team" <[email protected]>
Cc Peng Fan <[email protected]>
Cc Simon Glass <[email protected]>
Fixes 825ab6b406 ("driver: ddr: Refine the ddr init driver on imx8m")
reviewer
#2 lore raw

PATCH 1/1 arm: imx: imx8mm: correct unrecognized fracpll frequency

In reply to Andrey Zhizhikin

Hi Andrey,

After re-reading the patch I have some comments:

Quoted 28 lines · Andrey Zhizhikin

Frequency requested by ddrphy_init_set_dfi_clk from fracpll uses MHZ() macro, which expands the value provided to the Hz range without taking into account the precise Hz setting. This causes the frequency of 266 MHz not ot be found in the imx8mm_fracpll_tbl, since it is entered there with a precise Hz value. This in turn causes the boot hang in SPL, as proper DDR fracpll frequency cannot be determined.

Correct the value in imx8mm_fracpll_tbl to match the one expanded by MHZ(266) macro, rounding it down to MHz range only.

Cc Stefano Babic <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc "NXP i.MX U-Boot Team" <[email protected]>
Cc Peng Fan <[email protected]>
Cc Simon Glass <[email protected]>
Fixes 825ab6b406 ("driver: ddr: Refine the ddr init driver on imx8m")
---
 arch/arm/mach-imx/imx8m/clock_imx8mm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/mach-imx/imx8m/clock_imx8mm.c +0 -0
index 029d06f27f..86ff2b9cc9 100644

arch/arm/mach-imx/imx8m/clock_imx8mm.c static struct imx_int_pll_rate_table imx8mm_fracpll_tbl[] = { · line 57

Quoted 5 lines
arch/arm/mach-imx/imx8m/clock_imx8mm.c +1 -1
@@ -54,7 +54,7 @@ static struct imx_int_pll_rate_table imx8mm_fracpll_tbl[] = {
        PLL_1443X_RATE(600000000U, 300, 3, 2, 0),
        PLL_1443X_RATE(594000000U, 99, 1, 2, 0),
        PLL_1443X_RATE(400000000U, 300, 9, 1, 0),
-       PLL_1443X_RATE(266666667U, 400, 9, 2, 0),
+       PLL_1443X_RATE(266000000U, 400, 9, 2, 0),

This change looks good.

Quoted 13 lines
arch/arm/mach-imx/imx8m/clock_imx8mm.c +1 -1
        PLL_1443X_RATE(167000000U, 334, 3, 4, 0),
        PLL_1443X_RATE(100000000U, 300, 9, 3, 0),
 };
@@ -72,7 +72,7 @@ static int fracpll_configure(enum pll_clocks pll, u32 freq)
        }
 
        if (i == ARRAY_SIZE(imx8mm_fracpll_tbl)) {
-               printf("No matched freq table %u\n", freq);
+               printf("%s: No matched freq table %u\n", __func__, freq);
                return -EINVAL;
        }
 

arch/arm/mach-imx/imx8m/clock_imx8mm.c void dram_enable_bypass(ulong clk_val) · line 151

Quoted 5 lines
arch/arm/mach-imx/imx8m/clock_imx8mm.c +1 -1
@@ -148,7 +148,7 @@ void dram_enable_bypass(ulong clk_val)
        }
 
        if (i == ARRAY_SIZE(imx8mm_dram_bypass_tbl)) {
-               printf("No matched freq table %lu\n", clk_val);
+               printf("%s: No matched freq table %lu\n", __func__, clk_val);

, but these two I would put them on a separate patch.

Thanks

#3 lore raw

PATCH 1/1 arm: imx: imx8mm: correct unrecognized fracpll frequency

Hello Fabio,

Quoted 70 lines

-----Original Message-----
From: Fabio Estevam <[email protected]>
Sent: Sunday, May 2, 2021 11:45 PM
To: ZHIZHIKIN Andrey <[email protected]>
Cc: U-Boot-Denx <[email protected]>; Stefano Babic <[email protected]>; NXP i.MX U-Boot Team <[email protected]>; Peng Fan <[email protected]>; Simon Glass <[email protected]>; Ye Li <[email protected]>
Subject: Re: [PATCH] arm: imx: imx8mm: correct unrecognized fracpll frequency

Hi Andrey,

After re-reading the patch I have some comments:

arch/arm/mach-imx/imx8m/clock_imx8mm.c static struct imx_int_pll_rate_table imx8mm_fracpll_tbl[]

Quoted 30 lines · Andrey Zhizhikin

Frequency requested by ddrphy_init_set_dfi_clk from fracpll uses MHZ() macro, which expands the value provided to the Hz range without taking into account the precise Hz setting. This causes the frequency of 266 MHz not ot be found in the imx8mm_fracpll_tbl, since it is entered there with a precise Hz value. This in turn causes the boot hang in SPL, as proper DDR fracpll frequency cannot be determined.

Correct the value in imx8mm_fracpll_tbl to match the one expanded by MHZ(266) macro, rounding it down to MHz range only.

Signed-off-by: Andrey Zhizhikin
<[email protected]>

Cc Stefano Babic <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc "NXP i.MX U-Boot Team" <[email protected]>
Cc Peng Fan <[email protected]>
Cc Simon Glass <[email protected]>
Fixes 825ab6b406 ("driver: ddr: Refine the ddr init driver on imx8m")
---
 arch/arm/mach-imx/imx8m/clock_imx8mm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/mach-imx/imx8m/clock_imx8mm.c +0 -0
index 029d06f27f..86ff2b9cc9 100644
@@ -54,7 +54,7 @@ static struct imx_int_pll_rate_table imx8mm_fracpll_tbl[]

= {

arch/arm/mach-imx/imx8m/clock_imx8mm.c static struct imx_int_pll_rate_table imx8mm_fracpll_tbl[] = { · line 57

Quoted 5 lines
arch/arm/mach-imx/imx8m/clock_imx8mm.c +1 -1
        PLL_1443X_RATE(600000000U, 300, 3, 2, 0),
        PLL_1443X_RATE(594000000U, 99, 1, 2, 0),
        PLL_1443X_RATE(400000000U, 300, 9, 1, 0),
-       PLL_1443X_RATE(266666667U, 400, 9, 2, 0),
+       PLL_1443X_RATE(266000000U, 400, 9, 2, 0),

This change looks good.

Quoted 15 lines
arch/arm/mach-imx/imx8m/clock_imx8mm.c +0 -0
        PLL_1443X_RATE(167000000U, 334, 3, 4, 0),
        PLL_1443X_RATE(100000000U, 300, 9, 3, 0),  }; @@ -72,7 +72,7
 @@ static int fracpll_configure(enum pll_clocks pll, u32 freq)
        }

        if (i == ARRAY_SIZE(imx8mm_fracpll_tbl)) {
arch/arm/mach-imx/imx8m/clock_imx8mm.c +2 -1
-               printf("No matched freq table %u\n", freq);
+               printf("%s: No matched freq table %u\n", __func__,
+ freq);
                return -EINVAL;
        }
@@ -148,7 +148,7 @@ void dram_enable_bypass(ulong clk_val)
        }
 
Quoted 6 lines

arch/arm/mach-imx/imx8m/clock_imx8mm.c void dram_enable_bypass(ulong clk_val)

Quoted 4 lines
arch/arm/mach-imx/imx8m/clock_imx8mm.c +2 -1
        if (i == ARRAY_SIZE(imx8mm_dram_bypass_tbl)) {
-               printf("No matched freq table %lu\n", clk_val);
+               printf("%s: No matched freq table %lu\n", __func__,
+ clk_val);

, but these two I would put them on a separate patch.

Fair enough, thanks for pointing this out!

Even though this helped me originally to pinpoint the issue, looking at this change now I see it does indeed belong to the separate patch as it does not relate to the PLL fix per se.

I would split this into a separate patch, send it separate, and send a V2 for the PLL fix.

Quoted 2 lines

Thanks

Cheers,
Andrey

#4 lore raw

PATCH v2 1/1 arm: imx: imx8mm: correct unrecognized fracpll frequency

In reply to Andrey Zhizhikin

Frequency requested by ddrphy_init_set_dfi_clk from fracpll uses MHZ() macro, which expands the value provided to the Hz range without taking into account the precise Hz setting. This causes the frequency of 266 MHz not ot be found in the imx8mm_fracpll_tbl, since it is entered there with a precise Hz value. This in turn causes the boot hang in SPL, as proper DDR fracpll frequency cannot be determined.

Correct the value in imx8mm_fracpll_tbl to match the one expanded by MHZ(266) macro, rounding it down to MHz range only.

Cc Stefano Babic <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc "NXP i.MX U-Boot Team" <[email protected]>
Cc Peng Fan <[email protected]>
Cc Simon Glass <[email protected]>
Fixes 825ab6b406 ("driver: ddr: Refine the ddr init driver on imx8m")

---

Changes in v2:
- Remove debug message clarifications, they are addressed in a separate patch

 arch/arm/mach-imx/imx8m/clock_imx8mm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-imx/imx8m/clock_imx8mm.c +1 -1
index 029d06f27f..7d0f564a24 100644
@@ -54,7 +54,7 @@ static struct imx_int_pll_rate_table imx8mm_fracpll_tbl[] = {
 	PLL_1443X_RATE(600000000U, 300, 3, 2, 0),
 	PLL_1443X_RATE(594000000U, 99, 1, 2, 0),
 	PLL_1443X_RATE(400000000U, 300, 9, 1, 0),
-	PLL_1443X_RATE(266666667U, 400, 9, 2, 0),
+	PLL_1443X_RATE(266000000U, 400, 9, 2, 0),
 	PLL_1443X_RATE(167000000U, 334, 3, 4, 0),
 	PLL_1443X_RATE(100000000U, 300, 9, 3, 0),
 };
Signature · 1 line
2.25.1
reviewer
#5 lore raw

PATCH v2 1/1 arm: imx: imx8mm: correct unrecognized fracpll frequency

Quoted 11 lines · Andrey Zhizhikin

Frequency requested by ddrphy_init_set_dfi_clk from fracpll uses MHZ() macro, which expands the value provided to the Hz range without taking into account the precise Hz setting. This causes the frequency of 266 MHz not ot be found in the imx8mm_fracpll_tbl, since it is entered there with a precise Hz value. This in turn causes the boot hang in SPL, as proper DDR fracpll frequency cannot be determined.

Correct the value in imx8mm_fracpll_tbl to match the one expanded by MHZ(266) macro, rounding it down to MHz range only.

Quoted 8 lines
Cc Stefano Babic <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc "NXP i.MX U-Boot Team" <[email protected]>
Cc Peng Fan <[email protected]>
Cc Simon Glass <[email protected]>
Fixes 825ab6b406 ("driver: ddr: Refine the ddr init driver on imx8m")
#6 lore raw

PATCH v2 1/1 arm: imx: imx8mm: correct unrecognized fracpll frequency

In reply to Andrey Zhizhikin
Quoted 8 lines

Frequency requested by ddrphy_init_set_dfi_clk from fracpll uses MHZ() macro, which expands the value provided to the Hz range without taking into account the precise Hz setting. This causes the frequency of 266 MHz not ot be found in the imx8mm_fracpll_tbl, since it is entered there with a precise Hz value. This in turn causes the boot hang in SPL, as proper DDR fracpll frequency cannot be determined.
Correct the value in imx8mm_fracpll_tbl to match the one expanded by MHZ(266) macro, rounding it down to MHz range only.

Quoted 9 lines
Cc Stefano Babic <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc "NXP i.MX U-Boot Team" <[email protected]>
Cc Peng Fan <[email protected]>
Cc Simon Glass <[email protected]>
Fixes 825ab6b406 ("driver: ddr: Refine the ddr init driver on imx8m")

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================