[U-Boot] [PATCH] WIP: tegra: Use driver model for GPIO driver

Simon Glass sjg at chromium.org
Sat May 3 06:25:29 CEST 2014


Hi Stephen,

On 2 May 2014 16:43, Stephen Warren <swarren at wwwdotorg.org> wrote:
> On 05/02/2014 02:51 PM, Simon Glass wrote:
>> This is an implementation of GPIOs for Tegra that uses driver model.
>> It is written for comment and need work and testing before it is ready
>> to use.
>>
>> Specific points for discussion:
>>
>> 1. I can't find much in the way of GPIO device tree bindings, so ended up
>> just creating the GPIO devices
>
> The binding is already defined in the Linux kernel at:
>
> Documentation/devicetree/bindings/gpio/gpio.txt
> Documentation/devicetree/bindings/gpio/nvidia,tegra20-gpio.txt
>
> An example is in:
>
> arch/arm/boot/dts/tegra20.dtsi

Yes but all the parameters are hard-coded in the driver, not in the
device tree. I ended up doing the same thing, as you probably noticed.

>
>
>> 3. Driver model understand the concept of a bank of GPIOs, but this is
>> equivalent to 'port' in Tegra. So it is somewhat confusing. Need to think
>> about this.
>
> There's no need at all to expose the banks separately. This is purely an
> implementation detail of the internal register layout of the HW, and not
> something that anyone outside the GPIO driver need concern itself with.
> Tegra simply has N GPIOs numbered 0..n-1. Admittedly the GPIOs also have
> textual names derived from the banked register layout, but this has no
> practical consequence, and need not be represented anywhere.
>
> I would imagine this is true of any GPIO controller. Why does the driver
> model know/care about GPIO banks?

For naming - A, B, C, etc. Each of these is considered a 'bank'. At
present each is a separate GPIO device, also. This will allow us to
support I2C extenders and other ways of adding GPIOs.

>
>> diff --git a/arch/arm/dts/tegra20.dtsi b/arch/arm/dts/tegra20.dtsi
>> index 3805750..10065da 100644
>> --- a/arch/arm/dts/tegra20.dtsi
>> +++ b/arch/arm/dts/tegra20.dtsi
>> @@ -143,6 +143,148 @@
>>               interrupts = < 64 65 66 67 87 119 121 >;
>>               #gpio-cells = <2>;
>>               gpio-controller;
>> +             #address-cells = <1>;
>> +             #size-cells = <0>;
>> +             port at 0 {
>> +                     reg = <0>;
>> +                     compatible = "nvidia,tegra20-gpio-bank";
>> +                     gpio-bank-name = "a";
>> +             };
>
> We definitely shouldn't add these port child nodes.

Yes, that was just something I was playing with - it's not used in the
driver as you probably saw.

I see that U-Boot's GPIO stuff is out of date for tegra, so I'll
update that. I'll see if I can remove the need for the second-level
bank devices also. Not quite sure what I'll end up with. Ideas
welcome.

Regards,
Simon


More information about the U-Boot mailing list