From: Alex Elder <elder@riscstar.com>
To: Frank Li <Frank.li@nxp.com>
Cc: han.xu@nxp.com, broonie@kernel.org, dlan@gentoo.org,
guodong@riscstar.com, linux-spi@vger.kernel.org,
imx@lists.linux.dev, spacemit@lists.linux.dev,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/8] spi: fsl-qspi: allot 1KB per chip
Date: Tue, 21 Oct 2025 23:34:26 -0500 [thread overview]
Message-ID: <06af60b7-7ef7-451c-babd-e612a356013c@riscstar.com> (raw)
In-Reply-To: <aPaLibm+oVKSDbL9@lizhi-Precision-Tower-5810>
On 10/20/25 2:20 PM, Frank Li wrote:
> On Mon, Oct 20, 2025 at 11:51:48AM -0500, Alex Elder wrote:
>> In fsl_qspi_default_setup(), four registers define the size
>> of blocks of data to written to each of four chips that
>> comprise SPI NOR flash storage. They are currently defined
>> to be the same as the AHB buffer size (which is always 1KB).
>>
>> The SpacemiT QSPI has an AHB buffer size of 512 bytes, but
>> requires these four sizes to be multiples of 1024 bytes.
>
> I think it'd better to add field at fsl_qspi_devtype_data, like
> sfa_size.
OK.
> sz = q->devtype_data->sfa_size ? q->devtype_data->sfa_size : q->devtype_data->ahb_buf_size.
Why not just set sfa_size always then?
Anyway my biggest concern on this was what to call it. What
does "sfa" stand for?
I'll do it the way you suggest for v2.
Thanks.
-Alex
>
> qspi_writel(q, addr_offset + 1 * sz, base + QUADSPI_SFA1AD);
> ...
>
> Frank
>>
>> Rather than add a new quirk to support this scenario, just
>> define the four sizes to be 1KB rather than being dependent
>> on the AHB buffer size.
>>
>> Signed-off-by: Alex Elder <elder@riscstar.com>
>> ---
>> drivers/spi/spi-fsl-qspi.c | 17 +++++++----------
>> 1 file changed, 7 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/spi/spi-fsl-qspi.c b/drivers/spi/spi-fsl-qspi.c
>> index 703a7df394c00..9ecb756b33dba 100644
>> --- a/drivers/spi/spi-fsl-qspi.c
>> +++ b/drivers/spi/spi-fsl-qspi.c
>> @@ -795,17 +795,14 @@ static int fsl_qspi_default_setup(struct fsl_qspi *q)
>> * In HW there can be a maximum of four chips on two buses with
>> * two chip selects on each bus. We use four chip selects in SW
>> * to differentiate between the four chips.
>> - * We use ahb_buf_size for each chip and set SFA1AD, SFA2AD, SFB1AD,
>> - * SFB2AD accordingly.
>> + *
>> + * We use 1K for each chip and set SFA1AD, SFA2AD, SFB1AD, SFB2AD
>> + * accordingly.
>> */
>> - qspi_writel(q, q->devtype_data->ahb_buf_size + addr_offset,
>> - base + QUADSPI_SFA1AD);
>> - qspi_writel(q, q->devtype_data->ahb_buf_size * 2 + addr_offset,
>> - base + QUADSPI_SFA2AD);
>> - qspi_writel(q, q->devtype_data->ahb_buf_size * 3 + addr_offset,
>> - base + QUADSPI_SFB1AD);
>> - qspi_writel(q, q->devtype_data->ahb_buf_size * 4 + addr_offset,
>> - base + QUADSPI_SFB2AD);
>> + qspi_writel(q, addr_offset + 1 * SZ_1K, base + QUADSPI_SFA1AD);
>> + qspi_writel(q, addr_offset + 2 * SZ_1K, base + QUADSPI_SFA2AD);
>> + qspi_writel(q, addr_offset + 3 * SZ_1K, base + QUADSPI_SFB1AD);
>> + qspi_writel(q, addr_offset + 4 * SZ_1K, base + QUADSPI_SFB2AD);
>>
>> q->selected = -1;
>>
>> --
>> 2.48.1
>>
next prev parent reply other threads:[~2025-10-22 4:34 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-20 16:51 [PATCH 0/8] spi: enable the SpacemiT K1 SoC QSPI Alex Elder
2025-10-20 16:51 ` [PATCH 1/8] dt-bindings: spi: fsl-qspi: add optional resets Alex Elder
2025-10-20 17:44 ` Conor Dooley
2025-10-20 18:06 ` Alex Elder
2025-10-20 16:51 ` [PATCH 2/8] dt-bindings: spi: fsl-qspi: support SpacemiT K1 Alex Elder
2025-10-20 17:39 ` Conor Dooley
2025-10-20 18:06 ` Alex Elder
2025-10-20 18:26 ` Mark Brown
2025-10-20 18:37 ` Alex Elder
2025-10-20 18:39 ` Conor Dooley
2025-10-22 4:34 ` Alex Elder
2025-10-20 17:41 ` Conor Dooley
2025-10-20 18:06 ` Alex Elder
2025-10-20 18:41 ` Conor Dooley
2025-10-20 16:51 ` [PATCH 3/8] spi: fsl-qspi: add optional reset support Alex Elder
2025-10-20 19:07 ` Frank Li
2025-10-22 4:34 ` Alex Elder
2025-10-20 16:51 ` [PATCH 4/8] spi: fsl-qspi: add a clock disable quirk Alex Elder
2025-10-20 19:13 ` Frank Li
2025-10-22 4:34 ` Alex Elder
2025-10-20 16:51 ` [PATCH 5/8] spi: fsl-qspi: allot 1KB per chip Alex Elder
2025-10-20 19:20 ` Frank Li
2025-10-22 4:34 ` Alex Elder [this message]
2025-10-20 16:51 ` [PATCH 6/8] spi: fsl-qspi: support the SpacemiT K1 SoC Alex Elder
2025-10-20 19:23 ` Frank Li
2025-10-22 4:34 ` Alex Elder
2025-10-20 16:51 ` [PATCH 7/8] riscv: dts: spacemit: enable K1 SoC QSPI on BPI-F3 Alex Elder
2025-10-20 16:51 ` [PATCH 8/8] riscv: defconfig: enable SPI_FSL_QUADSPI as a module Alex Elder
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=06af60b7-7ef7-451c-babd-e612a356013c@riscstar.com \
--to=elder@riscstar.com \
--cc=Frank.li@nxp.com \
--cc=broonie@kernel.org \
--cc=dlan@gentoo.org \
--cc=guodong@riscstar.com \
--cc=han.xu@nxp.com \
--cc=imx@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-spi@vger.kernel.org \
--cc=spacemit@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox