Skip to contentSkip to conversation

kirkwood: ib62x0: Invert SATA activity LEDs

PATCH New Simon Baatz 3 participants 7 messages Jul 20, 2012 – Jul 21, 2012

lore
Share & tools
lore
#0 lore raw

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.

Cc Luka Perkov <[email protected]>
Cc Prafulla Wadaskar <[email protected]>
---
 board/raidsonic/ib62x0/ib62x0.c |    3 +++
 board/raidsonic/ib62x0/ib62x0.h |    4 ++++
 2 files changed, 7 insertions(+)
board/raidsonic/ib62x0/ib62x0.c +3 -0
index 1164d6b..b7e6e41 100644
@@ -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,
board/raidsonic/ib62x0/ib62x0.h +4 -0
index 0c30690..0118c2b 100644
@@ -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 */
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 2/2 kirkwood: ib62x0: Support flattened devicetree

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.

Cc Luka Perkov <[email protected]>
Cc Prafulla Wadaskar <[email protected]>
---
 include/configs/ib62x0.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/configs/ib62x0.h +2 -2
index 85856f2..34c83a4 100644
@@ -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
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 2/2 kirkwood: ib62x0: Support flattened devicetree

Quoted 16 lines · Simon Baatz

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.

Cc Luka Perkov <[email protected]>
Cc Prafulla Wadaskar <[email protected]>
---
 include/configs/ib62x0.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/configs/ib62x0.h +0 -0
index 85856f2..34c83a4 100644

include/configs/ib62x0.h line 42

Quoted 8 lines
include/configs/ib62x0.h +2 -2
@@ -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:

include/configs/ib62x0.h +5 -7
index 85856f2..b1c11fd 100644
@@ -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 at 0x0(uboot),"                   \
        "0x20000 at 0x80000(uboot_env),"           \
-       "- at 0xa0000(root)\0"
+       "- at 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

#3 lore raw

PATCH 2/2 kirkwood: ib62x0: Support flattened devicetree

Hi Simon and Luka,

Le 21/07/2012 10:03, Luka Perkov a ?crit :

Quoted 19 lines · Simon Baatz
Quoted 18 lines

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.

Cc Luka Perkov <[email protected]>
Cc Prafulla Wadaskar <[email protected]>
---
 include/configs/ib62x0.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/configs/ib62x0.h +0 -0
index 85856f2..34c83a4 100644
@@ -37,9 +37,9 @@
 #define CONFIG_SKIP_LOWLEVEL_INIT	/* disable board lowlevel_init */
 
Quoted 9 lines

include/configs/ib62x0.h line 42

Quoted 6 lines
include/configs/ib62x0.h +2 -2
 /*
- * 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 ?

Quoted 36 lines
include/configs/ib62x0.h +5 -7
index 85856f2..b1c11fd 100644
@@ -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 at 0x0(uboot),"                   \
        "0x20000 at 0x80000(uboot_env),"           \
-       "- at 0xa0000(root)\0"
+       "- at 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
Quoted 2 lines

Regards,
Luka

Regards,
DrEagle

#4 lore raw

PATCH 2/2 kirkwood: ib62x0: Support flattened devicetree

Hi Gerald and Luka,

Quoted 4 lines · DrEagle

Hi Simon and Luka,

Le 21/07/2012 10:03, Luka Perkov a ?crit :

Quoted 1 line · Simon Baatz
Quoted 8 lines
Quoted 5 lines

Review

Quoted 2 lines
(quoted diff) +1 -1
-#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.

Quoted 3 lines

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.

Quoted 4 lines

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.

Quoted 38 lines

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 ?

Quoted 33 lines
include/configs/ib62x0.h +5 -7
index 85856f2..b1c11fd 100644
@@ -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 at 0x0(uboot),"                   \
        "0x20000 at 0x80000(uboot_env),"           \
-       "- at 0xa0000(root)\0"
+       "- at 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"
 
Quoted 3 lines

include/configs/ib62x0.h line 109

Quoted 3 lines
include/configs/ib62x0.h +0 -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

#5 lore raw

PATCH 2/2 kirkwood: ib62x0: Support flattened devicetree

Hi Simon,

Quoted 5 lines · Simon Baatz
Quoted 4 lines · DrEagle

Hi Simon and Luka,

Le 21/07/2012 10:03, Luka Perkov a ?crit :

Quoted 1 line · Simon Baatz
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines

Review

Quoted 2 lines
(quoted diff) +1 -1
-#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.

Quoted 10 lines

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.

Quoted 6 lines
Quoted 3 lines

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.

Quoted 62 lines
Quoted 4 lines

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.

Quoted 37 lines

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 ?

Quoted 33 lines
include/configs/ib62x0.h +5 -7
index 85856f2..b1c11fd 100644
@@ -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 at 0x0(uboot),"                   \
        "0x20000 at 0x80000(uboot_env),"           \
-       "- at 0xa0000(root)\0"
+       "- at 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"
 
Quoted 3 lines

include/configs/ib62x0.h line 109

Quoted 3 lines
include/configs/ib62x0.h +0 -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                                                       
Quoted 5 lines

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

#6 lore raw

PATCH 1/2 kirkwood: ib62x0: Invert SATA activity LEDs

In reply to Simon Baatz
Quoted 11 lines · Simon Baatz

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.

Cc Luka Perkov <[email protected]>
Cc Prafulla Wadaskar <[email protected]>
---
 board/raidsonic/ib62x0/ib62x0.c |    3 +++
 board/raidsonic/ib62x0/ib62x0.h |    4 ++++
 2 files changed, 7 insertions(+)