aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/sh_pfc.h
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2012-06-20 11:03:41 -0400
committerPaul Mundt <lethal@linux-sh.org>2012-06-20 11:03:41 -0400
commit06d5631f56460917af3d9417ef63811cf0cad9ce (patch)
treea25eee33f3198c4ba75c79b51a3bc85fd10a5f50 /include/linux/sh_pfc.h
parent9f65b2b60c42c1e2d885acede4443b53f141c987 (diff)
sh: pfc: Verify pin type encoding size at build time.
The encoding is tightly packed, and future changes (such as pinconf-generic support) can easily lead to a situation where we violate the encoding constraints and trample data bit/reg bits. This plugs in some sanity checks by way of a BUILD_BUG_ON() to blow up if we fail to fit. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'include/linux/sh_pfc.h')
-rw-r--r--include/linux/sh_pfc.h23
1 files changed, 14 insertions, 9 deletions
diff --git a/include/linux/sh_pfc.h b/include/linux/sh_pfc.h
index c06a47313a25..ed1d8234f6ae 100644
--- a/include/linux/sh_pfc.h
+++ b/include/linux/sh_pfc.h
@@ -16,15 +16,18 @@
16typedef unsigned short pinmux_enum_t; 16typedef unsigned short pinmux_enum_t;
17typedef unsigned short pinmux_flag_t; 17typedef unsigned short pinmux_flag_t;
18 18
19#define PINMUX_TYPE_NONE 0 19enum {
20#define PINMUX_TYPE_FUNCTION 1 20 PINMUX_TYPE_NONE,
21#define PINMUX_TYPE_GPIO 2
22#define PINMUX_TYPE_OUTPUT 3
23#define PINMUX_TYPE_INPUT 4
24#define PINMUX_TYPE_INPUT_PULLUP 5
25#define PINMUX_TYPE_INPUT_PULLDOWN 6
26 21
27#define PINMUX_FLAG_TYPE (0x7) 22 PINMUX_TYPE_FUNCTION,
23 PINMUX_TYPE_GPIO,
24 PINMUX_TYPE_OUTPUT,
25 PINMUX_TYPE_INPUT,
26 PINMUX_TYPE_INPUT_PULLUP,
27 PINMUX_TYPE_INPUT_PULLDOWN,
28
29 PINMUX_FLAG_TYPE, /* must be last */
30};
28 31
29#define PINMUX_FLAG_DBIT_SHIFT 5 32#define PINMUX_FLAG_DBIT_SHIFT 5
30#define PINMUX_FLAG_DBIT (0x1f << PINMUX_FLAG_DBIT_SHIFT) 33#define PINMUX_FLAG_DBIT (0x1f << PINMUX_FLAG_DBIT_SHIFT)
@@ -36,7 +39,9 @@ struct pinmux_gpio {
36 pinmux_flag_t flags; 39 pinmux_flag_t flags;
37}; 40};
38 41
39#define PINMUX_GPIO(gpio, data_or_mark) [gpio] = { data_or_mark } 42#define PINMUX_GPIO(gpio, data_or_mark) \
43 [gpio] = { .enum_id = data_or_mark, .flags = PINMUX_TYPE_NONE }
44
40#define PINMUX_DATA(data_or_mark, ids...) data_or_mark, ids, 0 45#define PINMUX_DATA(data_or_mark, ids...) data_or_mark, ids, 0
41 46
42struct pinmux_cfg_reg { 47struct pinmux_cfg_reg {