[PATCHv2] ramips: add support for Notion R281
Ian Pangilinan
ian.pangilinan at upd.edu.ph
Tue Jul 26 20:17:03 PDT 2022
From: Ian Pangilinan <braveheart_leo at yahoo.com>
Date: Sun, 27 July 2022 10:55:00 +0800
Subject: [PATCHv2] ramips: add support for Notion R281
Notion R281 is a Cat.6 LTE CPE. It is known as Boosteven R281 in some
markets.
Product link: https://www.notioni.com/productinfo/759146.html
Hardware highlights:
- CPU: MT7621A 2C4T @ 880MHz
- RAM: DDR3 128MB @ 1066MHz
- FLASH: S34ML01G2 128MB SPI NAND
- WLAN0: MT7603E 2.4GHz 802.11bgn 2x2:2 @ 300Mbps
- WLAN1: MT7613BE 5GHz 802.11nac 2x2:2 @ 867Mbps
- SWITCH: MT7530 4-port GbE
- WWAN: Marvell PXA1826 (Nezha3) Profile M26H Board Cat.6 LTE
- SIM: 1x Mini-SIM 2FF
- USB: 1x USB 2.0 Micro Type-B
- BUTTONS: WPS, Reset
- LEDS: Power, Data, Wi-Fi, LAN, Signal1-3
- POWER: 12VDc 2A
The device comes in two configurations. In one configuration the
bootloader loads the kernel at 0xbc140000 (mtd4) and another at
0xbe800000 (mtd5). This patch is for the former. To check, gain root
shell and run 'cat /proc/cmdline', look for 'root='. If
'root=/dev/mtdblock5' then it is already configured as intended. If not,
then run
fw_setenv bootargs console=ttyS1,57600n8 root=/dev/mtdblock5
in the terminal, or run
setenv bootargs console=ttyS1,57600n8 root=/dev/mtdblock5
in U-boot. Reboot then follow the installation instructions below.
This is the flash layout for the mtd4 configuration:
0x000000000000-0x000007f80000 : "ALL"
0x000000000000-0x000000080000 : "Bootloader"
0x000000080000-0x000000100000 : "Config"
0x000000100000-0x000000140000 : "Factory"
0x000000140000-0x000002800000 : "firmware1"
0x0000002d6867-0x000002800000 : "rootfs"
0x000000b00000-0x000002800000 : "rootfs_data"
0x000002800000-0x000004ec0000 : "firmware2"
0x000004ec0000-0x000007f00000 : "ota"
0x000007f00000-0x000007f80000 : "Configbak"
This is the flash layout for the mtd5 configuration:
0x000000000000-0x000007f80000 : "ALL"
0x000000000000-0x000000080000 : "Bootloader"
0x000000080000-0x000000100000 : "Config"
0x000000100000-0x000000140000 : "Factory"
0x000000140000-0x000002800000 : "firmware1"
0x000002800000-0x000004ec0000 : "firmware2"
0x000002996dfc-0x000004ec0000 : "rootfs"
0x000003180000-0x000004ec0000 : "rootfs_data"
0x000004ec0000-0x000007f00000 : "ota"
0x000007f00000-0x000007f80000 : "Configbak"
This is how it looks when flashed to OpenWrt with this patch:
0x000000000000-0x000000080000 : "u-boot"
0x000000080000-0x0000000a0000 : "u-boot-env"
0x000000100000-0x000000140000 : "factory"
0x000000140000-0x000000540000 : "kernel"
0x000000540000-0x000007f00000 : "ubi"
0x000007f00000-0x000007f80000 : "configbak"
Installation Instructions:
Stock firmware runs an old OpenWrt Chaos Calmer release. Unfortunately,
because of the changes in the flash layout, this cannot be sysupgrade-d
readily from stock. Installation will be via tftpboot in the bootloader.
Connect the USB-TTL serial converter as follows, indicated on the board
by the APTX marking near three round PCB pads:
(GND) (RX) (TX) APTX
Baud rate is 57600.
1. Connect the computer to the device via ethernet cable. Set a static
adddress of 10.10.10.3/24 to the wired interface.
2. Start the TFTP server, point it to where the initramfs image is
located. Rename the image to 'test.bin'.
3. Turn on the device. There will be a three-second delay before the
default 'Boot system code via flash' is selected.
4. Interrupt the boot process by pressing 1 to 'System Load Linux to
SDRAM via TFTP'.
5. Press enter to accept the default 'Input device IP (10.10.10.123)'.
6. Press enter to accept the default 'Input server IP (10.10.10.3)'.
7. Press enter to accept the default 'Input Linux Kernel filename ()',
or enter 'test.bin'.
8. Wait for the initramfs image to finish loading.
9. Reconnect the wired interface to any LAN ports of the device via
DHCP.
9. Flash the sysupgrade image at
http://192.168.1.1/cgi-bin/luci/admin/system/flash
What Works?
- LEDs
- Buttons
- Wired LAN and WAN
- Wireless LAN
What Doesn't?
- Wireless WAN
The only configurable LEDs are the red and white data, and white Wi-Fi
LEDs. I use the red data LED as status indicator for OpenWrt. The white
LAN LED is controlled by the switch and functions as expected, as well
as the three green signal LED indicators controlled by the WWAN. I setup
the WPS button to work as a Wi-Fi/rfkill button. There is also an
exported GPIO to reset the WWAN. These are the same LEDs and GPIO found
on the stock firmware.
Support for WWAN could come at a later date. I have setup LAN1 of the
device as WAN.
Signed-off-by: Ian Pangilinan <braveheart_leo at yahoo.com>
---
package/boot/uboot-envtools/files/ramips | 1 +
.../linux/ramips/dts/mt7621_notion_r281.dts (new) | 203
+++++++++++++++++
target/linux/ramips/image/mt7621.mk | 15 +++
.../mt7621/base-files/etc/board.d/02_network | 3 ++
.../mt7621/base-files/lib/upgrade/platform.sh | 1 +
5 files changed, 223 insertions(+), 0 deletion(-)
create mode 100644 target/linux/ramips/dts/mt7621_notion_r281.dts
diff --git a/package/boot/uboot-envtools/files/ramips
b/package/boot/uboot-envtools/files/ramips
index eebc08d65d..1f62d6b70f 100644
--- a/package/boot/uboot-envtools/files/ramips
+++ b/package/boot/uboot-envtools/files/ramips
@@ -61,6 +63,7 @@ linksys,ea7500-v2|\
linksys,ea8100-v1|\
linksys,ea8100-v2|\
mts,wg430223|\
+notion,r281|\
xiaomi,mi-router-3g|\
xiaomi,mi-router-3-pro|\
xiaomi,mi-router-4|\
diff --git a/target/linux/ramips/dts/mt7621_notion_r281.dts
b/target/linux/ramips/dts/mt7621_notion_r281.dts
new file mode 100644
index 0000000000..d15cb2fffa
--- /dev/null
+++ b/target/linux/ramips/dts/mt7621_notion_r281.dts
@@ -0,0 +1,203 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+// Copyright (C) 2022, Ian Pangilinan <braveheart_leo at yahoo.com>
+
+#include "mt7621.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+ compatible = "notion,r281", "mediatek,mt7621-soc";
+ model = "Notion R281";
+
+ aliases {
+ led-boot = &led_red;
+ led-failsafe = &led_red;
+ /* led-running: skip this LED event as we use
+ * the red LED indicator for no data,
+ * which will leave it in the default-on state
+ */
+ led-upgrade = &led_red;
+ label-mac-device = &label_mac;
+ };
+
+ gpio-export {
+ compatible = "gpio-export";
+ #size-cells = <0>;
+
+ reset_cp {
+ gpio-export,name = "reset_cp";
+ gpio-export,output = <0>;
+ gpios = <&gpio 5 GPIO_ACTIVE_HIGH>;
+ };
+ };
+
+ leds {
+ compatible = "gpio-leds";
+
+ led_red: led-0 {
+ label = "red:data";
+ gpios = <&gpio 16 GPIO_ACTIVE_HIGH>;
+ };
+
+ led-1 {
+ label = "white:data";
+ gpios = <&gpio 15 GPIO_ACTIVE_HIGH>;
+ };
+
+ led-2 {
+ label = "white:wifi";
+ gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
+ linux,default-trigger = "phy0tpt";
+ };
+ };
+
+ keys {
+ compatible = "gpio-keys";
+
+ /* use wps as wifi button */
+ key-wifi {
+ label = "wifi";
+ gpios = <&gpio 10 GPIO_ACTIVE_LOW>;
+ linux,code = <KEY_RFKILL>;
+ };
+
+ key-reset {
+ label = "reset";
+ gpios = <&gpio 7 GPIO_ACTIVE_LOW>;
+ linux,code = <KEY_RESTART>;
+ };
+ };
+};
+
+&state_default {
+ gpio {
+ groups = "jtag", "uart3";
+ function = "gpio";
+ };
+};
+
+&pcie {
+ status = "okay";
+};
+
+&pcie0 {
+ label_mac: wifi at 0,0 {
+ compatible = "pci14c3,7603";
+ reg = <0x0 0 0 0 0>;
+
+ mediatek,mtd-eeprom = <&factory 0x0>;
+ ieee80211-freq-limit = <2400000 2500000>;
+
+ nvmem-cells = <&macaddr_factory_4>;
+ nvmem-cell-names = "mac-address";
+ };
+};
+
+&pcie1 {
+ wifi at 0,0 {
+ compatible = "pci14c3,7663";
+ reg = <0x0 0 0 0 0>;
+
+ mediatek,mtd-eeprom = <&factory 0x8000>;
+ ieee80211-freq-limit = <5000000 6000000>;
+
+ nvmem-cells = <&macaddr_factory_8004>;
+ nvmem-cell-names = "mac-address";
+ };
+};
+
+&nand {
+ status = "okay";
+
+ partitions {
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ partition at 0 {
+ label = "u-boot";
+ reg = <0x0 0x80000>;
+ read-only;
+ };
+
+ /* allow setting u-boot-env vars */
+ partition at 80000 {
+ label = "u-boot-env";
+ reg = <0x80000 0x20000>;
+ };
+
+ factory: partition at 100000 {
+ label = "factory";
+ reg = <0x100000 0x40000>;
+ read-only;
+ };
+
+ /* set kernel mtdsize to 4MB */
+ partition at 140000 {
+ label = "kernel";
+ reg = <0x140000 0x400000>;
+ };
+
+ /* convert firmware1, firmware2, ota from stock to ubi */
+ partition at 540000 {
+ label = "ubi";
+ reg = <0x540000 0x79c0000>;
+ };
+
+ partition at 7f00000 {
+ label = "configbak";
+ reg = <0x7f00000 0x80000>;
+ read-only;
+ };
+
+ /* BBT probably contained in the last 0x80000 or 512K bytes */
+ };
+};
+
+&switch0 {
+ ports {
+ port at 0 {
+ status = "okay";
+ label = "wan";
+ };
+
+ port at 1 {
+ status = "okay";
+ label = "lan2";
+ };
+
+ port at 2 {
+ status = "okay";
+ label = "lan3";
+ };
+
+ port at 3 {
+ status = "okay";
+ label = "lan4";
+ };
+ };
+};
+
+&gmac0 {
+ nvmem-cells = <&macaddr_factory_4>;
+ nvmem-cell-names = "mac-address";
+ mac-address-increment = <1>;
+};
+
+&factory {
+ compatible = "nvmem-cells";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ /* WLAN24 MAC address */
+ macaddr_factory_4: macaddr at 4 {
+ reg = <0x4 0x6>;
+ };
+
+ /* WLAN5 MAC address */
+ macaddr_factory_8004: macaddr at 8004 {
+ reg = <0x8004 0x6>;
+ };
+};
diff --git a/target/linux/ramips/dts/mt7621_tozed_s12-unisoc-plus.dts
b/target/linux/ramips/dts/mt7621_tozed_s12-unisoc-plus.dts
new file mode 100644
index 0000000000..ff7816654d
--- /dev/null
+++ b/target/linux/ramips/dts/mt7621_tozed_s12-unisoc-plus.dts
@@ -0,0 +1,250 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+// Copyright (C) 2022, Ian Pangilinan <braveheart_leo at yahoo.com>
+
+#include "mt7621.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+ compatible = "tozed,s12-unisoc-plus", "mediatek,mt7621-soc";
+ model = "Tozed S12 Plus (UNISOC)";
+
+ chosen {
+ bootargs = "console=ttyS0,115200";
+ };
+
+ aliases {
+ led-boot = &led_power0;
+ led-failsafe = &led_power0;
+ led-running = &led_power1;
+ led-upgrade = &led_power0;
+ label-mac-device = &gmac0;
+ };
+
+ gpio-export {
+ compatible = "gpio-export";
+ #size-cells = <0>;
+
+ /* external LTE antenna 1 */
+ ext_ant0 {
+ gpio-export,name = "ext_ant0";
+ gpios = <&gpio 6 GPIO_ACTIVE_HIGH>;
+ };
+
+ /* external LTE antenna 2 */
+ ext_ant1 {
+ gpio-export,name = "ext_ant1";
+ gpios = <&gpio 7 GPIO_ACTIVE_HIGH>;
+ };
+
+ reset_cp {
+ gpio-export,name = "reset_cp";
+ gpio-export,output = <1>;
+ gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
+ };
+ };
+
+ leds {
+ compatible = "gpio-leds";
+
+ led_power0: led-0 {
+ label = "yellow:power";
+ gpios = <&gpio 29 GPIO_ACTIVE_LOW>;
+ };
+
+ led_power1: led-1 {
+ label = "blue:power";
+ gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
+ };
+
+ led-2 {
+ label = "blue:wifi";
+ gpios = <&gpio 28 GPIO_ACTIVE_LOW>;
+ linux,default-trigger = "phy0tpt";
+ };
+
+ led-3 {
+ label = "red:data";
+ gpios = <&gpio 27 GPIO_ACTIVE_LOW>;
+ };
+
+ led-4 {
+ label = "blue:data";
+ gpios = <&gpio 33 GPIO_ACTIVE_LOW>;
+ };
+
+ led-5 {
+ label = "blue:tel";
+ gpios = <&gpio 31 GPIO_ACTIVE_LOW>;
+ };
+ };
+
+ keys {
+ compatible = "gpio-keys";
+
+ key-reset {
+ label = "reset";
+ gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
+ linux,code = <KEY_RESTART>;
+ };
+
+ key-wps {
+ label = "wps";
+ gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
+ linux,code = <KEY_WPS_BUTTON>;
+ };
+
+ key-wifi {
+ label = "wifi";
+ gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
+ linux,code = <KEY_RFKILL>;
+ };
+ };
+};
+
+&state_default {
+ gpio {
+ groups = "jtag", "rgmii2", "uart3", "wdt";
+ function = "gpio";
+ };
+};
+
+&pcie {
+ status = "okay";
+};
+
+&pcie0 {
+ wifi at 0,0 {
+ compatible = "pci14c3,7662";
+ reg = <0x0 0 0 0 0>;
+
+ mediatek,mtd-eeprom = <&factory 0x8000>;
+ ieee80211-freq-limit = <5000000 6000000>;
+
+ nvmem-cells = <&macaddr_factory_8004>;
+ nvmem-cell-names = "mac-address";
+ };
+};
+
+&pcie1 {
+ wifi at 0,0 {
+ compatible = "pci14c3,7603";
+ reg = <0x0 0 0 0 0>;
+
+ mediatek,mtd-eeprom = <&factory 0x0>;
+ ieee80211-freq-limit = <2400000 2500000>;
+
+ nvmem-cells = <&macaddr_factory_4>;
+ nvmem-cell-names = "mac-address";
+ };
+};
+
+&switch0 {
+ ports {
+ port at 0 {
+ status = "okay";
+ label = "lan4";
+ };
+
+ port at 1 {
+ status = "okay";
+ label = "lan3";
+ };
+
+ port at 2 {
+ status = "okay";
+ label = "lan2";
+ };
+
+ port at 4 {
+ status = "okay";
+ label = "lan1";
+ };
+ };
+};
+
+&spi0 {
+ status = "okay";
+
+ flash at 0 {
+ compatible = "jedec,spi-nor";
+ reg = <0>;
+ spi-max-frequency = <50000000>;
+ m25p,fast-read;
+
+ partitions {
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ partition at 0 {
+ label = "u-boot";
+ reg = <0x0 0x30000>;
+ read-only;
+ };
+
+ partition30000 {
+ label = "u-boot-env";
+ reg = <0x30000 0x8000>;
+ read-only;
+ };
+
+ factory: partition at 40000 {
+ label = "factory";
+ reg = <0x40000 0x10000>;
+ read-only;
+ };
+
+ partition at 50000 {
+ compatible = "denx,uimage";
+ label = "firmware";
+ reg = <0x50000 0xfb0000>;
+ };
+
+ partition at 38000 {
+ label = "tozed-conf";
+ reg = <0x38000 0x8000>;
+ read-only;
+ };
+ };
+ };
+};
+
+ðernet {
+ pinctrl-names = "default";
+ pinctrl-0 = <&mdio_pins>, <&rgmii1_pins>;
+};
+
+&gmac0 {
+ nvmem-cells = <&macaddr_factory_e000>;
+ nvmem-cell-names = "mac-address";
+ mac-address-increment = <1>;
+};
+
+&factory {
+ compatible = "nvmem-cells";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ /* WLAN24 MAC address */
+ macaddr_factory_4: macaddr at 4 {
+ reg = <0x4 0x6>;
+ };
+
+ /* WLAN5 MAC address */
+ macaddr_factory_8004: macaddr at 8004 {
+ reg = <0x8004 0x6>;
+ };
+
+ /* LAN MAC address */
+ macaddr_factory_e000: macaddr at e000 {
+ reg = <0xe000 0x6>;
+ };
+
+ /* WAN MAC address */
+ macaddr_factory_e006: macaddr at e006 {
+ reg = <0xe006 0x6>;
+ };
+};
diff --git a/target/linux/ramips/image/mt7621.mk
b/target/linux/ramips/image/mt7621.mk
index aa7adeee60..d9a4c999db 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -1451,6 +1451,21 @@ define Device/netis_wf2881
endef
TARGET_DEVICES += netis_wf2881
+define Device/notion_r281
+ $(Device/dsa-migration)
+ BLOCKSIZE := 128k
+ PAGESIZE := 2048
+ KERNEL_SIZE := 4096k
+ IMAGE_SIZE := 129792k
+ UBINIZE_OPTS := -E 5
+ IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
+ DEVICE_VENDOR := Notion
+ DEVICE_MODEL := R281
+ DEVICE_PACKAGES := kmod-usb3 kmod-mt7603 kmod-mt7615e
kmod-mt7663-firmware-ap \
+ kmod-usb-net-rndis kmod-usb-acm comgt-ncm uboot-envtools
+endef
+TARGET_DEVICES += notion_r281
+
define Device/oraybox_x3a
$(Device/dsa-migration)
$(Device/uimage-lzma-loader)
diff --git
a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
index 29336bad68..1934194f8c 100644
--- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
@@ -77,6 +78,9 @@ ramips_setup_interfaces()
mikrotik,routerboard-760igs)
ucidef_set_interfaces_lan_wan "lan2 lan3 lan4 lan5" "wan sfp"
;;
+ notion,r281)
+ ucidef_set_interfaces_lan_wan "lan2 lan3 lan4" "wan"
+ ;;
tplink,eap235-wall-v1|\
tplink,eap615-wall-v1)
ucidef_set_interface_lan "lan0 lan1 lan2 lan3"
diff --git
a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh
b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh
index b4dc34fbec..6654c274f9 100755
--- a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh
@@ -84,6 +84,7 @@ platform_do_upgrade() {
netgear,wac104|\
netgear,wac124|\
netis,wf2881|\
+ notion,r281|\
raisecom,msg1500-x-00|\
sercomm,na502|\
sercomm,na502s|\
More information about the openwrt-devel
mailing list