diff options
author | Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> | 2012-11-28 20:23:26 -0500 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> | 2013-03-15 08:33:37 -0400 |
commit | 380c2ed92412d519c71d8c270d6b073b2c5bfdec (patch) | |
tree | 5fc8f2e483f25c56e7d01492c49595fd4e3a0564 /drivers/pinctrl/sh-pfc/sh_pfc.h | |
parent | 53f374b13413c072ec4717703479ef7d5b632f90 (diff) |
sh-pfc: Initialize pinmux_gpio flags statically
All function GPIO entries are initialized with the GPIO_FN macro that
expands to the PINMUX_GPIO macro, used to initialize real GPIOs. Create
a PINMUX_GPIO_FN macro that duplicates PINMUX_GPIO and sets flags to
PINMUX_TYPE_FUNCTION and use it in GPIO_FN, and make PINMUX_GPIO set
flags to PINMUX_TYPE_GPIO.
This removes the need to initialize GPIO flags at runtime and thus
simplifies the code, preparing for the GPIO and functions split.
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/sh-pfc/sh_pfc.h')
-rw-r--r-- | drivers/pinctrl/sh-pfc/sh_pfc.h | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/drivers/pinctrl/sh-pfc/sh_pfc.h b/drivers/pinctrl/sh-pfc/sh_pfc.h index 2627a89273ee..e15039504a1c 100644 --- a/drivers/pinctrl/sh-pfc/sh_pfc.h +++ b/drivers/pinctrl/sh-pfc/sh_pfc.h | |||
@@ -41,8 +41,18 @@ struct pinmux_gpio { | |||
41 | const char *name; | 41 | const char *name; |
42 | }; | 42 | }; |
43 | 43 | ||
44 | #define PINMUX_GPIO(gpio, data_or_mark) \ | 44 | #define PINMUX_GPIO(gpio, data_or_mark) \ |
45 | [gpio] = { .name = __stringify(gpio), .enum_id = data_or_mark, .flags = PINMUX_TYPE_NONE } | 45 | [gpio] = { \ |
46 | .name = __stringify(gpio), \ | ||
47 | .enum_id = data_or_mark, \ | ||
48 | .flags = PINMUX_TYPE_GPIO \ | ||
49 | } | ||
50 | #define PINMUX_GPIO_FN(gpio, data_or_mark) \ | ||
51 | [gpio] = { \ | ||
52 | .name = __stringify(gpio), \ | ||
53 | .enum_id = data_or_mark, \ | ||
54 | .flags = PINMUX_TYPE_FUNCTION \ | ||
55 | } | ||
46 | 56 | ||
47 | #define PINMUX_DATA(data_or_mark, ids...) data_or_mark, ids, 0 | 57 | #define PINMUX_DATA(data_or_mark, ids...) data_or_mark, ids, 0 |
48 | 58 | ||
@@ -135,7 +145,7 @@ enum { GPIO_CFG_DRYRUN, GPIO_CFG_REQ, GPIO_CFG_FREE }; | |||
135 | #define _GPIO_PORT(pfx, sfx) PINMUX_GPIO(GPIO_PORT##pfx, PORT##pfx##_DATA) | 145 | #define _GPIO_PORT(pfx, sfx) PINMUX_GPIO(GPIO_PORT##pfx, PORT##pfx##_DATA) |
136 | #define PORT_ALL(str) CPU_ALL_PORT(_PORT_ALL, PORT, str) | 146 | #define PORT_ALL(str) CPU_ALL_PORT(_PORT_ALL, PORT, str) |
137 | #define GPIO_PORT_ALL() CPU_ALL_PORT(_GPIO_PORT, , unused) | 147 | #define GPIO_PORT_ALL() CPU_ALL_PORT(_GPIO_PORT, , unused) |
138 | #define GPIO_FN(str) PINMUX_GPIO(GPIO_FN_##str, str##_MARK) | 148 | #define GPIO_FN(str) PINMUX_GPIO_FN(GPIO_FN_##str, str##_MARK) |
139 | 149 | ||
140 | /* helper macro for pinmux_enum_t */ | 150 | /* helper macro for pinmux_enum_t */ |
141 | #define PORT_DATA_I(nr) \ | 151 | #define PORT_DATA_I(nr) \ |