lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aJ4sktG1NoMPu5wZ@lizhi-Precision-Tower-5810>
Date: Thu, 14 Aug 2025 14:36:02 -0400
From: Frank Li <Frank.li@....com>
To: James Clark <james.clark@...aro.org>
Cc: Mark Brown <broonie@...nel.org>, Clark Wang <xiaoning.wang@....com>,
	Fugang Duan <B38611@...escale.com>, Gao Pan <pandy.gao@....com>,
	Fugang Duan <fugang.duan@....com>, Rob Herring <robh@...nel.org>,
	Krzysztof Kozlowski <krzk+dt@...nel.org>,
	Conor Dooley <conor+dt@...nel.org>, Shawn Guo <shawnguo@...nel.org>,
	Sascha Hauer <s.hauer@...gutronix.de>,
	Fabio Estevam <festevam@...il.com>,
	Larisa Grigore <larisa.grigore@....nxp.com>,
	Larisa Grigore <larisa.grigore@....com>,
	Ghennadi Procopciuc <ghennadi.procopciuc@....com>,
	Ciprianmarian Costea <ciprianmarian.costea@....com>, s32@....com,
	linux-spi@...r.kernel.org, imx@...ts.linux.dev,
	linux-kernel@...r.kernel.org, devicetree@...r.kernel.org
Subject: Re: [PATCH 08/13] spi: spi-fsl-lpspi: Make prescale erratum a bool

On Thu, Aug 14, 2025 at 05:06:48PM +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 prescale values for
> every new device's devdata, make it a bool.
>
> Signed-off-by: James Clark <james.clark@...aro.org>
> ---
>  drivers/spi/spi-fsl-lpspi.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl-lpspi.c
> index 332a852b746f..1013d5c994e9 100644
> --- a/drivers/spi/spi-fsl-lpspi.c
> +++ b/drivers/spi/spi-fsl-lpspi.c
> @@ -96,7 +96,7 @@ static const char * const pincfgs[] = {
>  };
>
>  struct fsl_lpspi_devtype_data {
> -	u8 prescale_max;
> +	bool prescale_err : 1;
>  };
>
>  struct lpspi_config {
> @@ -144,13 +144,16 @@ 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 the full
> + * 3 bits are available (0-7).
>   */
>  static const struct fsl_lpspi_devtype_data imx93_lpspi_devtype_data = {
> -	.prescale_max = 1,
> +	.prescale_err = true,

I think prescale_max is good and clear enough, you can treat 0 as no
limit for prescale.

Frank
>  };
>
>  static const struct fsl_lpspi_devtype_data imx7ulp_lpspi_devtype_data = {
> -	.prescale_max = 7,
> +	.prescale_err = false,
>  };
>
>  static const struct of_device_id fsl_lpspi_dt_ids[] = {
> @@ -329,12 +332,11 @@ static int fsl_lpspi_set_bitrate(struct fsl_lpspi_data *fsl_lpspi)
>  {
>  	struct lpspi_config config = fsl_lpspi->config;
>  	unsigned int perclk_rate, div;
> -	u8 prescale_max;
> +	u8 prescale_max = fsl_lpspi->devtype_data->prescale_err ? 1 : 7;
>  	u8 prescale;
>  	int scldiv;
>
>  	perclk_rate = clk_get_rate(fsl_lpspi->clk_per);
> -	prescale_max = fsl_lpspi->devtype_data->prescale_max;
>
>  	if (!config.speed_hz) {
>  		dev_err(fsl_lpspi->dev,
>
> --
> 2.34.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ