Re: [PATCH v3] PCI: imx6: Replace legacy gpio interface for gpiod interface

From: Linus Walleij
Date: Mon Apr 25 2022 - 09:41:01 EST


On Mon, Apr 25, 2022 at 2:07 PM Lucas Stach <l.stach@xxxxxxxxxxxxxx> wrote:

> The binding explicitly describes the GPIO as not polarity aware and has
> a separate property "reset-gpio-active-high" to avoid breaking old
> DTBs. I don't think it's helpful to dismiss this explicit backward
> compat just because the driver code looks nicer that way.

I see. We handle such things a specific way.

Look in drivers/gpio/gpiolib-of.c, especially the function
of_gpio_flags_quirks().

Here we special-case all bindings which for some reason introduced
something necessary custom, like in this case not using the proper
polarity flag.

Add code to this file in the proper place to handle and hide the
old style DTBs using "reset-gpio-active-high" as active high flag
and assuming active low otherwise in this file.

I imagine it begins with

if (IS_ENABLED(CONFIG_PCI_IMX6)) { ... }

Then modify the code in drivers/pci/controller/dwc/pci-imx6.c
to act as if gpiolib handles polarity inversion. Include all changes
to all files in the same patch so this is changed in tandem (one technical
step).

Yours,
Linus Walleij