Re: [PATCH 3/3] spi: spi-fsl-lpspi: support effective_speed_hz

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Sep 30, 2024 at 11:30:56AM +0200, Stefan Wahren wrote:
> Setting spi_transfer->effective_speed_hz in transfer_one so that
> SPI client driver can use it.
>
> Signed-off-by: Stefan Wahren <wahrenst@xxxxxxx>

Reviewed-by: Frank Li <Frank.Li@xxxxxxx>
> ---
>  drivers/spi/spi-fsl-lpspi.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl-lpspi.c
> index 3b5aa91079ae..5d55ef4d4ba6 100644
> --- a/drivers/spi/spi-fsl-lpspi.c
> +++ b/drivers/spi/spi-fsl-lpspi.c
> @@ -92,6 +92,7 @@ struct lpspi_config {
>  	u8 prescale;
>  	u16 mode;
>  	u32 speed_hz;
> +	u32 effective_speed_hz;
>  };
>
>  struct fsl_lpspi_data {
> @@ -351,6 +352,9 @@ static int fsl_lpspi_set_bitrate(struct fsl_lpspi_data *fsl_lpspi)
>  	writel(scldiv | (scldiv << 8) | ((scldiv >> 1) << 16),
>  					fsl_lpspi->base + IMX7ULP_CCR);
>
> +	fsl_lpspi->config.effective_speed_hz = perclk_rate / (scldiv + 2) *
> +					       (1 << prescale);
> +
>  	dev_dbg(fsl_lpspi->dev, "perclk=%u, speed=%u, prescale=%u, scldiv=%d\n",
>  		perclk_rate, config.speed_hz, prescale, scldiv);
>
> @@ -750,6 +754,8 @@ static int fsl_lpspi_transfer_one(struct spi_controller *controller,
>  	if (ret < 0)
>  		return ret;
>
> +	t->effective_speed_hz = fsl_lpspi->config.effective_speed_hz;
> +
>  	fsl_lpspi_set_cmd(fsl_lpspi);
>  	fsl_lpspi->is_first_byte = false;
>
> --
> 2.34.1
>




[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux