Hi,

On 10/30/2014 10:08 AM, Ian Campbell wrote:
> On Wed, 2014-10-29 at 13:28 -0600, Simon Glass wrote:
>>> In the meantime could we somehow replace/augment the #ifdef chain in
>>> gpio_init with something keyed off the stdout alias perhaps?
>>
>> Tegra has code to convert a device interrupt number (which uniquely
>> identifies a peripheral in that SoC) to an internal peripheral ID,
>> then these is a function which can enable a peripheral given the ID
>> (funcmux). In some cases you could have multiple options for the
>> funcmux, but there is no easy way to support this.
> 
> I think that although there are multiple options for some functions
> (UARTs come to mind) we haven't yet found the need to make any dynamic
> choices, so it's all static right now.
> 
>>  But this approach
>> might be good enough for sunxi. We can easily write the function to
>> enable the pins for a particular port, and this could go in
>> arch/arm/...sunxi/ perhaps.
> 
> I'm ok with it so long as it isn't going to stand in the way of proper
> dt based pinmux in the future.
> 
> One way to help with that might be to use the allwinner,function
> property in DT as the funcmux name.
> 
> Hans, what do you think?

I'm not 100% sure what you're suggesting here, are you suggesting to
have a 1:1 mapping between function names as stored in allwinner,function
in dts and the value to pass to sunxi_gpio_set_cfgpin ?

This is not going to fly very far, e.g. the "uart0" function has cfg value
of 2 on portb while it has a value of 4 on portf.

So we will really need a sunxi specific function to go from port-no +
allwinner,function-string to a sunxi_gpio_set_cfgpin function.

I think the best thing we can do to not make this function too big is do 3
things:

1) Have a table which only contains mapping where the cfg value is not 2,
most ipblocks have a "primary" gpio port they are intended to be used with,
and this usage maps to a cfg value of 2, and most designs use this, so have
a list of exceptions and return 2 otherwise, this will make debugging of
issues where the mux is not setup a bit harder, but it will keep things a
lot smaller.

2) Only but things in there which are actually used by boards, or we expect
to need in the near future.

3) Have #ifndef CONFIG_SPL_BUILD .. #endif around anything but mmc / uart
entries in that table.

Together those should keep things small enough for the SPL.

Regards,

Hans


_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to