diff mbox series

[BUG/PATCH,3/4] gpiolib: make legacy handling for spi-cs-high optional

Message ID 83b5c3ddee26c6f5e4b3b21d8a4346da5956de11.1554026842.git.hns@goldelico.com
State New
Headers show
Series gpiolib: fix issues with legacy spi-cs-high handling | expand

Commit Message

H. Nikolaus Schaller March 31, 2019, 10:07 a.m. UTC
It is better to make legacy support a config option instead
of requiring non-legacy device tree files to be updated.

Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
---
 drivers/gpio/Kconfig      | 8 ++++++++
 drivers/gpio/gpiolib-of.c | 2 ++
 2 files changed, 10 insertions(+)
diff mbox series

Patch

diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 3f50526a771f..1a82619727c1 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -39,6 +39,14 @@  config OF_GPIO
 	depends on OF
 	depends on HAS_IOMEM
 
+config SPI_CS_HIGH_LEGACY_HANDLING
+	def_bool n
+	depends on OF_GPIO
+	help
+	   This enables a legacy handler which decodes the boolean spi-cs-high
+	   property found in some DTS/DTB to correctly work with cs-gpios
+	   with GPIO_ACTIVE_HIGH.
+
 config GPIO_ACPI
 	def_bool y
 	depends on ACPI
diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index 8b9c3ab70f6e..a22d2233458b 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -114,6 +114,7 @@  static void of_gpio_flags_quirks(struct device_node *np,
 			of_node_full_name(np));
 	}
 
+#if defined(CONFIG_SPI_CS_HIGH_LEGACY_HANDLING)
 	/*
 	 * Legacy handling of SPI active high chip select. If we have a
 	 * property named "cs-gpios" we need to inspect the child node
@@ -158,6 +159,7 @@  static void of_gpio_flags_quirks(struct device_node *np,
 			}
 		}
 	}
+#endif
 }
 
 /**