2022-02-03 18:03:25

by Erwan Le Ray

[permalink] [raw]
Subject: [PATCH 00/16] STM32 configure UART nodes for DMA

Add DMA configuration to UART nodes in stm32mp15x (SOC level) and
remove it at board level to keep current PIO behavior when needed.
For stm32-ed1 and stm32-dkx boards, UART4 (console) and UART7
(no HW flow control pin available) are kept in PIO mode, while USART3
is now configured in DMA mode.
UART4 (console UART) has to be kept in irq mode, as DMA support for
console has been removed from the driver by commit e359b4411c28
("serial: stm32: fix threaded interrupt handling").

For other stm32mp15x-based boards, current configuration is kept for
all UART instances.

Erwan Le Ray (16):
ARM: dts: stm32: add DMA configuration to UART nodes on stm32mp151
ARM: dts: stm32: keep uart4 behavior on stm32mp157c-ed1
ARM: dts: stm32: keep uart4 and uart7 behavior on stm32mp15xx-dkx
ARM: dts: stm32: keep uart4 behavior on icore-stm32mp1-ctouch2
ARM: dts: stm32: keep uart4 behavior on icore-stm32mp1-edimm2.2
ARM: dts: stm32: keep uart4 behavior on stm32mp157a-iot-box
ARM: dts: stm32: keep uart nodes behavior on stm32mp1-microdev2.0-of7
ARM: dts: stm32: keep uart nodes behavior on stm32mp1-microdev2.0
ARM: dts: stm32: keep uart nodes behavior on stm32mp157a-stinger96
ARM: dts: stm32: keep uart4 behavior on stm32mp157c-lxa-mc1
ARM: dts: stm32: keep uart4 behavior on stm32mp157c-odyssey
ARM: dts: stm32: keep uart nodes behavior on stm32mp15xx-dhcom-drc02
ARM: dts: stm32: keep uart nodes behavior on stm32mp15xx-dhcom-pdk2
ARM: dts: stm32: keep uart nodes behavior on stm32mp15xx-dhcom-picoitx
ARM: dts: stm32: keep uart4 behavior on stm32mp15xx-dhcom-som
ARM: dts: stm32: keep uart nodes behavior on
stm32mp15xx-dhcor-avenger96

arch/arm/boot/dts/stm32mp151.dtsi | 21 +++++++++++++++++++
.../stm32mp157a-icore-stm32mp1-ctouch2.dts | 2 ++
.../stm32mp157a-icore-stm32mp1-edimm2.2.dts | 2 ++
arch/arm/boot/dts/stm32mp157a-iot-box.dts | 2 ++
...157a-microgea-stm32mp1-microdev2.0-of7.dts | 4 ++++
...32mp157a-microgea-stm32mp1-microdev2.0.dts | 4 ++++
arch/arm/boot/dts/stm32mp157a-stinger96.dtsi | 6 ++++++
arch/arm/boot/dts/stm32mp157c-ed1.dts | 2 ++
arch/arm/boot/dts/stm32mp157c-lxa-mc1.dts | 2 ++
arch/arm/boot/dts/stm32mp157c-odyssey.dts | 2 ++
.../arm/boot/dts/stm32mp15xx-dhcom-drc02.dtsi | 4 ++++
arch/arm/boot/dts/stm32mp15xx-dhcom-pdk2.dtsi | 4 ++++
.../boot/dts/stm32mp15xx-dhcom-picoitx.dtsi | 4 ++++
arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi | 2 ++
.../boot/dts/stm32mp15xx-dhcor-avenger96.dtsi | 6 ++++++
arch/arm/boot/dts/stm32mp15xx-dkx.dtsi | 4 ++++
16 files changed, 71 insertions(+)

--
2.17.1


2022-02-03 18:16:27

by Erwan Le Ray

[permalink] [raw]
Subject: [PATCH 03/16] ARM: dts: stm32: keep uart4 and uart7 behavior on stm32mp15xx-dkx

DMA configuration is added to uart nodes in stm32mp15x device tree.
Delete uart4 DMA property in stm32mp15xx-dkx board device tree to keep
console in irq mode, as DMA support for console has been removed from
the driver by commit e359b4411c28 ("serial: stm32: fix threaded
interrupt handling").
Delete also uart7 DMA property to keep current behavior.

Signed-off-by: Erwan Le Ray <[email protected]>

diff --git a/arch/arm/boot/dts/stm32mp15xx-dkx.dtsi b/arch/arm/boot/dts/stm32mp15xx-dkx.dtsi
index 48beed0f1f30..7443859c54c6 100644
--- a/arch/arm/boot/dts/stm32mp15xx-dkx.dtsi
+++ b/arch/arm/boot/dts/stm32mp15xx-dkx.dtsi
@@ -650,6 +650,8 @@
pinctrl-0 = <&uart4_pins_a>;
pinctrl-1 = <&uart4_sleep_pins_a>;
pinctrl-2 = <&uart4_idle_pins_a>;
+ /delete-property/dmas;
+ /delete-property/dma-names;
status = "okay";
};

@@ -658,6 +660,8 @@
pinctrl-0 = <&uart7_pins_c>;
pinctrl-1 = <&uart7_sleep_pins_c>;
pinctrl-2 = <&uart7_idle_pins_c>;
+ /delete-property/dmas;
+ /delete-property/dma-names;
status = "disabled";
};

--
2.17.1

2022-02-03 18:25:46

by Erwan Le Ray

[permalink] [raw]
Subject: [PATCH 10/16] ARM: dts: stm32: keep uart4 behavior on stm32mp157c-lxa-mc1

DMA configuration is added to uart nodes in stm32mp15x device tree.
Delete uart4 DMA property in stm32mp157c-lxa-mc1 board device tree to
keep console in irq mode, as DMA support for console has been removed
from the driver by commit e359b4411c28 ("serial: stm32: fix threaded
interrupt handling").

Signed-off-by: Erwan Le Ray <[email protected]>

diff --git a/arch/arm/boot/dts/stm32mp157c-lxa-mc1.dts b/arch/arm/boot/dts/stm32mp157c-lxa-mc1.dts
index 1e9bf7eea0f1..e8d2ec41d537 100644
--- a/arch/arm/boot/dts/stm32mp157c-lxa-mc1.dts
+++ b/arch/arm/boot/dts/stm32mp157c-lxa-mc1.dts
@@ -248,5 +248,7 @@
&uart4 {
pinctrl-names = "default";
pinctrl-0 = <&uart4_pins_a>;
+ /delete-property/dmas;
+ /delete-property/dma-names;
status = "okay";
};
--
2.17.1

2022-02-03 20:31:49

by Erwan Le Ray

[permalink] [raw]
Subject: [PATCH 06/16] ARM: dts: stm32: keep uart4 behavior on stm32mp157a-iot-box

DMA configuration is added to uart nodes in stm32mp15x device tree.
Delete uart4 DMA property in stm32mp157a-iot-box board device tree to
keep console in irq mode, as DMA support for console has been removed
from the driver by commit e359b4411c28 ("serial: stm32: fix threaded
interrupt handling").

Signed-off-by: Erwan Le Ray <[email protected]>

diff --git a/arch/arm/boot/dts/stm32mp157a-iot-box.dts b/arch/arm/boot/dts/stm32mp157a-iot-box.dts
index 70f394b4d3c0..6a5a4af25bd9 100644
--- a/arch/arm/boot/dts/stm32mp157a-iot-box.dts
+++ b/arch/arm/boot/dts/stm32mp157a-iot-box.dts
@@ -58,6 +58,8 @@
/delete-property/st,hw-flow-ctrl;
cts-gpios = <&gpioa 15 GPIO_ACTIVE_LOW>;
rts-gpios = <&gpiob 0 GPIO_ACTIVE_LOW>;
+ /delete-property/dmas;
+ /delete-property/dma-names;
status = "okay";

bluetooth {
--
2.17.1

2022-02-03 20:42:13

by Erwan Le Ray

[permalink] [raw]
Subject: [PATCH 11/16] ARM: dts: stm32: keep uart4 behavior on stm32mp157c-odyssey

DMA configuration is added to uart nodes in stm32mp15x device tree.
Delete uart4 DMA property in stm32mp157c-odyssey board device tree to
keep console in irq mode, as DMA support for console has been removed
from the driver by commit e359b4411c28 ("serial: stm32: fix threaded
interrupt handling").

Signed-off-by: Erwan Le Ray <[email protected]>

diff --git a/arch/arm/boot/dts/stm32mp157c-odyssey.dts b/arch/arm/boot/dts/stm32mp157c-odyssey.dts
index 554f5d3bcdc3..ed66d25b8bf3 100644
--- a/arch/arm/boot/dts/stm32mp157c-odyssey.dts
+++ b/arch/arm/boot/dts/stm32mp157c-odyssey.dts
@@ -81,6 +81,8 @@
&uart4 {
pinctrl-names = "default";
pinctrl-0 = <&uart4_pins_a>;
+ /delete-property/dmas;
+ /delete-property/dma-names;
status = "okay";
};

--
2.17.1

2022-02-04 01:23:10

by Erwan Le Ray

[permalink] [raw]
Subject: [PATCH 12/16] ARM: dts: stm32: keep uart nodes behavior on stm32mp15xx-dhcom-drc02

DMA configuration is added to uart nodes in stm32mp15x device tree.
Delete usart3 and uart8 nodes DMA property in stm32mp15xx-dhcom-drc02
board device tree to keep current behavior.

Signed-off-by: Erwan Le Ray <[email protected]>

diff --git a/arch/arm/boot/dts/stm32mp15xx-dhcom-drc02.dtsi b/arch/arm/boot/dts/stm32mp15xx-dhcom-drc02.dtsi
index 4b10b013ffd5..35b1034aa3cf 100644
--- a/arch/arm/boot/dts/stm32mp15xx-dhcom-drc02.dtsi
+++ b/arch/arm/boot/dts/stm32mp15xx-dhcom-drc02.dtsi
@@ -131,6 +131,8 @@
&usart3 {
pinctrl-names = "default";
pinctrl-0 = <&usart3_pins_a>;
+ /delete-property/dmas;
+ /delete-property/dma-names;
status = "okay";
};

@@ -144,6 +146,8 @@
pinctrl-names = "default";
pinctrl-0 = <&uart8_pins_a>;
rts-gpios = <&gpioe 6 GPIO_ACTIVE_HIGH>;
+ /delete-property/dmas;
+ /delete-property/dma-names;
status = "okay";
};

--
2.17.1

2022-02-04 02:56:14

by Erwan Le Ray

[permalink] [raw]
Subject: [PATCH 02/16] ARM: dts: stm32: keep uart4 behavior on stm32mp157c-ed1

DMA configuration is added to uart nodes in stm32mp15x device tree.
Delete uart4 DMA property in stm32mp157c-ed1 board device tree to keep
console in irq mode, as DMA support for console has been removed from
the driver by commit e359b4411c28 ("serial: stm32: fix threaded
interrupt handling").

Signed-off-by: Erwan Le Ray <[email protected]>

diff --git a/arch/arm/boot/dts/stm32mp157c-ed1.dts b/arch/arm/boot/dts/stm32mp157c-ed1.dts
index 46b471d09c50..b1eb688a278a 100644
--- a/arch/arm/boot/dts/stm32mp157c-ed1.dts
+++ b/arch/arm/boot/dts/stm32mp157c-ed1.dts
@@ -384,6 +384,8 @@
pinctrl-0 = <&uart4_pins_a>;
pinctrl-1 = <&uart4_sleep_pins_a>;
pinctrl-2 = <&uart4_idle_pins_a>;
+ /delete-property/dmas;
+ /delete-property/dma-names;
status = "okay";
};

--
2.17.1

2022-02-04 08:36:36

by Erwan Le Ray

[permalink] [raw]
Subject: [PATCH 05/16] ARM: dts: stm32: keep uart4 behavior on icore-stm32mp1-edimm2.2

DMA configuration is added to uart nodes in stm32mp15x device tree.
Delete uart4 DMA property in icore-stm32mp1-edimm2.2 board device tree
to keep console in irq mode, as DMA support for console has been
removed from the driver by commit e359b4411c28 ("serial: stm32: fix
threaded interrupt handling").

Signed-off-by: Erwan Le Ray <[email protected]>

diff --git a/arch/arm/boot/dts/stm32mp157a-icore-stm32mp1-edimm2.2.dts b/arch/arm/boot/dts/stm32mp157a-icore-stm32mp1-edimm2.2.dts
index ec9f1d1cd50f..3a1295cfa978 100644
--- a/arch/arm/boot/dts/stm32mp157a-icore-stm32mp1-edimm2.2.dts
+++ b/arch/arm/boot/dts/stm32mp157a-icore-stm32mp1-edimm2.2.dts
@@ -43,5 +43,7 @@
pinctrl-0 = <&uart4_pins_a>;
pinctrl-1 = <&uart4_sleep_pins_a>;
pinctrl-2 = <&uart4_idle_pins_a>;
+ /delete-property/dmas;
+ /delete-property/dma-names;
status = "okay";
};
--
2.17.1

2022-02-04 09:14:58

by Erwan Le Ray

[permalink] [raw]
Subject: [PATCH 15/16] ARM: dts: stm32: keep uart4 behavior on stm32mp15xx-dhcom-som

DMA configuration is added to uart nodes in stm32mp15x device tree.
Delete uart4 DMA property in stm32mp15xx-dhcom-som board device tree
to keep console in irq mode, as DMA support for console has been
removed from the driver by commit e359b4411c28 ("serial: stm32: fix
threaded interrupt handling").

Signed-off-by: Erwan Le Ray <[email protected]>

diff --git a/arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi b/arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi
index 8c41f819f776..3cd729e29699 100644
--- a/arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi
+++ b/arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi
@@ -521,5 +521,7 @@
&uart4 {
pinctrl-names = "default";
pinctrl-0 = <&uart4_pins_a>;
+ /delete-property/dmas;
+ /delete-property/dma-names;
status = "okay";
};
--
2.17.1

2022-02-04 15:12:45

by Erwan Le Ray

[permalink] [raw]
Subject: [PATCH 04/16] ARM: dts: stm32: keep uart4 behavior on icore-stm32mp1-ctouch2

DMA configuration is added to uart nodes in stm32mp15x device tree.
Delete uart4 DMA property in icore-stm32mp1-ctouch2 board device tree
to keep console in irq mode, as DMA support for console has been
removed from the driver by commit e359b4411c28 ("serial: stm32: fix
threaded interrupt handling").

Signed-off-by: Erwan Le Ray <[email protected]>

diff --git a/arch/arm/boot/dts/stm32mp157a-icore-stm32mp1-ctouch2.dts b/arch/arm/boot/dts/stm32mp157a-icore-stm32mp1-ctouch2.dts
index d3058a036c74..1f75f1d45181 100644
--- a/arch/arm/boot/dts/stm32mp157a-icore-stm32mp1-ctouch2.dts
+++ b/arch/arm/boot/dts/stm32mp157a-icore-stm32mp1-ctouch2.dts
@@ -43,5 +43,7 @@
pinctrl-0 = <&uart4_pins_a>;
pinctrl-1 = <&uart4_sleep_pins_a>;
pinctrl-2 = <&uart4_idle_pins_a>;
+ /delete-property/dmas;
+ /delete-property/dma-names;
status = "okay";
};
--
2.17.1

2022-02-04 16:29:04

by Ahmad Fatoum

[permalink] [raw]
Subject: Re: [PATCH 00/16] STM32 configure UART nodes for DMA

Hello Erwan,

On 03.02.22 18:10, Erwan Le Ray wrote:
> Add DMA configuration to UART nodes in stm32mp15x (SOC level) and
> remove it at board level to keep current PIO behavior when needed.
> For stm32-ed1 and stm32-dkx boards, UART4 (console) and UART7
> (no HW flow control pin available) are kept in PIO mode, while USART3
> is now configured in DMA mode.
> UART4 (console UART) has to be kept in irq mode, as DMA support for
> console has been removed from the driver by commit e359b4411c28
> ("serial: stm32: fix threaded interrupt handling").

Do I understand correctly that your first patch breaks consoles of
most/all boards, because they will briefly use DMA, which is refused
by the stm32-usart driver and then you add a patch for each board
to fix that breakage?

Such intermittent breakage makes bisection a hassle. /delete-property/
is a no-op when the property doesn't exist, so you could move the first
patch to the very end to avoid intermittent breakage.

I also think that the driver's behavior is a bit harsh. I think it would
be better for the UART driver to print a warning and fall back to
PIO for console instead of outright refusing and rendering the system
silent. That's not mutually exclusive with your patch series here, of course.

Cheers,
Ahmad

>
> For other stm32mp15x-based boards, current configuration is kept for
> all UART instances.
>
> Erwan Le Ray (16):
> ARM: dts: stm32: add DMA configuration to UART nodes on stm32mp151
> ARM: dts: stm32: keep uart4 behavior on stm32mp157c-ed1
> ARM: dts: stm32: keep uart4 and uart7 behavior on stm32mp15xx-dkx
> ARM: dts: stm32: keep uart4 behavior on icore-stm32mp1-ctouch2
> ARM: dts: stm32: keep uart4 behavior on icore-stm32mp1-edimm2.2
> ARM: dts: stm32: keep uart4 behavior on stm32mp157a-iot-box
> ARM: dts: stm32: keep uart nodes behavior on stm32mp1-microdev2.0-of7
> ARM: dts: stm32: keep uart nodes behavior on stm32mp1-microdev2.0
> ARM: dts: stm32: keep uart nodes behavior on stm32mp157a-stinger96
> ARM: dts: stm32: keep uart4 behavior on stm32mp157c-lxa-mc1
> ARM: dts: stm32: keep uart4 behavior on stm32mp157c-odyssey
> ARM: dts: stm32: keep uart nodes behavior on stm32mp15xx-dhcom-drc02
> ARM: dts: stm32: keep uart nodes behavior on stm32mp15xx-dhcom-pdk2
> ARM: dts: stm32: keep uart nodes behavior on stm32mp15xx-dhcom-picoitx
> ARM: dts: stm32: keep uart4 behavior on stm32mp15xx-dhcom-som
> ARM: dts: stm32: keep uart nodes behavior on
> stm32mp15xx-dhcor-avenger96
>
> arch/arm/boot/dts/stm32mp151.dtsi | 21 +++++++++++++++++++
> .../stm32mp157a-icore-stm32mp1-ctouch2.dts | 2 ++
> .../stm32mp157a-icore-stm32mp1-edimm2.2.dts | 2 ++
> arch/arm/boot/dts/stm32mp157a-iot-box.dts | 2 ++
> ...157a-microgea-stm32mp1-microdev2.0-of7.dts | 4 ++++
> ...32mp157a-microgea-stm32mp1-microdev2.0.dts | 4 ++++
> arch/arm/boot/dts/stm32mp157a-stinger96.dtsi | 6 ++++++
> arch/arm/boot/dts/stm32mp157c-ed1.dts | 2 ++
> arch/arm/boot/dts/stm32mp157c-lxa-mc1.dts | 2 ++
> arch/arm/boot/dts/stm32mp157c-odyssey.dts | 2 ++
> .../arm/boot/dts/stm32mp15xx-dhcom-drc02.dtsi | 4 ++++
> arch/arm/boot/dts/stm32mp15xx-dhcom-pdk2.dtsi | 4 ++++
> .../boot/dts/stm32mp15xx-dhcom-picoitx.dtsi | 4 ++++
> arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi | 2 ++
> .../boot/dts/stm32mp15xx-dhcor-avenger96.dtsi | 6 ++++++
> arch/arm/boot/dts/stm32mp15xx-dkx.dtsi | 4 ++++
> 16 files changed, 71 insertions(+)
>


--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |

2022-02-04 17:34:22

by Erwan Le Ray

[permalink] [raw]
Subject: [PATCH 07/16] ARM: dts: stm32: keep uart nodes behavior on stm32mp1-microdev2.0-of7

DMA configuration is added to uart nodes in stm32mp15x device tree.
Delete uart4 DMA property in stm32mp1-microdev2.0-of7 board device tree
to keep console in irq mode, as DMA support for console has been
removed from the driver by commit e359b4411c28 ("serial: stm32: fix
threaded interrupt handling").
Delete also uart8 DMA property to keep current behavior.

Signed-off-by: Erwan Le Ray <[email protected]>

diff --git a/arch/arm/boot/dts/stm32mp157a-microgea-stm32mp1-microdev2.0-of7.dts b/arch/arm/boot/dts/stm32mp157a-microgea-stm32mp1-microdev2.0-of7.dts
index 5670b23812a2..fae656edd820 100644
--- a/arch/arm/boot/dts/stm32mp157a-microgea-stm32mp1-microdev2.0-of7.dts
+++ b/arch/arm/boot/dts/stm32mp157a-microgea-stm32mp1-microdev2.0-of7.dts
@@ -143,6 +143,8 @@
pinctrl-0 = <&uart4_pins_a>;
pinctrl-1 = <&uart4_sleep_pins_a>;
pinctrl-2 = <&uart4_idle_pins_a>;
+ /delete-property/dmas;
+ /delete-property/dma-names;
status = "okay";
};

@@ -150,5 +152,7 @@
&uart8 {
pinctrl-names = "default";
pinctrl-0 = <&uart8_pins_a>;
+ /delete-property/dmas;
+ /delete-property/dma-names;
status = "okay";
};
--
2.17.1

2022-02-04 19:52:04

by Ahmad Fatoum

[permalink] [raw]
Subject: Re: [PATCH 10/16] ARM: dts: stm32: keep uart4 behavior on stm32mp157c-lxa-mc1

On 03.02.22 18:11, Erwan Le Ray wrote:
> DMA configuration is added to uart nodes in stm32mp15x device tree.
> Delete uart4 DMA property in stm32mp157c-lxa-mc1 board device tree to
> keep console in irq mode, as DMA support for console has been removed
> from the driver by commit e359b4411c28 ("serial: stm32: fix threaded
> interrupt handling").
>
> Signed-off-by: Erwan Le Ray <[email protected]>

Reviewed-by: Ahmad Fatoum <[email protected]>

>
> diff --git a/arch/arm/boot/dts/stm32mp157c-lxa-mc1.dts b/arch/arm/boot/dts/stm32mp157c-lxa-mc1.dts
> index 1e9bf7eea0f1..e8d2ec41d537 100644
> --- a/arch/arm/boot/dts/stm32mp157c-lxa-mc1.dts
> +++ b/arch/arm/boot/dts/stm32mp157c-lxa-mc1.dts
> @@ -248,5 +248,7 @@
> &uart4 {
> pinctrl-names = "default";
> pinctrl-0 = <&uart4_pins_a>;
> + /delete-property/dmas;
> + /delete-property/dma-names;
> status = "okay";
> };


--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |

2022-02-04 21:16:10

by Erwan Le Ray

[permalink] [raw]
Subject: [PATCH 01/16] ARM: dts: stm32: add DMA configuration to UART nodes on stm32mp151

Add DMA configuration in stm32mp15x uart nodes by selecting dma direct
mode and alternate REQ/ACK dma protocol for uart.

DMA direct mode allows to bypass DMA FIFO. Each DMA request immediately
initiates a transfer from/to the memory. This allows USART to get data
transferred, even when the transfer ends before the DMA FIFO completion.

Default REQ/ACK DMA protocol consists in maintaining ACK signal up to the
removal of REQuest and the transfer completion.
In case of alternative REQ/ACK protocol, ACK de-assertion does not wait the
removal of the REQuest, but only the transfer completion.
Due to a possible DMA stream lock when transferring data to/from STM32
USART/UART, select this alternative protocol in STM32 USART/UART nodes.

Signed-off-by: Valentin Caron <[email protected]>
Signed-off-by: Erwan Le Ray <[email protected]>

diff --git a/arch/arm/boot/dts/stm32mp151.dtsi b/arch/arm/boot/dts/stm32mp151.dtsi
index 1cfc2f011e70..e86006ae137b 100644
--- a/arch/arm/boot/dts/stm32mp151.dtsi
+++ b/arch/arm/boot/dts/stm32mp151.dtsi
@@ -455,6 +455,9 @@
interrupts-extended = <&exti 27 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&rcc USART2_K>;
wakeup-source;
+ dmas = <&dmamux1 43 0x400 0x15>,
+ <&dmamux1 44 0x400 0x11>;
+ dma-names = "rx", "tx";
status = "disabled";
};

@@ -464,6 +467,9 @@
interrupts-extended = <&exti 28 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&rcc USART3_K>;
wakeup-source;
+ dmas = <&dmamux1 45 0x400 0x15>,
+ <&dmamux1 46 0x400 0x11>;
+ dma-names = "rx", "tx";
status = "disabled";
};

@@ -473,6 +479,9 @@
interrupts-extended = <&exti 30 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&rcc UART4_K>;
wakeup-source;
+ dmas = <&dmamux1 63 0x400 0x15>,
+ <&dmamux1 64 0x400 0x11>;
+ dma-names = "rx", "tx";
status = "disabled";
};

@@ -482,6 +491,9 @@
interrupts-extended = <&exti 31 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&rcc UART5_K>;
wakeup-source;
+ dmas = <&dmamux1 65 0x400 0x15>,
+ <&dmamux1 66 0x400 0x11>;
+ dma-names = "rx", "tx";
status = "disabled";
};

@@ -588,6 +600,9 @@
interrupts-extended = <&exti 32 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&rcc UART7_K>;
wakeup-source;
+ dmas = <&dmamux1 79 0x400 0x15>,
+ <&dmamux1 80 0x400 0x11>;
+ dma-names = "rx", "tx";
status = "disabled";
};

@@ -597,6 +612,9 @@
interrupts-extended = <&exti 33 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&rcc UART8_K>;
wakeup-source;
+ dmas = <&dmamux1 81 0x400 0x15>,
+ <&dmamux1 82 0x400 0x11>;
+ dma-names = "rx", "tx";
status = "disabled";
};

@@ -678,6 +696,9 @@
interrupts-extended = <&exti 29 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&rcc USART6_K>;
wakeup-source;
+ dmas = <&dmamux1 71 0x400 0x15>,
+ <&dmamux1 72 0x400 0x11>;
+ dma-names = "rx", "tx";
status = "disabled";
};

--
2.17.1

2022-02-06 08:23:56

by Ahmad Fatoum

[permalink] [raw]
Subject: Re: [PATCH 00/16] STM32 configure UART nodes for DMA

Hello Erwan,

On 04.02.22 16:41, Erwan LE RAY wrote:
> Hi Ahmad,
>
>
> On 2/4/22 2:22 PM, Alexandre TORGUE wrote:
>> Hi Ahmad
>>
>> On 2/3/22 18:25, Ahmad Fatoum wrote:
>>> Hello Erwan,
>>>
>>> On 03.02.22 18:10, Erwan Le Ray wrote:
>>>> Add DMA configuration to UART nodes in stm32mp15x (SOC level) and
>>>> remove it at board level to keep current PIO behavior when needed.
>>>> For stm32-ed1 and stm32-dkx boards, UART4 (console) and UART7
>>>> (no HW flow control pin available) are kept in PIO mode, while USART3
>>>> is now configured in DMA mode.
>>>> UART4 (console UART) has to be kept in irq mode, as DMA support for
>>>> console has been removed from the driver by commit e359b4411c28
>>>> ("serial: stm32: fix threaded interrupt handling").
>>>
>>> Do I understand correctly that your first patch breaks consoles of
>>> most/all boards, because they will briefly use DMA, which is refused
>>> by the stm32-usart driver and then you add a patch for each board
>>> to fix that breakage?
>>
>> We have two solutions and both have pro/drawbacks. The first one (Erwan ones, can break the boot if the patch is taken "alone". Your proposition avoids this breakage but deletes a non define property (which is a bit weird). However I prefer to keep a functional behavior, and keep Ahmad proposition. Ahmad, just one question, dt-bindings check doesn't complain about it ?
>>
>> Cheers
>> Alex
>>
>>>
>>> Such intermittent breakage makes bisection a hassle. /delete-property/
>>> is a no-op when the property doesn't exist, so you could move the first
>>> patch to the very end to avoid intermittent breakage.
>>>
>>> I also think that the driver's behavior is a bit harsh. I think it would
>>> be better for the UART driver to print a warning and fall back to
>>> PIO for console instead of outright refusing and rendering the system
>>> silent. That's not mutually exclusive with your patch series here, of course.
>>>
>>> Cheers,
>>> Ahmad
>>>
>
> The driver implementation will consider the request to probe the UART console in DMA mode as an error (-ENODEV), and will fallback this UART probe in irq mode.
> Whatever the patch ordering, the boot will never be broken. The board dt patches aim to get a "proper" implementation, but from functional perspective the driver will manage a request to probe an UART console in DMA mode as an error and fall it back in irq mode.

Thanks for the clarification. In that case, your changes look good to me.

Cheers,
Ahmad

>
> Cheers, Erwan.
>
>>>>
>>>> For other stm32mp15x-based boards, current configuration is kept for
>>>> all UART instances.
>>>>
>>>> Erwan Le Ray (16):
>>>>    ARM: dts: stm32: add DMA configuration to UART nodes on stm32mp151
>>>>    ARM: dts: stm32: keep uart4 behavior on stm32mp157c-ed1
>>>>    ARM: dts: stm32: keep uart4 and uart7 behavior on stm32mp15xx-dkx
>>>>    ARM: dts: stm32: keep uart4 behavior on icore-stm32mp1-ctouch2
>>>>    ARM: dts: stm32: keep uart4 behavior on icore-stm32mp1-edimm2.2
>>>>    ARM: dts: stm32: keep uart4 behavior on stm32mp157a-iot-box
>>>>    ARM: dts: stm32: keep uart nodes behavior on stm32mp1-microdev2.0-of7
>>>>    ARM: dts: stm32: keep uart nodes behavior on stm32mp1-microdev2.0
>>>>    ARM: dts: stm32: keep uart nodes behavior on stm32mp157a-stinger96
>>>>    ARM: dts: stm32: keep uart4 behavior on stm32mp157c-lxa-mc1
>>>>    ARM: dts: stm32: keep uart4 behavior on stm32mp157c-odyssey
>>>>    ARM: dts: stm32: keep uart nodes behavior on stm32mp15xx-dhcom-drc02
>>>>    ARM: dts: stm32: keep uart nodes behavior on stm32mp15xx-dhcom-pdk2
>>>>    ARM: dts: stm32: keep uart nodes behavior on stm32mp15xx-dhcom-picoitx
>>>>    ARM: dts: stm32: keep uart4 behavior on stm32mp15xx-dhcom-som
>>>>    ARM: dts: stm32: keep uart nodes behavior on
>>>>      stm32mp15xx-dhcor-avenger96
>>>>
>>>>   arch/arm/boot/dts/stm32mp151.dtsi             | 21 +++++++++++++++++++
>>>>   .../stm32mp157a-icore-stm32mp1-ctouch2.dts    |  2 ++
>>>>   .../stm32mp157a-icore-stm32mp1-edimm2.2.dts   |  2 ++
>>>>   arch/arm/boot/dts/stm32mp157a-iot-box.dts     |  2 ++
>>>>   ...157a-microgea-stm32mp1-microdev2.0-of7.dts |  4 ++++
>>>>   ...32mp157a-microgea-stm32mp1-microdev2.0.dts |  4 ++++
>>>>   arch/arm/boot/dts/stm32mp157a-stinger96.dtsi  |  6 ++++++
>>>>   arch/arm/boot/dts/stm32mp157c-ed1.dts         |  2 ++
>>>>   arch/arm/boot/dts/stm32mp157c-lxa-mc1.dts     |  2 ++
>>>>   arch/arm/boot/dts/stm32mp157c-odyssey.dts     |  2 ++
>>>>   .../arm/boot/dts/stm32mp15xx-dhcom-drc02.dtsi |  4 ++++
>>>>   arch/arm/boot/dts/stm32mp15xx-dhcom-pdk2.dtsi |  4 ++++
>>>>   .../boot/dts/stm32mp15xx-dhcom-picoitx.dtsi   |  4 ++++
>>>>   arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi  |  2 ++
>>>>   .../boot/dts/stm32mp15xx-dhcor-avenger96.dtsi |  6 ++++++
>>>>   arch/arm/boot/dts/stm32mp15xx-dkx.dtsi        |  4 ++++
>>>>   16 files changed, 71 insertions(+)
>>>>
>>>
>>>
>>
>


--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |

2022-02-07 07:53:57

by Erwan Le Ray

[permalink] [raw]
Subject: Re: [PATCH 00/16] STM32 configure UART nodes for DMA

Hi Ahmad,


On 2/4/22 2:22 PM, Alexandre TORGUE wrote:
> Hi Ahmad
>
> On 2/3/22 18:25, Ahmad Fatoum wrote:
>> Hello Erwan,
>>
>> On 03.02.22 18:10, Erwan Le Ray wrote:
>>> Add DMA configuration to UART nodes in stm32mp15x (SOC level) and
>>> remove it at board level to keep current PIO behavior when needed.
>>> For stm32-ed1 and stm32-dkx boards, UART4 (console) and UART7
>>> (no HW flow control pin available) are kept in PIO mode, while USART3
>>> is now configured in DMA mode.
>>> UART4 (console UART) has to be kept in irq mode, as DMA support for
>>> console has been removed from the driver by commit e359b4411c28
>>> ("serial: stm32: fix threaded interrupt handling").
>>
>> Do I understand correctly that your first patch breaks consoles of
>> most/all boards, because they will briefly use DMA, which is refused
>> by the stm32-usart driver and then you add a patch for each board
>> to fix that breakage?
>
> We have two solutions and both have pro/drawbacks. The first one (Erwan
> ones, can break the boot if the patch is taken "alone". Your proposition
> avoids this breakage but deletes a non define property (which is a bit
> weird). However I prefer to keep a functional behavior, and keep Ahmad
> proposition. Ahmad, just one question, dt-bindings check doesn't
> complain about it ?
>
> Cheers
> Alex
>
>>
>> Such intermittent breakage makes bisection a hassle. /delete-property/
>> is a no-op when the property doesn't exist, so you could move the first
>> patch to the very end to avoid intermittent breakage.
>>
>> I also think that the driver's behavior is a bit harsh. I think it would
>> be better for the UART driver to print a warning and fall back to
>> PIO for console instead of outright refusing and rendering the system
>> silent. That's not mutually exclusive with your patch series here, of
>> course.
>>
>> Cheers,
>> Ahmad
>>

The driver implementation will consider the request to probe the UART
console in DMA mode as an error (-ENODEV), and will fallback this UART
probe in irq mode.
Whatever the patch ordering, the boot will never be broken. The board dt
patches aim to get a "proper" implementation, but from functional
perspective the driver will manage a request to probe an UART console in
DMA mode as an error and fall it back in irq mode.

Cheers, Erwan.

>>>
>>> For other stm32mp15x-based boards, current configuration is kept for
>>> all UART instances.
>>>
>>> Erwan Le Ray (16):
>>>    ARM: dts: stm32: add DMA configuration to UART nodes on stm32mp151
>>>    ARM: dts: stm32: keep uart4 behavior on stm32mp157c-ed1
>>>    ARM: dts: stm32: keep uart4 and uart7 behavior on stm32mp15xx-dkx
>>>    ARM: dts: stm32: keep uart4 behavior on icore-stm32mp1-ctouch2
>>>    ARM: dts: stm32: keep uart4 behavior on icore-stm32mp1-edimm2.2
>>>    ARM: dts: stm32: keep uart4 behavior on stm32mp157a-iot-box
>>>    ARM: dts: stm32: keep uart nodes behavior on stm32mp1-microdev2.0-of7
>>>    ARM: dts: stm32: keep uart nodes behavior on stm32mp1-microdev2.0
>>>    ARM: dts: stm32: keep uart nodes behavior on stm32mp157a-stinger96
>>>    ARM: dts: stm32: keep uart4 behavior on stm32mp157c-lxa-mc1
>>>    ARM: dts: stm32: keep uart4 behavior on stm32mp157c-odyssey
>>>    ARM: dts: stm32: keep uart nodes behavior on stm32mp15xx-dhcom-drc02
>>>    ARM: dts: stm32: keep uart nodes behavior on stm32mp15xx-dhcom-pdk2
>>>    ARM: dts: stm32: keep uart nodes behavior on
>>> stm32mp15xx-dhcom-picoitx
>>>    ARM: dts: stm32: keep uart4 behavior on stm32mp15xx-dhcom-som
>>>    ARM: dts: stm32: keep uart nodes behavior on
>>>      stm32mp15xx-dhcor-avenger96
>>>
>>>   arch/arm/boot/dts/stm32mp151.dtsi             | 21 +++++++++++++++++++
>>>   .../stm32mp157a-icore-stm32mp1-ctouch2.dts    |  2 ++
>>>   .../stm32mp157a-icore-stm32mp1-edimm2.2.dts   |  2 ++
>>>   arch/arm/boot/dts/stm32mp157a-iot-box.dts     |  2 ++
>>>   ...157a-microgea-stm32mp1-microdev2.0-of7.dts |  4 ++++
>>>   ...32mp157a-microgea-stm32mp1-microdev2.0.dts |  4 ++++
>>>   arch/arm/boot/dts/stm32mp157a-stinger96.dtsi  |  6 ++++++
>>>   arch/arm/boot/dts/stm32mp157c-ed1.dts         |  2 ++
>>>   arch/arm/boot/dts/stm32mp157c-lxa-mc1.dts     |  2 ++
>>>   arch/arm/boot/dts/stm32mp157c-odyssey.dts     |  2 ++
>>>   .../arm/boot/dts/stm32mp15xx-dhcom-drc02.dtsi |  4 ++++
>>>   arch/arm/boot/dts/stm32mp15xx-dhcom-pdk2.dtsi |  4 ++++
>>>   .../boot/dts/stm32mp15xx-dhcom-picoitx.dtsi   |  4 ++++
>>>   arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi  |  2 ++
>>>   .../boot/dts/stm32mp15xx-dhcor-avenger96.dtsi |  6 ++++++
>>>   arch/arm/boot/dts/stm32mp15xx-dkx.dtsi        |  4 ++++
>>>   16 files changed, 71 insertions(+)
>>>
>>
>>
>

2022-02-07 17:05:45

by Erwan Le Ray

[permalink] [raw]
Subject: [PATCH 09/16] ARM: dts: stm32: keep uart nodes behavior on stm32mp157a-stinger96

DMA configuration is added to uart nodes in stm32mp15x device tree.
Delete uart4 DMA property in stm32mp157a-stinger96 board device tree to
keep console in irq mode, as DMA support for console has been removed
from the driver by commit e359b4411c28 ("serial: stm32: fix threaded
interrupt handling").
Delete also usart2 and uart7 DMA property to keep current behavior.

Signed-off-by: Erwan Le Ray <[email protected]>

diff --git a/arch/arm/boot/dts/stm32mp157a-stinger96.dtsi b/arch/arm/boot/dts/stm32mp157a-stinger96.dtsi
index a4b14ef3caee..3a36f7fe0a2c 100644
--- a/arch/arm/boot/dts/stm32mp157a-stinger96.dtsi
+++ b/arch/arm/boot/dts/stm32mp157a-stinger96.dtsi
@@ -288,6 +288,8 @@
pinctrl-0 = <&usart2_pins_b>;
pinctrl-1 = <&usart2_sleep_pins_b>;
st,hw-flow-ctrl;
+ /delete-property/dmas;
+ /delete-property/dma-names;
status = "okay";
};

@@ -296,6 +298,8 @@
pinctrl-names = "default";
pinctrl-0 = <&uart4_pins_c>;
st,hw-flow-ctrl;
+ /delete-property/dmas;
+ /delete-property/dma-names;
status = "okay";
};

@@ -303,6 +307,8 @@
&uart7 {
pinctrl-names = "default";
pinctrl-0 = <&uart7_pins_b>;
+ /delete-property/dmas;
+ /delete-property/dma-names;
status = "okay";
};

--
2.17.1


2022-02-07 17:42:56

by Erwan Le Ray

[permalink] [raw]
Subject: [PATCH 08/16] ARM: dts: stm32: keep uart nodes behavior on stm32mp1-microdev2.0

DMA configuration is added to uart nodes in stm32mp15x device tree.
Delete uart4 DMA property in stm32mp1-microdev2.0 board device tree
to keep console in irq mode, as DMA support for console has been
removed from the driver by commit e359b4411c28 ("serial: stm32: fix
threaded interrupt handling").
Delete also uart8 DMA property to keep current behavior.

Signed-off-by: Erwan Le Ray <[email protected]>

diff --git a/arch/arm/boot/dts/stm32mp157a-microgea-stm32mp1-microdev2.0.dts b/arch/arm/boot/dts/stm32mp157a-microgea-stm32mp1-microdev2.0.dts
index 7a75868164dc..b9d0d3d6ad15 100644
--- a/arch/arm/boot/dts/stm32mp157a-microgea-stm32mp1-microdev2.0.dts
+++ b/arch/arm/boot/dts/stm32mp157a-microgea-stm32mp1-microdev2.0.dts
@@ -44,6 +44,8 @@
pinctrl-0 = <&uart4_pins_a>;
pinctrl-1 = <&uart4_sleep_pins_a>;
pinctrl-2 = <&uart4_idle_pins_a>;
+ /delete-property/dmas;
+ /delete-property/dma-names;
status = "okay";
};

@@ -51,5 +53,7 @@
&uart8 {
pinctrl-names = "default";
pinctrl-0 = <&uart8_pins_a>;
+ /delete-property/dmas;
+ /delete-property/dma-names;
status = "okay";
};
--
2.17.1


2022-02-07 19:40:59

by Alexandre TORGUE

[permalink] [raw]
Subject: Re: [PATCH 00/16] STM32 configure UART nodes for DMA

Hi Ahmad

On 2/3/22 18:25, Ahmad Fatoum wrote:
> Hello Erwan,
>
> On 03.02.22 18:10, Erwan Le Ray wrote:
>> Add DMA configuration to UART nodes in stm32mp15x (SOC level) and
>> remove it at board level to keep current PIO behavior when needed.
>> For stm32-ed1 and stm32-dkx boards, UART4 (console) and UART7
>> (no HW flow control pin available) are kept in PIO mode, while USART3
>> is now configured in DMA mode.
>> UART4 (console UART) has to be kept in irq mode, as DMA support for
>> console has been removed from the driver by commit e359b4411c28
>> ("serial: stm32: fix threaded interrupt handling").
>
> Do I understand correctly that your first patch breaks consoles of
> most/all boards, because they will briefly use DMA, which is refused
> by the stm32-usart driver and then you add a patch for each board
> to fix that breakage?

We have two solutions and both have pro/drawbacks. The first one (Erwan
ones, can break the boot if the patch is taken "alone". Your proposition
avoids this breakage but deletes a non define property (which is a bit
weird). However I prefer to keep a functional behavior, and keep Ahmad
proposition. Ahmad, just one question, dt-bindings check doesn't
complain about it ?

Cheers
Alex

>
> Such intermittent breakage makes bisection a hassle. /delete-property/
> is a no-op when the property doesn't exist, so you could move the first
> patch to the very end to avoid intermittent breakage.
>
> I also think that the driver's behavior is a bit harsh. I think it would
> be better for the UART driver to print a warning and fall back to
> PIO for console instead of outright refusing and rendering the system
> silent. That's not mutually exclusive with your patch series here, of course.
>
> Cheers,
> Ahmad
>
>>
>> For other stm32mp15x-based boards, current configuration is kept for
>> all UART instances.
>>
>> Erwan Le Ray (16):
>> ARM: dts: stm32: add DMA configuration to UART nodes on stm32mp151
>> ARM: dts: stm32: keep uart4 behavior on stm32mp157c-ed1
>> ARM: dts: stm32: keep uart4 and uart7 behavior on stm32mp15xx-dkx
>> ARM: dts: stm32: keep uart4 behavior on icore-stm32mp1-ctouch2
>> ARM: dts: stm32: keep uart4 behavior on icore-stm32mp1-edimm2.2
>> ARM: dts: stm32: keep uart4 behavior on stm32mp157a-iot-box
>> ARM: dts: stm32: keep uart nodes behavior on stm32mp1-microdev2.0-of7
>> ARM: dts: stm32: keep uart nodes behavior on stm32mp1-microdev2.0
>> ARM: dts: stm32: keep uart nodes behavior on stm32mp157a-stinger96
>> ARM: dts: stm32: keep uart4 behavior on stm32mp157c-lxa-mc1
>> ARM: dts: stm32: keep uart4 behavior on stm32mp157c-odyssey
>> ARM: dts: stm32: keep uart nodes behavior on stm32mp15xx-dhcom-drc02
>> ARM: dts: stm32: keep uart nodes behavior on stm32mp15xx-dhcom-pdk2
>> ARM: dts: stm32: keep uart nodes behavior on stm32mp15xx-dhcom-picoitx
>> ARM: dts: stm32: keep uart4 behavior on stm32mp15xx-dhcom-som
>> ARM: dts: stm32: keep uart nodes behavior on
>> stm32mp15xx-dhcor-avenger96
>>
>> arch/arm/boot/dts/stm32mp151.dtsi | 21 +++++++++++++++++++
>> .../stm32mp157a-icore-stm32mp1-ctouch2.dts | 2 ++
>> .../stm32mp157a-icore-stm32mp1-edimm2.2.dts | 2 ++
>> arch/arm/boot/dts/stm32mp157a-iot-box.dts | 2 ++
>> ...157a-microgea-stm32mp1-microdev2.0-of7.dts | 4 ++++
>> ...32mp157a-microgea-stm32mp1-microdev2.0.dts | 4 ++++
>> arch/arm/boot/dts/stm32mp157a-stinger96.dtsi | 6 ++++++
>> arch/arm/boot/dts/stm32mp157c-ed1.dts | 2 ++
>> arch/arm/boot/dts/stm32mp157c-lxa-mc1.dts | 2 ++
>> arch/arm/boot/dts/stm32mp157c-odyssey.dts | 2 ++
>> .../arm/boot/dts/stm32mp15xx-dhcom-drc02.dtsi | 4 ++++
>> arch/arm/boot/dts/stm32mp15xx-dhcom-pdk2.dtsi | 4 ++++
>> .../boot/dts/stm32mp15xx-dhcom-picoitx.dtsi | 4 ++++
>> arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi | 2 ++
>> .../boot/dts/stm32mp15xx-dhcor-avenger96.dtsi | 6 ++++++
>> arch/arm/boot/dts/stm32mp15xx-dkx.dtsi | 4 ++++
>> 16 files changed, 71 insertions(+)
>>
>
>


2022-02-09 11:57:16

by Erwan Le Ray

[permalink] [raw]
Subject: [PATCH 13/16] ARM: dts: stm32: keep uart nodes behavior on stm32mp15xx-dhcom-pdk2

DMA configuration is added to uart nodes in stm32mp15x device tree.
Delete usart3 and uart8 DMA property in stm32mp15xx-dhcom-pdk2 board
device tree to keep current behavior.

Signed-off-by: Erwan Le Ray <[email protected]>

diff --git a/arch/arm/boot/dts/stm32mp15xx-dhcom-pdk2.dtsi b/arch/arm/boot/dts/stm32mp15xx-dhcom-pdk2.dtsi
index fbf3826933e4..5f586f024060 100644
--- a/arch/arm/boot/dts/stm32mp15xx-dhcom-pdk2.dtsi
+++ b/arch/arm/boot/dts/stm32mp15xx-dhcom-pdk2.dtsi
@@ -287,6 +287,8 @@
&usart3 {
pinctrl-names = "default";
pinctrl-0 = <&usart3_pins_a>;
+ /delete-property/dmas;
+ /delete-property/dma-names;
status = "okay";
};

@@ -294,6 +296,8 @@
pinctrl-names = "default";
pinctrl-0 = <&uart8_pins_a &uart8_rtscts_pins_a>;
uart-has-rtscts;
+ /delete-property/dmas;
+ /delete-property/dma-names;
status = "okay";
};

--
2.17.1


2022-02-14 21:04:38

by Alexandre TORGUE

[permalink] [raw]
Subject: Re: [PATCH 00/16] STM32 configure UART nodes for DMA

On 2/3/22 18:10, Erwan Le Ray wrote:
> Add DMA configuration to UART nodes in stm32mp15x (SOC level) and
> remove it at board level to keep current PIO behavior when needed.
> For stm32-ed1 and stm32-dkx boards, UART4 (console) and UART7
> (no HW flow control pin available) are kept in PIO mode, while USART3
> is now configured in DMA mode.
> UART4 (console UART) has to be kept in irq mode, as DMA support for
> console has been removed from the driver by commit e359b4411c28
> ("serial: stm32: fix threaded interrupt handling").
>
> For other stm32mp15x-based boards, current configuration is kept for
> all UART instances.
>
> Erwan Le Ray (16):
> ARM: dts: stm32: add DMA configuration to UART nodes on stm32mp151
> ARM: dts: stm32: keep uart4 behavior on stm32mp157c-ed1
> ARM: dts: stm32: keep uart4 and uart7 behavior on stm32mp15xx-dkx
> ARM: dts: stm32: keep uart4 behavior on icore-stm32mp1-ctouch2
> ARM: dts: stm32: keep uart4 behavior on icore-stm32mp1-edimm2.2
> ARM: dts: stm32: keep uart4 behavior on stm32mp157a-iot-box
> ARM: dts: stm32: keep uart nodes behavior on stm32mp1-microdev2.0-of7
> ARM: dts: stm32: keep uart nodes behavior on stm32mp1-microdev2.0
> ARM: dts: stm32: keep uart nodes behavior on stm32mp157a-stinger96
> ARM: dts: stm32: keep uart4 behavior on stm32mp157c-lxa-mc1
> ARM: dts: stm32: keep uart4 behavior on stm32mp157c-odyssey
> ARM: dts: stm32: keep uart nodes behavior on stm32mp15xx-dhcom-drc02
> ARM: dts: stm32: keep uart nodes behavior on stm32mp15xx-dhcom-pdk2
> ARM: dts: stm32: keep uart nodes behavior on stm32mp15xx-dhcom-picoitx
> ARM: dts: stm32: keep uart4 behavior on stm32mp15xx-dhcom-som
> ARM: dts: stm32: keep uart nodes behavior on
> stm32mp15xx-dhcor-avenger96
>
> arch/arm/boot/dts/stm32mp151.dtsi | 21 +++++++++++++++++++
> .../stm32mp157a-icore-stm32mp1-ctouch2.dts | 2 ++
> .../stm32mp157a-icore-stm32mp1-edimm2.2.dts | 2 ++
> arch/arm/boot/dts/stm32mp157a-iot-box.dts | 2 ++
> ...157a-microgea-stm32mp1-microdev2.0-of7.dts | 4 ++++
> ...32mp157a-microgea-stm32mp1-microdev2.0.dts | 4 ++++
> arch/arm/boot/dts/stm32mp157a-stinger96.dtsi | 6 ++++++
> arch/arm/boot/dts/stm32mp157c-ed1.dts | 2 ++
> arch/arm/boot/dts/stm32mp157c-lxa-mc1.dts | 2 ++
> arch/arm/boot/dts/stm32mp157c-odyssey.dts | 2 ++
> .../arm/boot/dts/stm32mp15xx-dhcom-drc02.dtsi | 4 ++++
> arch/arm/boot/dts/stm32mp15xx-dhcom-pdk2.dtsi | 4 ++++
> .../boot/dts/stm32mp15xx-dhcom-picoitx.dtsi | 4 ++++
> arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi | 2 ++
> .../boot/dts/stm32mp15xx-dhcor-avenger96.dtsi | 6 ++++++
> arch/arm/boot/dts/stm32mp15xx-dkx.dtsi | 4 ++++
> 16 files changed, 71 insertions(+)
>
Series applied on stm32-next.

Thanks
Alex

2022-11-08 12:29:29

by Uwe Kleine-König

[permalink] [raw]
Subject: Re: [PATCH 00/16] STM32 configure UART nodes for DMA

On Fri, Feb 04, 2022 at 04:41:55PM +0100, Erwan LE RAY wrote:
> On 2/4/22 2:22 PM, Alexandre TORGUE wrote:
> > Hi Ahmad
> >
> > On 2/3/22 18:25, Ahmad Fatoum wrote:
> > > Hello Erwan,
> > >
> > > On 03.02.22 18:10, Erwan Le Ray wrote:
> > > > Add DMA configuration to UART nodes in stm32mp15x (SOC level) and
> > > > remove it at board level to keep current PIO behavior when needed.
> > > > For stm32-ed1 and stm32-dkx boards, UART4 (console) and UART7
> > > > (no HW flow control pin available) are kept in PIO mode, while USART3
> > > > is now configured in DMA mode.
> > > > UART4 (console UART) has to be kept in irq mode, as DMA support for
> > > > console has been removed from the driver by commit e359b4411c28
> > > > ("serial: stm32: fix threaded interrupt handling").
> > >
> > > Do I understand correctly that your first patch breaks consoles of
> > > most/all boards, because they will briefly use DMA, which is refused
> > > by the stm32-usart driver and then you add a patch for each board
> > > to fix that breakage?
> >
> > We have two solutions and both have pro/drawbacks. The first one (Erwan
> > ones, can break the boot if the patch is taken "alone". Your proposition
> > avoids this breakage but deletes a non define property (which is a bit
> > weird). However I prefer to keep a functional behavior, and keep Ahmad
> > proposition. Ahmad, just one question, dt-bindings check doesn't
> > complain about it ?
> >
> > Cheers
> > Alex
> >
> > >
> > > Such intermittent breakage makes bisection a hassle. /delete-property/
> > > is a no-op when the property doesn't exist, so you could move the first
> > > patch to the very end to avoid intermittent breakage.
> > >
> > > I also think that the driver's behavior is a bit harsh. I think it would
> > > be better for the UART driver to print a warning and fall back to
> > > PIO for console instead of outright refusing and rendering the system
> > > silent. That's not mutually exclusive with your patch series here,
> > > of course.
> > >
> > > Cheers,
> > > Ahmad
> > >
>
> The driver implementation will consider the request to probe the UART
> console in DMA mode as an error (-ENODEV), and will fallback this UART probe
> in irq mode.

> Whatever the patch ordering, the boot will never be broken. The board dt
> patches aim to get a "proper" implementation, but from functional
> perspective the driver will manage a request to probe an UART console in DMA
> mode as an error and fall it back in irq mode.

I didn't debug this further yet, but my machine (with an out-of-tree
dts) fails to boot 6.1-rc4 without removing the dma properties from the
console UART. This is a bug isn't it? The same dts created a working
setup with stm32mp157.dtsi from 5.15 + kernel 5.15.

I can debug this further, but maybe you know off-hand what the problem
is?

Best regards
Uwe

--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | https://www.pengutronix.de/ |


Attachments:
(No filename) (3.00 kB)
signature.asc (499.00 B)
Download all attachments

2022-11-08 16:41:08

by Marek Vasut

[permalink] [raw]
Subject: Re: [PATCH 00/16] STM32 configure UART nodes for DMA

On 11/8/22 12:59, Uwe Kleine-König wrote:
> On Fri, Feb 04, 2022 at 04:41:55PM +0100, Erwan LE RAY wrote:
>> On 2/4/22 2:22 PM, Alexandre TORGUE wrote:
>>> Hi Ahmad
>>>
>>> On 2/3/22 18:25, Ahmad Fatoum wrote:
>>>> Hello Erwan,
>>>>
>>>> On 03.02.22 18:10, Erwan Le Ray wrote:
>>>>> Add DMA configuration to UART nodes in stm32mp15x (SOC level) and
>>>>> remove it at board level to keep current PIO behavior when needed.
>>>>> For stm32-ed1 and stm32-dkx boards, UART4 (console) and UART7
>>>>> (no HW flow control pin available) are kept in PIO mode, while USART3
>>>>> is now configured in DMA mode.
>>>>> UART4 (console UART) has to be kept in irq mode, as DMA support for
>>>>> console has been removed from the driver by commit e359b4411c28
>>>>> ("serial: stm32: fix threaded interrupt handling").
>>>>
>>>> Do I understand correctly that your first patch breaks consoles of
>>>> most/all boards, because they will briefly use DMA, which is refused
>>>> by the stm32-usart driver and then you add a patch for each board
>>>> to fix that breakage?
>>>
>>> We have two solutions and both have pro/drawbacks. The first one (Erwan
>>> ones, can break the boot if the patch is taken "alone". Your proposition
>>> avoids this breakage but deletes a non define property (which is a bit
>>> weird). However I prefer to keep a functional behavior, and keep Ahmad
>>> proposition. Ahmad, just one question, dt-bindings check doesn't
>>> complain about it ?
>>>
>>> Cheers
>>> Alex
>>>
>>>>
>>>> Such intermittent breakage makes bisection a hassle. /delete-property/
>>>> is a no-op when the property doesn't exist, so you could move the first
>>>> patch to the very end to avoid intermittent breakage.
>>>>
>>>> I also think that the driver's behavior is a bit harsh. I think it would
>>>> be better for the UART driver to print a warning and fall back to
>>>> PIO for console instead of outright refusing and rendering the system
>>>> silent. That's not mutually exclusive with your patch series here,
>>>> of course.
>>>>
>>>> Cheers,
>>>> Ahmad
>>>>
>>
>> The driver implementation will consider the request to probe the UART
>> console in DMA mode as an error (-ENODEV), and will fallback this UART probe
>> in irq mode.
>
>> Whatever the patch ordering, the boot will never be broken. The board dt
>> patches aim to get a "proper" implementation, but from functional
>> perspective the driver will manage a request to probe an UART console in DMA
>> mode as an error and fall it back in irq mode.
>
> I didn't debug this further yet, but my machine (with an out-of-tree
> dts) fails to boot 6.1-rc4 without removing the dma properties from the
> console UART. This is a bug isn't it? The same dts created a working
> setup with stm32mp157.dtsi from 5.15 + kernel 5.15.
>
> I can debug this further, but maybe you know off-hand what the problem
> is?

+CC Amelie, as this might be related to the DMA series that landed recently:

$ git log --oneline v5.18..v6.0 -- drivers/dma/stm32*

2022-11-09 14:39:46

by Amelie Delaunay

[permalink] [raw]
Subject: Re: [Linux-stm32] [PATCH 00/16] STM32 configure UART nodes for DMA

On 11/8/22 16:28, Marek Vasut wrote:
> On 11/8/22 12:59, Uwe Kleine-König wrote:
>> On Fri, Feb 04, 2022 at 04:41:55PM +0100, Erwan LE RAY wrote:
>>> On 2/4/22 2:22 PM, Alexandre TORGUE wrote:
>>>> Hi Ahmad
>>>>
>>>> On 2/3/22 18:25, Ahmad Fatoum wrote:
>>>>> Hello Erwan,
>>>>>
>>>>> On 03.02.22 18:10, Erwan Le Ray wrote:
>>>>>> Add DMA configuration to UART nodes in stm32mp15x (SOC level) and
>>>>>> remove it at board level to keep current PIO behavior when needed.
>>>>>> For stm32-ed1 and stm32-dkx boards, UART4 (console) and UART7
>>>>>> (no HW flow control pin available) are kept in PIO mode, while USART3
>>>>>> is now configured in DMA mode.
>>>>>> UART4 (console UART) has to be kept in irq mode, as DMA support for
>>>>>> console has been removed from the driver by commit e359b4411c28
>>>>>> ("serial: stm32: fix threaded interrupt handling").
>>>>>
>>>>> Do I understand correctly that your first patch breaks consoles of
>>>>> most/all boards, because they will briefly use DMA, which is refused
>>>>> by the stm32-usart driver and then you add a patch for each board
>>>>> to fix that breakage?
>>>>
>>>> We have two solutions and both have pro/drawbacks. The first one (Erwan
>>>> ones, can break the boot if the patch is taken "alone". Your
>>>> proposition
>>>> avoids this breakage but deletes a non define property (which is a bit
>>>> weird). However I prefer to keep a functional behavior, and keep Ahmad
>>>> proposition. Ahmad, just one question, dt-bindings check doesn't
>>>> complain about it ?
>>>>
>>>> Cheers
>>>> Alex
>>>>
>>>>>
>>>>> Such intermittent breakage makes bisection a hassle. /delete-property/
>>>>> is a no-op when the property doesn't exist, so you could move the
>>>>> first
>>>>> patch to the very end to avoid intermittent breakage.
>>>>>
>>>>> I also think that the driver's behavior is a bit harsh. I think it
>>>>> would
>>>>> be better for the UART driver to print a warning and fall back to
>>>>> PIO for console instead of outright refusing and rendering the system
>>>>> silent. That's not mutually exclusive with your patch series here,
>>>>> of course.
>>>>>
>>>>> Cheers,
>>>>> Ahmad
>>>>>
>>>
>>> The driver implementation will consider the request to probe the UART
>>> console in DMA mode as an error (-ENODEV), and will fallback this
>>> UART probe
>>> in irq mode.
>>
>>> Whatever the patch ordering, the boot will never be broken. The board dt
>>> patches aim to get a "proper" implementation, but from functional
>>> perspective the driver will manage a request to probe an UART console
>>> in DMA
>>> mode as an error and fall it back in irq mode.
>>
>> I didn't debug this further yet, but my machine (with an out-of-tree
>> dts) fails to boot 6.1-rc4 without removing the dma properties from the
>> console UART. This is a bug isn't it? The same dts created a working
>> setup with stm32mp157.dtsi from 5.15 + kernel 5.15.

Hi Uwe,

Could you confirm earlycon is enabled on your setup?

Without earlycon, boot is ok, even with dma properties, at least on
stm32mp157c-dk2.

>>
>> I can debug this further, but maybe you know off-hand what the problem
>> is?
>
> +CC Amelie, as this might be related to the DMA series that landed
> recently:
>
> $ git log --oneline v5.18..v6.0 -- drivers/dma/stm32*

Hi Marek,

We haven't yet investigated the issue, and if latest DMA updates could
explain why earlycon breaks the boot.


+TO Valentin, as he's now in charge of UART driver.
Valentin and I will investigate this issue.

Regards,
Amelie

2022-11-21 09:03:17

by Valentin Caron

[permalink] [raw]
Subject: Re: [Linux-stm32] [PATCH 00/16] STM32 configure UART nodes for DMA

Hi Uwe,

We found the issue, thank you to have reported it.

stm32-usart driver was not tolerant to a probe defer from DMA when the
earlycon is active.

You can find the patch here:
https://lore.kernel.org/lkml/[email protected]/

Valentin

On 11/9/22 14:48, Amelie Delaunay wrote:
> On 11/8/22 16:28, Marek Vasut wrote:
>> On 11/8/22 12:59, Uwe Kleine-König wrote:
>>> On Fri, Feb 04, 2022 at 04:41:55PM +0100, Erwan LE RAY wrote:
>>>> On 2/4/22 2:22 PM, Alexandre TORGUE wrote:
>>>>> Hi Ahmad
>>>>>
>>>>> On 2/3/22 18:25, Ahmad Fatoum wrote:
>>>>>> Hello Erwan,
>>>>>>
>>>>>> On 03.02.22 18:10, Erwan Le Ray wrote:
>>>>>>> Add DMA configuration to UART nodes in stm32mp15x (SOC level) and
>>>>>>> remove it at board level to keep current PIO behavior when needed.
>>>>>>> For stm32-ed1 and stm32-dkx boards, UART4 (console) and UART7
>>>>>>> (no HW flow control pin available) are kept in PIO mode, while
>>>>>>> USART3
>>>>>>> is now configured in DMA mode.
>>>>>>> UART4 (console UART) has to be kept in irq mode, as DMA support for
>>>>>>> console has been removed from the driver by commit e359b4411c28
>>>>>>> ("serial: stm32: fix threaded interrupt handling").
>>>>>>
>>>>>> Do I understand correctly that your first patch breaks consoles of
>>>>>> most/all boards, because they will briefly use DMA, which is refused
>>>>>> by the stm32-usart driver and then you add a patch for each board
>>>>>> to fix that breakage?
>>>>>
>>>>> We have two solutions and both have pro/drawbacks. The first one
>>>>> (Erwan
>>>>> ones, can break the boot if the patch is taken "alone". Your
>>>>> proposition
>>>>> avoids this breakage but deletes a non define property (which is a
>>>>> bit
>>>>> weird). However I prefer to keep a functional behavior, and keep
>>>>> Ahmad
>>>>> proposition. Ahmad, just one question, dt-bindings check doesn't
>>>>> complain about it ?
>>>>>
>>>>> Cheers
>>>>> Alex
>>>>>
>>>>>>
>>>>>> Such intermittent breakage makes bisection a hassle.
>>>>>> /delete-property/
>>>>>> is a no-op when the property doesn't exist, so you could move the
>>>>>> first
>>>>>> patch to the very end to avoid intermittent breakage.
>>>>>>
>>>>>> I also think that the driver's behavior is a bit harsh. I think
>>>>>> it would
>>>>>> be better for the UART driver to print a warning and fall back to
>>>>>> PIO for console instead of outright refusing and rendering the
>>>>>> system
>>>>>> silent. That's not mutually exclusive with your patch series here,
>>>>>> of course.
>>>>>>
>>>>>> Cheers,
>>>>>> Ahmad
>>>>>>
>>>>
>>>> The driver implementation will consider the request to probe the UART
>>>> console in DMA mode as an error (-ENODEV), and will fallback this
>>>> UART probe
>>>> in irq mode.
>>>
>>>> Whatever the patch ordering, the boot will never be broken. The
>>>> board dt
>>>> patches aim to get a "proper" implementation, but from functional
>>>> perspective the driver will manage a request to probe an UART
>>>> console in DMA
>>>> mode as an error and fall it back in irq mode.
>>>
>>> I didn't debug this further yet, but my machine (with an out-of-tree
>>> dts) fails to boot 6.1-rc4 without removing the dma properties from the
>>> console UART. This is a bug isn't it? The same dts created a working
>>> setup with stm32mp157.dtsi from 5.15 + kernel 5.15.
>
> Hi Uwe,
>
> Could you confirm earlycon is enabled on your setup?
>
> Without earlycon, boot is ok, even with dma properties, at least on
> stm32mp157c-dk2.
>
>>>
>>> I can debug this further, but maybe you know off-hand what the problem
>>> is?
>>
>> +CC Amelie, as this might be related to the DMA series that landed
>> recently:
>>
>> $ git log --oneline v5.18..v6.0 -- drivers/dma/stm32*
>
> Hi Marek,
>
> We haven't yet investigated the issue, and if latest DMA updates could
> explain why earlycon breaks the boot.
>
>
> +TO Valentin, as he's now in charge of UART driver.
> Valentin and I will investigate this issue.
>
> Regards,
> Amelie