* [PATCH 00/11] STM32 DMA3 updates for STM32MP25
@ 2024-10-10 14:27 Amelie Delaunay
2024-10-10 14:27 ` [PATCH 01/11] dt-bindings: dma: stm32-dma3: prevent packing/unpacking mode Amelie Delaunay
` (10 more replies)
0 siblings, 11 replies; 17+ messages in thread
From: Amelie Delaunay @ 2024-10-10 14:27 UTC (permalink / raw)
To: Vinod Koul, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Maxime Coquelin, Alexandre Torgue
Cc: dmaengine, linux-stm32, devicetree, linux-arm-kernel,
linux-kernel, Amelie Delaunay
The HW version of STM32 DMA3 inside STM32MP25 requires some tunings to
meet the needs of the interconnect. This series adds the linked list
refactoring feature to have optimal performance when addressing the
memory, and it adds the use of two new bits in the third cell specifying
the DMA transfer requirements:
- bit[16] to prevent packing/unpacking mode to avoid bytes loss in case
of interrupting an ongoing transfer (e.g. UART RX)i,
- bit[17] to prevent linked-list refactoring because some peripherals
(e.g. FMC ECC) require a one-shot transfer, they trigger the DMA only
once.
It also adds a new property, st,axi-max-burst-len, to clamp the burst
length when AXI port is used.
Finally this series also contains STM32MP25 device tree updates, to add
DMA support on SPI, I2C, UART and apply the tunings introduced.
Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
---
Amelie Delaunay (11):
dt-bindings: dma: stm32-dma3: prevent packing/unpacking mode
dmaengine: stm32-dma3: prevent pack/unpack thanks to DT configuration
dmaengine: stm32-dma3: refactor HW linked-list to optimize memory accesses
dt-bindings: dma: stm32-dma3: prevent linked-list refactoring
dmaengine: stm32-dma3: prevent LL refactoring thanks to DT configuration
dt-bindings: dma: stm32-dma3: introduce st,axi-max-burst-len property
dmaengine: stm32-dma3: clamp AXI burst using st,axi-max-burst-len
arm64: dts: st: limit axi burst length in dma nodes of stm32mp25
arm64: dts: st: add DMA support on U(S)ART instances of stm32mp25
arm64: dts: st: add DMA support on I2C instances of stm32mp25
arm64: dts: st: add DMA support on SPI instances of stm32mp25
.../bindings/dma/stm32/st,stm32-dma3.yaml | 17 ++++
arch/arm64/boot/dts/st/stm32mp251.dtsi | 78 +++++++++++++++
arch/arm64/boot/dts/st/stm32mp257f-ev1.dts | 2 +
drivers/dma/stm32/stm32-dma3.c | 107 +++++++++++++++++----
4 files changed, 185 insertions(+), 19 deletions(-)
---
base-commit: 9852d85ec9d492ebef56dc5f229416c925758edc
change-id: 20241010-dma3-mp25-updates-46b9e720290b
Best regards,
--
Amelie Delaunay <amelie.delaunay@foss.st.com>
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 01/11] dt-bindings: dma: stm32-dma3: prevent packing/unpacking mode
2024-10-10 14:27 [PATCH 00/11] STM32 DMA3 updates for STM32MP25 Amelie Delaunay
@ 2024-10-10 14:27 ` Amelie Delaunay
2024-10-10 18:11 ` Rob Herring (Arm)
2024-10-10 14:27 ` [PATCH 02/11] dmaengine: stm32-dma3: prevent pack/unpack thanks to DT configuration Amelie Delaunay
` (9 subsequent siblings)
10 siblings, 1 reply; 17+ messages in thread
From: Amelie Delaunay @ 2024-10-10 14:27 UTC (permalink / raw)
To: Vinod Koul, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Maxime Coquelin, Alexandre Torgue
Cc: dmaengine, linux-stm32, devicetree, linux-arm-kernel,
linux-kernel, Amelie Delaunay
When source data width/burst and destination data width/burst are
different, data are packed or unpacked in DMA3 channel FIFO.
Data are pushed out from DMA3 channel FIFO when the destination burst
length (= data width * burst) is reached.
If the channel is stopped before the transfer end, and if some bytes are
packed/unpacked in the DMA3 channel FIFO, these bytes are lost.
Indeed, DMA3 channel FIFO has no flush capability, only reset.
To avoid potential bytes lost, pack/unpack must be prevented by setting
memory data width/burst equal to peripheral data width/burst.
Memory accesses will be penalized. But it is the only way to avoid bytes
lost.
Some devices (e.g. cyclic RX like UART) need this, so add the possibility
to prevent pack/unpack feature, by setting bit 16 of the 'DMA transfer
requirements' bit mask.
Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
---
Documentation/devicetree/bindings/dma/stm32/st,stm32-dma3.yaml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/Documentation/devicetree/bindings/dma/stm32/st,stm32-dma3.yaml b/Documentation/devicetree/bindings/dma/stm32/st,stm32-dma3.yaml
index 7fdc44b2e6467928622a5bb25d9e0c74bb1790ae..5484848735f8ac3d2050104bbab1d986e82ba6a7 100644
--- a/Documentation/devicetree/bindings/dma/stm32/st,stm32-dma3.yaml
+++ b/Documentation/devicetree/bindings/dma/stm32/st,stm32-dma3.yaml
@@ -96,6 +96,9 @@ properties:
including the update of the LLI if any
0x3: at channel level, the transfer complete event is generated at the
end of the last LLI
+ -bit 16: Prevent packing/unpacking mode
+ 0x0: pack/unpack enabled when source data width/burst != destination data width/burst
+ 0x1: memory data width/burst forced to peripheral data width/burst to prevent pack/unpack
required:
- compatible
--
2.25.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 02/11] dmaengine: stm32-dma3: prevent pack/unpack thanks to DT configuration
2024-10-10 14:27 [PATCH 00/11] STM32 DMA3 updates for STM32MP25 Amelie Delaunay
2024-10-10 14:27 ` [PATCH 01/11] dt-bindings: dma: stm32-dma3: prevent packing/unpacking mode Amelie Delaunay
@ 2024-10-10 14:27 ` Amelie Delaunay
2024-10-10 14:27 ` [PATCH 03/11] dmaengine: stm32-dma3: refactor HW linked-list to optimize memory accesses Amelie Delaunay
` (8 subsequent siblings)
10 siblings, 0 replies; 17+ messages in thread
From: Amelie Delaunay @ 2024-10-10 14:27 UTC (permalink / raw)
To: Vinod Koul, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Maxime Coquelin, Alexandre Torgue
Cc: dmaengine, linux-stm32, devicetree, linux-arm-kernel,
linux-kernel, Amelie Delaunay
When source data width/burst and destination data width/burst are
different, data are packed or unpacked in DMA3 channel FIFO, using
CxTR1.PAM.
Data are pushed out from DMA3 channel FIFO when the destination burst
length (= data width * burst) is reached.
If the transfer is stopped before CxBR1.BNDT = 0, and if some bytes are
packed/unpacked in the DMA3 channel FIFO, these bytes are lost.
Indeed, DMA3 channel FIFO has no flush capability, only reset.
To avoid potential bytes lost, pack/unpack must be prevented by setting
memory data width/burst equal to peripheral data width/burst.
Memory accesses will be penalized. But it is the only way to avoid bytes
lost.
Prevent pack/unpack feature can be activated by setting bit 16 of DMA3
Transfer requirements bitfield (tr_conf) in device tree.
Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
---
drivers/dma/stm32/stm32-dma3.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/dma/stm32/stm32-dma3.c b/drivers/dma/stm32/stm32-dma3.c
index 0be6e944df6fd5d2a02974085251549d9389a37e..2b4cc479e1a1206fef7fd2808d1342048d81e07b 100644
--- a/drivers/dma/stm32/stm32-dma3.c
+++ b/drivers/dma/stm32/stm32-dma3.c
@@ -221,6 +221,7 @@ enum stm32_dma3_port_data_width {
#define STM32_DMA3_DT_BREQ BIT(8) /* CTR2_BREQ */
#define STM32_DMA3_DT_PFREQ BIT(9) /* CTR2_PFREQ */
#define STM32_DMA3_DT_TCEM GENMASK(13, 12) /* CTR2_TCEM */
+#define STM32_DMA3_DT_NOPACK BIT(16) /* CTR1_PAM */
/* struct stm32_dma3_chan .config_set bitfield */
#define STM32_DMA3_CFG_SET_DT BIT(0)
@@ -622,6 +623,10 @@ static int stm32_dma3_chan_prep_hw(struct stm32_dma3_chan *chan, enum dma_transf
/* Set source (memory) data width and burst */
sdw = stm32_dma3_get_max_dw(chan->max_burst, sap_max_dw, len, src_addr);
sbl_max = stm32_dma3_get_max_burst(len, sdw, chan->max_burst);
+ if (!!FIELD_GET(STM32_DMA3_DT_NOPACK, tr_conf)) {
+ sdw = ddw;
+ sbl_max = dbl_max;
+ }
_ctr1 |= FIELD_PREP(CTR1_SDW_LOG2, ilog2(sdw));
_ctr1 |= FIELD_PREP(CTR1_SBL_1, sbl_max - 1);
@@ -652,6 +657,11 @@ static int stm32_dma3_chan_prep_hw(struct stm32_dma3_chan *chan, enum dma_transf
/* Set destination (memory) data width and burst */
ddw = stm32_dma3_get_max_dw(chan->max_burst, dap_max_dw, len, dst_addr);
dbl_max = stm32_dma3_get_max_burst(len, ddw, chan->max_burst);
+ if (!!FIELD_GET(STM32_DMA3_DT_NOPACK, tr_conf) ||
+ ((_ctr2 & CTR2_PFREQ) && ddw > sdw)) { /* Packing to wider ddw not supported */
+ ddw = sdw;
+ dbl_max = sbl_max;
+ }
_ctr1 |= FIELD_PREP(CTR1_SDW_LOG2, ilog2(sdw));
_ctr1 |= FIELD_PREP(CTR1_SBL_1, sbl_max - 1);
--
2.25.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 03/11] dmaengine: stm32-dma3: refactor HW linked-list to optimize memory accesses
2024-10-10 14:27 [PATCH 00/11] STM32 DMA3 updates for STM32MP25 Amelie Delaunay
2024-10-10 14:27 ` [PATCH 01/11] dt-bindings: dma: stm32-dma3: prevent packing/unpacking mode Amelie Delaunay
2024-10-10 14:27 ` [PATCH 02/11] dmaengine: stm32-dma3: prevent pack/unpack thanks to DT configuration Amelie Delaunay
@ 2024-10-10 14:27 ` Amelie Delaunay
2024-10-10 14:27 ` [PATCH 04/11] dt-bindings: dma: stm32-dma3: prevent linked-list refactoring Amelie Delaunay
` (7 subsequent siblings)
10 siblings, 0 replies; 17+ messages in thread
From: Amelie Delaunay @ 2024-10-10 14:27 UTC (permalink / raw)
To: Vinod Koul, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Maxime Coquelin, Alexandre Torgue
Cc: dmaengine, linux-stm32, devicetree, linux-arm-kernel,
linux-kernel, Amelie Delaunay
Current behavior splits the buffer/sg in n * STM32_DMA3_MAX_BLOCK_SIZE + 1
for the remainder without optimization.
New behavior splits the buffer/sg in n * STM32_DMA3_MAX_BLOCK_SIZE + 1 for
(x * chan->max_burst) + 1 for the remainder.
Depending on channel FIFO size, optimal double-word (word if only 8-byte
FIFO size) bursts can be programmed before managing the very last remainder
with lower data width.
In case of _prep_slave_sg, and depending on the channel Transfer Complete
event configuration, the user is warned about the refactored linked-list,
not having the same items count than the initial sg_list. This warning is
shown only if the configuration is successful.
Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
---
drivers/dma/stm32/stm32-dma3.c | 40 +++++++++++++++++++++++++++++++++-------
1 file changed, 33 insertions(+), 7 deletions(-)
diff --git a/drivers/dma/stm32/stm32-dma3.c b/drivers/dma/stm32/stm32-dma3.c
index 2b4cc479e1a1206fef7fd2808d1342048d81e07b..8cb112dc5e057d4832ca7e8bb38c548ae7e269c3 100644
--- a/drivers/dma/stm32/stm32-dma3.c
+++ b/drivers/dma/stm32/stm32-dma3.c
@@ -1126,6 +1126,25 @@ static void stm32_dma3_free_chan_resources(struct dma_chan *c)
chan->config_set = 0;
}
+static u32 stm32_dma3_get_ll_count(struct stm32_dma3_chan *chan, size_t len)
+{
+ u32 count;
+
+ count = len / STM32_DMA3_MAX_BLOCK_SIZE;
+ len -= (len / STM32_DMA3_MAX_BLOCK_SIZE) * STM32_DMA3_MAX_BLOCK_SIZE;
+
+ if (len >= chan->max_burst) {
+ count += 1; /* len < STM32_DMA3_MAX_BLOCK_SIZE here, so it fits in one item */
+ len -= (len / chan->max_burst) * chan->max_burst;
+ }
+
+ /* Unaligned remainder fits in one extra item */
+ if (len > 0)
+ count += 1;
+
+ return count;
+}
+
static void stm32_dma3_init_chan_config_for_memcpy(struct stm32_dma3_chan *chan,
dma_addr_t dst, dma_addr_t src)
{
@@ -1161,7 +1180,7 @@ static struct dma_async_tx_descriptor *stm32_dma3_prep_dma_memcpy(struct dma_cha
size_t next_size, offset;
u32 count, i, ctr1, ctr2;
- count = DIV_ROUND_UP(len, STM32_DMA3_MAX_BLOCK_SIZE);
+ count = stm32_dma3_get_ll_count(chan, len);
swdesc = stm32_dma3_chan_desc_alloc(chan, count);
if (!swdesc)
@@ -1177,6 +1196,9 @@ static struct dma_async_tx_descriptor *stm32_dma3_prep_dma_memcpy(struct dma_cha
remaining = len - offset;
next_size = min_t(size_t, remaining, STM32_DMA3_MAX_BLOCK_SIZE);
+ if (next_size < STM32_DMA3_MAX_BLOCK_SIZE && next_size >= chan->max_burst)
+ next_size = chan->max_burst * (remaining / chan->max_burst);
+
ret = stm32_dma3_chan_prep_hw(chan, DMA_MEM_TO_MEM, &swdesc->ccr, &ctr1, &ctr2,
src + offset, dst + offset, next_size);
if (ret)
@@ -1215,12 +1237,9 @@ static struct dma_async_tx_descriptor *stm32_dma3_prep_slave_sg(struct dma_chan
u32 i, j, count, ctr1, ctr2;
int ret;
- count = sg_len;
- for_each_sg(sgl, sg, sg_len, i) {
- len = sg_dma_len(sg);
- if (len > STM32_DMA3_MAX_BLOCK_SIZE)
- count += DIV_ROUND_UP(len, STM32_DMA3_MAX_BLOCK_SIZE) - 1;
- }
+ count = 0;
+ for_each_sg(sgl, sg, sg_len, i)
+ count += stm32_dma3_get_ll_count(chan, sg_dma_len(sg));
swdesc = stm32_dma3_chan_desc_alloc(chan, count);
if (!swdesc)
@@ -1237,6 +1256,9 @@ static struct dma_async_tx_descriptor *stm32_dma3_prep_slave_sg(struct dma_chan
do {
size_t chunk = min_t(size_t, len, STM32_DMA3_MAX_BLOCK_SIZE);
+ if (chunk < STM32_DMA3_MAX_BLOCK_SIZE && chunk >= chan->max_burst)
+ chunk = chan->max_burst * (len / chan->max_burst);
+
if (dir == DMA_MEM_TO_DEV) {
src = sg_addr;
dst = dev_addr;
@@ -1269,6 +1291,10 @@ static struct dma_async_tx_descriptor *stm32_dma3_prep_slave_sg(struct dma_chan
} while (len);
}
+ if (count != sg_len && chan->tcem != CTR2_TCEM_CHANNEL)
+ dev_warn(chan2dev(chan), "Linked-list refactored, %d items instead of %d\n",
+ count, sg_len);
+
/* Enable Error interrupts */
swdesc->ccr |= CCR_USEIE | CCR_ULEIE | CCR_DTEIE;
/* Enable Transfer state interrupts */
--
2.25.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 04/11] dt-bindings: dma: stm32-dma3: prevent linked-list refactoring
2024-10-10 14:27 [PATCH 00/11] STM32 DMA3 updates for STM32MP25 Amelie Delaunay
` (2 preceding siblings ...)
2024-10-10 14:27 ` [PATCH 03/11] dmaengine: stm32-dma3: refactor HW linked-list to optimize memory accesses Amelie Delaunay
@ 2024-10-10 14:27 ` Amelie Delaunay
2024-10-10 18:14 ` Rob Herring
2024-10-10 14:27 ` [PATCH 05/11] dmaengine: stm32-dma3: prevent LL refactoring thanks to DT configuration Amelie Delaunay
` (6 subsequent siblings)
10 siblings, 1 reply; 17+ messages in thread
From: Amelie Delaunay @ 2024-10-10 14:27 UTC (permalink / raw)
To: Vinod Koul, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Maxime Coquelin, Alexandre Torgue
Cc: dmaengine, linux-stm32, devicetree, linux-arm-kernel,
linux-kernel, Amelie Delaunay
stm32-dma3 driver refactors the linked-list in order to address the memory
with the highest possible data width.
It means that it can introduce up to 2 linked-list items. One with a
transfer length multiple of channel maximum burst length and so with the
highest possible data width. And an extra one with the latest bytes, with
lower data width.
Some devices (e.g. FMC ECC) don't support having several transfers instead
of only one.
So add the possibility to prevent linked-list refactoring, by setting bit
17 of the 'DMA transfer requirements' bit mask.
Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
---
Documentation/devicetree/bindings/dma/stm32/st,stm32-dma3.yaml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/Documentation/devicetree/bindings/dma/stm32/st,stm32-dma3.yaml b/Documentation/devicetree/bindings/dma/stm32/st,stm32-dma3.yaml
index 5484848735f8ac3d2050104bbab1d986e82ba6a7..38c30271f732e0c8da48199a224a88bb647eeca7 100644
--- a/Documentation/devicetree/bindings/dma/stm32/st,stm32-dma3.yaml
+++ b/Documentation/devicetree/bindings/dma/stm32/st,stm32-dma3.yaml
@@ -99,6 +99,9 @@ properties:
-bit 16: Prevent packing/unpacking mode
0x0: pack/unpack enabled when source data width/burst != destination data width/burst
0x1: memory data width/burst forced to peripheral data width/burst to prevent pack/unpack
+ -bit 17: Prevent linked-list refactoring
+ 0x0: don't prevent driver to refactor the linked-list for optimal performance
+ 0x1: prevent driver to refactor the linked-list, despite not optimal performance
required:
- compatible
--
2.25.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 05/11] dmaengine: stm32-dma3: prevent LL refactoring thanks to DT configuration
2024-10-10 14:27 [PATCH 00/11] STM32 DMA3 updates for STM32MP25 Amelie Delaunay
` (3 preceding siblings ...)
2024-10-10 14:27 ` [PATCH 04/11] dt-bindings: dma: stm32-dma3: prevent linked-list refactoring Amelie Delaunay
@ 2024-10-10 14:27 ` Amelie Delaunay
2024-10-10 14:27 ` [PATCH 06/11] dt-bindings: dma: stm32-dma3: introduce st,axi-max-burst-len property Amelie Delaunay
` (5 subsequent siblings)
10 siblings, 0 replies; 17+ messages in thread
From: Amelie Delaunay @ 2024-10-10 14:27 UTC (permalink / raw)
To: Vinod Koul, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Maxime Coquelin, Alexandre Torgue
Cc: dmaengine, linux-stm32, devicetree, linux-arm-kernel,
linux-kernel, Amelie Delaunay
stm32-dma3 driver refactors the linked-list in order to address the memory
with the highest possible data width.
It means that it can introduce up to 2 linked-list items. One with a
transfer length multiple of channel maximum burst length and so with the
highest possible data width. And an extra one with the latest bytes, with
lower data width.
Some devices (e.g. FMC ECC) don't support having several transfers instead
of only one.
So add the possibility to prevent linked-list refactoring, when bit 17 of
the 'DMA transfer requirements' bit mask is set in device tree.
When NOPACK feature is used (bit 16 pf the 'DMA transfer requirements' bit
mask in device tree), linked-list refactoring can be avoided, since the
memory data width and burst will be aligned with the device ones.
Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
---
drivers/dma/stm32/stm32-dma3.c | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/drivers/dma/stm32/stm32-dma3.c b/drivers/dma/stm32/stm32-dma3.c
index 8cb112dc5e057d4832ca7e8bb38c548ae7e269c3..1467308dd27c4674b13d2740c05087b1338fd91a 100644
--- a/drivers/dma/stm32/stm32-dma3.c
+++ b/drivers/dma/stm32/stm32-dma3.c
@@ -222,6 +222,7 @@ enum stm32_dma3_port_data_width {
#define STM32_DMA3_DT_PFREQ BIT(9) /* CTR2_PFREQ */
#define STM32_DMA3_DT_TCEM GENMASK(13, 12) /* CTR2_TCEM */
#define STM32_DMA3_DT_NOPACK BIT(16) /* CTR1_PAM */
+#define STM32_DMA3_DT_NOREFACT BIT(17)
/* struct stm32_dma3_chan .config_set bitfield */
#define STM32_DMA3_CFG_SET_DT BIT(0)
@@ -1126,10 +1127,13 @@ static void stm32_dma3_free_chan_resources(struct dma_chan *c)
chan->config_set = 0;
}
-static u32 stm32_dma3_get_ll_count(struct stm32_dma3_chan *chan, size_t len)
+static u32 stm32_dma3_get_ll_count(struct stm32_dma3_chan *chan, size_t len, bool prevent_refactor)
{
u32 count;
+ if (prevent_refactor)
+ return DIV_ROUND_UP(len, STM32_DMA3_MAX_BLOCK_SIZE);
+
count = len / STM32_DMA3_MAX_BLOCK_SIZE;
len -= (len / STM32_DMA3_MAX_BLOCK_SIZE) * STM32_DMA3_MAX_BLOCK_SIZE;
@@ -1179,8 +1183,10 @@ static struct dma_async_tx_descriptor *stm32_dma3_prep_dma_memcpy(struct dma_cha
struct stm32_dma3_swdesc *swdesc;
size_t next_size, offset;
u32 count, i, ctr1, ctr2;
+ bool prevent_refactor = !!FIELD_GET(STM32_DMA3_DT_NOPACK, chan->dt_config.tr_conf) ||
+ !!FIELD_GET(STM32_DMA3_DT_NOREFACT, chan->dt_config.tr_conf);
- count = stm32_dma3_get_ll_count(chan, len);
+ count = stm32_dma3_get_ll_count(chan, len, prevent_refactor);
swdesc = stm32_dma3_chan_desc_alloc(chan, count);
if (!swdesc)
@@ -1196,7 +1202,8 @@ static struct dma_async_tx_descriptor *stm32_dma3_prep_dma_memcpy(struct dma_cha
remaining = len - offset;
next_size = min_t(size_t, remaining, STM32_DMA3_MAX_BLOCK_SIZE);
- if (next_size < STM32_DMA3_MAX_BLOCK_SIZE && next_size >= chan->max_burst)
+ if (!prevent_refactor &&
+ (next_size < STM32_DMA3_MAX_BLOCK_SIZE && next_size >= chan->max_burst))
next_size = chan->max_burst * (remaining / chan->max_burst);
ret = stm32_dma3_chan_prep_hw(chan, DMA_MEM_TO_MEM, &swdesc->ccr, &ctr1, &ctr2,
@@ -1235,11 +1242,13 @@ static struct dma_async_tx_descriptor *stm32_dma3_prep_slave_sg(struct dma_chan
size_t len;
dma_addr_t sg_addr, dev_addr, src, dst;
u32 i, j, count, ctr1, ctr2;
+ bool prevent_refactor = !!FIELD_GET(STM32_DMA3_DT_NOPACK, chan->dt_config.tr_conf) ||
+ !!FIELD_GET(STM32_DMA3_DT_NOREFACT, chan->dt_config.tr_conf);
int ret;
count = 0;
for_each_sg(sgl, sg, sg_len, i)
- count += stm32_dma3_get_ll_count(chan, sg_dma_len(sg));
+ count += stm32_dma3_get_ll_count(chan, sg_dma_len(sg), prevent_refactor);
swdesc = stm32_dma3_chan_desc_alloc(chan, count);
if (!swdesc)
@@ -1256,7 +1265,8 @@ static struct dma_async_tx_descriptor *stm32_dma3_prep_slave_sg(struct dma_chan
do {
size_t chunk = min_t(size_t, len, STM32_DMA3_MAX_BLOCK_SIZE);
- if (chunk < STM32_DMA3_MAX_BLOCK_SIZE && chunk >= chan->max_burst)
+ if (!prevent_refactor &&
+ (chunk < STM32_DMA3_MAX_BLOCK_SIZE && chunk >= chan->max_burst))
chunk = chan->max_burst * (len / chan->max_burst);
if (dir == DMA_MEM_TO_DEV) {
--
2.25.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 06/11] dt-bindings: dma: stm32-dma3: introduce st,axi-max-burst-len property
2024-10-10 14:27 [PATCH 00/11] STM32 DMA3 updates for STM32MP25 Amelie Delaunay
` (4 preceding siblings ...)
2024-10-10 14:27 ` [PATCH 05/11] dmaengine: stm32-dma3: prevent LL refactoring thanks to DT configuration Amelie Delaunay
@ 2024-10-10 14:27 ` Amelie Delaunay
2024-10-10 18:16 ` Rob Herring
2024-10-10 14:27 ` [PATCH 07/11] dmaengine: stm32-dma3: clamp AXI burst using st,axi-max-burst-len Amelie Delaunay
` (4 subsequent siblings)
10 siblings, 1 reply; 17+ messages in thread
From: Amelie Delaunay @ 2024-10-10 14:27 UTC (permalink / raw)
To: Vinod Koul, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Maxime Coquelin, Alexandre Torgue
Cc: dmaengine, linux-stm32, devicetree, linux-arm-kernel,
linux-kernel, Amelie Delaunay
DMA3 maximum burst length (in unit of beat) may be restricted depending
on bus interconnect.
As mentionned in STM32MP2 reference manual [1], "the maximum allowed AXI
burst length is 16. The user must set [S|D]BL_1 lower or equal to 15
if the Source/Destination allocated port is AXI (if [S|D]AP=0)".
Introduce st,axi-max-burst-len. If used, it will clamp the burst length
to that value if AXI port is used, if not, the maximum burst length value
supported by DMA3 is used.
[1] https://www.st.com/resource/en/reference_manual/rm0457-stm32mp2325xx-advanced-armbased-3264bit-mpus-stmicroelectronics.pdf
Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
---
.../devicetree/bindings/dma/stm32/st,stm32-dma3.yaml | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/Documentation/devicetree/bindings/dma/stm32/st,stm32-dma3.yaml b/Documentation/devicetree/bindings/dma/stm32/st,stm32-dma3.yaml
index 38c30271f732e0c8da48199a224a88bb647eeca7..90ad70bb24eb790afe72bf2085478fa4cec60b94 100644
--- a/Documentation/devicetree/bindings/dma/stm32/st,stm32-dma3.yaml
+++ b/Documentation/devicetree/bindings/dma/stm32/st,stm32-dma3.yaml
@@ -51,6 +51,16 @@ properties:
power-domains:
maxItems: 1
+ st,axi-max-burst-len:
+ description: |
+ Restrict AXI burst length in unit of beat by value specified in this property.
+ The value specified in this property is clamped to the maximum burst length supported by DMA3.
+ If this property is missing, the maximum burst length supported by DMA3 is used.
+ $ref: /schemas/types.yaml#/definitions/uint32
+ minimum: 1
+ maximum: 256
+ default: 64
+
"#dma-cells":
const: 3
description: |
@@ -137,5 +147,6 @@ examples:
<GIC_SPI 48 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&rcc CK_BUS_HPDMA1>;
#dma-cells = <3>;
+ st,axi-max-burst-len = <16>;
};
...
--
2.25.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 07/11] dmaengine: stm32-dma3: clamp AXI burst using st,axi-max-burst-len
2024-10-10 14:27 [PATCH 00/11] STM32 DMA3 updates for STM32MP25 Amelie Delaunay
` (5 preceding siblings ...)
2024-10-10 14:27 ` [PATCH 06/11] dt-bindings: dma: stm32-dma3: introduce st,axi-max-burst-len property Amelie Delaunay
@ 2024-10-10 14:27 ` Amelie Delaunay
2024-10-10 14:27 ` [PATCH 08/11] arm64: dts: st: limit axi burst length in dma nodes of stm32mp25 Amelie Delaunay
` (3 subsequent siblings)
10 siblings, 0 replies; 17+ messages in thread
From: Amelie Delaunay @ 2024-10-10 14:27 UTC (permalink / raw)
To: Vinod Koul, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Maxime Coquelin, Alexandre Torgue
Cc: dmaengine, linux-stm32, devicetree, linux-arm-kernel,
linux-kernel, Amelie Delaunay
STM32 DMA3 can be interconnected with AXI3 or AXI4 busses. In case it is
interconnected with AXI3, the maximum burst length supported by AXI3
protocol is 16 beats, which is lower than the maximum burst length
supported by STM32 DMA3. So the programmed burst has to be shortened when
AXI port is used.
Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
---
drivers/dma/stm32/stm32-dma3.c | 47 +++++++++++++++++++++++++++++++-----------
1 file changed, 35 insertions(+), 12 deletions(-)
diff --git a/drivers/dma/stm32/stm32-dma3.c b/drivers/dma/stm32/stm32-dma3.c
index 1467308dd27c4674b13d2740c05087b1338fd91a..e10689038d8269d23c3f38af9b19cad0b6761fe3 100644
--- a/drivers/dma/stm32/stm32-dma3.c
+++ b/drivers/dma/stm32/stm32-dma3.c
@@ -230,6 +230,8 @@ enum stm32_dma3_port_data_width {
#define STM32_DMA3_CFG_SET_BOTH (STM32_DMA3_CFG_SET_DT | STM32_DMA3_CFG_SET_DMA)
#define STM32_DMA3_MAX_BLOCK_SIZE ALIGN_DOWN(CBR1_BNDT, 64)
+#define STM32_DMA3_MAX_BURST_LEN (1 + min_t(u32, FIELD_GET(CTR1_SBL_1, CTR1_SBL_1), \
+ FIELD_GET(CTR1_DBL_1, CTR1_DBL_1)))
#define port_is_ahb(maxdw) ({ typeof(maxdw) (_maxdw) = (maxdw); \
((_maxdw) != DW_INVALID) && ((_maxdw) == DW_32); })
#define port_is_axi(maxdw) ({ typeof(maxdw) (_maxdw) = (maxdw); \
@@ -303,6 +305,7 @@ struct stm32_dma3_ddata {
u32 dma_channels;
u32 dma_requests;
enum stm32_dma3_port_data_width ports_max_dw[2];
+ u32 axi_max_burst_len;
};
static inline struct stm32_dma3_ddata *to_stm32_dma3_ddata(struct stm32_dma3_chan *chan)
@@ -535,7 +538,8 @@ static enum dma_slave_buswidth stm32_dma3_get_max_dw(u32 chan_max_burst,
return 1 << __ffs(len | addr | max_dw);
}
-static u32 stm32_dma3_get_max_burst(u32 len, enum dma_slave_buswidth dw, u32 chan_max_burst)
+static u32 stm32_dma3_get_max_burst(u32 len, enum dma_slave_buswidth dw,
+ u32 chan_max_burst, u32 bus_max_burst)
{
u32 max_burst = chan_max_burst ? chan_max_burst / dw : 1;
@@ -546,8 +550,9 @@ static u32 stm32_dma3_get_max_burst(u32 len, enum dma_slave_buswidth dw, u32 cha
/*
* HW doesn't modify the burst if burst size <= half of the fifo size.
* If len is not a multiple of burst size, last burst is shortened by HW.
+ * Take care of maximum burst supported on interconnect bus.
*/
- return max_burst;
+ return min_t(u32, max_burst, bus_max_burst);
}
static int stm32_dma3_chan_prep_hw(struct stm32_dma3_chan *chan, enum dma_transfer_direction dir,
@@ -556,6 +561,7 @@ static int stm32_dma3_chan_prep_hw(struct stm32_dma3_chan *chan, enum dma_transf
{
struct stm32_dma3_ddata *ddata = to_stm32_dma3_ddata(chan);
struct dma_device dma_device = ddata->dma_dev;
+ u32 src_max_burst = STM32_DMA3_MAX_BURST_LEN, dst_max_burst = STM32_DMA3_MAX_BURST_LEN;
u32 sdw, ddw, sbl_max, dbl_max, tcem, init_dw, init_bl_max;
u32 _ctr1 = 0, _ctr2 = 0;
u32 ch_conf = chan->dt_config.ch_conf;
@@ -596,10 +602,14 @@ static int stm32_dma3_chan_prep_hw(struct stm32_dma3_chan *chan, enum dma_transf
_ctr1 |= CTR1_SINC;
if (sap)
_ctr1 |= CTR1_SAP;
+ if (port_is_axi(sap_max_dw)) /* AXI - apply axi maximum burst limitation */
+ src_max_burst = ddata->axi_max_burst_len;
if (FIELD_GET(STM32_DMA3_DT_DINC, tr_conf))
_ctr1 |= CTR1_DINC;
if (dap)
_ctr1 |= CTR1_DAP;
+ if (port_is_axi(dap_max_dw)) /* AXI - apply axi maximum burst limitation */
+ dst_max_burst = ddata->axi_max_burst_len;
_ctr2 |= FIELD_PREP(CTR2_REQSEL, chan->dt_config.req_line) & ~CTR2_SWREQ;
if (FIELD_GET(STM32_DMA3_DT_BREQ, tr_conf))
@@ -619,11 +629,12 @@ static int stm32_dma3_chan_prep_hw(struct stm32_dma3_chan *chan, enum dma_transf
/* Set destination (device) data width and burst */
ddw = min_t(u32, ddw, stm32_dma3_get_max_dw(chan->max_burst, dap_max_dw,
len, dst_addr));
- dbl_max = min_t(u32, dbl_max, stm32_dma3_get_max_burst(len, ddw, chan->max_burst));
+ dbl_max = min_t(u32, dbl_max, stm32_dma3_get_max_burst(len, ddw, chan->max_burst,
+ dst_max_burst));
/* Set source (memory) data width and burst */
sdw = stm32_dma3_get_max_dw(chan->max_burst, sap_max_dw, len, src_addr);
- sbl_max = stm32_dma3_get_max_burst(len, sdw, chan->max_burst);
+ sbl_max = stm32_dma3_get_max_burst(len, sdw, chan->max_burst, src_max_burst);
if (!!FIELD_GET(STM32_DMA3_DT_NOPACK, tr_conf)) {
sdw = ddw;
sbl_max = dbl_max;
@@ -653,11 +664,12 @@ static int stm32_dma3_chan_prep_hw(struct stm32_dma3_chan *chan, enum dma_transf
/* Set source (device) data width and burst */
sdw = min_t(u32, sdw, stm32_dma3_get_max_dw(chan->max_burst, sap_max_dw,
len, src_addr));
- sbl_max = min_t(u32, sbl_max, stm32_dma3_get_max_burst(len, sdw, chan->max_burst));
+ sbl_max = min_t(u32, sbl_max, stm32_dma3_get_max_burst(len, sdw, chan->max_burst,
+ src_max_burst));
/* Set destination (memory) data width and burst */
ddw = stm32_dma3_get_max_dw(chan->max_burst, dap_max_dw, len, dst_addr);
- dbl_max = stm32_dma3_get_max_burst(len, ddw, chan->max_burst);
+ dbl_max = stm32_dma3_get_max_burst(len, ddw, chan->max_burst, dst_max_burst);
if (!!FIELD_GET(STM32_DMA3_DT_NOPACK, tr_conf) ||
((_ctr2 & CTR2_PFREQ) && ddw > sdw)) { /* Packing to wider ddw not supported */
ddw = sdw;
@@ -689,22 +701,24 @@ static int stm32_dma3_chan_prep_hw(struct stm32_dma3_chan *chan, enum dma_transf
init_dw = sdw;
init_bl_max = sbl_max;
sdw = stm32_dma3_get_max_dw(chan->max_burst, sap_max_dw, len, src_addr);
- sbl_max = stm32_dma3_get_max_burst(len, sdw, chan->max_burst);
+ sbl_max = stm32_dma3_get_max_burst(len, sdw, chan->max_burst, src_max_burst);
if (chan->config_set & STM32_DMA3_CFG_SET_DMA) {
sdw = min_t(u32, init_dw, sdw);
- sbl_max = min_t(u32, init_bl_max,
- stm32_dma3_get_max_burst(len, sdw, chan->max_burst));
+ sbl_max = min_t(u32, init_bl_max, stm32_dma3_get_max_burst(len, sdw,
+ chan->max_burst,
+ src_max_burst));
}
/* Set destination (memory) data width and burst */
init_dw = ddw;
init_bl_max = dbl_max;
ddw = stm32_dma3_get_max_dw(chan->max_burst, dap_max_dw, len, dst_addr);
- dbl_max = stm32_dma3_get_max_burst(len, ddw, chan->max_burst);
+ dbl_max = stm32_dma3_get_max_burst(len, ddw, chan->max_burst, dst_max_burst);
if (chan->config_set & STM32_DMA3_CFG_SET_DMA) {
ddw = min_t(u32, init_dw, ddw);
- dbl_max = min_t(u32, init_bl_max,
- stm32_dma3_get_max_burst(len, ddw, chan->max_burst));
+ dbl_max = min_t(u32, init_bl_max, stm32_dma3_get_max_burst(len, ddw,
+ chan->max_burst,
+ dst_max_burst));
}
_ctr1 |= FIELD_PREP(CTR1_SDW_LOG2, ilog2(sdw));
@@ -1750,6 +1764,15 @@ static int stm32_dma3_probe(struct platform_device *pdev)
else /* Dual master ports */
ddata->ports_max_dw[1] = FIELD_GET(G_M1_DATA_WIDTH_ENC, hwcfgr);
+ /* st,axi-max-burst-len is optional, if not defined, use STM32_DMA3_MAX_BURST_LEN */
+ if (of_property_read_u32(np, "st,axi-max-burst-len", &ddata->axi_max_burst_len))
+ ddata->axi_max_burst_len = STM32_DMA3_MAX_BURST_LEN;
+ else
+ ddata->axi_max_burst_len = min_t(u32, ddata->axi_max_burst_len,
+ STM32_DMA3_MAX_BURST_LEN);
+ dev_dbg(&pdev->dev, "Burst is limited to %u beats through AXI port\n",
+ ddata->axi_max_burst_len);
+
ddata->chans = devm_kcalloc(&pdev->dev, ddata->dma_channels, sizeof(*ddata->chans),
GFP_KERNEL);
if (!ddata->chans) {
--
2.25.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 08/11] arm64: dts: st: limit axi burst length in dma nodes of stm32mp25
2024-10-10 14:27 [PATCH 00/11] STM32 DMA3 updates for STM32MP25 Amelie Delaunay
` (6 preceding siblings ...)
2024-10-10 14:27 ` [PATCH 07/11] dmaengine: stm32-dma3: clamp AXI burst using st,axi-max-burst-len Amelie Delaunay
@ 2024-10-10 14:27 ` Amelie Delaunay
2024-10-10 14:27 ` [PATCH 09/11] arm64: dts: st: add DMA support on U(S)ART instances " Amelie Delaunay
` (2 subsequent siblings)
10 siblings, 0 replies; 17+ messages in thread
From: Amelie Delaunay @ 2024-10-10 14:27 UTC (permalink / raw)
To: Vinod Koul, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Maxime Coquelin, Alexandre Torgue
Cc: dmaengine, linux-stm32, devicetree, linux-arm-kernel,
linux-kernel, Amelie Delaunay
As stated in STM32MP2 Reference Manual [1], chapter "HPDMA allowed AXI
maximum length", "The maximum allowed AXI burst length is limited to 16.".
To apply this limitation on STM32MP25, add "st,axi-max-burst-len" property
in DMA controllers nodes in stm32mp251.dtsi.
[1] https://www.st.com/resource/en/reference_manual/rm0457-stm32mp2325xx-advanced-armbased-3264bit-mpus-stmicroelectronics.pdf
Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
---
arch/arm64/boot/dts/st/stm32mp251.dtsi | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/arm64/boot/dts/st/stm32mp251.dtsi b/arch/arm64/boot/dts/st/stm32mp251.dtsi
index 1167cf63d7e87aaa15c5c1ed70a9f6511fd818d4..443cc8d6ae8e9e2bff1bb862b0921d9626bb78e1 100644
--- a/arch/arm64/boot/dts/st/stm32mp251.dtsi
+++ b/arch/arm64/boot/dts/st/stm32mp251.dtsi
@@ -181,6 +181,7 @@ hpdma: dma-controller@40400000 {
<GIC_SPI 48 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&scmi_clk CK_SCMI_HPDMA1>;
#dma-cells = <3>;
+ st,axi-max-burst-len = <16>;
};
hpdma2: dma-controller@40410000 {
@@ -204,6 +205,7 @@ hpdma2: dma-controller@40410000 {
<GIC_SPI 64 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&scmi_clk CK_SCMI_HPDMA2>;
#dma-cells = <3>;
+ st,axi-max-burst-len = <16>;
};
hpdma3: dma-controller@40420000 {
@@ -227,6 +229,7 @@ hpdma3: dma-controller@40420000 {
<GIC_SPI 80 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&scmi_clk CK_SCMI_HPDMA3>;
#dma-cells = <3>;
+ st,axi-max-burst-len = <16>;
};
rifsc: bus@42080000 {
--
2.25.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 09/11] arm64: dts: st: add DMA support on U(S)ART instances of stm32mp25
2024-10-10 14:27 [PATCH 00/11] STM32 DMA3 updates for STM32MP25 Amelie Delaunay
` (7 preceding siblings ...)
2024-10-10 14:27 ` [PATCH 08/11] arm64: dts: st: limit axi burst length in dma nodes of stm32mp25 Amelie Delaunay
@ 2024-10-10 14:27 ` Amelie Delaunay
2024-10-10 14:28 ` [PATCH 10/11] arm64: dts: st: add DMA support on I2C " Amelie Delaunay
2024-10-10 14:28 ` [PATCH 11/11] arm64: dts: st: add DMA support on SPI " Amelie Delaunay
10 siblings, 0 replies; 17+ messages in thread
From: Amelie Delaunay @ 2024-10-10 14:27 UTC (permalink / raw)
To: Vinod Koul, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Maxime Coquelin, Alexandre Torgue
Cc: dmaengine, linux-stm32, devicetree, linux-arm-kernel,
linux-kernel, Amelie Delaunay
Add dmas and dma-names properties in u(s)art nodes of stm32mp251.dtsi to
enable DMA support.
RX channel requires to prevent pack/unpack feature of DMA to avoid losing
bytes when interrupting RX transfer, as it uses a cyclic buffer.
Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
---
arch/arm64/boot/dts/st/stm32mp251.dtsi | 27 +++++++++++++++++++++++++++
arch/arm64/boot/dts/st/stm32mp257f-ev1.dts | 2 ++
2 files changed, 29 insertions(+)
diff --git a/arch/arm64/boot/dts/st/stm32mp251.dtsi b/arch/arm64/boot/dts/st/stm32mp251.dtsi
index 443cc8d6ae8e9e2bff1bb862b0921d9626bb78e1..02fcb9fcff87ba9d5c1ecab0385e3a57cde31e2e 100644
--- a/arch/arm64/boot/dts/st/stm32mp251.dtsi
+++ b/arch/arm64/boot/dts/st/stm32mp251.dtsi
@@ -269,6 +269,9 @@ usart2: serial@400e0000 {
reg = <0x400e0000 0x400>;
interrupts = <GIC_SPI 115 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&rcc CK_KER_USART2>;
+ dmas = <&hpdma 11 0x20 0x10012>,
+ <&hpdma 12 0x20 0x3021>;
+ dma-names = "rx", "tx";
access-controllers = <&rifsc 32>;
status = "disabled";
};
@@ -278,6 +281,9 @@ usart3: serial@400f0000 {
reg = <0x400f0000 0x400>;
interrupts = <GIC_SPI 116 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&rcc CK_KER_USART3>;
+ dmas = <&hpdma 13 0x20 0x10012>,
+ <&hpdma 14 0x20 0x3021>;
+ dma-names = "rx", "tx";
access-controllers = <&rifsc 33>;
status = "disabled";
};
@@ -287,6 +293,9 @@ uart4: serial@40100000 {
reg = <0x40100000 0x400>;
interrupts = <GIC_SPI 126 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&rcc CK_KER_UART4>;
+ dmas = <&hpdma 15 0x20 0x10012>,
+ <&hpdma 16 0x20 0x3021>;
+ dma-names = "rx", "tx";
access-controllers = <&rifsc 34>;
status = "disabled";
};
@@ -296,6 +305,9 @@ uart5: serial@40110000 {
reg = <0x40110000 0x400>;
interrupts = <GIC_SPI 127 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&rcc CK_KER_UART5>;
+ dmas = <&hpdma 17 0x20 0x10012>,
+ <&hpdma 18 0x20 0x3021>;
+ dma-names = "rx", "tx";
access-controllers = <&rifsc 35>;
status = "disabled";
};
@@ -396,6 +408,9 @@ usart6: serial@40220000 {
reg = <0x40220000 0x400>;
interrupts = <GIC_SPI 136 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&rcc CK_KER_USART6>;
+ dmas = <&hpdma 19 0x20 0x10012>,
+ <&hpdma 20 0x20 0x3021>;
+ dma-names = "rx", "tx";
access-controllers = <&rifsc 36>;
status = "disabled";
};
@@ -441,6 +456,9 @@ uart9: serial@402c0000 {
reg = <0x402c0000 0x400>;
interrupts = <GIC_SPI 150 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&rcc CK_KER_UART9>;
+ dmas = <&hpdma 25 0x20 0x10012>,
+ <&hpdma 26 0x20 0x3021>;
+ dma-names = "rx", "tx";
access-controllers = <&rifsc 39>;
status = "disabled";
};
@@ -450,6 +468,9 @@ usart1: serial@40330000 {
reg = <0x40330000 0x400>;
interrupts = <GIC_SPI 114 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&rcc CK_KER_USART1>;
+ dmas = <&hpdma 9 0x20 0x10012>,
+ <&hpdma 10 0x20 0x3021>;
+ dma-names = "rx", "tx";
access-controllers = <&rifsc 31>;
status = "disabled";
};
@@ -483,6 +504,9 @@ uart7: serial@40370000 {
reg = <0x40370000 0x400>;
interrupts = <GIC_SPI 148 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&rcc CK_KER_UART7>;
+ dmas = <&hpdma 21 0x20 0x10012>,
+ <&hpdma 22 0x20 0x3021>;
+ dma-names = "rx", "tx";
access-controllers = <&rifsc 37>;
status = "disabled";
};
@@ -492,6 +516,9 @@ uart8: serial@40380000 {
reg = <0x40380000 0x400>;
interrupts = <GIC_SPI 149 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&rcc CK_KER_UART8>;
+ dmas = <&hpdma 23 0x20 0x10012>,
+ <&hpdma 24 0x20 0x3021>;
+ dma-names = "rx", "tx";
access-controllers = <&rifsc 38>;
status = "disabled";
};
diff --git a/arch/arm64/boot/dts/st/stm32mp257f-ev1.dts b/arch/arm64/boot/dts/st/stm32mp257f-ev1.dts
index 214191a8322b81e7ae453503863b4465d9b625e0..d468dcbe849680de812a0ddd593f30cbf507f645 100644
--- a/arch/arm64/boot/dts/st/stm32mp257f-ev1.dts
+++ b/arch/arm64/boot/dts/st/stm32mp257f-ev1.dts
@@ -157,6 +157,8 @@ &usart2 {
pinctrl-0 = <&usart2_pins_a>;
pinctrl-1 = <&usart2_idle_pins_a>;
pinctrl-2 = <&usart2_sleep_pins_a>;
+ /delete-property/dmas;
+ /delete-property/dma-names;
status = "okay";
};
--
2.25.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 10/11] arm64: dts: st: add DMA support on I2C instances of stm32mp25
2024-10-10 14:27 [PATCH 00/11] STM32 DMA3 updates for STM32MP25 Amelie Delaunay
` (8 preceding siblings ...)
2024-10-10 14:27 ` [PATCH 09/11] arm64: dts: st: add DMA support on U(S)ART instances " Amelie Delaunay
@ 2024-10-10 14:28 ` Amelie Delaunay
2024-10-10 14:28 ` [PATCH 11/11] arm64: dts: st: add DMA support on SPI " Amelie Delaunay
10 siblings, 0 replies; 17+ messages in thread
From: Amelie Delaunay @ 2024-10-10 14:28 UTC (permalink / raw)
To: Vinod Koul, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Maxime Coquelin, Alexandre Torgue
Cc: dmaengine, linux-stm32, devicetree, linux-arm-kernel,
linux-kernel, Amelie Delaunay
Add dmas and dma-names properties in i2c nodes of stm32mp251.dtsi to
enable DMA support.
Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
---
arch/arm64/boot/dts/st/stm32mp251.dtsi | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/arch/arm64/boot/dts/st/stm32mp251.dtsi b/arch/arm64/boot/dts/st/stm32mp251.dtsi
index 02fcb9fcff87ba9d5c1ecab0385e3a57cde31e2e..033da03d05a72c557dd81547fffa54eefed1e9cd 100644
--- a/arch/arm64/boot/dts/st/stm32mp251.dtsi
+++ b/arch/arm64/boot/dts/st/stm32mp251.dtsi
@@ -321,6 +321,9 @@ i2c1: i2c@40120000 {
resets = <&rcc I2C1_R>;
#address-cells = <1>;
#size-cells = <0>;
+ dmas = <&hpdma 27 0x20 0x3012>,
+ <&hpdma 28 0x20 0x3021>;
+ dma-names = "rx", "tx";
access-controllers = <&rifsc 41>;
status = "disabled";
};
@@ -334,6 +337,9 @@ i2c2: i2c@40130000 {
resets = <&rcc I2C2_R>;
#address-cells = <1>;
#size-cells = <0>;
+ dmas = <&hpdma 30 0x20 0x3012>,
+ <&hpdma 31 0x20 0x3021>;
+ dma-names = "rx", "tx";
access-controllers = <&rifsc 42>;
status = "disabled";
};
@@ -347,6 +353,9 @@ i2c3: i2c@40140000 {
resets = <&rcc I2C3_R>;
#address-cells = <1>;
#size-cells = <0>;
+ dmas = <&hpdma 33 0x20 0x3012>,
+ <&hpdma 34 0x20 0x3021>;
+ dma-names = "rx", "tx";
access-controllers = <&rifsc 43>;
status = "disabled";
};
@@ -360,6 +369,9 @@ i2c4: i2c@40150000 {
resets = <&rcc I2C4_R>;
#address-cells = <1>;
#size-cells = <0>;
+ dmas = <&hpdma 36 0x20 0x3012>,
+ <&hpdma 37 0x20 0x3021>;
+ dma-names = "rx", "tx";
access-controllers = <&rifsc 44>;
status = "disabled";
};
@@ -373,6 +385,9 @@ i2c5: i2c@40160000 {
resets = <&rcc I2C5_R>;
#address-cells = <1>;
#size-cells = <0>;
+ dmas = <&hpdma 39 0x20 0x3012>,
+ <&hpdma 40 0x20 0x3021>;
+ dma-names = "rx", "tx";
access-controllers = <&rifsc 45>;
status = "disabled";
};
@@ -386,6 +401,9 @@ i2c6: i2c@40170000 {
resets = <&rcc I2C6_R>;
#address-cells = <1>;
#size-cells = <0>;
+ dmas = <&hpdma 42 0x20 0x3012>,
+ <&hpdma 43 0x20 0x3021>;
+ dma-names = "rx", "tx";
access-controllers = <&rifsc 46>;
status = "disabled";
};
@@ -399,6 +417,9 @@ i2c7: i2c@40180000 {
resets = <&rcc I2C7_R>;
#address-cells = <1>;
#size-cells = <0>;
+ dmas = <&hpdma 45 0x20 0x3012>,
+ <&hpdma 46 0x20 0x3021>;
+ dma-names = "rx", "tx";
access-controllers = <&rifsc 47>;
status = "disabled";
};
@@ -544,6 +565,9 @@ i2c8: i2c@46040000 {
resets = <&rcc I2C8_R>;
#address-cells = <1>;
#size-cells = <0>;
+ dmas = <&hpdma 168 0x20 0x3012>,
+ <&hpdma 169 0x20 0x3021>;
+ dma-names = "rx", "tx";
access-controllers = <&rifsc 48>;
status = "disabled";
};
--
2.25.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 11/11] arm64: dts: st: add DMA support on SPI instances of stm32mp25
2024-10-10 14:27 [PATCH 00/11] STM32 DMA3 updates for STM32MP25 Amelie Delaunay
` (9 preceding siblings ...)
2024-10-10 14:28 ` [PATCH 10/11] arm64: dts: st: add DMA support on I2C " Amelie Delaunay
@ 2024-10-10 14:28 ` Amelie Delaunay
10 siblings, 0 replies; 17+ messages in thread
From: Amelie Delaunay @ 2024-10-10 14:28 UTC (permalink / raw)
To: Vinod Koul, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Maxime Coquelin, Alexandre Torgue
Cc: dmaengine, linux-stm32, devicetree, linux-arm-kernel,
linux-kernel, Amelie Delaunay
Add dmas and dma-names properties in spi nodes of stm32mp251.dtsi to
enable DMA support.
Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
---
arch/arm64/boot/dts/st/stm32mp251.dtsi | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/arch/arm64/boot/dts/st/stm32mp251.dtsi b/arch/arm64/boot/dts/st/stm32mp251.dtsi
index 033da03d05a72c557dd81547fffa54eefed1e9cd..0d3a736d4a77c7c02b1e4d0846682e3d2039cb2c 100644
--- a/arch/arm64/boot/dts/st/stm32mp251.dtsi
+++ b/arch/arm64/boot/dts/st/stm32mp251.dtsi
@@ -248,6 +248,9 @@ spi2: spi@400b0000 {
interrupts = <GIC_SPI 113 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&rcc CK_KER_SPI2>;
resets = <&rcc SPI2_R>;
+ dmas = <&hpdma 51 0x20 0x3012>,
+ <&hpdma 52 0x20 0x3021>;
+ dma-names = "rx", "tx";
access-controllers = <&rifsc 23>;
status = "disabled";
};
@@ -260,6 +263,9 @@ spi3: spi@400c0000 {
interrupts = <GIC_SPI 125 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&rcc CK_KER_SPI3>;
resets = <&rcc SPI3_R>;
+ dmas = <&hpdma 53 0x20 0x3012>,
+ <&hpdma 54 0x20 0x3021>;
+ dma-names = "rx", "tx";
access-controllers = <&rifsc 24>;
status = "disabled";
};
@@ -444,6 +450,9 @@ spi1: spi@40230000 {
interrupts = <GIC_SPI 112 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&rcc CK_KER_SPI1>;
resets = <&rcc SPI1_R>;
+ dmas = <&hpdma 49 0x20 0x3012>,
+ <&hpdma 50 0x20 0x3021>;
+ dma-names = "rx", "tx";
access-controllers = <&rifsc 22>;
status = "disabled";
};
@@ -456,6 +465,9 @@ spi4: spi@40240000 {
interrupts = <GIC_SPI 152 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&rcc CK_KER_SPI4>;
resets = <&rcc SPI4_R>;
+ dmas = <&hpdma 55 0x20 0x3012>,
+ <&hpdma 56 0x20 0x3021>;
+ dma-names = "rx", "tx";
access-controllers = <&rifsc 25>;
status = "disabled";
};
@@ -468,6 +480,9 @@ spi5: spi@40280000 {
interrupts = <GIC_SPI 153 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&rcc CK_KER_SPI5>;
resets = <&rcc SPI5_R>;
+ dmas = <&hpdma 57 0x20 0x3012>,
+ <&hpdma 58 0x20 0x3021>;
+ dma-names = "rx", "tx";
access-controllers = <&rifsc 26>;
status = "disabled";
};
@@ -504,6 +519,9 @@ spi6: spi@40350000 {
interrupts = <GIC_SPI 154 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&rcc CK_KER_SPI6>;
resets = <&rcc SPI6_R>;
+ dmas = <&hpdma 59 0x20 0x3012>,
+ <&hpdma 60 0x20 0x3021>;
+ dma-names = "rx", "tx";
access-controllers = <&rifsc 27>;
status = "disabled";
};
@@ -516,6 +534,9 @@ spi7: spi@40360000 {
interrupts = <GIC_SPI 155 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&rcc CK_KER_SPI7>;
resets = <&rcc SPI7_R>;
+ dmas = <&hpdma 61 0x20 0x3012>,
+ <&hpdma 62 0x20 0x3021>;
+ dma-names = "rx", "tx";
access-controllers = <&rifsc 28>;
status = "disabled";
};
@@ -552,6 +573,9 @@ spi8: spi@46020000 {
interrupts = <GIC_SPI 156 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&rcc CK_KER_SPI8>;
resets = <&rcc SPI8_R>;
+ dmas = <&hpdma 171 0x20 0x3012>,
+ <&hpdma 172 0x20 0x3021>;
+ dma-names = "rx", "tx";
access-controllers = <&rifsc 29>;
status = "disabled";
};
--
2.25.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH 01/11] dt-bindings: dma: stm32-dma3: prevent packing/unpacking mode
2024-10-10 14:27 ` [PATCH 01/11] dt-bindings: dma: stm32-dma3: prevent packing/unpacking mode Amelie Delaunay
@ 2024-10-10 18:11 ` Rob Herring (Arm)
0 siblings, 0 replies; 17+ messages in thread
From: Rob Herring (Arm) @ 2024-10-10 18:11 UTC (permalink / raw)
To: Amelie Delaunay
Cc: Maxime Coquelin, dmaengine, linux-stm32, Vinod Koul, devicetree,
Krzysztof Kozlowski, Conor Dooley, linux-kernel, Alexandre Torgue,
linux-arm-kernel
On Thu, 10 Oct 2024 16:27:51 +0200, Amelie Delaunay wrote:
> When source data width/burst and destination data width/burst are
> different, data are packed or unpacked in DMA3 channel FIFO.
> Data are pushed out from DMA3 channel FIFO when the destination burst
> length (= data width * burst) is reached.
> If the channel is stopped before the transfer end, and if some bytes are
> packed/unpacked in the DMA3 channel FIFO, these bytes are lost.
> Indeed, DMA3 channel FIFO has no flush capability, only reset.
> To avoid potential bytes lost, pack/unpack must be prevented by setting
> memory data width/burst equal to peripheral data width/burst.
> Memory accesses will be penalized. But it is the only way to avoid bytes
> lost.
>
> Some devices (e.g. cyclic RX like UART) need this, so add the possibility
> to prevent pack/unpack feature, by setting bit 16 of the 'DMA transfer
> requirements' bit mask.
>
> Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
> ---
> Documentation/devicetree/bindings/dma/stm32/st,stm32-dma3.yaml | 3 +++
> 1 file changed, 3 insertions(+)
>
Acked-by: Rob Herring (Arm) <robh@kernel.org>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 04/11] dt-bindings: dma: stm32-dma3: prevent linked-list refactoring
2024-10-10 14:27 ` [PATCH 04/11] dt-bindings: dma: stm32-dma3: prevent linked-list refactoring Amelie Delaunay
@ 2024-10-10 18:14 ` Rob Herring
2024-10-11 9:01 ` Amelie Delaunay
0 siblings, 1 reply; 17+ messages in thread
From: Rob Herring @ 2024-10-10 18:14 UTC (permalink / raw)
To: Amelie Delaunay
Cc: Vinod Koul, Krzysztof Kozlowski, Conor Dooley, Maxime Coquelin,
Alexandre Torgue, dmaengine, linux-stm32, devicetree,
linux-arm-kernel, linux-kernel
On Thu, Oct 10, 2024 at 04:27:54PM +0200, Amelie Delaunay wrote:
> stm32-dma3 driver refactors the linked-list in order to address the memory
> with the highest possible data width.
> It means that it can introduce up to 2 linked-list items. One with a
> transfer length multiple of channel maximum burst length and so with the
> highest possible data width. And an extra one with the latest bytes, with
> lower data width.
> Some devices (e.g. FMC ECC) don't support having several transfers instead
> of only one.
> So add the possibility to prevent linked-list refactoring, by setting bit
> 17 of the 'DMA transfer requirements' bit mask.
>
> Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
> ---
> Documentation/devicetree/bindings/dma/stm32/st,stm32-dma3.yaml | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/dma/stm32/st,stm32-dma3.yaml b/Documentation/devicetree/bindings/dma/stm32/st,stm32-dma3.yaml
> index 5484848735f8ac3d2050104bbab1d986e82ba6a7..38c30271f732e0c8da48199a224a88bb647eeca7 100644
> --- a/Documentation/devicetree/bindings/dma/stm32/st,stm32-dma3.yaml
> +++ b/Documentation/devicetree/bindings/dma/stm32/st,stm32-dma3.yaml
> @@ -99,6 +99,9 @@ properties:
> -bit 16: Prevent packing/unpacking mode
> 0x0: pack/unpack enabled when source data width/burst != destination data width/burst
> 0x1: memory data width/burst forced to peripheral data width/burst to prevent pack/unpack
> + -bit 17: Prevent linked-list refactoring
> + 0x0: don't prevent driver to refactor the linked-list for optimal performance
> + 0x1: prevent driver to refactor the linked-list, despite not optimal performance
Driver settings don't belong in DT. Perhaps reword it in terms of h/w
constraints (i.e. single transfer limitation).
>
> required:
> - compatible
>
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 06/11] dt-bindings: dma: stm32-dma3: introduce st,axi-max-burst-len property
2024-10-10 14:27 ` [PATCH 06/11] dt-bindings: dma: stm32-dma3: introduce st,axi-max-burst-len property Amelie Delaunay
@ 2024-10-10 18:16 ` Rob Herring
2024-10-11 9:12 ` Amelie Delaunay
0 siblings, 1 reply; 17+ messages in thread
From: Rob Herring @ 2024-10-10 18:16 UTC (permalink / raw)
To: Amelie Delaunay
Cc: Vinod Koul, Krzysztof Kozlowski, Conor Dooley, Maxime Coquelin,
Alexandre Torgue, dmaengine, linux-stm32, devicetree,
linux-arm-kernel, linux-kernel
On Thu, Oct 10, 2024 at 04:27:56PM +0200, Amelie Delaunay wrote:
> DMA3 maximum burst length (in unit of beat) may be restricted depending
> on bus interconnect.
>
> As mentionned in STM32MP2 reference manual [1], "the maximum allowed AXI
> burst length is 16. The user must set [S|D]BL_1 lower or equal to 15
> if the Source/Destination allocated port is AXI (if [S|D]AP=0)".
This should be implied by the SoC specific compatible.
>
> Introduce st,axi-max-burst-len. If used, it will clamp the burst length
> to that value if AXI port is used, if not, the maximum burst length value
> supported by DMA3 is used.
>
> [1] https://www.st.com/resource/en/reference_manual/rm0457-stm32mp2325xx-advanced-armbased-3264bit-mpus-stmicroelectronics.pdf
>
> Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
> ---
> .../devicetree/bindings/dma/stm32/st,stm32-dma3.yaml | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/dma/stm32/st,stm32-dma3.yaml b/Documentation/devicetree/bindings/dma/stm32/st,stm32-dma3.yaml
> index 38c30271f732e0c8da48199a224a88bb647eeca7..90ad70bb24eb790afe72bf2085478fa4cec60b94 100644
> --- a/Documentation/devicetree/bindings/dma/stm32/st,stm32-dma3.yaml
> +++ b/Documentation/devicetree/bindings/dma/stm32/st,stm32-dma3.yaml
> @@ -51,6 +51,16 @@ properties:
> power-domains:
> maxItems: 1
>
> + st,axi-max-burst-len:
> + description: |
> + Restrict AXI burst length in unit of beat by value specified in this property.
> + The value specified in this property is clamped to the maximum burst length supported by DMA3.
> + If this property is missing, the maximum burst length supported by DMA3 is used.
> + $ref: /schemas/types.yaml#/definitions/uint32
> + minimum: 1
> + maximum: 256
> + default: 64
> +
> "#dma-cells":
> const: 3
> description: |
> @@ -137,5 +147,6 @@ examples:
> <GIC_SPI 48 IRQ_TYPE_LEVEL_HIGH>;
> clocks = <&rcc CK_BUS_HPDMA1>;
> #dma-cells = <3>;
> + st,axi-max-burst-len = <16>;
> };
> ...
>
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 04/11] dt-bindings: dma: stm32-dma3: prevent linked-list refactoring
2024-10-10 18:14 ` Rob Herring
@ 2024-10-11 9:01 ` Amelie Delaunay
0 siblings, 0 replies; 17+ messages in thread
From: Amelie Delaunay @ 2024-10-11 9:01 UTC (permalink / raw)
To: Rob Herring
Cc: Vinod Koul, Krzysztof Kozlowski, Conor Dooley, Maxime Coquelin,
Alexandre Torgue, dmaengine, linux-stm32, devicetree,
linux-arm-kernel, linux-kernel
On 10/10/24 20:14, Rob Herring wrote:
> On Thu, Oct 10, 2024 at 04:27:54PM +0200, Amelie Delaunay wrote:
>> stm32-dma3 driver refactors the linked-list in order to address the memory
>> with the highest possible data width.
>> It means that it can introduce up to 2 linked-list items. One with a
>> transfer length multiple of channel maximum burst length and so with the
>> highest possible data width. And an extra one with the latest bytes, with
>> lower data width.
>> Some devices (e.g. FMC ECC) don't support having several transfers instead
>> of only one.
>> So add the possibility to prevent linked-list refactoring, by setting bit
>> 17 of the 'DMA transfer requirements' bit mask.
>>
>> Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
>> ---
>> Documentation/devicetree/bindings/dma/stm32/st,stm32-dma3.yaml | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/dma/stm32/st,stm32-dma3.yaml b/Documentation/devicetree/bindings/dma/stm32/st,stm32-dma3.yaml
>> index 5484848735f8ac3d2050104bbab1d986e82ba6a7..38c30271f732e0c8da48199a224a88bb647eeca7 100644
>> --- a/Documentation/devicetree/bindings/dma/stm32/st,stm32-dma3.yaml
>> +++ b/Documentation/devicetree/bindings/dma/stm32/st,stm32-dma3.yaml
>> @@ -99,6 +99,9 @@ properties:
>> -bit 16: Prevent packing/unpacking mode
>> 0x0: pack/unpack enabled when source data width/burst != destination data width/burst
>> 0x1: memory data width/burst forced to peripheral data width/burst to prevent pack/unpack
>> + -bit 17: Prevent linked-list refactoring
>> + 0x0: don't prevent driver to refactor the linked-list for optimal performance
>> + 0x1: prevent driver to refactor the linked-list, despite not optimal performance
>
> Driver settings don't belong in DT. Perhaps reword it in terms of h/w
> constraints (i.e. single transfer limitation).
>
Thanks for the review and suggestion. I'll reword it in V2. Indeed, it
is due to single transfer limitation, e.g. for ECC status registers
transfer.
-bit 17: Prevent additional transfers due to linked-list refactoring
0x0: don't prevent additional transfers for optimal performance
0x1: prevent additional transfers to accommodate user constraints
such as single transfer
Regards,
Amelie
>>
>> required:
>> - compatible
>>
>> --
>> 2.25.1
>>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 06/11] dt-bindings: dma: stm32-dma3: introduce st,axi-max-burst-len property
2024-10-10 18:16 ` Rob Herring
@ 2024-10-11 9:12 ` Amelie Delaunay
0 siblings, 0 replies; 17+ messages in thread
From: Amelie Delaunay @ 2024-10-11 9:12 UTC (permalink / raw)
To: Rob Herring
Cc: Vinod Koul, Krzysztof Kozlowski, Conor Dooley, Maxime Coquelin,
Alexandre Torgue, dmaengine, linux-stm32, devicetree,
linux-arm-kernel, linux-kernel
On 10/10/24 20:16, Rob Herring wrote:
> On Thu, Oct 10, 2024 at 04:27:56PM +0200, Amelie Delaunay wrote:
>> DMA3 maximum burst length (in unit of beat) may be restricted depending
>> on bus interconnect.
>>
>> As mentionned in STM32MP2 reference manual [1], "the maximum allowed AXI
>> burst length is 16. The user must set [S|D]BL_1 lower or equal to 15
>> if the Source/Destination allocated port is AXI (if [S|D]AP=0)".
>
> This should be implied by the SoC specific compatible.
>
I took an example from snps,dw-axi-dmac.yaml (snps,axi-max-burst-len).
But I agree, it will be implied by st,stm32mp25-dma3 compatible in V2.
Patch 8/11 will then be dropped.
Regards,
Amelie
>>
>> Introduce st,axi-max-burst-len. If used, it will clamp the burst length
>> to that value if AXI port is used, if not, the maximum burst length value
>> supported by DMA3 is used.
>>
>> [1] https://www.st.com/resource/en/reference_manual/rm0457-stm32mp2325xx-advanced-armbased-3264bit-mpus-stmicroelectronics.pdf
>>
>> Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
>> ---
>> .../devicetree/bindings/dma/stm32/st,stm32-dma3.yaml | 11 +++++++++++
>> 1 file changed, 11 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/dma/stm32/st,stm32-dma3.yaml b/Documentation/devicetree/bindings/dma/stm32/st,stm32-dma3.yaml
>> index 38c30271f732e0c8da48199a224a88bb647eeca7..90ad70bb24eb790afe72bf2085478fa4cec60b94 100644
>> --- a/Documentation/devicetree/bindings/dma/stm32/st,stm32-dma3.yaml
>> +++ b/Documentation/devicetree/bindings/dma/stm32/st,stm32-dma3.yaml
>> @@ -51,6 +51,16 @@ properties:
>> power-domains:
>> maxItems: 1
>>
>> + st,axi-max-burst-len:
>> + description: |
>> + Restrict AXI burst length in unit of beat by value specified in this property.
>> + The value specified in this property is clamped to the maximum burst length supported by DMA3.
>> + If this property is missing, the maximum burst length supported by DMA3 is used.
>> + $ref: /schemas/types.yaml#/definitions/uint32
>> + minimum: 1
>> + maximum: 256
>> + default: 64
>> +
>> "#dma-cells":
>> const: 3
>> description: |
>> @@ -137,5 +147,6 @@ examples:
>> <GIC_SPI 48 IRQ_TYPE_LEVEL_HIGH>;
>> clocks = <&rcc CK_BUS_HPDMA1>;
>> #dma-cells = <3>;
>> + st,axi-max-burst-len = <16>;
>> };
>> ...
>>
>> --
>> 2.25.1
>>
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2024-10-11 9:34 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-10 14:27 [PATCH 00/11] STM32 DMA3 updates for STM32MP25 Amelie Delaunay
2024-10-10 14:27 ` [PATCH 01/11] dt-bindings: dma: stm32-dma3: prevent packing/unpacking mode Amelie Delaunay
2024-10-10 18:11 ` Rob Herring (Arm)
2024-10-10 14:27 ` [PATCH 02/11] dmaengine: stm32-dma3: prevent pack/unpack thanks to DT configuration Amelie Delaunay
2024-10-10 14:27 ` [PATCH 03/11] dmaengine: stm32-dma3: refactor HW linked-list to optimize memory accesses Amelie Delaunay
2024-10-10 14:27 ` [PATCH 04/11] dt-bindings: dma: stm32-dma3: prevent linked-list refactoring Amelie Delaunay
2024-10-10 18:14 ` Rob Herring
2024-10-11 9:01 ` Amelie Delaunay
2024-10-10 14:27 ` [PATCH 05/11] dmaengine: stm32-dma3: prevent LL refactoring thanks to DT configuration Amelie Delaunay
2024-10-10 14:27 ` [PATCH 06/11] dt-bindings: dma: stm32-dma3: introduce st,axi-max-burst-len property Amelie Delaunay
2024-10-10 18:16 ` Rob Herring
2024-10-11 9:12 ` Amelie Delaunay
2024-10-10 14:27 ` [PATCH 07/11] dmaengine: stm32-dma3: clamp AXI burst using st,axi-max-burst-len Amelie Delaunay
2024-10-10 14:27 ` [PATCH 08/11] arm64: dts: st: limit axi burst length in dma nodes of stm32mp25 Amelie Delaunay
2024-10-10 14:27 ` [PATCH 09/11] arm64: dts: st: add DMA support on U(S)ART instances " Amelie Delaunay
2024-10-10 14:28 ` [PATCH 10/11] arm64: dts: st: add DMA support on I2C " Amelie Delaunay
2024-10-10 14:28 ` [PATCH 11/11] arm64: dts: st: add DMA support on SPI " Amelie Delaunay
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).