Преглед на файлове

Merge pull request #1290 from kb-light/er-x-sfp-v2017.1.x

Backport er-x-sfp (master -> v2017.1.x)
Matthias Schiffer преди 6 години
родител
ревизия
a4ce8474ff

+ 3 - 0
package/gluon-web-network/i18n/de.po

@@ -22,6 +22,9 @@ msgstr "Deaktiviert"
 msgid "Enable PoE Passthrough"
 msgid "Enable PoE Passthrough"
 msgstr "PoE-Passthrough aktivieren"
 msgstr "PoE-Passthrough aktivieren"
 
 
+msgid "Enable PoE Power Port %s"
+msgstr "PoE-Ausgabe auf Port %s aktivieren"
+
 msgid "Enable meshing on the LAN interface"
 msgid "Enable meshing on the LAN interface"
 msgstr "Mesh auf dem LAN-Port aktivieren"
 msgstr "Mesh auf dem LAN-Port aktivieren"
 
 

+ 3 - 0
package/gluon-web-network/i18n/fr.po

@@ -22,6 +22,9 @@ msgstr "Désactivé"
 msgid "Enable PoE Passthrough"
 msgid "Enable PoE Passthrough"
 msgstr ""
 msgstr ""
 
 
+msgid "Enable PoE Power Port %s"
+msgstr ""
+
 msgid "Enable meshing on the LAN interface"
 msgid "Enable meshing on the LAN interface"
 msgstr "Activer le réseau MESH sur le port LAN"
 msgstr "Activer le réseau MESH sur le port LAN"
 
 

+ 3 - 0
package/gluon-web-network/i18n/gluon-web-network.pot

@@ -13,6 +13,9 @@ msgstr ""
 msgid "Enable PoE Passthrough"
 msgid "Enable PoE Passthrough"
 msgstr ""
 msgstr ""
 
 
+msgid "Enable PoE Power Port %s"
+msgstr ""
+
 msgid "Enable meshing on the LAN interface"
 msgid "Enable meshing on the LAN interface"
 msgstr ""
 msgstr ""
 
 

+ 9 - 1
package/gluon-web-network/luasrc/lib/gluon/web/model/admin/network.lua

@@ -110,7 +110,15 @@ uci:foreach("system", "gpio_switch", function(s)
 		if not section then
 		if not section then
 			section = f:section(Section)
 			section = f:section(Section)
 		end
 		end
-		local poe = section:option(Flag, s[".name"], translate("Enable " .. s.name))
+
+		local port = s.name:match("^PoE Power Port(%d*)$")
+		local name
+		if port then
+			name = translatef("Enable PoE Power Port %s", port)
+		else
+			name = translate("Enable " .. s.name)
+		end
+		local poe = section:option(Flag, s[".name"], name)
 		poe.default = uci:get_bool("system", s[".name"], "value")
 		poe.default = uci:get_bool("system", s[".name"], "value")
 
 
 		function poe:write(data)
 		function poe:write(data)

+ 35 - 0
patches/lede/0040-ramips-use-GPIO_ACTIVE-macros-in-UBNT-ERX.dts.patch

@@ -0,0 +1,35 @@
+From: Sven Roederer <devel-sven@geroedel.de>
+Date: Fri, 5 May 2017 22:18:44 +0200
+Subject: ramips: use GPIO_ACTIVE macros in UBNT-ERX.dts
+
+- reorder includes
+- use GPIO_ACTIVE_LOW macro instead of hardcoded "1"
+
+Signed-off-by: Sven Roederer <devel-sven@geroedel.de>
+
+diff --git a/target/linux/ramips/dts/UBNT-ERX.dts b/target/linux/ramips/dts/UBNT-ERX.dts
+index 0b2da95b30f0e181e1929502b8ef1aa50a684f69..cf86bbb7e67b1c521c279367ee9e99fee88fae85 100644
+--- a/target/linux/ramips/dts/UBNT-ERX.dts
++++ b/target/linux/ramips/dts/UBNT-ERX.dts
+@@ -1,9 +1,10 @@
+-#include <dt-bindings/input/input.h>
+-
+ /dts-v1/;
+ 
+ #include "mt7621.dtsi"
+ 
++#include <dt-bindings/gpio/gpio.h>
++#include <dt-bindings/input/input.h>
++
+ / {
+ 	model = "UBNT-ERX";
+ 
+@@ -24,7 +25,7 @@
+ 
+ 		reset {
+ 			label = "reset";
+-			gpios = <&gpio0 12 1>;
++			gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
+ 			linux,code = <KEY_RESTART>;
+ 		};
+ 	};

+ 413 - 0
patches/lede/0041-ramips-add-support-for-Ubiquiti-EdgeRouter-X-SFP.patch

@@ -0,0 +1,413 @@
+From: Sven Roederer <devel-sven@geroedel.de>
+Date: Mon, 29 May 2017 11:24:49 +0200
+Subject: ramips: add support for Ubiquiti EdgeRouter X-SFP
+
+This patch adds support for the Ubiquiti EdgeRouter X-SFP and
+improves support for the EdgeRouter X (PoE-passthrough).
+
+Specification:
+- SoC: MediaTek MT7621AT
+- Flash: 256 MiB
+- RAM: 265 MiB
+- Ethernet: 5 x LAN (1000 Mbps)
+- UART: 1 x UART on PCB (3.3V, RX, TX, GND) - 57600 8N1
+- EdgeRouter X:
+  - 1 x PoE-Passtrough (Eth4)
+  - powered by Wallwart or passive PoE
+- EdgeRouter X-SFP:
+  - 5 x PoE-Out (24V, passive)
+  - 1 x SFP (unknown status)
+  - powered by Wallwart (24V)
+
+Doesn't work:
+* SoC has crypto engine but no open driver.
+* SoC has nat acceleration, but no open driver.
+* This router has 2MB spi flash soldered in but MT
+  nand/spi drivers do not support pin sharing,
+  so it is not accessable and disabled. Stock
+  firmware could read it and it was empty.
+
+Installation
+
+via vendor firmware:
+- build an Initrd-image (> 3MiB) and upload the factory-image
+- initrd can have luci-mod-failsafe
+- flash final firmware via LuCI / sysupgrade on rebooted system
+
+via TFTP:
+- stop uboot into tftp-load into option "1"
+- upload factory.bin image
+
+Signed-off-by: Sven Roederer <devel-sven@geroedel.de>
+
+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 1778dc93297136e3196ad3f74e4b3bea7535cee0..1f5c6429201ba05fc14ff09c6c562d2c114f2a63 100755
+--- a/target/linux/ramips/base-files/etc/board.d/02_network
++++ b/target/linux/ramips/base-files/etc/board.d/02_network
+@@ -146,6 +146,7 @@ ramips_setup_interfaces()
+ 	rb750gr3|\
+ 	rt-n14u|\
+ 	ubnt-erx|\
++	ubnt-erx-sfp|\
+ 	ur-326n4g|\
+ 	wrtnode|\
+ 	wrtnode2p | \
+diff --git a/target/linux/ramips/base-files/etc/board.d/03_gpio_switches b/target/linux/ramips/base-files/etc/board.d/03_gpio_switches
+new file mode 100755
+index 0000000000000000000000000000000000000000..859dfb31f51244e69d3dce5fc80b329cb57729f3
+--- /dev/null
++++ b/target/linux/ramips/base-files/etc/board.d/03_gpio_switches
+@@ -0,0 +1,25 @@
++#!/bin/sh
++
++. /lib/functions/uci-defaults.sh
++. /lib/ramips.sh
++
++board_config_update
++
++board=$(ramips_board_name)
++
++case "$board" in
++ubnt-erx)
++	ucidef_add_gpio_switch "poe_passthrough" "PoE Passthrough" "0"
++	;;
++ubnt-erx-sfp)
++	ucidef_add_gpio_switch "poe_power_port0" "PoE Power Port0" "496"
++	ucidef_add_gpio_switch "poe_power_port1" "PoE Power Port1" "497"
++	ucidef_add_gpio_switch "poe_power_port2" "PoE Power Port2" "498"
++	ucidef_add_gpio_switch "poe_power_port3" "PoE Power Port3" "499"
++	ucidef_add_gpio_switch "poe_power_port4" "PoE Power Port4" "500"
++	;;
++esac
++
++board_config_flush
++
++exit 0
+diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh
+index 17ada648931f16d3e85630dd341defb89ba50d6f..b1091f66b2897a19bd01d4a26a1b3647656fa62b 100755
+--- a/target/linux/ramips/base-files/lib/ramips.sh
++++ b/target/linux/ramips/base-files/lib/ramips.sh
+@@ -466,6 +466,9 @@ ramips_board_detect() {
+ 	*"UBNT-ERX")
+ 		name="ubnt-erx"
+ 		;;
++	*"UBNT-ERX-SFP")
++		name="ubnt-erx-sfp"
++		;;
+ 	*"UR-326N4G")
+ 		name="ur-326n4g"
+ 		;;
+diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh
+index a5cca2080d3b96cef92286b1b15f4f8832d9f8c5..d3efc2dd37ed855a1c0e966e448b67ae73324d5f 100755
+--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
++++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
+@@ -234,7 +234,8 @@ platform_check_image() {
+ 		}
+ 		return 0
+ 		;;
+-	ubnt-erx)
++	ubnt-erx|\
++	ubnt-erx-sfp)
+ 		nand_do_platform_check "$board" "$1"
+ 		return $?;
+ 		;;
+@@ -248,7 +249,8 @@ platform_nand_pre_upgrade() {
+ 	local board=$(ramips_board_name)
+ 
+ 	case "$board" in
+-	ubnt-erx)
++	ubnt-erx|\
++	ubnt-erx-sfp)
+ 		platform_upgrade_ubnt_erx "$ARGV"
+ 		;;
+ 	esac
+@@ -258,7 +260,8 @@ platform_do_upgrade() {
+ 	local board=$(ramips_board_name)
+ 
+ 	case "$board" in
+-    	ubnt-erx)
++	ubnt-erx|\
++	ubnt-erx-sfp)
+ 		nand_do_upgrade "$ARGV"
+ 		;;
+ 	*)
+diff --git a/target/linux/ramips/dts/UBNT-ER-e50.dtsi b/target/linux/ramips/dts/UBNT-ER-e50.dtsi
+new file mode 100644
+index 0000000000000000000000000000000000000000..b38c7194942db9f0a713fd8f707b53820d07c78e
+--- /dev/null
++++ b/target/linux/ramips/dts/UBNT-ER-e50.dtsi
+@@ -0,0 +1,106 @@
++#include "mt7621.dtsi"
++
++#include <dt-bindings/gpio/gpio.h>
++#include <dt-bindings/input/input.h>
++
++/ {
++	compatible = "ubiquiti,edgerouterx";
++
++	memory@0 {
++		device_type = "memory";
++		reg = <0x0 0x10000000>;
++	};
++
++	chosen {
++		bootargs = "console=ttyS0,57600";
++	};
++
++	gpio-keys-polled {
++		compatible = "gpio-keys-polled";
++		#address-cells = <1>;
++		#size-cells = <0>;
++		poll-interval = <20>;
++
++		reset {
++			label = "reset";
++			gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
++			linux,code = <KEY_RESTART>;
++		};
++	};
++};
++
++&ethernet {
++	mtd-mac-address = <&factory 0x22>;
++};
++
++&nand {
++	status = "okay";
++
++	partition@0 {
++		label = "u-boot";
++		reg = <0x0 0x80000>;
++		read-only;
++	};
++
++	partition@80000 {
++		label = "u-boot-env";
++		reg = <0x80000 0x60000>;
++		read-only;
++	};
++
++	factory: partition@e0000 {
++		label = "factory";
++		reg = <0xe0000 0x60000>;
++	};
++
++	partition@140000 {
++		label = "kernel1";
++		reg = <0x140000 0x300000>;
++	};
++
++	partition@440000 {
++		label = "kernel2";
++		reg = <0x440000 0x300000>;
++	};
++
++	partition@740000 {
++		label = "ubi";
++		reg = <0x740000 0xf7c0000>;
++	};
++};
++
++&pinctrl {
++	state_default: pinctrl0 {
++		gpio {
++			ralink,group = "uart2", "uart3", "i2c", "pcie", "rgmii2", "jtag";
++			ralink,function = "gpio";
++		};
++	};
++};
++
++&spi0 {
++	/* This board has 2Mb spi flash soldered in and visible
++	   from manufacturer's firmware.
++	   But this SoC shares spi and nand pins,
++	   and current driver does't handle this sharing well */
++	status = "disabled";
++
++	m25p80@0 {
++		#address-cells = <1>;
++		#size-cells = <1>;
++		compatible = "jedec,spi-nor";
++		reg = <1>;
++		spi-max-frequency = <10000000>;
++		m25p,chunked-io = <32>;
++
++		partition@0 {
++			label = "spi";
++			reg = <0x0 0x200000>;
++			read-only;
++		};
++	};
++};
++
++&xhci {
++	status = "disabled";
++};
+diff --git a/target/linux/ramips/dts/UBNT-ERX-SFP.dts b/target/linux/ramips/dts/UBNT-ERX-SFP.dts
+new file mode 100644
+index 0000000000000000000000000000000000000000..ca26d817211e5a5a20a7da926cd2aee726875780
+--- /dev/null
++++ b/target/linux/ramips/dts/UBNT-ERX-SFP.dts
+@@ -0,0 +1,24 @@
++/dts-v1/;
++
++#include "UBNT-ER-e50.dtsi"
++
++#include <dt-bindings/gpio/gpio.h>
++
++/ {
++	model = "UBNT-ERX-SFP";
++	compatible = "ubiquiti,edgerouterx-sfp";
++
++	i2c-gpio {
++		compatible = "i2c-gpio";
++		gpios = <&gpio0 3 GPIO_ACTIVE_HIGH /* sda */
++		         &gpio0 4 GPIO_ACTIVE_HIGH /* scl */
++		        >;
++		#address-cells = <1>;
++		#size-cells = <0>;
++
++		pca9555@25 {
++			compatible = "pca9555";
++			reg = <0x25>;
++		};
++	};
++};
+diff --git a/target/linux/ramips/dts/UBNT-ERX.dts b/target/linux/ramips/dts/UBNT-ERX.dts
+index cf86bbb7e67b1c521c279367ee9e99fee88fae85..556d1156c352f76a94c6e39bc3b58c88f08815be 100644
+--- a/target/linux/ramips/dts/UBNT-ERX.dts
++++ b/target/linux/ramips/dts/UBNT-ERX.dts
+@@ -1,108 +1,7 @@
+ /dts-v1/;
+ 
+-#include "mt7621.dtsi"
+-
+-#include <dt-bindings/gpio/gpio.h>
+-#include <dt-bindings/input/input.h>
++#include "UBNT-ER-e50.dtsi"
+ 
+ / {
+ 	model = "UBNT-ERX";
+-
+-	memory@0 {
+-		device_type = "memory";
+-		reg = <0x0 0x10000000>;
+-	};
+-
+-	chosen {
+-		bootargs = "console=ttyS0,57600";
+-	};
+-
+-	gpio-keys-polled {
+-		compatible = "gpio-keys-polled";
+-		#address-cells = <1>;
+-		#size-cells = <0>;
+-		poll-interval = <20>;
+-
+-		reset {
+-			label = "reset";
+-			gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
+-			linux,code = <KEY_RESTART>;
+-		};
+-	};
+-};
+-
+-&ethernet {
+-	mtd-mac-address = <&factory 0x22>;
+-};
+-
+-&nand {
+-	status = "okay";
+-
+-	partition@0 {
+-		label = "u-boot";
+-		reg = <0x0 0x80000>;
+-		read-only;
+-	};
+-
+-	partition@80000 {
+-		label = "u-boot-env";
+-		reg = <0x80000 0x60000>;
+-		read-only;
+-	};
+-
+-	factory: partition@e0000 {
+-		label = "factory";
+-		reg = <0xe0000 0x60000>;
+-	};
+-
+-	partition@140000 {
+-		label = "kernel1";
+-		reg = <0x140000 0x300000>;
+-	};
+-
+-	partition@440000 {
+-		label = "kernel2";
+-		reg = <0x440000 0x300000>;
+-	};
+-
+-	partition@740000 {
+-		label = "ubi";
+-		reg = <0x740000 0xf7c0000>;
+-	};
+-};
+-
+-&pinctrl {
+-	state_default: pinctrl0 {
+-		gpio {
+-			ralink,group = "uart2", "uart3", "i2c", "pcie", "rgmii2", "jtag";
+-			ralink,function = "gpio";
+-		};
+-	};
+-};
+-
+-&spi0 {
+-	/* This board has 2Mb spi flash soldered in and visible
+-	   from manufacturer's firmware.
+-	   But this SoC shares spi and nand pins,
+-	   and current driver does't handle this sharing well */
+-	status = "disabled";
+-
+-	m25p80@0 {
+-		#address-cells = <1>;
+-		#size-cells = <1>;
+-		compatible = "jedec,spi-nor";
+-		reg = <1>;
+-		spi-max-frequency = <10000000>;
+-		m25p,chunked-io = <32>;
+-
+-		partition@0 {
+-			label = "spi";
+-			reg = <0x0 0x200000>;
+-			read-only;
+-		};
+-	};
+-};
+-
+-&xhci {
+-	status = "disabled";
+ };
+diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk
+index 15ea9a13b6310b1454b5b3b92cd8ed30ee6255b3..8218bea84410536151a216cd2cc0300369ad977a 100644
+--- a/target/linux/ramips/image/mt7621.mk
++++ b/target/linux/ramips/image/mt7621.mk
+@@ -144,6 +144,19 @@ define Device/ubnt-erx
+ endef
+ TARGET_DEVICES += ubnt-erx
+ 
++define Device/ubnt-erx-sfp
++  DTS := UBNT-ERX-SFP
++  FILESYSTEMS := squashfs
++  KERNEL_SIZE := 3145728
++  KERNEL := $(KERNEL_DTB) | uImage lzma
++  IMAGES := sysupgrade.tar
++  KERNEL_INITRAMFS := $$(KERNEL) | ubnt-erx-factory-image $(KDIR)/tmp/$$(KERNEL_INITRAMFS_PREFIX)-factory.tar
++  IMAGE/sysupgrade.tar := sysupgrade-tar | append-metadata
++  DEVICE_TITLE := Ubiquiti EdgeRouter X-SFP
++  DEVICE_PACKAGES := -kmod-mt76 -kmod-rt2x00-lib -kmod-mac80211 -kmod-cfg80211 -wpad-mini -iwinfo kmod-i2c-algo-pca kmod-gpio-pca953x kmod-i2c-gpio-custom
++endef
++TARGET_DEVICES += ubnt-erx-sfp
++
+ define Device/vr500
+   DTS := VR500
+   IMAGE_SIZE := 66453504

+ 19 - 5
targets/ramips-mt7621

@@ -1,15 +1,29 @@
-# D-Link
+# BROKEN: No AP+IBSS support, 11s has high packet loss
+if [ "$BROKEN" ]; then
+
+## D-Link
 
 
 device d-link-dir-860l-b1 dir-860l-b1
 device d-link-dir-860l-b1 dir-860l-b1
 
 
-# Ubiquiti
+
+## ZBT
+
+device zbt-wg3526 zbt-wg3526
+factory
+
+fi
+
+
+# Devices without WLAN
+
+## Ubiquiti
 
 
 device ubnt-erx ubnt-erx
 device ubnt-erx ubnt-erx
 packages '-hostapd-mini'
 packages '-hostapd-mini'
 factory
 factory
 sysupgrade '.tar'
 sysupgrade '.tar'
 
 
-# ZBT
-
-device zbt-wg3526 zbt-wg3526
+device ubnt-erx-sfp ubnt-erx-sfp
+packages '-hostapd-mini'
 factory
 factory
+sysupgrade '.tar'

+ 1 - 1
targets/targets.mk

@@ -4,6 +4,7 @@ $(eval $(call GluonTarget,ar71xx,nand))
 $(eval $(call GluonTarget,brcm2708,bcm2708))
 $(eval $(call GluonTarget,brcm2708,bcm2708))
 $(eval $(call GluonTarget,brcm2708,bcm2709))
 $(eval $(call GluonTarget,brcm2708,bcm2709))
 $(eval $(call GluonTarget,mpc85xx,generic))
 $(eval $(call GluonTarget,mpc85xx,generic))
+$(eval $(call GluonTarget,ramips,mt7621))
 $(eval $(call GluonTarget,x86,generic))
 $(eval $(call GluonTarget,x86,generic))
 $(eval $(call GluonTarget,x86,geode))
 $(eval $(call GluonTarget,x86,geode))
 $(eval $(call GluonTarget,x86,64))
 $(eval $(call GluonTarget,x86,64))
@@ -12,7 +13,6 @@ ifneq ($(BROKEN),)
 $(eval $(call GluonTarget,ar71xx,mikrotik)) # BROKEN: no sysupgrade support
 $(eval $(call GluonTarget,ar71xx,mikrotik)) # BROKEN: no sysupgrade support
 $(eval $(call GluonTarget,ipq806x)) # BROKEN: Untested
 $(eval $(call GluonTarget,ipq806x)) # BROKEN: Untested
 $(eval $(call GluonTarget,mvebu)) # BROKEN: No AP+IBSS or 11s support
 $(eval $(call GluonTarget,mvebu)) # BROKEN: No AP+IBSS or 11s support
-$(eval $(call GluonTarget,ramips,mt7621)) # BROKEN: No AP+IBSS support, 11s has high packet loss
 $(eval $(call GluonTarget,ramips,mt7628)) # BROKEN: No AP+IBSS support
 $(eval $(call GluonTarget,ramips,mt7628)) # BROKEN: No AP+IBSS support
 $(eval $(call GluonTarget,ramips,rt305x)) # BROKEN: No AP+IBSS support
 $(eval $(call GluonTarget,ramips,rt305x)) # BROKEN: No AP+IBSS support
 $(eval $(call GluonTarget,sunxi)) # BROKEN: Untested
 $(eval $(call GluonTarget,sunxi)) # BROKEN: Untested