diff mbox

[U-Boot] Blackfin: cmd_gpio: allow port pins over 15

Message ID 1294677172-12879-1-git-send-email-apr@cn-eng.de
State Superseded
Delegated to: Mike Frysinger
Headers show

Commit Message

Andreas Pretzsch Jan. 10, 2011, 4:32 p.m. UTC
The pin portion of the specified GPIO was limited to 0..15.
While this is correct for Blackfins with different bank names (e.g.
BF537 with PF, PG, PH with 16 pins each), it's not sufficient for
Blackfins with linear naming like the BF561 (PF0..PF47).
Therefore check only for a valid GPIO number.

Attn.: Passing a # too high for the port will wrap over to the next
port(s), e.g. PA16 => PB0. Not a problem for correct scripts, though.

Signed-off-by: Andreas Pretzsch <apr@cn-eng.de>
---
 arch/blackfin/cpu/cmd_gpio.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

Comments

Mike Frysinger April 8, 2011, 8:24 p.m. UTC | #1
this is obsoleted by my recent patch:
	[U-Boot] [PATCH] gpio: generalize for all generic gpio providers
-mike
Andreas Pretzsch April 11, 2011, 7:35 p.m. UTC | #2
Am Freitag, den 08.04.2011, 16:24 -0400 schrieb Mike Frysinger:
> this is obsoleted by my recent patch:
> 	[U-Boot] [PATCH] gpio: generalize for all generic gpio providers
> -mike

ACK. Thanks very much for your work.
diff mbox

Patch

diff --git a/arch/blackfin/cpu/cmd_gpio.c b/arch/blackfin/cpu/cmd_gpio.c
index e96413b..9fd5a19 100644
--- a/arch/blackfin/cpu/cmd_gpio.c
+++ b/arch/blackfin/cpu/cmd_gpio.c
@@ -83,7 +83,11 @@  int do_gpio(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 	/* grab the <#> portion */
 	ulong pin = simple_strtoul(str_pin + 1, NULL, 10);
-	if (pin > 15)
+	/* Attn.: passing a # too high for the port will wrap over to
+	 * the next port(s), e.g. PA16 => PB0.
+	 * Check relaxed due to linear ports (e.g. PF0..PF47 @ BF561).
+	 */
+	if (!gpio_is_valid(pin))
 		goto show_usage;
 
 	/* grab the pin before we tweak it */