Skip to contentSkip to conversation

pxa3xx: Fix HSIO bus x24 multiplier

PATCH New Marek Vasut 2 participants 7 messages Jun 24, 2010 – Jun 28, 2010

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 pxa3xx: Fix HSIO bus x24 multiplier

The value should be 24, not 0 in the possibilities array. It was just a silly mistake.

---
 arch/arm/mach-pxa/pxa3xx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-pxa/pxa3xx.c +1 -1
index f544e58..611622a 100644
@@ -52,7 +52,7 @@
 static unsigned char smcfs_mult[8] = { 6, 0, 8, 0, 0, 16, };
 
 /* crystal frequency to HSIO bus frequency multiplier (HSS) */
-static unsigned char hss_mult[4] = { 8, 12, 16, 0 };
+static unsigned char hss_mult[4] = { 8, 12, 16, 24 };
 
 /*
  * Get the clock frequency as reflected by CCSR and the turbo flag.
Signature · 1 line
1.7.1
#1 lore raw

PATCH 2/3 pxa2xx/cpufreq: Simplify DRI recomputation routine

This patch:
1) Simpifies the DRI recomputation routine by pulling out the common code
2) Fixes a bug in PXA27x DRI recomputation caused by incorrect parenthesis

---
 arch/arm/mach-pxa/cpufreq-pxa2xx.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
arch/arm/mach-pxa/cpufreq-pxa2xx.c +5 -4
index 9e4d981..bb5f21e 100644
@@ -256,12 +256,13 @@ static void init_sdram_rows(void)
 
 static u32 mdrefr_dri(unsigned int freq)
 {
-	u32 dri = 0;
+	u32 dri = freq * SDRAM_TREF / sdram_rows;
 
-	if (cpu_is_pxa25x())
-		dri = ((freq * SDRAM_TREF) / (sdram_rows * 32));
 	if (cpu_is_pxa27x())
-		dri = ((freq * SDRAM_TREF) / (sdram_rows - 31)) / 32;
+		dri -= 31;
+
+	dri /= 32;
+
 	return dri;
 }
 
Signature · 1 line
1.7.1
#4 lore raw

PATCH 3/3 pxa2xx/cpufreq: Fix PCMCIA frequency scaling

In reply to Marek Vasut

The MCxx values must be based off memory clock, not CPU core clock.

This also fixes the bug where on some machines the LCD went crazy while using PCMCIA.

---
 drivers/pcmcia/pxa2xx_base.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
drivers/pcmcia/pxa2xx_base.c +2 -3
index df4532e..f370476 100644
@@ -178,7 +178,6 @@ pxa2xx_pcmcia_frequency_change(struct soc_pcmcia_socket *skt,
 			       unsigned long val,
 			       struct cpufreq_freqs *freqs)
 {
-#warning "it's not clear if this is right since the core CPU (N) clock has no effect on the memory (L) clock"
 	switch (val) {
 	case CPUFREQ_PRECHANGE:
 		if (freqs->new > freqs->old) {
@@ -186,7 +185,7 @@ pxa2xx_pcmcia_frequency_change(struct soc_pcmcia_socket *skt,
 			       "pre-updating\n",
 			       freqs->new / 1000, (freqs->new / 100) % 10,
 			       freqs->old / 1000, (freqs->old / 100) % 10);
-			pxa2xx_pcmcia_set_mcxx(skt, freqs->new);
+			pxa2xx_pcmcia_set_timing(skt);
 		}
 		break;
 
@@ -196,7 +195,7 @@ pxa2xx_pcmcia_frequency_change(struct soc_pcmcia_socket *skt,
 			       "post-updating\n",
 			       freqs->new / 1000, (freqs->new / 100) % 10,
 			       freqs->old / 1000, (freqs->old / 100) % 10);
-			pxa2xx_pcmcia_set_mcxx(skt, freqs->new);
+			pxa2xx_pcmcia_set_timing(skt);
 		}
 		break;
 	}
Signature · 1 line
1.7.1
Applied
#6 lore raw

PATCH 1/3 pxa3xx: Fix HSIO bus x24 multiplier

In reply to Marek Vasut
Quoted 4 lines · Marek Vasut

The value should be 24, not 0 in the possibilities array. It was just a silly mistake.

Applied.

Note, the 312MHz for HSS was not allowed previously until in recent DM this is enabled, so it's not that "silly" :-)

Quoted 21 lines

---
?arch/arm/mach-pxa/pxa3xx.c | ? ?2 +-
?1 files changed, 1 insertions(+), 1 deletions(-)

arch/arm/mach-pxa/pxa3xx.c +0 -0
index f544e58..611622a 100644
@@ -52,7 +52,7 @@
 ?static unsigned char smcfs_mult[8] = { 6, 0, 8, 0, 0, 16, };
 

?/* crystal frequency to HSIO bus frequency multiplier (HSS) */

arch/arm/mach-pxa/pxa3xx.c +1 -1
-static unsigned char hss_mult[4] = { 8, 12, 16, 0 };
+static unsigned char hss_mult[4] = { 8, 12, 16, 24 };

?/*
?* Get the clock frequency as reflected by CCSR and the turbo flag. --
1.7.1

#2 lore raw

PATCH 2/3 pxa2xx/cpufreq: Simplify DRI recomputation routine

In reply to Marek Vasut
Quoted 5 lines · Marek Vasut

This patch:
1) Simpifies the DRI recomputation routine by pulling out the common code
2) Fixes a bug in PXA27x DRI recomputation caused by incorrect parenthesis

Good catch, I've modified it a bit so it's more compact and reable below and I'll apply this to the 'fix' branch.

(quoted diff) +0 -0

b/arch/arm/mach-pxa/cpufreq-pxa2xx.c
index 9e4d981..268a9bc 100644

arch/arm/mach-pxa/cpufreq-pxa2xx.c +2 -6
@@ -256,13 +256,9 @@ static void init_sdram_rows(void)
 
 static u32 mdrefr_dri(unsigned int freq)
 {
-       u32 dri = 0;
+       u32 interval = freq * SDRAM_TREF / sdram_rows;
 
-       if (cpu_is_pxa25x())
-               dri = ((freq * SDRAM_TREF) / (sdram_rows * 32));
-       if (cpu_is_pxa27x())
-               dri = ((freq * SDRAM_TREF) / (sdram_rows - 31)) / 32;
-       return dri;
+       return (interval - (cpu_is_pxa27x() ? 31 : 0)) / 32;
 }
 
 /* find a valid frequency point */
Quoted 30 lines

---
?arch/arm/mach-pxa/cpufreq-pxa2xx.c | ? ?9 +++++---- ?1 files changed, 5 insertions(+), 4 deletions(-)

arch/arm/mach-pxa/cpufreq-pxa2xx.c +5 -5
index 9e4d981..bb5f21e 100644
@@ -256,12 +256,13 @@ static void init_sdram_rows(void)
 
 ?static u32 mdrefr_dri(unsigned int freq)
 ?{
- ? ? ? u32 dri = 0;
+ ? ? ? u32 dri = freq * SDRAM_TREF / sdram_rows;
 
- ? ? ? if (cpu_is_pxa25x())
- ? ? ? ? ? ? ? dri = ((freq * SDRAM_TREF) / (sdram_rows * 32));
 ? ? ? ?if (cpu_is_pxa27x())
- ? ? ? ? ? ? ? dri = ((freq * SDRAM_TREF) / (sdram_rows - 31)) / 32;
+ ? ? ? ? ? ? ? dri -= 31;
+
+ ? ? ? dri /= 32;
+
 ? ? ? ?return dri;
 ?}
 
--

1.7.1

Applied
#5 lore raw

PATCH 3/3 pxa2xx/cpufreq: Fix PCMCIA frequency scaling

In reply to Marek Vasut
Quoted 6 lines · Marek Vasut

The MCxx values must be based off memory clock, not CPU core clock.

This also fixes the bug where on some machines the LCD went crazy while using PCMCIA.

+ Reviewed-by: Robert Jarzmik <[email protected]>

Applied to 'fix'.

Quoted 38 lines

---
?drivers/pcmcia/pxa2xx_base.c | ? ?5 ++---
?1 files changed, 2 insertions(+), 3 deletions(-)

drivers/pcmcia/pxa2xx_base.c +0 -1
index df4532e..f370476 100644
@@ -178,7 +178,6 @@ pxa2xx_pcmcia_frequency_change(struct soc_pcmcia_socket *skt,
 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? unsigned long val,
 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? struct cpufreq_freqs *freqs)
 ?{
-#warning "it's not clear if this is right since the core CPU (N) clock has no effect on the memory (L) clock"
 ? ? ? ?switch (val) {

? ? ? ?case CPUFREQ_PRECHANGE:
? ? ? ? ? ? ? ?if (freqs->new > freqs->old) {

drivers/pcmcia/pxa2xx_base.c +2 -3
@@ -186,7 +185,7 @@ pxa2xx_pcmcia_frequency_change(struct soc_pcmcia_socket *skt,
 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? "pre-updating\n",
 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? freqs->new / 1000, (freqs->new / 100) % 10,
 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? freqs->old / 1000, (freqs->old / 100) % 10);
- ? ? ? ? ? ? ? ? ? ? ? pxa2xx_pcmcia_set_mcxx(skt, freqs->new);
+ ? ? ? ? ? ? ? ? ? ? ? pxa2xx_pcmcia_set_timing(skt);
 ? ? ? ? ? ? ? ?}
 ? ? ? ? ? ? ? ?break;
 
@@ -196,7 +195,7 @@ pxa2xx_pcmcia_frequency_change(struct soc_pcmcia_socket *skt,
 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? "post-updating\n",
 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? freqs->new / 1000, (freqs->new / 100) % 10,
 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? freqs->old / 1000, (freqs->old / 100) % 10);
- ? ? ? ? ? ? ? ? ? ? ? pxa2xx_pcmcia_set_mcxx(skt, freqs->new);
+ ? ? ? ? ? ? ? ? ? ? ? pxa2xx_pcmcia_set_timing(skt);
 ? ? ? ? ? ? ? ?}
 ? ? ? ? ? ? ? ?break;
 ? ? ? ?}
--

1.7.1

#3 lore raw

PATCH 2/3 pxa2xx/cpufreq: Simplify DRI recomputation routine

In reply to Eric Miao

Dne Po 28. ?ervna 2010 06:38:16 Eric Miao napsal(a):

Quoted 10 lines · Marek Vasut
Quoted 6 lines

This patch:
1) Simpifies the DRI recomputation routine by pulling out the common code
2) Fixes a bug in PXA27x DRI recomputation caused by incorrect parenthesis

Good catch, I've modified it a bit so it's more compact and reable below and I'll apply this to the 'fix' branch.

Ewww ... I'm kind-of missing the readability now ;-)

But I guess if you look into it for a long enough time, it's ok.

Quoted 51 lines
arch/arm/mach-pxa/cpufreq-pxa2xx.c +2 -6
index 9e4d981..268a9bc 100644
@@ -256,13 +256,9 @@ static void init_sdram_rows(void)
 
 static u32 mdrefr_dri(unsigned int freq)
 {
-       u32 dri = 0;
+       u32 interval = freq * SDRAM_TREF / sdram_rows;
 
-       if (cpu_is_pxa25x())
-               dri = ((freq * SDRAM_TREF) / (sdram_rows * 32));
-       if (cpu_is_pxa27x())
-               dri = ((freq * SDRAM_TREF) / (sdram_rows - 31)) / 32;
-       return dri;
+       return (interval - (cpu_is_pxa27x() ? 31 : 0)) / 32;
 }
 
 /* find a valid frequency point */
Quoted 29 lines
---
 arch/arm/mach-pxa/cpufreq-pxa2xx.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
(quoted diff) +0 -0

b/arch/arm/mach-pxa/cpufreq-pxa2xx.c index 9e4d981..bb5f21e 100644

arch/arm/mach-pxa/cpufreq-pxa2xx.c +5 -5
@@ -256,12 +256,13 @@ static void init_sdram_rows(void)
 
 static u32 mdrefr_dri(unsigned int freq)
 {
-       u32 dri = 0;
+       u32 dri = freq * SDRAM_TREF / sdram_rows;
 
-       if (cpu_is_pxa25x())
-               dri = ((freq * SDRAM_TREF) / (sdram_rows * 32));
       if (cpu_is_pxa27x())
-               dri = ((freq * SDRAM_TREF) / (sdram_rows - 31)) / 32;
+               dri -= 31;
+
+       dri /= 32;
+
       return dri;
 }
 
--

1.7.1