Skip to contentSkip to conversation

ORIGEN Board Support

PATCH Superseded Chander Kashyap 4 participants 18 messages Jul 29, 2011 – Aug 11, 2011 Arm/actions semi architecture

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v4 cover ORIGEN Board Support

Adds support for ORIGEN board with MMC Booting.

Chander Kashyap (2):
ARMV7: Add support for Samsung ORIGEN board
ORIGEN: Add MMC SPL support

 MAINTAINERS                                       |    1 +
 board/samsung/origen/Makefile                     |   46 ++
 board/samsung/origen/lowlevel_init.S              |  464 +++++++++++++++++++++
 board/samsung/origen/mem_setup.S                  |  359 ++++++++++++++++
 board/samsung/origen/origen.c                     |  105 +++++
 boards.cfg                                        |    1 +
 include/configs/origen.h                          |  166 ++++++++
 mmc_spl/board/samsung/origen/Makefile             |  106 +++++
 mmc_spl/board/samsung/origen/mmc_boot.c           |   57 +++
 mmc_spl/board/samsung/origen/tools/mkv310_image.c |  140 +++++++
 mmc_spl/board/samsung/origen/u-boot.lds           |   88 ++++
 11 files changed, 1533 insertions(+), 0 deletions(-)
 create mode 100644 board/samsung/origen/Makefile
 create mode 100644 board/samsung/origen/lowlevel_init.S
 create mode 100644 board/samsung/origen/mem_setup.S
 create mode 100644 board/samsung/origen/origen.c
 create mode 100644 include/configs/origen.h
 create mode 100644 mmc_spl/board/samsung/origen/Makefile
 create mode 100644 mmc_spl/board/samsung/origen/mmc_boot.c
 create mode 100644 mmc_spl/board/samsung/origen/tools/mkv310_image.c
 create mode 100644 mmc_spl/board/samsung/origen/u-boot.lds
Signature · 1 line
1.7.4.1
#1 lore raw

PATCH v4 1/2 ARMV7: Add support for Samsung ORIGEN board

Origen board is based upon S5PV310 SoC which is similiar to S5PC210 SoC.

---
Changes for v2:
- None
Changes for v3:
- Board entry added Alphabetically in boards.cfg
- Used get_Ram_size function to calculate ram size
Changes for v4:
- CONFIG_MACH_TYPE defined to initialise MACH_TYPE in generic way
- Used s5p_gpio_* functions for gpio operations

 MAINTAINERS                          |    1 +
 board/samsung/origen/Makefile        |   46 ++++
 board/samsung/origen/lowlevel_init.S |  464 ++++++++++++++++++++++++++++++++++
 board/samsung/origen/mem_setup.S     |  359 ++++++++++++++++++++++++++
 board/samsung/origen/origen.c        |  105 ++++++++
 boards.cfg                           |    1 +
 include/configs/origen.h             |  166 ++++++++++++
 7 files changed, 1142 insertions(+), 0 deletions(-)
 create mode 100644 board/samsung/origen/Makefile
 create mode 100644 board/samsung/origen/lowlevel_init.S
 create mode 100644 board/samsung/origen/mem_setup.S
 create mode 100644 board/samsung/origen/origen.c
 create mode 100644 include/configs/origen.h
MAINTAINERS +1 -0
index 6e6affa..8526642 100644
@@ -709,6 +709,7 @@ Minkyu Kang <[email protected]>
 
 Chander Kashyap <[email protected]>
 
+	origen			ARM ARMV7 (S5PC210 SoC)
 	SMDKV310		ARM ARMV7 (S5PC210 SoC)
 
 Torsten Koschorrek <[email protected]>
board/samsung/origen/Makefile new file +46 -0

46 lines not on this page · raw message

board/samsung/origen/lowlevel_init.S new file +464 -0

464 lines not on this page · raw message

board/samsung/origen/mem_setup.S new file +359 -0

359 lines not on this page · raw message

board/samsung/origen/origen.c new file +105 -0

105 lines not on this page · raw message

boards.cfg +1 -0
index 5cfaa78..1009f1c 100644
@@ -165,6 +165,7 @@ omap4_panda                  arm         armv7       panda               ti
 omap4_sdp4430                arm         armv7       sdp4430             ti             omap4
 s5p_goni                     arm         armv7       goni                samsung        s5pc1xx
 smdkc100                     arm         armv7       smdkc100            samsung        s5pc1xx
+origen			     arm	 armv7	     origen		 samsung	s5pc2xx
 s5pc210_universal            arm         armv7       universal_c210      samsung        s5pc2xx
 smdkv310		     arm	 armv7	     smdkv310		 samsung	s5pc2xx
 harmony                      arm         armv7       harmony             nvidia         tegra2
include/configs/origen.h new file +166 -0

166 lines not on this page · raw message

Signature · 1 line
1.7.4.1
#2 lore raw

PATCH v4 1/2 ARMV7: Add support for Samsung ORIGEN board

Dear Chander Kashyap,

Quoted 4 lines · In message <[email protected]> you…

Origen board is based upon S5PV310 SoC which is similiar to S5PC210 SoC.

...

Quoted 3 lines
board/samsung/origen/lowlevel_init.S new file +3 -0
+	/* APLL(1), MPLL(1), CORE(0), HPM(0) */
+	ldr	r1, =0x0101
+	ldr	r2, =0x14200			@CLK_SRC_CPU

...

Quoted 1 line
(quoted diff) +1 -0
+	mov	r1, #0x10000

...

Quoted 2 lines
board/samsung/origen/lowlevel_init.S new file +2 -0
+	ldr	r1, =0x00
+	ldr	r2, =0x0C210			@CLK_SRC_TOP0

...

Quoted 2 lines
(quoted diff) +2 -0
+	ldr	r1, =0x00
+	ldr	r2, =0x0C214			@CLK_SRC_TOP1_OFFSET

...

Quoted 2 lines
board/samsung/origen/lowlevel_init.S new file +2 -0
+	ldr	r1, =0x10000
+	ldr	r2, =0x10200			@CLK_SRC_DMC_OFFSET

...

..

Quoted 5 lines
board/samsung/origen/lowlevel_init.S new file +5 -0
+	/*
+	 * CLK_DIV_DMC0:
+	 *
+	 * CORE_TIMERS_RATIO[28]	0x1
+	 * COPY2_RATIO[24]		0x3

board/samsung/origen/lowlevel_init.S line 195

Quoted 10 lines
board/samsung/origen/lowlevel_init.S new file +10 -0
+	 * DMCP_RATIO[20]		0x1
+	 * DMCD_RATIO[16]		0x1
+	 * DMC_RATIO[12]		0x1
+	 * DPHY_RATIO[8]		0x1
+	 * ACP_PCLK_RATIO[4]		0x1
+	 * ACP_RATIO[0]			0x3
+	 */
+	ldr	r1, =0x13111113
+	ldr	r2, =0x010500			@CLK_DIV_DMC0_OFFSET
+	str	r1, [r0, r2]

lease get rid of all these magic hard coded constants. Use symbolic names instead. If needed, auto-generate these from the respective C structs. If needed, create the C structs.

...

board/samsung/origen/mem_setup.S

Quoted 3 lines
board/samsung/origen/mem_setup.S new file +0 -0
@@ -0,0 +1,359 @@

What exactly is the reeason for not coding this in C ?

...

Quoted 15 lines
board/samsung/origen/mem_setup.S new file +15 -0
+#ifdef CONFIG_MIU_1BIT_12_INTERLEAVED
+	ldr	r1, =0x0000000c
+	str	r1, [r0, #0x400]
+	ldr	r1, =0x00000001
+	str	r1, [r0, #0xc00]
+#elif defined(CONFIG_MIU_1BIT_7_INTERLEAVED)
+	ldr	r1, =0x00000007
+	str	r1, [r0, #0x400]
+	ldr	r1, =0x00000001
+	str	r1, [r0, #0xc00]
+#elif defined(CONFIG_MIU_2BIT_21_12_INTERLEAVED)
+	ldr	r1, =0x2000150c
+	str	r1, [r0, #0x400]
+	ldr	r1, =0x00000001
+	str	r1, [r0, #0xc00]

board/samsung/origen/mem_setup.S line 82

Quoted 10 lines
board/samsung/origen/mem_setup.S new file +10 -0
+#elif defined(CONFIG_MIU_2BIT_21_7_INTERLEAVED)
+	ldr	r1, =0x20001507
+	str	r1, [r0, #0x400]
+	ldr	r1, =0x00000001
+	str	r1, [r0, #0xc00]
+#elif defined(CONFIG_MIU_2BIT_31_INTERLEAVED)
+	ldr	r1, =0x0000001d
+	str	r1, [r0, #0x400]
+	ldr	r1, =0x00000001
+	str	r1, [r0, #0xc00]

See above. Please get rid of all these hard-ciooded magic numbers. [Eventually this happens automativcally when you rewrite this in C.]

Quoted 11 lines
board/samsung/origen/mem_setup.S new file +11 -0
+int dram_init(void)
+{
+	gd->ram_size	= get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE)
+			+ get_ram_size((long *)PHYS_SDRAM_2, PHYS_SDRAM_2_SIZE)
+			+ get_ram_size((long *)PHYS_SDRAM_3, PHYS_SDRAM_3_SIZE)
+			+ get_ram_size((long *)PHYS_SDRAM_4, PHYS_SDRAM_4_SIZE);
+
+	return 0;
+}
+
+void dram_init_banksize(void)

board/samsung/origen/mem_setup.S line 46

Quoted 10 lines
board/samsung/origen/mem_setup.S new file +10 -0
+{
+	gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
+	gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
+	gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
+	gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE;
+	gd->bd->bi_dram[2].start = PHYS_SDRAM_3;
+	gd->bd->bi_dram[2].size = PHYS_SDRAM_3_SIZE;
+	gd->bd->bi_dram[3].start = PHYS_SDRAM_4;
+	gd->bd->bi_dram[3].size = PHYS_SDRAM_4_SIZE;
+}

How do you detect memory issues in one of the memory banks, say, a memory error in bank 3?

Quoted 5 lines
include/configs/origen.h new file +0 -0
new file mode 100644
index 0000000..3cd9bfe

...

include/configs/origen.h line 165

Quoted 3 lines
include/configs/origen.h new file +3 -0
+#define COPY_BL2_SIZE		0x80000
+#define BL2_START_OFFSET	((CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE)/512)
+#define BL2_SIZE_BLOC_COUNT	(COPY_BL2_SIZE/512)

Some of the defines in this file are not used anywhere in the code (for example, COPY_BL2_SIZE, COPY_BL2_SIZEBL2_START_OFFSET or BL2_SIZE_BLOC_COUNT. Please remove unused defines from this patch.

Best regards,

Wolfgang Denk

Signature · 4 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
Don't hit a man when he's down - kick him; it's easier.
#3 lore raw

PATCH v4 1/2 ARMV7: Add support for Samsung ORIGEN board

Dear Wolfgang Denk,

Quoted 43 lines · Wolfgang Denk

Dear Chander Kashyap,

In message <[email protected]>

Quoted 4 lines · you

Origen board is based upon S5PV310 SoC which is similiar to S5PC210 SoC.

...

Quoted 3 lines
board/samsung/origen/lowlevel_init.S new file +3 -0
+     /* APLL(1), MPLL(1), CORE(0), HPM(0) */
+     ldr     r1, =0x0101
+     ldr     r2, =0x14200                    @CLK_SRC_CPU

...

Quoted 1 line

+ mov r1, #0x10000

...

Quoted 2 lines
board/samsung/origen/lowlevel_init.S new file +2 -0
+     ldr     r1, =0x00
+     ldr     r2, =0x0C210                    @CLK_SRC_TOP0

...

Quoted 2 lines
(quoted diff) +2 -0
+     ldr     r1, =0x00
+     ldr     r2, =0x0C214                    @CLK_SRC_TOP1_OFFSET

...

Quoted 2 lines
board/samsung/origen/lowlevel_init.S new file +2 -0
+     ldr     r1, =0x10000
+     ldr     r2, =0x10200                    @CLK_SRC_DMC_OFFSET

...

..

Quoted 5 lines
board/samsung/origen/lowlevel_init.S new file +5 -0
+     /*
+      * CLK_DIV_DMC0:
+      *
+      * CORE_TIMERS_RATIO[28]        0x1
+      * COPY2_RATIO[24]              0x3

board/samsung/origen/lowlevel_init.S line 195

Quoted 10 lines
board/samsung/origen/lowlevel_init.S new file +10 -0
+      * DMCP_RATIO[20]               0x1
+      * DMCD_RATIO[16]               0x1
+      * DMC_RATIO[12]                0x1
+      * DPHY_RATIO[8]                0x1
+      * ACP_PCLK_RATIO[4]            0x1
+      * ACP_RATIO[0]                 0x3
+      */
+     ldr     r1, =0x13111113
+     ldr     r2, =0x010500                   @CLK_DIV_DMC0_OFFSET
+     str     r1, [r0, r2]
Quoted 4 lines

lease get rid of all these magic hard coded constants. Use symbolic names instead. If needed, auto-generate these from the respective C structs. If needed, create the C structs.

I will change hard coded values to symbolic names.

Quoted 29 lines

...

board/samsung/origen/mem_setup.S

Quoted 3 lines
board/samsung/origen/mem_setup.S new file +0 -0
@@ -0,0 +1,359 @@

What exactly is the reeason for not coding this in C ?

...

Quoted 20 lines
board/samsung/origen/mem_setup.S new file +20 -0
+#ifdef CONFIG_MIU_1BIT_12_INTERLEAVED
+     ldr     r1, =0x0000000c
+     str     r1, [r0, #0x400]
+     ldr     r1, =0x00000001
+     str     r1, [r0, #0xc00]
+#elif defined(CONFIG_MIU_1BIT_7_INTERLEAVED)
+     ldr     r1, =0x00000007
+     str     r1, [r0, #0x400]
+     ldr     r1, =0x00000001
+     str     r1, [r0, #0xc00]
+#elif defined(CONFIG_MIU_2BIT_21_12_INTERLEAVED)
+     ldr     r1, =0x2000150c
+     str     r1, [r0, #0x400]
+     ldr     r1, =0x00000001
+     str     r1, [r0, #0xc00]
+#elif defined(CONFIG_MIU_2BIT_21_7_INTERLEAVED)
+     ldr     r1, =0x20001507
+     str     r1, [r0, #0x400]
+     ldr     r1, =0x00000001
+     str     r1, [r0, #0xc00]
Quoted 8 lines

board/samsung/origen/mem_setup.S line 82

Quoted 5 lines
board/samsung/origen/mem_setup.S new file +5 -0
+#elif defined(CONFIG_MIU_2BIT_31_INTERLEAVED)
+     ldr     r1, =0x0000001d
+     str     r1, [r0, #0x400]
+     ldr     r1, =0x00000001
+     str     r1, [r0, #0xc00]

See above. Please get rid of all these hard-ciooded magic numbers. [Eventually this happens automativcally when you rewrite this in C.]

I will use symbolic names.

Quoted 21 lines

board/samsung/origen/mem_setup.S line 28

Quoted 4 lines
board/samsung/origen/mem_setup.S new file +3 -0
+int dram_init(void)
+{
+     gd->ram_size    = get_ram_size((long *)PHYS_SDRAM_1,

PHYS_SDRAM_1_SIZE)

board/samsung/origen/mem_setup.S line 29

Quoted 1 line
board/samsung/origen/mem_setup.S new file +1 -0
+                     + get_ram_size((long *)PHYS_SDRAM_2,

PHYS_SDRAM_2_SIZE)

board/samsung/origen/mem_setup.S line 30

Quoted 1 line
board/samsung/origen/mem_setup.S new file +1 -0
+                     + get_ram_size((long *)PHYS_SDRAM_3,

PHYS_SDRAM_3_SIZE)

board/samsung/origen/mem_setup.S line 31

Quoted 1 line
board/samsung/origen/mem_setup.S new file +1 -0
+                     + get_ram_size((long *)PHYS_SDRAM_4,

PHYS_SDRAM_4_SIZE);

Quoted 10 lines
board/samsung/origen/mem_setup.S new file +10 -0
+
+     return 0;
+}
+
+void dram_init_banksize(void)
+{
+     gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
+     gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
+     gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
+     gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE;
Quoted 9 lines

board/samsung/origen/mem_setup.S line 46

Quoted 5 lines
board/samsung/origen/mem_setup.S new file +5 -0
+     gd->bd->bi_dram[2].start = PHYS_SDRAM_3;
+     gd->bd->bi_dram[2].size = PHYS_SDRAM_3_SIZE;
+     gd->bd->bi_dram[3].start = PHYS_SDRAM_4;
+     gd->bd->bi_dram[3].size = PHYS_SDRAM_4_SIZE;
+}

How do you detect memory issues in one of the memory banks, say, a memory error in bank 3?

get_ram_size will take care for it.

Quoted 27 lines
Quoted 5 lines
include/configs/origen.h new file +0 -0
new file mode 100644
index 0000000..3cd9bfe

...

include/configs/origen.h line 165

Quoted 3 lines
include/configs/origen.h new file +3 -0
+#define COPY_BL2_SIZE                0x80000
+#define BL2_START_OFFSET     ((CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE)/512)
+#define BL2_SIZE_BLOC_COUNT  (COPY_BL2_SIZE/512)

Some of the defines in this file are not used anywhere in the code (for example, COPY_BL2_SIZE, COPY_BL2_SIZEBL2_START_OFFSET or BL2_SIZE_BLOC_COUNT. Please remove unused defines from this patch.

These are used in spl code. I will move them to spl patch.

Best regards,

Wolfgang Denk

--
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 Don't hit a man when he's down - kick him; it's easier.

Signature · 2 lines
with warm regards,
Chander Kashyap
#4 lore raw

PATCH v4 1/2 ARMV7: Add support for Samsung ORIGEN board

Dear Chander Kashyap,

Quoted 16 lines · In message <CANuQgHFVBv-b5ecRqkrkcpPOwx2umpBR_RFPRx-c0fbvLmxNxQ@mail.gmail.com>…
Quoted 16 lines

board/samsung/origen/origen.c line 62

Quoted 12 lines
board/samsung/origen/origen.c new file +11 -0
+void dram_init_banksize(void)
+{
+     gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
+     gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
+     gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
+     gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE;
+     gd->bd->bi_dram[2].start = PHYS_SDRAM_3;
+     gd->bd->bi_dram[2].size = PHYS_SDRAM_3_SIZE;
+     gd->bd->bi_dram[3].start = PHYS_SDRAM_4;
+     gd->bd->bi_dram[3].size = PHYS_SDRAM_4_SIZE;
+}

How do you detect memory issues in one of the memory banks, say, a memory error in bank 3?

Quoted 1 line

get_ram_size will take care for it.

How so? You are setting these to fixed, predefined values.

If get_ram_size() for bank 3 returns a size of 0, you will still set the size to PHYS_SDRAM_3_SIZE here.

Best regards,

Wolfgang Denk

Signature · 4 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
1000 pains                                              = 1 Megahertz
#5 lore raw

PATCH v4 1/2 ARMV7: Add support for Samsung ORIGEN board

Quoted 21 lines · Wolfgang Denk

Dear Chander Kashyap,

In message < CANuQgHFVBv-b5ecRqkrkcpPOwx2umpBR_RFPRx-c0fbvLmxNxQ at mail.gmail.com> you

Quoted 16 lines · wrote:
Quoted 16 lines

board/samsung/origen/origen.c line 62

Quoted 12 lines
board/samsung/origen/origen.c new file +11 -0
+void dram_init_banksize(void)
+{
+     gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
+     gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
+     gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
+     gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE;
+     gd->bd->bi_dram[2].start = PHYS_SDRAM_3;
+     gd->bd->bi_dram[2].size = PHYS_SDRAM_3_SIZE;
+     gd->bd->bi_dram[3].start = PHYS_SDRAM_4;
+     gd->bd->bi_dram[3].size = PHYS_SDRAM_4_SIZE;
+}

How do you detect memory issues in one of the memory banks, say, a memory error in bank 3?

Quoted 7 lines
Quoted 1 line

get_ram_size will take care for it.

How so? You are setting these to fixed, predefined values.

If get_ram_size() for bank 3 returns a size of 0, you will still set the size to PHYS_SDRAM_3_SIZE here.

Ah. I got yours point. I will rectify it.

Quoted 12 lines

Best regards,

Wolfgang Denk

--
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
1000 pains = 1 Megahertz

Signature · 2 lines
with warm regards,
Chander Kashyap
#6 lore raw

PATCH v4 1/2 ARMV7: Add support for Samsung ORIGEN board

In reply to Chander Kashyap

Dear Wolfgang Denk,

Quoted 47 lines · Chander Kashyap

Dear Wolfgang Denk,

Quoted 43 lines · Wolfgang Denk

Dear Chander Kashyap,

In message <[email protected]>

Quoted 4 lines · you

Origen board is based upon S5PV310 SoC which is similiar to S5PC210 SoC.

...

Quoted 3 lines
board/samsung/origen/lowlevel_init.S new file +3 -0
+     /* APLL(1), MPLL(1), CORE(0), HPM(0) */
+     ldr     r1, =0x0101
+     ldr     r2, =0x14200                    @CLK_SRC_CPU

...

Quoted 1 line

+ mov r1, #0x10000

...

Quoted 2 lines
board/samsung/origen/lowlevel_init.S new file +2 -0
+     ldr     r1, =0x00
+     ldr     r2, =0x0C210                    @CLK_SRC_TOP0

...

Quoted 2 lines
(quoted diff) +2 -0
+     ldr     r1, =0x00
+     ldr     r2, =0x0C214                    @CLK_SRC_TOP1_OFFSET

...

Quoted 2 lines
board/samsung/origen/lowlevel_init.S new file +2 -0
+     ldr     r1, =0x10000
+     ldr     r2, =0x10200                    @CLK_SRC_DMC_OFFSET

...

..

Quoted 15 lines
board/samsung/origen/lowlevel_init.S new file +15 -0
+     /*
+      * CLK_DIV_DMC0:
+      *
+      * CORE_TIMERS_RATIO[28]        0x1
+      * COPY2_RATIO[24]              0x3
+      * DMCP_RATIO[20]               0x1
+      * DMCD_RATIO[16]               0x1
+      * DMC_RATIO[12]                0x1
+      * DPHY_RATIO[8]                0x1
+      * ACP_PCLK_RATIO[4]            0x1
+      * ACP_RATIO[0]                 0x3
+      */
+     ldr     r1, =0x13111113
+     ldr     r2, =0x010500                   @CLK_DIV_DMC0_OFFSET
+     str     r1, [r0, r2]
Quoted 7 lines
Quoted 4 lines

lease get rid of all these magic hard coded constants. Use symbolic names instead. If needed, auto-generate these from the respective C structs. If needed, create the C structs.

I will change hard coded values to symbolic names

While doing this, I find that the values written to the registers are used just once. So do you still prefer to have them as macros ? I did convert the register offsets and addresses to macros, but did not find it right to have macros for register values that are used just once. Please advise.

Quoted 107 lines
Quoted 28 lines

...

board/samsung/origen/mem_setup.S

Quoted 3 lines
board/samsung/origen/mem_setup.S new file +0 -0
@@ -0,0 +1,359 @@

What exactly is the reeason for not coding this in C ?

...

Quoted 20 lines
board/samsung/origen/mem_setup.S new file +20 -0
+#ifdef CONFIG_MIU_1BIT_12_INTERLEAVED
+     ldr     r1, =0x0000000c
+     str     r1, [r0, #0x400]
+     ldr     r1, =0x00000001
+     str     r1, [r0, #0xc00]
+#elif defined(CONFIG_MIU_1BIT_7_INTERLEAVED)
+     ldr     r1, =0x00000007
+     str     r1, [r0, #0x400]
+     ldr     r1, =0x00000001
+     str     r1, [r0, #0xc00]
+#elif defined(CONFIG_MIU_2BIT_21_12_INTERLEAVED)
+     ldr     r1, =0x2000150c
+     str     r1, [r0, #0x400]
+     ldr     r1, =0x00000001
+     str     r1, [r0, #0xc00]
+#elif defined(CONFIG_MIU_2BIT_21_7_INTERLEAVED)
+     ldr     r1, =0x20001507
+     str     r1, [r0, #0x400]
+     ldr     r1, =0x00000001
+     str     r1, [r0, #0xc00]
Quoted 8 lines

board/samsung/origen/mem_setup.S line 82

Quoted 5 lines
board/samsung/origen/mem_setup.S new file +5 -0
+#elif defined(CONFIG_MIU_2BIT_31_INTERLEAVED)
+     ldr     r1, =0x0000001d
+     str     r1, [r0, #0x400]
+     ldr     r1, =0x00000001
+     str     r1, [r0, #0xc00]

See above. Please get rid of all these hard-ciooded magic numbers. [Eventually this happens automativcally when you rewrite this in C.]

I will use symbolic names.

Quoted 21 lines

board/samsung/origen/mem_setup.S line 28

Quoted 4 lines
board/samsung/origen/mem_setup.S new file +3 -0
+int dram_init(void)
+{
+     gd->ram_size    = get_ram_size((long *)PHYS_SDRAM_1,

PHYS_SDRAM_1_SIZE)

board/samsung/origen/mem_setup.S line 29

Quoted 1 line
board/samsung/origen/mem_setup.S new file +1 -0
+                     + get_ram_size((long *)PHYS_SDRAM_2,

PHYS_SDRAM_2_SIZE)

board/samsung/origen/mem_setup.S line 30

Quoted 1 line
board/samsung/origen/mem_setup.S new file +1 -0
+                     + get_ram_size((long *)PHYS_SDRAM_3,

PHYS_SDRAM_3_SIZE)

board/samsung/origen/mem_setup.S line 31

Quoted 1 line
board/samsung/origen/mem_setup.S new file +1 -0
+                     + get_ram_size((long *)PHYS_SDRAM_4,

PHYS_SDRAM_4_SIZE);

Quoted 10 lines
board/samsung/origen/mem_setup.S new file +10 -0
+
+     return 0;
+}
+
+void dram_init_banksize(void)
+{
+     gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
+     gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
+     gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
+     gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE;
Quoted 9 lines

board/samsung/origen/mem_setup.S line 46

Quoted 5 lines
board/samsung/origen/mem_setup.S new file +5 -0
+     gd->bd->bi_dram[2].start = PHYS_SDRAM_3;
+     gd->bd->bi_dram[2].size = PHYS_SDRAM_3_SIZE;
+     gd->bd->bi_dram[3].start = PHYS_SDRAM_4;
+     gd->bd->bi_dram[3].size = PHYS_SDRAM_4_SIZE;
+}

How do you detect memory issues in one of the memory banks, say, a memory error in bank 3?

get_ram_size will take care for it.

Quoted 20 lines
Quoted 5 lines
include/configs/origen.h new file +0 -0
new file mode 100644
index 0000000..3cd9bfe

...

include/configs/origen.h

Quoted 2 lines
include/configs/origen.h new file +2 -0
+#define COPY_BL2_SIZE                0x80000
+#define BL2_START_OFFSET     ((CONFIG_ENV_OFFSET +

CONFIG_ENV_SIZE)/512)

Quoted 1 line

+#define BL2_SIZE_BLOC_COUNT (COPY_BL2_SIZE/512)

Some of the defines in this file are not used anywhere in the code (for example, COPY_BL2_SIZE, COPY_BL2_SIZEBL2_START_OFFSET or BL2_SIZE_BLOC_COUNT. Please remove unused defines from this patch.

These are used in spl code. I will move them to spl patch.

Best regards,

Quoted 8 lines

Wolfgang Denk

--
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 Don't hit a man when he's down - kick him; it's easier.

--
with warm regards,
Chander Kashyap

Signature · 2 lines
with warm regards,
Chander Kashyap
#7 lore raw

PATCH v4 1/2 ARMV7: Add support for Samsung ORIGEN board

Hi Chander,

[...]

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

lease get rid of all these magic hard coded constants. Use symbolic names instead. If needed, auto-generate these from the respective C structs. If needed, create the C structs.

Quoted 7 lines
Quoted 2 lines

I will change hard coded values to symbolic names

While doing this, I find that the values written to the registers are used just once. So do you still prefer to have them as macros ? I did convert the register offsets and addresses to macros, but did not find it right to have macros for register values that are used just once. Please advise.

Most of all we want to get rid of address constants in code. For _values_ that are written to some register, my personal preference is not so strong, alas if you _do_ use macros, usually already the macro name carries documentation as to what this is and it will make code reuse easier for the people having to maintain or build upon your code in the future.

Cheers
Detlev

Signature · 6 lines
Zivilisation ist der Zaubertrick, der uns unsere wahre Natur verbirgt.
                                            -- Salman Rushdie
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de
#8 lore raw

PATCH v4 1/2 ARMV7: Add support for Samsung ORIGEN board

Hi Detlev,

Quoted 18 lines · Detlev Zundel

Hi Chander,

[...]

Quoted 9 lines
Quoted 7 lines
Quoted 4 lines

lease get rid of all these magic hard coded constants. Use symbolic names instead. If needed, auto-generate these from the respective C structs. If needed, create the C structs.

I will change hard coded values to symbolic names

While doing this, I find that the values written to the registers are

used

Quoted 1 line

just once. So do you still prefer to have them as macros ? I did convert

the

Quoted 1 line

register offsets and addresses to macros, but did not find it right to

have

Quoted 9 lines
Quoted 1 line

macros for register values that are used just once. Please advise.

Most of all we want to get rid of address constants in code. For _values_ that are written to some register, my personal preference is not so strong, alas if you _do_ use macros, usually already the macro name carries documentation as to what this is and it will make code reuse easier for the people having to maintain or build upon your code in the future.

Thanks for the inputs.

Quoted 12 lines

Cheers
Detlev

--
Zivilisation ist der Zaubertrick, der uns unsere wahre Natur verbirgt.
-- Salman Rushdie
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de

Signature · 2 lines
with warm regards,
Chander Kashyap
#9 lore raw

PATCH v4 2/2 ORIGEN: Add MMC SPL support

In reply to Chander Kashyap

Adds mmc boot support.

---
 mmc_spl/board/samsung/origen/Makefile             |  106 ++++++++++++++++
 mmc_spl/board/samsung/origen/mmc_boot.c           |   57 +++++++++
 mmc_spl/board/samsung/origen/tools/mkv310_image.c |  140 +++++++++++++++++++++
 mmc_spl/board/samsung/origen/u-boot.lds           |   88 +++++++++++++
 4 files changed, 391 insertions(+), 0 deletions(-)
 create mode 100644 mmc_spl/board/samsung/origen/Makefile
 create mode 100644 mmc_spl/board/samsung/origen/mmc_boot.c
 create mode 100644 mmc_spl/board/samsung/origen/tools/mkv310_image.c
 create mode 100644 mmc_spl/board/samsung/origen/u-boot.lds
mmc_spl/board/samsung/origen/Makefile new file +106 -0
new file mode 100644
index 0000000..1d61cc0
@@ -0,0 +1,106 @@
+#
+# (C) Copyright 2006-2007
+# Stefan Roese, DENX Software Engineering, sr at denx.de.
+#
+# (C) Copyright 2008
+# Guennadi Liakhovetki, DENX Software Engineering, <[email protected]>
+#
+# (C) Copyright 2011
+# Chander Kashyap, Samsung Electronics, <[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
+#
+
+CONFIG_MMC_SPL	= y
+
+include $(TOPDIR)/config.mk
+
+LDSCRIPT= $(TOPDIR)/mmc_spl/board/$(BOARDDIR)/u-boot.lds
+LDFLAGS	= -Bstatic -T $(mmcobj)u-boot.lds -Ttext $(CONFIG_SYS_TEXT_BASE) $(PLATFORM_LDFLAGS)
+AFLAGS	+= -DCONFIG_MMC_SPL
+AFLAGS	+= -DCONFIG_SPL_BUILD
+CFLAGS	+= -DCONFIG_MMC_SPL
+CFLAGS	+= -DCONFIG_SPL_BUILD
+
+SOBJS	= start.o mem_setup.o lowlevel_init.o
+COBJS	= mmc_boot.o
+
+SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS))
+__OBJS	:= $(SOBJS) $(COBJS)
+LNDIR	:= $(OBJTREE)/mmc_spl/board/$(BOARDDIR)
+
+mmcobj	:= $(OBJTREE)/mmc_spl/
+
+
+MKV310_MMC_SPL_EXEC = mkv310_mmc_spl_exec
+MMC_SPL_BIN = u-boot-mmc-spl.bin
+
+ALL = $(mmcobj)u-boot-spl $(mmcobj)u-boot-spl.bin $(mmcobj)$(MMC_SPL_BIN)
+
+all:    $(obj).depend $(ALL)
+
+$(mmcobj)$(MMC_SPL_BIN):  $(mmcobj)u-boot-spl.bin tools/$(MKV310_MMC_SPL_EXEC)
+	./tools/$(MKV310_MMC_SPL_EXEC) $(mmcobj)u-boot-spl.bin $(mmcobj)$(MMC_SPL_BIN)
+	rm -f tools/$(MKV310_MMC_SPL_EXEC)
+
+tools/$(MKV310_MMC_SPL_EXEC): tools/mkv310_image.c
+	$(HOSTCC) tools/mkv310_image.c -o tools/$(MKV310_MMC_SPL_EXEC)
+
+$(mmcobj)u-boot-spl.bin:	$(mmcobj)u-boot-spl
+	$(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
+
+$(mmcobj)u-boot-spl:	$(OBJS) $(mmcobj)u-boot.lds
+	cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) \
+		-Map $(mmcobj)u-boot-spl.map \
+		-o $(mmcobj)u-boot-spl
+
+$(mmcobj)u-boot.lds: $(LDSCRIPT)
+	$(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@
+
+# create symbolic links for common files
+
+# from cpu directory
+start.S:
+	@rm -f $@
+	@ln -s $(TOPDIR)/arch/arm/cpu/armv7/start.S $@
+
+# from board directory
+mem_setup.S:
+	@rm -f $@
+	@ln -s $(TOPDIR)/board/samsung/origen/mem_setup.S $@
+
+lowlevel_init.S:
+	@rm -f $@
+	@ln -s $(TOPDIR)/board/samsung/origen/lowlevel_init.S $@
+
+#########################################################################
+
+$(obj)%.o:	%.S
+	$(CC) $(AFLAGS) -c -o $@ $<
+
+$(obj)%.o:	%.c
+	$(CC) $(CFLAGS) -c -o $@ $<
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
mmc_spl/board/samsung/origen/mmc_boot.c new file +57 -0

57 lines not on this page · raw message

mmc_spl/board/samsung/origen/tools/mkv310_image.c new file +140 -0

140 lines not on this page · raw message

mmc_spl/board/samsung/origen/u-boot.lds new file +88 -0

88 lines not on this page · raw message

Signature · 1 line
1.7.4.1
#10 lore raw

PATCH v4 2/2 ORIGEN: Add MMC SPL support

Hi Chander,

Quoted 157 lines · Chander Kashyap

Adds mmc boot support.

---

?mmc_spl/board/samsung/origen/Makefile ? ? ? ? ? ? | ?106 ++++++++++++++++
?mmc_spl/board/samsung/origen/mmc_boot.c ? ? ? ? ? | ? 57 +++++++++
?mmc_spl/board/samsung/origen/tools/mkv310_image.c | ?140 +++++++++++++++++++++
?mmc_spl/board/samsung/origen/u-boot.lds ? ? ? ? ? | ? 88 +++++++++++++

?4 files changed, 391 insertions(+), 0 deletions(-) ?create mode 100644 mmc_spl/board/samsung/origen/Makefile ?create mode 100644 mmc_spl/board/samsung/origen/mmc_boot.c ?create mode 100644 mmc_spl/board/samsung/origen/tools/mkv310_image.c ?create mode 100644 mmc_spl/board/samsung/origen/u-boot.lds

mmc_spl/board/samsung/origen/Makefile new file +106 -0
new file mode 100644
index 0000000..1d61cc0
@@ -0,0 +1,106 @@
+#
+# (C) Copyright 2006-2007
+# Stefan Roese, DENX Software Engineering, sr at denx.de.
+#
+# (C) Copyright 2008
+# Guennadi Liakhovetki, DENX Software Engineering, <[email protected]>
+#
+# (C) Copyright 2011
+# Chander Kashyap, Samsung Electronics, <[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
+#
+
+CONFIG_MMC_SPL = y
+
+include $(TOPDIR)/config.mk
+
+LDSCRIPT= $(TOPDIR)/mmc_spl/board/$(BOARDDIR)/u-boot.lds
+LDFLAGS ? ? ? ?= -Bstatic -T $(mmcobj)u-boot.lds -Ttext $(CONFIG_SYS_TEXT_BASE) $(PLATFORM_LDFLAGS)
+AFLAGS += -DCONFIG_MMC_SPL
+AFLAGS += -DCONFIG_SPL_BUILD
+CFLAGS += -DCONFIG_MMC_SPL
+CFLAGS += -DCONFIG_SPL_BUILD
+
+SOBJS ?= start.o mem_setup.o lowlevel_init.o
+COBJS ?= mmc_boot.o
+
+SRCS ? := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS ? := $(addprefix $(obj),$(SOBJS) $(COBJS))
+__OBJS := $(SOBJS) $(COBJS)
+LNDIR ?:= $(OBJTREE)/mmc_spl/board/$(BOARDDIR)
+
+mmcobj := $(OBJTREE)/mmc_spl/
+
+
+MKV310_MMC_SPL_EXEC = mkv310_mmc_spl_exec
+MMC_SPL_BIN = u-boot-mmc-spl.bin
+
+ALL = $(mmcobj)u-boot-spl $(mmcobj)u-boot-spl.bin $(mmcobj)$(MMC_SPL_BIN)
+
+all: ? ?$(obj).depend $(ALL)
+
+$(mmcobj)$(MMC_SPL_BIN): ?$(mmcobj)u-boot-spl.bin tools/$(MKV310_MMC_SPL_EXEC)
+ ? ? ? ./tools/$(MKV310_MMC_SPL_EXEC) $(mmcobj)u-boot-spl.bin $(mmcobj)$(MMC_SPL_BIN)
+ ? ? ? rm -f tools/$(MKV310_MMC_SPL_EXEC)
+
+tools/$(MKV310_MMC_SPL_EXEC): tools/mkv310_image.c
+ ? ? ? $(HOSTCC) tools/mkv310_image.c -o tools/$(MKV310_MMC_SPL_EXEC)
+
+$(mmcobj)u-boot-spl.bin: ? ? ? $(mmcobj)u-boot-spl
+ ? ? ? $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
+
+$(mmcobj)u-boot-spl: ? $(OBJS) $(mmcobj)u-boot.lds
+ ? ? ? cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) \
+ ? ? ? ? ? ? ? -Map $(mmcobj)u-boot-spl.map \
+ ? ? ? ? ? ? ? -o $(mmcobj)u-boot-spl
+
+$(mmcobj)u-boot.lds: $(LDSCRIPT)
+ ? ? ? $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@
+
+# create symbolic links for common files
+
+# from cpu directory
+start.S:
+ ? ? ? @rm -f $@
+ ? ? ? @ln -s $(TOPDIR)/arch/arm/cpu/armv7/start.S $@
+
+# from board directory
+mem_setup.S:
+ ? ? ? @rm -f $@
+ ? ? ? @ln -s $(TOPDIR)/board/samsung/origen/mem_setup.S $@
+
+lowlevel_init.S:
+ ? ? ? @rm -f $@
+ ? ? ? @ln -s $(TOPDIR)/board/samsung/origen/lowlevel_init.S $@
+
+#########################################################################
+
+$(obj)%.o: ? ? %.S
+ ? ? ? $(CC) $(AFLAGS) -c -o $@ $<
+
+$(obj)%.o: ? ? %.c
+ ? ? ? $(CC) $(CFLAGS) -c -o $@ $<
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
mmc_spl/board/samsung/origen/mmc_boot.c new file +25 -0
new file mode 100644
index 0000000..d9b44d8
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2011 Samsung Electronics
+ *
+ * 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<common.h>
+#include<config.h>
+

mmc_spl/board/samsung/origen/mmc_boot.c line 35

Quoted 10 lines
mmc_spl/board/samsung/origen/mmc_boot.c new file +10 -0
+typedef u32(*copy_sd_mmc_to_mem) \
+ ? ? ? (u32 start_block, u32 block_count, u32 *dest_addr);
+
+
+void copy_uboot_to_ram(void)
+{
+ ? ? ? copy_sd_mmc_to_mem copy_bl2 = (copy_sd_mmc_to_mem)*(u32 *)(0x02020030);
+ ? ? ? copy_bl2(BL2_START_OFFSET,\
+ ? ? ? ? ? ? ? BL2_SIZE_BLOC_COUNT, (u32 *)CONFIG_SYS_TEXT_BASE);
+}

Curious to know, what the 0x02020030 hardcoding number means here? It is a pointer to a API or hardware register, or anything else, how this simple function perform the
data transfer from mmc to ram?

Best regards,
Lei

#11 lore raw

PATCH v4 2/2 ORIGEN: Add MMC SPL support

Dear Chander Kashyap,

Quoted 5 lines · In message <CALZhoSTV0zYX=ySw-vS6D51X0B_MHxt8sq1sTw7XEkyV1C=Odg@mail.gmail.com>…
Quoted 2 lines · Chander Kashyap

Adds mmc boot support.

Quoted 11 lines
Quoted 11 lines
---
 mmc_spl/board/samsung/origen/Makefile             |  106 ++++++++++++++++
 mmc_spl/board/samsung/origen/mmc_boot.c           |   57 +++++++++
 mmc_spl/board/samsung/origen/tools/mkv310_image.c |  140 +++++++++++++++++++++
 mmc_spl/board/samsung/origen/u-boot.lds           |   88 +++++++++++++
 4 files changed, 391 insertions(+), 0 deletions(-)
 create mode 100644 mmc_spl/board/samsung/origen/Makefile
 create mode 100644 mmc_spl/board/samsung/origen/mmc_boot.c
 create mode 100644 mmc_spl/board/samsung/origen/tools/mkv310_image.c
 create mode 100644 mmc_spl/board/samsung/origen/u-boot.lds

It appears this patch has never been posted on the U-Boot mailing list.Lei Wen

#12 lore raw

PATCH v4 2/2 ORIGEN: Add MMC SPL support

Quoted 8 lines · In message <[email protected]> I wrote:
Quoted 6 lines · In message <CALZhoSTV0zYX=ySw-vS6D51X0B_MHxt8sq1sTw7XEkyV1C=Odg@mail.gmail.com>…
Quoted 3 lines · Chander Kashyap

Adds mmc boot support.

...

Quoted 2 lines

It appears this patch has never been posted on the U-Boot mailing list.Lei Wen

oops. Sorry, my fault. Please ignore me.

Best regards,

Wolfgang Denk

Signature · 4 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
"Why should we subsidize intellectual curiosity?" - Ronald Reagan
#13 lore raw

PATCH v4 2/2 ORIGEN: Add MMC SPL support

In reply to Lei Wen

Hi Lei Wen,

Quoted 183 lines · Lei Wen

Hi Chander,

Quoted 5 lines · Chander Kashyap

Adds mmc boot support.

---
 mmc_spl/board/samsung/origen/Makefile             |  106

++++++++++++++++

Quoted 2 lines
 mmc_spl/board/samsung/origen/mmc_boot.c           |   57 +++++++++
 mmc_spl/board/samsung/origen/tools/mkv310_image.c |  140

+++++++++++++++++++++

Review

Quoted 8 lines
 mmc_spl/board/samsung/origen/u-boot.lds           |   88 +++++++++++++
 4 files changed, 391 insertions(+), 0 deletions(-)
 create mode 100644 mmc_spl/board/samsung/origen/Makefile
 create mode 100644 mmc_spl/board/samsung/origen/mmc_boot.c
 create mode 100644 mmc_spl/board/samsung/origen/tools/mkv310_image.c
 create mode 100644 mmc_spl/board/samsung/origen/u-boot.lds
(quoted diff) +0 -0

b/mmc_spl/board/samsung/origen/Makefile

Quoted 30 lines

new file mode 100644
index 0000000..1d61cc0

mmc_spl/board/samsung/origen/Makefile new file +25 -0
@@ -0,0 +1,106 @@
+#
+# (C) Copyright 2006-2007
+# Stefan Roese, DENX Software Engineering, sr at denx.de.
+#
+# (C) Copyright 2008
+# Guennadi Liakhovetki, DENX Software Engineering, <[email protected]>
+#
+# (C) Copyright 2011
+# Chander Kashyap, Samsung Electronics, <[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

mmc_spl/board/samsung/origen/Makefile line 35

Quoted 10 lines
mmc_spl/board/samsung/origen/Makefile new file +10 -0
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+CONFIG_MMC_SPL = y
+
+include $(TOPDIR)/config.mk
+
+LDSCRIPT= $(TOPDIR)/mmc_spl/board/$(BOARDDIR)/u-boot.lds
+LDFLAGS        = -Bstatic -T $(mmcobj)u-boot.lds -Ttext

$(CONFIG_SYS_TEXT_BASE) $(PLATFORM_LDFLAGS)

Quoted 10 lines
mmc_spl/board/samsung/origen/Makefile new file +10 -0
+AFLAGS += -DCONFIG_MMC_SPL
+AFLAGS += -DCONFIG_SPL_BUILD
+CFLAGS += -DCONFIG_MMC_SPL
+CFLAGS += -DCONFIG_SPL_BUILD
+
+SOBJS  = start.o mem_setup.o lowlevel_init.o
+COBJS  = mmc_boot.o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(SOBJS) $(COBJS))

mmc_spl/board/samsung/origen/Makefile

Quoted 10 lines
mmc_spl/board/samsung/origen/Makefile new file +10 -0
+__OBJS := $(SOBJS) $(COBJS)
+LNDIR  := $(OBJTREE)/mmc_spl/board/$(BOARDDIR)
+
+mmcobj := $(OBJTREE)/mmc_spl/
+
+
+MKV310_MMC_SPL_EXEC = mkv310_mmc_spl_exec
+MMC_SPL_BIN = u-boot-mmc-spl.bin
+
+ALL = $(mmcobj)u-boot-spl $(mmcobj)u-boot-spl.bin

$(mmcobj)$(MMC_SPL_BIN)

mmc_spl/board/samsung/origen/Makefile

Quoted 4 lines
mmc_spl/board/samsung/origen/Makefile new file +4 -0
+
+all:    $(obj).depend $(ALL)
+
+$(mmcobj)$(MMC_SPL_BIN):  $(mmcobj)u-boot-spl.bin

tools/$(MKV310_MMC_SPL_EXEC)

mmc_spl/board/samsung/origen/Makefile line 60

Quoted 1 line
mmc_spl/board/samsung/origen/Makefile new file +1 -0
+       ./tools/$(MKV310_MMC_SPL_EXEC) $(mmcobj)u-boot-spl.bin

$(mmcobj)$(MMC_SPL_BIN)

Quoted 23 lines
mmc_spl/board/samsung/origen/Makefile new file +22 -0
+       rm -f tools/$(MKV310_MMC_SPL_EXEC)
+
+tools/$(MKV310_MMC_SPL_EXEC): tools/mkv310_image.c
+       $(HOSTCC) tools/mkv310_image.c -o tools/$(MKV310_MMC_SPL_EXEC)
+
+$(mmcobj)u-boot-spl.bin:       $(mmcobj)u-boot-spl
+       $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
+
+$(mmcobj)u-boot-spl:   $(OBJS) $(mmcobj)u-boot.lds
+       cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) \
+               -Map $(mmcobj)u-boot-spl.map \
+               -o $(mmcobj)u-boot-spl
+
+$(mmcobj)u-boot.lds: $(LDSCRIPT)
+       $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@
+
+# create symbolic links for common files
+
+# from cpu directory
+start.S:
+       @rm -f $@
+       @ln -s $(TOPDIR)/arch/arm/cpu/armv7/start.S $@

mmc_spl/board/samsung/origen/Makefile line 92

Quoted 10 lines
mmc_spl/board/samsung/origen/Makefile new file +10 -0
+
+# from board directory
+mem_setup.S:
+       @rm -f $@
+       @ln -s $(TOPDIR)/board/samsung/origen/mem_setup.S $@
+
+lowlevel_init.S:
+       @rm -f $@
+       @ln -s $(TOPDIR)/board/samsung/origen/lowlevel_init.S $@
+

+#########################################################################

mmc_spl/board/samsung/origen/Makefile line 105

Quoted 13 lines
mmc_spl/board/samsung/origen/Makefile new file +12 -0
+
+$(obj)%.o:     %.S
+       $(CC) $(AFLAGS) -c -o $@ $<
+
+$(obj)%.o:     %.c
+       $(CC) $(CFLAGS) -c -o $@ $<
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+

+#########################################################################

Review

Quoted 1 line
(quoted diff) +0 -0

b/mmc_spl/board/samsung/origen/mmc_boot.c

Quoted 27 lines

new file mode 100644
index 0000000..d9b44d8

mmc_spl/board/samsung/origen/mmc_boot.c new file +22 -0
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2011 Samsung Electronics
+ *
+ * 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
+ */
+

mmc_spl/board/samsung/origen/mmc_boot.c line 32

Quoted 10 lines
mmc_spl/board/samsung/origen/mmc_boot.c new file +10 -0
+#include<common.h>
+#include<config.h>
+
+typedef u32(*copy_sd_mmc_to_mem) \
+       (u32 start_block, u32 block_count, u32 *dest_addr);
+
+
+void copy_uboot_to_ram(void)
+{
+       copy_sd_mmc_to_mem copy_bl2 = (copy_sd_mmc_to_mem)*(u32

*)(0x02020030);

mmc_spl/board/samsung/origen/mmc_boot.c line 35

Quoted 3 lines
mmc_spl/board/samsung/origen/mmc_boot.c new file +3 -0
+       copy_bl2(BL2_START_OFFSET,\
+               BL2_SIZE_BLOC_COUNT, (u32 *)CONFIG_SYS_TEXT_BASE);
+}
Quoted 6 lines

Curious to know, what the 0x02020030 hardcoding number means here? It is a pointer to a API or hardware register, or anything else, how this simple function perform the
data transfer from mmc to ram?

0x02020030 is iROM address, which contains pointer to API (copy from mmc

from DDR) in iROM.

Best regards,

Quoted 2 lines

Lei

Signature · 2 lines
with warm regards,
Chander Kashyap
#14 lore raw

PATCH v4 2/2 ORIGEN: Add MMC SPL support

Dear Chander Kashyap,

Quoted 1 line · In message <CANuQgHGGaB3fWEFCXfgd97QxOfnizxLYvO8ke-v=5PzHyTN-Jg@mail.gmail.com>…

[200+ lines of unrelated quote deleted.]

Quoted 12 lines
Quoted 12 lines

mmc_spl/board/samsung/origen/mmc_boot.c line 35

Quoted 6 lines
mmc_spl/board/samsung/origen/mmc_boot.c new file +6 -0
+void copy_uboot_to_ram(void)
+{
+       copy_sd_mmc_to_mem copy_bl2 = (copy_sd_mmc_to_mem)*(u32 *)(0x02020030);
+       copy_bl2(BL2_START_OFFSET,\
+               BL2_SIZE_BLOC_COUNT, (u32 *)CONFIG_SYS_TEXT_BASE);
+}

Curious to know, what the 0x02020030 hardcoding number means here? It is a pointer to a API or hardware register, or anything else, how this simple function perform the
data transfer from mmc to ram?

Quoted 2 lines
Quoted 1 line

0x02020030 is iROM address, which contains pointer to API (copy from mmc

from DDR) in iROM.

Well, as you can see yourself here, an external reviewer has no chance to reand and understand this code. As mentioned before, this needs serious rework.

Best regards,

Wolfgang Denk

Signature · 6 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
Those who hate and fight must stop themselves -- otherwise it is  not
stopped.
	-- Spock, "Day of the Dove", stardate unknown
#15 lore raw

PATCH v4 2/2 ORIGEN: Add MMC SPL support

Dear Wolfgang Denk,

Quoted 20 lines · Wolfgang Denk

Dear Chander Kashyap,

In message <CANuQgHGGaB3fWEFCXfgd97QxOfnizxLYvO8ke-v=

Quoted 1 line · 5PzHyTN-Jg at mail.gmail.com> you wrote:

[200+ lines of unrelated quote deleted.]

Quoted 3 lines
Quoted 3 lines

mmc_spl/board/samsung/origen/mmc_boot.c

Quoted 3 lines
mmc_spl/board/samsung/origen/mmc_boot.c new file +3 -0
+void copy_uboot_to_ram(void)
+{
+       copy_sd_mmc_to_mem copy_bl2 = (copy_sd_mmc_to_mem)*(u32

*)(0x02020030);

Quoted 9 lines
Quoted 9 lines

mmc_spl/board/samsung/origen/mmc_boot.c line 35

Quoted 3 lines
mmc_spl/board/samsung/origen/mmc_boot.c new file +3 -0
+       copy_bl2(BL2_START_OFFSET,\
+               BL2_SIZE_BLOC_COUNT, (u32 *)CONFIG_SYS_TEXT_BASE);
+}

Curious to know, what the 0x02020030 hardcoding number means here? It is a pointer to a API or hardware register, or anything else, how this simple function perform the
data transfer from mmc to ram?

Quoted 8 lines
Quoted 1 line
Quoted 1 line

0x02020030 is iROM address, which contains pointer to API (copy from

mmc

Quoted 1 line

from DDR) in iROM.

Well, as you can see yourself here, an external reviewer has no chance to reand and understand this code. As mentioned before, this needs serious rework.

Yes I am reworking on it. I make it more readable. But still i need to use the inbuilt function to copy u-boot from mmc to ddr.

Quoted 13 lines

Best regards,

Wolfgang Denk

--
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 Those who hate and fight must stop themselves -- otherwise it is not stopped.
-- Spock, "Day of the Dove", stardate unknown

Signature · 2 lines
with warm regards,
Chander Kashyap
#16 lore raw

PATCH v4 2/2 ORIGEN: Add MMC SPL support

In reply to Chander Kashyap

Dear Chander Kashyap,

Quoted 13 lines · In message <[email protected]> you…

Adds mmc boot support.

---
 mmc_spl/board/samsung/origen/Makefile             |  106 ++++++++++++++++
 mmc_spl/board/samsung/origen/mmc_boot.c           |   57 +++++++++
 mmc_spl/board/samsung/origen/tools/mkv310_image.c |  140 +++++++++++++++++++++
 mmc_spl/board/samsung/origen/u-boot.lds           |   88 +++++++++++++
 4 files changed, 391 insertions(+), 0 deletions(-)
 create mode 100644 mmc_spl/board/samsung/origen/Makefile
 create mode 100644 mmc_spl/board/samsung/origen/mmc_boot.c
 create mode 100644 mmc_spl/board/samsung/origen/tools/mkv310_image.c
 create mode 100644 mmc_spl/board/samsung/origen/u-boot.lds

PLease adapt this code to the new SPL infrastructure that has recently been introduced.

mmc_spl/board/samsung/origen/mmc_boot.c line 27

Quoted 2 lines
mmc_spl/board/samsung/origen/mmc_boot.c new file +2 -0
+typedef u32(*copy_sd_mmc_to_mem) \
+	(u32 start_block, u32 block_count, u32 *dest_addr);

Quote CodingStyle:

Lots of people think that typedefs "help readability". Not so.

mmc_spl/board/samsung/origen/mmc_boot.c line 35

Quoted 6 lines
mmc_spl/board/samsung/origen/mmc_boot.c new file +6 -0
+void copy_uboot_to_ram(void)
+{
+	copy_sd_mmc_to_mem copy_bl2 = (copy_sd_mmc_to_mem)*(u32 *)(0x02020030);
+	copy_bl2(BL2_START_OFFSET,\
+		BL2_SIZE_BLOC_COUNT, (u32 *)CONFIG_SYS_TEXT_BASE);
+}

This code is, in addition to the magic 0x02020030 constant, basicly unreadable.

The typedef is especially useless as it is used only in this single case. Please clean this up.

mmc_spl/board/samsung/origen/u-boot.lds

Quoted 5 lines
mmc_spl/board/samsung/origen/u-boot.lds new file +0 -0
new file mode 100644
index 0000000..4a231d9

What exactly is the reason for needing your own, custom linker script?

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
Defaults are wonderful, just like fire.
                  - Larry Wall in <[email protected]>
#17 lore raw

PATCH v4 2/2 ORIGEN: Add MMC SPL support

Dear Wolfgang Denk,

Quoted 20 lines · Wolfgang Denk

Dear Chander Kashyap,

In message <[email protected]>

Quoted 5 lines · you

Adds mmc boot support.

---
 mmc_spl/board/samsung/origen/Makefile             |  106

++++++++++++++++

Quoted 2 lines
 mmc_spl/board/samsung/origen/mmc_boot.c           |   57 +++++++++
 mmc_spl/board/samsung/origen/tools/mkv310_image.c |  140

+++++++++++++++++++++

Quoted 6 lines
 mmc_spl/board/samsung/origen/u-boot.lds           |   88 +++++++++++++
 4 files changed, 391 insertions(+), 0 deletions(-)
 create mode 100644 mmc_spl/board/samsung/origen/Makefile
 create mode 100644 mmc_spl/board/samsung/origen/mmc_boot.c
 create mode 100644 mmc_spl/board/samsung/origen/tools/mkv310_image.c
 create mode 100644 mmc_spl/board/samsung/origen/u-boot.lds
Quoted 3 lines

PLease adapt this code to the new SPL infrastructure that has recently been introduced.

Yes i will use the new SPL Infrastructure.

Quoted 43 lines

mmc_spl/board/samsung/origen/mmc_boot.c line 27

Quoted 4 lines
mmc_spl/board/samsung/origen/mmc_boot.c new file +2 -0
+typedef u32(*copy_sd_mmc_to_mem) \
+     (u32 start_block, u32 block_count, u32 *dest_addr);

Quote CodingStyle:

Lots of people think that typedefs "help readability". Not so.

mmc_spl/board/samsung/origen/mmc_boot.c

Quoted 3 lines
mmc_spl/board/samsung/origen/mmc_boot.c new file +3 -0
+void copy_uboot_to_ram(void)
+{
+     copy_sd_mmc_to_mem copy_bl2 = (copy_sd_mmc_to_mem)*(u32

*)(0x02020030);

mmc_spl/board/samsung/origen/mmc_boot.c line 35

Quoted 3 lines
mmc_spl/board/samsung/origen/mmc_boot.c new file +3 -0
+     copy_bl2(BL2_START_OFFSET,\
+             BL2_SIZE_BLOC_COUNT, (u32 *)CONFIG_SYS_TEXT_BASE);
+}

This code is, in addition to the magic 0x02020030 constant, basicly unreadable.

The typedef is especially useless as it is used only in this single case. Please clean this up.

Review

Quoted 1 line
(quoted diff) +0 -0

b/mmc_spl/board/samsung/origen/u-boot.lds

mmc_spl/board/samsung/origen/u-boot.lds

Quoted 4 lines

new file mode 100644
index 0000000..4a231d9

mmc_spl/board/samsung/origen/u-boot.lds new file +0 -0

What exactly is the reason for needing your own, custom linker script?

Best regards,

Wolfgang Denk

--
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 Defaults are wonderful, just like fire.
- Larry Wall in <[email protected]>

Signature · 2 lines
with warm regards,
Chander Kashyap