Skip to contentSkip to conversation

Kirkwood: dram_init is moved to dram.c

PATCH New Prafulla Wadaskar 6 participants 26 messages Sep 30, 2010 – Oct 1, 2010 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Kirkwood: dram_init is moved to dram.c

For all Kirkwood boards so far dram_init function is duplicated dram_init function is moved to dram.c and relevant code from all board specific files removed

If any board needs specific dram init handling than standard one, then, a macro CONFIG_SYS_BOARD_DRAM_INIT should be defined in board config header file and the dram_init function can be put in board specific source file
For ex. keymile boards

---
 arch/arm/cpu/arm926ejs/kirkwood/dram.c          |   22 ++++++++++++++++++++++
 board/Marvell/guruplug/guruplug.c               |   11 -----------
 board/Marvell/mv88f6281gtw_ge/mv88f6281gtw_ge.c |   11 -----------
 board/Marvell/openrd_base/openrd_base.c         |   11 -----------
 board/Marvell/rd6281a/rd6281a.c                 |   11 -----------
 board/Marvell/sheevaplug/sheevaplug.c           |   11 -----------
 include/configs/keymile-common.h                |    1 +
 7 files changed, 23 insertions(+), 55 deletions(-)
arch/arm/cpu/arm926ejs/kirkwood/dram.c +22 -0
index 8f2a18a..d929d7a 100644
@@ -23,8 +23,11 @@
  */
 
 #include <config.h>
+#include <common.h>
 #include <asm/arch/kirkwood.h>
 
+DECLARE_GLOBAL_DATA_PTR;
+
 #define KW_REG_CPUCS_WIN_BAR(x)		(KW_REGISTER(0x1500) + (x * 0x08))
 #define KW_REG_CPUCS_WIN_SZ(x)		(KW_REGISTER(0x1504) + (x * 0x08))
 /*
@@ -56,3 +59,22 @@ u32 kw_sdram_bs(enum memory_bank bank)
 	result += 0x01000000;
 	return result;
 }
+
+#ifndef CONFIG_SYS_BOARD_DRAM_INIT
+int dram_init(void)
+{
+	int i;
+#if !defined(CONFIG_SYS_ARM_WITHOUT_RELOC)
+	gd->ram_size = 0;
+#endif
+	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
+		gd->bd->bi_dram[i].start = kw_sdram_bar(i);
+		gd->bd->bi_dram[i].size = kw_sdram_bs(i);
+#if !defined(CONFIG_SYS_ARM_WITHOUT_RELOC)
+		gd->ram_size += gd->bd->bi_dram[i].size;
+#endif
+	}
+	return 0;
+}
+#endif /* CONFIG_SYS_KWDRAM_INIT */
+
board/Marvell/guruplug/guruplug.c +0 -11
index c028a53..4df4e9b 100644
@@ -108,17 +108,6 @@ int board_init(void)
 	return 0;
 }
 
-int dram_init(void)
-{
-	int i;
-
-	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
-		gd->bd->bi_dram[i].start = kw_sdram_bar(i);
-		gd->bd->bi_dram[i].size = kw_sdram_bs(i);
-	}
-	return 0;
-}
-
 #ifdef CONFIG_RESET_PHY_R
 void mv_phy_88e1121_init(char *name)
 {
board/Marvell/mv88f6281gtw_ge/mv88f6281gtw_ge.c +0 -11
index c959bf8..93d1400 100644
@@ -110,17 +110,6 @@ int board_init(void)
 	return 0;
 }
 
-int dram_init(void)
-{
-	int i;
-
-	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
-		gd->bd->bi_dram[i].start = kw_sdram_bar(i);
-		gd->bd->bi_dram[i].size = kw_sdram_bs(i);
-	}
-	return 0;
-}
-
 #ifdef CONFIG_MV88E61XX_SWITCH
 void reset_phy(void)
 {
board/Marvell/openrd_base/openrd_base.c +0 -11
index c00a08a..d006b2d 100644
@@ -113,17 +113,6 @@ int board_init(void)
 	return 0;
 }
 
-int dram_init(void)
-{
-	int i;
-
-	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
-		gd->bd->bi_dram[i].start = kw_sdram_bar(i);
-		gd->bd->bi_dram[i].size = kw_sdram_bs(i);
-	}
-	return 0;
-}
-
 #ifdef CONFIG_RESET_PHY_R
 /* Configure and enable MV88E1116 PHY */
 void reset_phy(void)
board/Marvell/rd6281a/rd6281a.c +0 -11
index 8713a3c..0d76146 100644
@@ -109,17 +109,6 @@ int board_init(void)
 	return 0;
 }
 
-int dram_init(void)
-{
-	int i;
-
-	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
-		gd->bd->bi_dram[i].start = kw_sdram_bar(i);
-		gd->bd->bi_dram[i].size = kw_sdram_bs(i);
-	}
-	return 0;
-}
-
 void mv_phy_88e1116_init(char *name)
 {
 	u16 reg;
board/Marvell/sheevaplug/sheevaplug.c +0 -11
index 547126a..173a7b8 100644
@@ -108,17 +108,6 @@ int board_init(void)
 	return 0;
 }
 
-int dram_init(void)
-{
-	int i;
-
-	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
-		gd->bd->bi_dram[i].start = kw_sdram_bar(i);
-		gd->bd->bi_dram[i].size = kw_sdram_bs(i);
-	}
-	return 0;
-}
-
 #ifdef CONFIG_RESET_PHY_R
 /* Configure and enable MV88E1116 PHY */
 void reset_phy(void)
include/configs/keymile-common.h +1 -0
index 6c14ca0..62d21f6 100644
@@ -85,6 +85,7 @@
 
 #define CONFIG_LOADS_ECHO	1	/* echo on for serial download */
 #define CONFIG_SYS_LOADS_BAUD_CHANGE	1	/* allow baudrate change */
+#define CONFIG_SYS_BOARD_DRAM_INIT	/* Used board specific dram_init */
 
 /*
  * How to get access to the slot ID.  Put this here to make it easy
Signature · 1 line
1.5.3.3
#1 lore raw

PATCH 1/1 kirkwood: added common config file mv-config.h

It is observed that, in most of the board configs the code is being duplicated, also for any common change all board files needs update This issue was under discussion from long on mailing list and we converge on introducing common config file.

With this patch-
1. Total Kirkwood specific configuration code is reduced by 210 lines
2. All common configuration can be shared by multiple boards
3. Easy to manage common updates like ARM relocation changes

mv-config.h file is added to include/configs/
It contains all common configuration supported for all Kirkwood boards The respective board configs are updated for its usage

Build tested for guruplug, mv88f6281gtw_ge, openrd_base, rd6281a and sheevaplug
Binary execution tested for sheevaplug

Todo:
1. Other custom Kirkwood boards to be synced
2. After ARM relocation patches mvgbe driver is broken for network activity (need to be addressed)
3. The support to be extended for Orion5X based boards

---
 include/configs/guruplug.h        |  102 +----------------
 include/configs/mv-common.h       |  230 +++++++++++++++++++++++++++++++++++++
 include/configs/mv88f6281gtw_ge.h |  120 ++-----------------
 include/configs/openrd_base.h     |  144 +-----------------------
 include/configs/rd6281a.h         |   98 +---------------
 include/configs/sheevaplug.h      |  104 +----------------
 6 files changed, 255 insertions(+), 543 deletions(-)
 create mode 100644 include/configs/mv-common.h
include/configs/guruplug.h +3 -99
index eb3fa57..c2a5370 100644
@@ -33,58 +33,12 @@
 /*
  * High Level Configuration Options (easy to change)
  */
-#define CONFIG_MARVELL		1
-#define CONFIG_ARM926EJS	1	/* Basic Architecture */
 #define CONFIG_SHEEVA_88SV131	1	/* CPU Core subversion */
 #define CONFIG_KIRKWOOD		1	/* SOC Family Name */
 #define CONFIG_KW88F6281	1	/* SOC Name */
 #define CONFIG_MACH_GURUPLUG	/* Machine type */
-
-#define CONFIG_MD5	/* get_random_hex on krikwood needs MD5 support */
 #define CONFIG_SKIP_LOWLEVEL_INIT	/* disable board lowlevel_init */
-#define CONFIG_KIRKWOOD_EGIGA_INIT	/* Enable GbePort0/1 for kernel */
-#define CONFIG_KIRKWOOD_RGMII_PAD_1V8	/* Set RGMII Pad voltage to 1.8V */
-
-/*
- * CLKs configurations
- */
-#define CONFIG_SYS_HZ		1000
-
-/*
- * NS16550 Configuration
- */
-#define CONFIG_SYS_NS16550
-#define CONFIG_SYS_NS16550_SERIAL
-#define CONFIG_SYS_NS16550_REG_SIZE	(-4)
-#define CONFIG_SYS_NS16550_CLK		CONFIG_SYS_TCLK
-#define CONFIG_SYS_NS16550_COM1		KW_UART0_BASE
-
-/*
- * Serial Port configuration
- * The following definitions let you select what serial you want to use
- * for your console driver.
- */
-
-#define CONFIG_CONS_INDEX	1	/*Console on UART0 */
-#define CONFIG_BAUDRATE			115200
-#define CONFIG_SYS_BAUDRATE_TABLE	{ 9600, 19200, 38400, 57600, \
-					  115200,230400, 460800, 921600 }
-/* auto boot */
-#define CONFIG_BOOTDELAY	3	/* default enable autoboot */
-
-/*
- * For booting Linux, the board info and command line data
- * have to be in the first 8 MB of memory, since this is
- * the maximum mapped by the Linux kernel during initialization.
- */
-#define CONFIG_CMDLINE_TAG	1	/* enable passing of ATAGs  */
-#define CONFIG_INITRD_TAG	1	/* enable INITRD tag */
-#define CONFIG_SETUP_MEMORY_TAGS 1	/* enable memory tag */
 
-#define	CONFIG_SYS_PROMPT	"Marvell>> "	/* Command Prompt */
-#define	CONFIG_SYS_CBSIZE	1024	/* Console I/O Buff Size */
-#define	CONFIG_SYS_PBSIZE	(CONFIG_SYS_CBSIZE \
-		+sizeof(CONFIG_SYS_PROMPT) + 16)	/* Print Buff */
 /*
  * Commands configuration
  */
@@ -96,18 +50,11 @@
 #define CONFIG_CMD_NAND
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_USB
-
 /*
- * NAND configuration
+ * mv-common.h should be defined after CMD configs since it used them
+ * to enable certain macros
  */
-#ifdef CONFIG_CMD_NAND
-#define CONFIG_NAND_KIRKWOOD
-#define CONFIG_SYS_MAX_NAND_DEVICE	1
-#define NAND_MAX_CHIPS			1
-#define CONFIG_SYS_NAND_BASE		0xD8000000	/* KW_DEFADR_NANDF */
-#define NAND_ALLOW_ERASE_ALL		1
-#define CONFIG_SYS_64BIT_VSPRINTF	/* needed for nand_util.c */
-#endif
+#include "mv-common.h"
 
 /*
  *  Environment variables configurations
@@ -143,56 +90,13 @@
 	"x_bootargs_root=ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs\0"
 
 /*
- * Size of malloc() pool
- */
-#define CONFIG_SYS_MALLOC_LEN	(1024 * 128) /* 128kB for malloc() */
-/* size in bytes reserved for initial data */
-#define CONFIG_SYS_GBL_DATA_SIZE	128
-
-/*
- * Other required configurations
- */
-#define CONFIG_CONSOLE_INFO_QUIET	/* some code reduction */
-#define CONFIG_ARCH_CPU_INIT	/* call arch_cpu_init() */
-#define CONFIG_ARCH_MISC_INIT	/* call arch_misc_init() */
-#define CONFIG_DISPLAY_CPUINFO	/* Display cpu info */
-#define CONFIG_NR_DRAM_BANKS	4
-#define CONFIG_STACKSIZE	0x00100000	/* regular stack- 1M */
-#define CONFIG_SYS_LOAD_ADDR	0x00800000	/* default load adr- 8M */
-#define CONFIG_SYS_MEMTEST_START 0x00800000	/* 8M */
-#define CONFIG_SYS_MEMTEST_END	0x1fffffff	/*(_512M -1) */
-#define CONFIG_SYS_RESET_ADDRESS 0xffff0000	/* Rst Vector Adr */
-#define CONFIG_SYS_MAXARGS	16	/* max number of command args */
-
-/*
  * Ethernet Driver configuration
  */
 #ifdef CONFIG_CMD_NET
-#define CONFIG_NETCONSOLE	/* include NetConsole support   */
-#define CONFIG_NET_MULTI	/* specify more that one ports available */
-#define CONFIG_MII		/* expose smi ove miiphy interface */
-#define CONFIG_CMD_MII
-#define CONFIG_MVGBE		/* Enable Marvell Gbe Controller Driver */
-#define CONFIG_SYS_FAULT_ECHO_LINK_DOWN	/* detect link using phy */
 #define CONFIG_MVGBE_PORTS	{1, 1}	/* enable both ports */
 #define CONFIG_PHY_BASE_ADR	0
-#define CONFIG_ENV_OVERWRITE	/* ethaddr can be reprogrammed */
-#define CONFIG_RESET_PHY_R	/* use reset_phy() to init mv88e1121 PHY */
 #endif /* CONFIG_CMD_NET */
 
-/*
- * USB/EHCI
- */
-#ifdef CONFIG_CMD_USB
-#define CONFIG_USB_EHCI			/* Enable EHCI USB support */
-#define CONFIG_USB_EHCI_KIRKWOOD	/* on Kirkwood platform	*/
-#define CONFIG_EHCI_IS_TDI
-#define CONFIG_USB_STORAGE
-#define CONFIG_DOS_PARTITION
-#define CONFIG_ISO_PARTITION
-#define CONFIG_SUPPORT_VFAT
-#endif /* CONFIG_CMD_USB */
-
 #define CONFIG_SYS_ALT_MEMTEST
 
 #endif /* _CONFIG_GURUPLUG_H */
include/configs/mv-common.h new file +230 -0

230 lines not on this page · raw message

include/configs/mv88f6281gtw_ge.h +13 -107

155 lines not on this page · raw message

include/configs/openrd_base.h +3 -141

174 lines not on this page · raw message

include/configs/rd6281a.h +3 -95

133 lines not on this page · raw message

include/configs/sheevaplug.h +3 -101

143 lines not on this page · raw message

Signature · 1 line
1.5.3.3
#2 lore raw

PATCH 1/1 kirkwood: added common config file mv-config.h

Quoted 4 lines · Prafulla Wadaskar
include/configs/mv-common.h +1 -0
@@ -0,0 +1,230 @@
+#ifndef _MV_COMMON_H

include/configs/mv-common.h line 11

Quoted 10 lines
include/configs/mv-common.h +10 -0
+#define _MV_COMMON_H
+
+/*
+ * High Level Configuration Options (easy to change)
+ */
+#define CONFIG_MARVELL		1
+#define CONFIG_ARM926EJS	1	/* Basic Architecture */
+
+#if defined(CONFIG_KIRKWOOD)
+#define CONFIG_MD5	/* get_random_hex on krikwood needs MD5 support */

krikwood?

include/configs/mv-common.h line 50

Quoted 8 lines
include/configs/mv-common.h +7 -0
+#define CONFIG_KIRKWOOD_EGIGA_INIT	/* Enable GbePort0/1 for kernel */
+#define CONFIG_KIRKWOOD_RGMII_PAD_1V8	/* Set RGMII Pad voltage to 1.8V */
+#define CONFIG_KIRKWOOD_PCIE_INIT       /* Enable PCIE Port0 for kernel */
+
+#define CONFIG_I2C_MVTWSI_BASE	KW_TWSI_BASE
 
+#define MV_UART0_BASE		KW_UART0_BASE
+#define MV_UART0_BASE		KW_UART0_BASE

dup?

Quoted 3 lines

+/*
+ * IDe Support on SATA port0
+ */

IDe?

Rogan

#3 lore raw

PATCH 1/1 kirkwood: added common config file mv-config.h

Quoted 30 lines

-----Original Message-----
From: Rogan Dawes [mailto:rogan.dawes at gmail.com] On Behalf Of Rogan Dawes
Sent: Thursday, September 30, 2010 7:24 PM
To: Prafulla Wadaskar
Cc: u-boot at lists.denx.de; Ashish Karkare; Prabhanjan Sarnaik
Subject: Re: [U-Boot] [PATCH] kirkwood: added common config file mv-config.h

Review

Quoted 1 line · Prafulla Wadaskar
(quoted diff) +0 -0

b/include/configs/mv-common.h

include/configs/mv-common.h line 11

Quoted 12 lines
include/configs/mv-common.h new file +11 -0
@@ -0,0 +1,230 @@
+#ifndef _MV_COMMON_H
+#define _MV_COMMON_H
+
+/*
+ * High Level Configuration Options (easy to change)
+ */
+#define CONFIG_MARVELL		1
+#define CONFIG_ARM926EJS	1	/* Basic Architecture */
+
+#if defined(CONFIG_KIRKWOOD)
+#define CONFIG_MD5	/* get_random_hex on krikwood needs MD5 

support */

Quoted 1 line

krikwood?

Thanks I will correct this.

Quoted 6 lines

Review line 12

Quoted 2 lines
(quoted diff) +1 -0
+#define CONFIG_KIRKWOOD_EGIGA_INIT	/* Enable GbePort0/1 

for kernel */

Review line 13

Quoted 1 line
(quoted diff) +1 -0
+#define CONFIG_KIRKWOOD_RGMII_PAD_1V8	/* Set RGMII 

Pad voltage to 1.8V */

Review line 14

Quoted 1 line
(quoted diff) +1 -0
+#define CONFIG_KIRKWOOD_PCIE_INIT       /* Enable PCIE 
Quoted 8 lines

Port0 for kernel */

include/configs/mv-common.h line 50

Quoted 5 lines
include/configs/mv-common.h new file +4 -0
+
+#define CONFIG_I2C_MVTWSI_BASE	KW_TWSI_BASE
 
+#define MV_UART0_BASE		KW_UART0_BASE
+#define MV_UART0_BASE		KW_UART0_BASE

dup?

!! I will remove this additional line

Quoted 6 lines
Quoted 4 lines

+/*
+ * IDe Support on SATA port0
+ */

IDe?

I think Ide can be removed, right?

Regards..
Prafulla . .

Quoted 3 lines

Rogan

#4 lore raw

PATCH 1/1 kirkwood: added common config file mv-config.h

Quoted 7 lines · Prafulla Wadaskar
Quoted 5 lines
Quoted 3 lines

+/*
+ * IDe Support on SATA port0
+ */

IDe?

I think Ide can be removed, right?

I was just commenting on the (mis-)capitalisation.

Rogan

#5 lore raw

PATCH 1/1 kirkwood: added common config file mv-config.h

In reply to Prafulla Wadaskar

Le 30/09/2010 16:33, Prafulla Wadaskar a ?crit :

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

+/*
+ * IDe Support on SATA port0
+ */

IDe?

I think Ide can be removed, right?

Do none of the boards have disks? At least openrd-base should have IDE (and openrd-client as well if the patch to introduced it is finally merged).

So IDE should stay IMO, but the IDE stuff should be split into board-specifics (basically the defines for the IDE0 and, if it exists, IDE1 base addresses) and SoC-specifics (basically everything else, i.e. all that is required for cmd_ide.c to compile).

Amicalement,

Signature · 1 line
Albert.
#6 lore raw

PATCH 1/1 kirkwood: added common config file mv-config.h

Quoted 11 lines

-----Original Message-----
From: Albert ARIBAUD [mailto:albert.aribaud at free.fr]
Sent: Thursday, September 30, 2010 9:05 PM
To: Prafulla Wadaskar
Cc: Rogan Dawes; u-boot at lists.denx.de; Ashish Karkare; Prabhanjan Sarnaik
Subject: Re: [U-Boot] [PATCH] kirkwood: added common config file mv-config.h

Quoted 9 lines

Le 30/09/2010 16:33, Prafulla Wadaskar a ?crit :

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

+/*
+ * IDe Support on SATA port0
+ */

IDe?

I think Ide can be removed, right?

I mean here s/Ide//g

Quoted 3 lines

Do none of the boards have disks? At least openrd-base should have IDE

Guruplug, openrd_base and rd6281a have disk support

Quoted 9 lines

(and openrd-client as well if the patch to introduced it is finally merged).

So IDE should stay IMO, but the IDE stuff should be split into board-specifics (basically the defines for the IDE0 and, if it exists,
IDE1 base addresses) and SoC-specifics (basically everything else, i.e.
all that is required for cmd_ide.c to compile).

At this moment I only see the case with edminiv2 board where ATA bus0 is configured for sata port1. To extend this support for this board, we can undef and redef the respective macros.

Whereas on all other boards it is one-to-one mapping.

To me setting default configuration make more sense, that avoids code duplication in several files.

Regards..
Prafulla . .

#7 lore raw

PATCH 1/1 kirkwood: added common config file mv-config.h

Le 01/10/2010 08:10, Prafulla Wadaskar a ?crit :

Quoted 42 lines
Quoted 11 lines

-----Original Message-----
From: Albert ARIBAUD [mailto:albert.aribaud at free.fr]
Sent: Thursday, September 30, 2010 9:05 PM
To: Prafulla Wadaskar
Cc: Rogan Dawes; u-boot at lists.denx.de; Ashish Karkare; Prabhanjan Sarnaik
Subject: Re: [U-Boot] [PATCH] kirkwood: added common config file mv-config.h

Quoted 9 lines

Le 30/09/2010 16:33, Prafulla Wadaskar a ?crit :

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

+/*
+ * IDe Support on SATA port0
+ */

IDe?

I think Ide can be removed, right?

I mean here s/Ide//g

Quoted 3 lines

Do none of the boards have disks? At least openrd-base should have IDE

Guruplug, openrd_base and rd6281a have disk support

Quoted 9 lines

(and openrd-client as well if the patch to introduced it is finally merged).

So IDE should stay IMO, but the IDE stuff should be split into board-specifics (basically the defines for the IDE0 and, if it exists,
IDE1 base addresses) and SoC-specifics (basically everything else, i.e.
all that is required for cmd_ide.c to compile).

At this moment I only see the case with edminiv2 board where ATA bus0 is configured for sata port1. To extend this support for this board, we can undef and redef the respective macros.

Quoted 6 lines

Whereas on all other boards it is one-to-one mapping.

To me setting default configuration make more sense, that avoids code duplication in several files.

Regards..
Prafulla . .

Even if almost all boards have straight rather than cross mappings of IDE0/IDE1 to SATA0/SATA1, not all of them have two busses (guruplug has only one, and likewise another kirkwood based board I'm working on) so half the boards would have to modify the settings anyway.

Besides, having each board explicitely telling what busses is has rather than making it half implicit in the SoC common config file has two advantages:

- someone looking at the board config file will immediately know without if it supports IDE *and* how many busses it actually provides *and* how they are mapped;

- boards will always declare "what is there" rather than declaring either "what is there" or possibly "what isn't there even though the common config said there would be".

After all, this is only one or two lines in the board config, and they are always positively informative.

Amicalement,

Signature · 1 line
Albert.
#8 lore raw

PATCH 1/1 kirkwood: added common config file mv-config.h

Quoted 82 lines

-----Original Message-----
From: Albert ARIBAUD [mailto:albert.aribaud at free.fr]
Sent: Friday, October 01, 2010 12:06 PM
To: Prafulla Wadaskar
Cc: Rogan Dawes; u-boot at lists.denx.de; Ashish Karkare; Prabhanjan Sarnaik
Subject: Re: [U-Boot] [PATCH] kirkwood: added common config file mv-config.h

Le 01/10/2010 08:10, Prafulla Wadaskar a ?crit :

Quoted 32 lines
Quoted 11 lines

-----Original Message-----
From: Albert ARIBAUD [mailto:albert.aribaud at free.fr]
Sent: Thursday, September 30, 2010 9:05 PM
To: Prafulla Wadaskar
Cc: Rogan Dawes; u-boot at lists.denx.de; Ashish Karkare; Prabhanjan Sarnaik
Subject: Re: [U-Boot] [PATCH] kirkwood: added common config file mv-config.h

Quoted 9 lines

Le 30/09/2010 16:33, Prafulla Wadaskar a ?crit :

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

+/*
+ * IDe Support on SATA port0
+ */

IDe?

I think Ide can be removed, right?

I mean here s/Ide//g

Quoted 3 lines

Do none of the boards have disks? At least openrd-base should have IDE

Guruplug, openrd_base and rd6281a have disk support

Quoted 3 lines

(and openrd-client as well if the patch to introduced it is finally merged).

Quoted 8 lines
Quoted 6 lines

So IDE should stay IMO, but the IDE stuff should be split into board-specifics (basically the defines for the IDE0 and, if it exists,
IDE1 base addresses) and SoC-specifics (basically everything else, i.e.
all that is required for cmd_ide.c to compile).

At this moment I only see the case with edminiv2 board

where ATA bus0 is configured for sata port1.

Quoted 1 line

To extend this support for this board, we can undef and

redef the respective macros.

Quoted 4 lines

Whereas on all other boards it is one-to-one mapping.

To me setting default configuration make more sense, that

avoids code duplication in several files.

Quoted 3 lines

Regards..
Prafulla . .

Even if almost all boards have straight rather than cross mappings of IDE0/IDE1 to SATA0/SATA1, not all of them have two busses (guruplug has
only one, and likewise another kirkwood based board I'm working on) so
half the boards would have to modify the settings anyway.

Besides, having each board explicitely telling what busses is has rather
than making it half implicit in the SoC common config file has two advantages:

- someone looking at the board config file will immediately know without
if it supports IDE *and* how many busses it actually provides *and* how
they are mapped;

Quoted 6 lines

- boards will always declare "what is there" rather than declaring either "what is there" or possibly "what isn't there even though the common config said there would be".

After all, this is only one or two lines in the board config, and they

Well one can always undef if using only one sataport, as we undef commands configured in config_cmd_default.h On the other hand one can say I will define the needed config for used sata port. This makes more sense

I do agree, it is positively informative,
I will keep sata port config out of the common definition.

Regards..
Prafulla . .

#9 lore raw

PATCH 1/1 Kirkwood: Changes specific to ARM relocation support

In reply to Prafulla Wadaskar

All Kirkwood based boards are supported for this new implementation
ref: dovs/README.arm-relocation

---
 include/configs/mv-common.h |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
include/configs/mv-common.h +6 -0
index ca9f33b..b80ad00 100644
@@ -56,6 +56,12 @@
 #error "Unsupported SoC"
 #endif
 
+/* additions for new ARM relocation support */
+#undef CONFIG_RELOC_FIXUP_WORKS
+#define CONFIG_SYS_SDRAM_BASE		0x00000000
+#define CONFIG_SYS_INIT_SP_ADDR		(0x00000000 + 0x1000 - \
+					CONFIG_SYS_GBL_DATA_SIZE)
+
 /*
  * CLKs configurations
  */
Signature · 1 line
1.5.3.3
#10 lore raw

PATCH 1/1 Kirkwood: Changes specific to ARM relocation support

Hello Prafulla,

Quoted 2 lines · Prafulla Wadaskar

All Kirkwood based boards are supported for this new implementation
ref: dovs/README.arm-relocation

should be docs/README.arm-relocation

Quoted 10 lines
---
 include/configs/mv-common.h |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
include/configs/mv-common.h +0 -0
index ca9f33b..b80ad00 100644

include/configs/mv-common.h line 60

Quoted 5 lines
include/configs/mv-common.h +2 -0
@@ -56,6 +56,12 @@
 #error "Unsupported SoC"
 #endif
 
+/* additions for new ARM relocation support */
+#undef CONFIG_RELOC_FIXUP_WORKS

Should not be necessary.

include/configs/mv-common.h line 63

Quoted 3 lines
include/configs/mv-common.h +3 -0
+#define CONFIG_SYS_SDRAM_BASE		0x00000000
+#define CONFIG_SYS_INIT_SP_ADDR		(0x00000000 + 0x1000 - \
+					CONFIG_SYS_GBL_DATA_SIZE)

I setup the initial stack in the SDRAM, because I didn;t know, if there is on this cpu family a better place for the initial stack. (Some cpu internal ram?)

Do you know, if we have something like this on this cpu family?

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#11 lore raw

PATCH 1/1 Kirkwood: Changes specific to ARM relocation support

Le 30/09/2010 17:40, Heiko Schocher a ?crit :

Quoted 34 lines

Hello Prafulla,

Quoted 2 lines · Prafulla Wadaskar

All Kirkwood based boards are supported for this new implementation
ref: dovs/README.arm-relocation

should be docs/README.arm-relocation

Quoted 10 lines
---
  include/configs/mv-common.h |    6 ++++++
  1 files changed, 6 insertions(+), 0 deletions(-)
include/configs/mv-common.h +0 -0
index ca9f33b..b80ad00 100644

include/configs/mv-common.h line 60

Quoted 5 lines
include/configs/mv-common.h +2 -0
@@ -56,6 +56,12 @@
  #error "Unsupported SoC"
  #endif
 
+/* additions for new ARM relocation support */
+#undef CONFIG_RELOC_FIXUP_WORKS

Should not be necessary.

include/configs/mv-common.h line 63

Quoted 3 lines
include/configs/mv-common.h +3 -0
+#define CONFIG_SYS_SDRAM_BASE		0x00000000
+#define CONFIG_SYS_INIT_SP_ADDR		(0x00000000 + 0x1000 - \
+					CONFIG_SYS_GBL_DATA_SIZE)

I setup the initial stack in the SDRAM, because I didn;t know, if there is on this cpu family a better place for the initial stack. (Some cpu internal ram?)

Quoted 4 lines

Do you know, if we have something like this on this cpu family?

bye,
Heiko

Kirkwood has no internal RAM.

Amicalement,

Signature · 1 line
Albert.
#12 lore raw

PATCH 1/1 Kirkwood: Changes specific to ARM relocation support

Dear Albert ARIBAUD,

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

Kirkwood has no internal RAM.

But Data Cache, which is nothing else but fast RAM :-)

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
e-credibility: the non-guaranteeable likelihood that  the  electronic
data you're seeing is genuine rather than somebody's made-up crap.
- Karl Lehenbauer
#13 lore raw

PATCH 1/1 Kirkwood: Changes specific to ARM relocation support

In reply to Heiko Schocher

Dear Heiko Schocher,

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

I setup the initial stack in the SDRAM, because I didn;t know, if there is on this cpu family a better place for the initial stack. (Some cpu internal ram?)

As mentioned before: if ther eios no SRAM or other on-chip memory, we can lock the data cache, or parts of it. This has been done on other boards before.

I think Marek has patches in his queue that implement this for PXA, so maybe these may be interesting for other ARM families as well.

Marek, maybe you can post your stuff, even if preliminary? Thanks.

Best regards,

Wolfgang Denk

Signature · 8 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"The  release  of  emotion  is  what  keeps  us  health.  Emotionally
healthy."
"That may be, Doctor. However, I have noted that the healthy  release
of emotion is frequently unhealthy for those closest to you."
	-- McCoy and Spock, "Plato's Stepchildren", stardate 5784.3
#14 lore raw

PATCH 1/1 Kirkwood: Changes specific to ARM relocation support

Dne ?t 30. z??? 2010 19:49:24 Wolfgang Denk napsal(a):

Quoted 11 lines

Dear Heiko Schocher,

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

I setup the initial stack in the SDRAM, because I didn;t know, if there is on this cpu family a better place for the initial stack. (Some cpu internal ram?)

As mentioned before: if ther eios no SRAM or other on-chip memory, we can lock the data cache, or parts of it. This has been done on other boards before.

Quoted 8 lines

I think Marek has patches in his queue that implement this for PXA, so maybe these may be interesting for other ARM families as well.

Marek, maybe you can post your stuff, even if preliminary? Thanks.

Best regards,

Wolfgang Denk

http://git.denx.de/?p=u-boot/u-boot-
pxa.git;a=commitdiff;h=34a7734a0fafffb888f95134c93a627df159add1

See start.S, look for "enable MMU and Dcache as DRAM" ... it should be very similar on kirkwood. Also, you need temporary TTB, see at the bottom of the same file.

CHeers

#15 lore raw

PATCH 1/1 Kirkwood: Changes specific to ARM relocation support

In reply to Heiko Schocher
Quoted 32 lines

-----Original Message-----
From: Heiko Schocher [mailto:hs at denx.de]
Sent: Thursday, September 30, 2010 9:11 PM
To: Prafulla Wadaskar
Cc: u-boot at lists.denx.de; Ashish Karkare; Prabhanjan Sarnaik
Subject: Re: [U-Boot] [PATCH] Kirkwood: Changes specific to ARM relocation support

Hello Prafulla,

Quoted 2 lines · Prafulla Wadaskar

All Kirkwood based boards are supported for this new implementation
ref: dovs/README.arm-relocation

should be docs/README.arm-relocation

Review

Quoted 6 lines
---
 include/configs/mv-common.h |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
(quoted diff) +0 -0

b/include/configs/mv-common.h

Quoted 7 lines

index ca9f33b..b80ad00 100644

include/configs/mv-common.h +0 -0
@@ -56,6 +56,12 @@
 #error "Unsupported SoC"
 #endif
 
Quoted 4 lines

include/configs/mv-common.h line 60

Quoted 2 lines
include/configs/mv-common.h +2 -0
+/* additions for new ARM relocation support */
+#undef CONFIG_RELOC_FIXUP_WORKS

Should not be necessary.

Will remove it

Quoted 10 lines

include/configs/mv-common.h line 63

Quoted 4 lines
include/configs/mv-common.h +3 -0
+#define CONFIG_SYS_SDRAM_BASE		0x00000000
+#define CONFIG_SYS_INIT_SP_ADDR		(0x00000000 + 0x1000 - \
+					CONFIG_SYS_GBL_DATA_SIZE)

I setup the initial stack in the SDRAM, because I didn;t know, if there is on this cpu family a better place for the initial stack. (Some cpu internal ram?)

Do you know, if we have something like this on this cpu family?

Yes, Kirkwood do have internal SRAM of 2kB size called Security SRAM
I have never used it before, I will give a try to use it. Otherwise using a data cache will be other option

Regards..
Prafulla . .

#16 lore raw

PATCH 1/1 Kirkwood: Changes specific to ARM relocation support

In reply to Prafulla Wadaskar

Dear Prafulla Wadaskar,

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

All Kirkwood based boards are supported for this new implementation
ref: dovs/README.arm-relocation

---
 include/configs/mv-common.h |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
include/configs/mv-common.h +0 -0
index ca9f33b..b80ad00 100644

include/configs/mv-common.h line 60

Quoted 5 lines
include/configs/mv-common.h +2 -0
@@ -56,6 +56,12 @@
 #error "Unsupported SoC"
 #endif
 
+/* additions for new ARM relocation support */
+#undef CONFIG_RELOC_FIXUP_WORKS

Is this really needed? As far as I can see CONFIG_RELOC_FIXUP_WORKS is not defined anywhere in any ARM related fiole, so there shouldbe no need to undef it.

include/configs/mv-common.h line 63

Quoted 3 lines
include/configs/mv-common.h +3 -0
+#define CONFIG_SYS_SDRAM_BASE		0x00000000
+#define CONFIG_SYS_INIT_SP_ADDR		(0x00000000 + 0x1000 - \
+					CONFIG_SYS_GBL_DATA_SIZE)

This is wrong. You must not use RAM for the initial stack, or it cannot be initialized / tested as it should be. If you hav eno static RAM or other on-chip memory that could be used, you might try and lock (some part of) the data cache and use this as storage for the initial global data and stack.

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
He is truly wise who gains wisdom from another's mishap.
#17 lore raw

PATCH 1/1 Kirkwood: dram_init is moved to dram.c

In reply to Prafulla Wadaskar

Hello Prafulla,

Quoted 44 lines · Prafulla Wadaskar

For all Kirkwood boards so far dram_init function is duplicated dram_init function is moved to dram.c and relevant code from all board specific files removed

If any board needs specific dram init handling than standard one, then, a macro CONFIG_SYS_BOARD_DRAM_INIT should be defined in board config header file and the dram_init function can be put in board specific source file
For ex. keymile boards

---
 arch/arm/cpu/arm926ejs/kirkwood/dram.c          |   22 ++++++++++++++++++++++
 board/Marvell/guruplug/guruplug.c               |   11 -----------
 board/Marvell/mv88f6281gtw_ge/mv88f6281gtw_ge.c |   11 -----------
 board/Marvell/openrd_base/openrd_base.c         |   11 -----------
 board/Marvell/rd6281a/rd6281a.c                 |   11 -----------
 board/Marvell/sheevaplug/sheevaplug.c           |   11 -----------
 include/configs/keymile-common.h                |    1 +
 7 files changed, 23 insertions(+), 55 deletions(-)
arch/arm/cpu/arm926ejs/kirkwood/dram.c +6 -0
index 8f2a18a..d929d7a 100644
@@ -23,8 +23,11 @@
  */
 
 #include <config.h>
+#include <common.h>
 #include <asm/arch/kirkwood.h>
 
+DECLARE_GLOBAL_DATA_PTR;
+
 #define KW_REG_CPUCS_WIN_BAR(x)		(KW_REGISTER(0x1500) + (x * 0x08))
 #define KW_REG_CPUCS_WIN_SZ(x)		(KW_REGISTER(0x1504) + (x * 0x08))
 /*
@@ -56,3 +59,22 @@ u32 kw_sdram_bs(enum memory_bank bank)
 	result += 0x01000000;
 	return result;
 }
+
+#ifndef CONFIG_SYS_BOARD_DRAM_INIT
+int dram_init(void)

arch/arm/cpu/arm926ejs/kirkwood/dram.c u32 kw_sdram_bs(enum memory_bank bank) · line 74

Quoted 10 lines
arch/arm/cpu/arm926ejs/kirkwood/dram.c +10 -0
+{
+	int i;
+#if !defined(CONFIG_SYS_ARM_WITHOUT_RELOC)
+	gd->ram_size = 0;
+#endif
+	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
+		gd->bd->bi_dram[i].start = kw_sdram_bar(i);
+		gd->bd->bi_dram[i].size = kw_sdram_bs(i);
+#if !defined(CONFIG_SYS_ARM_WITHOUT_RELOC)
+		gd->ram_size += gd->bd->bi_dram[i].size;

This is only OK, if the memory banks are consecutive without gaps ... is this true for all boards?

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#18 lore raw

PATCH 1/1 Kirkwood: dram_init is moved to dram.c

Quoted 65 lines

-----Original Message-----
From: Heiko Schocher [mailto:hs at denx.de]
Sent: Thursday, September 30, 2010 9:10 PM
To: Prafulla Wadaskar
Cc: u-boot at lists.denx.de; Ashish Karkare; Prabhanjan Sarnaik
Subject: Re: [U-Boot] [PATCH] Kirkwood: dram_init is moved to dram.c

Hello Prafulla,

Quoted 10 lines · Prafulla Wadaskar

For all Kirkwood boards so far dram_init function is duplicated dram_init function is moved to dram.c and relevant code from all board specific files removed

If any board needs specific dram init handling than standard one, then, a macro CONFIG_SYS_BOARD_DRAM_INIT should be defined in board config header file and the dram_init function can be put in board specific source file
For ex. keymile boards

Quoted 3 lines
---
 arch/arm/cpu/arm926ejs/kirkwood/dram.c          |   22 

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

Review

Quoted 9 lines
 board/Marvell/guruplug/guruplug.c               |   11 -----------
 board/Marvell/mv88f6281gtw_ge/mv88f6281gtw_ge.c |   11 -----------
 board/Marvell/openrd_base/openrd_base.c         |   11 -----------
 board/Marvell/rd6281a/rd6281a.c                 |   11 -----------
 board/Marvell/sheevaplug/sheevaplug.c           |   11 -----------
 include/configs/keymile-common.h                |    1 +
 7 files changed, 23 insertions(+), 55 deletions(-)
(quoted diff) +0 -0

b/arch/arm/cpu/arm926ejs/kirkwood/dram.c

arch/arm/cpu/arm926ejs/kirkwood/dram.c line 31

Quoted 13 lines

index 8f2a18a..d929d7a 100644

arch/arm/cpu/arm926ejs/kirkwood/dram.c +3 -0
@@ -23,8 +23,11 @@
  */
 
 #include <config.h>
+#include <common.h>
 #include <asm/arch/kirkwood.h>
 
+DECLARE_GLOBAL_DATA_PTR;
+
 #define KW_REG_CPUCS_WIN_BAR(x)		

(KW_REGISTER(0x1500) + (x * 0x08))

arch/arm/cpu/arm926ejs/kirkwood/dram.c line 32

Quoted 1 line
arch/arm/cpu/arm926ejs/kirkwood/dram.c +0 -0
 #define KW_REG_CPUCS_WIN_SZ(x)		

(KW_REGISTER(0x1504) + (x * 0x08))

Quoted 13 lines
arch/arm/cpu/arm926ejs/kirkwood/dram.c +8 -0
 /*
@@ -56,3 +59,22 @@ u32 kw_sdram_bs(enum memory_bank bank)
 	result += 0x01000000;
 	return result;
 }
+
+#ifndef CONFIG_SYS_BOARD_DRAM_INIT
+int dram_init(void)
+{
+	int i;
+#if !defined(CONFIG_SYS_ARM_WITHOUT_RELOC)
+	gd->ram_size = 0;
+#endif
Quoted 8 lines

arch/arm/cpu/arm926ejs/kirkwood/dram.c u32 kw_sdram_bs(enum memory_bank bank) · line 74

Quoted 5 lines
arch/arm/cpu/arm926ejs/kirkwood/dram.c +5 -0
+	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
+		gd->bd->bi_dram[i].start = kw_sdram_bar(i);
+		gd->bd->bi_dram[i].size = kw_sdram_bs(i);
+#if !defined(CONFIG_SYS_ARM_WITHOUT_RELOC)
+		gd->ram_size += gd->bd->bi_dram[i].size;

This is only OK, if the memory banks are consecutive without gaps ... is this true for all boards?

Yes, those are consecutive without gaps on all boards so far.
But one can configure with gaps too, for ex. If any new board uses two chips with smaller size then it is possibility of gap insertion.

In that case how it should be?

Regards..
Prafulla . .

#19 lore raw

PATCH 1/1 Kirkwood: dram_init is moved to dram.c

Hello Prafulla,

Quoted 73 lines · Prafulla Wadaskar
Quoted 64 lines

-----Original Message-----
From: Heiko Schocher [mailto:hs at denx.de]
Sent: Thursday, September 30, 2010 9:10 PM
To: Prafulla Wadaskar
Cc: u-boot at lists.denx.de; Ashish Karkare; Prabhanjan Sarnaik
Subject: Re: [U-Boot] [PATCH] Kirkwood: dram_init is moved to dram.c

Hello Prafulla,

Quoted 10 lines · Prafulla Wadaskar

For all Kirkwood boards so far dram_init function is duplicated dram_init function is moved to dram.c and relevant code from all board specific files removed

If any board needs specific dram init handling than standard one, then, a macro CONFIG_SYS_BOARD_DRAM_INIT should be defined in board config header file and the dram_init function can be put in board specific source file
For ex. keymile boards

Quoted 3 lines
---
 arch/arm/cpu/arm926ejs/kirkwood/dram.c          |   22 

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

Review

Quoted 9 lines
 board/Marvell/guruplug/guruplug.c               |   11 -----------
 board/Marvell/mv88f6281gtw_ge/mv88f6281gtw_ge.c |   11 -----------
 board/Marvell/openrd_base/openrd_base.c         |   11 -----------
 board/Marvell/rd6281a/rd6281a.c                 |   11 -----------
 board/Marvell/sheevaplug/sheevaplug.c           |   11 -----------
 include/configs/keymile-common.h                |    1 +
 7 files changed, 23 insertions(+), 55 deletions(-)
(quoted diff) +0 -0

b/arch/arm/cpu/arm926ejs/kirkwood/dram.c

arch/arm/cpu/arm926ejs/kirkwood/dram.c line 31

Quoted 13 lines

index 8f2a18a..d929d7a 100644

arch/arm/cpu/arm926ejs/kirkwood/dram.c +3 -0
@@ -23,8 +23,11 @@
  */
 
 #include <config.h>
+#include <common.h>
 #include <asm/arch/kirkwood.h>
 
+DECLARE_GLOBAL_DATA_PTR;
+
 #define KW_REG_CPUCS_WIN_BAR(x)		

(KW_REGISTER(0x1500) + (x * 0x08))

arch/arm/cpu/arm926ejs/kirkwood/dram.c line 32

Quoted 1 line
arch/arm/cpu/arm926ejs/kirkwood/dram.c +0 -0
 #define KW_REG_CPUCS_WIN_SZ(x)		

(KW_REGISTER(0x1504) + (x * 0x08))

Quoted 12 lines
arch/arm/cpu/arm926ejs/kirkwood/dram.c +7 -0
 /*
@@ -56,3 +59,22 @@ u32 kw_sdram_bs(enum memory_bank bank)
 	result += 0x01000000;
 	return result;
 }
+
+#ifndef CONFIG_SYS_BOARD_DRAM_INIT
+int dram_init(void)
+{
+	int i;
+#if !defined(CONFIG_SYS_ARM_WITHOUT_RELOC)
+	gd->ram_size = 0;
Quoted 8 lines

arch/arm/cpu/arm926ejs/kirkwood/dram.c u32 kw_sdram_bs(enum memory_bank bank) · line 74

Quoted 6 lines
arch/arm/cpu/arm926ejs/kirkwood/dram.c +6 -0
+#endif
+	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
+		gd->bd->bi_dram[i].start = kw_sdram_bar(i);
+		gd->bd->bi_dram[i].size = kw_sdram_bs(i);
+#if !defined(CONFIG_SYS_ARM_WITHOUT_RELOC)
+		gd->ram_size += gd->bd->bi_dram[i].size;

This is only OK, if the memory banks are consecutive without gaps ... is this true for all boards?

Quoted 4 lines

Yes, those are consecutive without gaps on all boards so far.
But one can configure with gaps too, for ex. If any new board uses two chips with smaller size then it is possibility of gap insertion.

In that case how it should be?

Good question ... for this case we must adapt in arch/arm/lib/board.c

addr = CONFIG_SYS_SDRAM_BASE + gd->ram_size;

But no idea, where to put u-boot ... at the end of the first bank? at the end of the last bank?

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#20 lore raw

PATCH 1/1 Kirkwood: dram_init is moved to dram.c

Dear Heiko Schocher,

[There is no need to always keep the full quote. Please delete parts that are not interesting for the current diuscussion.]

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

But one can configure with gaps too, for ex. If any new board uses two chips with smaller size then it is possibility of gap insertion.

In that case how it should be?

Good question ... for this case we must adapt in arch/arm/lib/board.c

addr = CONFIG_SYS_SDRAM_BASE + gd->ram_size;

But no idea, where to put u-boot ... at the end of the first bank? at the end of the last bank?

It seems logical to me to put U-Boot to the end of the bank with the highest address.

But as mentioned before, this may be not a nice system to use. So far we kind of assume to have a contiguous area of RAM usable.

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
If it went on at this rate, in several billion  years  he'd  be  rich
beyond his wildest dreams!            - Terry Pratchett, _Soul Music_
#21 lore raw

PATCH 1/1 Kirkwood: dram_init is moved to dram.c

In reply to Prafulla Wadaskar

Le 01/10/2010 07:59, Prafulla Wadaskar a ?crit :

Quoted 74 lines
Quoted 65 lines

-----Original Message-----
From: Heiko Schocher [mailto:hs at denx.de]
Sent: Thursday, September 30, 2010 9:10 PM
To: Prafulla Wadaskar
Cc: u-boot at lists.denx.de; Ashish Karkare; Prabhanjan Sarnaik
Subject: Re: [U-Boot] [PATCH] Kirkwood: dram_init is moved to dram.c

Hello Prafulla,

Quoted 10 lines · Prafulla Wadaskar

For all Kirkwood boards so far dram_init function is duplicated dram_init function is moved to dram.c and relevant code from all board specific files removed

If any board needs specific dram init handling than standard one, then, a macro CONFIG_SYS_BOARD_DRAM_INIT should be defined in board config header file and the dram_init function can be put in board specific source file
For ex. keymile boards

Quoted 3 lines
---
  arch/arm/cpu/arm926ejs/kirkwood/dram.c          |   22

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

Review

Quoted 9 lines
  board/Marvell/guruplug/guruplug.c               |   11 -----------
  board/Marvell/mv88f6281gtw_ge/mv88f6281gtw_ge.c |   11 -----------
  board/Marvell/openrd_base/openrd_base.c         |   11 -----------
  board/Marvell/rd6281a/rd6281a.c                 |   11 -----------
  board/Marvell/sheevaplug/sheevaplug.c           |   11 -----------
  include/configs/keymile-common.h                |    1 +
  7 files changed, 23 insertions(+), 55 deletions(-)
(quoted diff) +0 -0

b/arch/arm/cpu/arm926ejs/kirkwood/dram.c

arch/arm/cpu/arm926ejs/kirkwood/dram.c line 31

Quoted 13 lines

index 8f2a18a..d929d7a 100644

arch/arm/cpu/arm926ejs/kirkwood/dram.c +3 -0
@@ -23,8 +23,11 @@
   */
 
  #include<config.h>
+#include<common.h>
  #include<asm/arch/kirkwood.h>
 
+DECLARE_GLOBAL_DATA_PTR;
+
  #define KW_REG_CPUCS_WIN_BAR(x)		

(KW_REGISTER(0x1500) + (x * 0x08))

arch/arm/cpu/arm926ejs/kirkwood/dram.c line 32

Quoted 1 line
arch/arm/cpu/arm926ejs/kirkwood/dram.c +0 -0
  #define KW_REG_CPUCS_WIN_SZ(x)		

(KW_REGISTER(0x1504) + (x * 0x08))

Quoted 13 lines
arch/arm/cpu/arm926ejs/kirkwood/dram.c +8 -0
  /*
@@ -56,3 +59,22 @@ u32 kw_sdram_bs(enum memory_bank bank)
  	result += 0x01000000;
  	return result;
  }
+
+#ifndef CONFIG_SYS_BOARD_DRAM_INIT
+int dram_init(void)
+{
+	int i;
+#if !defined(CONFIG_SYS_ARM_WITHOUT_RELOC)
+	gd->ram_size = 0;
+#endif
Quoted 8 lines

arch/arm/cpu/arm926ejs/kirkwood/dram.c u32 kw_sdram_bs(enum memory_bank bank) · line 74

Quoted 5 lines
arch/arm/cpu/arm926ejs/kirkwood/dram.c +5 -0
+	for (i = 0; i<  CONFIG_NR_DRAM_BANKS; i++) {
+		gd->bd->bi_dram[i].start = kw_sdram_bar(i);
+		gd->bd->bi_dram[i].size = kw_sdram_bs(i);
+#if !defined(CONFIG_SYS_ARM_WITHOUT_RELOC)
+		gd->ram_size += gd->bd->bi_dram[i].size;

This is only OK, if the memory banks are consecutive without gaps ... is this true for all boards?

Quoted 7 lines

Yes, those are consecutive without gaps on all boards so far.
But one can configure with gaps too, for ex. If any new board uses two chips with smaller size then it is possibility of gap insertion.

In that case how it should be?

Regards..
Prafulla . .

I guess the most correct approach would be to "lump" together all banks until one is found not to be contiguous. The "lump" would be "the RAM". Technically, if the banks are not in ascending base address order then you'd have to sort them out, so the best is to make it a requirement that they are in ascending base address order.

Amicalement,

Signature · 1 line
Albert.
#22 lore raw

PATCH 1/1 Kirkwood: dram_init is moved to dram.c

Quoted 100 lines

-----Original Message-----
From: u-boot-bounces at lists.denx.de [mailto:u-boot-bounces at lists.denx.de] On Behalf Of Albert ARIBAUD
Sent: Friday, October 01, 2010 11:51 AM
To: u-boot at lists.denx.de
Subject: Re: [U-Boot] [PATCH] Kirkwood: dram_init is moved to dram.c

Le 01/10/2010 07:59, Prafulla Wadaskar a ?crit :

Quoted 8 lines
Quoted 8 lines

-----Original Message-----
From: Heiko Schocher [mailto:hs at denx.de]
Sent: Thursday, September 30, 2010 9:10 PM
To: Prafulla Wadaskar
Cc: u-boot at lists.denx.de; Ashish Karkare; Prabhanjan Sarnaik
Subject: Re: [U-Boot] [PATCH] Kirkwood: dram_init is moved

to dram.c

Quoted 14 lines
Quoted 14 lines

Hello Prafulla,

Quoted 10 lines · Prafulla Wadaskar

For all Kirkwood boards so far dram_init function is duplicated dram_init function is moved to dram.c and relevant code from all board specific files removed

If any board needs specific dram init handling than standard one, then, a macro CONFIG_SYS_BOARD_DRAM_INIT should be defined in board config header file and the dram_init function can be put in board specific source file
For ex. keymile boards

Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
---
  arch/arm/cpu/arm926ejs/kirkwood/dram.c          |   22

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

Quoted 1 line
  board/Marvell/guruplug/guruplug.c               |   11 

-----------

Quoted 1 line
Quoted 1 line
Quoted 1 line
  board/Marvell/mv88f6281gtw_ge/mv88f6281gtw_ge.c |   11 

-----------

Quoted 1 line
Quoted 1 line
Quoted 1 line
  board/Marvell/openrd_base/openrd_base.c         |   11 

-----------

Quoted 1 line
Quoted 1 line
Quoted 1 line
  board/Marvell/rd6281a/rd6281a.c                 |   11 

-----------

Quoted 1 line
Quoted 1 line
Quoted 1 line
  board/Marvell/sheevaplug/sheevaplug.c           |   11 

-----------

Quoted 43 lines
Quoted 34 lines

Review

Quoted 4 lines
  include/configs/keymile-common.h                |    1 +
  7 files changed, 23 insertions(+), 55 deletions(-)
(quoted diff) +0 -0

b/arch/arm/cpu/arm926ejs/kirkwood/dram.c

arch/arm/cpu/arm926ejs/kirkwood/dram.c line 31

Quoted 13 lines

index 8f2a18a..d929d7a 100644

arch/arm/cpu/arm926ejs/kirkwood/dram.c +3 -0
@@ -23,8 +23,11 @@
   */
 
  #include<config.h>
+#include<common.h>
  #include<asm/arch/kirkwood.h>
 
+DECLARE_GLOBAL_DATA_PTR;
+
  #define KW_REG_CPUCS_WIN_BAR(x)		

(KW_REGISTER(0x1500) + (x * 0x08))

arch/arm/cpu/arm926ejs/kirkwood/dram.c line 32

Quoted 1 line
arch/arm/cpu/arm926ejs/kirkwood/dram.c +0 -0
  #define KW_REG_CPUCS_WIN_SZ(x)		

(KW_REGISTER(0x1504) + (x * 0x08))

Quoted 13 lines
arch/arm/cpu/arm926ejs/kirkwood/dram.c +8 -0
  /*
@@ -56,3 +59,22 @@ u32 kw_sdram_bs(enum memory_bank bank)
  	result += 0x01000000;
  	return result;
  }
+
+#ifndef CONFIG_SYS_BOARD_DRAM_INIT
+int dram_init(void)
+{
+	int i;
+#if !defined(CONFIG_SYS_ARM_WITHOUT_RELOC)
+	gd->ram_size = 0;
+#endif
Quoted 8 lines

arch/arm/cpu/arm926ejs/kirkwood/dram.c u32 kw_sdram_bs(enum memory_bank bank) · line 74

Quoted 5 lines
arch/arm/cpu/arm926ejs/kirkwood/dram.c +5 -0
+	for (i = 0; i<  CONFIG_NR_DRAM_BANKS; i++) {
+		gd->bd->bi_dram[i].start = kw_sdram_bar(i);
+		gd->bd->bi_dram[i].size = kw_sdram_bs(i);
+#if !defined(CONFIG_SYS_ARM_WITHOUT_RELOC)
+		gd->ram_size += gd->bd->bi_dram[i].size;

This is only OK, if the memory banks are consecutive without gaps ... is this true for all boards?

Quoted 2 lines

Yes, those are consecutive without gaps on all boards so far. But one can configure with gaps too, for ex. If any new

board uses two chips with smaller size then it is possibility of gap insertion.

Quoted 5 lines

In that case how it should be?

Regards..
Prafulla . .

Quoted 8 lines

I guess the most correct approach would be to "lump" together all banks
until one is found not to be contiguous. The "lump" would be "the RAM".
Technically, if the banks are not in ascending base address order then
you'd have to sort them out, so the best is to make it a requirement that they are in ascending base address order.

Okay, At this moment I will keep as it is since we do not have any such use case.

Regards..
Prafulla . .

#23 lore raw

PATCH 1/1 Kirkwood: dram_init is moved to dram.c

In reply to Prafulla Wadaskar

Dear Prafulla Wadaskar,

Quoted 8 lines · In message <[email protected]>…
Quoted 3 lines

This is only OK, if the memory banks are consecutive without gaps ... is this true for all boards?

Yes, those are consecutive without gaps on all boards so far.
But one can configure with gaps too, for ex. If any new board uses two chips with smaller size then it is possibility of gap insertion.

In that case how it should be?

If possible, the memory controller should be configured such that the banks are mapped at different addresses then, so that they again form a contiguous RAM area.

If this is not possible (because the bank base addresses cannot be adjusted), then we have a problem.

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
Pig: An animal (Porcus omnivorous) closely allied to the  human  race
by  the splendor and vivacity of its appetite, which, however, is in-
ferior in scope, for it balks at pig.                - Ambrose Bierce
#24 lore raw

PATCH 1/1 Kirkwood: dram_init is moved to dram.c

In reply to Prafulla Wadaskar

Dear Prafulla Wadaskar,

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

For all Kirkwood boards so far dram_init function is duplicated dram_init function is moved to dram.c and relevant code from all board specific files removed

If any board needs specific dram init handling than standard one, then, a macro CONFIG_SYS_BOARD_DRAM_INIT should be defined in board config header file and the dram_init function can be put in board specific source file
For ex. keymile boards

Thanks, I really appreciate this patch, but I have a minor request for change:

arch/arm/cpu/arm926ejs/kirkwood/dram.c u32 kw_sdram_bs(enum memory_bank bank) · line 75

Quoted 9 lines
arch/arm/cpu/arm926ejs/kirkwood/dram.c +9 -0
+#if !defined(CONFIG_SYS_ARM_WITHOUT_RELOC)
+	gd->ram_size = 0;
+#endif
+	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
+		gd->bd->bi_dram[i].start = kw_sdram_bar(i);
+		gd->bd->bi_dram[i].size = kw_sdram_bs(i);
+#if !defined(CONFIG_SYS_ARM_WITHOUT_RELOC)
+		gd->ram_size += gd->bd->bi_dram[i].size;
+#endif

When you touch this board now and make it work with CONFIG_SYS_ARM_WITHOUT_RELOC not defined, we should also drop all references to CONFIG_SYS_ARM_WITHOUT_RELOC from the code to make it obvious that this board has been adapted.

Thanks.

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
Anyone who doesn't believe in miracles is not a realist.
                                                   - David Ben Gurion
#25 lore raw

PATCH 1/1 Kirkwood: dram_init is moved to dram.c

Quoted 26 lines

-----Original Message-----
From: Wolfgang Denk [mailto:wd at denx.de]
Sent: Thursday, September 30, 2010 11:00 PM
To: Prafulla Wadaskar
Cc: u-boot at lists.denx.de; Ashish Karkare; Prabhanjan Sarnaik
Subject: Re: [U-Boot] [PATCH] Kirkwood: dram_init is moved to dram.c

Dear Prafulla Wadaskar,

In message

Quoted 9 lines · <[email protected]> you wrote:

For all Kirkwood boards so far dram_init function is duplicated dram_init function is moved to dram.c and relevant code from all board specific files removed

If any board needs specific dram init handling than standard one, then, a macro CONFIG_SYS_BOARD_DRAM_INIT should be defined in board config header file and the dram_init function can be put in board specific source file
For ex. keymile boards

Thanks, I really appreciate this patch, but I have a minor request for change:

Quoted 14 lines

arch/arm/cpu/arm926ejs/kirkwood/dram.c u32 kw_sdram_bs(enum memory_bank bank) · line 75

Quoted 9 lines
arch/arm/cpu/arm926ejs/kirkwood/dram.c +9 -0
+#if !defined(CONFIG_SYS_ARM_WITHOUT_RELOC)
+	gd->ram_size = 0;
+#endif
+	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
+		gd->bd->bi_dram[i].start = kw_sdram_bar(i);
+		gd->bd->bi_dram[i].size = kw_sdram_bs(i);
+#if !defined(CONFIG_SYS_ARM_WITHOUT_RELOC)
+		gd->ram_size += gd->bd->bi_dram[i].size;
+#endif

When you touch this board now and make it work with CONFIG_SYS_ARM_WITHOUT_RELOC not defined, we should also drop all references to CONFIG_SYS_ARM_WITHOUT_RELOC from the code to make it obvious that this board has been adapted.

I will remove this dependency
Thanks and regards..
Prafulla . .