[OpenWrt-Devel] [PATCH] brcm63xx: Add Huawei HG655b support

dani dgcbueu at gmail.com
Sat May 9 06:37:30 EDT 2015


This patch adds support for the Huawei HG655b.

Nothing much special in this router, it's just another BCM6368 with
a Ralink RT3062 wifi chip and the calibration data embedded in the 
main flash chip at offset 0x7c0000. There is also configuration data
used by the OEM firmware before the cal_data partition, this area is
protected by the board_data partition in this patch.

Signed-off-by: Daniel Gonzalez <dgcbueu at gmail.com>
diff --git a/target/linux/brcm63xx/base-files/etc/diag.sh b/target/linux/brcm63xx/base-files/etc/diag.sh
index 03d98b9..c330674 100644
--- a/target/linux/brcm63xx/base-files/etc/diag.sh
+++ b/target/linux/brcm63xx/base-files/etc/diag.sh
@@ -89,6 +89,9 @@ set_state() {
 	hg520)
 		status_led="HW520:green:net"
 		;;
+	hg655b)
+		status_led="HW65x:green:power"
+		;;
 	p870hw-51a_v2)
 		status_led="P870HW-51a:green:power"
 		;;
diff --git a/target/linux/brcm63xx/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom b/target/linux/brcm63xx/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom
index 9a324ea..4347485 100644
--- a/target/linux/brcm63xx/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom
+++ b/target/linux/brcm63xx/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom
@@ -34,6 +34,9 @@ case "$FIRMWARE" in
 	hg556a_c)
 		rt2x00_eeprom_extract "cal_data" 130560 512
 		;;
+	hg655b)
+		rt2x00_eeprom_extract "cal_data" 0 512
+		;;
 	*)
 		rt2x00_eeprom_die "board $board is not supported yet"
 		;;
diff --git a/target/linux/brcm63xx/base-files/etc/uci-defaults/01_leds b/target/linux/brcm63xx/base-files/etc/uci-defaults/01_leds
index 58404a1..b964bdb 100644
--- a/target/linux/brcm63xx/base-files/etc/uci-defaults/01_leds
+++ b/target/linux/brcm63xx/base-files/etc/uci-defaults/01_leds
@@ -34,6 +34,9 @@ hg556a_*)
 	ucidef_set_led_netdev "lan" "LAN" "HW556:red:dsl" "eth0"
 	ucidef_set_led_usbdev "usb" "USB" "HW556:red:hspa" "1-2"
 	;;
+hg655b)
+	ucidef_set_led_usbdev "usb" "USB" "HW65x:green:usb" "1-2"
+	;;
 homehub2a)
 	ucidef_set_led_netdev "lan" "LAN" "HOMEHUB2A:blue:broadband" "eth0.1"
 	ucidef_set_led_netdev "wlan0" "WIFI" "HOMEHUB2A:green:wireless" "wlan0"
diff --git a/target/linux/brcm63xx/base-files/etc/uci-defaults/02_network b/target/linux/brcm63xx/base-files/etc/uci-defaults/02_network
index 814e100..e5880eb 100644
--- a/target/linux/brcm63xx/base-files/etc/uci-defaults/02_network
+++ b/target/linux/brcm63xx/base-files/etc/uci-defaults/02_network
@@ -92,6 +92,7 @@ dsl-274xb-f |\
 dsl-275xb-d |\
 fast2504n |\
 fast2704v2 |\
+hg655b |\
 p870hw-51a_v2 |\
 vr-3025un |\
 vr-3025u)
diff --git a/target/linux/brcm63xx/base-files/lib/brcm63xx.sh b/target/linux/brcm63xx/base-files/lib/brcm63xx.sh
index 5cb390f..0eb9a75 100755
--- a/target/linux/brcm63xx/base-files/lib/brcm63xx.sh
+++ b/target/linux/brcm63xx/base-files/lib/brcm63xx.sh
@@ -156,6 +156,9 @@ brcm63xx_dt_detect() {
 	"Huawei EchoLife HG556a (version C)")
 		board_name="hg556a_c"
 		;;
+	"Huawei HG655b")
+		board_name="hg655b"
+		;;
 	"Inteno VG50")
 		board_name="vg50"
 		;;
diff --git a/target/linux/brcm63xx/image/Makefile b/target/linux/brcm63xx/image/Makefile
index e98011d..0d8ce53 100755
--- a/target/linux/brcm63xx/image/Makefile
+++ b/target/linux/brcm63xx/image/Makefile
@@ -360,6 +360,8 @@ $(eval $(call ImageDTB,CFEDTB,HG553,HG553,hg553,HW553,6358,--rsa-signature "Echo
 $(eval $(call ImageDTB,CFEDTB,HG556a_AB,HG556a_A,hg556a-a,HW556,6358,--rsa-signature "EchoLife_HG556a" --image-offset 0x20000 --block-size 0x10000 --tag-version 8))
 $(eval $(call ImageDTB,CFEDTB,HG556a_AB,HG556a_B,hg556a-b,HW556,6358,--rsa-signature "EchoLife_HG556a" --image-offset 0x20000 --block-size 0x20000 --tag-version 8))
 $(eval $(call ImageDTB,CFEDTB,HG556a_C,HG556a_C,hg556a-c,HW556,6358,--rsa-signature "EchoLife_HG556a" --image-offset 0x20000 --block-size 0x20000 --tag-version 8))
+# Huawei HG655b
+$(eval $(call ImageDTB,CFEDTB,HG655b,HG655b,hg655b,HW65x,6368,--image-offset 0x20000 --tag-version 7 --pad 4))
 # Inteno VG50
 $(eval $(call ImageDTB,Dummy,VG50,vg50,vg50,VW6339GU,63268))
 # Inventel Livebox 1
diff --git a/target/linux/brcm63xx/profiles/huawei.mk b/target/linux/brcm63xx/profiles/huawei.mk
index 594389e..a6764b7 100644
--- a/target/linux/brcm63xx/profiles/huawei.mk
+++ b/target/linux/brcm63xx/profiles/huawei.mk
@@ -43,3 +43,13 @@ define Profile/HG556a_C/Description
   Package set optimized for Huawei HG556a version C (Ralink).
 endef
 $(eval $(call Profile,HG556a_C))
+
+define Profile/HG655b
+  NAME:=Huawei HG655b
+  PACKAGES:=kmod-rt2800-pci wpad-mini \
+	kmod-usb2 kmod-usb-ohci kmod-ledtrig-usbdev
+endef
+define Profile/HG655b/Description
+  Package set optimized for Huawei HG655b, HG655d.
+endef
+$(eval $(call Profile,HG655b))
diff --git a/target/linux/brcm63xx/dts/hg655b.dts b/target/linux/brcm63xx/dts/hg655b.dts
new file mode 100644
index 0000000..256233d
--- /dev/null
+++ b/target/linux/brcm63xx/dts/hg655b.dts
@@ -0,0 +1,110 @@
+/dts-v1/;
+
+/include/ "bcm6368.dtsi"
+
+/ {
+	model = "Huawei HG655b";
+	compatible = "huawei,hg655b", "brcm,bcm6368";
+
+	gpio-keys-polled {
+		compatible = "gpio-keys-polled";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		poll-interval = <20>;
+		debounce-interval = <60>;
+
+		wps {
+			label = "wps";
+			gpios = <&gpio0 12 1>;
+			linux,code = <0x211>;
+		};
+		wlan {
+			label = "wlan";
+			gpios = <&gpio0 23 1>;
+			linux,code = <0xee>;
+		};
+		reset {
+			label = "reset";
+			gpios = <&gpio1 2 1>;
+			linux,code = <0x198>;
+		};
+	};
+
+	gpio-leds {
+		compatible = "gpio-leds";
+
+		dsl_green {
+			label = "HW65x:green:dsl";
+			gpios = <&gpio0 2 1>;
+		};
+		internet_green {
+			label = "HW65x:green:internet";
+			gpios = <&gpio0 5 1>;
+		};
+		lan1_green {
+			label = "HW65x:green:lan1";
+			gpios = <&gpio0 6 1>;
+		};
+		lan2_green {
+			label = "HW65x:green:lan2";
+			gpios = <&gpio0 7 1>;
+		};
+		lan3_green {
+			label = "HW65x:green:lan3";
+			gpios = <&gpio0 8 1>;
+		};
+		lan4_green {
+			label = "HW65x:green:lan4";
+			gpios = <&gpio0 9 1>;
+		};
+		usb_green {
+			label = "HW65x:green:usb";
+			gpios = <&gpio0 14 1>;
+		};
+		power_green {
+			label = "HW65x:green:power";
+			gpios = <&gpio0 22 1>;
+			default-state = "on";
+		};
+		voip_green {
+			label = "HW65x:green:voip";
+			gpios = <&gpio0 25 1>;
+		};
+		wps_green {
+			label = "HW65x:green:wps";
+			gpios = <&gpio0 27 1>;
+		};
+	};
+};
+
+&pflash {
+	status = "ok";
+
+	linux,part-probe = "bcm63xxpart";
+
+	cfe at 0 {
+		label = "CFE";
+		reg = <0x000000 0x020000>;
+	};
+
+	linux at 20000 {
+		label = "linux";
+		reg = <0x020000 0x770000>;
+	};
+
+	board_data at 790000 {
+		label = "board_data";
+		reg = <0x790000 0x030000>;
+	};
+
+	cal_data at 7c0000 {
+		label = "cal_data";
+		reg = <0x7c0000 0x020000>;
+		read-only;
+	};
+
+	nvram at 7d0000 {
+		label = "nvram";
+		reg = <0x7e0000 0x020000>;
+	};
+};
diff --git a/target/linux/brcm63xx/patches-3.18/570-board_HG655b.patch b/target/linux/brcm63xx/patches-3.18/570-board_HG655b.patch
new file mode 100644
index 0000000..903068a
--- /dev/null
+++ b/target/linux/brcm63xx/patches-3.18/570-board_HG655b.patch
@@ -0,0 +1,72 @@
+--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
++++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
+@@ -1928,6 +1928,53 @@
+ 
+ 	.spis = DGND3700v1_3800B_spi_devices,
+ 	.num_spis = ARRAY_SIZE(DGND3700v1_3800B_spi_devices),
++};
++
++static struct board_info __initdata board_HG655b = {
++	.name				= "HW65x",
++	.expected_cpu_id		= 0x6368,
++
++	.has_uart0			= 1,
++	.has_pci			= 1,
++	.has_ohci0			= 1,
++	.has_ehci0			= 1,
++	.num_usbh_ports			= 2,
++
++	.has_caldata			= 1,
++	.caldata = {
++		{
++			.vendor			= PCI_VENDOR_ID_RALINK,
++			.caldata_offset		= 0x7c0000,
++			.slot			= 1,
++			.eeprom			= "rt2x00.eeprom",
++		},
++	},
++
++	.has_enetsw			= 1,
++	.enetsw = {
++		.used_ports = {
++			[0] = {
++				.used		= 1,
++				.phy_id		= 1,
++				.name		= "port1",
++			},
++			[1] = {
++				.used		= 1,
++				.phy_id		= 2,
++				.name		= "port2",
++			},
++			[2] = {
++				.used		= 1,
++				.phy_id		= 3,
++				.name		= "port3",
++			},
++			[3] = {
++				.used		= 1,
++				.phy_id		= 4,
++				.name		= "port4",
++			},
++		},
++	},
+ };
+ 
+ static struct sprom_fixup __initdata vr3025u_fixups[] = {
+@@ -2380,6 +2427,7 @@
+ 	&board_96368mvwg,
+ 	&board_96368mvngr,
+ 	&board_DGND3700v1_3800B,
++	&board_HG655b,
+ 	&board_P870HW51A_V2,
+ 	&board_VR3025u,
+ 	&board_VR3025un,
+@@ -2483,6 +2531,7 @@
+ 	{ .compatible = "comtrend,vr-3025u", .data = &board_VR3025u, },
+ 	{ .compatible = "comtrend,vr-3025un", .data = &board_VR3025un, },
+ 	{ .compatible = "comtrend,wap-5813n", .data = &board_WAP5813n, },
++	{ .compatible = "huawei,hg655b", .data = &board_HG655b, },
+ 	{ .compatible = "netgear,dgnd3700v1", .data = &board_DGND3700v1_3800B, },
+ 	{ .compatible = "zyxel,p870hw-51a-v2", .data = &board_P870HW51A_V2, },
+ #endif
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list