diff options
author | Lothar Waßmann <LW@KARO-electronics.de> | 2010-10-26 08:28:31 -0400 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2010-11-24 03:56:58 -0500 |
commit | 8f5260c8c1a1f9b25dfedd5ca749e4faef1b3eb9 (patch) | |
tree | 56f3a67b1cf74a670c026ab14cc872cf3accccb8 /arch/arm/plat-mxc | |
parent | 2a85927c79634e89b9cd683dd2bae65966d9b216 (diff) |
ARM: i.MX IOMUX-V3 replace struct pad_desc with bitmapped cookie
The following patch is a first step to convert the 'struct pad_desc'
to a bitmapped cookie to facilitate adding platform specific pullup or
drive strength definitions to existing pad definitions without need to
rewrite the complete pad def.
The patch wraps 'struct pad_desc' in an opaque data type and
introduces macros to access the individual members.
This patch does not constitute any functional change!
Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/plat-mxc')
-rw-r--r-- | arch/arm/plat-mxc/include/mach/iomux-v3.h | 38 | ||||
-rw-r--r-- | arch/arm/plat-mxc/iomux-v3.c | 22 |
2 files changed, 45 insertions, 15 deletions
diff --git a/arch/arm/plat-mxc/include/mach/iomux-v3.h b/arch/arm/plat-mxc/include/mach/iomux-v3.h index 0880a4a1aed1..811716fbfbe6 100644 --- a/arch/arm/plat-mxc/include/mach/iomux-v3.h +++ b/arch/arm/plat-mxc/include/mach/iomux-v3.h | |||
@@ -44,7 +44,7 @@ | |||
44 | * | 44 | * |
45 | */ | 45 | */ |
46 | 46 | ||
47 | struct pad_desc { | 47 | typedef struct deprecated_pad_desc { |
48 | unsigned mux_ctrl_ofs:12; /* IOMUXC_SW_MUX_CTL_PAD offset */ | 48 | unsigned mux_ctrl_ofs:12; /* IOMUXC_SW_MUX_CTL_PAD offset */ |
49 | unsigned mux_mode:8; | 49 | unsigned mux_mode:8; |
50 | unsigned pad_ctrl_ofs:12; /* IOMUXC_SW_PAD_CTRL offset */ | 50 | unsigned pad_ctrl_ofs:12; /* IOMUXC_SW_PAD_CTRL offset */ |
@@ -52,7 +52,37 @@ struct pad_desc { | |||
52 | unsigned pad_ctrl:17; | 52 | unsigned pad_ctrl:17; |
53 | unsigned select_input_ofs:12; /* IOMUXC_SELECT_INPUT offset */ | 53 | unsigned select_input_ofs:12; /* IOMUXC_SELECT_INPUT offset */ |
54 | unsigned select_input:3; | 54 | unsigned select_input:3; |
55 | }; | 55 | } iomux_v3_cfg_t; |
56 | |||
57 | static inline unsigned int MUX_CTRL_OFS(iomux_v3_cfg_t *pad) | ||
58 | { | ||
59 | return pad->mux_ctrl_ofs; | ||
60 | } | ||
61 | |||
62 | static inline unsigned int MUX_MODE(iomux_v3_cfg_t *pad) | ||
63 | { | ||
64 | return pad->mux_mode; | ||
65 | } | ||
66 | |||
67 | static inline unsigned int MUX_SELECT_INPUT_OFS(iomux_v3_cfg_t *pad) | ||
68 | { | ||
69 | return pad->select_input_ofs; | ||
70 | } | ||
71 | |||
72 | static inline unsigned int MUX_SELECT_INPUT(iomux_v3_cfg_t *pad) | ||
73 | { | ||
74 | return pad->select_input; | ||
75 | } | ||
76 | |||
77 | static inline unsigned int MUX_PAD_CTRL_OFS(iomux_v3_cfg_t *pad) | ||
78 | { | ||
79 | return pad->pad_ctrl_ofs; | ||
80 | } | ||
81 | |||
82 | static inline unsigned int MUX_PAD_CTRL(iomux_v3_cfg_t *pad) | ||
83 | { | ||
84 | return pad->pad_ctrl; | ||
85 | } | ||
56 | 86 | ||
57 | #define IOMUX_PAD(_pad_ctrl_ofs, _mux_ctrl_ofs, _mux_mode, _select_input_ofs, \ | 87 | #define IOMUX_PAD(_pad_ctrl_ofs, _mux_ctrl_ofs, _mux_mode, _select_input_ofs, \ |
58 | _select_input, _pad_ctrl) \ | 88 | _select_input, _pad_ctrl) \ |
@@ -107,13 +137,13 @@ struct pad_desc { | |||
107 | /* | 137 | /* |
108 | * setups a single pad in the iomuxer | 138 | * setups a single pad in the iomuxer |
109 | */ | 139 | */ |
110 | int mxc_iomux_v3_setup_pad(struct pad_desc *pad); | 140 | int mxc_iomux_v3_setup_pad(iomux_v3_cfg_t *pad); |
111 | 141 | ||
112 | /* | 142 | /* |
113 | * setups mutliple pads | 143 | * setups mutliple pads |
114 | * convenient way to call the above function with tables | 144 | * convenient way to call the above function with tables |
115 | */ | 145 | */ |
116 | int mxc_iomux_v3_setup_multiple_pads(struct pad_desc *pad_list, unsigned count); | 146 | int mxc_iomux_v3_setup_multiple_pads(iomux_v3_cfg_t *pad_list, unsigned count); |
117 | 147 | ||
118 | /* | 148 | /* |
119 | * Initialise the iomux controller | 149 | * Initialise the iomux controller |
diff --git a/arch/arm/plat-mxc/iomux-v3.c b/arch/arm/plat-mxc/iomux-v3.c index b318c6a222d5..975ca7cdf9ad 100644 --- a/arch/arm/plat-mxc/iomux-v3.c +++ b/arch/arm/plat-mxc/iomux-v3.c | |||
@@ -32,26 +32,26 @@ | |||
32 | static void __iomem *base; | 32 | static void __iomem *base; |
33 | 33 | ||
34 | /* | 34 | /* |
35 | * setups a single pad in the iomuxer | 35 | * configures a single pad in the iomuxer |
36 | */ | 36 | */ |
37 | int mxc_iomux_v3_setup_pad(struct pad_desc *pad) | 37 | int mxc_iomux_v3_setup_pad(iomux_v3_cfg_t *pad) |
38 | { | 38 | { |
39 | if (pad->mux_ctrl_ofs) | 39 | if (MUX_CTRL_OFS(pad)) |
40 | __raw_writel(pad->mux_mode, base + pad->mux_ctrl_ofs); | 40 | __raw_writel(MUX_MODE(pad), base + MUX_CTRL_OFS(pad)); |
41 | 41 | ||
42 | if (pad->select_input_ofs) | 42 | if (MUX_SELECT_INPUT_OFS(pad)) |
43 | __raw_writel(pad->select_input, | 43 | __raw_writel(MUX_SELECT_INPUT(pad), |
44 | base + pad->select_input_ofs); | 44 | base + MUX_SELECT_INPUT(pad)); |
45 | 45 | ||
46 | if (!(pad->pad_ctrl & NO_PAD_CTRL) && pad->pad_ctrl_ofs) | 46 | if (!(MUX_PAD_CTRL(pad) & NO_PAD_CTRL) && MUX_PAD_CTRL_OFS(pad)) |
47 | __raw_writel(pad->pad_ctrl, base + pad->pad_ctrl_ofs); | 47 | __raw_writel(MUX_PAD_CTRL(pad), base + MUX_PAD_CTRL_OFS(pad)); |
48 | return 0; | 48 | return 0; |
49 | } | 49 | } |
50 | EXPORT_SYMBOL(mxc_iomux_v3_setup_pad); | 50 | EXPORT_SYMBOL(mxc_iomux_v3_setup_pad); |
51 | 51 | ||
52 | int mxc_iomux_v3_setup_multiple_pads(struct pad_desc *pad_list, unsigned count) | 52 | int mxc_iomux_v3_setup_multiple_pads(iomux_v3_cfg_t *pad_list, unsigned count) |
53 | { | 53 | { |
54 | struct pad_desc *p = pad_list; | 54 | iomux_v3_cfg_t *p = pad_list; |
55 | int i; | 55 | int i; |
56 | int ret; | 56 | int ret; |
57 | 57 | ||