lkml.org 
[lkml]   [2019]   [Nov]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC v2 0/2] gpio: Support for shared GPIO lines on boards
From
Date


On 05/11/2019 11.58, Linus Walleij wrote:
> On Mon, Nov 4, 2019 at 8:11 PM Rob Herring <robh+dt@kernel.org> wrote:
>> [Peter]
>>> The device needs the RST line to be high, otherwise it is not
>>> accessible. If it does not have reset control how can we make sure that
>>> the GPIO line is in correct state?
>>
>> Just like the reset code, drivers register their use of the reset and
>> the core tracks users and prevents resetting when not safe. Maybe the
>> reset subsystem needs to learn about GPIO resets. (...)
>
> I agree. Certainly the reset subsystem can do what the regulator
> subsystem is already doing: request the GPIO line nonexclusive
> and handle any reference counting and/or quirks that are needed
> in a hypothetical drivers/reset/reset-gpio.c driver.

I did wrote the reset-gpio driver first ;)
then it failed the thought test on several levels.

to get a reset control one either use the shared or exclusive API.
Depending on which one you use, the behavior changes. With exclusive it
works like a GPIO (no refcounting of asserts), with shared it refcounts.

It fails flat if I boot with old dtb blob which did not had the "resets"
and "#reset-cells" (from the user's point of view). Even if the old dtb
had rst/enable/reset-gpios defined.

It is kind of hard to use it for 'Output Enable' type of gpios. They are
not reset or enable signals for the peripheral, but to open a gate to
outside, for example allow an amplifier to drive the analog line on (one
of) it's output for example.

> There is no such driver today, just a "reset" driver in
> drivers/power/reset that resets the whole system.

Yep, I have checked that as well before I wrote my own gpio-reset

> But I see no problem in creating a proper reset driver in drivers/reset
> to handle a few peripherals with a shared GPIO reset line.

Even if we have a reset-gpio driver we will have the same issue that the
regulator might reset things underneath the tiddly refcounted reset line
for non regulator users, plus one extra which is using the line as
output enable.

With the gpio-shared all of these can be handled in a nice way and we
can add the pass-through mode to it which is assumed by some setups or
use refcounting as it is in the initial patch.

And we need to modify the drivers to ask for shared/nonexclusive reset/gpio.

- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

\
 
 \ /
  Last update: 2019-11-05 12:16    [W:0.071 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site