[PATCH 3/3] spi: spi-gpio: switch to new gpio binding

Ahmad Fatoum a.fatoum at pengutronix.de
Wed Sep 25 23:09:44 PDT 2024


Hello Sascha,

On 25.09.24 16:06, Sascha Hauer wrote:
> The old deprecated device tree binding for the spi-gpio driver uses
> "gpio-sck", "gpio-mosi" and "gpio-miso" to specify the GPIOs. Switch to
> the new binding which uses the standard GPIO property names.
> 
> The old binding is still used in some device trees, but none of the SoCs
> using them is actually supported in barebox, so do not bother to keep a
> fallback to the old binding. The one in-tree user of the old binding is
> converted in this patch.

There is one more user in sandbox-libftdi-example.dtsi. Please fix that as well.

Also, while you are it, why not switch over to the GPIOD API? :-)

Cheers,
Ahmad

> 
> Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
> ---
>  arch/arm/dts/stm32mp151-mect1s.dts | 6 +++---
>  drivers/spi/gpio_spi.c             | 6 +++---
>  2 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/arm/dts/stm32mp151-mect1s.dts b/arch/arm/dts/stm32mp151-mect1s.dts
> index 4d0e31d189..b0dc1cfaa8 100644
> --- a/arch/arm/dts/stm32mp151-mect1s.dts
> +++ b/arch/arm/dts/stm32mp151-mect1s.dts
> @@ -65,9 +65,9 @@ led-1 {
>  
>  	spi_gpio: spi-gpio-0 {
>  		compatible = "spi-gpio";
> -		gpio-sck = <&gpioi 1 GPIO_ACTIVE_HIGH>;
> -		gpio-mosi = <&gpioi 3 GPIO_ACTIVE_HIGH>;
> -		gpio-miso = <&gpioi 2 GPIO_ACTIVE_HIGH>;
> +		sck-gpios = <&gpioi 1 GPIO_ACTIVE_HIGH>;
> +		mosi-gpios = <&gpioi 3 GPIO_ACTIVE_HIGH>;
> +		miso-gpios = <&gpioi 2 GPIO_ACTIVE_HIGH>;
>  		cs-gpios = <&gpioj 3 GPIO_ACTIVE_LOW>;
>  		num-chipselects = <1>;
>  		#address-cells = <1>;
> diff --git a/drivers/spi/gpio_spi.c b/drivers/spi/gpio_spi.c
> index c76b71f610..34d74faf4c 100644
> --- a/drivers/spi/gpio_spi.c
> +++ b/drivers/spi/gpio_spi.c
> @@ -178,7 +178,7 @@ static int gpio_spi_of_probe(struct device *dev)
>  	if (!IS_ENABLED(CONFIG_OFDEVICE) || dev->platform_data)
>  		return 0;
>  
> -	sck = of_get_named_gpio(np, "gpio-sck", 0);
> +	sck = of_get_named_gpio(np, "sck-gpios", 0);
>  	if (!gpio_is_valid(sck))
>  		return dev_err_probe(dev, sck < 0 ? sck : -EINVAL,
>  				     "missing mandatory SCK gpio\n");
> @@ -187,11 +187,11 @@ static int gpio_spi_of_probe(struct device *dev)
>  	pdata->sck = sck;
>  	pdata->num_cs = MAX_CHIPSELECT;
>  
> -	pdata->miso = of_get_named_gpio(np, "gpio-miso", 0);
> +	pdata->miso = of_get_named_gpio(np, "miso-gpios", 0);
>  	if (!gpio_is_valid(pdata->miso))
>  		pdata->miso = SPI_GPIO_NO_MISO;
>  
> -	pdata->mosi = of_get_named_gpio(np, "gpio-mosi", 0);
> +	pdata->mosi = of_get_named_gpio(np, "mosi-gpios", 0);
>  	if (!gpio_is_valid(pdata->mosi))
>  		pdata->mosi = SPI_GPIO_NO_MOSI;
>  
> 


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list