[PATCH 06/12] spi: add support to handle cs-gpios

Sascha Hauer s.hauer at pengutronix.de
Mon Nov 25 01:19:14 PST 2024


On Fri, Nov 15, 2024 at 08:57:41PM +0100, Marco Felsch wrote:
> At the moment all drivers have to parse the cs-gpios on their own and
> have to implement the mapping. By this commit we add the support to
> handle this within the core and if there is a valid CS GPIO for a device
> we assign it accordingly.
> 

...

>  	 * likely need more hooks for more protocol options affecting how
> @@ -156,6 +158,9 @@ static inline void spi_set_ctldata(struct spi_device *spi, void *state)
>   *	the device whose settings are being modified.
>   * @transfer: adds a message to the controller's transfer queue.
>   * @cleanup: frees controller-specific state
> + * @cs_gpiods: Array of GPIO descriptors to use as chip select lines; one per CS
> + *	number. Any individual value may be NULL for CS lines that
> + *	are not GPIOs (driven by the SPI controller itself).
>   * @list: link with the global spi_controller list
>   *
>   * Each SPI controller can communicate with one or more @spi_device
> @@ -233,6 +238,10 @@ struct spi_controller {
>  	/* called on release() to free memory provided by spi_controller */
>  	void			(*cleanup)(struct spi_device *spi);
>  
> +	/* GPIO chip select */
> +	struct gpio_desc	**cs_gpiods;
> +	bool			use_gpio_descriptors;

You forgot to copy the documentation for this member.

Sascha

-- 
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