From nobody Wed Nov 27 11:54:55 2024 Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 993A81F892A; Thu, 10 Oct 2024 14:31:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.207.212.93 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728570710; cv=none; b=bw2st9MZhiAbgHd+cVmo7PVKm0YHRD0lQIHWe4cZQ/bV76T6clIiYetaouqpFqCqjv4v8CDz33cKsFzVQXaYC6dI2tgHcvxjTWzF2mNF4xykpbnmDaDe669Z3LxtvHf/eJsiHCfKmXBN92OaZzAVkU2eyGu0Q6Z2jVp5vCvl8Xs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728570710; c=relaxed/simple; bh=5b5rfrygcx7Qo9y6A9GF0vdCRsrnMPdtDmlEDViOX1s=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=AVPNqLMeYr24YRHqmOR0awO/1xUpmCfHFaWpTC5dlqjcAlZ+zBzWcaFROtVGs4Kelvy6gdJIQwE0Y7IL4KcEewGhrk1VCCG+tVqQ+6XSkLQVrexqXACFVp/0LHgL/CaA7a+r3T+TVacVVuEr7cLd+/AEXmAgcct/ojCo+zmEwe8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com; spf=pass smtp.mailfrom=foss.st.com; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b=pVhB0R01; arc=none smtp.client-ip=91.207.212.93 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=foss.st.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="pVhB0R01" 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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-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 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 (=3D 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..5484848735f8ac3d2050104bbab= 1d986e82ba6a7 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 !=3D desti= nation data width/burst + 0x1: memory data width/burst forced to peripheral data width/bur= st to prevent pack/unpack =20 required: - compatible --=20 2.25.1 From nobody Wed Nov 27 11:54:55 2024 Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 623CE1F7069; Thu, 10 Oct 2024 14:31:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.207.212.93 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728570709; cv=none; b=a+Ikfh3eSeosKCaNDmK9DZv3Hc+ZWMIth+BG3Mj8fhh42LbuF9RIzaGbm277qvugZDRTuOJdFixs+tdzVQS2WqtvEczqjDaSCoM6hJk6mom1s7syWaYB44me3hi6FRb/BOoR4KuBu/CRx7lFCya1Di34xdQOSlw0BobK7uXVJF0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728570709; c=relaxed/simple; bh=M+OwuR2L3A1nuRrWpdlwUD5uHBzx8kDYo55SfadjvxE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=K0DMNzZ0+KNpwR5UPt3hkUN5fUfFB0wZxMeLBstfsDWP33kYgASFjU1/Hi3LRvGS0S2ysqqETnkeWClfY+QM7hPbwt7TXUl12ucPHBDQQ5POg7psA1cUjh/4m28mCvh01SCD+JMoy1o2YBY97OVCi+z2zNeuctDoYjuMBkbPDPY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com; spf=pass smtp.mailfrom=foss.st.com; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b=m5qs6jeh; arc=none smtp.client-ip=91.207.212.93 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=foss.st.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="m5qs6jeh" 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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-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 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 (=3D data width * burst) is reached. If the transfer is stopped before CxBR1.BNDT =3D 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..2b4cc479e1a1206fef7fd2808d1= 342048d81e07b 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 */ =20 /* 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_c= han *chan, enum dma_transf /* Set source (memory) data width and burst */ sdw =3D stm32_dma3_get_max_dw(chan->max_burst, sap_max_dw, len, src_addr= ); sbl_max =3D stm32_dma3_get_max_burst(len, sdw, chan->max_burst); + if (!!FIELD_GET(STM32_DMA3_DT_NOPACK, tr_conf)) { + sdw =3D ddw; + sbl_max =3D dbl_max; + } =20 _ctr1 |=3D FIELD_PREP(CTR1_SDW_LOG2, ilog2(sdw)); _ctr1 |=3D FIELD_PREP(CTR1_SBL_1, sbl_max - 1); @@ -652,6 +657,11 @@ static int stm32_dma3_chan_prep_hw(struct stm32_dma3_c= han *chan, enum dma_transf /* Set destination (memory) data width and burst */ ddw =3D stm32_dma3_get_max_dw(chan->max_burst, dap_max_dw, len, dst_addr= ); dbl_max =3D 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 s= upported */ + ddw =3D sdw; + dbl_max =3D sbl_max; + } =20 _ctr1 |=3D FIELD_PREP(CTR1_SDW_LOG2, ilog2(sdw)); _ctr1 |=3D FIELD_PREP(CTR1_SBL_1, sbl_max - 1); --=20 2.25.1 From nobody Wed Nov 27 11:54:55 2024 Received: from mx08-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BC4381F893E; Thu, 10 Oct 2024 14:31:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.207.212.93 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728570710; cv=none; b=j4klc8TvuCi+9/A9Er3nRWFYImV3x48lC/C2UfMv5BGpqmwm94BcEoSff86fi0iWj7R8ysARLOLnoChW2gEb50R8rcEkNVofRuFqvyBmzF33JRydUaXxAryR0tJaO/K0l3wA3to1lNqgraNWSeDJ/lXW48lJDkbKpNSn05qM3yA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728570710; c=relaxed/simple; bh=teOtRPXVUV5VcEQv1d58K8v+79Yaldd7tVTqbVmCS/k=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=OE1QwTstTQRV7jFLaMtsTLsB5yiOvWw7JGoLX6tntCiM41q+bXXBeXtG5RUSCNddFeWpBskNkzCWYQtZQOvE6uPIxBJl/3XhBmLrgW0Yf4T1vNNWwUhCHEDv9pxgtZdOHcMAuI2SawBc+Kck4nOKG6ABf0xYbN7ZGr0922ckS5A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com; spf=pass smtp.mailfrom=foss.st.com; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b=oTZVkyPm; arc=none smtp.client-ip=91.207.212.93 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=foss.st.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="oTZVkyPm" 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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-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 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..8cb112dc5e057d4832ca7e8bb38= c548ae7e269c3 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 dm= a_chan *c) chan->config_set =3D 0; } =20 +static u32 stm32_dma3_get_ll_count(struct stm32_dma3_chan *chan, size_t le= n) +{ + u32 count; + + count =3D len / STM32_DMA3_MAX_BLOCK_SIZE; + len -=3D (len / STM32_DMA3_MAX_BLOCK_SIZE) * STM32_DMA3_MAX_BLOCK_SIZE; + + if (len >=3D chan->max_burst) { + count +=3D 1; /* len < STM32_DMA3_MAX_BLOCK_SIZE here, so it fits in one= item */ + len -=3D (len / chan->max_burst) * chan->max_burst; + } + + /* Unaligned remainder fits in one extra item */ + if (len > 0) + count +=3D 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_pre= p_dma_memcpy(struct dma_cha size_t next_size, offset; u32 count, i, ctr1, ctr2; =20 - count =3D DIV_ROUND_UP(len, STM32_DMA3_MAX_BLOCK_SIZE); + count =3D stm32_dma3_get_ll_count(chan, len); =20 swdesc =3D stm32_dma3_chan_desc_alloc(chan, count); if (!swdesc) @@ -1177,6 +1196,9 @@ static struct dma_async_tx_descriptor *stm32_dma3_pre= p_dma_memcpy(struct dma_cha remaining =3D len - offset; next_size =3D min_t(size_t, remaining, STM32_DMA3_MAX_BLOCK_SIZE); =20 + if (next_size < STM32_DMA3_MAX_BLOCK_SIZE && next_size >=3D chan->max_bu= rst) + next_size =3D chan->max_burst * (remaining / chan->max_burst); + ret =3D stm32_dma3_chan_prep_hw(chan, DMA_MEM_TO_MEM, &swdesc->ccr, &ctr= 1, &ctr2, src + offset, dst + offset, next_size); if (ret) @@ -1215,12 +1237,9 @@ static struct dma_async_tx_descriptor *stm32_dma3_pr= ep_slave_sg(struct dma_chan u32 i, j, count, ctr1, ctr2; int ret; =20 - count =3D sg_len; - for_each_sg(sgl, sg, sg_len, i) { - len =3D sg_dma_len(sg); - if (len > STM32_DMA3_MAX_BLOCK_SIZE) - count +=3D DIV_ROUND_UP(len, STM32_DMA3_MAX_BLOCK_SIZE) - 1; - } + count =3D 0; + for_each_sg(sgl, sg, sg_len, i) + count +=3D stm32_dma3_get_ll_count(chan, sg_dma_len(sg)); =20 swdesc =3D stm32_dma3_chan_desc_alloc(chan, count); if (!swdesc) @@ -1237,6 +1256,9 @@ static struct dma_async_tx_descriptor *stm32_dma3_pre= p_slave_sg(struct dma_chan do { size_t chunk =3D min_t(size_t, len, STM32_DMA3_MAX_BLOCK_SIZE); =20 + if (chunk < STM32_DMA3_MAX_BLOCK_SIZE && chunk >=3D chan->max_burst) + chunk =3D chan->max_burst * (len / chan->max_burst); + if (dir =3D=3D DMA_MEM_TO_DEV) { src =3D sg_addr; dst =3D dev_addr; @@ -1269,6 +1291,10 @@ static struct dma_async_tx_descriptor *stm32_dma3_pr= ep_slave_sg(struct dma_chan } while (len); } =20 + if (count !=3D sg_len && chan->tcem !=3D CTR2_TCEM_CHANNEL) + dev_warn(chan2dev(chan), "Linked-list refactored, %d items instead of %d= \n", + count, sg_len); + /* Enable Error interrupts */ swdesc->ccr |=3D CCR_USEIE | CCR_ULEIE | CCR_DTEIE; /* Enable Transfer state interrupts */ --=20 2.25.1 From nobody Wed Nov 27 11:54:55 2024 Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 11E801F8EE5; Thu, 10 Oct 2024 14:31:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.207.212.93 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728570710; cv=none; b=i63gLmPl03LvXjqPoy5eRPoY+8GfO/i5AU0LnI0r6EzzKl2KM7bIT/jqEFrC0S0OXX+rQEz6SFsT8ILduwEgfeHj4tky5kGB85JB388rWa6UcyqRiG1FDGv0dftbAONGt8j/XLiZAbLRyiARV4priG+sv0yU3DH0pxZLsNQ4jyM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728570710; c=relaxed/simple; bh=N2m1gfifwajmg6EnZMzZvXKqHVIAAPvDCXo9JlOB5Tc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=G/88HeZagxOSlLeJ78Qe0bIMO9TXNhFrmcp+uPrYq+ZNcqq5qlF4kOiWhKQUneagS1O6g/0f5jfeDJKtT8wQVjF2cK5DorQqqvOgqNNaqTO/YeBaLhjZn3lR4UAWU6OqVnOOSn9SEgjsoIN7C6ZDAv2oOVWePdl3/uFoI+0qeZo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com; spf=pass smtp.mailfrom=foss.st.com; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b=t+Tm3TBm; arc=none smtp.client-ip=91.207.212.93 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=foss.st.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="t+Tm3TBm" 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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-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 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..38c30271f732e0c8da48199a224= a88bb647eeca7 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 !=3D desti= nation data width/burst 0x1: memory data width/burst forced to peripheral data width/bur= st to prevent pack/unpack + -bit 17: Prevent linked-list refactoring + 0x0: don't prevent driver to refactor the linked-list for optima= l performance + 0x1: prevent driver to refactor the linked-list, despite not opt= imal performance =20 required: - compatible --=20 2.25.1 From nobody Wed Nov 27 11:54:55 2024 Received: from mx08-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 032001F8EE2; Thu, 10 Oct 2024 14:31:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.207.212.93 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728570711; cv=none; b=OeY/Off2JW4p117CecMULNFohlwH+uT0BRNyYKkJYPbxnX7uajxzKvjSmAjc25aB5xF+3nJLIii3Ykrqv+8qVp+uGBKt7fpQSV+GgD7KGr1SZOHXDfZ+pI+WFOHyVY130CxEtUBJDh4I/g4b10KB9zYgt1J5/qgm99eBeITInI8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728570711; c=relaxed/simple; bh=ziLr/jqssxHfBtXxCvrHUJOT1YFEuA8iq2VvAtTofxQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=BVySXR1zlVGpPSXohdvJefZPgyJQjchLxbFSpCXS6TKgXxepLSHssIQSPPDyCeN0jKvESNZElbknjj9G6gS7HAKmOioZOoM5rjBJ16POxLgwz9moiC0rhMT6XG9hFI1ay+Yv6xnqh3QqcJj6dxrXwxmNP4lbNkt2+LsosSM/rzQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com; spf=pass smtp.mailfrom=foss.st.com; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b=Nh2OI18w; arc=none smtp.client-ip=91.207.212.93 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=foss.st.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="Nh2OI18w" 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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-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 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..1467308dd27c4674b13d2740c05= 087b1338fd91a 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) =20 /* 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 d= ma_chan *c) chan->config_set =3D 0; } =20 -static u32 stm32_dma3_get_ll_count(struct stm32_dma3_chan *chan, size_t le= n) +static u32 stm32_dma3_get_ll_count(struct stm32_dma3_chan *chan, size_t le= n, bool prevent_refactor) { u32 count; =20 + if (prevent_refactor) + return DIV_ROUND_UP(len, STM32_DMA3_MAX_BLOCK_SIZE); + count =3D len / STM32_DMA3_MAX_BLOCK_SIZE; len -=3D (len / STM32_DMA3_MAX_BLOCK_SIZE) * STM32_DMA3_MAX_BLOCK_SIZE; =20 @@ -1179,8 +1183,10 @@ static struct dma_async_tx_descriptor *stm32_dma3_pr= ep_dma_memcpy(struct dma_cha struct stm32_dma3_swdesc *swdesc; size_t next_size, offset; u32 count, i, ctr1, ctr2; + bool prevent_refactor =3D !!FIELD_GET(STM32_DMA3_DT_NOPACK, chan->dt_conf= ig.tr_conf) || + !!FIELD_GET(STM32_DMA3_DT_NOREFACT, chan->dt_config.tr_conf); =20 - count =3D stm32_dma3_get_ll_count(chan, len); + count =3D stm32_dma3_get_ll_count(chan, len, prevent_refactor); =20 swdesc =3D stm32_dma3_chan_desc_alloc(chan, count); if (!swdesc) @@ -1196,7 +1202,8 @@ static struct dma_async_tx_descriptor *stm32_dma3_pre= p_dma_memcpy(struct dma_cha remaining =3D len - offset; next_size =3D min_t(size_t, remaining, STM32_DMA3_MAX_BLOCK_SIZE); =20 - if (next_size < STM32_DMA3_MAX_BLOCK_SIZE && next_size >=3D chan->max_bu= rst) + if (!prevent_refactor && + (next_size < STM32_DMA3_MAX_BLOCK_SIZE && next_size >=3D chan->max_b= urst)) next_size =3D chan->max_burst * (remaining / chan->max_burst); =20 ret =3D stm32_dma3_chan_prep_hw(chan, DMA_MEM_TO_MEM, &swdesc->ccr, &ctr= 1, &ctr2, @@ -1235,11 +1242,13 @@ static struct dma_async_tx_descriptor *stm32_dma3_p= rep_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 =3D !!FIELD_GET(STM32_DMA3_DT_NOPACK, chan->dt_conf= ig.tr_conf) || + !!FIELD_GET(STM32_DMA3_DT_NOREFACT, chan->dt_config.tr_conf); int ret; =20 count =3D 0; for_each_sg(sgl, sg, sg_len, i) - count +=3D stm32_dma3_get_ll_count(chan, sg_dma_len(sg)); + count +=3D stm32_dma3_get_ll_count(chan, sg_dma_len(sg), prevent_refacto= r); =20 swdesc =3D stm32_dma3_chan_desc_alloc(chan, count); if (!swdesc) @@ -1256,7 +1265,8 @@ static struct dma_async_tx_descriptor *stm32_dma3_pre= p_slave_sg(struct dma_chan do { size_t chunk =3D min_t(size_t, len, STM32_DMA3_MAX_BLOCK_SIZE); =20 - if (chunk < STM32_DMA3_MAX_BLOCK_SIZE && chunk >=3D chan->max_burst) + if (!prevent_refactor && + (chunk < STM32_DMA3_MAX_BLOCK_SIZE && chunk >=3D chan->max_burst)) chunk =3D chan->max_burst * (len / chan->max_burst); =20 if (dir =3D=3D DMA_MEM_TO_DEV) { --=20 2.25.1 From nobody Wed Nov 27 11:54:55 2024 Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AB42E1E501C; Thu, 10 Oct 2024 14:31:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.207.212.93 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728570707; cv=none; b=Psl+O9Qk4wYVZ5/8QGxy2h0dS7gtWzhKB1fqzz2Qc9TDeM83huh3UDl4slVD67MRBX3Aeefac8acEzGhW/Y3Pz69WF75d89OUiGD7tuowfCAXhDCTaLjvt//YwcstyWFDw3JSkGFEQtm2JC9wIbybDOutlEOUkDEgrQOnVXF7qw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728570707; c=relaxed/simple; bh=Wl7mJJHMHC5fbp4XDTf6oU21ajk9DYyVD4gVRn4ZCJk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=clw/lq9C442pXStwokscQoGgWcSXLprCRXAYNKQY58Lh0rhinusBcWkBorF3QAJo/0c2GDOmyBmkruORBHsPDsTf393VHFAm8IQ95jWhKXuUeIv5LQUfuO87lOQcp7FttCQwz4L+m6pFhHd9IEIaAmbAyPEJBPhok5UGOE01bTw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com; spf=pass smtp.mailfrom=foss.st.com; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b=FC+P2JHh; arc=none smtp.client-ip=91.207.212.93 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=foss.st.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="FC+P2JHh" 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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-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 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=3D0)". 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-ad= vanced-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..90ad70bb24eb790afe72bf20854= 78fa4cec60b94 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 =20 + 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 D= MA3 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 =3D <&rcc CK_BUS_HPDMA1>; #dma-cells =3D <3>; + st,axi-max-burst-len =3D <16>; }; ... --=20 2.25.1 From nobody Wed Nov 27 11:54:55 2024 Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 66D6B1F7068; Thu, 10 Oct 2024 14:31:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.207.212.93 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728570704; cv=none; b=KULU1ymAlF1rDW932d2AkhixvaSUdH7AQn/MawW6OUkEbwE6xjac/Mh/Coy+Nbg0J4rWBjWhrP7t6YIHNVzQ/Fcij+ka85HYM8JPtxqIAqtMiFrRnXMC+MxG31C43Ip+Uoi4dOWlNYnBLYOFap5TSvQHT1ZCr/sawnILthdaYPo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728570704; c=relaxed/simple; bh=H4Vb9l0ydru2LFOevK3qVIBNjdyQfY5DsqaXXXWxBDg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=i5Gl87CDlbDoRxin6Xfk1LHafweeNYZ86HQLlnj3w+DeJEiNkcEv5gqLLR/ETiUcQgMG0B/eAP6orOwVWPknzAUF5/5QXnq6OYheeNZkOZ0T46wRMGTeMQlPB6FI9WLFEEZRDgJAz15if6mas1NaFjpPUoOBbU2/+8uadS6m5ws= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com; spf=pass smtp.mailfrom=foss.st.com; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b=otaknseO; arc=none smtp.client-ip=91.207.212.93 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=foss.st.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="otaknseO" 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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-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 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..e10689038d8269d23c3f38af9b1= 9cad0b6761fe3 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_S= ET_DMA) =20 #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, CTR= 1_SBL_1), \ + FIELD_GET(CTR1_DBL_1, CTR1_DBL_1))) #define port_is_ahb(maxdw) ({ typeof(maxdw) (_maxdw) =3D (maxdw); \ ((_maxdw) !=3D DW_INVALID) && ((_maxdw) =3D=3D DW_32); }) #define port_is_axi(maxdw) ({ typeof(maxdw) (_maxdw) =3D (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; }; =20 static inline struct stm32_dma3_ddata *to_stm32_dma3_ddata(struct stm32_dm= a3_chan *chan) @@ -535,7 +538,8 @@ static enum dma_slave_buswidth stm32_dma3_get_max_dw(u3= 2 chan_max_burst, return 1 << __ffs(len | addr | max_dw); } =20 -static u32 stm32_dma3_get_max_burst(u32 len, enum dma_slave_buswidth dw, u= 32 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 =3D chan_max_burst ? chan_max_burst / dw : 1; =20 @@ -546,8 +550,9 @@ static u32 stm32_dma3_get_max_burst(u32 len, enum dma_s= lave_buswidth dw, u32 cha /* * HW doesn't modify the burst if burst size <=3D 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); } =20 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_ch= an *chan, enum dma_transf { struct stm32_dma3_ddata *ddata =3D to_stm32_dma3_ddata(chan); struct dma_device dma_device =3D ddata->dma_dev; + u32 src_max_burst =3D STM32_DMA3_MAX_BURST_LEN, dst_max_burst =3D STM32_D= MA3_MAX_BURST_LEN; u32 sdw, ddw, sbl_max, dbl_max, tcem, init_dw, init_bl_max; u32 _ctr1 =3D 0, _ctr2 =3D 0; u32 ch_conf =3D 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 |=3D CTR1_SINC; if (sap) _ctr1 |=3D CTR1_SAP; + if (port_is_axi(sap_max_dw)) /* AXI - apply axi maximum burst limitation = */ + src_max_burst =3D ddata->axi_max_burst_len; if (FIELD_GET(STM32_DMA3_DT_DINC, tr_conf)) _ctr1 |=3D CTR1_DINC; if (dap) _ctr1 |=3D CTR1_DAP; + if (port_is_axi(dap_max_dw)) /* AXI - apply axi maximum burst limitation = */ + dst_max_burst =3D ddata->axi_max_burst_len; =20 _ctr2 |=3D FIELD_PREP(CTR2_REQSEL, chan->dt_config.req_line) & ~CTR2_SWRE= Q; 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 =3D min_t(u32, ddw, stm32_dma3_get_max_dw(chan->max_burst, dap_max_d= w, len, dst_addr)); - dbl_max =3D min_t(u32, dbl_max, stm32_dma3_get_max_burst(len, ddw, chan-= >max_burst)); + dbl_max =3D min_t(u32, dbl_max, stm32_dma3_get_max_burst(len, ddw, chan-= >max_burst, + dst_max_burst)); =20 /* Set source (memory) data width and burst */ sdw =3D stm32_dma3_get_max_dw(chan->max_burst, sap_max_dw, len, src_addr= ); - sbl_max =3D stm32_dma3_get_max_burst(len, sdw, chan->max_burst); + sbl_max =3D stm32_dma3_get_max_burst(len, sdw, chan->max_burst, src_max_= burst); if (!!FIELD_GET(STM32_DMA3_DT_NOPACK, tr_conf)) { sdw =3D ddw; sbl_max =3D 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 =3D min_t(u32, sdw, stm32_dma3_get_max_dw(chan->max_burst, sap_max_d= w, len, src_addr)); - sbl_max =3D min_t(u32, sbl_max, stm32_dma3_get_max_burst(len, sdw, chan-= >max_burst)); + sbl_max =3D min_t(u32, sbl_max, stm32_dma3_get_max_burst(len, sdw, chan-= >max_burst, + src_max_burst)); =20 /* Set destination (memory) data width and burst */ ddw =3D stm32_dma3_get_max_dw(chan->max_burst, dap_max_dw, len, dst_addr= ); - dbl_max =3D stm32_dma3_get_max_burst(len, ddw, chan->max_burst); + dbl_max =3D 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 s= upported */ ddw =3D sdw; @@ -689,22 +701,24 @@ static int stm32_dma3_chan_prep_hw(struct stm32_dma3_= chan *chan, enum dma_transf init_dw =3D sdw; init_bl_max =3D sbl_max; sdw =3D stm32_dma3_get_max_dw(chan->max_burst, sap_max_dw, len, src_addr= ); - sbl_max =3D stm32_dma3_get_max_burst(len, sdw, chan->max_burst); + sbl_max =3D stm32_dma3_get_max_burst(len, sdw, chan->max_burst, src_max_= burst); if (chan->config_set & STM32_DMA3_CFG_SET_DMA) { sdw =3D min_t(u32, init_dw, sdw); - sbl_max =3D min_t(u32, init_bl_max, - stm32_dma3_get_max_burst(len, sdw, chan->max_burst)); + sbl_max =3D min_t(u32, init_bl_max, stm32_dma3_get_max_burst(len, sdw, + chan->max_burst, + src_max_burst)); } =20 /* Set destination (memory) data width and burst */ init_dw =3D ddw; init_bl_max =3D dbl_max; ddw =3D stm32_dma3_get_max_dw(chan->max_burst, dap_max_dw, len, dst_addr= ); - dbl_max =3D stm32_dma3_get_max_burst(len, ddw, chan->max_burst); + dbl_max =3D stm32_dma3_get_max_burst(len, ddw, chan->max_burst, dst_max_= burst); if (chan->config_set & STM32_DMA3_CFG_SET_DMA) { ddw =3D min_t(u32, init_dw, ddw); - dbl_max =3D min_t(u32, init_bl_max, - stm32_dma3_get_max_burst(len, ddw, chan->max_burst)); + dbl_max =3D min_t(u32, init_bl_max, stm32_dma3_get_max_burst(len, ddw, + chan->max_burst, + dst_max_burst)); } =20 _ctr1 |=3D 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] =3D FIELD_GET(G_M1_DATA_WIDTH_ENC, hwcfgr); =20 + /* st,axi-max-burst-len is optional, if not defined, use STM32_DMA3_MAX_B= URST_LEN */ + if (of_property_read_u32(np, "st,axi-max-burst-len", &ddata->axi_max_burs= t_len)) + ddata->axi_max_burst_len =3D STM32_DMA3_MAX_BURST_LEN; + else + ddata->axi_max_burst_len =3D 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 =3D devm_kcalloc(&pdev->dev, ddata->dma_channels, sizeof(*dd= ata->chans), GFP_KERNEL); if (!ddata->chans) { --=20 2.25.1 From nobody Wed Nov 27 11:54:55 2024 Received: from mx08-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 66DBF1F7069; Thu, 10 Oct 2024 14:31:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.207.212.93 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728570704; cv=none; b=PatlWkgc1rtMr7Hb6/ZffKKQ+i+1mES9ATcLrlEroykgOMjp8L2oQjI61zwWxaXvORR7+48rVWTRglRG2Wgt84uRizAZN/d67bttmp0Nq5nD23/IRiX3D3I7i4ROXoNdcspn3ElDMAMq4+C3ZFXRpv3xWcdBjyGnTfuP5JYzGk8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728570704; c=relaxed/simple; bh=KoQGSnpOs6ieXxEnyHHrxeA6S2VnsBKxUAdaTMFg/9U=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=IuR9rTpmz4K3R3X/ZkCbDrJMerWrgpM0llI9ddn4YQ0lxokoX114iSAGxtFKFSe+A3E0LtEKFLiu/GLjFTenjvQGLbWmrRYkKNDmlI71ViM7bDSTcd4IUtYcoVCvO5ojH40igV50aJD1Q8upd5RkKkfOFa5ax+SnDfvM2Hvsbto= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com; spf=pass smtp.mailfrom=foss.st.com; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b=nJaX0eR7; arc=none smtp.client-ip=91.207.212.93 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=foss.st.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="nJaX0eR7" 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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-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 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-ad= vanced-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/s= t/stm32mp251.dtsi index 1167cf63d7e87aaa15c5c1ed70a9f6511fd818d4..443cc8d6ae8e9e2bff1bb862b09= 21d9626bb78e1 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 =3D <&scmi_clk CK_SCMI_HPDMA1>; #dma-cells =3D <3>; + st,axi-max-burst-len =3D <16>; }; =20 hpdma2: dma-controller@40410000 { @@ -204,6 +205,7 @@ hpdma2: dma-controller@40410000 { ; clocks =3D <&scmi_clk CK_SCMI_HPDMA2>; #dma-cells =3D <3>; + st,axi-max-burst-len =3D <16>; }; =20 hpdma3: dma-controller@40420000 { @@ -227,6 +229,7 @@ hpdma3: dma-controller@40420000 { ; clocks =3D <&scmi_clk CK_SCMI_HPDMA3>; #dma-cells =3D <3>; + st,axi-max-burst-len =3D <16>; }; =20 rifsc: bus@42080000 { --=20 2.25.1 From nobody Wed Nov 27 11:54:55 2024 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0F1411E501C; Thu, 10 Oct 2024 14:31:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.132.182.106 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728570698; cv=none; b=ARicn7mP4cDN7yT/Z4q7oqDEaOu1toISxaorYMfJmyo/vMWYsAYW78M1iVNJdC4IYbHSPg69HZkRRxCh4KbuEfWwaPG70OSiF56QPB6KQE7wV9mnT11PnFOAF3dlZJ91OiieLPXRuHn5WHZl91HCbSkaXFU5q/CRGi8MmvE42TI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728570698; c=relaxed/simple; bh=3v6FjEfaz++4mLu4YmJye5IHpRVQYZ2nW5wvg/RaGVs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=BxdYa6lvEIFiUneP0u0bJeh6R6MDCnd7vrUUn9YDgrT9apToeq96T3uuUW/DkJn/egtK62yxEgilEMD0laHYzv+eSNswH6lFBL61wfKjqSajiBhV0xVXUBl5sGY0N4G/rWgA37YCmLF+elyxPxsBWFhS/2zKqAsP/HcLnQIAZGE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com; spf=pass smtp.mailfrom=foss.st.com; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b=X9xdoSGc; arc=none smtp.client-ip=185.132.182.106 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=foss.st.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="X9xdoSGc" 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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-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 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/s= t/stm32mp251.dtsi index 443cc8d6ae8e9e2bff1bb862b0921d9626bb78e1..02fcb9fcff87ba9d5c1ecab0385= e3a57cde31e2e 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 =3D <0x400e0000 0x400>; interrupts =3D ; clocks =3D <&rcc CK_KER_USART2>; + dmas =3D <&hpdma 11 0x20 0x10012>, + <&hpdma 12 0x20 0x3021>; + dma-names =3D "rx", "tx"; access-controllers =3D <&rifsc 32>; status =3D "disabled"; }; @@ -278,6 +281,9 @@ usart3: serial@400f0000 { reg =3D <0x400f0000 0x400>; interrupts =3D ; clocks =3D <&rcc CK_KER_USART3>; + dmas =3D <&hpdma 13 0x20 0x10012>, + <&hpdma 14 0x20 0x3021>; + dma-names =3D "rx", "tx"; access-controllers =3D <&rifsc 33>; status =3D "disabled"; }; @@ -287,6 +293,9 @@ uart4: serial@40100000 { reg =3D <0x40100000 0x400>; interrupts =3D ; clocks =3D <&rcc CK_KER_UART4>; + dmas =3D <&hpdma 15 0x20 0x10012>, + <&hpdma 16 0x20 0x3021>; + dma-names =3D "rx", "tx"; access-controllers =3D <&rifsc 34>; status =3D "disabled"; }; @@ -296,6 +305,9 @@ uart5: serial@40110000 { reg =3D <0x40110000 0x400>; interrupts =3D ; clocks =3D <&rcc CK_KER_UART5>; + dmas =3D <&hpdma 17 0x20 0x10012>, + <&hpdma 18 0x20 0x3021>; + dma-names =3D "rx", "tx"; access-controllers =3D <&rifsc 35>; status =3D "disabled"; }; @@ -396,6 +408,9 @@ usart6: serial@40220000 { reg =3D <0x40220000 0x400>; interrupts =3D ; clocks =3D <&rcc CK_KER_USART6>; + dmas =3D <&hpdma 19 0x20 0x10012>, + <&hpdma 20 0x20 0x3021>; + dma-names =3D "rx", "tx"; access-controllers =3D <&rifsc 36>; status =3D "disabled"; }; @@ -441,6 +456,9 @@ uart9: serial@402c0000 { reg =3D <0x402c0000 0x400>; interrupts =3D ; clocks =3D <&rcc CK_KER_UART9>; + dmas =3D <&hpdma 25 0x20 0x10012>, + <&hpdma 26 0x20 0x3021>; + dma-names =3D "rx", "tx"; access-controllers =3D <&rifsc 39>; status =3D "disabled"; }; @@ -450,6 +468,9 @@ usart1: serial@40330000 { reg =3D <0x40330000 0x400>; interrupts =3D ; clocks =3D <&rcc CK_KER_USART1>; + dmas =3D <&hpdma 9 0x20 0x10012>, + <&hpdma 10 0x20 0x3021>; + dma-names =3D "rx", "tx"; access-controllers =3D <&rifsc 31>; status =3D "disabled"; }; @@ -483,6 +504,9 @@ uart7: serial@40370000 { reg =3D <0x40370000 0x400>; interrupts =3D ; clocks =3D <&rcc CK_KER_UART7>; + dmas =3D <&hpdma 21 0x20 0x10012>, + <&hpdma 22 0x20 0x3021>; + dma-names =3D "rx", "tx"; access-controllers =3D <&rifsc 37>; status =3D "disabled"; }; @@ -492,6 +516,9 @@ uart8: serial@40380000 { reg =3D <0x40380000 0x400>; interrupts =3D ; clocks =3D <&rcc CK_KER_UART8>; + dmas =3D <&hpdma 23 0x20 0x10012>, + <&hpdma 24 0x20 0x3021>; + dma-names =3D "rx", "tx"; access-controllers =3D <&rifsc 38>; status =3D "disabled"; }; diff --git a/arch/arm64/boot/dts/st/stm32mp257f-ev1.dts b/arch/arm64/boot/d= ts/st/stm32mp257f-ev1.dts index 214191a8322b81e7ae453503863b4465d9b625e0..d468dcbe849680de812a0ddd593= f30cbf507f645 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 =3D <&usart2_pins_a>; pinctrl-1 =3D <&usart2_idle_pins_a>; pinctrl-2 =3D <&usart2_sleep_pins_a>; + /delete-property/dmas; + /delete-property/dma-names; status =3D "okay"; }; =20 --=20 2.25.1 From nobody Wed Nov 27 11:54:55 2024 Received: from mx08-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4E4471CF285; Thu, 10 Oct 2024 14:31:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.207.212.93 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728570704; cv=none; b=bX6N34wOLV6C4osMYDflA9MZXHk5I9XfCh3BLp2YkVev86uapqLvW+OvuIrWr4voPxuz28v3UHD4hIPoGTwXHXxgE78n3eFXNPyeEqTbSPz9Ms315LrUyRGqL7rvey/HsHZ8IR/1GVQ144MQb62iVqsiD5yFSw3hpF78VVXZVws= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728570704; c=relaxed/simple; bh=K3X7oiSCcT8hUzV633V8iq+iIATr9PhSk/pOdFOaKsE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=fLkpE5Fpm1oVplCD/J9LFgbZAG9eEMDHCdI5tTjpeSOubejtUlrSsZpLwHRwfneYnf5Efi+QyQWT/SlwK0o2Z9SEgkU4STQvc4NLlrauRNQypavzkNADsiPRxDha63VA23h0tN9MnLWAueP25k+GNF2Dljw4UWxckBh6Oye8RM0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com; spf=pass smtp.mailfrom=foss.st.com; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b=nSA93HAX; arc=none smtp.client-ip=91.207.212.93 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=foss.st.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="nSA93HAX" 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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-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 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/s= t/stm32mp251.dtsi index 02fcb9fcff87ba9d5c1ecab0385e3a57cde31e2e..033da03d05a72c557dd81547fff= a54eefed1e9cd 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 =3D <&rcc I2C1_R>; #address-cells =3D <1>; #size-cells =3D <0>; + dmas =3D <&hpdma 27 0x20 0x3012>, + <&hpdma 28 0x20 0x3021>; + dma-names =3D "rx", "tx"; access-controllers =3D <&rifsc 41>; status =3D "disabled"; }; @@ -334,6 +337,9 @@ i2c2: i2c@40130000 { resets =3D <&rcc I2C2_R>; #address-cells =3D <1>; #size-cells =3D <0>; + dmas =3D <&hpdma 30 0x20 0x3012>, + <&hpdma 31 0x20 0x3021>; + dma-names =3D "rx", "tx"; access-controllers =3D <&rifsc 42>; status =3D "disabled"; }; @@ -347,6 +353,9 @@ i2c3: i2c@40140000 { resets =3D <&rcc I2C3_R>; #address-cells =3D <1>; #size-cells =3D <0>; + dmas =3D <&hpdma 33 0x20 0x3012>, + <&hpdma 34 0x20 0x3021>; + dma-names =3D "rx", "tx"; access-controllers =3D <&rifsc 43>; status =3D "disabled"; }; @@ -360,6 +369,9 @@ i2c4: i2c@40150000 { resets =3D <&rcc I2C4_R>; #address-cells =3D <1>; #size-cells =3D <0>; + dmas =3D <&hpdma 36 0x20 0x3012>, + <&hpdma 37 0x20 0x3021>; + dma-names =3D "rx", "tx"; access-controllers =3D <&rifsc 44>; status =3D "disabled"; }; @@ -373,6 +385,9 @@ i2c5: i2c@40160000 { resets =3D <&rcc I2C5_R>; #address-cells =3D <1>; #size-cells =3D <0>; + dmas =3D <&hpdma 39 0x20 0x3012>, + <&hpdma 40 0x20 0x3021>; + dma-names =3D "rx", "tx"; access-controllers =3D <&rifsc 45>; status =3D "disabled"; }; @@ -386,6 +401,9 @@ i2c6: i2c@40170000 { resets =3D <&rcc I2C6_R>; #address-cells =3D <1>; #size-cells =3D <0>; + dmas =3D <&hpdma 42 0x20 0x3012>, + <&hpdma 43 0x20 0x3021>; + dma-names =3D "rx", "tx"; access-controllers =3D <&rifsc 46>; status =3D "disabled"; }; @@ -399,6 +417,9 @@ i2c7: i2c@40180000 { resets =3D <&rcc I2C7_R>; #address-cells =3D <1>; #size-cells =3D <0>; + dmas =3D <&hpdma 45 0x20 0x3012>, + <&hpdma 46 0x20 0x3021>; + dma-names =3D "rx", "tx"; access-controllers =3D <&rifsc 47>; status =3D "disabled"; }; @@ -544,6 +565,9 @@ i2c8: i2c@46040000 { resets =3D <&rcc I2C8_R>; #address-cells =3D <1>; #size-cells =3D <0>; + dmas =3D <&hpdma 168 0x20 0x3012>, + <&hpdma 169 0x20 0x3021>; + dma-names =3D "rx", "tx"; access-controllers =3D <&rifsc 48>; status =3D "disabled"; }; --=20 2.25.1 From nobody Wed Nov 27 11:54:55 2024 Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AB4861F709C; Thu, 10 Oct 2024 14:31:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.207.212.93 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728570708; cv=none; b=aXa3GNSRZm+X7WYulDJoSnCp7fV7BvI9vlAmFWvdT6qhUkfpcMW1OOFJy6llsamVFivdHpqkyTablxQJd3iI8+5SFwHSRygPFalWCcoc780mYqT49RvcRVrgWxEineoU00o0cuN0hK8j34aWHy6c45ich9kvV1hRm6Wj0RkexCk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728570708; c=relaxed/simple; bh=RbwQzJBW1oOcotlmJXd7IOtfirB5xZbKCzbVWgPZjXA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=lZli+fKNrxf4OxSVOB7prEBGvOAOGGXqa6Mii8ifEu+dx22gH+aRQgYNxyh7nuDmHrlYs7e25+d//ef4bMJsjGXX9mXIe7jwa6IezFFXIEpC6CJe76NiypHHqnk8urvJpO43KNujBD/LxG91jLIZuxSGNW0t6X9RWk9/kzLpY4E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com; spf=pass smtp.mailfrom=foss.st.com; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b=hNiHo6oh; arc=none smtp.client-ip=91.207.212.93 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=foss.st.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="hNiHo6oh" 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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-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 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/s= t/stm32mp251.dtsi index 033da03d05a72c557dd81547fffa54eefed1e9cd..0d3a736d4a77c7c02b1e4d08466= 82e3d2039cb2c 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 =3D ; clocks =3D <&rcc CK_KER_SPI2>; resets =3D <&rcc SPI2_R>; + dmas =3D <&hpdma 51 0x20 0x3012>, + <&hpdma 52 0x20 0x3021>; + dma-names =3D "rx", "tx"; access-controllers =3D <&rifsc 23>; status =3D "disabled"; }; @@ -260,6 +263,9 @@ spi3: spi@400c0000 { interrupts =3D ; clocks =3D <&rcc CK_KER_SPI3>; resets =3D <&rcc SPI3_R>; + dmas =3D <&hpdma 53 0x20 0x3012>, + <&hpdma 54 0x20 0x3021>; + dma-names =3D "rx", "tx"; access-controllers =3D <&rifsc 24>; status =3D "disabled"; }; @@ -444,6 +450,9 @@ spi1: spi@40230000 { interrupts =3D ; clocks =3D <&rcc CK_KER_SPI1>; resets =3D <&rcc SPI1_R>; + dmas =3D <&hpdma 49 0x20 0x3012>, + <&hpdma 50 0x20 0x3021>; + dma-names =3D "rx", "tx"; access-controllers =3D <&rifsc 22>; status =3D "disabled"; }; @@ -456,6 +465,9 @@ spi4: spi@40240000 { interrupts =3D ; clocks =3D <&rcc CK_KER_SPI4>; resets =3D <&rcc SPI4_R>; + dmas =3D <&hpdma 55 0x20 0x3012>, + <&hpdma 56 0x20 0x3021>; + dma-names =3D "rx", "tx"; access-controllers =3D <&rifsc 25>; status =3D "disabled"; }; @@ -468,6 +480,9 @@ spi5: spi@40280000 { interrupts =3D ; clocks =3D <&rcc CK_KER_SPI5>; resets =3D <&rcc SPI5_R>; + dmas =3D <&hpdma 57 0x20 0x3012>, + <&hpdma 58 0x20 0x3021>; + dma-names =3D "rx", "tx"; access-controllers =3D <&rifsc 26>; status =3D "disabled"; }; @@ -504,6 +519,9 @@ spi6: spi@40350000 { interrupts =3D ; clocks =3D <&rcc CK_KER_SPI6>; resets =3D <&rcc SPI6_R>; + dmas =3D <&hpdma 59 0x20 0x3012>, + <&hpdma 60 0x20 0x3021>; + dma-names =3D "rx", "tx"; access-controllers =3D <&rifsc 27>; status =3D "disabled"; }; @@ -516,6 +534,9 @@ spi7: spi@40360000 { interrupts =3D ; clocks =3D <&rcc CK_KER_SPI7>; resets =3D <&rcc SPI7_R>; + dmas =3D <&hpdma 61 0x20 0x3012>, + <&hpdma 62 0x20 0x3021>; + dma-names =3D "rx", "tx"; access-controllers =3D <&rifsc 28>; status =3D "disabled"; }; @@ -552,6 +573,9 @@ spi8: spi@46020000 { interrupts =3D ; clocks =3D <&rcc CK_KER_SPI8>; resets =3D <&rcc SPI8_R>; + dmas =3D <&hpdma 171 0x20 0x3012>, + <&hpdma 172 0x20 0x3021>; + dma-names =3D "rx", "tx"; access-controllers =3D <&rifsc 29>; status =3D "disabled"; }; --=20 2.25.1