spi: ep93xx: Convert to use CS GPIO descriptors
This converts the EP93xx SPI master driver to use GPIO descriptors for chip select handling. EP93xx was using platform data to pass in GPIO lines, by converting all board files to use GPIO descriptor tables the core will look up the GPIO lines from the SPI device in the same manner as for device tree. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:

committed by
Mark Brown

parent
2a168e10d6
commit
1dfbf334f1
@@ -28,7 +28,6 @@
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/scatterlist.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/spi/spi.h>
|
||||
|
||||
#include <linux/platform_data/dma-ep93xx.h>
|
||||
@@ -676,6 +675,7 @@ static int ep93xx_spi_probe(struct platform_device *pdev)
|
||||
if (!master)
|
||||
return -ENOMEM;
|
||||
|
||||
master->use_gpio_descriptors = true;
|
||||
master->prepare_transfer_hardware = ep93xx_spi_prepare_hardware;
|
||||
master->unprepare_transfer_hardware = ep93xx_spi_unprepare_hardware;
|
||||
master->prepare_message = ep93xx_spi_prepare_message;
|
||||
@@ -683,31 +683,11 @@ static int ep93xx_spi_probe(struct platform_device *pdev)
|
||||
master->bus_num = pdev->id;
|
||||
master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
|
||||
master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 16);
|
||||
|
||||
master->num_chipselect = info->num_chipselect;
|
||||
master->cs_gpios = devm_kcalloc(&master->dev,
|
||||
master->num_chipselect, sizeof(int),
|
||||
GFP_KERNEL);
|
||||
if (!master->cs_gpios) {
|
||||
error = -ENOMEM;
|
||||
goto fail_release_master;
|
||||
}
|
||||
|
||||
for (i = 0; i < master->num_chipselect; i++) {
|
||||
master->cs_gpios[i] = info->chipselect[i];
|
||||
|
||||
if (!gpio_is_valid(master->cs_gpios[i]))
|
||||
continue;
|
||||
|
||||
error = devm_gpio_request_one(&pdev->dev, master->cs_gpios[i],
|
||||
GPIOF_OUT_INIT_HIGH,
|
||||
"ep93xx-spi");
|
||||
if (error) {
|
||||
dev_err(&pdev->dev, "could not request cs gpio %d\n",
|
||||
master->cs_gpios[i]);
|
||||
goto fail_release_master;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* The SPI core will count the number of GPIO descriptors to figure
|
||||
* out the number of chip selects available on the platform.
|
||||
*/
|
||||
master->num_chipselect = 0;
|
||||
|
||||
platform_set_drvdata(pdev, master);
|
||||
|
||||
|
Reference in New Issue
Block a user