mirror of
https://github.com/torvalds/linux.git
synced 2026-12-06 05:14:35 +00:00
spi: dw: Convert to use CS GPIO descriptors
This converts the DesignWare (dw) SPI master driver to use GPIO descriptors for chip select handling. This driver has a duplicate DT parser in addition to the one in the core, sets up the line as non-asserted and relies on the core to drive the GPIOs. It is a pretty straight-forward conversion. Cc: Talel Shenhar <[email protected]> Cc: Simon Goldschmidt <[email protected]> Cc: Alexandre Belloni <[email protected]> Cc: Linuxarm <[email protected]> Tested-by: Jay Fang <[email protected]> Reviewed-by: Alexandre Belloni <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Signed-off-by: Mark Brown <[email protected]>
This commit is contained in:
@@ -18,7 +18,6 @@
|
||||
#include <linux/mfd/syscon.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_gpio.h>
|
||||
#include <linux/of_platform.h>
|
||||
#include <linux/acpi.h>
|
||||
#include <linux/property.h>
|
||||
@@ -185,27 +184,6 @@ static int dw_spi_mmio_probe(struct platform_device *pdev)
|
||||
|
||||
dws->num_cs = num_cs;
|
||||
|
||||
if (pdev->dev.of_node) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < dws->num_cs; i++) {
|
||||
int cs_gpio = of_get_named_gpio(pdev->dev.of_node,
|
||||
"cs-gpios", i);
|
||||
|
||||
if (cs_gpio == -EPROBE_DEFER) {
|
||||
ret = cs_gpio;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (gpio_is_valid(cs_gpio)) {
|
||||
ret = devm_gpio_request(&pdev->dev, cs_gpio,
|
||||
dev_name(&pdev->dev));
|
||||
if (ret)
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
init_func = device_get_match_data(&pdev->dev);
|
||||
if (init_func) {
|
||||
ret = init_func(pdev, dwsmmio);
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include <linux/delay.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/spi/spi.h>
|
||||
#include <linux/gpio.h>
|
||||
|
||||
#include "spi-dw.h"
|
||||
|
||||
@@ -426,13 +425,6 @@ static int dw_spi_setup(struct spi_device *spi)
|
||||
|
||||
chip->tmode = SPI_TMOD_TR;
|
||||
|
||||
if (gpio_is_valid(spi->cs_gpio)) {
|
||||
ret = gpio_direction_output(spi->cs_gpio,
|
||||
!(spi->mode & SPI_CS_HIGH));
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -497,6 +489,7 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws)
|
||||
goto err_free_master;
|
||||
}
|
||||
|
||||
master->use_gpio_descriptors = true;
|
||||
master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_LOOP;
|
||||
master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 16);
|
||||
master->bus_num = dws->bus_num;
|
||||
|
||||
Reference in New Issue
Block a user