[U-Boot] [PATCH 1/2] kirkwood: ib62x0: Invert SATA activity LEDs

The hardware design of the IB-NAS62x0 causes the SATA activity LEDs to be on when idle by default. Reverse the polarity of the activity LEDs in early init.
Signed-off-by: Simon Baatz gmbnomis@gmail.com Cc: Luka Perkov uboot@lukaperkov.net Cc: Prafulla Wadaskar prafulla@marvell.com --- board/raidsonic/ib62x0/ib62x0.c | 3 +++ board/raidsonic/ib62x0/ib62x0.h | 4 ++++ 2 files changed, 7 insertions(+)
diff --git a/board/raidsonic/ib62x0/ib62x0.c b/board/raidsonic/ib62x0/ib62x0.c index 1164d6b..b7e6e41 100644 --- a/board/raidsonic/ib62x0/ib62x0.c +++ b/board/raidsonic/ib62x0/ib62x0.c @@ -23,6 +23,7 @@
#include <common.h> #include <miiphy.h> +#include <asm/io.h> #include <asm/arch/cpu.h> #include <asm/arch/kirkwood.h> #include <asm/arch/mpp.h> @@ -41,6 +42,8 @@ int board_early_init_f(void) IB62x0_OE_VAL_HIGH, IB62x0_OE_LOW, IB62x0_OE_HIGH);
+ /* Set SATA activity LEDs to default off */ + writel(MVSATAHC_LED_POLARITY_CTRL, MVSATAHC_LED_CONF_REG); /* Multi-Purpose Pins Functionality configuration */ u32 kwmpp_config[] = { MPP0_NF_IO2, diff --git a/board/raidsonic/ib62x0/ib62x0.h b/board/raidsonic/ib62x0/ib62x0.h index 0c30690..0118c2b 100644 --- a/board/raidsonic/ib62x0/ib62x0.h +++ b/board/raidsonic/ib62x0/ib62x0.h @@ -37,4 +37,8 @@ #define MV88E1116_RGMII_TXTM_CTRL (1 << 4) #define MV88E1116_RGMII_RXTM_CTRL (1 << 5)
+/* SATAHC related */ +#define MVSATAHC_LED_CONF_REG (MV_SATA_BASE + 0x2C) +#define MVSATAHC_LED_POLARITY_CTRL (1 << 3) + #endif /* __IB62x0_H */

Support for the IB-NAS62x0 was added to the Linux mainline kernel as of 3.5-rc1 using flattened devicetree. Change the config for this board accordingly.
Signed-off-by: Simon Baatz gmbnomis@gmail.com Cc: Luka Perkov uboot@lukaperkov.net Cc: Prafulla Wadaskar prafulla@marvell.com --- include/configs/ib62x0.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/configs/ib62x0.h b/include/configs/ib62x0.h index 85856f2..34c83a4 100644 --- a/include/configs/ib62x0.h +++ b/include/configs/ib62x0.h @@ -37,9 +37,9 @@ #define CONFIG_SKIP_LOWLEVEL_INIT /* disable board lowlevel_init */
/* - * Machine type + * Enable device tree support */ -#define CONFIG_MACH_TYPE MACH_TYPE_NAS6210 +#define CONFIG_OF_LIBFDT
/* * Compression configuration

On Fri, Jul 20, 2012 at 09:59:15PM +0200, Simon Baatz wrote:
Support for the IB-NAS62x0 was added to the Linux mainline kernel as of 3.5-rc1 using flattened devicetree. Change the config for this board accordingly.
Signed-off-by: Simon Baatz gmbnomis@gmail.com Cc: Luka Perkov uboot@lukaperkov.net Cc: Prafulla Wadaskar prafulla@marvell.com
include/configs/ib62x0.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/configs/ib62x0.h b/include/configs/ib62x0.h index 85856f2..34c83a4 100644 --- a/include/configs/ib62x0.h +++ b/include/configs/ib62x0.h @@ -37,9 +37,9 @@ #define CONFIG_SKIP_LOWLEVEL_INIT /* disable board lowlevel_init */
/*
- Machine type
*/
- Enable device tree support
-#define CONFIG_MACH_TYPE MACH_TYPE_NAS6210 +#define CONFIG_OF_LIBFDT
Do we need to change environment variables too? This is how I'm booting OpenWrt with linux 3.3 now:
diff --git a/include/configs/ib62x0.h b/include/configs/ib62x0.h index 85856f2..b1c11fd 100644 --- a/include/configs/ib62x0.h +++ b/include/configs/ib62x0.h @@ -87,25 +87,23 @@ */ #define CONFIG_BOOTCOMMAND \ "setenv bootargs ${console} ${mtdparts} ${bootargs_root}; " \ - "ubi part root; " \ - "ubifsmount root; " \ + "ubi part rootfs; " \ + "ubifsmount rootfs; " \ "ubifsload 0x800000 ${kernel}; " \ - "ubifsload 0x1100000 ${initrd}; " \ - "bootm 0x800000 0x1100000" + "bootm 0x800000"
#define CONFIG_MTDPARTS \ "mtdparts=orion_nand:" \ "0x80000@0x0(uboot)," \ "0x20000@0x80000(uboot_env)," \ - "-@0xa0000(root)\0" + "-@0xa0000(rootfs)\0"
#define CONFIG_EXTRA_ENV_SETTINGS \ "console=console=ttyS0,115200\0" \ "mtdids=nand0=orion_nand\0" \ "mtdparts="CONFIG_MTDPARTS \ "kernel=/boot/uImage\0" \ - "initrd=/boot/uInitrd\0" \ - "bootargs_root=ubi.mtd=2 root=ubi0:root rootfstype=ubifs\0" + "bootargs_root=noinitrd ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs\0"
/* * Ethernet driver configuration
Regards, Luka

Hi Simon and Luka,
Le 21/07/2012 10:03, Luka Perkov a écrit :
On Fri, Jul 20, 2012 at 09:59:15PM +0200, Simon Baatz wrote:
Support for the IB-NAS62x0 was added to the Linux mainline kernel as of 3.5-rc1 using flattened devicetree. Change the config for this board accordingly.
Signed-off-by: Simon Baatz gmbnomis@gmail.com Cc: Luka Perkov uboot@lukaperkov.net Cc: Prafulla Wadaskar prafulla@marvell.com
include/configs/ib62x0.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/configs/ib62x0.h b/include/configs/ib62x0.h index 85856f2..34c83a4 100644 --- a/include/configs/ib62x0.h +++ b/include/configs/ib62x0.h @@ -37,9 +37,9 @@ #define CONFIG_SKIP_LOWLEVEL_INIT /* disable board lowlevel_init */
/*
- Machine type
*/
- Enable device tree support
-#define CONFIG_MACH_TYPE MACH_TYPE_NAS6210 +#define CONFIG_OF_LIBFDT
Do we need to change environment variables too? This is how I'm booting OpenWrt with linux 3.3 now:
Is it not better to have the same mtdparts as in the original stock firmware and in the next linux kernel ?
Then we will just need small specifics distribution patch to customize the upstream uboot for the specifics boot params: In Debian, we need the initrd for raid support system bootup.
It is better to have the same partition scheme in next linux kernel and in uboot, whatever it will be. And better to be more closer from the original one, to make end-user upgrade process simpler.
An alternative will be to have parameters, if possible, to put uboot distribution wide compatible. May be a bootstrap call (bootscript call from uboot) or another tweak ?
diff --git a/include/configs/ib62x0.h b/include/configs/ib62x0.h index 85856f2..b1c11fd 100644 --- a/include/configs/ib62x0.h +++ b/include/configs/ib62x0.h @@ -87,25 +87,23 @@ */ #define CONFIG_BOOTCOMMAND \ "setenv bootargs ${console} ${mtdparts} ${bootargs_root}; " \
"ubi part root; " \
"ubifsmount root; " \
"ubi part rootfs; " \
"ubifsmount rootfs; " \ "ubifsload 0x800000 ${kernel}; " \
"ubifsload 0x1100000 ${initrd}; " \
"bootm 0x800000 0x1100000"
"bootm 0x800000"
#define CONFIG_MTDPARTS \ "mtdparts=orion_nand:" \ "0x80000@0x0(uboot)," \ "0x20000@0x80000(uboot_env)," \
"-@0xa0000(root)\0"
"-@0xa0000(rootfs)\0"
#define CONFIG_EXTRA_ENV_SETTINGS \ "console=console=ttyS0,115200\0" \ "mtdids=nand0=orion_nand\0" \ "mtdparts="CONFIG_MTDPARTS \ "kernel=/boot/uImage\0" \
"initrd=/boot/uInitrd\0" \
"bootargs_root=ubi.mtd=2 root=ubi0:root rootfstype=ubifs\0"
"bootargs_root=noinitrd ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs\0"
/*
- Ethernet driver configuration
Regards, Luka
Regards, DrEagle

Hi Gerald and Luka,
On Sat, Jul 21, 2012 at 10:30:48AM +0200, DrEagle wrote:
Hi Simon and Luka,
Le 21/07/2012 10:03, Luka Perkov a écrit :
On Fri, Jul 20, 2012 at 09:59:15PM +0200, Simon Baatz wrote:
-#define CONFIG_MACH_TYPE MACH_TYPE_NAS6210 +#define CONFIG_OF_LIBFDT
Do we need to change environment variables too? This is how I'm booting OpenWrt with linux 3.3 now:
Is it not better to have the same mtdparts as in the original stock firmware and in the next linux kernel ?
You both raise good points here. The mtd partitions can be and also currently are defined in the default FDT. That's probably where the kernel should get the partitions from. However, this means that we have the problem that the partitions may be defined differently in U-Boot and the kernel, which is a source of errors.
In my opinion, U-Boot should be able to get the mtd partitions from the FDT. I just had a short look, but could not find such a functionality in U-Boot nor any discussions about it.
Then we will just need small specifics distribution patch to customize the upstream uboot for the specifics boot params: In Debian, we need the initrd for raid support system bootup.
Any of these settings here can be overriden by the U-Boot configuration. Thus, there is no need to modify U-Boot itself.
It is better to have the same partition scheme in next linux kernel and in uboot, whatever it will be. And better to be more closer from the original one, to make end-user upgrade process simpler.
As said, it would be even better to ensure this by letting U-Boot learn the partitions from the FDT.
An alternative will be to have parameters, if possible, to put uboot distribution wide compatible. May be a bootstrap call (bootscript call from uboot) or another tweak ?
diff --git a/include/configs/ib62x0.h b/include/configs/ib62x0.h index 85856f2..b1c11fd 100644 --- a/include/configs/ib62x0.h +++ b/include/configs/ib62x0.h @@ -87,25 +87,23 @@ */ #define CONFIG_BOOTCOMMAND \ "setenv bootargs ${console} ${mtdparts} ${bootargs_root}; " \
"ubi part root; " \
"ubifsmount root; " \
"ubi part rootfs; " \
"ubifsmount rootfs; " \ "ubifsload 0x800000 ${kernel}; " \
"ubifsload 0x1100000 ${initrd}; " \
"bootm 0x800000 0x1100000"
"bootm 0x800000"
#define CONFIG_MTDPARTS \ "mtdparts=orion_nand:" \ "0x80000@0x0(uboot)," \ "0x20000@0x80000(uboot_env)," \
"-@0xa0000(root)\0"
"-@0xa0000(rootfs)\0"
#define CONFIG_EXTRA_ENV_SETTINGS \ "console=console=ttyS0,115200\0" \ "mtdids=nand0=orion_nand\0" \ "mtdparts="CONFIG_MTDPARTS \ "kernel=/boot/uImage\0" \
"initrd=/boot/uInitrd\0" \
"bootargs_root=ubi.mtd=2 root=ubi0:root rootfstype=ubifs\0"
"bootargs_root=noinitrd ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs\0"
/*
- Ethernet driver configuration
Currently I use the following to boot usind a dtb from the first hard drive:
bootcmd=setenv bootargs $(bootargs_console) $(bootargs_root); \ run bootcmd_ide; \ run fdt_ide; \ bootm 0x00800000 0x01100000 0x01000000; bootcmd_ide=ide reset; \ ext2load ide 0:1 0x00800000 /boot/uImage; \ ext2load ide 0:1 0x01100000 /boot/uInitrd \ fdt_ide=ext2load ide 0:1 0x01000000 /boot/kirkwood-ib62x0.dtb; \ fdt addr 0x1000000; fdt resize; fdt chosen
This leaves 8MB for the kernel which is enough for me. But this is in "works for me" state, I haven't really invested time to find out how other boards do that. I also like to set the kernel bootargs from U-Boot and not from the dtb (using fdt chosen). The mtd partitions are not passed via cmdline, but the values from the dtb are taken.
Regards, Simon

Hi Simon,
On Sat, Jul 21, 2012 at 11:40:15AM +0200, Simon Baatz wrote:
On Sat, Jul 21, 2012 at 10:30:48AM +0200, DrEagle wrote:
Hi Simon and Luka,
Le 21/07/2012 10:03, Luka Perkov a écrit :
On Fri, Jul 20, 2012 at 09:59:15PM +0200, Simon Baatz wrote:
-#define CONFIG_MACH_TYPE MACH_TYPE_NAS6210 +#define CONFIG_OF_LIBFDT
Do we need to change environment variables too? This is how I'm booting OpenWrt with linux 3.3 now:
Is it not better to have the same mtdparts as in the original stock firmware and in the next linux kernel ?
I dont want to use firmware layout that the manufacturer decided to put in stock firmware. If manufacturer invested more time making good code they would make sure to upstream their u-boot and linux code. That is why I dont see any reason to respect original firmware layout.
You both raise good points here. The mtd partitions can be and also currently are defined in the default FDT. That's probably where the kernel should get the partitions from. However, this means that we have the problem that the partitions may be defined differently in U-Boot and the kernel, which is a source of errors.
In my opinion, U-Boot should be able to get the mtd partitions from the FDT. I just had a short look, but could not find such a functionality in U-Boot nor any discussions about it.
Then we will just need small specifics distribution patch to customize the upstream uboot for the specifics boot params: In Debian, we need the initrd for raid support system bootup.
Any of these settings here can be overriden by the U-Boot configuration. Thus, there is no need to modify U-Boot itself.
I agree.
It is better to have the same partition scheme in next linux kernel and in uboot, whatever it will be. And better to be more closer from the original one, to make end-user upgrade process simpler.
As said, it would be even better to ensure this by letting U-Boot learn the partitions from the FDT.
An alternative will be to have parameters, if possible, to put uboot distribution wide compatible. May be a bootstrap call (bootscript call from uboot) or another tweak ?
diff --git a/include/configs/ib62x0.h b/include/configs/ib62x0.h index 85856f2..b1c11fd 100644 --- a/include/configs/ib62x0.h +++ b/include/configs/ib62x0.h @@ -87,25 +87,23 @@ */ #define CONFIG_BOOTCOMMAND \ "setenv bootargs ${console} ${mtdparts} ${bootargs_root}; " \
"ubi part root; " \
"ubifsmount root; " \
"ubi part rootfs; " \
"ubifsmount rootfs; " \ "ubifsload 0x800000 ${kernel}; " \
"ubifsload 0x1100000 ${initrd}; " \
"bootm 0x800000 0x1100000"
"bootm 0x800000"
#define CONFIG_MTDPARTS \ "mtdparts=orion_nand:" \ "0x80000@0x0(uboot)," \ "0x20000@0x80000(uboot_env)," \
"-@0xa0000(root)\0"
"-@0xa0000(rootfs)\0"
#define CONFIG_EXTRA_ENV_SETTINGS \ "console=console=ttyS0,115200\0" \ "mtdids=nand0=orion_nand\0" \ "mtdparts="CONFIG_MTDPARTS \ "kernel=/boot/uImage\0" \
"initrd=/boot/uInitrd\0" \
"bootargs_root=ubi.mtd=2 root=ubi0:root rootfstype=ubifs\0"
"bootargs_root=noinitrd ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs\0"
/*
- Ethernet driver configuration
Currently I use the following to boot usind a dtb from the first hard drive:
bootcmd=setenv bootargs $(bootargs_console) $(bootargs_root); \ run bootcmd_ide; \ run fdt_ide; \ bootm 0x00800000 0x01100000 0x01000000; bootcmd_ide=ide reset; \ ext2load ide 0:1 0x00800000 /boot/uImage; \ ext2load ide 0:1 0x01100000 /boot/uInitrd \ fdt_ide=ext2load ide 0:1 0x01000000 /boot/kirkwood-ib62x0.dtb; \ fdt addr 0x1000000; fdt resize; fdt chosen
This leaves 8MB for the kernel which is enough for me. But this is in "works for me" state, I haven't really invested time to find out how other boards do that. I also like to set the kernel bootargs from U-Boot and not from the dtb (using fdt chosen). The mtd partitions are not passed via cmdline, but the values from the dtb are taken.
Thank you for this. As promised I'll try to boot 3.5 next week...
Regards, Luka

On Fri, Jul 20, 2012 at 09:59:14PM +0200, Simon Baatz wrote:
The hardware design of the IB-NAS62x0 causes the SATA activity LEDs to be on when idle by default. Reverse the polarity of the activity LEDs in early init.
Signed-off-by: Simon Baatz gmbnomis@gmail.com Cc: Luka Perkov uboot@lukaperkov.net Cc: Prafulla Wadaskar prafulla@marvell.com
board/raidsonic/ib62x0/ib62x0.c | 3 +++ board/raidsonic/ib62x0/ib62x0.h | 4 ++++ 2 files changed, 7 insertions(+)
Acked-by: Luka Perkov uboot@lukaperkov.net
participants (3)
-
DrEagle
-
Luka Perkov
-
Simon Baatz