brcm63xx: use dtb board detection for HW556
authorJonas Gorski <jogo@openwrt.org>
Mon, 11 Aug 2014 11:37:14 +0000 (11:37 +0000)
committerJonas Gorski <jogo@openwrt.org>
Mon, 11 Aug 2014 11:37:14 +0000 (11:37 +0000)
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

21 files changed:
target/linux/brcm63xx/dts/hg556a-a.dts [new file with mode: 0644]
target/linux/brcm63xx/dts/hg556a-b.dts [new file with mode: 0644]
target/linux/brcm63xx/dts/hg556a-c.dts [new file with mode: 0644]
target/linux/brcm63xx/image/Makefile
target/linux/brcm63xx/patches-3.14/534-board_hw556.patch
target/linux/brcm63xx/patches-3.14/535-board_rta770w.patch
target/linux/brcm63xx/patches-3.14/536-board_fast2704.patch
target/linux/brcm63xx/patches-3.14/537-board_fast2504n.patch
target/linux/brcm63xx/patches-3.14/555-board_96318ref.patch
target/linux/brcm63xx/patches-3.14/556-board_96318ref_p300.patch
target/linux/brcm63xx/patches-3.14/557-board_bcm963269bhr.patch
target/linux/brcm63xx/patches-3.14/558-board_AR1004G.patch
target/linux/brcm63xx/patches-3.14/559-board_vw6339gu.patch
target/linux/brcm63xx/patches-3.14/560-board_963268gu_p300.patch
target/linux/brcm63xx/patches-3.14/561-board_WAP-5813n.patch
target/linux/brcm63xx/patches-3.14/562-board_VR-3025u.patch
target/linux/brcm63xx/patches-3.14/563-board_VR-3025un.patch
target/linux/brcm63xx/patches-3.14/564-board_P870HW-51a_v2.patch
target/linux/brcm63xx/patches-3.14/565-board_hw520.patch
target/linux/brcm63xx/patches-3.14/566-board_A4001N.patch
target/linux/brcm63xx/patches-3.14/567-board_dsl-2751b_e1.patch

diff --git a/target/linux/brcm63xx/dts/hg556a-a.dts b/target/linux/brcm63xx/dts/hg556a-a.dts
new file mode 100644 (file)
index 0000000..89e2698
--- /dev/null
@@ -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>;
+       };
+};
diff --git a/target/linux/brcm63xx/dts/hg556a-b.dts b/target/linux/brcm63xx/dts/hg556a-b.dts
new file mode 100644 (file)
index 0000000..855dcd1
--- /dev/null
@@ -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>;
+       };
+};
diff --git a/target/linux/brcm63xx/dts/hg556a-c.dts b/target/linux/brcm63xx/dts/hg556a-c.dts
new file mode 100644 (file)
index 0000000..43e578d
--- /dev/null
@@ -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>;
+       };
+};
index 6ce7d957f9dc3eb08bd2b985c786ad03f53d3a9a..9ee97d15a6acda9e16e2910d7efe7cab6b30c451 100755 (executable)
@@ -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))
index 0f303cae049d9720ba7bac68f251a005cf770d1b..4f1e90cec60782497926425094b6de556b5d8954 100644 (file)
@@ -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
        },
  };
  
 +};
 +static struct board_info __initdata board_HW556_A = {
 +      .name                                   = "HW556_A",
++      .of_board_id                            = "huawei,hg556a-a",
 +      .expected_cpu_id                        = 0x6358,
 +
 +      .has_uart0                              = 1,
 +};
 +static struct board_info __initdata board_HW556_B = {
 +      .name                                   = "HW556_B",
++      .of_board_id                            = "huawei,hg556a-b",
 +      .expected_cpu_id                        = 0x6358,
 +
 +      .has_uart0                              = 1,
 +};
 +static struct board_info __initdata board_HW556_C = {
 +      .name                                   = "HW556_C",
++      .of_board_id                            = "huawei,hg556a-c",
 +      .expected_cpu_id                        = 0x6358,
 +
 +      .has_uart0                              = 1,
   /* 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,
        &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(
index 77350e20e1addde2b3f1a8b4c3475aef297bcb99..5a60a6ab58597c5c7447cad3ab277a2d00a71ac8 100644 (file)
@@ -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,
index cd23a2faeae522bd3b36aa869590ff14eef3de5b..98de734d8f10ae125cbfa4883ba223a8459a67da 100644 (file)
@@ -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,
index 70def81927088ca6f59addc704be263c66012768..172cc6faae9edbe0ee9a41bf8778628d834498c0 100644 (file)
@@ -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,
index de927de0d6dc15d00d5e1e02c8ab271e17e28168..2fe1ceb96bd2f5319a1e6bd76ccb99ae21c83c3f 100644 (file)
@@ -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
index 0bd0742682a9fe8800975df83291c8e6f70e1a14..94823f28feff6fc82609b38ae21e66520a1ea82e 100644 (file)
@@ -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,
index 278c4dc7f97022096976bfcfc968d6348c85fdd3..e7a2f82bb18fa54659011e447b26e2d59521c59a 100644 (file)
@@ -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
index 9e6f320a7e5fb214f41d17d37d620602a8b0574b..c52212a2f1874c48d8f9200657427e611a466263 100644 (file)
@@ -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,
index 66f6eb6085b7eed0d050ca443af10f8ed15021a3..272ee5acd596ddc455bcd0efaad8824372c7f803 100644 (file)
@@ -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
                },
        },
  };
  #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,
index e1ca64630c98a792aa21fb30d70ac457c5feb529..65c8add37f8258a8f7ce5485ee36858178b4c130 100644 (file)
@@ -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
  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
index f5cc1ad81778015c0802ec78201138db4d872409..87c00698ee292fa0ab5bf3902793f4af5956705b 100644 (file)
@@ -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,
  };
  #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,
index c072d0b83bb954a2b79b23be4f140e7541aa5a4b..2799f2277db2f56cc9658ef27f72505cb17a5a55 100644 (file)
@@ -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,
  };
  
  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,
index 5cdcc12a06d044220b43fe5d9ba1cd0fec98b95a..286ae62f363f04a15cae00e29102d6f553e52c5e 100644 (file)
@@ -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
        },
  };
  
  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,
index 652c2b28dda0c8f336a441588a2f1ced74887fdb..9b770cf1fe8a5c3639a243f70f2830993601497b 100644 (file)
@@ -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,
index 1e026638dace4329842e643f3032edf0107b07ab..e035f39d538899e64f44c0b2471e9628e68e7cc7 100644 (file)
@@ -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,
index d7eb88be6f2452bd4dac27cdf107832b7eed2937..3369b5256fafd9d60db55441a09b8164ed46c77b 100644 (file)
@@ -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,
index a72edbc013014e4dd2c066abfb8cf2ecb900071f..13fa11df08e96a85333dea303441f28d0b9280c0 100644 (file)
  #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,