diff --git a/target/linux/ramips/dts/mt7628an_iyunlink_m28s.dts b/target/linux/ramips/dts/mt7628an_iyunlink_m28s.dts new file mode 100644 index 00000000000000..9ed342d7cd013f --- /dev/null +++ b/target/linux/ramips/dts/mt7628an_iyunlink_m28s.dts @@ -0,0 +1,126 @@ +#include "mt7628an.dtsi" + +#include +#include + +/{ + compatible = "iyunlink,m28s", "mediatek,mt7628an-soc"; + model = "M28S"; + + chosen { + bootargs = "console=ttyS0,57600"; + }; + + leds { + compatible = "gpio-leds"; + + wifi_status:wifi { + label = "led_wifi"; + gpios = <&gpio 44 GPIO_ACTIVE_LOW>; + }; + + mod_status:mod { + label = "led_mod"; + gpios = <&gpio 0 GPIO_ACTIVE_LOW>; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 38 GPIO_ACTIVE_HIGH>; + linux,code = ; + }; + + sim_det { + label = "BTN_0"; + gpios = <&gpio 11 1>; + linux,code = <0x100>; + }; + }; + + gpio_export { + compatible = "gpio-export"; + #size-cells = <0>; + + power_mod { + gpio-export,name = "power_mod"; + gpio-export,output = <1>; + gpios = <&gpio 3 GPIO_ACTIVE_HIGH>; + }; + + }; + + watchdog { + compatible = "linux,wdt-gpio"; + gpios = <&gpio 2 GPIO_ACTIVE_HIGH>; + hw_algo = "toggle"; + hw_margin_ms = <1300>; + always-running; + }; +}; + +&state_default { + gpio { + groups = "gpio", "wled_an", "p0led_an", "p1led_an", "i2s"; + function = "gpio"; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&wmac { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <10000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; + }; + }; +}; + +&uart1 { + status = "okay"; +}; + +&usbphy { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/mt7628an_kooiot_tlink-c4-16m.dts b/target/linux/ramips/dts/mt7628an_kooiot_tlink-c4-16m.dts new file mode 100644 index 00000000000000..35a93fd90920f2 --- /dev/null +++ b/target/linux/ramips/dts/mt7628an_kooiot_tlink-c4-16m.dts @@ -0,0 +1,135 @@ +#include "mt7628an.dtsi" + +#include +#include + +/{ + compatible = "kooiot,tlink-c4-16m", "mediatek,mt7628an-soc"; + model = "ThingsLink C4 (16M)"; + + aliases { + led-boot = &led_status; + led-failsafe = &led_status; + led-upgrade = &led_status; + serial1 = &uart1; + }; + + chosen { + bootargs = "console=ttyS0,57600"; + }; + + leds { + compatible = "gpio-leds"; + + led_status: status { + label = "greeen:status"; + gpios = <&gpio 44 GPIO_ACTIVE_LOW>; + linux,default-trigger = "heartbeat"; + }; + + led_modem: modem { + label = "green:modem"; + gpios = <&gpio 0 GPIO_ACTIVE_LOW>; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 38 GPIO_ACTIVE_HIGH>; + linux,code = ; + }; + + sim_det { + label = "BTN_0"; + gpios = <&gpio 11 1>; + linux,code = <0x100>; + }; + }; + + gpio_export { + compatible = "gpio-export"; + #size-cells = <0>; + + pcie_power { + gpio-export,name = "pcie_power"; + gpio-export,output = <1>; + gpios = <&gpio 3 GPIO_ACTIVE_HIGH>; + }; + + }; + + watchdog { + compatible = "linux,wdt-gpio"; + gpios = <&gpio 2 GPIO_ACTIVE_HIGH>; + hw_algo = "toggle"; + hw_margin_ms = <1300>; + always-running; + }; +}; + +&state_default { + gpio { + groups = "gpio", "wled_an", "i2s"; + function = "gpio"; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&wmac { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <40000000>; + // spi-max-frequency = <10000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; + }; + }; +}; + +&uart1 { + status = "okay"; +}; + +&usbphy { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/mt7628an_kooiot_tlink-c4-32m.dts b/target/linux/ramips/dts/mt7628an_kooiot_tlink-c4-32m.dts new file mode 100644 index 00000000000000..b5e318af6ffe88 --- /dev/null +++ b/target/linux/ramips/dts/mt7628an_kooiot_tlink-c4-32m.dts @@ -0,0 +1,135 @@ +#include "mt7628an.dtsi" + +#include +#include + +/{ + compatible = "kooiot,tlink-c4-32m", "mediatek,mt7628an-soc"; + model = "ThingsLink C4 (32M)"; + + aliases { + led-boot = &led_status; + led-failsafe = &led_status; + led-upgrade = &led_status; + serial1 = &uart1; + }; + + chosen { + bootargs = "console=ttyS0,57600"; + }; + + leds { + compatible = "gpio-leds"; + + led_status: status { + label = "greeen:status"; + gpios = <&gpio 44 GPIO_ACTIVE_LOW>; + linux,default-trigger = "heartbeat"; + }; + + led_modem: modem { + label = "green:modem"; + gpios = <&gpio 0 GPIO_ACTIVE_LOW>; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 38 GPIO_ACTIVE_HIGH>; + linux,code = ; + }; + + sim_det { + label = "BTN_0"; + gpios = <&gpio 11 1>; + linux,code = <0x100>; + }; + }; + + gpio_export { + compatible = "gpio-export"; + #size-cells = <0>; + + pcie_power { + gpio-export,name = "pcie_power"; + gpio-export,output = <1>; + gpios = <&gpio 3 GPIO_ACTIVE_HIGH>; + }; + + }; + + watchdog { + compatible = "linux,wdt-gpio"; + gpios = <&gpio 2 GPIO_ACTIVE_HIGH>; + hw_algo = "toggle"; + hw_margin_ms = <1300>; + always-running; + }; +}; + +&state_default { + gpio { + groups = "gpio", "wled_an", "i2s"; + function = "gpio"; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; +}; + +&wmac { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <40000000>; + // spi-max-frequency = <10000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x50000 0x1fb0000>; + }; + }; + }; +}; + +&uart1 { + status = "okay"; +}; + +&usbphy { + status = "okay"; +}; diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk index 0ce4ff9a0b8983..5b11df483a3ed4 100644 --- a/target/linux/ramips/image/mt76x8.mk +++ b/target/linux/ramips/image/mt76x8.mk @@ -1144,6 +1144,51 @@ define Device/kooiot_tlink-c35-32m endef TARGET_DEVICES += kooiot_tlink-c35-32m +define Device/kooiot_tlink-c4-16m + IMAGE_SIZE := 16064k + DEVICE_VENDOR := KooIoT + DEVICE_MODEL := ThingsLink C4 + DEVICE_VARIANT := 16M + DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci \ + kmod-usb-uhci kmod-usb-net kmod-usb-net-cdc-ether \ + kmod-usb-net-cdc-ncm kmod-usb-serial kmod-usb-serial-option \ + kmod-gpio-button-hotplug kmod-leds-gpio \ + kmod-ledtrig-heartbeat kmod-ledtrig-gpio \ + kmod-usb-serial-qualcomm \ + kmod-usb-net-qmi-wwan kmod-usb-serial-cp210x \ + luci-app-freeioe luci-proto-qmi luci-proto-3g \ + uqmi fdisk usbutils freeioe wwanleds +endef +TARGET_DEVICES += kooiot_tlink-c4-16m + +define Device/kooiot_tlink-c4-32m + IMAGE_SIZE := 32448k + DEVICE_VENDOR := KooIoT + DEVICE_MODEL := ThingsLink C4 + DEVICE_VARIANT := 32M + DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci \ + kmod-usb-uhci kmod-usb-net kmod-usb-net-cdc-ether \ + kmod-usb-net-cdc-ncm kmod-usb-serial kmod-usb-serial-option \ + kmod-gpio-button-hotplug kmod-leds-gpio \ + kmod-ledtrig-heartbeat kmod-ledtrig-gpio \ + kmod-usb-serial-qualcomm \ + kmod-usb-net-qmi-wwan kmod-usb-serial-cp210x \ + luci-app-freeioe luci-proto-qmi luci-proto-3g \ + uqmi fdisk usbutils freeioe wwanleds +endef +TARGET_DEVICES += kooiot_tlink-c4-32m + +define Device/iyunlink_m28s + IMAGE_SIZE := 32448k + DEVICE_VENDOR := IYUNLINK + DEVICE_MODEL := M28S + DEVICE_VARIANT := 16M + DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci \ + kmod-usb-uhci kmod-usb-net kmod-usb-net-cdc-ether \ + kmod-usb-net-cdc-ncm kmod-usb-serial kmod-usb-serial-option +endef +TARGET_DEVICES += iyunlink_m28s + define Device/wiznet_wizfi630s IMAGE_SIZE := 32448k DEVICE_VENDOR := WIZnet @@ -1243,3 +1288,4 @@ define Device/zyxel_keenetic-extra-ii check-size | zyimage -d 6162 -v "ZyXEL Keenetic Extra II" endef TARGET_DEVICES += zyxel_keenetic-extra-ii + diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds b/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds index 6e013b4256a9b8..87c2fea42da07b 100644 --- a/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds @@ -187,6 +187,11 @@ kooiot,tlink-c35-16m|\ kooiot,tlink-c35-32m) ucidef_set_led_netdev "wifi_led" "wifi" "green:wifi" "wlan0" ;; +kooiot,tlink-c4-16m|\ +kooiot,tlink-c4-32m|\ +iyunlink,m28s) + ucidef_set_led_netdev "modem" "modem" "green:modem" "wwan0" + ;; esac board_config_flush diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network index 034ffb8d1f3dc0..5aafb9e5840607 100644 --- a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network @@ -213,6 +213,12 @@ ramips_setup_interfaces() ucidef_add_switch "switch0" \ "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6@eth0" ;; + kooiot,tlink-c4-16m|\ + kooiot,tlink-c4-32m|\ + iyunlink,m28s) + ucidef_add_switch "switch0" \ + "1:lan:1" "4:wan" "6@eth0" + ;; esac } @@ -348,6 +354,12 @@ ramips_setup_macs() lan_mac=$(mtd_get_mac_binary factory 0x19c) wan_mac=$(macaddr_add "$lan_mac" 1) ;; + kooiot,tlink-c4-16m|\ + kooiot,tlink-c4-32m|\ + iyunlink,m28s) + lan_mac=$(mtd_get_mac_binary factory 0x4) + wan_mac=$(macaddr_add "$lan_mac" 1) + ;; esac [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac diff --git a/target/linux/ramips/mt76x8/base-files/etc/uci-defaults/99_tlink b/target/linux/ramips/mt76x8/base-files/etc/uci-defaults/99_tlink index 8effb1e18d3dac..64296500668944 100755 --- a/target/linux/ramips/mt76x8/base-files/etc/uci-defaults/99_tlink +++ b/target/linux/ramips/mt76x8/base-files/etc/uci-defaults/99_tlink @@ -55,6 +55,18 @@ tlink_default() { "kooiot,tlink-c2-v2") tlink_add_4g_wan 3 2 ;; + "kooiot,tlink-c4-16m" | \ + "kooiot,tlink-c4-32m" | \ + "iyunlink,m28s") + # You need to use query usbmode + # AT+SYSNV=0,"usbmode" + # if it is not 2 // Eight Serials + # Then set it to 2 + # AT+SYSNV=1,"usbmode",2 + # And reboot it + # AT+TRB + tlink_add_4g_wan 0 5 + ;; *) tlink_add_4g_wan 2 1 ;; @@ -82,7 +94,10 @@ case "$(board_name)" in "kooiot,tlink-c3-16m" | \ "kooiot,tlink-c3-32m" | \ "kooiot,tlink-c35-16m" | \ -"kooiot,tlink-c35-32m" ) +"kooiot,tlink-c35-32m" | \ +"kooiot,tlink-c4-16m" | \ +"kooiot,tlink-c4-32m" | \ +"iyunlink,m28s") tlink_default ;; esac diff --git a/target/linux/ramips/mt76x8/base-files/lib/preinit/04_tlink.sh b/target/linux/ramips/mt76x8/base-files/lib/preinit/04_tlink.sh index fbe1bd255ef45b..d71e609c642ec9 100644 --- a/target/linux/ramips/mt76x8/base-files/lib/preinit/04_tlink.sh +++ b/target/linux/ramips/mt76x8/base-files/lib/preinit/04_tlink.sh @@ -86,7 +86,9 @@ do_kooiot_tlink_generic() { "kooiot,tlink-c3-16m" | \ "kooiot,tlink-c3-32m" | \ "kooiot,tlink-c35-16m" | \ - "kooiot,tlink-c35-32m") + "kooiot,tlink-c35-32m" | \ + "kooiot,tlink-c4-16m" | \ + "kooiot,tlink-c4-32m") do_product_sn_kooiot ;; esac diff --git a/target/linux/ramips/mt76x8/base-files/sbin/sysinfo b/target/linux/ramips/mt76x8/base-files/sbin/sysinfo index 68b6d103f4dd05..20700d58bf5361 100755 --- a/target/linux/ramips/mt76x8/base-files/sbin/sysinfo +++ b/target/linux/ramips/mt76x8/base-files/sbin/sysinfo @@ -16,7 +16,9 @@ case "$(board_name)" in "kooiot,tlink-c3-16m" | \ "kooiot,tlink-c3-32m" | \ "kooiot,tlink-c35-16m" | \ -"kooiot,tlink-c35-32m" ) +"kooiot,tlink-c35-32m" | \ +"kooiot,tlink-c4-16m" | \ +"kooiot,tlink-c4-32m" ) cpu_freq_cur="580000000" cpu_freq_min="580000000" cpu_freq_max="580000000" diff --git a/target/linux/ramips/mt76x8/base-files/sbin/write_psn b/target/linux/ramips/mt76x8/base-files/sbin/write_psn index d07fe0c29b87d7..1364888f5f0eb8 100755 --- a/target/linux/ramips/mt76x8/base-files/sbin/write_psn +++ b/target/linux/ramips/mt76x8/base-files/sbin/write_psn @@ -16,7 +16,9 @@ case "$(board_name)" in "kooiot,tlink-c3-16m" | \ "kooiot,tlink-c3-32m" | \ "kooiot,tlink-c35-16m" | \ -"kooiot,tlink-c35-32m") +"kooiot,tlink-c35-32m" | \ +"kooiot,tlink-c4-16m" | \ +"kooiot,tlink-c4-32m") ;; *) echo "This only support ThingsLink devices" diff --git a/target/linux/ramips/mt76x8/config-6.6 b/target/linux/ramips/mt76x8/config-6.6 index cf96fc10cb46f1..419e75776e492c 100644 --- a/target/linux/ramips/mt76x8/config-6.6 +++ b/target/linux/ramips/mt76x8/config-6.6 @@ -29,6 +29,7 @@ CONFIG_CPU_MIPS32=y CONFIG_CPU_MIPS32_R2=y CONFIG_CPU_MIPSR2=y CONFIG_CPU_MIPSR2_IRQ_VI=y +CONFIG_CPU_MITIGATIONS=y CONFIG_CPU_NEEDS_NO_SMARTMIPS_OR_MICROMIPS=y CONFIG_CPU_R4K_CACHE_TLB=y CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y @@ -56,7 +57,7 @@ CONFIG_FUNCTION_ALIGNMENT=0 CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y -CONFIG_GCC11_NO_ARRAY_BOUNDS=y +CONFIG_GCC10_NO_ARRAY_BOUNDS=y CONFIG_GCC_ASM_GOTO_OUTPUT_WORKAROUND=y CONFIG_GENERIC_ATOMIC64=y CONFIG_GENERIC_CLOCKEVENTS=y @@ -83,6 +84,7 @@ CONFIG_GPIOLIB_IRQCHIP=y CONFIG_GPIO_CDEV=y CONFIG_GPIO_GENERIC=y CONFIG_GPIO_MT7621=y +# CONFIG_GPIO_MT7628_MISC is not set # CONFIG_GPIO_RALINK is not set CONFIG_GPIO_WATCHDOG=y CONFIG_GPIO_WATCHDOG_ARCH_INITCALL=y @@ -120,6 +122,7 @@ CONFIG_MIPS_RAW_APPENDED_DTB=y CONFIG_MIPS_SPRAM=y CONFIG_MMU_LAZY_TLB_REFCOUNT=y CONFIG_MODULES_USE_ELF_REL=y +# CONFIG_MOTORCOMM_PHY_EXT is not set CONFIG_MT7621_WDT=y # CONFIG_MTD_CFI_INTELEXT is not set CONFIG_MTD_CMDLINE_PARTS=y @@ -146,6 +149,7 @@ CONFIG_NET_XGRESS=y CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y CONFIG_NVMEM=y CONFIG_NVMEM_LAYOUTS=y +# CONFIG_NVMEM_MT76X8_SYSC is not set CONFIG_OF=y CONFIG_OF_ADDRESS=y CONFIG_OF_EARLY_FLATTREE=y @@ -167,13 +171,13 @@ CONFIG_PHYLIB_LEDS=y # CONFIG_PHY_MT7621_PCI is not set CONFIG_PHY_RALINK_USB=y CONFIG_PINCTRL=y -# CONFIG_PINCTRL_AW9523 is not set # CONFIG_PINCTRL_MT7620 is not set CONFIG_PINCTRL_MT76X8=y CONFIG_PINCTRL_MTK_MTMIPS=y # CONFIG_PINCTRL_SINGLE is not set CONFIG_PREEMPT_NONE_BUILD=y CONFIG_PTP_1588_CLOCK_OPTIONAL=y +# CONFIG_R8168 is not set CONFIG_RALINK=y # CONFIG_RALINK_WDT is not set CONFIG_RANDSTRUCT_NONE=y @@ -190,6 +194,8 @@ CONFIG_SERIAL_8250_NR_UARTS=3 CONFIG_SERIAL_8250_RUNTIME_UARTS=3 CONFIG_SERIAL_MCTRL_GPIO=y CONFIG_SERIAL_OF_PLATFORM=y +# CONFIG_SERIAL_WK2XXX_SPI is not set +# CONFIG_SERIAL_XR14XX_USB is not set CONFIG_SOC_BUS=y CONFIG_SOC_MT7620=y # CONFIG_SOC_MT7621 is not set