Re: [U-Boot] [PATCH 1/1] sunxi: Fix pll1 clock calculation
On Fri, Sep 6, 2019 at 11:51 PM Jagan Teki wrote: > > On Wed, Jul 31, 2019 at 6:46 PM Stefan Mavrodiev wrote: > > > > clock_sun6i.c is used for sun6i, sun8i and sun50i SoC families. > > PLL1 clock sets the default system clock, defined as: > > sun6i: 100800 > > sun8i: 100800 > > sun50i: 81600 > > > > With the current calculation, m = 2 and k = 3. Solving for n, > > this results 28. Solving back: > > (24MHz * 28 * 3) / 2 = 1008MHz > > > > However if the requested clock is 816, n is 22.66 rounded > > to 22, which results: > > (24MHz * 28 * 3) / 2 = 792MHz > > > > Changing k to 4 satisfies both system clocks: > > (24E6 * 21 * 4) / 2 = 1008MHz > > (24E6 * 17 * 4) / 2 = 816MHz > > > > Signed-off-by: Stefan Mavrodiev > > --- > > Acked-by: Jagan Teki Applied to u-boot-sunxi/master ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 1/1] sunxi: Fix pll1 clock calculation
On Wed, Jul 31, 2019 at 6:46 PM Stefan Mavrodiev wrote: > > clock_sun6i.c is used for sun6i, sun8i and sun50i SoC families. > PLL1 clock sets the default system clock, defined as: > sun6i: 100800 > sun8i: 100800 > sun50i: 81600 > > With the current calculation, m = 2 and k = 3. Solving for n, > this results 28. Solving back: > (24MHz * 28 * 3) / 2 = 1008MHz > > However if the requested clock is 816, n is 22.66 rounded > to 22, which results: > (24MHz * 28 * 3) / 2 = 792MHz > > Changing k to 4 satisfies both system clocks: > (24E6 * 21 * 4) / 2 = 1008MHz > (24E6 * 17 * 4) / 2 = 816MHz > > Signed-off-by: Stefan Mavrodiev > --- Acked-by: Jagan Teki Need to test on respective sun boards, any results? ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 1/1] sunxi: Fix pll1 clock calculation
Can someone review this patch? Best regards, Stefan On 7/31/19 4:15 PM, Stefan Mavrodiev wrote: clock_sun6i.c is used for sun6i, sun8i and sun50i SoC families. PLL1 clock sets the default system clock, defined as: sun6i: 100800 sun8i: 100800 sun50i: 81600 With the current calculation, m = 2 and k = 3. Solving for n, this results 28. Solving back: (24MHz * 28 * 3) / 2 = 1008MHz However if the requested clock is 816, n is 22.66 rounded to 22, which results: (24MHz * 28 * 3) / 2 = 792MHz Changing k to 4 satisfies both system clocks: (24E6 * 21 * 4) / 2 = 1008MHz (24E6 * 17 * 4) / 2 = 816MHz Signed-off-by: Stefan Mavrodiev --- arch/arm/mach-sunxi/clock_sun6i.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-sunxi/clock_sun6i.c b/arch/arm/mach-sunxi/clock_sun6i.c index 1628f3a7b6..6ca38f73d9 100644 --- a/arch/arm/mach-sunxi/clock_sun6i.c +++ b/arch/arm/mach-sunxi/clock_sun6i.c @@ -118,7 +118,7 @@ void clock_set_pll1(unsigned int clk) if (clk > 115200) { k = 2; } else if (clk > 76800) { - k = 3; + k = 4; m = 2; } ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 1/1] sunxi: Fix pll1 clock calculation
clock_sun6i.c is used for sun6i, sun8i and sun50i SoC families. PLL1 clock sets the default system clock, defined as: sun6i: 100800 sun8i: 100800 sun50i: 81600 With the current calculation, m = 2 and k = 3. Solving for n, this results 28. Solving back: (24MHz * 28 * 3) / 2 = 1008MHz However if the requested clock is 816, n is 22.66 rounded to 22, which results: (24MHz * 28 * 3) / 2 = 792MHz Changing k to 4 satisfies both system clocks: (24E6 * 21 * 4) / 2 = 1008MHz (24E6 * 17 * 4) / 2 = 816MHz Signed-off-by: Stefan Mavrodiev --- arch/arm/mach-sunxi/clock_sun6i.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-sunxi/clock_sun6i.c b/arch/arm/mach-sunxi/clock_sun6i.c index 1628f3a7b6..6ca38f73d9 100644 --- a/arch/arm/mach-sunxi/clock_sun6i.c +++ b/arch/arm/mach-sunxi/clock_sun6i.c @@ -118,7 +118,7 @@ void clock_set_pll1(unsigned int clk) if (clk > 115200) { k = 2; } else if (clk > 76800) { - k = 3; + k = 4; m = 2; } -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot