spi: s3c64xx: add the BROKEN_CS case when setting up the transfer
authorAndi Shyti <andi.shyti@samsung.com>
Mon, 13 Jun 2016 02:44:09 +0000 (11:44 +0900)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Fri, 24 Jun 2016 01:48:37 +0000 (10:48 +0900)
The CS line might be disconneced ("broken"), therefore unused.
In this case, the device doesn't need to wait for the user to
handle the CS line for selecting the slave. The data will then be
automatically transferred without taking the CS line status into
account.

Change-Id: Ibddf87721b7d882efbdad9c978b79a3e19189b3e
Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Documentation/devicetree/bindings/spi/spi-samsung.txt
drivers/spi/spi-s3c64xx.c
include/linux/platform_data/spi-s3c64xx.h

index 6dbdeb3..62f19b6 100644 (file)
@@ -40,6 +40,9 @@ Optional Board Specific Properties:
 
 - cs-gpios: should specify GPIOs used for chipselects (see spi-bus.txt)
 
+- broken-cs: the CS line is disconnected, therefore the device should not wait
+  for the CS protocol to be established
+
 SPI Controller specific data in SPI slave nodes:
 
 - The spi slave nodes should provide the following information which is required
index 3c7ee57..629f187 100644 (file)
@@ -706,7 +706,8 @@ static int s3c64xx_spi_transfer_one(struct spi_master *master,
        enable_datapath(sdd, spi, xfer, use_dma);
 
        /* Start the signals */
-       if (!(sdd->port_conf->quirks & S3C64XX_SPI_QUIRK_CS_AUTO))
+       if (!(sdd->port_conf->quirks & S3C64XX_SPI_QUIRK_CS_AUTO) ||
+                                       sdd->cntrlr_info->broken_cs)
                writel(0, sdd->regs + S3C64XX_SPI_SLAVE_SEL);
        else
                writel(readl(sdd->regs + S3C64XX_SPI_SLAVE_SEL)
@@ -997,6 +998,8 @@ static struct s3c64xx_spi_info *s3c64xx_spi_parse_dt(struct device *dev)
                sci->num_cs = temp;
        }
 
+       sci->broken_cs = of_property_read_bool(dev->of_node, "broken-cs");
+
        return sci;
 }
 #else
index d3889b9..ee1fb3a 100644 (file)
@@ -38,6 +38,7 @@ struct s3c64xx_spi_csinfo {
 struct s3c64xx_spi_info {
        int src_clk_nr;
        int num_cs;
+       bool broken_cs;
        int (*cfg_gpio)(void);
        dma_filter_fn filter;
 };