* i.MX35 Clock patches
@ 2010-04-23 7:40 Sascha Hauer
2010-04-23 7:40 ` [PATCH 1/2] i.MX35: Fix arm/ahb clock calculation Sascha Hauer
2010-04-23 7:40 ` [PATCH 2/2] i.MX35: remove get_3_3_div helper function Sascha Hauer
0 siblings, 2 replies; 6+ messages in thread
From: Sascha Hauer @ 2010-04-23 7:40 UTC (permalink / raw)
To: linux-arm-kernel
Here are some clock fixes for i.MX35.
Sascha
The following changes since commit 2ba3abd8186f24c7fb418927025b4e2120e3a362:
Linus Torvalds (1):
Merge branch 'pm-fixes' of git://git.kernel.org/.../rafael/suspend-2.6
are available in the git repository at:
git://git.pengutronix.de/git/imx/linux-2.6.git mxc-pu
Sascha Hauer (2):
i.MX35: Fix arm/ahb clock calculation
i.MX35: remove get_3_3_div helper function
arch/arm/mach-mx3/clock-imx35.c | 17 +++++++----------
1 files changed, 7 insertions(+), 10 deletions(-)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] i.MX35: Fix arm/ahb clock calculation
2010-04-23 7:40 i.MX35 Clock patches Sascha Hauer
@ 2010-04-23 7:40 ` Sascha Hauer
2010-04-23 7:40 ` [PATCH 2/2] i.MX35: remove get_3_3_div helper function Sascha Hauer
1 sibling, 0 replies; 6+ messages in thread
From: Sascha Hauer @ 2010-04-23 7:40 UTC (permalink / raw)
To: linux-arm-kernel
The correct divider for the reference clock if arm_sel is 1 is
3/4 and not 2/3. Also, the ahb clock is also affected by this divider.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/mach-mx3/clock-imx35.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/arch/arm/mach-mx3/clock-imx35.c b/arch/arm/mach-mx3/clock-imx35.c
index 9f3e943..5c87338 100644
--- a/arch/arm/mach-mx3/clock-imx35.c
+++ b/arch/arm/mach-mx3/clock-imx35.c
@@ -155,7 +155,7 @@ static unsigned long get_rate_arm(void)
aad = &clk_consumer[(pdr0 >> 16) & 0xf];
if (aad->sel)
- fref = fref * 2 / 3;
+ fref = fref * 3 / 4;
return fref / aad->arm;
}
@@ -167,6 +167,8 @@ static unsigned long get_rate_ahb(struct clk *clk)
unsigned long fref = get_rate_mpll();
aad = &clk_consumer[(pdr0 >> 16) & 0xf];
+ if (aad->sel)
+ fref = fref * 3 / 4;
return fref / aad->ahb;
}
--
1.7.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] i.MX35: remove get_3_3_div helper function
2010-04-23 7:40 i.MX35 Clock patches Sascha Hauer
2010-04-23 7:40 ` [PATCH 1/2] i.MX35: Fix arm/ahb clock calculation Sascha Hauer
@ 2010-04-23 7:40 ` Sascha Hauer
2010-04-23 10:12 ` Sergei Shtylyov
1 sibling, 1 reply; 6+ messages in thread
From: Sascha Hauer @ 2010-04-23 7:40 UTC (permalink / raw)
To: linux-arm-kernel
In the v2 reference manual there are no dividers combined of two
dividers. Instead, all dividers are simple 6bit dividers. I assume
the combined dividers only exist in preliminary hardware.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/mach-mx3/clock-imx35.c | 13 ++++---------
1 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/arch/arm/mach-mx3/clock-imx35.c b/arch/arm/mach-mx3/clock-imx35.c
index 5c87338..c6ef64e 100644
--- a/arch/arm/mach-mx3/clock-imx35.c
+++ b/arch/arm/mach-mx3/clock-imx35.c
@@ -178,16 +178,11 @@ static unsigned long get_rate_ipg(struct clk *clk)
return get_rate_ahb(NULL) >> 1;
}
-static unsigned long get_3_3_div(unsigned long in)
-{
- return (((in >> 3) & 0x7) + 1) * ((in & 0x7) + 1);
-}
-
static unsigned long get_rate_uart(struct clk *clk)
{
unsigned long pdr3 = __raw_readl(CCM_BASE + CCM_PDR3);
unsigned long pdr4 = __raw_readl(CCM_BASE + CCM_PDR4);
- unsigned long div = get_3_3_div(pdr4 >> 10);
+ unsigned long div = ((pdr4 >> 10) & 0x3f) + 1;
if (pdr3 & (1 << 14))
return get_rate_arm() / div;
@@ -218,7 +213,7 @@ static unsigned long get_rate_sdhc(struct clk *clk)
break;
}
- return rate / get_3_3_div(div);
+ return rate / (div + 1);
}
static unsigned long get_rate_mshc(struct clk *clk)
@@ -272,7 +267,7 @@ static unsigned long get_rate_csi(struct clk *clk)
else
rate = get_rate_ppll();
- return rate / get_3_3_div((pdr2 >> 16) & 0x3f);
+ return rate / (((pdr2 >> 16) & 0x3f) + 1);
}
static unsigned long get_rate_otg(struct clk *clk)
@@ -285,7 +280,7 @@ static unsigned long get_rate_otg(struct clk *clk)
else
rate = get_rate_ppll();
- return rate / get_3_3_div((pdr4 >> 22) & 0x3f);
+ return rate / (((pdr4 >> 22) & 0x3f) + 1);
}
static unsigned long get_rate_ipg_per(struct clk *clk)
--
1.7.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] i.MX35: remove get_3_3_div helper function
2010-04-23 7:40 ` [PATCH 2/2] i.MX35: remove get_3_3_div helper function Sascha Hauer
@ 2010-04-23 10:12 ` Sergei Shtylyov
2010-04-23 12:38 ` Sascha Hauer
0 siblings, 1 reply; 6+ messages in thread
From: Sergei Shtylyov @ 2010-04-23 10:12 UTC (permalink / raw)
To: linux-arm-kernel
Hello.
Sascha Hauer wrote:
> In the v2 reference manual there are no dividers combined of two
> dividers. Instead, all dividers are simple 6bit dividers. I assume
> the combined dividers only exist in preliminary hardware.
>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
> arch/arm/mach-mx3/clock-imx35.c | 13 ++++---------
> 1 files changed, 4 insertions(+), 9 deletions(-)
>
> diff --git a/arch/arm/mach-mx3/clock-imx35.c b/arch/arm/mach-mx3/clock-imx35.c
> index 5c87338..c6ef64e 100644
> --- a/arch/arm/mach-mx3/clock-imx35.c
> +++ b/arch/arm/mach-mx3/clock-imx35.c
> @@ -178,16 +178,11 @@ static unsigned long get_rate_ipg(struct clk *clk)
> return get_rate_ahb(NULL) >> 1;
> }
>
> -static unsigned long get_3_3_div(unsigned long in)
> -{
> - return (((in >> 3) & 0x7) + 1) * ((in & 0x7) + 1);
> -}
> -
> static unsigned long get_rate_uart(struct clk *clk)
> {
> unsigned long pdr3 = __raw_readl(CCM_BASE + CCM_PDR3);
> unsigned long pdr4 = __raw_readl(CCM_BASE + CCM_PDR4);
> - unsigned long div = get_3_3_div(pdr4 >> 10);
> + unsigned long div = ((pdr4 >> 10) & 0x3f) + 1;
>
> if (pdr3 & (1 << 14))
> return get_rate_arm() / div;
> @@ -218,7 +213,7 @@ static unsigned long get_rate_sdhc(struct clk *clk)
> break;
> }
>
> - return rate / get_3_3_div(div);
> + return rate / (div + 1);
>
You're adding 1 to divisor twice here...
> }
>
> static unsigned long get_rate_mshc(struct clk *clk)
> @@ -272,7 +267,7 @@ static unsigned long get_rate_csi(struct clk *clk)
> else
> rate = get_rate_ppll();
>
> - return rate / get_3_3_div((pdr2 >> 16) & 0x3f);
> + return rate / (((pdr2 >> 16) & 0x3f) + 1);
> }
>
> static unsigned long get_rate_otg(struct clk *clk)
> @@ -285,7 +280,7 @@ static unsigned long get_rate_otg(struct clk *clk)
> else
> rate = get_rate_ppll();
>
> - return rate / get_3_3_div((pdr4 >> 22) & 0x3f);
> + return rate / (((pdr4 >> 22) & 0x3f) + 1);
>
... but not here. Is that right?
WBR, Sergei
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/2] i.MX35: remove get_3_3_div helper function
2010-04-23 10:12 ` Sergei Shtylyov
@ 2010-04-23 12:38 ` Sascha Hauer
2010-04-23 13:20 ` Sergei Shtylyov
0 siblings, 1 reply; 6+ messages in thread
From: Sascha Hauer @ 2010-04-23 12:38 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Apr 23, 2010 at 02:12:51PM +0400, Sergei Shtylyov wrote:
>> static unsigned long get_rate_uart(struct clk *clk)
>> {
>> unsigned long pdr3 = __raw_readl(CCM_BASE + CCM_PDR3);
>> unsigned long pdr4 = __raw_readl(CCM_BASE + CCM_PDR4);
>> - unsigned long div = get_3_3_div(pdr4 >> 10);
>> + unsigned long div = ((pdr4 >> 10) & 0x3f) + 1;
>> if (pdr3 & (1 << 14))
>> return get_rate_arm() / div;
>> @@ -218,7 +213,7 @@ static unsigned long get_rate_sdhc(struct clk *clk)
>> break;
>> }
>> - return rate / get_3_3_div(div);
>> + return rate / (div + 1);
>>
>
> You're adding 1 to divisor twice here...
Look again, these hunks are in two different functions.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/2] i.MX35: remove get_3_3_div helper function
2010-04-23 12:38 ` Sascha Hauer
@ 2010-04-23 13:20 ` Sergei Shtylyov
0 siblings, 0 replies; 6+ messages in thread
From: Sergei Shtylyov @ 2010-04-23 13:20 UTC (permalink / raw)
To: linux-arm-kernel
Hello.
Sascha Hauer wrote:
>>> static unsigned long get_rate_uart(struct clk *clk)
>>> {
>>> unsigned long pdr3 = __raw_readl(CCM_BASE + CCM_PDR3);
>>> unsigned long pdr4 = __raw_readl(CCM_BASE + CCM_PDR4);
>>> - unsigned long div = get_3_3_div(pdr4 >> 10);
>>> + unsigned long div = ((pdr4 >> 10) & 0x3f) + 1;
>>> if (pdr3 & (1 << 14))
>>> return get_rate_arm() / div;
>>> @@ -218,7 +213,7 @@ static unsigned long get_rate_sdhc(struct clk *clk)
>>> break;
>>> }
>>> - return rate / get_3_3_div(div);
>>> + return rate / (div + 1);
>>>
>>>
>> You're adding 1 to divisor twice here...
>>
>
> Look again, these hunks are in two different functions.
>
Indeed -- sorry.
> Sascha
WBR, Sergei
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-04-23 13:20 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-23 7:40 i.MX35 Clock patches Sascha Hauer
2010-04-23 7:40 ` [PATCH 1/2] i.MX35: Fix arm/ahb clock calculation Sascha Hauer
2010-04-23 7:40 ` [PATCH 2/2] i.MX35: remove get_3_3_div helper function Sascha Hauer
2010-04-23 10:12 ` Sergei Shtylyov
2010-04-23 12:38 ` Sascha Hauer
2010-04-23 13:20 ` Sergei Shtylyov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).