mirror of
https://github.com/hanwckf/immortalwrt-mt798x.git
synced 2025-01-09 02:43:53 +08:00
mediatek: add Imou LC-HX3001 support (#105)
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
parent
2828f34bee
commit
9dc5245046
@ -21,6 +21,9 @@ h3c,nx30pro |\
|
||||
cmcc,rax3000m)
|
||||
ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x80000" "0x20000" "4"
|
||||
;;
|
||||
*imou,lc-hx3001*)
|
||||
ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x80000" "0x80000" "1"
|
||||
;;
|
||||
xiaomi,mi-router-wr30u* |\
|
||||
xiaomi,redmi-router-ax6000*)
|
||||
ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x10000" "0x20000" "1"
|
||||
|
@ -0,0 +1,244 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
|
||||
/*
|
||||
* Copyright (C) 2023 Tianling Shen <cnsztl@immortalwrt.org>
|
||||
*/
|
||||
|
||||
/dts-v1/;
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
#include <dt-bindings/input/input.h>
|
||||
|
||||
#include "mt7981.dtsi"
|
||||
|
||||
/ {
|
||||
model = "Imou LC-HX3001";
|
||||
compatible = "imou,lc-hx3001", "mediatek,mt7981";
|
||||
|
||||
aliases {
|
||||
led-boot = &power_led;
|
||||
led-failsafe = &power_led;
|
||||
led-running = &power_led;
|
||||
led-upgrade = &power_led;
|
||||
};
|
||||
|
||||
chosen {
|
||||
bootargs = "console=ttyS0,115200n1 loglevel=8 earlycon=uart8250,mmio32,0x11002000";
|
||||
};
|
||||
|
||||
memory {
|
||||
reg = <0 0x40000000 0 0x10000000>;
|
||||
};
|
||||
|
||||
gpio-keys {
|
||||
compatible = "gpio-keys";
|
||||
|
||||
button-reset {
|
||||
label = "reset";
|
||||
linux,code = <KEY_RESTART>;
|
||||
gpios = <&pio 1 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
|
||||
button-mesh {
|
||||
label = "mesh";
|
||||
linux,code = <BTN_9>;
|
||||
linux,input-type = <EV_SW>;
|
||||
gpios = <&pio 0 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
};
|
||||
|
||||
gpio-leds {
|
||||
compatible = "gpio-leds";
|
||||
|
||||
power_led: led-0 {
|
||||
label = "green:power";
|
||||
gpios = <&pio 4 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
|
||||
led-1 {
|
||||
label = "green:wlan";
|
||||
gpios = <&pio 5 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
|
||||
led-2 {
|
||||
label = "red:wan";
|
||||
gpios = <&pio 6 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
|
||||
led-3 {
|
||||
label = "green:wan";
|
||||
gpios = <&pio 7 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
|
||||
led-4 {
|
||||
label = "green:lan";
|
||||
gpios = <&pio 8 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
};
|
||||
|
||||
gsw: gsw@0 {
|
||||
compatible = "mediatek,mt753x";
|
||||
mediatek,ethsys = <ðsys>;
|
||||
#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 = <0x00000 0x100000>;
|
||||
};
|
||||
|
||||
partition@100000 {
|
||||
label = "u-boot-env";
|
||||
reg = <0x100000 0x80000>;
|
||||
};
|
||||
|
||||
factory: partition@180000 {
|
||||
label = "Factory";
|
||||
reg = <0x180000 0x200000>;
|
||||
};
|
||||
|
||||
partition@380000 {
|
||||
label = "FIP";
|
||||
reg = <0x380000 0x200000>;
|
||||
};
|
||||
|
||||
partition@580000 {
|
||||
label = "ubi";
|
||||
reg = <0x580000 0x7280000>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
ð {
|
||||
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: flash@0 {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
compatible = "spi-nand";
|
||||
reg = <0>;
|
||||
spi-max-frequency = <52000000>;
|
||||
|
||||
spi-cal-enable;
|
||||
spi-cal-mode = "read-data";
|
||||
spi-cal-datalen = <7>;
|
||||
spi-cal-data = /bits/ 8 <0x53 0x50 0x49 0x4E 0x41 0x4E 0x44>;
|
||||
spi-cal-addrlen = <5>;
|
||||
spi-cal-addr = /bits/ 32 <0x0 0x0 0x0 0x0 0x0>;
|
||||
|
||||
spi-tx-buswidth = <4>;
|
||||
spi-rx-buswidth = <4>;
|
||||
mediatek,nmbm;
|
||||
mediatek,bmt-max-ratio = <1>;
|
||||
mediatek,bmt-max-reserved-blocks = <64>;
|
||||
};
|
||||
};
|
||||
|
||||
&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 = <8>;
|
||||
bias-pull-up = <103>;
|
||||
};
|
||||
|
||||
conf-pd {
|
||||
pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO";
|
||||
drive-strength = <8>;
|
||||
bias-pull-down = <103>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&uart0 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&watchdog {
|
||||
status = "okay";
|
||||
};
|
@ -388,3 +388,20 @@ define Device/konka_komi-a31
|
||||
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
|
||||
endef
|
||||
TARGET_DEVICES += konka_komi-a31
|
||||
|
||||
define Device/imou_lc-hx3001
|
||||
DEVICE_VENDOR := Imou
|
||||
DEVICE_MODEL := LC-HX3001
|
||||
DEVICE_DTS := mt7981-imou_lc-hx3001
|
||||
DEVICE_DTS_DIR := $(DTS_DIR)/mediatek
|
||||
SUPPORTED_DEVICES := imou,lc-hx3001
|
||||
UBINIZE_OPTS := -E 5
|
||||
BLOCKSIZE := 128k
|
||||
PAGESIZE := 2048
|
||||
IMAGE_SIZE := 114816k
|
||||
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 += imou_lc-hx3001
|
||||
|
@ -11,6 +11,11 @@ board=$(board_name)
|
||||
board_config_update
|
||||
|
||||
case "$board" in
|
||||
imou,lc-hx3001)
|
||||
ucidef_set_led_netdev "wan" "WAN" "green:wan" "eth1" "link"
|
||||
ucidef_set_led_netdev "lan" "LAN" "green:lan" "eth0" "link"
|
||||
ucidef_set_led_netdev "wlan" "WLAN" "green:wlan" "rax0" "link"
|
||||
;;
|
||||
livinet,zr-3020)
|
||||
ucidef_set_led_netdev "internet" "INTERNET" "blue:internet" "eth1"
|
||||
ucidef_set_led_netdev "wlan2g" "WLAN2G" "blue:wlan2g" "ra0" "link"
|
||||
|
@ -37,6 +37,11 @@ mediatek_setup_interfaces()
|
||||
ucidef_add_switch "switch0" \
|
||||
"0:lan" "1:lan" "2:lan" "3:wan" "6t@eth0"
|
||||
;;
|
||||
*imou,lc-hx3001*)
|
||||
ucidef_set_interfaces_lan_wan "eth0" "eth1"
|
||||
ucidef_add_switch "switch0" \
|
||||
"0:lan" "1:lan" "2:lan" "6u@eth0"
|
||||
;;
|
||||
*jcg,q30*)
|
||||
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
|
||||
ucidef_add_switch "switch0" \
|
||||
@ -156,6 +161,17 @@ mediatek_setup_macs()
|
||||
local wifi_mac="$(macaddr_add $lan_mac 1)"
|
||||
mtk_facrory_write_mac Factory 4 "$wifi_mac"
|
||||
;;
|
||||
*imou,lc-hx3001*)
|
||||
if [ -n "$(mtd_get_mac_ascii u-boot-env mac)" ]; then
|
||||
lan_mac=$(mtd_get_mac_ascii u-boot-env mac)
|
||||
wan_mac=$(macaddr_add $lan_mac 2)
|
||||
label_mac=$lan_mac
|
||||
else
|
||||
local wifi_mac=$(mtd_get_mac_binary Factory 0x4)
|
||||
lan_mac=$(macaddr_add $wifi_mac -1)
|
||||
wan_mac=$(macaddr_add $wifi_mac 1)
|
||||
fi
|
||||
;;
|
||||
*jcg,q30*)
|
||||
wan_mac=$(mtd_get_mac_binary $part_name 0xa0024)
|
||||
lan_mac=$(mtd_get_mac_binary $part_name 0xa002a)
|
||||
|
@ -194,6 +194,7 @@ platform_do_upgrade() {
|
||||
*zr-3020* |\
|
||||
*360,t7* |\
|
||||
*cetron,ct3003* |\
|
||||
*imou,lc-hx3001* |\
|
||||
*jcg,q30* |\
|
||||
cmcc,rax3000m |\
|
||||
h3c,nx30pro |\
|
||||
@ -231,6 +232,7 @@ platform_check_image() {
|
||||
xiaomi,mi-router-wr30u-stock|\
|
||||
xiaomi,mi-router-wr30u-112m|\
|
||||
*cetron,ct3003* |\
|
||||
*imou,lc-hx3001* |\
|
||||
*jcg,q30* |\
|
||||
cmcc,rax3000m |\
|
||||
h3c,nx30pro |\
|
||||
|
Loading…
x
Reference in New Issue
Block a user