From 92f1d0dec1dfeb6cc43173947df2c254c68950ca Mon Sep 17 00:00:00 2001 From: Alejandro Mery Date: Sat, 19 Jan 2013 14:05:02 +0100 Subject: [PATCH] fexc: add support for pio banks up to N needed for A31 support. closes issue #9 Signed-off-by: Alejandro Mery --- script.h | 2 ++ script_bin.c | 7 ++++--- script_fex.c | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/script.h b/script.h index 0fa2134..e4c1ada 100644 --- a/script.h +++ b/script.h @@ -17,6 +17,8 @@ #ifndef _SUNXI_TOOLS_SCRIPT_H #define _SUNXI_TOOLS_SCRIPT_H +#define GPIO_BANK_MAX 13 /* N */ + /** head of the data tree */ struct script { struct list_entry sections; diff --git a/script_bin.c b/script_bin.c index 752f519..cd71218 100644 --- a/script_bin.c +++ b/script_bin.c @@ -255,9 +255,10 @@ static int decompile_section(void *bin, size_t UNUSED(bin_size), filename, section->name, entry->name, words, 6); } else if (gpio->port == 0xffff) { ; /* port:power */ - } else if (gpio->port < 1 || gpio->port > 10) { - pr_err("%s: %s.%s: unknown GPIO port type %u\n", - filename, section->name, entry->name, gpio->port); + } else if (gpio->port < 1 || gpio->port > GPIO_BANK_MAX) { + pr_err("%s: %s.%s: unknown GPIO port bank %c (%u)\n", + filename, section->name, entry->name, + 'A'+gpio->port, gpio->port); goto failure; } v[0] = gpio->mul_sel; diff --git a/script_fex.c b/script_fex.c index 64699a9..50e8d2b 100644 --- a/script_fex.c +++ b/script_fex.c @@ -261,7 +261,7 @@ int script_parse_fex(FILE *in, const char *filename, struct script *script) /* GPIO */ p += 5; if (p[0] == 'P' && - (p[1] < 'A' || p[1] > 'I')) + (p[1] < 'A' || p[1] > ('A' + GPIO_BANK_MAX))) ; else if (*p != 'P' && memcmp(p, "power", 5) != 0)