aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/mux.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-03-17 22:28:15 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-03-17 22:28:15 -0400
commit0df0914d414a504b975f3cc66ace0c16ef55b7f3 (patch)
treec97ffa357943a8b226cdec1b9632c4cede813205 /arch/arm/mach-omap2/mux.c
parent6899608533410557e6698cb9d4ff6df553916e98 (diff)
parent05f689400ea5fa3d71af82f910c8b140f87ad1f3 (diff)
Merge branch 'omap-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6
* 'omap-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6: (258 commits) omap: zoom: host should not pull up wl1271's irq line arm: plat-omap: iommu: fix request_mem_region() error path OMAP2+: Common CPU DIE ID reading code reads wrong registers for OMAP4430 omap4: mux: Remove duplicate mux modes omap: iovmm: don't check 'da' to set IOVMF_DA_FIXED flag omap: iovmm: disallow mapping NULL address when IOVMF_DA_ANON is set omap2+: mux: Fix compile when CONFIG_OMAP_MUX is not selected omap4: board-omap4panda: Initialise the serial pads omap3: board-3430sdp: Initialise the serial pads omap4: board-4430sdp: Initialise the serial pads omap2+: mux: Add macro for configuring static with omap_hwmod_mux_init omap2+: mux: Remove the use of IDLE flag omap2+: Add separate list for dynamic pads to mux perf: add OMAP support for the new power events OMAP4: Add IVA OPP enteries. OMAP4: Update Voltage Rail Values for MPU, IVA and CORE OMAP4: Enable 800 MHz and 1 GHz MPU-OPP OMAP3+: OPP: Replace voltage values with Macros OMAP3: wdtimer: Fix CORE idle transition Watchdog: omap_wdt: add fine grain runtime-pm ... Fix up various conflicts in - arch/arm/mach-omap2/board-omap3evm.c - arch/arm/mach-omap2/clock3xxx_data.c - arch/arm/mach-omap2/usb-musb.c - arch/arm/plat-omap/include/plat/usb.h - drivers/usb/musb/musb_core.h
Diffstat (limited to 'arch/arm/mach-omap2/mux.c')
-rw-r--r--arch/arm/mach-omap2/mux.c85
1 files changed, 71 insertions, 14 deletions
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
index 6c84659cf846..bb043cbb3886 100644
--- a/arch/arm/mach-omap2/mux.c
+++ b/arch/arm/mach-omap2/mux.c
@@ -258,7 +258,7 @@ struct omap_hwmod_mux_info * __init
258omap_hwmod_mux_init(struct omap_device_pad *bpads, int nr_pads) 258omap_hwmod_mux_init(struct omap_device_pad *bpads, int nr_pads)
259{ 259{
260 struct omap_hwmod_mux_info *hmux; 260 struct omap_hwmod_mux_info *hmux;
261 int i; 261 int i, nr_pads_dynamic = 0;
262 262
263 if (!bpads || nr_pads < 1) 263 if (!bpads || nr_pads < 1)
264 return NULL; 264 return NULL;
@@ -302,9 +302,40 @@ omap_hwmod_mux_init(struct omap_device_pad *bpads, int nr_pads)
302 pad->enable = bpad->enable; 302 pad->enable = bpad->enable;
303 pad->idle = bpad->idle; 303 pad->idle = bpad->idle;
304 pad->off = bpad->off; 304 pad->off = bpad->off;
305
306 if (pad->flags & OMAP_DEVICE_PAD_REMUX)
307 nr_pads_dynamic++;
308
305 pr_debug("%s: Initialized %s\n", __func__, pad->name); 309 pr_debug("%s: Initialized %s\n", __func__, pad->name);
306 } 310 }
307 311
312 if (!nr_pads_dynamic)
313 return hmux;
314
315 /*
316 * Add pads that need dynamic muxing into a separate list
317 */
318
319 hmux->nr_pads_dynamic = nr_pads_dynamic;
320 hmux->pads_dynamic = kzalloc(sizeof(struct omap_device_pad *) *
321 nr_pads_dynamic, GFP_KERNEL);
322 if (!hmux->pads_dynamic) {
323 pr_err("%s: Could not allocate dynamic pads\n", __func__);
324 return hmux;
325 }
326
327 nr_pads_dynamic = 0;
328 for (i = 0; i < hmux->nr_pads; i++) {
329 struct omap_device_pad *pad = &hmux->pads[i];
330
331 if (pad->flags & OMAP_DEVICE_PAD_REMUX) {
332 pr_debug("%s: pad %s tagged dynamic\n",
333 __func__, pad->name);
334 hmux->pads_dynamic[nr_pads_dynamic] = pad;
335 nr_pads_dynamic++;
336 }
337 }
338
308 return hmux; 339 return hmux;
309 340
310err3: 341err3:
@@ -322,6 +353,36 @@ void omap_hwmod_mux(struct omap_hwmod_mux_info *hmux, u8 state)
322{ 353{
323 int i; 354 int i;
324 355
356 /* Runtime idling of dynamic pads */
357 if (state == _HWMOD_STATE_IDLE && hmux->enabled) {
358 for (i = 0; i < hmux->nr_pads_dynamic; i++) {
359 struct omap_device_pad *pad = hmux->pads_dynamic[i];
360 int val = -EINVAL;
361
362 val = pad->idle;
363 omap_mux_write(pad->partition, val,
364 pad->mux->reg_offset);
365 }
366
367 return;
368 }
369
370 /* Runtime enabling of dynamic pads */
371 if ((state == _HWMOD_STATE_ENABLED) && hmux->pads_dynamic
372 && hmux->enabled) {
373 for (i = 0; i < hmux->nr_pads_dynamic; i++) {
374 struct omap_device_pad *pad = hmux->pads_dynamic[i];
375 int val = -EINVAL;
376
377 val = pad->enable;
378 omap_mux_write(pad->partition, val,
379 pad->mux->reg_offset);
380 }
381
382 return;
383 }
384
385 /* Enabling or disabling of all pads */
325 for (i = 0; i < hmux->nr_pads; i++) { 386 for (i = 0; i < hmux->nr_pads; i++) {
326 struct omap_device_pad *pad = &hmux->pads[i]; 387 struct omap_device_pad *pad = &hmux->pads[i];
327 int flags, val = -EINVAL; 388 int flags, val = -EINVAL;
@@ -330,31 +391,22 @@ void omap_hwmod_mux(struct omap_hwmod_mux_info *hmux, u8 state)
330 391
331 switch (state) { 392 switch (state) {
332 case _HWMOD_STATE_ENABLED: 393 case _HWMOD_STATE_ENABLED:
333 if (flags & OMAP_DEVICE_PAD_ENABLED)
334 break;
335 flags |= OMAP_DEVICE_PAD_ENABLED;
336 val = pad->enable; 394 val = pad->enable;
337 pr_debug("%s: Enabling %s %x\n", __func__, 395 pr_debug("%s: Enabling %s %x\n", __func__,
338 pad->name, val); 396 pad->name, val);
339 break; 397 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: 398 case _HWMOD_STATE_DISABLED:
349 default:
350 /* Use safe mode unless OMAP_DEVICE_PAD_REMUX */ 399 /* Use safe mode unless OMAP_DEVICE_PAD_REMUX */
351 if (flags & OMAP_DEVICE_PAD_REMUX) 400 if (flags & OMAP_DEVICE_PAD_REMUX)
352 val = pad->off; 401 val = pad->off;
353 else 402 else
354 val = OMAP_MUX_MODE7; 403 val = OMAP_MUX_MODE7;
355 flags &= ~OMAP_DEVICE_PAD_ENABLED;
356 pr_debug("%s: Disabling %s %x\n", __func__, 404 pr_debug("%s: Disabling %s %x\n", __func__,
357 pad->name, val); 405 pad->name, val);
406 break;
407 default:
408 /* Nothing to be done */
409 break;
358 }; 410 };
359 411
360 if (val >= 0) { 412 if (val >= 0) {
@@ -363,6 +415,11 @@ void omap_hwmod_mux(struct omap_hwmod_mux_info *hmux, u8 state)
363 pad->flags = flags; 415 pad->flags = flags;
364 } 416 }
365 } 417 }
418
419 if (state == _HWMOD_STATE_ENABLED)
420 hmux->enabled = true;
421 else
422 hmux->enabled = false;
366} 423}
367 424
368#ifdef CONFIG_DEBUG_FS 425#ifdef CONFIG_DEBUG_FS