public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Frank Li <Frank.li@nxp.com>
To: James Clark <james.clark@linaro.org>
Cc: Mark Brown <broonie@kernel.org>,
	Clark Wang <xiaoning.wang@nxp.com>, Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>,
	Larisa Grigore <larisa.grigore@oss.nxp.com>,
	Larisa Grigore <larisa.grigore@nxp.com>,
	Ghennadi Procopciuc <ghennadi.procopciuc@nxp.com>,
	Ciprianmarian Costea <ciprianmarian.costea@nxp.com>,
	s32@nxp.com, linux-spi@vger.kernel.org, imx@lists.linux.dev,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v2 7/9] spi: spi-fsl-lpspi: Treat prescale_max == 0 as no erratum
Date: Thu, 28 Aug 2025 14:13:52 -0400	[thread overview]
Message-ID: <aLCcYMBqCF5XaaaN@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20250828-james-nxp-lpspi-v2-7-6262b9aa9be4@linaro.org>

On Thu, Aug 28, 2025 at 11:14:46AM +0100, James Clark wrote:
> This erratum only ever results in a max value of 1, otherwise the full 3
> bits are available. To avoid repeating the same default prescale value
> for every new device's devdata, treat 0 as no limit (7) and only set a
> value when the erratum is present.
>
> Change the field to be 3 bits to catch out of range definitions.
>
> No functionality change.
>
> Signed-off-by: James Clark <james.clark@linaro.org>
> ---

Reviewed-by: Frank Li <Frank.Li@nxp.com>
>  drivers/spi/spi-fsl-lpspi.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl-lpspi.c
> index f16449cf42bb..ea25e8dab0a4 100644
> --- a/drivers/spi/spi-fsl-lpspi.c
> +++ b/drivers/spi/spi-fsl-lpspi.c
> @@ -86,7 +86,7 @@
>  #define SR_CLEAR_MASK	GENMASK(13, 8)
>
>  struct fsl_lpspi_devtype_data {
> -	u8 prescale_max;
> +	u8 prescale_max : 3; /* 0 == no limit */
>  };
>
>  struct lpspi_config {
> @@ -132,15 +132,15 @@ struct fsl_lpspi_data {
>  };
>
>  /*
> - * ERR051608 fixed or not:
> - * https://www.nxp.com/docs/en/errata/i.MX93_1P87f.pdf
> + * Devices with ERR051608 have a max TCR_PRESCALE value of 1, otherwise there is
> + * no prescale limit: https://www.nxp.com/docs/en/errata/i.MX93_1P87f.pdf
>   */
>  static const struct fsl_lpspi_devtype_data imx93_lpspi_devtype_data = {
>  	.prescale_max = 1,
>  };
>
>  static const struct fsl_lpspi_devtype_data imx7ulp_lpspi_devtype_data = {
> -	.prescale_max = 7,
> +	/* All defaults */
>  };
>
>  static const struct of_device_id fsl_lpspi_dt_ids[] = {
> @@ -324,7 +324,7 @@ static int fsl_lpspi_set_bitrate(struct fsl_lpspi_data *fsl_lpspi)
>  	int scldiv;
>
>  	perclk_rate = clk_get_rate(fsl_lpspi->clk_per);
> -	prescale_max = fsl_lpspi->devtype_data->prescale_max;
> +	prescale_max = fsl_lpspi->devtype_data->prescale_max ?: 7;
>
>  	if (!config.speed_hz) {
>  		dev_err(fsl_lpspi->dev,
>
> --
> 2.34.1
>

  reply	other threads:[~2025-08-28 18:14 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-28 10:14 [PATCH v2 0/9] spi: spi-fsl-lpspi: Generic fixes and support for S32G devices James Clark
2025-08-28 10:14 ` [PATCH v2 1/9] spi: spi-fsl-lpspi: Fix transmissions when using CONT James Clark
2025-08-29 11:38   ` Mark Brown
2025-08-29 14:27     ` Frank Li
2025-08-28 10:14 ` [PATCH v2 2/9] spi: spi-fsl-lpspi: Set correct chip-select polarity bit James Clark
2025-08-28 18:09   ` Frank Li
2025-08-28 10:14 ` [PATCH v2 3/9] spi: spi-fsl-lpspi: Reset FIFO and disable module on transfer abort James Clark
2025-08-28 10:14 ` [PATCH v2 4/9] spi: spi-fsl-lpspi: Clear status register after disabling the module James Clark
2025-08-28 10:14 ` [PATCH v2 5/9] dt-bindings: lpspi: Document support for S32G James Clark
2025-08-28 18:10   ` Frank Li
2025-08-29 17:52   ` Rob Herring (Arm)
2025-08-28 10:14 ` [PATCH v2 6/9] spi: spi-fsl-lpspi: Constify devtype datas James Clark
2025-08-28 18:11   ` Frank Li
2025-08-28 10:14 ` [PATCH v2 7/9] spi: spi-fsl-lpspi: Treat prescale_max == 0 as no erratum James Clark
2025-08-28 18:13   ` Frank Li [this message]
2025-08-28 10:14 ` [PATCH v2 8/9] spi: spi-fsl-lpspi: Parameterize reading num-cs from hardware James Clark
2025-08-28 18:14   ` Frank Li
2025-08-28 10:14 ` [PATCH v2 9/9] spi: spi-fsl-lpspi: Add compatible for S32G James Clark
2025-08-28 18:15   ` Frank Li
2025-09-02  9:50 ` [PATCH v2 0/9] spi: spi-fsl-lpspi: Generic fixes and support for S32G devices 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=aLCcYMBqCF5XaaaN@lizhi-Precision-Tower-5810 \
    --to=frank.li@nxp.com \
    --cc=broonie@kernel.org \
    --cc=ciprianmarian.costea@nxp.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=ghennadi.procopciuc@nxp.com \
    --cc=imx@lists.linux.dev \
    --cc=james.clark@linaro.org \
    --cc=krzk+dt@kernel.org \
    --cc=larisa.grigore@nxp.com \
    --cc=larisa.grigore@oss.nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=s32@nxp.com \
    --cc=shawnguo@kernel.org \
    --cc=xiaoning.wang@nxp.com \
    /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