From: "Ondřej Jirman" <megous@megous.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [linux-sunxi] [PATCH] sunxi: set up PLL1 on sun6i+ without use dividers
Date: Mon, 10 Apr 2017 12:27:19 +0200 [thread overview]
Message-ID: <1491820039.14386.4.camel@megous.com> (raw)
In-Reply-To: <20170409161941.31531-1-icenowy@aosc.io>
Hi Icenowy,
Icenowy Zheng píše v Po 10. 04. 2017 v 00:19 +0800:
> 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.
Well, here it is if that helps:
Signed-off-by: Ondřej Jirman <megous@megous.com>
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.
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> ---
>
> 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(-)
>
> diff --git a/arch/arm/mach-sunxi/clock_sun6i.c b/arch/arm/mach-sunxi/clock_sun6i.c
> index 4762fbf0c3..ce4291b30e 100644
> --- a/arch/arm/mach-sunxi/clock_sun6i.c
> +++ b/arch/arm/mach-sunxi/clock_sun6i.c
> @@ -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 */
> --
> 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>
prev parent reply other threads:[~2017-04-10 10:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-09 16:19 [U-Boot] [PATCH] sunxi: set up PLL1 on sun6i+ without use dividers Icenowy Zheng
2017-04-09 16:24 ` [U-Boot] [linux-sunxi] " Vincent Legoll
2017-04-10 6:59 ` [U-Boot] " Maxime Ripard
2017-04-10 8:43 ` icenowy at aosc.io
2017-04-11 9:17 ` Maxime Ripard
2017-04-10 10:06 ` [U-Boot] [linux-sunxi] " Ondřej Jirman
2017-04-10 10:15 ` icenowy at aosc.io
2017-04-10 10:33 ` Ondřej Jirman
2017-04-11 9:18 ` Maxime Ripard
2017-04-10 10:27 ` Ondřej Jirman [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1491820039.14386.4.camel@megous.com \
--to=megous@megous.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox