[RFC 7/9] spi: spi-imx: replace struct spi_imx_data::bitbang by pointer to struct spi_controller

Baruch Siach baruch at tkos.co.il
Mon May 2 10:14:28 PDT 2022


Hi Marc,

On Mon, May 02 2022, Marc Kleine-Budde wrote:

> There's no need to embed the struct spi_bitbang into our private
> data (struct spi_imx_data), the spi core is flexible enough, so that
> we only need a pointer to the allocated struct spi_controller.
>
> This is also a preparation patch to add PIO based polling support to
> the driver.
>
> Co-developed-by: David Jander <david at protonic.nl>
> Signed-off-by: David Jander <david at protonic.nl>
> Signed-off-by: Marc Kleine-Budde <mkl at pengutronix.de>

[...]

> @@ -1641,17 +1642,17 @@ static int spi_imx_probe(struct platform_device *pdev)
>  	else
>  		controller->num_chipselect = 3;
>  
> -	spi_imx->bitbang.setup_transfer = spi_imx_setupxfer;
> -	spi_imx->bitbang.txrx_bufs = spi_imx_transfer;
> -	spi_imx->bitbang.master->setup = spi_imx_setup;
> -	spi_imx->bitbang.master->cleanup = spi_imx_cleanup;
> -	spi_imx->bitbang.master->prepare_message = spi_imx_prepare_message;
> -	spi_imx->bitbang.master->unprepare_message = spi_imx_unprepare_message;
> -	spi_imx->bitbang.master->slave_abort = spi_imx_slave_abort;
> -	spi_imx->bitbang.master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_NO_CS;
> +	spi_imx->controller->transfer_one = spi_imx_transfer_one;
> +	spi_imx->controller->setup = spi_imx_setup;
> +	spi_imx->controller->cleanup = spi_imx_cleanup;
> +	spi_imx->controller->prepare_message = spi_imx_prepare_message;
> +	spi_imx->controller->unprepare_message = spi_imx_unprepare_message;
> +	spi_imx->controller->slave_abort = spi_imx_slave_abort;
> +	spi_imx->controller->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_NO_CS;
> +
>  	if (is_imx35_cspi(spi_imx) || is_imx51_ecspi(spi_imx) ||
>  	    is_imx53_ecspi(spi_imx))
> -		spi_imx->bitbang.master->mode_bits |= SPI_LOOP | SPI_READY;
> +		spi_imx->controller->mode_bits |= SPI_LOOP | SPI_READY;
>  
>  	if (is_imx51_ecspi(spi_imx) &&
>  	    device_property_read_u32(&pdev->dev, "cs-gpios", NULL))

This hunk conflicts with commit 79422ed9bd7f ("spi: spi-imx: add support
for SPI_RX_CPHA_FLIP") in Mark's for-5.19 branch. That commit also adds
another reference to bitbang.master.

baruch

-- 
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -



More information about the linux-arm-kernel mailing list