[U-Boot-Users] [PATCH 0/6] Update sbc8560; enable fdt/powerpc support

The following six patches update the sbc8560 support to fix a memsize bug + some bitrot (1st three), and then add/enable the powerpc/fdt support (the second three). One additional patch required for using the sbc8560 on 1.3.x; the setting of the UART clk in mpc85xx/fdt.c isn't included here, as that wasn't a fix in a board specific file, and so it is being reviewed/submitted separately.
Thanks, Paul.
0001-sbc8560-proper-definitions-for-TSEC.patch b/include/configs/sbc8560.h | 32 ++++++++++++++++++++++----------
0002-sbc8560-properly-set-cs0_bnds-for-512MB.patch b/board/sbc8560/sbc8560.c | 4 ++++
0003-sbc8560-define-eth0-and-eth1-instead-of-eth1-and-eth2.patch b/include/configs/sbc8560.h | 3 +--
0004-sbc8560-add-in-ft_board_setup.patch b/board/sbc8560/sbc8560.c | 28 ++++++++++++++++++++++++++++
0005-sbc8560-add-default-fdt-values.patch b/include/configs/sbc8560.h | 35 +++++++++++++++++++++++++++++++----
0006-sbc8560-enable-CONFIG_OF_LIBFDT-by-default.patch b/include/configs/sbc8560.h | 5 +++++

The definitions for the TSEC have become out of date. There is no longer any such options like "CONFIG_MPC85xx_TSEC1" or similar. Update to match those of other boards, like the MPC8560ADS. --- include/configs/sbc8560.h | 32 ++++++++++++++++++++++---------- 1 files changed, 22 insertions(+), 10 deletions(-)
diff --git a/include/configs/sbc8560.h b/include/configs/sbc8560.h index 146eafe..f07fbc0 100644 --- a/include/configs/sbc8560.h +++ b/include/configs/sbc8560.h @@ -215,16 +215,28 @@ #define CFG_PCI_MEM_PHYS 0xC0000000 #define CFG_PCI_MEM_SIZE 0x10000000
-#if defined(CONFIG_TSEC_ENET) /* TSEC Ethernet port */ - -# define CONFIG_NET_MULTI 1 -# define CONFIG_MII 1 /* MII PHY management */ -# define CONFIG_MPC85xx_TSEC1 -# define CONFIG_MPC85xx_TSEC1_NAME "TSEC0" -# define TSEC1_PHY_ADDR 25 -# define TSEC1_PHYIDX 0 -/* Options are: TSEC0 */ -# define CONFIG_ETHPRIME "TSEC0" +#ifdef CONFIG_TSEC_ENET + +#ifndef CONFIG_NET_MULTI +#define CONFIG_NET_MULTI 1 +#endif + +#ifndef CONFIG_MII +#define CONFIG_MII 1 /* MII PHY management */ +#endif +#define CONFIG_TSEC1 1 +#define CONFIG_TSEC1_NAME "TSEC0" +#define CONFIG_TSEC2 1 +#define CONFIG_TSEC2_NAME "TSEC1" +#define TSEC1_PHY_ADDR 0x19 +#define TSEC2_PHY_ADDR 0x1a +#define TSEC1_PHYIDX 0 +#define TSEC2_PHYIDX 0 +#define TSEC1_FLAGS TSEC_GIGABIT +#define TSEC2_FLAGS TSEC_GIGABIT + +/* Options are: TSEC[0-1] */ +#define CONFIG_ETHPRIME "TSEC0"
#elif defined(CONFIG_ETHER_ON_FCC) /* CPM FCC Ethernet */

The sbc8560 board ships with 512MB of memory installed, but the current cs0_bnds is hard coded for 256MB. Set the value based on CFG_SDRAM_SIZE. --- board/sbc8560/sbc8560.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/board/sbc8560/sbc8560.c b/board/sbc8560/sbc8560.c index 2946ca1..3b6b541 100644 --- a/board/sbc8560/sbc8560.c +++ b/board/sbc8560/sbc8560.c @@ -421,7 +421,11 @@ long int fixed_sdram (void) #ifndef CFG_RAMBOOT volatile ccsr_ddr_t *ddr= (void *)(CFG_MPC85xx_DDR_ADDR);
+#if (CFG_SDRAM_SIZE == 512) + ddr->cs0_bnds = 0x0000000f; +#else ddr->cs0_bnds = 0x00000007; +#endif ddr->cs1_bnds = 0x0010001f; ddr->cs2_bnds = 0x00000000; ddr->cs3_bnds = 0x00000000;

The existing config doesn't define CONFIG_HAS_ETH0, and so the fdt support doesn't update the zeros in the dtb local-mac with real data from the u-boot env. Since the existing config is tailored to just two interfaces, get rid of the ETH2 definitions at the same time. --- include/configs/sbc8560.h | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/include/configs/sbc8560.h b/include/configs/sbc8560.h index f07fbc0..e5195e0 100644 --- a/include/configs/sbc8560.h +++ b/include/configs/sbc8560.h @@ -407,11 +407,10 @@
/*Note: change below for your network setting!!! */ #if defined(CONFIG_TSEC_ENET) || defined(CONFIG_ETHER_ON_FCC) +# define CONFIG_HAS_ETH0 # define CONFIG_ETHADDR 00:01:af:07:9b:8a # define CONFIG_HAS_ETH1 # define CONFIG_ETH1ADDR 00:01:af:07:9b:8b -# define CONFIG_HAS_ETH2 -# define CONFIG_ETH2ADDR 00:01:af:07:9b:8c #endif
#define CONFIG_SERVERIP 192.168.0.131

Add in for the sbc8560, the ft_board_setup() routine, based on what is in use for the Freescale MPC8560ADS board. --- board/sbc8560/sbc8560.c | 28 ++++++++++++++++++++++++++++ 1 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/board/sbc8560/sbc8560.c b/board/sbc8560/sbc8560.c index 3b6b541..d9e598c 100644 --- a/board/sbc8560/sbc8560.c +++ b/board/sbc8560/sbc8560.c @@ -33,6 +33,8 @@ #include <ioports.h> #include <spd_sdram.h> #include <miiphy.h> +#include <libfdt.h> +#include <fdt_support.h>
long int fixed_sdram (void);
@@ -456,3 +458,29 @@ long int fixed_sdram (void) return CFG_SDRAM_SIZE * 1024 * 1024; } #endif /* !defined(CONFIG_SPD_EEPROM) */ + + +#if defined(CONFIG_OF_BOARD_SETUP) +void +ft_board_setup(void *blob, bd_t *bd) +{ + int node, tmp[2]; +#ifdef CONFIG_PCI + const char *path; +#endif + + ft_cpu_setup(blob, bd); + + node = fdt_path_offset(blob, "/aliases"); + tmp[0] = 0; + if (node >= 0) { +#ifdef CONFIG_PCI + path = fdt_getprop(blob, node, "pci0", NULL); + if (path) { + tmp[1] = hose.last_busno - hose.first_busno; + do_fixup_by_path(blob, path, "bus-range", &tmp, 8, 1); + } +#endif + } +} +#endif

Add in the default fdt settings and the typical EXTRA_ENV settings as borrowed from the mpc8560ads. Fix a couple of stale references to the mpc8560ads dating back to the original clone/fork. --- include/configs/sbc8560.h | 35 +++++++++++++++++++++++++++++++---- 1 files changed, 31 insertions(+), 4 deletions(-)
diff --git a/include/configs/sbc8560.h b/include/configs/sbc8560.h index e5195e0..8e61225 100644 --- a/include/configs/sbc8560.h +++ b/include/configs/sbc8560.h @@ -24,8 +24,8 @@ * MA 02111-1307 USA */
-/* mpc8560ads board configuration file */ -/* please refer to doc/README.mpc85xx for more info */ +/* sbc8560 board configuration file */ +/* please refer to doc/README.sbc8560 for more info */ /* make sure you change the MAC address and other network params first, * search for CONFIG_ETHADDR,CONFIG_SERVERIP,etc in this file */ @@ -329,7 +329,6 @@
#define CONFIG_BOOTARGS "root=/dev/nfs rw nfsroot=192.168.0.251:/tftpboot ip=192.168.0.105:192.168.0.251::255.255.255.0:sbc8560:eth0:off console=ttyS0,9600" /*#define CONFIG_BOOTARGS "root=/dev/ram rw console=ttyS0,115200"*/ -#define CONFIG_BOOTCOMMAND "bootm 0xff800000 0xffa00000" #define CONFIG_BOOTDELAY 5 /* -1 disable autoboot */
#define CONFIG_LOADS_ECHO 1 /* echo on for serial download */ @@ -419,6 +418,34 @@ #define CONFIG_NETMASK 255.255.255.0 #define CONFIG_HOSTNAME SBC8560 #define CONFIG_ROOTPATH /home/ppc -#define CONFIG_BOOTFILE pImage +#define CONFIG_BOOTFILE uImage + +#define CONFIG_EXTRA_ENV_SETTINGS \ + "netdev=eth0\0" \ + "consoledev=ttyS0\0" \ + "ramdiskaddr=2000000\0" \ + "ramdiskfile=ramdisk.uboot\0" \ + "fdtaddr=c00000\0" \ + "fdtfile=sbc8560.dtb\0" + +#define CONFIG_NFSBOOTCOMMAND \ + "setenv bootargs root=/dev/nfs rw " \ + "nfsroot=$serverip:$rootpath " \ + "ip=$ipaddr:$serverip:$gatewayip:$netmask:$hostname:$netdev:off " \ + "console=$consoledev,$baudrate $othbootargs;" \ + "tftp $loadaddr $bootfile;" \ + "tftp $fdtaddr $fdtfile;" \ + "bootm $loadaddr - $fdtaddr" + + +#define CONFIG_RAMBOOTCOMMAND \ + "setenv bootargs root=/dev/ram rw " \ + "console=$consoledev,$baudrate $othbootargs;" \ + "tftp $ramdiskaddr $ramdiskfile;" \ + "tftp $loadaddr $bootfile;" \ + "tftp $fdtaddr $fdtfile;" \ + "bootm $loadaddr $ramdiskaddr $fdtaddr" + +#define CONFIG_BOOTCOMMAND CONFIG_NFSBOOTCOMMAND
#endif /* __CONFIG_H */

Make the default build for the sbc8560 board be powerpc capable with libfdt support. --- include/configs/sbc8560.h | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/include/configs/sbc8560.h b/include/configs/sbc8560.h index 8e61225..44d65b7 100644 --- a/include/configs/sbc8560.h +++ b/include/configs/sbc8560.h @@ -200,6 +200,11 @@ #define CFG_PROMPT_HUSH_PS2 "> " #endif
+/* pass open firmware flat tree */ +#define CONFIG_OF_LIBFDT 1 +#define CONFIG_OF_BOARD_SETUP 1 +#define CONFIG_OF_STDOUT_VIA_ALIAS 1 + /* * I2C */

Paul Gortmaker wrote:
The existing config doesn't define CONFIG_HAS_ETH0, and so the fdt support doesn't update the zeros in the dtb local-mac with real data from the u-boot env. Since the existing config is tailored to just two interfaces, get rid of the ETH2 definitions at the same time.
include/configs/sbc8560.h | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/include/configs/sbc8560.h b/include/configs/sbc8560.h index f07fbc0..e5195e0 100644 --- a/include/configs/sbc8560.h +++ b/include/configs/sbc8560.h @@ -407,11 +407,10 @@
/*Note: change below for your network setting!!! */ #if defined(CONFIG_TSEC_ENET) || defined(CONFIG_ETHER_ON_FCC) +# define CONFIG_HAS_ETH0 # define CONFIG_ETHADDR 00:01:af:07:9b:8a # define CONFIG_HAS_ETH1 # define CONFIG_ETH1ADDR 00:01:af:07:9b:8b -# define CONFIG_HAS_ETH2 -# define CONFIG_ETH2ADDR 00:01:af:07:9b:8c #endif
#define CONFIG_SERVERIP 192.168.0.131
Please get rid of all default network parameters while you're at it (MAC addresses, IP addresses etc.)
regards, Ben

Ben Warren wrote:
Paul Gortmaker wrote:
The existing config doesn't define CONFIG_HAS_ETH0, and so the fdt support doesn't update the zeros in the dtb local-mac with real data from the u-boot env. Since the existing config is tailored to just two interfaces, get rid of the ETH2 definitions at the same time.
include/configs/sbc8560.h | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/include/configs/sbc8560.h b/include/configs/sbc8560.h index f07fbc0..e5195e0 100644 --- a/include/configs/sbc8560.h +++ b/include/configs/sbc8560.h @@ -407,11 +407,10 @@
/*Note: change below for your network setting!!! */ #if defined(CONFIG_TSEC_ENET) || defined(CONFIG_ETHER_ON_FCC) +# define CONFIG_HAS_ETH0 # define CONFIG_ETHADDR 00:01:af:07:9b:8a # define CONFIG_HAS_ETH1 # define CONFIG_ETH1ADDR 00:01:af:07:9b:8b -# define CONFIG_HAS_ETH2 -# define CONFIG_ETH2ADDR 00:01:af:07:9b:8c #endif
#define CONFIG_SERVERIP 192.168.0.131
Please get rid of all default network parameters while you're at it (MAC addresses, IP addresses etc.)
Is there a set list of which things are considered OK and which are ones that folks would rather not see? A quick snoop around shows lots of other boards doing the 192.168.x.y type stuff and default MAC addresses and similar.
I'm fine with doing a cleanup; I just don't want to do it twice, and I'd rather it be consistent across all the boards as well.
Thanks, Paul.
regards, Ben

Hi Paul,
Paul Gortmaker wrote:
Ben Warren wrote:
Paul Gortmaker wrote:
The existing config doesn't define CONFIG_HAS_ETH0, and so the fdt support doesn't update the zeros in the dtb local-mac with real data from the u-boot env. Since the existing config is tailored to just two interfaces, get rid of the ETH2 definitions at the same time.
include/configs/sbc8560.h | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/include/configs/sbc8560.h b/include/configs/sbc8560.h index f07fbc0..e5195e0 100644 --- a/include/configs/sbc8560.h +++ b/include/configs/sbc8560.h @@ -407,11 +407,10 @@
/*Note: change below for your network setting!!! */ #if defined(CONFIG_TSEC_ENET) || defined(CONFIG_ETHER_ON_FCC) +# define CONFIG_HAS_ETH0 # define CONFIG_ETHADDR 00:01:af:07:9b:8a # define CONFIG_HAS_ETH1 # define CONFIG_ETH1ADDR 00:01:af:07:9b:8b -# define CONFIG_HAS_ETH2 -# define CONFIG_ETH2ADDR 00:01:af:07:9b:8c #endif
#define CONFIG_SERVERIP 192.168.0.131
Please get rid of all default network parameters while you're at it (MAC addresses, IP addresses etc.)
Is there a set list of which things are considered OK and which are ones that folks would rather not see? A quick snoop around shows lots of other boards doing the 192.168.x.y type stuff and default MAC addresses and similar.
Of course there's no list. That would take all of the fun out of subjective reviewing!
Essentially, anything that is specific to one particular network should not be defaulted. For MAC addresses, it's cut-and-dry - the values you're using were paid for by some entity (maybe Wind River, maybe somebody else that you cut'n'pasted from, I don't know) and the contract with the IEEE states that each number will be used only once and documented by the owner. For higher-layer things like IP addresses it's more a matter of convenience. While you may use 192.168.x.y in your lab, there's no guarantee that the buyers of your boards will, so why default it at all?
As to precedence, you won't find any recent additions with these things. I don't know if we'll ever remove the code that uses CONFIG_ETHADDR and friends, but you should make the assumption that it will go.
I'm fine with doing a cleanup; I just don't want to do it twice, and I'd rather it be consistent across all the boards as well.
I understand, and have no interest in adding ambiguity.
regards, Ben

Paul Gortmaker wrote:
The definitions for the TSEC have become out of date. There is no longer any such options like "CONFIG_MPC85xx_TSEC1" or similar. Update to match those of other boards, like the MPC8560ADS.
You forgot your signed-off-by. When you resubmit, add:
Acked-by: Ben Warren biggerbadderben@gmail.com
include/configs/sbc8560.h | 32 ++++++++++++++++++++++---------- 1 files changed, 22 insertions(+), 10 deletions(-)
diff --git a/include/configs/sbc8560.h b/include/configs/sbc8560.h index 146eafe..f07fbc0 100644 --- a/include/configs/sbc8560.h +++ b/include/configs/sbc8560.h @@ -215,16 +215,28 @@ #define CFG_PCI_MEM_PHYS 0xC0000000 #define CFG_PCI_MEM_SIZE 0x10000000
-#if defined(CONFIG_TSEC_ENET) /* TSEC Ethernet port */
-# define CONFIG_NET_MULTI 1 -# define CONFIG_MII 1 /* MII PHY management */ -# define CONFIG_MPC85xx_TSEC1 -# define CONFIG_MPC85xx_TSEC1_NAME "TSEC0" -# define TSEC1_PHY_ADDR 25 -# define TSEC1_PHYIDX 0 -/* Options are: TSEC0 */ -# define CONFIG_ETHPRIME "TSEC0" +#ifdef CONFIG_TSEC_ENET
+#ifndef CONFIG_NET_MULTI +#define CONFIG_NET_MULTI 1 +#endif
+#ifndef CONFIG_MII +#define CONFIG_MII 1 /* MII PHY management */ +#endif +#define CONFIG_TSEC1 1 +#define CONFIG_TSEC1_NAME "TSEC0" +#define CONFIG_TSEC2 1 +#define CONFIG_TSEC2_NAME "TSEC1" +#define TSEC1_PHY_ADDR 0x19 +#define TSEC2_PHY_ADDR 0x1a +#define TSEC1_PHYIDX 0 +#define TSEC2_PHYIDX 0 +#define TSEC1_FLAGS TSEC_GIGABIT +#define TSEC2_FLAGS TSEC_GIGABIT
+/* Options are: TSEC[0-1] */ +#define CONFIG_ETHPRIME "TSEC0"
#elif defined(CONFIG_ETHER_ON_FCC) /* CPM FCC Ethernet */

Ben Warren wrote:
Paul Gortmaker wrote:
The definitions for the TSEC have become out of date. There is no longer any such options like "CONFIG_MPC85xx_TSEC1" or similar. Update to match those of other boards, like the MPC8560ADS.
You forgot your signed-off-by. When you resubmit, add:
Ah, crap. Knew I was forgetting something. Thanks. I'll wait for other feedback before re-sending it again.
P.
Acked-by: Ben Warren biggerbadderben@gmail.com
include/configs/sbc8560.h | 32 ++++++++++++++++++++++---------- 1 files changed, 22 insertions(+), 10 deletions(-)
diff --git a/include/configs/sbc8560.h b/include/configs/sbc8560.h index 146eafe..f07fbc0 100644 --- a/include/configs/sbc8560.h +++ b/include/configs/sbc8560.h @@ -215,16 +215,28 @@ #define CFG_PCI_MEM_PHYS 0xC0000000 #define CFG_PCI_MEM_SIZE 0x10000000
-#if defined(CONFIG_TSEC_ENET) /* TSEC Ethernet port */
-# define CONFIG_NET_MULTI 1 -# define CONFIG_MII 1 /* MII PHY management */ -# define CONFIG_MPC85xx_TSEC1 -# define CONFIG_MPC85xx_TSEC1_NAME "TSEC0" -# define TSEC1_PHY_ADDR 25 -# define TSEC1_PHYIDX 0 -/* Options are: TSEC0 */ -# define CONFIG_ETHPRIME "TSEC0" +#ifdef CONFIG_TSEC_ENET
+#ifndef CONFIG_NET_MULTI +#define CONFIG_NET_MULTI 1 +#endif
+#ifndef CONFIG_MII +#define CONFIG_MII 1 /* MII PHY management */ +#endif +#define CONFIG_TSEC1 1 +#define CONFIG_TSEC1_NAME "TSEC0" +#define CONFIG_TSEC2 1 +#define CONFIG_TSEC2_NAME "TSEC1" +#define TSEC1_PHY_ADDR 0x19 +#define TSEC2_PHY_ADDR 0x1a +#define TSEC1_PHYIDX 0 +#define TSEC2_PHYIDX 0 +#define TSEC1_FLAGS TSEC_GIGABIT +#define TSEC2_FLAGS TSEC_GIGABIT
+/* Options are: TSEC[0-1] */ +#define CONFIG_ETHPRIME "TSEC0"
#elif defined(CONFIG_ETHER_ON_FCC) /* CPM FCC Ethernet */
participants (2)
-
Ben Warren
-
Paul Gortmaker