mtd: rawnand: ingenic: move the GPIO quirk to gpiolib-of.c
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Tue, 26 Sep 2023 09:06:23 +0000 (11:06 +0200)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Wed, 27 Sep 2023 11:13:54 +0000 (13:13 +0200)
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 <bartosz.golaszewski@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Paul Cercueil <paul@crapouillou.net>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
drivers/gpio/gpiolib-of.c
drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c

index 5515f32cf19b96b80c906294206fccd528da4f4c..58c0bbe9d569ab4b49555e72ab0e9d2429b1266a 100644 (file)
@@ -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;
index 6748226b8bd12fd989939ca0d6f02bd1e16f0d83..c816dc1372454ca87bb60ba6a0449cbb7fc16373 100644 (file)
@@ -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)) {