[OpenWrt-Devel] [PATCH] bcm63xx: Add board id override fixup.

Jonas Gorski jonas.gorski+openwrt at gmail.com
Mon Jun 21 18:35:29 CEST 2010


Add a fixup for the kernel to check the bcm tag of the image for a board id in the
information1 field, and use that instead of the supplied one by cfe.

Signed-off-by: Jonas Gorski <jonas.gorski+openwrt at gmail.com>
---
 .../patches-2.6.32/270-generic_boardid_fixup.patch |   42 ++++++++++++++++++++
 1 files changed, 42 insertions(+), 0 deletions(-)
 create mode 100644 target/linux/brcm63xx/patches-2.6.32/270-generic_boardid_fixup.patch

diff --git a/target/linux/brcm63xx/patches-2.6.32/270-generic_boardid_fixup.patch b/target/linux/brcm63xx/patches-2.6.32/270-generic_boardid_fixup.patch
new file mode 100644
index 0000000..87a0136
--- /dev/null
+++ b/target/linux/brcm63xx/patches-2.6.32/270-generic_boardid_fixup.patch
@@ -0,0 +1,42 @@
+--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
++++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
+@@ -41,6 +41,12 @@
+ #define NEUFBOX4_GPIO_74HC164_CLK	6
+ #define NXP_74HC64_GPIO(X)		(NEUFBOX4_EXP_GPIO_BASE + (X))
+ 
++#define TAG_INFO1_OFFSET		0xa2
++#define TAG_BOARD_MAGIC			"BRD="
++#define TAG_MAGIC_LEN			4
++#define CFE_OFFSET_64K			0x10000
++#define CFE_OFFSET_128K			0x20000
++
+ static struct bcm963xx_nvram nvram;
+ static unsigned int mac_addr_used;
+ static struct board_info board;
+@@ -1254,6 +1260,16 @@ static void __init neufbox4_nvram_fixup(
+ 	}
+ }
+ 
++static void __init boardid_fixup(u8 *boot_addr)
++{
++	u8 *p = boot_addr + TAG_INFO1_OFFSET;
++
++	if (!memcmp(p + CFE_OFFSET_64K, TAG_BOARD_MAGIC, TAG_MAGIC_LEN))
++		memcpy(nvram.name, p + CFE_OFFSET_64K + TAG_MAGIC_LEN, sizeof(nvram.name));
++	else if (!memcmp(p + CFE_OFFSET_128K, TAG_BOARD_MAGIC, TAG_MAGIC_LEN))
++		memcpy(nvram.name, p + CFE_OFFSET_128K + TAG_MAGIC_LEN, sizeof(nvram.name));
++}
++
+ /*
+  * early init callback, read nvram data from flash and checksum it
+  */
+@@ -1304,6 +1320,9 @@ void __init board_prom_init(void)
+ 	/* Fixup broken neufbox4 board name */
+ 	neufbox4_nvram_fixup();
+ 
++	/* fixup board id */
++	boardid_fixup(boot_addr);
++
+ 	/* find board by name */
+ 	for (i = 0; i < ARRAY_SIZE(bcm963xx_boards); i++) {
+ 		if (strncmp(nvram.name, bcm963xx_boards[i]->name,
-- 
1.5.6.5



More information about the openwrt-devel mailing list