[OpenWrt-Devel] [PATCH] brcm63xx: add support for ZyXEL P870HNU-51b

Mohammed Berdai mohammed.berdai at gmail.com
Sat Dec 19 22:52:09 EST 2015


This router is a ZyXEL VDSL2 router and its board has :
chip ID: BCM6368B2, MIPS: 400MHz,
Total Flash size: 16384K with 128 sectors
Total Memory: 67108864 bytes (64MB)
Board Id (0-15): 96368MVWG

with a usb port, and wifi Broadcom bcm43222.
This router requires the image to have: --signature "ZyXEL_4004" -pad
8 --image-offset 0x20000

this patch is for Trunk (compiled and tested against  trunk at 47953
3c298f89-4303-0410-b956-a3cf2f4a3e73 )


diff --git a/target/linux/brcm63xx/base-files/etc/board.d/02_network
b/target/linux/brcm63xx/base-files/etc/board.d/02_network
index c01aba8..061871c 100755
--- a/target/linux/brcm63xx/base-files/etc/board.d/02_network
+++ b/target/linux/brcm63xx/base-files/etc/board.d/02_network
@@ -88,6 +88,7 @@ fast2504n |\
 fast2704v2 |\
 hg655b |\
 p870hw-51a_v2 |\
+p870hnu-51b |\
 r5010un_v2 |\
 vr-3025un |\
 vr-3025u |\
diff --git a/target/linux/brcm63xx/base-files/etc/diag.sh
b/target/linux/brcm63xx/base-files/etc/diag.sh
index b864964..fe16f4d 100644
--- a/target/linux/brcm63xx/base-files/etc/diag.sh
+++ b/target/linux/brcm63xx/base-files/etc/diag.sh
@@ -102,6 +102,9 @@ set_state() {
     p870hw-51a_v2)
         status_led="P870HW-51a:green:power"
         ;;
+        p870hnu-51b)
+                status_led="P870HNU-51b:green:power"
+                ;;
     r5010un_v2)
         status_led="R5010UNv2:green:power"
         ;;
diff --git a/target/linux/brcm63xx/base-files/etc/uci-defaults/09_fix_crc
b/target/linux/brcm63xx/base-files/etc/uci-defaults/09_fix_crc
index bc9ae21..13e01c0 100644
--- a/target/linux/brcm63xx/base-files/etc/uci-defaults/09_fix_crc
+++ b/target/linux/brcm63xx/base-files/etc/uci-defaults/09_fix_crc
@@ -23,6 +23,7 @@ case "$(brcm63xx_board_name)" in
     dsl-274xb-f |\
     magic |\
     p870hw-51a_v2 |\
+    p870hnu-51b |\
     r5010un_v2 |\
     rta770bw |\
     rta770w |\
diff --git a/target/linux/brcm63xx/base-files/lib/brcm63xx.sh
b/target/linux/brcm63xx/base-files/lib/brcm63xx.sh
index 7dc57fd..c315910 100755
--- a/target/linux/brcm63xx/base-files/lib/brcm63xx.sh
+++ b/target/linux/brcm63xx/base-files/lib/brcm63xx.sh
@@ -246,6 +246,9 @@ brcm63xx_dt_detect() {
     "Zyxel P870HW-51a v2")
         board_name="p870hw-51a_v2"
         ;;
+        "Zyxel P870HNU-51b")
+                board_name="p870hnu-51b"
+                ;;
     *)
         board_name="unknown"
         ;;
diff --git a/target/linux/brcm63xx/base-files/lib/preinit/05_init_interfaces_brcm63xx
b/target/linux/brcm63xx/base-files/lib/preinit/05_init_interfaces_brcm63xx
index abf5b89..c516c64 100644
--- a/target/linux/brcm63xx/base-files/lib/preinit/05_init_interfaces_brcm63xx
+++ b/target/linux/brcm63xx/base-files/lib/preinit/05_init_interfaces_brcm63xx
@@ -25,6 +25,7 @@ set_preinit_iface() {
     hg520 |\
     neufbox6 |\
     p870hw-51a_v2 |\
+    p870hnu-51b |\
     rta770bw |\
     rta770w |\
     spw303v |\
diff --git a/target/linux/brcm63xx/dts/p870hnu-51b.dts
b/target/linux/brcm63xx/dts/p870hnu-51b.dts
new file mode 100644
index 0000000..b095a32
--- /dev/null
+++ b/target/linux/brcm63xx/dts/p870hnu-51b.dts
@@ -0,0 +1,77 @@
+/dts-v1/;
+
+#include "bcm6368.dtsi"
+
+#include <dt-bindings/input/input.h>
+
+/ {
+    model = "Zyxel P870HNU-51b";
+    compatible = "zyxel,p870hnu-51b", "brcm,bcm6368";
+
+    gpio-keys-polled {
+        compatible = "gpio-keys-polled";
+        #address-cells = <1>;
+        #size-cells = <0>;
+        poll-interval = <20>;
+        debounce-interval = <60>;
+
+        reset {
+            label = "reset";
+            gpios = <&gpio1 2 1>;
+            linux,code = <KEY_RESTART>;
+        };
+        wps {
+            label = "wps";
+            gpios = <&gpio1 3 1>;
+            linux,code = <KEY_WPS_BUTTON>;
+        };
+    };
+
+    gpio-leds {
+        compatible = "gpio-leds";
+
+        power_green {
+            label = "P870HNU-51b:green:power";
+            gpios = <&gpio0 0 0>;
+            default-state = "on";
+        };
+        dsl_green {
+            label = "P870HNU-51b:green:dsl";
+            gpios = <&gpio0 23 1>;
+        };
+        inet_green {
+            label = "P870HNU-51b:green:inet";
+            gpios = <&gpio0 22 1>;
+        };
+        wps_orange {
+            label = "P870HNU-51b:orange:wps";
+            gpios = <&gpio0 24 1>;
+        };
+        inet_red {
+            label = "P870HNU-51b:red:inet";
+            gpios = <&gpio1 1 1>;
+        };
+    };
+};
+
+&pflash {
+    status = "ok";
+
+    linux,part-probe = "bcm63xxpart";
+
+    cfe at 0 {
+        label = "CFE";
+        reg = <0x000000 0x020000>;
+        read-only;
+    };
+
+    linux at 20000 {
+        label = "linux";
+        reg = <0x020000 0xfd0000>;
+    };
+
+    nvram at ff0000 {
+        label = "nvram";
+        reg = <0xff0000 0x010000>;
+    };
+};
diff --git a/target/linux/brcm63xx/image/Makefile
b/target/linux/brcm63xx/image/Makefile
index 53e4c21..c7132c0 100644
--- a/target/linux/brcm63xx/image/Makefile
+++ b/target/linux/brcm63xx/image/Makefile
@@ -634,5 +634,7 @@ $(eval $(call
bcm63xxCfe,TDW8900GB,TD-W8900GB,td-w8900gb,96348GW-11,6348,--rsa-s
 $(eval $(call bcm63xxCfe,USR9108,USR9108,usr9108,96348GW-A,6348))
 # ZyXEL P870HW-51a v2
 $(eval $(call bcm63xxCfeZyxel,P870HW_51a_v2,P870HW-51a_v2,p870hw-51a-v2,96368VVW,6368,--rsa-signature
"ZyXEL" --signature "ZyXEL_0001"))
+# ZyXEL P870HNU-51B
+$(eval $(call bcm63xxCfeZyxel,P870HNU_51b,P870HNU-51b,p870hnu-51b,96368MVWG,6368,--rsa-signature
"ZyXEL" --signature "ZyXEL_4004" --pad 8 --image-offset 0x20000))

 $(eval $(call BuildImage))
diff --git a/target/linux/brcm63xx/patches-4.1/574-board_P870HNU-51b.patch
b/target/linux/brcm63xx/patches-4.1/574-board_P870HNU-51b.patch
new file mode 100644
index 0000000..96ed543
--- /dev/null
+++ b/target/linux/brcm63xx/patches-4.1/574-board_P870HNU-51b.patch
@@ -0,0 +1,68 @@
+--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
++++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
+@@ -2109,6 +2109,49 @@ static struct board_info __initdata boar
+     },
+ };
+
++static struct board_info __initdata board_P870HNU51B = {
++        .name                           = "P870HNU-51b",
++        .expected_cpu_id                = 0x6368,
++
++        .has_uart0                      = 1,
++        .has_pci                        = 1,
++        .use_fallback_sprom             = 1,
++        .has_ohci0                      = 1,
++        .has_ehci0                      = 1,
++
++        .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",
++                        },
++                },
++        },
++
++        .fallback_sprom = {
++                .type                           = SPROM_BCM4318,
++                .pci_bus                        = 0,
++                .pci_dev                        = 1,
++        },
++};
++
+ static struct board_info __initdata board_VR3025u = {
+     .name                    = "96368M-1541N",
+     .expected_cpu_id        = 0x6368,
+@@ -2565,6 +2608,7 @@ static const struct board_info __initcon
+     &board_DGND3700v1_3800B,
+     &board_HG655b,
+     &board_P870HW51A_V2,
++    &board_P870HNU51B,
+     &board_VR3025u,
+     &board_VR3025un,
+     &board_VR3026e,
+@@ -2674,6 +2718,7 @@ static struct of_device_id const bcm963x
+     { .compatible = "huawei,hg655b", .data = &board_HG655b, },
+     { .compatible = "netgear,dgnd3700v1", .data = &board_DGND3700v1_3800B, },
+     { .compatible = "zyxel,p870hw-51a-v2", .data = &board_P870HW51A_V2, },
++    { .compatible = "zyxel,p870hnu-51b", .data = &board_P870HNU51B, },
+ #endif
+ #ifdef CONFIG_BCM63XX_CPU_63268
+     { .compatible = "brcm,bcm963268bu_p300", .data = &board_963268bu_p300, },
diff --git a/target/linux/brcm63xx/patches-4.4/574-board_P870HNU-51b.patch
b/target/linux/brcm63xx/patches-4.4/574-board_P870HNU-51b.patch
new file mode 100644
index 0000000..6dc974d
--- /dev/null
+++ b/target/linux/brcm63xx/patches-4.4/574-board_P870HNU-51b.patch
@@ -0,0 +1,68 @@
+--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
++++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
+@@ -2110,6 +2110,49 @@ static struct board_info __initdata boar
+     },
+ };
+
++static struct board_info __initdata board_P870HNU51B = {
++        .name                           = "P870HNU-51b",
++        .expected_cpu_id                = 0x6368,
++
++        .has_uart0                      = 1,
++        .has_pci                        = 1,
++        .use_fallback_sprom             = 1,
++        .has_ohci0                      = 1,
++        .has_ehci0                      = 1,
++
++        .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",
++                        },
++                },
++        },
++
++        .fallback_sprom = {
++                .type                           = SPROM_BCM4318,
++                .pci_bus                        = 0,
++                .pci_dev                        = 1,
++        },
++};
++
+ static struct board_info __initdata board_VR3025u = {
+     .name                    = "96368M-1541N",
+     .expected_cpu_id        = 0x6368,
+@@ -2566,6 +2609,7 @@ static const struct board_info __initcon
+     &board_DGND3700v1_3800B,
+     &board_HG655b,
+     &board_P870HW51A_V2,
++    &board_P870HNU51B,
+     &board_VR3025u,
+     &board_VR3025un,
+     &board_VR3026e,
+@@ -2675,6 +2719,7 @@ static struct of_device_id const bcm963x
+     { .compatible = "huawei,hg655b", .data = &board_HG655b, },
+     { .compatible = "netgear,dgnd3700v1", .data = &board_DGND3700v1_3800B, },
+     { .compatible = "zyxel,p870hw-51a-v2", .data = &board_P870HW51A_V2, },
++    { .compatible = "zyxel,p870hnu-51b", .data = &board_P870HNU51B, },
+ #endif
+ #ifdef CONFIG_BCM63XX_CPU_63268
+     { .compatible = "brcm,bcm963268bu_p300", .data = &board_963268bu_p300, },
diff --git a/target/linux/brcm63xx/profiles/zyxel.mk
b/target/linux/brcm63xx/profiles/zyxel.mk
index 3aca094..0735da6 100644
--- a/target/linux/brcm63xx/profiles/zyxel.mk
+++ b/target/linux/brcm63xx/profiles/zyxel.mk
@@ -13,3 +13,14 @@ define Profile/P870HW_51a_v2/Description
   Package set optimized for P870HW-51a v2.
 endef
 $(eval $(call Profile,P870HW_51a_v2))
+
+define Profile/P870HNU_51b
+  NAME:=ZyXEL P870HNU-51b
+  PACKAGES:=kmod-b43 wpad-mini \
+        kmod-usb2 kmod-usb-ohci
+endef
+define Profile/P870HNU_51b/Description
+  Package set optimized for P870HNU-51b.
+endef
+$(eval $(call Profile,P870HNU_51b))
+
_______________________________________________
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