aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorR Sricharan <r.sricharan@ti.com>2011-03-11 14:32:25 -0500
committerTony Lindgren <tony@atomide.com>2011-03-11 14:32:25 -0500
commit86c79bf45f380c6efd907e95f993146b2b975232 (patch)
tree4dd547e30350bdbbe889efe85cc71df566dceec7
parent029268e4c124a38b11ae965849ea2dfef724a568 (diff)
omap2+: mux: Remove the use of IDLE flag
Currently OMAP_DEVICE_PAD_IDLE flag is used to mux pins dynamically. This can be simplified by using the enabled state variable of each pad. This also fixes the issue of the static pads not getting muxed after idling and disable/enable state transitions. Signed-off-by: sricharan <r.sricharan@ti.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
-rw-r--r--arch/arm/mach-omap2/mux.c19
-rw-r--r--arch/arm/mach-omap2/mux.h1
2 files changed, 7 insertions, 13 deletions
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
index 8717370c91b1..bb043cbb3886 100644
--- a/arch/arm/mach-omap2/mux.c
+++ b/arch/arm/mach-omap2/mux.c
@@ -359,7 +359,6 @@ void omap_hwmod_mux(struct omap_hwmod_mux_info *hmux, u8 state)
359 struct omap_device_pad *pad = hmux->pads_dynamic[i]; 359 struct omap_device_pad *pad = hmux->pads_dynamic[i];
360 int val = -EINVAL; 360 int val = -EINVAL;
361 361
362 pad->flags |= OMAP_DEVICE_PAD_IDLE;
363 val = pad->idle; 362 val = pad->idle;
364 omap_mux_write(pad->partition, val, 363 omap_mux_write(pad->partition, val,
365 pad->mux->reg_offset); 364 pad->mux->reg_offset);
@@ -369,25 +368,18 @@ void omap_hwmod_mux(struct omap_hwmod_mux_info *hmux, u8 state)
369 } 368 }
370 369
371 /* Runtime enabling of dynamic pads */ 370 /* Runtime enabling of dynamic pads */
372 if ((state == _HWMOD_STATE_ENABLED) && hmux->pads_dynamic) { 371 if ((state == _HWMOD_STATE_ENABLED) && hmux->pads_dynamic
373 int idled = 0; 372 && hmux->enabled) {
374
375 for (i = 0; i < hmux->nr_pads_dynamic; i++) { 373 for (i = 0; i < hmux->nr_pads_dynamic; i++) {
376 struct omap_device_pad *pad = hmux->pads_dynamic[i]; 374 struct omap_device_pad *pad = hmux->pads_dynamic[i];
377 int val = -EINVAL; 375 int val = -EINVAL;
378 376
379 if (!(pad->flags & OMAP_DEVICE_PAD_IDLE))
380 continue;
381
382 pad->flags &= ~OMAP_DEVICE_PAD_IDLE;
383 val = pad->enable; 377 val = pad->enable;
384 omap_mux_write(pad->partition, val, 378 omap_mux_write(pad->partition, val,
385 pad->mux->reg_offset); 379 pad->mux->reg_offset);
386 idled++;
387 } 380 }
388 381
389 if (idled) 382 return;
390 return;
391 } 383 }
392 384
393 /* Enabling or disabling of all pads */ 385 /* Enabling or disabling of all pads */
@@ -404,7 +396,6 @@ void omap_hwmod_mux(struct omap_hwmod_mux_info *hmux, u8 state)
404 pad->name, val); 396 pad->name, val);
405 break; 397 break;
406 case _HWMOD_STATE_DISABLED: 398 case _HWMOD_STATE_DISABLED:
407 default:
408 /* Use safe mode unless OMAP_DEVICE_PAD_REMUX */ 399 /* Use safe mode unless OMAP_DEVICE_PAD_REMUX */
409 if (flags & OMAP_DEVICE_PAD_REMUX) 400 if (flags & OMAP_DEVICE_PAD_REMUX)
410 val = pad->off; 401 val = pad->off;
@@ -412,6 +403,10 @@ void omap_hwmod_mux(struct omap_hwmod_mux_info *hmux, u8 state)
412 val = OMAP_MUX_MODE7; 403 val = OMAP_MUX_MODE7;
413 pr_debug("%s: Disabling %s %x\n", __func__, 404 pr_debug("%s: Disabling %s %x\n", __func__,
414 pad->name, val); 405 pad->name, val);
406 break;
407 default:
408 /* Nothing to be done */
409 break;
415 }; 410 };
416 411
417 if (val >= 0) { 412 if (val >= 0) {
diff --git a/arch/arm/mach-omap2/mux.h b/arch/arm/mach-omap2/mux.h
index 1d5bf4298c6f..8920fa4775ac 100644
--- a/arch/arm/mach-omap2/mux.h
+++ b/arch/arm/mach-omap2/mux.h
@@ -159,7 +159,6 @@ struct omap_board_mux {
159 u16 value; 159 u16 value;
160}; 160};
161 161
162#define OMAP_DEVICE_PAD_IDLE BIT(7) /* Not needed for board-*.c */
163#define OMAP_DEVICE_PAD_REMUX BIT(1) /* Dynamically remux a pad, 162#define OMAP_DEVICE_PAD_REMUX BIT(1) /* Dynamically remux a pad,
164 needs enable, idle and off 163 needs enable, idle and off
165 values */ 164 values */