diff options
Diffstat (limited to 'arch/arm/mach-omap2/mux.h')
-rw-r--r-- | arch/arm/mach-omap2/mux.h | 70 |
1 files changed, 58 insertions, 12 deletions
diff --git a/arch/arm/mach-omap2/mux.h b/arch/arm/mach-omap2/mux.h index 350c04f27383..86549bedd526 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 |
@@ -56,7 +56,7 @@ | |||
56 | 56 | ||
57 | #define OMAP_MODE_GPIO(x) (((x) & OMAP_MUX_MODE7) == OMAP_MUX_MODE4) | 57 | #define OMAP_MODE_GPIO(x) (((x) & OMAP_MUX_MODE7) == OMAP_MUX_MODE4) |
58 | 58 | ||
59 | /* Flags for omap_mux_init */ | 59 | /* Flags for omapX_mux_init */ |
60 | #define OMAP_PACKAGE_MASK 0xffff | 60 | #define OMAP_PACKAGE_MASK 0xffff |
61 | #define OMAP_PACKAGE_CBP 6 /* 515-pin 0.40 0.50 */ | 61 | #define OMAP_PACKAGE_CBP 6 /* 515-pin 0.40 0.50 */ |
62 | #define OMAP_PACKAGE_CUS 5 /* 423-pin 0.65 */ | 62 | #define OMAP_PACKAGE_CUS 5 /* 423-pin 0.65 */ |
@@ -66,14 +66,47 @@ | |||
66 | #define OMAP_PACKAGE_ZAF 1 /* 2420 447-pin SIP */ | 66 | #define OMAP_PACKAGE_ZAF 1 /* 2420 447-pin SIP */ |
67 | 67 | ||
68 | 68 | ||
69 | #define OMAP_MUX_NR_MODES 8 /* Available modes */ | 69 | #define OMAP_MUX_NR_MODES 8 /* Available modes */ |
70 | #define OMAP_MUX_NR_SIDES 2 /* Bottom & top */ | 70 | #define OMAP_MUX_NR_SIDES 2 /* Bottom & top */ |
71 | |||
72 | /* | ||
73 | * omap_mux_init flags definition: | ||
74 | * | ||
75 | * OMAP_MUX_REG_8BIT: Ensure that access to padconf is done in 8 bits. | ||
76 | * The default value is 16 bits. | ||
77 | * OMAP_MUX_GPIO_IN_MODE3: The GPIO is selected in mode3. | ||
78 | * The default is mode4. | ||
79 | */ | ||
80 | #define OMAP_MUX_REG_8BIT (1 << 0) | ||
81 | #define OMAP_MUX_GPIO_IN_MODE3 (1 << 1) | ||
82 | |||
83 | /** | ||
84 | * struct mux_partition - contain partition related information | ||
85 | * @name: name of the current partition | ||
86 | * @flags: flags specific to this partition | ||
87 | * @phys: physical address | ||
88 | * @size: partition size | ||
89 | * @base: virtual address after ioremap | ||
90 | * @muxmodes: list of nodes that belong to a partition | ||
91 | * @node: list node for the partitions linked list | ||
92 | */ | ||
93 | struct omap_mux_partition { | ||
94 | const char *name; | ||
95 | u32 flags; | ||
96 | u32 phys; | ||
97 | u32 size; | ||
98 | void __iomem *base; | ||
99 | struct list_head muxmodes; | ||
100 | struct list_head node; | ||
101 | }; | ||
71 | 102 | ||
72 | /** | 103 | /** |
73 | * struct omap_mux - data for omap mux register offset and it's value | 104 | * struct omap_mux - data for omap mux register offset and it's value |
74 | * @reg_offset: mux register offset from the mux base | 105 | * @reg_offset: mux register offset from the mux base |
75 | * @gpio: GPIO number | 106 | * @gpio: GPIO number |
76 | * @muxnames: available signal modes for a ball | 107 | * @muxnames: available signal modes for a ball |
108 | * @balls: available balls on the package | ||
109 | * @partition: mux partition | ||
77 | */ | 110 | */ |
78 | struct omap_mux { | 111 | struct omap_mux { |
79 | u16 reg_offset; | 112 | u16 reg_offset; |
@@ -151,28 +184,39 @@ u16 omap_mux_get_gpio(int gpio); | |||
151 | void omap_mux_set_gpio(u16 val, int gpio); | 184 | void omap_mux_set_gpio(u16 val, int gpio); |
152 | 185 | ||
153 | /** | 186 | /** |
187 | * omap_mux_get() - get a mux partition by name | ||
188 | * @name: Name of the mux partition | ||
189 | * | ||
190 | */ | ||
191 | struct omap_mux_partition *omap_mux_get(const char *name); | ||
192 | |||
193 | /** | ||
154 | * omap_mux_read() - read mux register | 194 | * omap_mux_read() - read mux register |
195 | * @partition: Mux partition | ||
155 | * @mux_offset: Offset of the mux register | 196 | * @mux_offset: Offset of the mux register |
156 | * | 197 | * |
157 | */ | 198 | */ |
158 | u16 omap_mux_read(u16 mux_offset); | 199 | u16 omap_mux_read(struct omap_mux_partition *p, u16 mux_offset); |
159 | 200 | ||
160 | /** | 201 | /** |
161 | * omap_mux_write() - write mux register | 202 | * omap_mux_write() - write mux register |
203 | * @partition: Mux partition | ||
162 | * @val: New mux register value | 204 | * @val: New mux register value |
163 | * @mux_offset: Offset of the mux register | 205 | * @mux_offset: Offset of the mux register |
164 | * | 206 | * |
165 | * This should be only needed for dynamic remuxing of non-gpio signals. | 207 | * This should be only needed for dynamic remuxing of non-gpio signals. |
166 | */ | 208 | */ |
167 | void omap_mux_write(u16 val, u16 mux_offset); | 209 | void omap_mux_write(struct omap_mux_partition *p, u16 val, u16 mux_offset); |
168 | 210 | ||
169 | /** | 211 | /** |
170 | * omap_mux_write_array() - write an array of mux registers | 212 | * omap_mux_write_array() - write an array of mux registers |
213 | * @partition: Mux partition | ||
171 | * @board_mux: Array of mux registers terminated by MAP_MUX_TERMINATOR | 214 | * @board_mux: Array of mux registers terminated by MAP_MUX_TERMINATOR |
172 | * | 215 | * |
173 | * This should be only needed for dynamic remuxing of non-gpio signals. | 216 | * This should be only needed for dynamic remuxing of non-gpio signals. |
174 | */ | 217 | */ |
175 | void omap_mux_write_array(struct omap_board_mux *board_mux); | 218 | void omap_mux_write_array(struct omap_mux_partition *p, |
219 | struct omap_board_mux *board_mux); | ||
176 | 220 | ||
177 | /** | 221 | /** |
178 | * omap2420_mux_init() - initialize mux system with board specific set | 222 | * omap2420_mux_init() - initialize mux system with board specific set |
@@ -198,8 +242,10 @@ int omap3_mux_init(struct omap_board_mux *board_mux, int flags); | |||
198 | /** | 242 | /** |
199 | * omap_mux_init - private mux init function, do not call | 243 | * omap_mux_init - private mux init function, do not call |
200 | */ | 244 | */ |
201 | int omap_mux_init(u32 mux_pbase, u32 mux_size, | 245 | int omap_mux_init(const char *name, u32 flags, |
202 | struct omap_mux *superset, | 246 | u32 mux_pbase, u32 mux_size, |
203 | struct omap_mux *package_subset, | 247 | struct omap_mux *superset, |
204 | struct omap_board_mux *board_mux, | 248 | struct omap_mux *package_subset, |
205 | struct omap_ball *package_balls); | 249 | struct omap_board_mux *board_mux, |
250 | struct omap_ball *package_balls); | ||
251 | |||