[U-Boot] [PATCH 1/2] gpio: Add DW APB GPIO driver

Marek Vasut marex at denx.de
Mon Aug 10 17:01:58 CEST 2015


On Friday, August 07, 2015 at 10:37:54 PM, Simon Glass wrote:
> Hi Marek,

Hi Simon,

> On 7 August 2015 at 14:35, Marek Vasut <marex at denx.de> wrote:
> > On Friday, August 07, 2015 at 09:13:45 PM, Simon Glass wrote:
> >> Hi Marek,
> > 
> > Hi!
> > 
> >> On 5 August 2015 at 19:49, Marek Vasut <marex at denx.de> wrote:
> >> > On Wednesday, August 05, 2015 at 04:39:33 PM, Simon Glass wrote:
> >> >> Hi Marek,
> >> > 
> >> > Hi Simon,
> > 
> > [...]
> > 
> >> >> It's up to you. Normally each bank has a name and the datasheet
> >> >> specifies it. In your case if not you could think about a naming
> >> >> scheme.
> >> > 
> >> > Can you please take a look into arch/arm/dts/socfpga.dtsi ?
> >> > The system has three GPIO controllers (look for gpio0, gpio1, gpio2)
> >> > and each of these controllers has one bank (porta, portb, portc) .
> >> > 
> >> > I can name my gpios portxN , where x is either of a,b,c and N is the
> >> > GPIO number. The problem is, I cannot determine in dwapb_gpio_bind()
> >> > which one is "porta", "portb" and "portc" because all I have is the
> >> > physical addess of the GPIO controller and the index of the bank in
> >> > the namespace of that controller.
> >> > 
> >> > Sure, I can do some sort of global counting in the driver, but I would
> >> > like to avoid that sort of thing. I can also add some kind of ad-hoc
> >> > DT prop, but that's also not a good idea I think. Do you have any
> >> > suggestion for me please ?
> >> 
> >> One option is to use the device tree node name but it isn't very
> >> friendly - gpio0 at xxxxx.
> > 
> > That's what I do now pretty much.
> > 
> >> You could perhaps add a new property like 'bank-name'?
> > 
> > Do we want to add ad-hoc DT nodes which are
> > a) Not describing hardware
> > b) Not part of the official DT bindings for that platform
> > ?
> > 
> > Is that really a way to go ?
> > 
> > [...]
> 
> It needs to be part of the official binding. Naming the hardware is
> part of the hardware definition - see for example the regulator-name
> property for regulators.

So what do you think about introducing a 'bank-name' property then ?
I think this might work just fine ?

> Another option is to use an alias:
> 
> aliases {
>    gpio0 = &gpio_0;
>    gpio1 = &gpio_1;
>    gpio2 = &gpio_2;
> }
> 
> Then you can turn gpio0 into bank A, gpio1 into bank B, etc.

Is there a function which maps the udevice->dev->of_offset into an alias's
seq ID ?

Best regards,
Marek Vasut


More information about the U-Boot mailing list