Merge pull request #19 from qooke/openwrt-23.05

mediatek: add support for One R35 Mini
This commit is contained in:
padavanonly
2025-04-07 00:16:37 +08:00
committed by GitHub
6 changed files with 337 additions and 0 deletions

View File

@@ -102,6 +102,7 @@ glinet,gl-mt6000)
local envdev=$(find_mmc_part "u-boot-env")
ubootenv_add_uci_config "$envdev" "0x0" "0x80000"
;;
one,r35-mini|\
glinet,gl-mt3000)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x20000"
;;

View File

@@ -743,6 +743,7 @@ setup_model()
*7986*)
MT7986_whnat $num_of_wifi $usbnet
;;
*r35-mini* |\
*mt3000* |\
glinet,x3000-emmc |\
*xe3000* |\

View File

@@ -0,0 +1,316 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;
#include "mt7981.dtsi"
/ {
model = "one r35-mini";
compatible = "one,r35-mini-snand", "mediatek,mt7981";
aliases {
led-boot = &status_led;
led-failsafe = &status_led;
led-running = &status_led;
led-upgrade = &status_led;
};
chosen {
bootargs = "console=ttyS0,115200n1 loglevel=8 \
earlycon=uart8250,mmio32,0x11002000";
};
gpio-keys {
compatible = "gpio-keys";
reset {
label = "reset";
linux,code = <KEY_RESTART>;
gpios = <&pio 1 GPIO_ACTIVE_LOW>;
};
user {
label = "user";
linux,code = <BTN_0>;
linux,input-type = <EV_SW>;
gpios = <&pio 0 GPIO_ACTIVE_LOW>;
};
};
leds {
compatible = "gpio-leds";
status_led: red {
label = "red:system";
gpios = <&pio 9 GPIO_ACTIVE_LOW>;
};
led-0 {
label = "blue0:wifi2g";
gpios = <&pio 34 GPIO_ACTIVE_LOW>;
default-state = "on";
};
led-1 {
label = "blue1:wifi5g";
gpios = <&pio 35 GPIO_ACTIVE_LOW>;
default-state = "on";
};
};
nmbm_spim_nand {
compatible = "generic,nmbm";
#address-cells = <1>;
#size-cells = <1>;
lower-mtd-device = <&spi_nand>;
max-reserved-blocks = <32>;
forced-create;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "BL2";
reg = <0x0000000 0x0100000>;
read-only;
};
partition@100000 {
label = "u-boot-env";
reg = <0x0100000 0x0080000>;
};
partition@180000 {
label = "Factory";
reg = <0x0180000 0x0200000>;
read-only;
};
partition@380000 {
label = "FIP";
reg = <0x0380000 0x0200000>;
read-only;
};
partition@580000 {
label = "log";
reg = <0x0580000 0x0040000>;
};
partition@5c0000 {
label = "ubi";
reg = <0x05c0000 0x7b0c000>;
};
};
};
fan: pwm-fan {
compatible = "pwm-fan";
cooling-min-state = <0>;
cooling-max-state = <3>;
#cooling-cells = <2>;
pwms = <&pwm 0 40000 0>;
pinctrl-0 = <&fan_pins>;
pinctrl-names = "default";
cooling-levels = <64 128 192 255>;
};
};
&cpu_thermal {
trips {
cpu_trip_critical: critical {
temperature = <100000>;
hysteresis = <2000>;
type = "critical";
};
cpu_trip_hot: hot {
temperature = <80000>;
hysteresis = <2000>;
type = "hot";
};
cpu_trip_active: active {
temperature = <60000>;
hysteresis = <2000>;
type = "active";
};
cpu_trip_passive: passive {
temperature = <40000>;
hysteresis = <2000>;
type = "passive";
};
};
cooling-maps {
cpu-active-high {
cooling-device = <&fan 3 3>;
trip = <&cpu_trip_critical>;
};
cpu-active-low {
cooling-device = <&fan 2 2>;
trip = <&cpu_trip_hot>;
};
cpu-active {
cooling-device = <&fan 1 1>;
trip = <&cpu_trip_active>;
};
cpu-passive {
cooling-device = <&fan 0 0>;
trip = <&cpu_trip_passive>;
};
};
};
&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 {
label = "lan";
compatible = "mediatek,eth-mac";
reg = <1>;
phy-mode = "gmii";
phy-handle = <&phy0>;
};
mdio: mdio-bus {
#address-cells = <1>;
#size-cells = <0>;
phy0: phy@0 {
compatible = "ethernet-phy-id03a2.9461";
reg = <0>;
nvmem-cells = <&phy_calibration>;
nvmem-cell-names = "phy-cal-data";
};
phy6: phy@6 {
compatible = "ethernet-phy-id67c9.de0a";
reg = <6>;
reset-gpios = <&pio 39 1>;
reset-assert-us = <600>;
reset-deassert-us = <20000>;
phy-mode = "2500base-x";
};
};
};
&hnat {
mtketh-wan = "eth0";
mtketh-lan = "eth1";
mtketh-ppd = "eth1";
mtketh-max-gmac = <2>;
mtketh-ppe-num = <2>;
status = "okay";
};
&spi0 {
pinctrl-names = "default";
pinctrl-0 = <&spi0_flash_pins>;
status = "okay";
spi_nand: spi_nand@0 {
compatible = "spi-nand";
#address-cells = <1>;
#size-cells = <1>;
reg = <0>;
spi-max-frequency = <52000000>;
spi-tx-bus-width = <4>;
spi-rx-bus-width = <4>;
};
};
&pio {
pwm0_pin: pwm0-pin-g0 {
mux {
function = "pwm";
groups = "pwm0_1";
};
};
fan_pins: fan-pins {
mux {
function = "wa_aice";
groups = "wa_aice3";
};
power {
pins = "SPI2_MISO";
drive-strength = <MTK_DRIVE_8mA>;
mediatek,pull-up-adv = <1>;
};
};
usb_pwr_pins: usb-pins {
mux {
function = "jtag";
groups = "wo0_jtag_0";
};
power {
pins = "WO_JTAG_JTCLK";
drive-strength = <MTK_DRIVE_8mA>;
mediatek,pull-up-adv = <1>;
};
};
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>;
};
};
};
&pwm {
pinctrl-names = "default";
pinctrl-0 = <&pwm0_pin>;
status = "okay";
};
&uart0 {
status = "okay";
};
&pcie {
status = "okay";
};
&xhci {
mediatek,u3p-dis-msk = <0x0>;
phys = <&u2port0 PHY_TYPE_USB2>,
<&u3port0 PHY_TYPE_USB3>;
pinctrl-0 = <&usb_pwr_pins>;
pinctrl-names = "default";
status = "okay";
};

View File

@@ -337,6 +337,23 @@ define Device/xiaomi_mi-router-ax3000t
endef
TARGET_DEVICES += xiaomi_mi-router-ax3000t
define Device/one_r35-mini
DEVICE_VENDOR := one
DEVICE_MODEL := r35-mini
DEVICE_DTS := mt7981-one-r35-mini
DEVICE_DTS_DIR := $(DTS_DIR)/mediatek
SUPPORTED_DEVICES := one,r35-mini-snand
DEVICE_PACKAGES := kmod-hwmon-pwmfan
UBINIZE_OPTS := -E 5
BLOCKSIZE := 128k
PAGESIZE := 2048
IMAGE_SIZE := 65536k
KERNEL_IN_UBI := 1
IMAGES := sysupgrade.tar
IMAGE/sysupgrade.tar := sysupgrade-tar | append-metadata
endef
TARGET_DEVICES += one_r35-mini
define Device/glinet_gl-mt3000
DEVICE_VENDOR := GL.iNet
DEVICE_MODEL := GL-MT3000

View File

@@ -51,6 +51,7 @@ mediatek_setup_interfaces()
*nokia,ea0326gmp*)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" wan
;;
*r35-mini* |\
*mt3000* |\
glinet,x3000-emmc |\
*xe3000* |\

View File

@@ -189,6 +189,7 @@ platform_do_upgrade() {
case "$board" in
xiaomi,mi-router-wr30u-112m|\
xiaomi,mi-router-ax3000t|\
*r35-mini* |\
*mt3000* |\
glinet,x3000-emmc |\
*xe3000* |\