ramips: add preliminary support for WIO ONE
authorFelix Fietkau <nbd@nbd.name>
Mon, 15 Oct 2018 10:52:34 +0000 (12:52 +0200)
committerFelix Fietkau <nbd@nbd.name>
Sat, 11 Dec 2021 12:53:01 +0000 (13:53 +0100)
Signed-off-by: Felix Fietkau <nbd@nbd.name>
target/linux/ramips/dts/mt7621_wio-one.dts [new file with mode: 0644]
target/linux/ramips/image/mt7621.mk
target/linux/ramips/mt7621/base-files/etc/board.d/02_network

diff --git a/target/linux/ramips/dts/mt7621_wio-one.dts b/target/linux/ramips/dts/mt7621_wio-one.dts
new file mode 100644 (file)
index 0000000..28cfd6a
--- /dev/null
@@ -0,0 +1,157 @@
+/dts-v1/;
+
+#include "mt7621.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+       compatible = "wio,wio-one", "mediatek,mt7621-soc";
+       model = "WIO ONE";
+
+       aliases {
+               led-boot = &led_power;
+               led-failsafe = &led_power;
+               led-running = &led_power;
+               led-upgrade = &led_power;
+       };
+
+       chosen {
+               bootargs = "console=ttyS0,57600";
+       };
+
+       gpio-leds {
+               compatible = "gpio-leds";
+
+               led_power: power {
+                       label = "wio-one:green:power";
+                       gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
+               };
+
+               alarm {
+                       label = "wio-one:red:alarm";
+                       gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
+               };
+       };
+
+       gpio_export {
+               compatible = "gpio-export";
+               #size-cells = <0>;
+
+               usb_power {
+                       gpio-export,name = "usb";
+                       gpio-export,output = <1>;
+                       gpios = <&gpio 17 GPIO_ACTIVE_HIGH>;
+               };
+       };
+};
+
+&spi0 {
+       status = "okay";
+
+       flash@0 {
+               compatible = "jedec,spi-nor";
+               reg = <0>;
+               spi-max-frequency = <104000000>;
+               m25p,fast-read;
+               m25p,chunked-io = <32>;
+
+               partitions {
+                       compatible = "fixed-partitions";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+
+                       partition@0 {
+                               label = "u-boot";
+                               reg = <0x0 0x30000>;
+                               read-only;
+                       };
+
+                       partition@30000 {
+                               label = "u-boot-env";
+                               reg = <0x30000 0x10000>;
+                               read-only;
+                       };
+
+                       factory: partition@40000 {
+                               label = "factory";
+                               reg = <0x40000 0x10000>;
+                               read-only;
+                       };
+
+                       partition@50000 {
+                               label = "firmware";
+                               reg = <0x50000 0xfb0000>;
+                               compatible = "denx,uimage";
+                       };
+               };
+       };
+};
+
+&ethernet {
+       mtd-mac-address = <&factory 4>;
+       mtd-mac-address-increment = <(-2)>;
+};
+
+&switch0 {
+       ports {
+               port@0 {
+                       status = "okay";
+                       label = "lan1";
+               };
+
+               port@1 {
+                       status = "okay";
+                       label = "lan2";
+               };
+
+               port@2 {
+                       status = "okay";
+                       label = "lan3";
+               };
+
+               port@3 {
+                       status = "okay";
+                       label = "lan4";
+               };
+
+               port@4 {
+                       status = "okay";
+                       label = "wan";
+               };
+       };
+};
+
+&state_default {
+       gpio {
+               groups = "i2c", "uart2", "uart3", "rgmii2", "sdhci", "jtag";
+               function = "gpio";
+       };
+};
+
+&pcie {
+       status = "okay";
+};
+
+&pcie0 {
+       mt76@0,0 {
+               reg = <0x0000 0 0 0 0>;
+               mediatek,mtd-eeprom = <&factory 0x8000>;
+               ieee80211-freq-limit = <5000000 6000000>;
+               adant,sas-devid = <1>;
+               adant,sas-gpio = <45 46 47 48>;
+       };
+};
+
+&pcie1 {
+       mt76@0,0 {
+               reg = <0x0000 0 0 0 0>;
+               mediatek,mtd-eeprom = <&factory 0x0000>;
+               adant,sas-devid = <0>;
+               adant,sas-gpio = <41 42 43 44>;
+       };
+};
+
+&xhci {
+       status = "disabled";
+};
index 8b156c2a1c8cb5810364d33b8cf1229bdfcb97db..338645df23fe222b43720ae72372942a521bccb4 100644 (file)
@@ -1658,6 +1658,17 @@ define Device/xzwifi_creativebox-v1
 endef
 TARGET_DEVICES += xzwifi_creativebox-v1
 
+define Device/wio-one
+  SOC := mt7621
+  IMAGE_SIZE := 16064k
+  SUPPORTED_DEVICES := wio,wio-one
+  DEVICE_VENDOR := WIO
+  DEVICE_MODEL := ONE
+  DEVICE_PACKAGES := \
+       kmod-mt7603 kmod-mt76x2 kmod-usb3 wpad-mini
+endef
+TARGET_DEVICES += wio-one
+
 define Device/youhua_wr1200js
   $(Device/dsa-migration)
   IMAGE_SIZE := 16064k
index 47f978baf87940751e4d865ab16f45450991d63d..a2972ce266d4d473c55c0cd697dd8371f55670b5 100644 (file)
@@ -160,6 +160,16 @@ ramips_setup_macs()
                wan_mac=$label_mac
                lan_mac=$(macaddr_add $label_mac 1)
                ;;
+       wio,wio-one)
+               local ethaddr="$(mtd_get_mac_ascii u-boot-env ethaddr)"
+               lan_mac=$(mtd_get_mac_binary factory 40)
+               wan_mac=$(mtd_get_mac_binary factory 46)
+               [ "$ethaddr" = "00:AA:BB:CC:DD:EE" -o "${lan_mac%%:ff:ff:ff}" != "$lan_mac" ] && {
+                       lan_mac=$(mtd_get_mac_binary factory 57344)
+                       wan_mac=$(mtd_get_mac_binary factory 57350)
+               }
+               label_mac=$lan_mac
+               ;;
        esac
 
        [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac