mediatek: fix clt-r30b1 (#148)

This commit is contained in:
benboguan 2023-10-31 11:28:39 +08:00 committed by GitHub
parent 7edca74a28
commit 358c1fa651
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 107 additions and 83 deletions

View File

@ -720,6 +720,7 @@ setup_model()
*zr-3020* |\
*360,t7* |\
abt,asr3000* |\
*clt,r30b1* |\
cmcc,a10* |\
xiaomi,mi-router-wr30u* |\
*rax3000m* |\

View File

@ -11,10 +11,11 @@
compatible = "clt,r30b1", "mediatek,mt7981";
aliases {
led-boot = &red_led;
led-failsafe = &red_led;
led-running = &green_led;
led-upgrade = &blue_led;
led-boot = &power_led;
led-failsafe = &power_led;
led-running = &system_led;
led-upgrade = &system_led;
#label-mac-device = &gmac0;
};
chosen {
@ -26,25 +27,6 @@
reg = <0 0x40000000 0 0x10000000>;
};
leds {
compatible = "gpio-leds";
red_led: red {
label = "r30b1:red";
gpios = <&pio 10 GPIO_ACTIVE_LOW>;
};
green_led: green {
label = "r30b1:green";
gpios = <&pio 12 GPIO_ACTIVE_LOW>;
};
blue_led: blue {
label = "r30b1:blue";
gpios = <&pio 11 GPIO_ACTIVE_LOW>;
};
};
gpio-keys {
compatible = "gpio-keys";
@ -62,6 +44,49 @@
};
};
leds {
compatible = "gpio-leds";
power_led: power_red {
label = "led_power";
gpios = <&pio 12 GPIO_ACTIVE_LOW>;
default-state = "on";
linux,default-trigger = "default-on";
};
system_led: wan_green {
label = "led_wan_green";
gpios = <&pio 6 GPIO_ACTIVE_LOW>;
};
wan_red {
label = "led_wan_red";
gpios = <&pio 5 GPIO_ACTIVE_LOW>;
};
mesh_blue {
label = "led_mesh";
gpios = <&pio 13 GPIO_ACTIVE_LOW>;
};
wifi_green {
label = "led_wifi";
gpios = <&pio 34 GPIO_ACTIVE_LOW>;
};
internet_blue {
label = "led_internet";
gpios = <&pio 11 GPIO_ACTIVE_LOW>;
};
all_ctrl {
label = "ctrl_led_all";
gpios = <&pio 8 GPIO_ACTIVE_LOW>;
default-state = "on";
linux,default-trigger = "default-on";
};
};
sound_wm8960 {
compatible = "mediatek,mt79xx-wm8960-machine";
mediatek,platform = <&afe>;
@ -114,19 +139,19 @@
};
&eth {
status = "okay";
status = "okay";
gmac0: mac@0 {
compatible = "mediatek,eth-mac";
reg = <0>;
phy-mode = "2500base-x";
gmac0: mac@0 {
compatible = "mediatek,eth-mac";
reg = <0>;
phy-mode = "2500base-x";
fixed-link {
speed = <2500>;
full-duplex;
pause;
};
};
fixed-link {
speed = <2500>;
full-duplex;
pause;
};
};
gmac1: mac@1 {
compatible = "mediatek,eth-mac";
@ -135,9 +160,9 @@
phy-handle = <&phy0>;
};
mdio: mdio-bus {
#address-cells = <1>;
#size-cells = <0>;
mdio: mdio-bus {
#address-cells = <1>;
#size-cells = <0>;
phy0: ethernet-phy@0 {
compatible = "ethernet-phy-id03a2.9461";
@ -172,7 +197,7 @@
&hnat {
mtketh-wan = "eth1";
mtketh-lan = "eth0";
mtketh-lan = "eth0";
mtketh-max-gmac = <2>;
status = "okay";
};
@ -187,14 +212,13 @@
#size-cells = <1>;
compatible = "spi-nand";
reg = <0>;
spi-max-frequency = <52000000>;
spi-tx-bus-width = <4>;
spi-rx-bus-width = <4>;
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-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>;
};
@ -219,7 +243,6 @@
};
&pio {
i2c_pins: i2c-pins-g0 {
mux {
function = "i2c";
@ -234,26 +257,26 @@
};
};
pwm0_pin: pwm0-pin-g0 {
mux {
function = "pwm";
groups = "pwm0_0";
};
};
pwm0_pin: pwm0-pin-g0 {
mux {
function = "pwm";
groups = "pwm0_0";
};
};
pwm1_pin: pwm1-pin-g0 {
mux {
function = "pwm";
groups = "pwm1_0";
};
};
pwm1_pin: pwm1-pin-g0 {
mux {
function = "pwm";
groups = "pwm1_0";
};
};
pwm2_pin: pwm2-pin {
mux {
function = "pwm";
groups = "pwm2";
};
};
pwm2_pin: pwm2-pin {
mux {
function = "pwm";
groups = "pwm2";
};
};
spi0_flash_pins: spi0-pins {
mux {
@ -282,16 +305,16 @@
};
uart1_pins: uart1-pins-g1 {
mux {
function = "uart";
groups = "uart1_1";
};
};
mux {
function = "uart";
groups = "uart1_1";
};
};
uart2_pins: uart2-pins-g1 {
mux {
function = "uart";
groups = "uart2_1";
};
};
function = "uart";
groups = "uart2_1";
};
};
};

View File

@ -17,9 +17,9 @@ abt,asr3000)
ucidef_set_led_netdev "wlan5g" "WLAN5G" "green:wlan5g" "rax0"
;;
clt,r30b1)
ucidef_set_led_default "green" "GREEN" "r30b1:green" "1"
ucidef_set_led_default "red" "RED" "r30b1:red" "0"
ucidef_set_led_netdev "blue" "BLUE" "r30b1:blue" "eth1"
ucidef_set_led_default "all_ctrl" "ALL_CTRL" "ctrl_led_all" "1"
ucidef_set_led_default "internet" "INTERNET" "led_internet" "1"
ucidef_set_led_default "power_red" "POWER_RED" "led_power" "0"
;;
imou,lc-hx3001)
ucidef_set_led_netdev "wan" "WAN" "green:wan" "eth1" "link"

View File

@ -37,8 +37,11 @@ mediatek_setup_interfaces()
ucidef_add_switch "switch0" \
"0:lan" "1:lan" "2:lan" "3:wan" "6t@eth0"
;;
abt,asr3000 |\
*clt,r30b1* |\
*imou,lc-hx3001*)
h3c,nx30pro |\
*imou,lc-hx3001* |\
*konka,komi-a31*)
ucidef_set_interfaces_lan_wan "eth0" "eth1"
ucidef_add_switch "switch0" \
"0:lan" "1:lan" "2:lan" "6u@eth0"
@ -53,13 +56,6 @@ mediatek_setup_interfaces()
ucidef_add_switch "switch0" \
"1:lan" "2:lan" "3:lan" "0:wan" "6t@eth0"
;;
abt,asr3000 |\
h3c,nx30pro |\
*konka,komi-a31*)
ucidef_set_interfaces_lan_wan "eth0" "eth1"
ucidef_add_switch "switch0" \
"0:lan" "1:lan" "2:lan" "6u@eth0"
;;
*rax3000m*)
ucidef_set_interfaces_lan_wan "eth0" "eth1"
ucidef_add_switch "switch0" \
@ -172,7 +168,6 @@ mediatek_setup_macs()
label_mac=$(mtd_get_mac_ascii art MAC_ADDRESS)
lan_mac=$label_mac
wan_mac=$label_mac
local wifi_mac="$(macaddr_add $label_mac 1)"
mtk_facrory_write_mac Factory 4 "$wifi_mac"
;;
@ -183,6 +178,12 @@ mediatek_setup_macs()
local wifi_mac="$(macaddr_add $lan_mac 1)"
mtk_facrory_write_mac Factory 4 "$wifi_mac"
;;
*clt,r30b1*)
lan_mac=$(mtd_get_mac_binary $part_name 0x2A)
wan_mac=$(mtd_get_mac_binary $part_name 0x24)
label_mac=$lan_mac
local wifi_mac="$(mtd_get_mac_binary $part_name 0x04)"
;;
cmcc,rax3000m-emmc)
lan_mac=$(mmc_get_mac_binary factory 0x24)
wan_mac=$(mmc_get_mac_binary factory 0x2a)
@ -219,7 +220,6 @@ mediatek_setup_macs()
fi
;;
*cmcc,a10* |\
*clt,r30b1* |\
*konka,komi-a31*)
lan_mac=$(mtd_get_mac_binary $part_name 0x2A)
wan_mac=$(mtd_get_mac_binary $part_name 0x24)