spi: s3c64xx: consider the case when the CS line is not connected
authorAndi Shyti <andi.shyti@samsung.com>
Tue, 28 Jun 2016 02:41:12 +0000 (11:41 +0900)
committerMark Brown <broonie@kernel.org>
Wed, 29 Jun 2016 21:45:23 +0000 (22:45 +0100)
When the CS line is not connected, it is not needed to enable or
disable the chip selection functionality from the s3c64xx
devices in order to perform a transfer.
Set the CS controller logically always enabled already during
initialization (by writing '0' in the S3C64XX_SPI_SLAVE_SEL
register) and never disable it.

Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Documentation/devicetree/bindings/spi/spi-samsung.txt
drivers/spi/spi-s3c64xx.c
include/linux/platform_data/spi-s3c64xx.h

index 6dbdeb3c361a9973bd26a5cdcc3c73775bf8c883..930bc734927174130a3a552ff2d2a1a00d9512c4 100644 (file)
@@ -40,6 +40,9 @@ Optional Board Specific Properties:
 
 - cs-gpios: should specify GPIOs used for chipselects (see spi-bus.txt)
 
+- no-cs-readback: the CS line is disconnected, therefore the device should not
+  operate based on CS signalling.
+
 SPI Controller specific data in SPI slave nodes:
 
 - The spi slave nodes should provide the following information which is required
index 972367d5c7f219a99e579085ff1e7cdec8de3e5c..14269b07804c9565293597fbf8418e516f64333b 100644 (file)
@@ -315,6 +315,9 @@ static void s3c64xx_spi_set_cs(struct spi_device *spi, bool enable)
        struct s3c64xx_spi_driver_data *sdd =
                                        spi_master_get_devdata(spi->master);
 
+       if (sdd->cntrlr_info->no_cs)
+               return;
+
        if (enable) {
                if (!(sdd->port_conf->quirks & S3C64XX_SPI_QUIRK_CS_AUTO)) {
                        writel(0, sdd->regs + S3C64XX_SPI_SLAVE_SEL);
@@ -960,7 +963,9 @@ static void s3c64xx_spi_hwinit(struct s3c64xx_spi_driver_data *sdd, int channel)
 
        sdd->cur_speed = 0;
 
-       if (!(sdd->port_conf->quirks & S3C64XX_SPI_QUIRK_CS_AUTO))
+       if (sci->no_cs)
+               writel(0, sdd->regs + S3C64XX_SPI_SLAVE_SEL);
+       else if (!(sdd->port_conf->quirks & S3C64XX_SPI_QUIRK_CS_AUTO))
                writel(S3C64XX_SPI_SLAVE_SIG_INACT, sdd->regs + S3C64XX_SPI_SLAVE_SEL);
 
        /* Disable Interrupts - we use Polling if not DMA mode */
@@ -1015,6 +1020,8 @@ static struct s3c64xx_spi_info *s3c64xx_spi_parse_dt(struct device *dev)
                sci->num_cs = temp;
        }
 
+       sci->no_cs = of_property_read_bool(dev->of_node, "broken-cs");
+
        return sci;
 }
 #else
index fb5625bcca9a5b73895eac8d38d9cc3864610898..5c1e21c8727080d40ac03fe3af96b3e2f5a5e9c1 100644 (file)
@@ -38,6 +38,7 @@ struct s3c64xx_spi_csinfo {
 struct s3c64xx_spi_info {
        int src_clk_nr;
        int num_cs;
+       bool no_cs;
        int (*cfg_gpio)(void);
        dma_filter_fn filter;
        void *dma_tx;