Skip to contentSkip to conversation

MX28: Drop the cp15 reconfiguration from SPL

PATCH New Marek Vasut 2 participants 6 messages Aug 6, 2012 – Aug 20, 2012 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 MX28: Drop the cp15 reconfiguration from SPL

The SPL doesn't need the CP15 reconfiguration, as that's what the BootROM does for us already. Moreover, when the CP15 is reconfigured and the code returns control to BootROM, the USB boot works no more.

Remove the code and allow [1] to work properly as well.

[1] http://git.bfuser.eu/?p=marex/mxsldr.git;a=summary

Cc Stefano Babic <[email protected]>
Cc Fabio Estevam <[email protected]>
---
 arch/arm/cpu/arm926ejs/mx28/start.S |   42 -----------------------------------
 1 file changed, 42 deletions(-)
arch/arm/cpu/arm926ejs/mx28/start.S +0 -42
index e572b78..7ccd337 100644
@@ -180,14 +180,6 @@ _reset:
 	orr	r0,r0,#0xd3
 	msr	cpsr,r0
 
-	/*
-	 * we do sys-critical inits only at reboot,
-	 * not when booting from ram!
-	 */
-#ifndef CONFIG_SKIP_LOWLEVEL_INIT
-	bl	cpu_init_crit
-#endif
-
 	bl	board_init_ll
 
 	/*
@@ -207,40 +199,6 @@ _reset:
 	pop	{r0-r12,r14}
 	bx	lr
 
-/*
- *************************************************************************
- *
- * CPU_init_critical registers
- *
- * setup important registers
- * setup memory timing
- *
- *************************************************************************
- */
-#ifndef CONFIG_SKIP_LOWLEVEL_INIT
-cpu_init_crit:
-	/*
-	 * flush v4 I/D caches
-	 */
-	mov	r0, #0
-	mcr	p15, 0, r0, c7, c7, 0	/* flush v3/v4 cache */
-	mcr	p15, 0, r0, c8, c7, 0	/* flush v4 TLB */
-
-	/*
-	 * disable MMU stuff and caches
-	 */
-	mrc	p15, 0, r0, c1, c0, 0
-	bic	r0, r0, #0x00002300	/* clear bits 13, 9:8 (--V- --RS) */
-	bic	r0, r0, #0x00000087	/* clear bits 7, 2:0 (B--- -CAM) */
-	orr	r0, r0, #0x00000002	/* set bit 2 (A) Align */
-	orr	r0, r0, #0x00001000	/* set bit 12 (I) I-Cache */
-	mcr	p15, 0, r0, c1, c0, 0
-
-	mov	pc, lr		/* back to my caller */
-
-	.align	5
-#endif /* CONFIG_SKIP_LOWLEVEL_INIT */
-
 _hang:
 	ldr	sp, _TEXT_BASE			/* switch to abort stack */
 1:
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 2/2 MX28: Shuffle around the power management code

Move some function calls to a more appropriate place, so they're called only when needed.

Cc Stefano Babic <[email protected]>
Cc Fabio Estevam <[email protected]>
---
 arch/arm/cpu/arm926ejs/mx28/spl_power_init.c |    9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
arch/arm/cpu/arm926ejs/mx28/spl_power_init.c +3 -6
index 4b09b0c..e06e6d6 100644
@@ -657,17 +657,14 @@ void mx28_power_configure_power_source(void)
 
 	mx28_src_power_init();
 
-	batt_ready = mx28_is_batt_ready();
-
 	if (readl(&power_regs->hw_power_sts) & POWER_STS_VDD5V_GT_VDDIO) {
-		batt_good = mx28_is_batt_good();
+		batt_ready = mx28_is_batt_ready();
 		if (batt_ready) {
 			/* 5V source detected, good battery detected. */
 			mx28_batt_boot();
 		} else {
-			if (batt_good) {
-				/* 5V source detected, low battery detceted. */
-			} else {
+			batt_good = mx28_is_batt_good();
+			if (!batt_good) {
 				/* 5V source detected, bad battery detected. */
 				writel(LRADC_CONVERSION_AUTOMATIC,
 					&lradc_regs->hw_lradc_conversion_clr);
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH 2/2 MX28: Shuffle around the power management code

Quoted 26 lines · Marek Vasut

Move some function calls to a more appropriate place, so they're called only when needed.

Cc Stefano Babic <[email protected]>
Cc Fabio Estevam <[email protected]>
---
 arch/arm/cpu/arm926ejs/mx28/spl_power_init.c |    9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
arch/arm/cpu/arm926ejs/mx28/spl_power_init.c +1 -3
index 4b09b0c..e06e6d6 100644
@@ -657,17 +657,14 @@ void mx28_power_configure_power_source(void)
 
 	mx28_src_power_init();
 
-	batt_ready = mx28_is_batt_ready();
-
 	if (readl(&power_regs->hw_power_sts) & POWER_STS_VDD5V_GT_VDDIO) {
-		batt_good = mx28_is_batt_good();
+		batt_ready = mx28_is_batt_ready();
 		if (batt_ready) {
 			/* 5V source detected, good battery detected. */

arch/arm/cpu/arm926ejs/mx28/spl_power_init.c void mx28_power_configure_power_source(void) · line 670

Quoted 10 lines
arch/arm/cpu/arm926ejs/mx28/spl_power_init.c +2 -3
 			mx28_batt_boot();
 		} else {
-			if (batt_good) {
-				/* 5V source detected, low battery detceted. */
-			} else {
+			batt_good = mx28_is_batt_good();
+			if (!batt_good) {
 				/* 5V source detected, bad battery detected. */
 				writel(LRADC_CONVERSION_AUTOMATIC,
 					&lradc_regs->hw_lradc_conversion_clr);

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#3 lore raw

PATCH 2/2 MX28: Shuffle around the power management code

In reply to Marek Vasut
Quoted 26 lines · Marek Vasut

Move some function calls to a more appropriate place, so they're called only when needed.

Cc Stefano Babic <[email protected]>
Cc Fabio Estevam <[email protected]>
---
 arch/arm/cpu/arm926ejs/mx28/spl_power_init.c |    9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
arch/arm/cpu/arm926ejs/mx28/spl_power_init.c +1 -3
index 4b09b0c..e06e6d6 100644
@@ -657,17 +657,14 @@ void mx28_power_configure_power_source(void)
 
 	mx28_src_power_init();
 
-	batt_ready = mx28_is_batt_ready();
-
 	if (readl(&power_regs->hw_power_sts) & POWER_STS_VDD5V_GT_VDDIO) {
-		batt_good = mx28_is_batt_good();
+		batt_ready = mx28_is_batt_ready();
 		if (batt_ready) {
 			/* 5V source detected, good battery detected. */

arch/arm/cpu/arm926ejs/mx28/spl_power_init.c void mx28_power_configure_power_source(void) · line 670

Quoted 10 lines
arch/arm/cpu/arm926ejs/mx28/spl_power_init.c +2 -3
 			mx28_batt_boot();
 		} else {
-			if (batt_good) {
-				/* 5V source detected, low battery detceted. */
-			} else {
+			batt_good = mx28_is_batt_good();
+			if (!batt_good) {
 				/* 5V source detected, bad battery detected. */
 				writel(LRADC_CONVERSION_AUTOMATIC,
 					&lradc_regs->hw_lradc_conversion_clr);

Applied to u-boot-imx, thanks.

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#4 lore raw

PATCH 1/2 MX28: Drop the cp15 reconfiguration from SPL

In reply to Marek Vasut
Quoted 66 lines · Marek Vasut

The SPL doesn't need the CP15 reconfiguration, as that's what the BootROM does for us already. Moreover, when the CP15 is reconfigured and the code returns control to BootROM, the USB boot works no more.

Remove the code and allow [1] to work properly as well.

[1] http://git.bfuser.eu/?p=marex/mxsldr.git;a=summary

Cc Stefano Babic <[email protected]>
Cc Fabio Estevam <[email protected]>
---
 arch/arm/cpu/arm926ejs/mx28/start.S |   42 -----------------------------------
 1 file changed, 42 deletions(-)
arch/arm/cpu/arm926ejs/mx28/start.S +0 -35
index e572b78..7ccd337 100644
@@ -180,14 +180,6 @@ _reset:
 	orr	r0,r0,#0xd3
 	msr	cpsr,r0
 
-	/*
-	 * we do sys-critical inits only at reboot,
-	 * not when booting from ram!
-	 */
-#ifndef CONFIG_SKIP_LOWLEVEL_INIT
-	bl	cpu_init_crit
-#endif
-
 	bl	board_init_ll
 
 	/*
@@ -207,40 +199,6 @@ _reset:
 	pop	{r0-r12,r14}
 	bx	lr
 
-/*
- *************************************************************************
- *
- * CPU_init_critical registers
- *
- * setup important registers
- * setup memory timing
- *
- *************************************************************************
- */
-#ifndef CONFIG_SKIP_LOWLEVEL_INIT
-cpu_init_crit:
-	/*
-	 * flush v4 I/D caches
-	 */
-	mov	r0, #0
-	mcr	p15, 0, r0, c7, c7, 0	/* flush v3/v4 cache */
-	mcr	p15, 0, r0, c8, c7, 0	/* flush v4 TLB */
-
-	/*
-	 * disable MMU stuff and caches
-	 */
-	mrc	p15, 0, r0, c1, c0, 0
-	bic	r0, r0, #0x00002300	/* clear bits 13, 9:8 (--V- --RS) */
-	bic	r0, r0, #0x00000087	/* clear bits 7, 2:0 (B--- -CAM) */
-	orr	r0, r0, #0x00000002	/* set bit 2 (A) Align */
-	orr	r0, r0, #0x00001000	/* set bit 12 (I) I-Cache */

arch/arm/cpu/arm926ejs/mx28/start.S _reset: · line 204

Quoted 10 lines
arch/arm/cpu/arm926ejs/mx28/start.S +0 -7
-	mcr	p15, 0, r0, c1, c0, 0
-
-	mov	pc, lr		/* back to my caller */
-
-	.align	5
-#endif /* CONFIG_SKIP_LOWLEVEL_INIT */
-
 _hang:
 	ldr	sp, _TEXT_BASE			/* switch to abort stack */
 1:

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#5 lore raw

PATCH 1/2 MX28: Drop the cp15 reconfiguration from SPL

In reply to Marek Vasut
Quoted 4 lines · Marek Vasut

The SPL doesn't need the CP15 reconfiguration, as that's what the BootROM does for us already. Moreover, when the CP15 is reconfigured and the code returns control to BootROM, the USB boot works no more.

Quoted 8 lines

Remove the code and allow [1] to work properly as well.

[1] http://git.bfuser.eu/?p=marex/mxsldr.git;a=summary

Cc Stefano Babic <[email protected]>
Cc Fabio Estevam <[email protected]>

---

Applied to u-boot-imx, thanks.

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================