[U-Boot] [PATCH 1/7] Tegra114: Add arch-tegra114 include files

Tom Warren twarren.nvidia at gmail.com
Thu Jan 17 23:56:34 CET 2013


Stephen,

On Thu, Jan 17, 2013 at 3:23 PM, Stephen Warren <swarren at wwwdotorg.org> wrote:
> On 01/17/2013 10:51 AM, Tom Warren wrote:
>> Stephen,
>>
>> On Wed, Jan 16, 2013 at 3:32 PM, Stephen Warren <swarren at 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.

I don't see the value in rewriting the Tegra GPIO driver right now -
maybe after T30 and T114 are more mature and there's more bandwidth.

#including the T30 gpio header is easier. I'll do that in V2.

Thanks


More information about the U-Boot mailing list