mediatek: add support for KONKA KOMI A31 (#102)

This commit is contained in:
abandon-xyz 2023-08-05 21:12:33 +08:00 committed by GitHub
parent 7420001e8f
commit 7268ecd1fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 256 additions and 0 deletions

View File

@ -9,6 +9,8 @@ CONFIG_TARGET_DEVICE_mediatek_mt7981_DEVICE_h3c_nx30pro=y
CONFIG_TARGET_DEVICE_PACKAGES_mediatek_mt7981_DEVICE_h3c_nx30pro=""
CONFIG_TARGET_DEVICE_mediatek_mt7981_DEVICE_jcg_q30=y
CONFIG_TARGET_DEVICE_PACKAGES_mediatek_mt7981_DEVICE_jcg_q30=""
CONFIG_TARGET_DEVICE_mediatek_mt7981_DEVICE_konka_komi-a31=y
CONFIG_TARGET_DEVICE_PACKAGES_mediatek_mt7981_DEVICE_konka_komi-a31=""
CONFIG_TARGET_DEVICE_mediatek_mt7981_DEVICE_livinet_zr-3020=y
CONFIG_TARGET_DEVICE_PACKAGES_mediatek_mt7981_DEVICE_livinet_zr-3020=""
CONFIG_TARGET_DEVICE_mediatek_mt7981_DEVICE_mt7981-360-t7=y

View File

@ -25,6 +25,9 @@ xiaomi,mi-router-wr30u* |\
xiaomi,redmi-router-ax6000*)
ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x10000" "0x20000" "1"
;;
*konka,komi-a31*)
ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x20000" "0x80000" "1"
;;
esac
config_load ubootenv

View File

@ -722,6 +722,7 @@ setup_model()
xiaomi,mi-router-wr30u* |\
*rax3000m* |\
h3c,nx30pro |\
konka,komi-a31 |\
*7981*)
MT7981_whnat $num_of_wifi
;;

View File

@ -0,0 +1,222 @@
/dts-v1/;
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include "mt7981.dtsi"
/ {
model = "KONKA KOMI A31";
compatible = "konka,komi-a31", "mediatek,mt7981";
aliases {
led-boot = &status_red_led;
led-failsafe = &status_red_led;
led-running = &status_green_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_green_led: led-0 {
label = "green:status";
gpios = <&pio 8 GPIO_ACTIVE_LOW>;
};
status_blue_led: led-1 {
label = "blue:status";
gpios = <&pio 13 GPIO_ACTIVE_LOW>;
};
status_red_led: led-2 {
label = "red:status";
gpios = <&pio 34 GPIO_ACTIVE_LOW>;
};
};
gpio-keys {
compatible = "gpio-keys";
button-reset {
label = "reset";
linux,code = <KEY_RESTART>;
gpios = <&pio 1 GPIO_ACTIVE_LOW>;
};
button-mesh {
label = "mesh";
gpios = <&pio 0 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 0x7000000>;
};
};
};
};
&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-buswidth = <4>;
spi-rx-buswidth = <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

@ -371,3 +371,20 @@ define Device/h3c_nx30pro
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
endef
TARGET_DEVICES += h3c_nx30pro
define Device/konka_komi-a31
DEVICE_VENDOR := KONKA
DEVICE_MODEL := KOMI A31
DEVICE_DTS := mt7981-konka-komi-a31
DEVICE_DTS_DIR := $(DTS_DIR)/mediatek
SUPPORTED_DEVICES := konka,komi-a31
UBINIZE_OPTS := -E 5
BLOCKSIZE := 128k
PAGESIZE := 2048
IMAGE_SIZE := 114688k
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 += konka_komi-a31

View File

@ -27,6 +27,9 @@ h3c,nx30pro)
ucidef_set_led_default "green" "GREEN" "nx30pro:green" "1"
ucidef_set_led_default "red" "RED" "nx30pro:red" "0"
;;
konka,komi-a31)
ucidef_set_led_netdev "blue" "BLUE" "blue:status" "eth1" "link"
;;
esac
board_config_flush

View File

@ -43,6 +43,7 @@ mediatek_setup_interfaces()
"1:lan" "2:lan" "3:lan" "0:wan" "6t@eth0"
;;
h3c,nx30pro |\
*konka,komi-a31* |\
*rax3000m*)
ucidef_set_interfaces_lan_wan "eth0" "eth1"
ucidef_add_switch "switch0" \
@ -168,6 +169,12 @@ mediatek_setup_macs()
mtk_facrory_write_mac "Factory" 4 $wifi_mac
fi
;;
*konka,komi-a31*)
lan_mac=$(mtd_get_mac_binary $part_name 0x2A)
wan_mac=$(mtd_get_mac_binary $part_name 0x24)
label_mac=$wan_mac
local wifi_mac="$(mtd_get_mac_binary $part_name 0x04)"
;;
*)
wan_mac=$(mtd_get_mac_binary $part_name $wan_mac_offset)
lan_mac=$(mtd_get_mac_binary $part_name $lan_mac_offset)

View File

@ -197,6 +197,7 @@ platform_do_upgrade() {
*jcg,q30* |\
cmcc,rax3000m |\
h3c,nx30pro |\
*konka,komi-a31* |\
*snand*)
nand_do_upgrade "$1"
;;