From patchwork Thu Oct 10 14:27:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amelie Delaunay X-Patchwork-Id: 13830354 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 60317CF11F5 for ; Thu, 10 Oct 2024 14:50:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References :Message-ID:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=8zvSJPaOxFyx6iKmFarEMp7/qdMh7rTZXLJBCgsAQ4g=; b=bBGMSRH0To4yg0iSmfzMzooiFC Z8jagcQiO+j7hVvLCfIM1EjV5I5JU2lzLdEtshrdX3J2Y/1xqVCh/vdtVL1mTCOhTe1PrYDAjIFVA 0OqkoU743CtxvAfSSag9CmsGGiOGJwXOj5AlVDVoqPNCAvZv6z3rXYtOqf6BQ+fdIjwKPPeHYxPxO G0B/q0svDbS7Mzue0U2hJ4Yfdgt9eb1Lf+Qze5poI69rd8Yj0ultPyHm5ZYb7G2qscD6+rxpI19XE mMLp4Q4iLciAAOS08rCHmpdj2AWh4JQVA+UyKRU8vWquSLvnM8hiillyJv/5pO92zc8nOtfoqQ77E 0tI3jEpQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1syuU7-0000000DBwb-3d54; Thu, 10 Oct 2024 14:49:47 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1syuCg-0000000D77f-2oH9 for linux-arm-kernel@bombadil.infradead.org; Thu, 10 Oct 2024 14:31:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=CC:To:In-Reply-To:References: Message-ID:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Sender:Reply-To:Content-ID:Content-Description; bh=8zvSJPaOxFyx6iKmFarEMp7/qdMh7rTZXLJBCgsAQ4g=; b=IO6iLT1gdEubTzmLbNktKGQ3Rt QQTaisHIkRmYWLaMiPSkev+mNQILpyXp6a9gH4lvVi41xzJvq7PUQkwyQfnjwSZnR+69pWFRfg348 8/5Mb04O92IHpbq7ogOo+zp22pVdNe39Ur68nIXm/WVRQ5PdIUcnv3N+WtdLrxjxgAcOd57lVBLue qT32tFe6AluAH7jQndjMr3de6DKHNTUJKsJqIosHvoQyU9HWMQsxL9/xZo2ACtyU6HDZt4adrQGyC E91ybD733RVVZyRKNM5BdKySkuaGHpkhyz8/6rE2uEhd1tFvFdDGMWHgEJpdG93XlC8ZsCIdjB7xa OKI3JZWg==; Received: from mx08-00178001.pphosted.com ([91.207.212.93] helo=mx07-00178001.pphosted.com) by desiato.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1syuCc-00000005P5I-30iC for linux-arm-kernel@lists.infradead.org; Thu, 10 Oct 2024 14:31:45 +0000 Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49AEMAQA014760; Thu, 10 Oct 2024 16:31:33 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=selector1; bh= 8zvSJPaOxFyx6iKmFarEMp7/qdMh7rTZXLJBCgsAQ4g=; b=pVhB0R01g1VunsM7 vmZThmKunyzqYZk7aV16FlLXg4imz4TEuz0xxLJ7s2+FeN2uDyQWhA1rW7c8YkrO 6t3sxtH96U5OhtHWFK8OXhIPoJ40VkZuBz9I6W1lXxhNCODOga6PvP2G8qxHzkbm VIo7rSPsRY1u8EEPvfJkMQii2WP6TLi0FXPazeY4zntqkxyNVn6KbybjMz3q8wLA 8W2G15DzxX6LxQeJWmn3XiEubR1Y2Q/2eYSgQ0HMvZtwjBKbuNnWGblvspJ9RwD1 GmRqj28CflRGlTka8FT5jY3i7HLB8ZUT9tdw+wp4OuoiTEqvs8C5jJ298RlAGVO7 suXOWA== Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 425q97xxb5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 10 Oct 2024 16:31:33 +0200 (MEST) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 5486940069; Thu, 10 Oct 2024 16:30:21 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 2464D2954A5; Thu, 10 Oct 2024 16:28:07 +0200 (CEST) Received: from localhost (10.252.31.182) by SHFDAG1NODE3.st.com (10.75.129.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37; Thu, 10 Oct 2024 16:28:06 +0200 From: Amelie Delaunay Date: Thu, 10 Oct 2024 16:27:51 +0200 Subject: [PATCH 01/11] dt-bindings: dma: stm32-dma3: prevent packing/unpacking mode MIME-Version: 1.0 Message-ID: <20241010-dma3-mp25-updates-v1-1-adf0633981ea@foss.st.com> References: <20241010-dma3-mp25-updates-v1-0-adf0633981ea@foss.st.com> In-Reply-To: <20241010-dma3-mp25-updates-v1-0-adf0633981ea@foss.st.com> To: Vinod Koul , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maxime Coquelin , Alexandre Torgue CC: , , , , , Amelie Delaunay X-Mailer: b4 0.14.2 X-Originating-IP: [10.252.31.182] X-ClientProxiedBy: SHFCAS1NODE1.st.com (10.75.129.72) To SHFDAG1NODE3.st.com (10.75.129.71) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241010_153143_350019_C31C03CD X-CRM114-Status: GOOD ( 10.54 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 Acked-by: Rob Herring (Arm) --- 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 From patchwork Thu Oct 10 14:27:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amelie Delaunay X-Patchwork-Id: 13830353 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9EF67CF11F9 for ; Thu, 10 Oct 2024 14:48:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References :Message-ID:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=cB08zjQih/Ih6h2EceQOGpBZJJTkTNDk33t9blGD3t4=; b=vWRdhflzKJ9oB1jwReq0Hbx9aD WzrpbsG+GR2pX06jqjGS2PZ9MCOiBLGnFbfpX18EcnW+yrycwa6shbYRlXeq6rXsz/KufP456iCyo TXlKTF3JAOHu4hwkN6P85eEWpMyYURVQeMNsnJ/bn6GiEW78GyTRJdM9dlRAOdnm5E5WEgzHQxaS3 MofaCCOvteAtzavvRy5BupAxMsdQfZlq/5/6Qn2TY48jY+DK8OPLlmyAtGpklnTKJQnEkyHEVgUtP e+fB4f+mpPOdKv8+JsU3nuDnbgG8pWU6AS8pCdBinS1p1cfAClerVtw6TrfE7AXcn386zB6BbDb4S ihrXskyQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1syuSn-0000000DBe0-3oMd; Thu, 10 Oct 2024 14:48:25 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1syuCg-0000000D77D-1DsQ for linux-arm-kernel@bombadil.infradead.org; Thu, 10 Oct 2024 14:31:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=CC:To:In-Reply-To:References: Message-ID:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Sender:Reply-To:Content-ID:Content-Description; bh=cB08zjQih/Ih6h2EceQOGpBZJJTkTNDk33t9blGD3t4=; b=nSAuTsd1NwslTugXYFTdE9T3GC eUwBhTJUufJeHiX6Qz0dk88UQFDjx66Capv8S56bGK9JzupfmHEzzn76S3eIzRqhmtnztPTbdFj8x In0MC5kgH6tTpzR5EhBfBNpP1ohfWIVz2o9yBuFhhp962a6/Q08MCIUKJv03Lqha0A3lLJk02jmm/ tPpleGsK/KM4TkWheNxA+gWT70r3/T5KlkHxsnvAvbavB7JMMIfbGLZIs46gJB/wKTKqgkW7ZX0+8 8AvAApITqXzCA1umDlZsJrK407nxDeeQjV7fK7oC0oiVaOfbZXiyTQkNBAZALpXovcnvQEPL8R8d5 pHPSzzuA==; Received: from mx08-00178001.pphosted.com ([91.207.212.93] helo=mx07-00178001.pphosted.com) by desiato.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1syuCd-00000005P5G-10m8 for linux-arm-kernel@lists.infradead.org; Thu, 10 Oct 2024 14:31:44 +0000 Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49AE78eZ014745; Thu, 10 Oct 2024 16:31:33 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=selector1; bh= cB08zjQih/Ih6h2EceQOGpBZJJTkTNDk33t9blGD3t4=; b=m5qs6jehLgxPnCWR DkX+TkDcMnZsJhxMwsEwTYZuQND33toHLNPWRbBmb66SqUyuhJwsS1s0YIo9K9LY ivirtQsGbb8+rGvQA7dFwJHTRoc8nVJDFwjzZX8sPkGA1yu8Ehsa9HkW4ZefCWnX W6aCVShpaAPYyFR/sNOV/fjHu3wrpxxQh8Ikt/wKUb4FFIfg4sTpY0ps+pCbHqDL 3wcJA+eoj8iDVWHpK8EYa1QkW/u7Rwed4WbsHTrLN23/D5KyuC3VLefxNbUGlGfX rRjg7uX9YtS5gkqANrzC3sXKh7G/0MkTnbgGeZ8mXBiF9LEHCyJDqLj7lKgUZapz NUgk6A== Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 425w9xcvk6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 10 Oct 2024 16:31:33 +0200 (MEST) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 6EEA64008E; Thu, 10 Oct 2024 16:30:22 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id E6D6B2954B9; Thu, 10 Oct 2024 16:28:07 +0200 (CEST) Received: from localhost (10.252.31.182) by SHFDAG1NODE3.st.com (10.75.129.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37; Thu, 10 Oct 2024 16:28:07 +0200 From: Amelie Delaunay Date: Thu, 10 Oct 2024 16:27:52 +0200 Subject: [PATCH 02/11] dmaengine: stm32-dma3: prevent pack/unpack thanks to DT configuration MIME-Version: 1.0 Message-ID: <20241010-dma3-mp25-updates-v1-2-adf0633981ea@foss.st.com> References: <20241010-dma3-mp25-updates-v1-0-adf0633981ea@foss.st.com> In-Reply-To: <20241010-dma3-mp25-updates-v1-0-adf0633981ea@foss.st.com> To: Vinod Koul , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maxime Coquelin , Alexandre Torgue CC: , , , , , Amelie Delaunay X-Mailer: b4 0.14.2 X-Originating-IP: [10.252.31.182] X-ClientProxiedBy: SHFCAS1NODE1.st.com (10.75.129.72) To SHFDAG1NODE3.st.com (10.75.129.71) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241010_153143_418681_159476C3 X-CRM114-Status: GOOD ( 12.95 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 --- 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); From patchwork Thu Oct 10 14:27:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amelie Delaunay X-Patchwork-Id: 13830355 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E0981CF11F9 for ; Thu, 10 Oct 2024 14:51:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References :Message-ID:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=flmoFierCs+JniXlvBEJvgJIG06tQ88swW/XB8WPtvI=; b=kZRd2BjQPDb93z8tYdBDqIYHux N83vBvYXSkO++5VtYLtKDVYO8gT485QiC6CbSbfH9SyD4E/zwhjdZY2LkxNWZjWbgH/mlXfp+oTd8 MboUYooikJ7rMmiwAYEDiP2VLze5ZeaG6DRm+7ixM2YdN9tRcXnsHH031DpYG0fTNA8nsXlrPtobY TjaJZmz3VWmdPa3Ljy0alN32bhb5w6K+8bV3N6N0FpzGu/N5/tVVtmxgp6qd0Se85GTOOAHY0w9Ut 7x/VXkigtUKU9LGzY/W9qXgDnnayklco8IvLRdffmbqVI85lF8odUtXv+tG5gqEAOz5g0c2j9NSqx mYSefzPA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1syuVT-0000000DCKZ-0WxZ; Thu, 10 Oct 2024 14:51:11 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1syuCh-0000000D77x-2q8I for linux-arm-kernel@bombadil.infradead.org; Thu, 10 Oct 2024 14:31:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=CC:To:In-Reply-To:References: Message-ID:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Sender:Reply-To:Content-ID:Content-Description; bh=flmoFierCs+JniXlvBEJvgJIG06tQ88swW/XB8WPtvI=; b=atE8O48n9Enmu8CDwc890QGprx qSSgPLFQDb5Wrk1QtPinpdRRCaOktRXWUnGdHMVcN62Sie5nyH0ThTjYpq3drJ0G2FDYMfCV1Js++ xojenbrPl3ViyJZeXbBbewYldnIpxOHRootohxHyfrTJUOGeJfaeUT+Dg7ldLfQ1LV3uuiP55nLJw EdFHfc2ps8u1R7Wp/3o8rwxn0sT6aNlv+VGH6ElP1jcbdWtcy0Xpb24N7oi48TLIT+shhiJMC+KzA je9vgWouPzs/+b7jJ65ALbi8klQPchUtVT8HQgxgzEBzzkQ+tVVa23n5GZUinjOJgbRQ+Y761Q+ds xM9ijuVw==; Received: from mx08-00178001.pphosted.com ([91.207.212.93]) by desiato.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1syuCd-00000005P5H-2tlf for linux-arm-kernel@lists.infradead.org; Thu, 10 Oct 2024 14:31:46 +0000 Received: from pps.filterd (m0369457.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49ADrNAl004168; Thu, 10 Oct 2024 16:31:35 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=selector1; bh= flmoFierCs+JniXlvBEJvgJIG06tQ88swW/XB8WPtvI=; b=oTZVkyPm66f2JYE0 IL1aIO5niw7K0ae2ZMuaO/ZU3HfZkWRWp6cas7fReAL9ni4XUQulDW/zuGLIFs9k lCfJB5x6/m1Cy3x34CkzbdExGfAx7FnZWdd8aoAjdjJ071k9Xuc6Snai+zyubuxE Y+8zSc+k++RuM2hYoQ6AvYD6T3A/ao7+IC0RLeD2xnPO/epyqVEW3xhxLNLJWh89 uEoRFhgKQtvcuvwP1go8SgTV+YEGy18yBZY1GxEd8YTHBo1yGpMwByZydGPN7745 WoNbvs/vnRkQyHS4WlWQbDzy/C7TnaoilzwISs6R3o1zeQD8EVo18PSvDH/h6wWN XmtEqA== Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 425w7xmw5m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 10 Oct 2024 16:31:34 +0200 (MEST) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id AF98940060; Thu, 10 Oct 2024 16:30:22 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id BAA0C2954D6; Thu, 10 Oct 2024 16:28:08 +0200 (CEST) Received: from localhost (10.252.31.182) by SHFDAG1NODE3.st.com (10.75.129.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37; Thu, 10 Oct 2024 16:28:08 +0200 From: Amelie Delaunay Date: Thu, 10 Oct 2024 16:27:53 +0200 Subject: [PATCH 03/11] dmaengine: stm32-dma3: refactor HW linked-list to optimize memory accesses MIME-Version: 1.0 Message-ID: <20241010-dma3-mp25-updates-v1-3-adf0633981ea@foss.st.com> References: <20241010-dma3-mp25-updates-v1-0-adf0633981ea@foss.st.com> In-Reply-To: <20241010-dma3-mp25-updates-v1-0-adf0633981ea@foss.st.com> To: Vinod Koul , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maxime Coquelin , Alexandre Torgue CC: , , , , , Amelie Delaunay X-Mailer: b4 0.14.2 X-Originating-IP: [10.252.31.182] X-ClientProxiedBy: SHFCAS1NODE1.st.com (10.75.129.72) To SHFDAG1NODE3.st.com (10.75.129.71) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241010_153143_892057_E3DD558E X-CRM114-Status: GOOD ( 15.92 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 --- 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 */ From patchwork Thu Oct 10 14:27:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amelie Delaunay X-Patchwork-Id: 13830356 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AC8FACF11F5 for ; Thu, 10 Oct 2024 14:52:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References :Message-ID:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=h4I11Ou8IOZpUXGFEYlLtaaqmE8Vy707B+jgjAFXffM=; b=otXH8AnJT/Nf5/MRYuIDVe/MCz ro34xFTRNWKdqinLF+5SgzuN1KawKTng4eQqbGz7yXASHow96p0lLz34/c7f+tM1SrwcT6bHV3ddC S3Hex49iCjJrJqxzdsLAMKNMNySytYzJZPtjA5grjyXtqZ1tkC4aKMdz8q1Qcn9Pctc88tokEIN77 iA1l+RV5yHoRgzdIB+QrNZ6MIDjVMy7gaLnFvQFlfv+peOgqOVGdjglwxAtoDL74z//HCBHHFtFCR wangNZLPwaceKJxcaQKlyufEJ3Sv/vjQbYtiV5dy/cxjBWJ3EEc0ZgYx4zNJnVw4mVrSZ7MaC9uZM yv1U0zUA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1syuWp-0000000DCiM-2S7f; Thu, 10 Oct 2024 14:52:35 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1syuCi-0000000D783-0B0t for linux-arm-kernel@bombadil.infradead.org; Thu, 10 Oct 2024 14:31:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=CC:To:In-Reply-To:References: Message-ID:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Sender:Reply-To:Content-ID:Content-Description; bh=h4I11Ou8IOZpUXGFEYlLtaaqmE8Vy707B+jgjAFXffM=; b=ev7On37yNOBy/jfLrw7In8hFVZ fEwZ/InDStfbjTQIvyMQauTjY9X+LT3i+AWDlVhB+n8JBmY40z1cWTqjTu0ju+OeOFH7S8v83Tw0t e1r4aLOyGBK5O2iBuElZmn/qLGMxep94ypMg7Fwh3HmckBIeMpJCyVm9Rl9+BtkWSKX2UYXYc2FlM EW4gCkxqLyu29rdSxXdgEw/yWi2SzHR7j6C1kWwoIoXlNJXT+i4WhASZgHWD+EL0JLHrS0is+KONu 6YtXB3DerboZkSFD+o86UsbqQGx7BtBblvnMqVIga5nvi3MjMVsKLV89YyC4Ozl75IagDuoLV5EHO cSrlPHXA==; Received: from mx08-00178001.pphosted.com ([91.207.212.93] helo=mx07-00178001.pphosted.com) by desiato.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1syuCd-00000005P5J-26wZ for linux-arm-kernel@lists.infradead.org; Thu, 10 Oct 2024 14:31:46 +0000 Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49A93TNI014746; Thu, 10 Oct 2024 16:31:35 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=selector1; bh= h4I11Ou8IOZpUXGFEYlLtaaqmE8Vy707B+jgjAFXffM=; b=t+Tm3TBmhs0fEr10 plbNUtImFIFmEt0NkQBH9hdqo/B3SN/AhazROIGIKYGJl7JaGzjchPAbk9L6tx9x lb3I/S6hb01yQYRK4/GT3QLeMlZF213UHAY53Z+vzkpRH6b+cJEVTx2dgn60QJ+T Ge02QFlyqhi7s9FBfH4NbkfBhWkas4JUvFog1TkxBX4kNdPcxW+TA0r/ypAatkgF nGBsj04qL1JCqFplj4yMx6t1typIKnX6yTdEAec2QK+q3fNgPj9ZZ4KvlZepJKIM 3ng2FyH32jcftnftBRM9ri8cdS8nkz7435/xGOiIBV+wPJ0HY/aalajngYGgRuco D0/kSA== Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 425w9xcvka-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 10 Oct 2024 16:31:35 +0200 (MEST) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 41A454008D; Thu, 10 Oct 2024 16:30:22 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 81B392967DE; Thu, 10 Oct 2024 16:28:09 +0200 (CEST) Received: from localhost (10.252.31.182) by SHFDAG1NODE3.st.com (10.75.129.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37; Thu, 10 Oct 2024 16:28:09 +0200 From: Amelie Delaunay Date: Thu, 10 Oct 2024 16:27:54 +0200 Subject: [PATCH 04/11] dt-bindings: dma: stm32-dma3: prevent linked-list refactoring MIME-Version: 1.0 Message-ID: <20241010-dma3-mp25-updates-v1-4-adf0633981ea@foss.st.com> References: <20241010-dma3-mp25-updates-v1-0-adf0633981ea@foss.st.com> In-Reply-To: <20241010-dma3-mp25-updates-v1-0-adf0633981ea@foss.st.com> To: Vinod Koul , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maxime Coquelin , Alexandre Torgue CC: , , , , , Amelie Delaunay X-Mailer: b4 0.14.2 X-Originating-IP: [10.252.31.182] X-ClientProxiedBy: SHFCAS1NODE1.st.com (10.75.129.72) To SHFDAG1NODE3.st.com (10.75.129.71) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241010_153143_698274_7394DDD0 X-CRM114-Status: UNSURE ( 8.74 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 --- 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 From patchwork Thu Oct 10 14:27:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amelie Delaunay X-Patchwork-Id: 13830357 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 96BE7CF11F5 for ; Thu, 10 Oct 2024 14:54:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References :Message-ID:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Ty8+muhODEf7J0IrMecw+ogQitNlh/rpZ3rOexp30rY=; b=2qSky28ni5aM6RcG6stJGa1IfU t1rHlYkG8PM81sJSIhLeCUL/SczTVZaEi7JO+J7LezRUJ7LvRG2CbLXd9vBCx6JVnx1zhTBQ+t9TC xbJk3lme0NpHnIQLWAOw6cFxN11eY54Yad09dh+hNYv/iXLp8jB3opqrZHVdEkQ/ws/kGqvUvqNLu S7GdvA4/GtIgj/ySEVKtWIElCaVU7NW6BTXK+uRIIwI5VJIdzNWWrlZR0MY2R/jxHUmSnPvF3Ao1l 7jyY9wNaIvkC+OIblAENGo3Ju2xGSC3wOVd418YafGfXvZ/xei1R4SBEhLuDBp1Z2RWQjVBOF1DXH yW1ItyhA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1syuYD-0000000DD9c-05Ob; Thu, 10 Oct 2024 14:54:01 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1syuCi-0000000D784-0C33 for linux-arm-kernel@bombadil.infradead.org; Thu, 10 Oct 2024 14:31:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=CC:To:In-Reply-To:References: Message-ID:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Sender:Reply-To:Content-ID:Content-Description; bh=Ty8+muhODEf7J0IrMecw+ogQitNlh/rpZ3rOexp30rY=; b=qnUG10eHAp0+JKsdKN+AkdwHJK p5pqgphiUcHL0CM4PMb0TvC09PnytMZ53SUoFABBQVQ6YhtwuurrxcE42pZfYVK8kFJDVioOyoAKK 3Jh3Hn87iT4C7GXVZoBsTyYm+ZWtMi8UIi34chL1hrPjI0VWXZN7AgZOwV8QuwUiWnKnpBS0PgV42 CTfpg3Ej0ksCU4kKXVTTSuZqYlnHdsJTTqO1rU1olIiscO+bMKkk8/aXQKj7Rtc8Amn2QfXsp21Y5 NWmdWFN52qxuJF6JFN+kVyg0higZHO0Qa5lFyefginynMWNfscY51H1EK+/kCWE5vjjUL3xpE8ASq 9aGXkzQw==; Received: from mx08-00178001.pphosted.com ([91.207.212.93]) by desiato.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1syuCd-00000005P5F-0e3v for linux-arm-kernel@lists.infradead.org; Thu, 10 Oct 2024 14:31:46 +0000 Received: from pps.filterd (m0369457.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49A930tE006178; Thu, 10 Oct 2024 16:31:33 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=selector1; bh= Ty8+muhODEf7J0IrMecw+ogQitNlh/rpZ3rOexp30rY=; b=Nh2OI18wLXAI8+Lt i30VVFCvEw3GvJLNR3FoRmi3WsdlQOLV+c7R4qXYrcrI3o92EJPpsl6vTilI++HR fm/XAPWcq0/EzdSk3m0yVUL/8yfzx7PDWw/YiNT3/ch/qtT5qGp8pfT62QzpQyzX p1O/sfUNekPki+XCILgsYHwgFXVP812Vo3zzmtHYENCHKwQjlE40JIPoWX6QptZW RxfgLaivCqdbK3PSDe8C35drSudv7iX6xVtEIp0JVN2KuDPtEf7MBekNGatZ8U5+ Elxjdfp1oAbDGgNWlRab0bl2uj6kzel956C9RoWWloAxbE5TLHMLj7P4eTqu6e4+ hbI3Tg== Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 425w7xmw5k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 10 Oct 2024 16:31:33 +0200 (MEST) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 411534008C; Thu, 10 Oct 2024 16:30:22 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 50C85299278; Thu, 10 Oct 2024 16:28:10 +0200 (CEST) Received: from localhost (10.252.31.182) by SHFDAG1NODE3.st.com (10.75.129.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37; Thu, 10 Oct 2024 16:28:10 +0200 From: Amelie Delaunay Date: Thu, 10 Oct 2024 16:27:55 +0200 Subject: [PATCH 05/11] dmaengine: stm32-dma3: prevent LL refactoring thanks to DT configuration MIME-Version: 1.0 Message-ID: <20241010-dma3-mp25-updates-v1-5-adf0633981ea@foss.st.com> References: <20241010-dma3-mp25-updates-v1-0-adf0633981ea@foss.st.com> In-Reply-To: <20241010-dma3-mp25-updates-v1-0-adf0633981ea@foss.st.com> To: Vinod Koul , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maxime Coquelin , Alexandre Torgue CC: , , , , , Amelie Delaunay X-Mailer: b4 0.14.2 X-Originating-IP: [10.252.31.182] X-ClientProxiedBy: SHFCAS1NODE1.st.com (10.75.129.72) To SHFDAG1NODE3.st.com (10.75.129.71) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241010_153143_447491_D7193013 X-CRM114-Status: GOOD ( 14.82 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 --- 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) { From patchwork Thu Oct 10 14:27:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amelie Delaunay X-Patchwork-Id: 13830352 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5F350CF11F9 for ; Thu, 10 Oct 2024 14:47:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References :Message-ID:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=3tg5heSL9K2PVAn49c6WcA9lpmDYzguhmN52wf4h1Nw=; b=wia0JnEphCCxYl13z8GshikjIh fGMIVllksuGKxZIKXNJvVKsd6J+w8MvUPsIvVl+kokUOtu1hQo7UHnyzPgP8RynrAm7C61//MnUHp KUwF/zwJ+8P7Hi3554Kjhx0kr6yO0iKBgTslmfhVl1uN7FdlRKFnlnkRrQrjRuF8Qkx3+pR/j7Nhk rwfVc0AALL9FJXa8N7OifxqE0ROq8iQ/Mn2/CTBlawc9MlnFnF8xQ+jqeU7Qwiz8jXbxoWVkKuJUG NNIupPW5VC7Z0CbiiYG69Ge9/SGHTazAmeUVL5Bz0phNmipOAkChnZAFBHIbwJhosG7iLqONSp3L7 T8h3nk9g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1syuRT-0000000DBGp-02EA; Thu, 10 Oct 2024 14:47:03 +0000 Received: from mx08-00178001.pphosted.com ([91.207.212.93] helo=mx07-00178001.pphosted.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1syuCb-0000000D75E-2Opb for linux-arm-kernel@lists.infradead.org; Thu, 10 Oct 2024 14:31:43 +0000 Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49AEBqR0015320; Thu, 10 Oct 2024 16:31:35 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=selector1; bh= 3tg5heSL9K2PVAn49c6WcA9lpmDYzguhmN52wf4h1Nw=; b=FC+P2JHhQ0B2FzuZ OhFNJ6mHadbx4tePNYTJbVUkK9gqv13OlzwwQ5p+B8Bz5hsgAPkMZ0oqXlnGjX1Q /Z62ZNXdPJjrQpXwZ1slzmkLOHNP81QD7uBC7UV9Ez4QWNLDT/wHpGly2xxCKSSe jSJ25n6vCHu6M3Y9pjjb4aEV/bZZcVuYFqDBMJZiCnLKUUyMFYGBCWxAbIrVGXg/ igMwMXu8R0L8oAbrNZmKWW9yGnRPMJCLSuEgk1ftyVTP08XzflZFrgPCwDKqMPoH z5JUORT7YuazqpBhsPzMTRuaL0v0tA853+1/Jt3S8i1WtzfRZwZDleqCI8Qk7I/P WAvSEg== Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 425q97xxb8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 10 Oct 2024 16:31:35 +0200 (MEST) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 1C02740063; Thu, 10 Oct 2024 16:30:22 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 1CC0229ADCD; Thu, 10 Oct 2024 16:28:11 +0200 (CEST) Received: from localhost (10.252.31.182) by SHFDAG1NODE3.st.com (10.75.129.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37; Thu, 10 Oct 2024 16:28:10 +0200 From: Amelie Delaunay Date: Thu, 10 Oct 2024 16:27:56 +0200 Subject: [PATCH 06/11] dt-bindings: dma: stm32-dma3: introduce st,axi-max-burst-len property MIME-Version: 1.0 Message-ID: <20241010-dma3-mp25-updates-v1-6-adf0633981ea@foss.st.com> References: <20241010-dma3-mp25-updates-v1-0-adf0633981ea@foss.st.com> In-Reply-To: <20241010-dma3-mp25-updates-v1-0-adf0633981ea@foss.st.com> To: Vinod Koul , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maxime Coquelin , Alexandre Torgue CC: , , , , , Amelie Delaunay X-Mailer: b4 0.14.2 X-Originating-IP: [10.252.31.182] X-ClientProxiedBy: SHFCAS1NODE1.st.com (10.75.129.72) To SHFDAG1NODE3.st.com (10.75.129.71) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241010_073142_024243_57203331 X-CRM114-Status: GOOD ( 10.01 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 --- .../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: ; clocks = <&rcc CK_BUS_HPDMA1>; #dma-cells = <3>; + st,axi-max-burst-len = <16>; }; ... From patchwork Thu Oct 10 14:27:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amelie Delaunay X-Patchwork-Id: 13830350 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6ABD5CF11F5 for ; Thu, 10 Oct 2024 14:44:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References :Message-ID:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=lXOggrmLJ4pNLUyVaZZVXgs6uSGIqsznrV48VLvdy+A=; b=KW8X8buk3KUIlC+tdSZ4bBsO9C FacKBQX65nR41hQfacD+3G/3EQJasZOPjD9xCjZjRoLINFZc4VHqriybJNU7k8uxBn30o+zQkcfO8 O9EDc2pom179vzvpTthuzw+u/Uotohdk07pQ9O5klNIWJm3XWSmE/evTAboie518q2UBezmoBZyWI whCllGTUNBFmM5c9SQD/RDaZaFKQMn462s0fwehdy7NdPPvzZVeoEcP8yjD3Tk6KdL4LPQ4oTORWL pm/gfv7o+VFAdK/bg1AZqGMAwYwkf03PDhxPgVC8TMoASXMUxJJrWwJ332zd7p6C38+3Lg9yJq6t9 1Ks4BYiw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1syuOm-0000000DAhB-3fQT; Thu, 10 Oct 2024 14:44:16 +0000 Received: from mx08-00178001.pphosted.com ([91.207.212.93] helo=mx07-00178001.pphosted.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1syuCR-0000000D71p-2mzd for linux-arm-kernel@lists.infradead.org; Thu, 10 Oct 2024 14:31:34 +0000 Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49A93TND014746; Thu, 10 Oct 2024 16:31:17 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=selector1; bh= lXOggrmLJ4pNLUyVaZZVXgs6uSGIqsznrV48VLvdy+A=; b=otaknseOSiT9wBQd 0hZJ/EaWeaq0ijlc1b8L4Z33zoILKQt+WbyeS3fE2JMWd72WXndgDvN2WtQXHyFd WCcZUd08ur4fdCkKdU3JivhU3PlZ68Za1UrnhQYVwKjd0f+qrBWoFUqeYWd2wDWC B1IxnpgLlAmaZKGW8kXXlVcvaEv9KZxZ17F5E0xzHzvME9j1U61SMJsints3zSrN MJ6v2ht8Vdt5udyrxksqJ9bXKTl3qjZNd7qCus2hYmeEshPs3TMvyOJY7n8QbRQ/ OKtUCdGICC4/BRbkFOWidGTfxzIQ+ElND9VKgbEHW/mF4Yywi1vzQSUW6Tl0GX5J ql1i0g== Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 425w9xcvj9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 10 Oct 2024 16:31:17 +0200 (MEST) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id C7E8E4008F; Thu, 10 Oct 2024 16:30:24 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id DDE7829ADD0; Thu, 10 Oct 2024 16:28:11 +0200 (CEST) Received: from localhost (10.252.31.182) by SHFDAG1NODE3.st.com (10.75.129.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37; Thu, 10 Oct 2024 16:28:11 +0200 From: Amelie Delaunay Date: Thu, 10 Oct 2024 16:27:57 +0200 Subject: [PATCH 07/11] dmaengine: stm32-dma3: clamp AXI burst using st,axi-max-burst-len MIME-Version: 1.0 Message-ID: <20241010-dma3-mp25-updates-v1-7-adf0633981ea@foss.st.com> References: <20241010-dma3-mp25-updates-v1-0-adf0633981ea@foss.st.com> In-Reply-To: <20241010-dma3-mp25-updates-v1-0-adf0633981ea@foss.st.com> To: Vinod Koul , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maxime Coquelin , Alexandre Torgue CC: , , , , , Amelie Delaunay X-Mailer: b4 0.14.2 X-Originating-IP: [10.252.31.182] X-ClientProxiedBy: SHFCAS1NODE1.st.com (10.75.129.72) To SHFDAG1NODE3.st.com (10.75.129.71) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241010_073132_049126_2773AF65 X-CRM114-Status: GOOD ( 16.26 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 --- 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) { From patchwork Thu Oct 10 14:27:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amelie Delaunay X-Patchwork-Id: 13830349 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C444ECF11F8 for ; Thu, 10 Oct 2024 14:43:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References :Message-ID:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=O41xSOzJv31DX5Er3+Tj267w66tdT1K/Yy2IS+3r0fM=; b=b9QjYOsClsOg+CaARPqIEKMIiF 0/hBDIYBoaNn1Qpboe24RWMyPDO2/+HqsdekQxUZ8btZn4OJL+TfrKnlmwxoAOPyYhS/+g1C2LzWr Ighk57O5p3s2s/NMeS2x7bEghJ6YF90AqePtOfhoWUEbjIWHaGmmWu9VVq9YW1eBS3c1E0H2FStX8 eD6xl99z7V6twm1v29WADVDYy2Z9YQligXtsbIA4ed7Os0+jkUlZe9CPuvzrhjg8GhlvHrDCksU57 jlvReQX/e3bAKUYN/UJGizotOHLLVeTaK6bCBnrTVA1iqJnuBCIWG4X2w9ibwmg+gljuQgIjSKYwI 6qL77TFw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1syuNR-0000000DA6z-3jyg; Thu, 10 Oct 2024 14:42:53 +0000 Received: from mx08-00178001.pphosted.com ([91.207.212.93]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1syuCR-0000000D71E-27z7 for linux-arm-kernel@lists.infradead.org; Thu, 10 Oct 2024 14:31:33 +0000 Received: from pps.filterd (m0369457.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49AE3xWM004150; Thu, 10 Oct 2024 16:31:17 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=selector1; bh= O41xSOzJv31DX5Er3+Tj267w66tdT1K/Yy2IS+3r0fM=; b=nJaX0eR7Z/4Ss7Ld drCUwepSIpU3l3EmEE/katOm4AnSDO+Gajt8JFTpsehTbpyFhysmeFeXK5Id31hJ Mnf5GqvjP/4xZFdyxNGZSTjCsCjK9tojvn+bsW+gwtW7XV2M3DBWWTsrlv+Vnh9f pKcUVZpQXbsHtshyamo9s3gZMfBY9SuVQRADEZH7E2CvjJ3QuFMbKmpvvnEPVqpu k/cC1GURyEil+gb42/WX7zay7qsywXm/VFzPsg5CN4OtS1NlRATidRZ6KIu0AFB7 2IWhlFXf5ny5biXr1ufcZ9J7U59xQk/G6m//NHffWNhe+hK+60eNOg6+17nOJa6v 7Pe8TA== Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 425w7xmw4j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 10 Oct 2024 16:31:17 +0200 (MEST) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id C7C254005D; Thu, 10 Oct 2024 16:30:24 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id A36D129F351; Thu, 10 Oct 2024 16:28:12 +0200 (CEST) Received: from localhost (10.252.31.182) by SHFDAG1NODE3.st.com (10.75.129.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37; Thu, 10 Oct 2024 16:28:12 +0200 From: Amelie Delaunay Date: Thu, 10 Oct 2024 16:27:58 +0200 Subject: [PATCH 08/11] arm64: dts: st: limit axi burst length in dma nodes of stm32mp25 MIME-Version: 1.0 Message-ID: <20241010-dma3-mp25-updates-v1-8-adf0633981ea@foss.st.com> References: <20241010-dma3-mp25-updates-v1-0-adf0633981ea@foss.st.com> In-Reply-To: <20241010-dma3-mp25-updates-v1-0-adf0633981ea@foss.st.com> To: Vinod Koul , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maxime Coquelin , Alexandre Torgue CC: , , , , , Amelie Delaunay X-Mailer: b4 0.14.2 X-Originating-IP: [10.252.31.182] X-ClientProxiedBy: SHFCAS1NODE1.st.com (10.75.129.72) To SHFDAG1NODE3.st.com (10.75.129.71) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241010_073131_958302_0E0CEF3C X-CRM114-Status: UNSURE ( 9.11 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 --- 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 { ; 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 { ; 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 { ; clocks = <&scmi_clk CK_SCMI_HPDMA3>; #dma-cells = <3>; + st,axi-max-burst-len = <16>; }; rifsc: bus@42080000 { From patchwork Thu Oct 10 14:27:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amelie Delaunay X-Patchwork-Id: 13830346 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EC0F0CF11F5 for ; Thu, 10 Oct 2024 14:38:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References :Message-ID:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=8MPyclVKhT1SqE2t4XVJpyWaFLL2aGVzJRzqILZ09Yc=; b=eFCo7K/rOC8fMZCpKcPTVSFzT7 6N49poIVhkTRpGEG3KNvESlTJCEn6BqFqyRPBF2R1K5Eu5r5M3kbZGTYYJZ/pYci/9t/8PVJLt4NX KBwM1kKOFBWwDZPFodYBajqt71IgNqnsYyaZ8elbKeVuldEIb7kz7SI89m2dpPwV4teBovq3LbWMI JHCUNvJO9GQ9V7dP3NnKe7mvFPYsOU48aeARmN/mFZ+Ysvi81FK5wlWYx22loz2OAmcydz5efzeXV xITf6btwhcrZKqUSo/7cEJy+g+ZPgeW0/sI/ZCzMSuRkZ/ecJwi2Oti9OaLCaKA/w2xnX1S+kWRJN GrD/yLTg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1syuJT-0000000D8ui-2kBX; Thu, 10 Oct 2024 14:38:48 +0000 Received: from mx07-00178001.pphosted.com ([185.132.182.106]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1syuCN-0000000D6z5-0YKC for linux-arm-kernel@lists.infradead.org; Thu, 10 Oct 2024 14:31:28 +0000 Received: from pps.filterd (m0369458.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49AEHIn5000480; Thu, 10 Oct 2024 16:31:17 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=selector1; bh= 8MPyclVKhT1SqE2t4XVJpyWaFLL2aGVzJRzqILZ09Yc=; b=X9xdoSGcd7v/ZGT8 7LCp231hd5gwZRaeWLGEFnNIiJFny50VWdIJFqV2BaPX3lPRQ29ZbViFKYkroa2V 9QLsC/6yz7/7u6PA62KAAqyJVwMNX7xzz0zjODPCF4OpkGLo9E0rP9ZA+oGWWYdB pQ9R0hfojWv6S/jFjOnl3Gt9EFlWTOA3S5BRLBCJm++2l8I/tnXSKFkMSmqA7YtQ QpiR9UU9QqmFGkaM0SvZZYrMf1cm7Fzh6ADi3riRwfAu/aPP285oSQOSWvFtVI+p VsL/nrjA/ZLN7D+Lh3oVBVgZYliXgg8r/lu47//YASh3Kn6Kebwjhe9hucPFbQ00 UZBM0Q== Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 423f117cxy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 10 Oct 2024 16:31:17 +0200 (MEST) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id CC97B40090; Thu, 10 Oct 2024 16:30:26 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 6C6F12A2FD3; Thu, 10 Oct 2024 16:28:13 +0200 (CEST) Received: from localhost (10.252.31.182) by SHFDAG1NODE3.st.com (10.75.129.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37; Thu, 10 Oct 2024 16:28:13 +0200 From: Amelie Delaunay Date: Thu, 10 Oct 2024 16:27:59 +0200 Subject: [PATCH 09/11] arm64: dts: st: add DMA support on U(S)ART instances of stm32mp25 MIME-Version: 1.0 Message-ID: <20241010-dma3-mp25-updates-v1-9-adf0633981ea@foss.st.com> References: <20241010-dma3-mp25-updates-v1-0-adf0633981ea@foss.st.com> In-Reply-To: <20241010-dma3-mp25-updates-v1-0-adf0633981ea@foss.st.com> To: Vinod Koul , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maxime Coquelin , Alexandre Torgue CC: , , , , , Amelie Delaunay X-Mailer: b4 0.14.2 X-Originating-IP: [10.252.31.182] X-ClientProxiedBy: SHFCAS1NODE1.st.com (10.75.129.72) To SHFDAG1NODE3.st.com (10.75.129.71) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241010_073127_520250_F7EC2B0A X-CRM114-Status: UNSURE ( 9.17 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 --- 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 = ; 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 = ; 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 = ; 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 = ; 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 = ; 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 = ; 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 = ; 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 = ; 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 = ; 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"; }; From patchwork Thu Oct 10 14:28:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amelie Delaunay X-Patchwork-Id: 13830348 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D3ED7CF11F5 for ; Thu, 10 Oct 2024 14:41:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References :Message-ID:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=KH8nP8o/qes/Z0lwN5BroWJF926mtTX7phjDCx9kS2E=; b=IqTRi9USkM6GXEMrz3vYNiHcU3 yXWBsGbQlDPdpX/k7cB9tfZH/hiNZkIdWxqpU1yEms6mbS6IxS0Fsq17L/GzWAHfmxFWNSNzmKUZx /LzmQ/b5Li95pJgmevkMe8OXEx14URwG5r+OW9z6SKIiO7UiKTpQLSuhw2W+oMwx12E2gnKP5BlbW EMOkjeovcG6rNUimtaBuJfhyYaLdxXNY32GEVTJzzlY2CK28Dyq9RU5znWEj68rx0N/wtISpMBSCf eeuEOV/gsiMYRlL/lScOachn2bOF8BeTVCuUT5a1kGUbegM+6HrupgiivDF0jtAAyqJLvNJvaAiAT fTx1tgrg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1syuM8-0000000D9UW-137O; Thu, 10 Oct 2024 14:41:32 +0000 Received: from mx08-00178001.pphosted.com ([91.207.212.93]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1syuCR-0000000D71Z-20gr for linux-arm-kernel@lists.infradead.org; Thu, 10 Oct 2024 14:31:33 +0000 Received: from pps.filterd (m0369457.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49A92Fas006182; Thu, 10 Oct 2024 16:31:23 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=selector1; bh= KH8nP8o/qes/Z0lwN5BroWJF926mtTX7phjDCx9kS2E=; b=nSA93HAXkZWV5JM1 mT/sIvf83NaqDEfXZwfXkVlaS0VPBAAKgM5b6C49KNzrJxGIusadiCktEkkNXnnG oWYdBhSmLFhGFQdveS1QRQroHWa5jsvVivsa4mkWr5reUZPyjAdQk4YSr+P3E+sQ q851FJWbc7A4cK80EChr5i0L+R9zPKuqK80aKafNpWIIQMPEl1j/NtMWAjvrTU+g lWETU+iRKgaYsCNFcrEkmRw/yqSUI1x18/rsaCqU2lChgT+4UNFkTR7LmSj8cjXk b4mJVjwGvAyBuvCBY02weTTxZ65mZpo6SE7q3icvbKgZ/Rr/EHXqjtowEsO95tGv N7yx/Q== Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 425w7xmw4x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 10 Oct 2024 16:31:23 +0200 (MEST) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 570244005B; Thu, 10 Oct 2024 16:30:29 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 36FC12A2FDD; Thu, 10 Oct 2024 16:28:14 +0200 (CEST) Received: from localhost (10.252.31.182) by SHFDAG1NODE3.st.com (10.75.129.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37; Thu, 10 Oct 2024 16:28:13 +0200 From: Amelie Delaunay Date: Thu, 10 Oct 2024 16:28:00 +0200 Subject: [PATCH 10/11] arm64: dts: st: add DMA support on I2C instances of stm32mp25 MIME-Version: 1.0 Message-ID: <20241010-dma3-mp25-updates-v1-10-adf0633981ea@foss.st.com> References: <20241010-dma3-mp25-updates-v1-0-adf0633981ea@foss.st.com> In-Reply-To: <20241010-dma3-mp25-updates-v1-0-adf0633981ea@foss.st.com> To: Vinod Koul , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maxime Coquelin , Alexandre Torgue CC: , , , , , Amelie Delaunay X-Mailer: b4 0.14.2 X-Originating-IP: [10.252.31.182] X-ClientProxiedBy: SHFCAS1NODE1.st.com (10.75.129.72) To SHFDAG1NODE3.st.com (10.75.129.71) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241010_073131_960897_C2CD9696 X-CRM114-Status: UNSURE ( 8.85 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add dmas and dma-names properties in i2c nodes of stm32mp251.dtsi to enable DMA support. Signed-off-by: Amelie Delaunay --- 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"; }; From patchwork Thu Oct 10 14:28:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amelie Delaunay X-Patchwork-Id: 13830351 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 947B8CF11F5 for ; Thu, 10 Oct 2024 14:45:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References :Message-ID:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=vnJlgTm1gqjidTDkTZlQIM7j52C6ZHciLLrj+JNiIVA=; b=DvS9aF8yh6LAPEnw5JjM7u3FDe JTF6XmDvcl9RTrpLPKwR/BS8PWoVf+StupBSV2zSMfRNbL3jVJZIF0n0bQtutI832n+cLV20mM6bc I9DhcKMBxW6llB28tnFG6UHJWCYIPKpaQ05dja3jZ4VQz6GRqbjLciRUcOiNLxNUUoSPG4siAbkF2 JFLvfNhl4DUhvhvOWsKxeVp7SWhpGZzW9Q7hAPOW8I2BVPIwZKWDJYnlbOg39JilMjaTosuy3Asna bxWZdGSAJx0jgA8EpEKPaWhv/h/3/yWIFgDVNvxUKhUD2jspBsyWk8mLhVnb/fwnymAjCxmfqlC7k GX3WaxxQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1syuQ8-0000000DB06-3v1P; Thu, 10 Oct 2024 14:45:41 +0000 Received: from mx08-00178001.pphosted.com ([91.207.212.93] helo=mx07-00178001.pphosted.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1syuCU-0000000D72r-3nUE for linux-arm-kernel@lists.infradead.org; Thu, 10 Oct 2024 14:31:36 +0000 Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49AE6oNQ014652; Thu, 10 Oct 2024 16:31:28 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=selector1; bh= vnJlgTm1gqjidTDkTZlQIM7j52C6ZHciLLrj+JNiIVA=; b=hNiHo6ohz4knEUA5 +lLys73HhEupdjBrG49ArXSFWBR9lj8wnkQN9qGyY/RkbhuuqCNy/jI8tY110o3i k5ziWSN1xTrZRqD7r9Oin5OFVVgMl5ujn95AzpGadC6JUj3xUfFS0spEgJmrjPX0 JJg/oULv1kTeZURerzNnAU2Utl5VQCOoft3Accw6QW5rq5vCfV31Lpbq2RgTOo74 vM5IXqGMQsUA5jjmV9DIsdMiDvR8wzATvhQwVXMqvbxSNRbfut0iKyZgbOZMoDyE 2OrIqfqdvT/GvARh0NDI7k0f0mnn3APJaGOvqCylTQfFAdJvQyfwZrn1U8/8Kb7u hoM1BQ== Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 425w9xcvjx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 10 Oct 2024 16:31:28 +0200 (MEST) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 5D11240092; Thu, 10 Oct 2024 16:30:29 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 01BB42A2FE3; Thu, 10 Oct 2024 16:28:15 +0200 (CEST) Received: from localhost (10.252.31.182) by SHFDAG1NODE3.st.com (10.75.129.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37; Thu, 10 Oct 2024 16:28:14 +0200 From: Amelie Delaunay Date: Thu, 10 Oct 2024 16:28:01 +0200 Subject: [PATCH 11/11] arm64: dts: st: add DMA support on SPI instances of stm32mp25 MIME-Version: 1.0 Message-ID: <20241010-dma3-mp25-updates-v1-11-adf0633981ea@foss.st.com> References: <20241010-dma3-mp25-updates-v1-0-adf0633981ea@foss.st.com> In-Reply-To: <20241010-dma3-mp25-updates-v1-0-adf0633981ea@foss.st.com> To: Vinod Koul , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maxime Coquelin , Alexandre Torgue CC: , , , , , Amelie Delaunay X-Mailer: b4 0.14.2 X-Originating-IP: [10.252.31.182] X-ClientProxiedBy: SHFCAS1NODE1.st.com (10.75.129.72) To SHFDAG1NODE3.st.com (10.75.129.71) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241010_073135_305573_C62FA454 X-CRM114-Status: UNSURE ( 8.60 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add dmas and dma-names properties in spi nodes of stm32mp251.dtsi to enable DMA support. Signed-off-by: Amelie Delaunay --- 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 = ; 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 = ; 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 = ; 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 = ; 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 = ; 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 = ; 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 = ; 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 = ; 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"; };