linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] clock-imx35: fixes
@ 2010-08-16 13:14 Michael Grzeschik
  2010-08-16 13:14 ` [PATCH 1/4] clock-imx35: use get_3_3_div helper for get_rate_ipg_per Michael Grzeschik
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Michael Grzeschik @ 2010-08-16 13:14 UTC (permalink / raw)
  To: linux-arm-kernel

The following clock specific patchseries with fixes for the mx35
are tested and checked againsted the following Datasheet:

"i.MX35 (MCIMX35) Multimedia Applications Processor Reference Manual,
Rev. 2"

Michael Grzeschik (4):
  clock-imx35: use get_3_3_div helper for get_rate_ipg_per
  clock-imx35: fix divider if ahb is source for ipg_per
  clock-imx35: correct arm and ahb clock calculation
  clock-imx35: Calculate the base clock rate for the IPU unit

 arch/arm/mach-mx3/clock-imx35.c |   41 +++++++++++++++++++++++++++++++-------
 1 files changed, 33 insertions(+), 8 deletions(-)

--
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] 8+ messages in thread

* [PATCH 1/4] clock-imx35: use get_3_3_div helper for get_rate_ipg_per
  2010-08-16 13:14 [PATCH 0/4] clock-imx35: fixes Michael Grzeschik
@ 2010-08-16 13:14 ` Michael Grzeschik
  2010-08-16 13:37   ` Sergei Shtylyov
  2010-08-16 13:14 ` [PATCH 2/4] clock-imx35: fix divider if ahb is source for ipg_per Michael Grzeschik
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Michael Grzeschik @ 2010-08-16 13:14 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
---
 arch/arm/mach-mx3/clock-imx35.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-mx3/clock-imx35.c b/arch/arm/mach-mx3/clock-imx35.c
index d3af0fd..4b10f46 100644
--- a/arch/arm/mach-mx3/clock-imx35.c
+++ b/arch/arm/mach-mx3/clock-imx35.c
@@ -290,12 +290,10 @@ static unsigned long get_rate_ipg_per(struct clk *clk)
 {
 	unsigned long pdr0 = __raw_readl(CCM_BASE + CCM_PDR0);
 	unsigned long pdr4 = __raw_readl(CCM_BASE + CCM_PDR4);
-	unsigned long div1, div2;
+	unsigned long div1;
 
 	if (pdr0 & (1 << 26)) {
-		div1 = (pdr4 >> 19) & 0x7;
-		div2 = (pdr4 >> 16) & 0x7;
-		return get_rate_arm() / ((div1 + 1) * (div2 + 1));
+		return get_rate_arm() / get_3_3_div(pdr4 >> 16);
 	} else {
 		div1 = (pdr0 >> 12) & 0x7;
 		return get_rate_ahb(NULL) / div1;
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/4] clock-imx35: fix divider if ahb is source for ipg_per
  2010-08-16 13:14 [PATCH 0/4] clock-imx35: fixes Michael Grzeschik
  2010-08-16 13:14 ` [PATCH 1/4] clock-imx35: use get_3_3_div helper for get_rate_ipg_per Michael Grzeschik
@ 2010-08-16 13:14 ` Michael Grzeschik
  2010-08-16 13:14 ` [PATCH 3/4] clock-imx35: correct arm and ahb clock calculation Michael Grzeschik
  2010-08-16 13:14 ` [PATCH 4/4] clock-imx35: Calculate the base clock rate for the IPU unit Michael Grzeschik
  3 siblings, 0 replies; 8+ messages in thread
From: Michael Grzeschik @ 2010-08-16 13:14 UTC (permalink / raw)
  To: linux-arm-kernel

According to the Datasheet:
"i.MX35 (MCIMX35) Multimedia Applications Processor Reference Manual,
Rev. 2" "Table 14-6. PDR0 Field Descriptions" the divider is
CCM_PER_AHB[3:0] + 1.

This patch adds the missing + 1.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
---
 arch/arm/mach-mx3/clock-imx35.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-mx3/clock-imx35.c b/arch/arm/mach-mx3/clock-imx35.c
index 4b10f46..f54a82c 100644
--- a/arch/arm/mach-mx3/clock-imx35.c
+++ b/arch/arm/mach-mx3/clock-imx35.c
@@ -296,7 +296,7 @@ static unsigned long get_rate_ipg_per(struct clk *clk)
 		return get_rate_arm() / get_3_3_div(pdr4 >> 16);
 	} else {
 		div1 = (pdr0 >> 12) & 0x7;
-		return get_rate_ahb(NULL) / div1;
+		return get_rate_ahb(NULL) / (div1 + 1);
 	}
 }
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/4] clock-imx35: correct arm and ahb clock calculation
  2010-08-16 13:14 [PATCH 0/4] clock-imx35: fixes Michael Grzeschik
  2010-08-16 13:14 ` [PATCH 1/4] clock-imx35: use get_3_3_div helper for get_rate_ipg_per Michael Grzeschik
  2010-08-16 13:14 ` [PATCH 2/4] clock-imx35: fix divider if ahb is source for ipg_per Michael Grzeschik
@ 2010-08-16 13:14 ` Michael Grzeschik
  2010-08-16 13:14 ` [PATCH 4/4] clock-imx35: Calculate the base clock rate for the IPU unit Michael Grzeschik
  3 siblings, 0 replies; 8+ messages in thread
From: Michael Grzeschik @ 2010-08-16 13:14 UTC (permalink / raw)
  To: linux-arm-kernel

According to the Datasheet:
"i.MX35 (MCIMX35) Multimedia Applications Processor Reference Manual,
Rev. 2" "Figure 14-24. Clock Control And Gating"
change the result of get_rate_ahb based on the frequency returned
by get_rate_arm to calculate the proper rate.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
---
 arch/arm/mach-mx3/clock-imx35.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-mx3/clock-imx35.c b/arch/arm/mach-mx3/clock-imx35.c
index f54a82c..009156d 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;
 }
@@ -164,7 +164,7 @@ static unsigned long get_rate_ahb(struct clk *clk)
 {
 	unsigned long pdr0 = __raw_readl(CCM_BASE + CCM_PDR0);
 	struct arm_ahb_div *aad;
-	unsigned long fref = get_rate_mpll();
+	unsigned long fref = get_rate_arm();
 
 	aad = &clk_consumer[(pdr0 >> 16) & 0xf];
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 4/4] clock-imx35: Calculate the base clock rate for the IPU unit
  2010-08-16 13:14 [PATCH 0/4] clock-imx35: fixes Michael Grzeschik
                   ` (2 preceding siblings ...)
  2010-08-16 13:14 ` [PATCH 3/4] clock-imx35: correct arm and ahb clock calculation Michael Grzeschik
@ 2010-08-16 13:14 ` Michael Grzeschik
  3 siblings, 0 replies; 8+ messages in thread
From: Michael Grzeschik @ 2010-08-16 13:14 UTC (permalink / raw)
  To: linux-arm-kernel

The mx3fb driver needs the clock the IPU runs in order to calculate
the divider for the LCD clock. This patch adds the clock rate calculation
routine for the i.MX35 CPU.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
---
 arch/arm/mach-mx3/clock-imx35.c |   29 ++++++++++++++++++++++++++++-
 1 files changed, 28 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-mx3/clock-imx35.c b/arch/arm/mach-mx3/clock-imx35.c
index 009156d..9b7dbcc 100644
--- a/arch/arm/mach-mx3/clock-imx35.c
+++ b/arch/arm/mach-mx3/clock-imx35.c
@@ -300,6 +300,33 @@ static unsigned long get_rate_ipg_per(struct clk *clk)
 	}
 }
 
+static unsigned long get_rate_hsp(struct clk *clk)
+{
+	unsigned long hsp_podf = (__raw_readl(CCM_BASE + CCM_PDR0) >> 20) & 0x03;
+	unsigned long fref = get_rate_mpll();
+
+	if (fref > 400 * 1000 * 1000) {
+		switch (hsp_podf) {
+		case 0:
+			return fref >> 2;
+		case 1:
+			return fref >> 3;
+		case 2:
+			return fref / 3;
+		}
+	} else {
+		switch (hsp_podf) {
+		case 0:
+		case 2:
+			return fref / 3;
+		case 1:
+			return fref / 6;
+		}
+	}
+
+	return 0;
+}
+
 static int clk_cgr_enable(struct clk *clk)
 {
 	u32 reg;
@@ -357,7 +384,7 @@ DEFINE_CLOCK(i2c1_clk,   0, CCM_CGR1, 10, get_rate_ipg_per, NULL);
 DEFINE_CLOCK(i2c2_clk,   1, CCM_CGR1, 12, get_rate_ipg_per, NULL);
 DEFINE_CLOCK(i2c3_clk,   2, CCM_CGR1, 14, get_rate_ipg_per, NULL);
 DEFINE_CLOCK(iomuxc_clk, 0, CCM_CGR1, 16, NULL, NULL);
-DEFINE_CLOCK(ipu_clk,    0, CCM_CGR1, 18, get_rate_ahb, NULL);
+DEFINE_CLOCK(ipu_clk,    0, CCM_CGR1, 18, get_rate_hsp, NULL);
 DEFINE_CLOCK(kpp_clk,    0, CCM_CGR1, 20, get_rate_ipg, NULL);
 DEFINE_CLOCK(mlb_clk,    0, CCM_CGR1, 22, get_rate_ahb, NULL);
 DEFINE_CLOCK(mshc_clk,   0, CCM_CGR1, 24, get_rate_mshc, NULL);
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 1/4] clock-imx35: use get_3_3_div helper for get_rate_ipg_per
  2010-08-16 13:14 ` [PATCH 1/4] clock-imx35: use get_3_3_div helper for get_rate_ipg_per Michael Grzeschik
@ 2010-08-16 13:37   ` Sergei Shtylyov
  2010-08-16 13:47     ` Marc Kleine-Budde
  2010-08-16 13:58     ` Michael Grzeschik
  0 siblings, 2 replies; 8+ messages in thread
From: Sergei Shtylyov @ 2010-08-16 13:37 UTC (permalink / raw)
  To: linux-arm-kernel

Hello.

Michael Grzeschik wrote:

> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>

    So, who's the author of the patch? In case it's actually Marc, you should 
have added (at the start of the changelog):

From: Marc Kleine-Budde <mkl@pengutronix.de>

WBR, Sergei

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/4] clock-imx35: use get_3_3_div helper for get_rate_ipg_per
  2010-08-16 13:37   ` Sergei Shtylyov
@ 2010-08-16 13:47     ` Marc Kleine-Budde
  2010-08-16 13:58     ` Michael Grzeschik
  1 sibling, 0 replies; 8+ messages in thread
From: Marc Kleine-Budde @ 2010-08-16 13:47 UTC (permalink / raw)
  To: linux-arm-kernel

Sergei Shtylyov wrote:
> Hello.
> 
> Michael Grzeschik wrote:
> 
>> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
>> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
> 
>    So, who's the author of the patch? In case it's actually Marc, you
> should have added (at the start of the changelog):

Yeah, it's me.

> From: Marc Kleine-Budde <mkl@pengutronix.de>
or do a:
$(git commit --amend --author="Marc Kleine-Budde <mkl@pengutronix.de>")
on the patches..


Marc
-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20100816/f135c32a/attachment.sig>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/4] clock-imx35: use get_3_3_div helper for get_rate_ipg_per
  2010-08-16 13:37   ` Sergei Shtylyov
  2010-08-16 13:47     ` Marc Kleine-Budde
@ 2010-08-16 13:58     ` Michael Grzeschik
  1 sibling, 0 replies; 8+ messages in thread
From: Michael Grzeschik @ 2010-08-16 13:58 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Aug 16, 2010 at 05:37:48PM +0400, Sergei Shtylyov wrote:
> Hello.
>
> Michael Grzeschik wrote:
>
>> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
>> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
>
>    So, who's the author of the patch? In case it's actually Marc, you 
> should have added (at the start of the changelog):
>
> From: Marc Kleine-Budde <mkl@pengutronix.de>
Done that, sorry Marc and Juergen, was not trying to take credit ;-)

Thanks,
Michael

-- 
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] 8+ messages in thread

end of thread, other threads:[~2010-08-16 13:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-16 13:14 [PATCH 0/4] clock-imx35: fixes Michael Grzeschik
2010-08-16 13:14 ` [PATCH 1/4] clock-imx35: use get_3_3_div helper for get_rate_ipg_per Michael Grzeschik
2010-08-16 13:37   ` Sergei Shtylyov
2010-08-16 13:47     ` Marc Kleine-Budde
2010-08-16 13:58     ` Michael Grzeschik
2010-08-16 13:14 ` [PATCH 2/4] clock-imx35: fix divider if ahb is source for ipg_per Michael Grzeschik
2010-08-16 13:14 ` [PATCH 3/4] clock-imx35: correct arm and ahb clock calculation Michael Grzeschik
2010-08-16 13:14 ` [PATCH 4/4] clock-imx35: Calculate the base clock rate for the IPU unit Michael Grzeschik

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).