Re: [PATCH] ARM: exynos4212: hotplug: Fix CPU idle clock down after CPU1 off

2014-05-30 Thread Krzysztof Kozlowski
On wto, 2014-05-13 at 16:12 +0200, Krzysztof Kozlowski wrote:
 On Exynos4212 USE_DELAYED_RESET_ASSERTION must be set in
 ARM_CORE1_OPTION register during CPU power down. This is the proper way
 of powering down CPU. Additionally without this the CPU clock down won't
 work after powering down CPU1 and CPU will work at full frequency chosen
 by CPUfreq governor.
 
 Signed-off-by: Krzysztof Kozlowski k.kozlow...@samsung.com



I am humbly reminding myself - any comments on this patch?

Best regards,
Krzysztof


 ---
  arch/arm/mach-exynos/hotplug.c  | 28 +---
  arch/arm/mach-exynos/regs-pmu.h |  2 ++
  2 files changed, 27 insertions(+), 3 deletions(-)
 
 diff --git a/arch/arm/mach-exynos/hotplug.c b/arch/arm/mach-exynos/hotplug.c
 index 5eead530c6f8..59b813e74558 100644
 --- a/arch/arm/mach-exynos/hotplug.c
 +++ b/arch/arm/mach-exynos/hotplug.c
 @@ -74,7 +74,7 @@ static inline void cpu_enter_lowpower_a15(void)
   dsb();
  }
  
 -static inline void cpu_leave_lowpower(void)
 +static inline void cpu_leave_lowpower(unsigned int cpu)
  {
   unsigned int v;
  
 @@ -88,6 +88,14 @@ static inline void cpu_leave_lowpower(void)
 : =r (v)
 : Ir (CR_C), Ir (0x40)
 : cc);
 +
 + if (cpu == 1  soc_is_exynos4212()) {
 + unsigned int tmp;
 +
 + tmp = __raw_readl(S5P_ARM_CORE1_OPTION);
 + tmp = ~(S5P_USE_DELAYED_RESET_ASSERTION);
 + __raw_writel(tmp, S5P_ARM_CORE1_OPTION);
 + }
  }
  
  static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
 @@ -95,8 +103,22 @@ static inline void platform_do_lowpower(unsigned int cpu, 
 int *spurious)
   for (;;) {
  
   /* make cpu1 to be turned off at next WFI command */
 - if (cpu == 1)
 + if (cpu == 1) {
 + if (soc_is_exynos4212()) {
 + unsigned int tmp;
 +
 + /*
 +  * Exynos 4212 requires setting
 +  * USE_DELAYED_RESET_ASSERTION so the CPU idle
 +  * clock down feature could properly detect
 +  * global idle state when CPU1 is off.
 +  */
 + tmp = __raw_readl(S5P_ARM_CORE1_OPTION);
 + tmp |= S5P_USE_DELAYED_RESET_ASSERTION;
 + __raw_writel(tmp, S5P_ARM_CORE1_OPTION);
 + }
   __raw_writel(0, S5P_ARM_CORE1_CONFIGURATION);
 + }
  
   /*
* here's the WFI
 @@ -152,7 +174,7 @@ void __ref exynos_cpu_die(unsigned int cpu)
* bring this CPU back into the world of cache
* coherency, and then restore interrupts
*/
 - cpu_leave_lowpower();
 + cpu_leave_lowpower(cpu);
  
   if (spurious)
   pr_warn(CPU%u: %u spurious wakeup calls\n, cpu, spurious);
 diff --git a/arch/arm/mach-exynos/regs-pmu.h b/arch/arm/mach-exynos/regs-pmu.h
 index 4f6a2560d022..1a3da4ef0e22 100644
 --- a/arch/arm/mach-exynos/regs-pmu.h
 +++ b/arch/arm/mach-exynos/regs-pmu.h
 @@ -25,6 +25,7 @@
  
  #define S5P_USE_STANDBY_WFI0 (1  16)
  #define S5P_USE_STANDBY_WFE0 (1  24)
 +#define S5P_USE_DELAYED_RESET_ASSERTION  BIT(12)
  
  #define EXYNOS_SWRESET   S5P_PMUREG(0x0400)
  #define EXYNOS5440_SWRESET   S5P_PMUREG(0x00C4)
 @@ -107,6 +108,7 @@
  
  #define S5P_ARM_CORE1_CONFIGURATION  S5P_PMUREG(0x2080)
  #define S5P_ARM_CORE1_STATUS S5P_PMUREG(0x2084)
 +#define S5P_ARM_CORE1_OPTION S5P_PMUREG(0x2088)
  
  #define S5P_PAD_RET_MAUDIO_OPTIONS5P_PMUREG(0x3028)
  #define S5P_PAD_RET_GPIO_OPTION  S5P_PMUREG(0x3108)

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ARM: exynos4212: hotplug: Fix CPU idle clock down after CPU1 off

2014-05-30 Thread Tomasz Figa
Hi Krzysztof,

On 13.05.2014 16:12, Krzysztof Kozlowski wrote:
 On Exynos4212 USE_DELAYED_RESET_ASSERTION must be set in
 ARM_CORE1_OPTION register during CPU power down. This is the proper way
 of powering down CPU. Additionally without this the CPU clock down won't
 work after powering down CPU1 and CPU will work at full frequency chosen
 by CPUfreq governor.
 
 Signed-off-by: Krzysztof Kozlowski k.kozlow...@samsung.com
 ---
  arch/arm/mach-exynos/hotplug.c  | 28 +---
  arch/arm/mach-exynos/regs-pmu.h |  2 ++
  2 files changed, 27 insertions(+), 3 deletions(-)
 
 diff --git a/arch/arm/mach-exynos/hotplug.c b/arch/arm/mach-exynos/hotplug.c
 index 5eead530c6f8..59b813e74558 100644
 --- a/arch/arm/mach-exynos/hotplug.c
 +++ b/arch/arm/mach-exynos/hotplug.c
 @@ -74,7 +74,7 @@ static inline void cpu_enter_lowpower_a15(void)
   dsb();
  }
  
 -static inline void cpu_leave_lowpower(void)
 +static inline void cpu_leave_lowpower(unsigned int cpu)
  {
   unsigned int v;
  
 @@ -88,6 +88,14 @@ static inline void cpu_leave_lowpower(void)
 : =r (v)
 : Ir (CR_C), Ir (0x40)
 : cc);
 +
 + if (cpu == 1  soc_is_exynos4212()) {

AFAIK this is needed not only on Exynos4x12, but at least also on 4412.
Also I don't think the (cpu == 1) condition is necessary. See below.

 + unsigned int tmp;
 +
 + tmp = __raw_readl(S5P_ARM_CORE1_OPTION);
 + tmp = ~(S5P_USE_DELAYED_RESET_ASSERTION);
 + __raw_writel(tmp, S5P_ARM_CORE1_OPTION);
 + }
  }
  
  static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
 @@ -95,8 +103,22 @@ static inline void platform_do_lowpower(unsigned int cpu, 
 int *spurious)
   for (;;) {
  
   /* make cpu1 to be turned off at next WFI command */
 - if (cpu == 1)
 + if (cpu == 1) {

I think this patch should be rebased on top of my [PATCH] ARM: EXYNOS:
Fix core ID used by platsmp and hotplug code. Then instead of if (cpu
== 1) you would just use EXYNOS_ARM_CORE_OPTION(core_id).

Also same comment as above, I believe this is also needed on Exynos4412.

Best regards,
Tomasz
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ARM: exynos4212: hotplug: Fix CPU idle clock down after CPU1 off

2014-05-30 Thread Krzysztof Kozlowski
On pią, 2014-05-30 at 13:50 +0200, Tomasz Figa wrote:
 Hi Krzysztof,
 
 On 13.05.2014 16:12, Krzysztof Kozlowski wrote:
  On Exynos4212 USE_DELAYED_RESET_ASSERTION must be set in
  ARM_CORE1_OPTION register during CPU power down. This is the proper way
  of powering down CPU. Additionally without this the CPU clock down won't
  work after powering down CPU1 and CPU will work at full frequency chosen
  by CPUfreq governor.
  
  Signed-off-by: Krzysztof Kozlowski k.kozlow...@samsung.com
  ---
   arch/arm/mach-exynos/hotplug.c  | 28 +---
   arch/arm/mach-exynos/regs-pmu.h |  2 ++
   2 files changed, 27 insertions(+), 3 deletions(-)
  
  diff --git a/arch/arm/mach-exynos/hotplug.c b/arch/arm/mach-exynos/hotplug.c
  index 5eead530c6f8..59b813e74558 100644
  --- a/arch/arm/mach-exynos/hotplug.c
  +++ b/arch/arm/mach-exynos/hotplug.c
  @@ -74,7 +74,7 @@ static inline void cpu_enter_lowpower_a15(void)
  dsb();
   }
   
  -static inline void cpu_leave_lowpower(void)
  +static inline void cpu_leave_lowpower(unsigned int cpu)
   {
  unsigned int v;
   
  @@ -88,6 +88,14 @@ static inline void cpu_leave_lowpower(void)
: =r (v)
: Ir (CR_C), Ir (0x40)
: cc);
  +
  +   if (cpu == 1  soc_is_exynos4212()) {
 
 AFAIK this is needed not only on Exynos4x12, but at least also on 4412.
 Also I don't think the (cpu == 1) condition is necessary. See below.

I'll test it on Exynos4412.

 
  +   unsigned int tmp;
  +
  +   tmp = __raw_readl(S5P_ARM_CORE1_OPTION);
  +   tmp = ~(S5P_USE_DELAYED_RESET_ASSERTION);
  +   __raw_writel(tmp, S5P_ARM_CORE1_OPTION);
  +   }
   }
   
   static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
  @@ -95,8 +103,22 @@ static inline void platform_do_lowpower(unsigned int 
  cpu, int *spurious)
  for (;;) {
   
  /* make cpu1 to be turned off at next WFI command */
  -   if (cpu == 1)
  +   if (cpu == 1) {
 
 I think this patch should be rebased on top of my [PATCH] ARM: EXYNOS:
 Fix core ID used by platsmp and hotplug code. Then instead of if (cpu
 == 1) you would just use EXYNOS_ARM_CORE_OPTION(core_id).
 
 Also same comment as above, I believe this is also needed on Exynos4412.

Probably your patch needs rebasing too. I couldn't apply (cleanly) on
current Linus' tree and on Kukjin's for-next. What are the requirements
for it?

Best regards,
Krzysztof


--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ARM: exynos4212: hotplug: Fix CPU idle clock down after CPU1 off

2014-05-30 Thread Tomasz Figa
On 30.05.2014 14:46, Krzysztof Kozlowski wrote:
 On pią, 2014-05-30 at 13:50 +0200, Tomasz Figa wrote:
 Hi Krzysztof,

 On 13.05.2014 16:12, Krzysztof Kozlowski wrote:
 On Exynos4212 USE_DELAYED_RESET_ASSERTION must be set in
 ARM_CORE1_OPTION register during CPU power down. This is the proper way
 of powering down CPU. Additionally without this the CPU clock down won't
 work after powering down CPU1 and CPU will work at full frequency chosen
 by CPUfreq governor.

 Signed-off-by: Krzysztof Kozlowski k.kozlow...@samsung.com
 ---
  arch/arm/mach-exynos/hotplug.c  | 28 +---
  arch/arm/mach-exynos/regs-pmu.h |  2 ++
  2 files changed, 27 insertions(+), 3 deletions(-)

 diff --git a/arch/arm/mach-exynos/hotplug.c b/arch/arm/mach-exynos/hotplug.c
 index 5eead530c6f8..59b813e74558 100644
 --- a/arch/arm/mach-exynos/hotplug.c
 +++ b/arch/arm/mach-exynos/hotplug.c
 @@ -74,7 +74,7 @@ static inline void cpu_enter_lowpower_a15(void)
 dsb();
  }
  
 -static inline void cpu_leave_lowpower(void)
 +static inline void cpu_leave_lowpower(unsigned int cpu)
  {
 unsigned int v;
  
 @@ -88,6 +88,14 @@ static inline void cpu_leave_lowpower(void)
   : =r (v)
   : Ir (CR_C), Ir (0x40)
   : cc);
 +
 +   if (cpu == 1  soc_is_exynos4212()) {

 AFAIK this is needed not only on Exynos4x12, but at least also on 4412.
 Also I don't think the (cpu == 1) condition is necessary. See below.
 
 I'll test it on Exynos4412.
 

 +   unsigned int tmp;
 +
 +   tmp = __raw_readl(S5P_ARM_CORE1_OPTION);
 +   tmp = ~(S5P_USE_DELAYED_RESET_ASSERTION);
 +   __raw_writel(tmp, S5P_ARM_CORE1_OPTION);
 +   }
  }
  
  static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
 @@ -95,8 +103,22 @@ static inline void platform_do_lowpower(unsigned int 
 cpu, int *spurious)
 for (;;) {
  
 /* make cpu1 to be turned off at next WFI command */
 -   if (cpu == 1)
 +   if (cpu == 1) {

 I think this patch should be rebased on top of my [PATCH] ARM: EXYNOS:
 Fix core ID used by platsmp and hotplug code. Then instead of if (cpu
 == 1) you would just use EXYNOS_ARM_CORE_OPTION(core_id).

 Also same comment as above, I believe this is also needed on Exynos4412.
 
 Probably your patch needs rebasing too. I couldn't apply (cleanly) on
 current Linus' tree and on Kukjin's for-next. What are the requirements
 for it?

Hmm, I based it on Kukjin's for-next from the day I sent the patch,
23.05 if I remember correctly. AFAICT everything needed by this patch is
already merged in Kukjin's tree (and I believe already was when I sent
that patch).

To make sure, I'm talking about this patch:
http://www.spinics.net/lists/linux-samsung-soc/msg31604.html

Best regards,
Tomasz
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ARM: exynos4212: hotplug: Fix CPU idle clock down after CPU1 off

2014-05-30 Thread Krzysztof Kozlowski
On pią, 2014-05-30 at 14:56 +0200, Tomasz Figa wrote:
 On 30.05.2014 14:46, Krzysztof Kozlowski wrote:
  On pią, 2014-05-30 at 13:50 +0200, Tomasz Figa wrote:
  Hi Krzysztof,
 
  On 13.05.2014 16:12, Krzysztof Kozlowski wrote:
  On Exynos4212 USE_DELAYED_RESET_ASSERTION must be set in
  ARM_CORE1_OPTION register during CPU power down. This is the proper way
  of powering down CPU. Additionally without this the CPU clock down won't
  work after powering down CPU1 and CPU will work at full frequency chosen
  by CPUfreq governor.
 
  Signed-off-by: Krzysztof Kozlowski k.kozlow...@samsung.com
  ---
   arch/arm/mach-exynos/hotplug.c  | 28 +---
   arch/arm/mach-exynos/regs-pmu.h |  2 ++
   2 files changed, 27 insertions(+), 3 deletions(-)
 
  diff --git a/arch/arm/mach-exynos/hotplug.c 
  b/arch/arm/mach-exynos/hotplug.c
  index 5eead530c6f8..59b813e74558 100644
  --- a/arch/arm/mach-exynos/hotplug.c
  +++ b/arch/arm/mach-exynos/hotplug.c
  @@ -74,7 +74,7 @@ static inline void cpu_enter_lowpower_a15(void)
dsb();
   }
   
  -static inline void cpu_leave_lowpower(void)
  +static inline void cpu_leave_lowpower(unsigned int cpu)
   {
unsigned int v;
   
  @@ -88,6 +88,14 @@ static inline void cpu_leave_lowpower(void)
  : =r (v)
  : Ir (CR_C), Ir (0x40)
  : cc);
  +
  + if (cpu == 1  soc_is_exynos4212()) {
 
  AFAIK this is needed not only on Exynos4x12, but at least also on 4412.
  Also I don't think the (cpu == 1) condition is necessary. See below.
  
  I'll test it on Exynos4412.
  
 
  + unsigned int tmp;
  +
  + tmp = __raw_readl(S5P_ARM_CORE1_OPTION);
  + tmp = ~(S5P_USE_DELAYED_RESET_ASSERTION);
  + __raw_writel(tmp, S5P_ARM_CORE1_OPTION);
  + }
   }
   
   static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
  @@ -95,8 +103,22 @@ static inline void platform_do_lowpower(unsigned int 
  cpu, int *spurious)
for (;;) {
   
/* make cpu1 to be turned off at next WFI command */
  - if (cpu == 1)
  + if (cpu == 1) {
 
  I think this patch should be rebased on top of my [PATCH] ARM: EXYNOS:
  Fix core ID used by platsmp and hotplug code. Then instead of if (cpu
  == 1) you would just use EXYNOS_ARM_CORE_OPTION(core_id).
 
  Also same comment as above, I believe this is also needed on Exynos4412.
  
  Probably your patch needs rebasing too. I couldn't apply (cleanly) on
  current Linus' tree and on Kukjin's for-next. What are the requirements
  for it?
 
 Hmm, I based it on Kukjin's for-next from the day I sent the patch,
 23.05 if I remember correctly. AFAICT everything needed by this patch is
 already merged in Kukjin's tree (and I believe already was when I sent
 that patch).
 
 To make sure, I'm talking about this patch:
 http://www.spinics.net/lists/linux-samsung-soc/msg31604.html

Yep, that's the patch but still it does not apply cleanly :). Anyway
I'll send next version of my patch reflecting your comments:
1. Limit to all Exynos4 SoCs.
2. Rebase on your patch to utilize EXYNOS_ARM_CORE_OPTION(core_id).

Best regards,
Krzysztof


--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ARM: exynos4212: hotplug: Fix CPU idle clock down after CPU1 off

2014-05-13 Thread Krzysztof Kozlowski
On Exynos4212 USE_DELAYED_RESET_ASSERTION must be set in
ARM_CORE1_OPTION register during CPU power down. This is the proper way
of powering down CPU. Additionally without this the CPU clock down won't
work after powering down CPU1 and CPU will work at full frequency chosen
by CPUfreq governor.

Signed-off-by: Krzysztof Kozlowski k.kozlow...@samsung.com
---
 arch/arm/mach-exynos/hotplug.c  | 28 +---
 arch/arm/mach-exynos/regs-pmu.h |  2 ++
 2 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-exynos/hotplug.c b/arch/arm/mach-exynos/hotplug.c
index 5eead530c6f8..59b813e74558 100644
--- a/arch/arm/mach-exynos/hotplug.c
+++ b/arch/arm/mach-exynos/hotplug.c
@@ -74,7 +74,7 @@ static inline void cpu_enter_lowpower_a15(void)
dsb();
 }
 
-static inline void cpu_leave_lowpower(void)
+static inline void cpu_leave_lowpower(unsigned int cpu)
 {
unsigned int v;
 
@@ -88,6 +88,14 @@ static inline void cpu_leave_lowpower(void)
  : =r (v)
  : Ir (CR_C), Ir (0x40)
  : cc);
+
+   if (cpu == 1  soc_is_exynos4212()) {
+   unsigned int tmp;
+
+   tmp = __raw_readl(S5P_ARM_CORE1_OPTION);
+   tmp = ~(S5P_USE_DELAYED_RESET_ASSERTION);
+   __raw_writel(tmp, S5P_ARM_CORE1_OPTION);
+   }
 }
 
 static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
@@ -95,8 +103,22 @@ static inline void platform_do_lowpower(unsigned int cpu, 
int *spurious)
for (;;) {
 
/* make cpu1 to be turned off at next WFI command */
-   if (cpu == 1)
+   if (cpu == 1) {
+   if (soc_is_exynos4212()) {
+   unsigned int tmp;
+
+   /*
+* Exynos 4212 requires setting
+* USE_DELAYED_RESET_ASSERTION so the CPU idle
+* clock down feature could properly detect
+* global idle state when CPU1 is off.
+*/
+   tmp = __raw_readl(S5P_ARM_CORE1_OPTION);
+   tmp |= S5P_USE_DELAYED_RESET_ASSERTION;
+   __raw_writel(tmp, S5P_ARM_CORE1_OPTION);
+   }
__raw_writel(0, S5P_ARM_CORE1_CONFIGURATION);
+   }
 
/*
 * here's the WFI
@@ -152,7 +174,7 @@ void __ref exynos_cpu_die(unsigned int cpu)
 * bring this CPU back into the world of cache
 * coherency, and then restore interrupts
 */
-   cpu_leave_lowpower();
+   cpu_leave_lowpower(cpu);
 
if (spurious)
pr_warn(CPU%u: %u spurious wakeup calls\n, cpu, spurious);
diff --git a/arch/arm/mach-exynos/regs-pmu.h b/arch/arm/mach-exynos/regs-pmu.h
index 4f6a2560d022..1a3da4ef0e22 100644
--- a/arch/arm/mach-exynos/regs-pmu.h
+++ b/arch/arm/mach-exynos/regs-pmu.h
@@ -25,6 +25,7 @@
 
 #define S5P_USE_STANDBY_WFI0   (1  16)
 #define S5P_USE_STANDBY_WFE0   (1  24)
+#define S5P_USE_DELAYED_RESET_ASSERTIONBIT(12)
 
 #define EXYNOS_SWRESET S5P_PMUREG(0x0400)
 #define EXYNOS5440_SWRESET S5P_PMUREG(0x00C4)
@@ -107,6 +108,7 @@
 
 #define S5P_ARM_CORE1_CONFIGURATIONS5P_PMUREG(0x2080)
 #define S5P_ARM_CORE1_STATUS   S5P_PMUREG(0x2084)
+#define S5P_ARM_CORE1_OPTION   S5P_PMUREG(0x2088)
 
 #define S5P_PAD_RET_MAUDIO_OPTION  S5P_PMUREG(0x3028)
 #define S5P_PAD_RET_GPIO_OPTIONS5P_PMUREG(0x3108)
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html