]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
spi: Fix handling of cs_change in core implementation
authorMark Brown <broonie@linaro.org>
Sat, 29 Mar 2014 23:48:07 +0000 (23:48 +0000)
committerMark Brown <broonie@linaro.org>
Sun, 30 Mar 2014 00:48:12 +0000 (00:48 +0000)
The core implementation of cs_change didn't follow the documentation
which says that cs_change in the middle of the transfer means to briefly
deassert chip select, instead it followed buggy drivers which change the
polarity of chip select.  Use a delay of 10us between deassert and
reassert simply from pulling numbers out of a hat.

Reported-by: Gerhard Sittig <gsi@denx.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
drivers/spi/spi.c

index 23756b0f90363c2f776718925cf7fba84d13c4a3..5d826f0477149662a17a234547b789b2764c3f7c 100644 (file)
@@ -591,7 +591,6 @@ static int spi_transfer_one_message(struct spi_master *master,
                                    struct spi_message *msg)
 {
        struct spi_transfer *xfer;
-       bool cur_cs = true;
        bool keep_cs = false;
        int ret = 0;
 
@@ -627,8 +626,9 @@ static int spi_transfer_one_message(struct spi_master *master,
                                         &msg->transfers)) {
                                keep_cs = true;
                        } else {
-                               cur_cs = !cur_cs;
-                               spi_set_cs(msg->spi, cur_cs);
+                               spi_set_cs(msg->spi, false);
+                               udelay(10);
+                               spi_set_cs(msg->spi, true);
                        }
                }