From: Stephen Warren <swarren@wwwdotorg.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] Driver Model and DTS Parsing
Date: Thu, 31 Jul 2014 12:04:13 -0600 [thread overview]
Message-ID: <53DA851D.3090200@wwwdotorg.org> (raw)
In-Reply-To: <CAPnjgZ2rgMzoWq7TEA=1hLFregB+yLO=ogasMnnqMBw1DKOULA@mail.gmail.com>
On 07/31/2014 03:56 AM, Simon Glass wrote:
> Hi Stephen,
>
> On 30 July 2014 20:57, Stephen Warren <swarren@wwwdotorg.org
> <mailto:swarren@wwwdotorg.org>> wrote:
>
> On 07/30/2014 10:09 AM, Simon Glass wrote:
>
> Hi Stephen,
>
> On 30 July 2014 16:47, Stephen Warren <swarren@wwwdotorg.org
> <mailto:swarren@wwwdotorg.org>> wrote:
>
> On 07/30/2014 09:26 AM, Simon Glass wrote:
>
>
> Hi Stephen,
>
> On 12 June 2014 23:31, Stephen Warren
> <swarren at wwwdotorg.org <mailto:swarren@wwwdotorg.org>>
> wrote:
>
>
> On 06/11/2014 10:55 PM, Simon Glass wrote:
> ...
Hmmm. This email has funny formatting, but hopefully it won't be too
hard to follow.
...
> So just define the Tegra GPIO controller as having a single bank.
> The fact that U-Boot and Tegra both chose the word "bank" to mean
> different things doesn't mean that the U-Boot term has to be forced
> to apply to Tegra where the documentation talks about a "bank".
>
> I don't think "bank" is a good description or level of abstraction
> anyway; U-Boot should use the term "controller", "chip", or "module"
> (which would apply to an entire HW module or GPIO expander chip),
> since "bank" is usually an internal implementation detail rather
> than something the user cares about. Put another way: all banks in a
> controller/chip/module/... would typically use the same
> operation/op/callback functions, just with different GPIO IDs or
> per-GPIO data, whereas different controllers/chips/modules/... would
> use different operation/op/callback functions. It therefore makes
> much more sense to abstract at the level of
> controller/chip/module/... rather than "bank" level, which is an
> internal implementation detail.
>
>
> Are you saying that 'bank' should be renamed 'chip' and then you would
> be happy? Or are you still talking about a separate level of data structure?
My primary objection is:
In Tegra, the GPIO controller should be represented as a single entity
that controls 250 GPIOs, not as a set of separate entities that control
8 or 32 GPIOs each.
Note that I'm talking about what the GPIO controller looks like to
anything outside the driver. Whether the driver internally uses the
concept of banks (or any other name) isn't relevant, since that would be
an entirely hidden implementation detail.
Renaming "bank" to "chip" or "controller" certainly makes sense to me,
but if that's the only change made, it would not address the objection I
just mentioned.
...
> The Linux GPIO driver uses the concept of a 'bank', and it doesn't even
> match with the TRM. A bank has 32 GPIOs and there are up to 8 banks.
> Each bank gets a separate 'struct tegra_gpio_banks'. In no way at they
> all lumped together.
That's not quite true.
*Internally* to the driver, there is a struct tegra_gpio_banks, I agree.
As an aside, there really doesn't need to be, since the calculations are
trivial enough that we should just do them for each access, but that's
beside the point.
*Externally* to the driver, there is a single "struct gpio_chip"
registered with the GPIO core. This chip owns/exposes all 250 GPIOs.
That's because in terms of HW, there is a single GPIO controller that
owns all 250 GPIOs.
> I am just trying to make sure that a 'struct
> udevice' corresponds to a 'struct tegra_gpio_banks', in the sense that
> we are not unnecessarily creating a level of data structure that is
> hidden from driver model. For example 'tegra_gpio_banks' would not be
> visible to the 'dm tree' command.
I very specifically want U-Boot, just like the kernel, to have a single
driver for the entire GPIO controller.
Whether the internals of that driver have a "struct tegra_gpio_banks" or
not is an implementation detail that has zero impact on the driver
model. As I mentioned above, there's no need for the driver to have a
"struct tegra_gpio_banks"; the register address calculations are trivial
enough that there's no need to divide the GPIO ID -> register address
calculation into two steps (the intermediate step generating this
annoying "bank" ID, which as you mentioned might not even correspond to
what the TRM calls a bank.)
> Does it really matter whether we split things into groups of 8 or groups
> of 32 or a large group of 224/256?
Yes. Anything external to the GPIO controller driver must see the HW as
it exists and is documented; a single HW module that controls 250 GPIOs.
next prev parent reply other threads:[~2014-07-31 18:04 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-30 14:49 [U-Boot] Driver Model and DTS Parsing Jon Loeliger
2014-06-03 1:26 ` Simon Glass
2014-06-03 13:39 ` Jon Loeliger
2014-06-03 16:04 ` Simon Glass
2014-06-03 16:33 ` Stephen Warren
2014-06-12 4:55 ` Simon Glass
2014-06-12 22:31 ` Stephen Warren
2014-07-30 15:26 ` Simon Glass
2014-07-30 15:47 ` Stephen Warren
2014-07-30 16:09 ` Simon Glass
2014-07-30 19:57 ` Stephen Warren
2014-07-31 9:56 ` Simon Glass
2014-07-31 18:04 ` Stephen Warren [this message]
2014-08-04 10:22 ` Simon Glass
2014-08-04 17:38 ` Stephen Warren
2014-08-04 20:21 ` Simon Glass
2014-07-31 21:58 ` Simon Glass
2014-07-31 22:54 ` Stephen Warren
2014-08-01 15:42 ` Jon Loeliger
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=53DA851D.3090200@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox