spi: dw: allow providing own set_cs callback
authorAlexandre Belloni <alexandre.belloni@bootlin.com>
Tue, 17 Jul 2018 14:23:11 +0000 (16:23 +0200)
committerMark Brown <broonie@kernel.org>
Wed, 18 Jul 2018 12:22:37 +0000 (13:22 +0100)
Allow platform specific drivers to provide their own set_cs callback when
the IP integration requires it.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-dw.c
drivers/spi/spi-dw.h

index f693bfe95ab9a1133e93a30b148f2b89a9499413..0d8ccb8be5ec36d06d892173d8790f17db1e70e3 100644 (file)
@@ -505,6 +505,9 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws)
        master->dev.of_node = dev->of_node;
        master->flags = SPI_MASTER_GPIO_SS;
 
+       if (dws->set_cs)
+               master->set_cs = dws->set_cs;
+
        /* Basic HW init */
        spi_hw_init(dev, dws);
 
index 2cde2473b3e94ba4e13c327bd4a063f9ce868cb8..4460130228495ead88f8cd8dbc82e082471e7451 100644 (file)
@@ -112,6 +112,7 @@ struct dw_spi {
        u32                     reg_io_width;   /* DR I/O width in bytes */
        u16                     bus_num;
        u16                     num_cs;         /* supported slave numbers */
+       void (*set_cs)(struct spi_device *spi, bool enable);
 
        /* Current message transfer state info */
        size_t                  len;