Message ID | 20200625231257.280615-1-linus.walleij@linaro.org |
---|---|
State | Accepted |
Commit | f27b1dc6412547fac256957e22d6889fb56a5470 |
Headers | show |
Series | spi: omap2-mcspi: Convert to use GPIO descriptors | expand |
* Linus Walleij <linus.walleij@linaro.org> [200625 23:13]: > The OMAP2 MCSPI has some kind of half-baked GPIO CS support: > it includes code like this: > > if (gpio_is_valid(spi->cs_gpio)) { > ret = gpio_request(spi->cs_gpio, dev_name(&spi->dev)); > (...) > > But it doesn't parse the "cs-gpios" attribute in the device > tree to count the number of GPIOs or pick out the GPIO numbers > and put these in the SPI master's .cs_gpios property. > > We complete the implementation of supporting CS GPIOs > from the device tree and switch it over to use the SPI core > for this. Acked-by: Tony Lindgren <tony@atomide.com>
On Fri, 26 Jun 2020 01:12:57 +0200, Linus Walleij wrote: > The OMAP2 MCSPI has some kind of half-baked GPIO CS support: > it includes code like this: > > if (gpio_is_valid(spi->cs_gpio)) { > ret = gpio_request(spi->cs_gpio, dev_name(&spi->dev)); > (...) > > [...] Applied to https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next Thanks! [1/1] spi: omap2-mcspi: Convert to use GPIO descriptors commit: f27b1dc6412547fac256957e22d6889fb56a5470 All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark
diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index e9e256718ef4..1c9478e6e5d9 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c @@ -27,7 +27,6 @@ #include <linux/iopoll.h> #include <linux/spi/spi.h> -#include <linux/gpio.h> #include <linux/platform_data/spi-omap2-mcspi.h> @@ -1043,16 +1042,6 @@ static int omap2_mcspi_setup(struct spi_device *spi) spi->controller_state = cs; /* Link this to context save list */ list_add_tail(&cs->node, &ctx->cs); - - if (gpio_is_valid(spi->cs_gpio)) { - ret = gpio_request(spi->cs_gpio, dev_name(&spi->dev)); - if (ret) { - dev_err(&spi->dev, "failed to request gpio\n"); - return ret; - } - gpio_direction_output(spi->cs_gpio, - !(spi->mode & SPI_CS_HIGH)); - } } ret = pm_runtime_get_sync(mcspi->dev); @@ -1080,9 +1069,6 @@ static void omap2_mcspi_cleanup(struct spi_device *spi) kfree(cs); } - - if (gpio_is_valid(spi->cs_gpio)) - gpio_free(spi->cs_gpio); } static irqreturn_t omap2_mcspi_irq_handler(int irq, void *data) @@ -1152,7 +1138,7 @@ static int omap2_mcspi_transfer_one(struct spi_master *master, omap2_mcspi_set_enable(spi, 0); - if (gpio_is_valid(spi->cs_gpio)) + if (spi->cs_gpiod) omap2_mcspi_set_cs(spi, spi->mode & SPI_CS_HIGH); if (par_override || @@ -1241,7 +1227,7 @@ static int omap2_mcspi_transfer_one(struct spi_master *master, omap2_mcspi_set_enable(spi, 0); - if (gpio_is_valid(spi->cs_gpio)) + if (spi->cs_gpiod) omap2_mcspi_set_cs(spi, !(spi->mode & SPI_CS_HIGH)); if (mcspi->fifo_depth > 0 && t) @@ -1431,6 +1417,7 @@ static int omap2_mcspi_probe(struct platform_device *pdev) master->dev.of_node = node; master->max_speed_hz = OMAP2_MCSPI_MAX_FREQ; master->min_speed_hz = OMAP2_MCSPI_MAX_FREQ >> 15; + master->use_gpio_descriptors = true; platform_set_drvdata(pdev, master);
The OMAP2 MCSPI has some kind of half-baked GPIO CS support: it includes code like this: if (gpio_is_valid(spi->cs_gpio)) { ret = gpio_request(spi->cs_gpio, dev_name(&spi->dev)); (...) But it doesn't parse the "cs-gpios" attribute in the device tree to count the number of GPIOs or pick out the GPIO numbers and put these in the SPI master's .cs_gpios property. We complete the implementation of supporting CS GPIOs from the device tree and switch it over to use the SPI core for this. Cc: Vignesh Raghavendra <vigneshr@ti.com> Cc: David Lechner <david@lechnology.com> Cc: Tony Lindgren <tony@atomide.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> --- drivers/spi/spi-omap2-mcspi.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) -- 2.25.4