All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Walmsley <paul@pwsan.com>
To: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Cc: Thara Gopinath <thara@ti.com>
Subject: [PATCH 05/19] OMAP2/3 PM: Adding powerdomain APIs for reading the next logic and mem state
Date: Mon, 15 Feb 2010 18:24:45 -0700	[thread overview]
Message-ID: <20100216012444.1101.68067.stgit@localhost.localdomain> (raw)
In-Reply-To: <20100216011942.1101.14348.stgit@localhost.localdomain>

From: Thara Gopinath <thara@ti.com>

This patch adds APIs pwrdm_read_logic_retst and
pwrdm_read_mem_retst for reading the next programmed
logic and memory state a powerdomain is to hit in event
of the next power domain state being retention.
These are needed for OSWR support.

Signed-off-by: Thara Gopinath <thara@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
---
 arch/arm/mach-omap2/powerdomain.c             |   73 +++++++++++++++++++++++++
 arch/arm/plat-omap/include/plat/powerdomain.h |    2 +
 2 files changed, 75 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
index dc03289..e9eeaa4 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -679,6 +679,29 @@ int pwrdm_read_prev_logic_pwrst(struct powerdomain *pwrdm)
 }
 
 /**
+ * pwrdm_read_logic_retst - get next powerdomain logic power state
+ * @pwrdm: struct powerdomain * to get next logic power state
+ *
+ * Return the powerdomain pwrdm's logic power state.  Returns -EINVAL
+ * if the powerdomain pointer is null or returns the next logic
+ * power state upon success.
+ */
+int pwrdm_read_logic_retst(struct powerdomain *pwrdm)
+{
+	if (!pwrdm)
+		return -EINVAL;
+
+	/*
+	 * The register bit names below may not correspond to the
+	 * actual names of the bits in each powerdomain's register,
+	 * but the type of value returned is the same for each
+	 * powerdomain.
+	 */
+	return prm_read_mod_bits_shift(pwrdm->prcm_offs, pwrstctrl_reg_offs,
+					OMAP3430_LOGICSTATEST);
+}
+
+/**
  * pwrdm_read_mem_pwrst - get current memory bank power state
  * @pwrdm: struct powerdomain * to get current memory bank power state
  * @bank: memory bank number (0-3)
@@ -785,6 +808,56 @@ int pwrdm_read_prev_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
 }
 
 /**
+ * pwrdm_read_mem_retst - get next memory bank power state
+ * @pwrdm: struct powerdomain * to get mext memory bank power state
+ * @bank: memory bank number (0-3)
+ *
+ * Return the powerdomain pwrdm's next memory power state for bank
+ * x.  Returns -EINVAL if the powerdomain pointer is null, -EEXIST if
+ * the target memory bank does not exist or is not controllable, or
+ * returns the next memory power state upon success.
+ */
+int pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank)
+{
+	u32 m;
+
+	if (!pwrdm)
+		return -EINVAL;
+
+	if (pwrdm->banks < (bank + 1))
+		return -EEXIST;
+
+	/*
+	 * The register bit names below may not correspond to the
+	 * actual names of the bits in each powerdomain's register,
+	 * but the type of value returned is the same for each
+	 * powerdomain.
+	 */
+	switch (bank) {
+	case 0:
+		m = OMAP_MEM0_RETSTATE_MASK;
+		break;
+	case 1:
+		m = OMAP_MEM1_RETSTATE_MASK;
+		break;
+	case 2:
+		m = OMAP_MEM2_RETSTATE_MASK;
+		break;
+	case 3:
+		m = OMAP_MEM3_RETSTATE_MASK;
+		break;
+	case 4:
+		m = OMAP_MEM4_RETSTATE_MASK;
+	default:
+		WARN_ON(1); /* should never happen */
+		return -EEXIST;
+	}
+
+	return prm_read_mod_bits_shift(pwrdm->prcm_offs,
+					pwrstctrl_reg_offs, m);
+}
+
+/**
  * pwrdm_clear_all_prev_pwrst - clear previous powerstate register for a pwrdm
  * @pwrdm: struct powerdomain * to clear
  *
diff --git a/arch/arm/plat-omap/include/plat/powerdomain.h b/arch/arm/plat-omap/include/plat/powerdomain.h
index e15c7e9..6657ff2 100644
--- a/arch/arm/plat-omap/include/plat/powerdomain.h
+++ b/arch/arm/plat-omap/include/plat/powerdomain.h
@@ -137,8 +137,10 @@ int pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank, u8 pwrst);
 
 int pwrdm_read_logic_pwrst(struct powerdomain *pwrdm);
 int pwrdm_read_prev_logic_pwrst(struct powerdomain *pwrdm);
+int pwrdm_read_logic_retst(struct powerdomain *pwrdm);
 int pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank);
 int pwrdm_read_prev_mem_pwrst(struct powerdomain *pwrdm, u8 bank);
+int pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank);
 
 int pwrdm_enable_hdwr_sar(struct powerdomain *pwrdm);
 int pwrdm_disable_hdwr_sar(struct powerdomain *pwrdm);



WARNING: multiple messages have this Message-ID (diff)
From: paul@pwsan.com (Paul Walmsley)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 05/19] OMAP2/3 PM: Adding powerdomain APIs for reading the next logic and mem state
Date: Mon, 15 Feb 2010 18:24:45 -0700	[thread overview]
Message-ID: <20100216012444.1101.68067.stgit@localhost.localdomain> (raw)
In-Reply-To: <20100216011942.1101.14348.stgit@localhost.localdomain>

From: Thara Gopinath <thara@ti.com>

This patch adds APIs pwrdm_read_logic_retst and
pwrdm_read_mem_retst for reading the next programmed
logic and memory state a powerdomain is to hit in event
of the next power domain state being retention.
These are needed for OSWR support.

Signed-off-by: Thara Gopinath <thara@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
---
 arch/arm/mach-omap2/powerdomain.c             |   73 +++++++++++++++++++++++++
 arch/arm/plat-omap/include/plat/powerdomain.h |    2 +
 2 files changed, 75 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
index dc03289..e9eeaa4 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -679,6 +679,29 @@ int pwrdm_read_prev_logic_pwrst(struct powerdomain *pwrdm)
 }
 
 /**
+ * pwrdm_read_logic_retst - get next powerdomain logic power state
+ * @pwrdm: struct powerdomain * to get next logic power state
+ *
+ * Return the powerdomain pwrdm's logic power state.  Returns -EINVAL
+ * if the powerdomain pointer is null or returns the next logic
+ * power state upon success.
+ */
+int pwrdm_read_logic_retst(struct powerdomain *pwrdm)
+{
+	if (!pwrdm)
+		return -EINVAL;
+
+	/*
+	 * The register bit names below may not correspond to the
+	 * actual names of the bits in each powerdomain's register,
+	 * but the type of value returned is the same for each
+	 * powerdomain.
+	 */
+	return prm_read_mod_bits_shift(pwrdm->prcm_offs, pwrstctrl_reg_offs,
+					OMAP3430_LOGICSTATEST);
+}
+
+/**
  * pwrdm_read_mem_pwrst - get current memory bank power state
  * @pwrdm: struct powerdomain * to get current memory bank power state
  * @bank: memory bank number (0-3)
@@ -785,6 +808,56 @@ int pwrdm_read_prev_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
 }
 
 /**
+ * pwrdm_read_mem_retst - get next memory bank power state
+ * @pwrdm: struct powerdomain * to get mext memory bank power state
+ * @bank: memory bank number (0-3)
+ *
+ * Return the powerdomain pwrdm's next memory power state for bank
+ * x.  Returns -EINVAL if the powerdomain pointer is null, -EEXIST if
+ * the target memory bank does not exist or is not controllable, or
+ * returns the next memory power state upon success.
+ */
+int pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank)
+{
+	u32 m;
+
+	if (!pwrdm)
+		return -EINVAL;
+
+	if (pwrdm->banks < (bank + 1))
+		return -EEXIST;
+
+	/*
+	 * The register bit names below may not correspond to the
+	 * actual names of the bits in each powerdomain's register,
+	 * but the type of value returned is the same for each
+	 * powerdomain.
+	 */
+	switch (bank) {
+	case 0:
+		m = OMAP_MEM0_RETSTATE_MASK;
+		break;
+	case 1:
+		m = OMAP_MEM1_RETSTATE_MASK;
+		break;
+	case 2:
+		m = OMAP_MEM2_RETSTATE_MASK;
+		break;
+	case 3:
+		m = OMAP_MEM3_RETSTATE_MASK;
+		break;
+	case 4:
+		m = OMAP_MEM4_RETSTATE_MASK;
+	default:
+		WARN_ON(1); /* should never happen */
+		return -EEXIST;
+	}
+
+	return prm_read_mod_bits_shift(pwrdm->prcm_offs,
+					pwrstctrl_reg_offs, m);
+}
+
+/**
  * pwrdm_clear_all_prev_pwrst - clear previous powerstate register for a pwrdm
  * @pwrdm: struct powerdomain * to clear
  *
diff --git a/arch/arm/plat-omap/include/plat/powerdomain.h b/arch/arm/plat-omap/include/plat/powerdomain.h
index e15c7e9..6657ff2 100644
--- a/arch/arm/plat-omap/include/plat/powerdomain.h
+++ b/arch/arm/plat-omap/include/plat/powerdomain.h
@@ -137,8 +137,10 @@ int pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank, u8 pwrst);
 
 int pwrdm_read_logic_pwrst(struct powerdomain *pwrdm);
 int pwrdm_read_prev_logic_pwrst(struct powerdomain *pwrdm);
+int pwrdm_read_logic_retst(struct powerdomain *pwrdm);
 int pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank);
 int pwrdm_read_prev_mem_pwrst(struct powerdomain *pwrdm, u8 bank);
+int pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank);
 
 int pwrdm_enable_hdwr_sar(struct powerdomain *pwrdm);
 int pwrdm_disable_hdwr_sar(struct powerdomain *pwrdm);

  parent reply	other threads:[~2010-02-16  1:26 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-16  1:24 [PATCH 00/19] OMAP: more clock/powerdomain/hwmod patches for 2.6.34 Paul Walmsley
2010-02-16  1:24 ` Paul Walmsley
2010-02-16  1:24 ` [PATCH 01/19] OMAP: omap_device: add omap_device_is_valid() Paul Walmsley
2010-02-16  1:24   ` Paul Walmsley
2010-02-16  1:24 ` [PATCH 02/19] OMAP: omap_device: when 'called from invalid state', print state Paul Walmsley
2010-02-16  1:24   ` Paul Walmsley
2010-02-16  1:24 ` [PATCH 03/19] OMAP3: clock: use std _MASK suffix for CM_FCLKEN_IVA2 defines Paul Walmsley
2010-02-16  1:24   ` Paul Walmsley
2010-02-16  1:24 ` [PATCH 04/19] OMAP3: Clock: Added IDLEST definitions for SGX Paul Walmsley
2010-02-16  1:24   ` Paul Walmsley
2010-02-16  1:24 ` Paul Walmsley [this message]
2010-02-16  1:24   ` [PATCH 05/19] OMAP2/3 PM: Adding powerdomain APIs for reading the next logic and mem state Paul Walmsley
2010-02-16  1:24 ` [PATCH 06/19] OMAP3 PM: Defining .pwrsts_logic_ret field for core power domain structure Paul Walmsley
2010-02-16  1:24   ` Paul Walmsley
2010-02-16  1:24 ` [PATCH 07/19] OMAP3 PM: Adding counters for power domain logic off and mem off during retention Paul Walmsley
2010-02-16  1:24   ` Paul Walmsley
2010-02-16  1:24 ` [PATCH 08/19] OMAP2/3 clock: Extend find_idlest() to pass back idle state value Paul Walmsley
2010-02-16  1:24   ` Paul Walmsley
2010-02-16  1:24 ` [PATCH 09/19] AM35xx: Add clock support for new modules on AM35xx Paul Walmsley
2010-02-16  1:24   ` Paul Walmsley
2010-02-16  1:24 ` [PATCH 10/19] OMAP3 clock: Check return values for clk_get() Paul Walmsley
2010-02-16  1:24   ` Paul Walmsley
2010-02-16  1:24 ` [PATCH 11/19] OMAP2/3: PRCM: fix misc. compiler warnings Paul Walmsley
2010-02-16  1:24   ` Paul Walmsley
2010-02-16  1:24 ` [PATCH 12/19] OMAP3 clock: Remove FreqSel for 3630 Paul Walmsley
2010-02-16  1:24   ` Paul Walmsley
2010-02-16 11:00   ` Sergei Shtylyov
2010-02-16 11:00     ` Sergei Shtylyov
2010-02-16 18:10     ` Paul Walmsley
2010-02-16 18:10       ` Paul Walmsley
2010-02-16  1:24 ` [PATCH 13/19] OMAP3: hwmod: support to specify the offset position of various SYSCONFIG register bits Paul Walmsley
2010-02-16  1:24   ` Paul Walmsley
2010-02-16  1:24 ` [PATCH 14/19] OMAP: HWMOD: Add support for early device register into omap device layer Paul Walmsley
2010-02-16  1:24   ` Paul Walmsley
2010-02-16  1:24 ` [PATCH 15/19] OMAP3630: Clock: Workaround for DPLL HS divider limitation Paul Walmsley
2010-02-16  1:24   ` Paul Walmsley
2010-02-16  1:25 ` [PATCH 16/19] ARM: OMAP4 clock domain: Add check for avoiding dependency related update Paul Walmsley
2010-02-16  1:25   ` Paul Walmsley
2010-02-16  1:25 ` [PATCH 17/19] OMAP3 clock: introduce DPLL4 Jtype Paul Walmsley
2010-02-16  1:25   ` Paul Walmsley
2010-02-16  1:25 ` [PATCH 18/19] OMAP3 clock: Introduce 3630 DPLL4 HSDivider changes Paul Walmsley
2010-02-16  1:25   ` Paul Walmsley
2010-02-16  1:25 ` [PATCH 19/19] OMAP3 clock: add support for 192Mhz DPLL4M2 output Paul Walmsley
2010-02-16  1:25   ` Paul Walmsley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100216012444.1101.68067.stgit@localhost.localdomain \
    --to=paul@pwsan.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=thara@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.