Skip to content

Commit

Permalink
sunxi: update device tree according to real device
Browse files Browse the repository at this point in the history
  • Loading branch information
srdgame committed May 10, 2024
1 parent 1502f8a commit 774041d
Show file tree
Hide file tree
Showing 9 changed files with 744 additions and 170 deletions.
7 changes: 7 additions & 0 deletions package/boot/uboot-sunxi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,12 @@ define U-Boot/tlink_e1
BUILD_DEVICES:=kooiot_tlink-e1
endef

define U-Boot/tlink_rp_t113
BUILD_SUBTARGET:=cortexa7
NAME:=RP T113-S3 board
BUILD_DEVICES:=kooiot_tlink-rp-t113
endef

define U-Boot/tlink_c4
BUILD_SUBTARGET:=cortexa7
NAME:=ThingsLink C4
Expand Down Expand Up @@ -551,6 +557,7 @@ UBOOT_TARGETS := \
tlink_m416 \
tlink_e1 \
tlink_s1 \
tlink_rp_t113 \
Lichee_Zero_Plus \
sinlinx_sin_v3s \
nanopi_neo2 \
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
diff -Nurp a/arch/arm/mach-sunxi/board.c b/arch/arm/mach-sunxi/board.c
--- a/arch/arm/mach-sunxi/board.c
+++ b/arch/arm/mach-sunxi/board.c
@@ -195,6 +195,10 @@ static int gpio_init(void)
sunxi_gpio_set_cfgpin(SUNXI_GPL(2), SUN8I_GPL_R_UART);
sunxi_gpio_set_cfgpin(SUNXI_GPL(3), SUN8I_GPL_R_UART);
sunxi_gpio_set_pull(SUNXI_GPL(3), SUNXI_GPIO_PULL_UP);
+#elif CONFIG_CONS_INDEX == 5 && defined(CONFIG_MACH_SUN8I_R528)
+ sunxi_gpio_set_cfgpin(SUNXI_GPD(7), 5);
+ sunxi_gpio_set_cfgpin(SUNXI_GPD(8), 5);
+ sunxi_gpio_set_pull(SUNXI_GPD(8), SUNXI_GPIO_PULL_UP);
#elif CONFIG_CONS_INDEX == 2 && (defined(CONFIG_MACH_SUN8I) && \
!defined(CONFIG_MACH_SUN8I_R40)) \
|| defined(CONFIG_MACH_SUN8I_R528)
diff -Nurp a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
--- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
@@ -623,6 +623,7 @@ static const struct sunxi_pinctrl_functi
#else
{ "uart3", 7 }, /* PB6-PB7 */
#endif
+ { "uart4", 5 }, /* PD7-PD8 */
};

static const struct sunxi_pinctrl_desc __maybe_unused sun20i_d1_pinctrl_desc = {
134 changes: 134 additions & 0 deletions package/boot/uboot-sunxi/patches/894-ARM-dts-rp-t113s.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
--- /dev/null
+++ b/configs/tlink_rp_t113_defconfig
@@ -0,0 +1,17 @@
+CONFIG_ARM=y
+CONFIG_ARCH_SUNXI=y
+CONFIG_DEFAULT_DEVICE_TREE="sun8i-t113s-tlink-rp-t113"
+CONFIG_SPL=y
+CONFIG_MACH_SUN8I_R528=y
+CONFIG_DRAM_CLK=792
+CONFIG_DRAM_ZQ=8092667
+CONFIG_SUNXI_MINIMUM_DRAM_MB=128
+# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
+CONFIG_DRAM_SUNXI_ODT_EN=0
+CONFIG_DRAM_SUNXI_TPR0=0x004a2195
+CONFIG_DRAM_SUNXI_TPR11=0x340000
+CONFIG_DRAM_SUNXI_TPR12=0x46
+CONFIG_DRAM_SUNXI_TPR13=0x34000100
+CONFIG_CONS_INDEX=4
+CONFIG_UART3_PORT_E=y
+CONFIG_MMC_SUNXI_SLOT_EXTRA=2
--- /dev/null
+++ b/arch/arm/dts/sun8i-t113s-tlink-rp-t113.dts
@@ -0,0 +1,111 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+// Copyright (C) 2024 Dirk Chang <[email protected]>.
+
+#include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/leds/common.h>
+
+/dts-v1/;
+
+#include "sun8i-t113s.dtsi"
+
+/ {
+ model = "ThingsLink RP-T113";
+ compatible = "kooiot,tlink-rp-t113", "allwinner,sun8i-t113s";
+
+ aliases {
+ serial0 = &uart3;
+ };
+
+ chosen {
+ stdout-path = "serial0:115200n8";
+ };
+
+ /* board wide 5V supply directly from the USB-C socket */
+ reg_vcc5v: regulator-5v {
+ compatible = "regulator-fixed";
+ regulator-name = "vcc-5v";
+ regulator-min-microvolt = <5000000>;
+ regulator-max-microvolt = <5000000>;
+ regulator-always-on;
+ };
+
+ /* SY8008 DC/DC regulator on the board */
+ reg_3v3: regulator-3v3 {
+ compatible = "regulator-fixed";
+ regulator-name = "vcc-3v3";
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+ vin-supply = <&reg_vcc5v>;
+ };
+
+ /* SY8008 DC/DC regulator on the board, also supplying VDD-SYS */
+ reg_vcc_core: regulator-core {
+ compatible = "regulator-fixed";
+ regulator-name = "vcc-core";
+ regulator-min-microvolt = <880000>;
+ regulator-max-microvolt = <880000>;
+ vin-supply = <&reg_vcc5v>;
+ };
+
+ /* XC6206 LDO on the board */
+ reg_avdd2v8: regulator-avdd {
+ compatible = "regulator-fixed";
+ regulator-name = "avdd2v8";
+ regulator-min-microvolt = <2800000>;
+ regulator-max-microvolt = <2800000>;
+ vin-supply = <&reg_3v3>;
+ };
+};
+
+&cpu0 {
+ cpu-supply = <&reg_vcc_core>;
+};
+
+&cpu1 {
+ cpu-supply = <&reg_vcc_core>;
+};
+
+&dcxo {
+ clock-frequency = <24000000>;
+};
+
+&mmc0 {
+ pinctrl-0 = <&mmc0_pins>;
+ pinctrl-names = "default";
+ vmmc-supply = <&reg_3v3>;
+ cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>;
+ disable-wp;
+ bus-width = <4>;
+ status = "okay";
+};
+
+&mmc2 {
+ bus-width = <8>;
+ non-removable;
+ vmmc-supply = <&reg_3v3>;
+ vqmmc-supply = <&reg_3v3>;
+ pinctrl-0 = <&mmc2_pins>;
+ pinctrl-names = "default";
+ status = "okay";
+};
+
+&pio {
+ vcc-pb-supply = <&reg_3v3>;
+ vcc-pd-supply = <&reg_3v3>;
+ vcc-pe-supply = <&reg_avdd2v8>;
+ vcc-pf-supply = <&reg_3v3>;
+ vcc-pg-supply = <&reg_3v3>;
+
+ uart3_pe_pins: uart3-pe-pins {
+ pins = "PE8", "PE9";
+ function = "uart3";
+ };
+};
+
+&uart3 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&uart3_pe_pins>;
+ status = "okay";
+};
+
53 changes: 33 additions & 20 deletions package/boot/uboot-sunxi/patches/923-ARM-dts-tlink-e1.patch
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@
+CONFIG_MACH_SUN8I_R528=y
+CONFIG_DRAM_CLK=792
+CONFIG_DRAM_ZQ=8092667
+CONFIG_MMC0_CD_PIN="PF6"
+CONFIG_MMC_SUNXI_SLOT_EXTRA=2
+CONFIG_SUNXI_MINIMUM_DRAM_MB=128
+# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
+CONFIG_DRAM_SUNXI_ODT_EN=0
+CONFIG_DRAM_SUNXI_TPR0=0x004a2195
+CONFIG_DRAM_SUNXI_TPR11=0x340000
+CONFIG_DRAM_SUNXI_TPR12=0x46
+CONFIG_DRAM_SUNXI_TPR13=0x34000100
+CONFIG_CONS_INDEX=4
+CONFIG_UART3_PORT_E=y
+CONFIG_MMC_SUNXI_SLOT_EXTRA=2
+CONFIG_CONS_INDEX=5
--- /dev/null
+++ b/arch/arm/dts/sun8i-t113s-tlink-e1.dts
@@ -0,0 +1,111 @@
@@ -0,0 +1,124 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+// Copyright (C) 2022 Arm Ltd.
+// Copyright (C) 2024 Dirk Chang <[email protected]>
+
+#include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/gpio/gpio.h>
Expand All @@ -37,14 +37,13 @@
+ compatible = "kooiot,tlink-e1", "allwinner,sun8i-t113s";
+
+ aliases {
+ serial0 = &uart3;
+ serial0 = &uart4;
+ };
+
+ chosen {
+ stdout-path = "serial0:115200n8";
+ };
+
+ /* board wide 5V supply directly from the USB-C socket */
+ reg_vcc5v: regulator-5v {
+ compatible = "regulator-fixed";
+ regulator-name = "vcc-5v";
Expand All @@ -53,7 +52,6 @@
+ regulator-always-on;
+ };
+
+ /* SY8008 DC/DC regulator on the board */
+ reg_3v3: regulator-3v3 {
+ compatible = "regulator-fixed";
+ regulator-name = "vcc-3v3";
Expand All @@ -62,12 +60,28 @@
+ vin-supply = <&reg_vcc5v>;
+ };
+
+ /* SY8008 DC/DC regulator on the board, also supplying VDD-SYS */
+ reg_1v8: regulator-1v8 {
+ compatible = "regulator-fixed";
+ regulator-name = "vcc-1v8";
+ regulator-min-microvolt = <1800000>;
+ regulator-max-microvolt = <1900000>;
+ vin-supply = <&reg_3v3>;
+ };
+
+ reg_vcc_wifi_3v3: regulator-wifi-3v3 {
+ compatible = "regulator-fixed";
+ regulator-name = "vcc-wifi-3v3";
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>; /* PD20 EXT-P-EN pin */
+ vin-supply = <&reg_vcc5v>;
+ };
+
+ /* SY8089 DC/DC regulator on the board, also supplying VDD-SYS */
+ reg_vcc_core: regulator-core {
+ compatible = "regulator-fixed";
+ regulator-name = "vcc-core";
+ regulator-min-microvolt = <880000>;
+ regulator-max-microvolt = <880000>;
+ regulator-min-microvolt = <950000>;
+ regulator-max-microvolt = <950000>;
+ vin-supply = <&reg_vcc5v>;
+ };
+
Expand Down Expand Up @@ -97,7 +111,7 @@
+ pinctrl-0 = <&mmc0_pins>;
+ pinctrl-names = "default";
+ vmmc-supply = <&reg_3v3>;
+ cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>;
+ cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
+ disable-wp;
+ bus-width = <4>;
+ status = "okay";
Expand All @@ -116,19 +130,18 @@
+&pio {
+ vcc-pb-supply = <&reg_3v3>;
+ vcc-pd-supply = <&reg_3v3>;
+ vcc-pe-supply = <&reg_avdd2v8>;
+ vcc-pe-supply = <&reg_3v3>;
+ vcc-pf-supply = <&reg_3v3>;
+ vcc-pg-supply = <&reg_3v3>;
+ vcc-pg-supply = <&reg_1v8>;
+
+ uart3_pe_pins: uart3-pe-pins {
+ pins = "PE8", "PE9";
+ function = "uart3";
+ uart4_pd_pins: uart4-pd-pins {
+ pins = "PD7", "PD8";
+ function = "uart4";
+ };
+};
+
+&uart3 {
+&uart4 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&uart3_pe_pins>;
+ pinctrl-0 = <&uart4_pd_pins>;
+ status = "okay";
+};
+
10 changes: 8 additions & 2 deletions package/boot/uboot-sunxi/patches/999-sunxi-add-boards-dts.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -673,6 +673,8 @@
@@ -772,6 +772,8 @@ dtb-$(CONFIG_MACH_SUN8I_A83T) += \
sun8i-a83t-bananapi-m3.dtb \
sun8i-a83t-cubietruck-plus.dtb \
sun8i-a83t-tbs-a711.dtb
Expand All @@ -9,7 +9,7 @@
dtb-$(CONFIG_MACH_SUN8I_H3) += \
sun8i-h2-plus-bananapi-m2-zero.dtb \
sun8i-h2-plus-libretech-all-h3-cc.dtb \
@@ -699,16 +701,31 @@
@@ -798,19 +800,36 @@ dtb-$(CONFIG_MACH_SUN8I_H3) += \
sun8i-h3-orangepi-plus2e.dtb \
sun8i-h3-orangepi-zero-plus2.dtb \
sun8i-h3-rervision-dvk.dtb \
Expand Down Expand Up @@ -40,5 +40,11 @@
+ sun8i-s3-tlink-s1.dtb \
+ sun8i-v3s-sinlinx-sin-v3s.dtb \
sun8i-v3s-licheepi-zero.dtb
dtb-$(CONFIG_MACH_SUN8I_R528) += \
- sun8i-t113s-mangopi-mq-r-t113.dtb
+ sun8i-t113s-mangopi-mq-r-t113.dtb \
+ sun8i-t113s-tlink-rp-t113.dtb \
+ sun8i-t113s-tlink-e1.dtb
dtb-$(CONFIG_MACH_SUN50I_H5) += \
sun50i-h5-bananapi-m2-plus.dtb \
sun50i-h5-emlid-neutis-n5-devboard.dtb \
8 changes: 0 additions & 8 deletions package/boot/uboot-sunxi/uEnv-t113.txt

This file was deleted.

20 changes: 20 additions & 0 deletions target/linux/sunxi/image/cortexa7.mk
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,26 @@ define Device/kooiot_tlink-m416
endef
TARGET_DEVICES += kooiot_tlink-m416

define Device/kooiot_tlink-rp-t113
DEVICE_VENDOR := KooIoT
DEVICE_MODEL := ThingsLink RP-T113
DEVICE_PACKAGES:=kmod-rtc-sunxi \
wpad-basic-mbedtls \
kmod-usb2 kmod-usb-ohci kmod-gpio-button-hotplug \
kmod-leds-gpio kmod-ledtrig-heartbeat \
kmod-ledtrig-netdev kmod-ledtrig-gpio \
kmod-usb-serial kmod-usb-serial-option \
kmod-usb-serial-qualcomm kmod-usb-net-qmi-wwan \
kmod-can-bcm kmod-can-raw ip-full\
uqmi fdisk usbutils freeioe wwanleds \
luci-app-freeioe luci-proto-qmi luci-proto-3g \
tinc-freeioe-tunnel ser2net shellinabox iperf3 ethtool \
blockd kmod-usb-storage \
usb-otg-sunxi kmod-usb-gadget-serial
SOC := sun8i-t113
endef
TARGET_DEVICES += kooiot_tlink-rp-t113

define Device/kooiot_tlink-e1
DEVICE_VENDOR := KooIoT
DEVICE_MODEL := ThingsLink E1
Expand Down
Loading

0 comments on commit 774041d

Please sign in to comment.