clock-imx35: fixes
Subsystems (3)
cover clock-imx35: fixes
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 |
PATCH 1/4 clock-imx35: use get_3_3_div helper for get_rate_ipg_per
--- arch/arm/mach-mx3/clock-imx35.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
arch/arm/mach-mx3/clock-imx35.c +2 -4
@@ -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;
Signature · 1 line
1.7.1
PATCH 1/4 clock-imx35: use get_3_3_div helper for get_rate_ipg_per
Hello.
Quoted 2 lines · Michael Grzeschik
Signed-off-by Marc Kleine-Budde <[email protected]>Signed-off-by Michael Grzeschik <[email protected]>
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 <[email protected]>
WBR, Sergei
PATCH 1/4 clock-imx35: use get_3_3_div helper for get_rate_ipg_per
Quoted 9 lines · Sergei Shtylyov
Hello.
Quoted 2 lines · Michael Grzeschik
Signed-off-by Marc Kleine-Budde <[email protected]>Signed-off-by Michael Grzeschik <[email protected]>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.
Quoted 1 line
From: Marc Kleine-Budde <[email protected]>
or do a:
$(git commit --amend --author="Marc Kleine-Budde <[email protected]>") on the patches..
Marc
Signature · 12 lines
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>
PATCH 1/4 clock-imx35: use get_3_3_div helper for get_rate_ipg_per
In reply to Sergei ShtylyovQuoted 11 lines · Sergei Shtylyov
Hello.
Quoted 2 lines · Michael Grzeschik
Signed-off-by Marc Kleine-Budde <[email protected]>Signed-off-by Michael Grzeschik <[email protected]>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 <[email protected]>
Done that, sorry Marc and Juergen, was not trying to take credit ;-)
Thanks,
Michael
Signature · 4 lines
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 |
PATCH 2/4 clock-imx35: fix divider if ahb is source for ipg_per
In reply to Michael GrzeschikAccording 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.
--- arch/arm/mach-mx3/clock-imx35.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-mx3/clock-imx35.c +1 -1
@@ -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 ); } }
Signature · 1 line
1.7.1
PATCH 3/4 clock-imx35: correct arm and ahb clock calculation
In reply to Michael GrzeschikAccording 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.
--- arch/arm/mach-mx3/clock-imx35.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-mx3/clock-imx35.c +2 -2
@@ -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 ];
Signature · 1 line
1.7.1
PATCH 4/4 clock-imx35: Calculate the base clock rate for the IPU unit
In reply to Michael GrzeschikThe 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.
--- arch/arm/mach-mx3/clock-imx35.c | 29 ++++++++++++++++++++++++++++- 1 files changed, 28 insertions(+), 1 deletions(-)
arch/arm/mach-mx3/clock-imx35.c +28 -1
@@ -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 );
Signature · 1 line
1.7.1