sunxi: add T113-S3 support
authorZoltan HERPAI <wigyori@uid0.hu>
Thu, 8 Jun 2023 09:41:03 +0000 (11:41 +0200)
committerZoltan HERPAI <wigyori@uid0.hu>
Thu, 8 Jun 2023 09:41:03 +0000 (11:41 +0200)
Signed-off-by: Zoltan HERPAI <wigyori@uid0.hu>
target/linux/sunxi/image/cortexa7.mk
target/linux/sunxi/patches-6.1/0001-MAINTAINERS-Match-the-sun20i-family-of-Allwinner-SoC.patch [new file with mode: 0644]
target/linux/sunxi/patches-6.1/0002-clk-sunxi-ng-Remove-duplicate-ARCH_SUNXI-dependencie.patch [new file with mode: 0644]
target/linux/sunxi/patches-6.1/0003-dts-add-riscv-include-prefix-link.patch [new file with mode: 0644]
target/linux/sunxi/patches-6.1/0004-ARM-dts-sunxi-add-Allwinner-T113-s-SoC-.dtsi.patch [new file with mode: 0644]
target/linux/sunxi/patches-6.1/0005-dt-bindings-arm-sunxi-document-MangoPi-MQ-R-board-na.patch [new file with mode: 0644]
target/linux/sunxi/patches-6.1/0006-ARM-dts-sunxi-add-MangoPi-MQ-R-T113-board.patch [new file with mode: 0644]
target/linux/sunxi/patches-6.1/0007-dt-bindings-spi-sun6i-add-DT-bindings-for-Allwinner-.patch [new file with mode: 0644]
target/linux/sunxi/patches-6.1/0008-ARM-dts-riscv-add-uart0_pins-on-Port-E-pins.patch [new file with mode: 0644]
target/linux/sunxi/patches-6.1/0009-ARM-dts-sunxi-add-support-for-MangoPI-MQDual-T113-va.patch [new file with mode: 0644]

index 5b9f27cef80393b3ec9b8051de56181f56ddb970..3d31b95ed613892634b58e7decc62473b3225fea 100644 (file)
@@ -231,3 +231,11 @@ define Device/xunlong_orangepi-2
   SOC := sun8i-h3
 endef
 TARGET_DEVICES += xunlong_orangepi-2
+
+define Device/widora_mangopi-mqdual-t113
+  DEVICE_VENDOR := Widora
+  DEVICE_MODEL := MangoPi MQDual T113
+  DEVICE_PACKAGES:=kmod-rtc-sunxi
+  SOC := sun8i-t113s
+endef
+TARGET_DEVICES += widora_mangopi-mqdual-t113
diff --git a/target/linux/sunxi/patches-6.1/0001-MAINTAINERS-Match-the-sun20i-family-of-Allwinner-SoC.patch b/target/linux/sunxi/patches-6.1/0001-MAINTAINERS-Match-the-sun20i-family-of-Allwinner-SoC.patch
new file mode 100644 (file)
index 0000000..a184792
--- /dev/null
@@ -0,0 +1,2155 @@
+From 24d720765ef87e099e43153d9662cb0f7cdabd94 Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel@sholland.org>
+Date: Wed, 25 Jan 2023 22:57:28 -0600
+Subject: [PATCH 1/9] MAINTAINERS: Match the sun20i family of Allwinner SoCs
+
+Allwinner sunxi SoCs with a RISC-V CPU use the sun20i designator. Match
+that pattern in addition to the designators for 32 and 64-bit ARM SoCs.
+
+Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
+Reviewed-by: Guo Ren <guoren@kernel.org>
+Reviewed-by: Heiko Stuebner <heiko@sntech.de>
+Signed-off-by: Samuel Holland <samuel@sholland.org>
+---
+ .../devicetree/bindings/riscv/sunxi.yaml      |  69 ++
+ MAINTAINERS                                   |   2 +-
+ arch/riscv/boot/dts/Makefile                  |   1 +
+ arch/riscv/boot/dts/allwinner/Makefile        |   9 +
+ .../allwinner/sun20i-common-regulators.dtsi   |  28 +
+ .../sun20i-d1-dongshan-nezha-stu.dts          | 117 +++
+ .../sun20i-d1-lichee-rv-86-panel-480p.dts     |  29 +
+ .../sun20i-d1-lichee-rv-86-panel-720p.dts     |  10 +
+ .../sun20i-d1-lichee-rv-86-panel.dtsi         | 119 +++
+ .../allwinner/sun20i-d1-lichee-rv-dock.dts    |  97 ++
+ .../dts/allwinner/sun20i-d1-lichee-rv.dts     |  87 ++
+ .../allwinner/sun20i-d1-mangopi-mq-pro.dts    | 142 +++
+ .../boot/dts/allwinner/sun20i-d1-nezha.dts    | 166 ++++
+ arch/riscv/boot/dts/allwinner/sun20i-d1.dtsi  |  66 ++
+ .../dts/allwinner/sun20i-d1s-mangopi-mq.dts   | 128 +++
+ arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi |  76 ++
+ .../boot/dts/allwinner/sunxi-d1-t113.dtsi     |  15 +
+ .../boot/dts/allwinner/sunxi-d1s-t113.dtsi    | 826 ++++++++++++++++++
+ 18 files changed, 1986 insertions(+), 1 deletion(-)
+ create mode 100644 Documentation/devicetree/bindings/riscv/sunxi.yaml
+ create mode 100644 arch/riscv/boot/dts/allwinner/Makefile
+ create mode 100644 arch/riscv/boot/dts/allwinner/sun20i-common-regulators.dtsi
+ create mode 100644 arch/riscv/boot/dts/allwinner/sun20i-d1-dongshan-nezha-stu.dts
+ create mode 100644 arch/riscv/boot/dts/allwinner/sun20i-d1-lichee-rv-86-panel-480p.dts
+ create mode 100644 arch/riscv/boot/dts/allwinner/sun20i-d1-lichee-rv-86-panel-720p.dts
+ create mode 100644 arch/riscv/boot/dts/allwinner/sun20i-d1-lichee-rv-86-panel.dtsi
+ create mode 100644 arch/riscv/boot/dts/allwinner/sun20i-d1-lichee-rv-dock.dts
+ create mode 100644 arch/riscv/boot/dts/allwinner/sun20i-d1-lichee-rv.dts
+ create mode 100644 arch/riscv/boot/dts/allwinner/sun20i-d1-mangopi-mq-pro.dts
+ create mode 100644 arch/riscv/boot/dts/allwinner/sun20i-d1-nezha.dts
+ create mode 100644 arch/riscv/boot/dts/allwinner/sun20i-d1.dtsi
+ create mode 100644 arch/riscv/boot/dts/allwinner/sun20i-d1s-mangopi-mq.dts
+ create mode 100644 arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi
+ create mode 100644 arch/riscv/boot/dts/allwinner/sunxi-d1-t113.dtsi
+ create mode 100644 arch/riscv/boot/dts/allwinner/sunxi-d1s-t113.dtsi
+
+diff --git a/Documentation/devicetree/bindings/riscv/sunxi.yaml b/Documentation/devicetree/bindings/riscv/sunxi.yaml
+new file mode 100644
+index 000000000000..9edb5e5992b1
+--- /dev/null
++++ b/Documentation/devicetree/bindings/riscv/sunxi.yaml
+@@ -0,0 +1,69 @@
++# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
++%YAML 1.2
++---
++$id: http://devicetree.org/schemas/riscv/sunxi.yaml#
++$schema: http://devicetree.org/meta-schemas/core.yaml#
++
++title: Allwinner RISC-V SoC-based boards
++
++maintainers:
++  - Chen-Yu Tsai <wens@csie.org>
++  - Jernej Skrabec <jernej.skrabec@gmail.com>
++  - Samuel Holland <samuel@sholland.org>
++
++description:
++  Allwinner RISC-V SoC-based boards
++
++properties:
++  $nodename:
++    const: '/'
++  compatible:
++    oneOf:
++      - description: Dongshan Nezha STU SoM
++        items:
++          - const: 100ask,dongshan-nezha-stu
++          - const: allwinner,sun20i-d1
++
++      - description: D1 Nezha board
++        items:
++          - const: allwinner,d1-nezha
++          - const: allwinner,sun20i-d1
++
++      - description: ClockworkPi R-01 SoM and v3.14 board
++        items:
++          - const: clockwork,r-01-clockworkpi-v3.14
++          - const: allwinner,sun20i-d1
++
++      - description: ClockworkPi R-01 SoM, v3.14 board, and DevTerm expansion
++        items:
++          - const: clockwork,r-01-devterm-v3.14
++          - const: clockwork,r-01-clockworkpi-v3.14
++          - const: allwinner,sun20i-d1
++
++      - description: Lichee RV SoM
++        items:
++          - const: sipeed,lichee-rv
++          - const: allwinner,sun20i-d1
++
++      - description: Carrier boards for the Lichee RV SoM
++        items:
++          - enum:
++              - sipeed,lichee-rv-86-panel-480p
++              - sipeed,lichee-rv-86-panel-720p
++              - sipeed,lichee-rv-dock
++          - const: sipeed,lichee-rv
++          - const: allwinner,sun20i-d1
++
++      - description: MangoPi MQ board
++        items:
++          - const: widora,mangopi-mq
++          - const: allwinner,sun20i-d1s
++
++      - description: MangoPi MQ Pro board
++        items:
++          - const: widora,mangopi-mq-pro
++          - const: allwinner,sun20i-d1
++
++additionalProperties: true
++
++...
+diff --git a/MAINTAINERS b/MAINTAINERS
+index 350d7e3ba94f..2ba2d82b14a0 100644
+--- a/MAINTAINERS
++++ b/MAINTAINERS
+@@ -1828,7 +1828,7 @@ F:       drivers/pinctrl/sunxi/
+ F:    drivers/soc/sunxi/
+ N:    allwinner
+ N:    sun[x456789]i
+-N:    sun50i
++N:    sun[25]0i
+ ARM/Amlogic Meson SoC CLOCK FRAMEWORK
+ M:    Neil Armstrong <neil.armstrong@linaro.org>
+diff --git a/arch/riscv/boot/dts/Makefile b/arch/riscv/boot/dts/Makefile
+index ff174996cdfd..f292e31bdb2c 100644
+--- a/arch/riscv/boot/dts/Makefile
++++ b/arch/riscv/boot/dts/Makefile
+@@ -1,4 +1,5 @@
+ # SPDX-License-Identifier: GPL-2.0
++subdir-y += allwinner
+ subdir-y += sifive
+ subdir-y += starfive
+ subdir-$(CONFIG_SOC_CANAAN_K210_DTB_BUILTIN) += canaan
+diff --git a/arch/riscv/boot/dts/allwinner/Makefile b/arch/riscv/boot/dts/allwinner/Makefile
+new file mode 100644
+index 000000000000..87f70b1af6b4
+--- /dev/null
++++ b/arch/riscv/boot/dts/allwinner/Makefile
+@@ -0,0 +1,9 @@
++# SPDX-License-Identifier: GPL-2.0
++dtb-$(CONFIG_ARCH_SUNXI) += sun20i-d1-dongshan-nezha-stu.dtb
++dtb-$(CONFIG_ARCH_SUNXI) += sun20i-d1-lichee-rv-86-panel-480p.dtb
++dtb-$(CONFIG_ARCH_SUNXI) += sun20i-d1-lichee-rv-86-panel-720p.dtb
++dtb-$(CONFIG_ARCH_SUNXI) += sun20i-d1-lichee-rv-dock.dtb
++dtb-$(CONFIG_ARCH_SUNXI) += sun20i-d1-lichee-rv.dtb
++dtb-$(CONFIG_ARCH_SUNXI) += sun20i-d1-mangopi-mq-pro.dtb
++dtb-$(CONFIG_ARCH_SUNXI) += sun20i-d1-nezha.dtb
++dtb-$(CONFIG_ARCH_SUNXI) += sun20i-d1s-mangopi-mq.dtb
+diff --git a/arch/riscv/boot/dts/allwinner/sun20i-common-regulators.dtsi b/arch/riscv/boot/dts/allwinner/sun20i-common-regulators.dtsi
+new file mode 100644
+index 000000000000..9b03fca2444c
+--- /dev/null
++++ b/arch/riscv/boot/dts/allwinner/sun20i-common-regulators.dtsi
+@@ -0,0 +1,28 @@
++// SPDX-License-Identifier: (GPL-2.0+ or MIT)
++// Copyright (C) 2021-2022 Samuel Holland <samuel@sholland.org>
++
++/ {
++      reg_vcc: vcc {
++              compatible = "regulator-fixed";
++              regulator-name = "vcc";
++              regulator-min-microvolt = <5000000>;
++              regulator-max-microvolt = <5000000>;
++      };
++
++      reg_vcc_3v3: vcc-3v3 {
++              compatible = "regulator-fixed";
++              regulator-name = "vcc-3v3";
++              regulator-min-microvolt = <3300000>;
++              regulator-max-microvolt = <3300000>;
++              vin-supply = <&reg_vcc>;
++      };
++};
++
++&pio {
++      vcc-pb-supply = <&reg_vcc_3v3>;
++      vcc-pc-supply = <&reg_vcc_3v3>;
++      vcc-pd-supply = <&reg_vcc_3v3>;
++      vcc-pe-supply = <&reg_vcc_3v3>;
++      vcc-pf-supply = <&reg_vcc_3v3>;
++      vcc-pg-supply = <&reg_vcc_3v3>;
++};
+diff --git a/arch/riscv/boot/dts/allwinner/sun20i-d1-dongshan-nezha-stu.dts b/arch/riscv/boot/dts/allwinner/sun20i-d1-dongshan-nezha-stu.dts
+new file mode 100644
+index 000000000000..8785de3c9224
+--- /dev/null
++++ b/arch/riscv/boot/dts/allwinner/sun20i-d1-dongshan-nezha-stu.dts
+@@ -0,0 +1,117 @@
++// SPDX-License-Identifier: (GPL-2.0+ or MIT)
++// Copyright (C) 2022 Samuel Holland <samuel@sholland.org>
++
++#include <dt-bindings/gpio/gpio.h>
++#include <dt-bindings/leds/common.h>
++
++/dts-v1/;
++
++#include "sun20i-d1.dtsi"
++#include "sun20i-common-regulators.dtsi"
++
++/ {
++      model = "Dongshan Nezha STU";
++      compatible = "100ask,dongshan-nezha-stu", "allwinner,sun20i-d1";
++
++      aliases {
++              ethernet0 = &emac;
++              serial0 = &uart0;
++      };
++
++      chosen {
++              stdout-path = "serial0:115200n8";
++      };
++
++      leds {
++              compatible = "gpio-leds";
++
++              led-0 {
++                      color = <LED_COLOR_ID_GREEN>;
++                      function = LED_FUNCTION_STATUS;
++                      gpios = <&pio 2 1 GPIO_ACTIVE_HIGH>; /* PC1 */
++              };
++      };
++
++      reg_usbvbus: usbvbus {
++              compatible = "regulator-fixed";
++              regulator-name = "usbvbus";
++              regulator-min-microvolt = <5000000>;
++              regulator-max-microvolt = <5000000>;
++              gpio = <&pio 3 19 GPIO_ACTIVE_HIGH>; /* PD19 */
++              enable-active-high;
++              vin-supply = <&reg_vcc>;
++      };
++
++      /*
++       * This regulator is PWM-controlled, but the PWM controller is not
++       * yet supported, so fix the regulator to its default voltage.
++       */
++      reg_vdd_cpu: vdd-cpu {
++              compatible = "regulator-fixed";
++              regulator-name = "vdd-cpu";
++              regulator-min-microvolt = <1100000>;
++              regulator-max-microvolt = <1100000>;
++              vin-supply = <&reg_vcc>;
++      };
++};
++
++&cpu0 {
++      cpu-supply = <&reg_vdd_cpu>;
++};
++
++&dcxo {
++      clock-frequency = <24000000>;
++};
++
++&ehci0 {
++      status = "okay";
++};
++
++&emac {
++      pinctrl-0 = <&rgmii_pe_pins>;
++      pinctrl-names = "default";
++      phy-handle = <&ext_rgmii_phy>;
++      phy-mode = "rgmii-id";
++      phy-supply = <&reg_vcc_3v3>;
++      status = "okay";
++};
++
++&mdio {
++      ext_rgmii_phy: ethernet-phy@1 {
++              compatible = "ethernet-phy-ieee802.3-c22";
++              reg = <1>;
++      };
++};
++
++&mmc0 {
++      broken-cd;
++      bus-width = <4>;
++      disable-wp;
++      vmmc-supply = <&reg_vcc_3v3>;
++      vqmmc-supply = <&reg_vcc_3v3>;
++      pinctrl-0 = <&mmc0_pins>;
++      pinctrl-names = "default";
++      status = "okay";
++};
++
++&ohci0 {
++      status = "okay";
++};
++
++&uart0 {
++      pinctrl-0 = <&uart0_pb8_pins>;
++      pinctrl-names = "default";
++      status = "okay";
++};
++
++&usb_otg {
++      dr_mode = "otg";
++      status = "okay";
++};
++
++&usbphy {
++      usb0_id_det-gpios = <&pio 3 21 GPIO_ACTIVE_HIGH>; /* PD21 */
++      usb0_vbus_det-gpios = <&pio 3 20 GPIO_ACTIVE_HIGH>; /* PD20 */
++      usb0_vbus-supply = <&reg_usbvbus>;
++      status = "okay";
++};
+diff --git a/arch/riscv/boot/dts/allwinner/sun20i-d1-lichee-rv-86-panel-480p.dts b/arch/riscv/boot/dts/allwinner/sun20i-d1-lichee-rv-86-panel-480p.dts
+new file mode 100644
+index 000000000000..4df8ffb71561
+--- /dev/null
++++ b/arch/riscv/boot/dts/allwinner/sun20i-d1-lichee-rv-86-panel-480p.dts
+@@ -0,0 +1,29 @@
++// SPDX-License-Identifier: (GPL-2.0+ or MIT)
++// Copyright (C) 2022 Samuel Holland <samuel@sholland.org>
++
++#include "sun20i-d1-lichee-rv-86-panel.dtsi"
++
++/ {
++      model = "Sipeed Lichee RV 86 Panel (480p)";
++      compatible = "sipeed,lichee-rv-86-panel-480p", "sipeed,lichee-rv",
++                   "allwinner,sun20i-d1";
++};
++
++&i2c2 {
++      pinctrl-0 = <&i2c2_pb0_pins>;
++      pinctrl-names = "default";
++      status = "okay";
++
++      touchscreen@48 {
++              compatible = "focaltech,ft6236";
++              reg = <0x48>;
++              interrupt-parent = <&pio>;
++              interrupts = <6 14 IRQ_TYPE_LEVEL_LOW>; /* PG14 */
++              iovcc-supply = <&reg_vcc_3v3>;
++              reset-gpios = <&pio 6 15 GPIO_ACTIVE_LOW>; /* PG15 */
++              touchscreen-size-x = <480>;
++              touchscreen-size-y = <480>;
++              vcc-supply = <&reg_vcc_3v3>;
++              wakeup-source;
++      };
++};
+diff --git a/arch/riscv/boot/dts/allwinner/sun20i-d1-lichee-rv-86-panel-720p.dts b/arch/riscv/boot/dts/allwinner/sun20i-d1-lichee-rv-86-panel-720p.dts
+new file mode 100644
+index 000000000000..1874fc05359f
+--- /dev/null
++++ b/arch/riscv/boot/dts/allwinner/sun20i-d1-lichee-rv-86-panel-720p.dts
+@@ -0,0 +1,10 @@
++// SPDX-License-Identifier: (GPL-2.0+ or MIT)
++// Copyright (C) 2022 Samuel Holland <samuel@sholland.org>
++
++#include "sun20i-d1-lichee-rv-86-panel.dtsi"
++
++/ {
++      model = "Sipeed Lichee RV 86 Panel (720p)";
++      compatible = "sipeed,lichee-rv-86-panel-720p", "sipeed,lichee-rv",
++                   "allwinner,sun20i-d1";
++};
+diff --git a/arch/riscv/boot/dts/allwinner/sun20i-d1-lichee-rv-86-panel.dtsi b/arch/riscv/boot/dts/allwinner/sun20i-d1-lichee-rv-86-panel.dtsi
+new file mode 100644
+index 000000000000..6cc7dd0c1ae2
+--- /dev/null
++++ b/arch/riscv/boot/dts/allwinner/sun20i-d1-lichee-rv-86-panel.dtsi
+@@ -0,0 +1,119 @@
++// SPDX-License-Identifier: (GPL-2.0+ or MIT)
++// Copyright (C) 2022 Samuel Holland <samuel@sholland.org>
++
++#include "sun20i-d1-lichee-rv.dts"
++
++/ {
++      aliases {
++              ethernet0 = &emac;
++              ethernet1 = &xr829;
++      };
++
++      dmic_codec: dmic-codec {
++              compatible = "dmic-codec";
++              num-channels = <2>;
++              #sound-dai-cells = <0>;
++      };
++
++      dmic-sound {
++              compatible = "simple-audio-card";
++              simple-audio-card,name = "DMIC";
++              #address-cells = <1>;
++              #size-cells = <0>;
++
++              simple-audio-card,dai-link@0 {
++                      reg = <0>;
++                      format = "pdm";
++                      frame-master = <&link0_cpu>;
++                      bitclock-master = <&link0_cpu>;
++
++                      link0_cpu: cpu {
++                              sound-dai = <&dmic>;
++                      };
++
++                      link0_codec: codec {
++                              sound-dai = <&dmic_codec>;
++                      };
++              };
++      };
++
++      /* PC1 is repurposed as BT_WAKE_AP */
++      /delete-node/ leds;
++
++      wifi_pwrseq: wifi-pwrseq {
++              compatible = "mmc-pwrseq-simple";
++              clocks = <&ccu CLK_FANOUT1>;
++              clock-names = "ext_clock";
++              reset-gpios = <&pio 6 12 GPIO_ACTIVE_LOW>; /* PG12 */
++              assigned-clocks = <&ccu CLK_FANOUT1>;
++              assigned-clock-rates = <32768>;
++              pinctrl-0 = <&clk_pg11_pin>;
++              pinctrl-names = "default";
++      };
++};
++
++&dmic {
++      pinctrl-0 = <&dmic_pb11_d0_pin>, <&dmic_pe17_clk_pin>;
++      pinctrl-names = "default";
++      status = "okay";
++};
++
++&ehci1 {
++      status = "okay";
++};
++
++&emac {
++      pinctrl-0 = <&rmii_pe_pins>;
++      pinctrl-names = "default";
++      phy-handle = <&ext_rmii_phy>;
++      phy-mode = "rmii";
++      phy-supply = <&reg_vcc_3v3>;
++      status = "okay";
++};
++
++&mdio {
++      ext_rmii_phy: ethernet-phy@1 {
++              compatible = "ethernet-phy-ieee802.3-c22";
++              reg = <1>;
++              reset-gpios = <&pio 4 16 GPIO_ACTIVE_LOW>; /* PE16 */
++      };
++};
++
++&mmc1 {
++      bus-width = <4>;
++      mmc-pwrseq = <&wifi_pwrseq>;
++      non-removable;
++      vmmc-supply = <&reg_vcc_3v3>;
++      vqmmc-supply = <&reg_vcc_3v3>;
++      pinctrl-0 = <&mmc1_pins>;
++      pinctrl-names = "default";
++      status = "okay";
++
++      xr829: wifi@1 {
++              reg = <1>;
++      };
++};
++
++&ohci1 {
++      status = "okay";
++};
++
++&uart1 {
++      uart-has-rtscts;
++      pinctrl-0 = <&uart1_pg6_pins>, <&uart1_pg8_rts_cts_pins>;
++      pinctrl-names = "default";
++      status = "okay";
++
++      /* XR829 bluetooth is connected here */
++};
++
++&usb_otg {
++      status = "disabled";
++};
++
++&usbphy {
++      /* PD20 and PD21 are repurposed for the LCD panel */
++      /delete-property/ usb0_id_det-gpios;
++      /delete-property/ usb0_vbus_det-gpios;
++      usb1_vbus-supply = <&reg_vcc>;
++};
+diff --git a/arch/riscv/boot/dts/allwinner/sun20i-d1-lichee-rv-dock.dts b/arch/riscv/boot/dts/allwinner/sun20i-d1-lichee-rv-dock.dts
+new file mode 100644
+index 000000000000..52b91e1affed
+--- /dev/null
++++ b/arch/riscv/boot/dts/allwinner/sun20i-d1-lichee-rv-dock.dts
+@@ -0,0 +1,97 @@
++// SPDX-License-Identifier: (GPL-2.0+ or MIT)
++// Copyright (C) 2022 Jisheng Zhang <jszhang@kernel.org>
++// Copyright (C) 2022 Samuel Holland <samuel@sholland.org>
++
++#include <dt-bindings/input/input.h>
++
++#include "sun20i-d1-lichee-rv.dts"
++
++/ {
++      model = "Sipeed Lichee RV Dock";
++      compatible = "sipeed,lichee-rv-dock", "sipeed,lichee-rv",
++                   "allwinner,sun20i-d1";
++
++      aliases {
++              ethernet1 = &rtl8723ds;
++      };
++
++      dmic_codec: dmic-codec {
++              compatible = "dmic-codec";
++              num-channels = <2>;
++              #sound-dai-cells = <0>;
++      };
++
++      dmic-sound {
++              compatible = "simple-audio-card";
++              simple-audio-card,name = "DMIC";
++              #address-cells = <1>;
++              #size-cells = <0>;
++
++              simple-audio-card,dai-link@0 {
++                      reg = <0>;
++                      format = "pdm";
++                      frame-master = <&link0_cpu>;
++                      bitclock-master = <&link0_cpu>;
++
++                      link0_cpu: cpu {
++                              sound-dai = <&dmic>;
++                      };
++
++                      link0_codec: codec {
++                              sound-dai = <&dmic_codec>;
++                      };
++              };
++      };
++
++      wifi_pwrseq: wifi-pwrseq {
++              compatible = "mmc-pwrseq-simple";
++              reset-gpios = <&pio 6 12 GPIO_ACTIVE_LOW>; /* PG12 */
++      };
++};
++
++&dmic {
++      pinctrl-0 = <&dmic_pb11_d0_pin>, <&dmic_pe17_clk_pin>;
++      pinctrl-names = "default";
++      status = "okay";
++};
++
++&ehci1 {
++      status = "okay";
++};
++
++&mmc1 {
++      bus-width = <4>;
++      mmc-pwrseq = <&wifi_pwrseq>;
++      non-removable;
++      vmmc-supply = <&reg_vcc_3v3>;
++      vqmmc-supply = <&reg_vcc_3v3>;
++      pinctrl-0 = <&mmc1_pins>;
++      pinctrl-names = "default";
++      status = "okay";
++
++      rtl8723ds: wifi@1 {
++              reg = <1>;
++      };
++};
++
++&ohci1 {
++      status = "okay";
++};
++
++&uart1 {
++      uart-has-rtscts;
++      pinctrl-0 = <&uart1_pg6_pins>, <&uart1_pg8_rts_cts_pins>;
++      pinctrl-names = "default";
++      status = "okay";
++
++      bluetooth {
++              compatible = "realtek,rtl8723ds-bt";
++              device-wake-gpios = <&pio 6 15 GPIO_ACTIVE_HIGH>; /* PG16 */
++              enable-gpios = <&pio 6 18 GPIO_ACTIVE_HIGH>; /* PG18 */
++              host-wake-gpios = <&pio 6 17 GPIO_ACTIVE_HIGH>; /* PG17 */
++      };
++};
++
++&usbphy {
++      usb1_vbus-supply = <&reg_vcc>;
++};
+diff --git a/arch/riscv/boot/dts/allwinner/sun20i-d1-lichee-rv.dts b/arch/riscv/boot/dts/allwinner/sun20i-d1-lichee-rv.dts
+new file mode 100644
+index 000000000000..d60a0562a8b1
+--- /dev/null
++++ b/arch/riscv/boot/dts/allwinner/sun20i-d1-lichee-rv.dts
+@@ -0,0 +1,87 @@
++// SPDX-License-Identifier: (GPL-2.0+ or MIT)
++// Copyright (C) 2022 Jisheng Zhang <jszhang@kernel.org>
++// Copyright (C) 2022 Samuel Holland <samuel@sholland.org>
++
++#include <dt-bindings/gpio/gpio.h>
++#include <dt-bindings/leds/common.h>
++
++/dts-v1/;
++
++#include "sun20i-d1.dtsi"
++#include "sun20i-common-regulators.dtsi"
++
++/ {
++      model = "Sipeed Lichee RV";
++      compatible = "sipeed,lichee-rv", "allwinner,sun20i-d1";
++
++      aliases {
++              serial0 = &uart0;
++      };
++
++      chosen {
++              stdout-path = "serial0:115200n8";
++      };
++
++      leds {
++              compatible = "gpio-leds";
++
++              led-0 {
++                      color = <LED_COLOR_ID_GREEN>;
++                      function = LED_FUNCTION_STATUS;
++                      gpios = <&pio 2 1 GPIO_ACTIVE_HIGH>; /* PC1 */
++              };
++      };
++
++      reg_vdd_cpu: vdd-cpu {
++              compatible = "regulator-fixed";
++              regulator-name = "vdd-cpu";
++              regulator-min-microvolt = <900000>;
++              regulator-max-microvolt = <900000>;
++              vin-supply = <&reg_vcc>;
++      };
++};
++
++&cpu0 {
++      cpu-supply = <&reg_vdd_cpu>;
++};
++
++&dcxo {
++      clock-frequency = <24000000>;
++};
++
++&ehci0 {
++      status = "okay";
++};
++
++&mmc0 {
++      broken-cd;
++      bus-width = <4>;
++      disable-wp;
++      vmmc-supply = <&reg_vcc_3v3>;
++      vqmmc-supply = <&reg_vcc_3v3>;
++      pinctrl-0 = <&mmc0_pins>;
++      pinctrl-names = "default";
++      status = "okay";
++};
++
++&ohci0 {
++      status = "okay";
++};
++
++&uart0 {
++      pinctrl-0 = <&uart0_pb8_pins>;
++      pinctrl-names = "default";
++      status = "okay";
++};
++
++&usb_otg {
++      dr_mode = "otg";
++      status = "okay";
++};
++
++&usbphy {
++      usb0_id_det-gpios = <&pio 3 21 GPIO_ACTIVE_HIGH>; /* PD21 */
++      usb0_vbus_det-gpios = <&pio 3 20 GPIO_ACTIVE_HIGH>; /* PD20 */
++      usb0_vbus-supply = <&reg_vcc>;
++      status = "okay";
++};
+diff --git a/arch/riscv/boot/dts/allwinner/sun20i-d1-mangopi-mq-pro.dts b/arch/riscv/boot/dts/allwinner/sun20i-d1-mangopi-mq-pro.dts
+new file mode 100644
+index 000000000000..f2e07043afb3
+--- /dev/null
++++ b/arch/riscv/boot/dts/allwinner/sun20i-d1-mangopi-mq-pro.dts
+@@ -0,0 +1,142 @@
++// SPDX-License-Identifier: (GPL-2.0+ or MIT)
++// Copyright (C) 2022 Samuel Holland <samuel@sholland.org>
++
++#include <dt-bindings/gpio/gpio.h>
++#include <dt-bindings/leds/common.h>
++
++/dts-v1/;
++
++#include "sun20i-d1.dtsi"
++#include "sun20i-common-regulators.dtsi"
++
++/ {
++      model = "MangoPi MQ Pro";
++      compatible = "widora,mangopi-mq-pro", "allwinner,sun20i-d1";
++
++      aliases {
++              ethernet0 = &rtl8723ds;
++              serial0 = &uart0;
++      };
++
++      chosen {
++              stdout-path = "serial0:115200n8";
++      };
++
++      leds {
++              compatible = "gpio-leds";
++
++              led-0 {
++                      color = <LED_COLOR_ID_BLUE>;
++                      function = LED_FUNCTION_STATUS;
++                      gpios = <&pio 3 18 GPIO_ACTIVE_HIGH>; /* PD18 */
++              };
++      };
++
++      reg_avdd2v8: avdd2v8 {
++              compatible = "regulator-fixed";
++              regulator-name = "avdd2v8";
++              regulator-min-microvolt = <2800000>;
++              regulator-max-microvolt = <2800000>;
++              vin-supply = <&reg_vcc_3v3>;
++      };
++
++      reg_dvdd: dvdd {
++              compatible = "regulator-fixed";
++              regulator-name = "dvdd";
++              regulator-min-microvolt = <1200000>;
++              regulator-max-microvolt = <1200000>;
++              vin-supply = <&reg_vcc_3v3>;
++      };
++
++      reg_vdd_cpu: vdd-cpu {
++              compatible = "regulator-fixed";
++              regulator-name = "vdd-cpu";
++              regulator-min-microvolt = <1100000>;
++              regulator-max-microvolt = <1100000>;
++              vin-supply = <&reg_vcc>;
++      };
++
++      wifi_pwrseq: wifi-pwrseq {
++              compatible = "mmc-pwrseq-simple";
++              reset-gpios = <&pio 6 17 GPIO_ACTIVE_LOW>; /* PG17 */
++      };
++};
++
++&cpu0 {
++      cpu-supply = <&reg_vdd_cpu>;
++};
++
++&dcxo {
++      clock-frequency = <24000000>;
++};
++
++&ehci1 {
++      status = "okay";
++};
++
++&mmc0 {
++      bus-width = <4>;
++      cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>; /* PF6 */
++      disable-wp;
++      vmmc-supply = <&reg_vcc_3v3>;
++      vqmmc-supply = <&reg_vcc_3v3>;
++      pinctrl-0 = <&mmc0_pins>;
++      pinctrl-names = "default";
++      status = "okay";
++};
++
++&mmc1 {
++      bus-width = <4>;
++      mmc-pwrseq = <&wifi_pwrseq>;
++      non-removable;
++      vmmc-supply = <&reg_vcc_3v3>;
++      vqmmc-supply = <&reg_vcc_3v3>;
++      pinctrl-0 = <&mmc1_pins>;
++      pinctrl-names = "default";
++      status = "okay";
++
++      rtl8723ds: wifi@1 {
++              reg = <1>;
++              interrupt-parent = <&pio>;
++              interrupts = <6 10 IRQ_TYPE_LEVEL_LOW>; /* PG10 */
++              interrupt-names = "host-wake";
++      };
++};
++
++&ohci1 {
++      status = "okay";
++};
++
++&pio {
++      vcc-pe-supply = <&reg_avdd2v8>;
++};
++
++&uart0 {
++      pinctrl-0 = <&uart0_pb8_pins>;
++      pinctrl-names = "default";
++      status = "okay";
++};
++
++&uart1 {
++      uart-has-rtscts;
++      pinctrl-0 = <&uart1_pg6_pins>, <&uart1_pg8_rts_cts_pins>;
++      pinctrl-names = "default";
++      status = "okay";
++
++      bluetooth {
++              compatible = "realtek,rtl8723ds-bt";
++              device-wake-gpios = <&pio 6 18 GPIO_ACTIVE_HIGH>; /* PG18 */
++              enable-gpios = <&pio 6 15 GPIO_ACTIVE_HIGH>; /* PG15 */
++              host-wake-gpios = <&pio 6 14 GPIO_ACTIVE_HIGH>; /* PG14 */
++      };
++};
++
++&usb_otg {
++      dr_mode = "peripheral";
++      status = "okay";
++};
++
++&usbphy {
++      usb1_vbus-supply = <&reg_vcc>;
++      status = "okay";
++};
+diff --git a/arch/riscv/boot/dts/allwinner/sun20i-d1-nezha.dts b/arch/riscv/boot/dts/allwinner/sun20i-d1-nezha.dts
+new file mode 100644
+index 000000000000..a0769185be97
+--- /dev/null
++++ b/arch/riscv/boot/dts/allwinner/sun20i-d1-nezha.dts
+@@ -0,0 +1,166 @@
++// SPDX-License-Identifier: (GPL-2.0+ or MIT)
++// Copyright (C) 2021-2022 Samuel Holland <samuel@sholland.org>
++
++#include <dt-bindings/gpio/gpio.h>
++#include <dt-bindings/input/input.h>
++
++/dts-v1/;
++
++#include "sun20i-d1.dtsi"
++#include "sun20i-common-regulators.dtsi"
++
++/ {
++      model = "Allwinner D1 Nezha";
++      compatible = "allwinner,d1-nezha", "allwinner,sun20i-d1";
++
++      aliases {
++              ethernet0 = &emac;
++              ethernet1 = &xr829;
++              serial0 = &uart0;
++      };
++
++      chosen {
++              stdout-path = "serial0:115200n8";
++      };
++
++      reg_usbvbus: usbvbus {
++              compatible = "regulator-fixed";
++              regulator-name = "usbvbus";
++              regulator-min-microvolt = <5000000>;
++              regulator-max-microvolt = <5000000>;
++              gpio = <&pio 3 19 GPIO_ACTIVE_HIGH>; /* PD19 */
++              enable-active-high;
++              vin-supply = <&reg_vcc>;
++      };
++
++      /*
++       * This regulator is PWM-controlled, but the PWM controller is not
++       * yet supported, so fix the regulator to its default voltage.
++       */
++      reg_vdd_cpu: vdd-cpu {
++              compatible = "regulator-fixed";
++              regulator-name = "vdd-cpu";
++              regulator-min-microvolt = <1100000>;
++              regulator-max-microvolt = <1100000>;
++              vin-supply = <&reg_vcc>;
++      };
++
++      wifi_pwrseq: wifi-pwrseq {
++              compatible = "mmc-pwrseq-simple";
++              reset-gpios = <&pio 6 12 GPIO_ACTIVE_LOW>; /* PG12 */
++      };
++};
++
++&cpu0 {
++      cpu-supply = <&reg_vdd_cpu>;
++};
++
++&dcxo {
++      clock-frequency = <24000000>;
++};
++
++&ehci0 {
++      status = "okay";
++};
++
++&ehci1 {
++      status = "okay";
++};
++
++&emac {
++      pinctrl-0 = <&rgmii_pe_pins>;
++      pinctrl-names = "default";
++      phy-handle = <&ext_rgmii_phy>;
++      phy-mode = "rgmii-id";
++      phy-supply = <&reg_vcc_3v3>;
++      status = "okay";
++};
++
++&i2c2 {
++      pinctrl-0 = <&i2c2_pb0_pins>;
++      pinctrl-names = "default";
++      status = "okay";
++
++      pcf8574a: gpio@38 {
++              compatible = "nxp,pcf8574a";
++              reg = <0x38>;
++              interrupt-parent = <&pio>;
++              interrupts = <1 2 IRQ_TYPE_LEVEL_LOW>; /* PB2 */
++              interrupt-controller;
++              gpio-controller;
++              #gpio-cells = <2>;
++              #interrupt-cells = <2>;
++      };
++};
++
++&mdio {
++      ext_rgmii_phy: ethernet-phy@1 {
++              compatible = "ethernet-phy-ieee802.3-c22";
++              reg = <1>;
++      };
++};
++
++&mmc0 {
++      bus-width = <4>;
++      cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>; /* PF6 */
++      disable-wp;
++      vmmc-supply = <&reg_vcc_3v3>;
++      vqmmc-supply = <&reg_vcc_3v3>;
++      pinctrl-0 = <&mmc0_pins>;
++      pinctrl-names = "default";
++      status = "okay";
++};
++
++&mmc1 {
++      bus-width = <4>;
++      mmc-pwrseq = <&wifi_pwrseq>;
++      non-removable;
++      vmmc-supply = <&reg_vcc_3v3>;
++      vqmmc-supply = <&reg_vcc_3v3>;
++      pinctrl-0 = <&mmc1_pins>;
++      pinctrl-names = "default";
++      status = "okay";
++
++      xr829: wifi@1 {
++              reg = <1>;
++              interrupt-parent = <&pio>;
++              interrupts = <6 10 IRQ_TYPE_LEVEL_LOW>; /* PG10 */
++              interrupt-names = "host-wake";
++      };
++};
++
++&ohci0 {
++      status = "okay";
++};
++
++&ohci1 {
++      status = "okay";
++};
++
++&uart0 {
++      pinctrl-0 = <&uart0_pb8_pins>;
++      pinctrl-names = "default";
++      status = "okay";
++};
++
++&uart1 {
++      uart-has-rtscts;
++      pinctrl-0 = <&uart1_pg6_pins>, <&uart1_pg8_rts_cts_pins>;
++      pinctrl-names = "default";
++      status = "okay";
++
++      /* XR829 bluetooth is connected here */
++};
++
++&usb_otg {
++      dr_mode = "otg";
++      status = "okay";
++};
++
++&usbphy {
++      usb0_id_det-gpios = <&pio 3 21 GPIO_ACTIVE_HIGH>; /* PD21 */
++      usb0_vbus_det-gpios = <&pio 3 20 GPIO_ACTIVE_HIGH>; /* PD20 */
++      usb0_vbus-supply = <&reg_usbvbus>;
++      usb1_vbus-supply = <&reg_vcc>;
++      status = "okay";
++};
+diff --git a/arch/riscv/boot/dts/allwinner/sun20i-d1.dtsi b/arch/riscv/boot/dts/allwinner/sun20i-d1.dtsi
+new file mode 100644
+index 000000000000..97e7cbb32597
+--- /dev/null
++++ b/arch/riscv/boot/dts/allwinner/sun20i-d1.dtsi
+@@ -0,0 +1,66 @@
++// SPDX-License-Identifier: (GPL-2.0+ or MIT)
++// Copyright (C) 2021-2022 Samuel Holland <samuel@sholland.org>
++
++#include "sun20i-d1s.dtsi"
++#include "sunxi-d1-t113.dtsi"
++
++/ {
++      soc {
++              lradc: keys@2009800 {
++                      compatible = "allwinner,sun20i-d1-lradc",
++                                   "allwinner,sun50i-r329-lradc";
++                      reg = <0x2009800 0x400>;
++                      interrupts = <SOC_PERIPHERAL_IRQ(61) IRQ_TYPE_LEVEL_HIGH>;
++                      clocks = <&ccu CLK_BUS_LRADC>;
++                      resets = <&ccu RST_BUS_LRADC>;
++                      status = "disabled";
++              };
++
++              i2s0: i2s@2032000 {
++                      compatible = "allwinner,sun20i-d1-i2s",
++                                   "allwinner,sun50i-r329-i2s";
++                      reg = <0x2032000 0x1000>;
++                      interrupts = <SOC_PERIPHERAL_IRQ(26) IRQ_TYPE_LEVEL_HIGH>;
++                      clocks = <&ccu CLK_BUS_I2S0>,
++                               <&ccu CLK_I2S0>;
++                      clock-names = "apb", "mod";
++                      resets = <&ccu RST_BUS_I2S0>;
++                      dmas = <&dma 3>, <&dma 3>;
++                      dma-names = "rx", "tx";
++                      status = "disabled";
++                      #sound-dai-cells = <0>;
++              };
++      };
++};
++
++&pio {
++      /omit-if-no-ref/
++      dmic_pb11_d0_pin: dmic-pb11-d0-pin {
++              pins = "PB11";
++              function = "dmic";
++      };
++
++      /omit-if-no-ref/
++      dmic_pe17_clk_pin: dmic-pe17-clk-pin {
++              pins = "PE17";
++              function = "dmic";
++      };
++
++      /omit-if-no-ref/
++      i2c0_pb10_pins: i2c0-pb10-pins {
++              pins = "PB10", "PB11";
++              function = "i2c0";
++      };
++
++      /omit-if-no-ref/
++      i2c2_pb0_pins: i2c2-pb0-pins {
++              pins = "PB0", "PB1";
++              function = "i2c2";
++      };
++
++      /omit-if-no-ref/
++      uart0_pb8_pins: uart0-pb8-pins {
++              pins = "PB8", "PB9";
++              function = "uart0";
++      };
++};
+diff --git a/arch/riscv/boot/dts/allwinner/sun20i-d1s-mangopi-mq.dts b/arch/riscv/boot/dts/allwinner/sun20i-d1s-mangopi-mq.dts
+new file mode 100644
+index 000000000000..e6d924f671fd
+--- /dev/null
++++ b/arch/riscv/boot/dts/allwinner/sun20i-d1s-mangopi-mq.dts
+@@ -0,0 +1,128 @@
++// SPDX-License-Identifier: (GPL-2.0+ or MIT)
++// Copyright (C) 2022 Samuel Holland <samuel@sholland.org>
++
++#include <dt-bindings/gpio/gpio.h>
++#include <dt-bindings/leds/common.h>
++
++/dts-v1/;
++
++#include "sun20i-d1s.dtsi"
++#include "sun20i-common-regulators.dtsi"
++
++/ {
++      model = "MangoPi MQ";
++      compatible = "widora,mangopi-mq", "allwinner,sun20i-d1s";
++
++      aliases {
++              ethernet0 = &rtl8189ftv;
++              serial3 = &uart3;
++      };
++
++      chosen {
++              stdout-path = "serial3:115200n8";
++      };
++
++      leds {
++              compatible = "gpio-leds";
++
++              led-0 {
++                      color = <LED_COLOR_ID_BLUE>;
++                      function = LED_FUNCTION_STATUS;
++                      gpios = <&pio 3 22 GPIO_ACTIVE_LOW>; /* PD22 */
++              };
++      };
++
++      reg_avdd2v8: avdd2v8 {
++              compatible = "regulator-fixed";
++              regulator-name = "avdd2v8";
++              regulator-min-microvolt = <2800000>;
++              regulator-max-microvolt = <2800000>;
++              vin-supply = <&reg_vcc_3v3>;
++      };
++
++      reg_dvdd: dvdd {
++              compatible = "regulator-fixed";
++              regulator-name = "dvdd";
++              regulator-min-microvolt = <1200000>;
++              regulator-max-microvolt = <1200000>;
++              vin-supply = <&reg_vcc_3v3>;
++      };
++
++      reg_vcc_core: vcc-core {
++              compatible = "regulator-fixed";
++              regulator-name = "vcc-core";
++              regulator-min-microvolt = <900000>;
++              regulator-max-microvolt = <900000>;
++              vin-supply = <&reg_vcc>;
++      };
++
++      wifi_pwrseq: wifi-pwrseq {
++              compatible = "mmc-pwrseq-simple";
++              reset-gpios = <&pio 6 12 GPIO_ACTIVE_LOW>; /* PG12 */
++      };
++};
++
++&cpu0 {
++      cpu-supply = <&reg_vcc_core>;
++};
++
++&dcxo {
++      clock-frequency = <24000000>;
++};
++
++&ehci1 {
++      status = "okay";
++};
++
++&mmc0 {
++      bus-width = <4>;
++      cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
++      disable-wp;
++      vmmc-supply = <&reg_vcc_3v3>;
++      vqmmc-supply = <&reg_vcc_3v3>;
++      pinctrl-0 = <&mmc0_pins>;
++      pinctrl-names = "default";
++      status = "okay";
++};
++
++&mmc1 {
++      bus-width = <4>;
++      mmc-pwrseq = <&wifi_pwrseq>;
++      non-removable;
++      vmmc-supply = <&reg_vcc_3v3>;
++      vqmmc-supply = <&reg_vcc_3v3>;
++      pinctrl-0 = <&mmc1_pins>;
++      pinctrl-names = "default";
++      status = "okay";
++
++      rtl8189ftv: wifi@1 {
++              reg = <1>;
++              interrupt-parent = <&pio>;
++              interrupts = <6 10 IRQ_TYPE_LEVEL_LOW>; /* PG10 */
++              interrupt-names = "host-wake";
++      };
++};
++
++&ohci1 {
++      status = "okay";
++};
++
++&pio {
++      vcc-pe-supply = <&reg_avdd2v8>;
++};
++
++&uart3 {
++      pinctrl-0 = <&uart3_pb_pins>;
++      pinctrl-names = "default";
++      status = "okay";
++};
++
++&usb_otg {
++      dr_mode = "peripheral";
++      status = "okay";
++};
++
++&usbphy {
++      usb1_vbus-supply = <&reg_vcc>;
++      status = "okay";
++};
+diff --git a/arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi b/arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi
+new file mode 100644
+index 000000000000..8275630af977
+--- /dev/null
++++ b/arch/riscv/boot/dts/allwinner/sun20i-d1s.dtsi
+@@ -0,0 +1,76 @@
++// SPDX-License-Identifier: (GPL-2.0+ or MIT)
++// Copyright (C) 2021-2022 Samuel Holland <samuel@sholland.org>
++
++#define SOC_PERIPHERAL_IRQ(nr)        (nr + 16)
++
++#include "sunxi-d1s-t113.dtsi"
++
++/ {
++      cpus {
++              timebase-frequency = <24000000>;
++              #address-cells = <1>;
++              #size-cells = <0>;
++
++              cpu0: cpu@0 {
++                      compatible = "thead,c906", "riscv";
++                      device_type = "cpu";
++                      reg = <0>;
++                      clocks = <&ccu CLK_RISCV>;
++                      d-cache-block-size = <64>;
++                      d-cache-sets = <256>;
++                      d-cache-size = <32768>;
++                      i-cache-block-size = <64>;
++                      i-cache-sets = <128>;
++                      i-cache-size = <32768>;
++                      mmu-type = "riscv,sv39";
++                      operating-points-v2 = <&opp_table_cpu>;
++                      riscv,isa = "rv64imafdc";
++                      #cooling-cells = <2>;
++
++                      cpu0_intc: interrupt-controller {
++                              compatible = "riscv,cpu-intc";
++                              interrupt-controller;
++                              #address-cells = <0>;
++                              #interrupt-cells = <1>;
++                      };
++              };
++      };
++
++      opp_table_cpu: opp-table-cpu {
++              compatible = "operating-points-v2";
++
++              opp-408000000 {
++                      opp-hz = /bits/ 64 <408000000>;
++                      opp-microvolt = <900000 900000 1100000>;
++              };
++
++              opp-1080000000 {
++                      opp-hz = /bits/ 64 <1008000000>;
++                      opp-microvolt = <900000 900000 1100000>;
++              };
++      };
++
++      soc {
++              interrupt-parent = <&plic>;
++
++              riscv_wdt: watchdog@6011000 {
++                      compatible = "allwinner,sun20i-d1-wdt";
++                      reg = <0x6011000 0x20>;
++                      interrupts = <SOC_PERIPHERAL_IRQ(131) IRQ_TYPE_LEVEL_HIGH>;
++                      clocks = <&dcxo>, <&rtc CLK_OSC32K>;
++                      clock-names = "hosc", "losc";
++              };
++
++              plic: interrupt-controller@10000000 {
++                      compatible = "allwinner,sun20i-d1-plic",
++                                   "thead,c900-plic";
++                      reg = <0x10000000 0x4000000>;
++                      interrupts-extended = <&cpu0_intc 11>,
++                                            <&cpu0_intc 9>;
++                      interrupt-controller;
++                      riscv,ndev = <175>;
++                      #address-cells = <0>;
++                      #interrupt-cells = <2>;
++              };
++      };
++};
+diff --git a/arch/riscv/boot/dts/allwinner/sunxi-d1-t113.dtsi b/arch/riscv/boot/dts/allwinner/sunxi-d1-t113.dtsi
+new file mode 100644
+index 000000000000..b7156123df54
+--- /dev/null
++++ b/arch/riscv/boot/dts/allwinner/sunxi-d1-t113.dtsi
+@@ -0,0 +1,15 @@
++// SPDX-License-Identifier: (GPL-2.0+ or MIT)
++// Copyright (C) 2021-2022 Samuel Holland <samuel@sholland.org>
++
++/ {
++      soc {
++              dsp_wdt: watchdog@1700400 {
++                      compatible = "allwinner,sun20i-d1-wdt";
++                      reg = <0x1700400 0x20>;
++                      interrupts = <SOC_PERIPHERAL_IRQ(122) IRQ_TYPE_LEVEL_HIGH>;
++                      clocks = <&dcxo>, <&rtc CLK_OSC32K>;
++                      clock-names = "hosc", "losc";
++                      status = "reserved";
++              };
++      };
++};
+diff --git a/arch/riscv/boot/dts/allwinner/sunxi-d1s-t113.dtsi b/arch/riscv/boot/dts/allwinner/sunxi-d1s-t113.dtsi
+new file mode 100644
+index 000000000000..3723612b1fd8
+--- /dev/null
++++ b/arch/riscv/boot/dts/allwinner/sunxi-d1s-t113.dtsi
+@@ -0,0 +1,826 @@
++// SPDX-License-Identifier: (GPL-2.0+ or MIT)
++// Copyright (C) 2021-2022 Samuel Holland <samuel@sholland.org>
++
++#include <dt-bindings/clock/sun6i-rtc.h>
++#include <dt-bindings/clock/sun8i-de2.h>
++#include <dt-bindings/clock/sun8i-tcon-top.h>
++#include <dt-bindings/clock/sun20i-d1-ccu.h>
++#include <dt-bindings/clock/sun20i-d1-r-ccu.h>
++#include <dt-bindings/interrupt-controller/irq.h>
++#include <dt-bindings/reset/sun8i-de2.h>
++#include <dt-bindings/reset/sun20i-d1-ccu.h>
++#include <dt-bindings/reset/sun20i-d1-r-ccu.h>
++
++/ {
++      #address-cells = <1>;
++      #size-cells = <1>;
++
++      dcxo: dcxo-clk {
++              compatible = "fixed-clock";
++              clock-output-names = "dcxo";
++              #clock-cells = <0>;
++      };
++
++      de: display-engine {
++              compatible = "allwinner,sun20i-d1-display-engine";
++              allwinner,pipelines = <&mixer0>, <&mixer1>;
++              status = "disabled";
++      };
++
++      soc {
++              compatible = "simple-bus";
++              ranges;
++              dma-noncoherent;
++              #address-cells = <1>;
++              #size-cells = <1>;
++
++              pio: pinctrl@2000000 {
++                      compatible = "allwinner,sun20i-d1-pinctrl";
++                      reg = <0x2000000 0x800>;
++                      interrupts = <SOC_PERIPHERAL_IRQ(69) IRQ_TYPE_LEVEL_HIGH>,
++                                   <SOC_PERIPHERAL_IRQ(71) IRQ_TYPE_LEVEL_HIGH>,
++                                   <SOC_PERIPHERAL_IRQ(73) IRQ_TYPE_LEVEL_HIGH>,
++                                   <SOC_PERIPHERAL_IRQ(75) IRQ_TYPE_LEVEL_HIGH>,
++                                   <SOC_PERIPHERAL_IRQ(77) IRQ_TYPE_LEVEL_HIGH>,
++                                   <SOC_PERIPHERAL_IRQ(79) IRQ_TYPE_LEVEL_HIGH>;
++                      clocks = <&ccu CLK_APB0>,
++                               <&dcxo>,
++                               <&rtc CLK_OSC32K>;
++                      clock-names = "apb", "hosc", "losc";
++                      gpio-controller;
++                      interrupt-controller;
++                      #gpio-cells = <3>;
++                      #interrupt-cells = <3>;
++
++                      /omit-if-no-ref/
++                      clk_pg11_pin: clk-pg11-pin {
++                              pins = "PG11";
++                              function = "clk";
++                      };
++
++                      /omit-if-no-ref/
++                      dsi_4lane_pins: dsi-4lane-pins {
++                              pins = "PD0", "PD1", "PD2", "PD3", "PD4", "PD5",
++                                     "PD6", "PD7", "PD8", "PD9";
++                              drive-strength = <30>;
++                              function = "dsi";
++                      };
++
++                      /omit-if-no-ref/
++                      lcd_rgb666_pins: lcd-rgb666-pins {
++                              pins = "PD0", "PD1", "PD2", "PD3", "PD4", "PD5",
++                                     "PD6", "PD7", "PD8", "PD9", "PD10", "PD11",
++                                     "PD12", "PD13", "PD14", "PD15", "PD16", "PD17",
++                                     "PD18", "PD19", "PD20", "PD21";
++                              function = "lcd0";
++                      };
++
++                      /omit-if-no-ref/
++                      mmc0_pins: mmc0-pins {
++                              pins = "PF0", "PF1", "PF2", "PF3", "PF4", "PF5";
++                              function = "mmc0";
++                      };
++
++                      /omit-if-no-ref/
++                      mmc1_pins: mmc1-pins {
++                              pins = "PG0", "PG1", "PG2", "PG3", "PG4", "PG5";
++                              function = "mmc1";
++                      };
++
++                      /omit-if-no-ref/
++                      mmc2_pins: mmc2-pins {
++                              pins = "PC2", "PC3", "PC4", "PC5", "PC6", "PC7";
++                              function = "mmc2";
++                      };
++
++                      /omit-if-no-ref/
++                      rgmii_pe_pins: rgmii-pe-pins {
++                              pins = "PE0", "PE1", "PE2", "PE3", "PE4",
++                                     "PE5", "PE6", "PE7", "PE8", "PE9",
++                                     "PE11", "PE12", "PE13", "PE14", "PE15";
++                              function = "emac";
++                      };
++
++                      /omit-if-no-ref/
++                      rmii_pe_pins: rmii-pe-pins {
++                              pins = "PE0", "PE1", "PE2", "PE3", "PE4",
++                                     "PE5", "PE6", "PE7", "PE8", "PE9";
++                              function = "emac";
++                      };
++
++                      /omit-if-no-ref/
++                      uart1_pg6_pins: uart1-pg6-pins {
++                              pins = "PG6", "PG7";
++                              function = "uart1";
++                      };
++
++                      /omit-if-no-ref/
++                      uart1_pg8_rts_cts_pins: uart1-pg8-rts-cts-pins {
++                              pins = "PG8", "PG9";
++                              function = "uart1";
++                      };
++
++                      /omit-if-no-ref/
++                      uart3_pb_pins: uart3-pb-pins {
++                              pins = "PB6", "PB7";
++                              function = "uart3";
++                      };
++              };
++
++              ccu: clock-controller@2001000 {
++                      compatible = "allwinner,sun20i-d1-ccu";
++                      reg = <0x2001000 0x1000>;
++                      clocks = <&dcxo>,
++                               <&rtc CLK_OSC32K>,
++                               <&rtc CLK_IOSC>;
++                      clock-names = "hosc", "losc", "iosc";
++                      #clock-cells = <1>;
++                      #reset-cells = <1>;
++              };
++
++              dmic: dmic@2031000 {
++                      compatible = "allwinner,sun20i-d1-dmic",
++                                   "allwinner,sun50i-h6-dmic";
++                      reg = <0x2031000 0x400>;
++                      interrupts = <SOC_PERIPHERAL_IRQ(24) IRQ_TYPE_LEVEL_HIGH>;
++                      clocks = <&ccu CLK_BUS_DMIC>,
++                               <&ccu CLK_DMIC>;
++                      clock-names = "bus", "mod";
++                      resets = <&ccu RST_BUS_DMIC>;
++                      dmas = <&dma 8>;
++                      dma-names = "rx";
++                      status = "disabled";
++                      #sound-dai-cells = <0>;
++              };
++
++              i2s1: i2s@2033000 {
++                      compatible = "allwinner,sun20i-d1-i2s",
++                                   "allwinner,sun50i-r329-i2s";
++                      reg = <0x2033000 0x1000>;
++                      interrupts = <SOC_PERIPHERAL_IRQ(27) IRQ_TYPE_LEVEL_HIGH>;
++                      clocks = <&ccu CLK_BUS_I2S1>,
++                               <&ccu CLK_I2S1>;
++                      clock-names = "apb", "mod";
++                      resets = <&ccu RST_BUS_I2S1>;
++                      dmas = <&dma 4>, <&dma 4>;
++                      dma-names = "rx", "tx";
++                      status = "disabled";
++                      #sound-dai-cells = <0>;
++              };
++
++              i2s2: i2s@2034000 {
++                      compatible = "allwinner,sun20i-d1-i2s",
++                                   "allwinner,sun50i-r329-i2s";
++                      reg = <0x2034000 0x1000>;
++                      interrupts = <SOC_PERIPHERAL_IRQ(28) IRQ_TYPE_LEVEL_HIGH>;
++                      clocks = <&ccu CLK_BUS_I2S2>,
++                               <&ccu CLK_I2S2>;
++                      clock-names = "apb", "mod";
++                      resets = <&ccu RST_BUS_I2S2>;
++                      dmas = <&dma 5>, <&dma 5>;
++                      dma-names = "rx", "tx";
++                      status = "disabled";
++                      #sound-dai-cells = <0>;
++              };
++
++              timer: timer@2050000 {
++                      compatible = "allwinner,sun20i-d1-timer",
++                                   "allwinner,sun8i-a23-timer";
++                      reg = <0x2050000 0xa0>;
++                      interrupts = <SOC_PERIPHERAL_IRQ(59) IRQ_TYPE_LEVEL_HIGH>,
++                                   <SOC_PERIPHERAL_IRQ(60) IRQ_TYPE_LEVEL_HIGH>;
++                      clocks = <&dcxo>;
++              };
++
++              wdt: watchdog@20500a0 {
++                      compatible = "allwinner,sun20i-d1-wdt-reset",
++                                   "allwinner,sun20i-d1-wdt";
++                      reg = <0x20500a0 0x20>;
++                      interrupts = <SOC_PERIPHERAL_IRQ(63) IRQ_TYPE_LEVEL_HIGH>;
++                      clocks = <&dcxo>, <&rtc CLK_OSC32K>;
++                      clock-names = "hosc", "losc";
++                      status = "reserved";
++              };
++
++              uart0: serial@2500000 {
++                      compatible = "snps,dw-apb-uart";
++                      reg = <0x2500000 0x400>;
++                      reg-io-width = <4>;
++                      reg-shift = <2>;
++                      interrupts = <SOC_PERIPHERAL_IRQ(2) IRQ_TYPE_LEVEL_HIGH>;
++                      clocks = <&ccu CLK_BUS_UART0>;
++                      resets = <&ccu RST_BUS_UART0>;
++                      dmas = <&dma 14>, <&dma 14>;
++                      dma-names = "rx", "tx";
++                      status = "disabled";
++              };
++
++              uart1: serial@2500400 {
++                      compatible = "snps,dw-apb-uart";
++                      reg = <0x2500400 0x400>;
++                      reg-io-width = <4>;
++                      reg-shift = <2>;
++                      interrupts = <SOC_PERIPHERAL_IRQ(3) IRQ_TYPE_LEVEL_HIGH>;
++                      clocks = <&ccu CLK_BUS_UART1>;
++                      resets = <&ccu RST_BUS_UART1>;
++                      dmas = <&dma 15>, <&dma 15>;
++                      dma-names = "rx", "tx";
++                      status = "disabled";
++              };
++
++              uart2: serial@2500800 {
++                      compatible = "snps,dw-apb-uart";
++                      reg = <0x2500800 0x400>;
++                      reg-io-width = <4>;
++                      reg-shift = <2>;
++                      interrupts = <SOC_PERIPHERAL_IRQ(4) IRQ_TYPE_LEVEL_HIGH>;
++                      clocks = <&ccu CLK_BUS_UART2>;
++                      resets = <&ccu RST_BUS_UART2>;
++                      dmas = <&dma 16>, <&dma 16>;
++                      dma-names = "rx", "tx";
++                      status = "disabled";
++              };
++
++              uart3: serial@2500c00 {
++                      compatible = "snps,dw-apb-uart";
++                      reg = <0x2500c00 0x400>;
++                      reg-io-width = <4>;
++                      reg-shift = <2>;
++                      interrupts = <SOC_PERIPHERAL_IRQ(5) IRQ_TYPE_LEVEL_HIGH>;
++                      clocks = <&ccu CLK_BUS_UART3>;
++                      resets = <&ccu RST_BUS_UART3>;
++                      dmas = <&dma 17>, <&dma 17>;
++                      dma-names = "rx", "tx";
++                      status = "disabled";
++              };
++
++              uart4: serial@2501000 {
++                      compatible = "snps,dw-apb-uart";
++                      reg = <0x2501000 0x400>;
++                      reg-io-width = <4>;
++                      reg-shift = <2>;
++                      interrupts = <SOC_PERIPHERAL_IRQ(6) IRQ_TYPE_LEVEL_HIGH>;
++                      clocks = <&ccu CLK_BUS_UART4>;
++                      resets = <&ccu RST_BUS_UART4>;
++                      dmas = <&dma 18>, <&dma 18>;
++                      dma-names = "rx", "tx";
++                      status = "disabled";
++              };
++
++              uart5: serial@2501400 {
++                      compatible = "snps,dw-apb-uart";
++                      reg = <0x2501400 0x400>;
++                      reg-io-width = <4>;
++                      reg-shift = <2>;
++                      interrupts = <SOC_PERIPHERAL_IRQ(7) IRQ_TYPE_LEVEL_HIGH>;
++                      clocks = <&ccu CLK_BUS_UART5>;
++                      resets = <&ccu RST_BUS_UART5>;
++                      dmas = <&dma 19>, <&dma 19>;
++                      dma-names = "rx", "tx";
++                      status = "disabled";
++              };
++
++              i2c0: i2c@2502000 {
++                      compatible = "allwinner,sun20i-d1-i2c",
++                                   "allwinner,sun8i-v536-i2c",
++                                   "allwinner,sun6i-a31-i2c";
++                      reg = <0x2502000 0x400>;
++                      interrupts = <SOC_PERIPHERAL_IRQ(9) IRQ_TYPE_LEVEL_HIGH>;
++                      clocks = <&ccu CLK_BUS_I2C0>;
++                      resets = <&ccu RST_BUS_I2C0>;
++                      dmas = <&dma 43>, <&dma 43>;
++                      dma-names = "rx", "tx";
++                      status = "disabled";
++                      #address-cells = <1>;
++                      #size-cells = <0>;
++              };
++
++              i2c1: i2c@2502400 {
++                      compatible = "allwinner,sun20i-d1-i2c",
++                                   "allwinner,sun8i-v536-i2c",
++                                   "allwinner,sun6i-a31-i2c";
++                      reg = <0x2502400 0x400>;
++                      interrupts = <SOC_PERIPHERAL_IRQ(10) IRQ_TYPE_LEVEL_HIGH>;
++                      clocks = <&ccu CLK_BUS_I2C1>;
++                      resets = <&ccu RST_BUS_I2C1>;
++                      dmas = <&dma 44>, <&dma 44>;
++                      dma-names = "rx", "tx";
++                      status = "disabled";
++                      #address-cells = <1>;
++                      #size-cells = <0>;
++              };
++
++              i2c2: i2c@2502800 {
++                      compatible = "allwinner,sun20i-d1-i2c",
++                                   "allwinner,sun8i-v536-i2c",
++                                   "allwinner,sun6i-a31-i2c";
++                      reg = <0x2502800 0x400>;
++                      interrupts = <SOC_PERIPHERAL_IRQ(11) IRQ_TYPE_LEVEL_HIGH>;
++                      clocks = <&ccu CLK_BUS_I2C2>;
++                      resets = <&ccu RST_BUS_I2C2>;
++                      dmas = <&dma 45>, <&dma 45>;
++                      dma-names = "rx", "tx";
++                      status = "disabled";
++                      #address-cells = <1>;
++                      #size-cells = <0>;
++              };
++
++              i2c3: i2c@2502c00 {
++                      compatible = "allwinner,sun20i-d1-i2c",
++                                   "allwinner,sun8i-v536-i2c",
++                                   "allwinner,sun6i-a31-i2c";
++                      reg = <0x2502c00 0x400>;
++                      interrupts = <SOC_PERIPHERAL_IRQ(12) IRQ_TYPE_LEVEL_HIGH>;
++                      clocks = <&ccu CLK_BUS_I2C3>;
++                      resets = <&ccu RST_BUS_I2C3>;
++                      dmas = <&dma 46>, <&dma 46>;
++                      dma-names = "rx", "tx";
++                      status = "disabled";
++                      #address-cells = <1>;
++                      #size-cells = <0>;
++              };
++
++              syscon: syscon@3000000 {
++                      compatible = "allwinner,sun20i-d1-system-control";
++                      reg = <0x3000000 0x1000>;
++                      ranges;
++                      #address-cells = <1>;
++                      #size-cells = <1>;
++              };
++
++              dma: dma-controller@3002000 {
++                      compatible = "allwinner,sun20i-d1-dma";
++                      reg = <0x3002000 0x1000>;
++                      interrupts = <SOC_PERIPHERAL_IRQ(50) IRQ_TYPE_LEVEL_HIGH>;
++                      clocks = <&ccu CLK_BUS_DMA>, <&ccu CLK_MBUS_DMA>;
++                      clock-names = "bus", "mbus";
++                      resets = <&ccu RST_BUS_DMA>;
++                      dma-channels = <16>;
++                      dma-requests = <48>;
++                      #dma-cells = <1>;
++              };
++
++              sid: efuse@3006000 {
++                      compatible = "allwinner,sun20i-d1-sid";
++                      reg = <0x3006000 0x1000>;
++                      #address-cells = <1>;
++                      #size-cells = <1>;
++              };
++
++              mbus: dram-controller@3102000 {
++                      compatible = "allwinner,sun20i-d1-mbus";
++                      reg = <0x3102000 0x1000>,
++                            <0x3103000 0x1000>;
++                      reg-names = "mbus", "dram";
++                      interrupts = <SOC_PERIPHERAL_IRQ(43) IRQ_TYPE_LEVEL_HIGH>;
++                      clocks = <&ccu CLK_MBUS>,
++                               <&ccu CLK_DRAM>,
++                               <&ccu CLK_BUS_DRAM>;
++                      clock-names = "mbus", "dram", "bus";
++                      dma-ranges = <0 0x40000000 0x80000000>;
++                      #address-cells = <1>;
++                      #size-cells = <1>;
++                      #interconnect-cells = <1>;
++              };
++
++              mmc0: mmc@4020000 {
++                      compatible = "allwinner,sun20i-d1-mmc";
++                      reg = <0x4020000 0x1000>;
++                      interrupts = <SOC_PERIPHERAL_IRQ(40) IRQ_TYPE_LEVEL_HIGH>;
++                      clocks = <&ccu CLK_BUS_MMC0>, <&ccu CLK_MMC0>;
++                      clock-names = "ahb", "mmc";
++                      resets = <&ccu RST_BUS_MMC0>;
++                      reset-names = "ahb";
++                      cap-sd-highspeed;
++                      max-frequency = <150000000>;
++                      no-mmc;
++                      status = "disabled";
++                      #address-cells = <1>;
++                      #size-cells = <0>;
++              };
++
++              mmc1: mmc@4021000 {
++                      compatible = "allwinner,sun20i-d1-mmc";
++                      reg = <0x4021000 0x1000>;
++                      interrupts = <SOC_PERIPHERAL_IRQ(41) IRQ_TYPE_LEVEL_HIGH>;
++                      clocks = <&ccu CLK_BUS_MMC1>, <&ccu CLK_MMC1>;
++                      clock-names = "ahb", "mmc";
++                      resets = <&ccu RST_BUS_MMC1>;
++                      reset-names = "ahb";
++                      cap-sd-highspeed;
++                      max-frequency = <150000000>;
++                      no-mmc;
++                      status = "disabled";
++                      #address-cells = <1>;
++                      #size-cells = <0>;
++              };
++
++              mmc2: mmc@4022000 {
++                      compatible = "allwinner,sun20i-d1-emmc",
++                                   "allwinner,sun50i-a100-emmc";
++                      reg = <0x4022000 0x1000>;
++                      interrupts = <SOC_PERIPHERAL_IRQ(42) IRQ_TYPE_LEVEL_HIGH>;
++                      clocks = <&ccu CLK_BUS_MMC2>, <&ccu CLK_MMC2>;
++                      clock-names = "ahb", "mmc";
++                      resets = <&ccu RST_BUS_MMC2>;
++                      reset-names = "ahb";
++                      cap-mmc-highspeed;
++                      max-frequency = <150000000>;
++                      mmc-ddr-1_8v;
++                      mmc-ddr-3_3v;
++                      no-sd;
++                      no-sdio;
++                      status = "disabled";
++                      #address-cells = <1>;
++                      #size-cells = <0>;
++              };
++
++              usb_otg: usb@4100000 {
++                      compatible = "allwinner,sun20i-d1-musb",
++                                   "allwinner,sun8i-a33-musb";
++                      reg = <0x4100000 0x400>;
++                      interrupts = <SOC_PERIPHERAL_IRQ(29) IRQ_TYPE_LEVEL_HIGH>;
++                      interrupt-names = "mc";
++                      clocks = <&ccu CLK_BUS_OTG>;
++                      resets = <&ccu RST_BUS_OTG>;
++                      extcon = <&usbphy 0>;
++                      phys = <&usbphy 0>;
++                      phy-names = "usb";
++                      status = "disabled";
++              };
++
++              usbphy: phy@4100400 {
++                      compatible = "allwinner,sun20i-d1-usb-phy";
++                      reg = <0x4100400 0x100>,
++                            <0x4101800 0x100>,
++                            <0x4200800 0x100>;
++                      reg-names = "phy_ctrl",
++                                  "pmu0",
++                                  "pmu1";
++                      clocks = <&dcxo>,
++                               <&dcxo>;
++                      clock-names = "usb0_phy",
++                                    "usb1_phy";
++                      resets = <&ccu RST_USB_PHY0>,
++                               <&ccu RST_USB_PHY1>;
++                      reset-names = "usb0_reset",
++                                    "usb1_reset";
++                      status = "disabled";
++                      #phy-cells = <1>;
++              };
++
++              ehci0: usb@4101000 {
++                      compatible = "allwinner,sun20i-d1-ehci",
++                                   "generic-ehci";
++                      reg = <0x4101000 0x100>;
++                      interrupts = <SOC_PERIPHERAL_IRQ(30) IRQ_TYPE_LEVEL_HIGH>;
++                      clocks = <&ccu CLK_BUS_OHCI0>,
++                               <&ccu CLK_BUS_EHCI0>,
++                               <&ccu CLK_USB_OHCI0>;
++                      resets = <&ccu RST_BUS_OHCI0>,
++                               <&ccu RST_BUS_EHCI0>;
++                      phys = <&usbphy 0>;
++                      phy-names = "usb";
++                      status = "disabled";
++              };
++
++              ohci0: usb@4101400 {
++                      compatible = "allwinner,sun20i-d1-ohci",
++                                   "generic-ohci";
++                      reg = <0x4101400 0x100>;
++                      interrupts = <SOC_PERIPHERAL_IRQ(31) IRQ_TYPE_LEVEL_HIGH>;
++                      clocks = <&ccu CLK_BUS_OHCI0>,
++                               <&ccu CLK_USB_OHCI0>;
++                      resets = <&ccu RST_BUS_OHCI0>;
++                      phys = <&usbphy 0>;
++                      phy-names = "usb";
++                      status = "disabled";
++              };
++
++              ehci1: usb@4200000 {
++                      compatible = "allwinner,sun20i-d1-ehci",
++                                   "generic-ehci";
++                      reg = <0x4200000 0x100>;
++                      interrupts = <SOC_PERIPHERAL_IRQ(33) IRQ_TYPE_LEVEL_HIGH>;
++                      clocks = <&ccu CLK_BUS_OHCI1>,
++                               <&ccu CLK_BUS_EHCI1>,
++                               <&ccu CLK_USB_OHCI1>;
++                      resets = <&ccu RST_BUS_OHCI1>,
++                               <&ccu RST_BUS_EHCI1>;
++                      phys = <&usbphy 1>;
++                      phy-names = "usb";
++                      status = "disabled";
++              };
++
++              ohci1: usb@4200400 {
++                      compatible = "allwinner,sun20i-d1-ohci",
++                                   "generic-ohci";
++                      reg = <0x4200400 0x100>;
++                      interrupts = <SOC_PERIPHERAL_IRQ(34) IRQ_TYPE_LEVEL_HIGH>;
++                      clocks = <&ccu CLK_BUS_OHCI1>,
++                               <&ccu CLK_USB_OHCI1>;
++                      resets = <&ccu RST_BUS_OHCI1>;
++                      phys = <&usbphy 1>;
++                      phy-names = "usb";
++                      status = "disabled";
++              };
++
++              emac: ethernet@4500000 {
++                      compatible = "allwinner,sun20i-d1-emac",
++                                   "allwinner,sun50i-a64-emac";
++                      reg = <0x4500000 0x10000>;
++                      interrupts = <SOC_PERIPHERAL_IRQ(46) IRQ_TYPE_LEVEL_HIGH>;
++                      interrupt-names = "macirq";
++                      clocks = <&ccu CLK_BUS_EMAC>;
++                      clock-names = "stmmaceth";
++                      resets = <&ccu RST_BUS_EMAC>;
++                      reset-names = "stmmaceth";
++                      syscon = <&syscon>;
++                      status = "disabled";
++
++                      mdio: mdio {
++                              compatible = "snps,dwmac-mdio";
++                              #address-cells = <1>;
++                              #size-cells = <0>;
++                      };
++              };
++
++              display_clocks: clock-controller@5000000 {
++                      compatible = "allwinner,sun20i-d1-de2-clk",
++                                   "allwinner,sun50i-h5-de2-clk";
++                      reg = <0x5000000 0x10000>;
++                      clocks = <&ccu CLK_BUS_DE>, <&ccu CLK_DE>;
++                      clock-names = "bus", "mod";
++                      resets = <&ccu RST_BUS_DE>;
++                      #clock-cells = <1>;
++                      #reset-cells = <1>;
++              };
++
++              mixer0: mixer@5100000 {
++                      compatible = "allwinner,sun20i-d1-de2-mixer-0";
++                      reg = <0x5100000 0x100000>;
++                      clocks = <&display_clocks CLK_BUS_MIXER0>,
++                               <&display_clocks CLK_MIXER0>;
++                      clock-names = "bus", "mod";
++                      resets = <&display_clocks RST_MIXER0>;
++
++                      ports {
++                              #address-cells = <1>;
++                              #size-cells = <0>;
++
++                              mixer0_out: port@1 {
++                                      reg = <1>;
++
++                                      mixer0_out_tcon_top_mixer0: endpoint {
++                                              remote-endpoint = <&tcon_top_mixer0_in_mixer0>;
++                                      };
++                              };
++                      };
++              };
++
++              mixer1: mixer@5200000 {
++                      compatible = "allwinner,sun20i-d1-de2-mixer-1";
++                      reg = <0x5200000 0x100000>;
++                      clocks = <&display_clocks CLK_BUS_MIXER1>,
++                               <&display_clocks CLK_MIXER1>;
++                      clock-names = "bus", "mod";
++                      resets = <&display_clocks RST_MIXER1>;
++
++                      ports {
++                              #address-cells = <1>;
++                              #size-cells = <0>;
++
++                              mixer1_out: port@1 {
++                                      reg = <1>;
++
++                                      mixer1_out_tcon_top_mixer1: endpoint {
++                                              remote-endpoint = <&tcon_top_mixer1_in_mixer1>;
++                                      };
++                              };
++                      };
++              };
++
++              dsi: dsi@5450000 {
++                      compatible = "allwinner,sun20i-d1-mipi-dsi",
++                                   "allwinner,sun50i-a100-mipi-dsi";
++                      reg = <0x5450000 0x1000>;
++                      interrupts = <SOC_PERIPHERAL_IRQ(92) IRQ_TYPE_LEVEL_HIGH>;
++                      clocks = <&ccu CLK_BUS_MIPI_DSI>,
++                               <&tcon_top CLK_TCON_TOP_DSI>;
++                      clock-names = "bus", "mod";
++                      resets = <&ccu RST_BUS_MIPI_DSI>;
++                      phys = <&dphy>;
++                      phy-names = "dphy";
++                      status = "disabled";
++
++                      port {
++                              dsi_in_tcon_lcd0: endpoint {
++                                      remote-endpoint = <&tcon_lcd0_out_dsi>;
++                              };
++                      };
++              };
++
++              dphy: phy@5451000 {
++                      compatible = "allwinner,sun20i-d1-mipi-dphy",
++                                   "allwinner,sun50i-a100-mipi-dphy";
++                      reg = <0x5451000 0x1000>;
++                      interrupts = <SOC_PERIPHERAL_IRQ(92) IRQ_TYPE_LEVEL_HIGH>;
++                      clocks = <&ccu CLK_BUS_MIPI_DSI>,
++                               <&ccu CLK_MIPI_DSI>;
++                      clock-names = "bus", "mod";
++                      resets = <&ccu RST_BUS_MIPI_DSI>;
++                      #phy-cells = <0>;
++              };
++
++              tcon_top: tcon-top@5460000 {
++                      compatible = "allwinner,sun20i-d1-tcon-top";
++                      reg = <0x5460000 0x1000>;
++                      clocks = <&ccu CLK_BUS_DPSS_TOP>,
++                               <&ccu CLK_TCON_TV>,
++                               <&ccu CLK_TVE>,
++                               <&ccu CLK_TCON_LCD0>;
++                      clock-names = "bus", "tcon-tv0", "tve0", "dsi";
++                      clock-output-names = "tcon-top-tv0", "tcon-top-dsi";
++                      resets = <&ccu RST_BUS_DPSS_TOP>;
++                      #clock-cells = <1>;
++
++                      ports {
++                              #address-cells = <1>;
++                              #size-cells = <0>;
++
++                              tcon_top_mixer0_in: port@0 {
++                                      reg = <0>;
++
++                                      tcon_top_mixer0_in_mixer0: endpoint {
++                                              remote-endpoint = <&mixer0_out_tcon_top_mixer0>;
++                                      };
++                              };
++
++                              tcon_top_mixer0_out: port@1 {
++                                      reg = <1>;
++                                      #address-cells = <1>;
++                                      #size-cells = <0>;
++
++                                      tcon_top_mixer0_out_tcon_lcd0: endpoint@0 {
++                                              reg = <0>;
++                                              remote-endpoint = <&tcon_lcd0_in_tcon_top_mixer0>;
++                                      };
++
++                                      tcon_top_mixer0_out_tcon_tv0: endpoint@2 {
++                                              reg = <2>;
++                                              remote-endpoint = <&tcon_tv0_in_tcon_top_mixer0>;
++                                      };
++                              };
++
++                              tcon_top_mixer1_in: port@2 {
++                                      reg = <2>;
++                                      #address-cells = <1>;
++                                      #size-cells = <0>;
++
++                                      tcon_top_mixer1_in_mixer1: endpoint@1 {
++                                              reg = <1>;
++                                              remote-endpoint = <&mixer1_out_tcon_top_mixer1>;
++                                      };
++                              };
++
++                              tcon_top_mixer1_out: port@3 {
++                                      reg = <3>;
++                                      #address-cells = <1>;
++                                      #size-cells = <0>;
++
++                                      tcon_top_mixer1_out_tcon_lcd0: endpoint@0 {
++                                              reg = <0>;
++                                              remote-endpoint = <&tcon_lcd0_in_tcon_top_mixer1>;
++                                      };
++
++                                      tcon_top_mixer1_out_tcon_tv0: endpoint@2 {
++                                              reg = <2>;
++                                              remote-endpoint = <&tcon_tv0_in_tcon_top_mixer1>;
++                                      };
++                              };
++
++                              tcon_top_hdmi_in: port@4 {
++                                      reg = <4>;
++
++                                      tcon_top_hdmi_in_tcon_tv0: endpoint {
++                                              remote-endpoint = <&tcon_tv0_out_tcon_top_hdmi>;
++                                      };
++                              };
++
++                              tcon_top_hdmi_out: port@5 {
++                                      reg = <5>;
++                              };
++                      };
++              };
++
++              tcon_lcd0: lcd-controller@5461000 {
++                      compatible = "allwinner,sun20i-d1-tcon-lcd";
++                      reg = <0x5461000 0x1000>;
++                      interrupts = <SOC_PERIPHERAL_IRQ(90) IRQ_TYPE_LEVEL_HIGH>;
++                      clocks = <&ccu CLK_BUS_TCON_LCD0>,
++                               <&ccu CLK_TCON_LCD0>;
++                      clock-names = "ahb", "tcon-ch0";
++                      clock-output-names = "tcon-pixel-clock";
++                      resets = <&ccu RST_BUS_TCON_LCD0>,
++                               <&ccu RST_BUS_LVDS0>;
++                      reset-names = "lcd", "lvds";
++                      #clock-cells = <0>;
++
++                      ports {
++                              #address-cells = <1>;
++                              #size-cells = <0>;
++
++                              tcon_lcd0_in: port@0 {
++                                      reg = <0>;
++                                      #address-cells = <1>;
++                                      #size-cells = <0>;
++
++                                      tcon_lcd0_in_tcon_top_mixer0: endpoint@0 {
++                                              reg = <0>;
++                                              remote-endpoint = <&tcon_top_mixer0_out_tcon_lcd0>;
++                                      };
++
++                                      tcon_lcd0_in_tcon_top_mixer1: endpoint@1 {
++                                              reg = <1>;
++                                              remote-endpoint = <&tcon_top_mixer1_out_tcon_lcd0>;
++                                      };
++                              };
++
++                              tcon_lcd0_out: port@1 {
++                                      reg = <1>;
++                                      #address-cells = <1>;
++                                      #size-cells = <0>;
++
++                                      tcon_lcd0_out_dsi: endpoint@1 {
++                                              reg = <1>;
++                                              remote-endpoint = <&dsi_in_tcon_lcd0>;
++                                      };
++                              };
++                      };
++              };
++
++              tcon_tv0: lcd-controller@5470000 {
++                      compatible = "allwinner,sun20i-d1-tcon-tv";
++                      reg = <0x5470000 0x1000>;
++                      interrupts = <SOC_PERIPHERAL_IRQ(91) IRQ_TYPE_LEVEL_HIGH>;
++                      clocks = <&ccu CLK_BUS_TCON_TV>,
++                               <&tcon_top CLK_TCON_TOP_TV0>;
++                      clock-names = "ahb", "tcon-ch1";
++                      resets = <&ccu RST_BUS_TCON_TV>;
++                      reset-names = "lcd";
++
++                      ports {
++                              #address-cells = <1>;
++                              #size-cells = <0>;
++
++                              tcon_tv0_in: port@0 {
++                                      reg = <0>;
++                                      #address-cells = <1>;
++                                      #size-cells = <0>;
++
++                                      tcon_tv0_in_tcon_top_mixer0: endpoint@0 {
++                                              reg = <0>;
++                                              remote-endpoint = <&tcon_top_mixer0_out_tcon_tv0>;
++                                      };
++
++                                      tcon_tv0_in_tcon_top_mixer1: endpoint@1 {
++                                              reg = <1>;
++                                              remote-endpoint = <&tcon_top_mixer1_out_tcon_tv0>;
++                                      };
++                              };
++
++                              tcon_tv0_out: port@1 {
++                                      reg = <1>;
++
++                                      tcon_tv0_out_tcon_top_hdmi: endpoint {
++                                              remote-endpoint = <&tcon_top_hdmi_in_tcon_tv0>;
++                                      };
++                              };
++                      };
++              };
++
++              r_ccu: clock-controller@7010000 {
++                      compatible = "allwinner,sun20i-d1-r-ccu";
++                      reg = <0x7010000 0x400>;
++                      clocks = <&dcxo>,
++                               <&rtc CLK_OSC32K>,
++                               <&rtc CLK_IOSC>,
++                               <&ccu CLK_PLL_PERIPH0_DIV3>;
++                      clock-names = "hosc", "losc", "iosc", "pll-periph";
++                      #clock-cells = <1>;
++                      #reset-cells = <1>;
++              };
++
++              rtc: rtc@7090000 {
++                      compatible = "allwinner,sun20i-d1-rtc",
++                                   "allwinner,sun50i-r329-rtc";
++                      reg = <0x7090000 0x400>;
++                      interrupts = <SOC_PERIPHERAL_IRQ(144) IRQ_TYPE_LEVEL_HIGH>;
++                      clocks = <&r_ccu CLK_BUS_R_RTC>,
++                               <&dcxo>,
++                               <&r_ccu CLK_R_AHB>;
++                      clock-names = "bus", "hosc", "ahb";
++                      #clock-cells = <1>;
++              };
++      };
++};
+-- 
+2.20.1
+
diff --git a/target/linux/sunxi/patches-6.1/0002-clk-sunxi-ng-Remove-duplicate-ARCH_SUNXI-dependencie.patch b/target/linux/sunxi/patches-6.1/0002-clk-sunxi-ng-Remove-duplicate-ARCH_SUNXI-dependencie.patch
new file mode 100644 (file)
index 0000000..443fcea
--- /dev/null
@@ -0,0 +1,263 @@
+From 0cf9d94bdc6c4b9ee95b6798e56991658e3d38fc Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel@sholland.org>
+Date: Sat, 31 Dec 2022 17:14:24 -0600
+Subject: [PATCH 2/9] clk: sunxi-ng: Remove duplicate ARCH_SUNXI dependencies
+
+SUNXI_CCU already depends on ARCH_SUNXI, so adding the dependency to
+individual SoC drivers is redundant. Drivers stay disabled under
+COMPILE_TEST because of the `default ARCH_SUNXI` applied to SUNXI_CCU.
+
+Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
+Signed-off-by: Samuel Holland <samuel@sholland.org>
+---
+ drivers/clk/sunxi-ng/Kconfig              | 71 ++++++++++++-----------
+ drivers/clk/sunxi-ng/ccu-sun20i-d1.c      | 13 ++++-
+ drivers/clk/sunxi-ng/ccu-sun20i-d1.h      |  2 +-
+ include/dt-bindings/clock/sun20i-d1-ccu.h |  2 +
+ include/dt-bindings/reset/sun20i-d1-ccu.h |  2 +
+ 5 files changed, 53 insertions(+), 37 deletions(-)
+
+diff --git a/drivers/clk/sunxi-ng/Kconfig b/drivers/clk/sunxi-ng/Kconfig
+index 461537679c04..b547198a2c65 100644
+--- a/drivers/clk/sunxi-ng/Kconfig
++++ b/drivers/clk/sunxi-ng/Kconfig
+@@ -9,112 +9,113 @@ if SUNXI_CCU
+ config SUNIV_F1C100S_CCU
+       tristate "Support for the Allwinner newer F1C100s CCU"
+-      default MACH_SUNIV
++      default y
+       depends on MACH_SUNIV || COMPILE_TEST
+ config SUN20I_D1_CCU
+-      tristate "Support for the Allwinner D1 CCU"
+-      default RISCV && ARCH_SUNXI
+-      depends on (RISCV && ARCH_SUNXI) || COMPILE_TEST
++      tristate "Support for the Allwinner D1/R528/T113 CCU"
++      default y
++      depends on MACH_SUN8I || RISCV || COMPILE_TEST
+ config SUN20I_D1_R_CCU
+-      tristate "Support for the Allwinner D1 PRCM CCU"
+-      default RISCV && ARCH_SUNXI
+-      depends on (RISCV && ARCH_SUNXI) || COMPILE_TEST
++      tristate "Support for the Allwinner D1/R528/T113 PRCM CCU"
++      default y
++      depends on MACH_SUN8I || RISCV || COMPILE_TEST
+ config SUN50I_A64_CCU
+       tristate "Support for the Allwinner A64 CCU"
+-      default ARM64 && ARCH_SUNXI
+-      depends on (ARM64 && ARCH_SUNXI) || COMPILE_TEST
++      default y
++      depends on ARM64 || COMPILE_TEST
+ config SUN50I_A100_CCU
+       tristate "Support for the Allwinner A100 CCU"
+-      default ARM64 && ARCH_SUNXI
+-      depends on (ARM64 && ARCH_SUNXI) || COMPILE_TEST
++      default y
++      depends on ARM64 || COMPILE_TEST
+ config SUN50I_A100_R_CCU
+       tristate "Support for the Allwinner A100 PRCM CCU"
+-      default ARM64 && ARCH_SUNXI
+-      depends on (ARM64 && ARCH_SUNXI) || COMPILE_TEST
++      default y
++      depends on ARM64 || COMPILE_TEST
+ config SUN50I_H6_CCU
+       tristate "Support for the Allwinner H6 CCU"
+-      default ARM64 && ARCH_SUNXI
+-      depends on (ARM64 && ARCH_SUNXI) || COMPILE_TEST
++      default y
++      depends on ARM64 || COMPILE_TEST
+ config SUN50I_H616_CCU
+       tristate "Support for the Allwinner H616 CCU"
+-      default ARM64 && ARCH_SUNXI
+-      depends on (ARM64 && ARCH_SUNXI) || COMPILE_TEST
++      default y
++      depends on ARM64 || COMPILE_TEST
+ config SUN50I_H6_R_CCU
+       tristate "Support for the Allwinner H6 and H616 PRCM CCU"
+-      default ARM64 && ARCH_SUNXI
+-      depends on (ARM64 && ARCH_SUNXI) || COMPILE_TEST
++      default y
++      depends on ARM64 || COMPILE_TEST
+ config SUN4I_A10_CCU
+       tristate "Support for the Allwinner A10/A20 CCU"
+-      default MACH_SUN4I
+-      default MACH_SUN7I
++      default y
+       depends on MACH_SUN4I || MACH_SUN7I || COMPILE_TEST
+ config SUN5I_CCU
+       bool "Support for the Allwinner sun5i family CCM"
+-      default MACH_SUN5I
++      default y
+       depends on MACH_SUN5I || COMPILE_TEST
+       depends on SUNXI_CCU=y
+ config SUN6I_A31_CCU
+       tristate "Support for the Allwinner A31/A31s CCU"
+-      default MACH_SUN6I
++      default y
+       depends on MACH_SUN6I || COMPILE_TEST
+ config SUN6I_RTC_CCU
+       tristate "Support for the Allwinner H616/R329 RTC CCU"
+-      default ARCH_SUNXI
+-      depends on ARCH_SUNXI || COMPILE_TEST
++      default y
++      depends on MACH_SUN8I || ARM64 || RISCV || COMPILE_TEST
+ config SUN8I_A23_CCU
+       tristate "Support for the Allwinner A23 CCU"
+-      default MACH_SUN8I
++      default y
+       depends on MACH_SUN8I || COMPILE_TEST
+ config SUN8I_A33_CCU
+       tristate "Support for the Allwinner A33 CCU"
+-      default MACH_SUN8I
++      default y
+       depends on MACH_SUN8I || COMPILE_TEST
+ config SUN8I_A83T_CCU
+       tristate "Support for the Allwinner A83T CCU"
+-      default MACH_SUN8I
++      default y
+       depends on MACH_SUN8I || COMPILE_TEST
+ config SUN8I_H3_CCU
+       tristate "Support for the Allwinner H3 CCU"
+-      default MACH_SUN8I || (ARM64 && ARCH_SUNXI)
+-      depends on MACH_SUN8I || (ARM64 && ARCH_SUNXI) || COMPILE_TEST
++      default y
++      depends on MACH_SUN8I || ARM64 || COMPILE_TEST
+ config SUN8I_V3S_CCU
+       tristate "Support for the Allwinner V3s CCU"
+-      default MACH_SUN8I
++      default y
+       depends on MACH_SUN8I || COMPILE_TEST
+ config SUN8I_DE2_CCU
+       tristate "Support for the Allwinner SoCs DE2 CCU"
+-      default MACH_SUN8I || (ARM64 && ARCH_SUNXI)
++      default y
++      depends on MACH_SUN8I || ARM64 || RISCV || COMPILE_TEST
+ config SUN8I_R40_CCU
+       tristate "Support for the Allwinner R40 CCU"
+-      default MACH_SUN8I
++      default y
+       depends on MACH_SUN8I || COMPILE_TEST
+ config SUN9I_A80_CCU
+       tristate "Support for the Allwinner A80 CCU"
+-      default MACH_SUN9I
++      default y
+       depends on MACH_SUN9I || COMPILE_TEST
+ config SUN8I_R_CCU
+       tristate "Support for Allwinner SoCs' PRCM CCUs"
+-      default MACH_SUN8I || (ARCH_SUNXI && ARM64)
++      default y
++      depends on MACH_SUN8I || ARM64 || COMPILE_TEST
+ endif
+diff --git a/drivers/clk/sunxi-ng/ccu-sun20i-d1.c b/drivers/clk/sunxi-ng/ccu-sun20i-d1.c
+index 8ef3cdeb7962..48a8fb2c43b7 100644
+--- a/drivers/clk/sunxi-ng/ccu-sun20i-d1.c
++++ b/drivers/clk/sunxi-ng/ccu-sun20i-d1.c
+@@ -240,7 +240,7 @@ static const struct clk_parent_data cpux_parents[] = {
+       { .hw = &pll_periph0_800M_clk.common.hw },
+ };
+ static SUNXI_CCU_MUX_DATA(cpux_clk, "cpux", cpux_parents,
+-                        0x500, 24, 3, CLK_SET_RATE_PARENT);
++                        0x500, 24, 3, CLK_SET_RATE_PARENT | CLK_IS_CRITICAL);
+ static const struct clk_hw *cpux_hws[] = { &cpux_clk.common.hw };
+ static SUNXI_CCU_M_HWS(cpux_axi_clk, "cpux-axi",
+@@ -469,6 +469,11 @@ static SUNXI_CCU_GATE_HWS(bus_i2c2_clk, "bus-i2c2", apb1_hws,
+ static SUNXI_CCU_GATE_HWS(bus_i2c3_clk, "bus-i2c3", apb1_hws,
+                         0x91c, BIT(3), 0);
++static SUNXI_CCU_GATE_HWS(bus_can0_clk, "bus-can0", apb1_hws,
++                        0x92c, BIT(0), 0);
++static SUNXI_CCU_GATE_HWS(bus_can1_clk, "bus-can1", apb1_hws,
++                        0x92c, BIT(1), 0);
++
+ static const struct clk_parent_data spi_parents[] = {
+       { .fw_name = "hosc" },
+       { .hw = &pll_periph0_clk.hw },
+@@ -997,6 +1002,8 @@ static struct ccu_common *sun20i_d1_ccu_clks[] = {
+       &bus_i2c1_clk.common,
+       &bus_i2c2_clk.common,
+       &bus_i2c3_clk.common,
++      &bus_can0_clk.common,
++      &bus_can1_clk.common,
+       &spi0_clk.common,
+       &spi1_clk.common,
+       &bus_spi0_clk.common,
+@@ -1147,6 +1154,8 @@ static struct clk_hw_onecell_data sun20i_d1_hw_clks = {
+               [CLK_BUS_I2C1]          = &bus_i2c1_clk.common.hw,
+               [CLK_BUS_I2C2]          = &bus_i2c2_clk.common.hw,
+               [CLK_BUS_I2C3]          = &bus_i2c3_clk.common.hw,
++              [CLK_BUS_CAN0]          = &bus_can0_clk.common.hw,
++              [CLK_BUS_CAN1]          = &bus_can1_clk.common.hw,
+               [CLK_SPI0]              = &spi0_clk.common.hw,
+               [CLK_SPI1]              = &spi1_clk.common.hw,
+               [CLK_BUS_SPI0]          = &bus_spi0_clk.common.hw,
+@@ -1252,6 +1261,8 @@ static struct ccu_reset_map sun20i_d1_ccu_resets[] = {
+       [RST_BUS_I2C1]          = { 0x91c, BIT(17) },
+       [RST_BUS_I2C2]          = { 0x91c, BIT(18) },
+       [RST_BUS_I2C3]          = { 0x91c, BIT(19) },
++      [RST_BUS_CAN0]          = { 0x92c, BIT(16) },
++      [RST_BUS_CAN1]          = { 0x92c, BIT(17) },
+       [RST_BUS_SPI0]          = { 0x96c, BIT(16) },
+       [RST_BUS_SPI1]          = { 0x96c, BIT(17) },
+       [RST_BUS_EMAC]          = { 0x97c, BIT(16) },
+diff --git a/drivers/clk/sunxi-ng/ccu-sun20i-d1.h b/drivers/clk/sunxi-ng/ccu-sun20i-d1.h
+index e303176f0d4e..b14da36e2537 100644
+--- a/drivers/clk/sunxi-ng/ccu-sun20i-d1.h
++++ b/drivers/clk/sunxi-ng/ccu-sun20i-d1.h
+@@ -10,6 +10,6 @@
+ #include <dt-bindings/clock/sun20i-d1-ccu.h>
+ #include <dt-bindings/reset/sun20i-d1-ccu.h>
+-#define CLK_NUMBER            (CLK_FANOUT2 + 1)
++#define CLK_NUMBER            (CLK_BUS_CAN1 + 1)
+ #endif /* _CCU_SUN20I_D1_H_ */
+diff --git a/include/dt-bindings/clock/sun20i-d1-ccu.h b/include/dt-bindings/clock/sun20i-d1-ccu.h
+index e3ac53315e1a..e143b9929763 100644
+--- a/include/dt-bindings/clock/sun20i-d1-ccu.h
++++ b/include/dt-bindings/clock/sun20i-d1-ccu.h
+@@ -152,5 +152,7 @@
+ #define CLK_FANOUT0           142
+ #define CLK_FANOUT1           143
+ #define CLK_FANOUT2           144
++#define CLK_BUS_CAN0          145
++#define CLK_BUS_CAN1          146
+ #endif /* _DT_BINDINGS_CLK_SUN20I_D1_CCU_H_ */
+diff --git a/include/dt-bindings/reset/sun20i-d1-ccu.h b/include/dt-bindings/reset/sun20i-d1-ccu.h
+index de9ff5203239..f8001cf50bf1 100644
+--- a/include/dt-bindings/reset/sun20i-d1-ccu.h
++++ b/include/dt-bindings/reset/sun20i-d1-ccu.h
+@@ -73,5 +73,7 @@
+ #define RST_BUS_DSP_CFG               63
+ #define RST_BUS_DSP_DBG               64
+ #define RST_BUS_RISCV_CFG     65
++#define RST_BUS_CAN0          66
++#define RST_BUS_CAN1          67
+ #endif /* _DT_BINDINGS_RST_SUN20I_D1_CCU_H_ */
+-- 
+2.20.1
+
diff --git a/target/linux/sunxi/patches-6.1/0003-dts-add-riscv-include-prefix-link.patch b/target/linux/sunxi/patches-6.1/0003-dts-add-riscv-include-prefix-link.patch
new file mode 100644 (file)
index 0000000..f353002
--- /dev/null
@@ -0,0 +1,30 @@
+From 7d33648daa3c0b7366ac2c4c4551680e4283e2cc Mon Sep 17 00:00:00 2001
+From: Andre Przywara <andre.przywara@arm.com>
+Date: Mon, 20 Mar 2023 00:52:46 +0000
+Subject: [PATCH 3/9] dts: add riscv include prefix link
+
+The Allwinner D1/D1s SoCs (with a RISC-V core) use an (almost?) identical
+die as their R528/T113-s siblings with ARM Cortex-A7 cores.
+
+To allow sharing the basic SoC .dtsi files across those two
+architectures as well, introduce a symlink to the RISC-V DT directory.
+
+Signed-off-by: Andre Przywara <andre.przywara@arm.com>
+Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
+Acked-by: Palmer Dabbelt <palmer@rivosinc.com>
+---
+ scripts/dtc/include-prefixes/riscv | 1 +
+ 1 file changed, 1 insertion(+)
+ create mode 120000 scripts/dtc/include-prefixes/riscv
+
+diff --git a/scripts/dtc/include-prefixes/riscv b/scripts/dtc/include-prefixes/riscv
+new file mode 120000
+index 000000000000..202509418938
+--- /dev/null
++++ b/scripts/dtc/include-prefixes/riscv
+@@ -0,0 +1 @@
++../../../arch/riscv/boot/dts
+\ No newline at end of file
+-- 
+2.20.1
+
diff --git a/target/linux/sunxi/patches-6.1/0004-ARM-dts-sunxi-add-Allwinner-T113-s-SoC-.dtsi.patch b/target/linux/sunxi/patches-6.1/0004-ARM-dts-sunxi-add-Allwinner-T113-s-SoC-.dtsi.patch
new file mode 100644 (file)
index 0000000..2d6d8d6
--- /dev/null
@@ -0,0 +1,88 @@
+From 8a17ab8278f2eadb73f2c58aaee006133312f412 Mon Sep 17 00:00:00 2001
+From: Andre Przywara <andre.przywara@arm.com>
+Date: Mon, 20 Mar 2023 00:52:47 +0000
+Subject: [PATCH 4/9] ARM: dts: sunxi: add Allwinner T113-s SoC .dtsi
+
+The Allwinner T113-s SoC is apparently using the same (or at least a very
+similar) die as the D1/D1s, but replaces the single RISC-V core with
+two Arm Cortex-A7 cores.
+Since the D1 core .dtsi already describes all common peripherals, we
+just need a DT describing the ARM specific peripherals: the CPU cores,
+the Generic Timer, the GIC and the PMU.
+We include the core .dtsi directly from the riscv DT directory.
+
+Signed-off-by: Andre Przywara <andre.przywara@arm.com>
+Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
+---
+ arch/arm/boot/dts/sun8i-t113s.dtsi | 59 ++++++++++++++++++++++++++++++
+ 1 file changed, 59 insertions(+)
+ create mode 100644 arch/arm/boot/dts/sun8i-t113s.dtsi
+
+diff --git a/arch/arm/boot/dts/sun8i-t113s.dtsi b/arch/arm/boot/dts/sun8i-t113s.dtsi
+new file mode 100644
+index 000000000000..804aa197a24f
+--- /dev/null
++++ b/arch/arm/boot/dts/sun8i-t113s.dtsi
+@@ -0,0 +1,59 @@
++// SPDX-License-Identifier: (GPL-2.0+ or MIT)
++// Copyright (C) 2022 Arm Ltd.
++
++#define SOC_PERIPHERAL_IRQ(nr) GIC_SPI nr
++
++#include <dt-bindings/interrupt-controller/arm-gic.h>
++#include <riscv/allwinner/sunxi-d1s-t113.dtsi>
++#include <riscv/allwinner/sunxi-d1-t113.dtsi>
++
++/ {
++      interrupt-parent = <&gic>;
++
++      cpus {
++              #address-cells = <1>;
++              #size-cells = <0>;
++
++              cpu0: cpu@0 {
++                      compatible = "arm,cortex-a7";
++                      device_type = "cpu";
++                      reg = <0>;
++                      clocks = <&ccu CLK_CPUX>;
++                      clock-names = "cpu";
++              };
++
++              cpu1: cpu@1 {
++                      compatible = "arm,cortex-a7";
++                      device_type = "cpu";
++                      reg = <1>;
++                      clocks = <&ccu CLK_CPUX>;
++                      clock-names = "cpu";
++              };
++      };
++
++      gic: interrupt-controller@1c81000 {
++              compatible = "arm,gic-400";
++              reg = <0x03021000 0x1000>,
++                    <0x03022000 0x2000>,
++                    <0x03024000 0x2000>,
++                    <0x03026000 0x2000>;
++              interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
++              interrupt-controller;
++              #interrupt-cells = <3>;
++      };
++
++      timer {
++              compatible = "arm,armv7-timer";
++              interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
++                           <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
++                           <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
++                           <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
++      };
++
++      pmu {
++              compatible = "arm,cortex-a7-pmu";
++              interrupts = <GIC_SPI 172 IRQ_TYPE_LEVEL_HIGH>,
++                           <GIC_SPI 173 IRQ_TYPE_LEVEL_HIGH>;
++              interrupt-affinity = <&cpu0>, <&cpu1>;
++      };
++};
+-- 
+2.20.1
+
diff --git a/target/linux/sunxi/patches-6.1/0005-dt-bindings-arm-sunxi-document-MangoPi-MQ-R-board-na.patch b/target/linux/sunxi/patches-6.1/0005-dt-bindings-arm-sunxi-document-MangoPi-MQ-R-board-na.patch
new file mode 100644 (file)
index 0000000..2f7407e
--- /dev/null
@@ -0,0 +1,54 @@
+From 9881216d2e779d11cddc36c692c5bf7b93d110c9 Mon Sep 17 00:00:00 2001
+From: Andre Przywara <andre.przywara@arm.com>
+Date: Mon, 20 Mar 2023 00:52:48 +0000
+Subject: [PATCH 5/9] dt-bindings: arm: sunxi: document MangoPi MQ-R board
+ names
+
+The MangoPi MQ-R board is a small development board, using Allwinner
+SoCs with co-packaged DRAM. There are versions with a RISC-V core and
+ones with two Arm Cortex-A7 cores.
+
+Add the board/SoC compatible string pair to the list of known boards.
+
+Signed-off-by: Andre Przywara <andre.przywara@arm.com>
+Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
+---
+ Documentation/devicetree/bindings/arm/sunxi.yaml   | 5 +++++
+ Documentation/devicetree/bindings/riscv/sunxi.yaml | 5 +++++
+ 2 files changed, 10 insertions(+)
+
+diff --git a/Documentation/devicetree/bindings/arm/sunxi.yaml b/Documentation/devicetree/bindings/arm/sunxi.yaml
+index 3ad1cd50e3fe..1a2d728234b1 100644
+--- a/Documentation/devicetree/bindings/arm/sunxi.yaml
++++ b/Documentation/devicetree/bindings/arm/sunxi.yaml
+@@ -843,6 +843,11 @@ properties:
+           - const: wexler,tab7200
+           - const: allwinner,sun7i-a20
++      - description: MangoPi MQ-R board
++        items:
++          - const: widora,mangopi-mq-r-t113
++          - const: allwinner,sun8i-t113s
++
+       - description: WITS A31 Colombus Evaluation Board
+         items:
+           - const: wits,colombus
+diff --git a/Documentation/devicetree/bindings/riscv/sunxi.yaml b/Documentation/devicetree/bindings/riscv/sunxi.yaml
+index 9edb5e5992b1..b36e313e13a6 100644
+--- a/Documentation/devicetree/bindings/riscv/sunxi.yaml
++++ b/Documentation/devicetree/bindings/riscv/sunxi.yaml
+@@ -64,6 +64,11 @@ properties:
+           - const: widora,mangopi-mq-pro
+           - const: allwinner,sun20i-d1
++      - description: MangoPi MQ-R board
++        items:
++          - const: widora,mangopi-mq-r-f133
++          - const: allwinner,sun20i-d1s
++
+ additionalProperties: true
+ ...
+-- 
+2.20.1
+
diff --git a/target/linux/sunxi/patches-6.1/0006-ARM-dts-sunxi-add-MangoPi-MQ-R-T113-board.patch b/target/linux/sunxi/patches-6.1/0006-ARM-dts-sunxi-add-MangoPi-MQ-R-T113-board.patch
new file mode 100644 (file)
index 0000000..50fb10d
--- /dev/null
@@ -0,0 +1,214 @@
+From ef2a6caed0f55cc4680ce3255b414e9aebadaaeb Mon Sep 17 00:00:00 2001
+From: Andre Przywara <andre.przywara@arm.com>
+Date: Mon, 20 Mar 2023 00:52:49 +0000
+Subject: [PATCH 6/9] ARM: dts: sunxi: add MangoPi MQ-R-T113 board
+
+The MangoPi MQ-R-T113 is a small SBC with the Allwinner T113-s3 SoC.
+The SoC features two Arm Cortex-A7 cores and 128 MB of co-packaged DDR3
+DRAM. The board adds mostly connectors and the required regulators, plus
+a Realtek RTL8189FTV WiFi chip.
+Power comes in via a USB-C connector wired as a peripheral, and there is
+a second USB-C connector usable as a host port.
+
+Add a .dtsi file describing most of the board's peripherals, and include
+that from the actual board .dts file. This allows to re-use the .dtsi
+for the MQ-R-F113 RISC-V variant of that board.
+
+Signed-off-by: Andre Przywara <andre.przywara@arm.com>
+Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
+---
+ arch/arm/boot/dts/Makefile                    |   1 +
+ .../dts/sun8i-t113s-mangopi-mq-r-t113.dts     |  35 +++++
+ .../boot/dts/sunxi-d1s-t113-mangopi-mq-r.dtsi | 126 ++++++++++++++++++
+ 3 files changed, 162 insertions(+)
+ create mode 100644 arch/arm/boot/dts/sun8i-t113s-mangopi-mq-r-t113.dts
+ create mode 100644 arch/arm/boot/dts/sunxi-d1s-t113-mangopi-mq-r.dtsi
+
+diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
+index 6aa7dc4db2fc..d49c7c3bc9a4 100644
+--- a/arch/arm/boot/dts/Makefile
++++ b/arch/arm/boot/dts/Makefile
+@@ -1382,6 +1382,7 @@ dtb-$(CONFIG_MACH_SUN8I) += \
+       sun8i-s3-elimo-initium.dtb \
+       sun8i-s3-lichee-zero-plus.dtb \
+       sun8i-s3-pinecube.dtb \
++      sun8i-t113s-mangopi-mq-r-t113.dtb \
+       sun8i-t3-cqa3t-bv3.dtb \
+       sun8i-v3-sl631-imx179.dtb \
+       sun8i-v3s-licheepi-zero.dtb \
+diff --git a/arch/arm/boot/dts/sun8i-t113s-mangopi-mq-r-t113.dts b/arch/arm/boot/dts/sun8i-t113s-mangopi-mq-r-t113.dts
+new file mode 100644
+index 000000000000..94e24b5926dd
+--- /dev/null
++++ b/arch/arm/boot/dts/sun8i-t113s-mangopi-mq-r-t113.dts
+@@ -0,0 +1,35 @@
++// SPDX-License-Identifier: (GPL-2.0+ or MIT)
++// Copyright (C) 2022 Arm Ltd.
++
++#include <dt-bindings/interrupt-controller/irq.h>
++
++/dts-v1/;
++
++#include "sun8i-t113s.dtsi"
++#include "sunxi-d1s-t113-mangopi-mq-r.dtsi"
++
++/ {
++      model = "MangoPi MQ-R-T113";
++      compatible = "widora,mangopi-mq-r-t113", "allwinner,sun8i-t113s";
++
++      aliases {
++              ethernet0 = &rtl8189ftv;
++      };
++};
++
++&cpu0 {
++      cpu-supply = <&reg_vcc_core>;
++};
++
++&cpu1 {
++      cpu-supply = <&reg_vcc_core>;
++};
++
++&mmc1 {
++      rtl8189ftv: wifi@1 {
++              reg = <1>;
++              interrupt-parent = <&pio>;
++              interrupts = <6 10 IRQ_TYPE_LEVEL_LOW>; /* PG10 = WL_WAKE_AP */
++              interrupt-names = "host-wake";
++      };
++};
+diff --git a/arch/arm/boot/dts/sunxi-d1s-t113-mangopi-mq-r.dtsi b/arch/arm/boot/dts/sunxi-d1s-t113-mangopi-mq-r.dtsi
+new file mode 100644
+index 000000000000..e9bc749488bb
+--- /dev/null
++++ b/arch/arm/boot/dts/sunxi-d1s-t113-mangopi-mq-r.dtsi
+@@ -0,0 +1,126 @@
++// SPDX-License-Identifier: (GPL-2.0+ or MIT)
++// Copyright (C) 2022 Arm Ltd.
++/*
++ * Common peripherals and configurations for MangoPi MQ-R boards.
++ */
++
++#include <dt-bindings/gpio/gpio.h>
++#include <dt-bindings/leds/common.h>
++
++/ {
++      aliases {
++              serial3 = &uart3;
++      };
++
++      chosen {
++              stdout-path = "serial3:115200n8";
++      };
++
++      leds {
++              compatible = "gpio-leds";
++
++              led-0 {
++                      color = <LED_COLOR_ID_BLUE>;
++                      function = LED_FUNCTION_STATUS;
++                      gpios = <&pio 3 22 GPIO_ACTIVE_LOW>; /* PD22 */
++              };
++      };
++
++      /* 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>;
++      };
++
++      wifi_pwrseq: wifi-pwrseq {
++              compatible = "mmc-pwrseq-simple";
++              reset-gpios = <&pio 6 12 GPIO_ACTIVE_LOW>; /* PG12 */
++      };
++};
++
++&dcxo {
++      clock-frequency = <24000000>;
++};
++
++&ehci1 {
++      status = "okay";
++};
++
++&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";
++};
++
++&mmc1 {
++      pinctrl-0 = <&mmc1_pins>;
++      pinctrl-names = "default";
++      vmmc-supply = <&reg_3v3>;
++      non-removable;
++      bus-width = <4>;
++      mmc-pwrseq = <&wifi_pwrseq>;
++      status = "okay";
++};
++
++&ohci1 {
++      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 {
++      pinctrl-names = "default";
++      pinctrl-0 = <&uart3_pb_pins>;
++      status = "okay";
++};
++
++/* The USB-C socket has its CC pins pulled to GND, so is hardwired as a UFP. */
++&usb_otg {
++      dr_mode = "peripheral";
++      status = "okay";
++};
++
++&usbphy {
++      usb1_vbus-supply = <&reg_vcc5v>;
++      status = "okay";
++};
+-- 
+2.20.1
+
diff --git a/target/linux/sunxi/patches-6.1/0007-dt-bindings-spi-sun6i-add-DT-bindings-for-Allwinner-.patch b/target/linux/sunxi/patches-6.1/0007-dt-bindings-spi-sun6i-add-DT-bindings-for-Allwinner-.patch
new file mode 100644 (file)
index 0000000..1754d19
--- /dev/null
@@ -0,0 +1,333 @@
+From 160cc587decac38e0f28f1583412a987a70450e9 Mon Sep 17 00:00:00 2001
+From: Maksim Kiselev <bigunclemax@gmail.com>
+Date: Wed, 10 May 2023 11:11:08 +0300
+Subject: [PATCH 7/9] dt-bindings: spi: sun6i: add DT bindings for Allwinner
+ R329/D1/R528/T113s SPI
+
+Listed above Allwinner SoCs has two SPI controllers. First is the regular
+SPI controller and the second one has additional functionality for
+MIPI-DBI Type C.
+
+Add compatible strings for these controllers
+
+Signed-off-by: Maksim Kiselev <bigunclemax@gmail.com>
+Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
+Reviewed-by: Andre Przywara <andre.przywara@arm.com>
+Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
+---
+ .../bindings/spi/allwinner,sun6i-a31-spi.yaml |  10 ++
+ .../boot/dts/allwinner/sunxi-d1s-t113.dtsi    |  37 +++++
+ drivers/spi/spi-sun6i.c                       | 131 ++++++++++++------
+ 3 files changed, 138 insertions(+), 40 deletions(-)
+
+diff --git a/Documentation/devicetree/bindings/spi/allwinner,sun6i-a31-spi.yaml b/Documentation/devicetree/bindings/spi/allwinner,sun6i-a31-spi.yaml
+index 58b7056f4a70..95939684a00d 100644
+--- a/Documentation/devicetree/bindings/spi/allwinner,sun6i-a31-spi.yaml
++++ b/Documentation/devicetree/bindings/spi/allwinner,sun6i-a31-spi.yaml
+@@ -19,6 +19,7 @@ properties:
+   compatible:
+     oneOf:
++      - const: allwinner,sun50i-r329-spi
+       - const: allwinner,sun6i-a31-spi
+       - const: allwinner,sun8i-h3-spi
+       - items:
+@@ -28,6 +29,15 @@ properties:
+               - allwinner,sun50i-h616-spi
+               - allwinner,suniv-f1c100s-spi
+           - const: allwinner,sun8i-h3-spi
++      - items:
++          - enum:
++              - allwinner,sun20i-d1-spi
++              - allwinner,sun50i-r329-spi-dbi
++          - const: allwinner,sun50i-r329-spi
++      - items:
++          - const: allwinner,sun20i-d1-spi-dbi
++          - const: allwinner,sun50i-r329-spi-dbi
++          - const: allwinner,sun50i-r329-spi
+   reg:
+     maxItems: 1
+diff --git a/arch/riscv/boot/dts/allwinner/sunxi-d1s-t113.dtsi b/arch/riscv/boot/dts/allwinner/sunxi-d1s-t113.dtsi
+index 3723612b1fd8..6efff8f41e00 100644
+--- a/arch/riscv/boot/dts/allwinner/sunxi-d1s-t113.dtsi
++++ b/arch/riscv/boot/dts/allwinner/sunxi-d1s-t113.dtsi
+@@ -108,6 +108,12 @@
+                               function = "emac";
+                       };
++                      /omit-if-no-ref/
++                      spi0_pins: spi0-pins {
++                              pins = "PC2", "PC3", "PC4", "PC5";
++                              function = "spi0";
++                      };
++
+                       /omit-if-no-ref/
+                       uart1_pg6_pins: uart1-pg6-pins {
+                               pins = "PG6", "PG7";
+@@ -435,6 +441,37 @@
+                       #size-cells = <0>;
+               };
++              spi0: spi@4025000 {
++                      compatible = "allwinner,sun20i-d1-spi",
++                                   "allwinner,sun50i-r329-spi";
++                      reg = <0x04025000 0x1000>;
++                      interrupts = <SOC_PERIPHERAL_IRQ(15) IRQ_TYPE_LEVEL_HIGH>;
++                      clocks = <&ccu CLK_BUS_SPI0>, <&ccu CLK_SPI0>;
++                      clock-names = "ahb", "mod";
++                      dmas = <&dma 22>, <&dma 22>;
++                      dma-names = "rx", "tx";
++                      resets = <&ccu RST_BUS_SPI0>;
++                      status = "disabled";
++                      #address-cells = <1>;
++                      #size-cells = <0>;
++              };
++
++              spi1: spi@4026000 {
++                      compatible = "allwinner,sun20i-d1-spi-dbi",
++                                   "allwinner,sun50i-r329-spi-dbi",
++                                   "allwinner,sun50i-r329-spi";
++                      reg = <0x04026000 0x1000>;
++                      interrupts = <SOC_PERIPHERAL_IRQ(16) IRQ_TYPE_LEVEL_HIGH>;
++                      clocks = <&ccu CLK_BUS_SPI1>, <&ccu CLK_SPI1>;
++                      clock-names = "ahb", "mod";
++                      dmas = <&dma 23>, <&dma 23>;
++                      dma-names = "rx", "tx";
++                      resets = <&ccu RST_BUS_SPI1>;
++                      status = "disabled";
++                      #address-cells = <1>;
++                      #size-cells = <0>;
++              };
++
+               usb_otg: usb@4100000 {
+                       compatible = "allwinner,sun20i-d1-musb",
+                                    "allwinner,sun8i-a33-musb";
+diff --git a/drivers/spi/spi-sun6i.c b/drivers/spi/spi-sun6i.c
+index 23ad052528db..4f32cd99a81e 100644
+--- a/drivers/spi/spi-sun6i.c
++++ b/drivers/spi/spi-sun6i.c
+@@ -42,7 +42,9 @@
+ #define SUN6I_TFR_CTL_CS_MANUAL                       BIT(6)
+ #define SUN6I_TFR_CTL_CS_LEVEL                        BIT(7)
+ #define SUN6I_TFR_CTL_DHB                     BIT(8)
++#define SUN6I_TFR_CTL_SDC                     BIT(11)
+ #define SUN6I_TFR_CTL_FBS                     BIT(12)
++#define SUN6I_TFR_CTL_SDM                     BIT(13)
+ #define SUN6I_TFR_CTL_XCH                     BIT(31)
+ #define SUN6I_INT_CTL_REG             0x10
+@@ -85,6 +87,11 @@
+ #define SUN6I_TXDATA_REG              0x200
+ #define SUN6I_RXDATA_REG              0x300
++struct sun6i_spi_cfg {
++      unsigned long           fifo_depth;
++      bool                    has_clk_ctl;
++};
++
+ struct sun6i_spi {
+       struct spi_master       *master;
+       void __iomem            *base_addr;
+@@ -99,7 +106,7 @@ struct sun6i_spi {
+       const u8                *tx_buf;
+       u8                      *rx_buf;
+       int                     len;
+-      unsigned long           fifo_depth;
++      const struct sun6i_spi_cfg *cfg;
+ };
+ static inline u32 sun6i_spi_read(struct sun6i_spi *sspi, u32 reg)
+@@ -156,7 +163,7 @@ static inline void sun6i_spi_fill_fifo(struct sun6i_spi *sspi)
+       u8 byte;
+       /* See how much data we can fit */
+-      cnt = sspi->fifo_depth - sun6i_spi_get_tx_fifo_count(sspi);
++      cnt = sspi->cfg->fifo_depth - sun6i_spi_get_tx_fifo_count(sspi);
+       len = min((int)cnt, sspi->len);
+@@ -256,7 +263,7 @@ static int sun6i_spi_transfer_one(struct spi_master *master,
+                                 struct spi_transfer *tfr)
+ {
+       struct sun6i_spi *sspi = spi_master_get_devdata(master);
+-      unsigned int mclk_rate, div, div_cdr1, div_cdr2, timeout;
++      unsigned int div, div_cdr1, div_cdr2, timeout;
+       unsigned int start, end, tx_time;
+       unsigned int trig_level;
+       unsigned int tx_len = 0, rx_len = 0;
+@@ -289,14 +296,14 @@ static int sun6i_spi_transfer_one(struct spi_master *master,
+                * the hardcoded value used in old generation of Allwinner
+                * SPI controller. (See spi-sun4i.c)
+                */
+-              trig_level = sspi->fifo_depth / 4 * 3;
++              trig_level = sspi->cfg->fifo_depth / 4 * 3;
+       } else {
+               /*
+                * Setup FIFO DMA request trigger level
+                * We choose 1/2 of the full fifo depth, that value will
+                * be used as DMA burst length.
+                */
+-              trig_level = sspi->fifo_depth / 2;
++              trig_level = sspi->cfg->fifo_depth / 2;
+               if (tfr->tx_buf)
+                       reg |= SUN6I_FIFO_CTL_TF_DRQ_EN;
+@@ -346,39 +353,65 @@ static int sun6i_spi_transfer_one(struct spi_master *master,
+       sun6i_spi_write(sspi, SUN6I_TFR_CTL_REG, reg);
+-      /* Ensure that we have a parent clock fast enough */
+-      mclk_rate = clk_get_rate(sspi->mclk);
+-      if (mclk_rate < (2 * tfr->speed_hz)) {
+-              clk_set_rate(sspi->mclk, 2 * tfr->speed_hz);
+-              mclk_rate = clk_get_rate(sspi->mclk);
+-      }
++      if (sspi->cfg->has_clk_ctl) {
++              unsigned int mclk_rate = clk_get_rate(sspi->mclk);
+-      /*
+-       * Setup clock divider.
+-       *
+-       * We have two choices there. Either we can use the clock
+-       * divide rate 1, which is calculated thanks to this formula:
+-       * SPI_CLK = MOD_CLK / (2 ^ cdr)
+-       * Or we can use CDR2, which is calculated with the formula:
+-       * SPI_CLK = MOD_CLK / (2 * (cdr + 1))
+-       * Wether we use the former or the latter is set through the
+-       * DRS bit.
+-       *
+-       * First try CDR2, and if we can't reach the expected
+-       * frequency, fall back to CDR1.
+-       */
+-      div_cdr1 = DIV_ROUND_UP(mclk_rate, tfr->speed_hz);
+-      div_cdr2 = DIV_ROUND_UP(div_cdr1, 2);
+-      if (div_cdr2 <= (SUN6I_CLK_CTL_CDR2_MASK + 1)) {
+-              reg = SUN6I_CLK_CTL_CDR2(div_cdr2 - 1) | SUN6I_CLK_CTL_DRS;
+-              tfr->effective_speed_hz = mclk_rate / (2 * div_cdr2);
++              /* Ensure that we have a parent clock fast enough */
++              if (mclk_rate < (2 * tfr->speed_hz)) {
++                      clk_set_rate(sspi->mclk, 2 * tfr->speed_hz);
++                      mclk_rate = clk_get_rate(sspi->mclk);
++              }
++
++              /*
++               * Setup clock divider.
++               *
++               * We have two choices there. Either we can use the clock
++               * divide rate 1, which is calculated thanks to this formula:
++               * SPI_CLK = MOD_CLK / (2 ^ cdr)
++               * Or we can use CDR2, which is calculated with the formula:
++               * SPI_CLK = MOD_CLK / (2 * (cdr + 1))
++               * Wether we use the former or the latter is set through the
++               * DRS bit.
++               *
++               * First try CDR2, and if we can't reach the expected
++               * frequency, fall back to CDR1.
++               */
++              div_cdr1 = DIV_ROUND_UP(mclk_rate, tfr->speed_hz);
++              div_cdr2 = DIV_ROUND_UP(div_cdr1, 2);
++              if (div_cdr2 <= (SUN6I_CLK_CTL_CDR2_MASK + 1)) {
++                      reg = SUN6I_CLK_CTL_CDR2(div_cdr2 - 1) | SUN6I_CLK_CTL_DRS;
++                      tfr->effective_speed_hz = mclk_rate / (2 * div_cdr2);
++              } else {
++                      div = min(SUN6I_CLK_CTL_CDR1_MASK, order_base_2(div_cdr1));
++                      reg = SUN6I_CLK_CTL_CDR1(div);
++                      tfr->effective_speed_hz = mclk_rate / (1 << div);
++              }
++
++              sun6i_spi_write(sspi, SUN6I_CLK_CTL_REG, reg);
+       } else {
+-              div = min(SUN6I_CLK_CTL_CDR1_MASK, order_base_2(div_cdr1));
+-              reg = SUN6I_CLK_CTL_CDR1(div);
+-              tfr->effective_speed_hz = mclk_rate / (1 << div);
++              clk_set_rate(sspi->mclk, tfr->speed_hz);
++              tfr->effective_speed_hz = clk_get_rate(sspi->mclk);
++
++              /*
++               * Configure work mode.
++               *
++               * There are three work modes depending on the controller clock
++               * frequency:
++               * - normal sample mode           : CLK <= 24MHz SDM=1 SDC=0
++               * - delay half-cycle sample mode : CLK <= 40MHz SDM=0 SDC=0
++               * - delay one-cycle sample mode  : CLK >= 80MHz SDM=0 SDC=1
++               */
++              reg = sun6i_spi_read(sspi, SUN6I_TFR_CTL_REG);
++              reg &= ~(SUN6I_TFR_CTL_SDM | SUN6I_TFR_CTL_SDC);
++
++              if (tfr->effective_speed_hz <= 24000000)
++                      reg |= SUN6I_TFR_CTL_SDM;
++              else if (tfr->effective_speed_hz >= 80000000)
++                      reg |= SUN6I_TFR_CTL_SDC;
++
++              sun6i_spi_write(sspi, SUN6I_TFR_CTL_REG, reg);
+       }
+-      sun6i_spi_write(sspi, SUN6I_CLK_CTL_REG, reg);
+       /* Finally enable the bus - doing so before might raise SCK to HIGH */
+       reg = sun6i_spi_read(sspi, SUN6I_GBL_CTL_REG);
+       reg |= SUN6I_GBL_CTL_BUS_ENABLE;
+@@ -410,9 +443,9 @@ static int sun6i_spi_transfer_one(struct spi_master *master,
+       reg = SUN6I_INT_CTL_TC;
+       if (!use_dma) {
+-              if (rx_len > sspi->fifo_depth)
++              if (rx_len > sspi->cfg->fifo_depth)
+                       reg |= SUN6I_INT_CTL_RF_RDY;
+-              if (tx_len > sspi->fifo_depth)
++              if (tx_len > sspi->cfg->fifo_depth)
+                       reg |= SUN6I_INT_CTL_TF_ERQ;
+       }
+@@ -543,7 +576,7 @@ static bool sun6i_spi_can_dma(struct spi_master *master,
+        * the fifo length we can just fill the fifo and wait for a single
+        * irq, so don't bother setting up dma
+        */
+-      return xfer->len > sspi->fifo_depth;
++      return xfer->len > sspi->cfg->fifo_depth;
+ }
+ static int sun6i_spi_probe(struct platform_device *pdev)
+@@ -582,7 +615,7 @@ static int sun6i_spi_probe(struct platform_device *pdev)
+       }
+       sspi->master = master;
+-      sspi->fifo_depth = (unsigned long)of_device_get_match_data(&pdev->dev);
++      sspi->cfg = of_device_get_match_data(&pdev->dev);
+       master->max_speed_hz = 100 * 1000 * 1000;
+       master->min_speed_hz = 3 * 1000;
+@@ -696,9 +729,27 @@ static int sun6i_spi_remove(struct platform_device *pdev)
+       return 0;
+ }
++static const struct sun6i_spi_cfg sun6i_a31_spi_cfg = {
++      .fifo_depth     = SUN6I_FIFO_DEPTH,
++      .has_clk_ctl    = true,
++};
++
++static const struct sun6i_spi_cfg sun8i_h3_spi_cfg = {
++      .fifo_depth     = SUN8I_FIFO_DEPTH,
++      .has_clk_ctl    = true,
++};
++
++static const struct sun6i_spi_cfg sun50i_r329_spi_cfg = {
++      .fifo_depth     = SUN8I_FIFO_DEPTH,
++};
++
+ static const struct of_device_id sun6i_spi_match[] = {
+-      { .compatible = "allwinner,sun6i-a31-spi", .data = (void *)SUN6I_FIFO_DEPTH },
+-      { .compatible = "allwinner,sun8i-h3-spi",  .data = (void *)SUN8I_FIFO_DEPTH },
++      { .compatible = "allwinner,sun6i-a31-spi", .data = &sun6i_a31_spi_cfg },
++      { .compatible = "allwinner,sun8i-h3-spi",  .data = &sun8i_h3_spi_cfg },
++      {
++              .compatible = "allwinner,sun50i-r329-spi",
++              .data = &sun50i_r329_spi_cfg
++      },
+       {}
+ };
+ MODULE_DEVICE_TABLE(of, sun6i_spi_match);
+-- 
+2.20.1
+
diff --git a/target/linux/sunxi/patches-6.1/0008-ARM-dts-riscv-add-uart0_pins-on-Port-E-pins.patch b/target/linux/sunxi/patches-6.1/0008-ARM-dts-riscv-add-uart0_pins-on-Port-E-pins.patch
new file mode 100644 (file)
index 0000000..173ffea
--- /dev/null
@@ -0,0 +1,30 @@
+From ad14f88ba1b019e8cb26b77688188399557f96c3 Mon Sep 17 00:00:00 2001
+From: Zoltan HERPAI <wigyori@uid0.hu>
+Date: Sun, 4 Jun 2023 16:46:05 +0200
+Subject: [PATCH 8/9] ARM: dts: riscv: add uart0_pins on Port E pins
+
+Signed-off-by: Zoltan HERPAI <wigyori@uid0.hu>
+---
+ arch/riscv/boot/dts/allwinner/sunxi-d1s-t113.dtsi | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/arch/riscv/boot/dts/allwinner/sunxi-d1s-t113.dtsi b/arch/riscv/boot/dts/allwinner/sunxi-d1s-t113.dtsi
+index 6efff8f41e00..176d0d4a0124 100644
+--- a/arch/riscv/boot/dts/allwinner/sunxi-d1s-t113.dtsi
++++ b/arch/riscv/boot/dts/allwinner/sunxi-d1s-t113.dtsi
+@@ -131,6 +131,12 @@
+                               pins = "PB6", "PB7";
+                               function = "uart3";
+                       };
++
++                      /omit-if-no-ref/
++                      uart0_pins: uart0-pins {
++                              pins = "PE2", "PE3";
++                              function = "uart0";
++                      };
+               };
+               ccu: clock-controller@2001000 {
+-- 
+2.20.1
+
diff --git a/target/linux/sunxi/patches-6.1/0009-ARM-dts-sunxi-add-support-for-MangoPI-MQDual-T113-va.patch b/target/linux/sunxi/patches-6.1/0009-ARM-dts-sunxi-add-support-for-MangoPI-MQDual-T113-va.patch
new file mode 100644 (file)
index 0000000..ed035fd
--- /dev/null
@@ -0,0 +1,84 @@
+From 86e8afcc2fa8c1a4db2e063f4d6bb4812a53d2aa Mon Sep 17 00:00:00 2001
+From: Zoltan HERPAI <wigyori@uid0.hu>
+Date: Sun, 4 Jun 2023 16:46:43 +0200
+Subject: [PATCH 9/9] ARM: dts: sunxi: add support for MangoPI MQDual T113
+ variant
+
+Signed-off-by: Zoltan HERPAI <wigyori@uid0.hu>
+---
+ arch/arm/boot/dts/Makefile                    |  1 +
+ .../dts/sun8i-t113s-mangopi-mqdual-t113.dts   | 50 +++++++++++++++++++
+ 2 files changed, 51 insertions(+)
+ create mode 100644 arch/arm/boot/dts/sun8i-t113s-mangopi-mqdual-t113.dts
+
+diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
+index d49c7c3bc9a4..b9f593d52f4b 100644
+--- a/arch/arm/boot/dts/Makefile
++++ b/arch/arm/boot/dts/Makefile
+@@ -1383,6 +1383,7 @@ dtb-$(CONFIG_MACH_SUN8I) += \
+       sun8i-s3-lichee-zero-plus.dtb \
+       sun8i-s3-pinecube.dtb \
+       sun8i-t113s-mangopi-mq-r-t113.dtb \
++      sun8i-t113s-mangopi-mqdual-t113.dtb \
+       sun8i-t3-cqa3t-bv3.dtb \
+       sun8i-v3-sl631-imx179.dtb \
+       sun8i-v3s-licheepi-zero.dtb \
+diff --git a/arch/arm/boot/dts/sun8i-t113s-mangopi-mqdual-t113.dts b/arch/arm/boot/dts/sun8i-t113s-mangopi-mqdual-t113.dts
+new file mode 100644
+index 000000000000..7de3ddb92fe1
+--- /dev/null
++++ b/arch/arm/boot/dts/sun8i-t113s-mangopi-mqdual-t113.dts
+@@ -0,0 +1,50 @@
++// SPDX-License-Identifier: (GPL-2.0+ or MIT)
++// Copyright (C) 2022 Arm Ltd.
++
++#include <dt-bindings/interrupt-controller/irq.h>
++
++/dts-v1/;
++
++#include "sun8i-t113s.dtsi"
++#include "sunxi-d1s-t113-mangopi-mq-r.dtsi"
++
++/ {
++      model = "MangoPi MQDual T113";
++      compatible = "widora,mangopi-mqdual-t113", "allwinner,sun8i-t113s";
++
++      aliases {
++              serial0 = &uart0;
++              ethernet0 = &rtl8189ftv;
++      };
++
++      chosen {
++              stdout-path = "serial0:115200n8";
++      };
++};
++
++&cpu0 {
++      cpu-supply = <&reg_vcc_core>;
++};
++
++&cpu1 {
++      cpu-supply = <&reg_vcc_core>;
++};
++
++&mmc1 {
++      rtl8189ftv: wifi@1 {
++              reg = <1>;
++              interrupt-parent = <&pio>;
++              interrupts = <6 10 IRQ_TYPE_LEVEL_LOW>; /* PG10 = WL_WAKE_AP */
++              interrupt-names = "host-wake";
++      };
++};
++
++&uart0 {
++      pinctrl-names = "default";
++      pinctrl-0 = <&uart0_pins>;
++      status = "okay";
++};
++
++&uart3 {
++      status = "disabled";
++};
+-- 
+2.20.1
+