aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-omap2/mux.c48
-rw-r--r--arch/arm/mach-omap2/mux.h15
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c14
3 files changed, 74 insertions, 3 deletions
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
index 27eb51a224cb..17bd6394d224 100644
--- a/arch/arm/mach-omap2/mux.c
+++ b/arch/arm/mach-omap2/mux.c
@@ -317,6 +317,54 @@ err1:
317 return NULL; 317 return NULL;
318} 318}
319 319
320/* Assumes the calling function takes care of locking */
321void omap_hwmod_mux(struct omap_hwmod_mux_info *hmux, u8 state)
322{
323 int i;
324
325 for (i = 0; i < hmux->nr_pads; i++) {
326 struct omap_device_pad *pad = &hmux->pads[i];
327 int flags, val = -EINVAL;
328
329 flags = pad->flags;
330
331 switch (state) {
332 case _HWMOD_STATE_ENABLED:
333 if (flags & OMAP_DEVICE_PAD_ENABLED)
334 break;
335 flags |= OMAP_DEVICE_PAD_ENABLED;
336 val = pad->enable;
337 pr_debug("%s: Enabling %s %x\n", __func__,
338 pad->name, val);
339 break;
340 case _HWMOD_STATE_IDLE:
341 if (!(flags & OMAP_DEVICE_PAD_REMUX))
342 break;
343 flags &= ~OMAP_DEVICE_PAD_ENABLED;
344 val = pad->idle;
345 pr_debug("%s: Idling %s %x\n", __func__,
346 pad->name, val);
347 break;
348 case _HWMOD_STATE_DISABLED:
349 default:
350 /* Use safe mode unless OMAP_DEVICE_PAD_REMUX */
351 if (flags & OMAP_DEVICE_PAD_REMUX)
352 val = pad->off;
353 else
354 val = OMAP_MUX_MODE7;
355 flags &= ~OMAP_DEVICE_PAD_ENABLED;
356 pr_debug("%s: Disabling %s %x\n", __func__,
357 pad->name, val);
358 };
359
360 if (val >= 0) {
361 omap_mux_write(pad->partition, val,
362 pad->mux->reg_offset);
363 pad->flags = flags;
364 }
365 }
366}
367
320#ifdef CONFIG_DEBUG_FS 368#ifdef CONFIG_DEBUG_FS
321 369
322#define OMAP_MUX_MAX_NR_FLAGS 10 370#define OMAP_MUX_MAX_NR_FLAGS 10
diff --git a/arch/arm/mach-omap2/mux.h b/arch/arm/mach-omap2/mux.h
index 9c48b9d3ec29..c9ec50de99c9 100644
--- a/arch/arm/mach-omap2/mux.h
+++ b/arch/arm/mach-omap2/mux.h
@@ -171,6 +171,8 @@ struct omap_device_pad {
171 struct omap_mux *mux; 171 struct omap_mux *mux;
172}; 172};
173 173
174struct omap_hwmod_mux_info;
175
174#if defined(CONFIG_OMAP_MUX) 176#if defined(CONFIG_OMAP_MUX)
175 177
176/** 178/**
@@ -195,6 +197,15 @@ int omap_mux_init_signal(const char *muxname, int val);
195extern struct omap_hwmod_mux_info * 197extern struct omap_hwmod_mux_info *
196omap_hwmod_mux_init(struct omap_device_pad *bpads, int nr_pads); 198omap_hwmod_mux_init(struct omap_device_pad *bpads, int nr_pads);
197 199
200/**
201 * omap_hwmod_mux - omap hwmod specific pin muxing
202 * @hmux: Pads for a hwmod
203 * @state: Desired _HWMOD_STATE
204 *
205 * Called only from omap_hwmod.c, do not use.
206 */
207void omap_hwmod_mux(struct omap_hwmod_mux_info *hmux, u8 state);
208
198#else 209#else
199 210
200static inline int omap_mux_init_gpio(int gpio, int val) 211static inline int omap_mux_init_gpio(int gpio, int val)
@@ -212,6 +223,10 @@ omap_hwmod_mux_init(struct omap_device_pad *bpads, int nr_pads)
212 return NULL; 223 return NULL;
213} 224}
214 225
226static inline void omap_hwmod_mux(struct omap_hwmod_mux_info *hmux, u8 state)
227{
228}
229
215static struct omap_board_mux *board_mux __initdata __maybe_unused; 230static struct omap_board_mux *board_mux __initdata __maybe_unused;
216 231
217#endif 232#endif
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 77a8be64cfae..e282e35769fd 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -116,7 +116,6 @@
116 * - Open Core Protocol Specification 2.2 116 * - Open Core Protocol Specification 2.2
117 * 117 *
118 * To do: 118 * To do:
119 * - pin mux handling
120 * - handle IO mapping 119 * - handle IO mapping
121 * - bus throughput & module latency measurement code 120 * - bus throughput & module latency measurement code
122 * 121 *
@@ -149,6 +148,7 @@
149#include "cm44xx.h" 148#include "cm44xx.h"
150#include "prm2xxx_3xxx.h" 149#include "prm2xxx_3xxx.h"
151#include "prm44xx.h" 150#include "prm44xx.h"
151#include "mux.h"
152 152
153/* Maximum microseconds to wait for OMAP module to softreset */ 153/* Maximum microseconds to wait for OMAP module to softreset */
154#define MAX_MODULE_SOFTRESET_WAIT 10000 154#define MAX_MODULE_SOFTRESET_WAIT 10000
@@ -1229,7 +1229,9 @@ static int _enable(struct omap_hwmod *oh)
1229 oh->_state == _HWMOD_STATE_DISABLED) && oh->rst_lines_cnt == 1) 1229 oh->_state == _HWMOD_STATE_DISABLED) && oh->rst_lines_cnt == 1)
1230 _deassert_hardreset(oh, oh->rst_lines[0].name); 1230 _deassert_hardreset(oh, oh->rst_lines[0].name);
1231 1231
1232 /* XXX mux balls */ 1232 /* Mux pins for device runtime if populated */
1233 if (oh->mux)
1234 omap_hwmod_mux(oh->mux, _HWMOD_STATE_ENABLED);
1233 1235
1234 _add_initiator_dep(oh, mpu_oh); 1236 _add_initiator_dep(oh, mpu_oh);
1235 _enable_clocks(oh); 1237 _enable_clocks(oh);
@@ -1276,6 +1278,10 @@ static int _idle(struct omap_hwmod *oh)
1276 _del_initiator_dep(oh, mpu_oh); 1278 _del_initiator_dep(oh, mpu_oh);
1277 _disable_clocks(oh); 1279 _disable_clocks(oh);
1278 1280
1281 /* Mux pins for device idle if populated */
1282 if (oh->mux)
1283 omap_hwmod_mux(oh->mux, _HWMOD_STATE_IDLE);
1284
1279 oh->_state = _HWMOD_STATE_IDLE; 1285 oh->_state = _HWMOD_STATE_IDLE;
1280 1286
1281 return 0; 1287 return 0;
@@ -1334,7 +1340,9 @@ static int _shutdown(struct omap_hwmod *oh)
1334 } 1340 }
1335 /* XXX Should this code also force-disable the optional clocks? */ 1341 /* XXX Should this code also force-disable the optional clocks? */
1336 1342
1337 /* XXX mux any associated balls to safe mode */ 1343 /* Mux pins to safe mode or use populated off mode values */
1344 if (oh->mux)
1345 omap_hwmod_mux(oh->mux, _HWMOD_STATE_DISABLED);
1338 1346
1339 oh->_state = _HWMOD_STATE_DISABLED; 1347 oh->_state = _HWMOD_STATE_DISABLED;
1340 1348