From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Mark Brown <broonie@kernel.org>
Cc: Frank Li <Frank.Li@nxp.com>,
linux-spi@vger.kernel.org, imx@lists.linux.dev,
linux-kernel@vger.kernel.org, kernel@pengutronix.de
Subject: Re: [PATCH spi-next 04/11] spi: spi-fsl-lpspi: fsl_lpspi_set_watermark(): use FIELD_PREP() to encode FIFO Status register
Date: Mon, 16 Mar 2026 19:31:04 +0100 [thread overview]
Message-ID: <20260316-imperious-amusing-dogfish-0ca492-mkl@pengutronix.de> (raw)
In-Reply-To: <b6787850-11cf-4b38-a5ea-da2c5d0811f4@sirena.org.uk>
[-- Attachment #1: Type: text/plain, Size: 2037 bytes --]
On 16.03.2026 18:16:01, Mark Brown wrote:
> On Mon, Mar 16, 2026 at 06:59:12PM +0100, Marc Kleine-Budde wrote:
> > On 16.03.2026 17:37:45, Mark Brown wrote:
> > > On Mon, Mar 16, 2026 at 05:49:48PM +0100, Marc Kleine-Budde wrote:
>
> > > > The param register's default value on the i.MX93 is:
>
> > > > | LPSPI1–LPSPI3: 0002_0303h
> > > > | LPSPI4: 0003_0303h
> > > > | LPSPI5–LPSPI8: 0002_0303h
>
> > > > This means a RX/TX-FIFO size of 1 << 3 == 8.
>
> > > Right, so the parsing code is using the wrong mask to extract the width
> > > here but with actual values it's fine.
>
> > No, the parsing code is correct, the width of the fields are 8 bits
> > (datasheet of all supported SoCs), but the values are "2" (i.MX7ulp,
> > S32G2) resp. "3" (i.MX93).
>
> Oh, dear, so that's potentially going to go badly if there's a SoC with
> a bigger FIFO that didn't also increase the watermark field width. We
> should at least warn about that, and ideally do something sensible.
Good idea, I'll add a warning if the FIFO is bigger than the watermark
field.
To handle this situation I see 2 options:
- warning + limit the FIFO to the usable size due to the currently
hard-coded watermark width - this will result in reduced throughput
- increase the watermark mask to 8 bits - which is basically how the
unpatched driver works.
As outlined in my previous mail, the other code in the driver takes
care that the watermark stays within the limits.
> > into the watermark fields. So using the 3 bit mask in FIELD_PREP should
> > not be a problem, even on the IP cores with just 2 bit wide mask.
>
> Yeah, it's not broken right now - just landmines for potential future
> SoCs to trip over.
ACK
regards,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung Nürnberg | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2026-03-16 18:31 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-16 8:39 [PATCH spi-next 00/11] spi: spi-fsl-lpspi: various cleanup and enhancement patches Marc Kleine-Budde
2026-03-16 8:39 ` [PATCH spi-next 01/11] spi: spi-fsl-lpspi: adapt to kernel coding style Marc Kleine-Budde
2026-03-16 8:39 ` [PATCH spi-next 02/11] spi: spi-fsl-lpspi: fsl_lpspi_probe(): use FIELD_GET to decode Parameter register Marc Kleine-Budde
2026-03-17 1:05 ` Frank Li
2026-03-17 9:04 ` Marc Kleine-Budde
2026-03-16 8:39 ` [PATCH spi-next 03/11] spi: spi-fsl-lpspi: fsl_lpspi_set_cmd(): use FIELD_PREP to encode Transmit Command register Marc Kleine-Budde
2026-03-16 8:39 ` [PATCH spi-next 04/11] spi: spi-fsl-lpspi: fsl_lpspi_set_watermark(): use FIELD_PREP() to encode FIFO Status register Marc Kleine-Budde
2026-03-16 14:39 ` Mark Brown
2026-03-16 16:49 ` Marc Kleine-Budde
2026-03-16 17:37 ` Mark Brown
2026-03-16 17:59 ` Marc Kleine-Budde
2026-03-16 18:16 ` Mark Brown
2026-03-16 18:31 ` Marc Kleine-Budde [this message]
2026-03-16 18:49 ` Mark Brown
2026-03-17 9:44 ` Marc Kleine-Budde
2026-03-19 18:17 ` Marc Kleine-Budde
2026-03-16 8:39 ` [PATCH spi-next 05/11] spi: spi-fsl-lpspi: fsl_lpspi_setup_transfer(): remove useless spi_transfer NULL pointer check Marc Kleine-Budde
2026-03-16 8:39 ` [PATCH spi-next 06/11] spi: spi-fsl-lpspi: fsl_lpspi_can_dma(): directly assign return value to fsl_lpspi->usedma Marc Kleine-Budde
2026-03-16 8:39 ` [PATCH spi-next 07/11] spi: spi-fsl-lpspi: fsl_lpspi_reset(): convert to void Marc Kleine-Budde
2026-03-16 8:39 ` [PATCH spi-next 08/11] spi: spi-fsl-lpspi: fsl_lpspi_write_tx_fifo(): simplify while() loop check Marc Kleine-Budde
2026-03-16 8:39 ` [PATCH spi-next 09/11] spi: spi-fsl-lpspi: make struct lpspi_config::mode u32 Marc Kleine-Budde
2026-03-16 8:39 ` [PATCH spi-next 10/11] spi: spi-fsl-lpspi: fsl_lpspi_set_cmd(): use mode from (struct fsl_lpspi_data::config::mode Marc Kleine-Budde
2026-03-16 11:51 ` Marek Vasut
2026-03-16 8:39 ` [PATCH spi-next 11/11] spi: spi-fsl-lpspi: fsl_lpspi_set_bitrate(): don't treat devtype_data->prescale_max == 0 as a special case Marc Kleine-Budde
2026-03-16 9:57 ` James Clark
2026-03-16 11:19 ` Marc Kleine-Budde
2026-03-16 12:08 ` James Clark
2026-03-16 12:11 ` Marc Kleine-Budde
2026-04-07 16:45 ` [PATCH spi-next 00/11] spi: spi-fsl-lpspi: various cleanup and enhancement patches Mark Brown
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=20260316-imperious-amusing-dogfish-0ca492-mkl@pengutronix.de \
--to=mkl@pengutronix.de \
--cc=Frank.Li@nxp.com \
--cc=broonie@kernel.org \
--cc=imx@lists.linux.dev \
--cc=kernel@pengutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
/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
all inboxes | Powered by JetHome®