* [U-Boot] [PATCH 1/1] sunxi: Fix pll1 clock calculation
@ 2019-07-31 13:15 Stefan Mavrodiev
2019-08-26 10:04 ` Stefan Mavrodiev
2019-09-06 18:21 ` Jagan Teki
0 siblings, 2 replies; 4+ messages in thread
From: Stefan Mavrodiev @ 2019-07-31 13:15 UTC (permalink / raw)
To: u-boot
clock_sun6i.c is used for sun6i, sun8i and sun50i SoC families.
PLL1 clock sets the default system clock, defined as:
sun6i: 1008000000
sun8i: 1008000000
sun50i: 816000000
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 <stefan@olimex.com>
---
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 > 1152000000) {
k = 2;
} else if (clk > 768000000) {
- k = 3;
+ k = 4;
m = 2;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH 1/1] sunxi: Fix pll1 clock calculation
2019-07-31 13:15 [U-Boot] [PATCH 1/1] sunxi: Fix pll1 clock calculation Stefan Mavrodiev
@ 2019-08-26 10:04 ` Stefan Mavrodiev
2019-09-06 18:21 ` Jagan Teki
1 sibling, 0 replies; 4+ messages in thread
From: Stefan Mavrodiev @ 2019-08-26 10:04 UTC (permalink / raw)
To: u-boot
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: 1008000000
> sun8i: 1008000000
> sun50i: 816000000
>
> 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 <stefan@olimex.com>
> ---
> 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 > 1152000000) {
> k = 2;
> } else if (clk > 768000000) {
> - k = 3;
> + k = 4;
> m = 2;
> }
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH 1/1] sunxi: Fix pll1 clock calculation
2019-07-31 13:15 [U-Boot] [PATCH 1/1] sunxi: Fix pll1 clock calculation Stefan Mavrodiev
2019-08-26 10:04 ` Stefan Mavrodiev
@ 2019-09-06 18:21 ` Jagan Teki
2019-10-16 16:40 ` Jagan Teki
1 sibling, 1 reply; 4+ messages in thread
From: Jagan Teki @ 2019-09-06 18:21 UTC (permalink / raw)
To: u-boot
On Wed, Jul 31, 2019 at 6:46 PM Stefan Mavrodiev <stefan@olimex.com> wrote:
>
> clock_sun6i.c is used for sun6i, sun8i and sun50i SoC families.
> PLL1 clock sets the default system clock, defined as:
> sun6i: 1008000000
> sun8i: 1008000000
> sun50i: 816000000
>
> 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 <stefan@olimex.com>
> ---
Acked-by: Jagan Teki <jagan@amarulasolutions.com>
Need to test on respective sun boards, any results?
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH 1/1] sunxi: Fix pll1 clock calculation
2019-09-06 18:21 ` Jagan Teki
@ 2019-10-16 16:40 ` Jagan Teki
0 siblings, 0 replies; 4+ messages in thread
From: Jagan Teki @ 2019-10-16 16:40 UTC (permalink / raw)
To: u-boot
On Fri, Sep 6, 2019 at 11:51 PM Jagan Teki <jagan@amarulasolutions.com> wrote:
>
> On Wed, Jul 31, 2019 at 6:46 PM Stefan Mavrodiev <stefan@olimex.com> wrote:
> >
> > clock_sun6i.c is used for sun6i, sun8i and sun50i SoC families.
> > PLL1 clock sets the default system clock, defined as:
> > sun6i: 1008000000
> > sun8i: 1008000000
> > sun50i: 816000000
> >
> > 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 <stefan@olimex.com>
> > ---
>
> Acked-by: Jagan Teki <jagan@amarulasolutions.com>
Applied to u-boot-sunxi/master
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-10-16 16:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-31 13:15 [U-Boot] [PATCH 1/1] sunxi: Fix pll1 clock calculation Stefan Mavrodiev
2019-08-26 10:04 ` Stefan Mavrodiev
2019-09-06 18:21 ` Jagan Teki
2019-10-16 16:40 ` Jagan Teki
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.