mediatek: filogic: add HF-M7986R1 support

This commit is contained in:
coolsnowwolf 2024-06-30 13:27:48 +08:00
parent 6924a18f35
commit 78c0839c9b
6 changed files with 453 additions and 0 deletions

View File

@ -0,0 +1,100 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;
#include "mt7986a-hf-m7986r1.dtsi"
/ {
model = "HF-M7986R1 eMMC version";
compatible = "hf,m7986r1-emmc", "mediatek,mt7986a";
chosen {
bootargs = "root=PARTLABEL=rootfs rootwait rootfstype=squashfs,f2fs";
};
reg_1p8v: regulator-1p8v {
compatible = "regulator-fixed";
regulator-name = "fixed-1.8V";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
regulator-boot-on;
regulator-always-on;
};
};
&mmc0 {
bus-width = <8>;
cap-mmc-highspeed;
hs400-ds-delay = <0x14014>;
max-frequency = <200000000>;
mmc-hs200-1_8v;
mmc-hs400-1_8v;
no-sd;
no-sdio;
non-removable;
pinctrl-names = "default", "state_uhs";
pinctrl-0 = <&mmc0_pins_default>;
pinctrl-1 = <&mmc0_pins_uhs>;
vmmc-supply = <&reg_3p3v>;
vqmmc-supply = <&reg_1p8v>;
status = "okay";
};
&pio {
mmc0_pins_default: mmc0-pins-default {
mux {
function = "emmc";
groups = "emmc_51";
};
conf-cmd-dat {
pins = "EMMC_DATA_0", "EMMC_DATA_1", "EMMC_DATA_2",
"EMMC_DATA_3", "EMMC_DATA_4", "EMMC_DATA_5",
"EMMC_DATA_6", "EMMC_DATA_7", "EMMC_CMD";
input-enable;
drive-strength = <4>;
mediatek,pull-up-adv = <1>;
};
conf-clk {
pins = "EMMC_CK";
drive-strength = <6>;
mediatek,pull-down-adv = <2>;
};
conf-ds {
pins = "EMMC_DSL";
mediatek,pull-down-adv = <2>;
};
conf-rst {
pins = "EMMC_RSTB";
drive-strength = <4>;
mediatek,pull-up-adv = <1>;
};
};
mmc0_pins_uhs: mmc0-uhs-pins {
mux {
function = "emmc";
groups = "emmc_51";
};
conf-cmd-dat {
pins = "EMMC_DATA_0", "EMMC_DATA_1", "EMMC_DATA_2",
"EMMC_DATA_3", "EMMC_DATA_4", "EMMC_DATA_5",
"EMMC_DATA_6", "EMMC_DATA_7", "EMMC_CMD";
input-enable;
drive-strength = <4>;
mediatek,pull-up-adv = <1>;
};
conf-clk {
pins = "EMMC_CK";
drive-strength = <6>;
mediatek,pull-down-adv = <2>;
};
conf-ds {
pins = "EMMC_DSL";
mediatek,pull-down-adv = <2>;
};
conf-rst {
pins = "EMMC_RSTB";
drive-strength = <4>;
mediatek,pull-up-adv = <1>;
};
};
};

View File

@ -0,0 +1,76 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;
#include "mt7986a-hf-m7986r1.dtsi"
/ {
model = "HF-M7986R1 NAND version";
compatible = "hf,m7986r1-nand", "mediatek,mt7986a";
};
&pio {
spi_flash_pins: spi-flash-pins {
mux {
function = "spi";
groups = "spi0", "spi0_wp_hold";
};
conf-pu {
pins = "SPI2_CS", "SPI2_HOLD", "SPI2_WP";
drive-strength = <8>;
mediatek,pull-up-adv = <0>;
};
conf-pd {
pins = "SPI2_CLK", "SPI2_MOSI", "SPI2_MISO";
drive-strength = <8>;
mediatek,pull-down-adv = <0>;
};
};
};
&spi0 {
pinctrl-names = "default";
pinctrl-0 = <&spi_flash_pins>;
status = "okay";
flash@0 {
compatible = "spi-nand";
#address-cells = <1>;
#size-cells = <1>;
reg = <0>;
spi-max-frequency = <20000000>;
spi-tx-bus-width = <4>;
spi-rx-bus-width = <4>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "bl2";
reg = <0x00000 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 0x7a80000>;
};
};
};
};

View File

@ -0,0 +1,251 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/leds/common.h>
#include "mt7986a.dtsi"
/ {
aliases {
serial0 = &uart0;
led-boot = &sys_led;
led-failsafe = &sys_led;
led-running = &sys_led;
led-upgrade = &sys_led;
};
chosen {
stdout-path = "serial0:115200n8";
};
memory@40000000 {
reg = <0 0x40000000 0 0x40000000>;
};
gpio-keys {
compatible = "gpio-keys";
// seems to conflict with pcie_clk, needs investigate
button-reset {
label = "reset";
linux,code = <KEY_RESTART>;
gpios = <&pio 9 GPIO_ACTIVE_LOW>;
};
};
gpio-leds {
compatible = "gpio-leds";
sys_led: led-0 {
label = "hf:sys";
gpios = <&pio 15 GPIO_ACTIVE_LOW>;
};
led-1 {
label = "led-1";
gpios = <&pio 16 GPIO_ACTIVE_LOW>;
};
led-2 {
label = "led-2";
gpios = <&pio 17 GPIO_ACTIVE_LOW>;
};
led-3 {
label = "led-3";
gpios = <&pio 18 GPIO_ACTIVE_LOW>;
};
led-4 {
label = "led-4";
gpios = <&pio 19 GPIO_ACTIVE_LOW>;
};
led-5 {
label = "led-5";
gpios = <&pio 20 GPIO_ACTIVE_LOW>;
};
};
reg_3p3v: regulator-3p3v {
compatible = "regulator-fixed";
regulator-name = "fixed-3.3V";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-boot-on;
regulator-always-on;
};
reg_5v: regulator-5v {
compatible = "regulator-fixed";
regulator-name = "fixed-5V";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
regulator-boot-on;
regulator-always-on;
};
};
&crypto {
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;
};
};
mdio: mdio-bus {
#address-cells = <1>;
#size-cells = <0>;
};
};
&mdio {
switch: switch@1f {
compatible = "mediatek,mt7531";
reg = <31>;
reset-gpios = <&pio 5 GPIO_ACTIVE_HIGH>;
interrupt-controller;
#interrupt-cells = <1>;
interrupt-parent = <&pio>;
interrupts = <66 IRQ_TYPE_LEVEL_HIGH>;
};
};
&pcie {
pinctrl-names = "default";
pinctrl-0 = <&pcie_pins>;
status = "okay";
pcie@0,0 {
reg = <0x0000 0 0 0 0>;
wifi@0,0 {
compatible = "mediatek,mt76";
reg = <0x0000 0 0 0 0>;
};
};
};
&pcie_phy {
status = "okay";
};
&pio {
pcie_pins: pcie-pins {
power-pcie {
pins = "GPIO_7";
drive-strength = <8>;
mediatek,pull-up-adv = <1>;
};
reset-pcie {
pins = "GPIO_9";
drive-strength = <8>;
mediatek,pull-down-adv = <1>;
output-low;
};
mux {
function = "pcie";
groups = "pcie_clk", "pcie_wake", "pcie_pereset";
};
};
usb_pins: usb-pins {
reset-sata {
pins = "GPIO_1";
drive-strength = <8>;
mediatek,pull-up-adv = <1>;
};
power-m2 {
pins = "GPIO_6";
drive-strength = <8>;
mediatek,pull-up-adv = <1>;
};
reset-m2 {
pins = "GPIO_8";
drive-strength = <8>;
mediatek,pull-down-adv = <1>;
output-low;
};
};
};
&ssusb {
pinctrl-names = "default";
pinctrl-0 = <&usb_pins>;
vusb33-supply = <&reg_3p3v>;
vbus-supply = <&reg_5v>;
status = "okay";
};
&switch {
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
label = "lan1";
};
port@1 {
reg = <1>;
label = "lan2";
};
port@2 {
reg = <2>;
label = "lan3";
};
port@3 {
reg = <3>;
label = "lan4";
};
port@6 {
reg = <6>;
ethernet = <&gmac0>;
phy-mode = "2500base-x";
fixed-link {
speed = <2500>;
full-duplex;
pause;
};
};
};
};
&trng {
status = "okay";
};
&uart0 {
status = "okay";
};
&usb_phy {
status = "okay";
};
&watchdog {
status = "okay";
};

View File

@ -9,6 +9,13 @@ case $board in
abt,asr3000) abt,asr3000)
ucidef_set_led_netdev "wan" "WAN" "green:wan" "eth1" ucidef_set_led_netdev "wan" "WAN" "green:wan" "eth1"
;; ;;
hf,m7986r1*)
ucidef_set_led_netdev "led-1" "LAN1" "led-1" "lan1"
ucidef_set_led_netdev "led-2" "LAN2" "led-2" "lan2"
ucidef_set_led_netdev "led-3" "LAN3" "led-3" "lan3"
ucidef_set_led_netdev "led-4" "LAN4" "led-4" "lan4"
ucidef_set_led_netdev "led-5" "WWAN" "led-5" "usb0"
;;
imou,lc-hx3001|\ imou,lc-hx3001|\
nokia,ea0326gmp) nokia,ea0326gmp)
ucidef_set_led_netdev "lan" "LAN" "green:lan" "br-lan" ucidef_set_led_netdev "lan" "LAN" "green:lan" "br-lan"

View File

@ -30,6 +30,9 @@ mediatek_setup_interfaces()
qihoo,360t7) qihoo,360t7)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" wan ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" wan
;; ;;
hf,m7986r1*)
ucidef_set_interfaces_lan_wan "lan2 lan3 lan4" lan1
;;
glinet,gl-mt2500|\ glinet,gl-mt2500|\
glinet,gl-mt3000) glinet,gl-mt3000)
ucidef_set_interfaces_lan_wan eth1 eth0 ucidef_set_interfaces_lan_wan eth1 eth0

View File

@ -421,6 +421,22 @@ define Device/mediatek_mt7988a-rfb
endef endef
TARGET_DEVICES += mediatek_mt7988a-rfb TARGET_DEVICES += mediatek_mt7988a-rfb
define Device/hf_m7986r1-nand
DEVICE_VENDOR := HF
DEVICE_MODEL := M7986R1
DEVICE_DTS := mt7986a-hf-m7986r1-nand
DEVICE_DTS_DIR := ../dts
UBINIZE_OPTS := -E 5
BLOCKSIZE := 128k
PAGESIZE := 2048
IMAGE_SIZE := 116736k
KERNEL_IN_UBI := 1
DEVICE_PACKAGES := kmod-usb3 kmod-mt7921e kmod-usb-serial-option kmod-usb-net-rndis
SUPPORTED_DEVICES += HF-M7986R1
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
endef
TARGET_DEVICES +=hf_m7986r1-nand
define Device/netcore_n60 define Device/netcore_n60
DEVICE_VENDOR := Netcore DEVICE_VENDOR := Netcore
DEVICE_MODEL := N60 DEVICE_MODEL := N60