Skip to contentSkip to conversation

S3C24XX: Add support to MINI2416 board

PATCH Superseded José Miguel Gonçalves 7 participants 84 messages Sep 14, 2012 – Oct 4, 2012 1 message not in the archive

Subsystems (6)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v2 cover S3C24XX: Add support to MINI2416 board

Support for the MINI2416 board based on a Samsung's S3C2416 SoC with 64MB DDR2 SDRAM, 256MB NAND Flash, a LAN9220 Ethernet Controller and a WM8731 Audio CODEC.

Changes for v2:
- Coding style cleanup
- Removed new serial and rtc drivers
- Use of in-tree serial and rtc drivers

Jos? Miguel Gon?alves (11):
ARM: fix relocation on ARM926EJS
S3C24XX: Add core support for Samsung's S3C24XX SoCs
serial: Add support to 4 ports in serial_s3c24x0
serial: Use a more precise baud rate generation for serial_s3c24x0
serial: Remove unnecessary delay in serial_s3c24x0
rtc: Improve rtc_get() on s3c24x0_rtc
rtc: Fix rtc_reset() on s3c24x0_rtc
rtc: Don't allow setting unsuported years on s3c24x0_rtc
S3C24XX: Add NAND Flash driver
Add u-boot-ubl.bin target to the Makefile
S3C24XX: Add support to MINI2416 board

 MAINTAINERS                                     |    4 +
 Makefile                                        |    7 +-
 arch/arm/cpu/arm926ejs/s3c24xx/Makefile         |   52 ++
 arch/arm/cpu/arm926ejs/s3c24xx/cpu.c            |   56 +++
 arch/arm/cpu/arm926ejs/s3c24xx/cpu_info.c       |   57 +++
 arch/arm/cpu/arm926ejs/s3c24xx/s3c2412_speed.c  |  114 +++++
 arch/arm/cpu/arm926ejs/s3c24xx/s3c2416_speed.c  |  116 +++++
 arch/arm/cpu/arm926ejs/s3c24xx/timer.c          |  152 ++++++
 arch/arm/cpu/arm926ejs/start.S                  |    4 +-
 arch/arm/include/asm/arch-s3c24xx/s3c2412.h     |  120 +++++
 arch/arm/include/asm/arch-s3c24xx/s3c2416.h     |  175 +++++++
 arch/arm/include/asm/arch-s3c24xx/s3c24x0_cpu.h |   41 ++
 arch/arm/include/asm/arch-s3c24xx/s3c24xx.h     |  598 +++++++++++++++++++++++
 arch/arm/include/asm/arch-s3c24xx/s3c24xx_cpu.h |   30 ++
 board/boardcon/mini2416/Makefile                |   47 ++
 board/boardcon/mini2416/config.mk               |    4 +
 board/boardcon/mini2416/mini2416.c              |   98 ++++
 board/boardcon/mini2416/mini2416_spl.c          |  200 ++++++++
 board/boardcon/mini2416/u-boot-spl.lds          |   63 +++
 boards.cfg                                      |    1 +
 drivers/mtd/nand/Makefile                       |    1 +
 drivers/mtd/nand/s3c24xx_nand.c                 |  245 ++++++++++
 drivers/rtc/s3c24x0_rtc.c                       |   30 +-
 drivers/serial/serial_s3c24x0.c                 |   52 +-
 include/common.h                                |    1 +
 include/configs/VCMA9.h                         |    2 +-
 include/configs/mini2416.h                      |  200 ++++++++
 include/configs/smdk2410.h                      |    2 +-
 28 files changed, 2446 insertions(+), 26 deletions(-)
 create mode 100644 arch/arm/cpu/arm926ejs/s3c24xx/Makefile
 create mode 100644 arch/arm/cpu/arm926ejs/s3c24xx/cpu.c
 create mode 100644 arch/arm/cpu/arm926ejs/s3c24xx/cpu_info.c
 create mode 100644 arch/arm/cpu/arm926ejs/s3c24xx/s3c2412_speed.c
 create mode 100644 arch/arm/cpu/arm926ejs/s3c24xx/s3c2416_speed.c
 create mode 100644 arch/arm/cpu/arm926ejs/s3c24xx/timer.c
 create mode 100644 arch/arm/include/asm/arch-s3c24xx/s3c2412.h
 create mode 100644 arch/arm/include/asm/arch-s3c24xx/s3c2416.h
 create mode 100644 arch/arm/include/asm/arch-s3c24xx/s3c24x0_cpu.h
 create mode 100644 arch/arm/include/asm/arch-s3c24xx/s3c24xx.h
 create mode 100644 arch/arm/include/asm/arch-s3c24xx/s3c24xx_cpu.h
 create mode 100644 board/boardcon/mini2416/Makefile
 create mode 100644 board/boardcon/mini2416/config.mk
 create mode 100644 board/boardcon/mini2416/mini2416.c
 create mode 100644 board/boardcon/mini2416/mini2416_spl.c
 create mode 100644 board/boardcon/mini2416/u-boot-spl.lds
 create mode 100644 drivers/mtd/nand/s3c24xx_nand.c
 create mode 100644 include/configs/mini2416.h
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v2 1/11 ARM: fix relocation on ARM926EJS

Jumping to board_init_r is not performed due to a bug on address computation. Relocation offsets are not needed when building SPL.

---
Changes for v2:
- None

---
 arch/arm/cpu/arm926ejs/start.S |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/cpu/arm926ejs/start.S +3 -1
index 6f05f1a..2da5342 100644
@@ -325,7 +325,7 @@ _nand_boot_ofs:
 	.word nand_boot
 #else
 	ldr	r0, _board_init_r_ofs
-	ldr	r1, _TEXT_BASE
+	adr	r1, _start
 	add	lr, r0, r1
 	add	lr, lr, r9
 	/* setup parameters for board_init_r */
@@ -338,12 +338,14 @@ _board_init_r_ofs:
 	.word board_init_r - _start
 #endif
 
+#ifndef CONFIG_SPL_BUILD
 _rel_dyn_start_ofs:
 	.word __rel_dyn_start - _start
 _rel_dyn_end_ofs:
 	.word __rel_dyn_end - _start
 _dynsym_start_ofs:
 	.word __dynsym_start - _start
+#endif
 
 /*
  *************************************************************************
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH v2 1/11 ARM: fix relocation on ARM926EJS

Dear Jos? Miguel Gon?alves,

Quoted 2 lines

Jumping to board_init_r is not performed due to a bug on address computation.

Is your CONFIG_SYS_TEXT_BASE configured correctly? I don't detect any misbehavior on my arm926 boards.

Quoted 1 line

Relocation offsets are not needed when building SPL.

Do they cause any trouble?

Quoted 26 lines

---
Changes for v2:
- None

---
 arch/arm/cpu/arm926ejs/start.S |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/arch/arm/cpu/arm926ejs/start.S index 6f05f1a..2da5342 100644

arch/arm/cpu/arm926ejs/start.S +2 -1
@@ -325,7 +325,7 @@ _nand_boot_ofs:
 	.word nand_boot
 #else
 	ldr	r0, _board_init_r_ofs
-	ldr	r1, _TEXT_BASE
+	adr	r1, _start
 	add	lr, r0, r1
 	add	lr, lr, r9
 	/* setup parameters for board_init_r */
@@ -338,12 +338,14 @@ _board_init_r_ofs:
 	.word board_init_r - _start
 #endif
 
+#ifndef CONFIG_SPL_BUILD

arch/arm/cpu/arm926ejs/start.S _board_init_r_ofs: · line 351

Quoted 10 lines
arch/arm/cpu/arm926ejs/start.S +1 -0
 _rel_dyn_start_ofs:
 	.word __rel_dyn_start - _start
 _rel_dyn_end_ofs:
 	.word __rel_dyn_end - _start
 _dynsym_start_ofs:
 	.word __dynsym_start - _start
+#endif
 
 /*
  *************************************************************************

Best regards,
Marek Vasut

#3 lore raw

PATCH v2 1/11 ARM: fix relocation on ARM926EJS

Quoted 6 lines · Marek Vasut

Dear Jos? Miguel Gon?alves,

Quoted 2 lines

Jumping to board_init_r is not performed due to a bug on address computation.

Is your CONFIG_SYS_TEXT_BASE configured correctly? I don't detect any misbehavior on my arm926 boards.

Maybe because you are not using it to build an SPL? Please check the same chunk of code in other start.S for arm1176 and armv7. They have the same code that I put for arm926ejs.

Quoted 3 lines
Quoted 2 lines

Relocation offsets are not needed when building SPL.

Do they cause any trouble?

No! Just not needed.

Quoted 35 lines
Quoted 35 lines

---
Changes for v2:
- None

---
  arch/arm/cpu/arm926ejs/start.S |    4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/arch/arm/cpu/arm926ejs/start.S index 6f05f1a..2da5342 100644

arch/arm/cpu/arm926ejs/start.S +3 -1
@@ -325,7 +325,7 @@ _nand_boot_ofs:
  	.word nand_boot
  #else
  	ldr	r0, _board_init_r_ofs
-	ldr	r1, _TEXT_BASE
+	adr	r1, _start
  	add	lr, r0, r1
  	add	lr, lr, r9
  	/* setup parameters for board_init_r */
@@ -338,12 +338,14 @@ _board_init_r_ofs:
  	.word board_init_r - _start
  #endif
 
+#ifndef CONFIG_SPL_BUILD
  _rel_dyn_start_ofs:
  	.word __rel_dyn_start - _start
  _rel_dyn_end_ofs:
  	.word __rel_dyn_end - _start
  _dynsym_start_ofs:
  	.word __dynsym_start - _start
+#endif
 
Quoted 5 lines

arch/arm/cpu/arm926ejs/start.S _board_init_r_ofs: · line 351

Quoted 2 lines
arch/arm/cpu/arm926ejs/start.S +0 -0
  /*
   *************************************************************************

Best regards,
Marek Vasut

Best regards,
Jos? Gon?alves

#4 lore raw

PATCH v2 1/11 ARM: fix relocation on ARM926EJS

Dear Jos? Miguel Gon?alves,

Quoted 10 lines · Marek Vasut
Quoted 7 lines

Dear Jos? Miguel Gon?alves,

Quoted 2 lines

Jumping to board_init_r is not performed due to a bug on address computation.

Is your CONFIG_SYS_TEXT_BASE configured correctly? I don't detect any misbehavior on my arm926 boards.

Maybe because you are not using it to build an SPL?

I do ... and I use CONFIG_SPL_TEXT_BASE properly .

Quoted 2 lines

Please check the same chunk of code in other start.S for arm1176 and armv7. They have the same code that I put for arm926ejs.

Please wait and please first explain what is the issue.

Quoted 56 lines
Quoted 3 lines
Quoted 1 line

Relocation offsets are not needed when building SPL.

Do they cause any trouble?

No! Just not needed.

Quoted 50 lines
Quoted 50 lines

---

Changes for v2:
- None

---

  arch/arm/cpu/arm926ejs/start.S |    4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/arch/arm/cpu/arm926ejs/start.S index 6f05f1a..2da5342 100644

arch/arm/cpu/arm926ejs/start.S +1 -1
@@ -325,7 +325,7 @@ _nand_boot_ofs:
  	.word nand_boot
 
  #else
 
  	ldr	r0, _board_init_r_ofs
 
-	ldr	r1, _TEXT_BASE
+	adr	r1, _start

add lr, r0, r1
add lr, lr, r9
/* setup parameters for board_init_r */

arch/arm/cpu/arm926ejs/start.S +2 -0
@@ -338,12 +338,14 @@ _board_init_r_ofs:
  	.word board_init_r - _start
 
  #endif
 
+#ifndef CONFIG_SPL_BUILD
 
  _rel_dyn_start_ofs:
  	.word __rel_dyn_start - _start
 
  _rel_dyn_end_ofs:
  	.word __rel_dyn_end - _start
 
  _dynsym_start_ofs:
  	.word __dynsym_start - _start
 
+#endif
 
  /*
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
   *********************************************************************
   ****

Best regards,
Marek Vasut

Best regards,
Jos? Gon?alves

Best regards,
Marek Vasut

#5 lore raw

PATCH v2 1/11 ARM: fix relocation on ARM926EJS

Quoted 7 lines · Marek Vasut

Dear Jos? Miguel Gon?alves,

Quoted 5 lines · Marek Vasut
Quoted 4 lines

Dear Jos? Miguel Gon?alves,

Quoted 2 lines

Jumping to board_init_r is not performed due to a bug on address computation.

Quoted 8 lines
Quoted 3 lines
Quoted 2 lines

Is your CONFIG_SYS_TEXT_BASE configured correctly? I don't detect any misbehavior on my arm926 boards.

Maybe because you are not using it to build an SPL?

I do ... and I use CONFIG_SPL_TEXT_BASE properly .

Quoted 2 lines

Please check the same chunk of code in other start.S for arm1176 and armv7. They have the same code that I put for arm926ejs.

Please wait and please first explain what is the issue.

The issue is what I've explained in the patch comments. Without this change the code never reaches board_init_r in the SPL and I think I have all the configurations correctly set. If the bug is not from here please suggest me what I need to change in the configuration in order to correctly boot my board.

Quoted 55 lines
Quoted 55 lines
Quoted 3 lines
Quoted 2 lines

Relocation offsets are not needed when building SPL.

Do they cause any trouble?

No! Just not needed.

Quoted 50 lines
Quoted 50 lines

---

Changes for v2:
- None

---

   arch/arm/cpu/arm926ejs/start.S |    4 +++-
   1 file changed, 3 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/arch/arm/cpu/arm926ejs/start.S index 6f05f1a..2da5342 100644

arch/arm/cpu/arm926ejs/start.S +1 -1
@@ -325,7 +325,7 @@ _nand_boot_ofs:
   	.word nand_boot
 
   #else
 
   	ldr	r0, _board_init_r_ofs
 
-	ldr	r1, _TEXT_BASE
+	adr	r1, _start
   	add	lr, r0, r1
   	add	lr, lr, r9
   	/* setup parameters for board_init_r */
arch/arm/cpu/arm926ejs/start.S +2 -0
@@ -338,12 +338,14 @@ _board_init_r_ofs:
   	.word board_init_r - _start
 
   #endif
 
+#ifndef CONFIG_SPL_BUILD
 
   _rel_dyn_start_ofs:
   	.word __rel_dyn_start - _start
 
   _rel_dyn_end_ofs:
   	.word __rel_dyn_end - _start
 
   _dynsym_start_ofs:
   	.word __dynsym_start - _start
 
+#endif
 
   /*
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
    *********************************************************************
    ****

Best regards,
Marek Vasut

Best regards,
Jos? Gon?alves

Best regards,
Marek Vasut

Best regards,
Jos? Gon?alves

#6 lore raw

PATCH v2 1/11 ARM: fix relocation on ARM926EJS

Dear Jos? Miguel Gon?alves,

Quoted 14 lines · Marek Vasut
Quoted 13 lines

Dear Jos? Miguel Gon?alves,

Quoted 10 lines · Marek Vasut
Quoted 7 lines

Dear Jos? Miguel Gon?alves,

Quoted 2 lines

Jumping to board_init_r is not performed due to a bug on address computation.

Is your CONFIG_SYS_TEXT_BASE configured correctly? I don't detect any misbehavior on my arm926 boards.

Maybe because you are not using it to build an SPL?

Quoted 8 lines
Quoted 6 lines

I do ... and I use CONFIG_SPL_TEXT_BASE properly .

Quoted 2 lines

Please check the same chunk of code in other start.S for arm1176 and armv7. They have the same code that I put for arm926ejs.

Please wait and please first explain what is the issue.

The issue is what I've explained in the patch comments.

"Jumping to board_init_r is not performed due to a bug on address computation."

Ok, I don't know how to replicate the bug from this comment or what effects it causes or ... well, anything. So please, try to be more elaborate in your patch description next time. Anyway ..

Quoted 3 lines

Without this
change the code never reaches board_init_r in the SPL and I think I have all the configurations correctly set.

I wonder why you'd ever want to reach board_init_r in the SPL. SPL is there only to load the real U-Boot from whatever media, so you usually use either NAND SPL or something like that.

What do you boot the rest from ?

Quoted 74 lines

If the bug is not from here please
suggest me what I need to change in the configuration in order to correctly boot my board.

Quoted 62 lines
Quoted 62 lines
Quoted 3 lines
Quoted 1 line

Relocation offsets are not needed when building SPL.

Do they cause any trouble?

No! Just not needed.

Quoted 55 lines
Quoted 42 lines

---

Changes for v2:
- None

---

   arch/arm/cpu/arm926ejs/start.S |    4 +++-
   1 file changed, 3 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/arch/arm/cpu/arm926ejs/start.S index 6f05f1a..2da5342 100644

arch/arm/cpu/arm926ejs/start.S +1 -1
@@ -325,7 +325,7 @@ _nand_boot_ofs:
   	.word nand_boot
 
   #else
 
   	ldr	r0, _board_init_r_ofs
 
-	ldr	r1, _TEXT_BASE
+	adr	r1, _start
   	add	lr, r0, r1
   	add	lr, lr, r9
   	/* setup parameters for board_init_r */
arch/arm/cpu/arm926ejs/start.S +1 -0
@@ -338,12 +338,14 @@ _board_init_r_ofs:
   	.word board_init_r - _start
 
   #endif
 
+#ifndef CONFIG_SPL_BUILD
 
   _rel_dyn_start_ofs:
   	.word __rel_dyn_start - _start
 
   _rel_dyn_end_ofs:
   	.word __rel_dyn_end - _start

arch/arm/cpu/arm926ejs/start.S _board_init_r_ofs:

Quoted 10 lines
arch/arm/cpu/arm926ejs/start.S +1 -0
 
   _dynsym_start_ofs:
   	.word __dynsym_start - _start
 
+#endif
 
   /*
 
    ******************************************************************
    *** ****

Best regards,
Marek Vasut

Quoted 5 lines
Quoted 2 lines

Best regards,
Jos? Gon?alves

Best regards,
Marek Vasut

Best regards,
Jos? Gon?alves

#7 lore raw

PATCH v2 1/11 ARM: fix relocation on ARM926EJS

Quoted 16 lines · Marek Vasut

Dear Jos? Miguel Gon?alves,

Quoted 14 lines · Marek Vasut
Quoted 13 lines

Dear Jos? Miguel Gon?alves,

Quoted 8 lines · Marek Vasut
Quoted 6 lines

Dear Jos? Miguel Gon?alves,

Quoted 2 lines

Jumping to board_init_r is not performed due to a bug on address computation.

Is your CONFIG_SYS_TEXT_BASE configured correctly? I don't detect any misbehavior on my arm926 boards.

Maybe because you are not using it to build an SPL?

I do ... and I use CONFIG_SPL_TEXT_BASE properly .

Quoted 2 lines

Please check the same chunk of code in other start.S for arm1176 and armv7. They have the same code that I put for arm926ejs.

Quoted 7 lines
Quoted 2 lines
Quoted 1 line

Please wait and please first explain what is the issue.

The issue is what I've explained in the patch comments.

"Jumping to board_init_r is not performed due to a bug on address computation."

Ok, I don't know how to replicate the bug from this comment or what effects it causes or ... well, anything. So please, try to be more elaborate in your patch description next time. Anyway ..

My bad. I should be more explicit on the patch description.

Quoted 8 lines
Quoted 3 lines

Without this
change the code never reaches board_init_r in the SPL and I think I have all the configurations correctly set.

I wonder why you'd ever want to reach board_init_r in the SPL. SPL is there only to load the real U-Boot from whatever media, so you usually use either NAND SPL or something like that.

What do you boot the rest from ?

Both SPL and U-Boot are in NAND Flash.

The board's SPL code in board/boardcon/mini2416/mini2416_spl.c that needs this patch was based on existing code from arch/arm/cpu/arm926ejs/davinci/spl.c and arm/cpu/armv7/omap-common/spl.c

The need to call relocate_code() in board_init_f() is explained on the SPL source comment, i.e., only to initialize .bss before we could use it in board_init_r() (in the serial driver initialization).

Quoted 69 lines
Quoted 69 lines

If the bug is not from here please
suggest me what I need to change in the configuration in order to correctly boot my board.

Quoted 54 lines
Quoted 54 lines
Quoted 2 lines
Quoted 1 line

Relocation offsets are not needed when building SPL.

Do they cause any trouble?

No! Just not needed.

Quoted 50 lines
Quoted 50 lines

---

Changes for v2:
- None

---

    arch/arm/cpu/arm926ejs/start.S |    4 +++-
    1 file changed, 3 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/arch/arm/cpu/arm926ejs/start.S index 6f05f1a..2da5342 100644

arch/arm/cpu/arm926ejs/start.S +1 -1
@@ -325,7 +325,7 @@ _nand_boot_ofs:
    	.word nand_boot
 
    #else
 
    	ldr	r0, _board_init_r_ofs
 
-	ldr	r1, _TEXT_BASE
+	adr	r1, _start
    	add	lr, r0, r1
    	add	lr, lr, r9
    	/* setup parameters for board_init_r */
arch/arm/cpu/arm926ejs/start.S +2 -0
@@ -338,12 +338,14 @@ _board_init_r_ofs:
    	.word board_init_r - _start
 
    #endif
 
+#ifndef CONFIG_SPL_BUILD
 
    _rel_dyn_start_ofs:
    	.word __rel_dyn_start - _start
 
    _rel_dyn_end_ofs:
    	.word __rel_dyn_end - _start
 
    _dynsym_start_ofs:
    	.word __dynsym_start - _start
 
+#endif
 
    /*
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
     ******************************************************************
     *** ****

Best regards,
Marek Vasut

Best regards,
Jos? Gon?alves

Best regards,
Marek Vasut

Best regards,
Jos? Gon?alves

#8 lore raw

PATCH v2 1/11 ARM: fix relocation on ARM926EJS

Dear Jos? Miguel Gon?alves,

Quoted 43 lines · Marek Vasut
Quoted 23 lines

Dear Jos? Miguel Gon?alves,

Quoted 21 lines · Marek Vasut
Quoted 19 lines

Dear Jos? Miguel Gon?alves,

Quoted 10 lines · Marek Vasut
Quoted 7 lines

Dear Jos? Miguel Gon?alves,

Quoted 2 lines

Jumping to board_init_r is not performed due to a bug on address computation.

Is your CONFIG_SYS_TEXT_BASE configured correctly? I don't detect any misbehavior on my arm926 boards.

Maybe because you are not using it to build an SPL?

I do ... and I use CONFIG_SPL_TEXT_BASE properly .

Quoted 2 lines

Please check the same chunk of code in other start.S for arm1176 and armv7. They have the same code that I put for arm926ejs.

Please wait and please first explain what is the issue.

Quoted 8 lines
Quoted 1 line

The issue is what I've explained in the patch comments.

"Jumping to board_init_r is not performed due to a bug on address computation."

Ok, I don't know how to replicate the bug from this comment or what effects it causes or ... well, anything. So please, try to be more elaborate in your patch description next time. Anyway ..

My bad. I should be more explicit on the patch description.

Quoted 8 lines
Quoted 3 lines

Without this
change the code never reaches board_init_r in the SPL and I think I have all the configurations correctly set.

I wonder why you'd ever want to reach board_init_r in the SPL. SPL is there only to load the real U-Boot from whatever media, so you usually use either NAND SPL or something like that.

Quoted 7 lines
Quoted 1 line

What do you boot the rest from ?

Both SPL and U-Boot are in NAND Flash.

The board's SPL code in board/boardcon/mini2416/mini2416_spl.c that needs this patch was based on existing code from arch/arm/cpu/arm926ejs/davinci/spl.c and arm/cpu/armv7/omap-common/spl.c

CCing Tom, he's the SPL expert.

Quoted 78 lines

The need to call relocate_code() in board_init_f() is explained on the SPL source comment, i.e., only to initialize .bss before we could use it in board_init_r() (in the serial driver initialization).

Quoted 74 lines
Quoted 74 lines

If the bug is not from here please
suggest me what I need to change in the configuration in order to correctly boot my board.

Quoted 62 lines
Quoted 62 lines
Quoted 3 lines
Quoted 1 line

Relocation offsets are not needed when building SPL.

Do they cause any trouble?

No! Just not needed.

Quoted 55 lines
Quoted 42 lines

---

Changes for v2:
- None

---

    arch/arm/cpu/arm926ejs/start.S |    4 +++-
    1 file changed, 3 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/arch/arm/cpu/arm926ejs/start.S index 6f05f1a..2da5342 100644

arch/arm/cpu/arm926ejs/start.S +1 -1
@@ -325,7 +325,7 @@ _nand_boot_ofs:
    	.word nand_boot
 
    #else
 
    	ldr	r0, _board_init_r_ofs
 
-	ldr	r1, _TEXT_BASE
+	adr	r1, _start
    	add	lr, r0, r1
    	add	lr, lr, r9
    	/* setup parameters for board_init_r */
arch/arm/cpu/arm926ejs/start.S +1 -0
@@ -338,12 +338,14 @@ _board_init_r_ofs:
    	.word board_init_r - _start
 
    #endif
 
+#ifndef CONFIG_SPL_BUILD
 
    _rel_dyn_start_ofs:
    	.word __rel_dyn_start - _start
 
    _rel_dyn_end_ofs:
    	.word __rel_dyn_end - _start

arch/arm/cpu/arm926ejs/start.S _board_init_r_ofs:

Quoted 10 lines
arch/arm/cpu/arm926ejs/start.S +1 -0
 
    _dynsym_start_ofs:
    	.word __dynsym_start - _start
 
+#endif
 
    /*
 
     ***************************************************************
     *** *** ****

Best regards,
Marek Vasut

Quoted 5 lines
Quoted 2 lines

Best regards,
Jos? Gon?alves

Best regards,
Marek Vasut

Best regards,
Jos? Gon?alves

#9 lore raw

PATCH v2 1/11 ARM: fix relocation on ARM926EJS

In reply to Marek Vasut

Hi,

Quoted 23 lines · Marek Vasut

Dear Jos? Miguel Gon?alves,

Quoted 21 lines · Marek Vasut
Quoted 19 lines

Dear Jos? Miguel Gon?alves,

Quoted 10 lines · Marek Vasut
Quoted 7 lines

Dear Jos? Miguel Gon?alves,

Quoted 2 lines

Jumping to board_init_r is not performed due to a bug on address computation.

Is your CONFIG_SYS_TEXT_BASE configured correctly? I don't detect any misbehavior on my arm926 boards.

Maybe because you are not using it to build an SPL?

I do ... and I use CONFIG_SPL_TEXT_BASE properly .

Quoted 2 lines

Please check the same chunk of code in other start.S for arm1176 and armv7. They have the same code that I put for arm926ejs.

Please wait and please first explain what is the issue.

Quoted 7 lines
Quoted 1 line

The issue is what I've explained in the patch comments.

"Jumping to board_init_r is not performed due to a bug on address computation."

Ok, I don't know how to replicate the bug from this comment or what effects it causes or ... well, anything. So please, try to be more elaborate in your patch description next time. Anyway ..

Same for me - I have no idea what you are trying to fix here. In my SPL configuration, _TEXT_BASE and _start point to the same location, so please explain why they are different on your board.

Quoted 8 lines
Quoted 3 lines

Without this
change the code never reaches board_init_r in the SPL and I think I have all the configurations correctly set.

I wonder why you'd ever want to reach board_init_r in the SPL. SPL is there only to load the real U-Boot from whatever media, so you usually use either NAND SPL or something like that.

Marek, going into board_init_r is fine for SPL, for example the davinci SPL does some hw initialization in board_init_f and then loads u-boot in board_init_r.
Regards, Christian

Quoted 80 lines

What do you boot the rest from ?

Quoted 66 lines

If the bug is not from here please
suggest me what I need to change in the configuration in order to correctly boot my board.

Quoted 62 lines
Quoted 62 lines
Quoted 3 lines
Quoted 1 line

Relocation offsets are not needed when building SPL.

Do they cause any trouble?

No! Just not needed.

Quoted 55 lines
Quoted 42 lines

---

Changes for v2:
- None

---

   arch/arm/cpu/arm926ejs/start.S |    4 +++-
   1 file changed, 3 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/arch/arm/cpu/arm926ejs/start.S index 6f05f1a..2da5342 100644

arch/arm/cpu/arm926ejs/start.S +1 -1
@@ -325,7 +325,7 @@ _nand_boot_ofs:
         .word nand_boot
 
   #else
 
         ldr     r0, _board_init_r_ofs
 
-        ldr     r1, _TEXT_BASE
+        adr     r1, _start

add lr, r0, r1
add lr, lr, r9
/* setup parameters for board_init_r */

arch/arm/cpu/arm926ejs/start.S +1 -0
@@ -338,12 +338,14 @@ _board_init_r_ofs:
         .word board_init_r - _start
 
   #endif
 
+#ifndef CONFIG_SPL_BUILD
 
   _rel_dyn_start_ofs:
         .word __rel_dyn_start - _start
 
   _rel_dyn_end_ofs:
         .word __rel_dyn_end - _start

arch/arm/cpu/arm926ejs/start.S _board_init_r_ofs:

Quoted 10 lines
arch/arm/cpu/arm926ejs/start.S +1 -0
 
   _dynsym_start_ofs:
         .word __dynsym_start - _start
 
+#endif
 
   /*
 
    ******************************************************************
    *** ****

Best regards,
Marek Vasut

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Best regards,
Jos? Gon?alves

Best regards,
Marek Vasut

Best regards,
Jos? Gon?alves

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#10 lore raw

PATCH v2 1/11 ARM: fix relocation on ARM926EJS

Quoted 21 lines · Christian Riesch

Hi,

Quoted 18 lines · Marek Vasut

Dear Jos? Miguel Gon?alves,

Quoted 16 lines · Marek Vasut
Quoted 7 lines

Dear Jos? Miguel Gon?alves,

Quoted 5 lines · Marek Vasut
Quoted 4 lines

Dear Jos? Miguel Gon?alves,

Quoted 2 lines

Jumping to board_init_r is not performed due to a bug on address computation.

Quoted 7 lines
Quoted 3 lines
Quoted 2 lines

Is your CONFIG_SYS_TEXT_BASE configured correctly? I don't detect any misbehavior on my arm926 boards.

Maybe because you are not using it to build an SPL?

I do ... and I use CONFIG_SPL_TEXT_BASE properly .

Quoted 2 lines

Please check the same chunk of code in other start.S for arm1176 and armv7. They have the same code that I put for arm926ejs.

Please wait and please first explain what is the issue.

The issue is what I've explained in the patch comments.

Quoted 8 lines
Quoted 5 lines

"Jumping to board_init_r is not performed due to a bug on address computation."

Ok, I don't know how to replicate the bug from this comment or what effects it causes or ... well, anything. So please, try to be more elaborate in your patch description next time. Anyway ..

Same for me - I have no idea what you are trying to fix here. In my SPL configuration, _TEXT_BASE and _start point to the same location, so please explain why they are different on your board.

They are different because of how start.S is implemented in arm926ejs.

In my SPL map file I see:

.text 0x0000000000000000 0xc24
arch/arm/cpu/arm926ejs/start.o(.text)
.text 0x0000000000000000 0x120
arch/arm/cpu/arm926ejs/start.o

                 0x0000000000000000                _start
                 0x0000000000000040                _TEXT_BASE
                 0x0000000000000044                _bss_start_ofs
                 0x0000000000000048                _bss_end_ofs
                 0x000000000000004c                _end_ofs
                 0x0000000000000050                IRQ_STACK_START_IN
                 0x0000000000000074                relocate_code
Quoted 82 lines
Quoted 7 lines
Quoted 3 lines

Without this
change the code never reaches board_init_r in the SPL and I think I have all the configurations correctly set.

I wonder why you'd ever want to reach board_init_r in the SPL. SPL is there only to load the real U-Boot from whatever media, so you usually use either NAND SPL or something like that.

Marek, going into board_init_r is fine for SPL, for example the davinci SPL does some hw initialization in board_init_f and then loads u-boot in board_init_r.
Regards, Christian

Quoted 70 lines

What do you boot the rest from ?

Quoted 68 lines

If the bug is not from here please
suggest me what I need to change in the configuration in order to correctly boot my board.

Quoted 54 lines
Quoted 54 lines
Quoted 2 lines
Quoted 1 line

Relocation offsets are not needed when building SPL.

Do they cause any trouble?

No! Just not needed.

Quoted 50 lines
Quoted 50 lines

---

Changes for v2:
- None

---

    arch/arm/cpu/arm926ejs/start.S |    4 +++-
    1 file changed, 3 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/arch/arm/cpu/arm926ejs/start.S index 6f05f1a..2da5342 100644

arch/arm/cpu/arm926ejs/start.S +1 -1
@@ -325,7 +325,7 @@ _nand_boot_ofs:
          .word nand_boot
 
    #else
 
          ldr     r0, _board_init_r_ofs
 
-        ldr     r1, _TEXT_BASE
+        adr     r1, _start

add lr, r0, r1
add lr, lr, r9
/* setup parameters for board_init_r */

arch/arm/cpu/arm926ejs/start.S +2 -0
@@ -338,12 +338,14 @@ _board_init_r_ofs:
          .word board_init_r - _start
 
    #endif
 
+#ifndef CONFIG_SPL_BUILD
 
    _rel_dyn_start_ofs:
          .word __rel_dyn_start - _start
 
    _rel_dyn_end_ofs:
          .word __rel_dyn_end - _start
 
    _dynsym_start_ofs:
          .word __dynsym_start - _start
 
+#endif
 
    /*
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
     ******************************************************************
     *** ****

Best regards,
Marek Vasut

Best regards,
Jos? Gon?alves

Best regards,
Marek Vasut

Best regards,
Jos? Gon?alves

Best regards,
Jos? Gon?alves

#11 lore raw

PATCH v2 1/11 ARM: fix relocation on ARM926EJS

Hi,

Quoted 54 lines · Jos? Miguel Gon?alves
Quoted 41 lines · Christian Riesch

Hi,

Quoted 28 lines · Marek Vasut

Dear Jos? Miguel Gon?alves,

Quoted 16 lines · Marek Vasut
Quoted 15 lines

Dear Jos? Miguel Gon?alves,

Quoted 11 lines · Marek Vasut
Quoted 8 lines

Dear Jos? Miguel Gon?alves,

Quoted 2 lines

Jumping to board_init_r is not performed due to a bug on address computation.

Is your CONFIG_SYS_TEXT_BASE configured correctly? I don't detect any misbehavior on my arm926 boards.

Maybe because you are not using it to build an SPL?

Quoted 8 lines
Quoted 6 lines

I do ... and I use CONFIG_SPL_TEXT_BASE properly .

Quoted 3 lines

Please check the same chunk of code in other start.S for arm1176 and armv7. They have the same code that I put for arm926ejs.

Please wait and please first explain what is the issue.

The issue is what I've explained in the patch comments.

Quoted 8 lines

"Jumping to board_init_r is not performed due to a bug on address computation."

Ok, I don't know how to replicate the bug from this comment or what effects it
causes or ... well, anything. So please, try to be more elaborate in your patch
description next time. Anyway ..

Quoted 3 lines

Same for me - I have no idea what you are trying to fix here. In my SPL configuration, _TEXT_BASE and _start point to the same location, so please explain why they are different on your board.

They are different because of how start.S is implemented in arm926ejs.

In my SPL map file I see:

.text 0x0000000000000000 0xc24
arch/arm/cpu/arm926ejs/start.o(.text)
.text 0x0000000000000000 0x120 arch/arm/cpu/arm926ejs/start.o

Quoted 7 lines
                0x0000000000000000                _start
                0x0000000000000040                _TEXT_BASE
                0x0000000000000044                _bss_start_ofs
                0x0000000000000048                _bss_end_ofs
                0x000000000000004c                _end_ofs
                0x0000000000000050                IRQ_STACK_START_IN
                0x0000000000000074                relocate_code

So _start is 0x00000000, and in your config/include/include/configs/mini2416.h you have

#define CONFIG_SPL_TEXT_BASE 0x00000000

and in arch/arm/cpu/arm926ejs/start.S we have

.globl _TEXT_BASE
_TEXT_BASE:
#ifdef CONFIG_NAND_SPL /* deprecated, use instead CONFIG_SPL_BUILD */
.word CONFIG_SYS_TEXT_BASE
#else
#ifdef CONFIG_SPL_BUILD
.word CONFIG_SPL_TEXT_BASE
#else
.word CONFIG_SYS_TEXT_BASE
#endif
#endif

So

ldr r1, _TEXT_BASE

should be the same as

adr r1, _start

However, if you do not load your SPL to 0x00000000 but to another address and execute it from there, it will be different, since adr uses relative adressing, right? Are you sure you are loading it to 0x00000000?

Regards, Christian

Quoted 103 lines
Quoted 13 lines
Quoted 7 lines
Quoted 6 lines

Without this
change the code never reaches board_init_r in the SPL and I think I have all the configurations correctly set.

Quoted 6 lines

I wonder why you'd ever want to reach board_init_r in the SPL. SPL is there only
to load the real U-Boot from whatever media, so you usually use either NAND SPL
or something like that.

Quoted 82 lines

Marek, going into board_init_r is fine for SPL, for example the davinci SPL does some hw initialization in board_init_f and then loads u-boot in board_init_r.
Regards, Christian

Quoted 77 lines

What do you boot the rest from ?

Quoted 75 lines

If the bug is not from here please
suggest me what I need to change in the configuration in order to correctly boot my board.

Quoted 63 lines
Quoted 63 lines
Quoted 3 lines
Quoted 1 line

Relocation offsets are not needed when building SPL.

Do they cause any trouble?

No! Just not needed.

Quoted 56 lines
Quoted 51 lines

---

Changes for v2:
- None

---

    arch/arm/cpu/arm926ejs/start.S |    4 +++-
    1 file changed, 3 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/arch/arm/cpu/arm926ejs/start.S index 6f05f1a..2da5342 100644

arch/arm/cpu/arm926ejs/start.S +1 -1
@@ -325,7 +325,7 @@ _nand_boot_ofs:
          .word nand_boot
 
    #else
 
          ldr     r0, _board_init_r_ofs
 
-        ldr     r1, _TEXT_BASE
+        adr     r1, _start

add lr, r0, r1
add lr, lr, r9
/* setup parameters for board_init_r */

arch/arm/cpu/arm926ejs/start.S +2 -0
@@ -338,12 +338,14 @@ _board_init_r_ofs:
          .word board_init_r - _start
 
    #endif
 
+#ifndef CONFIG_SPL_BUILD
 
    _rel_dyn_start_ofs:
          .word __rel_dyn_start - _start
 
    _rel_dyn_end_ofs:
          .word __rel_dyn_end - _start
 
    _dynsym_start_ofs:
          .word __dynsym_start - _start
 
+#endif
 
    /*
Quoted 2 lines

******************************************************************

     *** ****

Best regards,
Marek Vasut

Quoted 5 lines
Quoted 2 lines

Best regards,
Jos? Gon?alves

Best regards,
Marek Vasut

Best regards,
Jos? Gon?alves

Best regards,
Jos? Gon?alves
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#12 lore raw

PATCH v2 1/11 ARM: fix relocation on ARM926EJS

Hi Christian,

Quoted 75 lines · Christian Riesch

Hi,

Quoted 41 lines · Jos? Miguel Gon?alves
Quoted 24 lines · Christian Riesch

Hi,

Quoted 21 lines · Marek Vasut

Dear Jos? Miguel Gon?alves,

Quoted 8 lines · Marek Vasut
Quoted 7 lines

Dear Jos? Miguel Gon?alves,

Quoted 5 lines · Marek Vasut
Quoted 4 lines

Dear Jos? Miguel Gon?alves,

Quoted 2 lines

Jumping to board_init_r is not performed due to a bug on address computation.

Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
Quoted 2 lines

Is your CONFIG_SYS_TEXT_BASE configured correctly? I don't detect any misbehavior on my arm926 boards.

Maybe because you are not using it to build an SPL?

I do ... and I use CONFIG_SPL_TEXT_BASE properly .

Quoted 2 lines

Please check the same chunk of code in other start.S for arm1176 and armv7. They have the same code that I put for arm926ejs.

Please wait and please first explain what is the issue.

The issue is what I've explained in the patch comments.

"Jumping to board_init_r is not performed due to a bug on address computation."

Quoted 8 lines
Quoted 5 lines

Ok, I don't know how to replicate the bug from this comment or what effects it
causes or ... well, anything. So please, try to be more elaborate in your patch
description next time. Anyway ..

Same for me - I have no idea what you are trying to fix here. In my SPL configuration, _TEXT_BASE and _start point to the same location, so please explain why they are different on your board.

They are different because of how start.S is implemented in arm926ejs.

In my SPL map file I see:

.text 0x0000000000000000 0xc24
arch/arm/cpu/arm926ejs/start.o(.text)
.text 0x0000000000000000 0x120 arch/arm/cpu/arm926ejs/start.o

Quoted 7 lines
                 0x0000000000000000                _start
                 0x0000000000000040                _TEXT_BASE
                 0x0000000000000044                _bss_start_ofs
                 0x0000000000000048                _bss_end_ofs
                 0x000000000000004c                _end_ofs
                 0x0000000000000050                IRQ_STACK_START_IN
                 0x0000000000000074                relocate_code

So _start is 0x00000000, and in your config/include/include/configs/mini2416.h you have

#define CONFIG_SPL_TEXT_BASE 0x00000000

and in arch/arm/cpu/arm926ejs/start.S we have

.globl _TEXT_BASE
_TEXT_BASE:
#ifdef CONFIG_NAND_SPL /* deprecated, use instead CONFIG_SPL_BUILD */
.word CONFIG_SYS_TEXT_BASE
#else
#ifdef CONFIG_SPL_BUILD
.word CONFIG_SPL_TEXT_BASE
#else
.word CONFIG_SYS_TEXT_BASE
#endif
#endif

So

ldr r1, _TEXT_BASE

Quoted 8 lines

should be the same as

adr r1, _start

However, if you do not load your SPL to 0x00000000 but to another address and execute it from there, it will be different, since adr uses relative adressing, right? Are you sure you are loading it to 0x00000000?

Not an expert on ARM assembly, so cannot give any feedback on the differences between adr and ldr mnemonics.

What I know for a fact is that the S3C2416, when booting from it's internal ROM, makes a copy of the first 8KB of the NAND flash to an internal RAM (named SteppingStone), maps it at address 0 and the jumps to the start of it. This mapping is not clear in Samsung's user manual but I retrieved that information from here:

http://barebox.org/documentation/barebox-2011.05.0/dev_s3c24xx_arch.html

Quoted 94 lines

Regards, Christian

Quoted 90 lines
Quoted 11 lines
Quoted 11 lines
Quoted 5 lines

Without this
change the code never reaches board_init_r in the SPL and I think I have all the configurations correctly set.

I wonder why you'd ever want to reach board_init_r in the SPL. SPL is there only
to load the real U-Boot from whatever media, so you usually use either NAND SPL
or something like that.

Quoted 76 lines

Marek, going into board_init_r is fine for SPL, for example the davinci SPL does some hw initialization in board_init_f and then loads u-boot in board_init_r.
Regards, Christian

Quoted 71 lines

What do you boot the rest from ?

Quoted 69 lines

If the bug is not from here please
suggest me what I need to change in the configuration in order to correctly boot my board.

Quoted 55 lines
Quoted 55 lines
Quoted 2 lines
Quoted 1 line

Relocation offsets are not needed when building SPL.

Do they cause any trouble?

No! Just not needed.

Quoted 51 lines
Quoted 51 lines

---

Changes for v2:
- None

---

     arch/arm/cpu/arm926ejs/start.S |    4 +++-
     1 file changed, 3 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/arch/arm/cpu/arm926ejs/start.S index 6f05f1a..2da5342 100644

arch/arm/cpu/arm926ejs/start.S +1 -1
@@ -325,7 +325,7 @@ _nand_boot_ofs:
           .word nand_boot
 
     #else
 
           ldr     r0, _board_init_r_ofs
 
-        ldr     r1, _TEXT_BASE
+        adr     r1, _start

add lr, r0, r1
add lr, lr, r9
/* setup parameters for board_init_r */

arch/arm/cpu/arm926ejs/start.S +2 -0
@@ -338,12 +338,14 @@ _board_init_r_ofs:
           .word board_init_r - _start
 
     #endif
 
+#ifndef CONFIG_SPL_BUILD
 
     _rel_dyn_start_ofs:
           .word __rel_dyn_start - _start
 
     _rel_dyn_end_ofs:
           .word __rel_dyn_end - _start
 
     _dynsym_start_ofs:
           .word __dynsym_start - _start
 
+#endif
 
     /*
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

******************************************************************

      *** ****

Best regards,
Marek Vasut

Best regards,
Jos? Gon?alves

Best regards,
Marek Vasut

Best regards,
Jos? Gon?alves

Best regards,
Jos? Gon?alves

Best regards,
Jos? Gon?alves

#13 lore raw

PATCH v2 1/11 ARM: fix relocation on ARM926EJS

In reply to Marek Vasut
Quoted 31 lines · Marek Vasut

Dear Jos? Miguel Gon?alves,

Quoted 14 lines · Marek Vasut
Quoted 13 lines

Dear Jos? Miguel Gon?alves,

Quoted 10 lines · Marek Vasut
Quoted 7 lines

Dear Jos? Miguel Gon?alves,

Quoted 2 lines

Jumping to board_init_r is not performed due to a bug on address computation.

Is your CONFIG_SYS_TEXT_BASE configured correctly? I don't detect any misbehavior on my arm926 boards.

Maybe because you are not using it to build an SPL?

Quoted 8 lines
Quoted 6 lines

I do ... and I use CONFIG_SPL_TEXT_BASE properly .

Quoted 2 lines

Please check the same chunk of code in other start.S for arm1176 and armv7. They have the same code that I put for arm926ejs.

Please wait and please first explain what is the issue.

The issue is what I've explained in the patch comments.

"Jumping to board_init_r is not performed due to a bug on address computation."

Ok, I don't know how to replicate the bug from this comment or what effects it causes or ... well, anything. So please, try to be more elaborate in your patch description next time. Anyway ..

Quoted 6 lines
Quoted 3 lines

Without this
change the code never reaches board_init_r in the SPL and I think I have all the configurations correctly set.

I wonder why you'd ever want to reach board_init_r in the SPL. SPL is there only to load the real U-Boot from whatever media, so you usually use either NAND SPL

Here's a good point for me to jump in, I think. There's two things to understand:
- In the current in-tree SPL implementations the code flow is board_init_f calls relocate_code() to clear the BSS _and_ get our jump to board_init_r. It does not actually relocate the running U-Boot, just clears the BSS. board_init_r is what calls the things to load and boot the next stage (U-Boot or Linux).

- In my series this has been changed slightly to be board_init_f calls memset and then board_init_r directly. So this patch should not be needed once rebased on that series.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120917/db3c424d/attachment.pgp>
#14 lore raw

PATCH v2 1/11 ARM: fix relocation on ARM926EJS

Quoted 57 lines · Tom Rini
Quoted 9 lines · Marek Vasut

Dear Jos? Miguel Gon?alves,

Quoted 7 lines · Marek Vasut
Quoted 6 lines

Dear Jos? Miguel Gon?alves,

Quoted 4 lines · Marek Vasut
Quoted 3 lines

Dear Jos? Miguel Gon?alves,

Quoted 1 line

Jumping to board_init_r is not performed due to a bug on

address

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

computation.

Is your CONFIG_SYS_TEXT_BASE configured correctly? I don't

detect any

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Quoted 1 line

misbehavior on my arm926 boards.

Maybe because you are not using it to build an SPL?

I do ... and I use CONFIG_SPL_TEXT_BASE properly .

Quoted 1 line

Please check the same chunk of code in other start.S for

arm1176 and

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

armv7. They have the same code that I put for arm926ejs.

Please wait and please first explain what is the issue.

The issue is what I've explained in the patch comments.

"Jumping to board_init_r is not performed due to a bug on address

computation."

Quoted 2 lines

Ok, I don't know how to replicate the bug from this comment or what

effects it

Quoted 1 line

causes or ... well, anything. So please, try to be more elaborate

in your patch

Quoted 4 lines

description next time. Anyway ..

Quoted 2 lines

Without this
change the code never reaches board_init_r in the SPL and I think

I have

Quoted 3 lines
Quoted 1 line

all the configurations correctly set.

I wonder why you'd ever want to reach board_init_r in the SPL. SPL

is there only

Quoted 1 line

to load the real U-Boot from whatever media, so you usually use

either NAND SPL

Here's a good point for me to jump in, I think. There's two things to understand:
- In the current in-tree SPL implementations the code flow is board_init_f calls relocate_code() to clear the BSS _and_ get our
jump
to board_init_r. It does not actually relocate the running U-Boot, just clears the BSS. board_init_r is what calls the things to load and boot the next stage (U-Boot or Linux).

Quoted 3 lines

- In my series this has been changed slightly to be board_init_f calls memset and then board_init_r directly. So this patch should not be needed once rebased on that series.

So you've removed the ability to relocate at all? What about hardware where you boot from an I/O buffer, that you need to get out of in order to load more pages?

-Scott

#15 lore raw

PATCH v2 1/11 ARM: fix relocation on ARM926EJS

Quoted 58 lines · Scott Wood
Quoted 57 lines · Tom Rini
Quoted 9 lines · Marek Vasut

Dear Jos? Miguel Gon?alves,

Quoted 7 lines · Marek Vasut
Quoted 6 lines

Dear Jos? Miguel Gon?alves,

Quoted 4 lines · Marek Vasut
Quoted 3 lines

Dear Jos? Miguel Gon?alves,

Quoted 1 line

Jumping to board_init_r is not performed due to a bug on

address

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

computation.

Is your CONFIG_SYS_TEXT_BASE configured correctly? I don't

detect any

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Quoted 1 line

misbehavior on my arm926 boards.

Maybe because you are not using it to build an SPL?

I do ... and I use CONFIG_SPL_TEXT_BASE properly .

Quoted 1 line

Please check the same chunk of code in other start.S for

arm1176 and

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

armv7. They have the same code that I put for arm926ejs.

Please wait and please first explain what is the issue.

The issue is what I've explained in the patch comments.

"Jumping to board_init_r is not performed due to a bug on

address computation."

Quoted 2 lines

Ok, I don't know how to replicate the bug from this comment or

what effects it

Quoted 1 line

causes or ... well, anything. So please, try to be more

elaborate in your patch

Quoted 4 lines

description next time. Anyway ..

Quoted 2 lines

Without this
change the code never reaches board_init_r in the SPL and I

think I have

Quoted 3 lines
Quoted 1 line

all the configurations correctly set.

I wonder why you'd ever want to reach board_init_r in the SPL.

SPL is there only

Quoted 1 line

to load the real U-Boot from whatever media, so you usually use

either NAND SPL

Here's a good point for me to jump in, I think. There's two things to understand:
- In the current in-tree SPL implementations the code flow is board_init_f calls relocate_code() to clear the BSS _and_ get
our jump
to board_init_r. It does not actually relocate the running U-Boot, just clears the BSS. board_init_r is what calls the things to load and boot the next stage (U-Boot or Linux).

Quoted 7 lines
Quoted 3 lines

- In my series this has been changed slightly to be board_init_f calls memset and then board_init_r directly. So this patch should not be needed once rebased on that series.

So you've removed the ability to relocate at all? What about hardware where you boot from an I/O buffer, that you need to get out of in order to load more pages?

Then you do that instead. Getting from board_init_f to _r is setup at the arch level, weakly, and with what it must perform documented.

Signature · 1 line
Tom
#16 lore raw

PATCH v2 1/11 ARM: fix relocation on ARM926EJS

In reply to Tom Rini

Dear Tom Rini,

Quoted 49 lines · Marek Vasut
Quoted 32 lines

Dear Jos? Miguel Gon?alves,

Quoted 14 lines · Marek Vasut
Quoted 13 lines

Dear Jos? Miguel Gon?alves,

Quoted 10 lines · Marek Vasut
Quoted 7 lines

Dear Jos? Miguel Gon?alves,

Quoted 2 lines

Jumping to board_init_r is not performed due to a bug on address computation.

Is your CONFIG_SYS_TEXT_BASE configured correctly? I don't detect any misbehavior on my arm926 boards.

Maybe because you are not using it to build an SPL?

Quoted 8 lines
Quoted 6 lines

I do ... and I use CONFIG_SPL_TEXT_BASE properly .

Quoted 2 lines

Please check the same chunk of code in other start.S for arm1176 and armv7. They have the same code that I put for arm926ejs.

Please wait and please first explain what is the issue.

The issue is what I've explained in the patch comments.

"Jumping to board_init_r is not performed due to a bug on address computation."

Ok, I don't know how to replicate the bug from this comment or what effects it causes or ... well, anything. So please, try to be more elaborate in your patch description next time. Anyway ..

Quoted 7 lines
Quoted 3 lines

Without this
change the code never reaches board_init_r in the SPL and I think I have all the configurations correctly set.

I wonder why you'd ever want to reach board_init_r in the SPL. SPL is there only to load the real U-Boot from whatever media, so you usually use either NAND SPL

Here's a good point for me to jump in, I think. There's two things to understand:
- In the current in-tree SPL implementations the code flow is board_init_f calls relocate_code() to clear the BSS _and_ get our jump to board_init_r. It does not actually relocate the running U-Boot, just clears the BSS. board_init_r is what calls the things to load and boot the next stage (U-Boot or Linux).

Quoted 3 lines

- In my series this has been changed slightly to be board_init_f calls memset and then board_init_r directly. So this patch should not be needed once rebased on that series.

Do we need to do all the relocation in assembler code btw? Can it not be moved into C code and made generic across all platforms (module the stack adjustment and a few minor things) ?

Best regards,
Marek Vasut

#17 lore raw

PATCH v2 1/11 ARM: fix relocation on ARM926EJS

Quoted 51 lines · Marek Vasut

Dear Tom Rini,

Quoted 49 lines · Marek Vasut
Quoted 32 lines

Dear Jos? Miguel Gon?alves,

Quoted 14 lines · Marek Vasut
Quoted 13 lines

Dear Jos? Miguel Gon?alves,

Quoted 10 lines · Marek Vasut
Quoted 7 lines

Dear Jos? Miguel Gon?alves,

Quoted 2 lines

Jumping to board_init_r is not performed due to a bug on address computation.

Is your CONFIG_SYS_TEXT_BASE configured correctly? I don't detect any misbehavior on my arm926 boards.

Maybe because you are not using it to build an SPL?

Quoted 8 lines
Quoted 6 lines

I do ... and I use CONFIG_SPL_TEXT_BASE properly .

Quoted 2 lines

Please check the same chunk of code in other start.S for arm1176 and armv7. They have the same code that I put for arm926ejs.

Please wait and please first explain what is the issue.

The issue is what I've explained in the patch comments.

"Jumping to board_init_r is not performed due to a bug on address computation."

Ok, I don't know how to replicate the bug from this comment or what effects it causes or ... well, anything. So please, try to be more elaborate in your patch description next time. Anyway ..

Quoted 7 lines
Quoted 3 lines

Without this
change the code never reaches board_init_r in the SPL and I think I have all the configurations correctly set.

I wonder why you'd ever want to reach board_init_r in the SPL. SPL is there only to load the real U-Boot from whatever media, so you usually use either NAND SPL

Here's a good point for me to jump in, I think. There's two things to understand:
- In the current in-tree SPL implementations the code flow is board_init_f calls relocate_code() to clear the BSS _and_ get our jump to board_init_r. It does not actually relocate the running U-Boot, just clears the BSS. board_init_r is what calls the things to load and boot the next stage (U-Boot or Linux).

Quoted 7 lines
Quoted 3 lines

- In my series this has been changed slightly to be board_init_f calls memset and then board_init_r directly. So this patch should not be needed once rebased on that series.

Do we need to do all the relocation in assembler code btw? Can it not be moved into C code and made generic across all platforms (module the stack adjustment and a few minor things) ?

I think people have posted patches for this before and yes, once CONFIG_NEEDS_MANUAL_RELOC dies it should be all possible to do in C, so long as it doesn't grow in size or doesn't grow in size that would be problematic (remember the 4kb people).

Signature · 1 line
Tom
#18 lore raw

PATCH v2 1/11 ARM: fix relocation on ARM926EJS

Dear Tom Rini,

Quoted 58 lines · Marek Vasut
Quoted 57 lines

Dear Tom Rini,

Quoted 54 lines · Marek Vasut
Quoted 32 lines

Dear Jos? Miguel Gon?alves,

Quoted 14 lines · Marek Vasut
Quoted 13 lines

Dear Jos? Miguel Gon?alves,

Quoted 10 lines · Marek Vasut
Quoted 7 lines

Dear Jos? Miguel Gon?alves,

Quoted 2 lines

Jumping to board_init_r is not performed due to a bug on address computation.

Is your CONFIG_SYS_TEXT_BASE configured correctly? I don't detect any misbehavior on my arm926 boards.

Maybe because you are not using it to build an SPL?

Quoted 8 lines
Quoted 6 lines

I do ... and I use CONFIG_SPL_TEXT_BASE properly .

Quoted 2 lines

Please check the same chunk of code in other start.S for arm1176 and armv7. They have the same code that I put for arm926ejs.

Please wait and please first explain what is the issue.

The issue is what I've explained in the patch comments.

"Jumping to board_init_r is not performed due to a bug on address computation."

Ok, I don't know how to replicate the bug from this comment or what effects it causes or ... well, anything. So please, try to be more elaborate in your patch description next time. Anyway ..

Quoted 7 lines
Quoted 3 lines

Without this
change the code never reaches board_init_r in the SPL and I think I have all the configurations correctly set.

I wonder why you'd ever want to reach board_init_r in the SPL. SPL is there only to load the real U-Boot from whatever media, so you usually use either NAND SPL

Here's a good point for me to jump in, I think. There's two things to understand:
- In the current in-tree SPL implementations the code flow is

board_init_f calls relocate_code() to clear the BSS _and_ get our jump to board_init_r. It does not actually relocate the running U-Boot, just clears the BSS. board_init_r is what calls the things to load and boot the next stage (U-Boot or Linux).

- In my series this has been changed slightly to be board_init_f calls

memset and then board_init_r directly. So this patch should not be needed once rebased on that series.

Quoted 8 lines
Quoted 3 lines

Do we need to do all the relocation in assembler code btw? Can it not be moved into C code and made generic across all platforms (module the stack adjustment and a few minor things) ?

I think people have posted patches for this before and yes, once CONFIG_NEEDS_MANUAL_RELOC dies it should be all possible to do in C, so long as it doesn't grow in size or doesn't grow in size that would be problematic (remember the 4kb people).

How does MANUAL_RELOC interfere with that? Eg. on ARM, it can already be shifted to C. Then if we made it generic enough, those MANUAL_RELOC platforms could simply adopt the C code.

Best regards,
Marek Vasut

#19 lore raw

PATCH v2 1/11 ARM: fix relocation on ARM926EJS

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 71 lines · Marek Vasut

Dear Tom Rini,

Quoted 69 lines · Marek Vasut
Quoted 67 lines

Dear Tom Rini,

Quoted 55 lines · Marek Vasut
Quoted 36 lines

Dear Jos? Miguel Gon?alves,

Quoted 17 lines · Marek Vasut
Quoted 16 lines

Dear Jos? Miguel Gon?alves,

Quoted 11 lines · Marek Vasut
Quoted 8 lines

Dear Jos? Miguel Gon?alves,

Quoted 2 lines

Jumping to board_init_r is not performed due to a
bug on address computation.

Is your CONFIG_SYS_TEXT_BASE configured correctly? I don't detect any misbehavior on my arm926 boards.

Maybe because you are not using it to build an SPL?

I do ... and I use CONFIG_SPL_TEXT_BASE properly .

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

Please check the same chunk of code in other start.S for arm1176 and armv7. They have the same code that I put for arm926ejs.

Please wait and please first explain what is the
issue.

The issue is what I've explained in the patch comments.

"Jumping to board_init_r is not performed due to a bug on address computation."

Ok, I don't know how to replicate the bug from this comment or what effects it causes or ... well, anything. So please, try to be more elaborate in your patch description next time. Anyway ..

Quoted 7 lines
Quoted 3 lines

Without this change the code never reaches board_init_r in the SPL and I think I have all the configurations correctly set.

I wonder why you'd ever want to reach board_init_r in the SPL. SPL is there only to load the real U-Boot from whatever media, so you usually use either NAND SPL

Here's a good point for me to jump in, I think. There's two things to understand: - In the current in-tree SPL implementations the code flow is

board_init_f calls relocate_code() to clear the BSS _and_ get our jump to board_init_r. It does not actually relocate the running U-Boot, just clears the BSS. board_init_r is what calls the things to load and boot the next stage (U-Boot or Linux).

Quoted 5 lines

- In my series this has been changed slightly to be board_init_f calls

memset and then board_init_r directly. So this patch should not be needed once rebased on that series.

Do we need to do all the relocation in assembler code btw? Can it not be moved into C code and made generic across all platforms (module the stack adjustment and a few minor things) ?

Quoted 8 lines
Quoted 4 lines

I think people have posted patches for this before and yes, once CONFIG_NEEDS_MANUAL_RELOC dies it should be all possible to do in C, so long as it doesn't grow in size or doesn't grow in size that would be problematic (remember the 4kb people).

How does MANUAL_RELOC interfere with that? Eg. on ARM, it can already be shifted to C. Then if we made it generic enough, those MANUAL_RELOC platforms could simply adopt the C code.

Yes, one of the platforms that already has C code for ELF relocation (x86, iirc) could be made more generic and I think someone (Graeme?) already started this a long time ago as part of making a generic set of functions for board_init_{f,r}. Just can't make it for all platforms until everyone has ELF is the point I was poorly making.

- --
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQIcBAEBAgAGBQJQV2VKAAoJENk4IS6UOR1W3McP/1htBzFzXXPULGOO+1zanoaO T2tmJZ9f4gHNIY6gnCdU7SlW4mhZPEFlwHD+JwPmIS7ZhGcPxVn9Vgl+r0fpEZHW VBY1bGeSGmaLhziiT+9MmaUqKUx6IFN5nZX0ypYcHS1ZTo1JztvLSUrSdOnOYHWx DXXPwNIreUctwIpyjNrhu93e39ep1AYb1ZW+o57Sj4+uGqt8+G9FpEjdxMQrjKqh r88j7XRgfWNPiqLwuGy+7HHEXnQGDum3Aml/ojO3WSzpZYXZQ4zC4MTND+TwzSi6 h3+nB3OfYktPgFWRDYQt8VyWPl9beVHzhac3o6sF5SiclQyya0liCCNsSbDSKf/G Zjpjg5cOAmPMMUs1ZXq2Ve5wMxb0alArzxZuMZ/ZA1gRDjazFErvYCUzAQFkDAZz zB6YMNc1+iCaYyaeNOqvJdMOZXAIoGLx5bbv9dzsnYc45jeU1ScDywcOQC2jTYFf jnzmqzh/6EJW2gfWW33XdxbHsDOZeEfCzJFmK7/vEbVW0TrkiCMJjHzf/jdguABQ jhusLwYYJr5yNlwq16RmiPxIaUhBrCFLY5cxLiSTd4v0DdbqyaTC7MEadjKQLpBW /LA5ImhXr/ORhfNTrVQjDSRhAGdmi2L0GVTurHJ2I6SCIVesu/ioMCGY3sy+aizK H3jl0yobGtRNFamgK+Ld
=ncZ8
-----END PGP SIGNATURE-----

#20 lore raw

PATCH v2 1/11 ARM: fix relocation on ARM926EJS

In reply to Tom Rini
Quoted 38 lines · Tom Rini
Quoted 24 lines · Marek Vasut

Dear Jos? Miguel Gon?alves,

Quoted 8 lines · Marek Vasut
Quoted 7 lines

Dear Jos? Miguel Gon?alves,

Quoted 5 lines · Marek Vasut
Quoted 4 lines

Dear Jos? Miguel Gon?alves,

Quoted 2 lines

Jumping to board_init_r is not performed due to a bug on address computation.

Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
Quoted 2 lines

Is your CONFIG_SYS_TEXT_BASE configured correctly? I don't detect any misbehavior on my arm926 boards.

Maybe because you are not using it to build an SPL?

I do ... and I use CONFIG_SPL_TEXT_BASE properly .

Quoted 2 lines

Please check the same chunk of code in other start.S for arm1176 and armv7. They have the same code that I put for arm926ejs.

Please wait and please first explain what is the issue.

The issue is what I've explained in the patch comments.

"Jumping to board_init_r is not performed due to a bug on address computation."

Ok, I don't know how to replicate the bug from this comment or what effects it causes or ... well, anything. So please, try to be more elaborate in your patch description next time. Anyway ..

Quoted 5 lines
Quoted 3 lines

Without this
change the code never reaches board_init_r in the SPL and I think I have all the configurations correctly set.

I wonder why you'd ever want to reach board_init_r in the SPL. SPL is there only to load the real U-Boot from whatever media, so you usually use either NAND SPL

Here's a good point for me to jump in, I think. There's two things to understand:
- In the current in-tree SPL implementations the code flow is board_init_f calls relocate_code() to clear the BSS _and_ get our jump to board_init_r. It does not actually relocate the running U-Boot, just clears the BSS. board_init_r is what calls the things to load and boot the next stage (U-Boot or Linux).

Quoted 3 lines

- In my series this has been changed slightly to be board_init_f calls memset and then board_init_r directly. So this patch should not be needed once rebased on that series.

OK Tom. I will start working on rebasing the MINI2416 board support on the new SPL framework.
If I have any doubts I will get in touch with you...

Best regards,
Jos? Gon?alves

#21 lore raw

PATCH v2 1/11 ARM: fix relocation on ARM926EJS

In reply to José Miguel Gonçalves

Hi Jos?,

Quoted 29 lines · Jos? Miguel Gon?alves

Jumping to board_init_r is not performed due to a bug on address computation. Relocation offsets are not needed when building SPL.

---
Changes for v2:
- None

---
 arch/arm/cpu/arm926ejs/start.S |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/cpu/arm926ejs/start.S +2 -1
index 6f05f1a..2da5342 100644
@@ -325,7 +325,7 @@ _nand_boot_ofs:
 	.word nand_boot
 #else
 	ldr	r0, _board_init_r_ofs
-	ldr	r1, _TEXT_BASE
+	adr	r1, _start
 	add	lr, r0, r1
 	add	lr, lr, r9
 	/* setup parameters for board_init_r */
@@ -338,12 +338,14 @@ _board_init_r_ofs:
 	.word board_init_r - _start
 #endif
 
+#ifndef CONFIG_SPL_BUILD

arch/arm/cpu/arm926ejs/start.S _board_init_r_ofs: · line 351

Quoted 10 lines
arch/arm/cpu/arm926ejs/start.S +1 -0
 _rel_dyn_start_ofs:
 	.word __rel_dyn_start - _start
 _rel_dyn_end_ofs:
 	.word __rel_dyn_end - _start
 _dynsym_start_ofs:
 	.word __dynsym_start - _start
+#endif
 
 /*
  *************************************************************************

Deferring decision on this one until after 2012.10.

Amicalement,

Signature · 1 line
Albert.
#22 lore raw

PATCH v2 2/11 S3C24XX: Add core support for Samsung's S3C24XX SoCs

In reply to José Miguel Gonçalves

This patch adds the support for Samsung's S3C24XX SoCs that have an ARM926EJS core. Currently it supports S3C2412, S3C2413, S3C2416 and S3C2450.
Tested on an S3C2416 platform.

---
Changes for v2:
- Added register bit macros to avoid magic numbers
- Removed volatile attribute from register structs
- Added s3c24x0_cpu.h to be able to use drivers from s3c24x0 family
- Fixed EPLL computation in get_PLLCLK for S3C2416
- Added display of UCLK in print_cpu_info
- Use of clrsetbits_le32()

---
 arch/arm/cpu/arm926ejs/s3c24xx/Makefile         |   52 ++
 arch/arm/cpu/arm926ejs/s3c24xx/cpu.c            |   56 +++
 arch/arm/cpu/arm926ejs/s3c24xx/cpu_info.c       |   57 +++
 arch/arm/cpu/arm926ejs/s3c24xx/s3c2412_speed.c  |  114 +++++
 arch/arm/cpu/arm926ejs/s3c24xx/s3c2416_speed.c  |  116 +++++
 arch/arm/cpu/arm926ejs/s3c24xx/timer.c          |  152 ++++++
 arch/arm/include/asm/arch-s3c24xx/s3c2412.h     |  120 +++++
 arch/arm/include/asm/arch-s3c24xx/s3c2416.h     |  175 +++++++
 arch/arm/include/asm/arch-s3c24xx/s3c24x0_cpu.h |   41 ++
 arch/arm/include/asm/arch-s3c24xx/s3c24xx.h     |  598 +++++++++++++++++++++++
 arch/arm/include/asm/arch-s3c24xx/s3c24xx_cpu.h |   30 ++
 include/common.h                                |    1 +
 12 files changed, 1512 insertions(+)
 create mode 100644 arch/arm/cpu/arm926ejs/s3c24xx/Makefile
 create mode 100644 arch/arm/cpu/arm926ejs/s3c24xx/cpu.c
 create mode 100644 arch/arm/cpu/arm926ejs/s3c24xx/cpu_info.c
 create mode 100644 arch/arm/cpu/arm926ejs/s3c24xx/s3c2412_speed.c
 create mode 100644 arch/arm/cpu/arm926ejs/s3c24xx/s3c2416_speed.c
 create mode 100644 arch/arm/cpu/arm926ejs/s3c24xx/timer.c
 create mode 100644 arch/arm/include/asm/arch-s3c24xx/s3c2412.h
 create mode 100644 arch/arm/include/asm/arch-s3c24xx/s3c2416.h
 create mode 100644 arch/arm/include/asm/arch-s3c24xx/s3c24x0_cpu.h
 create mode 100644 arch/arm/include/asm/arch-s3c24xx/s3c24xx.h
 create mode 100644 arch/arm/include/asm/arch-s3c24xx/s3c24xx_cpu.h
arch/arm/cpu/arm926ejs/s3c24xx/Makefile new file +52 -0
new file mode 100644
index 0000000..62b8378
@@ -0,0 +1,52 @@
+#
+# (C) Copyright 2012 INOV - INESC Inovacao
+# Jose Goncalves <[email protected]>
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(SOC).o
+
+COBJS-$(CONFIG_DISPLAY_CPUINFO)	+= cpu_info.o
+ifeq ($(filter y,$(CONFIG_S3C2412) $(CONFIG_S3C2413)),y)
+COBJS-y	+= s3c2412_speed.o
+else
+COBJS-y	+= s3c2416_speed.o
+endif
+COBJS-y	+= cpu.o
+COBJS-y	+= timer.o
+
+SRCS	:= $(COBJS-y:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS-y))
+
+all:	$(obj).depend $(LIB)
+
+$(LIB):	$(OBJS)
+	$(call cmd_link_o_target, $(OBJS))
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
arch/arm/cpu/arm926ejs/s3c24xx/cpu.c new file +56 -0

56 lines not on this page · raw message

arch/arm/cpu/arm926ejs/s3c24xx/cpu_info.c new file +57 -0

57 lines not on this page · raw message

arch/arm/cpu/arm926ejs/s3c24xx/s3c2412_speed.c new file +114 -0

114 lines not on this page · raw message

arch/arm/cpu/arm926ejs/s3c24xx/s3c2416_speed.c new file +116 -0

116 lines not on this page · raw message

arch/arm/cpu/arm926ejs/s3c24xx/timer.c new file +152 -0

152 lines not on this page · raw message

arch/arm/include/asm/arch-s3c24xx/s3c2412.h new file +120 -0

120 lines not on this page · raw message

arch/arm/include/asm/arch-s3c24xx/s3c2416.h new file +175 -0

175 lines not on this page · raw message

arch/arm/include/asm/arch-s3c24xx/s3c24x0_cpu.h new file +41 -0

41 lines not on this page · raw message

arch/arm/include/asm/arch-s3c24xx/s3c24xx.h new file +598 -0

598 lines not on this page · raw message

arch/arm/include/asm/arch-s3c24xx/s3c24xx_cpu.h new file +30 -0
new file mode 100644
index 0000000..59ccfd4
@@ -0,0 +1,30 @@
+/*
+ * (C) Copyright 2012 INOV - INESC Inovacao
+ * Jose Goncalves <[email protected]>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#if defined(CONFIG_S3C2412) || defined(CONFIG_S3C2413)
+#include <asm/arch/s3c2412.h>
+#elif defined(CONFIG_S3C2416) || defined(CONFIG_S3C2450)
+#include <asm/arch/s3c2416.h>
+#else
+#error Please define the S3C24XX SoC type
+#endif
include/common.h +1 -0
index 55025c0..36f0636 100644
@@ -628,6 +628,7 @@ ulong	get_OPB_freq (void);
 ulong	get_PCI_freq (void);
 #endif
 #if defined(CONFIG_S3C24X0) || \
+    defined(CONFIG_S3C24XX) || \
     defined(CONFIG_LH7A40X) || \
     defined(CONFIG_S3C6400) || \
     defined(CONFIG_EP93XX)
Signature · 1 line
1.7.9.5
#23 lore raw

PATCH v2 2/11 S3C24XX: Add core support for Samsung's S3C24XX SoCs

Dear Jos? Miguel Gon?alves,

It's getting better :)

[...]

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+typedef ulong(*getfreq) (void);

Is this used?

Quoted 1 line

+static const getfreq freq_f[] = {

const array const members, no?

arch/arm/cpu/arm926ejs/s3c24xx/cpu_info.c line 40

Quoted 7 lines
arch/arm/cpu/arm926ejs/s3c24xx/cpu_info.c new file +7 -0
+	get_FCLK,
+	get_HCLK,
+	get_PCLK,
+	get_UCLK,
+};
+
+static const char freq_c[] = { 'F', 'H', 'P', 'U' };

Same here.

Quoted 16 lines
arch/arm/cpu/arm926ejs/s3c24xx/cpu_info.c new file +16 -0
+int print_cpuinfo(void)
+{
+	int i;
+	char buf[32];
+	ulong cpuid;
+	struct s3c24xx_gpio *const gpio = s3c24xx_get_base_gpio();
+
+	cpuid = readl(&gpio->gstatus[1]);
+	printf("CPU:  %8s (id %08lX) @ %s MHz\n", s3c24xx_get_cpu_name(),
+	       cpuid, strmhz(buf, get_ARMCLK()));
+	for (i = 0; i < ARRAY_SIZE(freq_f); i++)
+		printf("%cCLK: %8s MHz\n", freq_c[i],
+		       strmhz(buf, freq_f[i] ()));
+
+	return 0;
+}

[...]

arch/arm/cpu/arm926ejs/s3c24xx/s3c2412_speed.c line 81

Quoted 9 lines
arch/arm/cpu/arm926ejs/s3c24xx/s3c2412_speed.c new file +9 -0
+ulong get_HCLK(void)
+{
+	struct s3c2412_sysctl *const sysctl = s3c2412_get_base_sysctl();
+	u32 clkdivn;
+	u16 hclk_div, arm_div;
+
+	clkdivn = readl(&sysctl->clkdivn);
+	hclk_div = (clkdivn & 0x3) + 1;
+	arm_div = ((clkdivn >> 3) & 0x1) + 1;

Magic.

arch/arm/cpu/arm926ejs/s3c24xx/s3c2412_speed.c line 94

Quoted 12 lines
arch/arm/cpu/arm926ejs/s3c24xx/s3c2412_speed.c new file +12 -0
+	return get_FCLK() / (hclk_div * arm_div);
+}
+
+/* return PCLK frequency */
+ulong get_PCLK(void)
+{
+	struct s3c2412_sysctl *const sysctl = s3c2412_get_base_sysctl();
+	u32 clkdivn;
+
+	clkdivn = readl(&sysctl->clkdivn);
+
+	return (clkdivn & 0x4) ? get_HCLK() / 2 : get_HCLK();

Magic

Quoted 7 lines
arch/arm/cpu/arm926ejs/s3c24xx/s3c2412_speed.c new file +7 -0
+}
+
+/* return UCLK frequency */
+ulong get_UCLK(void)
+{
+	return get_PLLCLK(UPLL);
+}

arch/arm/cpu/arm926ejs/s3c24xx/s3c2412_speed.c line 111

Quoted 10 lines
arch/arm/cpu/arm926ejs/s3c24xx/s3c2412_speed.c new file +10 -0
+
+/* return ARMCORE frequency */
+ulong get_ARMCLK(void)
+{
+	struct s3c2412_sysctl *const sysctl = s3c2412_get_base_sysctl();
+	u32 clkdivn;
+
+	clkdivn = readl(&sysctl->clkdivn);
+	if (clkdivn & 0x10)
+		return get_FCLK();

Magic above and below and in the following file

Quoted 2 lines
arch/arm/cpu/arm926ejs/s3c24xx/s3c2412_speed.c new file +2 -0
+	return (clkdivn & 0x8) ? get_FCLK() / 2 : get_FCLK();
+}

[...]

Quoted 107 lines
(quoted diff) +0 -0

b/arch/arm/cpu/arm926ejs/s3c24xx/timer.c new file mode 100644 index 0000000..23d3343

arch/arm/cpu/arm926ejs/s3c24xx/timer.c new file +5 -0
@@ -0,0 +1,152 @@
+/*
+ * (C) Copyright 2012 INOV - INESC Inovacao
+ * Jose Goncalves <[email protected]>
+ *
+ * Based on arch/arm/cpu/armv7/s5p-common/timer.c and U-Boot 1.3.4 from

Samsung. + *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */

arch/arm/cpu/arm926ejs/s3c24xx/timer.c new file +77 -0
+
+#include <common.h>
+#include <asm/io.h>
+#include <asm/arch/s3c24xx_cpu.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static ulong get_current_tick(void)
+{
+	struct s3c24xx_timers *const timers = s3c24xx_get_base_timers();
+	ulong now = readl(&timers->tcnto4);
+
+	if (gd->lastinc >= now)
+		gd->tbl += gd->lastinc - now;
+	else
+		gd->tbl += gd->lastinc + gd->tbu - now;
+
+	gd->lastinc = now;
+
+	return gd->tbl;
+}
+
+int timer_init(void)
+{
+	struct s3c24xx_timers *const timers = s3c24xx_get_base_timers();
+
+	/* use PWM Timer 4 because it has no output */
+	if (gd->tbu == 0) {
+		/* set divider value for Timer 4 to 2 */
+		clrsetbits_le32(&timers->tcfg1, TCFG1_MUX4_MASK,
+				TCFG1_MUX4_DIV2);
+		/* set prescaler value for Timer 4 to 15 */
+		clrsetbits_le32(&timers->tcfg0, TCFG0_PRESCALER1_MASK,
+				TCFG0_PRESCALER1(15));
+		/*
+		 * Timer Freq(HZ) =
+		 *      PCLK / (prescaler_value + 1) / (divider_value)
+		 */
+		gd->timer_rate_hz = get_PCLK() / (15 + 1) / 2;
+		gd->tbu = gd->timer_rate_hz / CONFIG_SYS_HZ;
+	}
+	/* load value for selected timeout */
+	writel(gd->tbu, &timers->tcntb4);
+	/* auto reload, manual update of timer 4 */
+	clrsetbits_le32(&timers->tcon, TCON_T4START,
+			TCON_T4RELOAD | TCON_T4MANUALUPD);
+	/* auto reload, start timer 4 */
+	clrsetbits_le32(&timers->tcon, TCON_T4MANUALUPD,
+			TCON_T4RELOAD | TCON_T4START);
+	gd->lastinc = 0;
+	gd->tbl = 0;
+
+	return 0;
+}
+
+ulong get_timer(ulong base)
+{
+	return get_timer_masked() - base;
+}
+
+void __udelay(unsigned long usec)
+{
+	ulong tmo, tmp;
+
+	if (usec >= 1000) {
+		/*
+		 * if "big" number, spread normalization
+		 * to seconds
+		 * 1. start to normalize for usec to ticks per sec
+		 * 2. find number of "ticks" to wait to achieve target
+		 * 3. finish normalize.
+		 */
+		tmo = usec / 1000;
+		tmo *= gd->timer_rate_hz;
+		tmo /= 1000;
+	} else {
+		/* else small number, don't kill it prior to HZ multiply */

arch/arm/cpu/arm926ejs/s3c24xx/timer.c line 111

Quoted 10 lines
arch/arm/cpu/arm926ejs/s3c24xx/timer.c new file +10 -0
+		tmo = usec * gd->timer_rate_hz;
+		tmo /= (1000 * 1000);
+	}
+
+	/* get current timestamp */
+	tmp = get_current_tick();
+
+	/* if setting this fordward will roll time stamp */
+	/* reset "advancing" timestamp to 0, set lastinc value */
+	/* else, set advancing stamp wake up time */

/*
* multi
* line
* comment
*/

Quoted 41 lines
arch/arm/cpu/arm926ejs/s3c24xx/timer.c new file +26 -0
+	if ((tmo + tmp + 1) < tmp)
+		reset_timer_masked();
+	else
+		tmo += tmp;
+
+	/* loop till event */
+	while (get_current_tick() < tmo)
+		/* NOP */;
+}
+
+void reset_timer_masked(void)
+{
+	struct s3c24xx_timers *const timers = s3c24xx_get_base_timers();
+
+	/* reset time */
+	gd->lastinc = readl(&timers->tcnto4);
+	gd->tbl = 0;
+}
+
+ulong get_timer_masked(void)
+{
+	return get_current_tick() / gd->tbu;
+}
+
+/*
+ * This function is derived from PowerPC code (read timebase as long

long). + * On ARM it just returns the timer value.
+ */

arch/arm/cpu/arm926ejs/s3c24xx/timer.c new file +13 -0
+unsigned long long get_ticks(void)
+{
+	return get_timer_masked();
+}
+
+/*
+ * This function is derived from PowerPC code (timebase clock frequency).
+ * On ARM it returns the number of timer ticks per second.
+ */
+ulong get_tbclk(void)
+{
+	return CONFIG_SYS_HZ;
+}

[...]

include/common.h ulong get_OPB_freq (void); · line 634

Quoted 12 lines
include/common.h +1 -0
index 55025c0..36f0636 100644
@@ -628,6 +628,7 @@ ulong	get_OPB_freq (void);
 ulong	get_PCI_freq (void);
 #endif
 #if defined(CONFIG_S3C24X0) || \
+    defined(CONFIG_S3C24XX) || \
     defined(CONFIG_LH7A40X) || \
     defined(CONFIG_S3C6400) || \
     defined(CONFIG_EP93XX)

What's this change? Split into different patch please.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#25 lore raw

PATCH v2 2/11 S3C24XX: Add core support for Samsung's S3C24XX SoCs

Dear Jos? Miguel Gon?alves,

Quoted 9 lines

Hi Marek,

Quoted 3 lines · Marek Vasut

Dear Jos? Miguel Gon?alves,

It's getting better :)

Hopefully :-)

Quoted 8 lines
Quoted 6 lines

[...]

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+typedef ulong(*getfreq) (void);

Is this used?

In the array declaration bellow...

Why, these are only values, no ?

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

+static const getfreq freq_f[] = {

const array const members, no?

Do you mean I should declare it like this:

static const getfreq const freq[] = { ...

Yes

Quoted 2 lines

I don't see the point because an array has no other storage besides it's elements. Moreover GCC generates the same object code in both ways.

Type checking, if you ever decided to write into the array, it'll prevent you from doing so.

Quoted 41 lines
Quoted 29 lines

arch/arm/cpu/arm926ejs/s3c24xx/cpu_info.c line 40

Quoted 7 lines
arch/arm/cpu/arm926ejs/s3c24xx/cpu_info.c new file +7 -0
+	get_FCLK,
+	get_HCLK,
+	get_PCLK,
+	get_UCLK,
+};
+
+static const char freq_c[] = { 'F', 'H', 'P', 'U' };

Same here.

Quoted 16 lines
arch/arm/cpu/arm926ejs/s3c24xx/cpu_info.c new file +16 -0
+int print_cpuinfo(void)
+{
+	int i;
+	char buf[32];
+	ulong cpuid;
+	struct s3c24xx_gpio *const gpio = s3c24xx_get_base_gpio();
+
+	cpuid = readl(&gpio->gstatus[1]);
+	printf("CPU:  %8s (id %08lX) @ %s MHz\n", s3c24xx_get_cpu_name(),
+	       cpuid, strmhz(buf, get_ARMCLK()));
+	for (i = 0; i < ARRAY_SIZE(freq_f); i++)
+		printf("%cCLK: %8s MHz\n", freq_c[i],
+		       strmhz(buf, freq_f[i] ()));
+
+	return 0;
+}

[...]

Quoted 11 lines

arch/arm/cpu/arm926ejs/s3c24xx/s3c2412_speed.c line 81

Quoted 9 lines
arch/arm/cpu/arm926ejs/s3c24xx/s3c2412_speed.c new file +9 -0
+ulong get_HCLK(void)
+{
+	struct s3c2412_sysctl *const sysctl = s3c2412_get_base_sysctl();
+	u32 clkdivn;
+	u16 hclk_div, arm_div;
+
+	clkdivn = readl(&sysctl->clkdivn);
+	hclk_div = (clkdivn & 0x3) + 1;
+	arm_div = ((clkdivn >> 3) & 0x1) + 1;

Magic.

Quoted 2 lines

Missed that... I will fix it.

There's more, globally please.

[...]

Quoted 18 lines
Quoted 10 lines
Quoted 10 lines
include/common.h +0 -0
index 55025c0..36f0636 100644
@@ -628,6 +628,7 @@ ulong	get_OPB_freq (void);
 
  ulong	get_PCI_freq (void);
  #endif
  #if defined(CONFIG_S3C24X0) || \
 
Quoted 7 lines
Quoted 5 lines
include/common.h +1 -0
+    defined(CONFIG_S3C24XX) || \
 
      defined(CONFIG_LH7A40X) || \
      defined(CONFIG_S3C6400) || \

defined(CONFIG_EP93XX)

What's this change? Split into different patch please.

Quoted 3 lines

This is related. I need this to export the functions get_FCLK(), get_HCLK(), get_PCLK() and get_UCLK() used in arch/arm/cpu/arm926ejs/s3c24xx/cpu_info.c

OK

Quoted 2 lines

Best regards,
Jos? Gon?alves

#26 lore raw

PATCH v2 2/11 S3C24XX: Add core support for Samsung's S3C24XX SoCs

Quoted 13 lines · Marek Vasut

Dear Jos? Miguel Gon?alves,

Quoted 11 lines

Hi Marek,

Quoted 3 lines · Marek Vasut

Dear Jos? Miguel Gon?alves,

It's getting better :)

Hopefully :-)

Quoted 2 lines

[...]

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+typedef ulong(*getfreq) (void);

Is this used?

In the array declaration bellow...

Why, these are only values, no ?

They're function pointers. If they were values the compiler should complain, because "getfreq" is used as the type of the array.

Quoted 9 lines
Quoted 7 lines
Quoted 3 lines
Quoted 1 line

+static const getfreq freq_f[] = {

const array const members, no?

Do you mean I should declare it like this:

static const getfreq const freq[] = { ...

Yes

Why? When can you ever change what an array (not a pointer) points to?

Quoted 5 lines
Quoted 2 lines

I don't see the point because an array has no other storage besides it's elements. Moreover GCC generates the same object code in both ways.

Type checking, if you ever decided to write into the array, it'll prevent you from doing so.

The first const takes care of that.

-Scott

#27 lore raw

PATCH v2 2/11 S3C24XX: Add core support for Samsung's S3C24XX SoCs

Dear Scott Wood,

Quoted 30 lines · Marek Vasut
Quoted 13 lines

Dear Jos? Miguel Gon?alves,

Quoted 11 lines

Hi Marek,

Quoted 3 lines · Marek Vasut

Dear Jos? Miguel Gon?alves,

It's getting better :)

Hopefully :-)

Quoted 2 lines

[...]

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+typedef ulong(*getfreq) (void);

Is this used?

In the array declaration bellow...

Why, these are only values, no ?

They're function pointers. If they were values the compiler should complain, because "getfreq" is used as the type of the array.

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Quoted 1 line

+static const getfreq freq_f[] = {

const array const members, no?

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

Do you mean I should declare it like this:

static const getfreq const freq[] = { ...

Yes

Why? When can you ever change what an array (not a pointer) points to?

Uh oh ... now I see the stuff with the functions. Crazy

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

I don't see the point because an array has no other storage besides it's elements. Moreover GCC generates the same object code in both ways.

Type checking, if you ever decided to write into the array, it'll prevent you from doing so.

The first const takes care of that.

Doesn't one prevent you from manupulating the elements and the other manipulating the array ?

Quoted 1 line

-Scott

Best regards,
Marek Vasut

#28 lore raw

PATCH v2 2/11 S3C24XX: Add core support for Samsung's S3C24XX SoCs

Quoted 46 lines · Marek Vasut

Dear Scott Wood,

Quoted 30 lines · Marek Vasut
Quoted 13 lines

Dear Jos? Miguel Gon?alves,

Quoted 11 lines

Hi Marek,

Quoted 3 lines · Marek Vasut

Dear Jos? Miguel Gon?alves,

It's getting better :)

Hopefully :-)

Quoted 2 lines

[...]

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+typedef ulong(*getfreq) (void);

Is this used?

In the array declaration bellow...

Why, these are only values, no ?

They're function pointers. If they were values the compiler should complain, because "getfreq" is used as the type of the array.

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Quoted 1 line

+static const getfreq freq_f[] = {

const array const members, no?

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

Do you mean I should declare it like this:

static const getfreq const freq[] = { ...

Yes

Why? When can you ever change what an array (not a pointer) points to?

Uh oh ... now I see the stuff with the functions. Crazy

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

I don't see the point because an array has no other storage besides it's elements. Moreover GCC generates the same object code in both ways.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Type checking, if you ever decided to write into the array, it'll prevent you from doing so.

The first const takes care of that.

Doesn't one prevent you from manupulating the elements and the other manipulating the array ?

No. These are all identical:

const int foo[];
int const foo[];
const int const foo[];
const const const int const const const foo[];

If it were a pointer, then there would be a difference between these:

const int *foo; (pointed-to data is const) int *const foo; (pointer itself is const) const int *const foo; (both are const)

...but still there's no distinction between these:

const int *foo;
const int const *foo;

-Scott

#29 lore raw

PATCH v2 2/11 S3C24XX: Add core support for Samsung's S3C24XX SoCs

In reply to José Miguel Gonçalves
Quoted 3 lines · Jos?? Miguel Gon??alves

This patch adds the support for Samsung's S3C24XX SoCs that have an ARM926EJS core. Currently it supports S3C2412, S3C2413, S3C2416 and S3C2450.
Tested on an S3C2416 platform.

[snip]

Quoted 9 lines
arch/arm/cpu/arm926ejs/s3c24xx/cpu.c new file +9 -0
+/*
+ * Reset the cpu by setting up the watchdog timer and let him time out.
+ */
+void reset_cpu(ulong addr)
+{
+	struct s3c24xx_watchdog *const watchdog = s3c24xx_get_base_watchdog();
+
+	/* Disable watchdog */
+	writel(0x0000, &watchdog->wtcon);

arch/arm/cpu/arm926ejs/s3c24xx/cpu.c line 56

Quoted 10 lines
arch/arm/cpu/arm926ejs/s3c24xx/cpu.c new file +10 -0
+
+	/* Initialize watchdog timer count register */
+	writel(0x0001, &watchdog->wtcnt);
+
+	/* Enable watchdog timer; assert reset at timer timeout */
+	writel(WTCON_RSTEN | WTCON_ENABLE, &watchdog->wtcon);
+
+	while (1)
+		/* loop forever and wait for reset to happen */;
+}

As we're dealing with in another series, this should be __noreturn (from <linux/compiler.h>).

Also, please audit your new headers to make sure you aren't adding structs / defines / etc that you aren't using by the end of the series, and make sure to note in the cover letter that you are checkpatch clean or explain away the false positives. Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120914/936e5684/attachment.pgp>
#30 lore raw

PATCH v2 3/11 serial: Add support to 4 ports in serial_s3c24x0

In reply to José Miguel Gonçalves

S3C2416 and S3C2450 have 4 UARTs insted of 3 found on older chips. This patch adds support to the additional UART port and changes the mapping between CONFIG_SERIAL? and S3C24X0_UART? in order they have a direct correspondence.

---
Changes for v2:
- New patch

---
 drivers/serial/serial_s3c24x0.c |   25 ++++++++++++++++++-------
 include/configs/VCMA9.h         |    2 +-
 include/configs/smdk2410.h      |    2 +-
 3 files changed, 20 insertions(+), 9 deletions(-)
drivers/serial/serial_s3c24x0.c +18 -7
index 12bcdd3..280cd2d 100644
@@ -2,6 +2,9 @@
  * (C) Copyright 2002
  * Gary Jennejohn, DENX Software Engineering, <[email protected]>
  *
+ * (C) Copyright 2012 INOV - INESC Inovacao
+ * Jose Goncalves <[email protected]>
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
@@ -24,17 +27,20 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#ifdef CONFIG_SERIAL1
+#if defined(CONFIG_SERIAL0)
 #define UART_NR	S3C24X0_UART0
 
-#elif defined(CONFIG_SERIAL2)
+#elif defined(CONFIG_SERIAL1)
 #define UART_NR	S3C24X0_UART1
 
-#elif defined(CONFIG_SERIAL3)
+#elif defined(CONFIG_SERIAL2)
 #define UART_NR	S3C24X0_UART2
 
+#elif defined(CONFIG_SERIAL3)
+#define UART_NR	S3C24X0_UART3
+
 #else
-#error "Bad: you didn't configure serial ..."
+#error "You didn't configure serial."
 #endif
 
 #include <asm/io.h>
@@ -310,15 +316,20 @@ INIT_S3C_SERIAL_STRUCTURE(1, "s3ser1");
 DECLARE_S3C_SERIAL_FUNCTIONS(2);
 struct serial_device s3c24xx_serial2_device =
 INIT_S3C_SERIAL_STRUCTURE(2, "s3ser2");
+DECLARE_S3C_SERIAL_FUNCTIONS(3);
+struct serial_device s3c24xx_serial3_device =
+INIT_S3C_SERIAL_STRUCTURE(3, "s3ser3");
 
 __weak struct serial_device *default_serial_console(void)
 {
-#if defined(CONFIG_SERIAL1)
+#if defined(CONFIG_SERIAL0)
 	return &s3c24xx_serial0_device;
-#elif defined(CONFIG_SERIAL2)
+#elif defined(CONFIG_SERIAL1)
 	return &s3c24xx_serial1_device;
-#elif defined(CONFIG_SERIAL3)
+#elif defined(CONFIG_SERIAL2)
 	return &s3c24xx_serial2_device;
+#elif defined(CONFIG_SERIAL3)
+	return &s3c24xx_serial3_device;
 #else
 #error "CONFIG_SERIAL? missing."
 #endif
include/configs/VCMA9.h +1 -1
index 06adc94..46bc22d 100644
@@ -120,7 +120,7 @@
  * select serial console configuration
  */
 #define CONFIG_S3C24X0_SERIAL
-#define CONFIG_SERIAL1		1	/* we use SERIAL 1 on VCMA9 */
+#define CONFIG_SERIAL0		1	/* we use SERIAL 0 on VCMA9 */
 
 /* USB support (currently only works with D-cache off) */
 #define CONFIG_USB_OHCI
include/configs/smdk2410.h +1 -1
index 1c0978d..5daa3fe 100644
@@ -60,7 +60,7 @@
  * select serial console configuration
  */
 #define CONFIG_S3C24X0_SERIAL
-#define CONFIG_SERIAL1		1	/* we use SERIAL 1 on SMDK2410 */
+#define CONFIG_SERIAL0		1	/* we use SERIAL 0 on SMDK2410 */
 
 /************************************************************
  * USB support (currently only works with D-cache off)
Signature · 1 line
1.7.9.5
#31 lore raw

PATCH v2 4/11 serial: Use a more precise baud rate generation for serial_s3c24x0

In reply to José Miguel Gonçalves

Program udivslot register in order to obtain a more precise baudrate.

---
Changes for v2:
- New patch

---
 drivers/serial/serial_s3c24x0.c |   24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)
drivers/serial/serial_s3c24x0.c +20 -4
index 280cd2d..c9bc121 100644
@@ -92,16 +92,32 @@ DECLARE_GLOBAL_DATA_PTR;
 static int hwflow;
 #endif
 
+/*
+ * The values stored in the baud rate divisor register (UBRDIVn) and dividing
+ * slot register (UDIVSLOTn), are used to determine the serial Tx/Rx clock rate
+ * (baud rate) as follows:
+ *     DIV_VAL = UBRDIVn + (num of 1?s in UDIVSLOTn) / 16
+ * Using UDIVSLOT, which is the factor of floating point divisor, you can make
+ * more accurate baud rate. Section 2.1.10 of the S3C2416 User's Manual suggests
+ * using the constants on the following table.
+ */
+static const int udivslot[] = {
+	0x0000, 0x0080, 0x0808, 0x0888, 0x2222, 0x4924, 0x4A52, 0x54AA,
+	0x5555, 0xD555, 0xD5D5, 0xDDD5, 0xDDDD, 0xDFDD, 0xDFDF, 0xFFDF,
+};
+
 void _serial_setbrg(const int dev_index)
 {
 	struct s3c24x0_uart *uart = s3c24x0_get_base_uart(dev_index);
-	unsigned int reg = 0;
+	u32 pclk;
+	u32 baudrate;
 	int i;
 
-	/* value is calculated so : (int)(PCLK/16./baudrate) -1 */
-	reg = get_PCLK() / (16 * gd->baudrate) - 1;
+	pclk = get_PCLK();
+	baudrate = gd->baudrate;
 
-	writel(reg, &uart->ubrdiv);
+	writel((pclk / baudrate / 16) - 1, &uart->ubrdiv);
+	writel(udivslot[(pclk / baudrate) % 16], &uart->udivslot);
 	for (i = 0; i < 100; i++)
 		/* Delay */ ;
 }
Signature · 1 line
1.7.9.5
#32 lore raw

PATCH v2 4/11 serial: Use a more precise baud rate generation for serial_s3c24x0

Dear Jos? Miguel Gon?alves,

Quoted 1 line

Program udivslot register in order to obtain a more precise baudrate.

More explanatory commit message would be nice.

[...]

Quoted 1 line

+static const int udivslot[] = {

const array const members, no ?

Quoted 13 lines
drivers/serial/serial_s3c24x0.c +6 -2
+	0x0000, 0x0080, 0x0808, 0x0888, 0x2222, 0x4924, 0x4A52, 0x54AA,
+	0x5555, 0xD555, 0xD5D5, 0xDDD5, 0xDDDD, 0xDFDD, 0xDFDF, 0xFFDF,
+};
+
 void _serial_setbrg(const int dev_index)
 {
 	struct s3c24x0_uart *uart = s3c24x0_get_base_uart(dev_index);
-	unsigned int reg = 0;
+	u32 pclk;
+	u32 baudrate;
 	int i;
 
-	/* value is calculated so : (int)(PCLK/16./baudrate) -1 */

drivers/serial/serial_s3c24x0.c DECLARE_GLOBAL_DATA_PTR; · line 123

Quoted 10 lines
drivers/serial/serial_s3c24x0.c +4 -2
-	reg = get_PCLK() / (16 * gd->baudrate) - 1;
+	pclk = get_PCLK();
+	baudrate = gd->baudrate;
 
-	writel(reg, &uart->ubrdiv);
+	writel((pclk / baudrate / 16) - 1, &uart->ubrdiv);
+	writel(udivslot[(pclk / baudrate) % 16], &uart->udivslot);
 	for (i = 0; i < 100; i++)
 		/* Delay */ ;
 }

Best regards,
Marek Vasut

#33 lore raw

PATCH v2 5/11 serial: Remove unnecessary delay in serial_s3c24x0

In reply to José Miguel Gonçalves

The loop used to make a delay after baudrate setting is not necessary. Moreover it is removed by the GCC optimizer (at least with GCC 4.6).

---
Changes for v2:
- New patch

---
 drivers/serial/serial_s3c24x0.c |    3 ---
 1 file changed, 3 deletions(-)
drivers/serial/serial_s3c24x0.c +0 -3
index c9bc121..ec5d1cb 100644
@@ -111,15 +111,12 @@ void _serial_setbrg(const int dev_index)
 	struct s3c24x0_uart *uart = s3c24x0_get_base_uart(dev_index);
 	u32 pclk;
 	u32 baudrate;
-	int i;
 
 	pclk = get_PCLK();
 	baudrate = gd->baudrate;
 
 	writel((pclk / baudrate / 16) - 1, &uart->ubrdiv);
 	writel(udivslot[(pclk / baudrate) % 16], &uart->udivslot);
-	for (i = 0; i < 100; i++)
-		/* Delay */ ;
 }
 
 #if defined(CONFIG_SERIAL_MULTI)
Signature · 1 line
1.7.9.5
#34 lore raw

PATCH v2 5/11 serial: Remove unnecessary delay in serial_s3c24x0

Dear Jos? Miguel Gon?alves,

Quoted 4 lines

The loop used to make a delay after baudrate setting is not necessary. Moreover it is removed by the GCC optimizer (at least with GCC 4.6).

Quoted 17 lines

---
Changes for v2:
- New patch

---
 drivers/serial/serial_s3c24x0.c |    3 ---
 1 file changed, 3 deletions(-)
(quoted diff) +0 -0

b/drivers/serial/serial_s3c24x0.c index c9bc121..ec5d1cb 100644

drivers/serial/serial_s3c24x0.c +0 -1
@@ -111,15 +111,12 @@ void _serial_setbrg(const int dev_index)
 	struct s3c24x0_uart *uart = s3c24x0_get_base_uart(dev_index);
 	u32 pclk;
 	u32 baudrate;
-	int i;
 

drivers/serial/serial_s3c24x0.c void _serial_setbrg(const int dev_index) · line 122

Quoted 10 lines
drivers/serial/serial_s3c24x0.c +0 -2
 	pclk = get_PCLK();
 	baudrate = gd->baudrate;
 
 	writel((pclk / baudrate / 16) - 1, &uart->ubrdiv);
 	writel(udivslot[(pclk / baudrate) % 16], &uart->udivslot);
-	for (i = 0; i < 100; i++)
-		/* Delay */ ;
 }
 
 #if defined(CONFIG_SERIAL_MULTI)

Best regards,
Marek Vasut

#35 lore raw

PATCH v2 6/11 rtc: Improve rtc_get() on s3c24x0_rtc

In reply to José Miguel Gonçalves

A better approach to avoid reading the RTC during updates, as sugested in the S3C2416 User's Manual.

---
Changes for v2:
- New patch

---
 drivers/rtc/s3c24x0_rtc.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/rtc/s3c24x0_rtc.c +8 -2
index c16ff2e..7d04b74 100644
@@ -65,20 +65,26 @@ int rtc_get(struct rtc_time *tmp)
 	uchar sec, min, hour, mday, wday, mon, year;
 	__maybe_unused uchar a_sec, a_min, a_hour, a_date,
 			     a_mon, a_year, a_armed;
+	int have_retried = 0;
 
 	/* enable access to RTC registers */
 	SetRTC_Access(RTC_ENABLE);
 
 	/* read RTC registers */
 	do {
-		sec  = readb(&rtc->bcdsec);
 		min  = readb(&rtc->bcdmin);
 		hour = readb(&rtc->bcdhour);
 		mday = readb(&rtc->bcddate);
 		wday = readb(&rtc->bcdday);
 		mon  = readb(&rtc->bcdmon);
 		year = readb(&rtc->bcdyear);
-	} while (sec != readb(&rtc->bcdsec));
+		sec  = readb(&rtc->bcdsec);
+		/*
+		 * The only way to work out whether the RTC was mid-update
+		 * when we read it is to check the seconds counter.
+		 * If it's zero, then we re-try the entire read.
+		 */
+	} while ((sec == 0) && !(have_retried++));
 
 	/* read ALARM registers */
 	a_sec   = readb(&rtc->almsec);
Signature · 1 line
1.7.9.5
#36 lore raw

PATCH v2 6/11 rtc: Improve rtc_get() on s3c24x0_rtc

Dear Jos? Miguel Gon?alves,

Quoted 31 lines

A better approach to avoid reading the RTC during updates, as sugested in the S3C2416 User's Manual.

---
Changes for v2:
- New patch

---
 drivers/rtc/s3c24x0_rtc.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/rtc/s3c24x0_rtc.c +1 -1
index c16ff2e..7d04b74 100644
@@ -65,20 +65,26 @@ int rtc_get(struct rtc_time *tmp)
 	uchar sec, min, hour, mday, wday, mon, year;
 	__maybe_unused uchar a_sec, a_min, a_hour, a_date,
 			     a_mon, a_year, a_armed;
+	int have_retried = 0;
 
 	/* enable access to RTC registers */
 	SetRTC_Access(RTC_ENABLE);
 
 	/* read RTC registers */
 	do {
-		sec  = readb(&rtc->bcdsec);
 		min  = readb(&rtc->bcdmin);
 		hour = readb(&rtc->bcdhour);
 		mday = readb(&rtc->bcddate);
 		wday = readb(&rtc->bcdday);

drivers/rtc/s3c24x0_rtc.c int rtc_get(struct rtc_time *tmp) · line 87

Quoted 10 lines
drivers/rtc/s3c24x0_rtc.c +7 -1
 		mon  = readb(&rtc->bcdmon);
 		year = readb(&rtc->bcdyear);
-	} while (sec != readb(&rtc->bcdsec));
+		sec  = readb(&rtc->bcdsec);
+		/*
+		 * The only way to work out whether the RTC was mid-update
+		 * when we read it is to check the seconds counter.
+		 * If it's zero, then we re-try the entire read.
+		 */
+	} while ((sec == 0) && !(have_retried++));

You don't need that parens around (have_retried++)

drivers/rtc/s3c24x0_rtc.c int rtc_get(struct rtc_time *tmp) · line 90

Quoted 3 lines
drivers/rtc/s3c24x0_rtc.c +0 -0
 	/* read ALARM registers */
 	a_sec   = readb(&rtc->almsec);

Best regards,
Marek Vasut

#37 lore raw

PATCH v2 7/11 rtc: Fix rtc_reset() on s3c24x0_rtc

In reply to José Miguel Gonçalves

rtc_reset() must set the RTC date to the UNIX Epoch.

---
Changes for v2:
- New patch

---
 drivers/rtc/s3c24x0_rtc.c |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/rtc/s3c24x0_rtc.c +11 -4
index 7d04b74..54bf6e3 100644
@@ -167,10 +167,17 @@ int rtc_set(struct rtc_time *tmp)
 
 void rtc_reset(void)
 {
-	struct s3c24x0_rtc *rtc = s3c24x0_get_base_rtc();
-
-	writeb((readb(&rtc->rtccon) & ~0x06) | 0x08, &rtc->rtccon);
-	writeb(readb(&rtc->rtccon) & ~(0x08 | 0x01), &rtc->rtccon);
+	static struct rtc_time tmp = {
+		.tm_year = 1970,
+		.tm_mon = 1,
+		.tm_mday = 1,
+		.tm_wday = 4,
+		.tm_hour = 0,
+		.tm_min = 0,
+		.tm_sec = 0,
+	};
+
+	rtc_set(&tmp);
 }
 
 #endif
Signature · 1 line
1.7.9.5
#38 lore raw

PATCH v2 7/11 rtc: Fix rtc_reset() on s3c24x0_rtc

Dear Jos? Miguel Gon?alves,

Quoted 1 line

rtc_reset() must set the RTC date to the UNIX Epoch.

Quoted 24 lines

---
Changes for v2:
- New patch

---
 drivers/rtc/s3c24x0_rtc.c |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/rtc/s3c24x0_rtc.c +4 -4
index 7d04b74..54bf6e3 100644
@@ -167,10 +167,17 @@ int rtc_set(struct rtc_time *tmp)
 
 void rtc_reset(void)
 {
-	struct s3c24x0_rtc *rtc = s3c24x0_get_base_rtc();
-
-	writeb((readb(&rtc->rtccon) & ~0x06) | 0x08, &rtc->rtccon);
-	writeb(readb(&rtc->rtccon) & ~(0x08 | 0x01), &rtc->rtccon);
+	static struct rtc_time tmp = {
+		.tm_year = 1970,
+		.tm_mon = 1,
+		.tm_mday = 1,

drivers/rtc/s3c24x0_rtc.c int rtc_set(struct rtc_time *tmp) · line 183

Quoted 10 lines
drivers/rtc/s3c24x0_rtc.c +7 -0
+		.tm_wday = 4,
+		.tm_hour = 0,
+		.tm_min = 0,
+		.tm_sec = 0,
+	};
+
+	rtc_set(&tmp);
 }
 
 #endif

Best regards,
Marek Vasut

#39 lore raw

PATCH v2 8/11 rtc: Don't allow setting unsuported years on s3c24x0_rtc

In reply to José Miguel Gonçalves

This RTC only supports a 100 years range so rtc_set() should not allow setting years bellow 1970 or above 2069.

---
Changes for v2:
- New patch

---
 drivers/rtc/s3c24x0_rtc.c |    5 +++++
 1 file changed, 5 insertions(+)
drivers/rtc/s3c24x0_rtc.c +5 -0
index 54bf6e3..f96cb11 100644
@@ -139,6 +139,11 @@ int rtc_set(struct rtc_time *tmp)
 	       tmp->tm_year, tmp->tm_mon, tmp->tm_mday, tmp->tm_wday,
 	       tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
 #endif
+	if (tmp->tm_year < 1970 || tmp->tm_year > 2069) {
+		puts("ERROR: year should be between 1970 and 2069!\n");
+		return -1;
+	}
+
 	year = bin2bcd(tmp->tm_year % 100);
 	mon  = bin2bcd(tmp->tm_mon);
 	wday = bin2bcd(tmp->tm_wday);
Signature · 1 line
1.7.9.5
#40 lore raw

PATCH v2 8/11 rtc: Don't allow setting unsuported years on s3c24x0_rtc

Dear Jos? Miguel Gon?alves,

Quoted 2 lines

This RTC only supports a 100 years range so rtc_set() should not allow setting years bellow 1970 or above 2069.

Quoted 14 lines

---
Changes for v2:
- New patch

---
 drivers/rtc/s3c24x0_rtc.c |    5 +++++
 1 file changed, 5 insertions(+)
drivers/rtc/s3c24x0_rtc.c +0 -0
index 54bf6e3..f96cb11 100644
@@ -139,6 +139,11 @@ int rtc_set(struct rtc_time *tmp)
 	       tmp->tm_year, tmp->tm_mon, tmp->tm_mday, tmp->tm_wday,

drivers/rtc/s3c24x0_rtc.c int rtc_set(struct rtc_time *tmp) · line 149

Quoted 10 lines
drivers/rtc/s3c24x0_rtc.c +5 -0
 	       tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
 #endif
+	if (tmp->tm_year < 1970 || tmp->tm_year > 2069) {
+		puts("ERROR: year should be between 1970 and 2069!\n");
+		return -1;
+	}
+
 	year = bin2bcd(tmp->tm_year % 100);
 	mon  = bin2bcd(tmp->tm_mon);
 	wday = bin2bcd(tmp->tm_wday);

Best regards,
Marek Vasut

#41 lore raw

PATCH v2 9/11 S3C24XX: Add NAND Flash driver

In reply to José Miguel Gonçalves

NAND Flash driver with HW ECC for the S3C24XX SoCs. Currently it only supports SLC NAND chips.

---
Changes for v2:
- Coding style cleanup
- Use of clrsetbits_le32()
- Use of register bit macros instead of magic numbers

---
 drivers/mtd/nand/Makefile       |    1 +
 drivers/mtd/nand/s3c24xx_nand.c |  245 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 246 insertions(+)
 create mode 100644 drivers/mtd/nand/s3c24xx_nand.c
drivers/mtd/nand/Makefile +1 -0
index 29dc20e..791ec44 100644
@@ -60,6 +60,7 @@ COBJS-$(CONFIG_NAND_MXS) += mxs_nand.o
 COBJS-$(CONFIG_NAND_NDFC) += ndfc.o
 COBJS-$(CONFIG_NAND_NOMADIK) += nomadik.o
 COBJS-$(CONFIG_NAND_S3C2410) += s3c2410_nand.o
+COBJS-$(CONFIG_NAND_S3C24XX) += s3c24xx_nand.o
 COBJS-$(CONFIG_NAND_S3C64XX) += s3c64xx.o
 COBJS-$(CONFIG_NAND_SPEAR) += spr_nand.o
 COBJS-$(CONFIG_NAND_OMAP_GPMC) += omap_gpmc.o
drivers/mtd/nand/s3c24xx_nand.c new file +245 -0

245 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#42 lore raw

PATCH v2 9/11 S3C24XX: Add NAND Flash driver

Dear Jos? Miguel Gon?alves,

Quoted 4 lines

NAND Flash driver with HW ECC for the S3C24XX SoCs. Currently it only supports SLC NAND chips.

[...]

drivers/mtd/nand/s3c24xx_nand.c line 37

Quoted 11 lines
drivers/mtd/nand/s3c24xx_nand.c new file +11 -0
+#include <common.h>
+#include <nand.h>
+#include <asm/io.h>
+#include <asm/arch/s3c24xx_cpu.h>
+#include <asm/errno.h>
+
+#define MAX_CHIPS	2
+static int nand_cs[MAX_CHIPS] = { 0, 1 };
+
+#ifdef CONFIG_SPL_BUILD
+#define printf(arg...) do {} while (0)

This doesn't seem quite right ...

1) this should be in CPU directory
2) should be enabled only if CONFIG_SPL_SERIAL_SUPPORT is not set
3) should be inline function, not a macro

Quoted 31 lines
drivers/mtd/nand/s3c24xx_nand.c new file +30 -0
+#endif
+
+static void s3c_nand_select_chip(struct mtd_info *mtd, int chip)
+{
+	struct s3c24xx_nand *const nand = s3c24xx_get_base_nand();
+	u_long nfcont;
+
+	nfcont = readl(&nand->nfcont);
+
+	switch (chip) {
+	case -1:
+		nfcont |= NFCONT_NCE1 | NFCONT_NCE0;
+		break;
+	case 0:
+		nfcont &= ~NFCONT_NCE0;
+		break;
+	case 1:
+		nfcont &= ~NFCONT_NCE1;
+		break;
+	default:
+		return;
+	}
+
+	writel(nfcont, &nand->nfcont);
+}
+
+/*
+ * Hardware specific access to control-lines function
+ */
+static void s3c_nand_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int

ctrl) +{

drivers/mtd/nand/s3c24xx_nand.c line 78

Quoted 10 lines
drivers/mtd/nand/s3c24xx_nand.c new file +10 -0
+	struct s3c24xx_nand *const nand = s3c24xx_get_base_nand();
+	struct nand_chip *this = mtd->priv;
+
+	if (ctrl & NAND_CTRL_CHANGE) {
+		if (ctrl & NAND_CLE)
+			this->IO_ADDR_W = &nand->nfcmmd;
+		else if (ctrl & NAND_ALE)
+			this->IO_ADDR_W = &nand->nfaddr;
+		else
+			this->IO_ADDR_W = &nand->nfdata;

Why don't you use local variable here?

drivers/mtd/nand/s3c24xx_nand.c line 80

Quoted 2 lines
drivers/mtd/nand/s3c24xx_nand.c new file +2 -0
+		if (ctrl & NAND_NCE)
+			s3c_nand_select_chip(mtd, *(int *)this->priv);

Uh, how's this *(int *) supposed to work?
[...]

#43 lore raw

PATCH v2 9/11 S3C24XX: Add NAND Flash driver

Quoted 21 lines · Marek Vasut

Dear Jos? Miguel Gon?alves,

Quoted 4 lines

NAND Flash driver with HW ECC for the S3C24XX SoCs. Currently it only supports SLC NAND chips.

[...]

drivers/mtd/nand/s3c24xx_nand.c line 37

Quoted 11 lines
drivers/mtd/nand/s3c24xx_nand.c new file +11 -0
+#include <common.h>
+#include <nand.h>
+#include <asm/io.h>
+#include <asm/arch/s3c24xx_cpu.h>
+#include <asm/errno.h>
+
+#define MAX_CHIPS	2
+static int nand_cs[MAX_CHIPS] = { 0, 1 };
+
+#ifdef CONFIG_SPL_BUILD
+#define printf(arg...) do {} while (0)

This doesn't seem quite right ...

Quoted 3 lines

1) this should be in CPU directory
2) should be enabled only if CONFIG_SPL_SERIAL_SUPPORT is not set
3) should be inline function, not a macro

1) and 3) OK.
Don't quite understand 2). I want to remove the printfs in the SPL build, as it would blown up the internal SoC RAM space available.
So why add a condition with CONFIG_SPL_SERIAL_SUPPORT?

Quoted 35 lines
Quoted 35 lines
drivers/mtd/nand/s3c24xx_nand.c new file +30 -0
+#endif
+
+static void s3c_nand_select_chip(struct mtd_info *mtd, int chip)
+{
+	struct s3c24xx_nand *const nand = s3c24xx_get_base_nand();
+	u_long nfcont;
+
+	nfcont = readl(&nand->nfcont);
+
+	switch (chip) {
+	case -1:
+		nfcont |= NFCONT_NCE1 | NFCONT_NCE0;
+		break;
+	case 0:
+		nfcont &= ~NFCONT_NCE0;
+		break;
+	case 1:
+		nfcont &= ~NFCONT_NCE1;
+		break;
+	default:
+		return;
+	}
+
+	writel(nfcont, &nand->nfcont);
+}
+
+/*
+ * Hardware specific access to control-lines function
+ */
+static void s3c_nand_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int

ctrl) +{

drivers/mtd/nand/s3c24xx_nand.c new file +3 -0
+	struct s3c24xx_nand *const nand = s3c24xx_get_base_nand();
+	struct nand_chip *this = mtd->priv;
+
Quoted 8 lines

drivers/mtd/nand/s3c24xx_nand.c line 78

Quoted 7 lines
drivers/mtd/nand/s3c24xx_nand.c new file +7 -0
+	if (ctrl & NAND_CTRL_CHANGE) {
+		if (ctrl & NAND_CLE)
+			this->IO_ADDR_W = &nand->nfcmmd;
+		else if (ctrl & NAND_ALE)
+			this->IO_ADDR_W = &nand->nfaddr;
+		else
+			this->IO_ADDR_W = &nand->nfdata;

Why don't you use local variable here?

Because you need to retain the NAND controller register to use between calls to s3c_nand_hwcontrol().
If you call the function without the NAND_CTRL_CHANGE bit set in the parameter 'ctrl' you must use the register used on the last call on the next access.

Quoted 5 lines

drivers/mtd/nand/s3c24xx_nand.c line 80

Quoted 3 lines
drivers/mtd/nand/s3c24xx_nand.c new file +2 -0
+		if (ctrl & NAND_NCE)
+			s3c_nand_select_chip(mtd, *(int *)this->priv);

Uh, how's this *(int *) supposed to work?

*(int *)this->priv contains an integer that is the chip id (0 or 1).

Best regards,
Jos? Gon?alves

Best regards,
Jos? Gon?alves

#44 lore raw

PATCH v2 9/11 S3C24XX: Add NAND Flash driver

Quoted 22 lines · Jos? Miguel Gon?alves
Quoted 21 lines · Marek Vasut

Dear Jos? Miguel Gon?alves,

Quoted 4 lines

NAND Flash driver with HW ECC for the S3C24XX SoCs. Currently it only supports SLC NAND chips.

[...]

drivers/mtd/nand/s3c24xx_nand.c line 37

Quoted 11 lines
drivers/mtd/nand/s3c24xx_nand.c new file +11 -0
+#include <common.h>
+#include <nand.h>
+#include <asm/io.h>
+#include <asm/arch/s3c24xx_cpu.h>
+#include <asm/errno.h>
+
+#define MAX_CHIPS	2
+static int nand_cs[MAX_CHIPS] = { 0, 1 };
+
+#ifdef CONFIG_SPL_BUILD
+#define printf(arg...) do {} while (0)

This doesn't seem quite right ...

Quoted 8 lines
Quoted 3 lines

1) this should be in CPU directory
2) should be enabled only if CONFIG_SPL_SERIAL_SUPPORT is not set
3) should be inline function, not a macro

1) and 3) OK.
Don't quite understand 2). I want to remove the printfs in the SPL build, as it would blown up the internal SoC RAM space available. So why add a condition with CONFIG_SPL_SERIAL_SUPPORT?

You've got 8KB, based on the final patch in the series. At least in my SPL series that's still enough to get you printf/puts (I believe 4kb was the cutoff where that had to be dropped).

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120914/a545310e/attachment.pgp>
#45 lore raw

PATCH v2 9/11 S3C24XX: Add NAND Flash driver

Quoted 26 lines · Tom Rini
Quoted 25 lines · Jos? Miguel Gon?alves
Quoted 24 lines · Marek Vasut

Dear Jos? Miguel Gon?alves,

Quoted 4 lines

NAND Flash driver with HW ECC for the S3C24XX SoCs. Currently it only supports SLC NAND chips.

[...]

drivers/mtd/nand/s3c24xx_nand.c line 37

Quoted 11 lines
drivers/mtd/nand/s3c24xx_nand.c new file +11 -0
+#include <common.h>
+#include <nand.h>
+#include <asm/io.h>
+#include <asm/arch/s3c24xx_cpu.h>
+#include <asm/errno.h>
+
+#define MAX_CHIPS	2
+static int nand_cs[MAX_CHIPS] = { 0, 1 };
+
+#ifdef CONFIG_SPL_BUILD
+#define printf(arg...) do {} while (0)

This doesn't seem quite right ...

1) this should be in CPU directory
2) should be enabled only if CONFIG_SPL_SERIAL_SUPPORT is not set
3) should be inline function, not a macro

Quoted 8 lines
Quoted 4 lines

1) and 3) OK.
Don't quite understand 2). I want to remove the printfs in the SPL build, as it would blown up the internal SoC RAM space available. So why add a condition with CONFIG_SPL_SERIAL_SUPPORT?

You've got 8KB, based on the final patch in the series. At least in my SPL series that's still enough to get you printf/puts (I believe 4kb was the cutoff where that had to be dropped).

Barely:

$ size u-boot-spl
    text       data        bss        dec        hex    filename
    3337          8        588       3933        f5d    u-boot-spl
$ size u-boot-spl-printf
    text       data        bss        dec        hex    filename
    7968          8        604       8580       2184 u-boot-spl-printf

The printf is not so important that justifies exhausting the IRAM space available and preventing any future SPL expansion...

#46 lore raw

PATCH v2 9/11 S3C24XX: Add NAND Flash driver

Quoted 42 lines · Jos? Miguel Gon?alves
Quoted 26 lines · Tom Rini
Quoted 25 lines · Jos? Miguel Gon?alves
Quoted 24 lines · Marek Vasut

Dear Jos? Miguel Gon?alves,

Quoted 4 lines

NAND Flash driver with HW ECC for the S3C24XX SoCs. Currently it only supports SLC NAND chips.

[...]

drivers/mtd/nand/s3c24xx_nand.c line 37

Quoted 11 lines
drivers/mtd/nand/s3c24xx_nand.c new file +11 -0
+#include <common.h>
+#include <nand.h>
+#include <asm/io.h>
+#include <asm/arch/s3c24xx_cpu.h>
+#include <asm/errno.h>
+
+#define MAX_CHIPS	2
+static int nand_cs[MAX_CHIPS] = { 0, 1 };
+
+#ifdef CONFIG_SPL_BUILD
+#define printf(arg...) do {} while (0)

This doesn't seem quite right ...

1) this should be in CPU directory
2) should be enabled only if CONFIG_SPL_SERIAL_SUPPORT is not set
3) should be inline function, not a macro

Quoted 8 lines
Quoted 4 lines

1) and 3) OK.
Don't quite understand 2). I want to remove the printfs in the SPL build, as it would blown up the internal SoC RAM space available. So why add a condition with CONFIG_SPL_SERIAL_SUPPORT?

You've got 8KB, based on the final patch in the series. At least in my SPL series that's still enough to get you printf/puts (I believe 4kb was the cutoff where that had to be dropped).

Barely:

$ size u-boot-spl
   text       data        bss        dec        hex    filename
   3337          8        588       3933        f5d    u-boot-spl
Quoted 6 lines
$ size u-boot-spl-printf
   text       data        bss        dec        hex    filename
   7968          8        604       8580       2184 u-boot-spl-printf

The printf is not so important that justifies exhausting the IRAM space available and preventing any future SPL expansion...

There's two parts to this:
- What else can you do in a single binary, in theory? Is there boot medium detection and you would want to have, for example, NAND and SD support in the same binary? I would say memory is meant for using, but this is a board maintainer decision and that's you :)
- We have a define today (CONFIG_SPL_LIBCOMMON_SUPPORT) that toggles printf or no printf. If we really need to say yes to LIBCOMMON_SUPPORT and no to printf, we need finer grained config options and then a do-nothing printf is used for SPL. Doing the opt-out driver by driver just punts this problem down the road to the next developer and that's not very nice (and adding CONFIG_SPL_PRINTF_SUPPORT shouldn't be a big patch, modify a few Makefiles, update a bunch of config files, add common/spl/dummy_funcs.c and a __weak printf).

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120917/1a9e0e7a/attachment.pgp>
#47 lore raw

PATCH v2 9/11 S3C24XX: Add NAND Flash driver

Quoted 54 lines · Tom Rini
Quoted 2 lines · Jos? Miguel Gon?alves
Quoted 1 line · Tom Rini

On Fri, Sep 14, 2012 at 07:45:40PM +0100, Jos? Miguel Gon?alves

Quoted 22 lines · wrote:
Quoted 22 lines
Quoted 22 lines · Marek Vasut
Quoted 21 lines

Dear Jos? Miguel Gon?alves,

Quoted 4 lines

NAND Flash driver with HW ECC for the S3C24XX SoCs. Currently it only supports SLC NAND chips.

[...]

drivers/mtd/nand/s3c24xx_nand.c line 37

Quoted 11 lines
drivers/mtd/nand/s3c24xx_nand.c new file +11 -0
+#include <common.h>
+#include <nand.h>
+#include <asm/io.h>
+#include <asm/arch/s3c24xx_cpu.h>
+#include <asm/errno.h>
+
+#define MAX_CHIPS	2
+static int nand_cs[MAX_CHIPS] = { 0, 1 };
+
+#ifdef CONFIG_SPL_BUILD
+#define printf(arg...) do {} while (0)

This doesn't seem quite right ...

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines

1) this should be in CPU directory
2) should be enabled only if CONFIG_SPL_SERIAL_SUPPORT is not set
3) should be inline function, not a macro

1) and 3) OK.
Don't quite understand 2). I want to remove the printfs in the SPL build, as it would blown up the internal SoC RAM space available. So why add a condition with CONFIG_SPL_SERIAL_SUPPORT?

You've got 8KB, based on the final patch in the series. At least

in my

Quoted 1 line
Quoted 1 line

SPL series that's still enough to get you printf/puts (I believe

4kb was

Quoted 5 lines
Quoted 2 lines

the cutoff where that had to be dropped).

Barely:

Quoted 7 lines
$ size u-boot-spl
   text       data        bss        dec        hex    filename
   3337          8        588       3933        f5d    u-boot-spl
$ size u-boot-spl-printf
   text       data        bss        dec        hex    filename
   7968          8        604       8580       2184  

u-boot-spl-printf

Quoted 3 lines

The printf is not so important that justifies exhausting the IRAM space available and preventing any future SPL expansion...

Quoted 16 lines

There's two parts to this:
- What else can you do in a single binary, in theory? Is there boot medium detection and you would want to have, for example, NAND and
SD
support in the same binary? I would say memory is meant for using, but this is a board maintainer decision and that's you :)
- We have a define today (CONFIG_SPL_LIBCOMMON_SUPPORT) that toggles printf or no printf. If we really need to say yes to LIBCOMMON_SUPPORT and no to printf, we need finer grained config options and then a do-nothing printf is used for SPL. Doing the opt-out driver by driver just punts this problem down the road to
the
next developer and that's not very nice (and adding CONFIG_SPL_PRINTF_SUPPORT shouldn't be a big patch, modify a few Makefiles, update a bunch of config files, add common/spl/dummy_funcs.c and a __weak printf).

Weak symbols are not OK for configuring printf out of the SPL, as you'll still have all the format strings and caller code in the binary. It should be a macro (or an inline function that replaces the standard printf declaration), but it should be in a system header (not the CPU directory -- not sure what Marek meant there) and be based on an appropriate CONFIG symbol.

-Scott

#48 lore raw

PATCH v2 9/11 S3C24XX: Add NAND Flash driver

Quoted 68 lines · Scott Wood
Quoted 52 lines · Tom Rini
Quoted 24 lines · Jos? Miguel Gon?alves
Quoted 23 lines · Tom Rini
Quoted 22 lines · Jos? Miguel Gon?alves
Quoted 21 lines · Marek Vasut

Dear Jos? Miguel Gon?alves,

Quoted 4 lines

NAND Flash driver with HW ECC for the S3C24XX SoCs. Currently it only supports SLC NAND chips.

[...]

Review

Quoted 11 lines
(quoted diff) +11 -0
+#include <common.h>
+#include <nand.h>
+#include <asm/io.h>
+#include <asm/arch/s3c24xx_cpu.h>
+#include <asm/errno.h>
+
+#define MAX_CHIPS    2
+static int nand_cs[MAX_CHIPS] = { 0, 1 };
+
+#ifdef CONFIG_SPL_BUILD
+#define printf(arg...) do {} while (0)

This doesn't seem quite right ...

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines

1) this should be in CPU directory
2) should be enabled only if CONFIG_SPL_SERIAL_SUPPORT is not set
3) should be inline function, not a macro

1) and 3) OK.
Don't quite understand 2). I want to remove the printfs in the SPL build, as it would blown up the internal SoC RAM space available. So why add a condition with CONFIG_SPL_SERIAL_SUPPORT?

You've got 8KB, based on the final patch in the series. At least

in my

Quoted 1 line
Quoted 1 line

SPL series that's still enough to get you printf/puts (I believe

4kb was

Quoted 9 lines
Quoted 2 lines

the cutoff where that had to be dropped).

Barely:

$ size u-boot-spl
   text       data        bss        dec        hex    filename
   3337          8        588       3933        f5d    u-boot-spl
Quoted 6 lines
$ size u-boot-spl-printf
   text       data        bss        dec        hex    filename
   7968          8        604       8580       2184 u-boot-spl-printf

The printf is not so important that justifies exhausting the IRAM space available and preventing any future SPL expansion...

Quoted 14 lines

There's two parts to this:
- What else can you do in a single binary, in theory? Is there boot medium detection and you would want to have, for example, NAND and SD support in the same binary? I would say memory is meant for using, but this is a board maintainer decision and that's you :)
- We have a define today (CONFIG_SPL_LIBCOMMON_SUPPORT) that toggles printf or no printf. If we really need to say yes to LIBCOMMON_SUPPORT and no to printf, we need finer grained config options and then a do-nothing printf is used for SPL. Doing the opt-out driver by driver just punts this problem down the road to the next developer and that's not very nice (and adding CONFIG_SPL_PRINTF_SUPPORT shouldn't be a big patch, modify a few Makefiles, update a bunch of config files, add common/spl/dummy_funcs.c and a __weak printf).

Quoted 6 lines

Weak symbols are not OK for configuring printf out of the SPL, as you'll still have all the format strings and caller code in the binary. It should be a macro (or an inline function that replaces the standard printf declaration), but it should be in a system header (not the CPU directory -- not sure what Marek meant there) and be based on an appropriate CONFIG symbol.

I'm a little leery of adding #if ... into <common.h> around printf. I'd like to not worry about the branch/return bytes until we really really have to again but yes, the strings are more of a concern since they won't be collected out. Just top of my head thinking above.

Signature · 1 line
Tom
#49 lore raw

PATCH v2 9/11 S3C24XX: Add NAND Flash driver

Quoted 7 lines · Tom Rini
Quoted 1 line · Scott Wood

Weak symbols are not OK for configuring printf out of the SPL, as

you'll

Quoted 3 lines

still have all the format strings and caller code in the binary. It should be a macro (or an inline function that replaces the standard printf declaration), but it should be in a system header (not the

CPU

Quoted 8 lines
Quoted 2 lines

directory -- not sure what Marek meant there) and be based on an appropriate CONFIG symbol.

I'm a little leery of adding #if ... into <common.h> around printf. I'd
like to not worry about the branch/return bytes until we really really have to again but yes, the strings are more of a concern since they won't be collected out. Just top of my head thinking above.

Caller code won't be collected either. It's not just branch/return bytes but argument preparation -- possibly significant chunks of code to calculate values to be displayed, that might otherwise be optimized out.

-Scott

#50 lore raw

PATCH v2 9/11 S3C24XX: Add NAND Flash driver

In reply to Tom Rini
Quoted 46 lines · Tom Rini
Quoted 45 lines · Jos? Miguel Gon?alves
Quoted 26 lines · Tom Rini
Quoted 25 lines · Jos? Miguel Gon?alves
Quoted 24 lines · Marek Vasut

Dear Jos? Miguel Gon?alves,

Quoted 4 lines

NAND Flash driver with HW ECC for the S3C24XX SoCs. Currently it only supports SLC NAND chips.

[...]

drivers/mtd/nand/s3c24xx_nand.c line 37

Quoted 11 lines
drivers/mtd/nand/s3c24xx_nand.c new file +11 -0
+#include <common.h>
+#include <nand.h>
+#include <asm/io.h>
+#include <asm/arch/s3c24xx_cpu.h>
+#include <asm/errno.h>
+
+#define MAX_CHIPS	2
+static int nand_cs[MAX_CHIPS] = { 0, 1 };
+
+#ifdef CONFIG_SPL_BUILD
+#define printf(arg...) do {} while (0)

This doesn't seem quite right ...

1) this should be in CPU directory
2) should be enabled only if CONFIG_SPL_SERIAL_SUPPORT is not set
3) should be inline function, not a macro

Quoted 8 lines
Quoted 4 lines

1) and 3) OK.
Don't quite understand 2). I want to remove the printfs in the SPL build, as it would blown up the internal SoC RAM space available. So why add a condition with CONFIG_SPL_SERIAL_SUPPORT?

You've got 8KB, based on the final patch in the series. At least in my SPL series that's still enough to get you printf/puts (I believe 4kb was the cutoff where that had to be dropped).

Barely:

$ size u-boot-spl
    text       data        bss        dec        hex    filename
    3337          8        588       3933        f5d    u-boot-spl
$ size u-boot-spl-printf
    text       data        bss        dec        hex    filename
    7968          8        604       8580       2184 u-boot-spl-printf
Quoted 7 lines
Quoted 2 lines

The printf is not so important that justifies exhausting the IRAM space available and preventing any future SPL expansion...

There's two parts to this:
- What else can you do in a single binary, in theory? Is there boot medium detection and you would want to have, for example, NAND and SD support in the same binary? I would say memory is meant for using, but this is a board maintainer decision and that's you :)

That's exactly what I've got in mind when I talked about a future expansion! Being able to boot also from an SD card.
With only 8KB for .text and .data, I can not use printfs in the SPL for this platform (at least with the present printf support for SPL).

Quoted 10 lines

- We have a define today (CONFIG_SPL_LIBCOMMON_SUPPORT) that toggles printf or no printf. If we really need to say yes to LIBCOMMON_SUPPORT and no to printf, we need finer grained config options and then a do-nothing printf is used for SPL. Doing the opt-out driver by driver just punts this problem down the road to the next developer and that's not very nice (and adding CONFIG_SPL_PRINTF_SUPPORT shouldn't be a big patch, modify a few Makefiles, update a bunch of config files, add common/spl/dummy_funcs.c and a __weak printf).

#51 lore raw

PATCH v2 9/11 S3C24XX: Add NAND Flash driver

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 55 lines · Jos? Miguel Gon?alves
Quoted 45 lines · Tom Rini
Quoted 43 lines · Jos? Miguel Gon?alves
Quoted 23 lines · Tom Rini
Quoted 21 lines · Jos? Miguel Gon?alves
Quoted 20 lines · Marek Vasut

Dear Jos? Miguel Gon?alves,

Quoted 5 lines

NAND Flash driver with HW ECC for the S3C24XX SoCs. Currently it only supports SLC NAND chips.

Signed-off-by: Jos? Miguel Gon?alves
<[email protected]>

[...]

Quoted 6 lines

+#include <common.h> +#include <nand.h> +#include <asm/io.h> +#include <asm/arch/s3c24xx_cpu.h> +#include
<asm/errno.h> + +#define MAX_CHIPS 2 +static int
nand_cs[MAX_CHIPS] = { 0, 1 }; + +#ifdef CONFIG_SPL_BUILD +#define printf(arg...) do {} while
(0)

This doesn't seem quite right ...

1) this should be in CPU directory 2) should be enabled only if CONFIG_SPL_SERIAL_SUPPORT is not set 3) should be inline function, not a macro

Quoted 9 lines
Quoted 4 lines

1) and 3) OK. Don't quite understand 2). I want to remove the printfs in the SPL build, as it would blown up the internal SoC RAM space available. So why add a condition with CONFIG_SPL_SERIAL_SUPPORT?

You've got 8KB, based on the final patch in the series. At least in my SPL series that's still enough to get you printf/puts (I believe 4kb was the cutoff where that had to be dropped).

Barely:

$ size u-boot-spl text       data        bss        dec
hex    filename 3337          8        588       3933
f5d    u-boot-spl
$ size u-boot-spl-printf text       data        bss        dec
hex    filename 7968          8        604       8580
2184 u-boot-spl-printf
Quoted 8 lines
Quoted 3 lines

The printf is not so important that justifies exhausting the IRAM space available and preventing any future SPL expansion...

There's two parts to this: - What else can you do in a single binary, in theory? Is there boot medium detection and you would want to have, for example, NAND and SD support in the same binary? I would say memory is meant for using, but this is a board maintainer decision and that's you :)

Quoted 14 lines

That's exactly what I've got in mind when I talked about a future expansion! Being able to boot also from an SD card. With only 8KB for .text and .data, I can not use printfs in the SPL for this platform (at least with the present printf support for SPL).

Quoted 9 lines

- We have a define today (CONFIG_SPL_LIBCOMMON_SUPPORT) that toggles printf or no printf. If we really need to say yes to LIBCOMMON_SUPPORT and no to printf, we need finer grained config options and then a do-nothing printf is used for SPL. Doing the opt-out driver by driver just punts this problem down the road to the next developer and that's not very nice (and adding CONFIG_SPL_PRINTF_SUPPORT shouldn't be a big patch, modify a few Makefiles, update a bunch of config files, add common/spl/dummy_funcs.c and a __weak printf).

OK, so please take a stab at option two, on top of my SPL series, keeping in mind what Scott has said (which makes sense) because otherwise you'll be changing a lot of MMC files too to drop out printf :)

- --
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQIcBAEBAgAGBQJQV2Q+AAoJENk4IS6UOR1W0VMP/1ToNzW5XmNApUGYIZi1d779 hJ6MieZoiTHOCnrHiRMMMAfOnPNnt+63TozmXWkhNhlPVRCs1Irx8nCpzMabjevr ZENjnewtKsvgBsICak5rSQLbfyQBUG8tL3iBMPnYwyNhDf8CgED6rNCnxhV8Lr7j o0gELaNHPRD7bJwglXo3TN0BxNtTrww3uSArSYh4WMVaOP908Mk7p7y8qEVSvNeh BrdbVZK1oPmhlke9EUXfCQYqn/JdJ7mtdW1q5PdST7GFtnLZmqpj+FuOEwN3OioA DE6J461Aqr95mGVUnUr7PxglytL6zLKJcE8YpIhu9nL6r9QRg0wm4HIKr3uTKLl5 WBs4ziJsLtm5IAZ7xg2FOsPrCkrAiL3bVQg0+7xVc1cVzKIGmtMR6oGVS+nI38Q6 lzmz0AQSuobeLkiP4+tL8C7kFkwMcj9I5LByN968ZMvbTftecIsdgYSkluOdGU5w dwKPjplU4t8yy6d1TXbh0Xdw7q8cBZ3bjqbAKi3uo9BpEHgCDOwHp7oOTuJTDB/7 C6WxXHdQFHh7m0hxf1zkawOeh+oqd5MHAxjlckQ/zmg5UsmNWDA6RmmYgWrOBw9m jCvN/lhe1soBnxaz2byUKwEkPIDwmBl+JgtSL7DMZ7bLfS59daXiaMNac2JPstG3 j0lBvj7SCVnQrE6SJxxa
=71I1
-----END PGP SIGNATURE-----

#52 lore raw

PATCH v2 9/11 S3C24XX: Add NAND Flash driver

Quoted 72 lines · Tom Rini

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 54 lines · Jos? Miguel Gon?alves
Quoted 45 lines · Tom Rini
Quoted 43 lines · Jos? Miguel Gon?alves
Quoted 23 lines · Tom Rini
Quoted 21 lines · Jos? Miguel Gon?alves
Quoted 20 lines · Marek Vasut

Dear Jos? Miguel Gon?alves,

Quoted 5 lines

NAND Flash driver with HW ECC for the S3C24XX SoCs. Currently it only supports SLC NAND chips.

Signed-off-by: Jos? Miguel Gon?alves
<[email protected]>

[...]

Quoted 6 lines

+#include <common.h> +#include <nand.h> +#include <asm/io.h> +#include <asm/arch/s3c24xx_cpu.h> +#include
<asm/errno.h> + +#define MAX_CHIPS 2 +static int
nand_cs[MAX_CHIPS] = { 0, 1 }; + +#ifdef CONFIG_SPL_BUILD +#define printf(arg...) do {} while
(0)

This doesn't seem quite right ...

1) this should be in CPU directory 2) should be enabled only if CONFIG_SPL_SERIAL_SUPPORT is not set 3) should be inline function, not a macro

Quoted 9 lines
Quoted 4 lines

1) and 3) OK. Don't quite understand 2). I want to remove the printfs in the SPL build, as it would blown up the internal SoC RAM space available. So why add a condition with CONFIG_SPL_SERIAL_SUPPORT?

You've got 8KB, based on the final patch in the series. At least in my SPL series that's still enough to get you printf/puts (I believe 4kb was the cutoff where that had to be dropped).

Barely:

$ size u-boot-spl text       data        bss        dec
hex    filename 3337          8        588       3933
f5d    u-boot-spl
$ size u-boot-spl-printf text       data        bss        dec
hex    filename 7968          8        604       8580
2184 u-boot-spl-printf
Quoted 8 lines
Quoted 3 lines

The printf is not so important that justifies exhausting the IRAM space available and preventing any future SPL expansion...

There's two parts to this: - What else can you do in a single binary, in theory? Is there boot medium detection and you would want to have, for example, NAND and SD support in the same binary? I would say memory is meant for using, but this is a board maintainer decision and that's you :)

Quoted 14 lines

That's exactly what I've got in mind when I talked about a future expansion! Being able to boot also from an SD card. With only 8KB for .text and .data, I can not use printfs in the SPL for this platform (at least with the present printf support for SPL).

Quoted 9 lines

- We have a define today (CONFIG_SPL_LIBCOMMON_SUPPORT) that toggles printf or no printf. If we really need to say yes to LIBCOMMON_SUPPORT and no to printf, we need finer grained config options and then a do-nothing printf is used for SPL. Doing the opt-out driver by driver just punts this problem down the road to the next developer and that's not very nice (and adding CONFIG_SPL_PRINTF_SUPPORT shouldn't be a big patch, modify a few Makefiles, update a bunch of config files, add common/spl/dummy_funcs.c and a __weak printf).

Quoted 3 lines

OK, so please take a stab at option two, on top of my SPL series, keeping in mind what Scott has said (which makes sense) because otherwise you'll be changing a lot of MMC files too to drop out printf :)

The solution that I sorted out on the current SPL framework was to add this:

#ifdef CONFIG_SPL_BUILD
#define printf(arg...) do {} while (0)
#ifdef CONFIG_SPL_SERIAL_SUPPORT
#define puts(arg) serial_puts(arg)
#endif
#endif

on a CPU specific header. Marek told me to not use macros, but to use inline functions instead, but has I told earlier on this thread, I am unable to do that. Suggestions for doing this in a better way are welcome...

#53 lore raw

PATCH v2 9/11 S3C24XX: Add NAND Flash driver

Quoted 86 lines · Jos? Miguel Gon?alves
Quoted 72 lines · Tom Rini

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 54 lines · Jos? Miguel Gon?alves
Quoted 45 lines · Tom Rini
Quoted 43 lines · Jos? Miguel Gon?alves
Quoted 23 lines · Tom Rini
Quoted 21 lines · Jos? Miguel Gon?alves
Quoted 20 lines · Marek Vasut

Dear Jos? Miguel Gon?alves,

Quoted 5 lines

NAND Flash driver with HW ECC for the S3C24XX SoCs. Currently it only supports SLC NAND chips.

Signed-off-by: Jos? Miguel Gon?alves
<[email protected]>

[...]

Quoted 6 lines

+#include <common.h> +#include <nand.h> +#include <asm/io.h> +#include <asm/arch/s3c24xx_cpu.h> +#include
<asm/errno.h> + +#define MAX_CHIPS 2 +static int
nand_cs[MAX_CHIPS] = { 0, 1 }; + +#ifdef CONFIG_SPL_BUILD +#define printf(arg...) do {} while
(0)

This doesn't seem quite right ...

1) this should be in CPU directory 2) should be enabled only if CONFIG_SPL_SERIAL_SUPPORT is not set 3) should be inline function, not a macro

Quoted 9 lines
Quoted 4 lines

1) and 3) OK. Don't quite understand 2). I want to remove the printfs in the SPL build, as it would blown up the internal SoC RAM space available. So why add a condition with CONFIG_SPL_SERIAL_SUPPORT?

You've got 8KB, based on the final patch in the series. At least in my SPL series that's still enough to get you printf/puts (I believe 4kb was the cutoff where that had to be dropped).

Barely:

$ size u-boot-spl text       data        bss        dec
hex    filename 3337          8        588       3933
f5d    u-boot-spl
$ size u-boot-spl-printf text       data        bss        dec
hex    filename 7968          8        604       8580
2184 u-boot-spl-printf
Quoted 8 lines
Quoted 3 lines

The printf is not so important that justifies exhausting the IRAM space available and preventing any future SPL expansion...

There's two parts to this: - What else can you do in a single binary, in theory? Is there boot medium detection and you would want to have, for example, NAND and SD support in the same binary? I would say memory is meant for using, but this is a board maintainer decision and that's you :)

Quoted 14 lines

That's exactly what I've got in mind when I talked about a future expansion! Being able to boot also from an SD card. With only 8KB for .text and .data, I can not use printfs in the SPL for this platform (at least with the present printf support for SPL).

Quoted 9 lines

- We have a define today (CONFIG_SPL_LIBCOMMON_SUPPORT) that toggles printf or no printf. If we really need to say yes to LIBCOMMON_SUPPORT and no to printf, we need finer grained config options and then a do-nothing printf is used for SPL. Doing the opt-out driver by driver just punts this problem down the road to the next developer and that's not very nice (and adding CONFIG_SPL_PRINTF_SUPPORT shouldn't be a big patch, modify a few Makefiles, update a bunch of config files, add common/spl/dummy_funcs.c and a __weak printf).

Quoted 3 lines

OK, so please take a stab at option two, on top of my SPL series, keeping in mind what Scott has said (which makes sense) because otherwise you'll be changing a lot of MMC files too to drop out printf :)

The solution that I sorted out on the current SPL framework was to add this:

#ifdef CONFIG_SPL_BUILD
#define printf(arg...) do {} while (0)
#ifdef CONFIG_SPL_SERIAL_SUPPORT
#define puts(arg) serial_puts(arg)
#endif
#endif

Quoted 4 lines

on a CPU specific header. Marek told me to not use macros, but to use inline functions instead, but has I told earlier on this thread, I am unable to do that. Suggestions for doing this in a better way are welcome...

It's gotta go in <common.h>, and something like /* Big comment what / why */
#if !defined(CONFIG_SPL_BUILD) || \
(CONFIG_SPL_BUILD && CONFIG_SPL_PRINTF_SUPPORT)
void putc(...);
void puts(...);
int printf(....);
#else
#define putc(c) serial_putc(c)
#define puts(s) serial_puts(s)
#define printf(arg...) do {} while (0) #endif

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120917/725562d3/attachment.pgp>
#54 lore raw

PATCH v2 9/11 S3C24XX: Add NAND Flash driver

Quoted 94 lines · Tom Rini
Quoted 85 lines · Jos? Miguel Gon?alves
Quoted 72 lines · Tom Rini

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 54 lines · Jos? Miguel Gon?alves
Quoted 45 lines · Tom Rini
Quoted 43 lines · Jos? Miguel Gon?alves
Quoted 23 lines · Tom Rini
Quoted 21 lines · Jos? Miguel Gon?alves
Quoted 20 lines · Marek Vasut

Dear Jos? Miguel Gon?alves,

Quoted 5 lines

NAND Flash driver with HW ECC for the S3C24XX SoCs. Currently it only supports SLC NAND chips.

Signed-off-by: Jos? Miguel Gon?alves
<[email protected]>

[...]

Quoted 6 lines

+#include <common.h> +#include <nand.h> +#include <asm/io.h> +#include <asm/arch/s3c24xx_cpu.h> +#include
<asm/errno.h> + +#define MAX_CHIPS 2 +static int
nand_cs[MAX_CHIPS] = { 0, 1 }; + +#ifdef CONFIG_SPL_BUILD +#define printf(arg...) do {} while
(0)

This doesn't seem quite right ...

1) this should be in CPU directory 2) should be enabled only if CONFIG_SPL_SERIAL_SUPPORT is not set 3) should be inline function, not a macro

Quoted 9 lines
Quoted 4 lines

1) and 3) OK. Don't quite understand 2). I want to remove the printfs in the SPL build, as it would blown up the internal SoC RAM space available. So why add a condition with CONFIG_SPL_SERIAL_SUPPORT?

You've got 8KB, based on the final patch in the series. At least in my SPL series that's still enough to get you printf/puts (I believe 4kb was the cutoff where that had to be dropped).

Barely:

$ size u-boot-spl text       data        bss        dec
hex    filename 3337          8        588       3933
f5d    u-boot-spl
$ size u-boot-spl-printf text       data        bss        dec
hex    filename 7968          8        604       8580
2184 u-boot-spl-printf
Quoted 8 lines
Quoted 3 lines

The printf is not so important that justifies exhausting the IRAM space available and preventing any future SPL expansion...

There's two parts to this: - What else can you do in a single binary, in theory? Is there boot medium detection and you would want to have, for example, NAND and SD support in the same binary? I would say memory is meant for using, but this is a board maintainer decision and that's you :)

Quoted 14 lines

That's exactly what I've got in mind when I talked about a future expansion! Being able to boot also from an SD card. With only 8KB for .text and .data, I can not use printfs in the SPL for this platform (at least with the present printf support for SPL).

Quoted 9 lines

- We have a define today (CONFIG_SPL_LIBCOMMON_SUPPORT) that toggles printf or no printf. If we really need to say yes to LIBCOMMON_SUPPORT and no to printf, we need finer grained config options and then a do-nothing printf is used for SPL. Doing the opt-out driver by driver just punts this problem down the road to the next developer and that's not very nice (and adding CONFIG_SPL_PRINTF_SUPPORT shouldn't be a big patch, modify a few Makefiles, update a bunch of config files, add common/spl/dummy_funcs.c and a __weak printf).

Quoted 3 lines

OK, so please take a stab at option two, on top of my SPL series, keeping in mind what Scott has said (which makes sense) because otherwise you'll be changing a lot of MMC files too to drop out printf :)

The solution that I sorted out on the current SPL framework was to add this:

#ifdef CONFIG_SPL_BUILD
#define printf(arg...) do {} while (0)
#ifdef CONFIG_SPL_SERIAL_SUPPORT
#define puts(arg) serial_puts(arg)
#endif
#endif

Quoted 4 lines

on a CPU specific header. Marek told me to not use macros, but to use inline functions instead, but has I told earlier on this thread, I am unable to do that. Suggestions for doing this in a better way are welcome...

It's gotta go in <common.h>, and something like
/* Big comment what / why */

#if !defined(CONFIG_SPL_BUILD) || \
    (CONFIG_SPL_BUILD && CONFIG_SPL_PRINTF_SUPPORT)
Quoted 9 lines

void putc(...);
void puts(...);
int printf(....);
#else
#define putc(c) serial_putc(c)
#define puts(s) serial_puts(s)
#define printf(arg...) do {} while (0)
#endif

Are macros OK to remove printf() and to replace putc()/puts() by serial_putc()/serial_puts() in the SPL?
Shouldn?t we be using inline functions instead?

#55 lore raw

PATCH v2 9/11 S3C24XX: Add NAND Flash driver

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 104 lines · Jos? Miguel Gon?alves
Quoted 95 lines · Tom Rini
Quoted 85 lines · Jos? Miguel Gon?alves
Quoted 77 lines · Tom Rini

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1

Quoted 58 lines · Jos? Miguel Gon?alves
Quoted 51 lines · Tom Rini
Quoted 42 lines · Jos? Miguel Gon?alves
Quoted 30 lines · Tom Rini
Quoted 20 lines · Jos? Miguel Gon?alves
Quoted 19 lines · Marek Vasut

Dear Jos? Miguel Gon?alves,

Quoted 6 lines

NAND Flash driver with HW ECC for the S3C24XX
SoCs. Currently it only supports SLC NAND
chips.

Signed-off-by: Jos? Miguel Gon?alves
<[email protected]>

[...]

Quoted 7 lines
(quoted diff) +2 -0
+#include <common.h> +#include <nand.h>
+#include <asm/io.h> +#include

<asm/arch/s3c24xx_cpu.h> +#include
<asm/errno.h> + +#define MAX_CHIPS 2 +static
int nand_cs[MAX_CHIPS] = { 0, 1 }; + +#ifdef
CONFIG_SPL_BUILD +#define printf(arg...) do {}
while (0)

This doesn't seem quite right ...

Quoted 8 lines
Quoted 3 lines

1) this should be in CPU directory 2) should be
enabled only if CONFIG_SPL_SERIAL_SUPPORT is not
set 3) should be inline function, not a macro

1) and 3) OK. Don't quite understand 2). I want to remove the printfs in the SPL build, as it would blown up the internal SoC RAM space available. So why add a condition with CONFIG_SPL_SERIAL_SUPPORT?

Quoted 5 lines

You've got 8KB, based on the final patch in the series. At least in my SPL series that's still enough to get you printf/puts (I believe 4kb was the cutoff where that had to be dropped).

Barely:

$ size u-boot-spl text       data        bss
dec hex    filename 3337          8        588
3933 f5d    u-boot-spl
Quoted 7 lines
$ size u-boot-spl-printf text       data        bss
dec hex    filename 7968          8        604
8580 2184 u-boot-spl-printf

The printf is not so important that justifies exhausting the IRAM space available and preventing any future SPL expansion...

Quoted 6 lines

There's two parts to this: - What else can you do in a single binary, in theory? Is there boot medium detection and you would want to have, for example, NAND and SD support in the same binary? I would say memory is meant for using, but this is a board maintainer decision and that's you :)

Quoted 16 lines

That's exactly what I've got in mind when I talked about a future expansion! Being able to boot also from an SD card. With only 8KB for .text and .data, I can not use printfs in the SPL for this platform (at least with the present printf support for SPL).

Quoted 10 lines

- We have a define today (CONFIG_SPL_LIBCOMMON_SUPPORT) that toggles printf or no printf. If we really need to say yes to LIBCOMMON_SUPPORT and no to printf, we need finer grained config options and then a do-nothing printf is used for SPL. Doing the opt-out driver by driver just punts this problem down the road to the next developer and that's not very nice (and adding CONFIG_SPL_PRINTF_SUPPORT shouldn't be a big patch, modify a few Makefiles, update a bunch of config files, add common/spl/dummy_funcs.c and a __weak printf).

Quoted 4 lines

OK, so please take a stab at option two, on top of my SPL series, keeping in mind what Scott has said (which makes sense) because otherwise you'll be changing a lot of MMC files too to drop out printf :)

The solution that I sorted out on the current SPL framework was to add this:

Quoted 8 lines

#ifdef CONFIG_SPL_BUILD #define printf(arg...) do {} while (0) #ifdef CONFIG_SPL_SERIAL_SUPPORT #define puts(arg) serial_puts(arg) #endif #endif

on a CPU specific header. Marek told me to not use macros, but to use inline functions instead, but has I told earlier on this thread, I am unable to do that. Suggestions for doing this in a better way are welcome...

Quoted 7 lines

It's gotta go in <common.h>, and something like /* Big comment what / why */ #if !defined(CONFIG_SPL_BUILD) || \
(CONFIG_SPL_BUILD && CONFIG_SPL_PRINTF_SUPPORT) void putc(...); void puts(...); int printf(....); #else #define putc(c) serial_putc(c) #define puts(s) serial_puts(s) #define printf(arg...) do {} while (0) #endif

Quoted 3 lines

Are macros OK to remove printf() and to replace putc()/puts() by serial_putc()/serial_puts() in the SPL? Shouldn?t we be using inline functions instead?

As Scott pointed out, inline won't remove the string constants from the binary so it will still be possibly too large, depending on all of the code in question. And note the above isn't 100% right, we need a test for SERIAL_SUPPORT in there too.

- --
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQIcBAEBAgAGBQJQV3JcAAoJENk4IS6UOR1WMe0P/RlvfaE4J6ZxdIAIy77XmqGt KKTEnJV+dTu8/a9jrMZFmZ/lGNPNrujLlphNUgGZr2W1+lriHuCgAZx1ObsMXhx9 XGRn05gshUuUtTWRCpOy3Nzo9jPF/LYrWttBiwDfOPWZ6+6G3zGPIXV3T9HHEFMM ti0c0zCBMu1ci5RoQg4Zb6CJqJR/giBrBzegQZlL4x8t9p/GR03MSxdVPHx+NoQ7 wTuom8Q2yE5o7xDlx+zjoGCemNAVae7HXggqyqNpjU0nDb/lBg1HcvVt6IuORx9t U7u4yskgXom3RYetrKYdYPEE3yufONY3BkTEdHvS0lLE/dc7S8JKBLdAa0cCYEPG PlzJtQa98cZgcWG2PCx9TT3S16FEs+xSu3yN/S5OsvD3LwmPwls45n0rVZf1qUTL jHQ5NnFPC/xppZupRs4cr19ED8xs2YGKO7iHc3auPEz7rA6XuLGpMteFtBVM55+a 3JuZzzTMxgvP/i86VI6l+ClSLHXUHcVWPLE2bvmAvj3R2sRe6NaM8ldtWP6Wh0Hw Ncp4mGLaCh7VkdAo9Uunnf+y0m15BoDNH5fgK0eNErYPAzH34AROTbIrTsl6JLmQ +x1sYL3XLmw7z+nyd0a/IfcBjdDGeGZhaHItkCrIj5hOp937yZIEhtP8q8s93qxj bURH7UFvYhsiUAp0NG4h
=Xg9g
-----END PGP SIGNATURE-----

#56 lore raw

PATCH v2 9/11 S3C24XX: Add NAND Flash driver

In reply to Marek Vasut
Quoted 23 lines · Marek Vasut

Dear Jos? Miguel Gon?alves,

Quoted 4 lines

NAND Flash driver with HW ECC for the S3C24XX SoCs. Currently it only supports SLC NAND chips.

[...]

drivers/mtd/nand/s3c24xx_nand.c line 37

Quoted 11 lines
drivers/mtd/nand/s3c24xx_nand.c new file +11 -0
+#include <common.h>
+#include <nand.h>
+#include <asm/io.h>
+#include <asm/arch/s3c24xx_cpu.h>
+#include <asm/errno.h>
+
+#define MAX_CHIPS	2
+static int nand_cs[MAX_CHIPS] = { 0, 1 };
+
+#ifdef CONFIG_SPL_BUILD
+#define printf(arg...) do {} while (0)

This doesn't seem quite right ...

Quoted 3 lines

1) this should be in CPU directory
2) should be enabled only if CONFIG_SPL_SERIAL_SUPPORT is not set
3) should be inline function, not a macro

What specifically should be in the CPU directory?

Quoted 35 lines
Quoted 35 lines
drivers/mtd/nand/s3c24xx_nand.c new file +30 -0
+#endif
+
+static void s3c_nand_select_chip(struct mtd_info *mtd, int chip)
+{
+	struct s3c24xx_nand *const nand = s3c24xx_get_base_nand();
+	u_long nfcont;
+
+	nfcont = readl(&nand->nfcont);
+
+	switch (chip) {
+	case -1:
+		nfcont |= NFCONT_NCE1 | NFCONT_NCE0;
+		break;
+	case 0:
+		nfcont &= ~NFCONT_NCE0;
+		break;
+	case 1:
+		nfcont &= ~NFCONT_NCE1;
+		break;
+	default:
+		return;
+	}
+
+	writel(nfcont, &nand->nfcont);
+}
+
+/*
+ * Hardware specific access to control-lines function
+ */
+static void s3c_nand_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int

ctrl) +{

drivers/mtd/nand/s3c24xx_nand.c new file +4 -0
+	struct s3c24xx_nand *const nand = s3c24xx_get_base_nand();
+	struct nand_chip *this = mtd->priv;
+
+	if (ctrl & NAND_CTRL_CHANGE) {
Quoted 8 lines

drivers/mtd/nand/s3c24xx_nand.c line 78

Quoted 6 lines
drivers/mtd/nand/s3c24xx_nand.c new file +6 -0
+		if (ctrl & NAND_CLE)
+			this->IO_ADDR_W = &nand->nfcmmd;
+		else if (ctrl & NAND_ALE)
+			this->IO_ADDR_W = &nand->nfaddr;
+		else
+			this->IO_ADDR_W = &nand->nfdata;

Why don't you use local variable here?

Because then you'll access the wrong data when the function is called again without NAND_CTRL_CHANGE. This is a common way of writing the hwcontrol function, though the way ndfc.c does it is simpler (you can use a local variable if you ignore NAND_CTRL_CHANGE altogether).

Quoted 4 lines

drivers/mtd/nand/s3c24xx_nand.c line 80

Quoted 2 lines
drivers/mtd/nand/s3c24xx_nand.c new file +2 -0
+		if (ctrl & NAND_NCE)
+			s3c_nand_select_chip(mtd, *(int *)this->priv);

Uh, how's this *(int *) supposed to work?

Usually driver-private data is a struct; apparently in this driver it's an int.

-Scott

#57 lore raw

PATCH v2 9/11 S3C24XX: Add NAND Flash driver

Quoted 7 lines · Scott Wood
Quoted 6 lines · Marek Vasut

Dear Jos? Miguel Gon?alves,

Quoted 4 lines

NAND Flash driver with HW ECC for the S3C24XX SoCs. Currently it only supports SLC NAND chips.

[snip]

Quoted 23 lines
Quoted 9 lines
Quoted 9 lines
drivers/mtd/nand/s3c24xx_nand.c new file +4 -0
+/*
+ * Hardware specific access to control-lines function
+ */
+static void s3c_nand_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int

ctrl) +{

drivers/mtd/nand/s3c24xx_nand.c new file +4 -0
+	struct s3c24xx_nand *const nand = s3c24xx_get_base_nand();
+	struct nand_chip *this = mtd->priv;
+
+	if (ctrl & NAND_CTRL_CHANGE) {
Quoted 8 lines

drivers/mtd/nand/s3c24xx_nand.c line 78

Quoted 6 lines
drivers/mtd/nand/s3c24xx_nand.c new file +6 -0
+		if (ctrl & NAND_CLE)
+			this->IO_ADDR_W = &nand->nfcmmd;
+		else if (ctrl & NAND_ALE)
+			this->IO_ADDR_W = &nand->nfaddr;
+		else
+			this->IO_ADDR_W = &nand->nfdata;

Why don't you use local variable here?

Because then you'll access the wrong data when the function is called again without NAND_CTRL_CHANGE. This is a common way of writing the hwcontrol function, though the way ndfc.c does it is simpler (you can use a local variable if you ignore NAND_CTRL_CHANGE altogether).

Quoted 7 lines
Quoted 4 lines

drivers/mtd/nand/s3c24xx_nand.c line 80

Quoted 2 lines
drivers/mtd/nand/s3c24xx_nand.c new file +2 -0
+		if (ctrl & NAND_NCE)
+			s3c_nand_select_chip(mtd, *(int *)this->priv);

Uh, how's this *(int *) supposed to work?

Usually driver-private data is a struct; apparently in this driver it's an int.

Shall we take both of these comments as requests to do things differently (struct like everyone else does, simpiler code like ndfc.c does) unless there's good reason to not change?

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120914/a48c29f8/attachment.pgp>
#58 lore raw

PATCH v2 9/11 S3C24XX: Add NAND Flash driver

Quoted 37 lines · Tom Rini
Quoted 7 lines · Scott Wood
Quoted 6 lines · Marek Vasut

Dear Jos? Miguel Gon?alves,

Quoted 4 lines

NAND Flash driver with HW ECC for the S3C24XX SoCs. Currently it only supports SLC NAND chips.

[snip]

Quoted 28 lines
Quoted 9 lines
Quoted 9 lines
drivers/mtd/nand/s3c24xx_nand.c new file +4 -0
+/*
+ * Hardware specific access to control-lines function
+ */
+static void s3c_nand_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int

ctrl) +{

drivers/mtd/nand/s3c24xx_nand.c new file +4 -0
+	struct s3c24xx_nand *const nand = s3c24xx_get_base_nand();
+	struct nand_chip *this = mtd->priv;
+
+	if (ctrl & NAND_CTRL_CHANGE) {
Quoted 8 lines

drivers/mtd/nand/s3c24xx_nand.c line 78

Quoted 6 lines
drivers/mtd/nand/s3c24xx_nand.c new file +6 -0
+		if (ctrl & NAND_CLE)
+			this->IO_ADDR_W = &nand->nfcmmd;
+		else if (ctrl & NAND_ALE)
+			this->IO_ADDR_W = &nand->nfaddr;
+		else
+			this->IO_ADDR_W = &nand->nfdata;

Why don't you use local variable here?

Because then you'll access the wrong data when the function is called again without NAND_CTRL_CHANGE. This is a common way of writing the hwcontrol function, though the way ndfc.c does it is simpler (you can use a local variable if you ignore NAND_CTRL_CHANGE altogether).

Quoted 4 lines

drivers/mtd/nand/s3c24xx_nand.c line 80

Quoted 2 lines
drivers/mtd/nand/s3c24xx_nand.c new file +2 -0
+		if (ctrl & NAND_NCE)
+			s3c_nand_select_chip(mtd, *(int *)this->priv);

Uh, how's this *(int *) supposed to work?

Quoted 6 lines
Quoted 2 lines

Usually driver-private data is a struct; apparently in this driver it's an int.

Shall we take both of these comments as requests to do things differently (struct like everyone else does, simpiler code like ndfc.c does) unless there's good reason to not change?

Sure. :-)

-Scott

#59 lore raw

PATCH v2 9/11 S3C24XX: Add NAND Flash driver

In reply to Marek Vasut

Hi Marek,

Quoted 21 lines · Marek Vasut

Dear Jos? Miguel Gon?alves,

Quoted 4 lines

NAND Flash driver with HW ECC for the S3C24XX SoCs. Currently it only supports SLC NAND chips.

[...]

drivers/mtd/nand/s3c24xx_nand.c line 37

Quoted 11 lines
drivers/mtd/nand/s3c24xx_nand.c new file +11 -0
+#include <common.h>
+#include <nand.h>
+#include <asm/io.h>
+#include <asm/arch/s3c24xx_cpu.h>
+#include <asm/errno.h>
+
+#define MAX_CHIPS	2
+static int nand_cs[MAX_CHIPS] = { 0, 1 };
+
+#ifdef CONFIG_SPL_BUILD
+#define printf(arg...) do {} while (0)

This doesn't seem quite right ...

Quoted 4 lines

1) this should be in CPU directory
2) should be enabled only if CONFIG_SPL_SERIAL_SUPPORT is not set
3) should be inline function, not a macro

I'm having difficulties in following this suggestion. No problem if I migrate the printf as a macro to a header in the CPU directory. The problem is when I try to put it as an inline function. In this case if I define it like this;

#ifdef CONFIG_SPL_BUILD
static inline int printf(const char *fmt, ...)

{
     return 0;
}

#endif

I will get an "static declaration of `printf' follows non-static declaration" error due to the printf() declaration in common.h.

If I put this inline printf function (without the static) in a .c file in the CPU directory, it will compile but, as I expected, it will not be inlined, but it will be compiled as a normal function.

Can you detail on how to do this?

Best regards,
Jos? Gon?alves

#60 lore raw

PATCH v2 9/11 S3C24XX: Add NAND Flash driver

In reply to José Miguel Gonçalves
Quoted 4 lines · Jos?? Miguel Gon??alves

NAND Flash driver with HW ECC for the S3C24XX SoCs. Currently it only supports SLC NAND chips.

[snip]

drivers/mtd/nand/s3c24xx_nand.c line 38

Quoted 3 lines
drivers/mtd/nand/s3c24xx_nand.c new file +3 -0
+#ifdef CONFIG_SPL_BUILD
+#define printf(arg...) do {} while (0)
+#endif

As Marek pointed out, this isn't the right way to do this.

[snip]

drivers/mtd/nand/s3c24xx_nand.c line 189

Quoted 3 lines
drivers/mtd/nand/s3c24xx_nand.c new file +3 -0
+	case 2:		/* Multiple error */
+	case 3:		/* ECC area error */
+		printf("S3C24XX NAND: ECC uncorrectable error detected.\n");

Use puts() here.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120914/c08fc150/attachment.pgp>
#61 lore raw

PATCH v2 10/11 Add u-boot-ubl.bin target to the Makefile

In reply to José Miguel Gonçalves

Samsung's S3C24XX SoCs need this in order to generate a binary image with the SPL and U-Boot concatenated.

---
Changes for v2:
- None

---
 Makefile |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
Makefile +4 -3
index 058fb53..595b5f6 100644
@@ -442,13 +442,14 @@ $(obj)u-boot.sha1:	$(obj)u-boot.bin
 $(obj)u-boot.dis:	$(obj)u-boot
 		$(OBJDUMP) -d $< > $@
 
-$(obj)u-boot.ubl:       $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
+$(obj)u-boot-ubl.bin:       $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
 		$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $(obj)spl/u-boot-spl $(obj)spl/u-boot-spl-pad.bin
 		cat $(obj)spl/u-boot-spl-pad.bin $(obj)u-boot.bin > $(obj)u-boot-ubl.bin
+		rm $(obj)spl/u-boot-spl-pad.bin
+
+$(obj)u-boot.ubl:       $(obj)u-boot-ubl.bin
 		$(obj)tools/mkimage -n $(UBL_CONFIG) -T ublimage \
 		-e $(CONFIG_SYS_TEXT_BASE) -d $(obj)u-boot-ubl.bin $(obj)u-boot.ubl
-		rm $(obj)u-boot-ubl.bin
-		rm $(obj)spl/u-boot-spl-pad.bin
 
 $(obj)u-boot.ais:       $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
 		$(obj)tools/mkimage -s -n $(if $(CONFIG_AIS_CONFIG_FILE),$(CONFIG_AIS_CONFIG_FILE),"/dev/null") \
Signature · 1 line
1.7.9.5
#62 lore raw

PATCH v2 10/11 Add u-boot-ubl.bin target to the Makefile

Dear Jos? Miguel Gon?alves,

Quoted 2 lines

Samsung's S3C24XX SoCs need this in order to generate a binary image with the SPL and U-Boot concatenated.

You aren't adding it, you're modifying it.

Quoted 19 lines

---
Changes for v2:
- None

---
 Makefile |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
Makefile +1 -1
index 058fb53..595b5f6 100644
@@ -442,13 +442,14 @@ $(obj)u-boot.sha1:	$(obj)u-boot.bin
 $(obj)u-boot.dis:	$(obj)u-boot
 		$(OBJDUMP) -d $< > $@
 
-$(obj)u-boot.ubl:       $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
+$(obj)u-boot-ubl.bin:       $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
 		$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary
Quoted 2 lines

$(obj)spl/u-boot-spl $(obj)spl/u-boot-spl-pad.bin cat $(obj)spl/u-boot-spl-pad.bin $(obj)u-boot.bin > $(obj)u-boot-ubl.bin +

rm

Makefile $(obj)u-boot.sha1: $(obj)u-boot.bin

Quoted 5 lines

$(obj)spl/u-boot-spl-pad.bin

Makefile +2 -0
+
+$(obj)u-boot.ubl:       $(obj)u-boot-ubl.bin
 		$(obj)tools/mkimage -n $(UBL_CONFIG) -T ublimage \
 		-e $(CONFIG_SYS_TEXT_BASE) -d $(obj)u-boot-ubl.bin $(obj)u-

boot.ubl

Makefile $(obj)u-boot.sha1: $(obj)u-boot.bin · line 451

Quoted 2 lines
Makefile +0 -2
-		rm $(obj)u-boot-ubl.bin
-		rm $(obj)spl/u-boot-spl-pad.bin

Check the apollon board, won't this colide with it's NAND IPL?

Quoted 3 lines

$(obj)u-boot.ais: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
$(obj)tools/mkimage -s -n $(if
$(CONFIG_AIS_CONFIG_FILE),$(CONFIG_AIS_CONFIG_FILE),"/dev/null") \

Best regards,
Marek Vasut

#63 lore raw

PATCH v2 10/11 Add u-boot-ubl.bin target to the Makefile

In reply to José Miguel Gonçalves
Quoted 23 lines · Jos?? Miguel Gon??alves

Samsung's S3C24XX SoCs need this in order to generate a binary image with the SPL and U-Boot concatenated.

---
Changes for v2:
- None

---
 Makefile |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
Makefile +1 -1
index 058fb53..595b5f6 100644
@@ -442,13 +442,14 @@ $(obj)u-boot.sha1:	$(obj)u-boot.bin
 $(obj)u-boot.dis:	$(obj)u-boot
 		$(OBJDUMP) -d $< > $@
 
-$(obj)u-boot.ubl:       $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
+$(obj)u-boot-ubl.bin:       $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
 		$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $(obj)spl/u-boot-spl $(obj)spl/u-boot-spl-pad.bin
 		cat $(obj)spl/u-boot-spl-pad.bin $(obj)u-boot.bin > $(obj)u-boot-ubl.bin

Makefile $(obj)u-boot.sha1: $(obj)u-boot.bin · line 455

Quoted 10 lines
Makefile +3 -2
+		rm $(obj)spl/u-boot-spl-pad.bin
+
+$(obj)u-boot.ubl:       $(obj)u-boot-ubl.bin
 		$(obj)tools/mkimage -n $(UBL_CONFIG) -T ublimage \
 		-e $(CONFIG_SYS_TEXT_BASE) -d $(obj)u-boot-ubl.bin $(obj)u-boot.ubl
-		rm $(obj)u-boot-ubl.bin
-		rm $(obj)spl/u-boot-spl-pad.bin
 
 $(obj)u-boot.ais:       $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
 		$(obj)tools/mkimage -s -n $(if $(CONFIG_AIS_CONFIG_FILE),$(CONFIG_AIS_CONFIG_FILE),"/dev/null") \

This diff is hard to read, but what exactly are you changing? The u-boot-ubl target is also used on TI platforms. It looks like you're making it such that u-boot-ubl.bin produces the old binary and u-boot-ubl adds a new target which is the mkimage header on top of the same bits as before, but without possibly padding the output image. I suspect in your case you could just set PAD_TO to 8192 in board/../config.mk and use the existing target.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120914/f4c1f94e/attachment.pgp>
#64 lore raw

PATCH v2 10/11 Add u-boot-ubl.bin target to the Makefile

Quoted 33 lines · Tom Rini
Quoted 31 lines · Jos?? Miguel Gon??alves

Samsung's S3C24XX SoCs need this in order to generate a binary image with the SPL and U-Boot concatenated.

---
Changes for v2:
- None

---
  Makefile |    7 ++++---
  1 file changed, 4 insertions(+), 3 deletions(-)
Makefile +4 -3
index 058fb53..595b5f6 100644
@@ -442,13 +442,14 @@ $(obj)u-boot.sha1:	$(obj)u-boot.bin
  $(obj)u-boot.dis:	$(obj)u-boot
  		$(OBJDUMP) -d $< > $@
 
-$(obj)u-boot.ubl:       $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
+$(obj)u-boot-ubl.bin:       $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
  		$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $(obj)spl/u-boot-spl $(obj)spl/u-boot-spl-pad.bin
  		cat $(obj)spl/u-boot-spl-pad.bin $(obj)u-boot.bin > $(obj)u-boot-ubl.bin
+		rm $(obj)spl/u-boot-spl-pad.bin
+
+$(obj)u-boot.ubl:       $(obj)u-boot-ubl.bin
  		$(obj)tools/mkimage -n $(UBL_CONFIG) -T ublimage \
  		-e $(CONFIG_SYS_TEXT_BASE) -d $(obj)u-boot-ubl.bin $(obj)u-boot.ubl
-		rm $(obj)u-boot-ubl.bin
-		rm $(obj)spl/u-boot-spl-pad.bin
 
Quoted 10 lines

Makefile $(obj)u-boot.sha1: $(obj)u-boot.bin · line 455

Quoted 2 lines
Makefile +0 -0
  $(obj)u-boot.ais:       $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
  		$(obj)tools/mkimage -s -n $(if $(CONFIG_AIS_CONFIG_FILE),$(CONFIG_AIS_CONFIG_FILE),"/dev/null") \

This diff is hard to read, but what exactly are you changing? The u-boot-ubl target is also used on TI platforms. It looks like you're making it such that u-boot-ubl.bin produces the old binary and u-boot-ubl adds a new target which is the mkimage header on top of the same bits as before, but without possibly padding the output image. I suspect in your case you could just set PAD_TO to 8192 in board/../config.mk and use the existing target.

In the S3C2416 I don't need the mkimage stuff. I only need the raw SPL image padded at 8KB concatenated with the standard U-Boot. What I've done was to split the existing u-boot-ubl target in two; u-boot-ubl.bin, that I use to program the Flash, and u-boot-ubl that remains with the same functionality as before, just now it depends on u-boot-ubl.bin.

#65 lore raw

PATCH v2 10/11 Add u-boot-ubl.bin target to the Makefile

Hi,

Quoted 49 lines · Jos? Miguel Gon?alves
Quoted 39 lines · Tom Rini
Quoted 34 lines · Jos?? Miguel Gon??alves

Samsung's S3C24XX SoCs need this in order to generate a binary image with the SPL and U-Boot concatenated.

---
Changes for v2:
- None

---
  Makefile |    7 ++++---
  1 file changed, 4 insertions(+), 3 deletions(-)
Makefile +1 -0
index 058fb53..595b5f6 100644
@@ -442,13 +442,14 @@ $(obj)u-boot.sha1:        $(obj)u-boot.bin
  $(obj)u-boot.dis:     $(obj)u-boot
                $(OBJDUMP) -d $< > $@
  -$(obj)u-boot.ubl:       $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
+$(obj)u-boot-ubl.bin:       $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
                $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary

$(obj)spl/u-boot-spl $(obj)spl/u-boot-spl-pad.bin

                cat $(obj)spl/u-boot-spl-pad.bin $(obj)u-boot.bin >

$(obj)u-boot-ubl.bin

Makefile +3 -0
+               rm $(obj)spl/u-boot-spl-pad.bin
+
+$(obj)u-boot.ubl:       $(obj)u-boot-ubl.bin
                $(obj)tools/mkimage -n $(UBL_CONFIG) -T ublimage \
                -e $(CONFIG_SYS_TEXT_BASE) -d $(obj)u-boot-ubl.bin

$(obj)u-boot.ubl

Makefile +0 -2
-               rm $(obj)u-boot-ubl.bin
-               rm $(obj)spl/u-boot-spl-pad.bin
    $(obj)u-boot.ais:       $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
                $(obj)tools/mkimage -s -n $(if
Quoted 1 line

$(CONFIG_AIS_CONFIG_FILE),$(CONFIG_AIS_CONFIG_FILE),"/dev/null") \

Quoted 8 lines

This diff is hard to read, but what exactly are you changing? The u-boot-ubl target is also used on TI platforms. It looks like you're making it such that u-boot-ubl.bin produces the old binary and u-boot-ubl adds a new target which is the mkimage header on top of the same bits as before, but without possibly padding the output image. I suspect in your case you could just set PAD_TO to 8192 in board/../config.mk and use the existing target.

Quoted 5 lines

In the S3C2416 I don't need the mkimage stuff. I only need the raw SPL image padded at 8KB concatenated with the standard U-Boot. What I've done was to split the existing u-boot-ubl target in two; u-boot-ubl.bin, that I use to program the Flash, and u-boot-ubl that remains with the same functionality as before, just now it depends on u-boot-ubl.bin.

I think you should drop the UBL names from your padding target (u-boot-ubl.bin) since this is TI specific, use something more generic.
Regards, Christian

#66 lore raw

PATCH v2 10/11 Add u-boot-ubl.bin target to the Makefile

Quoted 50 lines · Christian Riesch

Hi,

Quoted 46 lines · Jos? Miguel Gon?alves
Quoted 45 lines · Tom Rini
Quoted 34 lines · Jos?? Miguel Gon??alves

Samsung's S3C24XX SoCs need this in order to generate a binary image with the SPL and U-Boot concatenated.

---
Changes for v2:
- None

---
   Makefile |    7 ++++---
   1 file changed, 4 insertions(+), 3 deletions(-)
Makefile +1 -0
index 058fb53..595b5f6 100644
@@ -442,13 +442,14 @@ $(obj)u-boot.sha1:        $(obj)u-boot.bin
   $(obj)u-boot.dis:     $(obj)u-boot
                 $(OBJDUMP) -d $< > $@
   -$(obj)u-boot.ubl:       $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
+$(obj)u-boot-ubl.bin:       $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
                 $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary

$(obj)spl/u-boot-spl $(obj)spl/u-boot-spl-pad.bin

                 cat $(obj)spl/u-boot-spl-pad.bin $(obj)u-boot.bin >

$(obj)u-boot-ubl.bin

Makefile +3 -0
+               rm $(obj)spl/u-boot-spl-pad.bin
+
+$(obj)u-boot.ubl:       $(obj)u-boot-ubl.bin
                 $(obj)tools/mkimage -n $(UBL_CONFIG) -T ublimage \
                 -e $(CONFIG_SYS_TEXT_BASE) -d $(obj)u-boot-ubl.bin

$(obj)u-boot.ubl

Makefile +0 -2
-               rm $(obj)u-boot-ubl.bin
-               rm $(obj)spl/u-boot-spl-pad.bin
     $(obj)u-boot.ais:       $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
                 $(obj)tools/mkimage -s -n $(if
Quoted 1 line

$(CONFIG_AIS_CONFIG_FILE),$(CONFIG_AIS_CONFIG_FILE),"/dev/null") \

This diff is hard to read, but what exactly are you changing? The u-boot-ubl target is also used on TI platforms. It looks like you're making it such that u-boot-ubl.bin produces the old binary and u-boot-ubl adds a new target which is the mkimage header on top of the same bits as before, but without possibly padding the output image. I suspect in your case you could just set PAD_TO to 8192 in board/../config.mk and use the existing target.

Quoted 8 lines
Quoted 5 lines

In the S3C2416 I don't need the mkimage stuff. I only need the raw SPL image padded at 8KB concatenated with the standard U-Boot. What I've done was to split the existing u-boot-ubl target in two; u-boot-ubl.bin, that I use to program the Flash, and u-boot-ubl that remains with the same functionality as before, just now it depends on u-boot-ubl.bin.

I think you should drop the UBL names from your padding target (u-boot-ubl.bin) since this is TI specific, use something more generic.

I only reused a temporary filename used for the u-boot-ubl target and make it a new target.
If you think this is not an adequate name, can you suggest a new one?

Best regards,
Jos? Gon?alves

#67 lore raw

PATCH v2 10/11 Add u-boot-ubl.bin target to the Makefile

Quoted 65 lines · Jos? Miguel Gon?alves
Quoted 64 lines · Christian Riesch

Hi,

Quoted 58 lines · Jos? Miguel Gon?alves
Quoted 39 lines · Tom Rini
Quoted 34 lines · Jos?? Miguel Gon??alves

Samsung's S3C24XX SoCs need this in order to generate a binary image with the SPL and U-Boot concatenated.

---
Changes for v2:
- None

---
   Makefile |    7 ++++---
   1 file changed, 4 insertions(+), 3 deletions(-)
Makefile +1 -0
index 058fb53..595b5f6 100644
@@ -442,13 +442,14 @@ $(obj)u-boot.sha1:        $(obj)u-boot.bin
   $(obj)u-boot.dis:     $(obj)u-boot
                 $(OBJDUMP) -d $< > $@
   -$(obj)u-boot.ubl:       $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
+$(obj)u-boot-ubl.bin:       $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
                 $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary

$(obj)spl/u-boot-spl $(obj)spl/u-boot-spl-pad.bin

                 cat $(obj)spl/u-boot-spl-pad.bin $(obj)u-boot.bin >

$(obj)u-boot-ubl.bin

Makefile +3 -0
+               rm $(obj)spl/u-boot-spl-pad.bin
+
+$(obj)u-boot.ubl:       $(obj)u-boot-ubl.bin
                 $(obj)tools/mkimage -n $(UBL_CONFIG) -T ublimage \
                 -e $(CONFIG_SYS_TEXT_BASE) -d $(obj)u-boot-ubl.bin

$(obj)u-boot.ubl

Makefile +0 -2
-               rm $(obj)u-boot-ubl.bin
-               rm $(obj)spl/u-boot-spl-pad.bin
     $(obj)u-boot.ais:       $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
                 $(obj)tools/mkimage -s -n $(if
Quoted 1 line

$(CONFIG_AIS_CONFIG_FILE),$(CONFIG_AIS_CONFIG_FILE),"/dev/null") \

Quoted 8 lines

This diff is hard to read, but what exactly are you changing? The u-boot-ubl target is also used on TI platforms. It looks like you're making it such that u-boot-ubl.bin produces the old binary and u-boot-ubl adds a new target which is the mkimage header on top of the same bits as before, but without possibly padding the output image. I suspect in your case you could just set PAD_TO to 8192 in board/../config.mk and use the existing target.

In the S3C2416 I don't need the mkimage stuff. I only need the raw SPL image
padded at 8KB concatenated with the standard U-Boot. What I've done was to
split the existing u-boot-ubl target in two; u-boot-ubl.bin, that I use to
program the Flash, and u-boot-ubl that remains with the same functionality
as before, just now it depends on u-boot-ubl.bin.

Quoted 8 lines
Quoted 3 lines

I think you should drop the UBL names from your padding target (u-boot-ubl.bin) since this is TI specific, use something more generic.

I only reused a temporary filename used for the u-boot-ubl target and make it a new target.
If you think this is not an adequate name, can you suggest a new one?

u-boot.pad? u-boot-pad.bin?

#68 lore raw

PATCH v2 10/11 Add u-boot-ubl.bin target to the Makefile

Quoted 62 lines · Christian Riesch
Quoted 60 lines · Jos? Miguel Gon?alves
Quoted 59 lines · Christian Riesch

Hi,

Quoted 55 lines · Jos? Miguel Gon?alves
Quoted 36 lines · Tom Rini
Quoted 34 lines · Jos?? Miguel Gon??alves

Samsung's S3C24XX SoCs need this in order to generate a binary image with the SPL and U-Boot concatenated.

---
Changes for v2:
- None

---
    Makefile |    7 ++++---
    1 file changed, 4 insertions(+), 3 deletions(-)
Makefile +1 -0
index 058fb53..595b5f6 100644
@@ -442,13 +442,14 @@ $(obj)u-boot.sha1:        $(obj)u-boot.bin
    $(obj)u-boot.dis:     $(obj)u-boot
                  $(OBJDUMP) -d $< > $@
    -$(obj)u-boot.ubl:       $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
+$(obj)u-boot-ubl.bin:       $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
                  $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary

$(obj)spl/u-boot-spl $(obj)spl/u-boot-spl-pad.bin

                  cat $(obj)spl/u-boot-spl-pad.bin $(obj)u-boot.bin >

$(obj)u-boot-ubl.bin

Makefile +3 -0
+               rm $(obj)spl/u-boot-spl-pad.bin
+
+$(obj)u-boot.ubl:       $(obj)u-boot-ubl.bin
                  $(obj)tools/mkimage -n $(UBL_CONFIG) -T ublimage \
                  -e $(CONFIG_SYS_TEXT_BASE) -d $(obj)u-boot-ubl.bin

$(obj)u-boot.ubl

Makefile +0 -2
-               rm $(obj)u-boot-ubl.bin
-               rm $(obj)spl/u-boot-spl-pad.bin
      $(obj)u-boot.ais:       $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
                  $(obj)tools/mkimage -s -n $(if
Quoted 9 lines
Quoted 1 line

$(CONFIG_AIS_CONFIG_FILE),$(CONFIG_AIS_CONFIG_FILE),"/dev/null") \

This diff is hard to read, but what exactly are you changing? The u-boot-ubl target is also used on TI platforms. It looks like you're making it such that u-boot-ubl.bin produces the old binary and u-boot-ubl adds a new target which is the mkimage header on top of the same bits as before, but without possibly padding the output image. I suspect in your case you could just set PAD_TO to 8192 in board/../config.mk and use the existing target.

In the S3C2416 I don't need the mkimage stuff. I only need the raw SPL image
padded at 8KB concatenated with the standard U-Boot. What I've done was to
split the existing u-boot-ubl target in two; u-boot-ubl.bin, that I use to
program the Flash, and u-boot-ubl that remains with the same functionality
as before, just now it depends on u-boot-ubl.bin.

Quoted 9 lines
Quoted 7 lines
Quoted 3 lines

I think you should drop the UBL names from your padding target (u-boot-ubl.bin) since this is TI specific, use something more generic.

I only reused a temporary filename used for the u-boot-ubl target and make it a new target.
If you think this is not an adequate name, can you suggest a new one?

u-boot.pad? u-boot-pad.bin?

If no one else has anything against, I will change the name of the new target to u-boot-pad.bin

Best regards,
Jos? Gon?alves

#69 lore raw

PATCH v2 10/11 Add u-boot-ubl.bin target to the Makefile

Quoted 67 lines · Jos?? Miguel Gon??alves
Quoted 66 lines · Christian Riesch
Quoted 64 lines · Jos?? Miguel Gon??alves
Quoted 62 lines · Christian Riesch

Hi,

Quoted 46 lines · Jos?? Miguel Gon??alves
Quoted 36 lines · Tom Rini
Quoted 34 lines · Jos?? Miguel Gon??alves

Samsung's S3C24XX SoCs need this in order to generate a binary image with the SPL and U-Boot concatenated.

---
Changes for v2:
- None

---
   Makefile |    7 ++++---
   1 file changed, 4 insertions(+), 3 deletions(-)
Makefile +1 -0
index 058fb53..595b5f6 100644
@@ -442,13 +442,14 @@ $(obj)u-boot.sha1:        $(obj)u-boot.bin
   $(obj)u-boot.dis:     $(obj)u-boot
                 $(OBJDUMP) -d $< > $@
   -$(obj)u-boot.ubl:       $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
+$(obj)u-boot-ubl.bin:       $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
                 $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary

$(obj)spl/u-boot-spl $(obj)spl/u-boot-spl-pad.bin

                 cat $(obj)spl/u-boot-spl-pad.bin $(obj)u-boot.bin >

$(obj)u-boot-ubl.bin

Makefile +3 -0
+               rm $(obj)spl/u-boot-spl-pad.bin
+
+$(obj)u-boot.ubl:       $(obj)u-boot-ubl.bin
                 $(obj)tools/mkimage -n $(UBL_CONFIG) -T ublimage \
                 -e $(CONFIG_SYS_TEXT_BASE) -d $(obj)u-boot-ubl.bin

$(obj)u-boot.ubl

Makefile +0 -2
-               rm $(obj)u-boot-ubl.bin
-               rm $(obj)spl/u-boot-spl-pad.bin
     $(obj)u-boot.ais:       $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
                 $(obj)tools/mkimage -s -n $(if
Quoted 9 lines
Quoted 1 line

$(CONFIG_AIS_CONFIG_FILE),$(CONFIG_AIS_CONFIG_FILE),"/dev/null") \

This diff is hard to read, but what exactly are you changing? The u-boot-ubl target is also used on TI platforms. It looks like you're making it such that u-boot-ubl.bin produces the old binary and u-boot-ubl adds a new target which is the mkimage header on top of the same bits as before, but without possibly padding the output image. I suspect in your case you could just set PAD_TO to 8192 in board/../config.mk and use the existing target.

Quoted 9 lines

In the S3C2416 I don't need the mkimage stuff. I only need the raw SPL image
padded at 8KB concatenated with the standard U-Boot. What I've done was to
split the existing u-boot-ubl target in two; u-boot-ubl.bin, that I use to
program the Flash, and u-boot-ubl that remains with the same functionality
as before, just now it depends on u-boot-ubl.bin.

I think you should drop the UBL names from your padding target (u-boot-ubl.bin) since this is TI specific, use something more generic.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

I only reused a temporary filename used for the u-boot-ubl target and make it a new target.
If you think this is not an adequate name, can you suggest a new one?

u-boot.pad? u-boot-pad.bin?

If no one else has anything against, I will change the name of the new target to u-boot-pad.bin

I think I'm OK with that.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120917/3ef6c3cc/attachment.pgp>
#70 lore raw

PATCH v2 10/11 Add u-boot-ubl.bin target to the Makefile

Dear Tom Rini,

[...]

Quoted 4 lines
Quoted 2 lines

If no one else has anything against, I will change the name of the new target to u-boot-pad.bin

I think I'm OK with that.

What about having CPU-overridable targets ? So omap can have it's own .ubl result and commands leading to it ... and so can s3c24xx. Such targets would have to be shifted into CPU-specific dirs, is that possible?

Best regards,
Marek Vasut

#71 lore raw

PATCH v2 10/11 Add u-boot-ubl.bin target to the Makefile

Quoted 4 lines · Marek Vasut

Dear Tom Rini,

[...]

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

If no one else has anything against, I will change the name of the new target to u-boot-pad.bin

I think I'm OK with that.

What about having CPU-overridable targets ? So omap can have it's own .ubl result and commands leading to it ... and so can s3c24xx. Such targets would have to be shifted into CPU-specific dirs, is that possible?

The problem I see first is that "UBL" doesn't seem to mean anything in the context of s3c24xx, it just happens to be doing some of what the system wants.

Signature · 1 line
Tom
#72 lore raw

PATCH v2 10/11 Add u-boot-ubl.bin target to the Makefile

In reply to José Miguel Gonçalves
Quoted 89 lines · Jos? Miguel Gon?alves
Quoted 88 lines · Christian Riesch
Quoted 86 lines · Jos? Miguel Gon?alves
Quoted 76 lines · Christian Riesch

Hi,

Quoted 60 lines · Jos? Miguel Gon?alves
Quoted 50 lines · Tom Rini
Quoted 41 lines · Jos?? Miguel Gon??alves

Samsung's S3C24XX SoCs need this in order to generate a binary image
with the SPL and U-Boot concatenated.

---
Changes for v2:
- None

---
    Makefile |    7 ++++---
    1 file changed, 4 insertions(+), 3 deletions(-)
Makefile +0 -0
index 058fb53..595b5f6 100644
@@ -442,13 +442,14 @@ $(obj)u-boot.sha1:        $(obj)u-boot.bin
    $(obj)u-boot.dis:     $(obj)u-boot
                  $(OBJDUMP) -d $< > $@
    -$(obj)u-boot.ubl:       $(obj)spl/u-boot-spl.bin  

$(obj)u-boot.bin
+$(obj)u-boot-ubl.bin: $(obj)spl/u-boot-spl.bin
$(obj)u-boot.bin

                  $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O  
binary
$(obj)spl/u-boot-spl $(obj)spl/u-boot-spl-pad.bin
                  cat $(obj)spl/u-boot-spl-pad.bin  

$(obj)u-boot.bin >
$(obj)u-boot-ubl.bin

Makefile +3 -0
+               rm $(obj)spl/u-boot-spl-pad.bin
+
+$(obj)u-boot.ubl:       $(obj)u-boot-ubl.bin
                  $(obj)tools/mkimage -n $(UBL_CONFIG) -T  
ublimage \
                  -e $(CONFIG_SYS_TEXT_BASE) -d  

$(obj)u-boot-ubl.bin
$(obj)u-boot.ubl

Makefile +0 -2
-               rm $(obj)u-boot-ubl.bin
-               rm $(obj)spl/u-boot-spl-pad.bin
      $(obj)u-boot.ais:       $(obj)spl/u-boot-spl.bin  

$(obj)u-boot.bin

Quoted 3 lines
                  $(obj)tools/mkimage -s -n $(if

$(CONFIG_AIS_CONFIG_FILE),$(CONFIG_AIS_CONFIG_FILE),"/dev/null") \

This diff is hard to read, but what exactly are you changing? The
u-boot-ubl target is also used on TI platforms. It looks like

Quoted 9 lines

you're
making it such that u-boot-ubl.bin produces the old binary and u-boot-ubl adds a new target which is the mkimage header on top of the
same bits as before, but without possibly padding the output image. I
suspect in your case you could just set PAD_TO to 8192 in board/../config.mk and use the existing target.

Quoted 12 lines

In the S3C2416 I don't need the mkimage stuff. I only need the raw SPL
image
padded at 8KB concatenated with the standard U-Boot. What I've done was
to
split the existing u-boot-ubl target in two; u-boot-ubl.bin, that I use
to
program the Flash, and u-boot-ubl that remains with the same functionality
as before, just now it depends on u-boot-ubl.bin.

Quoted 3 lines

I think you should drop the UBL names from your padding target (u-boot-ubl.bin) since this is TI specific, use something more generic.

I only reused a temporary filename used for the u-boot-ubl target and make
it a new target.
If you think this is not an adequate name, can you suggest a new one?

Quoted 5 lines
Quoted 2 lines

u-boot.pad? u-boot-pad.bin?

If no one else has anything against, I will change the name of the new target to u-boot-pad.bin

What exactly is u-boot-pad.bin supposed to be? I hope that's not being proposed as the final output file the user sees.

With old nand_spl we had u-boot-nand.bin for the final concatenated binary, but that's not appropriate for a generic spl. I think it would be better for the user to see "u-boot.bin" as the actual image to put on the boot device, regardless of implementation details like spl, if there's no requirement of a specific file format. The second stage could become "u-boot-main.bin" or similar on builds where spl is used.

-Scott

#73 lore raw

PATCH v2 10/11 Add u-boot-ubl.bin target to the Makefile

Quoted 1 line · Scott Wood

On 09/17/2012 04:24:34 AM, Jos? Miguel Gon?alves wrote:

[snip]

Quoted 6 lines
Quoted 2 lines

If no one else has anything against, I will change the name of the new target to u-boot-pad.bin

What exactly is u-boot-pad.bin supposed to be? I hope that's not being proposed as the final output file the user sees.

Quoted 6 lines

With old nand_spl we had u-boot-nand.bin for the final concatenated binary, but that's not appropriate for a generic spl. I think it would be better for the user to see "u-boot.bin" as the actual image to put on the boot device, regardless of implementation details like spl, if there's no requirement of a specific file format. The second stage could become "u-boot-main.bin" or similar on builds where spl is used.

We need some name that means "U-Boot SPL with U-Boot tacked on at the end". This can optionally be padded to a defined size to make writing to hardware easier. We also have the problem that "u-boot.bin" already means something so it needs to be clear. I further fear that even if we made an "out" directory if we put u-boot.bin in there and it's not the same as the objcopy -O binary u-boot u-boot.bin as before we've violated the rule of least surprise and the end user problems from people that read "the" document (that happened to be out of date) will be our problem.

In short, at least a few people have said something along the lines of "We need generic output nameo $mediums and targets" but there's two hard problems, one of which is that every SoC _needs_ things tweaked just so (no header? no boot!), sometimes wants things tweaked further (pad the final image out to be easier to write to $medium) and sometimes needs multiple files (the whole of 'SPL' will be read so it must fit into $SMALL_MEMORY). The other is naming.

I don't want to block this series on this problem. I do want to say it needs to use my updated SPL framework or show that it's inadequate (and I owe another reply to part of this thread still) for this platform. Call it u-boot.s3c or .s3c24xx and lets continue talking about how to solve the general problem.

Signature · 1 line
Tom
#74 lore raw

PATCH v2 10/11 Add u-boot-ubl.bin target to the Makefile

Quoted 19 lines · Tom Rini
Quoted 1 line · Scott Wood

On 09/17/2012 04:24:34 AM, Jos? Miguel Gon?alves wrote:

[snip]

Quoted 1 line
Quoted 1 line

If no one else has anything against, I will change the name of the

new

Quoted 3 lines
Quoted 1 line

target to u-boot-pad.bin

What exactly is u-boot-pad.bin supposed to be? I hope that's not

being

Quoted 4 lines

proposed as the final output file the user sees.

With old nand_spl we had u-boot-nand.bin for the final concatenated binary, but that's not appropriate for a generic spl. I think it

would

Quoted 1 line

be better for the user to see "u-boot.bin" as the actual image to

put on

Quoted 3 lines

the boot device, regardless of implementation details like spl, if there's no requirement of a specific file format. The second stage could become "u-boot-main.bin" or similar on builds where spl is

Quoted 7 lines

used.

We need some name that means "U-Boot SPL with U-Boot tacked on at the end". This can optionally be padded to a defined size to make writing to hardware easier. We also have the problem that "u-boot.bin" already
means something so it needs to be clear.

u-boot.bin has traditionally (except for nand_spl and derivatives) meant the final image ready to put into flash, after any platform-specific layout issues are taken care of (e.g. on mpc83xx it will have a reset control word embedded, on mpc85xx it will be padded to 512K with a reset vector at the end, etc.). That we did the tweaking in the linker script rather than after linking seems like an inconsequential implementation detail.

Quoted 7 lines

I further fear that even if we
made an "out" directory if we put u-boot.bin in there and it's not the same as the objcopy -O binary u-boot u-boot.bin as before we've violated
the rule of least surprise and the end user problems from people that read "the" document (that happened to be out of date) will be our problem.

In this case I think you can't meet one user's expectations without violating another's. I think it's more important to make it clear to the user what file they're supposed to put into flash. Users of platforms that are currently supported by nand_spl would probably like to continue seeing u-boot-nand.bin -- it's a tradeoff of historical stability versus current consistency.

Quoted 9 lines

In short, at least a few people have said something along the lines of "We need generic output nameo $mediums and targets" but there's two hard
problems, one of which is that every SoC _needs_ things tweaked just so
(no header? no boot!), sometimes wants things tweaked further (pad the final image out to be easier to write to $medium) and sometimes needs multiple files (the whole of 'SPL' will be read so it must fit into $SMALL_MEMORY). The other is naming.

A simple concatenation of a padded SPL plus the main U-Boot was good enough for all the nand_spl boards AFAIK, so it's not quite every SoC that needs something special here. For those that do require a special format (or multiple files) with a file extension that is familiar to people working with that platform, using that extension makes sense. "pad" does not, and a proliferation of SoC-specific suffixes isn't much better.

-Scott

#75 lore raw

PATCH v2 10/11 Add u-boot-ubl.bin target to the Makefile

Quoted 23 lines · Scott Wood
Quoted 13 lines · Tom Rini
Quoted 1 line · Scott Wood

On 09/17/2012 04:24:34 AM, Jos? Miguel Gon?alves wrote:

[snip]

Quoted 9 lines
Quoted 2 lines

If no one else has anything against, I will change the name of the new target to u-boot-pad.bin

What exactly is u-boot-pad.bin supposed to be? I hope that's not being proposed as the final output file the user sees.

With old nand_spl we had u-boot-nand.bin for the final concatenated binary, but that's not appropriate for a generic spl. I think it would be better for the user to see "u-boot.bin" as the actual image to

put on

Quoted 8 lines
Quoted 3 lines

the boot device, regardless of implementation details like spl, if there's no requirement of a specific file format. The second stage could become "u-boot-main.bin" or similar on builds where spl is used.

We need some name that means "U-Boot SPL with U-Boot tacked on at the end". This can optionally be padded to a defined size to make writing to hardware easier. We also have the problem that "u-boot.bin" already means something so it needs to be clear.

Quoted 7 lines

u-boot.bin has traditionally (except for nand_spl and derivatives) meant the final image ready to put into flash, after any platform-specific layout issues are taken care of (e.g. on mpc83xx it will have a reset control word embedded, on mpc85xx it will be padded to 512K with a reset vector at the end, etc.). That we did the tweaking in the linker script rather than after linking seems like an inconsequential implementation detail.

Right, but it's also just objcopy (with OBJCFLAGS) -O binary of, and this is the biggie to me, just U-Boot.

Quoted 7 lines
Quoted 6 lines

I further fear that even if we
made an "out" directory if we put u-boot.bin in there and it's not the same as the objcopy -O binary u-boot u-boot.bin as before we've violated the rule of least surprise and the end user problems from people that read "the" document (that happened to be out of date) will be our problem.

Quoted 6 lines

In this case I think you can't meet one user's expectations without violating another's. I think it's more important to make it clear to the user what file they're supposed to put into flash. Users of platforms that are currently supported by nand_spl would probably like to continue seeing u-boot-nand.bin -- it's a tradeoff of historical stability versus current consistency.

Right. So I'm saying we need to set new expectations for everyone and some human helper symlinks to help. A new top-level out or images or something, with symlinks inside.

Quoted 8 lines
Quoted 7 lines

In short, at least a few people have said something along the lines of "We need generic output nameo $mediums and targets" but there's two hard problems, one of which is that every SoC _needs_ things tweaked just so (no header? no boot!), sometimes wants things tweaked further (pad the final image out to be easier to write to $medium) and sometimes needs multiple files (the whole of 'SPL' will be read so it must fit into $SMALL_MEMORY). The other is naming.

Quoted 7 lines

A simple concatenation of a padded SPL plus the main U-Boot was good enough for all the nand_spl boards AFAIK, so it's not quite every SoC that needs something special here. For those that do require a special format (or multiple files) with a file extension that is familiar to people working with that platform, using that extension makes sense. "pad" does not, and a proliferation of SoC-specific suffixes isn't much better.

I think we're running into PowerPC vs ARM "fun". We've got 7 or so different "whack the image for this SoC for this medium" type things already.

Signature · 1 line
Tom
#76 lore raw

PATCH v2 10/11 Add u-boot-ubl.bin target to the Makefile

Quoted 65 lines · Tom Rini
Quoted 5 lines · Scott Wood
Quoted 4 lines · Tom Rini
Quoted 1 line · Scott Wood

On 09/17/2012 04:24:34 AM, Jos? Miguel Gon?alves wrote:

[snip]

Quoted 1 line
Quoted 1 line

If no one else has anything against, I will change the name of

the new

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

target to u-boot-pad.bin

What exactly is u-boot-pad.bin supposed to be? I hope that's

not being

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

proposed as the final output file the user sees.

With old nand_spl we had u-boot-nand.bin for the final

concatenated

Quoted 1 line
Quoted 1 line
Quoted 1 line

binary, but that's not appropriate for a generic spl. I think

it would

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

be better for the user to see "u-boot.bin" as the actual image to

put on

Quoted 1 line

the boot device, regardless of implementation details like spl,

if

Quoted 1 line
Quoted 1 line
Quoted 1 line

there's no requirement of a specific file format. The second

stage

Quoted 1 line
Quoted 1 line
Quoted 1 line

could become "u-boot-main.bin" or similar on builds where spl is

used.

Quoted 2 lines
Quoted 2 lines

We need some name that means "U-Boot SPL with U-Boot tacked on at

the

Quoted 1 line
Quoted 1 line

end". This can optionally be padded to a defined size to make

writing

Quoted 1 line
Quoted 1 line

to hardware easier. We also have the problem that "u-boot.bin"

already

Quoted 3 lines
Quoted 1 line

means something so it needs to be clear.

u-boot.bin has traditionally (except for nand_spl and derivatives)

meant

Quoted 2 lines

the final image ready to put into flash, after any platform-specific layout issues are taken care of (e.g. on mpc83xx it will have a

reset

Quoted 1 line

control word embedded, on mpc85xx it will be padded to 512K with a

reset

Quoted 1 line

vector at the end, etc.). That we did the tweaking in the linker

script

Quoted 1 line

rather than after linking seems like an inconsequential

implementation

Quoted 1 line

detail.

Right, but it's also just objcopy (with OBJCFLAGS) -O binary of, and this is the biggie to me, just U-Boot.

Quoted 2 lines
Quoted 2 lines

I further fear that even if we
made an "out" directory if we put u-boot.bin in there and it's not

the

Quoted 1 line
Quoted 1 line

same as the objcopy -O binary u-boot u-boot.bin as before we've

violated

Quoted 1 line
Quoted 1 line

the rule of least surprise and the end user problems from people

that

Quoted 5 lines
Quoted 2 lines

read "the" document (that happened to be out of date) will be our problem.

In this case I think you can't meet one user's expectations without violating another's. I think it's more important to make it clear

to

Quoted 2 lines

the user what file they're supposed to put into flash. Users of platforms that are currently supported by nand_spl would probably

Quoted 7 lines

like

Quoted 2 lines

to continue seeing u-boot-nand.bin -- it's a tradeoff of historical stability versus current consistency.

Right. So I'm saying we need to set new expectations for everyone and some human helper symlinks to help. A new top-level out or images or something, with symlinks inside.

How about something like "u-boot-final.bin"[1], "u-boot-all.bin", "u-boot-image.bin", etc. as the end-user output, with ".bin" changed to something else if it's a well known file type? At least for the boards that only require one output file.

-Scott

[1] Though then LDFLAGS_FINAL becomes confusing...

#77 lore raw

PATCH v2 10/11 Add u-boot-ubl.bin target to the Makefile

In reply to Tom Rini

Dear Tom Rini,

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

Right. So I'm saying we need to set new expectations for everyone and some human helper symlinks to help. A new top-level out or images or something, with symlinks inside.

Why would we need that?

For the end user, any name is good enough, as long as it's clearly documented which file to use, and what exactly to do with it. There are so many different boot formatrequirements, that we canot expect to come up with "good" names for all of these in any way that matches all people's expectations because everything is completely self-explanatory.

Make it simple, and handle it in the documentation.

Quoted 3 lines

I think we're running into PowerPC vs ARM "fun". We've got 7 or so different "whack the image for this SoC for this medium" type things already.

I don't think it's an PPC versus ARM issue It's more an "good old times" versus "brave new world" thing. Actually Shakespeare's verses apply fully to many of teh recent SoC designs - be these PPC or ARM or whatever based:

O wonder!
How many goodly creatures are there here!
How beauteous mankind is! O brave new world,
That has such people in't.
?William Shakespeare, The Tempest, Act V, Scene I, ll. 203?6

Thinking about features, boot image formats, boot device selection and other boot requirements of the ROM boot loaders of any recent SoC indeed makes me wonder "How many goodly creatures are there here!"

PS: The "good" in this reference is to be understood in the same sense as the "best" in the name of the MPC5200 BestComm DMA controller.

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
"In the long run, every program becomes rococo, and then rubble."
- Alan Perlis
#78 lore raw

PATCH v2 11/11 S3C24XX: Add support to MINI2416 board

In reply to José Miguel Gonçalves

The MINI2416 board is based on a Samsung's S3C2416 SoC and has 64MB DDR2 SDRAM, 256MB NAND Flash, a LAN9220 Ethernet Controller and a WM8731 Audio CODEC. This U-Boot port was implemented and tested on a unit bought to Boardcon
(http://www.armdesigner.com/) but there are some other chinese providers that can supply it with a selectable NAND chip from 128MB to 1GB.

---
Changes for v2:
- Coding style cleanup
- Use of Use of clrbits_le32(), setbits_le32() and clrsetbits_le32()
- Use of register bit macros instead of magic numbers
- Use of serial and rtc drivers implemented for s3c24x0

---
 MAINTAINERS                            |    4 +
 board/boardcon/mini2416/Makefile       |   47 ++++++++
 board/boardcon/mini2416/config.mk      |    4 +
 board/boardcon/mini2416/mini2416.c     |   98 ++++++++++++++++
 board/boardcon/mini2416/mini2416_spl.c |  200 ++++++++++++++++++++++++++++++++
 board/boardcon/mini2416/u-boot-spl.lds |   63 ++++++++++
 boards.cfg                             |    1 +
 include/configs/mini2416.h             |  200 ++++++++++++++++++++++++++++++++
 8 files changed, 617 insertions(+)
 create mode 100644 board/boardcon/mini2416/Makefile
 create mode 100644 board/boardcon/mini2416/config.mk
 create mode 100644 board/boardcon/mini2416/mini2416.c
 create mode 100644 board/boardcon/mini2416/mini2416_spl.c
 create mode 100644 board/boardcon/mini2416/u-boot-spl.lds
 create mode 100644 include/configs/mini2416.h
MAINTAINERS +4 -0
index 4aabcff..593baa0 100644
@@ -655,6 +655,10 @@ Fabio Estevam <[email protected]>
 	mx53ard		i.MX53
 	mx53smd		i.MX53
 
+Jos? Gon?alves <[email protected]>
+
+	mini2416	ARM926EJS (S3C2416 SoC)
+
 Daniel Gorsulowski <[email protected]>
 
 	meesc		ARM926EJS (AT91SAM9263 SoC)
board/boardcon/mini2416/Makefile new file +47 -0

47 lines not on this page · raw message

board/boardcon/mini2416/config.mk new file +4 -0
new file mode 100644
index 0000000..f1230d0
@@ -0,0 +1,4 @@
+PAD_TO	:= 0x2000
+ifndef CONFIG_SPL_BUILD
+ALL-y += $(obj)u-boot-ubl.bin
+endif
board/boardcon/mini2416/mini2416.c new file +98 -0

98 lines not on this page · raw message

board/boardcon/mini2416/mini2416_spl.c new file +200 -0

200 lines not on this page · raw message

board/boardcon/mini2416/u-boot-spl.lds new file +63 -0

63 lines not on this page · raw message

boards.cfg +1 -0
index 72e7803..bf084a0 100644
@@ -193,6 +193,7 @@ omap730p2_cs0boot	     arm         arm926ejs   omap730p2		 ti             omap
 omap730p2_cs3boot	     arm         arm926ejs   omap730p2		 ti             omap        omap730p2:CS3_BOOT
 edminiv2                     arm         arm926ejs   -                   LaCie          orion5x
 dkb			     arm         arm926ejs   -                   Marvell        pantheon
+mini2416                     arm         arm926ejs   mini2416            boardcon       s3c24xx
 spear300                     arm         arm926ejs   spear300            spear          spear       spear3xx_evb:spear300
 spear300_nand                arm         arm926ejs   spear300            spear          spear       spear3xx_evb:spear300,nand
 spear300_usbtty              arm         arm926ejs   spear300            spear          spear       spear3xx_evb:spear300,usbtty
include/configs/mini2416.h new file +200 -0

200 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#79 lore raw

PATCH v2 11/11 S3C24XX: Add support to MINI2416 board

Quoted 5 lines · Jos?? Miguel Gon??alves

The MINI2416 board is based on a Samsung's S3C2416 SoC and has 64MB DDR2 SDRAM, 256MB NAND Flash, a LAN9220 Ethernet Controller and a WM8731 Audio CODEC. This U-Boot port was implemented and tested on a unit bought to Boardcon
(http://www.armdesigner.com/) but there are some other chinese providers that can supply it with a selectable NAND chip from 128MB to 1GB.

[snip]

Can you please try this on top of my SPL framework series? Thanks!

Signature · 1 line
Tom
#80 lore raw

PATCH v2 11/11 S3C24XX: Add support to MINI2416 board

Quoted 11 lines · Tom Rini
Quoted 5 lines · Jos?? Miguel Gon??alves

The MINI2416 board is based on a Samsung's S3C2416 SoC and has 64MB DDR2 SDRAM, 256MB NAND Flash, a LAN9220 Ethernet Controller and a WM8731 Audio CODEC. This U-Boot port was implemented and tested on a unit bought to Boardcon
(http://www.armdesigner.com/) but there are some other chinese providers that can supply it with a selectable NAND chip from 128MB to 1GB.

[snip]

Can you please try this on top of my SPL framework series? Thanks!

I thought I was using the latest SPL framework! Can you please detail on what I should do different?

Best regards,
Jos? Gon?alves

#81 lore raw

PATCH v2 11/11 S3C24XX: Add support to MINI2416 board

Quoted 8 lines · Jos? Miguel Gon?alves
Quoted 7 lines · Tom Rini
Quoted 5 lines · Jos?? Miguel Gon??alves

The MINI2416 board is based on a Samsung's S3C2416 SoC and has 64MB DDR2 SDRAM, 256MB NAND Flash, a LAN9220 Ethernet Controller and a WM8731 Audio CODEC. This U-Boot port was implemented and tested on a unit bought to Boardcon
(http://www.armdesigner.com/) but there are some other chinese providers that can supply it with a selectable NAND chip from 128MB to 1GB.

Quoted 6 lines
Quoted 3 lines

[snip]

Can you please try this on top of my SPL framework series? Thanks!

I thought I was using the latest SPL framework! Can you please detail on what I should do different?

Please see
http://www.mail-archive.com/u-boot at lists.denx.de/msg92156.html

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120917/2da26656/attachment.pgp>
#82 lore raw

PATCH v2 11/11 S3C24XX: Add support to MINI2416 board

Quoted 9 lines · Tom Rini
Quoted 8 lines · Jos? Miguel Gon?alves
Quoted 7 lines · Tom Rini
Quoted 5 lines · Jos?? Miguel Gon??alves

The MINI2416 board is based on a Samsung's S3C2416 SoC and has 64MB DDR2 SDRAM, 256MB NAND Flash, a LAN9220 Ethernet Controller and a WM8731 Audio CODEC. This U-Boot port was implemented and tested on a unit bought to Boardcon
(http://www.armdesigner.com/) but there are some other chinese providers that can supply it with a selectable NAND chip from 128MB to 1GB.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

[snip]

Can you please try this on top of my SPL framework series? Thanks!

I thought I was using the latest SPL framework! Can you please detail on what I should do different?

Please see
http://www.mail-archive.com/u-boot at lists.denx.de/msg92156.html

As this is still not merged, I reckon you only want to check if this new SPL framework works fine with my board.

I'm not expected to resubmit my patch to be according with the new framework, correct?

Best regards,
Jos? Gon?alves

#83 lore raw

PATCH v2 11/11 S3C24XX: Add support to MINI2416 board

Quoted 15 lines · Jos? Miguel Gon?alves
Quoted 14 lines · Tom Rini
Quoted 13 lines · Jos? Miguel Gon?alves
Quoted 10 lines · Tom Rini
Quoted 5 lines · Jos?? Miguel Gon??alves

The MINI2416 board is based on a Samsung's S3C2416 SoC and has 64MB DDR2 SDRAM, 256MB NAND Flash, a LAN9220 Ethernet Controller and a WM8731 Audio CODEC. This U-Boot port was implemented and tested on a unit bought to Boardcon
(http://www.armdesigner.com/) but there are some other chinese providers that can supply it with a selectable NAND chip from 128MB to 1GB.

[snip]

Can you please try this on top of my SPL framework series? Thanks!

I thought I was using the latest SPL framework! Can you please detail on what I should do different?

Quoted 8 lines
Quoted 3 lines

Please see
http://www.mail-archive.com/u-boot at lists.denx.de/msg92156.html

As this is still not merged, I reckon you only want to check if this new SPL framework works fine with my board.

I'm not expected to resubmit my patch to be according with the new framework, correct?

v1 of your patches was posted well after the merge window for v2012.10 closed. My SPL series will be merged to mainline shortly (taking care of everyone elses merge requests first). So yes, to get into v2013.01 you will need to update. If you check the archives you can see how the altera soc support changed to adapt to this framework. And if there's a shortcoming in the framework, I really do want to know. Thanks!

Signature · 1 line
Tom
#84 lore raw

PATCH v2 11/11 S3C24XX: Add support to MINI2416 board

Hi Tom,

Quoted 22 lines · Tom Rini
Quoted 21 lines · Jos? Miguel Gon?alves
Quoted 9 lines · Tom Rini
Quoted 8 lines · Jos? Miguel Gon?alves
Quoted 7 lines · Tom Rini
Quoted 5 lines · Jos?? Miguel Gon??alves

The MINI2416 board is based on a Samsung's S3C2416 SoC and has 64MB DDR2 SDRAM, 256MB NAND Flash, a LAN9220 Ethernet Controller and a WM8731 Audio CODEC. This U-Boot port was implemented and tested on a unit bought to Boardcon
(http://www.armdesigner.com/) but there are some other chinese providers that can supply it with a selectable NAND chip from 128MB to 1GB.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

[snip]

Can you please try this on top of my SPL framework series? Thanks!

I thought I was using the latest SPL framework! Can you please detail on what I should do different?

Please see
http://www.mail-archive.com/u-boot at lists.denx.de/msg92156.html

As this is still not merged, I reckon you only want to check if this new SPL framework works fine with my board.

Quoted 8 lines
Quoted 1 line

I'm not expected to resubmit my patch to be according with the new framework, correct?

v1 of your patches was posted well after the merge window for v2012.10 closed. My SPL series will be merged to mainline shortly (taking care of everyone elses merge requests first). So yes, to get into v2013.01 you will need to update. If you check the archives you can see how the altera soc support changed to adapt to this framework. And if there's a shortcoming in the framework, I really do want to know. Thanks!

I already have my board working on the top of this new SPL framework. It was easy to migrate and the interface is easier to use for a new U-Boot developer (like me). Good work!
I'll resubmit my new patch later on.

Here are my board's SPL sizes for both older and new frameworks:

text data bss dec hex filename
4083 8 588 4679 1247 u-boot/spl/u-boot-spl

text data bss dec hex filename
3905 160 500 4565 11d5 u-boot-spl-framework/spl/u-boot-spl

So I get around 30 bytes of additional IRAM space (text + data).

I have a comment, though. As you use memset() to initialize the .bss, wouldn?t be better that CONFIG_SPL_LIBGENERIC_SUPPORT would be automaticaly included when adding CONFIG_SPL_FRAMEWORK to the board config?

Best regards,
Jos? Gon?alves