[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1309777713-17528-2-git-send-email-kishon@ti.com>
Date: Mon, 4 Jul 2011 16:38:32 +0530
From: Kishon Vijay Abraham I <kishon@...com>
To: <linux-omap@...r.kernel.org>, <linux-kernel@...r.kernel.org>
CC: paul@...an.com, b-cousson@...com, vishwanath.bs@...com,
p-basak2@...com, peter.ujfalusi@...com, jhnikula@...il.com,
kishon@...com, charu@...com
Subject: [PATCH v3 1/2] OMAP: omap_hwmod: API to modify AUTOIDLE and SMARTIDLE bits
Provide APIs to be used by the omap_device layer in order to modify AUTOIDLE
and SIDLE bits.
Signed-off-by: Kishon Vijay Abraham I <kishon@...com>
Signed-off-by: Benoit Cousson <b-cousson@...com>
Cc: Paul Walmsley <paul@...an.com>
---
arch/arm/mach-omap2/omap_hwmod.c | 93 ++++++++++++++++++++++++++
arch/arm/plat-omap/include/plat/omap_hwmod.h | 11 +++
2 files changed, 104 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index e034294..a1b13e8 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -1340,6 +1340,34 @@ int omap_hwmod_set_ocp_autoidle(struct omap_hwmod *oh, u8 autoidle)
}
/**
+ * omap_hwmod_enable_autoidle - set the hwmod's OCP autoidle bit
+ * @oh: struct omap_hwmod *
+ *
+ * Sets the IP block's OCP autoidle bit in hardware.
+ * Intended to be used by drivers that have some erratum that requires direct
+ * manipulation of the SIDLEMODE bits.
+ * Returns the return value from omap_hwmod_set_ocp_autoidle.
+ */
+int omap_hwmod_enable_autoidle(struct omap_hwmod *oh)
+{
+ return omap_hwmod_set_ocp_autoidle(oh, HWMOD_IDLEMODE_ENABLEAUTO);
+}
+
+/**
+ * omap_hwmod_disable_autoidle - reset the hwmod's OCP autoidle bit
+ * @oh: struct omap_hwmod *
+ *
+ * Resets the IP block's OCP autoidle bit in hardware.
+ * Intended to be used by drivers that have some erratum that requires direct
+ * manipulation of the SIDLEMODE bits.
+ * Returns the return value from omap_hwmod_set_ocp_autoidle.
+ */
+int omap_hwmod_disable_autoidle(struct omap_hwmod *oh)
+{
+ return omap_hwmod_set_ocp_autoidle(oh, HWMOD_IDLEMODE_DISABLEAUTO);
+}
+
+/**
* _shutdown - shutdown an omap_hwmod
* @oh: struct omap_hwmod *
*
@@ -1594,6 +1622,71 @@ int omap_hwmod_set_slave_idlemode(struct omap_hwmod *oh, u8 idlemode)
}
/**
+ * omap_hwmod_noidle - set the hwmod's slave idlemode to no idle
+ * @oh: struct omap_hwmod *
+ *
+ * Sets the IP block's OCP slave idlemode in hardware to no idle.
+ * Intended to be used by drivers that have some erratum that requires direct
+ * manipulation of the SIDLEMODE bits.
+ * Returns the return value from omap_hwmod_set_slave_idlemode().
+ */
+int omap_hwmod_noidle(struct omap_hwmod *oh)
+{
+ return omap_hwmod_set_slave_idlemode(oh, HWMOD_IDLEMODE_NO);
+}
+
+/**
+ * omap_hwmod_smartidle - set the hwmod's slave idlemode to smart idle
+ * @oh: struct omap_hwmod *
+ *
+ * Sets the IP block's OCP slave idlemode in hardware to smart idle.
+ * Intended to be used by drivers that have some erratum that requires direct
+ * manipulation of the SIDLEMODE bits.
+ * Returns the return value from omap_hwmod_set_slave_idlemode().
+ */
+int omap_hwmod_smartidle(struct omap_hwmod *oh)
+{
+ return omap_hwmod_set_slave_idlemode(oh, HWMOD_IDLEMODE_SMART);
+}
+
+/**
+ * omap_hwmod_forceidle - set the hwmod's slave idlemode to force idle
+ * @oh: struct omap_hwmod *
+ *
+ * Sets the IP block's OCP slave idlemode in hardware to force idle.
+ * Intended to be used by drivers that have some erratum that requires direct
+ * manipulation of the SIDLEMODE bits.
+ * Returns the return value from omap_hwmod_set_slave_idlemode().
+ */
+int omap_hwmod_forceidle(struct omap_hwmod *oh)
+{
+ return omap_hwmod_set_slave_idlemode(oh, HWMOD_IDLEMODE_FORCE);
+}
+
+/**
+ * omap_hwmod_default_idle - set the hwmod's slave idlemode to no idle or
+ * smart idle based on the hwmod flag
+ * @oh: struct omap_hwmod *
+ *
+ * Sets the IP block's OCP slave idlemode in hardware to no idle or smart idle
+ * based on the hwmod flag.
+ * Intended to be used by drivers that have some erratum that requires direct
+ * manipulation of the SIDLEMODE bits. Returns -EINVAL if @oh is NULL,
+ * or passes along the return value from omap_hwmod_set_slave_idlemode().
+ */
+int omap_hwmod_default_idle(struct omap_hwmod *oh)
+{
+ u8 idlemode;
+
+ if (!oh)
+ return -EINVAL;
+
+ idlemode = (oh->flags & HWMOD_SWSUP_SIDLE) ?
+ HWMOD_IDLEMODE_NO : HWMOD_IDLEMODE_SMART;
+ return omap_hwmod_set_slave_idlemode(oh, idlemode);
+}
+
+/**
* omap_hwmod_lookup - look up a registered omap_hwmod by name
* @name: name of the omap_hwmod to look up
*
diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/plat-omap/include/plat/omap_hwmod.h
index 1adea9c..166a866 100644
--- a/arch/arm/plat-omap/include/plat/omap_hwmod.h
+++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h
@@ -80,6 +80,9 @@ extern struct omap_hwmod_sysc_fields omap_hwmod_sysc_type2;
/* Slave idle mode flag only */
#define HWMOD_IDLEMODE_SMART_WKUP (1 << 3)
+#define HWMOD_IDLEMODE_ENABLEAUTO (1 << 0)
+#define HWMOD_IDLEMODE_DISABLEAUTO 0x0
+
/**
* struct omap_hwmod_mux_info - hwmod specific mux configuration
* @pads: array of omap_device_pad entries
@@ -567,6 +570,14 @@ int omap_hwmod_disable_clocks(struct omap_hwmod *oh);
int omap_hwmod_set_slave_idlemode(struct omap_hwmod *oh, u8 idlemode);
int omap_hwmod_set_ocp_autoidle(struct omap_hwmod *oh, u8 autoidle);
+int omap_hwmod_noidle(struct omap_hwmod *oh);
+int omap_hwmod_smartidle(struct omap_hwmod *oh);
+int omap_hwmod_forceidle(struct omap_hwmod *oh);
+int omap_hwmod_default_idle(struct omap_hwmod *oh);
+
+int omap_hwmod_enable_autoidle(struct omap_hwmod *oh);
+int omap_hwmod_disable_autoidle(struct omap_hwmod *oh);
+
int omap_hwmod_reset(struct omap_hwmod *oh);
void omap_hwmod_ocp_barrier(struct omap_hwmod *oh);
--
1.7.0.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists