From 16284577a7edee37ccdef5d6641bbd2c889923bb Mon Sep 17 00:00:00 2001 From: jogo Date: Mon, 16 Mar 2015 11:52:10 +0000 Subject: [PATCH] brcm63xx: Add DGND3700 v1 / DGND3800B support This adds support for the Netgear DGND3700 v1 and DGND3800B. DGND3700 v1 and DGND3800B are exactly the same router, only one difference, the factory firmware. This patch produces two factory firmwares for each router. The router includes an onboard NAND flash for extra storage. NAND is currently not supported in bcm63xx, so no code added for this part. The NOR flash (32MB) is enough for storing an openwrt firmware. Signed-off-by: Daniel Gonzalez [jogo: Add back commit message from v1] Signed-off-by: Jonas Gorski git-svn-id: svn://svn.openwrt.org/openwrt/trunk@44831 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../brcm63xx/base-files/etc/uci-defaults/01_leds | 8 ++ .../base-files/etc/uci-defaults/02_network | 7 ++ target/linux/brcm63xx/base-files/lib/brcm63xx.sh | 5 + target/linux/brcm63xx/dts/dgnd3700v1.dts | 110 +++++++++++++++++++++ target/linux/brcm63xx/image/Makefile | 12 +++ .../patches-3.14/568-board_DGND3700v1_3800B.patch | 67 +++++++++++++ .../patches-3.18/568-board_DGND3700v1_3800B.patch | 67 +++++++++++++ target/linux/brcm63xx/profiles/netgear.mk | 11 ++- 8 files changed, 286 insertions(+), 1 deletion(-) create mode 100644 target/linux/brcm63xx/dts/dgnd3700v1.dts create mode 100644 target/linux/brcm63xx/patches-3.14/568-board_DGND3700v1_3800B.patch create mode 100644 target/linux/brcm63xx/patches-3.18/568-board_DGND3700v1_3800B.patch 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 854b3b284a..69d797e510 100644 --- a/target/linux/brcm63xx/base-files/etc/uci-defaults/01_leds +++ b/target/linux/brcm63xx/base-files/etc/uci-defaults/01_leds @@ -14,6 +14,14 @@ case "$board_name" in 96328dg2x2) ucidef_set_led_usbdev "usb" "USB" "A4001N:green:usb" "1-1" ;; +DGND3700v1_3800B) + ucidef_set_led_netdev "lan" "LAN" "DGND3700v1_3800B:green:lan" "eth0.1" + ucidef_set_led_netdev "wan" "WAN" "DGND3700v1_3800B:green:inet" "eth0.2" + ucidef_set_led_netdev "wlan0" "WIFI2G" "DGND3700v1_3800B:green:wifi2g" "wlan0" + ucidef_set_led_netdev "wlan1" "WIFI5G" "DGND3700v1_3800B:blue:wifi5g" "wlan1" + ucidef_set_led_usbdev "usb1" "USB1" "DGND3700v1_3800B:green:usb-back" "1-1" + ucidef_set_led_usbdev "usb2" "USB2" "DGND3700v1_3800B:green:usb-front" "1-2" + ;; 'F@ST2704V2') ucidef_set_led_usbdev "usb" "USB" "F@ST2704V2:green:usb" "1-1" ;; 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 709a1c8a47..6b9736a469 100644 --- a/target/linux/brcm63xx/base-files/etc/uci-defaults/02_network +++ b/target/linux/brcm63xx/base-files/etc/uci-defaults/02_network @@ -108,6 +108,13 @@ P870HW-51a_v2) ucidef_add_switch_vlan "eth0" "2" "4 5t" ;; +DGND3700v1_3800B) + ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" + ucidef_add_switch "eth0" "1" "1" + ucidef_add_switch_vlan "eth0" "1" "1 2 3 4 8t" + ucidef_add_switch_vlan "eth0" "2" "0 8t" + ;; + NB6) ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" ucidef_add_switch "switch0" "1" "1" diff --git a/target/linux/brcm63xx/base-files/lib/brcm63xx.sh b/target/linux/brcm63xx/base-files/lib/brcm63xx.sh index 58ce71ee16..55e6796431 100755 --- a/target/linux/brcm63xx/base-files/lib/brcm63xx.sh +++ b/target/linux/brcm63xx/base-files/lib/brcm63xx.sh @@ -111,6 +111,11 @@ brcm63xx_detect() { brcm63xx_has_reset_button="true" ifname=eth0 ;; + DGND3700v1_3800B) + status_led="DGND3700v1_3800B:green:power" + brcm63xx_has_reset_button="true" + ifname="eth0" + ;; "F@ST2504n") status_led="fast2504n:green:ok" brcm63xx_has_reset_button="true" diff --git a/target/linux/brcm63xx/dts/dgnd3700v1.dts b/target/linux/brcm63xx/dts/dgnd3700v1.dts new file mode 100644 index 0000000000..b349576239 --- /dev/null +++ b/target/linux/brcm63xx/dts/dgnd3700v1.dts @@ -0,0 +1,110 @@ +/dts-v1/; + +/include/ "bcm6368.dtsi" + +/ { + model = "Netgear DGND3700v1/DGND3800B"; + compatible = "netgear,dgnd3700v1", "brcm,bcm6368"; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + debounce-interval = <60>; + + wlan { + label = "wlan"; + gpios = <&gpio0 10 1>; + linux,code = <0xee>; + }; + reset { + label = "reset"; + gpios = <&gpio0 12 1>; + linux,code = <0x198>; + }; + wps { + label = "wps"; + gpios = <&gpio1 3 1>; + linux,code = <0x211>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + dsl_green { + label = "DGND3700v1_3800B:green:dsl"; + gpios = <&gpio0 2 1>; + }; + inet_red { + label = "DGND3700v1_3800B:red:inet"; + gpios = <&gpio0 4 1>; + }; + inet_green { + label = "DGND3700v1_3800B:green:inet"; + gpios = <&gpio0 5 1>; + }; + wps_green { + label = "DGND3700v1_3800B:green:wps"; + gpios = <&gpio0 11 1>; + }; + usbfront_green { + label = "DGND3700v1_3800B:green:usb-front"; + gpios = <&gpio0 13 1>; + }; + usbback_green { + label = "DGND3700v1_3800B:green:usb-back"; + gpios = <&gpio0 14 1>; + }; + power_red { + label = "DGND3700v1_3800B:red:power"; + gpios = <&gpio0 22 1>; + }; + lan_green { + label = "DGND3700v1_3800B:green:lan"; + gpios = <&gpio0 23 1>; + }; + power_green { + label = "DGND3700v1_3800B:green:power"; + gpios = <&gpio0 24 1>; + default-state = "on"; + }; + wifi2g_green { + label = "DGND3700v1_3800B:green:wifi2g"; + gpios = <&gpio0 26 1>; + }; + wifi5g_blue { + label = "DGND3700v1_3800B:blue:wifi5g"; + gpios = <&gpio0 27 1>; + }; + }; +}; + +&pflash { + status = "ok"; + + linux,part-probe = "bcm63xxpart"; + + cfe@0 { + label = "CFE"; + reg = <0x000000 0x020000>; + read-only; + }; + + linux@20000 { + label = "linux"; + reg = <0x020000 0x1e20000>; + }; + + board_data@1e40000 { + label = "board_data"; + reg = <0x1e40000 0x1a0000>; + read-only; + }; + + nvram@1fe0000 { + label = "nvram"; + reg = <0x1fe0000 0x20000>; + }; +}; diff --git a/target/linux/brcm63xx/image/Makefile b/target/linux/brcm63xx/image/Makefile index dd1635527f..3fb9b1cd2b 100755 --- a/target/linux/brcm63xx/image/Makefile +++ b/target/linux/brcm63xx/image/Makefile @@ -111,6 +111,12 @@ define Image/Build/HCSDTB --output_file=$(BIN_DIR)/openwrt-$(2)-$(1).bin endef +define Image/Build/ChkDTB + # Generate Netgear factory image + $(STAGING_DIR_HOST)/bin/mkchkimg -o $(BIN_DIR)/openwrt-$(2)-$(1)-factory.chk \ + -k $(BIN_DIR)/openwrt-$(4)-$(1)-cfe.bin -b $(5) -r $(6) +endef + define Build/Clean $(MAKE) -C lzma-loader clean endef @@ -303,6 +309,12 @@ $(eval $(call ImageDTB,RedBootDTB,Livebox,livebox,livebox-blue-5g)) $(eval $(call ImageDTB,HCSDTB,CVG834G,,cvg834g,a020,0001,0022,vmlinux-cvg834g)) # Netgear DG834GT/PN $(eval $(call ImageDTB,CFEDTB,DG834GTPN,DG834GT_PN,dg834gtpn,96348GW-10,6348)) +# Netgear DGND3700 v1 / DGND3800B +$(eval $(call ImageDTB,CFEDTB,DGND3700v1_3800B,DGND3700v1_3800B,dgnd3700v1,96368MVWG,6368,--image-offset 0x20000 --block-size 0x20000)) +#Netgear DGND3700 v1 factory firmware +$(eval $(call ImageDTB,ChkDTB,DGND3700v1_3800B,DGND3700v1,,DGND3700v1_3800B,U12L144T01_NETGEAR_NEWLED,1)) +#Netgear DGND3800B factory firmware +$(eval $(call ImageDTB,ChkDTB,DGND3700v1_3800B,DGND3800B,,DGND3700v1_3800B,U12L144T11_NETGEAR_NEWLED,1)) # Pirelli Alice Gate VoIP 2 Plus Wi-Fi AGPF-S0 $(eval $(call ImageDTB,CFEDTB,AGPF_S0,AGV2+W,agpf-s0,AGPF-S0,6358,--block-size 0x20000 --image-offset 0x20000 --signature2 IMAGE --tag-version 8)) # Pirelli A226G diff --git a/target/linux/brcm63xx/patches-3.14/568-board_DGND3700v1_3800B.patch b/target/linux/brcm63xx/patches-3.14/568-board_DGND3700v1_3800B.patch new file mode 100644 index 0000000000..b4013bbd4a --- /dev/null +++ b/target/linux/brcm63xx/patches-3.14/568-board_DGND3700v1_3800B.patch @@ -0,0 +1,67 @@ +--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c ++++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c +@@ -2132,6 +2132,48 @@ + .has_ehci0 = 1, + }; + ++static struct b53_platform_data DGND3700v1_3800B_b53_pdata = { ++ .alias = "eth0", ++}; ++ ++static struct spi_board_info DGND3700v1_3800B_spi_devices[] = { ++ { ++ .modalias = "b53-switch", ++ .max_speed_hz = 781000, ++ .bus_num = 0, ++ .chip_select = 1, ++ .platform_data = &DGND3700v1_3800B_b53_pdata, ++ } ++}; ++ ++static struct board_info __initdata board_DGND3700v1_3800B = { ++ .name = "DGND3700v1_3800B", ++ .expected_cpu_id = 0x6368, ++ ++ .has_uart0 = 1, ++ .has_pci = 1, ++ .has_ohci0 = 1, ++ .has_ehci0 = 1, ++ .num_usbh_ports = 2, ++ ++ .has_enetsw = 1, ++ .enetsw = { ++ .used_ports = { ++ [5] = { ++ .used = 1, ++ .phy_id = 0xff, ++ .bypass_link = 1, ++ .force_speed = 1000, ++ .force_duplex_full = 1, ++ .name = "RGMII", ++ }, ++ }, ++ }, ++ ++ .spis = DGND3700v1_3800B_spi_devices, ++ .num_spis = ARRAY_SIZE(DGND3700v1_3800B_spi_devices), ++}; ++ + static struct sprom_fixup __initdata vr3025u_fixups[] = { + { .offset = 97, .value = 0xfeb3 }, + { .offset = 98, .value = 0x1618 }, +@@ -2723,6 +2765,7 @@ + #ifdef CONFIG_BCM63XX_CPU_6368 + &board_96368mvwg, + &board_96368mvngr, ++ &board_DGND3700v1_3800B, + &board_P870HW51A_V2, + &board_VR3025u, + &board_VR3025un, +@@ -2813,6 +2856,7 @@ + { .compatible = "comtrend,vr-3025u", .data = &board_VR3025u, }, + { .compatible = "comtrend,vr-3025un", .data = &board_VR3025un, }, + { .compatible = "comtrend,wap-5813n", .data = &board_WAP5813n, }, ++ { .compatible = "netgear,dgnd3700v1", .data = &board_DGND3700v1_3800B, }, + { .compatible = "zyxel,p870hw-51a-v2", .data = &board_P870HW51A_V2, }, + #endif + #ifdef CONFIG_BCM63XX_CPU_63268 diff --git a/target/linux/brcm63xx/patches-3.18/568-board_DGND3700v1_3800B.patch b/target/linux/brcm63xx/patches-3.18/568-board_DGND3700v1_3800B.patch new file mode 100644 index 0000000000..b4013bbd4a --- /dev/null +++ b/target/linux/brcm63xx/patches-3.18/568-board_DGND3700v1_3800B.patch @@ -0,0 +1,67 @@ +--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c ++++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c +@@ -2132,6 +2132,48 @@ + .has_ehci0 = 1, + }; + ++static struct b53_platform_data DGND3700v1_3800B_b53_pdata = { ++ .alias = "eth0", ++}; ++ ++static struct spi_board_info DGND3700v1_3800B_spi_devices[] = { ++ { ++ .modalias = "b53-switch", ++ .max_speed_hz = 781000, ++ .bus_num = 0, ++ .chip_select = 1, ++ .platform_data = &DGND3700v1_3800B_b53_pdata, ++ } ++}; ++ ++static struct board_info __initdata board_DGND3700v1_3800B = { ++ .name = "DGND3700v1_3800B", ++ .expected_cpu_id = 0x6368, ++ ++ .has_uart0 = 1, ++ .has_pci = 1, ++ .has_ohci0 = 1, ++ .has_ehci0 = 1, ++ .num_usbh_ports = 2, ++ ++ .has_enetsw = 1, ++ .enetsw = { ++ .used_ports = { ++ [5] = { ++ .used = 1, ++ .phy_id = 0xff, ++ .bypass_link = 1, ++ .force_speed = 1000, ++ .force_duplex_full = 1, ++ .name = "RGMII", ++ }, ++ }, ++ }, ++ ++ .spis = DGND3700v1_3800B_spi_devices, ++ .num_spis = ARRAY_SIZE(DGND3700v1_3800B_spi_devices), ++}; ++ + static struct sprom_fixup __initdata vr3025u_fixups[] = { + { .offset = 97, .value = 0xfeb3 }, + { .offset = 98, .value = 0x1618 }, +@@ -2723,6 +2765,7 @@ + #ifdef CONFIG_BCM63XX_CPU_6368 + &board_96368mvwg, + &board_96368mvngr, ++ &board_DGND3700v1_3800B, + &board_P870HW51A_V2, + &board_VR3025u, + &board_VR3025un, +@@ -2813,6 +2856,7 @@ + { .compatible = "comtrend,vr-3025u", .data = &board_VR3025u, }, + { .compatible = "comtrend,vr-3025un", .data = &board_VR3025un, }, + { .compatible = "comtrend,wap-5813n", .data = &board_WAP5813n, }, ++ { .compatible = "netgear,dgnd3700v1", .data = &board_DGND3700v1_3800B, }, + { .compatible = "zyxel,p870hw-51a-v2", .data = &board_P870HW51A_V2, }, + #endif + #ifdef CONFIG_BCM63XX_CPU_63268 diff --git a/target/linux/brcm63xx/profiles/netgear.mk b/target/linux/brcm63xx/profiles/netgear.mk index 75ddab53ce..20224a259a 100644 --- a/target/linux/brcm63xx/profiles/netgear.mk +++ b/target/linux/brcm63xx/profiles/netgear.mk @@ -12,7 +12,6 @@ endef define Profile/CVG834G/Description Package set optimized for CVG834G. endef - $(eval $(call Profile,CVG834G)) define Profile/DG834GTPN @@ -23,3 +22,13 @@ define Profile/DG834GTPN/Description Package set optimized for DG834GT/PN. endef $(eval $(call Profile,DG834GTPN)) + +define Profile/DGND3700v1_3800B + NAME:=Netgear DGND3700 v1 / DGND3800B + PACKAGES:=kmod-b43 wpad-mini \ + kmod-usb2 kmod-usb-ohci kmod-ledtrig-usbdev +endef +define Profile/DGND3700v1_3800B/Description + Package set optimized for DGND3700 v1 / DGND3800B. +endef +$(eval $(call Profile,DGND3700v1_3800B)) -- 2.11.0