Bcm63xx: support for Sagem Fast 2304, testers wanted

I've made patches to support the Sagem Fast 2304 bcm63xx based router. However, I don't own this device. Before sending patches some testing is required.

Hardware

  SoC: BCM6328
  Flash: 8 MB SPI NOR
  RAM: 64 MB
  Wireless: BCM4313, 2.4GHz only
  Ethernet: 4x 100 Mbps
  DSL: unsupported

wiki: https://openwrt.org/toh/sagemcom/fast2304

Images for testing: openwrt-fast2304-testing.zip

  • The initramfs image is for loading via tftp using serial UART interface, without flashing anything.
  • The squashfs-cfe image is for flashing the firmware using the CFE failsafe mode, enabled with the RESET button.

We need to know if:

  • LEDs are working
  • RESET button works
  • LAN ports work
  • Wireless works, at least station mode.

Current patch:

diff --git a/target/linux/bcm63xx/base-files/etc/board.d/01_leds b/target/linux/bcm63xx/base-files/etc/board.d/01_leds
index 75e8afef9d..b73af1b71b 100644
--- a/target/linux/bcm63xx/base-files/etc/board.d/01_leds
+++ b/target/linux/bcm63xx/base-files/etc/board.d/01_leds
@@ -80,6 +80,9 @@ netgear,evg2000)
 	ucidef_set_led_usbdev "usb1" "USB1" "green:voip1" "1-1"
 	ucidef_set_led_usbdev "usb2" "USB2" "green:voip2" "1-2"
 	;;
+sagem,fast-2304)
+	ucidef_set_led_netdev "wlan0" "WIFI" "green:wlan" "wlan0"
+	;;
 sagem,fast-2704n)
 	ucidef_set_led_netdev "wan" "WAN" "green:inet" "eth0.2"
 	;;
diff --git a/target/linux/bcm63xx/base-files/etc/board.d/02_network b/target/linux/bcm63xx/base-files/etc/board.d/02_network
index c594a9265f..665b0f41fd 100644
--- a/target/linux/bcm63xx/base-files/etc/board.d/02_network
+++ b/target/linux/bcm63xx/base-files/etc/board.d/02_network
@@ -101,6 +101,7 @@ huawei,echolife-hg556a-c)
 comtrend,ar-5315u|\
 innacomm,w3400v6|\
 observa,vh4032n|\
+sagem,fast-2304|\
 sagem,fast-2704n)
 	ucidef_add_switch "switch0" \
 		"0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "8t@eth0"
diff --git a/target/linux/bcm63xx/dts/bcm6328-sagem-fast-2304.dts b/target/linux/bcm63xx/dts/bcm6328-sagem-fast-2304.dts
new file mode 100644
index 0000000000..2a7e55a26f
--- /dev/null
+++ b/target/linux/bcm63xx/dts/bcm6328-sagem-fast-2304.dts
@@ -0,0 +1,156 @@
+#include "bcm6328.dtsi"
+
+#include <dt-bindings/input/input.h>
+
+/ {
+	model = "Sagem F@st 2304";
+	compatible = "sagem,fast-2304", "brcm,bcm6328";
+
+	aliases {
+		led-boot = &led_power_green;
+		led-failsafe = &led_power_amber;
+		led-running = &led_power_green;
+		led-upgrade = &led_power_green;
+	};
+
+	chosen {
+		bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200";
+		stdout-path = "serial0:115200n8";
+	};
+
+	keys {
+		compatible = "gpio-keys";
+
+		reset {
+			label = "Reset button";
+			linux,code = <KEY_RESTART>;
+			gpios = <&pinctrl 23 1>;
+			debounce-interval = <60>;
+		};
+	};
+};
+
+&hsspi {
+	status = "okay";
+
+	flash@0 {
+		compatible = "jedec,spi-nor";
+		spi-max-frequency = <16666667>;
+		spi-tx-bus-width = <2>;
+		spi-rx-bus-width = <2>;
+		reg = <0>;
+
+		partitions {
+			compatible = "fixed-partitions";
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			cfe@0 {
+				reg = <0x000000 0x010000>;
+				label = "cfe";
+				read-only;
+			};
+
+			linux@10000 {
+				reg = <0x010000 0x7e0000>;
+				label = "linux";
+				compatible = "brcm,bcm963xx-imagetag";
+			};
+
+			nvram@7f0000 {
+				reg = <0x7f0000 0x010000>;
+				label = "nvram";
+			};
+		};
+	};
+};
+
+&leds {
+	status = "okay";
+
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_leds
+		     &pinctrl_ephy0_spd_led &pinctrl_ephy1_spd_led
+		     &pinctrl_ephy2_spd_led &pinctrl_ephy3_spd_led>;
+
+	diag_green@3 {
+		reg = <3>;
+		active-low;
+		label = "green:diag";
+	};
+
+	wlan_green@4 {
+		reg = <4>;
+		active-low;
+		label = "green:wlan";
+	};
+
+	inet_amber@5 {
+		reg = <5>;
+		active-low;
+		label = "amber:inet";
+	};
+
+	inet_green@6 {
+		reg = <6>;
+		active-low;
+		label = "green:inet";
+	};
+
+	inet_red@7 {
+		reg = <7>;
+		active-low;
+		label = "red:inet";
+	};
+
+	led_power_green: power_green@8 {
+		reg = <8>;
+		active-low;
+		label = "green:power";
+		default-state = "on";
+	};
+
+	led_power_amber: power_amber@9 {
+		reg = <9>;
+		active-low;
+		label = "amber:power";
+	};
+
+	diag_amber@11 {
+		reg = <11>;
+		active-low;
+		label = "amber:diag";
+	};
+
+	ephy0_spd@17 {
+		reg = <17>;
+		brcm,hardware-controlled;
+	};
+
+	ephy0_spd@18 {
+		reg = <18>;
+		brcm,hardware-controlled;
+	};
+
+	ephy0_spd@19 {
+		reg = <19>;
+		brcm,hardware-controlled;
+	};
+
+	ephy0_spd@20 {
+		reg = <20>;
+		brcm,hardware-controlled;
+	};
+};
+
+&pinctrl {
+	pinctrl_leds: leds {
+		function = "led";
+		pins = "gpio3", "gpio4", "gpio5", "gpio6",
+		       "gpio7", "gpio8", "gpio9", "gpio11";
+	};
+};
+
+&uart0 {
+	status = "okay";
+};
diff --git a/target/linux/bcm63xx/image/bcm63xx.mk b/target/linux/bcm63xx/image/bcm63xx.mk
index 97959d7819..d8a0011049 100644
--- a/target/linux/bcm63xx/image/bcm63xx.mk
+++ b/target/linux/bcm63xx/image/bcm63xx.mk
@@ -969,6 +969,17 @@ endef
 TARGET_DEVICES += pirelli_agpf-s0
 
 ### Sagem ###
+define Device/sagem_fast-2304
+  $(Device/bcm63xx)
+  DEVICE_VENDOR := Sagemcom
+  DEVICE_MODEL := F@st 2304
+  CFE_BOARD_ID := F@ST2304
+  CHIP_ID := 6328
+  FLASH_MB := 8
+  DEVICE_PACKAGES := kmod-brcmsmac wpad-basic-wolfssl
+endef
+TARGET_DEVICES += sagem_fast-2304
+
 define Device/sagem_fast-2404
   $(Device/bcm63xx-legacy)
   DEVICE_VENDOR := Sagemcom
diff --git a/target/linux/bcm63xx/patches-5.10/520-board_fast2304.patch b/target/linux/bcm63xx/patches-5.10/520-board_fast2304.patch
new file mode 100644
index 0000000000..17a9b68713
--- /dev/null
+++ b/target/linux/bcm63xx/patches-5.10/520-board_fast2304.patch
@@ -0,0 +1,80 @@
+--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
++++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
+@@ -699,10 +699,53 @@
+ 			},
+ 		},
+ 	},
+ };
+ 
++static struct board_info __initdata board_FAST2304 = {
++	.name = "F@ST2304",
++	.expected_cpu_id = 0x6328,
++
++	.has_pci = 1,
++	.has_ohci0 = 1,
++	.has_ehci0 = 1,
++	.num_usbh_ports = 1,
++
++	.has_enetsw = 1,
++	.enetsw = {
++		.used_ports = {
++			[0] = {
++				.used = 1,
++				.phy_id = 1,
++				.name = "LAN4",
++			},
++			[1] = {
++				.used = 1,
++				.phy_id = 2,
++				.name = "LAN3",
++			},
++			[2] = {
++				.used = 1,
++				.phy_id = 3,
++				.name = "LAN2",
++			},
++			[3] = {
++				.used = 1,
++				.phy_id = 4,
++				.name = "LAN1",
++			},
++		},
++	},
++
++	.use_fallback_sprom = 1,
++	.fallback_sprom = {
++		.type = SPROM_BCM4313,
++		.pci_bus = 1,
++		.pci_dev = 0,
++	},
++};
++
+ static struct board_info __initdata board_FAST2704V2 = {
+ 	.name = "F@ST2704V2",
+ 	.expected_cpu_id = 0x6328,
+ 
+ 	.has_pci = 1,
+@@ -2984,10 +3027,11 @@
+ 	&board_A4001N1,
+ 	&board_AD1018,
+ 	&board_AR5381u,
+ 	&board_AR5387un,
+ 	&board_dsl_274xb_f1,
++	&board_FAST2304,
+ 	&board_FAST2704V2,
+ 	&board_PDG_A4001N_A_000_1A1_AX,
+ 	&board_PDG_A4101N_A_000_1A1_AE,
+ 	&board_TG582N,
+ 	&board_TG582N_TELECOM_ITALIA,
+@@ -3102,10 +3146,11 @@
+ 	{ .compatible = "comtrend,ar-5387un", .data = &board_AR5387un, },
+ 	{ .compatible = "d-link,dsl-274xb-f1", .data = &board_dsl_274xb_f1, },
+ 	{ .compatible = "d-link,dsl-2750u-c1", .data = &board_A4001N, },
+ 	{ .compatible = "innacomm,w3400v6", .data = &board_W3400V6, },
+ 	{ .compatible = "nucom,r5010un-v2", .data = &board_R5010UNV2, },
++	{ .compatible = "sagem,fast-2304", .data = &board_FAST2304, },
+ 	{ .compatible = "sagem,fast-2704-v2", .data = &board_FAST2704V2, },
+ 	{ .compatible = "sercomm,ad1018", .data = &board_AD1018, },
+ 	{ .compatible = "sercomm,ad1018-nor", .data = &board_AD1018, },
+ 	{ .compatible = "technicolor,tg582n", .data = &board_TG582N, },
+ 	{ .compatible = "technicolor,tg582n-telecom-italia", .data = &board_TG582N_TELECOM_ITALIA, },

Testers are welcome.