2023-03-20 00:53:11

by Andre Przywara

[permalink] [raw]
Subject: [PATCH v2 0/4] ARM: dts: sunxi: Add MangoPi MQ-R board support

Hi,

this is v2, mostly acknowledging the fact that there is an Allwinner D1s
version of the board as well, thus splitting the board .dts into a
shared .dtsi and a stub .dts for the ARM version. I don't have the RISC-V
version, so cannot provide (nor test) this .dts file, but creation should
be easy, being based on the shared board .dtsi file.
Since the D1/D1s .dts files are now merged, this patch set should compile
cleanly now.

======================================

The MangoPi MQ-R-T113 is a small SBC with the Allwinner T113-s3 SoC.
That is a very close relative to the Allwinner D1/D1s SoCs, but with
Arm Cortex-A7 cores, and 128 MB of SIP co-packaged DDR3 DRAM.

This series introduces the missing T113-s .dtsi, which builds on top of
the D1/D1s .dtsi, but adds the ARM specific peripherals, like the CPU
cores, the arch timer, the GIC and the PMU.
This requires to add a symlink to the RISC-V DT directory in patch 1/4,
to be able to easily reference the base .dtsi from other architecture
directories.
Since there are versions of the MQ-R boards with the Allwinner D1s,
there is shared .dtsi describing the board peripherals, plus a small
stub .dts to tie together all bits for the actual board.

Cheers,
Andre

Changelog v1 ... v2:
- rebase on top of v6.3-rc3 (including now merged D1/D1s .dtsi files)
- refine board naming, stating both RISC-V and ARM versions
- move board .dts into a shared .dtsi (to cover RISC-V version)
- fix 5V regulator node name

Andre Przywara (4):
dts: add riscv include prefix link
ARM: dts: sunxi: add Allwinner T113-s SoC .dtsi
dt-bindings: arm: sunxi: document MangoPi MQ-R board names
ARM: dts: sunxi: add MangoPi MQ-R-T113 board

.../devicetree/bindings/arm/sunxi.yaml | 5 +
.../devicetree/bindings/riscv/sunxi.yaml | 5 +
arch/arm/boot/dts/Makefile | 1 +
.../dts/sun8i-t113s-mangopi-mq-r-t113.dts | 35 +++++
arch/arm/boot/dts/sun8i-t113s.dtsi | 59 ++++++++
.../boot/dts/sunxi-d1s-t113-mangopi-mq-r.dtsi | 126 ++++++++++++++++++
scripts/dtc/include-prefixes/riscv | 1 +
7 files changed, 232 insertions(+)
create mode 100644 arch/arm/boot/dts/sun8i-t113s-mangopi-mq-r-t113.dts
create mode 100644 arch/arm/boot/dts/sun8i-t113s.dtsi
create mode 100644 arch/arm/boot/dts/sunxi-d1s-t113-mangopi-mq-r.dtsi
create mode 120000 scripts/dtc/include-prefixes/riscv

--
2.35.7



2023-03-20 00:53:21

by Andre Przywara

[permalink] [raw]
Subject: [PATCH v2 1/4] 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 <[email protected]>
Reviewed-by: Conor Dooley <[email protected]>
Acked-by: Palmer Dabbelt <[email protected]>
---
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 0000000000000..2025094189380
--- /dev/null
+++ b/scripts/dtc/include-prefixes/riscv
@@ -0,0 +1 @@
+../../../arch/riscv/boot/dts
\ No newline at end of file
--
2.35.7


2023-03-20 00:53:28

by Andre Przywara

[permalink] [raw]
Subject: [PATCH v2 2/4] 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 <[email protected]>
---
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 0000000000000..804aa197a24f8
--- /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.35.7


2023-03-20 00:53:31

by Andre Przywara

[permalink] [raw]
Subject: [PATCH v2 3/4] 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 <[email protected]>
---
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 3ad1cd50e3fe0..1a2d728234b1e 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 9edb5e5992b19..b36e313e13a67 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.35.7


2023-03-20 00:53:51

by Andre Przywara

[permalink] [raw]
Subject: [PATCH v2 4/4] 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 <[email protected]>
---
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 efe4152e5846d..3367e24146da8 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -1397,6 +1397,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 0000000000000..94e24b5926dd7
--- /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 0000000000000..e9bc749488bb2
--- /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.35.7


2023-03-20 06:51:53

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH v2 3/4] dt-bindings: arm: sunxi: document MangoPi MQ-R board names

On 20/03/2023 01:52, Andre Przywara wrote:
> 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.
>


Acked-by: Krzysztof Kozlowski <[email protected]>

Best regards,
Krzysztof


2023-03-23 21:27:42

by Jernej Škrabec

[permalink] [raw]
Subject: Re: [PATCH v2 4/4] ARM: dts: sunxi: add MangoPi MQ-R-T113 board

Dne ponedeljek, 20. marec 2023 ob 01:52:49 CET je Andre Przywara napisal(a):
> 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 <[email protected]>

Acked-by: Jernej Skrabec <[email protected]>

Best regards,
Jernej


2023-03-23 21:28:43

by Jernej Škrabec

[permalink] [raw]
Subject: Re: [PATCH v2 2/4] ARM: dts: sunxi: add Allwinner T113-s SoC .dtsi

Dne ponedeljek, 20. marec 2023 ob 01:52:47 CET je Andre Przywara napisal(a):
> 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 <[email protected]>

Acked-by: Jernej Skrabec <[email protected]>

Best regards,
Jernej


2023-03-27 08:42:27

by Belisko Marek

[permalink] [raw]
Subject: Re: [PATCH v2 4/4] ARM: dts: sunxi: add MangoPi MQ-R-T113 board

On Mon, Mar 20, 2023 at 1:53 AM Andre Przywara <[email protected]> wrote:
>
> 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 <[email protected]>
> ---
> 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 efe4152e5846d..3367e24146da8 100644
> --- a/arch/arm/boot/dts/Makefile
> +++ b/arch/arm/boot/dts/Makefile
> @@ -1397,6 +1397,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 0000000000000..94e24b5926dd7
> --- /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>;
> +};
Tested on MQ-R-T113 Mangopi on top of 6.3-rc3 and on booted system I
have only one CPU available:

root@t113:~# cat /proc/cpuinfo
processor : 0
model name : ARMv7 Processor rev 5 (v7l)
BogoMIPS : 48.00
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4
idiva idivt vfpd32 lpae evtstrm
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xc07
CPU revision : 5

Hardware : Generic DT based system
Revision : 0000
Serial : 9340600081169098

bootlog shows:
[ 0.003515] /cpus/cpu@0 missing clock-frequency property
[ 0.003601] /cpus/cpu@1 missing clock-frequency property
[ 0.003640] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000

> +
> +&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 0000000000000..e9bc749488bb2
> --- /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.35.7
>

BR,

marek

2023-03-27 09:32:41

by Andre Przywara

[permalink] [raw]
Subject: Re: [PATCH v2 4/4] ARM: dts: sunxi: add MangoPi MQ-R-T113 board

On Mon, 27 Mar 2023 10:30:33 +0200
Belisko Marek <[email protected]> wrote:

Hi Marek,

thanks for testing!

> On Mon, Mar 20, 2023 at 1:53 AM Andre Przywara <[email protected]> wrote:
> >
> > 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 <[email protected]>
> > ---
> > 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 efe4152e5846d..3367e24146da8 100644
> > --- a/arch/arm/boot/dts/Makefile
> > +++ b/arch/arm/boot/dts/Makefile
> > @@ -1397,6 +1397,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 0000000000000..94e24b5926dd7
> > --- /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>;
> > +};
> Tested on MQ-R-T113 Mangopi on top of 6.3-rc3 and on booted system I
> have only one CPU available:

Right, thanks for the heads up. The reason is that the current U-Boot
branch does not enable PSCI services, so the kernel does not know how to
enable and online the second core. As with the other 32-bit parts, the
PSCI nodes and properties get inserted into the DT by U-Boot, at runtime:
arch/arm/lib/psci-dt.c:fdt_psci().

It should be fairly straight-forward to enable that in U-Boot, I will try
to look into this later this week.

Cheers,
Andre

> root@t113:~# cat /proc/cpuinfo
> processor : 0
> model name : ARMv7 Processor rev 5 (v7l)
> BogoMIPS : 48.00
> Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4
> idiva idivt vfpd32 lpae evtstrm
> CPU implementer : 0x41
> CPU architecture: 7
> CPU variant : 0x0
> CPU part : 0xc07
> CPU revision : 5
>
> Hardware : Generic DT based system
> Revision : 0000
> Serial : 9340600081169098
>
> bootlog shows:
> [ 0.003515] /cpus/cpu@0 missing clock-frequency property
> [ 0.003601] /cpus/cpu@1 missing clock-frequency property
> [ 0.003640] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
>
> > +
> > +&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 0000000000000..e9bc749488bb2
> > --- /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.35.7
> >
>
> BR,
>
> marek
>

2023-03-27 20:56:19

by Jernej Škrabec

[permalink] [raw]
Subject: Re: [PATCH v2 0/4] ARM: dts: sunxi: Add MangoPi MQ-R board support

Dne ponedeljek, 20. marec 2023 ob 01:52:45 CEST je Andre Przywara napisal(a):
> Hi,
>
> this is v2, mostly acknowledging the fact that there is an Allwinner D1s
> version of the board as well, thus splitting the board .dts into a
> shared .dtsi and a stub .dts for the ARM version. I don't have the RISC-V
> version, so cannot provide (nor test) this .dts file, but creation should
> be easy, being based on the shared board .dtsi file.
> Since the D1/D1s .dts files are now merged, this patch set should compile
> cleanly now.
>
> ======================================
>
> The MangoPi MQ-R-T113 is a small SBC with the Allwinner T113-s3 SoC.
> That is a very close relative to the Allwinner D1/D1s SoCs, but with
> Arm Cortex-A7 cores, and 128 MB of SIP co-packaged DDR3 DRAM.
>
> This series introduces the missing T113-s .dtsi, which builds on top of
> the D1/D1s .dtsi, but adds the ARM specific peripherals, like the CPU
> cores, the arch timer, the GIC and the PMU.
> This requires to add a symlink to the RISC-V DT directory in patch 1/4,
> to be able to easily reference the base .dtsi from other architecture
> directories.
> Since there are versions of the MQ-R boards with the Allwinner D1s,
> there is shared .dtsi describing the board peripherals, plus a small
> stub .dts to tie together all bits for the actual board.
>
> Cheers,
> Andre
>
> Changelog v1 ... v2:
> - rebase on top of v6.3-rc3 (including now merged D1/D1s .dtsi files)
> - refine board naming, stating both RISC-V and ARM versions
> - move board .dts into a shared .dtsi (to cover RISC-V version)
> - fix 5V regulator node name
>
> Andre Przywara (4):
> dts: add riscv include prefix link
> ARM: dts: sunxi: add Allwinner T113-s SoC .dtsi
> dt-bindings: arm: sunxi: document MangoPi MQ-R board names
> ARM: dts: sunxi: add MangoPi MQ-R-T113 board
>
> .../devicetree/bindings/arm/sunxi.yaml | 5 +
> .../devicetree/bindings/riscv/sunxi.yaml | 5 +
> arch/arm/boot/dts/Makefile | 1 +
> .../dts/sun8i-t113s-mangopi-mq-r-t113.dts | 35 +++++
> arch/arm/boot/dts/sun8i-t113s.dtsi | 59 ++++++++
> .../boot/dts/sunxi-d1s-t113-mangopi-mq-r.dtsi | 126 ++++++++++++++++++
> scripts/dtc/include-prefixes/riscv | 1 +
> 7 files changed, 232 insertions(+)
> create mode 100644 arch/arm/boot/dts/sun8i-t113s-mangopi-mq-r-t113.dts
> create mode 100644 arch/arm/boot/dts/sun8i-t113s.dtsi
> create mode 100644 arch/arm/boot/dts/sunxi-d1s-t113-mangopi-mq-r.dtsi
> create mode 120000 scripts/dtc/include-prefixes/riscv

Merged, thanks!

Best regards,
Jernej