aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-omap2/mux.c39
-rw-r--r--arch/arm/mach-omap2/mux.h17
2 files changed, 54 insertions, 2 deletions
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
index 6fb9324..2b1c799 100644
--- a/arch/arm/mach-omap2/mux.c
+++ b/arch/arm/mach-omap2/mux.c
@@ -156,7 +156,7 @@ int __init omap_mux_init_gpio(int gpio, int val)
return -ENODEV;
}
-static int __init _omap_mux_get_by_name(struct omap_mux_partition *partition,
+static int _omap_mux_get_by_name(struct omap_mux_partition *partition,
const char *muxname,
struct omap_mux **found_mux)
{
@@ -213,7 +213,7 @@ static int __init _omap_mux_get_by_name(struct omap_mux_partition *partition,
return -ENODEV;
}
-static int __init
+static int
omap_mux_get_by_name(const char *muxname,
struct omap_mux_partition **found_partition,
struct omap_mux **found_mux)
@@ -253,6 +253,41 @@ int __init omap_mux_init_signal(const char *muxname, int val)
pr_debug("%s: Setting signal %s 0x%04x -> 0x%04x\n",
__func__, muxname, old_mode, mux_mode);
omap_mux_write(partition, mux_mode, mux->reg_offset);
+ return 0;
+}
+
+int omap_mux_enable_wkup(const char *muxname)
+{
+ struct omap_mux_partition *partition = NULL;
+ struct omap_mux *mux = NULL;
+ u16 old_mode;
+ int mux_mode;
+
+ mux_mode = omap_mux_get_by_name(muxname, &partition, &mux);
+ if (mux_mode < 0)
+ return mux_mode;
+ old_mode = omap_mux_read(partition, mux->reg_offset);
+ old_mode |= OMAP_WAKEUP_EN;
+ pr_debug("%s: Setting signal %s 0x%04x -> 0x%04x\n",
+ __func__, muxname, old_mode, mux_mode);
+ omap_mux_write(partition, old_mode, mux->reg_offset);
+ return 0;
+}
+
+int omap_mux_disable_wkup(const char *muxname)
+{
+ struct omap_mux_partition *partition = NULL;
+ struct omap_mux *mux = NULL;
+ u16 old_mode;
+ int mux_mode;
+ mux_mode = omap_mux_get_by_name(muxname, &partition, &mux);
+ if (mux_mode < 0)
+ return mux_mode;
+ old_mode = omap_mux_read(partition, mux->reg_offset);
+ old_mode &= ~OMAP_WAKEUP_EN;
+ pr_debug("%s: Setting signal %s 0x%04x -> 0x%04x\n",
+ __func__, muxname, old_mode, mux_mode);
+ omap_mux_write(partition, old_mode, mux->reg_offset);
return 0;
}
diff --git a/arch/arm/mach-omap2/mux.h b/arch/arm/mach-omap2/mux.h
index 25aab87..2959c0f 100644
--- a/arch/arm/mach-omap2/mux.h
+++ b/arch/arm/mach-omap2/mux.h
@@ -210,6 +210,13 @@ int omap_mux_init_gpio(int gpio, int val);
int omap_mux_init_signal(const char *muxname, int val);
/**
+ * omap_mux_enable_wkup - set/clear the pad wakup bit.
+ * @muxname: Mux name in mode0_name.signal_name format
+ */
+int omap_mux_enable_wkup(const char *muxname);
+int omap_mux_disable_wkup(const char *muxname);
+
+/**
* omap_hwmod_mux_init - initialize hwmod specific mux data
* @bpads: Board specific device signal names
* @nr_pads: Number of signal names for the device
@@ -260,6 +267,16 @@ static inline void omap_hwmod_mux(struct omap_hwmod_mux_info *hmux, u8 state)
{
}
+static inline int omap_mux_enable_wkup(const char *muxname)
+{
+ return 0;
+}
+
+static inline int omap_mux_disable_wkup(const char *muxname)
+{
+ return 0;
+}
+
static struct omap_board_mux *board_mux __initdata __maybe_unused;
#endif