build/patch/kernel/archive/sunxi-6.5/patches.armbian/arm64-dts-overlay-sun50i-h616-bigtreetech-cb1.patch

498 lines
14 KiB
Diff
Raw Normal View History

From 0480784b475fe2af7f06ce980583b8c875d2bc5a Mon Sep 17 00:00:00 2001
From: Your Name <you@example.com>
Date: Tue, 30 May 2023 12:04:55 +0800
Subject: [PATCH] cb1-overlay
---
arch/arm64/boot/dts/allwinner/overlay/Makefile | 15 +++++++++++++--
.../overlay/sun50i-h616-fixup.scr-cmd | 110 ++++++++++++++++++
.../dts/allwinner/overlay/sun50i-h616-ir.dtso | 13 +++
.../allwinner/overlay/sun50i-h616-light.dtso | 27 +++++
.../allwinner/overlay/sun50i-h616-mcp2515.dtso | 18 +++
.../overlay/sun50i-h616-spi-spidev.dtso | 42 +++++++
.../overlay/sun50i-h616-spidev0_0.dtso | 28 +++++
.../overlay/sun50i-h616-spidev1_0.dtso | 28 +++++
.../overlay/sun50i-h616-spidev1_1.dtso | 28 +++++
.../overlay/sun50i-h616-spidev1_2.dtso | 28 +++++
.../overlay/sun50i-h616-tft35_spi.dtso | 33 ++++++
.../allwinner/overlay/sun50i-h616-ws2812.dtso | 13 +++
12 files changed, 383 insertions(+), 2 deletions(-)
create mode 100755 arch/arm64/boot/dts/allwinner/overlay/sun50i-h616-fixup.scr-cmd
create mode 100755 arch/arm64/boot/dts/allwinner/overlay/sun50i-h616-ir.dtso
create mode 100755 arch/arm64/boot/dts/allwinner/overlay/sun50i-h616-light.dtso
create mode 100755 arch/arm64/boot/dts/allwinner/overlay/sun50i-h616-mcp2515.dtso
create mode 100755 arch/arm64/boot/dts/allwinner/overlay/sun50i-h616-spi-spidev.dtso
create mode 100755 arch/arm64/boot/dts/allwinner/overlay/sun50i-h616-spidev0_0.dtso
create mode 100755 arch/arm64/boot/dts/allwinner/overlay/sun50i-h616-spidev1_0.dtso
create mode 100755 arch/arm64/boot/dts/allwinner/overlay/sun50i-h616-spidev1_1.dtso
create mode 100755 arch/arm64/boot/dts/allwinner/overlay/sun50i-h616-spidev1_2.dtso
create mode 100755 arch/arm64/boot/dts/allwinner/overlay/sun50i-h616-tft35_spi.dtso
create mode 100755 arch/arm64/boot/dts/allwinner/overlay/sun50i-h616-ws2812.dtso
diff --git a/arch/arm64/boot/dts/allwinner/overlay/Makefile b/arch/arm64/boot/dts/allwinner/overlay/Makefile
index 7cabe8f42c5a..e19b987e3b03 100644
--- a/arch/arm64/boot/dts/allwinner/overlay/Makefile
+++ b/arch/arm64/boot/dts/allwinner/overlay/Makefile
@@ -47,12 +47,23 @@ dtb-$(CONFIG_ARCH_SUNXI) += \
sun50i-h6-uart1.dtbo \
sun50i-h6-uart2.dtbo \
sun50i-h6-uart3.dtbo \
- sun50i-h6-w1-gpio.dtbo
+ sun50i-h6-w1-gpio.dtbo \
+ sun50i-h616-spi-spidev.dtbo \
+ sun50i-h616-spidev0_0.dtbo \
+ sun50i-h616-spidev1_0.dtbo \
+ sun50i-h616-spidev1_1.dtbo \
+ sun50i-h616-spidev1_2.dtbo \
+ sun50i-h616-ir.dtbo \
+ sun50i-h616-tft35_spi.dtbo \
+ sun50i-h616-mcp2515.dtbo \
+ sun50i-h616-ws2812.dtbo \
+ sun50i-h616-light.dtbo
scr-$(CONFIG_ARCH_SUNXI) += \
sun50i-a64-fixup.scr \
sun50i-h5-fixup.scr \
- sun50i-h6-fixup.scr
+ sun50i-h6-fixup.scr \
+ sun50i-h616-fixup.scr
dtbotxt-$(CONFIG_ARCH_SUNXI) += \
README.sun50i-a64-overlays \
diff --git a/arch/arm64/boot/dts/allwinner/overlay/sun50i-h616-fixup.scr-cmd b/arch/arm64/boot/dts/allwinner/overlay/sun50i-h616-fixup.scr-cmd
new file mode 100755
index 000000000000..2bde77cb082d
--- /dev/null
+++ b/arch/arm64/boot/dts/allwinner/overlay/sun50i-h616-fixup.scr-cmd
@@ -0,0 +1,110 @@
+# overlays fixup script
+# implements (or rather substitutes) overlay arguments functionality
+# using u-boot scripting, environment variables and "fdt" command
+
+# setexpr test_var ${tmp_bank} - A
+# works only for hex numbers (A-F)
+
+setenv decompose_pin 'setexpr tmp_bank sub "P(C|G|H|I)\\d+" "\\1";
+setexpr tmp_pin sub "P\\S(\\d+)" "\\1";
+test "${tmp_bank}" = "C" && setenv tmp_bank 2;
+test "${tmp_bank}" = "G" && setenv tmp_bank 6'
+test "${tmp_bank}" = "H" && setenv tmp_bank 7;
+test "${tmp_bank}" = "I" && setenv tmp_bank 8;
+
+if test -n "${param_spinor_spi_bus}"; then
+ test "${param_spinor_spi_bus}" = "0" && setenv tmp_spi_path "spi@5010000"
+ test "${param_spinor_spi_bus}" = "1" && setenv tmp_spi_path "spi@5011000"
+ fdt set /soc/${tmp_spi_path} status "okay"
+ fdt set /soc/${tmp_spi_path}/spiflash@0 status "okay"
+ if test -n "${param_spinor_max_freq}"; then
+ fdt set /soc/${tmp_spi_path}/spiflash@0 spi-max-frequency "<${param_spinor_max_freq}>"
+ fi
+ if test "${param_spinor_spi_cs}" = "1"; then
+ fdt set /soc/${tmp_spi_path}/spiflash@0 reg "<1>"
+ fi
+ env delete tmp_spi_path
+fi
+
+if test -n "${param_spidev_spi_bus}"; then
+ test "${param_spidev_spi_bus}" = "0" && setenv tmp_spi_path "spi@5010000"
+ test "${param_spidev_spi_bus}" = "1" && setenv tmp_spi_path "spi@5011000"
+ fdt set /soc/${tmp_spi_path} status "okay"
+ fdt set /soc/${tmp_spi_path}/spidev status "okay"
+ if test -n "${param_spidev_max_freq}"; then
+ fdt set /soc/${tmp_spi_path}/spidev spi-max-frequency "<${param_spidev_max_freq}>"
+ fi
+ if test "${param_spidev_spi_cs}" = "1"; then
+ fdt set /soc/${tmp_spi_path}/spidev reg "<1>"
+ fi
+ env delete tmp_spi_path
+fi
+
+if test -n "${param_pps_pin}"; then
+ setenv tmp_bank "${param_pps_pin}"
+ setenv tmp_pin "${param_pps_pin}"
+ run decompose_pin
+ fdt set /soc/pinctrl@300b000/pps_pins pins "${param_pps_pin}"
+ fdt get value tmp_phandle /soc/pinctrl@300b000 phandle
+ fdt set /pps@0 gpios "<${tmp_phandle} ${tmp_bank} ${tmp_pin} 0>"
+ env delete tmp_pin tmp_bank tmp_phandle
+fi
+
+if test "${param_pps_falling_edge}" = "1"; then
+ fdt set /pps@0 assert-falling-edge
+fi
+
+for f in ${overlays}; do
+ if test "${f}" = "pwm34"; then
+ setenv bootargs_new ""
+ for arg in ${bootargs}; do
+ if test "${arg}" = "console=ttyS0,115200"; then
+ echo "Warning: Disabling ttyS0 console due to enabled PWM3 and PWM4 overlay"
+ else
+ setenv bootargs_new "${bootargs_new} ${arg}"
+ fi
+ done
+ setenv bootargs "${bootargs_new}"
+ fi
+done
+
+if test -n "${param_w1_pin}"; then
+ setenv tmp_bank "${param_w1_pin}"
+ setenv tmp_pin "${param_w1_pin}"
+ run decompose_pin
+ fdt set /soc/pinctrl@300b000/w1_pins pins "${param_w1_pin}"
+ fdt get value tmp_phandle /soc/pinctrl@300b000 phandle
+ fdt set /onewire@0 gpios "<${tmp_phandle} ${tmp_bank} ${tmp_pin} 0>"
+ env delete tmp_pin tmp_bank tmp_phandle
+fi
+
+if test "${param_w1_pin_int_pullup}" = "1"; then
+ fdt set /soc/pinctrl@300b000/w1_pins bias-pull-up
+fi
+
+if test "${param_uart1_rtscts}" = "1"; then
+ fdt get value tmp_phandle1 /soc/pinctrl@300b000/uart1-pins phandle
+ fdt get value tmp_phandle2 /soc/pinctrl@300b000/uart1-rts-cts-pins phandle
+ fdt set /soc/serial@5000400 pinctrl-names "default" "default"
+ fdt set /soc/serial@5000400 pinctrl-0 "<${tmp_phandle1}>"
+ fdt set /soc/serial@5000400 pinctrl-1 "<${tmp_phandle2}>"
+ env delete tmp_phandle1 tmp_phandle2
+fi
+
+if test "${param_uart2_rtscts}" = "1"; then
+ fdt get value tmp_phandle1 /soc/pinctrl@300b000/uart2-pins phandle
+ fdt get value tmp_phandle2 /soc/pinctrl@300b000/uart2-rts-cts-pins phandle
+ fdt set /soc/serial@5000800 pinctrl-names "default" "default"
+ fdt set /soc/serial@5000800 pinctrl-0 "<${tmp_phandle1}>"
+ fdt set /soc/serial@5000800 pinctrl-1 "<${tmp_phandle2}>"
+ env delete tmp_phandle1 tmp_phandle2
+fi
+
+if test "${param_uart3_rtscts}" = "1"; then
+ fdt get value tmp_phandle1 /soc/pinctrl@300b000/uart3-pins phandle
+ fdt get value tmp_phandle2 /soc/pinctrl@300b000/uart3-rts-cts-pins phandle
+ fdt set /soc/serial@5000c00 pinctrl-names "default" "default"
+ fdt set /soc/serial@5000c00 pinctrl-0 "<${tmp_phandle1}>"
+ fdt set /soc/serial@5000c00 pinctrl-1 "<${tmp_phandle2}>"
+ env delete tmp_phandle1 tmp_phandle2
+fi
diff --git a/arch/arm64/boot/dts/allwinner/overlay/sun50i-h616-ir.dtso b/arch/arm64/boot/dts/allwinner/overlay/sun50i-h616-ir.dtso
new file mode 100755
index 000000000000..825433add1c3
--- /dev/null
+++ b/arch/arm64/boot/dts/allwinner/overlay/sun50i-h616-ir.dtso
@@ -0,0 +1,13 @@
+/dts-v1/;
+/plugin/;
+
+/ {
+ compatible = "allwinner,sun50i-h616";
+
+ fragment@0 {
+ target = <&ir>;
+ __overlay__ {
+ status = "okay";
+ };
+ };
+};
diff --git a/arch/arm64/boot/dts/allwinner/overlay/sun50i-h616-light.dtso b/arch/arm64/boot/dts/allwinner/overlay/sun50i-h616-light.dtso
new file mode 100755
index 000000000000..5010ea6a57b5
--- /dev/null
+++ b/arch/arm64/boot/dts/allwinner/overlay/sun50i-h616-light.dtso
@@ -0,0 +1,27 @@
+/dts-v1/;
+/plugin/;
+
+/ {
+ compatible = "allwinner,sun50i-h616";
+
+ fragment@0 {
+ target = <&i2c_gpio>;
+ __overlay__ {
+ status = "okay";
+ };
+ };
+
+ fragment@1 {
+ target = <&uart0>;
+ __overlay__ {
+ status = "disabled";
+ };
+ };
+
+ fragment@2 {
+ target = <&pwm>;
+ __overlay__ {
+ status = "okay";
+ };
+ };
+};
diff --git a/arch/arm64/boot/dts/allwinner/overlay/sun50i-h616-mcp2515.dtso b/arch/arm64/boot/dts/allwinner/overlay/sun50i-h616-mcp2515.dtso
new file mode 100755
index 000000000000..64841956e568
--- /dev/null
+++ b/arch/arm64/boot/dts/allwinner/overlay/sun50i-h616-mcp2515.dtso
@@ -0,0 +1,18 @@
+/dts-v1/;
+/plugin/;
+
+/ {
+ fragment@0 {
+ target = <&spi1>;
+ __overlay__ {
+ status = "okay";
+ };
+ };
+
+ fragment@1 {
+ target = <&can>;
+ __overlay__ {
+ status = "okay";
+ };
+ };
+};
diff --git a/arch/arm64/boot/dts/allwinner/overlay/sun50i-h616-spi-spidev.dtso b/arch/arm64/boot/dts/allwinner/overlay/sun50i-h616-spi-spidev.dtso
new file mode 100755
index 000000000000..e0ceed71965f
--- /dev/null
+++ b/arch/arm64/boot/dts/allwinner/overlay/sun50i-h616-spi-spidev.dtso
@@ -0,0 +1,42 @@
+/dts-v1/;
+/plugin/;
+
+/ {
+ compatible = "allwinner,sun50i-h616";
+
+ fragment@0 {
+ target-path = "/aliases";
+ __overlay__ {
+ spi0 = "/soc/spi@5010000";
+ spi1 = "/soc/spi@5011000";
+ };
+ };
+
+ fragment@1 {
+ target = <&spi0>;
+ __overlay__ {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ spidev@0 {
+ compatible = "rohm,dh2228fv";
+ status = "disabled";
+ reg = <0>;
+ spi-max-frequency = <1000000>;
+ };
+ };
+ };
+
+ fragment@2 {
+ target = <&spi1>;
+ __overlay__ {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ spidev@0 {
+ compatible = "rohm,dh2228fv";
+ status = "disabled";
+ reg = <0>;
+ spi-max-frequency = <1000000>;
+ };
+ };
+ };
+};
diff --git a/arch/arm64/boot/dts/allwinner/overlay/sun50i-h616-spidev0_0.dtso b/arch/arm64/boot/dts/allwinner/overlay/sun50i-h616-spidev0_0.dtso
new file mode 100755
index 000000000000..a5a89707c3dd
--- /dev/null
+++ b/arch/arm64/boot/dts/allwinner/overlay/sun50i-h616-spidev0_0.dtso
@@ -0,0 +1,28 @@
+/dts-v1/;
+/plugin/;
+
+/ {
+ compatible = "allwinner,sun50i-h616";
+
+ fragment@0 {
+ target-path = "/aliases";
+ __overlay__ {
+ spi0 = "/soc/spi@5010000";
+ };
+ };
+
+ fragment@1 {
+ target = <&spi0>;
+ __overlay__ {
+ status = "okay";
+ #address-cells = <1>;
+ #size-cells = <0>;
+ spidev0_0: spidev@0 {
+ compatible = "rohm,dh2228fv";
+ status = "okay";
+ reg = <0>;
+ spi-max-frequency = <1000000>;
+ };
+ };
+ };
+};
diff --git a/arch/arm64/boot/dts/allwinner/overlay/sun50i-h616-spidev1_0.dtso b/arch/arm64/boot/dts/allwinner/overlay/sun50i-h616-spidev1_0.dtso
new file mode 100755
index 000000000000..20a0486442cc
--- /dev/null
+++ b/arch/arm64/boot/dts/allwinner/overlay/sun50i-h616-spidev1_0.dtso
@@ -0,0 +1,28 @@
+/dts-v1/;
+/plugin/;
+
+/ {
+ compatible = "allwinner,sun50i-h616";
+
+ fragment@0 {
+ target-path = "/aliases";
+ __overlay__ {
+ spi1 = "/soc/spi@5011000";
+ };
+ };
+
+ fragment@1 {
+ target = <&spi1>;
+ __overlay__ {
+ status = "okay";
+ #address-cells = <1>;
+ #size-cells = <0>;
+ spidev1_0: spidev@0 {
+ compatible = "rohm,dh2228fv";
+ status = "okay";
+ reg = <0>;
+ spi-max-frequency = <1000000>;
+ };
+ };
+ };
+};
diff --git a/arch/arm64/boot/dts/allwinner/overlay/sun50i-h616-spidev1_1.dtso b/arch/arm64/boot/dts/allwinner/overlay/sun50i-h616-spidev1_1.dtso
new file mode 100755
index 000000000000..a9ae45e84063
--- /dev/null
+++ b/arch/arm64/boot/dts/allwinner/overlay/sun50i-h616-spidev1_1.dtso
@@ -0,0 +1,28 @@
+/dts-v1/;
+/plugin/;
+
+/ {
+ compatible = "allwinner,sun50i-h616";
+
+ fragment@0 {
+ target-path = "/aliases";
+ __overlay__ {
+ spi1 = "/soc/spi@5011000";
+ };
+ };
+
+ fragment@1 {
+ target = <&spi1>;
+ __overlay__ {
+ status = "okay";
+ #address-cells = <1>;
+ #size-cells = <0>;
+ spidev1_1: spidev@1 {
+ compatible = "rohm,dh2228fv";
+ status = "okay";
+ reg = <1>;
+ spi-max-frequency = <1000000>;
+ };
+ };
+ };
+};
diff --git a/arch/arm64/boot/dts/allwinner/overlay/sun50i-h616-spidev1_2.dtso b/arch/arm64/boot/dts/allwinner/overlay/sun50i-h616-spidev1_2.dtso
new file mode 100755
index 000000000000..efe5a8949b3a
--- /dev/null
+++ b/arch/arm64/boot/dts/allwinner/overlay/sun50i-h616-spidev1_2.dtso
@@ -0,0 +1,28 @@
+/dts-v1/;
+/plugin/;
+
+/ {
+ compatible = "allwinner,sun50i-h616";
+
+ fragment@0 {
+ target-path = "/aliases";
+ __overlay__ {
+ spi1 = "/soc/spi@5011000";
+ };
+ };
+
+ fragment@1 {
+ target = <&spi1>;
+ __overlay__ {
+ status = "okay";
+ #address-cells = <1>;
+ #size-cells = <0>;
+ spidev1_2: spidev@2 {
+ compatible = "rohm,dh2228fv";
+ status = "okay";
+ reg = <2>;
+ spi-max-frequency = <1000000>;
+ };
+ };
+ };
+};
diff --git a/arch/arm64/boot/dts/allwinner/overlay/sun50i-h616-tft35_spi.dtso b/arch/arm64/boot/dts/allwinner/overlay/sun50i-h616-tft35_spi.dtso
new file mode 100755
index 000000000000..e96582bcbed5
--- /dev/null
+++ b/arch/arm64/boot/dts/allwinner/overlay/sun50i-h616-tft35_spi.dtso
@@ -0,0 +1,33 @@
+/dts-v1/;
+/plugin/;
+
+/ {
+ fragment@0 {
+ target = <&i2c_gpio>;
+ __overlay__ {
+ status = "okay";
+ };
+ };
+
+ fragment@1 {
+ target = <&spi1>;
+ __overlay__ {
+ status = "okay";
+ };
+ };
+
+ fragment@2 {
+ target = <&tft_35>;
+ __overlay__ {
+ status = "okay";
+ spi-max-frequency = <12500000>;
+ };
+ };
+
+ fragment@3 {
+ target = <&tft_tp>;
+ __overlay__ {
+ status = "okay";
+ };
+ };
+};
diff --git a/arch/arm64/boot/dts/allwinner/overlay/sun50i-h616-ws2812.dtso b/arch/arm64/boot/dts/allwinner/overlay/sun50i-h616-ws2812.dtso
new file mode 100755
index 000000000000..4e43907cb0ce
--- /dev/null
+++ b/arch/arm64/boot/dts/allwinner/overlay/sun50i-h616-ws2812.dtso
@@ -0,0 +1,13 @@
+/dts-v1/;
+/plugin/;
+
+/ {
+ compatible = "allwinner,sun50i-h616";
+
+ fragment@0 {
+ target = <&ws2812>;
+ __overlay__ {
+ status = "okay";
+ };
+ };
+};
--
2.34.1