200-spi-ath79-fix-initial-GPIO-CS-line-setup.patch 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. From 3a7853f0dd24e81dc920c98a5c7e8cfdde81bb45 Mon Sep 17 00:00:00 2001
  2. From: Gabor Juhos <[email protected]>
  3. Date: Thu, 16 Jan 2014 16:58:58 +0100
  4. Subject: [PATCH] spi-ath79: fix initial GPIO CS line setup
  5. The 'ath79_spi_setup_cs' function initializes the chip
  6. select line of a given SPI device in order to make sure
  7. that the device is inactive.
  8. If the SPI_CS_HIGH bit is set for a given device, it
  9. means that the CS line of that device is active HIGH
  10. so it must be set to LOW initially. In case of GPIO
  11. CS lines, the 'ath79_spi_setup_cs' function does the
  12. opposite of that due to the wrong GPIO flags.
  13. Fix the code to use the correct GPIO flags.
  14. Reported-by: Ronald Wahl <[email protected]>
  15. Signed-off-by: Gabor Juhos <[email protected]>
  16. ---
  17. drivers/spi/spi-ath79.c | 4 ++--
  18. 1 file changed, 2 insertions(+), 2 deletions(-)
  19. --- a/drivers/spi/spi-ath79.c
  20. +++ b/drivers/spi/spi-ath79.c
  21. @@ -132,9 +132,9 @@ static int ath79_spi_setup_cs(struct spi
  22. flags = GPIOF_DIR_OUT;
  23. if (spi->mode & SPI_CS_HIGH)
  24. - flags |= GPIOF_INIT_HIGH;
  25. - else
  26. flags |= GPIOF_INIT_LOW;
  27. + else
  28. + flags |= GPIOF_INIT_HIGH;
  29. status = gpio_request_one(cdata->gpio, flags,
  30. dev_name(&spi->dev));