[U-Boot] Blackfin: cmd_gpio port/pin naming

Mike Frysinger vapier at gentoo.org
Fri Jan 7 23:38:30 CET 2011


On Friday, January 07, 2011 15:50:30 Andreas Pretzsch wrote:
> the Blackfin U-Boot GPIO command (see "arch/blackfin/cpu/cmd_gpio.c")
> specifies the port/pin naming in the form "[p][port]<#>", e.g. PF11.
> The pin portion of the specified GPIO is limited to 0..15.
> While this is correct for Blackfins with different bank names (e.g.
> BF537 with PF, PG, PH), it's not sufficient for Blackfins with linear
> naming like the BF561 (PF0..PF47).

if we cut out the friendly port naming, the rest of the code is no longer 
Blackfin specific.  so what i had been thinking of doing at some point was 
dropping that as a requirement and making it a "nice" feature so it could be 
moved into common/cmd_gpio.c for everyone to use.

so if we rip out that part and just make it something like:
...
#ifndef name_to_gpio
#define name_to_gpio(name) simple_strtoul(name, NULL, 10)
#endif
...
ulong pin = name_to_gpio(argv[2]);
if (!gpio_is_valid(pin))
	goto usage;
...

although perhaps in your case, we can just change "if (pin > 15)" to "if 
(!gpio_is_valid(pin))" and forget about the people who do PF34 on parts that 
only have PF0..PF15 (they'll instead get like PH4 or whatever).
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110107/e148aee9/attachment.pgp 


More information about the U-Boot mailing list