[source] ramips: add support for Sitecom WLR-6000

LEDE Commits lede-commits at lists.infradead.org
Wed Nov 16 21:42:10 PST 2016


mkresin pushed a commit to source.git, branch master:
https://git.lede-project.org/3d680c57286a2f77b9cfba275756c711730c7fe2

commit 3d680c57286a2f77b9cfba275756c711730c7fe2
Author: Jasper Scholte <NightNL at outlook.com>
AuthorDate: Sun Aug 14 23:30:44 2016 +0200

    ramips: add support for Sitecom WLR-6000
    
    The Sitecom firmware upgrade file has SENAO_FIRMWARE_TYPE 2 set. This
    looks rather wrong since SENAO_FIRMWARE_TYPE 2 is kernel only but the
    file is way to big for only including a kernel.
    
    The factory image need to have the dlf file extension. Otherwise the
    Sitecom firmware rejects the file.
    
    The stock firmware uses the following mac addresses:
    
    LAN: 00:0C:F6:AA:BB:D8 (u-boot env: ethaddr)
    2,4: 00:0C:F6:AA:BB:D8 (EEPROM)
    5:   00:0C:F6:AA:BB:DC (EEPROM)
    WAN: 00:0C:F6:AA:C8:43 (u-boot env: wanaddr)
    
    Assuming the mac address range :D8 to :DC is reserved for this device,
    the MAC addresses were reorder to have a unique MAC address for each
    interface:
    
    2.4GHz: 00:0C:F6:AA:BB:D8
    LAN:    00:0C:F6:AA:BB:D9
    WAN:    00:0C:F6:AA:BB:DA
    5 GHz:  00:0C:F6:AA:BB:DC
    
    The first MAC is assigned to the 2.4GHz WiFi interface
    to keep compatibility with the SSIDs printed on the case, which have
    the last three sextets of the MAC address appended.
    
    There are still issues with the rt2x00 driver. It is not possible to
    use both wireless interfaces at the same time. The 2.4 GHz
    wireless (PCIe) only works if the internal 5GHz wireless is/has been
    enabled or used for scanning. The internal 5GHz wireless only works if
    the 2.4GHz wireless (PCIe) was never enabled. Disabling the 2.4Ghz
    after it was enabled will result in stations seeing the 5Ghz AP but are
    unable to connect.
    
    Due to the not optimal working wifi the manufacture, backup and storage
    partitions of the OEM firmware are kept for now to allow an easy switch
    back to the Sitecom firmware.
    
    Signed-off-by: Jasper Scholte <NightNL at outlook.com>
    Signed-off-by: Mathias Kresin <dev at kresin.me>
---
 .../linux/ramips/base-files/etc/board.d/02_network |   6 +-
 target/linux/ramips/base-files/etc/diag.sh         |   3 +
 target/linux/ramips/base-files/lib/ramips.sh       |   3 +
 .../ramips/base-files/lib/upgrade/platform.sh      |   1 +
 target/linux/ramips/dts/WLR-6000.dts               | 186 +++++++++++++++++++++
 target/linux/ramips/image/rt3883.mk                |  13 ++
 6 files changed, 211 insertions(+), 1 deletion(-)

diff --git a/target/linux/ramips/base-files/etc/board.d/02_network b/target/linux/ramips/base-files/etc/board.d/02_network
index 537448e..1e97c3b 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -226,7 +226,8 @@ ramips_setup_interfaces()
 			"0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "8 at eth0"
 		;;
 	tew-691gr|\
-	tew-692gr)
+	tew-692gr|\
+	wlr-6000)
 		ucidef_add_switch "switch0" \
 			"1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "0 at eth0"
 		;;
@@ -383,6 +384,9 @@ ramips_setup_macs()
 		lan_mac=$(mtd_get_mac_binary factory 4)
 		wan_mac=$(mtd_get_mac_binary factory 40)
 		;;
+	wlr-6000)
+		wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 32772)" 2)
+		;;
 	wsr-1166)
 		local index="$(find_mtd_index "board_data")"
 		wan_mac="$(grep -m1 mac= "/dev/mtd${index}" | cut -d= -f2)"
diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh
index f3910c7..52baa0b 100644
--- a/target/linux/ramips/base-files/etc/diag.sh
+++ b/target/linux/ramips/base-files/etc/diag.sh
@@ -207,6 +207,9 @@ get_status_led() {
 		status_led="$board:amber:power"
 		;;
 	whr-g300n|\
+	wlr-6000)
+		status_led="$board:red:power"
+		;;
 	wzr-agl300nh)
 		status_led="$board:green:router"
 		;;
diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh
index ee90732..c62f5f6 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -508,6 +508,9 @@ ramips_board_detect() {
 	*"WLI-TX4-AG300N")
 		name="wli-tx4-ag300n"
 		;;
+	*"WLR-6000")
+		name="wlr-6000"
+		;;
 	*"WMR-300")
 		name="wmr-300"
 		;;
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index d5d0463..fa108b6 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -148,6 +148,7 @@ platform_check_image() {
 	wl-351|\
 	wl-wn575a3|\
 	wli-tx4-ag300n|\
+	wlr-6000|\
 	wmr-300|\
 	wnce2001|\
 	wndr3700v5|\
diff --git a/target/linux/ramips/dts/WLR-6000.dts b/target/linux/ramips/dts/WLR-6000.dts
new file mode 100644
index 0000000..ff30969
--- /dev/null
+++ b/target/linux/ramips/dts/WLR-6000.dts
@@ -0,0 +1,186 @@
+/dts-v1/;
+
+#include "rt3883.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+	model = "Sitecom WLR-6000";
+
+	gpio-keys-polled {
+		compatible = "gpio-keys-polled";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		poll-interval = <20>;
+
+		reset {
+			label = "reset";
+			gpios = <&gpio1 2 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_RESTART>;
+		};
+	};
+
+	gpio-leds {
+		compatible = "gpio-leds";
+
+		power {
+			label = "wlr-6000:red:power";
+			gpios = <&gpio0 1 GPIO_ACTIVE_LOW>;
+		};
+
+		ops {
+			label = "wlr-6000:white:ops";
+			gpios = <&gpio0 0 GPIO_ACTIVE_LOW>;
+		};
+	};
+
+	gpio_export {
+		compatible = "gpio-export";
+		#size-cells = <0>;
+
+		usb {
+			gpio-export,name = "usb";
+			gpio-export,output = <1>;
+			gpios = <&gpio0 9 GPIO_ACTIVE_HIGH>;
+		};
+	};
+};
+
+&gpio1 {
+	status = "okay";
+};
+
+&pinctrl {
+	state_default: pinctrl0 {
+		gpio {
+			ralink,group = "i2c", "jtag", "uartf";
+			ralink,function = "gpio";
+		};
+	};
+};
+
+&ethernet {
+	status = "okay";
+	mtd-mac-address = <&factory 0x8004>;
+	mtd-mac-address-increment = <1>;
+
+	port at 0 {
+		phy-handle = <&phy0>;
+		phy-mode = "rgmii";
+	};
+
+	mdio-bus {
+		status = "okay";
+
+		phy0: ethernet-phy at 0 {
+			reg = <0>;
+			phy-mode = "rgmii";
+
+			qca,ar8327-initvals = <
+				0x04 0x07600000 /* PORT0 PAD MODE CTRL */
+				0x0c 0x07600000 /* PORT6 PAD MODE CTRL */
+				0x10 0x40000000 /* Power-on Strapping: 176-pin interface configuration */
+				0x50 0xc437c437 /* LED Control Register 0 */
+				0x54 0xc337c337 /* LED Control Register 1 */
+				0x58 0x00000000 /* LED Control Register 2 */
+				0x5c 0x03ffff00 /* LED Control Register 3 */
+				0x7c 0x0000007e /* PORT0_STATUS */
+				0x94 0x0000007e /* PORT6 STATUS */
+			>;
+		};
+	};
+};
+
+&spi0 {
+	status = "okay";
+
+	m25p80 at 0 {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		compatible = "jedec,spi-nor";
+		reg = <0>;
+		spi-max-frequency = <8600000>;
+		m25p,fast-read;
+
+		partition at 0 {
+			label = "u-boot";
+			reg = <0x0 0x30000>;
+			read-only;
+		};
+
+		partition at 30000 {
+			label = "u-boot-env";
+			reg = <0x30000 0x10000>;
+			read-only;
+		};
+
+		factory: partition at 40000 {
+			label = "factory";
+			reg = <0x40000 0x10000>;
+			read-only;
+		};
+
+		partition at 50000 {
+			label = "firmware";
+			reg = <0x50000 0x713000>;
+		};
+
+		partition at 763000 {
+			label = "manufacture";
+			reg = <0x763000 0x7D000>;
+			read-only;
+		};
+
+		partition at 7E0000 {
+			label = "backup";
+			reg = <0x7E0000 0x10000>;
+			read-only;
+		};
+
+		partition at 7F0000 {
+			label = "storage";
+			reg = <0x7F0000 0x10000>;
+			read-only;
+		};
+	};
+};
+
+&pci {
+	status = "okay";
+	pinctrl-names = "default";
+	pinctrl-0 = <&pci_pins>;
+
+	pci_pins: pci {
+		pci {
+			ralink,group = "pci";
+			ralink,function = "pci-fnc";
+		};
+	};
+
+	host-bridge {
+		pci-bridge at 1 {
+			status = "okay";
+
+			wifi at 1814,3091 {
+				compatible = "pci1814,3091";
+				reg = <0x10000 0 0 0 0>;
+				ralink,mtd-eeprom = <&factory 0x8000>;
+			};
+		};
+	};
+};
+
+&wmac {
+	status = "okay";
+	ralink,2ghz = <0>;
+	ralink,mtd-eeprom = <&factory 0x0>;
+};
+
+&ehci {
+	status = "okay";
+};
+
+&ohci {
+	status = "okay";
+};
diff --git a/target/linux/ramips/image/rt3883.mk b/target/linux/ramips/image/rt3883.mk
index efdbc1f..89b215d 100644
--- a/target/linux/ramips/image/rt3883.mk
+++ b/target/linux/ramips/image/rt3883.mk
@@ -87,6 +87,19 @@ endef
 TARGET_DEVICES += tew-692gr
 
 
+define Device/wlr-6000
+  DTS := WLR-6000
+  BLOCKSIZE := 4k
+  IMAGE_SIZE := 7244k
+  IMAGES += factory.dlf
+  IMAGE/factory.dlf := \
+	$$(IMAGE/sysupgrade.bin) | senao-header -r 0x0202 -p 0x41 -t 2
+  DEVICE_TITLE := Sitecom WLR-6000
+  DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 swconfig
+endef
+TARGET_DEVICES += wlr-6000
+
+
 define BuildFirmware/RTN56U/squashfs
 	$(call BuildFirmware/Default8M/$(1),$(1),rt-n56u,RT-N56U)
 	-mkrtn56uimg -s $(call sysupname,$(1),rt-n56u)



More information about the lede-commits mailing list