* [PATCH v3 1/2] OMAP: omap_hwmod: API to modify AUTOIDLE and SMARTIDLE bits
2011-07-04 11:08 [PATCH v3 0/2] OMAP: omap_device: API to modify SYSCONFIG register Kishon Vijay Abraham I
@ 2011-07-04 11:08 ` Kishon Vijay Abraham I
2011-07-04 11:08 ` [PATCH v3 2/2] OMAP: omap_device: " Kishon Vijay Abraham I
2011-07-08 13:21 ` [PATCH v3 0/2] OMAP: omap_device: API to modify SYSCONFIG register ABRAHAM, KISHON VIJAY
2 siblings, 0 replies; 4+ messages in thread
From: Kishon Vijay Abraham I @ 2011-07-04 11:08 UTC (permalink / raw)
To: linux-omap, linux-kernel
Cc: paul, b-cousson, vishwanath.bs, p-basak2, peter.ujfalusi,
jhnikula, kishon, charu
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@ti.com>
Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Paul Walmsley <paul@pwsan.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
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH v3 2/2] OMAP: omap_device: API to modify AUTOIDLE and SMARTIDLE bits
2011-07-04 11:08 [PATCH v3 0/2] OMAP: omap_device: API to modify SYSCONFIG register Kishon Vijay Abraham I
2011-07-04 11:08 ` [PATCH v3 1/2] OMAP: omap_hwmod: API to modify AUTOIDLE and SMARTIDLE bits Kishon Vijay Abraham I
@ 2011-07-04 11:08 ` Kishon Vijay Abraham I
2011-07-08 13:21 ` [PATCH v3 0/2] OMAP: omap_device: API to modify SYSCONFIG register ABRAHAM, KISHON VIJAY
2 siblings, 0 replies; 4+ messages in thread
From: Kishon Vijay Abraham I @ 2011-07-04 11:08 UTC (permalink / raw)
To: linux-omap, linux-kernel
Cc: paul, b-cousson, vishwanath.bs, p-basak2, peter.ujfalusi,
jhnikula, kishon, charu
Provide APIs to be used by the driver in order to modify AUTOIDLE
and SIDLE bits. These APIs in turn call hwmod APIs to modify the
SYSCONFIG register.
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
---
arch/arm/plat-omap/include/plat/omap_device.h | 6 +
arch/arm/plat-omap/omap_device.c | 165 +++++++++++++++++++++++++
2 files changed, 171 insertions(+), 0 deletions(-)
diff --git a/arch/arm/plat-omap/include/plat/omap_device.h b/arch/arm/plat-omap/include/plat/omap_device.h
index e4c349f..47ad0ab 100644
--- a/arch/arm/plat-omap/include/plat/omap_device.h
+++ b/arch/arm/plat-omap/include/plat/omap_device.h
@@ -110,6 +110,12 @@ struct powerdomain *omap_device_get_pwrdm(struct omap_device *od);
u32 omap_device_get_context_loss_count(struct platform_device *pdev);
/* Other */
+int omap_device_noidle(struct omap_device *od);
+int omap_device_smartidle(struct omap_device *od);
+int omap_device_forceidle(struct omap_device *od);
+int omap_device_default_idle(struct omap_device *od);
+int omap_device_enable_autoidle(struct omap_device *od);
+int omap_device_disable_autoidle(struct omap_device *od);
int omap_device_idle_hwmods(struct omap_device *od);
int omap_device_enable_hwmods(struct omap_device *od);
diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c
index 9bbda9a..6df413d 100644
--- a/arch/arm/plat-omap/omap_device.c
+++ b/arch/arm/plat-omap/omap_device.c
@@ -742,6 +742,171 @@ void __iomem *omap_device_get_rt_va(struct omap_device *od)
return omap_hwmod_get_mpu_rt_va(od->hwmods[0]);
}
+/**
+ * omap_device_noidle - set the device's slave idlemode to no idle
+ * @od: struct omap_device *
+ *
+ * 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 -EINVAL if @od is in invalid
+ * state, or passes along the return value from
+ * omap_hwmod_noidle().
+ */
+int omap_device_noidle(struct omap_device *od)
+{
+ int retval = 0, i;
+
+ if (od->_state != OMAP_DEVICE_STATE_ENABLED) {
+ WARN(1, "omap_device: %s.%d: %s() called from invalid state "
+ "%d\n", od->pdev.name, od->pdev.id, __func__,
+ od->_state);
+ return -EINVAL;
+ }
+
+ for (i = 0; i < od->hwmods_cnt; i++)
+ retval |= omap_hwmod_noidle(od->hwmods[i]);
+
+ return retval;
+}
+
+
+/**
+ * omap_device_smartidle - set the device's slave idlemode to smart idle
+ * @od: struct omap_device *
+ *
+ * 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 -EINVAL if @od is in invalid
+ * state, or passes along the return value from
+ * omap_hwmod_smartidle().
+ */
+int omap_device_smartidle(struct omap_device *od)
+{
+ int retval = 0, i;
+
+ if (od->_state != OMAP_DEVICE_STATE_ENABLED) {
+ WARN(1, "omap_device: %s.%d: %s() called from invalid state "
+ "%d\n", od->pdev.name, od->pdev.id, __func__,
+ od->_state);
+ return -EINVAL;
+ }
+
+ for (i = 0; i < od->hwmods_cnt; i++)
+ retval |= omap_hwmod_smartidle(od->hwmods[i]);
+
+ return retval;
+}
+
+
+/**
+ * omap_device_forceidle - set the device's slave idlemode to force idle
+ * @od: struct omap_device *
+ *
+ * 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 -EINVAL if @od is in invalid
+ * state, or passes along the return value from
+ * omap_hwmod_forceidle().
+ */
+int omap_device_forceidle(struct omap_device *od)
+{
+ int retval = 0, i;
+
+ if (od->_state != OMAP_DEVICE_STATE_ENABLED) {
+ WARN(1, "omap_device: %s.%d: %s() called from invalid state "
+ "%d\n", od->pdev.name, od->pdev.id, __func__,
+ od->_state);
+ return -EINVAL;
+ }
+
+ for (i = 0; i < od->hwmods_cnt; i++)
+ retval |= omap_hwmod_forceidle(od->hwmods[i]);
+
+ return retval;
+}
+
+/**
+ * omap_device_default_idle - set the device's slave idlemode to no idle or
+ * smart idle
+ * @od: struct omap_device *
+ *
+ * Sets the IP block's OCP slave idlemode in hardware to no idle or smart idle
+ * Intended to be used by drivers that have some erratum that requires direct
+ * manipulation of the SIDLEMODE bits. Returns -EINVAL if @od is in invalid
+ * state, or passes along the return value from
+ * omap_hwmod_default_idle().
+ */
+int omap_device_default_idle(struct omap_device *od)
+{
+ int retval = 0, i;
+
+ if (od->_state != OMAP_DEVICE_STATE_ENABLED) {
+ WARN(1, "omap_device: %s.%d: %s() called from invalid state "
+ "%d\n", od->pdev.name, od->pdev.id, __func__,
+ od->_state);
+ return -EINVAL;
+ }
+
+ for (i = 0; i < od->hwmods_cnt; i++)
+ retval |= omap_hwmod_default_idle(od->hwmods[i]);
+
+ return retval;
+}
+
+/*
+ * omap_device_enable_autoidle - enable the device's OCP slave autoidle
+ * @od: struct omap_device *
+ *
+ * Sets the IP block's OCP slave autoidle in hardware.
+ * Intended to be used by drivers that have some erratum that requires direct
+ * manipulation of the AUTOIDLE bits. Returns -EINVAL if @od is in invalid
+ * state, or passes along the return value from
+ * omap_hwmod_set_ocp_autoidle().
+ */
+int omap_device_enable_autoidle(struct omap_device *od)
+{
+ int retval = 0, i;
+
+ if (od->_state != OMAP_DEVICE_STATE_ENABLED) {
+ WARN(1, "omap_device: %s.%d: %s() called from invalid state "
+ "%d\n", od->pdev.name, od->pdev.id, __func__,
+ od->_state);
+ return -EINVAL;
+ }
+
+ for (i = 0; i < od->hwmods_cnt; i++)
+ retval |= omap_hwmod_enable_autoidle(od->hwmods[i]);
+
+ return retval;
+}
+
+/*
+ * omap_device_disable_autoidle - disable the device's OCP slave autoidle
+ * @od: struct omap_device *
+ *
+ * Disables the IP block's OCP slave autoidle in hardware.
+ * Intended to be used by drivers that have some erratum that requires direct
+ * manipulation of the AUTOIDLE bits. Returns -EINVAL if @od is in invalid
+ * state, or passes along the return value from
+ * omap_hwmod_set_ocp_autoidle().
+ */
+int omap_device_disable_autoidle(struct omap_device *od)
+{
+ int retval = 0, i;
+
+ if (od->_state != OMAP_DEVICE_STATE_ENABLED) {
+ WARN(1, "omap_device: %s.%d: %s() called from invalid state "
+ "%d\n", od->pdev.name, od->pdev.id, __func__,
+ od->_state);
+ return -EINVAL;
+ }
+
+ for (i = 0; i < od->hwmods_cnt; i++)
+ retval |= omap_hwmod_disable_autoidle(od->hwmods[i]);
+
+ return retval;
+}
+
/*
* Public functions intended for use in omap_device_pm_latency
* .activate_func and .deactivate_func function pointers
--
1.7.0.4
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH v3 0/2] OMAP: omap_device: API to modify SYSCONFIG register
2011-07-04 11:08 [PATCH v3 0/2] OMAP: omap_device: API to modify SYSCONFIG register Kishon Vijay Abraham I
2011-07-04 11:08 ` [PATCH v3 1/2] OMAP: omap_hwmod: API to modify AUTOIDLE and SMARTIDLE bits Kishon Vijay Abraham I
2011-07-04 11:08 ` [PATCH v3 2/2] OMAP: omap_device: " Kishon Vijay Abraham I
@ 2011-07-08 13:21 ` ABRAHAM, KISHON VIJAY
2 siblings, 0 replies; 4+ messages in thread
From: ABRAHAM, KISHON VIJAY @ 2011-07-08 13:21 UTC (permalink / raw)
To: paul, b-cousson
Cc: linux-omap, linux-kernel, vishwanath.bs, p-basak2,
peter.ujfalusi, jhnikula, kishon, charu
Paul, Benoit,
Do you have any comments for this series?
Regards
Kishon
On Mon, Jul 4, 2011 at 4:38 PM, Kishon Vijay Abraham I <kishon@ti.com> wrote:
> Certain peripherals require autoidle bits to be disabled before performing
> some operations. This patch series provides APIs in omap_device layer and
> omap_hwmod layer to modify the SYSCONFIG register.
>
> Since current implementation of PM run time framework does not support
> changing sysconfig settings during middle of the on going operation,
> these APIs will support the same.
>
> For e.g McBSP 2 and 3 in OMAP3 has sidetone feature which requires
> autoidle to be disabled before starting the sidetone.
>
> McBSP also requires the SYSCONFIG to be in NOIDLE when ELEMENTSYNCH
> mode is selected for DMA operation.
>
> Created on top of linux OMAP master (linux-omap-2.6 :master)
> commit-id: d9be6df1331f8078618745298d38ed619729ec91
> Tested on OMAP4430 and OMAP3430 SDP boards. Verified that this patch
> series does not break the OMAP1 build.
>
> V3:
> created one-one mapping between omap_device APIs and omap_hwmod APIs to
> modify the sysconfig register.
>
> V2:
> Mutex is replaced with spinlock.
>
> V1:
> * Creates 3 separate API's to change the idle mode to NOIDLE, SMARTIDLE
> and FORCEIDLE and one more API to change the idlemode to default value
> based on the hwmod flag. This change is done to align with the discussion
> on [3]
>
> * Added hwmod mutex in omap hwmod APIs that modifies SYSCONFIG register.
>
> * omap_hwmod_set_slave_idlemode() is not modified to take true/false kind-of
> argument since 3 states are associated with SIDLE bits (force, no and smart).
>
> These changes were made to align with Benoit's and Paul's comments for a
> similar patch written by Manjunath [1] for changing MSTANDBY bits.
>
> The discussions that happened for the RFC patch can be found at [2]
>
> [1]: http://www.mail-archive.com/linux-omap <at> vger.kernel.org/msg39647.html
> [2]: https://patchwork.kernel.org/patch/134371/
> [3]: http://www.mail-archive.com/linux-omap <at> vger.kernel.org/msg39615.html
>
> Kishon Vijay Abraham I (2):
> OMAP: omap_hwmod: API to modify AUTOIDLE and SMARTIDLE bits
> OMAP: omap_device: API to modify AUTOIDLE and SMARTIDLE bits
>
> arch/arm/mach-omap2/omap_hwmod.c | 93 ++++++++++++++
> arch/arm/plat-omap/include/plat/omap_device.h | 6 +
> arch/arm/plat-omap/include/plat/omap_hwmod.h | 11 ++
> arch/arm/plat-omap/omap_device.c | 165 +++++++++++++++++++++++++
> 4 files changed, 275 insertions(+), 0 deletions(-)
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread