sh-pfc: Split pins and functions definition tables
Split the GPIOs table into a pins table for real GPIOs and a functions
table for function GPIOs.
Only register pins with the pinctrl core. The function GPIOs remain
accessible as GPIOs.
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
diff --git a/drivers/pinctrl/sh-pfc/sh_pfc.h b/drivers/pinctrl/sh-pfc/sh_pfc.h
index 6ed7ab9..940170a 100644
--- a/drivers/pinctrl/sh-pfc/sh_pfc.h
+++ b/drivers/pinctrl/sh-pfc/sh_pfc.h
@@ -35,23 +35,27 @@
#define PINMUX_FLAG_DREG_SHIFT 10
#define PINMUX_FLAG_DREG (0x3f << PINMUX_FLAG_DREG_SHIFT)
-struct pinmux_gpio {
+struct pinmux_pin {
const pinmux_enum_t enum_id;
pinmux_flag_t flags;
const char *name;
};
+struct pinmux_func {
+ const pinmux_enum_t enum_id;
+ const char *name;
+};
+
#define PINMUX_GPIO(gpio, data_or_mark) \
[gpio] = { \
.name = __stringify(gpio), \
.enum_id = data_or_mark, \
.flags = PINMUX_TYPE_GPIO \
}
-#define PINMUX_GPIO_FN(gpio, data_or_mark) \
- [gpio] = { \
+#define PINMUX_GPIO_FN(gpio, base, data_or_mark) \
+ [gpio - (base)] = { \
.name = __stringify(gpio), \
.enum_id = data_or_mark, \
- .flags = PINMUX_TYPE_FUNCTION \
}
#define PINMUX_DATA(data_or_mark, ids...) data_or_mark, ids, 0
@@ -106,9 +110,10 @@
struct pinmux_range output;
struct pinmux_range function;
- struct pinmux_gpio *gpios;
+ struct pinmux_pin *pins;
unsigned int nr_pins;
- unsigned int nr_gpios;
+ struct pinmux_func *func_gpios;
+ unsigned int nr_func_gpios;
struct pinmux_cfg_reg *cfg_regs;
struct pinmux_data_reg *data_regs;
@@ -145,7 +150,7 @@
#define _GPIO_PORT(pfx, sfx) PINMUX_GPIO(GPIO_PORT##pfx, PORT##pfx##_DATA)
#define PORT_ALL(str) CPU_ALL_PORT(_PORT_ALL, PORT, str)
#define GPIO_PORT_ALL() CPU_ALL_PORT(_GPIO_PORT, , unused)
-#define GPIO_FN(str) PINMUX_GPIO_FN(GPIO_FN_##str, str##_MARK)
+#define GPIO_FN(str) PINMUX_GPIO_FN(GPIO_FN_##str, PINMUX_FN_BASE, str##_MARK)
/* helper macro for pinmux_enum_t */
#define PORT_DATA_I(nr) \