gpio: of: Check propname before applying "cs-gpios" quirks
PATCH 1/2 gpio: of: Check propname before applying "cs-gpios" quirks
SPI GPIO device has more than just "cs-gpio" property in its node and would request those GPIOs as a part of its initialization. To avoid applying CS-specific quirk to all of them add a check to make sure that propname is "cs-gpios".
--- drivers/gpio/gpiolib-of.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpio/gpiolib-of.c +2 -1
@@ -120,7 +120,8 @@ static void of_gpio_flags_quirks(struct device_node *np,* to determine if the flags should have inverted semantics. */ if (IS_ENABLED (CONFIG_SPI_MASTER ) && -of_property_read_bool (np,"cs-gpios" )) { +of_property_read_bool (np,"cs-gpios" ) && + !strcmp (propname,"cs-gpios" )) {struct device_node *child;u32 cs;int ret;
Signature · 1 line
2.20.1
PATCH 2/2 gpio: of: Check for "spi-cs-high" in child instead of parent node
"spi-cs-high" is going to be specified in child node of an SPI controller's representing attached SPI device, so change the code to look for it there, instead of checking parent node.
--- drivers/gpio/gpiolib-of.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpio/gpiolib-of.c +3 -3
@@ -143,16 +143,16 @@ static void of_gpio_flags_quirks(struct device_node *np,* conflict and the "spi-cs-high" flag will * take precedence. */ -if (of_property_read_bool (np,"spi-cs-high" )) { +if (of_property_read_bool (child,"spi-cs-high" )) {if (*flags &OF_GPIO_ACTIVE_LOW ) {pr_warn ("%s GPIO handle specifies active low - ignored\n" , -of_node_full_name (np)); +of_node_full_name (child)); *flags &= ~OF_GPIO_ACTIVE_LOW ; } }else {if (!(*flags &OF_GPIO_ACTIVE_LOW ))pr_info ("%s enforce active low on chipselect handle\n" , -of_node_full_name (np)); +of_node_full_name (child)); *flags |=OF_GPIO_ACTIVE_LOW ; }break ;
Signature · 1 line
2.20.1
Re: [PATCH 2/2] gpio: of: Check for "spi-cs-high" in child instead of parent node
Quoted 10 lines · Andrey Smirnov
"spi-cs-high" is going to be specified in child node of an SPI controller's representing attached SPI device, so change the code to look for it there, instead of checking parent node.
Signed-off-by Andrey Smirnov <[email protected]>Cc Linus Walleij <[email protected]>Cc Bartosz Golaszewski <[email protected]>Cc Chris Healy <[email protected]>
Patch applied for fixes.
I could bet I exercised these code paths just the other week, but I don't know how it all ended up like this... :/
Thanks for fixing it up!!
Yours,
Linus Walleij
Quoted 11 lines · Andrey Smirnov
SPI GPIO device has more than just "cs-gpio" property in its node and would request those GPIOs as a part of its initialization. To avoid applying CS-specific quirk to all of them add a check to make sure that propname is "cs-gpios".
Signed-off-by Andrey Smirnov <[email protected]>Cc Linus Walleij <[email protected]>Cc Bartosz Golaszewski <[email protected]>Cc Chris Healy <[email protected]>
Patch applied for fixes.
Sorry for my mistakes...
Yours,
Linus Walleij