[U-Boot] [RFC PATCH v2 13/13] tegra: Convert tegra GPIO driver to use driver model

Simon Glass
2014-05-22T01:25:57Z

Hi Stephen,

On 13 May 2014 09:30, Stephen Warren <swarren@wwwdotorg.org> wrote:
> On 05/09/2014 11:28 AM, Simon Glass wrote:
>> This is an implementation of GPIOs for Tegra that uses driver model. It has
>> been tested on trimslice and also using the new iotrace feature.
>>
>> The implementation uses a top-level GPIO device (which has no actual GPIOS).
>> Under this all the banks are created as separate GPIO devices.
>
> I still believe that there is a single Tegra GPIO controller, and this
> should be represented by a single device in the U-Boot device model.
>

It is possible that this is the best way to go, but it is far from
certain. I have just had a try at implementing this for exynos now
that the GPIO patches have been applied. I find a number of
independent GPIO banks which fits nicely into the driver model idea of
hierarchical devices. I'm on the fence with Tegra, but feel my
approach is reasonable for now.

If we go with the route you suggest, we'll have to deal with a single
device having multiple banks. That may be necessary/expedient at some
point but for now I would prefer to add complexity/features as they
are needed, and not before. Once we have a few more GPIO conversions
done it should be clearer. It is very early days with driver model and
we don't have a lot of information as to what is best. If we want to
change the way GPIO drivers are done in a few months, it is not a big
job and I will happily do it, I just don't want to build more
complexity than we need early on.

There is also no need for a single hardware device to be a single
U-Boot 'struct device'. In particular mfd devices have several
children with different functions. One of the founding principles of
U-Boot's driver model was to support child devices easily and in a
general way. IMO we might as well take advantage of it.

Regards,
Simon