Re: [PATCH V2 3/3] gpio: modepin: Add driver support for modepin GPIO controller

From: Michal Simek
Date: Wed Aug 11 2021 - 09:30:17 EST


Hi Linus,

On 8/11/21 2:59 PM, Linus Walleij wrote:
> Hi Piyush,
>
> thanks for your patch!
>
> Can you explain one thing to me: since this is now a GPIO driver
> that means "General Purpos Input/Output", then these bits are
> accessed like this:
>
> On Thu, Aug 5, 2021 at 7:43 PM Piyush Mehta <piyush.mehta@xxxxxxxxxx> wrote:
>
>> + ret = zynqmp_pm_bootmode_read(&bootpin_val);
>
> This does not look very general purpose. These seem to be all about
> boot mode, right?
>
> So can you explain why this should be a GPIO driver at all?
>
> I understand it is sometimes convenient to describe stuff as GPIO even
> if it is not (for example to get a convenient userspace interface) but
> as maintainers
> we really need to make sure that the subsystem is not being abused
> for things not GPIO.

They are bootmode pins because that pins are designed and used by ROM to
get information which boot device should be used.
But after this is it is really behaving as generic purpose I/O pins.
Xilinx is using them for years for usb phy resets. I have also seen them
to be used for other reset functionality.
And that's exactly what we are trying to do here by this driver. Because
usb hubs/phys have reset normally connected via gpio pin which is
toggled. And we have boards where these resets are connected via these
pins or via hard gpio IP or via i2c-gpio expanders that's why IMHO this
option should be designed in the same way to have gpio reset
functionality added dwc3 and based on DT/board bootmode gpio, ps gpio,
pl gpio, i2c gpio or gpio over power regulators, etc will be used.

Please let me know if you want to get more information about it.

Thanks,
Michal