Skip to contentSkip to conversation

sh: lowlevel_init coding style cleanup

PATCH New Jean-Christophe PLAGNIOL-VILLARD 2 participants 3 messages Dec 20, 2008 – Jan 10, 2009 Arm/actions semi architecture

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 sh: lowlevel_init coding style cleanup

---
 board/mpr2/lowlevel_init.S              |   44 +-
 board/ms7722se/lowlevel_init.S          |   34 +-
 board/ms7750se/lowlevel_init.S          |  150 +++---
 board/renesas/MigoR/lowlevel_init.S     |   10 +-
 board/renesas/ap325rxa/lowlevel_init.S  |   86 ++--
 board/renesas/r2dplus/lowlevel_init.S   |  126 +++---
 board/renesas/r7780mp/lowlevel_init.S   |  858 +++++++++++++++---------------
 board/renesas/rsk7203/lowlevel_init.S   |  214 ++++----
 board/renesas/sh7763rdp/lowlevel_init.S |  162 +++---
 board/renesas/sh7785lcr/lowlevel_init.S |    2 +-
 10 files changed, 846 insertions(+), 840 deletions(-)

rewrite board/renesas/r7780mp/lowlevel_init.S (68%)

board/mpr2/lowlevel_init.S +25 -19
index 060957a..187b5bb 100644
@@ -33,17 +33,17 @@ lowlevel_init:
 /*
  * Set frequency multipliers and dividers in FRQCR.
  */
-	mov.l	WTCSR_A,r1
-	mov.l	WTCSR_D,r0
-	mov.w	r0, at r1
+	mov.l	WTCSR_A, r1
+	mov.l	WTCSR_D, r0
+	mov.w	r0, @r1
 
-	mov.l	WTCNT_A,r1
-	mov.l	WTCNT_D,r0
-	mov.w	r0, at r1
+	mov.l	WTCNT_A, r1
+	mov.l	WTCNT_D, r0
+	mov.w	r0, @r1
 
-	mov.l	FRQCR_A,r1
-	mov.l	FRQCR_D,r0
-	mov.w	r0, at r1
+	mov.l	FRQCR_A, r1
+	mov.l	FRQCR_D, r0
+	mov.w	r0, @r1
 
 /*
  * Setup CS0 (Flash).
@@ -112,21 +112,27 @@ WTCSR_D:	.long	0xA507		/* divide by 4096 */
 /*
  * Spansion S29GL256N11 @ 48 MHz
  */
-CS0BCR_D:	.long	0x12490400  /* 1 idle cycle inserted, normal space, 16 bit */
-CS0WCR_D:	.long	0x00000340  /* tSW=0.5ck, 6 wait cycles, NO external wait, tHW=0.5ck */
+/* 1 idle cycle inserted, normal space, 16 bit */
+CS0BCR_D:	.long	0x12490400
+/* tSW=0.5ck, 6 wait cycles, NO external wait, tHW=0.5ck */
+CS0WCR_D:	.long	0x00000340
 
 /*
  * Samsung K4S511632B-UL75 @ 48 MHz
  * Micron MT48LC32M16A2-75 @ 48 MHz
  */
-CS3BCR_D:	.long	0x10004400  /* CS3BCR = 0x10004400, minimum idle cycles, SDRAM, 16 bit */
-CS3WCR_D:	.long	0x00000091  /* tRP=1ck, tRCD=1ck, CL=2, tRWL=2ck, tRC=4ck */
-SDCR_D1:	.long	0x00000012  /* no refresh, 13 rows, 10 cols, NO bank active mode */
-SDCR_D2:	.long	0x00000812  /* refresh */
-RTCSR_D:	.long	0xA55A0008  /* 1/4, once */
-RTCNT_D:	.long	0xA55A005D  /* count 93 */
-RTCOR_D:	.long	0xa55a005d  /* count 93 */
-SDMR3_D:	.long	0x440       /* mode register CL2, burst read and SINGLE WRITE */
+/* CS3BCR = 0x10004400, minimum idle cycles, SDRAM, 16 bit */
+CS3BCR_D:	.long	0x10004400
+/* tRP=1ck, tRCD=1ck, CL=2, tRWL=2ck, tRC=4ck */
+CS3WCR_D:	.long	0x00000091
+/* no refresh, 13 rows, 10 cols, NO bank active mode */
+SDCR_D1:	.long	0x00000012
+SDCR_D2:	.long	0x00000812	/* refresh */
+RTCSR_D:	.long	0xA55A0008	/* 1/4, once */
+RTCNT_D:	.long	0xA55A005D	/* count 93 */
+RTCOR_D:	.long	0xa55a005d	/* count 93 */
+/* mode register CL2, burst read and SINGLE WRITE */
+SDMR3_D:	.long	0x440
 
 /*
  * Registers
board/ms7722se/lowlevel_init.S +17 -17
index 8b46595..3e887cf 100644
@@ -29,11 +29,11 @@
 #include <asm/processor.h>
 
 /*
- *  Board specific low level init code, called _very_ early in the
- *  startup sequence. Relocation to SDRAM has not happened yet, no
- *  stack is available, bss section has not been initialised, etc.
+ * Board specific low level init code, called _very_ early in the
+ * startup sequence. Relocation to SDRAM has not happened yet, no
+ * stack is available, bss section has not been initialised, etc.
  *
- *  (Note: As no stack is available, no subroutines can be called...).
+ * (Note: As no stack is available, no subroutines can be called...).
  */
 
 	.global	lowlevel_init
@@ -203,7 +203,7 @@ bsc_init:
 	mov	#0x00, r0	! SDMR3 data    -> R0
 	mov.b	r0, @r1		! SDMR3 set
 
-	! BL bit off (init = ON)  (?!?)
+	! BL bit off (init = ON) (?!?)
 
 	stc	sr, r0				! BL bit off(init=ON)
 	mov.l	SR_MASK_D, r1
@@ -232,28 +232,28 @@ MSTPCR0_D:	.long	0x00001001
 MSTPCR2_D:	.long	0xffffffff
 FRQCR_D:	.long	0x07022538
 
-PSELA_A:	.long   0xa405014E
-PSELA_D:	.word   0x0A10
+PSELA_A:	.long	0xa405014E
+PSELA_D:	.word	0x0A10
 	.align 2
 
-DRVCR_A:	.long   0xa405018A
-DRVCR_D:	.word   0x0554
+DRVCR_A:	.long	0xa405018A
+DRVCR_D:	.word	0x0554
 	.align 2
 
-PCCR_A:		.long   0xa4050104
-PCCR_D:		.word   0x8800
+PCCR_A:		.long	0xa4050104
+PCCR_D:		.word	0x8800
 	.align 2
 
-PECR_A:		.long   0xa4050108
-PECR_D:		.word   0x0000
+PECR_A:		.long	0xa4050108
+PECR_D:		.word	0x0000
 	.align 2
 
-PJCR_A:		.long   0xa4050110
-PJCR_D:		.word   0x1000
+PJCR_A:		.long	0xa4050110
+PJCR_D:		.word	0x1000
 	.align 2
 
-PXCR_A:		.long   0xa4050148
-PXCR_D:		.word   0x0AAA
+PXCR_A:		.long	0xa4050148
+PXCR_D:		.word	0x0AAA
 	.align 2
 
 CMNCR_A:	.long	CMNCR
board/ms7750se/lowlevel_init.S +75 -75

193 lines not on this page · raw message

board/renesas/MigoR/lowlevel_init.S +5 -5
index 4c1900e..13c83bf 100644
@@ -29,11 +29,11 @@
 #include <asm/processor.h>
 
 /*
- *  Board specific low level init code, called _very_ early in the
- *  startup sequence. Relocation to SDRAM has not happened yet, no
- *  stack is available, bss section has not been initialised, etc.
+ * Board specific low level init code, called _very_ early in the
+ * startup sequence. Relocation to SDRAM has not happened yet, no
+ * stack is available, bss section has not been initialised, etc.
  *
- *  (Note: As no stack is available, no subroutines can be called...).
+ * (Note: As no stack is available, no subroutines can be called...).
  */
 
 	.global	lowlevel_init
@@ -176,7 +176,7 @@ bsc_init:
 	mov	#0x00, r0	! SDMR3 data    -> R0
 	mov.b	r0, @r1		! SDMR3 set
 
-	! BL bit off (init = ON)  (?!?)
+	! BL bit off (init = ON) (?!?)
 
 	stc	sr, r0				! BL bit off(init=ON)
 	mov.l	SR_MASK_D, r1
board/renesas/ap325rxa/lowlevel_init.S +43 -43

179 lines not on this page · raw message

board/renesas/r2dplus/lowlevel_init.S +63 -63

155 lines not on this page · raw message

board/renesas/r7780mp/lowlevel_init.S +429 -429

858 lines not on this page · raw message

board/renesas/rsk7203/lowlevel_init.S +107 -107

275 lines not on this page · raw message

board/renesas/sh7763rdp/lowlevel_init.S +81 -81

248 lines not on this page · raw message

board/renesas/sh7785lcr/lowlevel_init.S +1 -1
index 50e1789..4cb1d9d 100644
@@ -305,7 +305,7 @@ CS4WCR_D:	.long	0x00101012
 CS_USB_BCR_D:	.long	0x11111200
 CS_USB_WCR_D:	.long	0x00020004
 
-/* SD setting  : 32bit mode = CS3, 29bit mode = CS6 */
+/* SD setting : 32bit mode = CS3, 29bit mode = CS6 */
 CS_SD_BCR_D:	.long	0x00000300
 CS_SD_WCR_D:	.long	0x00030108
 
Signature · 1 line
1.5.6.5
#1 lore raw

PATCH 2/2 sh: use write{8,16,32} in all lowlevel_init

---
 board/mpr2/lowlevel_init.S              |   49 +++-------
 board/ms7722se/lowlevel_init.S          |  160 ++++++++---------------------
 board/ms7750se/lowlevel_init.S          |   64 ++++--------
 board/renesas/MigoR/lowlevel_init.S     |  141 ++++++++------------------
 board/renesas/ap325rxa/lowlevel_init.S  |  121 ++++++----------------
 board/renesas/r2dplus/lowlevel_init.S   |   85 ++++-----------
 board/renesas/r7780mp/lowlevel_init.S   |  122 ++++++----------------
 board/renesas/rsk7203/lowlevel_init.S   |  129 ++++++-----------------
 board/renesas/sh7763rdp/lowlevel_init.S |  172 +++++++++----------------------
 board/renesas/sh7785lcr/lowlevel_init.S |   28 +-----
 include/asm-sh/macro.h                  |   52 +++++++++
 11 files changed, 338 insertions(+), 785 deletions(-)
 create mode 100644 include/asm-sh/macro.h
board/mpr2/lowlevel_init.S +13 -36
index 187b5bb..5f02bd4 100644
@@ -22,6 +22,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  * MA 02111-1307 USA
  */
+#include <asm/macro.h>
 
 	.global	lowlevel_init
 
@@ -33,59 +34,35 @@ lowlevel_init:
 /*
  * Set frequency multipliers and dividers in FRQCR.
  */
-	mov.l	WTCSR_A, r1
-	mov.l	WTCSR_D, r0
-	mov.w	r0, @r1
+	write16	WTCSR_A, WTCSR_D
 
-	mov.l	WTCNT_A, r1
-	mov.l	WTCNT_D, r0
-	mov.w	r0, @r1
+	write16	WTCNT_A, WTCNT_D
 
-	mov.l	FRQCR_A, r1
-	mov.l	FRQCR_D, r0
-	mov.w	r0, @r1
+	write16	FRQCR_A, FRQCR_D
 
 /*
  * Setup CS0 (Flash).
  */
-	mov.l	CS0BCR_A, r1
-	mov.l	CS0BCR_D, r0
-	mov.l	r0, @r1
+	write32	CS0BCR_A, CS0BCR_D
 
-	mov.l	CS0WCR_A, r1
-	mov.l	CS0WCR_D, r0
-	mov.l	r0, @r1
+	write32	CS0WCR_A, CS0WCR_D
 
 /*
  * Setup CS3 (SDRAM).
  */
-	mov.l	CS3BCR_A, r1
-	mov.l	CS3BCR_D, r0
-	mov.l	r0, @r1
+	write32	CS3BCR_A, CS3BCR_D
 
-	mov.l	CS3WCR_A, r1
-	mov.l	CS3WCR_D, r0
-	mov.l	r0, @r1
+	write32	CS3WCR_A, CS3WCR_D
 
-	mov.l	SDCR_A, r1
-	mov.l	SDCR_D1, r0
-	mov.l	r0, @r1
+	write32	SDCR_A, SDCR_D1
 
-	mov.l	RTCSR_A, r1
-	mov.l	RTCSR_D, r0
-	mov.l	r0, @r1
+	write32	RTCSR_A, RTCSR_D
 
-	mov.l	RTCNT_A, r1
-	mov.l	RTCNT_D, r0
-	mov.l	r0, @r1
+	write32	RTCNT_A, RTCNT_D
 
-	mov.l	RTCOR_A, r1
-	mov.l	RTCOR_D, r0
-	mov.l	r0, @r1
+	write32	RTCOR_A, RTCOR_D
 
-	mov.l	SDCR_A, r1
-	mov.l	SDCR_D2, r0
-	mov.l	r0, @r1
+	write32	SDCR_A, SDCR_D2
 
 	mov.l	SDMR3_A, r1
 	mov.l	SDMR3_D, r0
board/ms7722se/lowlevel_init.S +45 -115

216 lines not on this page · raw message

board/ms7750se/lowlevel_init.S +19 -45

99 lines not on this page · raw message

board/renesas/MigoR/lowlevel_init.S +42 -99

187 lines not on this page · raw message

board/renesas/ap325rxa/lowlevel_init.S +31 -90

167 lines not on this page · raw message

board/renesas/r2dplus/lowlevel_init.S +22 -63

122 lines not on this page · raw message

board/renesas/r7780mp/lowlevel_init.S +32 -90

170 lines not on this page · raw message

board/renesas/rsk7203/lowlevel_init.S +33 -96

179 lines not on this page · raw message

board/renesas/sh7763rdp/lowlevel_init.S +48 -124

260 lines not on this page · raw message

board/renesas/sh7785lcr/lowlevel_init.S +1 -27
index 4cb1d9d..f5ebeb9 100644
@@ -19,33 +19,7 @@
 #include <config.h>
 #include <version.h>
 #include <asm/processor.h>
-
-.macro	write32, addr, data
-	mov.l \addr ,r1
-	mov.l \data ,r0
-	mov.l r0, @r1
-.endm
-
-.macro	write16, addr, data
-	mov.l \addr ,r1
-	mov.l \data ,r0
-	mov.w r0, @r1
-.endm
-
-.macro	write8, addr, data
-	mov.l \addr ,r1
-	mov.l \data ,r0
-	mov.b r0, @r1
-.endm
-
-.macro	wait_timer, time
-	mov.l	\time ,r3
-1:
-	nop
-	tst	r3, r3
-	bf/s	1b
-	dt	r3
-.endm
+#include <asm/macro.h>
 
 #include <asm/processor.h>
 
include/asm-sh/macro.h new file +52 -0

52 lines not on this page · raw message

Signature · 1 line
1.5.6.5
#2 lore raw

PATCH 1/2 sh: lowlevel_init coding style cleanup

In reply to Jean-Christophe PLAGNIOL-VILLARD
Quoted 13 lines · On Sat, 20 Dec 2008 19:29:48 +0100 Jean-Christophe PLAGNIOL-VILLARD…
---
 board/mpr2/lowlevel_init.S              |   44 +-
 board/ms7722se/lowlevel_init.S          |   34 +-
 board/ms7750se/lowlevel_init.S          |  150 +++---
 board/renesas/MigoR/lowlevel_init.S     |   10 +-
 board/renesas/ap325rxa/lowlevel_init.S  |   86 ++--
 board/renesas/r2dplus/lowlevel_init.S   |  126 +++---
 board/renesas/r7780mp/lowlevel_init.S   |  858 +++++++++++++++---------------
 board/renesas/rsk7203/lowlevel_init.S   |  214 ++++----
 board/renesas/sh7763rdp/lowlevel_init.S |  162 +++---
 board/renesas/sh7785lcr/lowlevel_init.S |    2 +-
 10 files changed, 846 insertions(+), 840 deletions(-)
Quoted 1 line

rewrite board/renesas/r7780mp/lowlevel_init.S (68%)

Applied, thanks.

Best regards,
Nobuhiro