From 2f09960e46f4f308a764ce04e4a466ab2ee06aa2 Mon Sep 17 00:00:00 2001
From: Jonas Gorski <jogo@openwrt.org>
Date: Thu, 21 Aug 2014 11:28:46 +0000
Subject: [PATCH] brcm63xx: Add DT support for HG520v
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
[jogo: fix nvram partition offset]
Signed-off-by: Jonas Gorski <jogo@openwrt.org>

SVN-Revision: 42246
---
 target/linux/brcm63xx/dts/hg520v.dts          | 30 +++++++++++++++++++
 target/linux/brcm63xx/image/Makefile          |  5 ++--
 .../patches-3.14/565-board_hw520.patch        |  5 ++--
 .../patches-3.14/566-board_A4001N.patch       |  2 +-
 .../patches-3.14/567-board_dsl-2751b_e1.patch |  2 +-
 target/linux/brcm63xx/profiles/huawei.mk      |  9 ++++++
 6 files changed, 46 insertions(+), 7 deletions(-)
 create mode 100644 target/linux/brcm63xx/dts/hg520v.dts

diff --git a/target/linux/brcm63xx/dts/hg520v.dts b/target/linux/brcm63xx/dts/hg520v.dts
new file mode 100644
index 0000000000..bc8af33cc3
--- /dev/null
+++ b/target/linux/brcm63xx/dts/hg520v.dts
@@ -0,0 +1,30 @@
+/dts-v1/;
+
+/include/ "bcm6358.dtsi"
+
+/ {
+	model = "Huawei EchoLife HG520v";
+	compatible = "huawei,hg520v", "brcm,bcm6358";
+};
+
+&pflash {
+	status = "ok";
+
+	linux,part-probe = "bcm63xxpart";
+
+	cfe@0 {
+		label = "CFE";
+		reg = <0x000000 0x010000>;
+		read-only;
+	};
+
+	linux@10000 {
+		label = "linux";
+		reg = <0x010000 0x3e0000>;
+	};
+
+	nvram@3f0000 {
+		label = "nvram";
+		reg = <0x3f0000 0x010000>;
+	};
+};
diff --git a/target/linux/brcm63xx/image/Makefile b/target/linux/brcm63xx/image/Makefile
index 009c34e8fb..5b3e06c0db 100755
--- a/target/linux/brcm63xx/image/Makefile
+++ b/target/linux/brcm63xx/image/Makefile
@@ -316,9 +316,6 @@ define Image/Build
 	# Telsey CPVA642-type (e.g. CPA-ZNTE60T)
 	$(call Image/Build/CFE,$(1),CPVA642,6358,CPA-ZNTE60T,,--signature "Telsey Tlc",--signature2 "99.99.999",--second-image-flag "0")
 
-	# Huawei HW520
-	$(call Image/Build/CFE,$(1),HW6358GW_B,6358,HW520,EchoLife_HG520v)
-
 	#HW553
 	$(call Image/Build/CFEHW553,$(1),HW553,6358,0x20000,HW553)
 
@@ -369,6 +366,8 @@ $(eval $(call CfeImageDTB,DSL274XB_C,dsl-274xb-c,96358GW,6358,DSL274XB-C2))
 $(eval $(call CfeImageDTB,DSL274XB_C,dsl-274xb-c,AW4139,6358,DSL274XB-C3))
 # D-Link DVA-G3810BN/TL
 $(eval $(call CfeImageDTB,DVAG3810BN,dva-g3810bn_tl,96358VW,6358,DVAG3810BN))
+# Huawei HG520v
+$(eval $(call CfeImageDTB,HG520v,hg520v,HW6358GW_B,6358,HG520v,EchoLife_HG520v))
 # Huawei HG556a
 $(eval $(call CfeImageDTB,HG556a_AB,hg556a-a,HW556,6358,HG556a_A,EchoLife_HG556a,--image-offset 0x20000 --block-size 0x10000 --tag-version 8))
 $(eval $(call CfeImageDTB,HG556a_AB,hg556a-b,HW556,6358,HG556a_B,EchoLife_HG556a,--image-offset 0x20000 --block-size 0x20000 --tag-version 8))
diff --git a/target/linux/brcm63xx/patches-3.14/565-board_hw520.patch b/target/linux/brcm63xx/patches-3.14/565-board_hw520.patch
index eb90bcc1c8..eb59a404aa 100644
--- a/target/linux/brcm63xx/patches-3.14/565-board_hw520.patch
+++ b/target/linux/brcm63xx/patches-3.14/565-board_hw520.patch
@@ -1,11 +1,12 @@
 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
-@@ -3226,6 +3226,56 @@ static struct board_info __initdata boar
+@@ -3226,6 +3226,57 @@ static struct board_info __initdata boar
  	.num_spis = ARRAY_SIZE(ct6373_spi_devices),
  };
  
 +static struct board_info __initdata board_HW520 = {
 +	.name				= "HW6358GW_B",
++	.of_board_id			= "huawei,hg520v",
 +	.expected_cpu_id		= 0x6358,
 +
 +	.has_uart0			= 1,
@@ -57,7 +58,7 @@
  static struct board_info __initdata board_HW553 = {
  	.name                           = "HW553",
  	.expected_cpu_id                = 0x6358,
-@@ -4956,6 +5006,7 @@ static const struct board_info __initcon
+@@ -4956,6 +5007,7 @@ static const struct board_info __initcon
  	&board_nb4_ser_r0,
  	&board_nb4_fxc_r1,
  	&board_ct6373_1,
diff --git a/target/linux/brcm63xx/patches-3.14/566-board_A4001N.patch b/target/linux/brcm63xx/patches-3.14/566-board_A4001N.patch
index ed5aa03c3e..7846aeff82 100644
--- a/target/linux/brcm63xx/patches-3.14/566-board_A4001N.patch
+++ b/target/linux/brcm63xx/patches-3.14/566-board_A4001N.patch
@@ -97,7 +97,7 @@
  static struct board_info __initdata board_A4001N1 = {
  	.name					= "963281T_TEF",
  	.of_board_id			= "adb,a4001n1",
-@@ -4957,6 +5047,7 @@ static const struct board_info __initcon
+@@ -4958,6 +5048,7 @@ static const struct board_info __initcon
  	&board_AR5381u,
  	&board_AR5387un,
  	&board_963281TAN,
diff --git a/target/linux/brcm63xx/patches-3.14/567-board_dsl-2751b_e1.patch b/target/linux/brcm63xx/patches-3.14/567-board_dsl-2751b_e1.patch
index 6cc28eada4..706142ddd7 100644
--- a/target/linux/brcm63xx/patches-3.14/567-board_dsl-2751b_e1.patch
+++ b/target/linux/brcm63xx/patches-3.14/567-board_dsl-2751b_e1.patch
@@ -142,7 +142,7 @@
  #endif /* CONFIG_BCM63XX_CPU_6318 */
  
  /*
-@@ -5041,6 +5176,7 @@ static const struct board_info __initcon
+@@ -5042,6 +5177,7 @@ static const struct board_info __initcon
  #ifdef CONFIG_BCM63XX_CPU_6318
  	&board_96318ref,
  	&board_96318ref_p300,
diff --git a/target/linux/brcm63xx/profiles/huawei.mk b/target/linux/brcm63xx/profiles/huawei.mk
index b0775c1343..1014884143 100644
--- a/target/linux/brcm63xx/profiles/huawei.mk
+++ b/target/linux/brcm63xx/profiles/huawei.mk
@@ -5,6 +5,15 @@
 # See /LICENSE for more information.
 #
 
+define Profile/HG520v
+  NAME:=Huawei EchoLife HG520v
+  PACKAGES:=kmod-b43 wpad-mini
+endef
+define Profile/HG520v/Description
+  Package set optimized for Huawei HG520v.
+endef
+$(eval $(call Profile,HG520v))
+
 define Profile/HG556a_AB
   NAME:=Huawei EchoLife HG556a (version A/B - Atheros)
   PACKAGES:=kmod-ath9k wpad-mini \
-- 
GitLab