mtd: rawnand: ingenic: move the GPIO quirk to gpiolib-of.c
Subsystems (6)
PATCH 1/1 mtd: rawnand: ingenic: move the GPIO quirk to gpiolib-of.c
From: Bartosz Golaszewski <[email protected]>
We have a special place for OF polarity quirks in gpiolib-of.c. Let's move this over there so that it doesn't pollute the driver.
---
This is an alternative to the previous patch that instead of replacing one active-low setter with another, just moves the quirk over to gpiolib-of.c
drivers/gpio/gpiolib-of.c | 9 +++++++++ drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c | 12 ------------ 2 files changed, 9 insertions(+), 12 deletions(-)
drivers/gpio/gpiolib-of.c +9 -0
@@ -192,6 +192,15 @@ static void of_gpio_try_fixup_polarity(const struct device_node *np, */ { "himax,hx8357", "gpios-reset", false }, { "himax,hx8369", "gpios-reset", false }, + /* + * The rb-gpios semantics was undocumented and qi,lb60 (along with + * the ingenic driver) got it wrong. The active state encodes the + * NAND ready state, which is high level. Since there's no signal + * inverter on this board, it should be active-high. Let's fix that + * here for older DTs so we can re-use the generic nand_gpio_waitrdy() + * helper, and be consistent with what other drivers do. + */ + { "qi,lb60", "rb-gpios", true }, #endif }; unsigned int i;
drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c +0 -12
@@ -380,18 +380,6 @@ static int ingenic_nand_init_chip(struct platform_device *pdev,return ret; } -/* -* The rb-gpios semantics was undocumented and qi,lb60 (along with -* the ingenic driver) got it wrong. The active state encodes the -* NAND ready state, which is high level. Since there's no signal -* inverter on this board, it should be active-high. Let's fix that -* here for older DTs so we can re-use the generic nand_gpio_waitrdy() -* helper, and be consistent with what other drivers do. -*/ -if (of_machine_is_compatible ("qi,lb60" ) && -gpiod_is_active_low (nand->busy_gpio)) -gpiod_toggle_active_low (nand->busy_gpio); - nand->wp_gpio =devm_gpiod_get_optional (dev,"wp" ,GPIOD_OUT_LOW );if (IS_ERR (nand->wp_gpio)) {
Signature · 1 line
2.39.2
Quoted 6 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
We have a special place for OF polarity quirks in
gpiolib-of.c. Let's move this over there so that it doesn't pollute the driver.Signed-off-by Bartosz Golaszewski <[email protected]>
This is nice.
Yours,
Linus Walleij
Hi Bartosz,
[email protected] wrote on Tue, 26 Sep 2023 11:06:23 +0200:
Quoted 22 lines
From: Bartosz Golaszewski <[email protected]>
We have a special place for OF polarity quirks in
gpiolib-of.c. Let's move this over there so that it doesn't pollute the driver.Signed-off-by Bartosz Golaszewski <[email protected]>---
This is an alternative to the previous patch that instead of replacing one active-low setter with another, just moves the quirk over togpiolib-of.cdrivers/gpio/gpiolib-of.c | 9 +++++++++ drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c | 12 ------------ 2 files changed, 9 insertions(+), 12 deletions(-)drivers/gpio/gpiolib-of.c +0
-0@@ -192,6 +192,15 @@ static void of_gpio_try_fixup_polarity(const struct device_node *np,*/ { "himax,hx8357", "gpios-reset", false },
drivers/gpio/gpiolib-of.c static void of_gpio_try_fixup_polarity(const struct device_node *np, · line 203
Quoted 10 lines
drivers/gpio/gpiolib-of.c +9
-0{ "himax,hx8369", "gpios-reset", false }, +/* +* The rb-gpios semantics was undocumented and qi,lb60 (along with +* the ingenic driver) got it wrong. The active state encodes the +* NAND ready state, which is high level. Since there's no signal +* inverter on this board, it should be active-high. Let's fix that +* here for older DTs so we can re-use the generic nand_gpio_waitrdy() +* helper, and be consistent with what other drivers do. +*/ + { "qi,lb60", "rb-gpios", true },
I didn't know about such a list, interesting. Better be aware when debugging :)
IIRC Linus was fine, so if Paul also agrees I guess this is better taking through the gpio tree? I don't have any ingenic related changes queued right now so feel free to take it.
Thanks,
Miquèl
Hi,
Le mardi 26 septembre 2023 à 11:16 +0200, Miquel Raynal a écrit :
Quoted 49 lines
Hi Bartosz,
[email protected] wrote on Tue, 26 Sep 2023 11:06:23 +0200:
Quoted 33 lines
From: Bartosz Golaszewski <[email protected]>
We have a special place for OF polarity quirks in
gpiolib-of.c. Let's
move this over there so that it doesn't pollute the driver.Signed-off-by Bartosz Golaszewski <[email protected]>---
This is an alternative to the previous patch that instead of replacing
one active-low setter with another, just moves the quirk over togpiolib-of.cdrivers/gpio/gpiolib-of.c | 9 +++++++++
drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c| 12 ------------2 files changed, 9 insertions(+), 12 deletions(-)drivers/gpio/gpiolib-of.c +2
-0@@ -192,6 +192,15 @@ static void of_gpio_try_fixup_polarity(conststruct device_node *np, */ { "himax,hx8357", "gpios-reset", false }, { "himax,hx8369", "gpios-reset", false }, + /* +* The rb-gpios semantics was undocumented and qi,lb60 (along with
+ * the ingenic driver) got it wrong. The active state encodes the
+ * NAND ready state, which is high level. Since there's no signalQuoted 8 lines
+ * inverter on this board, it should be active- high. Let's fix that
+ * here for older DTs so we can re-use the genericnand_gpio_waitrdy()
+ * helper, and be consistent with what other drivers do.
+ */
+ { "qi,lb60", "rb-gpios", true },I didn't know about such a list, interesting. Better be aware when debugging :)
Quoted 4 lines
IIRC Linus was fine, so if Paul also agrees I guess this is better taking through the gpio tree? I don't have any ingenic related changes
queued right now so feel free to take it.
Works for me.
Quoted 2 lines
Acked-by Miquel Raynal <[email protected]>
Quoted 2 lines
Thanks,
Miquèl
Cheers,
-Paul
Quoted 10 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
We have a special place for OF polarity quirks in
gpiolib-of.c. Let's move this over there so that it doesn't pollute the driver.Signed-off-by Bartosz Golaszewski <[email protected]>---
This is an alternative to the previous patch that instead of replacing one active-low setter with another, just moves the quirk over togpiolib-of.c
Much better than that in my opinion.
Quoted 50 lines
drivers/gpio/gpiolib-of.c | 9 +++++++++ drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c | 12 ------------ 2 files changed, 9 insertions(+), 12 deletions(-)drivers/gpio/gpiolib-of.c +9
-0@@ -192,6 +192,15 @@ static void of_gpio_try_fixup_polarity(const struct device_node *np, */ { "himax,hx8357", "gpios-reset", false }, { "himax,hx8369", "gpios-reset", false }, + /* + * The rb-gpios semantics was undocumented and qi,lb60 (along with + * the ingenic driver) got it wrong. The active state encodes the + * NAND ready state, which is high level. Since there's no signal + * inverter on this board, it should be active-high. Let's fix that + * here for older DTs so we can re-use the generic nand_gpio_waitrdy() + * helper, and be consistent with what other drivers do. + */ + { "qi,lb60", "rb-gpios", true }, #endif }; unsigned int i;drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c +0
-12@@ -380,18 +380,6 @@ static int ingenic_nand_init_chip(struct platform_device *pdev,return ret; } -/* -* The rb-gpios semantics was undocumented and qi,lb60 (along with -* the ingenic driver) got it wrong. The active state encodes the -* NAND ready state, which is high level. Since there's no signal -* inverter on this board, it should be active-high. Let's fix that -* here for older DTs so we can re-use the generic nand_gpio_waitrdy() -* helper, and be consistent with what other drivers do. -*/ -if (of_machine_is_compatible ("qi,lb60" ) && -gpiod_is_active_low (nand->busy_gpio)) -gpiod_toggle_active_low (nand->busy_gpio); - nand->wp_gpio =devm_gpiod_get_optional (dev,"wp" ,GPIOD_OUT_LOW );if (IS_ERR (nand->wp_gpio)) {Signature · 1 line
2.39.2
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 60 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
We have a special place for OF polarity quirks in
gpiolib-of.c. Let's move this over there so that it doesn't pollute the driver.Signed-off-by Bartosz Golaszewski <[email protected]>---
This is an alternative to the previous patch that instead of replacing one active-low setter with another, just moves the quirk over togpiolib-of.cdrivers/gpio/gpiolib-of.c | 9 +++++++++ drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c | 12 ------------ 2 files changed, 9 insertions(+), 12 deletions(-)drivers/gpio/gpiolib-of.c +9
-0@@ -192,6 +192,15 @@ static void of_gpio_try_fixup_polarity(const struct device_node *np, */ { "himax,hx8357", "gpios-reset", false }, { "himax,hx8369", "gpios-reset", false }, + /* + * The rb-gpios semantics was undocumented and qi,lb60 (along with + * the ingenic driver) got it wrong. The active state encodes the + * NAND ready state, which is high level. Since there's no signal + * inverter on this board, it should be active-high. Let's fix that + * here for older DTs so we can re-use the generic nand_gpio_waitrdy() + * helper, and be consistent with what other drivers do. + */ + { "qi,lb60", "rb-gpios", true }, #endif }; unsigned int i;drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c +0
-13@@ -380,18 +380,6 @@ static int ingenic_nand_init_chip(struct platform_device *pdev,return ret; } -/* -* The rb-gpios semantics was undocumented and qi,lb60 (along with -* the ingenic driver) got it wrong. The active state encodes the -* NAND ready state, which is high level. Since there's no signal -* inverter on this board, it should be active-high. Let's fix that -* here for older DTs so we can re-use the generic nand_gpio_waitrdy() -* helper, and be consistent with what other drivers do. -*/ -if (of_machine_is_compatible ("qi,lb60" ) && -gpiod_is_active_low (nand->busy_gpio)) -gpiod_toggle_active_low (nand->busy_gpio); - nand->wp_gpio =devm_gpiod_get_optional (dev,"wp" ,GPIOD_OUT_LOW );if (IS_ERR (nand->wp_gpio)) { --
Quoted 2 lines
2.39.2
Queued for v6.7.
Bartosz