[U-Boot] [PATCH v2 00/15] km/powerpc: various bugfixes and support for 3 new boards

A few bugfixes have been done for the km_kirkwood bards in the last months and this series collects them all to be sumbitted to mainline. Furthermore, support for 2 new Keymile ppc boards are added: - kmtepr2: based on a 8321, this is another variation of tuxx1 - kmtegr1: based on 8309, similarly to kmvect1 but with a lot of different peripherals
Changes in v2: - Removed merge conflict files in commit message - Squashed commit 9/17 and 10/17 together into a single commit - Rewritten commit message to get rid of internal git commit reference - Removed support for kmvect1_p1a: not relevant anymore
Bagavathiannan Palanisamy (1): board/keymile/km82xx: setting dip_switch 3 and 4 will run bootloader
Christoph Dietrich (1): powerpc/83xx: add support for kmtepr2 board
Holger Brunck (6): powerpc/82xx: make set/get_pin for km82xx more flexible powerpc/82xx/km: add testpin detection for mgcoge3ne km/powerpc: increase space for kernel imange and FDT blob km/powerpc: move open firmware defines to km-powerpc.h km/powerpc: remove unneeded defines km/powerpc82xx: remove unused function
Valentin Longchamp (7): powerpc/km8321: define CONFIG_SYS_DDRCDR powerpc/km8309: define CONFIG_SYS_DDRCDR powerpc/km8360: fix the ODT parameters for CS0 km83xx: use CONFIG_ENV_ADDR for the newenv env command km8309: change the default QE_FW address powerpc/83xx: add support for kmtegr1 board km/powerpc: fix ft_board_setup prototype for km82xx & km83xx
board/keymile/common/common.c | 5 ++- board/keymile/common/common.h | 2 ++ board/keymile/km82xx/km82xx.c | 57 ++++++++++++++------------------- board/keymile/km83xx/MAINTAINERS | 2 ++ board/keymile/km83xx/km83xx.c | 2 -- configs/kmtegr1_defconfig | 4 +++ configs/kmtepr2_defconfig | 4 +++ include/configs/km/km-powerpc.h | 10 ++++-- include/configs/km/km8309-common.h | 12 +++++-- include/configs/km/km8321-common.h | 6 ++++ include/configs/km/km83xx-common.h | 11 ++++--- include/configs/km82xx.h | 3 -- include/configs/km8360.h | 4 +-- include/configs/suvd3.h | 65 +++++++++++++++++++++++++++++++++++--- include/configs/tuxx1.h | 43 +++++++++++++++++++++---- 15 files changed, 167 insertions(+), 63 deletions(-) create mode 100644 configs/kmtegr1_defconfig create mode 100644 configs/kmtepr2_defconfig

From: Christoph Dietrich christoph.dietrich@keymile.com
This board is similar to TUXX1, but it has differend FPGAs.
Signed-off-by: Christoph Dietrich christoph.dietrich@keymile.com Signed-off-by: Andreas Huber andreas.huber@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com ---
Changes in v2: None
board/keymile/km83xx/MAINTAINERS | 1 + configs/kmtepr2_defconfig | 4 ++++ include/configs/tuxx1.h | 43 +++++++++++++++++++++++++++++++++------- 3 files changed, 41 insertions(+), 7 deletions(-) create mode 100644 configs/kmtepr2_defconfig
diff --git a/board/keymile/km83xx/MAINTAINERS b/board/keymile/km83xx/MAINTAINERS index cee7e08..c4c3183 100644 --- a/board/keymile/km83xx/MAINTAINERS +++ b/board/keymile/km83xx/MAINTAINERS @@ -7,6 +7,7 @@ F: configs/kmcoge5ne_defconfig F: configs/kmeter1_defconfig F: include/configs/tuxx1.h F: configs/kmopti2_defconfig +F: configs/kmtepr2_defconfig F: include/configs/suvd3.h F: configs/kmvect1_defconfig F: configs/suvd3_defconfig diff --git a/configs/kmtepr2_defconfig b/configs/kmtepr2_defconfig new file mode 100644 index 0000000..5cffd53 --- /dev/null +++ b/configs/kmtepr2_defconfig @@ -0,0 +1,4 @@ +CONFIG_SYS_EXTRA_OPTIONS="KMTEPR2" +CONFIG_PPC=y +CONFIG_MPC83xx=y +CONFIG_TARGET_TUXX1=y diff --git a/include/configs/tuxx1.h b/include/configs/tuxx1.h index 08ead7f..e2ca9e3 100644 --- a/include/configs/tuxx1.h +++ b/include/configs/tuxx1.h @@ -36,6 +36,9 @@ #elif defined(CONFIG_KMOPTI2) #define CONFIG_KM_BOARD_NAME "kmopti2" #define CONFIG_HOSTNAME kmopti2 +#elif defined(CONFIG_KMTEPR2) +#define CONFIG_KM_BOARD_NAME "kmtepr2" +#define CONFIG_HOSTNAME kmtepr2 #else #error ("Board not supported") #endif @@ -47,21 +50,45 @@
#define CONFIG_SYS_APP1_BASE 0xA0000000 /* PAXG */ #define CONFIG_SYS_APP1_SIZE 256 /* Megabytes */ -#if defined(CONFIG_TUXX1) || defined(CONFIG_KMOPTI2) +#if defined(CONFIG_TUXX1) || defined(CONFIG_KMOPTI2) || defined(CONFIG_KMTEPR2) #define CONFIG_SYS_APP2_BASE 0xB0000000 /* PINC3 */ #define CONFIG_SYS_APP2_SIZE 256 /* Megabytes */ #endif
/* * Init Local Bus Memory Controller: - * Device on - * Bank Bus Machine PortSz Size TUDA1 TUXA1 TUGE1 KMSUPX4 KMOPTI2 - * ---- --- ------- ------ ----- --------------------------------------- - * 2 Local GPCM 8 bit 256MB PAXG LPXF PAXI LPXF PAXE - * 3 Local GPCM 8 bit 256MB PINC3 PINC2 unused unused OPI2(16 bit) + * Device on board + * Bank Bus Machine PortSz Size TUDA1 TUXA1 TUGE1 KMSUPX4 KMOPTI2 + * ----------------------------------------------------------------------------- + * 2 Local GPCM 8 bit 256MB PAXG LPXF PAXI LPXF PAXE + * 3 Local GPCM 8 bit 256MB PINC3 PINC2 unused unused OPI2(16 bit) * + * Device on board (continued) + * Bank Bus Machine PortSz Size KMTEPR2 + * ----------------------------------------------------------------------------- + * 2 Local GPCM 8 bit 256MB NVRAM + * 3 Local GPCM 8 bit 256MB TEP2 (16 bit) */
+#if defined(CONFIG_KMTEPRO2) +/* + * Configuration for C2 (NVRAM) on the local bus + */ +#define CONFIG_SYS_LBLAWBAR2_PRELIM CONFIG_SYS_APP1_BASE +#define CONFIG_SYS_LBLAWAR2_PRELIM (LBLAWAR_EN | LBLAWAR_256MB) +#define CONFIG_SYS_BR2_PRELIM (CONFIG_SYS_APP1_BASE | \ + BR_PS_8 | \ + BR_MS_GPCM | \ + BR_V) +#define CONFIG_SYS_OR2_PRELIM (MEG_TO_AM(CONFIG_SYS_APP1_SIZE) | \ + OR_GPCM_CSNT | \ + OR_GPCM_ACS_DIV2 | \ + OR_GPCM_XACS | \ + OR_GPCM_SCY_2 | \ + OR_GPCM_TRLX_SET | \ + OR_GPCM_EHTR_SET | \ + OR_GPCM_EAD) +#else /* * Configuration for C2 on the local bus */ @@ -82,6 +109,8 @@ OR_GPCM_TRLX_SET | \ OR_GPCM_EHTR_CLEAR | \ OR_GPCM_EAD) +#endif + #if defined(CONFIG_TUXX1) /* * Configuration for C3 on the local bus @@ -108,7 +137,7 @@ MxMR_WLFx_2X) #endif
-#if defined(CONFIG_KMOPTI2) +#if defined(CONFIG_KMOPTI2) || defined(CONFIG_KMTEPR2) /* * Configuration for C3 on the local bus */

On Tue, Nov 17, 2015 at 10:53:24AM +0100, Valentin Longchamp wrote:
From: Christoph Dietrich christoph.dietrich@keymile.com
This board is similar to TUXX1, but it has differend FPGAs.
Signed-off-by: Christoph Dietrich christoph.dietrich@keymile.com Signed-off-by: Andreas Huber andreas.huber@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com
Applied to u-boot/master, thanks!

From: Holger Brunck holger.brunck@keymile.com
The get_pin and set_pin funciton was only used for pins on Port D and therefore the value was hard coded in the function. Enhance this with a parameter, that we are able to use this functions for other ports too.
Signed-off-by: Holger Brunck holger.brunck@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com ---
Changes in v2: None
board/keymile/km82xx/km82xx.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/board/keymile/km82xx/km82xx.c b/board/keymile/km82xx/km82xx.c index c599b40..03cd10c 100644 --- a/board/keymile/km82xx/km82xx.c +++ b/board/keymile/km82xx/km82xx.c @@ -343,7 +343,7 @@ int last_stage_init(void) }
#ifdef CONFIG_MGCOGE3NE -static void set_pin(int state, unsigned long mask); +static void set_pin(int state, unsigned long mask, int port);
/* * For mgcoge3ne boards, the mgcoge3un control is controlled from @@ -357,11 +357,11 @@ static void handle_mgcoge3un_reset(void) if (bobcatreset) { if (strcmp(bobcatreset, "true") == 0) { puts("Forcing bobcat reset\n"); - set_pin(0, 0x00000004); /* clear PD29 to reset arm */ + set_pin(0, 0x00000004, 3); /* clear PD29 (reset arm) */ udelay(1000); - set_pin(1, 0x00000004); + set_pin(1, 0x00000004, 3); } else - set_pin(1, 0x00000004); /* set PD29 to not reset arm */ + set_pin(1, 0x00000004, 3); /* don't reset arm */ } } #endif @@ -410,9 +410,9 @@ int hush_init_var(void) #define SDA_MASK 0x00010000 #define SCL_MASK 0x00020000
-static void set_pin(int state, unsigned long mask) +static void set_pin(int state, unsigned long mask, int port) { - ioport_t *iop = ioport_addr((immap_t *)CONFIG_SYS_IMMR, 3); + ioport_t *iop = ioport_addr((immap_t *)CONFIG_SYS_IMMR, port);
if (state) setbits_be32(&iop->pdat, mask); @@ -422,9 +422,9 @@ static void set_pin(int state, unsigned long mask) setbits_be32(&iop->pdir, mask); }
-static int get_pin(unsigned long mask) +static int get_pin(unsigned long mask, int port) { - ioport_t *iop = ioport_addr((immap_t *)CONFIG_SYS_IMMR, 3); + ioport_t *iop = ioport_addr((immap_t *)CONFIG_SYS_IMMR, port);
clrbits_be32(&iop->pdir, mask); return 0 != (in_be32(&iop->pdat) & mask); @@ -432,22 +432,22 @@ static int get_pin(unsigned long mask)
void set_sda(int state) { - set_pin(state, SDA_MASK); + set_pin(state, SDA_MASK, 3); }
void set_scl(int state) { - set_pin(state, SCL_MASK); + set_pin(state, SCL_MASK, 3); }
int get_sda(void) { - return get_pin(SDA_MASK); + return get_pin(SDA_MASK, 3); }
int get_scl(void) { - return get_pin(SCL_MASK); + return get_pin(SCL_MASK, 3); }
#if defined(CONFIG_HARD_I2C)

On Tue, Nov 17, 2015 at 10:53:25AM +0100, Valentin Longchamp wrote:
From: Holger Brunck holger.brunck@keymile.com
The get_pin and set_pin funciton was only used for pins on Port D and therefore the value was hard coded in the function. Enhance this with a parameter, that we are able to use this functions for other ports too.
Signed-off-by: Holger Brunck holger.brunck@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com
Applied to u-boot/master, thanks!

From: Holger Brunck holger.brunck@keymile.com
On mgcoge3ne we also want to start the test application if the testpin is asserted. But we don't have a full POST test support yet. So simply add a function to read the testpin value.
Signed-off-by: Holger Brunck holger.brunck@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com ---
Changes in v2: None
board/keymile/common/common.c | 5 ++++- board/keymile/common/common.h | 2 ++ board/keymile/km82xx/km82xx.c | 9 +++++++++ 3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c index b9aff1a..8de129d 100644 --- a/board/keymile/common/common.c +++ b/board/keymile/common/common.c @@ -354,8 +354,11 @@ static int do_checktestboot(cmd_tbl_t *cmdtp, int flag, int argc,
#if defined(CONFIG_POST) testpin = post_hotkeys_pressed(); - s = getenv("test_bank"); #endif +#if defined(CONFIG_MGCOGE3NE) + testpin = get_testpin(); +#endif + s = getenv("test_bank"); /* when test_bank is not set, act as if testpin is not asserted */ testboot = (testpin != 0) && (s); if (verbose) { diff --git a/board/keymile/common/common.h b/board/keymile/common/common.h index dcfefc4..c74f569 100644 --- a/board/keymile/common/common.h +++ b/board/keymile/common/common.h @@ -134,6 +134,8 @@ int wait_for_fpga_config(void); int fpga_reset(void); int toggle_eeprom_spi_bus(void);
+int get_testpin(void); + int set_km_env(void); int fdt_set_node_and_value(void *blob, char *nodename, diff --git a/board/keymile/km82xx/km82xx.c b/board/keymile/km82xx/km82xx.c index 03cd10c..cc9a7c9 100644 --- a/board/keymile/km82xx/km82xx.c +++ b/board/keymile/km82xx/km82xx.c @@ -473,3 +473,12 @@ int ft_board_setup(void *blob, bd_t *bd) return 0; } #endif /* defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) */ + +#if defined(CONFIG_MGCOGE3NE) +int get_testpin(void) +{ + /* Testpin is Port C pin 29 - enable = low */ + int testpin = !get_pin(0x00000004, 2); + return testpin; +} +#endif

On Tue, Nov 17, 2015 at 10:53:26AM +0100, Valentin Longchamp wrote:
From: Holger Brunck holger.brunck@keymile.com
On mgcoge3ne we also want to start the test application if the testpin is asserted. But we don't have a full POST test support yet. So simply add a function to read the testpin value.
Signed-off-by: Holger Brunck holger.brunck@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com
Applied to u-boot/master, thanks!

From: Holger Brunck holger.brunck@keymile.com
128kByte and 3,986MB may be in the future too little for kernel the fdt blob respectively the kernel image. So increase the reserved areas here, we have the space for this.
Signed-off-by: Holger Brunck holger.brunck@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com ---
Changes in v2: None
include/configs/km/km-powerpc.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/configs/km/km-powerpc.h b/include/configs/km/km-powerpc.h index eb85a74..8121e5c 100644 --- a/include/configs/km/km-powerpc.h +++ b/include/configs/km/km-powerpc.h @@ -63,9 +63,9 @@ * is not valid yet, which is the case for when u-boot copies itself to RAM */ #define CONFIG_PRAM ((CONFIG_KM_PNVRAM + CONFIG_KM_PHRAM)>>10)
-#define CONFIG_KM_CRAMFS_ADDR 0x800000 -#define CONFIG_KM_KERNEL_ADDR 0x400000 /* 3968Kbytes */ -#define CONFIG_KM_FDT_ADDR 0x7E0000 /* 128Kbytes */ +#define CONFIG_KM_CRAMFS_ADDR 0xC00000 +#define CONFIG_KM_KERNEL_ADDR 0x400000 /* 7680Kbytes */ +#define CONFIG_KM_FDT_ADDR 0xB80000 /* 512Kbytes */
/* architecture specific default bootargs */ #define CONFIG_KM_DEF_BOOT_ARGS_CPU ""

On Tue, Nov 17, 2015 at 10:53:27AM +0100, Valentin Longchamp wrote:
From: Holger Brunck holger.brunck@keymile.com
128kByte and 3,986MB may be in the future too little for kernel the fdt blob respectively the kernel image. So increase the reserved areas here, we have the space for this.
Signed-off-by: Holger Brunck holger.brunck@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com
Applied to u-boot/master, thanks!

From: Holger Brunck holger.brunck@keymile.com
We use the same settings for open firmware defines on all our powerpc targets, so move them from the CPU specific headers to the common powerpc header.
Signed-off-by: Holger Brunck holger.brunck@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com ---
Changes in v2: None
include/configs/km/km-powerpc.h | 4 ++++ include/configs/km/km83xx-common.h | 3 --- include/configs/km82xx.h | 3 --- 3 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/include/configs/km/km-powerpc.h b/include/configs/km/km-powerpc.h index 8121e5c..cf4a91c 100644 --- a/include/configs/km/km-powerpc.h +++ b/include/configs/km/km-powerpc.h @@ -17,6 +17,10 @@ #define CONFIG_CMD_DTT #define CONFIG_JFFS2_CMDLINE
+/* Pass open firmware flat tree */ +#define CONFIG_OF_LIBFDT +#define CONFIG_OF_BOARD_SETUP + /* standard km ethernet_present for piggy */ #define CONFIG_KM_COMMON_ETH_INIT
diff --git a/include/configs/km/km83xx-common.h b/include/configs/km/km83xx-common.h index 940000e..2325451 100644 --- a/include/configs/km/km83xx-common.h +++ b/include/configs/km/km83xx-common.h @@ -153,9 +153,6 @@ #define CONFIG_SYS_NS16550_COM1 (CONFIG_SYS_IMMR+0x4500) #define CONFIG_SYS_NS16550_COM2 (CONFIG_SYS_IMMR+0x4600)
-/* Pass open firmware flat tree */ -#define CONFIG_OF_LIBFDT -#define CONFIG_OF_BOARD_SETUP #define CONFIG_OF_STDOUT_VIA_ALIAS
/* diff --git a/include/configs/km82xx.h b/include/configs/km82xx.h index 12f9d42..8c06dc1 100644 --- a/include/configs/km82xx.h +++ b/include/configs/km82xx.h @@ -431,10 +431,7 @@ int get_scl(void);
#define CONFIG_SYS_RESET_ADDRESS 0xFDFFFFFC /* "bad" address */
-/* pass open firmware flat tree */ #define CONFIG_FIT 1 -#define CONFIG_OF_LIBFDT 1 -#define CONFIG_OF_BOARD_SETUP 1
#define OF_TBCLK (bd->bi_busfreq / 4) #define OF_STDOUT_PATH "/soc/cpm/serial@11a90"

On Tue, Nov 17, 2015 at 10:53:28AM +0100, Valentin Longchamp wrote:
From: Holger Brunck holger.brunck@keymile.com
We use the same settings for open firmware defines on all our powerpc targets, so move them from the CPU specific headers to the common powerpc header.
Signed-off-by: Holger Brunck holger.brunck@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com
Applied to u-boot/master, thanks!

From: Holger Brunck holger.brunck@keymile.com
We use CONFIG_OF_LIBFDT and CONFIG_OF_BOARD_SETUP on all our powerpc targets, so there is no need to check these defines within our C code.
Signed-off-by: Holger Brunck holger.brunck@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com
---
Changes in v2: - Removed merge conflict files in commit message
board/keymile/km82xx/km82xx.c | 8 ++------ board/keymile/km83xx/km83xx.c | 4 +--- 2 files changed, 3 insertions(+), 9 deletions(-)
diff --git a/board/keymile/km82xx/km82xx.c b/board/keymile/km82xx/km82xx.c index cc9a7c9..70f816b 100644 --- a/board/keymile/km82xx/km82xx.c +++ b/board/keymile/km82xx/km82xx.c @@ -11,10 +11,7 @@ #include <malloc.h> #include <asm/io.h>
-#if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) #include <libfdt.h> -#endif - #include <i2c.h> #include "../common/common.h"
@@ -465,14 +462,13 @@ static void setports(int gpio) } } #endif -#if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) -int ft_board_setup(void *blob, bd_t *bd) + +void ft_board_setup(void *blob, bd_t *bd) { ft_cpu_setup(blob, bd);
return 0; } -#endif /* defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) */
#if defined(CONFIG_MGCOGE3NE) int get_testpin(void) diff --git a/board/keymile/km83xx/km83xx.c b/board/keymile/km83xx/km83xx.c index 89e9e1e..1164c2e 100644 --- a/board/keymile/km83xx/km83xx.c +++ b/board/keymile/km83xx/km83xx.c @@ -361,14 +361,12 @@ int checkboard(void) return 0; }
-#if defined(CONFIG_OF_BOARD_SETUP) -int ft_board_setup(void *blob, bd_t *bd) +void ft_board_setup(void *blob, bd_t *bd) { ft_cpu_setup(blob, bd);
return 0; } -#endif
#if defined(CONFIG_HUSH_INIT_VAR) int hush_init_var(void)

On Tue, Nov 17, 2015 at 10:53:29AM +0100, Valentin Longchamp wrote:
From: Holger Brunck holger.brunck@keymile.com
We use CONFIG_OF_LIBFDT and CONFIG_OF_BOARD_SETUP on all our powerpc targets, so there is no need to check these defines within our C code.
Signed-off-by: Holger Brunck holger.brunck@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com
Applied to u-boot/master, thanks!

From: Holger Brunck holger.brunck@keymile.com
commit 0a4f88b98 removed the usage of our setports function, but the function itself were not removed. So toss it it's dead code.
Signed-off-by: Holger Brunck holger.brunck@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com ---
Changes in v2: None
board/keymile/km82xx/km82xx.c | 16 ---------------- 1 file changed, 16 deletions(-)
diff --git a/board/keymile/km82xx/km82xx.c b/board/keymile/km82xx/km82xx.c index 70f816b..01a3c20 100644 --- a/board/keymile/km82xx/km82xx.c +++ b/board/keymile/km82xx/km82xx.c @@ -447,22 +447,6 @@ int get_scl(void) return get_pin(SCL_MASK, 3); }
-#if defined(CONFIG_HARD_I2C) -static void setports(int gpio) -{ - ioport_t *iop = ioport_addr((immap_t *)CONFIG_SYS_IMMR, 3); - - if (gpio) { - clrbits_be32(&iop->ppar, (SDA_MASK | SCL_MASK)); - clrbits_be32(&iop->podr, (SDA_MASK | SCL_MASK)); - } else { - setbits_be32(&iop->ppar, (SDA_MASK | SCL_MASK)); - clrbits_be32(&iop->pdir, (SDA_MASK | SCL_MASK)); - setbits_be32(&iop->podr, (SDA_MASK | SCL_MASK)); - } -} -#endif - void ft_board_setup(void *blob, bd_t *bd) { ft_cpu_setup(blob, bd);

On Tue, Nov 17, 2015 at 10:53:30AM +0100, Valentin Longchamp wrote:
From: Holger Brunck holger.brunck@keymile.com
commit 0a4f88b98 removed the usage of our setports function, but the function itself were not removed. So toss it it's dead code.
Signed-off-by: Holger Brunck holger.brunck@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com
Applied to u-boot/master, thanks!

On the km8321 boards is CONFIG_SYS_DDRCDR not defined, which leads to the DDRCDR not being configured at startup and still containing the reset value.
The required settings for our km8321 hardware designs are different than the reset value and must be set with CONFIG_SYS_DDRCDR, that is used by mpc83xx's cpu_init_f function at early CPU initialization.
The important settings are the DDR2 internal voltage level and the half-strength "drivers".
In our case where the DRAM chips are soldered on board and the routing for these signals under control, half-strength is sufficient as a few measurements done in the lasts have shown. Since all the hardware qualification tests have been performed with half strength, the nominal strength settings are removed in favor of the default reset half strength settings.
Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com
---
Changes in v2: - Squashed commit 9/17 and 10/17 together into a single commit
include/configs/km/km8321-common.h | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/include/configs/km/km8321-common.h b/include/configs/km/km8321-common.h index 058b0ab..b2e68e3 100644 --- a/include/configs/km/km8321-common.h +++ b/include/configs/km/km8321-common.h @@ -65,6 +65,12 @@ HRCWH_BIG_ENDIAN | \ HRCWH_LALE_NORMAL)
+#define CONFIG_SYS_DDRCDR (\ + DDRCDR_EN | \ + DDRCDR_PZ_MAXZ | \ + DDRCDR_NZ_MAXZ | \ + DDRCDR_M_ODR) + #define CONFIG_SYS_DDR_CS0_BNDS 0x0000007f #define CONFIG_SYS_DDR_SDRAM_CFG (SDRAM_CFG_SDRAM_TYPE_DDR2 | \ SDRAM_CFG_32_BE | \

On Tue, Nov 17, 2015 at 10:53:31AM +0100, Valentin Longchamp wrote:
On the km8321 boards is CONFIG_SYS_DDRCDR not defined, which leads to the DDRCDR not being configured at startup and still containing the reset value.
The required settings for our km8321 hardware designs are different than the reset value and must be set with CONFIG_SYS_DDRCDR, that is used by mpc83xx's cpu_init_f function at early CPU initialization.
The important settings are the DDR2 internal voltage level and the half-strength "drivers".
In our case where the DRAM chips are soldered on board and the routing for these signals under control, half-strength is sufficient as a few measurements done in the lasts have shown. Since all the hardware qualification tests have been performed with half strength, the nominal strength settings are removed in favor of the default reset half strength settings.
Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com
Applied to u-boot/master, thanks!

For consistency with all the other km83xx plaforms, this should also be defined for km8309. The same settings as for km8321 are taken.
Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com ---
Changes in v2: None
include/configs/km/km8309-common.h | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/include/configs/km/km8309-common.h b/include/configs/km/km8309-common.h index ec133f9..d7f6cb1 100644 --- a/include/configs/km/km8309-common.h +++ b/include/configs/km/km8309-common.h @@ -99,6 +99,12 @@ HRCWH_BIG_ENDIAN | \ HRCWH_LALE_NORMAL)
+#define CONFIG_SYS_DDRCDR (\ + DDRCDR_EN | \ + DDRCDR_PZ_MAXZ | \ + DDRCDR_NZ_MAXZ | \ + DDRCDR_M_ODR) + #define CONFIG_SYS_DDR_CS0_BNDS 0x0000007f #define CONFIG_SYS_DDR_SDRAM_CFG (SDRAM_CFG_SDRAM_TYPE_DDR2 | \ SDRAM_CFG_32_BE | \

On Tue, Nov 17, 2015 at 10:53:32AM +0100, Valentin Longchamp wrote:
For consistency with all the other km83xx plaforms, this should also be defined for km8309. The same settings as for km8321 are taken.
Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com
Applied to u-boot/master, thanks!

The ODT parameters for km8360 set the ODT_WR_ACS bit in u-boot KM-2011.09 that is used in the release bootpackage for kmcoge5ne. During the transition from the kmeter1 to km8360 this was changed to ODT_RD_ONLY_CURRENT, which is uncorrect and causes faulty RAM accesses at low temperatures.
This is now changed to ODT_WR_ONLY_CURRENT which is the equivalent of ODT_WR_ACS.
Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com
---
Changes in v2: - Rewritten commit message to get rid of internal git commit reference
include/configs/km8360.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/configs/km8360.h b/include/configs/km8360.h index 04cde46..5034fda 100644 --- a/include/configs/km8360.h +++ b/include/configs/km8360.h @@ -100,7 +100,7 @@ #define CONFIG_SYS_DDR_CS0_CONFIG (\ CSCONFIG_EN | \ CSCONFIG_AP | \ - CSCONFIG_ODT_RD_ONLY_CURRENT | \ + CSCONFIG_ODT_WR_ONLY_CURRENT | \ CSCONFIG_BANK_BIT_3 | \ CSCONFIG_ROW_BIT_13 | \ CSCONFIG_COL_BIT_10) @@ -108,7 +108,7 @@ #define CONFIG_SYS_DDR_CS0_CONFIG (CSCONFIG_EN | CSCONFIG_AP | \ CSCONFIG_ROW_BIT_13 | \ CSCONFIG_COL_BIT_10 | \ - CSCONFIG_ODT_RD_ONLY_CURRENT) + CSCONFIG_ODT_WR_ONLY_CURRENT) #endif
#define CONFIG_SYS_DDR_CLK_CNTL (\

On Tue, Nov 17, 2015 at 10:53:33AM +0100, Valentin Longchamp wrote:
The ODT parameters for km8360 set the ODT_WR_ACS bit in u-boot KM-2011.09 that is used in the release bootpackage for kmcoge5ne. During the transition from the kmeter1 to km8360 this was changed to ODT_RD_ONLY_CURRENT, which is uncorrect and causes faulty RAM accesses at low temperatures.
This is now changed to ODT_WR_ONLY_CURRENT which is the equivalent of ODT_WR_ACS.
Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com
Applied to u-boot/master, thanks!

From: Bagavathiannan Palanisamy Bagavathiannan.Palanisamy@keymile.com
Setting dip_switch 3 and 4 also will run bootloader in COGE3 and COGE6 It is required remove local mgmt IP address, when DIP Switch PIN3 is enabled. DIP Switch 4 also enabled to avoid u-boot update in future for DIP switch enhancements.
Signed-off-by: Bagavathiannan Palanisamy Bagavathiannan.Palanisamy@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com ---
Changes in v2: None
board/keymile/km82xx/km82xx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/board/keymile/km82xx/km82xx.c b/board/keymile/km82xx/km82xx.c index 01a3c20..9e285ec 100644 --- a/board/keymile/km82xx/km82xx.c +++ b/board/keymile/km82xx/km82xx.c @@ -329,8 +329,8 @@ int last_stage_init(void)
dip_switch = in_8(&base->mswitch); dip_switch &= BFTICU_DIPSWITCH_MASK; - /* dip switch 'full reset' or 'db erase' */ - if (dip_switch & 0x1 || dip_switch & 0x2) { + /* dip switch 'full reset' or 'db erase' or 'Local mgmt IP' or any */ + if (dip_switch != 0) { /* start bootloader */ puts("DIP: Enabled\n"); setenv("actual_bank", "0");

On Tue, Nov 17, 2015 at 10:53:34AM +0100, Valentin Longchamp wrote:
From: Bagavathiannan Palanisamy Bagavathiannan.Palanisamy@keymile.com
Setting dip_switch 3 and 4 also will run bootloader in COGE3 and COGE6 It is required remove local mgmt IP address, when DIP Switch PIN3 is enabled. DIP Switch 4 also enabled to avoid u-boot update in future for DIP switch enhancements.
Signed-off-by: Bagavathiannan Palanisamy Bagavathiannan.Palanisamy@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com
Applied to u-boot/master, thanks!

The hardcoded value are bad, since the address could change between different boards.
Furthermore, the relevant #defines are set only if #undefined here, so that they can be changed by some boards if required.
Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com ---
Changes in v2: None
include/configs/km/km83xx-common.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/include/configs/km/km83xx-common.h b/include/configs/km/km83xx-common.h index 2325451..27b47d7 100644 --- a/include/configs/km/km83xx-common.h +++ b/include/configs/km/km83xx-common.h @@ -182,10 +182,14 @@
#ifndef CONFIG_SYS_RAMBOOT #define CONFIG_ENV_IS_IN_FLASH +#ifndef CONFIG_ENV_ADDR #define CONFIG_ENV_ADDR (CONFIG_SYS_MONITOR_BASE + \ CONFIG_SYS_MONITOR_LEN) +#endif #define CONFIG_ENV_SECT_SIZE 0x20000 /* 128K(one sector) for env */ +#ifndef CONFIG_ENV_OFFSET #define CONFIG_ENV_OFFSET (CONFIG_SYS_MONITOR_LEN) +#endif
/* Address and size of Redundant Environment Sector */ #define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + \ @@ -320,8 +324,8 @@ CONFIG_KM_DEF_ENV \ CONFIG_KM_DEF_ARCH \ "newenv=" \ - "prot off 0xF00C0000 +0x40000 && " \ - "era 0xF00C0000 +0x40000\0" \ + "prot off "__stringify(CONFIG_ENV_ADDR)" +0x40000 && " \ + "era "__stringify(CONFIG_ENV_ADDR)" +0x40000\0" \ "unlock=yes\0" \ ""

On Tue, Nov 17, 2015 at 10:53:35AM +0100, Valentin Longchamp wrote:
The hardcoded value are bad, since the address could change between different boards.
Furthermore, the relevant #defines are set only if #undefined here, so that they can be changed by some boards if required.
Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com
Applied to u-boot/master, thanks!

It should be after the u-boot reserved sectors and before the env sectors, since the solution used for kmvect1 (tell the linker to put the firmware into the u-boot produced binary, at the end of the area) should be the exception.
The #define is only "conditional" so that we can still support kmvect1.
Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com ---
Changes in v2: None
include/configs/km/km8309-common.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/include/configs/km/km8309-common.h b/include/configs/km/km8309-common.h index d7f6cb1..a69fdf1 100644 --- a/include/configs/km/km8309-common.h +++ b/include/configs/km/km8309-common.h @@ -29,8 +29,10 @@
/* QE microcode/firmware address */ #define CONFIG_SYS_QE_FMAN_FW_IN_NOR -/* at end of uboot partition, before env */ -#define CONFIG_SYS_QE_FW_ADDR 0xF00B0000 +/* between the u-boot partition and env */ +#ifndef CONFIG_SYS_QE_FW_ADDR +#define CONFIG_SYS_QE_FW_ADDR 0xF00C0000 +#endif
/* * System IO Config

On Tue, Nov 17, 2015 at 10:53:36AM +0100, Valentin Longchamp wrote:
It should be after the u-boot reserved sectors and before the env sectors, since the solution used for kmvect1 (tell the linker to put the firmware into the u-boot produced binary, at the end of the area) should be the exception.
The #define is only "conditional" so that we can still support kmvect1.
Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com
Applied to u-boot/master, thanks!

This board uses the same CPU (8309) as VECT1. The memory however is different since it has NAND Flash, the NOR Flash partitioning is different and of course the FPGAs as well.
Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com Signed-off-by: Christoph Dietrich christoph.dietrich@keymile.com ---
Changes in v2: None
board/keymile/km83xx/MAINTAINERS | 1 + configs/kmtegr1_defconfig | 4 +++ include/configs/suvd3.h | 65 +++++++++++++++++++++++++++++++++++++--- 3 files changed, 66 insertions(+), 4 deletions(-) create mode 100644 configs/kmtegr1_defconfig
diff --git a/board/keymile/km83xx/MAINTAINERS b/board/keymile/km83xx/MAINTAINERS index c4c3183..63b0651 100644 --- a/board/keymile/km83xx/MAINTAINERS +++ b/board/keymile/km83xx/MAINTAINERS @@ -9,6 +9,7 @@ F: include/configs/tuxx1.h F: configs/kmopti2_defconfig F: configs/kmtepr2_defconfig F: include/configs/suvd3.h +F: configs/kmtegr1_defconfig F: configs/kmvect1_defconfig F: configs/suvd3_defconfig F: configs/tuge1_defconfig diff --git a/configs/kmtegr1_defconfig b/configs/kmtegr1_defconfig new file mode 100644 index 0000000..aee9886 --- /dev/null +++ b/configs/kmtegr1_defconfig @@ -0,0 +1,4 @@ +CONFIG_SYS_EXTRA_OPTIONS="KMTEGR1" +CONFIG_PPC=y +CONFIG_MPC83xx=y +CONFIG_TARGET_SUVD3=y diff --git a/include/configs/suvd3.h b/include/configs/suvd3.h index fddba92..af8730a 100644 --- a/include/configs/suvd3.h +++ b/include/configs/suvd3.h @@ -29,13 +29,48 @@ #define CONFIG_KM_BOARD_NAME "suvd3" /* include common defines/options for all 8321 Keymile boards */ #include "km/km8321-common.h" + #elif defined(CONFIG_KMVECT1) /* VECT1 board specific */ #define CONFIG_HOSTNAME kmvect1 #define CONFIG_KM_BOARD_NAME "kmvect1" +/* at end of uboot partition, before env */ +#define CONFIG_SYS_QE_FW_ADDR 0xF00B0000 +/* include common defines/options for all 8309 Keymile boards */ +#include "km/km8309-common.h" + +#elif defined(CONFIG_KMTEGR1) /* TEGR1 board specific */ +#define CONFIG_HOSTNAME kmtegr1 +#define CONFIG_KM_BOARD_NAME "kmtegr1" +#define CONFIG_KM_UBI_PARTITION_NAME_BOOT "ubi0" +#define CONFIG_KM_UBI_PARTITION_NAME_APP "ubi1" +#define MTDIDS_DEFAULT "nor0=boot,nand0=app" +#define MTDPARTS_DEFAULT "mtdparts=" \ + "boot:" \ + "768k(u-boot)," \ + "256k(qe-fw)," \ + "128k(env)," \ + "128k(envred)," \ + "-(" CONFIG_KM_UBI_PARTITION_NAME_BOOT ");" \ + "app:" \ + "-(" CONFIG_KM_UBI_PARTITION_NAME_APP ");" + +#define CONFIG_ENV_ADDR 0xF0100000 +#define CONFIG_ENV_OFFSET 0x100000 + +#define CONFIG_CMD_NAND +#define CONFIG_NAND_ECC_BCH +#define CONFIG_BCH +#define CONFIG_NAND_KMETER1 +#define CONFIG_SYS_MAX_NAND_DEVICE 1 +#define NAND_MAX_CHIPS 1 + /* include common defines/options for all 8309 Keymile boards */ #include "km/km8309-common.h" +/* must be after the include because KMBEC_FPGA is otherwise undefined */ +#define CONFIG_SYS_NAND_BASE CONFIG_SYS_KMBEC_FPGA_BASE /* PRIO_BASE_ADDRESS */ + #else -#error Supported boards are: SUVD3, KMVECT1 +#error Supported boards are: SUVD3, KMVECT1, KMTEGR1 #endif
#define CONFIG_SYS_APP1_BASE 0xA0000000 @@ -56,6 +91,7 @@ * */
+#if defined(CONFIG_SUVD3) || defined(CONFIG_KMVECT1) /* * APP1 on the local bus CS2 */ @@ -82,14 +118,26 @@ 0x0000c000 | \ MxMR_WLFx_2X)
+#elif defined(CONFIG_KMTEGR1) +#define CONFIG_SYS_BR3_PRELIM (CONFIG_SYS_APP2_BASE | \ + BR_PS_16 | \ + BR_MS_GPCM | \ + BR_V) + +#define CONFIG_SYS_OR3_PRELIM (MEG_TO_AM(CONFIG_SYS_APP2_SIZE) | \ + OR_GPCM_SCY_5 | \ + OR_GPCM_TRLX_CLEAR | \ + OR_GPCM_EHTR_CLEAR) + +#endif /* CONFIG_KMTEGR1 */ + #define CONFIG_SYS_LBLAWBAR3_PRELIM CONFIG_SYS_APP2_BASE #define CONFIG_SYS_LBLAWAR3_PRELIM (LBLAWAR_EN | LBLAWAR_256MB)
/* * MMU Setup */ - - +#if defined(CONFIG_SUVD3) || defined(CONFIG_KMVECT1) /* APP1: icache cacheable, but dcache-inhibit and guarded */ #define CONFIG_SYS_IBAT5L (CONFIG_SYS_APP1_BASE | BATL_PP_RW | \ BATL_MEMCOHERENCE) @@ -99,6 +147,13 @@ BATL_CACHEINHIBIT | BATL_GUARDEDSTORAGE) #define CONFIG_SYS_DBAT5U CONFIG_SYS_IBAT5U
+#elif defined(CONFIG_KMTEGR1) +#define CONFIG_SYS_IBAT5L (0) +#define CONFIG_SYS_IBAT5U (0) +#define CONFIG_SYS_DBAT5L CONFIG_SYS_IBAT5L +#define CONFIG_SYS_DBAT5U CONFIG_SYS_IBAT5U +#endif /* CONFIG_KMTEGR1 */ + #define CONFIG_SYS_IBAT6L (CONFIG_SYS_APP2_BASE | BATL_PP_RW | \ BATL_MEMCOHERENCE) #define CONFIG_SYS_IBAT6U (CONFIG_SYS_APP2_BASE | BATU_BL_256M | \ @@ -131,7 +186,9 @@ #define CONFIG_SYS_UEC1_PHY_ADDR CONFIG_SYS_FIXED_PHY_ADDR #define CONFIG_SYS_UEC1_INTERFACE_TYPE PHY_INTERFACE_MODE_MII #define CONFIG_SYS_UEC1_INTERFACE_SPEED 100 +#endif /* CONFIG_KMVECT1 */
+#if defined(CONFIG_KMVECT1) || defined(CONFIG_KMTEGR1) /* ethernet port connected to piggy (UEC2) */ #define CONFIG_HAS_ETH1 #define CONFIG_UEC_ETH2 @@ -142,6 +199,6 @@ #define CONFIG_SYS_UEC2_PHY_ADDR 0 #define CONFIG_SYS_UEC2_INTERFACE_TYPE PHY_INTERFACE_MODE_RMII #define CONFIG_SYS_UEC2_INTERFACE_SPEED 100 -#endif /* CONFIG_KMVECT1 */ +#endif /* CONFIG_KMVECT1 || CONFIG_KMTEGR1 */
#endif /* __CONFIG_H */

On Tue, Nov 17, 2015 at 10:53:37AM +0100, Valentin Longchamp wrote:
This board uses the same CPU (8309) as VECT1. The memory however is different since it has NAND Flash, the NOR Flash partitioning is different and of course the FPGAs as well.
Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com Signed-off-by: Christoph Dietrich christoph.dietrich@keymile.com
Applied to u-boot/master, thanks!

Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com
---
Changes in v2: - Removed support for kmvect1_p1a: not relevant anymore
board/keymile/km82xx/km82xx.c | 2 +- board/keymile/km83xx/km83xx.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/board/keymile/km82xx/km82xx.c b/board/keymile/km82xx/km82xx.c index 9e285ec..c2a7a5f 100644 --- a/board/keymile/km82xx/km82xx.c +++ b/board/keymile/km82xx/km82xx.c @@ -447,7 +447,7 @@ int get_scl(void) return get_pin(SCL_MASK, 3); }
-void ft_board_setup(void *blob, bd_t *bd) +int ft_board_setup(void *blob, bd_t *bd) { ft_cpu_setup(blob, bd);
diff --git a/board/keymile/km83xx/km83xx.c b/board/keymile/km83xx/km83xx.c index 1164c2e..154f974 100644 --- a/board/keymile/km83xx/km83xx.c +++ b/board/keymile/km83xx/km83xx.c @@ -361,7 +361,7 @@ int checkboard(void) return 0; }
-void ft_board_setup(void *blob, bd_t *bd) +int ft_board_setup(void *blob, bd_t *bd) { ft_cpu_setup(blob, bd);

On Tue, Nov 17, 2015 at 10:53:38AM +0100, Valentin Longchamp wrote:
Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com
Applied to u-boot/master, thanks!

Hello Valentin,
for the hole serie:
Reviewed-by: Heiko Schocher hs@denx.de
bye, Heiko Am 17.11.2015 um 10:53 schrieb Valentin Longchamp:
A few bugfixes have been done for the km_kirkwood bards in the last months and this series collects them all to be sumbitted to mainline. Furthermore, support for 2 new Keymile ppc boards are added:
- kmtepr2: based on a 8321, this is another variation of tuxx1
- kmtegr1: based on 8309, similarly to kmvect1 but with a lot of different peripherals
Changes in v2:
- Removed merge conflict files in commit message
- Squashed commit 9/17 and 10/17 together into a single commit
- Rewritten commit message to get rid of internal git commit reference
- Removed support for kmvect1_p1a: not relevant anymore
Bagavathiannan Palanisamy (1): board/keymile/km82xx: setting dip_switch 3 and 4 will run bootloader
Christoph Dietrich (1): powerpc/83xx: add support for kmtepr2 board
Holger Brunck (6): powerpc/82xx: make set/get_pin for km82xx more flexible powerpc/82xx/km: add testpin detection for mgcoge3ne km/powerpc: increase space for kernel imange and FDT blob km/powerpc: move open firmware defines to km-powerpc.h km/powerpc: remove unneeded defines km/powerpc82xx: remove unused function
Valentin Longchamp (7): powerpc/km8321: define CONFIG_SYS_DDRCDR powerpc/km8309: define CONFIG_SYS_DDRCDR powerpc/km8360: fix the ODT parameters for CS0 km83xx: use CONFIG_ENV_ADDR for the newenv env command km8309: change the default QE_FW address powerpc/83xx: add support for kmtegr1 board km/powerpc: fix ft_board_setup prototype for km82xx & km83xx
board/keymile/common/common.c | 5 ++- board/keymile/common/common.h | 2 ++ board/keymile/km82xx/km82xx.c | 57 ++++++++++++++------------------- board/keymile/km83xx/MAINTAINERS | 2 ++ board/keymile/km83xx/km83xx.c | 2 -- configs/kmtegr1_defconfig | 4 +++ configs/kmtepr2_defconfig | 4 +++ include/configs/km/km-powerpc.h | 10 ++++-- include/configs/km/km8309-common.h | 12 +++++-- include/configs/km/km8321-common.h | 6 ++++ include/configs/km/km83xx-common.h | 11 ++++--- include/configs/km82xx.h | 3 -- include/configs/km8360.h | 4 +-- include/configs/suvd3.h | 65 +++++++++++++++++++++++++++++++++++--- include/configs/tuxx1.h | 43 +++++++++++++++++++++---- 15 files changed, 167 insertions(+), 63 deletions(-) create mode 100644 configs/kmtegr1_defconfig create mode 100644 configs/kmtepr2_defconfig
participants (3)
-
Heiko Schocher
-
Tom Rini
-
Valentin Longchamp