Skip to contentSkip to conversation

Add initial support of PMU and CMU for exynos5260

PATCH New Vikas Sajjan 3 participants 6 messages Dec 11, 2013 – Dec 31, 2013

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover Add initial support of PMU and CMU for exynos5260

1) Added initial PMU support for exynos5260

2) Added exynos5260_iodesc for mapping 5260 specific SFRs. We modified exynos5_map_io so that in case of exynos5260 only exynos5260_iodesc can be initialized.

3) Added new macros for WAKEUP MASK for 5260, and modified exynos_pm_drvinit accordingly.

4) Adds CMU virtual addresses for exynos5260.

rebased on kgene tree for-next branch
https://git.kernel.org/cgit/linux/kernel/git/kgene/linux-samsung.git/log/?h=for-next
and on top of rahul's patches for basic support of exynos5260
http://www.mail-archive.com/linux-samsung-soc at vger.kernel.org/msg24573.html

Vikas Sajjan (1):
ARM: EXYNOS: Add initial support of PMU for Exynos5260

Young-Gun Jang (1):
ARM: EXYNOS: Add CMU virtual addresses for exynos5260

 arch/arm/mach-exynos/common.c                  | 154 ++++++++++++++++-
 arch/arm/mach-exynos/common.h                  |   5 +
 arch/arm/mach-exynos/include/mach/map.h        |  31 ++++
 arch/arm/mach-exynos/include/mach/regs-clock.h |  17 ++
 arch/arm/mach-exynos/include/mach/regs-pmu.h   | 221 +++++++++++++++++++++++++
 arch/arm/mach-exynos/pm.c                      |  33 +++-
 arch/arm/mach-exynos/pmu.c                     | 140 ++++++++++++++++
 arch/arm/plat-samsung/include/plat/map-s5p.h   |  30 ++++
 8 files changed, 620 insertions(+), 11 deletions(-)
Signature · 1 line
1.7.12.4
#1 lore raw

PATCH 1/2 ARM: EXYNOS: Add initial support of PMU for Exynos5260

Adds initial PMU support for Exynos5260

Following are the changes done
------------------------------

1) Added initial PMU support for exynos5260

2) Added exynos5260_iodesc for mapping 5260 specific SFRs. We modified exynos5_map_io so that in case of exynos5260 only exynos5260_iodesc can be initialized.

3) Added new macros for WAKEUP MASK for 5260, and modified exynos_pm_drvinit accrodingly.

Change-Id Ie585d47a499c17813cfe0e5a668072ca7b13ffb5
---
 arch/arm/mach-exynos/common.c                |  89 ++++++++++-
 arch/arm/mach-exynos/common.h                |   5 +
 arch/arm/mach-exynos/include/mach/map.h      |  17 +++
 arch/arm/mach-exynos/include/mach/regs-pmu.h | 221 +++++++++++++++++++++++++++
 arch/arm/mach-exynos/pm.c                    |  33 +++-
 arch/arm/mach-exynos/pmu.c                   | 140 +++++++++++++++++
 arch/arm/plat-samsung/include/plat/map-s5p.h |  14 ++
 7 files changed, 508 insertions(+), 11 deletions(-)
arch/arm/mach-exynos/common.c +86 -3
index 5eb77d1..70da5c4 100644
@@ -272,10 +272,90 @@ static struct map_desc exynos5_iodesc[] __initdata = {
 
 static struct map_desc exynos5260_iodesc[] __initdata = {
 	{
+		.virtual	= (unsigned long)EXYNOS5260_VA_SYS_PERI,
+		.pfn		= __phys_to_pfn(EXYNOS5260_PA_SYS_PERI),
+		.length		= SZ_16K,
+		.type		= MT_DEVICE,
+	}, {
+		.virtual	= (unsigned long)EXYNOS5260_VA_SYS_EGL,
+		.pfn		= __phys_to_pfn(EXYNOS5260_PA_SYS_EGL),
+		.length		= SZ_16K,
+		.type		= MT_DEVICE,
+	}, {
+		.virtual	= (unsigned long)EXYNOS5260_VA_SYS_KFC,
+		.pfn		= __phys_to_pfn(EXYNOS5260_PA_SYS_KFC),
+		.length		= SZ_16K,
+		.type		= MT_DEVICE,
+	}, {
+		.virtual	= (unsigned long)EXYNOS5260_VA_SYS_G2D,
+		.pfn		= __phys_to_pfn(EXYNOS5260_PA_SYS_G2D),
+		.length		= SZ_16K,
+		.type		= MT_DEVICE,
+	}, {
+		.virtual	= (unsigned long)EXYNOS5260_VA_SYS_MIF,
+		.pfn		= __phys_to_pfn(EXYNOS5260_PA_SYS_MIF),
+		.length		= SZ_16K,
+		.type		= MT_DEVICE,
+	}, {
+		.virtual	= (unsigned long)EXYNOS5260_VA_SYS_MFC,
+		.pfn		= __phys_to_pfn(EXYNOS5260_PA_SYS_MFC),
+		.length		= SZ_16K,
+		.type		= MT_DEVICE,
+	}, {
+		.virtual	= (unsigned long)EXYNOS5260_VA_SYS_G3D,
+		.pfn		= __phys_to_pfn(EXYNOS5260_PA_SYS_G3D),
+		.length		= SZ_16K,
+		.type		= MT_DEVICE,
+	}, {
+		.virtual	= (unsigned long)EXYNOS5260_VA_SYS_FSYS,
+		.pfn		= __phys_to_pfn(EXYNOS5260_PA_SYS_FSYS),
+		.length		= SZ_16K,
+		.type		= MT_DEVICE,
+	}, {
+		.virtual	= (unsigned long)EXYNOS5260_VA_SYS_AUD,
+		.pfn		= __phys_to_pfn(EXYNOS5260_PA_SYS_AUD),
+		.length		= SZ_16K,
+		.type		= MT_DEVICE,
+	}, {
+		.virtual	= (unsigned long)EXYNOS5260_VA_SYS_ISP,
+		.pfn		= __phys_to_pfn(EXYNOS5260_PA_SYS_ISP),
+		.length		= SZ_16K,
+		.type		= MT_DEVICE,
+	}, {
+		.virtual	= (unsigned long)EXYNOS5260_VA_SYS_GSCL,
+		.pfn		= __phys_to_pfn(EXYNOS5260_PA_SYS_GSCL),
+		.length		= SZ_16K,
+		.type		= MT_DEVICE,
+	}, {
+		.virtual	= (unsigned long)EXYNOS5260_VA_SYS_DISP,
+		.pfn		= __phys_to_pfn(EXYNOS5260_PA_SYS_DISP),
+		.length		= SZ_16K,
+		.type		= MT_DEVICE,
+	}, {
+		.virtual	= (unsigned long)S3C_VA_WATCHDOG,
+		.pfn		= __phys_to_pfn(EXYNOS5_PA_WATCHDOG),
+		.length		= SZ_4K,
+		.type		= MT_DEVICE,
+	}, {
+		.virtual	= (unsigned long)S5P_VA_SROMC,
+		.pfn		= __phys_to_pfn(EXYNOS5260_PA_SROMC),
+		.length		= SZ_4K,
+		.type		= MT_DEVICE,
+	}, {
+		.virtual	= (unsigned long)S5P_VA_SYSRAM,
+		.pfn		= __phys_to_pfn(EXYNOS5_PA_SYSRAM),
+		.length		= SZ_4K,
+		.type		= MT_DEVICE,
+	}, {
 		.virtual	= (unsigned long)S5P_VA_SYSRAM_NS,
 		.pfn		= __phys_to_pfn(EXYNOS5260_PA_SYSRAM_NS),
 		.length		= SZ_4K,
 		.type		= MT_DEVICE,
+	}, {
+		.virtual	= (unsigned long)S5P_VA_PMU,
+		.pfn		= __phys_to_pfn(EXYNOS5260_PA_PMU),
+		.length		= SZ_64K,
+		.type		= MT_DEVICE,
 	},
 };
 
@@ -386,11 +466,14 @@ static void __init exynos4_map_io(void)
 
 static void __init exynos5_map_io(void)
 {
-	iotable_init(exynos5_iodesc, ARRAY_SIZE(exynos5_iodesc));
-	if (soc_is_exynos5260())
-		iotable_init(exynos5260_iodesc, ARRAY_SIZE(exynos5260_iodesc));
+	if (!soc_is_exynos5260())
+		iotable_init(exynos5_iodesc, ARRAY_SIZE(exynos5_iodesc));
+
 	if (soc_is_exynos5250())
 		iotable_init(exynos5250_iodesc, ARRAY_SIZE(exynos5250_iodesc));
+
+	if (soc_is_exynos5260())
+		iotable_init(exynos5260_iodesc, ARRAY_SIZE(exynos5260_iodesc));
 }
 
 struct bus_type exynos_subsys = {
arch/arm/mach-exynos/common.h +5 -0
index ff9b6a9..e2cabfe 100644
@@ -47,6 +47,11 @@ enum sys_powerdown {
 	NUM_SYS_POWERDOWN,
 };
 
+enum running_cpu {
+	KFC,
+	ARM,
+};
+
 extern unsigned long l2x0_regs_phys;
 struct exynos_pmu_conf {
 	void __iomem *reg;
arch/arm/mach-exynos/include/mach/map.h +17 -0
index bd6fa02..cc190b9 100644
@@ -31,6 +31,23 @@
 #define EXYNOS5250_PA_SYSRAM_NS		0x0204F000
 #define EXYNOS5260_PA_SYSRAM_NS		0x02073000
 
+#define EXYNOS5260_PA_PMU				0x10D50000
+#define EXYNOS5260_PA_SROMC				0x12180000
+#define EXYNOS5260_PA_PWM				0x12D90000
+
+#define EXYNOS5260_PA_SYS_PERI				0x10220000
+#define EXYNOS5260_PA_SYS_MIF				0x10D00000
+#define EXYNOS5260_PA_SYS_MFC				0x110A0000
+#define EXYNOS5260_PA_SYS_KFC				0x10710000
+#define EXYNOS5260_PA_SYS_ISP				0x133E0000
+#define EXYNOS5260_PA_SYS_GSCL				0x13F20000
+#define EXYNOS5260_PA_SYS_G3D				0x11850000
+#define EXYNOS5260_PA_SYS_G2D				0x10A20000
+#define EXYNOS5260_PA_SYS_FSYS				0x122F0000
+#define EXYNOS5260_PA_SYS_EGL				0x10610000
+#define EXYNOS5260_PA_SYS_DISP				0x14540000
+#define EXYNOS5260_PA_SYS_AUD				0x128F0000
+
 #define EXYNOS_PA_CHIPID		0x10000000
 
 #define EXYNOS4_PA_SYSCON		0x10010000
arch/arm/mach-exynos/include/mach/regs-pmu.h +221 -0

237 lines not on this page · raw message

arch/arm/mach-exynos/pm.c +25 -8
index 78a22bf..c6def953 100644
@@ -58,7 +58,7 @@ static int exynos_cpu_suspend(unsigned long arg)
 	outer_flush_all();
 #endif
 
-	if (soc_is_exynos5250())
+	if (soc_is_exynos5250() || soc_is_exynos5260())
 		flush_cache_all();
 
 	/* issue the standby signal into the pm unit. */
@@ -117,9 +117,15 @@ static __init int exynos_pm_drvinit(void)
 
 	/* All wakeup disable */
 
-	tmp = __raw_readl(S5P_WAKEUP_MASK);
-	tmp |= ((0xFF << 8) | (0x1F << 1));
-	__raw_writel(tmp, S5P_WAKEUP_MASK);
+	if (soc_is_exynos5260()) {
+		tmp = __raw_readl(EXYNOS5260_WAKEUP_MASK);
+		tmp |= ((0xE << 12) | (0xE << 8) | (0x3 << 1));
+		__raw_writel(tmp, EXYNOS5260_WAKEUP_MASK);
+	} else {
+		tmp = __raw_readl(S5P_WAKEUP_MASK);
+		tmp |= ((0xFF << 8) | (0x1F << 1));
+		__raw_writel(tmp, S5P_WAKEUP_MASK);
+	}
 
 	return subsys_interface_register(&exynos_pm_interface);
 }
@@ -128,6 +134,7 @@ arch_initcall(exynos_pm_drvinit);
 static int exynos_pm_suspend(void)
 {
 	unsigned long tmp;
+	unsigned int cluster_id;
 
 	/* Setting Central Sequence Register for power down mode */
 
@@ -136,11 +143,21 @@ static int exynos_pm_suspend(void)
 	__raw_writel(tmp, S5P_CENTRAL_SEQ_CONFIGURATION);
 
 	/* Setting SEQ_OPTION register */
+	if (soc_is_exynos5250()) {
+		tmp = (S5P_USE_STANDBY_WFI0 | S5P_USE_STANDBY_WFE0);
+		__raw_writel(tmp, S5P_CENTRAL_SEQ_OPTION);
+	} else if (soc_is_exynos5260()) {
+		cluster_id = (read_cpuid(CPUID_MPIDR) >> 8) & 0xf;
+		if (!cluster_id)
+			__raw_writel(EXYNOS5260_ARM_USE_STANDBY_WFI0,
+				     S5P_CENTRAL_SEQ_OPTION);
+		else
+			__raw_writel(EXYNOS5260_KFC_USE_STANDBY_WFI0,
+				     S5P_CENTRAL_SEQ_OPTION);
 
-	tmp = (S5P_USE_STANDBY_WFI0 | S5P_USE_STANDBY_WFE0);
-	__raw_writel(tmp, S5P_CENTRAL_SEQ_OPTION);
+	}
 
-	if (!soc_is_exynos5250()) {
+	if (!soc_is_exynos5250() || !soc_is_exynos5260()) {
 		/* Save Power control register */
 		asm ("mrc p15, 0, %0, c15, c0, 0"
 		     : "=r" (tmp) : : "cc");
@@ -174,7 +191,7 @@ static void exynos_pm_resume(void)
 		/* No need to perform below restore code */
 		goto early_wakeup;
 	}
-	if (!soc_is_exynos5250()) {
+	if (!soc_is_exynos5250() || !soc_is_exynos5260()) {
 		/* Restore Power control register */
 		tmp = save_arm_register[0];
 		asm volatile ("mcr p15, 0, %0, c15, c0, 0"
arch/arm/mach-exynos/pmu.c +140 -0

158 lines not on this page · raw message

arch/arm/plat-samsung/include/plat/map-s5p.h +14 -0
index 804597c..c2d7fcf 100644
@@ -58,6 +58,20 @@
 #define S3C_UART_OFFSET		(0x400)
 #endif
 
+/* Exynos5260 specific definitions */
+#define EXYNOS5260_VA_SYS_PERI		S3C_ADDR(0x02848000)
+#define EXYNOS5260_VA_SYS_EGL           S3C_ADDR(0x0284C000)
+#define EXYNOS5260_VA_SYS_KFC           S3C_ADDR(0x02850000)
+#define EXYNOS5260_VA_SYS_G2D           S3C_ADDR(0x02854000)
+#define EXYNOS5260_VA_SYS_MIF           S3C_ADDR(0x02858000)
+#define EXYNOS5260_VA_SYS_MFC           S3C_ADDR(0x0285C000)
+#define EXYNOS5260_VA_SYS_G3D           S3C_ADDR(0x02860000)
+#define EXYNOS5260_VA_SYS_FSYS		S3C_ADDR(0x02864000)
+#define EXYNOS5260_VA_SYS_AUD           S3C_ADDR(0x02868000)
+#define EXYNOS5260_VA_SYS_ISP		S3C_ADDR(0x0286C000)
+#define EXYNOS5260_VA_SYS_GSCL          S3C_ADDR(0x02870000)
+#define EXYNOS5260_VA_SYS_DISP          S3C_ADDR(0x02874000)
+
 #include <plat/map-s3c.h>
 
 #endif /* __ASM_PLAT_MAP_S5P_H */
Signature · 1 line
1.7.12.4
#2 lore raw

PATCH 1/2 ARM: EXYNOS: Add initial support of PMU for Exynos5260

Hi Vikas, Pankaj,

Quoted 7 lines · On Wednesday 11 of December 2013 16:25:15 Vikas Sajjan wrote:

Adds initial PMU support for Exynos5260

Following are the changes done
------------------------------

1) Added initial PMU support for exynos5260

Quoted 8 lines

2) Added exynos5260_iodesc for mapping 5260 specific SFRs. We modified exynos5_map_io so that in case of exynos5260 only exynos5260_iodesc can be initialized.

3) Added new macros for WAKEUP MASK for 5260, and modified exynos_pm_drvinit accrodingly.

Change-Id: Ie585d47a499c17813cfe0e5a668072ca7b13ffb5

This line should be removed.

Quoted 11 lines
---
 arch/arm/mach-exynos/common.c                |  89 ++++++++++-
 arch/arm/mach-exynos/common.h                |   5 +
 arch/arm/mach-exynos/include/mach/map.h      |  17 +++
 arch/arm/mach-exynos/include/mach/regs-pmu.h | 221 +++++++++++++++++++++++++++
 arch/arm/mach-exynos/pm.c                    |  33 +++-
 arch/arm/mach-exynos/pmu.c                   | 140 +++++++++++++++++
 arch/arm/plat-samsung/include/plat/map-s5p.h |  14 ++
 7 files changed, 508 insertions(+), 11 deletions(-)

[snip]

Quoted 11 lines
arch/arm/mach-exynos/common.c +11 -0
+	}, {
+		.virtual	= (unsigned long)S5P_VA_SROMC,
+		.pfn		= __phys_to_pfn(EXYNOS5260_PA_SROMC),
+		.length		= SZ_4K,
+		.type		= MT_DEVICE,
+	}, {
+		.virtual	= (unsigned long)S5P_VA_SYSRAM,
+		.pfn		= __phys_to_pfn(EXYNOS5_PA_SYSRAM),
+		.length		= SZ_4K,
+		.type		= MT_DEVICE,
+	}, {

arch/arm/mach-exynos/common.c static struct map_desc exynos5_iodesc[] __initdata = { · line 359

Quoted 10 lines
arch/arm/mach-exynos/common.c +5 -0
 		.virtual	= (unsigned long)S5P_VA_SYSRAM_NS,
 		.pfn		= __phys_to_pfn(EXYNOS5260_PA_SYSRAM_NS),
 		.length		= SZ_4K,
 		.type		= MT_DEVICE,
+	}, {
+		.virtual	= (unsigned long)S5P_VA_PMU,
+		.pfn		= __phys_to_pfn(EXYNOS5260_PA_PMU),
+		.length		= SZ_64K,
+		.type		= MT_DEVICE,
 	},

Do you really need all these static mappings above? Why can't you create a mapping dynamically?

Quoted 2 lines

};

[snip]

arch/arm/mach-exynos/common.h enum sys_powerdown { · line 53

Quoted 13 lines

struct bus_type exynos_subsys = {

arch/arm/mach-exynos/common.h +4 -0
index ff9b6a9..e2cabfe 100644
@@ -47,6 +47,11 @@ enum sys_powerdown {
 	NUM_SYS_POWERDOWN,
 };
 
+enum running_cpu {
+	KFC,
+	ARM,
+};

This isn't too meaningful. You should write a comment saying how this enum is used and describing its values.

Also the name is too generic. It should be prefixed with exynos5260_ probably.

Quoted 19 lines
arch/arm/mach-exynos/common.h +1 -0
+
 extern unsigned long l2x0_regs_phys;
 struct exynos_pmu_conf {
 	void __iomem *reg;
arch/arm/mach-exynos/include/mach/map.h +7 -0
index bd6fa02..cc190b9 100644
@@ -31,6 +31,23 @@
 #define EXYNOS5250_PA_SYSRAM_NS		0x0204F000
 #define EXYNOS5260_PA_SYSRAM_NS		0x02073000
 
+#define EXYNOS5260_PA_PMU				0x10D50000
+#define EXYNOS5260_PA_SROMC				0x12180000
+#define EXYNOS5260_PA_PWM				0x12D90000
+
+#define EXYNOS5260_PA_SYS_PERI				0x10220000
+#define EXYNOS5260_PA_SYS_MIF				0x10D00000
+#define EXYNOS5260_PA_SYS_MFC				0x110A0000

arch/arm/mach-exynos/include/mach/map.h line 50

Quoted 10 lines
arch/arm/mach-exynos/include/mach/map.h +10 -0
+#define EXYNOS5260_PA_SYS_KFC				0x10710000
+#define EXYNOS5260_PA_SYS_ISP				0x133E0000
+#define EXYNOS5260_PA_SYS_GSCL				0x13F20000
+#define EXYNOS5260_PA_SYS_G3D				0x11850000
+#define EXYNOS5260_PA_SYS_G2D				0x10A20000
+#define EXYNOS5260_PA_SYS_FSYS				0x122F0000
+#define EXYNOS5260_PA_SYS_EGL				0x10610000
+#define EXYNOS5260_PA_SYS_DISP				0x14540000
+#define EXYNOS5260_PA_SYS_AUD				0x128F0000
+

Do you really need all the static addresses above?

Quoted 10 lines
arch/arm/mach-exynos/include/mach/map.h +0 -0
 #define EXYNOS_PA_CHIPID		0x10000000
 
 #define EXYNOS4_PA_SYSCON		0x10010000
arch/arm/mach-exynos/include/mach/regs-pmu.h +0 -0
index 09ae29a..ac53f85 100644
@@ -125,6 +125,25 @@
 #define S5P_ARM_CORE1_STATUS			S5P_PMUREG(0x2084)
 #define S5P_ARM_CORE1_OPTION			S5P_PMUREG(0x2088)

[snip]

Quoted 4 lines
arch/arm/mach-exynos/include/mach/regs-pmu.h +4 -0
+#define EXYNOS5260_CORE_LOCAL_PWR_EN				0xf
+#define EXYNOS5260_CPUS_PER_CLUSTER				4
+#define EXYNOS5260_USE_DELAYED_RESET_ASSERTION			(1 << 12)
+

arch/arm/mach-exynos/include/mach/regs-pmu.h line 427

Quoted 10 lines
arch/arm/mach-exynos/include/mach/regs-pmu.h +10 -0
+#define EXYNOS5260_WAKEUP_STAT2			S5P_PMUREG(0x0604)
+#define EXYNOS5260_WAKEUP_STAT3			S5P_PMUREG(0x0608)
+#define EXYNOS5260_EINT_WAKEUP_MASK		S5P_PMUREG(0x060C)
+#define EXYNOS5260_WAKEUP_MASK			S5P_PMUREG(0x0610)
+#define EXYNOS5260_WAKEUP_MASK2			S5P_PMUREG(0x0614)
+#define EXYNOS5260_WAKEUP_MASK3			S5P_PMUREG(0x0618)
+
+
+/* Exynos5260 specific PMU SYS_PWR_REGs */
+#define	EXYNOS5260_A15_EGL0_SYS_PWR_REG			S5P_PMUREG(0x1000)

CodingStyle: There should be just one space between #define and definiton name. The same for a lot of definitons below.

Quoted 4 lines
arch/arm/mach-exynos/include/mach/regs-pmu.h +4 -0
+#define	EXYNOS5260_DIS_IRQ_A15_EGL0_LOCAL_SYS_PWR_REG	S5P_PMUREG(0x1004)
+#define	EXYNOS5260_DIS_IRQ_A15_EGL0_CNTRL_SYS_PWR_REG	S5P_PMUREG(0x1008)
+#define	EXYNOS5260_DIS_IRQ_A15_EGL0_EGLSEQ_SYS_PWR_REG	S5P_PMUREG(0x100C)
+#define	EXYNOS5260_A15_EGL1_SYS_PWR_REG			S5P_PMUREG(0x1010)

[snip]

Quoted 10 lines
arch/arm/mach-exynos/include/mach/regs-pmu.h +10 -0
+/* CENTRAL_SEQ_OPTION */
+#define EXYNOS5260_ARM_USE_STANDBY_WFI0			(1 << 16)
+#define EXYNOS5260_ARM_USE_STANDBY_WFI1			(1 << 17)
+#define EXYNOS5260_KFC_USE_STANDBY_WFI0			(1 << 20)
+#define EXYNOS5260_KFC_USE_STANDBY_WFI1			(1 << 21)
+#define EXYNOS5260_KFC_USE_STANDBY_WFI2			(1 << 22)
+#define EXYNOS5260_KFC_USE_STANDBY_WFI3			(1 << 23)
+#define EXYNOS5260_ARM_USE_STANDBY_WFE0			(1 << 24)
+#define EXYNOS5260_ARM_USE_STANDBY_WFE1			(1 << 25)
+#define EXYNOS5260_KFC_USE_STANDBY_WFE0			(1 << 28)

arch/arm/mach-exynos/include/mach/regs-pmu.h line 590

Quoted 10 lines
arch/arm/mach-exynos/include/mach/regs-pmu.h +10 -0
+#define EXYNOS5260_KFC_USE_STANDBY_WFE1			(1 << 29)
+#define EXYNOS5260_KFC_USE_STANDBY_WFE2			(1 << 30)
+#define EXYNOS5260_KFC_USE_STANDBY_WFE3			(1 << 31)
+
+#define EXYNOS5260_USE_STANDBY_WFI_ALL	(EXYNOS5260_ARM_USE_STANDBY_WFI0  \
+					| EXYNOS5260_ARM_USE_STANDBY_WFI1  \
+					| EXYNOS5260_KFC_USE_STANDBY_WFI0  \
+					| EXYNOS5260_KFC_USE_STANDBY_WFI1  \
+					| EXYNOS5260_KFC_USE_STANDBY_WFI2  \
+					| EXYNOS5260_KFC_USE_STANDBY_WFI3)

This is not a definition of registers, so should be present in the file using it as a convenience macro.

Quoted 10 lines
arch/arm/mach-exynos/include/mach/regs-pmu.h +2 -0
+
+
 #endif /* __ASM_ARCH_REGS_PMU_H */
arch/arm/mach-exynos/pm.c +0 -0
index 78a22bf..c6def953 100644
@@ -58,7 +58,7 @@ static int exynos_cpu_suspend(unsigned long arg)
 	outer_flush_all();
 #endif

[snip]

arch/arm/mach-exynos/pm.c static int exynos_pm_suspend(void) · line 156

Quoted 12 lines
arch/arm/mach-exynos/pm.c +11 -0
 	/* Setting SEQ_OPTION register */
+	if (soc_is_exynos5250()) {
+		tmp = (S5P_USE_STANDBY_WFI0 | S5P_USE_STANDBY_WFE0);
+		__raw_writel(tmp, S5P_CENTRAL_SEQ_OPTION);
+	} else if (soc_is_exynos5260()) {
+		cluster_id = (read_cpuid(CPUID_MPIDR) >> 8) & 0xf;
+		if (!cluster_id)
+			__raw_writel(EXYNOS5260_ARM_USE_STANDBY_WFI0,
+				     S5P_CENTRAL_SEQ_OPTION);
+		else
+			__raw_writel(EXYNOS5260_KFC_USE_STANDBY_WFI0,
+				     S5P_CENTRAL_SEQ_OPTION);

Hmm, this seems strange. Shouldn't just a single particular CPU (CPU0 most likely) be allowed to enter standby such as the code for other Exynos SoCs is doing?

arch/arm/mach-exynos/pm.c static int exynos_pm_suspend(void) · line 160

Quoted 7 lines
arch/arm/mach-exynos/pm.c +2 -3
-	tmp = (S5P_USE_STANDBY_WFI0 | S5P_USE_STANDBY_WFE0);
-	__raw_writel(tmp, S5P_CENTRAL_SEQ_OPTION);
+	}
 
-	if (!soc_is_exynos5250()) {
+	if (!soc_is_exynos5250() || !soc_is_exynos5260()) {

Is this condition really correct? It doesn't make much sense.

arch/arm/mach-exynos/pm.c static void exynos_pm_resume(void) · line 194

Quoted 9 lines
arch/arm/mach-exynos/pm.c +1 -1
 		/* Save Power control register */
 		asm ("mrc p15, 0, %0, c15, c0, 0"
 		     : "=r" (tmp) : : "cc");
@@ -174,7 +191,7 @@ static void exynos_pm_resume(void)
 		/* No need to perform below restore code */
 		goto early_wakeup;
 	}
-	if (!soc_is_exynos5250()) {
+	if (!soc_is_exynos5250() || !soc_is_exynos5260()) {

Ditto.

Quoted 10 lines
arch/arm/mach-exynos/pm.c +0 -0
 		/* Restore Power control register */
 		tmp = save_arm_register[0];
 		asm volatile ("mcr p15, 0, %0, c15, c0, 0"
arch/arm/mach-exynos/pmu.c +0 -0
index 97d6885..c828d07 100644
@@ -317,6 +317,99 @@ static struct exynos_pmu_conf exynos5250_pmu_config[] = {
 	{ PMU_TABLE_END,},
 };

[snip]

arch/arm/mach-exynos/pmu.c void exynos_sys_powerdown_conf(enum sys_powerdown mode) · line 495

Quoted 12 lines
arch/arm/mach-exynos/pmu.c +12 -0
+static void exynos5260_reset_assert_ctrl(bool on, enum running_cpu cluster)
+{
+	unsigned int i;
+	unsigned int option;
+	unsigned int cpu_s, cpu_f;
+
+	if (cluster == KFC) {
+		cpu_s = EXYNOS5260_CPUS_PER_CLUSTER;
+		cpu_f = cpu_s + EXYNOS5260_CPUS_PER_CLUSTER;
+	} else {
+		cpu_s = 0;
+		cpu_f = 2;

Hmm, a magic number. I wonder what it means. It doesn't seem to be the Answer to the Ultimate Question of Life, The Universe, and Everything, though. ;)

[1] http://en.wikipedia.org/wiki/Phrases_from_The_Hitchhiker's_Guide_to_the_Galaxy#Answer_to_the_Ultimate_Question_of_Life.2C_the_Universe.2C_and_Everything_.2842.29

arch/arm/mach-exynos/pmu.c void exynos_sys_powerdown_conf(enum sys_powerdown mode) · line 502

Quoted 7 lines
arch/arm/mach-exynos/pmu.c +7 -0
+	}
+
+	for (i = cpu_s; i < cpu_f; i++) {
+		option = __raw_readl(EXYNOS_ARM_CORE_OPTION(i));
+		option = on ?
+		(option | EXYNOS5260_USE_DELAYED_RESET_ASSERTION) :
+			(option & ~EXYNOS5260_USE_DELAYED_RESET_ASSERTION);

Readability of this is quite poor. I'd recommend rewriting this to a simple

		if (on)
			option |= EXYNOS5260_USE_DELAYED_RESET_ASSERTION;
		else
			option &= ~EXYNOS5260_USE_DELAYED_RESET_ASSERTION;
Quoted 19 lines
arch/arm/mach-exynos/pmu.c +12 -0
+		__raw_writel(option, EXYNOS_ARM_CORE_OPTION(i));
+	}
+}
+
+
 static int __init exynos_pmu_init(void)
 {
 	unsigned int value;
@@ -415,6 +532,29 @@ static int __init exynos_pmu_init(void)
 
 		exynos_pmu_config = exynos5250_pmu_config;
 		pr_info("EXYNOS5250 PMU Initialize\n");
+	} else if (soc_is_exynos5260()) {
+		/* Enable USE_STANDBY_WFI for all CORE */
+		__raw_writel(EXYNOS5260_USE_STANDBY_WFI_ALL,
+			S5P_CENTRAL_SEQ_OPTION);
+		/*
+		 * Set PSHOLD port for output high
+		 */

arch/arm/mach-exynos/pmu.c static int __init exynos_pmu_init(void) · line 551

Quoted 10 lines
arch/arm/mach-exynos/pmu.c +10 -0
+		value = __raw_readl(EXYNOS_PS_HOLD_CONTROL);
+		value |= EXYNOS_PS_HOLD_OUTPUT_HIGH;
+		__raw_writel(value, EXYNOS_PS_HOLD_CONTROL);
+
+		/*
+		 * Enable signal for PSHOLD port
+		 */
+		value = __raw_readl(EXYNOS_PS_HOLD_CONTROL);
+		value |= EXYNOS_PS_HOLD_EN;
+		__raw_writel(value, EXYNOS_PS_HOLD_CONTROL);

Hmm, do you really need this? What about boards with different polarity of power hold signal in used PMIC? I believe this should be set correctly by the bootloader and never changed later, except in power off callback.

Best regards,
Tomasz

#3 lore raw

PATCH 1/2 ARM: EXYNOS: Add initial support of PMU for Exynos5260

Hi Tomasz,

Quoted 14 lines · Tomasz Figa

Hi Vikas, Pankaj,

Quoted 11 lines · On Wednesday 11 of December 2013 16:25:15 Vikas Sajjan wrote:

Adds initial PMU support for Exynos5260

Following are the changes done
------------------------------

1) Added initial PMU support for exynos5260

2) Added exynos5260_iodesc for mapping 5260 specific SFRs. We modified exynos5_map_io so that in case of exynos5260 only exynos5260_iodesc can be initialized.

Quoted 6 lines
Quoted 4 lines

3) Added new macros for WAKEUP MASK for 5260, and modified exynos_pm_drvinit accrodingly.

Change-Id: Ie585d47a499c17813cfe0e5a668072ca7b13ffb5

This line should be removed.

Yeah, right.

Quoted 35 lines
Quoted 12 lines
---
 arch/arm/mach-exynos/common.c                |  89 ++++++++++-
 arch/arm/mach-exynos/common.h                |   5 +
 arch/arm/mach-exynos/include/mach/map.h      |  17 +++
 arch/arm/mach-exynos/include/mach/regs-pmu.h | 221 +++++++++++++++++++++++++++
 arch/arm/mach-exynos/pm.c                    |  33 +++-
 arch/arm/mach-exynos/pmu.c                   | 140 +++++++++++++++++
 arch/arm/plat-samsung/include/plat/map-s5p.h |  14 ++
 7 files changed, 508 insertions(+), 11 deletions(-)

[snip]

Quoted 11 lines
arch/arm/mach-exynos/common.c +11 -0
+     }, {
+             .virtual        = (unsigned long)S5P_VA_SROMC,
+             .pfn            = __phys_to_pfn(EXYNOS5260_PA_SROMC),
+             .length         = SZ_4K,
+             .type           = MT_DEVICE,
+     }, {
+             .virtual        = (unsigned long)S5P_VA_SYSRAM,
+             .pfn            = __phys_to_pfn(EXYNOS5_PA_SYSRAM),
+             .length         = SZ_4K,
+             .type           = MT_DEVICE,
+     }, {

arch/arm/mach-exynos/common.c static struct map_desc exynos5_iodesc[] __initdata = { · line 359

Quoted 10 lines
arch/arm/mach-exynos/common.c +5 -0
              .virtual        = (unsigned long)S5P_VA_SYSRAM_NS,
              .pfn            = __phys_to_pfn(EXYNOS5260_PA_SYSRAM_NS),
              .length         = SZ_4K,
              .type           = MT_DEVICE,
+     }, {
+             .virtual        = (unsigned long)S5P_VA_PMU,
+             .pfn            = __phys_to_pfn(EXYNOS5260_PA_PMU),
+             .length         = SZ_64K,
+             .type           = MT_DEVICE,
      },
Quoted 2 lines

Do you really need all these static mappings above? Why can't you create a mapping dynamically?

Sure, will keep only required static mapping like PMU.

Quoted 21 lines
Quoted 3 lines

};

[snip]

arch/arm/mach-exynos/common.h enum sys_powerdown { · line 53

Quoted 13 lines

struct bus_type exynos_subsys = {

arch/arm/mach-exynos/common.h +4 -0
index ff9b6a9..e2cabfe 100644
@@ -47,6 +47,11 @@ enum sys_powerdown {
      NUM_SYS_POWERDOWN,
 };
 
+enum running_cpu {
+     KFC,
+     ARM,
+};

This isn't too meaningful. You should write a comment saying how this enum is used and describing its values.

Quoted 2 lines

Also the name is too generic. It should be prefixed with exynos5260_ probably.

Sure, will modify it as EXYNOS5_KFC and EXYNOS5_ARM, so that it can be used by 5420 also, if needed.

Quoted 24 lines
Quoted 24 lines
arch/arm/mach-exynos/common.h +1 -0
+
 extern unsigned long l2x0_regs_phys;
 struct exynos_pmu_conf {
      void __iomem *reg;
arch/arm/mach-exynos/include/mach/map.h +11 -0
index bd6fa02..cc190b9 100644
@@ -31,6 +31,23 @@
 #define EXYNOS5250_PA_SYSRAM_NS              0x0204F000
 #define EXYNOS5260_PA_SYSRAM_NS              0x02073000
 
+#define EXYNOS5260_PA_PMU                            0x10D50000
+#define EXYNOS5260_PA_SROMC                          0x12180000
+#define EXYNOS5260_PA_PWM                            0x12D90000
+
+#define EXYNOS5260_PA_SYS_PERI                               0x10220000
+#define EXYNOS5260_PA_SYS_MIF                                0x10D00000
+#define EXYNOS5260_PA_SYS_MFC                                0x110A0000
+#define EXYNOS5260_PA_SYS_KFC                                0x10710000
+#define EXYNOS5260_PA_SYS_ISP                                0x133E0000
+#define EXYNOS5260_PA_SYS_GSCL                               0x13F20000
+#define EXYNOS5260_PA_SYS_G3D                                0x11850000
Quoted 8 lines

arch/arm/mach-exynos/include/mach/map.h line 50

Quoted 6 lines
arch/arm/mach-exynos/include/mach/map.h +6 -0
+#define EXYNOS5260_PA_SYS_G2D                                0x10A20000
+#define EXYNOS5260_PA_SYS_FSYS                               0x122F0000
+#define EXYNOS5260_PA_SYS_EGL                                0x10610000
+#define EXYNOS5260_PA_SYS_DISP                               0x14540000
+#define EXYNOS5260_PA_SYS_AUD                                0x128F0000
+

Do you really need all the static addresses above?

Will remove them.

Quoted 21 lines
Quoted 11 lines
arch/arm/mach-exynos/include/mach/map.h +0 -0
 #define EXYNOS_PA_CHIPID             0x10000000
 
 #define EXYNOS4_PA_SYSCON            0x10010000
arch/arm/mach-exynos/include/mach/regs-pmu.h +0 -0
index 09ae29a..ac53f85 100644
@@ -125,6 +125,25 @@
 #define S5P_ARM_CORE1_STATUS                 S5P_PMUREG(0x2084)
 #define S5P_ARM_CORE1_OPTION                 S5P_PMUREG(0x2088)

[snip]

Quoted 9 lines
arch/arm/mach-exynos/include/mach/regs-pmu.h +9 -0
+#define EXYNOS5260_CORE_LOCAL_PWR_EN                         0xf
+#define EXYNOS5260_CPUS_PER_CLUSTER                          4
+#define EXYNOS5260_USE_DELAYED_RESET_ASSERTION                       (1 << 12)
+
+#define EXYNOS5260_WAKEUP_STAT2                      S5P_PMUREG(0x0604)
+#define EXYNOS5260_WAKEUP_STAT3                      S5P_PMUREG(0x0608)
+#define EXYNOS5260_EINT_WAKEUP_MASK          S5P_PMUREG(0x060C)
+#define EXYNOS5260_WAKEUP_MASK                       S5P_PMUREG(0x0610)
+#define EXYNOS5260_WAKEUP_MASK2                      S5P_PMUREG(0x0614)
Quoted 8 lines

arch/arm/mach-exynos/include/mach/regs-pmu.h line 427

Quoted 5 lines
arch/arm/mach-exynos/include/mach/regs-pmu.h +5 -0
+#define EXYNOS5260_WAKEUP_MASK3                      S5P_PMUREG(0x0618)
+
+
+/* Exynos5260 specific PMU SYS_PWR_REGs */
+#define      EXYNOS5260_A15_EGL0_SYS_PWR_REG                 S5P_PMUREG(0x1000)

CodingStyle: There should be just one space between #define and definiton name. The same for a lot of definitons below.

OK.

Quoted 21 lines
Quoted 5 lines
arch/arm/mach-exynos/include/mach/regs-pmu.h +4 -0
+#define      EXYNOS5260_DIS_IRQ_A15_EGL0_LOCAL_SYS_PWR_REG   S5P_PMUREG(0x1004)
+#define      EXYNOS5260_DIS_IRQ_A15_EGL0_CNTRL_SYS_PWR_REG   S5P_PMUREG(0x1008)
+#define      EXYNOS5260_DIS_IRQ_A15_EGL0_EGLSEQ_SYS_PWR_REG  S5P_PMUREG(0x100C)
+#define      EXYNOS5260_A15_EGL1_SYS_PWR_REG                 S5P_PMUREG(0x1010)

[snip]

Quoted 15 lines
arch/arm/mach-exynos/include/mach/regs-pmu.h +15 -0
+/* CENTRAL_SEQ_OPTION */
+#define EXYNOS5260_ARM_USE_STANDBY_WFI0                      (1 << 16)
+#define EXYNOS5260_ARM_USE_STANDBY_WFI1                      (1 << 17)
+#define EXYNOS5260_KFC_USE_STANDBY_WFI0                      (1 << 20)
+#define EXYNOS5260_KFC_USE_STANDBY_WFI1                      (1 << 21)
+#define EXYNOS5260_KFC_USE_STANDBY_WFI2                      (1 << 22)
+#define EXYNOS5260_KFC_USE_STANDBY_WFI3                      (1 << 23)
+#define EXYNOS5260_ARM_USE_STANDBY_WFE0                      (1 << 24)
+#define EXYNOS5260_ARM_USE_STANDBY_WFE1                      (1 << 25)
+#define EXYNOS5260_KFC_USE_STANDBY_WFE0                      (1 << 28)
+#define EXYNOS5260_KFC_USE_STANDBY_WFE1                      (1 << 29)
+#define EXYNOS5260_KFC_USE_STANDBY_WFE2                      (1 << 30)
+#define EXYNOS5260_KFC_USE_STANDBY_WFE3                      (1 << 31)
+
+#define EXYNOS5260_USE_STANDBY_WFI_ALL       (EXYNOS5260_ARM_USE_STANDBY_WFI0  \
Quoted 8 lines

arch/arm/mach-exynos/include/mach/regs-pmu.h line 590

Quoted 5 lines
arch/arm/mach-exynos/include/mach/regs-pmu.h +5 -0
+                                     | EXYNOS5260_ARM_USE_STANDBY_WFI1  \
+                                     | EXYNOS5260_KFC_USE_STANDBY_WFI0  \
+                                     | EXYNOS5260_KFC_USE_STANDBY_WFI1  \
+                                     | EXYNOS5260_KFC_USE_STANDBY_WFI2  \
+                                     | EXYNOS5260_KFC_USE_STANDBY_WFI3)

This is not a definition of registers, so should be present in the file using it as a convenience macro.

OK.

Quoted 25 lines
Quoted 11 lines
arch/arm/mach-exynos/include/mach/regs-pmu.h +2 -0
+
+
 #endif /* __ASM_ARCH_REGS_PMU_H */
arch/arm/mach-exynos/pm.c +0 -0
index 78a22bf..c6def953 100644
@@ -58,7 +58,7 @@ static int exynos_cpu_suspend(unsigned long arg)
      outer_flush_all();
 #endif

[snip]

arch/arm/mach-exynos/pm.c static int exynos_pm_suspend(void) · line 156

Quoted 12 lines
      /* Setting SEQ_OPTION register */
arch/arm/mach-exynos/pm.c +11 -0
+     if (soc_is_exynos5250()) {
+             tmp = (S5P_USE_STANDBY_WFI0 | S5P_USE_STANDBY_WFE0);
+             __raw_writel(tmp, S5P_CENTRAL_SEQ_OPTION);
+     } else if (soc_is_exynos5260()) {
+             cluster_id = (read_cpuid(CPUID_MPIDR) >> 8) & 0xf;
+             if (!cluster_id)
+                     __raw_writel(EXYNOS5260_ARM_USE_STANDBY_WFI0,
+                                  S5P_CENTRAL_SEQ_OPTION);
+             else
+                     __raw_writel(EXYNOS5260_KFC_USE_STANDBY_WFI0,
+                                  S5P_CENTRAL_SEQ_OPTION);
Quoted 3 lines

Hmm, this seems strange. Shouldn't just a single particular CPU (CPU0 most likely) be allowed to enter standby such as the code for other Exynos SoCs is doing?

We need to handle the case where the primary CPU can be KFC also.

Quoted 10 lines

arch/arm/mach-exynos/pm.c static int exynos_pm_suspend(void) · line 160

Quoted 8 lines
arch/arm/mach-exynos/pm.c +2 -3
-     tmp = (S5P_USE_STANDBY_WFI0 | S5P_USE_STANDBY_WFE0);
-     __raw_writel(tmp, S5P_CENTRAL_SEQ_OPTION);
+     }
 
-     if (!soc_is_exynos5250()) {
+     if (!soc_is_exynos5250() || !soc_is_exynos5260()) {

Is this condition really correct? It doesn't make much sense.

Will modify.

Quoted 12 lines

arch/arm/mach-exynos/pm.c static void exynos_pm_resume(void) · line 194

Quoted 10 lines
              /* Save Power control register */
              asm ("mrc p15, 0, %0, c15, c0, 0"
                   : "=r" (tmp) : : "cc");
arch/arm/mach-exynos/pm.c +1 -1
@@ -174,7 +191,7 @@ static void exynos_pm_resume(void)
              /* No need to perform below restore code */
              goto early_wakeup;
      }
-     if (!soc_is_exynos5250()) {
+     if (!soc_is_exynos5250() || !soc_is_exynos5260()) {

Ditto.

Will modify.

Quoted 12 lines
Quoted 11 lines
arch/arm/mach-exynos/pm.c +0 -0
              /* Restore Power control register */
              tmp = save_arm_register[0];
              asm volatile ("mcr p15, 0, %0, c15, c0, 0"
arch/arm/mach-exynos/pmu.c +0 -0
index 97d6885..c828d07 100644
@@ -317,6 +317,99 @@ static struct exynos_pmu_conf exynos5250_pmu_config[] = {
      { PMU_TABLE_END,},
 };

[snip]

Quoted 16 lines

arch/arm/mach-exynos/pmu.c void exynos_sys_powerdown_conf(enum sys_powerdown mode) · line 495

Quoted 12 lines
arch/arm/mach-exynos/pmu.c +12 -0
+static void exynos5260_reset_assert_ctrl(bool on, enum running_cpu cluster)
+{
+     unsigned int i;
+     unsigned int option;
+     unsigned int cpu_s, cpu_f;
+
+     if (cluster == KFC) {
+             cpu_s = EXYNOS5260_CPUS_PER_CLUSTER;
+             cpu_f = cpu_s + EXYNOS5260_CPUS_PER_CLUSTER;
+     } else {
+             cpu_s = 0;
+             cpu_f = 2;

Hmm, a magic number. I wonder what it means. It doesn't seem to be the Answer to the Ultimate Question of Life, The Universe, and Everything, though. ;)

:-) Will modify.

Quoted 11 lines

[1] http://en.wikipedia.org/wiki/Phrases_from_The_Hitchhiker's_Guide_to_the_Galaxy#Answer_to_the_Ultimate_Question_of_Life.2C_the_Universe.2C_and_Everything_.2842.29

arch/arm/mach-exynos/pmu.c void exynos_sys_powerdown_conf(enum sys_powerdown mode) · line 502

Quoted 7 lines
arch/arm/mach-exynos/pmu.c +7 -0
+     }
+
+     for (i = cpu_s; i < cpu_f; i++) {
+             option = __raw_readl(EXYNOS_ARM_CORE_OPTION(i));
+             option = on ?
+             (option | EXYNOS5260_USE_DELAYED_RESET_ASSERTION) :
+                     (option & ~EXYNOS5260_USE_DELAYED_RESET_ASSERTION);
Quoted 2 lines

Readability of this is quite poor. I'd recommend rewriting this to a simple

Sure.

Quoted 31 lines
                if (on)
                        option |= EXYNOS5260_USE_DELAYED_RESET_ASSERTION;
                else
                        option &= ~EXYNOS5260_USE_DELAYED_RESET_ASSERTION;
Quoted 25 lines
arch/arm/mach-exynos/pmu.c +18 -0
+             __raw_writel(option, EXYNOS_ARM_CORE_OPTION(i));
+     }
+}
+
+
 static int __init exynos_pmu_init(void)
 {
      unsigned int value;
@@ -415,6 +532,29 @@ static int __init exynos_pmu_init(void)
 
              exynos_pmu_config = exynos5250_pmu_config;
              pr_info("EXYNOS5250 PMU Initialize\n");
+     } else if (soc_is_exynos5260()) {
+             /* Enable USE_STANDBY_WFI for all CORE */
+             __raw_writel(EXYNOS5260_USE_STANDBY_WFI_ALL,
+                     S5P_CENTRAL_SEQ_OPTION);
+             /*
+              * Set PSHOLD port for output high
+              */
+             value = __raw_readl(EXYNOS_PS_HOLD_CONTROL);
+             value |= EXYNOS_PS_HOLD_OUTPUT_HIGH;
+             __raw_writel(value, EXYNOS_PS_HOLD_CONTROL);
+
+             /*
+              * Enable signal for PSHOLD port
Quoted 8 lines

arch/arm/mach-exynos/pmu.c static int __init exynos_pmu_init(void) · line 551

Quoted 4 lines
arch/arm/mach-exynos/pmu.c +4 -0
+              */
+             value = __raw_readl(EXYNOS_PS_HOLD_CONTROL);
+             value |= EXYNOS_PS_HOLD_EN;
+             __raw_writel(value, EXYNOS_PS_HOLD_CONTROL);

Hmm, do you really need this? What about boards with different polarity of power hold signal in used PMIC? I believe this should be set correctly by the bootloader and never changed later, except in power off callback.

Right, can be removed.

Quoted 9 lines

Best regards,
Tomasz

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#4 lore raw

PATCH 2/2 ARM: EXYNOS: Add CMU virtual addresses for exynos5260

In reply to Vikas Sajjan

From: Young-Gun Jang <[email protected]>

Adds CMU virtual addresses for exynos5260.

Change-Id Ia4f4eda96187d8d9e1edfc1a6b025af56d3bc43e
---
 arch/arm/mach-exynos/common.c                  | 65 ++++++++++++++++++++++++++
 arch/arm/mach-exynos/include/mach/map.h        | 14 ++++++
 arch/arm/mach-exynos/include/mach/regs-clock.h | 17 +++++++
 arch/arm/plat-samsung/include/plat/map-s5p.h   | 16 +++++++
 4 files changed, 112 insertions(+)
arch/arm/mach-exynos/common.c +65 -0
index 70da5c4..350b730 100644
@@ -332,6 +332,71 @@ static struct map_desc exynos5260_iodesc[] __initdata = {
 		.length		= SZ_16K,
 		.type		= MT_DEVICE,
 	}, {
+		.virtual	= (unsigned long)EXYNOS5260_VA_CMU_TOP,
+		.pfn		= __phys_to_pfn(EXYNOS5260_PA_CMU_TOP),
+		.length		= SZ_4K,
+		.type		= MT_DEVICE,
+	}, {
+		.virtual	= (unsigned long)EXYNOS5260_VA_CMU_PERI,
+		.pfn		= __phys_to_pfn(EXYNOS5260_PA_CMU_PERI),
+		.length		= SZ_4K,
+		.type		= MT_DEVICE,
+	}, {
+		.virtual	= (unsigned long)EXYNOS5260_VA_CMU_EGL,
+		.pfn		= __phys_to_pfn(EXYNOS5260_PA_CMU_EGL),
+		.length		= SZ_8K,
+		.type		= MT_DEVICE,
+	}, {
+		.virtual	= (unsigned long)EXYNOS5260_VA_CMU_KFC,
+		.pfn		= __phys_to_pfn(EXYNOS5260_PA_CMU_KFC),
+		.length		= SZ_8K,
+		.type		= MT_DEVICE,
+	}, {
+		.virtual	= (unsigned long)EXYNOS5260_VA_CMU_G2D,
+		.pfn		= __phys_to_pfn(EXYNOS5260_PA_CMU_G2D),
+		.length		= SZ_4K,
+		.type		= MT_DEVICE,
+	}, {
+		.virtual	= (unsigned long)EXYNOS5260_VA_CMU_MIF,
+		.pfn		= __phys_to_pfn(EXYNOS5260_PA_CMU_MIF),
+		.length		= SZ_8K,
+		.type		= MT_DEVICE,
+	}, {
+		.virtual	= (unsigned long)EXYNOS5260_VA_CMU_MFC,
+		.pfn		= __phys_to_pfn(EXYNOS5260_PA_CMU_MFC),
+		.length		= SZ_4K,
+		.type		= MT_DEVICE,
+	}, {
+		.virtual	= (unsigned long)EXYNOS5260_VA_CMU_G3D,
+		.pfn		= __phys_to_pfn(EXYNOS5260_PA_CMU_G3D),
+		.length		= SZ_8K,
+		.type		= MT_DEVICE,
+	}, {
+		.virtual	= (unsigned long)EXYNOS5260_VA_CMU_FSYS,
+		.pfn		= __phys_to_pfn(EXYNOS5260_PA_CMU_FSYS),
+		.length		= SZ_4K,
+		.type		= MT_DEVICE,
+	}, {
+		.virtual	= (unsigned long)EXYNOS5260_VA_CMU_AUD,
+		.pfn		= __phys_to_pfn(EXYNOS5260_PA_CMU_AUD),
+		.length		= SZ_4K,
+		.type		= MT_DEVICE,
+	}, {
+		.virtual	= (unsigned long)EXYNOS5260_VA_CMU_ISP,
+		.pfn		= __phys_to_pfn(EXYNOS5260_PA_CMU_ISP),
+		.length		= SZ_8K,
+		.type		= MT_DEVICE,
+	}, {
+		.virtual	= (unsigned long)EXYNOS5260_VA_CMU_GSCL,
+		.pfn		= __phys_to_pfn(EXYNOS5260_PA_CMU_GSCL),
+		.length		= SZ_4K,
+		.type		= MT_DEVICE,
+	}, {
+		.virtual	= (unsigned long)EXYNOS5260_VA_CMU_DISP,
+		.pfn		= __phys_to_pfn(EXYNOS5260_PA_CMU_DISP),
+		.length		= SZ_4K,
+		.type		= MT_DEVICE,
+	}, {
 		.virtual	= (unsigned long)S3C_VA_WATCHDOG,
 		.pfn		= __phys_to_pfn(EXYNOS5_PA_WATCHDOG),
 		.length		= SZ_4K,
arch/arm/mach-exynos/include/mach/map.h +14 -0
index cc190b9..fa1b565 100644
@@ -48,6 +48,20 @@
 #define EXYNOS5260_PA_SYS_DISP				0x14540000
 #define EXYNOS5260_PA_SYS_AUD				0x128F0000
 
+#define EXYNOS5260_PA_CMU_TOP                          0x10010000
+#define EXYNOS5260_PA_CMU_PERI                         0x10200000
+#define EXYNOS5260_PA_CMU_EGL                          0x10600000
+#define EXYNOS5260_PA_CMU_KFC                          0x10700000
+#define EXYNOS5260_PA_CMU_G2D                          0x10A00000
+#define EXYNOS5260_PA_CMU_MIF                          0x10CE0000
+#define EXYNOS5260_PA_CMU_MFC                          0x11090000
+#define EXYNOS5260_PA_CMU_G3D                          0x11830000
+#define EXYNOS5260_PA_CMU_FSYS                         0x122E0000
+#define EXYNOS5260_PA_CMU_AUD                          0x128C0000
+#define EXYNOS5260_PA_CMU_ISP                          0x133C0000
+#define EXYNOS5260_PA_CMU_GSCL                         0x13F00000
+#define EXYNOS5260_PA_CMU_DISP                         0x14550000
+
 #define EXYNOS_PA_CHIPID		0x10000000
 
 #define EXYNOS4_PA_SYSCON		0x10010000
arch/arm/mach-exynos/include/mach/regs-clock.h +17 -0
index d36ad76..1c568d0 100644
@@ -365,6 +365,23 @@
 
 /* Compatibility defines and inclusion */
 
+
+/* For EXYNOS5260 */
+#define EXYNOS_CLKREG_TOP(x)                    (EXYNOS5260_VA_CMU_TOP + (x))
+#define EXYNOS_CLKREG_PERI(x)                   (EXYNOS5260_VA_CMU_PERI + (x))
+#define EXYNOS_CLKREG_EGL(x)                    (EXYNOS5260_VA_CMU_EGL + (x))
+#define EXYNOS_CLKREG_KFC(x)                    (EXYNOS5260_VA_CMU_KFC + (x))
+#define EXYNOS_CLKREG_G2D(x)                    (EXYNOS5260_VA_CMU_G2D + (x))
+#define EXYNOS_CLKREG_MIF(x)                    (EXYNOS5260_VA_CMU_MIF + (x))
+#define EXYNOS_CLKREG_MFC(x)                    (EXYNOS5260_VA_CMU_MFC + (x))
+#define EXYNOS_CLKREG_G3D(x)                    (EXYNOS5260_VA_CMU_G3D + (x))
+#define EXYNOS_CLKREG_FSYS(x)                   (EXYNOS5260_VA_CMU_FSYS + (x))
+#define EXYNOS_CLKREG_AUD(x)                    (EXYNOS5260_VA_CMU_AUD + (x))
+#define EXYNOS_CLKREG_ISP(x)                    (EXYNOS5260_VA_CMU_ISP + (x))
+#define EXYNOS_CLKREG_GSCL(x)                   (EXYNOS5260_VA_CMU_GSCL + (x))
+#define EXYNOS_CLKREG_DISP(x)                   (EXYNOS5260_VA_CMU_DISP + (x))
+
+
 #include <mach/regs-pmu.h>
 
 #define S5P_EPLL_CON				EXYNOS4_EPLL_CON0
arch/arm/plat-samsung/include/plat/map-s5p.h +16 -0
index c2d7fcf..32966c8 100644
@@ -72,6 +72,22 @@
 #define EXYNOS5260_VA_SYS_GSCL          S3C_ADDR(0x02870000)
 #define EXYNOS5260_VA_SYS_DISP          S3C_ADDR(0x02874000)
 
+
+#define EXYNOS5260_VA_CMU_TOP           (S5P_VA_CMU + (SZ_4K * 1))
+#define EXYNOS5260_VA_CMU_PERI          (S5P_VA_CMU + (SZ_4K * 2))
+#define EXYNOS5260_VA_CMU_EGL           (S5P_VA_CMU + (SZ_4K * 3))
+#define EXYNOS5260_VA_CMU_KFC           (S5P_VA_CMU + (SZ_4K * 5))
+#define EXYNOS5260_VA_CMU_G2D           (S5P_VA_CMU + (SZ_4K * 7))
+#define EXYNOS5260_VA_CMU_MIF           (S5P_VA_CMU + (SZ_4K * 8))
+#define EXYNOS5260_VA_CMU_MFC           (S5P_VA_CMU + (SZ_4K * 10))
+#define EXYNOS5260_VA_CMU_G3D           (S5P_VA_CMU + (SZ_4K * 11))
+#define EXYNOS5260_VA_CMU_FSYS          (S5P_VA_CMU + (SZ_4K * 13))
+#define EXYNOS5260_VA_CMU_AUD           (S5P_VA_CMU + (SZ_4K * 14))
+#define EXYNOS5260_VA_CMU_ISP           (S5P_VA_CMU + (SZ_4K * 15))
+#define EXYNOS5260_VA_CMU_GSCL          (S5P_VA_CMU + (SZ_4K * 17))
+#define EXYNOS5260_VA_CMU_DISP          (S5P_VA_CMU + (SZ_4K * 18))
+
+
 #include <plat/map-s3c.h>
 
 #endif /* __ASM_PLAT_MAP_S5P_H */
Signature · 1 line
1.7.12.4
#5 lore raw

PATCH 2/2 ARM: EXYNOS: Add CMU virtual addresses for exynos5260

Hi Vikas, Young-Gun,

Quoted 5 lines · On Wednesday 11 of December 2013 16:25:16 Vikas Sajjan wrote:

From: Young-Gun Jang <[email protected]>

Adds CMU virtual addresses for exynos5260.

Change-Id: Ia4f4eda96187d8d9e1edfc1a6b025af56d3bc43e

This line should be dropped.

Quoted 8 lines
---
 arch/arm/mach-exynos/common.c                  | 65 ++++++++++++++++++++++++++
 arch/arm/mach-exynos/include/mach/map.h        | 14 ++++++
 arch/arm/mach-exynos/include/mach/regs-clock.h | 17 +++++++
 arch/arm/plat-samsung/include/plat/map-s5p.h   | 16 +++++++
 4 files changed, 112 insertions(+)

Why do you need those static mappings? Unless there is a reason to map those registers very early (before ioremap() and friends are available) I'm going to NAK any additions of static mappings.

Best regards,
Tomasz