diff --git a/package/boot/uboot-sunxi/Makefile b/package/boot/uboot-sunxi/Makefile index 79a014ba99e302..914a08db32d8e8 100644 --- a/package/boot/uboot-sunxi/Makefile +++ b/package/boot/uboot-sunxi/Makefile @@ -361,6 +361,13 @@ define U-Boot/tlink_k2x UENV:=display endef +define U-Boot/tlink_k4x + BUILD_SUBTARGET:=cortexa7 + NAME:=ThingsLink K4X + BUILD_DEVICES:=kooiot_tlink-k4x + UENV:=display +endef + define U-Boot/tlink_m408 BUILD_SUBTARGET:=cortexa7 NAME:=ThingsLink M408 @@ -425,6 +432,7 @@ UBOOT_TARGETS := \ tlink_k1 \ tlink_k2 \ tlink_k2x \ + tlink_k4x \ tlink_m408 \ tlink_m416 \ tlink_s1 \ diff --git a/package/boot/uboot-sunxi/patches/915-ARM-dts-tlink-k2x.patch b/package/boot/uboot-sunxi/patches/915-ARM-dts-tlink-k2x.patch index cba0ea78deb588..304bd2477ccb9a 100644 --- a/package/boot/uboot-sunxi/patches/915-ARM-dts-tlink-k2x.patch +++ b/package/boot/uboot-sunxi/patches/915-ARM-dts-tlink-k2x.patch @@ -78,7 +78,7 @@ + + status { + label = "kooiot:green:status"; -+ gpios = <&pio 7 11 GPIO_ACTIVE_LOW>; /* PG7 */ ++ gpios = <&pio 6 7 GPIO_ACTIVE_LOW>; /* PG7 */ + linux,default-trigger = "heartbeat"; + }; + }; diff --git a/package/boot/uboot-sunxi/patches/916-ARM-dts-tlink-k4x.patch b/package/boot/uboot-sunxi/patches/916-ARM-dts-tlink-k4x.patch new file mode 100644 index 00000000000000..5d8fb4a97c5f1f --- /dev/null +++ b/package/boot/uboot-sunxi/patches/916-ARM-dts-tlink-k4x.patch @@ -0,0 +1,271 @@ +--- /dev/null ++++ b/configs/tlink_k4x_defconfig +@@ -0,0 +1,32 @@ ++CONFIG_ARM=y ++CONFIG_ARCH_SUNXI=y ++CONFIG_SPL=y ++CONFIG_MACH_SUN8I_R40=y ++CONFIG_DRAM_CLK=576 ++CONFIG_DRAM_ZQ=3881979 ++# CONFIG_SUNXI_DRAM_DW_R40_DUAL_RANK is not set ++CONFIG_MMC0_CD_PIN="PB8" ++CONFIG_MMC_SUNXI_SLOT_EXTRA=2 ++CONFIG_USB0_VBUS_PIN="PC18" ++CONFIG_AHCI=y ++CONFIG_SUNXI_DRAM_LPDDR3_STOCK=y ++# CONFIG_NR_DRAM_BANKS is not set ++# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set ++CONFIG_SPL_I2C_SUPPORT=y ++# CONFIG_CMD_FLASH is not set ++CONFIG_DEFAULT_DEVICE_TREE="sun8i-r40-tlink-k4x" ++CONFIG_SCSI_AHCI=y ++CONFIG_MII=y ++CONFIG_SUN8I_EMAC=y ++CONFIG_AXP_GPIO=y ++CONFIG_AXP_DCDC3_VOLT=1200 ++CONFIG_AXP_DCDC5_VOLT=1200 ++CONFIG_AXP_ALDO1_VOLT=3300 ++CONFIG_AXP_ALDO2_VOLT=1800 ++CONFIG_AXP_DLDO1_VOLT=3300 ++CONFIG_AXP_DLDO4_VOLT=1800 ++CONFIG_AXP_ELDO2_VOLT=1200 ++CONFIG_AXP_ELDO3_VOLT=2500 ++CONFIG_SCSI=y ++CONFIG_USB_ECHI_HCD=y ++CONFIG_USB_OCHI_HCD=y ++++ a/arch/arm/dts/Makefile ++++ b/arch/arm/dts/Makefile +@@ -547,6 +547,7 @@ + sun8i-r40-bananapi-m2-ultra.dtb \ + sun8i-r40-tlink-k1.dtb \ + sun8i-r40-tlink-k2x.dtb \ ++ sun8i-r40-tlink-k4x.dtb \ + sun8i-v40-bananapi-m2-berry.dtb \ + sun8i-t3-tlink-m408.dtb + dtb-$(CONFIG_MACH_SUN8I_V3S) += \ +--- /dev/null ++++ b/arch/arm/dts/sun8i-r40-tlink-k4x.dts +@@ -0,0 +1,223 @@ ++/* ++ * Copyright (C) 2024 Dirk Chang ++ * ++ */ ++ ++/dts-v1/; ++#include "sun8i-r40.dtsi" ++ ++#include ++ ++/ { ++ model = "ThingsLink K4X"; ++ compatible = "kooiot,tlink-k4x", "allwinner,sun8i-r40"; ++ ++ aliases { ++ ethernet0 = &gmac; ++ ethernet1 = &emac; ++ serial0 = &uart0; ++ mmc0 = &mmc0; ++ mmc1 = &mmc2; ++ }; ++ ++ chosen { ++ stdout-path = "serial0:115200n8"; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ status { ++ label = "green:status"; ++ gpios = <&pio 6 8 GPIO_ACTIVE_HIGH>; /* PG8 */ ++ linux,default-trigger = "heartbeat"; ++ }; ++ }; ++ ++ reg_vcc3v3_sdc: vcc3v3-sdc { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc3v3-sdc"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ vin-supply = <®_dcdc1>; ++ gpio = <&pio 2 16 GPIO_ACTIVE_LOW>; /* PC16 CARD0-PWR*/ ++ // enable-active-high; ++ }; ++}; ++ ++&emac { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&emac_mii_pins>; ++ phy-handle = <&emac_phy>; ++ phy-supply = <®_dcdc1>; ++ phy-mode = "mii"; ++ status = "okay"; ++}; ++ ++&emac_mdio { ++ status = "okay"; ++ phy-supply = <®_dcdc1>; ++ reset-gpios = <&pio 7 27 GPIO_ACTIVE_LOW>; /* PH27 */ ++ reset-assert-us = <10000>; ++ reset-deassert-us = <1000000>; ++ emac_phy: ethernet-phy@3 { ++ compatible = "ethernet-phy-ieee802.3-c22"; ++ reg = <3>; ++ }; ++}; ++ ++&gmac { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&gmac_rgmii_pins>; ++ phy-handle = <&phy1>; ++ phy-mode = "rgmii"; ++ phy-supply = <®_dcdc1>; ++ snps,reset-gpio = <&pio 0 9 GPIO_ACTIVE_LOW>; /* PA9 */ ++ snps,reset-delays-us = <0 10000 1000000>; ++ status = "okay"; ++}; ++ ++&gmac_mdio { ++ phy1: ethernet-phy@3 { ++ compatible = "ethernet-phy-ieee802.3-c22"; ++ reg = <3>; ++ // reset-gpios = <&pio 0 9 GPIO_ACTIVE_LOW>; /* PA9 */ ++ // reset-assert-us = <10000>; ++ // reset-deassert-us = <1000000>; ++ // interrupt-parent = <&pio>; ++ // interrupts = <&pio 0 17 GPIO_ACTIVE_LOW>; /* PA17 */ ++ }; ++}; ++ ++&i2c0 { ++ status = "okay"; ++ ++ axp22x: pmic@34 { ++ compatible = "x-powers,axp221"; ++ reg = <0x34>; ++ interrupt-parent = <&nmi_intc>; ++ interrupts = <0 IRQ_TYPE_LEVEL_LOW>; ++ }; ++}; ++ ++#include "axp22x.dtsi" ++ ++&mmc0 { ++ vmmc-supply = <®_vcc3v3_sdc>; ++ bus-width = <4>; ++ cd-gpios = <&pio 1 8 GPIO_ACTIVE_LOW>; /* PB3 */ ++ status = "okay"; ++}; ++ ++&mmc2 { ++ vmmc-supply = <®_dcdc1>; ++ vqmmc-supply = <®_aldo2>; ++ bus-width = <8>; ++ non-removable; ++ status = "okay"; ++}; ++ ++&pio { ++ pinctrl-names = "default"; ++ // pinctrl-0 = <&clk_out_a_pin>; // used by UART6 ++ vcc-pa-supply = <®_dcdc1>; ++ vcc-pc-supply = <®_dcdc1>; ++ vcc-pd-supply = <®_dcdc1>; ++ vcc-pe-supply = <®_dcdc1>; ++ vcc-pf-supply = <®_dcdc1>; ++ vcc-pg-supply = <®_dcdc1>; ++}; ++ ++®_aldo1 { ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-name = "vcc-wifi-io"; ++}; ++ ++®_aldo2 { ++ regulator-always-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-name = "vcc-pc"; ++}; ++ ++®_aldo3 { ++ regulator-always-on; ++ regulator-min-microvolt = <3000000>; ++ regulator-max-microvolt = <3000000>; ++ regulator-name = "vcc-pll"; ++}; ++ ++®_dc1sw { ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-name = "vcc-wifi"; ++}; ++ ++®_dcdc1 { ++ regulator-always-on; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-name = "vcc-3v3"; ++}; ++ ++®_dcdc2 { ++ regulator-always-on; ++ regulator-min-microvolt = <1000000>; ++ regulator-max-microvolt = <1300000>; ++ regulator-name = "vdd-sys"; ++}; ++ ++®_dcdc3 { ++ regulator-always-on; ++ regulator-min-microvolt = <1000000>; ++ regulator-max-microvolt = <1300000>; ++ regulator-name = "vdd-cpu"; ++}; ++ ++®_dcdc5 { ++ regulator-always-on; ++ regulator-min-microvolt = <1200000>; ++ regulator-max-microvolt = <1200000>; ++ regulator-name = "vcc-dram"; ++}; ++ ++®_dldo1 { ++ regulator-always-on; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-name = "vcc-eth-io"; ++}; ++ ++®_dldo2 { ++ regulator-always-on; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-name = "vcc-eth-io-2"; ++}; ++ ++®_dldo3 { ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-name = "vcc-wifi-1v8"; ++}; ++ ++®_dldo4 { ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-name = "vcc-wifi-1v8-2"; ++}; ++ ++®_eldo3 { ++ regulator-min-microvolt = <2500000>; ++ regulator-max-microvolt = <2500000>; ++ regulator-name = "vdd1v2-sata"; ++}; ++ ++&uart0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart0_pb_pins>; ++ status = "okay"; ++}; diff --git a/target/linux/sunxi/base-files/etc/board.d/01_leds b/target/linux/sunxi/base-files/etc/board.d/01_leds index 22cb7e5450e93b..46f3d76f7b9662 100755 --- a/target/linux/sunxi/base-files/etc/board.d/01_leds +++ b/target/linux/sunxi/base-files/etc/board.d/01_leds @@ -22,6 +22,7 @@ kooiot,tlink-r1) ucidef_set_led_netdev "modem" "modem" "kooiot:green:modem" "wwan0" ;; kooiot,tlink-k2) +kooiot,tlink-k4x) ucidef_set_led_netdev "modem" "modem" "kooiot:green:modem" "wwan0" ;; kooiot,tlink-k2x) diff --git a/target/linux/sunxi/base-files/etc/board.d/02_network b/target/linux/sunxi/base-files/etc/board.d/02_network index 9028aec29bf9eb..f78182b3ebe779 100755 --- a/target/linux/sunxi/base-files/etc/board.d/02_network +++ b/target/linux/sunxi/base-files/etc/board.d/02_network @@ -77,6 +77,7 @@ kooiot,tlink-k1) ucidef_set_interface_lan "eth0 eth1" ;; kooiot,tlink-k2|\ +kooiot,tlink-k4x|\ kooiot,tlink-m408|\ kooiot,tlink-m416) # tlink_setup_macs diff --git a/target/linux/sunxi/base-files/etc/uci-defaults/99_tlink b/target/linux/sunxi/base-files/etc/uci-defaults/99_tlink index 4f082fc5d1d01c..debc633db381d2 100755 --- a/target/linux/sunxi/base-files/etc/uci-defaults/99_tlink +++ b/target/linux/sunxi/base-files/etc/uci-defaults/99_tlink @@ -245,6 +245,7 @@ tlink_default() { case "$(board_name)" in "kooiot,tlink-k2x"|\ + "kooiot,tlink-k4x"|\ "kooiot,tlink-k2") tlink_init_5g ;; @@ -298,6 +299,7 @@ case "$(board_name)" in "kooiot,tlink-k1"|\ "kooiot,tlink-k2"|\ "kooiot,tlink-k2x"|\ +"kooiot,tlink-k4x"|\ "kooiot,tlink-s1"|\ "kooiot,tlink-m408"|\ "kooiot,tlink-m416"|\ diff --git a/target/linux/sunxi/base-files/lib/functions/tlink_csq_leds.sh b/target/linux/sunxi/base-files/lib/functions/tlink_csq_leds.sh index c29610a61d029d..cb354bf390da1a 100644 --- a/target/linux/sunxi/base-files/lib/functions/tlink_csq_leds.sh +++ b/target/linux/sunxi/base-files/lib/functions/tlink_csq_leds.sh @@ -115,7 +115,8 @@ case $(board_name) in tlink_csq_leds_mixed ;; kooiot,tlink-k2|\ - kooiot,tlink-k2x) + kooiot,tlink-k2x|\ + kooiot,tlink-k4x) tlink_csq_leds_single ;; *) diff --git a/target/linux/sunxi/base-files/lib/preinit/04_tlink.sh b/target/linux/sunxi/base-files/lib/preinit/04_tlink.sh index 1c2617133b9ce2..71f55c0ec420c1 100644 --- a/target/linux/sunxi/base-files/lib/preinit/04_tlink.sh +++ b/target/linux/sunxi/base-files/lib/preinit/04_tlink.sh @@ -84,7 +84,8 @@ do_kooiot_tlink_generic() { "kooiot,tlink-k2") do_product_sn_kooiot_nvmem "3" "0050" ;; - "kooiot,tlink-k2x") + "kooiot,tlink-k2x"|\ + "kooiot,tlink-k4x") do_product_sn_kooiot_nvmem "2" "0050" ;; esac diff --git a/target/linux/sunxi/base-files/lib/upgrade/platform.sh b/target/linux/sunxi/base-files/lib/upgrade/platform.sh index 8489463241965d..9e0e67c172464c 100644 --- a/target/linux/sunxi/base-files/lib/upgrade/platform.sh +++ b/target/linux/sunxi/base-files/lib/upgrade/platform.sh @@ -54,7 +54,8 @@ platform_check_image() { ;; "kooiot,tlink-k1"|\ "kooiot,tlink-k2"|\ - "kooiot,tlink-k2x") + "kooiot,tlink-k2x"|\ + "kooiot,tlink-k4x") tlink_check_image "sun8i-r40" "$1" && return 0 return 1 ;; @@ -101,6 +102,7 @@ platform_pre_upgrade() { "kooiot,tlink-k1"|\ "kooiot,tlink-k2"|\ "kooiot,tlink-k2x"|\ + "kooiot,tlink-k4x"|\ "kooiot,tlink-s1"|\ "kooiot,tlink-m408"|\ "kooiot,tlink-m416"|\ diff --git a/target/linux/sunxi/base-files/sbin/write_psn b/target/linux/sunxi/base-files/sbin/write_psn index 2f0748b5c5454b..f45f6b4d73c303 100755 --- a/target/linux/sunxi/base-files/sbin/write_psn +++ b/target/linux/sunxi/base-files/sbin/write_psn @@ -90,7 +90,8 @@ case "$(board_name)" in NVMEM_PATH="/sys/bus/i2c/devices/3-0050/3-00501/nvmem" fi ;; - "kooiot,tlink-k2x") + "kooiot,tlink-k2x" |\ + "kooiot,tlink-k4x") NVMEM_PATH="/sys/bus/i2c/devices/2-0050/eeprom" if [ ! -f ${NVMEM_PATH} ]; then NVMEM_PATH="/sys/bus/i2c/devices/2-0050/2-00500/nvmem" diff --git a/target/linux/sunxi/image/cortexa7.mk b/target/linux/sunxi/image/cortexa7.mk index 4709bbf68b0a7c..71cdce15e88403 100644 --- a/target/linux/sunxi/image/cortexa7.mk +++ b/target/linux/sunxi/image/cortexa7.mk @@ -372,6 +372,33 @@ endef TARGET_DEVICES += kooiot_tlink-k2x +define Device/kooiot_tlink-k4x + DEVICE_VENDOR := KooIoT + DEVICE_MODEL := ThingsLink K4X + DEVICE_PACKAGES:=kmod-rtc-sunxi kmod-ata-sunxi \ + kmod-sun4i-emac kmod-rtc-sd3078 \ + kmod-xradio melsem-xr819-firmware wpad-basic-wolfssl \ + kmod-usb2 kmod-usb-ohci kmod-gpio-button-hotplug \ + kmod-leds-gpio kmod-ledtrig-heartbeat \ + kmod-ledtrig-netdev kmod-ledtrig-gpio \ + kmod-usb-net kmod-usb-net-asix \ + kmod-usb-serial kmod-usb-serial-option \ + kmod-usb-serial-qualcomm kmod-usb-net-qmi-wwan \ + kmod-serial-wk2xxx-spi kmod-can kmod-can-mcp251x \ + kmod-serial-ch432 \ + kmod-can-bcm kmod-can-raw ip-full\ + kmod-motorcomm-yt8521s kmod-motorcomm-yt8512c \ + uqmi fdisk usbutils freeioe wwanleds \ + luci-proto-qmi luci-proto-3g luci-proto-ncm \ + luci-app-freeioe tinc-freeioe-tunnel\ + ser2net shellinabox iperf3 ethtool \ + blockd kmod-usb-storage kmod-drm-sunxi \ + usb-otg-sunxi kmod-usb-gadget-serial + SOC := sun8i-r40 +endef +TARGET_DEVICES += kooiot_tlink-k4x + + define Device/kooiot_tlink-m408 DEVICE_VENDOR := KooIoT DEVICE_MODEL := ThingsLink M408 diff --git a/target/linux/sunxi/patches-5.4/916-ARM-dts-sun8i-kooiot-tlink-k4x.patch b/target/linux/sunxi/patches-5.4/916-ARM-dts-sun8i-kooiot-tlink-k4x.patch new file mode 100644 index 00000000000000..f856dca1edf340 --- /dev/null +++ b/target/linux/sunxi/patches-5.4/916-ARM-dts-sun8i-kooiot-tlink-k4x.patch @@ -0,0 +1,644 @@ +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -1132,6 +1132,7 @@ + sun8i-r40-tlink-k1.dtb \ + sun8i-r40-tlink-k2.dtb \ + sun8i-r40-tlink-k2x.dtb \ ++ sun8i-r40-tlink-k4x.dtb \ + sun8i-t3-tlink-m408.dtb \ + sun8i-s3-lichee-zero-plus.dtb \ + sun8i-s3-olinuxino.dtb \ +--- /dev/null ++++ b/arch/arm/boot/dts/sun8i-r40-tlink-k4x.dts +@@ -0,0 +1,631 @@ ++/* ++ * Copyright (C) 2024 Dirk Chang ++ * ++ */ ++ ++/dts-v1/; ++#include "sun8i-r40.dtsi" ++ ++#include ++#include ++#include ++#include ++ ++/ { ++ model = "ThingsLink K4X"; ++ compatible = "kooiot,tlink-k4x", "allwinner,sun8i-r40"; ++ ++ aliases { ++ ethernet0 = &gmac; ++ ethernet1 = &emac; ++ ethernet2 = &usb_eth1; ++ ethernet3 = &usb_eth2; ++ serial0 = &uart0; ++ serial1 = &uart3; ++ serial2 = &uart4; ++ serial3 = &uart5; ++ serial4 = &uart6; ++ mmc0 = &mmc0; ++ mmc1 = &mmc2; ++ mmc2 = &mmc1; ++ }; ++ ++ chosen { ++ stdout-path = "serial0:115200n8"; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ status { ++ label = "kooiot:green:status"; ++ gpios = <&pio 6 8 GPIO_ACTIVE_LOW>; /* PG8 */ ++ linux,default-trigger = "heartbeat"; ++ }; ++ ++ modem { ++ label = "kooiot:green:modem"; ++ gpios = <&pio 6 9 GPIO_ACTIVE_LOW>; /* PG9 */ ++ default-state = "off"; ++ }; ++ ++ csq { ++ label = "kooiot:green:csq"; ++ gpios = <&pio 6 10 GPIO_ACTIVE_LOW>; /* PG10 */ ++ default-state = "off"; ++ }; ++ }; ++ ++ gpio_keys { ++ compatible = "gpio-keys-polled"; ++ poll-interval = <20>; ++ ++ reset { ++ label = "reset"; ++ linux,code = ; ++ gpios = <&pio 8 6 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; /* PI6 */ ++ }; ++ }; ++ ++ gpio_export { ++ compatible = "gpio-export"; ++ #size-cells = <0>; ++ ++ pcie_power { ++ gpio-export,name = "pcie_power"; ++ gpio-export,output=<1>; ++ gpios = <&pio 8 4 GPIO_ACTIVE_HIGH>; /* PI4 */ ++ }; ++ ++ pcie_reset { ++ gpio-export,name = "pcie_reset"; ++ gpio-export,output=<1>; ++ gpios = <&pio 1 6 GPIO_ACTIVE_LOW>; /* PB6 */ ++ }; ++ ++ pcie_on_off { ++ gpio-export,name = "pcie_on_off"; ++ gpio-export,output=<1>; ++ gpios = <&pio 1 7 GPIO_ACTIVE_HIGH>; /* PB7 */ ++ }; ++ ++ pcie_disable { ++ gpio-export,name = "pcie_disable"; ++ gpio-export,output=<1>; ++ gpios = <&pio 1 5 GPIO_ACTIVE_HIGH>; /* PB5 */ ++ }; ++ ++ /* ++ wk2xxx_reset_1 { ++ gpio-export,name = "wk2xxx_reset_1"; ++ gpio-export,output=<1>; ++ gpios = <&pio 8 9 GPIO_ACTIVE_LOW>; /* PI9 / ++ }; ++ */ ++ ++ ap_reset { ++ gpio-export,name = "ap_reset"; ++ /* gpio-export,output=<1>; */ ++ gpios = <&pio 1 11 GPIO_ACTIVE_LOW>; /* PB11 */ ++ }; ++ ++ sata_en { ++ gpio-export,name = "sata_en"; /* SATA0_ACTn/GPIO_9 */ ++ gpio-export,output=<1>; ++ gpios = <&pio 8 7 GPIO_ACTIVE_HIGH>; /* PI7 */ ++ }; ++ ++ sata_sleep { ++ gpio-export,name = "sata_sleep"; /* DEVSLP0/DEVSLP */ ++ gpio-export,output=<0>; ++ gpios = <&pio 8 8 GPIO_ACTIVE_HIGH>; /* PI8 */ ++ }; ++ ++ eth2_reset { ++ gpio-export,name = "eth2_reset"; ++ gpio-export,output=<0>; ++ gpios = <&pio 7 12 GPIO_ACTIVE_HIGH>; /* PH12 */ ++ }; ++ ++ eth3_reset { ++ gpio-export,name = "eth3_reset"; ++ gpio-export,output=<0>; ++ gpios = <&pio 7 2 GPIO_ACTIVE_HIGH>; /* PH2 */ ++ }; ++ }; ++ ++ reg_vcc3v3_sdc: vcc3v3-sdc { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc3v3-sdc"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ vin-supply = <®_dcdc1>; ++ gpio = <&pio 2 16 GPIO_ACTIVE_LOW>; /* PC16 CARD0-PWR*/ ++ // enable-active-high; ++ }; ++ ++ reg_usb_vcc5v0: usb-vcc5v0 { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc5v0"; ++ regulator-always-on; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ // gpio = <&pio 2 18 GPIO_ACTIVE_HIGH>; /* PC18 */ ++ // enable-active-high; ++ }; ++ ++ wifi_pwrseq: wifi_pwrseq { ++ compatible = "mmc-pwrseq-simple"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&wifi_rst>; ++ reset-gpios = <&pio 7 6 GPIO_ACTIVE_LOW>; /* PH6 WL_RESTN */ ++ post-power-on-delay-ms = <50>; ++ }; ++ ++ reg_vcc_mac_3v3: vcc-mac-3v3 { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc-mac-3v3"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ vin-supply = <®_eldo1>, <®_eldo2>; ++ }; ++}; ++ ++&rtc { ++ status = "disabled"; // cpu rtc disabled ++}; ++ ++&ahci { ++ ahci-supply = <®_dc5ldo>; ++ phy-supply = <®_eldo3>; ++ status = "okay"; ++}; ++ ++&ths { ++ status = "okay"; ++}; ++ ++&ehci0 { ++ status = "okay"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ usb_eth2: asix@1 { ++ reg = <1>; ++ nvmem-cells = <&chipid>; ++ nvmem-cell-names = "chipid"; ++ local-mac-address = [00 00 00 00 00 00]; ++ }; ++}; ++ ++&ohci0 { ++ status = "okay"; ++}; ++ ++&ehci1 { ++ status = "okay"; ++ ++ usb_eth1: asix@1 { ++ reg = <1>; ++ nvmem-cells = <&chipid>; ++ nvmem-cell-names = "chipid"; ++ local-mac-address = [00 00 00 00 00 00]; ++ }; ++}; ++ ++&ohci1 { ++ status = "okay"; ++}; ++ ++&ehci2 { ++ status = "okay"; ++}; ++ ++&ohci2 { ++ status = "okay"; ++}; ++ ++&emac { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&emac_ph_pins>; ++ phy-handle = <&emac_phy>; ++ phy-supply = <®_vcc_mac_3v3>; ++ phy-mode = "mii"; ++ reset-gpios = <&pio 7 27 GPIO_ACTIVE_LOW>; /* PH27 */ ++ status = "okay"; ++}; ++ ++&emac_mdio { ++ status = "okay"; ++ phy-supply = <®_vcc_mac_3v3>; ++ allwinner,emac-fix-phy-id = <0x128>; ++ ++ emac_phy: ethernet-phy@3 { ++ compatible = "ethernet-phy-ieee802.3-c22"; ++ reg = <3>; ++ motorcomm,led0 = <0x331>; ++ motorcomm,led1 = <0x30>; ++ }; ++}; ++ ++&gmac { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&gmac_rgmii_pins>; ++ phy-handle = <&phy1>; ++ phy-mode = "rgmii"; ++ phy-supply = <®_vcc_mac_3v3>; ++ snps,reset-gpio = <&pio 0 9 GPIO_ACTIVE_LOW>; /* PA9 */ ++ snps,reset-delays-us = <0 10000 1000000>; ++ status = "okay"; ++}; ++ ++&gmac_mdio { ++ phy1: ethernet-phy@3 { ++ compatible = "ethernet-phy-ieee802.3-c22"; ++ reg = <3>; ++ // reset-gpios = <&pio 0 9 GPIO_ACTIVE_LOW>; /* PA9 */ ++ // reset-assert-us = <10000>; ++ // reset-deassert-us = <1000000>; ++ // interrupt-parent = <&pio>; ++ // interrupts = <&pio 0 17 GPIO_ACTIVE_LOW>; /* PA17 */ ++ motorcomm,led1 = <0x1e00>; ++ motorcomm,led2 = <0x24>; ++ }; ++}; ++ ++&spi0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi0_pc_pins>, <&spi0_cs0_pc_pin>, <&spi0_irq_pins>, <&spi0_reset_pins>; ++ status = "okay"; ++ wk2xxx_spi0: wk2xxx-spi0@00 { ++ status = "okay"; ++ compatible = "wkmic,wk2xxx_spi"; ++ reg = <0x00>; ++ spi-max-frequency = <10000000>; ++ poll_mode = <0>; ++ type = <0>; ++ enable_dma = <0>; ++ reset_gpio = <&pio 1 2 GPIO_ACTIVE_HIGH>; /* PB2 */ ++ irq_gpio=<&pio 8 15 IRQ_TYPE_LEVEL_LOW>; /* PI15 */ ++ }; ++}; ++ ++&spi1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi1_pi_pins>, <&spi1_cs0_pi_pin>, <&spi1_irq_pins>, <&spi1_reset_pins>; ++ status = "okay"; ++ wk2xxx_spi1: wk2xxx-spi1@00 { ++ status = "okay"; ++ compatible = "wkmic,wk2xxx_spi"; ++ reg = <0x00>; ++ spi-max-frequency = <10000000>; ++ poll_mode = <0>; ++ type = <0>; ++ enable_dma = <0>; ++ reset_gpio = <&pio 1 3 GPIO_ACTIVE_HIGH>; /* PB3 */ ++ irq_gpio=<&pio 7 2 IRQ_TYPE_LEVEL_LOW>; /* PH2 */ ++ }; ++}; ++ ++&spi2 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi2_pc_pins>, <&spi2_irq_pins>, <&spi2_reset_pins>; ++ status = "okay"; ++ wk2xxx_spi2: wk2xxx-spi2@00 { ++ status = "okay"; ++ compatible = "wkmic,wk2xxx_spi"; ++ reg = <0x00>; ++ spi-max-frequency = <10000000>; ++ poll_mode = <0>; ++ type = <0>; ++ enable_dma = <0>; ++ reset_gpio = <&pio 1 3 GPIO_ACTIVE_HIGH>; /* PI9 */ ++ irq_gpio=<&pio 7 3 IRQ_TYPE_LEVEL_LOW>; /* PH3 */ ++ }; ++}; ++ ++&i2c0 { ++ status = "okay"; ++ ++ axp22x: pmic@34 { ++ compatible = "x-powers,axp221"; ++ reg = <0x34>; ++ interrupt-parent = <&nmi_intc>; ++ interrupts = <0 IRQ_TYPE_LEVEL_LOW>; ++ }; ++}; ++ ++&i2c1 { ++ status = "okay"; ++}; ++ ++&i2c2 { ++ status = "okay"; ++ ++ sd3077: sd3077@32 { ++ compatible = "whwave,sd3078"; ++ reg = <0x32>; ++ status = "okay"; ++ }; ++}; ++ ++&i2c3 { ++ status = "okay"; ++ ++ at24c02: eeprom@50 { ++ compatible = "atmel,24c02"; ++ reg = <0x50>; ++ pagesize = <16>; ++ }; ++}; ++ ++#include "axp22x.dtsi" ++ ++/* SD Card */ ++&mmc0 { ++ vmmc-supply = <®_vcc3v3_sdc>; ++ bus-width = <4>; ++ cd-gpios = <&pio 1 8 GPIO_ACTIVE_LOW>; /* PB8 */ ++ status = "okay"; ++}; ++ ++/* SDIO (P26) */ ++&mmc1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&mmc1_pg_pins>; ++ vmmc-supply = <®_dldo3>, <®_dldo4>; ++ vqmmc-supply = <®_aldo1>; ++ mmc-pwrseq = <&wifi_pwrseq>; ++ bus-width = <4>; ++ max-frequency = <16000000>; ++ non-removable; ++ status = "okay"; ++ ++ xr819: sdio_wifi@1 { ++ reg = <1>; ++ compatible = "xradio,xr819"; ++ interrupt-parent = <&pio>; ++ interrupts = <7 7 IRQ_TYPE_EDGE_RISING>; /* PH7 */ ++ interrupt-names = "host-wake"; ++ local-mac-address = [dc 44 6d c0 ff ee]; ++ }; ++}; ++ ++/* eMMC */ ++&mmc2 { ++ vmmc-supply = <®_dcdc1>; ++ vqmmc-supply = <®_aldo2>; ++ bus-width = <8>; ++ non-removable; ++ status = "okay"; ++}; ++ ++&pio { ++ pinctrl-names = "default"; ++ // pinctrl-0 = <&clk_out_a_pin>; // used by UART6 ++ vcc-pa-supply = <®_dcdc1>; ++ vcc-pc-supply = <®_dcdc1>; ++ vcc-pd-supply = <®_dcdc1>; ++ vcc-pe-supply = <®_dcdc1>; ++ vcc-pf-supply = <®_dcdc1>; ++ vcc-pg-supply = <®_dcdc1>; ++ ++ spi0_irq_pins: spi0-irq-pins { ++ pins = "PI15"; ++ function = "irq"; ++ }; ++ ++ spi0_reset_pins: spi0-reset-pins { ++ pins = "PB2"; ++ function = "gpio_out"; ++ }; ++ ++ spi1_irq_pins: spi1-irq-pins { ++ pins = "PH2"; ++ function = "irq"; ++ }; ++ ++ spi1_reset_pins: spi1-reset-pins { ++ pins = "PB3"; ++ function = "gpio_out"; ++ }; ++ ++ spi2_pc_pins: spi2-pc-pins { ++ pins = "PC19", "PC20", "PC21", "PC22"; ++ function = "spi2"; ++ }; ++ ++ spi2_irq_pins: spi2-irq-pins { ++ pins = "PH3"; ++ function = "irq"; ++ }; ++ ++ spi2_reset_pins: spi2-reset-pins { ++ pins = "PB3"; ++ function = "gpio_out"; ++ }; ++ ++ /omit-if-no-ref/ ++ lcd0_rgb888_pins: lcd0-rgb888-pins { ++ pins = "PD0", "PD1", "PD2", "PD3", ++ "PD4", "PD5", "PD6", "PD7", ++ "PD8", "PD9", "PD10", "PD11", ++ "PD12", "PD13", "PD14", "PD15", ++ "PD16", "PD17", "PD18", "PD19", ++ "PD20", "PD21", "PD22", "PD23", ++ "PD24", "PD25", "PD26", "PD27"; ++ function = "lcd0"; ++ }; ++ ++ wifi_rst: wifi-rst-pin { ++ pins = "PH6"; ++ function = "gpio_out"; ++ }; ++ ++ keys_pins: key-pins { ++ pins = "PI6"; ++ function = "gpio_in"; ++ }; ++ ++ uart3_ph_pins: uart3-ph-pins { ++ pins = "PH0", "PH1"; ++ function = "uart3"; ++ }; ++ ++ uart4_ph_pins: uart4-ph-pins { ++ pins = "PH4", "PH5"; ++ function = "uart4"; ++ }; ++ ++ uart5_pi_pins: uart5-pi-pins { ++ pins = "PI10", "PI11"; ++ function = "uart5"; ++ }; ++ ++ uart6_pi_pins: uart6-pi-pins { ++ pins = "PI12", "PI13"; ++ function = "uart6"; ++ }; ++}; ++ ++&pwm { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pwm_ch0_pin>; ++ status = "okay"; ++}; ++ ++®_aldo1 { ++ regulator-always-on; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-name = "vcc-wifi-io"; ++}; ++ ++®_aldo2 { ++ regulator-always-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-name = "vcc-pc"; ++}; ++ ++®_aldo3 { ++ regulator-always-on; ++ regulator-min-microvolt = <3000000>; ++ regulator-max-microvolt = <3000000>; ++ regulator-name = "vcc-pll"; ++}; ++ ++®_dc1sw { ++ regulator-always-on; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-name = "vcc-wifi"; ++}; ++ ++®_dcdc1 { ++ regulator-always-on; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-name = "vcc-3v3"; ++}; ++ ++®_dcdc2 { ++ regulator-always-on; ++ regulator-min-microvolt = <1000000>; ++ regulator-max-microvolt = <1300000>; ++ regulator-name = "vdd-sys"; ++}; ++ ++®_dcdc3 { ++ regulator-always-on; ++ regulator-min-microvolt = <1000000>; ++ regulator-max-microvolt = <1300000>; ++ regulator-name = "vdd-cpu"; ++}; ++ ++®_dcdc5 { ++ regulator-always-on; ++ regulator-min-microvolt = <1200000>; ++ regulator-max-microvolt = <1200000>; ++ regulator-name = "vcc-dram"; ++}; ++ ++®_dc5ldo { ++ regulator-min-microvolt = <1200000>; ++ regulator-max-microvolt = <1200000>; ++ regulator-name = "vdd1v2-sata"; ++}; ++ ++®_dldo1 { ++ regulator-always-on; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-name = "vcc-eth-io"; ++}; ++ ++®_dldo2 { ++ regulator-always-on; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-name = "vcc-eth-io-2"; ++}; ++ ++®_dldo3 { ++ regulator-always-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-name = "vcc-wifi-1v8"; ++}; ++ ++®_dldo4 { ++ regulator-always-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-name = "vcc-wifi-1v8-2"; ++}; ++ ++®_eldo3 { ++ regulator-min-microvolt = <2500000>; ++ regulator-max-microvolt = <2500000>; ++ regulator-name = "vdd2v5-sata"; ++}; ++ ++&uart0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart0_pb_pins>; ++ status = "okay"; ++}; ++ ++&uart3 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart3_ph_pins>; ++ status = "okay"; ++}; ++ ++&uart4 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart4_ph_pins>; ++ status = "okay"; ++}; ++ ++&uart5 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart5_pi_pins>; ++ status = "okay"; ++}; ++ ++&uart6 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart6_pi_pins>; ++ status = "okay"; ++}; ++ ++&usbphy { ++ // usb0_id_det-gpios = <&pio 1 12 GPIO_ACTIVE_HIGH>; /* PB12 */ ++ usb0_vbus-supply = <®_usb_vcc5v0>; ++ // usb1_id_det-gpios = <&pio 1 13 GPIO_ACTIVE_HIGH>; /* PB13 */ ++ usb1_vbus-supply = <®_usb_vcc5v0>; ++ status = "okay"; ++};