Skip to contentSkip to conversation

pm9263: lowlevel init update

PATCH New Jean-Christophe PLAGNIOL-VILLARD 1 participant 2 messages May 1, 2009

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

PATCH 1/2 pm9263: lowlevel init update

move PSRAM init to pm9263_lcd_hw_psram_init

---
 board/ronetix/pm9263/lowlevel_init.S |   17 +----------------
 board/ronetix/pm9263/pm9263.c        |   21 +++++++++++++++++++++
 include/configs/pm9263.h             |   10 +---------
 3 files changed, 23 insertions(+), 25 deletions(-)
board/ronetix/pm9263/lowlevel_init.S +1 -16
index c048c91..561722c 100644
@@ -194,12 +194,10 @@ SMRDATA:
 
 	.word (AT91_BASE_SYS + AT91_MATRIX_EBI0CSA)
 	.word CONFIG_SYS_MATRIX_EBI0CSA_VAL
-	.word (AT91_BASE_SYS + AT91_MATRIX_EBI1CSA)
-	.word CONFIG_SYS_MATRIX_EBI1CSA_VAL
 
 	/* flash */
 	.word (AT91_BASE_SYS + AT91_SMC_MODE(0))
-	.word CONFIG_SYS_SMC0_CTRL0_VAL
+	.word CONFIG_SYS_SMC0_MODE0_VAL
 
 	.word (AT91_BASE_SYS + AT91_SMC_CYCLE(0))
 	.word CONFIG_SYS_SMC0_CYCLE0_VAL
@@ -210,19 +208,6 @@ SMRDATA:
 	.word (AT91_BASE_SYS + AT91_SMC_SETUP(0))
 	.word CONFIG_SYS_SMC0_SETUP0_VAL
 
-	/* PSRAM */
-	.word (AT91_BASE_SYS + AT91_SMC1_MODE(0))
-	.word CONFIG_SYS_SMC1_CTRL0_VAL
-
-	.word (AT91_BASE_SYS + AT91_SMC1_CYCLE(0))
-	.word CONFIG_SYS_SMC1_CYCLE0_VAL
-
-	.word (AT91_BASE_SYS + AT91_SMC1_PULSE(0))
-	.word CONFIG_SYS_SMC1_PULSE0_VAL
-
-	.word (AT91_BASE_SYS + AT91_SMC1_SETUP(0))
-	.word CONFIG_SYS_SMC1_SETUP0_VAL
-
 SMRDATA1:
 	.word (AT91_BASE_SYS + AT91_SDRAMC_MR)
 	.word CONFIG_SYS_SDRC_MR_VAL1
board/ronetix/pm9263/pm9263.c +21 -0
index d24ef9a..cfac897 100644
@@ -165,6 +165,27 @@ void lcd_disable(void)
 static int pm9263_lcd_hw_psram_init(void)
 {
 	volatile uint16_t x;
+	unsigned long csa;
+
+	/* Enable CS3  3.3v, no pull-ups */
+	csa = at91_sys_read(AT91_MATRIX_EBI1CSA);
+	at91_sys_write(AT91_MATRIX_EBI1CSA,
+		       csa | AT91_MATRIX_EBI1_DBPUC |
+		       AT91_MATRIX_EBI1_VDDIOMSEL_3_3V);
+
+	/* Configure SMC1 CS0 for PSRAM - 16-bit */
+	at91_sys_write(AT91_SMC1_SETUP(0),
+		       AT91_SMC_NWESETUP_(0) | AT91_SMC_NCS_WRSETUP_(0) |
+		       AT91_SMC_NRDSETUP_(0) | AT91_SMC_NCS_RDSETUP_(0));
+	at91_sys_write(AT91_SMC1_PULSE(0),
+		       AT91_SMC_NWEPULSE_(7) | AT91_SMC_NCS_WRPULSE_(7) |
+		       AT91_SMC_NRDPULSE_(2) | AT91_SMC_NCS_RDPULSE_(7));
+	at91_sys_write(AT91_SMC1_CYCLE(0),
+		       AT91_SMC_NWECYCLE_(8) | AT91_SMC_NRDCYCLE_(8));
+	at91_sys_write(AT91_SMC1_MODE(0),
+		       AT91_SMC_DBW_16 |
+		       AT91_SMC_PMEN |
+		       AT91_SMC_PS_32);
 
 	/* setup PB29 as output */
 	at91_set_gpio_output(PSRAM_CRE_PIN, 1);
include/configs/pm9263.h +1 -9
index 0db17b3..5729acd 100644
@@ -68,8 +68,6 @@
 #define CONFIG_SYS_PIOD_PPUDR_VAL	0xFFFF0000
 /* EBI0_CSA, CS1 SDRAM, CS3 NAND Flash, 3.3V memories */
 #define CONFIG_SYS_MATRIX_EBI0CSA_VAL	0x0001010A
-/* EBI1_CSA, 3.3v, no pull-ups */
-#define CONFIG_SYS_MATRIX_EBI1CSA_VAL	0x00010100
 
 /* SDRAM */
 /* SDRAMC_MR Mode register */
@@ -101,13 +99,7 @@
 #define CONFIG_SYS_SMC0_SETUP0_VAL	0x0A0A0A0A	/* SMC_SETUP */
 #define CONFIG_SYS_SMC0_PULSE0_VAL	0x0B0B0B0B	/* SMC_PULSE */
 #define CONFIG_SYS_SMC0_CYCLE0_VAL	0x00160016	/* SMC_CYCLE */
-#define CONFIG_SYS_SMC0_CTRL0_VAL	0x00161003	/* SMC_MODE */
-
-/* setup SMC1, CS0 (PSRAM) - 16-bit */
-#define CONFIG_SYS_SMC1_SETUP0_VAL	0x00000000	/* SMC_SETUP */
-#define CONFIG_SYS_SMC1_PULSE0_VAL	0x07020707	/* SMC_PULSE */
-#define CONFIG_SYS_SMC1_CYCLE0_VAL	0x00080008	/* SMC_CYCLE */
-#define CONFIG_SYS_SMC1_CTRL0_VAL	0x31001000	/* SMC_MODE */
+#define CONFIG_SYS_SMC0_MODE0_VAL	0x00161003	/* SMC_MODE */
 
 #define CONFIG_SYS_RSTC_RMR_VAL		0xA5000301	/* user reset enable */
 
Signature · 1 line
1.6.1.3
#1 lore raw

PATCH 2/2 pm9263: use macro instead of hardcode value for the lowlevel_init

optimize a few the RAM init

---
 board/ronetix/pm9263/lowlevel_init.S |    2 +-
 board/ronetix/pm9263/pm9263.c        |    2 +-
 include/asm-arm/arch-at91/at91_pmc.h |    1 +
 include/configs/pm9263.h             |  105 +++++++++++++++++++++++++--------
 4 files changed, 82 insertions(+), 28 deletions(-)
board/ronetix/pm9263/lowlevel_init.S +1 -1
index 561722c..b139c89 100644
@@ -87,7 +87,7 @@ POS1:
  */
 	ldr	r1, =(AT91_BASE_SYS + AT91_CKGR_MOR)
 	ldr	r2, =(AT91_BASE_SYS + AT91_PMC_SR)
-	ldr	r0, =0x0000FF01
+	ldr	r0, =CONFIG_SYS_MOR_VAL
 	str	r0, [r1]	/* Enable main oscillator, OSCOUNT = 0xFF */
 
 	/* Reading the PMC Status to detect when the Main Oscillator is enabled */
board/ronetix/pm9263/pm9263.c +1 -1
index cfac897..52b6bb4 100644
@@ -239,7 +239,7 @@ static int pm9263_lcd_hw_psram_init(void)
 	at91_sys_write( AT91_MATRIX_SCFG5, AT91_MATRIX_ARBT_FIXED_PRIORITY |
 				(AT91_MATRIX_FIXED_DEFMSTR & (5 << 18)) |
 				AT91_MATRIX_DEFMSTR_TYPE_FIXED |
-				(AT91_MATRIX_SLOT_CYCLE & (0x80 << 0)));
+				(AT91_MATRIX_SLOT_CYCLE & (0xFF << 0)));
 
 	return 0;
 }
include/asm-arm/arch-at91/at91_pmc.h +1 -0
index 07580da..a82955c 100644
@@ -65,6 +65,7 @@
 #define			AT91_PMC_USBDIV_2		(1 << 28)
 #define			AT91_PMC_USBDIV_4		(2 << 28)
 #define		AT91_PMC_USB96M		(1     << 28)		/* Divider by 2 Enable (PLLB only) */
+#define		AT91_PMC_PLLA_WR_ERRATA	(1     << 29)		/* Bit 29 must always be set to 1 when programming the CKGR_PLLAR register */
 
 #define	AT91_PMC_MCKR		(AT91_PMC + 0x30)	/* Master Clock Register */
 #define		AT91_PMC_CSS		(3 <<  0)		/* Master Clock Selection */
include/configs/pm9263.h +81 -28

153 lines not on this page · raw message

Signature · 1 line
1.6.1.3