All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Warren <swarren@wwwdotorg.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] WIP: tegra: Use driver model for GPIO driver
Date: Mon, 05 May 2014 10:10:41 -0600	[thread overview]
Message-ID: <5367B801.4070901@wwwdotorg.org> (raw)
In-Reply-To: <CAPnjgZ3w_9LGz5H2eKe-zof8-sWiND3F0xi_cw2UJo98oirQXA@mail.gmail.com>

On 05/02/2014 10:25 PM, Simon Glass wrote:
> Hi Stephen,
> 
> On 2 May 2014 16:43, Stephen Warren <swarren@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.

To be honest, since I saw all the DT binding changes and mentions of
"banks", I didn't look at the driver, since I assumed it'd have to be
re-written to solve those issues first. If the driver doesn't actually
use any of that stuff, then perhaps I should take another look at the patch.

>>> 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.

I don't think individual GPIO controllers have to be broken down into
banks in order for U-Boot to support multiple GPIO controllers. U-Boot
should know that multiple controller instances exist. U-Boot shouldn't
dictate the internal structure of each controller; if it wants to expose
1000 GPIOs in a flat naming space, that should be OK.

Or, when you mentioned "bank", did you mean "HW module" or "GPIO
expander chip" i.e. what the Linux kernel calls a struct gpio_chip,
rather than a "bank" being a sub-division of a whole HW module or GPIO
expander chip?

  reply	other threads:[~2014-05-05 16:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-02 20:51 [U-Boot] [PATCH] WIP: tegra: Use driver model for GPIO driver Simon Glass
2014-05-02 22:43 ` Stephen Warren
2014-05-03  4:25   ` Simon Glass
2014-05-05 16:10     ` Stephen Warren [this message]
2014-05-05 16:32       ` Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5367B801.4070901@wwwdotorg.org \
    --to=swarren@wwwdotorg.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.