public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Stephen Warren <swarren@wwwdotorg.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/7] Tegra114: Add arch-tegra114 include files
Date: Thu, 17 Jan 2013 15:23:19 -0700	[thread overview]
Message-ID: <50F879D7.5090003@wwwdotorg.org> (raw)
In-Reply-To: <CA+m5__+s-6AVTZnFHokG-9nVHWYAyOf=V306grQsB0_OCXHjug@mail.gmail.com>

On 01/17/2013 10:51 AM, Tom Warren wrote:
> Stephen,
> 
> On Wed, Jan 16, 2013 at 3:32 PM, Stephen Warren <swarren@wwwdotorg.org> wrote:
>> On 01/16/2013 02:14 PM, Tom Warren wrote:
>>> Common Tegra files are in arch-tegra, shared between T20/T30/T114.
>>> Tegra114-specific headers are in arch-tegra114. Note that some of
>>> these will be filled in as more T114 support is added (drivers,
>>> WB/LP0 support, etc.).
>>
>>> diff --git a/arch/arm/include/asm/arch-tegra114/gpio.h b/arch/arm/include/asm/arch-tegra114/gpio.h
>>
>> I think the Tegra30 and Tegra114 GPIO controllers are basically
>> identical. Can this file be shared at all?
>>
> 
> gpio.h is identical for T30 and T114, but not for T20.  I've already
> commonized what I could in arch-tegra/gpio.h, but to do the same for
> the gpio_ctlr struct and gpio_pin enums would involve #ifdefs, which
> is moving in the wrong direction, IMO.  If you have a way to share one
> or two files between T20/T30/T114/future SoCs, I'll give it a try.

This may not work well for U-Boot since it uses structs to define the
register layouts rather than simply #defining the various register
addresses, but:

We use the exact same driver code for Tegra20/30/114. The difference in
register layout between Tegra20/30 can be described algorithmically with
the following data:

> struct tegra_gpio_soc_config {
>         u32 bank_stride;
>         u32 upper_offset;
> };
> 
> static struct tegra_gpio_soc_config tegra20_gpio_config = {
>         .bank_stride = 0x80,
>         .upper_offset = 0x800,
> };
> 
> static struct tegra_gpio_soc_config tegra30_gpio_config = {
>         .bank_stride = 0x100,
>         .upper_offset = 0x80,
> };
> 
> static struct of_device_id tegra_gpio_of_match[] = {
>         { .compatible = "nvidia,tegra30-gpio", .data = &tegra30_gpio_config },
>         { .compatible = "nvidia,tegra20-gpio", .data = &tegra20_gpio_config },
>         { },
> };

which feeds into a few register offset #defines:

> #define GPIO_REG(x)             (GPIO_BANK(x) * tegra_gpio_bank_stride + \
...
> #define GPIO_CNF(x)             (GPIO_REG(x) + 0x00)
...
> #define GPIO_MSK_CNF(x)         (GPIO_REG(x) + tegra_gpio_upper_offset + 0x00)

Alternatively, can the Tegra114 GPIO header simply #include the Tegra30
GPIO header and do nothing else, via some relative include or similar?
I'm not sure how gross that'd turn out to be.

  reply	other threads:[~2013-01-17 22:23 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-16 21:14 [U-Boot] [PATCH 0/7] Add support for NVIDIA Tegra114 SoC Tom Warren
2013-01-16 21:14 ` [U-Boot] [PATCH 1/7] Tegra114: Add arch-tegra114 include files Tom Warren
2013-01-16 22:32   ` Stephen Warren
2013-01-17 17:51     ` Tom Warren
2013-01-17 22:23       ` Stephen Warren [this message]
2013-01-17 22:56         ` Tom Warren
2013-01-16 22:39   ` Allen Martin
2013-01-17 17:50     ` Tom Warren
2013-01-16 21:14 ` [U-Boot] [PATCH 2/7] Tegra114: Add AVP (arm720t) files Tom Warren
2013-01-16 22:42   ` Stephen Warren
2013-01-17 19:15     ` Tom Warren
2013-01-17 22:42       ` Stephen Warren
2013-01-16 23:01   ` Allen Martin
2013-01-17 19:28     ` Tom Warren
2013-01-16 21:14 ` [U-Boot] [PATCH 3/7] Tegra114: Add CPU (armv7) files Tom Warren
2013-01-16 21:14 ` [U-Boot] [PATCH 4/7] Tegra114: Add common CPU (shared) files Tom Warren
2013-01-16 22:46   ` Stephen Warren
2013-01-17 17:55     ` Tom Warren
2013-01-16 21:14 ` [U-Boot] [PATCH 5/7] Tegra114: Dalmore: Add DT files Tom Warren
2013-01-16 22:47   ` Stephen Warren
2013-01-17 17:58     ` Tom Warren
2013-01-17 22:25       ` Stephen Warren
2013-01-17 22:58         ` Tom Warren
2013-01-17 23:11           ` Stephen Warren
2013-01-17 23:29             ` Tom Warren
2013-01-16 21:14 ` [U-Boot] [PATCH 6/7] Tegra114: Add generic Tegra114 build support Tom Warren
2013-01-16 21:14 ` [U-Boot] [PATCH 7/7] Tegra114: Add/enable Dalmore build (T114 reference board) Tom Warren
2013-01-16 22:51   ` Stephen Warren
2013-01-17 18:01     ` Tom Warren
2013-01-21 23:07     ` Simon Glass
2013-01-22 20:47       ` Tom Warren
2013-01-22 20:56         ` 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=50F879D7.5090003@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