All of lore.kernel.org
 help / color / mirror / Atom feed
From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Santosh Shilimkar <santosh.shilimkar@ti.com>
Cc: catalin.marinas@arm.com, linus.ml.walleij@gmail.com,
	linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	ccross@android.com
Subject: Re: [PATCH 4/5] ARM: scu: Move register defines to header file
Date: Fri, 4 Feb 2011 11:30:53 +0000	[thread overview]
Message-ID: <20110204113053.GF15004@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <c703383234131695d040a1e5b8a79413@mail.gmail.com>

On Fri, Feb 04, 2011 at 04:16:07PM +0530, Santosh Shilimkar wrote:
> > -----Original Message-----
> > From: Russell King - ARM Linux [mailto:linux@arm.linux.org.uk]
> > Sent: Friday, February 04, 2011 4:11 PM
> > To: Santosh Shilimkar
> > Cc: catalin.marinas@arm.com; linus.ml.walleij@gmail.com; linux-
> > omap@vger.kernel.org; linux-arm-kernel@lists.infradead.org;
> > ccross@android.com
> > Subject: Re: [PATCH 4/5] ARM: scu: Move register defines to header
> > file
> >
> > On Tue, Jan 25, 2011 at 11:53:35PM +0530, Santosh Shilimkar wrote:
> > > After fixing the 3rd version for base address break, I was able to
> > > use this patch and test it. Seems to work. SMC related stuff can
> > > be ignored because OMAP4 ES1.0 doesn't have functional PM hardware
> > > support.
> >
> > I think I'd prefer to do as the other functions do, and pass in the
> > scu base address from the platform code.  It's potentially more
> > efficient for platforms which have a fixed SCU base address.
> Ok. I can fix that

8<------
Subject: [PATCH] ARM: smp: add function to set WFI low-power mode for SMP CPUs

Add a function to set the SCU low-power mode for SMP CPUs.  This
centralizes this functionality rather than having to expose the
SCU register definitions to each platform.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
 arch/arm/include/asm/smp_scu.h |    5 +++++
 arch/arm/kernel/smp_scu.c      |   24 ++++++++++++++++++++++++
 2 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/arch/arm/include/asm/smp_scu.h b/arch/arm/include/asm/smp_scu.h
index 2376835..800860d 100644
--- a/arch/arm/include/asm/smp_scu.h
+++ b/arch/arm/include/asm/smp_scu.h
@@ -1,7 +1,12 @@
 #ifndef __ASMARM_ARCH_SCU_H
 #define __ASMARM_ARCH_SCU_H
 
+#define SCU_PM_NORMAL	0
+#define SCU_PM_DORMANT	2
+#define SCU_PM_POWEROFF	3
+
 unsigned int scu_get_core_count(void __iomem *);
 void scu_enable(void __iomem *);
+int scu_power_mode(void __iomem *, unsigned int);
 
 #endif
diff --git a/arch/arm/kernel/smp_scu.c b/arch/arm/kernel/smp_scu.c
index 9ab4149..0ba329a 100644
--- a/arch/arm/kernel/smp_scu.c
+++ b/arch/arm/kernel/smp_scu.c
@@ -50,3 +50,27 @@ void __init scu_enable(void __iomem *scu_base)
 	 */
 	flush_cache_all();
 }
+
+/*
+ * Set the executing CPUs power mode as defined.  This will be in
+ * preparation for it executing a WFI instruction.
+ *
+ * This function must be called with preemption disabled, and as it
+ * has the side effect of disabling coherency, caches must have been
+ * flushed.  Interrupts must also have been disabled.
+ */
+int scu_power_mode(void __iomem *scu_base, unsigned int mode)
+{
+	unsigned int val;
+	int cpu = smp_processor_id();
+	int shift;
+
+	if (mode > 3 || mode == 1 || cpu > 3)
+		return -EINVAL;
+
+	val = __raw_readb(scu_base + SCU_CPU_STATUS + cpu) & ~0x03;
+	val |= mode;
+	__raw_writeb(val, scu_base + SCU_CPU_STATUS + cpu);
+
+	return 0;
+}
-- 
1.6.2.5


WARNING: multiple messages have this Message-ID (diff)
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/5] ARM: scu: Move register defines to header file
Date: Fri, 4 Feb 2011 11:30:53 +0000	[thread overview]
Message-ID: <20110204113053.GF15004@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <c703383234131695d040a1e5b8a79413@mail.gmail.com>

On Fri, Feb 04, 2011 at 04:16:07PM +0530, Santosh Shilimkar wrote:
> > -----Original Message-----
> > From: Russell King - ARM Linux [mailto:linux at arm.linux.org.uk]
> > Sent: Friday, February 04, 2011 4:11 PM
> > To: Santosh Shilimkar
> > Cc: catalin.marinas at arm.com; linus.ml.walleij at gmail.com; linux-
> > omap at vger.kernel.org; linux-arm-kernel at lists.infradead.org;
> > ccross at android.com
> > Subject: Re: [PATCH 4/5] ARM: scu: Move register defines to header
> > file
> >
> > On Tue, Jan 25, 2011 at 11:53:35PM +0530, Santosh Shilimkar wrote:
> > > After fixing the 3rd version for base address break, I was able to
> > > use this patch and test it. Seems to work. SMC related stuff can
> > > be ignored because OMAP4 ES1.0 doesn't have functional PM hardware
> > > support.
> >
> > I think I'd prefer to do as the other functions do, and pass in the
> > scu base address from the platform code.  It's potentially more
> > efficient for platforms which have a fixed SCU base address.
> Ok. I can fix that

8<------
Subject: [PATCH] ARM: smp: add function to set WFI low-power mode for SMP CPUs

Add a function to set the SCU low-power mode for SMP CPUs.  This
centralizes this functionality rather than having to expose the
SCU register definitions to each platform.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
 arch/arm/include/asm/smp_scu.h |    5 +++++
 arch/arm/kernel/smp_scu.c      |   24 ++++++++++++++++++++++++
 2 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/arch/arm/include/asm/smp_scu.h b/arch/arm/include/asm/smp_scu.h
index 2376835..800860d 100644
--- a/arch/arm/include/asm/smp_scu.h
+++ b/arch/arm/include/asm/smp_scu.h
@@ -1,7 +1,12 @@
 #ifndef __ASMARM_ARCH_SCU_H
 #define __ASMARM_ARCH_SCU_H
 
+#define SCU_PM_NORMAL	0
+#define SCU_PM_DORMANT	2
+#define SCU_PM_POWEROFF	3
+
 unsigned int scu_get_core_count(void __iomem *);
 void scu_enable(void __iomem *);
+int scu_power_mode(void __iomem *, unsigned int);
 
 #endif
diff --git a/arch/arm/kernel/smp_scu.c b/arch/arm/kernel/smp_scu.c
index 9ab4149..0ba329a 100644
--- a/arch/arm/kernel/smp_scu.c
+++ b/arch/arm/kernel/smp_scu.c
@@ -50,3 +50,27 @@ void __init scu_enable(void __iomem *scu_base)
 	 */
 	flush_cache_all();
 }
+
+/*
+ * Set the executing CPUs power mode as defined.  This will be in
+ * preparation for it executing a WFI instruction.
+ *
+ * This function must be called with preemption disabled, and as it
+ * has the side effect of disabling coherency, caches must have been
+ * flushed.  Interrupts must also have been disabled.
+ */
+int scu_power_mode(void __iomem *scu_base, unsigned int mode)
+{
+	unsigned int val;
+	int cpu = smp_processor_id();
+	int shift;
+
+	if (mode > 3 || mode == 1 || cpu > 3)
+		return -EINVAL;
+
+	val = __raw_readb(scu_base + SCU_CPU_STATUS + cpu) & ~0x03;
+	val |= mode;
+	__raw_writeb(val, scu_base + SCU_CPU_STATUS + cpu);
+
+	return 0;
+}
-- 
1.6.2.5

  reply	other threads:[~2011-02-04 11:31 UTC|newest]

Thread overview: 132+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-24  8:51 [PATCH 0/5] ARM: Few patches for PM enablement Santosh Shilimkar
2011-01-24  8:51 ` Santosh Shilimkar
2011-01-24  8:51 ` [PATCH 1/5] ARM: gic: Add hooks for architecture specific extensions Santosh Shilimkar
2011-01-24  8:51   ` Santosh Shilimkar
2011-01-25  3:03   ` Colin Cross
2011-01-25  3:03     ` Colin Cross
2011-01-25 20:54     ` Colin Cross
2011-01-25 20:54       ` Colin Cross
2011-01-26  7:22       ` Santosh Shilimkar
2011-01-26  7:22         ` Santosh Shilimkar
2011-01-26  7:23         ` Colin Cross
2011-01-26  7:23           ` Colin Cross
2011-01-26  7:31           ` Santosh Shilimkar
2011-01-26  7:31             ` Santosh Shilimkar
2011-01-26  7:52             ` Colin Cross
2011-01-26  7:52               ` Colin Cross
2011-01-26  7:55               ` Santosh Shilimkar
2011-01-26  7:55                 ` Santosh Shilimkar
2011-01-24  8:51 ` [PATCH 2/5] ARM: gic: Add distributor and interface enable/disable accessory api Santosh Shilimkar
2011-01-24  8:51   ` Santosh Shilimkar
2011-03-01  5:58   ` Santosh Shilimkar
2011-03-01  5:58     ` Santosh Shilimkar
2011-01-24  8:51 ` [PATCH 3/5] ARM: twd: Add context save restore support Santosh Shilimkar
2011-01-24  8:51   ` Santosh Shilimkar
2011-01-24 11:06   ` Russell King - ARM Linux
2011-01-24 11:06     ` Russell King - ARM Linux
2011-01-24 11:11     ` Russell King - ARM Linux
2011-01-24 11:11       ` Russell King - ARM Linux
2011-01-24 11:16       ` Santosh Shilimkar
2011-01-24 11:16         ` Santosh Shilimkar
2011-01-25  7:39       ` Colin Cross
2011-01-25  7:39         ` Colin Cross
2011-01-25 10:32         ` Russell King - ARM Linux
2011-01-25 10:32           ` Russell King - ARM Linux
2011-01-25 13:23           ` Thomas Gleixner
2011-01-25 13:23             ` Thomas Gleixner
2011-01-25 13:37             ` Russell King - ARM Linux
2011-01-25 13:37               ` Russell King - ARM Linux
2011-01-25 13:55               ` Santosh Shilimkar
2011-01-25 13:55                 ` Santosh Shilimkar
2011-01-25 14:12               ` Thomas Gleixner
2011-01-25 14:12                 ` Thomas Gleixner
2011-01-25 14:15                 ` Russell King - ARM Linux
2011-01-25 14:15                   ` Russell King - ARM Linux
2011-01-25 14:24                   ` Thomas Gleixner
2011-01-25 14:24                     ` Thomas Gleixner
2011-01-25 16:04               ` Santosh Shilimkar
2011-01-25 16:04                 ` Santosh Shilimkar
2011-01-25 16:13                 ` Russell King - ARM Linux
2011-01-25 16:13                   ` Russell King - ARM Linux
2011-01-25 16:14                   ` Santosh Shilimkar
2011-01-25 16:14                     ` Santosh Shilimkar
2011-01-25 11:29         ` Russell King - ARM Linux
2011-01-25 11:29           ` Russell King - ARM Linux
2011-01-25 11:40           ` Santosh Shilimkar
2011-01-25 11:40             ` Santosh Shilimkar
2011-01-25 11:48             ` Russell King - ARM Linux
2011-01-25 11:48               ` Russell King - ARM Linux
2011-01-25 12:08               ` Santosh Shilimkar
2011-01-25 12:08                 ` Santosh Shilimkar
2011-01-25 12:17                 ` Russell King - ARM Linux
2011-01-25 12:17                   ` Russell King - ARM Linux
2011-01-25 12:20                   ` Santosh Shilimkar
2011-01-25 12:20                     ` Santosh Shilimkar
2011-01-25 18:44           ` Colin Cross
2011-01-25 18:44             ` Colin Cross
2011-01-24 11:14     ` Santosh Shilimkar
2011-01-24 11:14       ` Santosh Shilimkar
2011-01-24  8:51 ` [PATCH 4/5] ARM: scu: Move register defines to header file Santosh Shilimkar
2011-01-24  8:51   ` Santosh Shilimkar
2011-01-25 11:46   ` Russell King - ARM Linux
2011-01-25 11:46     ` Russell King - ARM Linux
2011-01-25 12:02     ` Santosh Shilimkar
2011-01-25 12:02       ` Santosh Shilimkar
2011-01-25 12:16       ` Russell King - ARM Linux
2011-01-25 12:16         ` Russell King - ARM Linux
2011-01-25 12:29         ` Russell King - ARM Linux
2011-01-25 12:29           ` Russell King - ARM Linux
2011-01-25 12:39           ` Santosh Shilimkar
2011-01-25 12:39             ` Santosh Shilimkar
2011-01-25 12:36         ` Santosh Shilimkar
2011-01-25 12:36           ` Santosh Shilimkar
2011-01-25 12:56           ` Russell King - ARM Linux
2011-01-25 12:56             ` Russell King - ARM Linux
2011-01-25 13:04             ` Russell King - ARM Linux
2011-01-25 13:04               ` Russell King - ARM Linux
2011-01-25 13:06               ` Russell King - ARM Linux
2011-01-25 13:06                 ` Russell King - ARM Linux
2011-01-25 18:23                 ` Santosh Shilimkar
2011-01-25 18:23                   ` Santosh Shilimkar
2011-02-04 10:41                   ` Russell King - ARM Linux
2011-02-04 10:41                     ` Russell King - ARM Linux
2011-02-04 10:46                     ` Santosh Shilimkar
2011-02-04 10:46                       ` Santosh Shilimkar
2011-02-04 11:30                       ` Russell King - ARM Linux [this message]
2011-02-04 11:30                         ` Russell King - ARM Linux
2011-02-04 11:34                         ` Santosh Shilimkar
2011-02-04 11:34                           ` Santosh Shilimkar
2011-02-07  9:51                         ` Santosh Shilimkar
2011-02-07  9:51                           ` Santosh Shilimkar
2011-02-07 10:18                           ` Russell King - ARM Linux
2011-02-07 10:18                             ` Russell King - ARM Linux
2011-02-07 10:21                             ` Santosh Shilimkar
2011-02-07 10:21                               ` Santosh Shilimkar
2011-02-07 10:23                               ` Russell King - ARM Linux
2011-02-07 10:23                                 ` Russell King - ARM Linux
2011-02-07 10:30                                 ` Santosh Shilimkar
2011-02-07 10:30                                   ` Santosh Shilimkar
2011-02-10 14:49                             ` Santosh Shilimkar
2011-02-10 14:49                               ` Santosh Shilimkar
2011-02-10 16:13                               ` Russell King - ARM Linux
2011-02-10 16:13                                 ` Russell King - ARM Linux
2011-02-10 16:26                                 ` Santosh Shilimkar
2011-02-10 16:26                                   ` Santosh Shilimkar
2011-01-25 13:05             ` Santosh Shilimkar
2011-01-25 13:05               ` Santosh Shilimkar
2011-01-25 13:41           ` Russell King - ARM Linux
2011-01-25 13:41             ` Russell King - ARM Linux
2011-01-25 13:47             ` Santosh Shilimkar
2011-01-25 13:47               ` Santosh Shilimkar
2011-01-24  8:51 ` [PATCH 5/5] ARM: smp: Skip secondary cpu calibration to speed-up boot Santosh Shilimkar
2011-01-24  8:51   ` Santosh Shilimkar
2011-01-24 10:30   ` Russell King - ARM Linux
2011-01-24 10:30     ` Russell King - ARM Linux
2011-01-24  8:51 ` Santosh Shilimkar
2011-01-24  8:51   ` Santosh Shilimkar
2011-01-24  8:55   ` Santosh Shilimkar
2011-01-24  8:55     ` Santosh Shilimkar
2011-02-04 10:19 ` [PATCH 0/5] ARM: Few patches for PM enablement Santosh Shilimkar
2011-02-04 10:19   ` Santosh Shilimkar
2011-02-11 14:24   ` Santosh Shilimkar
2011-02-11 14:24     ` Santosh Shilimkar

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=20110204113053.GF15004@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=catalin.marinas@arm.com \
    --cc=ccross@android.com \
    --cc=linus.ml.walleij@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=santosh.shilimkar@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.