diff options
Diffstat (limited to 'arch/arm/mach-omap2/mux.h')
-rw-r--r-- | arch/arm/mach-omap2/mux.h | 163 |
1 files changed, 150 insertions, 13 deletions
diff --git a/arch/arm/mach-omap2/mux.h b/arch/arm/mach-omap2/mux.h index a8e040c2c7e9..2132308ad1e4 100644 --- a/arch/arm/mach-omap2/mux.h +++ b/arch/arm/mach-omap2/mux.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2009 Nokia | 2 | * Copyright (C) 2009 Nokia |
3 | * Copyright (C) 2009 Texas Instruments | 3 | * Copyright (C) 2009-2010 Texas Instruments |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License version 2 as | 6 | * it under the terms of the GNU General Public License version 2 as |
@@ -10,6 +10,7 @@ | |||
10 | #include "mux2420.h" | 10 | #include "mux2420.h" |
11 | #include "mux2430.h" | 11 | #include "mux2430.h" |
12 | #include "mux34xx.h" | 12 | #include "mux34xx.h" |
13 | #include "mux44xx.h" | ||
13 | 14 | ||
14 | #define OMAP_MUX_TERMINATOR 0xffff | 15 | #define OMAP_MUX_TERMINATOR 0xffff |
15 | 16 | ||
@@ -37,6 +38,9 @@ | |||
37 | #define OMAP_OFF_PULL_UP (1 << 13) | 38 | #define OMAP_OFF_PULL_UP (1 << 13) |
38 | #define OMAP_WAKEUP_EN (1 << 14) | 39 | #define OMAP_WAKEUP_EN (1 << 14) |
39 | 40 | ||
41 | /* 44xx specific mux bit defines */ | ||
42 | #define OMAP_WAKEUP_EVENT (1 << 15) | ||
43 | |||
40 | /* Active pin states */ | 44 | /* Active pin states */ |
41 | #define OMAP_PIN_OUTPUT 0 | 45 | #define OMAP_PIN_OUTPUT 0 |
42 | #define OMAP_PIN_INPUT OMAP_INPUT_EN | 46 | #define OMAP_PIN_INPUT OMAP_INPUT_EN |
@@ -56,8 +60,10 @@ | |||
56 | 60 | ||
57 | #define OMAP_MODE_GPIO(x) (((x) & OMAP_MUX_MODE7) == OMAP_MUX_MODE4) | 61 | #define OMAP_MODE_GPIO(x) (((x) & OMAP_MUX_MODE7) == OMAP_MUX_MODE4) |
58 | 62 | ||
59 | /* Flags for omap_mux_init */ | 63 | /* Flags for omapX_mux_init */ |
60 | #define OMAP_PACKAGE_MASK 0xffff | 64 | #define OMAP_PACKAGE_MASK 0xffff |
65 | #define OMAP_PACKAGE_CBS 8 /* 547-pin 0.40 0.40 */ | ||
66 | #define OMAP_PACKAGE_CBL 7 /* 547-pin 0.40 0.40 */ | ||
61 | #define OMAP_PACKAGE_CBP 6 /* 515-pin 0.40 0.50 */ | 67 | #define OMAP_PACKAGE_CBP 6 /* 515-pin 0.40 0.50 */ |
62 | #define OMAP_PACKAGE_CUS 5 /* 423-pin 0.65 */ | 68 | #define OMAP_PACKAGE_CUS 5 /* 423-pin 0.65 */ |
63 | #define OMAP_PACKAGE_CBB 4 /* 515-pin 0.40 0.50 */ | 69 | #define OMAP_PACKAGE_CBB 4 /* 515-pin 0.40 0.50 */ |
@@ -66,14 +72,61 @@ | |||
66 | #define OMAP_PACKAGE_ZAF 1 /* 2420 447-pin SIP */ | 72 | #define OMAP_PACKAGE_ZAF 1 /* 2420 447-pin SIP */ |
67 | 73 | ||
68 | 74 | ||
69 | #define OMAP_MUX_NR_MODES 8 /* Available modes */ | 75 | #define OMAP_MUX_NR_MODES 8 /* Available modes */ |
70 | #define OMAP_MUX_NR_SIDES 2 /* Bottom & top */ | 76 | #define OMAP_MUX_NR_SIDES 2 /* Bottom & top */ |
77 | |||
78 | /* | ||
79 | * omap_mux_init flags definition: | ||
80 | * | ||
81 | * OMAP_MUX_REG_8BIT: Ensure that access to padconf is done in 8 bits. | ||
82 | * The default value is 16 bits. | ||
83 | * OMAP_MUX_GPIO_IN_MODE3: The GPIO is selected in mode3. | ||
84 | * The default is mode4. | ||
85 | */ | ||
86 | #define OMAP_MUX_REG_8BIT (1 << 0) | ||
87 | #define OMAP_MUX_GPIO_IN_MODE3 (1 << 1) | ||
88 | |||
89 | /** | ||
90 | * struct omap_board_data - board specific device data | ||
91 | * @id: instance id | ||
92 | * @flags: additional flags for platform init code | ||
93 | * @pads: array of device specific pads | ||
94 | * @pads_cnt: ARRAY_SIZE() of pads | ||
95 | */ | ||
96 | struct omap_board_data { | ||
97 | int id; | ||
98 | u32 flags; | ||
99 | struct omap_device_pad *pads; | ||
100 | int pads_cnt; | ||
101 | }; | ||
102 | |||
103 | /** | ||
104 | * struct mux_partition - contain partition related information | ||
105 | * @name: name of the current partition | ||
106 | * @flags: flags specific to this partition | ||
107 | * @phys: physical address | ||
108 | * @size: partition size | ||
109 | * @base: virtual address after ioremap | ||
110 | * @muxmodes: list of nodes that belong to a partition | ||
111 | * @node: list node for the partitions linked list | ||
112 | */ | ||
113 | struct omap_mux_partition { | ||
114 | const char *name; | ||
115 | u32 flags; | ||
116 | u32 phys; | ||
117 | u32 size; | ||
118 | void __iomem *base; | ||
119 | struct list_head muxmodes; | ||
120 | struct list_head node; | ||
121 | }; | ||
71 | 122 | ||
72 | /** | 123 | /** |
73 | * struct omap_mux - data for omap mux register offset and it's value | 124 | * struct omap_mux - data for omap mux register offset and it's value |
74 | * @reg_offset: mux register offset from the mux base | 125 | * @reg_offset: mux register offset from the mux base |
75 | * @gpio: GPIO number | 126 | * @gpio: GPIO number |
76 | * @muxnames: available signal modes for a ball | 127 | * @muxnames: available signal modes for a ball |
128 | * @balls: available balls on the package | ||
129 | * @partition: mux partition | ||
77 | */ | 130 | */ |
78 | struct omap_mux { | 131 | struct omap_mux { |
79 | u16 reg_offset; | 132 | u16 reg_offset; |
@@ -106,6 +159,39 @@ struct omap_board_mux { | |||
106 | u16 value; | 159 | u16 value; |
107 | }; | 160 | }; |
108 | 161 | ||
162 | #define OMAP_DEVICE_PAD_REMUX BIT(1) /* Dynamically remux a pad, | ||
163 | needs enable, idle and off | ||
164 | values */ | ||
165 | #define OMAP_DEVICE_PAD_WAKEUP BIT(0) /* Pad is wake-up capable */ | ||
166 | |||
167 | /** | ||
168 | * struct omap_device_pad - device specific pad configuration | ||
169 | * @name: signal name | ||
170 | * @flags: pad specific runtime flags | ||
171 | * @enable: runtime value for a pad | ||
172 | * @idle: idle value for a pad | ||
173 | * @off: off value for a pad, defaults to safe mode | ||
174 | * @partition: mux partition | ||
175 | * @mux: mux register | ||
176 | */ | ||
177 | struct omap_device_pad { | ||
178 | char *name; | ||
179 | u8 flags; | ||
180 | u16 enable; | ||
181 | u16 idle; | ||
182 | u16 off; | ||
183 | struct omap_mux_partition *partition; | ||
184 | struct omap_mux *mux; | ||
185 | }; | ||
186 | |||
187 | struct omap_hwmod_mux_info; | ||
188 | |||
189 | #define OMAP_MUX_STATIC(signal, mode) \ | ||
190 | { \ | ||
191 | .name = (signal), \ | ||
192 | .enable = (mode), \ | ||
193 | } | ||
194 | |||
109 | #if defined(CONFIG_OMAP_MUX) | 195 | #if defined(CONFIG_OMAP_MUX) |
110 | 196 | ||
111 | /** | 197 | /** |
@@ -120,7 +206,24 @@ int omap_mux_init_gpio(int gpio, int val); | |||
120 | * @muxname: Mux name in mode0_name.signal_name format | 206 | * @muxname: Mux name in mode0_name.signal_name format |
121 | * @val: Options for the mux register value | 207 | * @val: Options for the mux register value |
122 | */ | 208 | */ |
123 | int omap_mux_init_signal(char *muxname, int val); | 209 | int omap_mux_init_signal(const char *muxname, int val); |
210 | |||
211 | /** | ||
212 | * omap_hwmod_mux_init - initialize hwmod specific mux data | ||
213 | * @bpads: Board specific device signal names | ||
214 | * @nr_pads: Number of signal names for the device | ||
215 | */ | ||
216 | extern struct omap_hwmod_mux_info * | ||
217 | omap_hwmod_mux_init(struct omap_device_pad *bpads, int nr_pads); | ||
218 | |||
219 | /** | ||
220 | * omap_hwmod_mux - omap hwmod specific pin muxing | ||
221 | * @hmux: Pads for a hwmod | ||
222 | * @state: Desired _HWMOD_STATE | ||
223 | * | ||
224 | * Called only from omap_hwmod.c, do not use. | ||
225 | */ | ||
226 | void omap_hwmod_mux(struct omap_hwmod_mux_info *hmux, u8 state); | ||
124 | 227 | ||
125 | #else | 228 | #else |
126 | 229 | ||
@@ -133,6 +236,18 @@ static inline int omap_mux_init_signal(char *muxname, int val) | |||
133 | return 0; | 236 | return 0; |
134 | } | 237 | } |
135 | 238 | ||
239 | static inline struct omap_hwmod_mux_info * | ||
240 | omap_hwmod_mux_init(struct omap_device_pad *bpads, int nr_pads) | ||
241 | { | ||
242 | return NULL; | ||
243 | } | ||
244 | |||
245 | static inline void omap_hwmod_mux(struct omap_hwmod_mux_info *hmux, u8 state) | ||
246 | { | ||
247 | } | ||
248 | |||
249 | static struct omap_board_mux *board_mux __initdata __maybe_unused; | ||
250 | |||
136 | #endif | 251 | #endif |
137 | 252 | ||
138 | /** | 253 | /** |
@@ -151,28 +266,39 @@ u16 omap_mux_get_gpio(int gpio); | |||
151 | void omap_mux_set_gpio(u16 val, int gpio); | 266 | void omap_mux_set_gpio(u16 val, int gpio); |
152 | 267 | ||
153 | /** | 268 | /** |
269 | * omap_mux_get() - get a mux partition by name | ||
270 | * @name: Name of the mux partition | ||
271 | * | ||
272 | */ | ||
273 | struct omap_mux_partition *omap_mux_get(const char *name); | ||
274 | |||
275 | /** | ||
154 | * omap_mux_read() - read mux register | 276 | * omap_mux_read() - read mux register |
277 | * @partition: Mux partition | ||
155 | * @mux_offset: Offset of the mux register | 278 | * @mux_offset: Offset of the mux register |
156 | * | 279 | * |
157 | */ | 280 | */ |
158 | u16 omap_mux_read(u16 mux_offset); | 281 | u16 omap_mux_read(struct omap_mux_partition *p, u16 mux_offset); |
159 | 282 | ||
160 | /** | 283 | /** |
161 | * omap_mux_write() - write mux register | 284 | * omap_mux_write() - write mux register |
285 | * @partition: Mux partition | ||
162 | * @val: New mux register value | 286 | * @val: New mux register value |
163 | * @mux_offset: Offset of the mux register | 287 | * @mux_offset: Offset of the mux register |
164 | * | 288 | * |
165 | * This should be only needed for dynamic remuxing of non-gpio signals. | 289 | * This should be only needed for dynamic remuxing of non-gpio signals. |
166 | */ | 290 | */ |
167 | void omap_mux_write(u16 val, u16 mux_offset); | 291 | void omap_mux_write(struct omap_mux_partition *p, u16 val, u16 mux_offset); |
168 | 292 | ||
169 | /** | 293 | /** |
170 | * omap_mux_write_array() - write an array of mux registers | 294 | * omap_mux_write_array() - write an array of mux registers |
295 | * @partition: Mux partition | ||
171 | * @board_mux: Array of mux registers terminated by MAP_MUX_TERMINATOR | 296 | * @board_mux: Array of mux registers terminated by MAP_MUX_TERMINATOR |
172 | * | 297 | * |
173 | * This should be only needed for dynamic remuxing of non-gpio signals. | 298 | * This should be only needed for dynamic remuxing of non-gpio signals. |
174 | */ | 299 | */ |
175 | void omap_mux_write_array(struct omap_board_mux *board_mux); | 300 | void omap_mux_write_array(struct omap_mux_partition *p, |
301 | struct omap_board_mux *board_mux); | ||
176 | 302 | ||
177 | /** | 303 | /** |
178 | * omap2420_mux_init() - initialize mux system with board specific set | 304 | * omap2420_mux_init() - initialize mux system with board specific set |
@@ -196,10 +322,21 @@ int omap2430_mux_init(struct omap_board_mux *board_mux, int flags); | |||
196 | int omap3_mux_init(struct omap_board_mux *board_mux, int flags); | 322 | int omap3_mux_init(struct omap_board_mux *board_mux, int flags); |
197 | 323 | ||
198 | /** | 324 | /** |
325 | * omap4_mux_init() - initialize mux system with board specific set | ||
326 | * @board_subset: Board specific mux table | ||
327 | * @board_wkup_subset: Board specific mux table for wakeup instance | ||
328 | * @flags: OMAP package type used for the board | ||
329 | */ | ||
330 | int omap4_mux_init(struct omap_board_mux *board_subset, | ||
331 | struct omap_board_mux *board_wkup_subset, int flags); | ||
332 | |||
333 | /** | ||
199 | * omap_mux_init - private mux init function, do not call | 334 | * omap_mux_init - private mux init function, do not call |
200 | */ | 335 | */ |
201 | int omap_mux_init(u32 mux_pbase, u32 mux_size, | 336 | int omap_mux_init(const char *name, u32 flags, |
202 | struct omap_mux *superset, | 337 | u32 mux_pbase, u32 mux_size, |
203 | struct omap_mux *package_subset, | 338 | struct omap_mux *superset, |
204 | struct omap_board_mux *board_mux, | 339 | struct omap_mux *package_subset, |
205 | struct omap_ball *package_balls); | 340 | struct omap_board_mux *board_mux, |
341 | struct omap_ball *package_balls); | ||
342 | |||