brcm63xx: rename target to bcm63xx
[openwrt/staging/wigyori.git] / target / linux / brcm2708 / patches-4.19 / 950-0144-spi-Make-GPIO-CSs-honour-the-SPI_NO_CS-flag.patch
1 From d7aa9d52b7f9b2d600f9b2479767c24d438a2c68 Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.org>
3 Date: Tue, 3 Jul 2018 14:23:47 +0100
4 Subject: [PATCH] spi: Make GPIO CSs honour the SPI_NO_CS flag
5
6 The SPI configuration state includes an SPI_NO_CS flag that disables
7 all CS line manipulation, for applications that want to manage their
8 own chip selects. However, this flag is ignored by the GPIO CS code
9 in the SPI framework.
10
11 Correct this omission with a trivial patch.
12
13 See: https://github.com/raspberrypi/linux/issues/2169
14
15 Signed-off-by: Phil Elwell <phil@raspberrypi.org>
16 ---
17 drivers/spi/spi.c | 4 +++-
18 1 file changed, 3 insertions(+), 1 deletion(-)
19
20 --- a/drivers/spi/spi.c
21 +++ b/drivers/spi/spi.c
22 @@ -733,7 +733,9 @@ static void spi_set_cs(struct spi_device
23 enable = !enable;
24
25 if (gpio_is_valid(spi->cs_gpio)) {
26 - gpio_set_value_cansleep(spi->cs_gpio, !enable);
27 + /* Honour the SPI_NO_CS flag */
28 + if (!(spi->mode & SPI_NO_CS))
29 + gpio_set_value_cansleep(spi->cs_gpio, !enable);
30 /* Some SPI masters need both GPIO CS & slave_select */
31 if ((spi->controller->flags & SPI_MASTER_GPIO_SS) &&
32 spi->controller->set_cs)