sunxi: set up PLL1 on sun6i+ without use dividers
Subsystems (3)
PATCH 1/1 sunxi: set up PLL1 on sun6i+ without use dividers
According to the researching result of Ondrej Jirman, the factor M of PLL1 shouldn't be used and the factor P should be used only if the intended frequency is lower than 288MHz. This is proven by the clk-sun8iw7_tbl.c in the BSP source code -- in there the M value is always 0 and the maximum frequency that P is not 0 is 224MHz.
As P is ignored on sun6i, it's not currently used. This patch removed the usage of M.
This patch is an original work by Ondrej Jirman, however, he didn't add a Signed-off-by tag here to his commit. So I take this code and added my Signed-off-by.
---
This is a critical patch, and should be added to 2017.05.
It has been verified by the Armbian.
arch/arm/mach-sunxi/clock_sun6i.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
arch/arm/mach-sunxi/clock_sun6i.c +3 -4
@@ -98,11 +98,10 @@ void clock_set_pll1(unsigned int clk)int k =1 ;int m =1 ; -if (clk >1152000000 ) { - k =2 ; - }else if (clk >768000000 ) { +if (clk >=1368000000 ) { k =3 ; - m =2 ; + }else if (clk >=768000000 ) { + k =2 ; }/* Switch to 24MHz clock while changing PLL1 */
Signature · 1 line
2.12.2
PATCH 1/1 sunxi: set up PLL1 on sun6i+ without use dividers
Hello,
Quoted 3 lines · Icenowy Zheng
This patch is an original work by Ondrej Jirman, however, he didn't add a Signed-off-by tag here to his commit. So I take this code and added my Signed-off-by.
Isn't adding a "From:" header line the way to reflect that ?
Signature · 1 line
Vincent Legoll
PATCH 1/1 sunxi: set up PLL1 on sun6i+ without use dividers
In reply to Icenowy ZhengQuoted 13 lines · Icenowy Zheng
According to the researching result of Ondrej Jirman, the factor M of PLL1 shouldn't be used and the factor P should be used only if the intended frequency is lower than 288MHz. This is proven by the
clk-sun8iw7_tbl.cin the BSP source code -- in there the M value is always 0 and the maximum frequency that P is not 0 is 224MHz.As P is ignored on sun6i, it's not currently used. This patch removed the usage of M.
This patch is an original work by Ondrej Jirman, however, he didn't add a Signed-off-by tag here to his commit. So I take this code and added my Signed-off-by.
Quoted 6 lines
Signed-off-by Icenowy Zheng <[email protected]>---
This is a critical patch, and should be added to 2017.05.
It has been verified by the Armbian.
This doesn't mean anything. How has this been verified?
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 801 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170410/bc7bb7c8/attachment.sig>
PATCH 1/1 sunxi: set up PLL1 on sun6i+ without use dividers
Quoted 16 lines · 在 2017-04-10 14:59,Maxime Ripard 写道:
Quoted 15 lines · Icenowy Zheng
According to the researching result of Ondrej Jirman, the factor M of PLL1 shouldn't be used and the factor P should be used only if the intended frequency is lower than 288MHz. This is proven by the
clk-sun8iw7_tbl.cin the BSP source code -- in there the M value is always 0 and the maximum frequency that P is not 0 is 224MHz.As P is ignored on sun6i, it's not currently used. This patch removed the usage of M.
This patch is an original work by Ondrej Jirman, however, he didn't add
a Signed-off-by tag here to his commit. So I take this code and added my
Signed-off-by.
Quoted 8 lines
Quoted 6 lines
Signed-off-by Icenowy Zheng <[email protected]>---
This is a critical patch, and should be added to 2017.05.
It has been verified by the Armbian.
This doesn't mean anything. How has this been verified?
Armbian has included this patch since several months ago, and it's proven that without it DVFS will be not stable. (And it proved at least it won't make the system more unstable). See [1].
And for Ondrej's research, please see [2].
I also verified it on my own board.
P.S. it's also the behavior of the clk-sun8iw7_tbl.c, in which the M part of PLL_CPUX is always 0.
[1]
https://github.com/igorpecovnik/lib/blob/master/patch/u-boot/u-boot-sunxi/h3-Fix-PLL1-setup-to-never-use-dividers.patch
[2] https://github.com/megous/h3-firmware
Quoted 2 lines
Maxime
PATCH 1/1 sunxi: set up PLL1 on sun6i+ without use dividers
Quoted 22 lines · icenowy at aosc.io
Quoted 21 lines · 在 2017-04-10 14:59,Maxime Ripard 写道:
Quoted 20 lines · Icenowy Zheng
According to the researching result of Ondrej Jirman, the factor M of PLL1 shouldn't be used and the factor P should be used only if the intended frequency is lower than 288MHz. This is proven by the
clk-sun8iw7_tbl.cin the BSP source code -- in there the M value is always 0 and the maximum frequency that P is not 0 is 224MHz.As P is ignored on sun6i, it's not currently used. This patch removed the usage of M.
This patch is an original work by Ondrej Jirman, however, he didn't add
a Signed-off-by tag here to his commit. So I take this code and added my
Signed-off-by.Signed-off-by Icenowy Zheng <[email protected]>---
This is a critical patch, and should be added to 2017.05.
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
It has been verified by the Armbian.
This doesn't mean anything. How has this been verified?
Armbian has included this patch since several months ago, and it's proven that without it DVFS will be not stable. (And it proved at least it won't make the system more unstable). See [1].
Then, this should have been your commit log.
Thanks!
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 801 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170411/7d450592/attachment.sig>
Hi Maxime,
Maxime Ripard píše v Po 10. 04. 2017 v 08:59 +0200:
Quoted 14 lines · Icenowy Zheng
Quoted 13 lines
According to the researching result of Ondrej Jirman, the factor M of PLL1 shouldn't be used and the factor P should be used only if the intended frequency is lower than 288MHz. This is proven by the
clk-sun8iw7_tbl.cin the BSP source code -- in there the M value is always 0 and the maximum frequency that P is not 0 is 224MHz.As P is ignored on sun6i, it's not currently used. This patch removed the usage of M.
This patch is an original work by Ondrej Jirman, however, he didn't add a Signed-off-by tag here to his commit. So I take this code and added my Signed-off-by.
Quoted 8 lines
Quoted 6 lines
Signed-off-by Icenowy Zheng <[email protected]>---
This is a critical patch, and should be added to 2017.05.
It has been verified by the Armbian.
This doesn't mean anything. How has this been verified?
We already discussed this here: https://patchwork.kernel.org/patch/9446
365/
regards,
o.j.
Quoted 7 lines
Maxime
Signature · 3 lines
Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170410/ac718063/attachment.sig>
Quoted 20 lines · 在 2017-04-10 18:06,Ondřej Jirman 写道:
Hi Maxime,
Maxime Ripard píše v Po 10. 04. 2017 v 08:59 +0200:
Quoted 17 lines · Icenowy Zheng
Quoted 16 lines
According to the researching result of Ondrej Jirman, the factor M of PLL1 shouldn't be used and the factor P should be used only if the intended frequency is lower than 288MHz. This is proven by the
clk-sun8iw7_tbl.cin the BSP source code -- in there the M value is always 0 and the maximum frequency that P is not 0 is 224MHz.As P is ignored on sun6i, it's not currently used. This patch removed the usage of M.
This patch is an original work by Ondrej Jirman, however, he didn't add a Signed-off-by tag here to his commit. So I take this code and added my Signed-off-by.
Signed-off-by Icenowy Zheng <[email protected]>---
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
This is a critical patch, and should be added to 2017.05.
It has been verified by the Armbian.
This doesn't mean anything. How has this been verified?
We already discussed this here: https://patchwork.kernel.org/patch/9446
365/
P.S. as Chen-Yu dig out, it's not the correct work to restrict factors, but we need to gate the PLL_CPUX when adjusting. (Of course the mux should
also be switched to osc24M when PLL_CPUX is gated)
I tried this on your h3-firmware code, and it succeeded with even P overused
(for any frequency) (and M is also free in this situation).
Quoted 11 lines
regards,
o.j.Quoted 7 lines
Maxime
--
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
icenowy at aosc.io píše v Po 10. 04. 2017 v 18:15 +0800:
Quoted 30 lines · 在 2017-04-10 18:06,Ondřej Jirman 写道:
Quoted 20 lines
Hi Maxime,
Maxime Ripard píše v Po 10. 04. 2017 v 08:59 +0200:
Quoted 17 lines · Icenowy Zheng
Quoted 16 lines
According to the researching result of Ondrej Jirman, the factor M of PLL1 shouldn't be used and the factor P should be used only if the intended frequency is lower than 288MHz. This is proven by the
clk-sun8iw7_tbl.cin the BSP source code -- in there the M value is always 0 and the maximum frequency that P is not 0 is 224MHz.As P is ignored on sun6i, it's not currently used. This patch removed the usage of M.
This patch is an original work by Ondrej Jirman, however, he didn't add a Signed-off-by tag here to his commit. So I take this code and added my Signed-off-by.
Signed-off-by Icenowy Zheng <[email protected]>---
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
This is a critical patch, and should be added to 2017.05.
It has been verified by the Armbian.
This doesn't mean anything. How has this been verified?
We already discussed this here: https://patchwork.kernel.org/patch/9446
365/
Quoted 8 lines
P.S. as Chen-Yu dig out, it's not the correct work to restrict factors, but we need to gate thePLL_CPUXwhen adjusting. (Of course the mux should
also be switched to osc24M whenPLL_CPUXis gated)I tried this on your h3-firmware code, and it succeeded with even P overused
(for any frequency) (and M is also free in this situation).
Interesting, I was only switching the source of the CPUX clock, and not gating the CPUX_PLL for the test. I guess the kernel still doesn't gate CPUX_PLL, so this whole situation should be fixed by adding the gating of PLL during the chnage and that would be it?
Sounds like the cleanest solution so far.
regards,
o.j.
Quoted 11 lines
Quoted 11 lines
regards,
o.j.Quoted 7 lines
Maxime
--
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170410/63542b44/attachment.sig>
Quoted 20 lines · Ondřej Jirman
Hi Maxime,
Maxime Ripard píše v Po 10. 04. 2017 v 08:59 +0200:
Quoted 17 lines · Icenowy Zheng
Quoted 16 lines
According to the researching result of Ondrej Jirman, the factor M of PLL1 shouldn't be used and the factor P should be used only if the intended frequency is lower than 288MHz. This is proven by the
clk-sun8iw7_tbl.cin the BSP source code -- in there the M value is always 0 and the maximum frequency that P is not 0 is 224MHz.As P is ignored on sun6i, it's not currently used. This patch removed the usage of M.
This patch is an original work by Ondrej Jirman, however, he didn't add a Signed-off-by tag here to his commit. So I take this code and added my Signed-off-by.
Signed-off-by Icenowy Zheng <[email protected]>---
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
This is a critical patch, and should be added to 2017.05.
It has been verified by the Armbian.
This doesn't mean anything. How has this been verified?
We already discussed this here: https://patchwork.kernel.org/patch/9446
365/
Yes, I know. I wasn't discussing the fact that this was the right thing to do or not, just that the wording didn't allow anyone to get an idea of *how* to reproduce that test on their own board.
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 801 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170411/c0df8c43/attachment.sig>
PATCH 1/1 sunxi: set up PLL1 on sun6i+ without use dividers
In reply to Icenowy ZhengHi Icenowy,
Icenowy Zheng píše v Po 10. 04. 2017 v 00:19 +0800:
Quoted 6 lines
According to the researching result of Ondrej Jirman, the factor M of PLL1 shouldn't be used and the factor P should be used only if the intended frequency is lower than 288MHz. This is proven by the
clk-sun8iw7_tbl.cin the BSP source code -- in there the M value is always 0 and the maximum frequency that P is not 0 is 224MHz.
Quoted 6 lines
As P is ignored on sun6i, it's not currently used. This patch removed the usage of M.
This patch is an original work by Ondrej Jirman, however, he didn't add a Signed-off-by tag here to his commit. So I take this code and added my Signed-off-by.
Well, here it is if that helps:
Though this might be somewhat difficult change to make. It works perfectly when combined with kernel that will not use dividers either. So it's ok with BSP kernel as you noted, but it might cause trouble (lockup on boot) with the mainline kernel unless the kernel is patched too to not use dividers. (it does now)
Current kernel patches are here: https://megous.com/dl/h3-cpufreq/
I have only tested that it breaks if kernel is patched and u-boot is not. I haven't tried to verify that it works the other way round, which is important for the mainlining of these changes.
That's also the reason it's been sitting in my trees for a long time and not being pushed out. It's not a problem when you control both u- boot and the kernel, but that will not be a case when mainlining. Though the current kernel will be broken anyway, when the kernel starts to enable cpufreq/DVFS, so it might not matter either way.
TLDR:
- if we patch the kernel first without patching u-boot there will be lockups
- if we patch u-boot first without kernel, that's not tested yet
regards,
o.j.
Quoted 32 lines
Signed-off-by Icenowy Zheng <[email protected]>---
This is a critical patch, and should be added to 2017.05.
It has been verified by the Armbian.
arch/arm/mach-sunxi/clock_sun6i.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)arch/arm/mach-sunxi/clock_sun6i.c +3
-4@@ -98,11 +98,10 @@ void clock_set_pll1(unsigned int clk)int k =1 ;int m =1 ; -if (clk >1152000000 ) { - k =2 ; - }else if (clk >768000000 ) { +if (clk >=1368000000 ) { k =3 ; - m =2 ; + }else if (clk >=768000000 ) { + k =2 ; }/* Switch to 24MHz clock while changing PLL1 */ Signature · 1 line
2.12.2
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170410/8819ebef/attachment.sig>