The chip select line was configured as output with the initial value
being active explicitly. It was later deasserted during
spi_bitbang_setup() without any clock activity in between. So it makes
no sense to activate the device at all and the chip select line can
better start non-active.

Signed-off-by: Uwe Kleine-König <[email protected]>
---
Hello,

I'm not sure if an active chip select line without any clock activity can
confuse a device. If so, this patch might qualify as fix. But with my
limited knowledge about spi it's also possible that I just miss why the
active chip select is important. For the devices I have it doesn't seem
to make a difference.

Best regards
Uwe

 drivers/spi/spi-gpio.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/spi/spi-gpio.c b/drivers/spi/spi-gpio.c
index 0094c64..0b56cfc 100644
--- a/drivers/spi/spi-gpio.c
+++ b/drivers/spi/spi-gpio.c
@@ -235,7 +235,8 @@ static int spi_gpio_setup(struct spi_device *spi)
                        status = gpio_request(cs, dev_name(&spi->dev));
                        if (status)
                                return status;
-                       status = gpio_direction_output(cs, spi->mode & 
SPI_CS_HIGH);
+                       status = gpio_direction_output(cs,
+                                       !(spi->mode & SPI_CS_HIGH));
                }
        }
        if (!status)
-- 
1.7.9


------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
spi-devel-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spi-devel-general

Reply via email to