diff mbox

[OpenWrt-Devel,brcm63xx] Add support for Plusnet 2704N

Message ID 555A1FBB.3070708@googlemail.com
State Changes Requested
Delegated to: Jonas Gorski
Headers show

Commit Message

Matt Goring May 18, 2015, 5:22 p.m. UTC
Hello, this is my first submission, please excuse me if I have the wrong 
mailing list, or missed a mailing rule.


This patch is to add support for the Plusnet 2704N Router (BCM6318), on 
the current trunk.
This will most possibly add support for the Sagem 2704N (Ver 1) and the 
TP-Link-TD-W8960N (Ver 5) due to the same hardware, but unconfirmed.
ADSL does not work (same with all Broadcom devices) and the Fibre (via 
copper) is purposely not configured.  Otherwise you will loose a 
Ethernet port.

The openwrt image will not work out-the-box for this Plusnet router.  So 
I will create a wiki page if this patch is accepted.

Signed-off-by: Matt Goring <matt.goring at googlemail.com>

Comments

Jonas Gorski May 25, 2015, 11:20 a.m. UTC | #1
Hi,

On Mon, May 18, 2015 at 7:22 PM, Matt Goring <matt.goring@googlemail.com> wrote:
> Hello, this is my first submission, please excuse me if I have the wrong
> mailing list, or missed a mailing rule.

No need for formalities, just write it like you would write a commit log.
>
> This patch is to add support for the Plusnet 2704N Router (BCM6318), on the
> current trunk.
> This will most possibly add support for the Sagem 2704N (Ver 1) and the
> TP-Link-TD-W8960N (Ver 5) due to the same hardware, but unconfirmed.
> ADSL does not work (same with all Broadcom devices) and the Fibre (via
> copper) is purposely not configured.  Otherwise you will loose a Ethernet
> port.

If it has a dedicated wan port (even if it is part of the switch), it
should be configured as a wan port by default IMHO.

> The openwrt image will not work out-the-box for this Plusnet router.  So I
> will create a wiki page if this patch is accepted.

Put these after a tear-off line ("--- ") so they don't become part of
the commit log.
>
> Signed-off-by: Matt Goring <matt.goring at googlemail.com>

> diff --git a/build_dir/target-mips_mips32_uClibc-0.9.33.2/linux-brcm63xx_generic/linux-3.18.11/arch/mips/bcm63xx/boards/board_bcm963xx.c b/build_dir/target-mips_mips32_uClibc-0.9.33.2/linux-brcm63xx_generic/linux-3.18.11/arch/mips/bcm63xx/boards/board_bcm963xx.c

You seem to be using git, please consider using git send-email to send
the patch inline.

> index 6b6cfc0..a0ef569 100644
> --- a/build_dir/target-mips_mips32_uClibc-0.9.33.2/linux-brcm63xx_generic/linux-3.18.11/arch/mips/bcm63xx/boards/board_bcm963xx.c
> +++ b/build_dir/target-mips_mips32_uClibc-0.9.33.2/linux-brcm63xx_generic/linux-3.18.11/arch/mips/bcm63xx/boards/board_bcm963xx.c

This won't apply, you need to add a patch for the kernel, see
https://patchwork.ozlabs.org/patch/470305/ for an example.

> @@ -2401,6 +2401,7 @@  static struct of_device_id const bcm963xx_boards_dt[] = {
>         { .compatible = "brcm,bcm96318ref", .data = &board_96318ref, },
>         { .compatible = "brcm,bcm96318ref_p300", .data = &board_96318ref_p300, },
>         { .compatible = "d-link,dsl-275xb-d", .data = &board_dsl_2751b_d1, },
> +         { .compatible = "plusnet,f@st2704n", .data = &board_96318ref, },

If the OEM is sagem, it should stay sagem. Also this device does not
seem to have any USB ports, so don't reuse a random board_<foo> file,
add a new one.

> diff --git a/target/linux/brcm63xx/dts/fast2704n.dts b/target/linux/brcm63xx/dts/fast2704n.dts
> new file mode 100755
> index 0000000..08bc58b
> --- /dev/null
> +++ b/target/linux/brcm63xx/dts/fast2704n.dts
> @@ -0,0 +1,70 @@
> +/dts-v1/;
> +
> +/include/ "bcm6318.dtsi"
> +
> +/ {
> +       model = "Plusnet F@ST2704N";
> +       compatible = "plusnet,f@st2704n", "brcm,bcm6318";
> +
> +       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 = <0x198>;
> +               };
> +               wps {
> +                       label = "wps";
> +                       gpios = <&gpio1 1 1>;
> +                       linux,code = <0x211>;
> +               };

Please order these by their gpio numbers.

> +       };
> +
> +       /* Wireless LAN led is controlled independently */

Drop this comment, it doesn't really add much information.

> +
> +       gpio-leds {
> +               compatible = "gpio-leds";
> +
> +               wps_green {
> +                       label = "F@ST2704N:green:wps";
> +                       gpios = <&gpio0 2 1>;
> +               };
> +               inet_red {
> +                       label = "F@ST2704N:red:inet";
> +                       gpios = <&gpio0 9 1>;
> +               };
> +               inet_green {
> +                       label = "F@ST2704N:green:inet";
> +                       gpios = <&gpio0 8 1>;
> +               };
> +               dsl_green {
> +                       label = "F@ST2704N:green:dsl";
> +                       gpios = <&gpio0 10 1>;
> +               };
> +               lan4_green {
> +                       label = "F@ST2704N:green:lan4";
> +                       gpios = <&gpio0 7 1>;
> +               };
> +               lan3_green {
> +                       label = "F@ST2704N:green:lan3";
> +                       gpios = <&gpio0 6 1>;
> +               };
> +               lan2_green {
> +                       label = "F@ST2704N:green:lan2";
> +                       gpios = <&gpio0 5 1>;
> +               };
> +               lan1_green {
> +                       label = "F@ST2704N:green:lan1";
> +                       gpios = <&gpio0 4 1>;
> +               };
> +               power_red {
> +                       label = "F@ST2704N:red:power";
> +                       gpios = <&gpio0 11 1>;
> +               };

Please order these by their gpio numbers.

> +       };
> +};


Regards
Jonas
Jonas Gorski July 25, 2015, 12:48 p.m. UTC | #2
Hi,

I just noticed that you sent this to the wrong address
(openwrt-devel-request@ instead of openwrt-devel), thus it never made
it to the mailing list.

On 20.07.2015 10:40, Matt Goring wrote:
> BCM6318: will also support Sagem 2704N (V1) and probably the TP-Link-TD-W8960N (V5) because its the same hardware.
> Signed-off-by: Matt Goring <matt.goring at googlemail.com>

Please shorten your commitlog lines to <=72 chars.

Also please rebase onto the new image building code.

> ---
> I have learnt and made the changes.  about the USB comment, its comes in 2 favours.  Either way they still have the PCB layout for the USB socket.  I hope that is OK?
> Also tested with kernel 4.1.

Yeah, if this is the only difference that's fine.

> This is a resubmit.
> ---
>  target/linux/brcm63xx/base-files/etc/diag.sh       |    3 +
>  .../brcm63xx/base-files/etc/uci-defaults/01_leds   |    3 +
>  .../base-files/etc/uci-defaults/02_network         |    7 ++
>  target/linux/brcm63xx/base-files/lib/brcm63xx.sh   |    3 +
>  target/linux/brcm63xx/dts/fast2704n.dts            |   82 ++++++++++++++++++++
>  target/linux/brcm63xx/image/Makefile               |    2 +
>  .../patches-3.18/571-board_fast2704n.patch         |   65 ++++++++++++++++
>  .../brcm63xx/patches-4.1/571-board_fast2704n.patch |   65 ++++++++++++++++
>  target/linux/brcm63xx/profiles/sagem.mk            |   10 +++
>  9 files changed, 240 insertions(+)
>  create mode 100644 target/linux/brcm63xx/dts/fast2704n.dts
>  create mode 100644 target/linux/brcm63xx/patches-3.18/571-board_fast2704n.patch
>  create mode 100644 target/linux/brcm63xx/patches-4.1/571-board_fast2704n.patch
> 
> diff --git a/target/linux/brcm63xx/base-files/etc/diag.sh b/target/linux/brcm63xx/base-files/etc/diag.sh
> index 1b0d26d..7916ac2 100644
> --- a/target/linux/brcm63xx/base-files/etc/diag.sh
> +++ b/target/linux/brcm63xx/base-files/etc/diag.sh
> @@ -70,6 +70,9 @@ set_state() {
>  	fast2504n)
>  		status_led="fast2504n:green:ok"
>  		;;
> +	fast2704n)
> +		status_led2="F@ST2704N:red:power"
> +		;;
>  	fast2704v2)
>  		status_led="F@ST2704V2:green:power"
>  		;;
> 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 b964bdb..bdb3dad 100644
> --- a/target/linux/brcm63xx/base-files/etc/uci-defaults/01_leds
> +++ b/target/linux/brcm63xx/base-files/etc/uci-defaults/01_leds
> @@ -22,6 +22,9 @@ dgnd3700v1_dgnd3800b)
>  	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"
>  	;;
> +fast2704n)
> +	ucidef_set_led_netdev "wan" "WAN" "F@ST2704N:green:inet" "eth0.2"
> +	;;
>  fast2704v2)
>  	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 e5880eb..d6bd43e 100644
> --- a/target/linux/brcm63xx/base-files/etc/uci-defaults/02_network
> +++ b/target/linux/brcm63xx/base-files/etc/uci-defaults/02_network
> @@ -141,6 +141,13 @@ bcm963268bu_p300)
>  	ucidef_add_switch_vlan "switch0" "1" "0 3 4 5 6 7 8t"
>  	;;
>  
> +fast2704n)
> +	ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
> +	ucidef_add_switch "eth0" "1" "1"
> +	ucidef_add_switch_vlan "eth0" "1" "1 2 3 8t"
> +	ucidef_add_switch_vlan "eth0" "2" "0 8t" 

That's the same setup as dgnd3700v1_dgnd3800b, so just add this board id to the case instead of adding its own case.

> +	;;
> +
>  *)
>  	ucidef_set_interfaces_lan_wan "eth1" "eth0"
>  	;;
> diff --git a/target/linux/brcm63xx/base-files/lib/brcm63xx.sh b/target/linux/brcm63xx/base-files/lib/brcm63xx.sh
> index 0eb9a75..92fa5f2 100755
> --- a/target/linux/brcm63xx/base-files/lib/brcm63xx.sh
> +++ b/target/linux/brcm63xx/base-files/lib/brcm63xx.sh
> @@ -198,6 +198,9 @@ brcm63xx_dt_detect() {
>  	"Sagem F@ST2604")
>  		board_name="fast2604"
>  		;;
> +	"Sagem F@ST2704N")
> +		board_name="fast2704n"
> +		;;
>  	"Sagem F@ST2704V2")
>  		board_name="fast2704v2"
>  		;;
> diff --git a/target/linux/brcm63xx/dts/fast2704n.dts b/target/linux/brcm63xx/dts/fast2704n.dts
> new file mode 100644
> index 0000000..19e027b
> --- /dev/null
> +++ b/target/linux/brcm63xx/dts/fast2704n.dts
> @@ -0,0 +1,82 @@
> +/dts-v1/;
> +
> +/include/ "bcm6318.dtsi"
> +
> +/ {
> +	model = "Sagem F@ST2704N";
> +	compatible = "sagem,f@st2704n", "brcm,bcm6318";
> +
> +	gpio-keys-polled {
> +		compatible = "gpio-keys-polled";
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +		poll-interval = <20>;
> +		debounce-interval = <60>;
> +
> +		rfkill {
> +			label = "rfkill";
> +			gpios = <&gpio0 1 0>;
> +			linux,code = <0xee>;
> +		};
> +		wps {
> +			label = "wps";
> +			gpios = <&gpio1 1 1>;
> +			linux,code = <0x211>;
> +		};
> +		reset {
> +			label = "reset";
> +			gpios = <&gpio1 2 1>;
> +			linux,code = <0x198>;

Please make use of the dt-includes as done in r46391.


the rest looks fine.


Regards
Jonas
diff mbox

Patch

diff --git a/build_dir/target-mips_mips32_uClibc-0.9.33.2/linux-brcm63xx_generic/linux-3.18.11/arch/mips/bcm63xx/boards/board_bcm963xx.c b/build_dir/target-mips_mips32_uClibc-0.9.33.2/linux-brcm63xx_generic/linux-3.18.11/arch/mips/bcm63xx/boards/board_bcm963xx.c
index 6b6cfc0..a0ef569 100644
--- a/build_dir/target-mips_mips32_uClibc-0.9.33.2/linux-brcm63xx_generic/linux-3.18.11/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ b/build_dir/target-mips_mips32_uClibc-0.9.33.2/linux-brcm63xx_generic/linux-3.18.11/arch/mips/bcm63xx/boards/board_bcm963xx.c
@@ -2401,6 +2401,7 @@  static struct of_device_id const bcm963xx_boards_dt[] = {
 	{ .compatible = "brcm,bcm96318ref", .data = &board_96318ref, },
 	{ .compatible = "brcm,bcm96318ref_p300", .data = &board_96318ref_p300, },
 	{ .compatible = "d-link,dsl-275xb-d", .data = &board_dsl_2751b_d1, },
+	{ .compatible = "plusnet,f@st2704n", .data = &board_96318ref, },
 #endif
 #ifdef CONFIG_BCM63XX_CPU_6328
 	{ .compatible = "adb,a4001n", .data = &board_A4001N, },
diff --git a/target/linux/brcm63xx/base-files/etc/diag.sh b/target/linux/brcm63xx/base-files/etc/diag.sh
index 03d98b9..e97547a 100644
--- a/target/linux/brcm63xx/base-files/etc/diag.sh
+++ b/target/linux/brcm63xx/base-files/etc/diag.sh
@@ -69,6 +69,9 @@  set_state() {
 	fast2504n)
 		status_led="fast2504n:green:ok"
 		;;
+	fast2704n)
+		status_led2="F@ST2704N:red:power"
+		;;
 	fast2704v2)
 		status_led="F@ST2704V2:green:power"
 		;;
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..c40a94f 100644
--- a/target/linux/brcm63xx/base-files/etc/uci-defaults/01_leds
+++ b/target/linux/brcm63xx/base-files/etc/uci-defaults/01_leds
@@ -22,6 +22,9 @@  dgnd3700v1_dgnd3800b)
 	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"
 	;;
+fast2704n)
+	ucidef_set_led_netdev "lan" "LAN" "F@ST2704N:green:lan1" "eth0.1"
+	;;
 fast2704v2)
 	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 814e100..c31373a 100644
--- a/target/linux/brcm63xx/base-files/etc/uci-defaults/02_network
+++ b/target/linux/brcm63xx/base-files/etc/uci-defaults/02_network
@@ -91,6 +91,13 @@  bcm96368mvngr |\
 dsl-274xb-f |\
 dsl-275xb-d |\
 fast2504n |\
+fast2704n)
+	ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
+	ucidef_add_switch "eth0" "1" "1"
+	ucidef_add_switch_vlan "eth0" "1" "0 1 2 3 8t"
+	;;
+
 fast2704v2 |\
 p870hw-51a_v2 |\
 vr-3025un |\
diff --git a/target/linux/brcm63xx/base-files/lib/brcm63xx.sh b/target/linux/brcm63xx/base-files/lib/brcm63xx.sh
index 5cb390f..e09478e 100755
--- a/target/linux/brcm63xx/base-files/lib/brcm63xx.sh
+++ b/target/linux/brcm63xx/base-files/lib/brcm63xx.sh
@@ -186,6 +186,9 @@  brcm63xx_dt_detect() {
 	"Pirelli Alice Gate AGPF-S0")
 		board_name="agpf-s0"
 		;;
+	"Plusnet F@ST2704N")
+		board_name="fast2704n"
+		;;
 	"Sagem F@ST2404")
 		board_name="fast2404"
 		;;
diff --git a/target/linux/brcm63xx/dts/fast2704n.dts b/target/linux/brcm63xx/dts/fast2704n.dts
new file mode 100755
index 0000000..08bc58b
--- /dev/null
+++ b/target/linux/brcm63xx/dts/fast2704n.dts
@@ -0,0 +1,70 @@ 
+/dts-v1/;
+
+/include/ "bcm6318.dtsi"
+
+/ {
+	model = "Plusnet F@ST2704N";
+	compatible = "plusnet,f@st2704n", "brcm,bcm6318";
+
+	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 = <0x198>;
+		};
+		wps {
+			label = "wps";
+			gpios = <&gpio1 1 1>;
+			linux,code = <0x211>;
+		};
+	};
+
+	/* Wireless LAN led is controlled independently */
+
+	gpio-leds {
+		compatible = "gpio-leds";
+
+		wps_green {
+			label = "F@ST2704N:green:wps";
+			gpios = <&gpio0 2 1>;
+		};
+		inet_red {
+			label = "F@ST2704N:red:inet";
+			gpios = <&gpio0 9 1>;
+		};
+		inet_green {
+			label = "F@ST2704N:green:inet";
+			gpios = <&gpio0 8 1>;
+		};
+		dsl_green {
+			label = "F@ST2704N:green:dsl";
+			gpios = <&gpio0 10 1>;
+		};
+		lan4_green {
+			label = "F@ST2704N:green:lan4";
+			gpios = <&gpio0 7 1>;
+		};
+		lan3_green {
+			label = "F@ST2704N:green:lan3";
+			gpios = <&gpio0 6 1>;
+		};
+		lan2_green {
+			label = "F@ST2704N:green:lan2";
+			gpios = <&gpio0 5 1>;
+		};
+		lan1_green {
+			label = "F@ST2704N:green:lan1";
+			gpios = <&gpio0 4 1>;
+		};
+		power_red {
+			label = "F@ST2704N:red:power";
+			gpios = <&gpio0 11 1>;
+		};
+	};
+};
diff --git a/target/linux/brcm63xx/image/Makefile b/target/linux/brcm63xx/image/Makefile
index e98011d..805f0c5 100755
--- a/target/linux/brcm63xx/image/Makefile
+++ b/target/linux/brcm63xx/image/Makefile
@@ -383,6 +383,8 @@  $(eval $(call ImageDTB,CFEDTB,A226G,A226G,a226g,DWV-S0,6358,--signature2 IMAGE -
 # Pirelli A226M/A226M-FWB
 $(eval $(call ImageDTB,CFEDTB,A226M,A226M,a226m,DWV-S0,6358,--signature2 IMAGE --tag-version 8))
 $(eval $(call ImageDTB,CFEDTB,A226M,A226M-FWB,a226m-fwb,DWV-S0,6358,--block-size 0x20000 --image-offset 0x20000 --signature2 IMAGE --tag-version 8))
+# Plusnet F@ST2704N / Sagem F@ST2704N (V1)
+$(eval $(call ImageDTB,CFEDTB,FAST2704N,F@ST2704N,fast2704n,F@ST2704N,6318))
 # Sagem F@ST2404
 $(eval $(call ImageDTB,CFEDTB,FAST2404,F@ST2404,fast2404,F@ST2404,6348))
 # Sagem F@ST2504n