brcm63xx: use dtb board detection for HW556

This requires individual images for each board version for now.
Linux partition was shrunk to ensure writing thewrong image won't
erase wifi calibration data.

Signed-off-by: Jonas Gorski <jogo@openwrt.org>

SVN-Revision: 42126
v19.07.3_mercusys_ac12_duma
Jonas Gorski 10 years ago
parent 0aa242fe20
commit 52b0935efe

@ -0,0 +1,36 @@
/dts-v1/;
/include/ "bcm6358.dtsi"
/ {
model = "Huawei EchoLife HG556a (version A)";
compatible = "huawei,hg556a-a", "brcm,bcm6358";
};
&pflash {
status = "ok";
linux,part-probe = "bcm63xxpart";
cfe@0 {
label = "CFE";
reg = <0x000000 0x020000>;
read-only;
};
linux@20000 {
label = "linux";
reg = <0x020000 0xec0000>;
};
caldata@ee0000 {
label = "caldata";
reg = <0xee0000 0x100000>;
read-only;
};
nvram@fe0000 {
label = "nvram";
reg = <0xfe0000 0x020000>;
};
};

@ -0,0 +1,36 @@
/dts-v1/;
/include/ "bcm6358.dtsi"
/ {
model = "Huawei EchoLife HG556a (version B)";
compatible = "huawei,hg556a-b", "brcm,bcm6358";
};
&pflash {
status = "ok";
linux,part-probe = "bcm63xxpart";
cfe@0 {
label = "CFE";
reg = <0x000000 0x020000>;
read-only;
};
linux@20000 {
label = "linux";
reg = <0x020000 0xec0000>;
};
caldata@ee0000 {
label = "caldata";
reg = <0xee0000 0x100000>;
read-only;
};
nvram@fe0000 {
label = "nvram";
reg = <0xfe0000 0x020000>;
};
};

@ -0,0 +1,36 @@
/dts-v1/;
/include/ "bcm6358.dtsi"
/ {
model = "Huawei EchoLife HG556a (version C)";
compatible = "huawei,hg556a-c", "brcm,bcm6358";
};
&pflash {
status = "ok";
linux,part-probe = "bcm63xxpart";
cfe@0 {
label = "CFE";
reg = <0x000000 0x020000>;
read-only;
};
linux@20000 {
label = "linux";
reg = <0x020000 0xec0000>;
};
caldata@ee0000 {
label = "caldata";
reg = <0xee0000 0x100000>;
read-only;
};
nvram@fe0000 {
label = "nvram";
reg = <0xfe0000 0x020000>;
};
};

@ -74,15 +74,6 @@ define Image/Build/CFEHW553
--block-size 0x20000 --image-offset $(4)
endef
define Image/Build/CFEHW556
# Generate the tagged image
$(STAGING_DIR_HOST)/bin/imagetag -i $(KDIR)/vmlinux.lzma.cfe -f $(KDIR)/root.$(1) \
--output $(BIN_DIR)/openwrt-$(2)-$(1)-cfe.bin \
--boardid $(2) --chipid $(3) --entry $(LOADADDR) \
--load-addr $(LOADADDR) --tag-version 8 --rsa-signature "$(5)" \
--image-offset $(4) --info1 "$(6)" --block-size 0x20000
endef
define Image/Build/CFEAGPF
# Generate the tagged image
$(STAGING_DIR_HOST)/bin/imagetag -i $(KDIR)/vmlinux.lzma.cfe -f $(KDIR)/root.$(1) \
@ -229,6 +220,16 @@ define CfeImageDTB
TARGET_IMAGES += $(4)
endef
define HW556ImageDTB
define Image/Build/$(2)
$$(call Image/Build/CFEDTB,$$(1),$(1),HW556,6358,$(2),EchoLife_HG556a,--image-offset 0x20000 --block-size 0x20000 --tag-version 8)
endef
TARGET_DTBS += $(1)
TARGET_IMAGES += $(2)
endef
define Image/Build
dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=128k conv=sync
# Various routers
@ -351,9 +352,6 @@ define Image/Build
#HW553
$(call Image/Build/CFEHW553,$(1),HW553,6358,0x20000,HW553)
#HW556
$(call Image/Build/CFEHW556,$(1),HW556,6358,0x20000,EchoLife_HG556a,OpenWRT-$(REVISION))
# T-Com Speedport W 303V Typ B
$(call Image/Build/SPW303V,$(1),96358-502V,6358,SPW303V)
@ -388,5 +386,9 @@ $(eval $(call CfeImageDTB,dsl-274xb-c,96358GW,6358,DSL274XB-C2))
$(eval $(call CfeImageDTB,dsl-274xb-c,AW4139,6358,DSL274XB-C3))
# D-Link DVA-G3810BN/TL
$(eval $(call CfeImageDTB,dva-g3810bn_tl,96358VW,6358,DVAG3810BN))
# Huawei HW556
$(eval $(call HW556ImageDTB,hg556a-a,HW556-A))
$(eval $(call HW556ImageDTB,hg556a-b,HW556-B))
$(eval $(call HW556ImageDTB,hg556a-c,HW556-C))
$(eval $(call BuildImage))

@ -8,7 +8,7 @@
#include <linux/platform_device.h>
#include <linux/spi/spi.h>
#include <linux/spi/spi_gpio.h>
@@ -3006,6 +3007,492 @@ static struct board_info __initdata boar
@@ -3006,6 +3007,495 @@ static struct board_info __initdata boar
},
};
@ -104,6 +104,7 @@
+};
+static struct board_info __initdata board_HW556_A = {
+ .name = "HW556_A",
+ .of_board_id = "huawei,hg556a-a",
+ .expected_cpu_id = 0x6358,
+
+ .has_uart0 = 1,
@ -231,6 +232,7 @@
+};
+static struct board_info __initdata board_HW556_B = {
+ .name = "HW556_B",
+ .of_board_id = "huawei,hg556a-b",
+ .expected_cpu_id = 0x6358,
+
+ .has_uart0 = 1,
@ -365,6 +367,7 @@
+};
+static struct board_info __initdata board_HW556_C = {
+ .name = "HW556_C",
+ .of_board_id = "huawei,hg556a-c",
+ .expected_cpu_id = 0x6358,
+
+ .has_uart0 = 1,
@ -501,7 +504,7 @@
/* T-Home Speedport W 303V Typ B */
static struct board_info __initdata board_spw303v = {
.name = "96358-502V",
@@ -3446,6 +3933,10 @@ static const struct board_info __initcon
@@ -3446,6 +3936,10 @@ static const struct board_info __initcon
&board_nb4_fxc_r2,
&board_ct6373_1,
&board_HW553,
@ -512,51 +515,6 @@
&board_spw303v,
&board_DVAG3810BN,
#endif
@@ -3465,13 +3956,37 @@ static void __init boardid_fixup(u8 *boo
struct bcm_tag *tag = (struct bcm_tag *)(boot_addr + CFE_OFFSET_64K);
char *board_name = (char *)bcm63xx_nvram_get_name();
- if (BCMCPU_IS_6358() && (!strcmp(board_name, "96358VW"))) {
- u8 *p = boot_addr + NB4_PID_OFFSET;
-
- /* Extract nb4 PID */
- if (!memcmp(p, "NB4-", 4)) {
- memcpy(board_name, p, sizeof("NB4-XXX-rX"));
- return;
+ if (BCMCPU_IS_6358()) {
+ if (!strcmp(board_name, "96358VW")) {
+ u8 *p = boot_addr + NB4_PID_OFFSET;
+
+ /* Extract nb4 PID */
+ if (!memcmp(p, "NB4-", 4)) {
+ memcpy(board_name, p, sizeof("NB4-XXX-rX"));
+ return;
+ }
+ } else if (!strcmp(board_name, "HW556")) {
+ /*
+ * HW556 has different wlan caldatas depending on
+ * hardware version.
+ * Detect hardware version and change board id
+ */
+ u8 cal_data_ath9k[4] = { 0xa5, 0x5a, 0, 0 };
+ u8 cal_data_rt3062[4] = { 0x62, 0x30, 1, 0 };
+
+ if (!memcmp(boot_addr + 0xeffe00,
+ &cal_data_rt3062, 4)) {
+ /* Ralink 0xeffe00 */
+ memcpy(board_name, "HW556_A", 7);
+ } else if (!memcmp(boot_addr + 0xf7e000,
+ &cal_data_ath9k, 4)) {
+ /* Atheros 0xf7e000 */
+ memcpy(board_name, "HW556_B", 7);
+ } else if (!memcmp(boot_addr + 0xefe000,
+ &cal_data_ath9k, 4)) {
+ /* Atheros 0xefe000 */
+ memcpy(board_name, "HW556_C", 7);
+ }
}
}
--- a/drivers/mtd/bcm63xxpart.c
+++ b/drivers/mtd/bcm63xxpart.c
@@ -224,6 +224,11 @@ static int bcm63xx_parse_cfe_partitions(

@ -61,7 +61,7 @@
#endif /* CONFIG_BCM63XX_CPU_6345 */
/*
@@ -3895,6 +3949,7 @@ static const struct board_info __initcon
@@ -3898,6 +3952,7 @@ static const struct board_info __initcon
#ifdef CONFIG_BCM63XX_CPU_6345
&board_96345gw2,
&board_rta770bw,

@ -135,7 +135,7 @@ Signed-off-by: Marcin Jurkowski <marcin1j@gmail.com>
#endif /* CONFIG_BCM63XX_CPU_6328 */
/*
@@ -3939,6 +4055,7 @@ static const struct board_info __initcon
@@ -3942,6 +4058,7 @@ static const struct board_info __initcon
&board_963281TAN,
&board_A4001N1,
&board_dsl_274xb_f1,

@ -6,7 +6,7 @@ Signed-off-by: Max Staudt <openwrt.max@enpas.org>
---
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
@@ -3894,6 +3894,96 @@ static struct board_info __initdata boar
@@ -3897,6 +3897,96 @@ static struct board_info __initdata boar
.devs = nb6_devices,
.num_devs = ARRAY_SIZE(nb6_devices),
};
@ -103,7 +103,7 @@ Signed-off-by: Max Staudt <openwrt.max@enpas.org>
#endif /* CONFIG_BCM63XX_CPU_6362 */
/*
@@ -4115,6 +4205,7 @@ static const struct board_info __initcon
@@ -4118,6 +4208,7 @@ static const struct board_info __initcon
#ifdef CONFIG_BCM63XX_CPU_6362
&board_nb6,

@ -94,7 +94,7 @@
* known 6328 boards
*/
#ifdef CONFIG_BCM63XX_CPU_6328
@@ -4369,6 +4456,9 @@ static const struct board_info __initcon
@@ -4372,6 +4459,9 @@ static const struct board_info __initcon
#ifdef CONFIG_BCM63XX_CPU_3368
&board_cvg834g,
#endif

@ -95,7 +95,7 @@
#endif /* CONFIG_BCM63XX_CPU_6318 */
/*
@@ -4458,6 +4546,7 @@ static const struct board_info __initcon
@@ -4461,6 +4549,7 @@ static const struct board_info __initcon
#endif
#ifdef CONFIG_BCM63XX_CPU_6318
&board_96318ref,

@ -1,6 +1,6 @@
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
@@ -4538,6 +4538,75 @@ static struct board_info __initdata boar
@@ -4541,6 +4541,75 @@ static struct board_info __initdata boar
#endif /* CONFIG_BCM63XX_CPU_6368 */
/*
@ -76,7 +76,7 @@
* all boards
*/
static const struct board_info __initconst *bcm963xx_boards[] = {
@@ -4622,6 +4691,9 @@ static const struct board_info __initcon
@@ -4625,6 +4694,9 @@ static const struct board_info __initcon
&board_96368mvwg,
&board_96368mvngr,
#endif

@ -61,7 +61,7 @@ Signed-off-by: Adrian Feliks <mexit@o2.pl>
/* BT Voyager 2110 */
static struct board_info __initdata board_V2110 = {
@@ -4658,6 +4704,7 @@ static const struct board_info __initcon
@@ -4661,6 +4707,7 @@ static const struct board_info __initcon
&board_96348A_122,
&board_CPVA502plus,
&board_96348W3,

@ -1,6 +1,6 @@
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
@@ -4650,6 +4650,108 @@ static struct board_info __initdata boar
@@ -4653,6 +4653,108 @@ static struct board_info __initdata boar
},
},
};
@ -109,7 +109,7 @@
#endif /* CONFIG_BCM63XX_CPU_63268 */
/*
@@ -4740,6 +4842,7 @@ static const struct board_info __initcon
@@ -4743,6 +4845,7 @@ static const struct board_info __initcon
#endif
#ifdef CONFIG_BCM63XX_CPU_63268
&board_963269bhr,

@ -1,6 +1,6 @@
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
@@ -4587,6 +4587,131 @@ static struct board_info __initdata boar
@@ -4590,6 +4590,131 @@ static struct board_info __initdata boar
* known 63268/63269 boards
*/
#ifdef CONFIG_BCM63XX_CPU_63268
@ -132,7 +132,7 @@
static struct board_info __initdata board_963269bhr = {
.name = "963269BHR",
.expected_cpu_id = 0x63268,
@@ -4841,6 +4966,7 @@ static const struct board_info __initcon
@@ -4844,6 +4969,7 @@ static const struct board_info __initcon
&board_96368mvngr,
#endif
#ifdef CONFIG_BCM63XX_CPU_63268

@ -8,7 +8,7 @@
#include <linux/platform_device.h>
#include <linux/spi/spi.h>
#include <linux/spi/spi_gpio.h>
@@ -4581,6 +4582,117 @@ static struct board_info __initdata boar
@@ -4584,6 +4585,117 @@ static struct board_info __initdata boar
.has_ohci0 = 1,
.has_ehci0 = 1,
};
@ -126,7 +126,7 @@
#endif /* CONFIG_BCM63XX_CPU_6368 */
/*
@@ -4964,6 +5076,7 @@ static const struct board_info __initcon
@@ -4967,6 +5079,7 @@ static const struct board_info __initcon
#ifdef CONFIG_BCM63XX_CPU_6368
&board_96368mvwg,
&board_96368mvngr,

@ -1,6 +1,6 @@
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
@@ -4583,6 +4583,116 @@ static struct board_info __initdata boar
@@ -4586,6 +4586,116 @@ static struct board_info __initdata boar
.has_ehci0 = 1,
};
@ -117,7 +117,7 @@
static struct b53_platform_data WAP5813n_b53_pdata = {
.alias = "eth0",
};
@@ -5076,6 +5186,7 @@ static const struct board_info __initcon
@@ -5079,6 +5189,7 @@ static const struct board_info __initcon
#ifdef CONFIG_BCM63XX_CPU_6368
&board_96368mvwg,
&board_96368mvngr,

@ -1,6 +1,6 @@
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
@@ -4693,6 +4693,116 @@ static struct board_info __initdata boar
@@ -4696,6 +4696,116 @@ static struct board_info __initdata boar
},
};
@ -117,7 +117,7 @@
static struct b53_platform_data WAP5813n_b53_pdata = {
.alias = "eth0",
};
@@ -5187,6 +5297,7 @@ static const struct board_info __initcon
@@ -5190,6 +5300,7 @@ static const struct board_info __initcon
&board_96368mvwg,
&board_96368mvngr,
&board_VR3025u,

@ -1,6 +1,6 @@
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
@@ -4592,6 +4592,96 @@ static struct sprom_fixup __initdata vr3
@@ -4595,6 +4595,96 @@ static struct sprom_fixup __initdata vr3
{ .offset = 115, .value = 0xfad9 },
};
@ -97,7 +97,7 @@
static struct board_info __initdata board_VR3025u = {
.name = "96368M-1541N",
.expected_cpu_id = 0x6368,
@@ -5296,6 +5386,7 @@ static const struct board_info __initcon
@@ -5299,6 +5389,7 @@ static const struct board_info __initcon
#ifdef CONFIG_BCM63XX_CPU_6368
&board_96368mvwg,
&board_96368mvngr,

@ -57,7 +57,7 @@
static struct board_info __initdata board_HW553 = {
.name = "HW553",
.expected_cpu_id = 0x6358,
@@ -5369,6 +5419,7 @@ static const struct board_info __initcon
@@ -5372,6 +5422,7 @@ static const struct board_info __initcon
&board_nb4_fxc_r1,
&board_nb4_fxc_r2,
&board_ct6373_1,

@ -96,7 +96,7 @@
static struct board_info __initdata board_A4001N1 = {
.name = "963281T_TEF",
.expected_cpu_id = 0x6328,
@@ -5367,6 +5456,7 @@ static const struct board_info __initcon
@@ -5370,6 +5459,7 @@ static const struct board_info __initcon
&board_AR5381u,
&board_AR5387un,
&board_963281TAN,

@ -142,7 +142,7 @@
#endif /* CONFIG_BCM63XX_CPU_6318 */
/*
@@ -5450,6 +5585,7 @@ static const struct board_info __initcon
@@ -5453,6 +5588,7 @@ static const struct board_info __initcon
#ifdef CONFIG_BCM63XX_CPU_6318
&board_96318ref,
&board_96318ref_p300,

Loading…
Cancel
Save