From: Hans de Goede <hdegoede@redhat.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 09/14] sun6i: Add k and m parameters to clock_set_pll5()
Date: Fri, 19 Dec 2014 17:40:27 +0100 [thread overview]
Message-ID: <549454FB.4060502@redhat.com> (raw)
In-Reply-To: <20141219120300.2740b997@i7>
Hi,
On 19-12-14 11:03, Siarhei Siamashka wrote:
> On Tue, 16 Dec 2014 21:31:34 +0100
> Hans de Goede <hdegoede@redhat.com> wrote:
>
>> The A23 (sun8i) requires different values for these then sun6i, so make them
>> function parameters.
>>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>
> What happens if A23 does not get these special k and m parameters, but
> the 'clock_set_pll5' function picks some other values for them (with
> the same resulting target clock speed)?
The major difference is that on the A23 pll5 must be set to dram_clk / 2,
where as on A31 it needs to be set to dram_clk * 2. By codifying k and m
so that they do the * 2 on A31 and / 2 on A23 we can make any multiple of
24 MHz as DRAM clk without needing any other code to figure out the optimal
k and m. AFAIK using other k and m factors with the same end-result should
work fine. But doing things this way follows the KISS principle and I'm
a great fan of KISS.
Regards,
Hans
>
> And if they are really required for A23, then why exposing them as the
> function arguments instead of hiding this implementation detail inside
> of the 'clock_set_pll5' function?
>
>> ---
>> arch/arm/cpu/armv7/sunxi/clock_sun6i.c | 4 +---
>> arch/arm/cpu/armv7/sunxi/dram_sun6i.c | 2 +-
>> arch/arm/include/asm/arch-sunxi/clock_sun6i.h | 2 +-
>> 3 files changed, 3 insertions(+), 5 deletions(-)
>>
>> diff --git a/arch/arm/cpu/armv7/sunxi/clock_sun6i.c b/arch/arm/cpu/armv7/sunxi/clock_sun6i.c
>> index 193e314..8ef19df 100644
>> --- a/arch/arm/cpu/armv7/sunxi/clock_sun6i.c
>> +++ b/arch/arm/cpu/armv7/sunxi/clock_sun6i.c
>> @@ -144,12 +144,10 @@ void clock_set_pll3(unsigned int clk)
>> &ccm->pll3_cfg);
>> }
>>
>> -void clock_set_pll5(unsigned int clk, bool sigma_delta_enable)
>> +void clock_set_pll5(unsigned int clk, int k, int m, bool sigma_delta_enable)
>> {
>> struct sunxi_ccm_reg * const ccm =
>> (struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
>> - const int k = 2;
>> - const int m = 1;
>>
>> if (sigma_delta_enable)
>> writel(CCM_PLL5_PATTERN, &ccm->pll5_pattern_cfg);
>> diff --git a/arch/arm/cpu/armv7/sunxi/dram_sun6i.c b/arch/arm/cpu/armv7/sunxi/dram_sun6i.c
>> index bc6428a..a8bbdfd 100644
>> --- a/arch/arm/cpu/armv7/sunxi/dram_sun6i.c
>> +++ b/arch/arm/cpu/armv7/sunxi/dram_sun6i.c
>> @@ -46,7 +46,7 @@ static void mctl_sys_init(void)
>> (struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
>> const int dram_clk_div = 2;
>>
>> - clock_set_pll5(DRAM_CLK * dram_clk_div, false);
>> + clock_set_pll5(DRAM_CLK * dram_clk_div, 2, 1, false);
>>
>> clrsetbits_le32(&ccm->dram_clk_cfg, CCM_DRAMCLK_CFG_DIV0_MASK,
>> CCM_DRAMCLK_CFG_DIV0(dram_clk_div) | CCM_DRAMCLK_CFG_RST |
>> diff --git a/arch/arm/include/asm/arch-sunxi/clock_sun6i.h b/arch/arm/include/asm/arch-sunxi/clock_sun6i.h
>> index f807af3..7d61216 100644
>> --- a/arch/arm/include/asm/arch-sunxi/clock_sun6i.h
>> +++ b/arch/arm/include/asm/arch-sunxi/clock_sun6i.h
>> @@ -311,6 +311,6 @@ struct sunxi_ccm_reg {
>> #define CCM_DE_CTRL_PLL10 (5 << 24)
>> #define CCM_DE_CTRL_GATE (1 << 31)
>>
>> -void clock_set_pll5(unsigned int clk, bool sigma_delta_enable);
>> +void clock_set_pll5(unsigned int clk, int k, int m, bool sigma_delta_enable);
>>
>> #endif /* _SUNXI_CLOCK_SUN6I_H */
>
>
>
next prev parent reply other threads:[~2014-12-19 16:40 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-16 20:31 [U-Boot] [PATCH 01/14] sun6i: s/SUNXI_GPL0_R_P2WI/SUN6I_GPL0_R_P2WI/ Hans de Goede
2014-12-16 20:31 ` [U-Boot] [PATCH 02/14] sunxi: Add support for the rsb (Reduced Serial Bus) Hans de Goede
2014-12-17 2:22 ` Chen-Yu Tsai
2014-12-17 12:56 ` Hans de Goede
2014-12-18 18:57 ` Ian Campbell
2014-12-18 18:59 ` Ian Campbell
2014-12-19 15:26 ` Hans de Goede
2014-12-16 20:31 ` [U-Boot] [PATCH 03/14] sunxi: axp221: Add axp223 support Hans de Goede
2014-12-17 2:34 ` Chen-Yu Tsai
2014-12-18 10:44 ` Hans de Goede
2014-12-18 19:00 ` Ian Campbell
2014-12-16 20:31 ` [U-Boot] [PATCH 04/14] sunxi: axp221: Add Kconfig help and sane defaults for typical ldo usage Hans de Goede
2014-12-18 19:02 ` Ian Campbell
2014-12-16 20:31 ` [U-Boot] [PATCH 05/14] sunxi: axp221: Make dcdc1 voltage configurable Hans de Goede
2014-12-18 19:03 ` Ian Campbell
2014-12-16 20:31 ` [U-Boot] [PATCH 06/14] sunxi: axp221: Explicitly turn off unused voltages Hans de Goede
2014-12-18 19:04 ` Ian Campbell
2014-12-16 20:31 ` [U-Boot] [PATCH 07/14] sunxi: axp221: Disable dcdc4 on sun8i (A23) Hans de Goede
2014-12-18 19:05 ` Ian Campbell
2014-12-16 20:31 ` [U-Boot] [PATCH 08/14] sun6i: Add a sigma_delta_enable paramter to clock_set_pll5() Hans de Goede
2014-12-18 19:07 ` Ian Campbell
2014-12-19 10:02 ` Siarhei Siamashka
2014-12-16 20:31 ` [U-Boot] [PATCH 09/14] sun6i: Add k and m parameters " Hans de Goede
2014-12-18 19:07 ` Ian Campbell
2014-12-19 10:03 ` Siarhei Siamashka
2014-12-19 16:40 ` Hans de Goede [this message]
2014-12-22 7:25 ` Siarhei Siamashka
2014-12-16 20:31 ` [U-Boot] [PATCH 10/14] sunxi: Move await_completion dram helper to dram.h Hans de Goede
2014-12-18 19:08 ` Ian Campbell
2014-12-19 10:06 ` Siarhei Siamashka
2014-12-19 16:42 ` Hans de Goede
2014-12-22 7:28 ` Siarhei Siamashka
2014-12-16 20:31 ` [U-Boot] [PATCH 11/14] sunxi: Fill memory before comparing it when doing dram init on sun6i Hans de Goede
2014-12-18 19:12 ` Ian Campbell
2014-12-19 10:08 ` Siarhei Siamashka
2014-12-19 16:56 ` Hans de Goede
2014-12-22 7:39 ` Siarhei Siamashka
2014-12-19 16:55 ` Hans de Goede
2014-12-22 14:19 ` Ian Campbell
2014-12-22 14:32 ` Siarhei Siamashka
2014-12-22 14:34 ` Ian Campbell
2014-12-22 15:47 ` Hans de Goede
2014-12-16 20:31 ` [U-Boot] [PATCH 12/14] sunxi: Use memcmp for mctl_mem_matches Hans de Goede
2014-12-18 19:13 ` Ian Campbell
2014-12-16 20:31 ` [U-Boot] [PATCH 13/14] sun8i: Add dram initialization support Hans de Goede
2014-12-18 11:12 ` Chen-Yu Tsai
2014-12-18 19:17 ` Ian Campbell
2014-12-19 16:51 ` Hans de Goede
2014-12-19 10:20 ` Siarhei Siamashka
2014-12-19 17:05 ` Hans de Goede
2014-12-22 7:43 ` Siarhei Siamashka
2014-12-16 20:31 ` [U-Boot] [PATCH 14/14] sun8i: Add defconfig for Ippo_q8h v1.2 Hans de Goede
2014-12-18 19:19 ` Ian Campbell
2014-12-18 18:56 ` [U-Boot] [PATCH 01/14] sun6i: s/SUNXI_GPL0_R_P2WI/SUN6I_GPL0_R_P2WI/ Ian Campbell
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=549454FB.4060502@redhat.com \
--to=hdegoede@redhat.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