Skip to contentSkip to conversation

ARM pcm043: Use PDR0 to change cpu freq

PATCH In review Teresa Gámez 2 participants 5 messages Aug 22, 2011 – Aug 23, 2011

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

PATCH v2 1/2 ARM pcm043: Use PDR0 to change cpu freq

Instead of changing the MPCTL to set an other cpu frequency, use the post divider.

This prevents freezing when changing the clock from 399MHz to 532MHz.

---
 arch/arm/boards/pcm043/pcm043.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
arch/arm/boards/pcm043/pcm043.c +4 -4
index 966899a..5cd6432 100644
@@ -301,8 +301,8 @@ static int pcm043_core_setup(void)
 
 core_initcall(pcm043_core_setup);
 
-#define MPCTL_PARAM_399     (IMX_PLL_PD(0) | IMX_PLL_MFD(15) | IMX_PLL_MFI(8) | IMX_PLL_MFN(5))
-#define MPCTL_PARAM_532     ((1 << 31) | IMX_PLL_PD(0) | IMX_PLL_MFD(11) | IMX_PLL_MFI(11) | IMX_PLL_MFN(1))
+#define CCM_PDR0_PARAM_399	((1 << 12) | (1 << 16))
+#define CCM_PDR0_PARAM_532	(1 << 12)
 
 static int do_cpufreq(struct command *cmdtp, int argc, char *argv[])
 {
@@ -315,10 +315,10 @@ static int do_cpufreq(struct command *cmdtp, int argc, char *argv[])
 
 	switch (freq) {
 	case 399:
-		writel(MPCTL_PARAM_399, IMX_CCM_BASE + CCM_MPCTL);
+		writel(CCM_PDR0_PARAM_399, IMX_CCM_BASE + CCM_PDR0);
 		break;
 	case 532:
-		writel(MPCTL_PARAM_532, IMX_CCM_BASE + CCM_MPCTL);
+		writel(CCM_PDR0_PARAM_532, IMX_CCM_BASE + CCM_PDR0);
 		break;
 	default:
 		return COMMAND_ERROR_USAGE;
Signature · 7 lines
1.7.0.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw

PATCH v2 2/2 ARM pcm043: change RAM timings

Update RAM timing for new sdrams (IS43DR16320B). RAM timings are reworked with extended row cycle delay. Timings where also tested with older sdrams (MT47H32M16).

---
 arch/arm/boards/pcm043/lowlevel.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/boards/pcm043/lowlevel.c +1 -1
index eff96f9..bbe586b 100644
@@ -146,7 +146,7 @@ void __bare_init __naked board_init_lowlevel(void)
 	writel(0x00000304, ESDMISC); /* was 0x00000004 */
 
 	/* set timing paramters */
-	writel(0x00255417, ESDCFG0);
+	writel(0x0025541F, ESDCFG0);
 	/* select Precharge-All mode */
 	writel(0x92220000, ESDCTL0);
 	/* Precharge-All */
Signature · 7 lines
1.7.0.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw
In reply to Teresa Gámez

Hi Teresa,

Quoted 4 lines · Teresa Gámez

Instead of changing the MPCTL to set an other cpu frequency, use the post divider.

This prevents freezing when changing the clock from 399MHz to 532MHz.

Originally this command was meant for debugging purposes. The pcm043 comes up with 532MHz and there should be no need to change the frequency. I remember that some boards are able to run barebox with 532MHz but don't manage to start the kernel with this frequency. Also I have one board which does not run with 532MHz at all, but I think it's an early development sample.
Is there a need to run boards with a lower frequency than they are able to do? Otherwise, if some boards are not stable at the default 532MHz I suggest we should also lower the default to 399MHz.

Sascha

Quoted 42 lines
---
 arch/arm/boards/pcm043/pcm043.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
arch/arm/boards/pcm043/pcm043.c +4 -4
index 966899a..5cd6432 100644
@@ -301,8 +301,8 @@ static int pcm043_core_setup(void)
 
 core_initcall(pcm043_core_setup);
 
-#define MPCTL_PARAM_399     (IMX_PLL_PD(0) | IMX_PLL_MFD(15) | IMX_PLL_MFI(8) | IMX_PLL_MFN(5))
-#define MPCTL_PARAM_532     ((1 << 31) | IMX_PLL_PD(0) | IMX_PLL_MFD(11) | IMX_PLL_MFI(11) | IMX_PLL_MFN(1))
+#define CCM_PDR0_PARAM_399	((1 << 12) | (1 << 16))
+#define CCM_PDR0_PARAM_532	(1 << 12)
 
 static int do_cpufreq(struct command *cmdtp, int argc, char *argv[])
 {
@@ -315,10 +315,10 @@ static int do_cpufreq(struct command *cmdtp, int argc, char *argv[])
 
 	switch (freq) {
 	case 399:
-		writel(MPCTL_PARAM_399, IMX_CCM_BASE + CCM_MPCTL);
+		writel(CCM_PDR0_PARAM_399, IMX_CCM_BASE + CCM_PDR0);
 		break;
 	case 532:
-		writel(MPCTL_PARAM_532, IMX_CCM_BASE + CCM_MPCTL);
+		writel(CCM_PDR0_PARAM_532, IMX_CCM_BASE + CCM_PDR0);
 		break;
 	default:
 		return COMMAND_ERROR_USAGE;
Signature · 7 lines
1.7.0.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 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 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#3 lore raw

Am Montag, den 22.08.2011, 19:27 +0200 schrieb Sascha Hauer:

Quoted 8 lines

Hi Teresa,

Quoted 4 lines · Teresa Gámez

Instead of changing the MPCTL to set an other cpu frequency, use the post divider.

This prevents freezing when changing the clock from 399MHz to 532MHz.

Quoted 9 lines

Originally this command was meant for debugging purposes. The pcm043 comes up with 532MHz and there should be no need to change the frequency. I remember that some boards are able to run barebox with 532MHz but don't manage to start the kernel with this frequency. Also I have one board which does not run with 532MHz at all, but I think it's an early development sample.
Is there a need to run boards with a lower frequency than they are able to do? Otherwise, if some boards are not stable at the default 532MHz I suggest we should also lower the default to 399MHz.

Yes, there where different problems with older i.MX35 modules so that the frequency was lowered to 399MHz.
For the revision 1315.4 we made some PCB optimizations to run the pcm043 safe with 532MHz. Additionally we switched the silicon revision to TO 2.1. So it is ensured that all pcm043 with >= TO 2.1 run with 532MHz. For that case we made a patch (for u-boot-v2) that checks the silicon revision and sets up the frequency post divider accordingly.
I'll update the patch and send it.

Teresa

Quoted 41 lines

Sascha

Quoted 38 lines
---
 arch/arm/boards/pcm043/pcm043.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
arch/arm/boards/pcm043/pcm043.c +4 -4
index 966899a..5cd6432 100644
@@ -301,8 +301,8 @@ static int pcm043_core_setup(void)
 
 core_initcall(pcm043_core_setup);
 
-#define MPCTL_PARAM_399     (IMX_PLL_PD(0) | IMX_PLL_MFD(15) | IMX_PLL_MFI(8) | IMX_PLL_MFN(5))
-#define MPCTL_PARAM_532     ((1 << 31) | IMX_PLL_PD(0) | IMX_PLL_MFD(11) | IMX_PLL_MFI(11) | IMX_PLL_MFN(1))
+#define CCM_PDR0_PARAM_399	((1 << 12) | (1 << 16))
+#define CCM_PDR0_PARAM_532	(1 << 12)
 
 static int do_cpufreq(struct command *cmdtp, int argc, char *argv[])
 {
@@ -315,10 +315,10 @@ static int do_cpufreq(struct command *cmdtp, int argc, char *argv[])
 
 	switch (freq) {
 	case 399:
-		writel(MPCTL_PARAM_399, IMX_CCM_BASE + CCM_MPCTL);
+		writel(CCM_PDR0_PARAM_399, IMX_CCM_BASE + CCM_PDR0);
 		break;
 	case 532:
-		writel(MPCTL_PARAM_532, IMX_CCM_BASE + CCM_MPCTL);
+		writel(CCM_PDR0_PARAM_532, IMX_CCM_BASE + CCM_PDR0);
 		break;
 	default:
 		return COMMAND_ERROR_USAGE;
Signature · 1 line
1.7.0.4
Quoted 5 lines
Quoted 4 lines

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#4 lore raw
Quoted 19 lines · Teresa Gamez

Am Montag, den 22.08.2011, 19:27 +0200 schrieb Sascha Hauer:

Quoted 8 lines

Hi Teresa,

Quoted 4 lines · Teresa Gámez

Instead of changing the MPCTL to set an other cpu frequency, use the post divider.

This prevents freezing when changing the clock from 399MHz to 532MHz.

Quoted 9 lines

Originally this command was meant for debugging purposes. The pcm043 comes up with 532MHz and there should be no need to change the frequency. I remember that some boards are able to run barebox with 532MHz but don't manage to start the kernel with this frequency. Also I have one board which does not run with 532MHz at all, but I think it's an early development sample.
Is there a need to run boards with a lower frequency than they are able to do? Otherwise, if some boards are not stable at the default 532MHz I suggest we should also lower the default to 399MHz.

Quoted 8 lines

Yes, there where different problems with older i.MX35 modules so that the frequency was lowered to 399MHz.
For the revision 1315.4 we made some PCB optimizations to run the pcm043 safe with 532MHz. Additionally we switched the silicon revision to TO 2.1. So it is ensured that all pcm043 with >= TO 2.1 run with 532MHz. For that case we made a patch (for u-boot-v2) that checks the silicon revision and sets up the frequency post divider accordingly.
I'll update the patch and send it.

Thanks. This looks like a sane solution.

Sascha

Quoted 52 lines

Teresa

Quoted 46 lines

Sascha

Quoted 42 lines
---
 arch/arm/boards/pcm043/pcm043.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
arch/arm/boards/pcm043/pcm043.c +4 -4
index 966899a..5cd6432 100644
@@ -301,8 +301,8 @@ static int pcm043_core_setup(void)
 
 core_initcall(pcm043_core_setup);
 
-#define MPCTL_PARAM_399     (IMX_PLL_PD(0) | IMX_PLL_MFD(15) | IMX_PLL_MFI(8) | IMX_PLL_MFN(5))
-#define MPCTL_PARAM_532     ((1 << 31) | IMX_PLL_PD(0) | IMX_PLL_MFD(11) | IMX_PLL_MFI(11) | IMX_PLL_MFN(1))
+#define CCM_PDR0_PARAM_399	((1 << 12) | (1 << 16))
+#define CCM_PDR0_PARAM_532	(1 << 12)
 
 static int do_cpufreq(struct command *cmdtp, int argc, char *argv[])
 {
@@ -315,10 +315,10 @@ static int do_cpufreq(struct command *cmdtp, int argc, char *argv[])
 
 	switch (freq) {
 	case 399:
-		writel(MPCTL_PARAM_399, IMX_CCM_BASE + CCM_MPCTL);
+		writel(CCM_PDR0_PARAM_399, IMX_CCM_BASE + CCM_PDR0);
 		break;
 	case 532:
-		writel(MPCTL_PARAM_532, IMX_CCM_BASE + CCM_MPCTL);
+		writel(CCM_PDR0_PARAM_532, IMX_CCM_BASE + CCM_PDR0);
 		break;
 	default:
 		return COMMAND_ERROR_USAGE;
Signature · 7 lines
1.7.0.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 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 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox