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

From: H. Nikolaus Schaller
Date: Sun Mar 31 2019 - 06:08:01 EST


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@xxxxxxxxxxxxx>
---
drivers/gpio/Kconfig | 8 ++++++++
drivers/gpio/gpiolib-of.c | 2 ++
2 files changed, 10 insertions(+)

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
}

/**
--
2.19.1