aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/mux.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap2/mux.h')
-rw-r--r--arch/arm/mach-omap2/mux.h154
1 files changed, 142 insertions, 12 deletions
diff --git a/arch/arm/mach-omap2/mux.h b/arch/arm/mach-omap2/mux.h
index 350c04f27383..a4ab17a737a6 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 */
96struct 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 */
113struct 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 */
78struct omap_mux { 131struct omap_mux {
79 u16 reg_offset; 132 u16 reg_offset;
@@ -106,6 +159,34 @@ struct omap_board_mux {
106 u16 value; 159 u16 value;
107}; 160};
108 161
162#define OMAP_DEVICE_PAD_ENABLED BIT(7) /* Not needed for board-*.c */
163#define OMAP_DEVICE_PAD_REMUX BIT(1) /* Dynamically remux a pad,
164 needs enable, idle and off
165 values */
166#define OMAP_DEVICE_PAD_WAKEUP BIT(0) /* Pad is wake-up capable */
167
168/**
169 * struct omap_device_pad - device specific pad configuration
170 * @name: signal name
171 * @flags: pad specific runtime flags
172 * @enable: runtime value for a pad
173 * @idle: idle value for a pad
174 * @off: off value for a pad, defaults to safe mode
175 * @partition: mux partition
176 * @mux: mux register
177 */
178struct omap_device_pad {
179 char *name;
180 u8 flags;
181 u16 enable;
182 u16 idle;
183 u16 off;
184 struct omap_mux_partition *partition;
185 struct omap_mux *mux;
186};
187
188struct omap_hwmod_mux_info;
189
109#if defined(CONFIG_OMAP_MUX) 190#if defined(CONFIG_OMAP_MUX)
110 191
111/** 192/**
@@ -122,6 +203,23 @@ int omap_mux_init_gpio(int gpio, int val);
122 */ 203 */
123int omap_mux_init_signal(const char *muxname, int val); 204int omap_mux_init_signal(const char *muxname, int val);
124 205
206/**
207 * omap_hwmod_mux_init - initialize hwmod specific mux data
208 * @bpads: Board specific device signal names
209 * @nr_pads: Number of signal names for the device
210 */
211extern struct omap_hwmod_mux_info *
212omap_hwmod_mux_init(struct omap_device_pad *bpads, int nr_pads);
213
214/**
215 * omap_hwmod_mux - omap hwmod specific pin muxing
216 * @hmux: Pads for a hwmod
217 * @state: Desired _HWMOD_STATE
218 *
219 * Called only from omap_hwmod.c, do not use.
220 */
221void omap_hwmod_mux(struct omap_hwmod_mux_info *hmux, u8 state);
222
125#else 223#else
126 224
127static inline int omap_mux_init_gpio(int gpio, int val) 225static inline int omap_mux_init_gpio(int gpio, int val)
@@ -133,6 +231,18 @@ static inline int omap_mux_init_signal(char *muxname, int val)
133 return 0; 231 return 0;
134} 232}
135 233
234static inline struct omap_hwmod_mux_info *
235omap_hwmod_mux_init(struct omap_device_pad *bpads, int nr_pads)
236{
237 return NULL;
238}
239
240static inline void omap_hwmod_mux(struct omap_hwmod_mux_info *hmux, u8 state)
241{
242}
243
244static struct omap_board_mux *board_mux __initdata __maybe_unused;
245
136#endif 246#endif
137 247
138/** 248/**
@@ -151,28 +261,39 @@ u16 omap_mux_get_gpio(int gpio);
151void omap_mux_set_gpio(u16 val, int gpio); 261void omap_mux_set_gpio(u16 val, int gpio);
152 262
153/** 263/**
264 * omap_mux_get() - get a mux partition by name
265 * @name: Name of the mux partition
266 *
267 */
268struct omap_mux_partition *omap_mux_get(const char *name);
269
270/**
154 * omap_mux_read() - read mux register 271 * omap_mux_read() - read mux register
272 * @partition: Mux partition
155 * @mux_offset: Offset of the mux register 273 * @mux_offset: Offset of the mux register
156 * 274 *
157 */ 275 */
158u16 omap_mux_read(u16 mux_offset); 276u16 omap_mux_read(struct omap_mux_partition *p, u16 mux_offset);
159 277
160/** 278/**
161 * omap_mux_write() - write mux register 279 * omap_mux_write() - write mux register
280 * @partition: Mux partition
162 * @val: New mux register value 281 * @val: New mux register value
163 * @mux_offset: Offset of the mux register 282 * @mux_offset: Offset of the mux register
164 * 283 *
165 * This should be only needed for dynamic remuxing of non-gpio signals. 284 * This should be only needed for dynamic remuxing of non-gpio signals.
166 */ 285 */
167void omap_mux_write(u16 val, u16 mux_offset); 286void omap_mux_write(struct omap_mux_partition *p, u16 val, u16 mux_offset);
168 287
169/** 288/**
170 * omap_mux_write_array() - write an array of mux registers 289 * omap_mux_write_array() - write an array of mux registers
290 * @partition: Mux partition
171 * @board_mux: Array of mux registers terminated by MAP_MUX_TERMINATOR 291 * @board_mux: Array of mux registers terminated by MAP_MUX_TERMINATOR
172 * 292 *
173 * This should be only needed for dynamic remuxing of non-gpio signals. 293 * This should be only needed for dynamic remuxing of non-gpio signals.
174 */ 294 */
175void omap_mux_write_array(struct omap_board_mux *board_mux); 295void omap_mux_write_array(struct omap_mux_partition *p,
296 struct omap_board_mux *board_mux);
176 297
177/** 298/**
178 * omap2420_mux_init() - initialize mux system with board specific set 299 * omap2420_mux_init() - initialize mux system with board specific set
@@ -196,10 +317,19 @@ int omap2430_mux_init(struct omap_board_mux *board_mux, int flags);
196int omap3_mux_init(struct omap_board_mux *board_mux, int flags); 317int omap3_mux_init(struct omap_board_mux *board_mux, int flags);
197 318
198/** 319/**
320 * omap4_mux_init() - initialize mux system with board specific set
321 * @board_mux: Board specific mux table
322 * @flags: OMAP package type used for the board
323 */
324int omap4_mux_init(struct omap_board_mux *board_mux, int flags);
325
326/**
199 * omap_mux_init - private mux init function, do not call 327 * omap_mux_init - private mux init function, do not call
200 */ 328 */
201int omap_mux_init(u32 mux_pbase, u32 mux_size, 329int omap_mux_init(const char *name, u32 flags,
202 struct omap_mux *superset, 330 u32 mux_pbase, u32 mux_size,
203 struct omap_mux *package_subset, 331 struct omap_mux *superset,
204 struct omap_board_mux *board_mux, 332 struct omap_mux *package_subset,
205 struct omap_ball *package_balls); 333 struct omap_board_mux *board_mux,
334 struct omap_ball *package_balls);
335