ramips: add support for ipTIME A1004ns
authorSungbo Eo <mans0n@gorani.run>
Thu, 26 Sep 2019 15:21:25 +0000 (00:21 +0900)
committerChuanhong Guo <gch981213@gmail.com>
Sat, 18 Apr 2020 04:35:54 +0000 (12:35 +0800)
ipTIME A1004ns is a 2.4/5GHz band AC750 router, based on MediaTek MT7620A.

Specifications:
- SoC: MT7620A
- RAM: DDR2 128MB
- Flash: SPI NOR 16MB
- WiFi:
  - 2.4GHz: SoC internal
  - 5GHz: MT7610EN
- Ethernet: 5x 10/100/1000Mbps
  - Switch: MT7530BU
- USB: 1x 2.0
- UART:
  - J2: 3.3V, TX, RX, GND (3.3V is the square pad) / 57600 8N1

Installation via web interface:
1.  Flash **initramfs** image through the stock web interface.
2.  Boot into OpenWrt and perform sysupgrade with sysupgrade image.

Revert to stock firmware:
1.  Perform sysupgrade with stock image.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
target/linux/ramips/dts/mt7620a_iptime_a1004ns.dts [new file with mode: 0644]
target/linux/ramips/image/mt7620.mk
target/linux/ramips/mt7620/base-files/etc/board.d/02_network

diff --git a/target/linux/ramips/dts/mt7620a_iptime_a1004ns.dts b/target/linux/ramips/dts/mt7620a_iptime_a1004ns.dts
new file mode 100644 (file)
index 0000000..02b6749
--- /dev/null
@@ -0,0 +1,104 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/dts-v1/;
+
+#include "mt7620a_iptime.dtsi"
+
+/ {
+       compatible = "iptime,a1004ns", "ralink,mt7620a-soc";
+       model = "ipTIME A1004ns";
+
+       aliases {
+               led-boot = &led_cpu;
+               led-failsafe = &led_cpu;
+               led-running = &led_cpu;
+               led-upgrade = &led_cpu;
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               led_cpu: cpu {
+                       label = "a1004ns:blue:cpu";
+                       gpios = <&gpio0 11 GPIO_ACTIVE_LOW>;
+               };
+
+               usb {
+                       label = "a1004ns:blue:usb";
+                       gpios = <&gpio1 15 GPIO_ACTIVE_LOW>;
+                       trigger-sources = <&ohci_port1>, <&ehci_port1>;
+                       linux,default-trigger = "usbport";
+               };
+       };
+
+       keys {
+               compatible = "gpio-keys";
+
+               reset {
+                       label = "reset";
+                       gpios = <&gpio0 1 GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_RESTART>;
+               };
+
+               wps {
+                       label = "wps";
+                       gpios = <&gpio0 2 GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_WPS_BUTTON>;
+               };
+       };
+};
+
+&firmware {
+       reg = <0x30000 0xfd0000>;
+};
+
+&state_default {
+       gpio {
+               ralink,group = "i2c", "uartf", "spi refclk";
+               ralink,function = "gpio";
+       };
+};
+
+&ethernet {
+       pinctrl-names = "default";
+       pinctrl-0 = <&rgmii1_pins &mdio_pins>;
+
+       port@5 {
+               status = "okay";
+               mediatek,fixed-link = <1000 1 1 1>;
+               phy-mode = "rgmii";
+       };
+
+       mdio-bus {
+               status = "okay";
+
+               ethernet-phy@0 {
+                       reg = <0>;
+                       phy-mode = "rgmii";
+               };
+
+               ethernet-phy@1 {
+                       reg = <1>;
+                       phy-mode = "rgmii";
+               };
+
+               ethernet-phy@2 {
+                       reg = <2>;
+                       phy-mode = "rgmii";
+               };
+
+               ethernet-phy@3 {
+                       reg = <3>;
+                       phy-mode = "rgmii";
+               };
+
+               ethernet-phy@4 {
+                       reg = <4>;
+                       phy-mode = "rgmii";
+               };
+
+               ethernet-phy@1f {
+                       reg = <0x1f>;
+                       phy-mode = "rgmii";
+               };
+       };
+};
index 818fd12de754e2817afc5bde0d40ae4c38208a1d..69b9b7d7fd32199c76a81c1c0582ad78650d3b97 100644 (file)
@@ -503,6 +503,17 @@ define Device/iodata_wn-ac733gr3
 endef
 TARGET_DEVICES += iodata_wn-ac733gr3
 
+define Device/iptime_a1004ns
+  SOC := mt7620a
+  IMAGE_SIZE := 16192k
+  UIMAGE_NAME := a1004ns
+  DEVICE_VENDOR := ipTIME
+  DEVICE_MODEL := A1004ns
+  DEVICE_PACKAGES := kmod-mt76x0e kmod-usb2 kmod-usb-ohci \
+       kmod-usb-ledtrig-usbport
+endef
+TARGET_DEVICES += iptime_a1004ns
+
 define Device/iptime_a104ns
   SOC := mt7620a
   IMAGE_SIZE := 8000k
index 44a9db6ece6877eef2e5f7b7248bf857ef2c4c12..8ae50b3df5ad13310e6aa17d8db011de58dfb0bf 100755 (executable)
@@ -143,7 +143,8 @@ ramips_setup_interfaces()
                        "0:lan" "1:lan" "5:wan" "6@eth0"
                ;;
        iodata,wn-ac1167gr|\
-       iodata,wn-ac733gr3)
+       iodata,wn-ac733gr3|\
+       iptime,a1004ns)
                ucidef_add_switch "switch0"
                ucidef_add_switch_attr "switch0" "enable" "false"
                ucidef_add_switch "switch1" \
@@ -312,6 +313,9 @@ ramips_setup_macs()
        iodata,wn-ac733gr3)
                wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr)
                ;;
+       iptime,a1004ns)
+               wan_mac=$(mtd_get_mac_binary u-boot 0x1fc40)
+               ;;
        iptime,a104ns)
                wan_mac=$(macaddr_add "$(mtd_get_mac_binary u-boot 0x1fc20)" 2)
                ;;