From nobody Sat Jun 13 04:17:48 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 9AF2137C910; Mon, 11 May 2026 03:36:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778470597; cv=none; b=WyPpDqiMuefo4ZskY1RIcZC+fO/C9MKlSgnM70fbK0lCiDKspOk0JKcJ29DRuLbWTU0yWrZdlGeHvma2OIOb9PvlYDDxjmOYEWEYCagjLbp+gohno/Wfj2LEqsuHcNnG/R0tAUjP+8F80Z8AcK7KI7eRolgQ/t699hzWEjVJqwQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778470597; c=relaxed/simple; bh=wrat4bPhc6XbDi2zqSt2OMWtek0S2JVfzoY+dgfGSJI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DF0V2g0ehZp+PvIa8GGSiCf+JNxqDLCnLtAdqjFyGkCH7/c610j3h4nS7mY7adu2j8MGNezpNZV21Z2ZKd9vzprz84TSEZGQHtUFcvb7Htp070HrQ9HYGSNczvasSwEwg9DW3CCbJeKK5GVWOf1XJjZvFpFM2TWL5VbyGMphRgc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JSXEM93z; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JSXEM93z" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11D93C2BCF6; Mon, 11 May 2026 03:36:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778470597; bh=wrat4bPhc6XbDi2zqSt2OMWtek0S2JVfzoY+dgfGSJI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JSXEM93ztq/DliQRZEBRzuFufPeaaJKqSPdKri4jbKnmRvkGp+NvU36sb0uiT38K3 k0Eg+pNqG66ThvNnalgrBlmj13G8248JVBzdXVZ42C9e8vYKeIydAUFTu9RR2QuKJQ yvrcBAV6e52lCIRmwbth5CJqpAeaf3nJMDqDHbdUl5NTAuWvCcs/f+Z8G/WK7JZ7yV hHxVxgy/DZGcxI2V8Mii8LNVLIRImgj6V+KvtrBvigf7pVaBD3hzX9qw1iXF8iq1/9 30JXFExylnqHFcoTQankbA/0DxOQljvGkQVSE0Vue02pBwsEj3etekewlznzVBpHxh xVB6uRJTwsO3Q== From: Jisheng Zhang To: Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-spi@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] spi: dt-bindings: cdns,xspi: add sdma-io-width Date: Mon, 11 May 2026 11:17:31 +0800 Message-ID: <20260511031732.3199-2-jszhang@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260511031732.3199-1-jszhang@kernel.org> References: <20260511031732.3199-1-jszhang@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The cdns xspi controller SDMA data port may support wider I/O width. Wider I/O width can benefit performance. A simple test with QSPI nor flash on one arm64 platform: 1 byte io width (default): # dd if=3D/dev/mtdblock0 of=3D/dev/null bs=3D8192 count=3D1000 1000+0 records in 1000+0 records out 8192000 bytes (7.8MB) copied, 1.368735 seconds, 5.7MB/s 4 bytes io width: # dd if=3D/dev/mtdblock0 of=3D/dev/null bs=3D8192 count=3D1000 1000+0 records in 1000+0 records out 8192000 bytes (7.8MB) copied, 1.088787 seconds, 7.2MB/s Improved by 26.3%! Add dt binding for sdma-io-width. Signed-off-by: Jisheng Zhang --- Documentation/devicetree/bindings/spi/cdns,xspi.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/spi/cdns,xspi.yaml b/Documen= tation/devicetree/bindings/spi/cdns,xspi.yaml index 38a5795589de..1fd4b6dfd417 100644 --- a/Documentation/devicetree/bindings/spi/cdns,xspi.yaml +++ b/Documentation/devicetree/bindings/spi/cdns,xspi.yaml @@ -40,6 +40,12 @@ properties: interrupts: maxItems: 1 =20 + sdma-io-width: + description: Slave DMA data port I/O width (in bytes) + $ref: /schemas/types.yaml#/definitions/uint32 + default: 1 + enum: [ 1, 4 ] + required: - compatible - reg --=20 2.53.0 From nobody Sat Jun 13 04:17:48 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 BC43A37CD3E; Mon, 11 May 2026 03:36:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778470599; cv=none; b=WN9bSfhXcGJ/XPxftTFrzgJdKt7zrAqHctlvvxRX7/6DwOlDqZtWTbeub8ZeTt640olqi/Myabhh/qeS6P5TNHz5Ya9SfqitEgif6+baXqEWAhcaZESJ7/RYuBCms6WR6YFrcCo+8i59wJTC2cH3hG+peR8g8uK8VZyaDIB8DoE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778470599; c=relaxed/simple; bh=GyBrdGpPxIAJW7UIim5m/rpLZCOK2WwyJZZq+uAJ6fM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CfUTGf34MzR77oluRn//BEXSZWPDT4q87W7dWHTQsKHngRumvNOswrN6yQ+098sAI+5B/EVgvTnWaHWXaO1EKSn10Dhq6b3FAH0MvC+WBkLZKRqdXG32zIV5oIX1xKKUXivBhoJCh5ngZFOQx1+MQfll500flz4J2R3GMneZUrE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PeUo1KRj; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PeUo1KRj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A98AFC2BCC7; Mon, 11 May 2026 03:36:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778470599; bh=GyBrdGpPxIAJW7UIim5m/rpLZCOK2WwyJZZq+uAJ6fM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PeUo1KRjD57S1I7rhf1LJ9TsoWgQXxyyiChRhq5hDhQbSrpYC1gKAVinC8/jJI4cw SFXqx5eaXmF8yyKaqpvyQYMI/0AVaQA7n0dK/ns2zg/5YiE73ylCHS1TCsEuG0aNSq avsIjtFCMnAQMw94D64Q8UJI9iJOsf94wVuPgqTcE2P9kyliVaSMYsoDS+AtprgOWy s81jWxvCKtDph/gB0oHAougFdJNYKMo/b4Lv5HVwW7EYehZ9tV5z5pYi9prJnCGVoG 2L4874jsYQbtatyddK94q69SpEN2Kg4FuPnsHNbjE66Po9z5Br8aYkvm+VFgr3NjG1 6qszCKL4lBBGQ== From: Jisheng Zhang To: Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-spi@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] spi: cadence-xspi: support 4bytes sdma-io-width Date: Mon, 11 May 2026 11:17:32 +0800 Message-ID: <20260511031732.3199-3-jszhang@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260511031732.3199-1-jszhang@kernel.org> References: <20260511031732.3199-1-jszhang@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The cdns xspi controller SDMA data port may support wider I/O width. Wider I/O width can benefit performance. A simple test with QSPI nor flash on one arm64 platform: 1 byte io width (default): # dd if=3D/dev/mtdblock0 of=3D/dev/null bs=3D8192 count=3D1000 1000+0 records in 1000+0 records out 8192000 bytes (7.8MB) copied, 1.368735 seconds, 5.7MB/s 4 bytes io width: # dd if=3D/dev/mtdblock0 of=3D/dev/null bs=3D8192 count=3D1000 1000+0 records in 1000+0 records out 8192000 bytes (7.8MB) copied, 1.088787 seconds, 7.2MB/s Improved by 26.3%! Signed-off-by: Jisheng Zhang --- drivers/spi/spi-cadence-xspi.c | 43 ++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-cadence-xspi.c b/drivers/spi/spi-cadence-xspi.c index 895b4b3276a5..c1fb749540e7 100644 --- a/drivers/spi/spi-cadence-xspi.c +++ b/drivers/spi/spi-cadence-xspi.c @@ -369,6 +369,7 @@ struct cdns_xspi_dev { =20 void *in_buffer; const void *out_buffer; + u32 sdma_io_width; =20 u8 hw_num_banks; =20 @@ -578,6 +579,38 @@ static int cdns_xspi_controller_init(struct cdns_xspi_= dev *cdns_xspi) return 0; } =20 +static inline void cdns_xspi_sdma_read(struct cdns_xspi_dev *cdns_xspi, si= ze_t len) +{ + void __iomem *src =3D cdns_xspi->sdmabase; + void *buf =3D cdns_xspi->in_buffer; + size_t offset =3D 0; + + if (cdns_xspi->sdma_io_width =3D=3D 4) { + if (IS_ALIGNED((uintptr_t)src, 4) && IS_ALIGNED((uintptr_t)buf, 4)) { + ioread32_rep(src, buf, len >> 2); + offset =3D len & ~0x3; + len -=3D offset; + } + } + ioread8_rep(src, (u8 *)buf + offset, len); +} + +static inline void cdns_xspi_sdma_write(struct cdns_xspi_dev *cdns_xspi, s= ize_t len) +{ + void __iomem *dst =3D cdns_xspi->sdmabase; + const void *buf =3D cdns_xspi->out_buffer; + size_t offset =3D 0; + + if (cdns_xspi->sdma_io_width =3D=3D 4) { + if (IS_ALIGNED((uintptr_t)dst, 4) && IS_ALIGNED((uintptr_t)buf, 4)) { + iowrite32_rep(dst, buf, len >> 2); + offset =3D len & ~0x3; + len -=3D offset; + } + } + iowrite8_rep(dst, (const u8 *)buf + offset, len); +} + static void cdns_xspi_sdma_handle(struct cdns_xspi_dev *cdns_xspi) { u32 sdma_size, sdma_trd_info; @@ -589,13 +622,11 @@ static void cdns_xspi_sdma_handle(struct cdns_xspi_de= v *cdns_xspi) =20 switch (sdma_dir) { case CDNS_XSPI_SDMA_DIR_READ: - ioread8_rep(cdns_xspi->sdmabase, - cdns_xspi->in_buffer, sdma_size); + cdns_xspi_sdma_read(cdns_xspi, sdma_size); break; =20 case CDNS_XSPI_SDMA_DIR_WRITE: - iowrite8_rep(cdns_xspi->sdmabase, - cdns_xspi->out_buffer, sdma_size); + cdns_xspi_sdma_write(cdns_xspi, sdma_size); break; } } @@ -1215,6 +1246,10 @@ static int cdns_xspi_probe(struct platform_device *p= dev) } } =20 + if (device_property_read_u32(&pdev->dev, "sdma-io-width", + &cdns_xspi->sdma_io_width)) + cdns_xspi->sdma_io_width =3D 1; + cdns_xspi->irq =3D platform_get_irq(pdev, 0); if (cdns_xspi->irq < 0) return -ENXIO; --=20 2.53.0