mediatek: add support for Newland NL-WR8103/MR3000D-CIq(256MB RAM version)

Hardware specification:
SoC: MediaTek MT7981B 2x A53
Flash: FORESEE F35SQA001G 128MB
RAM: DDR3 256MB
Ethernet: 4x 10/100/1000 Mbps
Switch: MediaTek MT7531AE
WiFi: MediaTek MT7976C
Button: Reset, Mesh
Power: DC 12V 1A
This commit is contained in:
Aabandon 2024-08-28 11:07:44 +08:00 committed by hanwckf
parent 6cf32632e8
commit d10d8a3174
11 changed files with 262 additions and 5 deletions

View File

@ -37,6 +37,8 @@ CONFIG_TARGET_DEVICE_mediatek_mt7981_DEVICE_xiaomi_mi-router-wr30u-112m=y
CONFIG_TARGET_DEVICE_PACKAGES_mediatek_mt7981_DEVICE_xiaomi_mi-router-wr30u-112m=""
CONFIG_TARGET_DEVICE_mediatek_mt7981_DEVICE_xiaomi_mi-router-wr30u-stock=y
CONFIG_TARGET_DEVICE_PACKAGES_mediatek_mt7981_DEVICE_xiaomi_mi-router-wr30u-stock=""
CONFIG_TARGET_DEVICE_mediatek_mt7981_DEVICE_newland_nl-wr8103=y
CONFIG_TARGET_DEVICE_PACKAGES_mediatek_mt7981_DEVICE_newland_nl-wr8103=""
CONFIG_DEVEL=y
CONFIG_TOOLCHAINOPTS=y
CONFIG_BUSYBOX_CUSTOM=y

View File

@ -55,6 +55,8 @@ CONFIG_TARGET_DEVICE_mediatek_mt7981_DEVICE_ruijie-rg-x30e-pro-firmware2=y
CONFIG_TARGET_DEVICE_PACKAGES_mediatek_mt7981_DEVICE_ruijie-rg-x30e-pro-firmware2=""
CONFIG_TARGET_DEVICE_mediatek_mt7981_DEVICE_ruijie-rg-x30e-pro=y
CONFIG_TARGET_DEVICE_PACKAGES_mediatek_mt7981_DEVICE_ruijie-rg-x30e-pro=""
CONFIG_TARGET_DEVICE_mediatek_mt7981_DEVICE_newland_nl-wr8103=y
CONFIG_TARGET_DEVICE_PACKAGES_mediatek_mt7981_DEVICE_newland_nl-wr8103=""
CONFIG_DEVEL=y
CONFIG_TOOLCHAINOPTS=y
CONFIG_BUSYBOX_CUSTOM=y

View File

@ -21,6 +21,7 @@ jdcloud,re-cp-03)
;;
*360,t7* |\
ruijie,rg-x30e* |\
*newland,nl-wr8103* |\
livinet,zr-3020*)
ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x20000" "0x20000" "1"
;;

View File

@ -759,6 +759,7 @@ setup_model()
*honor,fur-602* |\
konka,komi-a31 |\
*nokia,ea0326gmp* |\
newland,nl-wr8103 |\
nradio,wt9103 |\
ruijie,rg-x30e* |\
*7981*)

View File

@ -23,7 +23,7 @@ Index: linux-5.4.255/drivers/mtd/nand/spi/foresee.c
===================================================================
--- /dev/null
+++ linux-5.4.255/drivers/mtd/nand/spi/foresee.c
@@ -0,0 +1,147 @@
@@ -0,0 +1,145 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2020 Grandstream Networks, Inc
@ -39,9 +39,7 @@ Index: linux-5.4.255/drivers/mtd/nand/spi/foresee.c
+#define SPINAND_MFR_FORESEE 0xCD
+
+static SPINAND_OP_VARIANTS(read_cache_variants,
+ SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 2, NULL, 0),
+ SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0),
+ SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 1, NULL, 0),
+ SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0),
+ SPINAND_PAGE_READ_FROM_CACHE_OP(true, 0, 1, NULL, 0),
+ SPINAND_PAGE_READ_FROM_CACHE_OP(false, 0, 1, NULL, 0));
@ -51,7 +49,7 @@ Index: linux-5.4.255/drivers/mtd/nand/spi/foresee.c
+ SPINAND_PROG_LOAD(true, 0, NULL, 0));
+
+static SPINAND_OP_VARIANTS(update_cache_variants,
+ SPINAND_PROG_LOAD_X4(false, 0, NULL, 0),
+ SPINAND_PROG_LOAD_X4(true, 0, NULL, 0),
+ SPINAND_PROG_LOAD(true, 0, NULL, 0));
+
+static int fsxxndxxg_ooblayout_ecc(struct mtd_info *mtd, int section,

View File

@ -10,7 +10,7 @@
#include "mt7981.dtsi"
/ {
model = "JCG Q30";
model = "JCG Q30 / MR3000D-CIq(512MB RAM version)";
compatible = "jcg,q30", "mediatek,mt7981";
aliases {

View File

@ -0,0 +1,223 @@
/dts-v1/;
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include "mt7981.dtsi"
/ {
model = "Newland NL-WR8103 / MR3000D-CIq(256MB RAM version)";
compatible = "newland,nl-wr8103", "mediatek,mt7981";
aliases {
led-boot = &status_red_led;
led-failsafe = &status_red_led;
led-running = &status_blue_led;
led-upgrade = &status_green_led;
};
chosen {
bootargs = "console=ttyS0,115200n1 loglevel=8 \
earlycon=uart8250,mmio32,0x11002000";
};
memory {
reg = <0 0x40000000 0 0x10000000>;
};
leds {
compatible = "gpio-leds";
status_red_led: led-0 {
label = "red:status";
gpios = <&pio 10 GPIO_ACTIVE_LOW>;
};
status_green_led: led-1 {
label = "green:status";
gpios = <&pio 11 GPIO_ACTIVE_LOW>;
};
status_blue_led: led-2 {
label = "blue:status";
gpios = <&pio 12 GPIO_ACTIVE_LOW>;
};
};
gpio-keys {
compatible = "gpio-keys";
button-reset {
label = "reset";
linux,code = <KEY_RESTART>;
gpios = <&pio 0 GPIO_ACTIVE_LOW>;
};
button-mesh {
label = "mesh";
gpios = <&pio 1 GPIO_ACTIVE_LOW>;
linux,code = <BTN_9>;
linux,input-type = <EV_SW>;
};
};
gsw: gsw@0 {
compatible = "mediatek,mt753x";
mediatek,ethsys = <&ethsys>;
#address-cells = <1>;
#size-cells = <0>;
};
nmbm_spim_nand {
compatible = "generic,nmbm";
#address-cells = <1>;
#size-cells = <1>;
lower-mtd-device = <&spi_nand>;
forced-create;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "BL2";
reg = <0x00 0x100000>;
};
partition@100000 {
label = "u-boot-env";
reg = <0x100000 0x80000>;
};
partition@180000 {
label = "Factory";
reg = <0x180000 0x200000>;
};
partition@380000 {
label = "FIP";
reg = <0x380000 0x200000>;
};
partition@580000 {
label = "ubi";
reg = <0x580000 0x7200000>;
};
};
};
};
&uart0 {
status = "okay";
};
&watchdog {
status = "okay";
};
&eth {
status = "okay";
gmac0: mac@0 {
compatible = "mediatek,eth-mac";
reg = <0>;
phy-mode = "2500base-x";
fixed-link {
speed = <2500>;
full-duplex;
pause;
};
};
gmac1: mac@1 {
compatible = "mediatek,eth-mac";
reg = <1>;
phy-mode = "gmii";
phy-handle = <&phy0>;
};
mdio: mdio-bus {
#address-cells = <1>;
#size-cells = <0>;
phy0: ethernet-phy@0 {
compatible = "ethernet-phy-id03a2.9461";
reg = <0>;
phy-mode = "gmii";
nvmem-cells = <&phy_calibration>;
nvmem-cell-names = "phy-cal-data";
};
};
};
&gsw {
mediatek,mdio = <&mdio>;
mediatek,mdio_master_pinmux = <0>;
reset-gpios = <&pio 39 0>;
interrupt-parent = <&pio>;
interrupts = <38 IRQ_TYPE_LEVEL_HIGH>;
status = "okay";
port6: port@6 {
compatible = "mediatek,mt753x-port";
mediatek,ssc-on;
reg = <6>;
phy-mode = "sgmii";
fixed-link {
speed = <2500>;
full-duplex;
};
};
};
&hnat {
mtketh-wan = "eth1";
mtketh-lan = "eth0";
mtketh-max-gmac = <2>;
status = "okay";
};
&spi0 {
pinctrl-names = "default";
pinctrl-0 = <&spi0_flash_pins>;
status = "okay";
spi_nand: spi_nand@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "spi-nand";
reg = <0>;
spi-max-frequency = <52000000>;
spi-tx-bus-width = <4>;
spi-rx-bus-width = <4>;
spi-cal-enable;
spi-cal-mode = "read-data";
spi-cal-datalen = <7>;
spi-cal-data = /bits/ 8 <0x53 0x50 0x49 0x4E 0x41 0x4E 0x44>; /* 'SPINAND' */
spi-cal-addrlen = <5>;
spi-cal-addr = /bits/ 32 <0x0 0x0 0x0 0x0 0x0>;
};
};
&pio {
spi0_flash_pins: spi0-pins {
mux {
function = "spi";
groups = "spi0", "spi0_wp_hold";
};
conf-pu {
pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP";
drive-strength = <MTK_DRIVE_8mA>;
bias-pull-up = <MTK_PUPD_SET_R1R0_11>;
};
conf-pd {
pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO";
drive-strength = <MTK_DRIVE_8mA>;
bias-pull-down = <MTK_PUPD_SET_R1R0_11>;
};
};
};

View File

@ -667,6 +667,23 @@ define Device/nokia_ea0326gmp
endef
TARGET_DEVICES += nokia_ea0326gmp
define Device/newland_nl-wr8103
DEVICE_VENDOR := Newland
DEVICE_MODEL := NL-WR8103
DEVICE_DTS := mt7981-newland-nl-wr8103
DEVICE_DTS_DIR := $(DTS_DIR)/mediatek
SUPPORTED_DEVICES := newland,nl-wr8103
UBINIZE_OPTS := -E 5
BLOCKSIZE := 128k
PAGESIZE := 2048
IMAGE_SIZE := 116736k
KERNEL_IN_UBI := 1
IMAGES += factory.bin
IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE)
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
endef
TARGET_DEVICES += newland_nl-wr8103
define Device/nradio_wt9103
DEVICE_VENDOR := NRADIO
DEVICE_MODEL := WT9103

View File

@ -66,6 +66,11 @@ routerich,ax3000)
ucidef_set_led_netdev "wlan2g" "WLAN 2G" "blue:wlan2g" "ra0"
ucidef_set_led_netdev "wlan5g" "WLAN 5G" "red:wlan5g" "rax0"
;;
*newland,nl-wr8103*)
ucidef_set_led_default "red" "RED" "red:status" "0"
ucidef_set_led_default "green" "GREEN" "green:status" "0"
ucidef_set_led_default "blue" "BLUE" "blue:status" "1"
;;
esac
board_config_flush

View File

@ -47,6 +47,7 @@ mediatek_setup_interfaces()
*clt,r30b1* |\
h3c,nx30pro |\
*imou,lc-hx3001* |\
*newland,nl-wr8103* |\
*konka,komi-a31*)
ucidef_set_interfaces_lan_wan "eth0" "eth1"
ucidef_add_switch "switch0" \
@ -282,6 +283,11 @@ mediatek_setup_macs()
echo "MacAddress=$b1mac" >> ${b1dat}
fi
;;
*newland,nl-wr8103*)
local wifi_mac=$(mtd_get_mac_binary Factory 0x4)
lan_mac=$(macaddr_add $wifi_mac -1)
wan_mac=$(macaddr_add $wifi_mac -2)
;;
*)
wan_mac=$(mtd_get_mac_binary $part_name $wan_mac_offset)
lan_mac=$(mtd_get_mac_binary $part_name $lan_mac_offset)

View File

@ -209,6 +209,7 @@ platform_do_upgrade() {
*konka,komi-a31* |\
routerich,ax3000 |\
*nokia,ea0326gmp* |\
*newland,nl-wr8103* |\
*snand*)
nand_do_upgrade "$1"
;;
@ -258,6 +259,7 @@ platform_check_image() {
*honor,fur-602* |\
*konka,komi-a31* |\
*nokia,ea0326gmp* |\
*newland,nl-wr8103* |\
nradio,wt9103 |\
*snand* |\
*emmc* |\