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