Skip to contentSkip to conversation

sh: improve pinmux support for single direction pins

PATCH New Magnus Damm 1 participant 1 message Oct 22, 2008 SuperH

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sh: improve pinmux support for single direction pins

From: Magnus Damm <[email protected]>

This patch improves the support for gpio pins that are hard wired to either input or output and lack control register association. A special force enum id is used to allow use without control register but still mark the gpio pin as input or output.

---

 arch/sh/include/asm/gpio.h              |    1 
 arch/sh/kernel/cpu/sh2a/pinmux-sh7203.c |   43 +++++++++++++++----------------
 arch/sh/kernel/gpio.c                   |    6 +++-
 3 files changed, 27 insertions(+), 23 deletions(-)
arch/sh/include/asm/gpio.h +1 -0
@@ -64,6 +64,7 @@ struct pinmux_data_reg {
 struct pinmux_range {
 	pinmux_enum_t begin;
 	pinmux_enum_t end;
+	pinmux_enum_t force;
 };
 
 struct pinmux_info {
arch/sh/kernel/cpu/sh2a/pinmux-sh7203.c +21 -22

110 lines not on this page · raw message

arch/sh/kernel/gpio.c +5 -1
@@ -267,9 +267,13 @@ int pinmux_config_gpio(struct pinmux_inf
 			break;
 
 		in_range = enum_in_range(enum_id, &gpioc->function);
-		if (!in_range && range)
+		if (!in_range && range) {
 			in_range = enum_in_range(enum_id, range);
 
+			if (in_range && enum_id = range->force)
+				continue;
+		}
+
 		if (!in_range)
 			continue;