linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V5 0/5] ARM: exynos: Add l2 retention mode cpuidle state
@ 2012-01-05  4:25 Amit Daniel Kachhap
  2012-01-05  4:25 ` [PATCH V5 1/5] ARM: exynos: Add support AFTR mode on EXYNOS4210 Amit Daniel Kachhap
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Amit Daniel Kachhap @ 2012-01-05  4:25 UTC (permalink / raw)
  To: linux-arm-kernel

Changes since V4:
*Rebased the patchset against for-next of samsung kernel tree.
*Added Tushar suggestion of putting a check if L2 cache dt node not found.
*Added Inder suggestion of removing the BUG_ON check in cpuidle driver.

Changes since V3:
*Implemented Russell feedback and moved sleep magic 4byte memory before 
s3c_cpu_resume to data section.

Changes since V2:
*Implemented the suggestion of MyungJoo Ham and used INFORM0/1
registers for resume for some board versions.
*Added back save/restore through CPU PM notifiers as suggested by 
Lorenzo Pieralisi. This is useful to restore vfp state.
*some patch modularization (s5p/exynos) and proper commit logs.  

Changes since V1:
*rebased the whole patch against 3.2-rc1 tree
*removed GIC save/restore in AFTR cpuidle state as it is external
to cpu powerdomain
*Added L2 setup code through device tree
*Removed only l2 save/restore registers in sleep

This Patch series adds support for AFTR mode cpuidle state based on
patch (http://www.spinics.net/lists/arm-kernel/msg132243.html) earlier
submitted by Jaecheol Lee <jc.lee@samsung.com>.

This patch uses CPU PM notifiers , common l2 save/restore and
new cpu_suspend/resume interfaces and is based on the tip of
for-next branch of samsung tree
(git://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung.git for-next)
since commit id 44ceab1ea847daa03d1d58a20c43a83e8b99a2f9.

Amit Daniel Kachhap (5):
  ARM: exynos: Add support AFTR mode on EXYNOS4210
  ARM: s5p: add L2 early resume code
  ARM: exynos: save L2 settings during bootup
  ARM: exynos: remove useless code to save/restore L2
  ARM: exynos: Enable l2 configuration through device tree

 arch/arm/mach-exynos/common.c           |   54 +++++++++---
 arch/arm/mach-exynos/cpuidle.c          |  149 ++++++++++++++++++++++++++++++-
 arch/arm/mach-exynos/include/mach/pmu.h |    2 +
 arch/arm/mach-exynos/pm.c               |   15 ---
 arch/arm/plat-s5p/sleep.S               |   44 ++++++++--
 5 files changed, 228 insertions(+), 36 deletions(-)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH V5 1/5] ARM: exynos: Add support AFTR mode on EXYNOS4210
  2012-01-05  4:25 [PATCH V5 0/5] ARM: exynos: Add l2 retention mode cpuidle state Amit Daniel Kachhap
@ 2012-01-05  4:25 ` Amit Daniel Kachhap
  2012-02-01 11:37   ` Tushar Behera
  2012-01-05  4:25 ` [PATCH V5 2/5] ARM: s5p: add L2 early resume code Amit Daniel Kachhap
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: Amit Daniel Kachhap @ 2012-01-05  4:25 UTC (permalink / raw)
  To: linux-arm-kernel

This patch adds support AFTR(ARM OFF TOP RUNNING) mode in
cpuidle driver. L2 cache keeps their data in this mode.
This patch ports the code to the latest interfaces to
save/restore CPU state inclusive of CPU PM notifiers, l2
resume and cpu_suspend/resume.

Signed-off-by: Jaecheol Lee <jc.lee@samsung.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Amit Daniel Kachhap <amit.kachhap@linaro.org>
---
 arch/arm/mach-exynos/cpuidle.c          |  149 ++++++++++++++++++++++++++++++-
 arch/arm/mach-exynos/include/mach/pmu.h |    2 +
 2 files changed, 148 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-exynos/cpuidle.c b/arch/arm/mach-exynos/cpuidle.c
index 4ebb382..1f882af 100644
--- a/arch/arm/mach-exynos/cpuidle.c
+++ b/arch/arm/mach-exynos/cpuidle.c
@@ -11,15 +11,36 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/cpuidle.h>
+#include <linux/cpu_pm.h>
 #include <linux/io.h>
 #include <linux/export.h>
 #include <linux/time.h>
 
 #include <asm/proc-fns.h>
+#include <asm/smp_scu.h>
+#include <asm/suspend.h>
+#include <asm/unified.h>
+#include <mach/regs-pmu.h>
+#include <mach/pmu.h>
+
+#include <plat/cpu.h>
+
+#define REG_DIRECTGO_ADDR	(samsung_rev() == EXYNOS4210_REV_1_1 ? \
+			S5P_INFORM7 : (samsung_rev() == EXYNOS4210_REV_1_0 ? \
+			(S5P_VA_SYSRAM + 0x24) : S5P_INFORM0))
+#define REG_DIRECTGO_FLAG	(samsung_rev() == EXYNOS4210_REV_1_1 ? \
+			S5P_INFORM6 : (samsung_rev() == EXYNOS4210_REV_1_0 ? \
+			(S5P_VA_SYSRAM + 0x20) : S5P_INFORM1))
+
+#define S5P_CHECK_AFTR		(samsung_rev() == EXYNOS4210_REV_1_0 ? \
+				0xBAD00000 : 0xFCBA0D10)
 
 static int exynos4_enter_idle(struct cpuidle_device *dev,
 			struct cpuidle_driver *drv,
 			      int index);
+static int exynos4_enter_lowpower(struct cpuidle_device *dev,
+				struct cpuidle_driver *drv,
+				int index);
 
 static struct cpuidle_state exynos4_cpuidle_set[] = {
 	[0] = {
@@ -27,9 +48,17 @@ static struct cpuidle_state exynos4_cpuidle_set[] = {
 		.exit_latency		= 1,
 		.target_residency	= 100000,
 		.flags			= CPUIDLE_FLAG_TIME_VALID,
-		.name			= "IDLE",
+		.name			= "C0",
 		.desc			= "ARM clock gating(WFI)",
 	},
+	[1] = {
+		.enter			= exynos4_enter_lowpower,
+		.exit_latency		= 300,
+		.target_residency	= 100000,
+		.flags			= CPUIDLE_FLAG_TIME_VALID,
+		.name			= "C1",
+		.desc			= "ARM power down",
+	},
 };
 
 static DEFINE_PER_CPU(struct cpuidle_device, exynos4_cpuidle_device);
@@ -39,9 +68,101 @@ static struct cpuidle_driver exynos4_idle_driver = {
 	.owner		= THIS_MODULE,
 };
 
+/* Ext-GIC nIRQ/nFIQ is the only wakeup source in AFTR */
+static void exynos4_set_wakeupmask(void)
+{
+	__raw_writel(0x0000ff3e, S5P_WAKEUP_MASK);
+}
+
+static unsigned int g_pwr_ctrl, g_diag_reg;
+
+static void save_cpu_arch_register(void)
+{
+	/*read power control register*/
+	asm("mrc p15, 0, %0, c15, c0, 0" : "=r"(g_pwr_ctrl) : : "cc");
+	/*read diagnostic register*/
+	asm("mrc p15, 0, %0, c15, c0, 1" : "=r"(g_diag_reg) : : "cc");
+	return;
+}
+
+static void restore_cpu_arch_register(void)
+{
+	/*write power control register*/
+	asm("mcr p15, 0, %0, c15, c0, 0" : : "r"(g_pwr_ctrl) : "cc");
+	/*write diagnostic register*/
+	asm("mcr p15, 0, %0, c15, c0, 1" : : "r"(g_diag_reg) : "cc");
+	return;
+}
+
+static int idle_finisher(unsigned long flags)
+{
+	cpu_do_idle();
+	return 1;
+}
+
+static int exynos4_enter_core0_aftr(struct cpuidle_device *dev,
+				struct cpuidle_driver *drv,
+				int index)
+{
+	struct timeval before, after;
+	int idle_time;
+	unsigned long tmp;
+
+	local_irq_disable();
+	do_gettimeofday(&before);
+
+	exynos4_set_wakeupmask();
+
+	/* Set value of power down register for aftr mode */
+	exynos4_sys_powerdown_conf(SYS_AFTR);
+
+	__raw_writel(BSYM(virt_to_phys(s3c_cpu_resume)),
+						 REG_DIRECTGO_ADDR);
+	__raw_writel(S5P_CHECK_AFTR, REG_DIRECTGO_FLAG);
+
+	save_cpu_arch_register();
+
+	/* Setting Central Sequence Register for power down mode */
+	tmp = __raw_readl(S5P_CENTRAL_SEQ_CONFIGURATION);
+	tmp &= ~S5P_CENTRAL_LOWPWR_CFG;
+	__raw_writel(tmp, S5P_CENTRAL_SEQ_CONFIGURATION);
+
+	cpu_pm_enter();
+	cpu_suspend(0, idle_finisher);
+
+	scu_enable(S5P_VA_SCU);
+	cpu_pm_exit();
+
+	restore_cpu_arch_register();
+
+	/*
+	 * If PMU failed while entering sleep mode, WFI will be
+	 * ignored by PMU and then exiting cpu_do_idle().
+	 * S5P_CENTRAL_LOWPWR_CFG bit will not be set automatically
+	 * in this situation.
+	 */
+	tmp = __raw_readl(S5P_CENTRAL_SEQ_CONFIGURATION);
+	if (!(tmp & S5P_CENTRAL_LOWPWR_CFG)) {
+		tmp |= S5P_CENTRAL_LOWPWR_CFG;
+		__raw_writel(tmp, S5P_CENTRAL_SEQ_CONFIGURATION);
+	}
+
+	/* Clear wakeup state register */
+	__raw_writel(0x0, S5P_WAKEUP_STAT);
+
+	do_gettimeofday(&after);
+
+	local_irq_enable();
+	idle_time = (after.tv_sec - before.tv_sec) * USEC_PER_SEC +
+		    (after.tv_usec - before.tv_usec);
+
+	dev->last_residency = idle_time;
+	return index;
+}
+
 static int exynos4_enter_idle(struct cpuidle_device *dev,
 				struct cpuidle_driver *drv,
-			      int index)
+				int index)
 {
 	struct timeval before, after;
 	int idle_time;
@@ -60,6 +181,22 @@ static int exynos4_enter_idle(struct cpuidle_device *dev,
 	return index;
 }
 
+static int exynos4_enter_lowpower(struct cpuidle_device *dev,
+				struct cpuidle_driver *drv,
+				int index)
+{
+	int new_index = index;
+
+	/* This mode only can be entered when other core's are offline */
+	if (num_online_cpus() > 1)
+		new_index = drv->safe_state_index;
+
+	if (new_index == 0)
+		return exynos4_enter_idle(dev, drv, new_index);
+	else
+		return exynos4_enter_core0_aftr(dev, drv, new_index);
+}
+
 static int __init exynos4_init_cpuidle(void)
 {
 	int i, max_cpuidle_state, cpu_id;
@@ -74,19 +211,25 @@ static int __init exynos4_init_cpuidle(void)
 		memcpy(&drv->states[i], &exynos4_cpuidle_set[i],
 				sizeof(struct cpuidle_state));
 	}
+	drv->safe_state_index = 0;
 	cpuidle_register_driver(&exynos4_idle_driver);
 
 	for_each_cpu(cpu_id, cpu_online_mask) {
 		device = &per_cpu(exynos4_cpuidle_device, cpu_id);
 		device->cpu = cpu_id;
 
-		device->state_count = drv->state_count;
+		if (cpu_id == 0)
+			device->state_count = (sizeof(exynos4_cpuidle_set) /
+					       sizeof(struct cpuidle_state));
+		else
+			device->state_count = 1;	/* Support IDLE only */
 
 		if (cpuidle_register_device(device)) {
 			printk(KERN_ERR "CPUidle register device failed\n,");
 			return -EIO;
 		}
 	}
+
 	return 0;
 }
 device_initcall(exynos4_init_cpuidle);
diff --git a/arch/arm/mach-exynos/include/mach/pmu.h b/arch/arm/mach-exynos/include/mach/pmu.h
index 632dd56..e76b7fa 100644
--- a/arch/arm/mach-exynos/include/mach/pmu.h
+++ b/arch/arm/mach-exynos/include/mach/pmu.h
@@ -22,11 +22,13 @@ enum sys_powerdown {
 	NUM_SYS_POWERDOWN,
 };
 
+extern unsigned long l2x0_regs_phys;
 struct exynos4_pmu_conf {
 	void __iomem *reg;
 	unsigned int val[NUM_SYS_POWERDOWN];
 };
 
 extern void exynos4_sys_powerdown_conf(enum sys_powerdown mode);
+extern void s3c_cpu_resume(void);
 
 #endif /* __ASM_ARCH_PMU_H */
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH V5 2/5] ARM: s5p: add L2 early resume code
  2012-01-05  4:25 [PATCH V5 0/5] ARM: exynos: Add l2 retention mode cpuidle state Amit Daniel Kachhap
  2012-01-05  4:25 ` [PATCH V5 1/5] ARM: exynos: Add support AFTR mode on EXYNOS4210 Amit Daniel Kachhap
@ 2012-01-05  4:25 ` Amit Daniel Kachhap
  2012-01-05  4:25 ` [PATCH V5 3/5] ARM: exynos: save L2 settings during bootup Amit Daniel Kachhap
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Amit Daniel Kachhap @ 2012-01-05  4:25 UTC (permalink / raw)
  To: linux-arm-kernel

This patch adds code to resume L2 before MMU is enabled in
suspend and cpuidle resume paths. s3c_cpu_resume is moved to the
data section with appropriate comments.

Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Amit Daniel Kachhap <amit.kachhap@linaro.org>
---
 arch/arm/plat-s5p/sleep.S |   44 ++++++++++++++++++++++++++++++++++++++------
 1 files changed, 38 insertions(+), 6 deletions(-)

diff --git a/arch/arm/plat-s5p/sleep.S b/arch/arm/plat-s5p/sleep.S
index 0fd591b..006bd01 100644
--- a/arch/arm/plat-s5p/sleep.S
+++ b/arch/arm/plat-s5p/sleep.S
@@ -23,9 +23,18 @@
 */
 
 #include <linux/linkage.h>
-#include <asm/assembler.h>
+#include <asm/asm-offsets.h>
+#include <asm/hardware/cache-l2x0.h>
 
-	.text
+/*
+ *	 The following code is located into the .data section. This is to
+ *	 allow l2x0_regs_phys to be accessed with a relative load while we
+ *	 can't rely on any MMU translation. We could have put l2x0_regs_phys
+ *	 in the .text section as well, but some setups might insist on it to
+ *	 be truly read-only. (Reference from: arch/arm/kernel/sleep.S)
+ */
+	.data
+	.align
 
 	/*
 	 * sleep magic, to allow the bootloader to check for an valid
@@ -39,11 +48,34 @@
 	 * s3c_cpu_resume
 	 *
 	 * resume code entry for bootloader to call
-	 *
-	 * we must put this code here in the data segment as we have no
-	 * other way of restoring the stack pointer after sleep, and we
-	 * must not write to the code segment (code is read-only)
 	 */
 
 ENTRY(s3c_cpu_resume)
+#ifdef CONFIG_CACHE_L2X0
+	adr	r0, l2x0_regs_phys
+	ldr	r0, [r0]
+	ldr	r1, [r0, #L2X0_R_PHY_BASE]
+	ldr	r2, [r1, #L2X0_CTRL]
+	tst	r2, #0x1
+	bne	resume_l2on
+	ldr	r2, [r0, #L2X0_R_AUX_CTRL]
+	str	r2, [r1, #L2X0_AUX_CTRL]
+	ldr	r2, [r0, #L2X0_R_TAG_LATENCY]
+	str	r2, [r1, #L2X0_TAG_LATENCY_CTRL]
+	ldr	r2, [r0, #L2X0_R_DATA_LATENCY]
+	str	r2, [r1, #L2X0_DATA_LATENCY_CTRL]
+	ldr	r2, [r0, #L2X0_R_PREFETCH_CTRL]
+	str	r2, [r1, #L2X0_PREFETCH_CTRL]
+	ldr	r2, [r0, #L2X0_R_PWR_CTRL]
+	str	r2, [r1, #L2X0_POWER_CTRL]
+	mov	r2, #1
+	str	r2, [r1, #L2X0_CTRL]
+resume_l2on:
+#endif
 	b	cpu_resume
+ENDPROC(s3c_cpu_resume)
+#ifdef CONFIG_CACHE_L2X0
+	.globl l2x0_regs_phys
+l2x0_regs_phys:
+	.long	0
+#endif
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH V5 3/5] ARM: exynos: save L2 settings during bootup
  2012-01-05  4:25 [PATCH V5 0/5] ARM: exynos: Add l2 retention mode cpuidle state Amit Daniel Kachhap
  2012-01-05  4:25 ` [PATCH V5 1/5] ARM: exynos: Add support AFTR mode on EXYNOS4210 Amit Daniel Kachhap
  2012-01-05  4:25 ` [PATCH V5 2/5] ARM: s5p: add L2 early resume code Amit Daniel Kachhap
@ 2012-01-05  4:25 ` Amit Daniel Kachhap
  2012-01-05  4:25 ` [PATCH V5 4/5] ARM: exynos: remove useless code to save/restore L2 Amit Daniel Kachhap
  2012-01-05  4:25 ` [PATCH V5 5/5] ARM: exynos: Enable l2 configuration through device tree Amit Daniel Kachhap
  4 siblings, 0 replies; 9+ messages in thread
From: Amit Daniel Kachhap @ 2012-01-05  4:25 UTC (permalink / raw)
  To: linux-arm-kernel

This patch adds code to save L2 register configuration at boot, and
later used to resume L2 before MMU is enabled in suspend and cpuidle
resume paths.

Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Amit Daniel Kachhap <amit.kachhap@linaro.org>
---
 arch/arm/mach-exynos/common.c |   42 ++++++++++++++++++++++++++++++----------
 1 files changed, 31 insertions(+), 11 deletions(-)

diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
index ba4ab1f..f8bb808 100644
--- a/arch/arm/mach-exynos/common.c
+++ b/arch/arm/mach-exynos/common.c
@@ -26,10 +26,12 @@
 #include <asm/hardware/gic.h>
 #include <asm/mach/map.h>
 #include <asm/mach/irq.h>
+#include <asm/cacheflush.h>
 
 #include <mach/regs-irq.h>
 #include <mach/regs-pmu.h>
 #include <mach/regs-gpio.h>
+#include <mach/pmu.h>
 
 #include <plat/cpu.h>
 #include <plat/clock.h>
@@ -451,20 +453,38 @@ core_initcall(exynos4_core_init);
 #ifdef CONFIG_CACHE_L2X0
 static int __init exynos4_l2x0_cache_init(void)
 {
-	/* TAG, Data Latency Control: 2cycle */
-	__raw_writel(0x110, S5P_VA_L2CC + L2X0_TAG_LATENCY_CTRL);
+	if (!(__raw_readl(S5P_VA_L2CC + L2X0_CTRL) & 0x1)) {
+		l2x0_saved_regs.phy_base = EXYNOS4_PA_L2CC;
+		/* TAG, Data Latency Control: 2 cycles */
+		l2x0_saved_regs.tag_latency = 0x110;
 
-	if (soc_is_exynos4210())
-		__raw_writel(0x110, S5P_VA_L2CC + L2X0_DATA_LATENCY_CTRL);
-	else if (soc_is_exynos4212() || soc_is_exynos4412())
-		__raw_writel(0x120, S5P_VA_L2CC + L2X0_DATA_LATENCY_CTRL);
+		if (soc_is_exynos4212() || soc_is_exynos4412())
+			l2x0_saved_regs.data_latency = 0x120;
+		else
+			l2x0_saved_regs.data_latency = 0x110;
+
+		l2x0_saved_regs.prefetch_ctrl = 0x30000007;
+		l2x0_saved_regs.pwr_ctrl =
+			(L2X0_DYNAMIC_CLK_GATING_EN | L2X0_STNDBY_MODE_EN);
+
+		l2x0_regs_phys = virt_to_phys(&l2x0_saved_regs);
 
-	/* L2X0 Prefetch Control */
-	__raw_writel(0x30000007, S5P_VA_L2CC + L2X0_PREFETCH_CTRL);
+		__raw_writel(l2x0_saved_regs.tag_latency,
+				S5P_VA_L2CC + L2X0_TAG_LATENCY_CTRL);
+		__raw_writel(l2x0_saved_regs.data_latency,
+				S5P_VA_L2CC + L2X0_DATA_LATENCY_CTRL);
 
-	/* L2X0 Power Control */
-	__raw_writel(L2X0_DYNAMIC_CLK_GATING_EN | L2X0_STNDBY_MODE_EN,
-		     S5P_VA_L2CC + L2X0_POWER_CTRL);
+		/* L2X0 Prefetch Control */
+		__raw_writel(l2x0_saved_regs.prefetch_ctrl,
+				S5P_VA_L2CC + L2X0_PREFETCH_CTRL);
+
+		/* L2X0 Power Control */
+		__raw_writel(l2x0_saved_regs.pwr_ctrl,
+				S5P_VA_L2CC + L2X0_POWER_CTRL);
+
+		clean_dcache_area(&l2x0_regs_phys, sizeof(unsigned long));
+		clean_dcache_area(&l2x0_saved_regs, sizeof(struct l2x0_regs));
+	}
 
 	l2x0_init(S5P_VA_L2CC, 0x7C470001, 0xC200ffff);
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH V5 4/5] ARM: exynos: remove useless code to save/restore L2
  2012-01-05  4:25 [PATCH V5 0/5] ARM: exynos: Add l2 retention mode cpuidle state Amit Daniel Kachhap
                   ` (2 preceding siblings ...)
  2012-01-05  4:25 ` [PATCH V5 3/5] ARM: exynos: save L2 settings during bootup Amit Daniel Kachhap
@ 2012-01-05  4:25 ` Amit Daniel Kachhap
  2012-01-05  4:25 ` [PATCH V5 5/5] ARM: exynos: Enable l2 configuration through device tree Amit Daniel Kachhap
  4 siblings, 0 replies; 9+ messages in thread
From: Amit Daniel Kachhap @ 2012-01-05  4:25 UTC (permalink / raw)
  To: linux-arm-kernel

Following the merge of CPU PM notifiers and L2 resume code, this patch
removes useless code to save and restore L2 registers.

This is now automatically covered by suspend calls which integrated
CPU PM notifiers and new sleep code that allows to resume L2 before MMU
is turned on.

Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Amit Daniel Kachhap <amit.kachhap@linaro.org>
---
 arch/arm/mach-exynos/pm.c |   15 ---------------
 1 files changed, 0 insertions(+), 15 deletions(-)

diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c
index a4f61a4..2dd55a1 100644
--- a/arch/arm/mach-exynos/pm.c
+++ b/arch/arm/mach-exynos/pm.c
@@ -155,13 +155,6 @@ static struct sleep_save exynos4_core_save[] = {
 	SAVE_ITEM(S5P_SROM_BC3),
 };
 
-static struct sleep_save exynos4_l2cc_save[] = {
-	SAVE_ITEM(S5P_VA_L2CC + L2X0_TAG_LATENCY_CTRL),
-	SAVE_ITEM(S5P_VA_L2CC + L2X0_DATA_LATENCY_CTRL),
-	SAVE_ITEM(S5P_VA_L2CC + L2X0_PREFETCH_CTRL),
-	SAVE_ITEM(S5P_VA_L2CC + L2X0_POWER_CTRL),
-	SAVE_ITEM(S5P_VA_L2CC + L2X0_AUX_CTRL),
-};
 
 /* For Cortex-A9 Diagnostic and Power control register */
 static unsigned int save_arm_register[2];
@@ -182,7 +175,6 @@ static void exynos4_pm_prepare(void)
 	u32 tmp;
 
 	s3c_pm_do_save(exynos4_core_save, ARRAY_SIZE(exynos4_core_save));
-	s3c_pm_do_save(exynos4_l2cc_save, ARRAY_SIZE(exynos4_l2cc_save));
 	s3c_pm_do_save(exynos4_epll_save, ARRAY_SIZE(exynos4_epll_save));
 	s3c_pm_do_save(exynos4_vpll_save, ARRAY_SIZE(exynos4_vpll_save));
 
@@ -386,13 +378,6 @@ static void exynos4_pm_resume(void)
 
 	scu_enable(S5P_VA_SCU);
 
-#ifdef CONFIG_CACHE_L2X0
-	s3c_pm_do_restore_core(exynos4_l2cc_save, ARRAY_SIZE(exynos4_l2cc_save));
-	outer_inv_all();
-	/* enable L2X0*/
-	writel_relaxed(1, S5P_VA_L2CC + L2X0_CTRL);
-#endif
-
 early_wakeup:
 	return;
 }
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH V5 5/5] ARM: exynos: Enable l2 configuration through device tree
  2012-01-05  4:25 [PATCH V5 0/5] ARM: exynos: Add l2 retention mode cpuidle state Amit Daniel Kachhap
                   ` (3 preceding siblings ...)
  2012-01-05  4:25 ` [PATCH V5 4/5] ARM: exynos: remove useless code to save/restore L2 Amit Daniel Kachhap
@ 2012-01-05  4:25 ` Amit Daniel Kachhap
  2012-01-05  4:36   ` Olof Johansson
  4 siblings, 1 reply; 9+ messages in thread
From: Amit Daniel Kachhap @ 2012-01-05  4:25 UTC (permalink / raw)
  To: linux-arm-kernel

This patch enables calling generic l2 setup functions if device tree is used.

Signed-off-by: Amit Daniel Kachhap <amit.kachhap@linaro.org>
---
 arch/arm/mach-exynos/common.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
index f8bb808..e91b92d 100644
--- a/arch/arm/mach-exynos/common.c
+++ b/arch/arm/mach-exynos/common.c
@@ -47,6 +47,8 @@
 #include <plat/regs-serial.h>
 
 #include "common.h"
+#define L2_AUX_VAL 0x7C470001
+#define L2_AUX_MASK 0xC200ffff
 
 static const char name_exynos4210[] = "EXYNOS4210";
 static const char name_exynos4212[] = "EXYNOS4212";
@@ -453,6 +455,15 @@ core_initcall(exynos4_core_init);
 #ifdef CONFIG_CACHE_L2X0
 static int __init exynos4_l2x0_cache_init(void)
 {
+#ifdef CONFIG_OF
+	int ret;
+	ret = l2x0_of_init(L2_AUX_VAL, L2_AUX_MASK);
+	if (!ret) {
+		l2x0_regs_phys = virt_to_phys(&l2x0_saved_regs);
+		clean_dcache_area(&l2x0_regs_phys, sizeof(unsigned long));
+		return 0;
+	}
+#endif
 	if (!(__raw_readl(S5P_VA_L2CC + L2X0_CTRL) & 0x1)) {
 		l2x0_saved_regs.phy_base = EXYNOS4_PA_L2CC;
 		/* TAG, Data Latency Control: 2 cycles */
@@ -486,8 +497,7 @@ static int __init exynos4_l2x0_cache_init(void)
 		clean_dcache_area(&l2x0_saved_regs, sizeof(struct l2x0_regs));
 	}
 
-	l2x0_init(S5P_VA_L2CC, 0x7C470001, 0xC200ffff);
-
+	l2x0_init(S5P_VA_L2CC, L2_AUX_VAL, L2_AUX_MASK);
 	return 0;
 }
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH V5 5/5] ARM: exynos: Enable l2 configuration through device tree
  2012-01-05  4:25 ` [PATCH V5 5/5] ARM: exynos: Enable l2 configuration through device tree Amit Daniel Kachhap
@ 2012-01-05  4:36   ` Olof Johansson
  2012-01-05  6:26     ` Amit Kachhap
  0 siblings, 1 reply; 9+ messages in thread
From: Olof Johansson @ 2012-01-05  4:36 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jan 4, 2012 at 8:25 PM, Amit Daniel Kachhap
<amit.kachhap@linaro.org> wrote:
> This patch enables calling generic l2 setup functions if device tree is used.
>
> Signed-off-by: Amit Daniel Kachhap <amit.kachhap@linaro.org>
> ---
> ?arch/arm/mach-exynos/common.c | ? 14 ++++++++++++--
> ?1 files changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
> index f8bb808..e91b92d 100644
> --- a/arch/arm/mach-exynos/common.c
> +++ b/arch/arm/mach-exynos/common.c
> @@ -47,6 +47,8 @@
> ?#include <plat/regs-serial.h>
>
> ?#include "common.h"
> +#define L2_AUX_VAL 0x7C470001
> +#define L2_AUX_MASK 0xC200ffff
>
> ?static const char name_exynos4210[] = "EXYNOS4210";
> ?static const char name_exynos4212[] = "EXYNOS4212";
> @@ -453,6 +455,15 @@ core_initcall(exynos4_core_init);
> ?#ifdef CONFIG_CACHE_L2X0
> ?static int __init exynos4_l2x0_cache_init(void)
> ?{
> +#ifdef CONFIG_OF
> + ? ? ? int ret;
> + ? ? ? ret = l2x0_of_init(L2_AUX_VAL, L2_AUX_MASK);
> + ? ? ? if (!ret) {
> + ? ? ? ? ? ? ? l2x0_regs_phys = virt_to_phys(&l2x0_saved_regs);
> + ? ? ? ? ? ? ? clean_dcache_area(&l2x0_regs_phys, sizeof(unsigned long));
> + ? ? ? ? ? ? ? return 0;
> + ? ? ? }
> +#endif

No need for ifdef here, if CONFIG_OF is off, then there's a static
inline version of l2x_of_init() that will return -ENODEV.


-Olof

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH V5 5/5] ARM: exynos: Enable l2 configuration through device tree
  2012-01-05  4:36   ` Olof Johansson
@ 2012-01-05  6:26     ` Amit Kachhap
  0 siblings, 0 replies; 9+ messages in thread
From: Amit Kachhap @ 2012-01-05  6:26 UTC (permalink / raw)
  To: linux-arm-kernel

On 5 January 2012 10:06, Olof Johansson <olof@lixom.net> wrote:
> On Wed, Jan 4, 2012 at 8:25 PM, Amit Daniel Kachhap
> <amit.kachhap@linaro.org> wrote:
>> This patch enables calling generic l2 setup functions if device tree is used.
>>
>> Signed-off-by: Amit Daniel Kachhap <amit.kachhap@linaro.org>
>> ---
>> ?arch/arm/mach-exynos/common.c | ? 14 ++++++++++++--
>> ?1 files changed, 12 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
>> index f8bb808..e91b92d 100644
>> --- a/arch/arm/mach-exynos/common.c
>> +++ b/arch/arm/mach-exynos/common.c
>> @@ -47,6 +47,8 @@
>> ?#include <plat/regs-serial.h>
>>
>> ?#include "common.h"
>> +#define L2_AUX_VAL 0x7C470001
>> +#define L2_AUX_MASK 0xC200ffff
>>
>> ?static const char name_exynos4210[] = "EXYNOS4210";
>> ?static const char name_exynos4212[] = "EXYNOS4212";
>> @@ -453,6 +455,15 @@ core_initcall(exynos4_core_init);
>> ?#ifdef CONFIG_CACHE_L2X0
>> ?static int __init exynos4_l2x0_cache_init(void)
>> ?{
>> +#ifdef CONFIG_OF
>> + ? ? ? int ret;
>> + ? ? ? ret = l2x0_of_init(L2_AUX_VAL, L2_AUX_MASK);
>> + ? ? ? if (!ret) {
>> + ? ? ? ? ? ? ? l2x0_regs_phys = virt_to_phys(&l2x0_saved_regs);
>> + ? ? ? ? ? ? ? clean_dcache_area(&l2x0_regs_phys, sizeof(unsigned long));
>> + ? ? ? ? ? ? ? return 0;
>> + ? ? ? }
>> +#endif
>
> No need for ifdef here, if CONFIG_OF is off, then there's a static
> inline version of l2x_of_init() that will return -ENODEV.

Will accept your suggestion. Thanks

>
>
> -Olof

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH V5 1/5] ARM: exynos: Add support AFTR mode on EXYNOS4210
  2012-01-05  4:25 ` [PATCH V5 1/5] ARM: exynos: Add support AFTR mode on EXYNOS4210 Amit Daniel Kachhap
@ 2012-02-01 11:37   ` Tushar Behera
  0 siblings, 0 replies; 9+ messages in thread
From: Tushar Behera @ 2012-02-01 11:37 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Amit,

On 01/05/2012 09:55 AM, Amit Daniel Kachhap wrote:
> This patch adds support AFTR(ARM OFF TOP RUNNING) mode in
> cpuidle driver. L2 cache keeps their data in this mode.
> This patch ports the code to the latest interfaces to
> save/restore CPU state inclusive of CPU PM notifiers, l2
> resume and cpu_suspend/resume.
> 
> Signed-off-by: Jaecheol Lee <jc.lee@samsung.com>
> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Signed-off-by: Amit Daniel Kachhap <amit.kachhap@linaro.org>
> ---
>  arch/arm/mach-exynos/cpuidle.c          |  149 ++++++++++++++++++++++++++++++-
>  arch/arm/mach-exynos/include/mach/pmu.h |    2 +
>  2 files changed, 148 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/mach-exynos/cpuidle.c b/arch/arm/mach-exynos/cpuidle.c

-- snip --

> +static int exynos4_enter_core0_aftr(struct cpuidle_device *dev,
> +				struct cpuidle_driver *drv,
> +				int index)
> +{

-- snip --

> +
> +	scu_enable(S5P_VA_SCU);

#ifdef CONFIG_SMP
	scu_enable(S5P_VA_SCU);
#endif

This is required when compiling without SMP support.


-- 
Tushar Behera

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-02-01 11:37 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-05  4:25 [PATCH V5 0/5] ARM: exynos: Add l2 retention mode cpuidle state Amit Daniel Kachhap
2012-01-05  4:25 ` [PATCH V5 1/5] ARM: exynos: Add support AFTR mode on EXYNOS4210 Amit Daniel Kachhap
2012-02-01 11:37   ` Tushar Behera
2012-01-05  4:25 ` [PATCH V5 2/5] ARM: s5p: add L2 early resume code Amit Daniel Kachhap
2012-01-05  4:25 ` [PATCH V5 3/5] ARM: exynos: save L2 settings during bootup Amit Daniel Kachhap
2012-01-05  4:25 ` [PATCH V5 4/5] ARM: exynos: remove useless code to save/restore L2 Amit Daniel Kachhap
2012-01-05  4:25 ` [PATCH V5 5/5] ARM: exynos: Enable l2 configuration through device tree Amit Daniel Kachhap
2012-01-05  4:36   ` Olof Johansson
2012-01-05  6:26     ` Amit Kachhap

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).