[PATCH] spi: pxa2xx_spi: Convert to use GPIO descriptors

Jonathan Cameron Jonathan.Cameron at Huawei.com
Fri Jan 21 01:42:43 PST 2022


On Fri, 21 Jan 2022 02:20:14 +0100
Linus Walleij <linus.walleij at linaro.org> wrote:

> This converts the PXA2xx SPI driver to use GPIO descriptors
> exclusively to retrieve GPIO chip select lines.
> 
> The device tree and ACPI paths of the driver already use
> descriptors, hence ->use_gpio_descriptors is already set and
> this codepath is well tested.
> 
> Convert all the PXA boards providing chip select GPIOs as
> platform data and drop the old GPIO chipselect handling in
> favor of the core managing it exclusively.
> 
> Cc: Marek Vasut <marek.vasut at gmail.com>
> Cc: Daniel Mack <daniel at zonque.org>
> Cc: Haojian Zhuang <haojian.zhuang at gmail.com>
> Cc: Robert Jarzmik <robert.jarzmik at free.fr>
> Cc: linux-arm-kernel at lists.infradead.org
> Signed-off-by: Linus Walleij <linus.walleij at linaro.org>
> ---
>  Documentation/spi/pxa2xx.rst   |  3 --
>  arch/arm/mach-pxa/corgi.c      | 26 +++++++---------
>  arch/arm/mach-pxa/hx4700.c     | 10 +++++-
>  arch/arm/mach-pxa/icontrol.c   | 26 +++++++++++++---
>  arch/arm/mach-pxa/littleton.c  | 10 +++++-
>  arch/arm/mach-pxa/magician.c   | 12 +++++--
>  arch/arm/mach-pxa/poodle.c     | 14 ++++++---
>  arch/arm/mach-pxa/spitz.c      | 26 +++++++---------
>  arch/arm/mach-pxa/stargate2.c  | 21 +++++++++++--
>  arch/arm/mach-pxa/z2.c         | 20 ++++++++++--
>  drivers/spi/spi-pxa2xx.c       | 57 ----------------------------------
>  include/linux/spi/pxa2xx_spi.h |  1 -
>  12 files changed, 117 insertions(+), 109 deletions(-)
> 

...

> diff --git a/arch/arm/mach-pxa/stargate2.c b/arch/arm/mach-pxa/stargate2.c
> index 8ca02ec1d44c..650043023006 100644
> --- a/arch/arm/mach-pxa/stargate2.c
> +++ b/arch/arm/mach-pxa/stargate2.c
> @@ -346,6 +346,23 @@ static struct pxa2xx_spi_controller pxa_ssp_master_2_info = {
>  	.num_chipselect = 1,
>  };
>  
> +static struct gpiod_lookup_table pxa_ssp1_gpio_table = {
> +	.dev_id = "pxa2xx-spi.1",
> +	.table = {
> +		GPIO_LOOKUP_IDX("gpio-pxa", 24, "cs", 0, GPIO_ACTIVE_LOW),
> +		{ },
> +	},
> +};
> +
> +static struct gpiod_lookup_table pxa_ssp3_gpio_table = {
> +	.dev_id = "pxa2xx-spi.3",
> +	.table = {
> +		GPIO_LOOKUP_IDX("gpio-pxa", 39, "cs", 0, GPIO_ACTIVE_LOW),
> +		{ },
> +	},
> +};
> +

Nitpick, one line will do.

As a side note I have a patch outstanding (from May 2021) to drop
stargate2/imote2 on basis that I strongly suspect I'm the only person
who still has access to hardware and I've not booted one for a few years.

https://lore.kernel.org/all/20210523163606.1966355-1-jic23@kernel.org/
Patch still applies cleanly.

In meantime for stargate2/imote2 (same file)  Should both patches go in
the merge conflict will be very obvious ;)

Acked-by: Jonathan Cameron <Jonathan.Cameron at huawei.com>

> +
>  /* An upcoming kernel change will scrap SFRM usage so these
>   * drivers have been moved to use GPIOs */
>  static struct pxa2xx_spi_chip staccel_chip_info = {
> @@ -353,7 +370,6 @@ static struct pxa2xx_spi_chip staccel_chip_info = {
>  	.rx_threshold = 8,
>  	.dma_burst_size = 8,
>  	.timeout = 235,
> -	.gpio_cs = 24,
>  };
>  
>  static struct pxa2xx_spi_chip cc2420_info = {
> @@ -361,7 +377,6 @@ static struct pxa2xx_spi_chip cc2420_info = {
>  	.rx_threshold = 8,
>  	.dma_burst_size = 8,
>  	.timeout = 235,
> -	.gpio_cs = 39,
>  };
>  
>  static struct spi_board_info spi_board_info[] __initdata = {
> @@ -410,6 +425,8 @@ static void __init imote2_stargate2_init(void)
>  	pxa_set_btuart_info(NULL);
>  	pxa_set_stuart_info(NULL);
>  
> +	gpiod_add_lookup_table(&pxa_ssp1_gpio_table);
> +	gpiod_add_lookup_table(&pxa_ssp3_gpio_table);
>  	pxa2xx_set_spi_info(1, &pxa_ssp_master_0_info);
>  	pxa2xx_set_spi_info(2, &pxa_ssp_master_1_info);
>  	pxa2xx_set_spi_info(3, &pxa_ssp_master_2_info);



More information about the linux-arm-kernel mailing list