Skip to contentSkip to conversation

ppc4xx: Replace 4xx lowercase SPR references

PATCH New Matthias Fuchs 3 participants 5 messages Jul 22, 2009 – Jul 24, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ppc4xx: Replace 4xx lowercase SPR references

---
This patch replaces my patch from yesterday titled

[PATCH V2] ppc4xx: use SPRN_TCR macro instead of tcr

 board/esd/pmc440/pmc440.c   |    2 +-
 board/mpl/mip405/mip405.c   |    2 +-
 board/mpl/pip405/pip405.c   |    2 +-
 board/netstal/hcu5/hcu5.c   |    8 +-
 board/netstal/hcu5/sdram.c  |    4 +-
 board/netstal/mcu25/mcu25.c |    2 +-
 cpu/ppc4xx/cpu.c            |    8 +-
 cpu/ppc4xx/cpu_init.c       |    2 +-
 cpu/ppc4xx/interrupts.c     |   18 ++--
 cpu/ppc4xx/speed.c          |    3 +-
 cpu/ppc4xx/start.S          |  206 +++++++++++++++++++++---------------------
 include/asm-ppc/processor.h |   46 ++++++++++
 include/ppc405.h            |   55 ------------
 include/ppc440.h            |   93 -------------------
 post/cpu/ppc4xx/fpu.c       |    6 +-
 15 files changed, 178 insertions(+), 279 deletions(-)
board/esd/pmc440/pmc440.c +1 -1
index 2ab944d..f22a1c2 100644
@@ -142,7 +142,7 @@ int board_early_init_f(void)
 		reg |= CPR0_ICFG_RLI_MASK;
 		mtcpr(clk_icfg, reg);
 
-		mtspr(dbcr0, 0x20000000); /* do chip reset */
+		mtspr(SPRN_DBCR0, 0x20000000); /* do chip reset */
 	}
 
 	/*
board/mpl/mip405/mip405.c +1 -1
index 24caa46..1738f54 100644
@@ -688,7 +688,7 @@ int misc_init_r (void)
 	start=get_timer(0);
 	/* if MIP405 has booted from PCI, reset CCR0[24] as described in errata PCI_18 */
 	if (mfdcr(strap) & PSR_ROM_LOC)
-	       mtspr(ccr0, (mfspr(ccr0) & ~0x80));
+	       mtspr(SPRN_CCR0, (mfspr(SPRN_CCR0) & ~0x80));
 
 	return (0);
 }
board/mpl/pip405/pip405.c +1 -1
index f31a5e8..677437d 100644
@@ -669,7 +669,7 @@ int misc_init_r (void)
 
 	/* if PIP405 has booted from PCI, reset CCR0[24] as described in errata PCI_18 */
 	if (mfdcr(strap) & PSR_ROM_LOC)
-	       mtspr(ccr0, (mfspr(ccr0) & ~0x80));
+	       mtspr(SPRN_CCR0, (mfspr(SPRN_CCR0) & ~0x80));
 
 	return (0);
 }
board/netstal/hcu5/hcu5.c +4 -4
index 6f4ec29..5eb33d3 100644
@@ -89,8 +89,8 @@ int board_early_init_f(void)
 		/*
 		 * Initiate system reset in debug control register DBCR
 		 */
-		dbcr = mfspr(dbcr0);
-		mtspr(dbcr0, dbcr | CHIP_RESET);
+		dbcr = mfspr(SPRN_DBCR0);
+		mtspr(SPRN_DBCR0, dbcr | CHIP_RESET);
 	}
 	mtsdr(SDR0_CP440, 0x0EAAEA02);  /* [Nto1] = 1*/
 #endif
@@ -307,14 +307,14 @@ int misc_init_r(void)
 	/* We cannot easily enable trace before, as there are other
 	 * routines messing around with sdr0_pfc1. And I do not need it.
 	 */
-	if (mfspr(dbcr0) & 0x80000000) {
+	if (mfspr(SPRN_DBCR0) & 0x80000000) {
 		/* External debugger alive
 		 * enable trace facilty for Lauterbach
 		 * CCR0[DTB]=0		Enable broadcast of trace information
 		 * SDR0_PFC0[TRE]	Trace signals are enabled instead of
 		 *			GPIO49-63
 		 */
-	        mtspr(ccr0, mfspr(ccr0)  &~ (CCR0_DTB));
+	        mtspr(SPRN_CCR0, mfspr(SPRN_CCR0)  &~ (CCR0_DTB));
 		mtsdr(SDR0_PFC0, sdr0_pfc1 | SDR0_PFC0_TRE_ENABLE);
 	}
 	return 0;
board/netstal/hcu5/sdram.c +2 -2
index f59bd7d..5c2ec35 100644
@@ -144,7 +144,7 @@ static void program_ecc(unsigned long start_address, unsigned long num_bytes)
 	u32 *magicPtr;
 	u32 magic;
 
-	if ((mfspr(dbcr0) & 0x80000000) == 0) {
+	if ((mfspr(SPRN_DBCR0) & 0x80000000) == 0) {
 		/* only if no external debugger is alive!
 		 * Check whether vxWorks is using EDR logging, if yes zero
 		 * also PostMortem and user reserved memory
@@ -182,7 +182,7 @@ static void program_ecc(unsigned long start_address, unsigned long num_bytes)
 	 * If not done, then we could get an interrupt later on when
 	 * exceptions are enabled.
 	 */
-	mtspr(mcsr, mfspr(mcsr));
+	mtspr(SPRN_MCSR, mfspr(SPRN_MCSR));
 
 	/* Set 'int_mask' parameter to functionnal value */
 	mfsdram(DDR0_01, val);
board/netstal/mcu25/mcu25.c +1 -1
index 66ed95f..67c1b0b 100644
@@ -77,7 +77,7 @@ int board_early_init_f (void)
 	out32(GPIO0_OR,		CONFIG_SYS_GPIO0_OR );
 	out32(GPIO0_TCR,	CONFIG_SYS_GPIO0_TCR);
 	out32(GPIO0_ODR,	CONFIG_SYS_GPIO0_ODR);
-	mtspr(ccr0,      0x00700000);
+	mtspr(SPRN_CCR0,      0x00700000);
 
 	return 0;
 }
cpu/ppc4xx/cpu.c +4 -4
index fb3837c..e12a784 100644
@@ -272,7 +272,7 @@ static int do_chip_reset (unsigned long sys0, unsigned long sys1)
 	mtdcr (cpc0_sys0, sys0);
 	mtdcr (cpc0_sys1, sys1);
 	mtdcr (cntrl0, mfdcr (cntrl0) & ~0x80000000);	/* Clr SWE */
-	mtspr (dbcr0, 0x20000000);	/* Reset the chip */
+	mtspr (SPRN_DBCR0, 0x20000000);	/* Reset the chip */
 
 	return 1;
 }
@@ -654,12 +654,12 @@ int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 	board_reset();
 #else
 #if defined(CONFIG_SYS_4xx_RESET_TYPE)
-	mtspr(dbcr0, CONFIG_SYS_4xx_RESET_TYPE << 28);
+	mtspr(SPRN_DBCR0, CONFIG_SYS_4xx_RESET_TYPE << 28);
 #else
 	/*
 	 * Initiate system reset in debug control register DBCR
 	 */
-	mtspr(dbcr0, 0x30000000);
+	mtspr(SPRN_DBCR0, 0x30000000);
 #endif /* defined(CONFIG_SYS_4xx_RESET_TYPE) */
 #endif /* defined(CONFIG_BOARD_RESET) */
 
@@ -697,7 +697,7 @@ void reset_4xx_watchdog(void)
 	/*
 	 * Clear TSR(WIS) bit
 	 */
-	mtspr(tsr, 0x40000000);
+	mtspr(SPRN_TSR, 0x40000000);
 }
 #endif	/* CONFIG_WATCHDOG */
 
cpu/ppc4xx/cpu_init.c +1 -1
index bbd795d..65092fb 100644
@@ -123,7 +123,7 @@ void reconfigure_pll(u32 new_cpu_freq)
 	/* Reset processor if configuration changed */
 	if (reset_needed) {
 		__asm__ __volatile__ ("sync; isync");
-		mtspr(dbcr0, 0x20000000);
+		mtspr(SPRN_DBCR0, 0x20000000);
 	}
 #endif
 }
cpu/ppc4xx/interrupts.c +9 -9
index 494bd8c..6db8421 100644
@@ -102,15 +102,15 @@ int interrupt_init_cpu (unsigned *decrementer_count)
 	 * Init PIT
 	 */
 #if defined(CONFIG_440)
-	val = mfspr( tcr );
+	val = mfspr( SPRN_TCR );
 	val &= (~0x04400000);		/* clear DIS & ARE */
-	mtspr( tcr, val );
-	mtspr( dec, 0 );		/* Prevent exception after TSR clear*/
-	mtspr( decar, 0 );		/* clear reload */
-	mtspr( tsr, 0x08000000 );	/* clear DEC status */
+	mtspr( SPRN_TCR, val );
+	mtspr( SPRN_DEC, 0 );		/* Prevent exception after TSR clear*/
+	mtspr( SPRN_DECAR, 0 );		/* clear reload */
+	mtspr( SPRN_TSR, 0x08000000 );	/* clear DEC status */
 	val = gd->bd->bi_intfreq/1000;	/* 1 msec */
-	mtspr( decar, val );		/* Set auto-reload value */
-	mtspr( dec, val );		/* Set inital val */
+	mtspr( SPRN_DECAR, val );		/* Set auto-reload value */
+	mtspr( SPRN_DEC, val );		/* Set inital val */
 #else
 	set_pit(gd->bd->bi_intfreq / 1000);
 #endif
@@ -126,9 +126,9 @@ int interrupt_init_cpu (unsigned *decrementer_count)
 	/*
 	 * Enable PIT
 	 */
-	val = mfspr(tcr);
+	val = mfspr(SPRN_TCR);
 	val |= 0x04400000;
-	mtspr(tcr, val);
+	mtspr(SPRN_TCR, val);
 
 	/*
 	 * Set EVPR to 0
cpu/ppc4xx/speed.c +2 -1
index ed6e55b..e1a634c 100644
@@ -394,7 +394,8 @@ void get_sys_info (sys_info_t *sysInfo)
 	sysInfo->freqUART = sysInfo->freqPLB;
 
 	/* Figure which timer source to use */
-	if (mfspr(ccr1) & 0x0080) { /* External Clock, assume same as SYS_CLK */
+	if (mfspr(SPRN_CCR1) & 0x0080) {
+		/* External Clock, assume same as SYS_CLK */
 		temp = sysInfo->freqProcessor / 2;  /* Max extern clock speed */
 		if (CONFIG_SYS_CLK_FREQ > temp)
 			sysInfo->freqTmrClk = temp;
cpu/ppc4xx/start.S +103 -103

366 lines not on this page · raw message

include/asm-ppc/processor.h +46 -0

99 lines not on this page · raw message

include/ppc405.h +0 -55

61 lines not on this page · raw message

include/ppc440.h +0 -93

99 lines not on this page · raw message

post/cpu/ppc4xx/fpu.c +3 -3
index fff4169..e9b96dd 100644
@@ -34,7 +34,7 @@
 
 int fpu_status(void)
 {
-	if (mfspr(ccr0) & CCR0_DAPUIB)
+	if (mfspr(SPRN_CCR0) & CCR0_DAPUIB)
 		return 0; /* Disabled */
 	else
 		return 1; /* Enabled */
@@ -43,14 +43,14 @@ int fpu_status(void)
 
 void fpu_disable(void)
 {
-	mtspr(ccr0, mfspr(ccr0) | CCR0_DAPUIB);
+	mtspr(SPRN_CCR0, mfspr(SPRN_CCR0) | CCR0_DAPUIB);
 	mtmsr(mfmsr() & ~MSR_FP);
 }
 
 
 void fpu_enable(void)
 {
-	mtspr(ccr0, mfspr(ccr0) & ~CCR0_DAPUIB);
+	mtspr(SPRN_CCR0, mfspr(SPRN_CCR0) & ~CCR0_DAPUIB);
 	mtmsr(mfmsr() | MSR_FP);
 }
 
Signature · 1 line
1.6.1
#1 lore raw

PATCH 1/1 ppc4xx: Replace 4xx lowercase SPR references

Dear Matthias Fuchs,

Quoted 1 line · In message <[email protected]> you wrote:

...

Quoted 8 lines
 board/esd/pmc440/pmc440.c   |    2 +-
 board/mpl/mip405/mip405.c   |    2 +-
 board/mpl/pip405/pip405.c   |    2 +-
 board/netstal/hcu5/hcu5.c   |    8 +-
 board/netstal/hcu5/sdram.c  |    4 +-
 board/netstal/mcu25/mcu25.c |    2 +-
 cpu/ppc4xx/cpu.c            |    8 +-
 cpu/ppc4xx/cpu_init.c       |    2 +-
Quoted 8 lines
 cpu/ppc4xx/interrupts.c     |   18 ++--
 cpu/ppc4xx/speed.c          |    3 +-
 cpu/ppc4xx/start.S          |  206 +++++++++++++++++++++---------------------
 include/asm-ppc/processor.h |   46 ++++++++++
 include/ppc405.h            |   55 ------------
 include/ppc440.h            |   93 -------------------
 post/cpu/ppc4xx/fpu.c       |    6 +-
 15 files changed, 178 insertions(+), 279 deletions(-)

I understand the include/asm-ppc/processor.h changes are in sync with the Linux version of this file?

If so:

Best regards,

Wolfgang Denk

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-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Death, when unnecessary, is a tragic thing.
	-- Flint, "Requiem for Methuselah", stardate 5843.7
#2 lore raw

PATCH 1/1 ppc4xx: Replace 4xx lowercase SPR references

Hi Wolfgang,

Matthias is not available for 2 days, so I'll answer instead.

Quoted 25 lines · On Wednesday 22 July 2009 17:42:40 Wolfgang Denk wrote:

Dear Matthias Fuchs,

Quoted 1 line · In message <[email protected]> you wrote:

..

Quoted 9 lines
 board/esd/pmc440/pmc440.c   |    2 +-
 board/mpl/mip405/mip405.c   |    2 +-
 board/mpl/pip405/pip405.c   |    2 +-
 board/netstal/hcu5/hcu5.c   |    8 +-
 board/netstal/hcu5/sdram.c  |    4 +-
 board/netstal/mcu25/mcu25.c |    2 +-
 cpu/ppc4xx/cpu.c            |    8 +-
 cpu/ppc4xx/cpu_init.c       |    2 +-
 cpu/ppc4xx/interrupts.c     |   18 ++--
Quoted 8 lines
 cpu/ppc4xx/speed.c          |    3 +-
 cpu/ppc4xx/start.S          |  206
+++++++++++++++++++++--------------------- include/asm-ppc/processor.h | 
 46 ++++++++++
 include/ppc405.h            |   55 ------------
 include/ppc440.h            |   93 -------------------
 post/cpu/ppc4xx/fpu.c       |    6 +-
 15 files changed, 178 insertions(+), 279 deletions(-)
Quoted 2 lines

I understand the include/asm-ppc/processor.h changes are in sync with the Linux version of this file?

No, it's not in sync with the Linux version. Reason is, that the Linux version you are referring to was an very old arch/ppc version. The current arch/powerpc version is completely different. No SPRN defines in this file any more.

But I'll double check the new defines in processor.h before applying this patch.

Quoted 3 lines

If so:

I hope you don't withdraw your Acked-by now. I would really like to apply this patch soon.

Thanks.

Best regards,
Stefan

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

#3 lore raw

PATCH 1/1 ppc4xx: Replace 4xx lowercase SPR references

Dear Stefan Roese,

Quoted 5 lines · In message <[email protected]> you wrote:

No, it's not in sync with the Linux version. Reason is, that the Linux version you are referring to was an very old arch/ppc version. The current arch/powerpc version is completely different. No SPRN defines in this file any more.

No, I did use the current code from arch/powerpc/include; I just didn't mention that it's split there into several files like asm/reg.h, asm/reg_booke.h etc.

Quoted 2 lines

But I'll double check the new defines in processor.h before applying this patch.

OK, that's all I wanted to make sure :-)

Quoted 2 lines

I hope you don't withdraw your Acked-by now. I would really like to apply this patch soon.

I still ACK it.

Best regards,

Wolfgang Denk

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-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The first thing we do is kill all the lawyers.
(Shakespeare. II Henry VI, Act IV, scene ii)
Applied
#4 lore raw

PATCH 1/1 ppc4xx: Replace 4xx lowercase SPR references

In reply to Matthias Fuchs
Quoted 1 line · On Wednesday 22 July 2009 17:27:56 Matthias Fuchs wrote:

Applied to ppc4xx/master. Thanks.

Best regards,
Stefan

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