Skip to contentSkip to conversation

ARM: SAMSUNG: Add Support Power Domain Control

PATCH Superseded Kukjin Kim 3 participants 6 messages Oct 13, 2010 – Oct 29, 2010

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Kukjin Kim

author
#0 lore raw

cover ARM: SAMSUNG: Add Support Power Domain Control

This patch adds support Power Domain Control based on Runtim PM.

Each Power Domain is represented by a Power Domain device and the devices belong to these Power Domains should be set as a child device of the Power Domain devices. The corresponding drivers of the devices should implement Runtime PM to control the Power Domains.

NOTE: Depends on EINT and GPIOlib.

[PATCH 1/2] ARM: SAMSUNG: Add support for Power Domain control [PATCH 2/2] ARM: S5PV310: Add support Power Domain

author
#1 lore raw

PATCH 1/2 ARM: SAMSUNG: Add support for Power Domain control

From: Changhwan Youn <[email protected]>

This patch implements Power Domain control based on Runtime PM framework. Each Power Domain is represented by a Power Domain device and the devices belong to these Power Domains should be set as a child device of the Power Domain devices. The corresponding drivers of the devices should implement Runtime PM to control the Power Domains.

---
NOTE: This depends on EINT and GPIOlib.

 arch/arm/plat-samsung/Kconfig           |    8 +++
 arch/arm/plat-samsung/Makefile          |    4 +
 arch/arm/plat-samsung/include/plat/pd.h |   41 +++++++++++++
 arch/arm/plat-samsung/pd.c              |  100 +++++++++++++++++++++++++++++++
 4 files changed, 153 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/plat-samsung/include/plat/pd.h
 create mode 100644 arch/arm/plat-samsung/pd.c
arch/arm/plat-samsung/Kconfig +8 -0
index dcd6eff..2ebf415 100644
@@ -333,4 +333,12 @@ config SAMSUNG_WAKEMASK
 	  and above. This code allows a set of interrupt to wakeup-mask
 	  mappings. See <plat/wakeup-mask.h>
 
+comment "Power Domain"
+
+config SAMSUNG_PD
+	bool "Samsung Power Domain"
+	depends on PM_RUNTIME
+	help
+	  Say Y here if you want to control Power Domain by Runtime PM.
+
 endif
arch/arm/plat-samsung/Makefile +4 -0
index afcce47..09dbd78 100644
@@ -73,6 +73,10 @@ obj-$(CONFIG_SAMSUNG_PM_CHECK)	+= pm-check.o
 
 obj-$(CONFIG_SAMSUNG_WAKEMASK)	+= wakeup-mask.o
 
+# PD support
+
+obj-$(CONFIG_SAMSUNG_PD)	+= pd.o
+
 # PWM support
 
 obj-$(CONFIG_HAVE_PWM)		+= pwm.o
arch/arm/plat-samsung/include/plat/pd.h new file +41 -0

41 lines not on this page · raw message

arch/arm/plat-samsung/pd.c new file +100 -0

100 lines not on this page · raw message

Signature · 1 line
1.6.2.5
author
#2 lore raw

PATCH 2/2 ARM: S5PV310: Add support Power Domain

In reply to Kukjin Kim

From: Changhwan Youn <[email protected]>

This patch adds support Power Domain for S5PV310 and S5PC210.

---
 arch/arm/mach-s5pv310/Kconfig                 |    7 +
 arch/arm/mach-s5pv310/Makefile                |    2 +
 arch/arm/mach-s5pv310/cpu.c                   |    5 +
 arch/arm/mach-s5pv310/dev-pd.c                |  249 +++++++++++++++++++++++++
 arch/arm/mach-s5pv310/include/mach/map.h      |    2 +
 arch/arm/mach-s5pv310/include/mach/regs-pmu.h |   40 ++++
 arch/arm/mach-s5pv310/mach-smdkc210.c         |    9 +
 arch/arm/mach-s5pv310/mach-smdkv310.c         |    9 +
 arch/arm/plat-s5p/include/plat/map-s5p.h      |    1 +
 arch/arm/plat-samsung/include/plat/devs.h     |    2 +
 10 files changed, 326 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-s5pv310/dev-pd.c
 create mode 100644 arch/arm/mach-s5pv310/include/mach/regs-pmu.h
arch/arm/mach-s5pv310/Kconfig +7 -0
index 1150b36..3bf72a6 100644
@@ -14,6 +14,11 @@ config CPU_S5PV310
 	help
 	  Enable S5PV310 CPU support
 
+config S5PV310_DEV_PD
+	bool
+	help
+	  Compile in platform device definitions for Power Domain
+
 config S5PV310_SETUP_I2C1
 	bool
 	help
@@ -73,6 +78,7 @@ config MACH_SMDKC210
 	select S3C_DEV_HSMMC1
 	select S3C_DEV_HSMMC2
 	select S3C_DEV_HSMMC3
+	select S5PV310_DEV_PD
 	select S5PV310_SETUP_SDHCI
 	help
 	  Machine support for Samsung SMDKC210
@@ -101,6 +107,7 @@ config MACH_SMDKV310
 	select S3C_DEV_HSMMC1
 	select S3C_DEV_HSMMC2
 	select S3C_DEV_HSMMC3
+	select S5PV310_DEV_PD
 	select S5PV310_SETUP_SDHCI
 	help
 	  Machine support for Samsung SMDKV310
arch/arm/mach-s5pv310/Makefile +2 -0
index 97aba6d..74beb47 100644
@@ -28,6 +28,8 @@ obj-$(CONFIG_MACH_UNIVERSAL_C210)	+= mach-universal_c210.o
 
 # device support
 
+obj-$(CONFIG_S5PV310_DEV_PD)		+= dev-pd.o
+
 obj-$(CONFIG_S5PV310_SETUP_I2C1)	+= setup-i2c1.o
 obj-$(CONFIG_S5PV310_SETUP_I2C2)	+= setup-i2c2.o
 obj-$(CONFIG_S5PV310_SETUP_I2C3)	+= setup-i2c3.o
arch/arm/mach-s5pv310/cpu.c +5 -0
index ffed262..44ddad6 100644
@@ -42,6 +42,11 @@ static struct map_desc s5pv310_iodesc[] __initdata = {
 		.length		= SZ_128K,
 		.type		= MT_DEVICE,
 	}, {
+		.virtual	= (unsigned long)S5P_VA_PMU,
+		.pfn		= __phys_to_pfn(S5PV310_PA_PMU),
+		.length		= SZ_64K,
+		.type		= MT_DEVICE,
+	}, {
 		.virtual	= (unsigned long)S5P_VA_COMBINER_BASE,
 		.pfn		= __phys_to_pfn(S5PV310_PA_COMBINER),
 		.length		= SZ_4K,
arch/arm/mach-s5pv310/dev-pd.c new file +249 -0

249 lines not on this page · raw message

arch/arm/mach-s5pv310/include/mach/map.h +2 -0
index 1429510..9decf02 100644
@@ -37,6 +37,8 @@
 #define S5PV310_PA_SYSCON		(0x10010000)
 #define S5P_PA_SYSCON			S5PV310_PA_SYSCON
 
+#define S5PV310_PA_PMU			(0x10020000)
+
 #define S5PV310_PA_CMU			(0x10030000)
 
 #define S5PV310_PA_WATCHDOG		(0x10060000)
arch/arm/mach-s5pv310/include/mach/regs-pmu.h new file +40 -0
new file mode 100644
index 0000000..f4b2229
@@ -0,0 +1,40 @@
+/* linux/arch/arm/mach-s5pv310/include/mach/regs-pmu.h
+ *
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com
+ *
+ * S5PV310 - Power management unit definition
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#ifndef __ASM_ARCH_REGS_PMU_H
+#define __ASM_ARCH_REGS_PMU_H __FILE__
+
+#include <mach/map.h>
+
+#define S5P_PMUREG(x)				(S5P_VA_PMU + (x))
+
+#define S5P_CAM_CONFIGURATION			S5P_PMUREG(0x3C00)
+#define S5P_CAM_STATUS				S5P_PMUREG(0x3C04)
+
+#define S5P_TV_CONFIGURATION			S5P_PMUREG(0x3C20)
+#define S5P_TV_STATUS				S5P_PMUREG(0x3C24)
+
+#define S5P_MFC_CONFIGURATION			S5P_PMUREG(0x3C40)
+#define S5P_MFC_STATUS				S5P_PMUREG(0x3C44)
+
+#define S5P_G3D_CONFIGURATION			S5P_PMUREG(0x3C60)
+#define S5P_G3D_STATUS				S5P_PMUREG(0x3C64)
+
+#define S5P_LCD0_CONFIGURATION			S5P_PMUREG(0x3C80)
+#define S5P_LCD0_STATUS				S5P_PMUREG(0x3C84)
+
+#define S5P_LCD1_CONFIGURATION			S5P_PMUREG(0x3CA0)
+#define S5P_LCD1_STATUS				S5P_PMUREG(0x3CA4)
+
+#define S5P_INT_LOCAL_PWR_EN			0x7
+
+#endif /* __ASM_ARCH_REGS_PMU_H */
arch/arm/mach-s5pv310/mach-smdkc210.c +9 -0
index d2cf694..390befd 100644
@@ -22,6 +22,7 @@
 #include <plat/cpu.h>
 #include <plat/devs.h>
 #include <plat/sdhci.h>
+#include <plat/pd.h>
 
 #include <mach/map.h>
 
@@ -113,6 +114,12 @@ static struct platform_device *smdkc210_devices[] __initdata = {
 	&s3c_device_hsmmc3,
 	&s3c_device_rtc,
 	&s3c_device_wdt,
+	&s5pv310_device_pd[PD_MFC],
+	&s5pv310_device_pd[PD_G3D],
+	&s5pv310_device_pd[PD_LCD0],
+	&s5pv310_device_pd[PD_LCD1],
+	&s5pv310_device_pd[PD_CAM],
+	&s5pv310_device_pd[PD_TV],
 };
 
 static void __init smdkc210_map_io(void)
@@ -124,6 +131,8 @@ static void __init smdkc210_map_io(void)
 
 static void __init smdkc210_machine_init(void)
 {
+	samsung_pd_init();
+
 	s3c_sdhci0_set_platdata(&smdkc210_hsmmc0_pdata);
 	s3c_sdhci1_set_platdata(&smdkc210_hsmmc1_pdata);
 	s3c_sdhci2_set_platdata(&smdkc210_hsmmc2_pdata);
arch/arm/mach-s5pv310/mach-smdkv310.c +9 -0
index 10f8056..c6690cf 100644
@@ -22,6 +22,7 @@
 #include <plat/cpu.h>
 #include <plat/devs.h>
 #include <plat/sdhci.h>
+#include <plat/pd.h>
 
 #include <mach/map.h>
 
@@ -113,6 +114,12 @@ static struct platform_device *smdkv310_devices[] __initdata = {
 	&s3c_device_hsmmc3,
 	&s3c_device_rtc,
 	&s3c_device_wdt,
+	&s5pv310_device_pd[PD_MFC],
+	&s5pv310_device_pd[PD_G3D],
+	&s5pv310_device_pd[PD_LCD0],
+	&s5pv310_device_pd[PD_LCD1],
+	&s5pv310_device_pd[PD_CAM],
+	&s5pv310_device_pd[PD_TV],
 };
 
 static void __init smdkv310_map_io(void)
@@ -124,6 +131,8 @@ static void __init smdkv310_map_io(void)
 
 static void __init smdkv310_machine_init(void)
 {
+	samsung_pd_init();
+
 	s3c_sdhci0_set_platdata(&smdkv310_hsmmc0_pdata);
 	s3c_sdhci1_set_platdata(&smdkv310_hsmmc1_pdata);
 	s3c_sdhci2_set_platdata(&smdkv310_hsmmc2_pdata);
arch/arm/plat-s5p/include/plat/map-s5p.h +1 -0
index fef353d..d973d39 100644
@@ -15,6 +15,7 @@
 
 #define S5P_VA_CHIPID		S3C_ADDR(0x02000000)
 #define S5P_VA_CMU		S3C_ADDR(0x02100000)
+#define S5P_VA_PMU		S3C_ADDR(0x02180000)
 #define S5P_VA_GPIO		S3C_ADDR(0x02200000)
 #define S5P_VA_GPIO1		S5P_VA_GPIO
 #define S5P_VA_GPIO2		S3C_ADDR(0x02240000)
arch/arm/plat-samsung/include/plat/devs.h +2 -0
index 71bcc0f..c483480 100644
@@ -118,6 +118,8 @@ extern struct platform_device s5p_device_fimc0;
 extern struct platform_device s5p_device_fimc1;
 extern struct platform_device s5p_device_fimc2;
 
+extern struct platform_device s5pv310_device_pd[];
+
 /* s3c2440 specific devices */
 
 #ifdef CONFIG_CPU_S3C2440
Signature · 1 line
1.6.2.5
#3 lore raw

PATCH 2/2 ARM: S5PV310: Add support Power Domain

Hello,

Quoted 287 lines · Kukjin Kim

From: Changhwan Youn <[email protected]>

This patch adds support Power Domain for S5PV310 and S5PC210.

---
 arch/arm/mach-s5pv310/Kconfig                 |    7 +
 arch/arm/mach-s5pv310/Makefile                |    2 +
 arch/arm/mach-s5pv310/cpu.c                   |    5 +
 arch/arm/mach-s5pv310/dev-pd.c                |  249 +++++++++++++++++++++++++
 arch/arm/mach-s5pv310/include/mach/map.h      |    2 +
 arch/arm/mach-s5pv310/include/mach/regs-pmu.h |   40 ++++
 arch/arm/mach-s5pv310/mach-smdkc210.c         |    9 +
 arch/arm/mach-s5pv310/mach-smdkv310.c         |    9 +
 arch/arm/plat-s5p/include/plat/map-s5p.h      |    1 +
 arch/arm/plat-samsung/include/plat/devs.h     |    2 +
 10 files changed, 326 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-s5pv310/dev-pd.c
 create mode 100644 arch/arm/mach-s5pv310/include/mach/regs-pmu.h
arch/arm/mach-s5pv310/Kconfig +7 -0
index 1150b36..3bf72a6 100644
@@ -14,6 +14,11 @@ config CPU_S5PV310
 	help
 	  Enable S5PV310 CPU support
 
+config S5PV310_DEV_PD
+	bool
+	help
+	  Compile in platform device definitions for Power Domain
+
 config S5PV310_SETUP_I2C1
 	bool
 	help
@@ -73,6 +78,7 @@ config MACH_SMDKC210
 	select S3C_DEV_HSMMC1
 	select S3C_DEV_HSMMC2
 	select S3C_DEV_HSMMC3
+	select S5PV310_DEV_PD
 	select S5PV310_SETUP_SDHCI
 	help
 	  Machine support for Samsung SMDKC210
@@ -101,6 +107,7 @@ config MACH_SMDKV310
 	select S3C_DEV_HSMMC1
 	select S3C_DEV_HSMMC2
 	select S3C_DEV_HSMMC3
+	select S5PV310_DEV_PD
 	select S5PV310_SETUP_SDHCI
 	help
 	  Machine support for Samsung SMDKV310
arch/arm/mach-s5pv310/Makefile +2 -0
index 97aba6d..74beb47 100644
@@ -28,6 +28,8 @@ obj-$(CONFIG_MACH_UNIVERSAL_C210)	+= mach-universal_c210.o
 
 # device support
 
+obj-$(CONFIG_S5PV310_DEV_PD)		+= dev-pd.o
+
 obj-$(CONFIG_S5PV310_SETUP_I2C1)	+= setup-i2c1.o
 obj-$(CONFIG_S5PV310_SETUP_I2C2)	+= setup-i2c2.o
 obj-$(CONFIG_S5PV310_SETUP_I2C3)	+= setup-i2c3.o
arch/arm/mach-s5pv310/cpu.c +5 -0
index ffed262..44ddad6 100644
@@ -42,6 +42,11 @@ static struct map_desc s5pv310_iodesc[] __initdata = {
 		.length		= SZ_128K,
 		.type		= MT_DEVICE,
 	}, {
+		.virtual	= (unsigned long)S5P_VA_PMU,
+		.pfn		= __phys_to_pfn(S5PV310_PA_PMU),
+		.length		= SZ_64K,
+		.type		= MT_DEVICE,
+	}, {
 		.virtual	= (unsigned long)S5P_VA_COMBINER_BASE,
 		.pfn		= __phys_to_pfn(S5PV310_PA_COMBINER),
 		.length		= SZ_4K,
arch/arm/mach-s5pv310/dev-pd.c new file +199 -0
new file mode 100644
index 0000000..ac5a1f8
@@ -0,0 +1,249 @@
+/* linux/arch/arm/mach-s5pv310/dev-pd.c
+ *
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com
+ *
+ * S5PV310 - Power Domain support
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#include <linux/io.h>
+#include <linux/kernel.h>
+#include <linux/platform_device.h>
+#include <linux/delay.h>
+
+#include <mach/regs-pmu.h>
+
+#include <plat/pd.h>
+
+static int s5pv310_pd_enable(enum s5pv310_pd_block pd)
+{
+	void __iomem *status;
+	u32 timeout;
+
+	switch (pd) {
+	case PD_MFC:
+		__raw_writel(S5P_INT_LOCAL_PWR_EN, S5P_MFC_CONFIGURATION);
+		status = S5P_MFC_STATUS;
+		break;
+	case PD_G3D:
+		__raw_writel(S5P_INT_LOCAL_PWR_EN, S5P_G3D_CONFIGURATION);
+		status = S5P_G3D_STATUS;
+		break;
+	case PD_LCD0:
+		__raw_writel(S5P_INT_LOCAL_PWR_EN, S5P_LCD0_CONFIGURATION);
+		status = S5P_LCD0_STATUS;
+		break;
+	case PD_LCD1:
+		__raw_writel(S5P_INT_LOCAL_PWR_EN, S5P_LCD1_CONFIGURATION);
+		status = S5P_LCD1_STATUS;
+		break;
+	case PD_CAM:
+		__raw_writel(S5P_INT_LOCAL_PWR_EN, S5P_CAM_CONFIGURATION);
+		status = S5P_CAM_STATUS;
+		break;
+	case PD_TV:
+		__raw_writel(S5P_INT_LOCAL_PWR_EN, S5P_TV_CONFIGURATION);
+		status = S5P_TV_STATUS;
+		break;
+	default:
+		printk(KERN_WARNING "Wrong PD enable request %d\n", pd);
+		return -EINVAL;
+	}
+
+	/* Wait max 1ms */
+	timeout = 10;
+	while ((__raw_readl(status) & S5P_INT_LOCAL_PWR_EN)
+		!= S5P_INT_LOCAL_PWR_EN) {
+		if (timeout == 0) {
+			printk(KERN_ERR "Power domain %d enable failed.\n", pd);
+			return -ETIMEDOUT;
+		}
+		timeout--;
+		udelay(100);
+	}
+
+	return 0;
+}
+
+static int s5pv310_pd_disable(enum s5pv310_pd_block pd)
+{
+	void __iomem *status;
+	u32 timeout;
+
+	switch (pd) {
+	case PD_MFC:
+		__raw_writel(0, S5P_MFC_CONFIGURATION);
+		status = S5P_MFC_STATUS;
+		break;
+	case PD_G3D:
+		__raw_writel(0, S5P_G3D_CONFIGURATION);
+		status = S5P_G3D_STATUS;
+		break;
+	case PD_LCD0:
+		__raw_writel(0, S5P_LCD0_CONFIGURATION);
+		status = S5P_LCD0_STATUS;
+		break;
+	case PD_LCD1:
+		__raw_writel(0, S5P_LCD1_CONFIGURATION);
+		status = S5P_LCD1_STATUS;
+		break;
+	case PD_CAM:
+		__raw_writel(0, S5P_CAM_CONFIGURATION);
+		status = S5P_CAM_STATUS;
+		break;
+	case PD_TV:
+		__raw_writel(0, S5P_TV_CONFIGURATION);
+		status = S5P_TV_STATUS;
+		break;
+	default:
+		printk(KERN_WARNING "Wrong PD disable request %d\n", pd);
+		return -EINVAL;
+	}
+
+	/* Wait max 1ms */
+	timeout = 10;
+	while (__raw_readl(status) & S5P_INT_LOCAL_PWR_EN) {
+		if (timeout == 0) {
+			printk(KERN_ERR "PD %d disable failed.\n", pd);
+			return -ETIMEDOUT;
+		}
+		timeout--;
+		udelay(100);
+	}
+
+	return 0;
+}
+
+static int s5pv310_pd_mfc_enable(void)
+{
+	return s5pv310_pd_enable(PD_MFC);
+}
+
+static int s5pv310_pd_mfc_disable(void)
+{
+	return s5pv310_pd_disable(PD_MFC);
+}
+
+static int s5pv310_pd_g3d_enable(void)
+{
+	return s5pv310_pd_enable(PD_G3D);
+}
+
+static int s5pv310_pd_g3d_disable(void)
+{
+	return s5pv310_pd_disable(PD_G3D);
+}
+
+static int s5pv310_pd_lcd0_enable(void)
+{
+	return s5pv310_pd_enable(PD_LCD0);
+}
+
+static int s5pv310_pd_lcd0_disable(void)
+{
+	return s5pv310_pd_disable(PD_LCD0);
+}
+
+static int s5pv310_pd_lcd1_enable(void)
+{
+	return s5pv310_pd_enable(PD_LCD1);
+}
+
+static int s5pv310_pd_lcd1_disable(void)
+{
+	return s5pv310_pd_disable(PD_LCD1);
+}
+
+static int s5pv310_pd_cam_enable(void)
+{
+	return s5pv310_pd_enable(PD_CAM);
+}
+
+static int s5pv310_pd_cam_disable(void)
+{
+	return s5pv310_pd_disable(PD_CAM);
+}
+
+static int s5pv310_pd_tv_enable(void)
+{
+	return s5pv310_pd_enable(PD_TV);
+}
+
+static int s5pv310_pd_tv_disable(void)
+{
+	return s5pv310_pd_disable(PD_TV);
+}
+
+static struct samsung_pd_info s5pv310_pd_mfc_pdata = {
+	.enable		= s5pv310_pd_mfc_enable,
+	.disable	= s5pv310_pd_mfc_disable,
+};
+
+static struct samsung_pd_info s5pv310_pd_g3d_pdata = {
+	.enable		= s5pv310_pd_g3d_enable,
+	.disable	= s5pv310_pd_g3d_disable,
+};
+
+static struct samsung_pd_info s5pv310_pd_lcd0_pdata = {
+	.enable		= s5pv310_pd_lcd0_enable,
+	.disable	= s5pv310_pd_lcd0_disable,
+};
+
+static struct samsung_pd_info s5pv310_pd_lcd1_pdata = {
+	.enable		= s5pv310_pd_lcd1_enable,
+	.disable	= s5pv310_pd_lcd1_disable,
+};

arch/arm/mach-s5pv310/dev-pd.c line 209

Quoted 10 lines
arch/arm/mach-s5pv310/dev-pd.c new file +10 -0
+
+static struct samsung_pd_info s5pv310_pd_tv_pdata = {
+	.enable		= s5pv310_pd_tv_enable,
+	.disable	= s5pv310_pd_tv_disable,
+};
+
+static struct samsung_pd_info s5pv310_pd_cam_pdata = {
+	.enable		= s5pv310_pd_cam_enable,
+	.disable	= s5pv310_pd_cam_disable,
+};

You can probably get rid of all the above by adding a few more entries to struct samsung_pd_info. Just think of adding a u32 reg, status, on_value, off_value and maybe a mask. In such case all power domain devices can be handled by the same function which will read all needed data from device's platform_data.

arch/arm/mach-s5pv310/dev-pd.c line 217

Quoted 7 lines
arch/arm/mach-s5pv310/dev-pd.c new file +7 -0
+struct platform_device s5pv310_device_pd[] = {
+	{
+		.name		= "samsung-pd",
+		.id		= 0,
+		.dev = {
+			.platform_data = &s5pv310_pd_mfc_pdata,
+		},

You can use embedded structure definition to make the code a bit easier to read (I've also added the entries from the previous comment):

.dev = {
	.platform_data = &(struct samsung_pd_info) {
		.enable	= s5pv310_pd_enable,
		.disable	= s5pv310_pd_disable,
		.reg		= S5P_MFC_CONFIGURATION,
		.status	= S5P_MFC_STATUS,
		.on_value	= S5P_INT_LOCAL_PWR_EN,
		.mask		= 0x7,
	},
},
Quoted 186 lines
arch/arm/mach-s5pv310/dev-pd.c new file +32 -0
+	}, {
+		.name		= "samsung-pd",
+		.id		= 1,
+		.dev = {
+			.platform_data = &s5pv310_pd_g3d_pdata,
+		},
+	}, {
+		.name		= "samsung-pd",
+		.id		= 2,
+		.dev = {
+			.platform_data = &s5pv310_pd_lcd0_pdata,
+		},
+	}, {
+		.name		= "samsung-pd",
+		.id		= 3,
+		.dev = {
+			.platform_data = &s5pv310_pd_lcd1_pdata,
+		},
+	}, {
+		.name		= "samsung-pd",
+		.id		= 4,
+		.dev = {
+			.platform_data = &s5pv310_pd_tv_pdata,
+		},
+	}, {
+		.name		= "samsung-pd",
+		.id		= 5,
+		.dev = {
+			.platform_data = &s5pv310_pd_cam_pdata,
+		},
+	},
+};
arch/arm/mach-s5pv310/include/mach/map.h +2 -0
index 1429510..9decf02 100644
@@ -37,6 +37,8 @@
 #define S5PV310_PA_SYSCON		(0x10010000)
 #define S5P_PA_SYSCON			S5PV310_PA_SYSCON
 
+#define S5PV310_PA_PMU			(0x10020000)
+
 #define S5PV310_PA_CMU			(0x10030000)
 
 #define S5PV310_PA_WATCHDOG		(0x10060000)
arch/arm/mach-s5pv310/include/mach/regs- renamed from arch/arm/mach-s5pv310/include/mach/regs-pmu.h +0 -0

pmu.h
new file mode 100644
index 0000000..f4b2229

arch/arm/mach-s5pv310/include/mach/regs-pmu.h new file +40 -0
@@ -0,0 +1,40 @@
+/* linux/arch/arm/mach-s5pv310/include/mach/regs-pmu.h
+ *
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com
+ *
+ * S5PV310 - Power management unit definition
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#ifndef __ASM_ARCH_REGS_PMU_H
+#define __ASM_ARCH_REGS_PMU_H __FILE__
+
+#include <mach/map.h>
+
+#define S5P_PMUREG(x)				(S5P_VA_PMU + (x))
+
+#define S5P_CAM_CONFIGURATION			S5P_PMUREG(0x3C00)
+#define S5P_CAM_STATUS				S5P_PMUREG(0x3C04)
+
+#define S5P_TV_CONFIGURATION			S5P_PMUREG(0x3C20)
+#define S5P_TV_STATUS				S5P_PMUREG(0x3C24)
+
+#define S5P_MFC_CONFIGURATION			S5P_PMUREG(0x3C40)
+#define S5P_MFC_STATUS				S5P_PMUREG(0x3C44)
+
+#define S5P_G3D_CONFIGURATION			S5P_PMUREG(0x3C60)
+#define S5P_G3D_STATUS				S5P_PMUREG(0x3C64)
+
+#define S5P_LCD0_CONFIGURATION			S5P_PMUREG(0x3C80)
+#define S5P_LCD0_STATUS				S5P_PMUREG(0x3C84)
+
+#define S5P_LCD1_CONFIGURATION			S5P_PMUREG(0x3CA0)
+#define S5P_LCD1_STATUS				S5P_PMUREG(0x3CA4)
+
+#define S5P_INT_LOCAL_PWR_EN			0x7
+
+#endif /* __ASM_ARCH_REGS_PMU_H */
arch/arm/mach-s5pv310/mach-smdkc210.c +9 -0
index d2cf694..390befd 100644
@@ -22,6 +22,7 @@
 #include <plat/cpu.h>
 #include <plat/devs.h>
 #include <plat/sdhci.h>
+#include <plat/pd.h>
 
 #include <mach/map.h>
 
@@ -113,6 +114,12 @@ static struct platform_device *smdkc210_devices[] __initdata = {
 	&s3c_device_hsmmc3,
 	&s3c_device_rtc,
 	&s3c_device_wdt,
+	&s5pv310_device_pd[PD_MFC],
+	&s5pv310_device_pd[PD_G3D],
+	&s5pv310_device_pd[PD_LCD0],
+	&s5pv310_device_pd[PD_LCD1],
+	&s5pv310_device_pd[PD_CAM],
+	&s5pv310_device_pd[PD_TV],
 };
 
 static void __init smdkc210_map_io(void)
@@ -124,6 +131,8 @@ static void __init smdkc210_map_io(void)
 
 static void __init smdkc210_machine_init(void)
 {
+	samsung_pd_init();
+
 	s3c_sdhci0_set_platdata(&smdkc210_hsmmc0_pdata);
 	s3c_sdhci1_set_platdata(&smdkc210_hsmmc1_pdata);
 	s3c_sdhci2_set_platdata(&smdkc210_hsmmc2_pdata);
arch/arm/mach-s5pv310/mach-smdkv310.c +9 -0
index 10f8056..c6690cf 100644
@@ -22,6 +22,7 @@
 #include <plat/cpu.h>
 #include <plat/devs.h>
 #include <plat/sdhci.h>
+#include <plat/pd.h>
 
 #include <mach/map.h>
 
@@ -113,6 +114,12 @@ static struct platform_device *smdkv310_devices[] __initdata = {
 	&s3c_device_hsmmc3,
 	&s3c_device_rtc,
 	&s3c_device_wdt,
+	&s5pv310_device_pd[PD_MFC],
+	&s5pv310_device_pd[PD_G3D],
+	&s5pv310_device_pd[PD_LCD0],
+	&s5pv310_device_pd[PD_LCD1],
+	&s5pv310_device_pd[PD_CAM],
+	&s5pv310_device_pd[PD_TV],
 };
 
 static void __init smdkv310_map_io(void)
@@ -124,6 +131,8 @@ static void __init smdkv310_map_io(void)
 
 static void __init smdkv310_machine_init(void)
 {
+	samsung_pd_init();
+
 	s3c_sdhci0_set_platdata(&smdkv310_hsmmc0_pdata);
 	s3c_sdhci1_set_platdata(&smdkv310_hsmmc1_pdata);
 	s3c_sdhci2_set_platdata(&smdkv310_hsmmc2_pdata);
arch/arm/plat-s5p/include/plat/map-s5p.h +1 -0
index fef353d..d973d39 100644
@@ -15,6 +15,7 @@
 
 #define S5P_VA_CHIPID		S3C_ADDR(0x02000000)
 #define S5P_VA_CMU		S3C_ADDR(0x02100000)
+#define S5P_VA_PMU		S3C_ADDR(0x02180000)
 #define S5P_VA_GPIO		S3C_ADDR(0x02200000)
 #define S5P_VA_GPIO1		S5P_VA_GPIO
 #define S5P_VA_GPIO2		S3C_ADDR(0x02240000)
arch/arm/plat-samsung/include/plat/devs.h +2 -1
index 71bcc0f..c483480 100644
@@ -118,6 +118,8 @@ extern struct platform_device s5p_device_fimc0;
 extern struct platform_device s5p_device_fimc1;
 extern struct platform_device s5p_device_fimc2;
 
+extern struct platform_device s5pv310_device_pd[];
+
 /* s3c2440 specific devices */
 
 #ifdef CONFIG_CPU_S3C2440
--
Quoted 1 line

1.6.2.5

Best regards
--
Marek Szyprowski
Samsung Poland R&D Center

#4 lore raw

PATCH 2/2 ARM: S5PV310: Add support Power Domain

In reply to Kukjin Kim
Quoted 295 lines · Kukjin Kim

From: Changhwan Youn <[email protected]>

This patch adds support Power Domain for S5PV310 and S5PC210.

---
 arch/arm/mach-s5pv310/Kconfig                 |    7 +
 arch/arm/mach-s5pv310/Makefile                |    2 +
 arch/arm/mach-s5pv310/cpu.c                   |    5 +
 arch/arm/mach-s5pv310/dev-pd.c                |  249 +++++++++++++++++++++++++
 arch/arm/mach-s5pv310/include/mach/map.h      |    2 +
 arch/arm/mach-s5pv310/include/mach/regs-pmu.h |   40 ++++
 arch/arm/mach-s5pv310/mach-smdkc210.c         |    9 +
 arch/arm/mach-s5pv310/mach-smdkv310.c         |    9 +
 arch/arm/plat-s5p/include/plat/map-s5p.h      |    1 +
 arch/arm/plat-samsung/include/plat/devs.h     |    2 +
 10 files changed, 326 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-s5pv310/dev-pd.c
 create mode 100644 arch/arm/mach-s5pv310/include/mach/regs-pmu.h
arch/arm/mach-s5pv310/Kconfig +7 -0
index 1150b36..3bf72a6 100644
@@ -14,6 +14,11 @@ config CPU_S5PV310
 	help
 	  Enable S5PV310 CPU support
 
+config S5PV310_DEV_PD
+	bool
+	help
+	  Compile in platform device definitions for Power Domain
+
 config S5PV310_SETUP_I2C1
 	bool
 	help
@@ -73,6 +78,7 @@ config MACH_SMDKC210
 	select S3C_DEV_HSMMC1
 	select S3C_DEV_HSMMC2
 	select S3C_DEV_HSMMC3
+	select S5PV310_DEV_PD
 	select S5PV310_SETUP_SDHCI
 	help
 	  Machine support for Samsung SMDKC210
@@ -101,6 +107,7 @@ config MACH_SMDKV310
 	select S3C_DEV_HSMMC1
 	select S3C_DEV_HSMMC2
 	select S3C_DEV_HSMMC3
+	select S5PV310_DEV_PD
 	select S5PV310_SETUP_SDHCI
 	help
 	  Machine support for Samsung SMDKV310
arch/arm/mach-s5pv310/Makefile +2 -0
index 97aba6d..74beb47 100644
@@ -28,6 +28,8 @@ obj-$(CONFIG_MACH_UNIVERSAL_C210)	+= mach-universal_c210.o
 
 # device support
 
+obj-$(CONFIG_S5PV310_DEV_PD)		+= dev-pd.o
+
 obj-$(CONFIG_S5PV310_SETUP_I2C1)	+= setup-i2c1.o
 obj-$(CONFIG_S5PV310_SETUP_I2C2)	+= setup-i2c2.o
 obj-$(CONFIG_S5PV310_SETUP_I2C3)	+= setup-i2c3.o
arch/arm/mach-s5pv310/cpu.c +5 -0
index ffed262..44ddad6 100644
@@ -42,6 +42,11 @@ static struct map_desc s5pv310_iodesc[] __initdata = {
 		.length		= SZ_128K,
 		.type		= MT_DEVICE,
 	}, {
+		.virtual	= (unsigned long)S5P_VA_PMU,
+		.pfn		= __phys_to_pfn(S5PV310_PA_PMU),
+		.length		= SZ_64K,
+		.type		= MT_DEVICE,
+	}, {
 		.virtual	= (unsigned long)S5P_VA_COMBINER_BASE,
 		.pfn		= __phys_to_pfn(S5PV310_PA_COMBINER),
 		.length		= SZ_4K,
arch/arm/mach-s5pv310/dev-pd.c new file +207 -0
new file mode 100644
index 0000000..ac5a1f8
@@ -0,0 +1,249 @@
+/* linux/arch/arm/mach-s5pv310/dev-pd.c
+ *
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com
+ *
+ * S5PV310 - Power Domain support
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#include <linux/io.h>
+#include <linux/kernel.h>
+#include <linux/platform_device.h>
+#include <linux/delay.h>
+
+#include <mach/regs-pmu.h>
+
+#include <plat/pd.h>
+
+static int s5pv310_pd_enable(enum s5pv310_pd_block pd)
+{
+	void __iomem *status;
+	u32 timeout;
+
+	switch (pd) {
+	case PD_MFC:
+		__raw_writel(S5P_INT_LOCAL_PWR_EN, S5P_MFC_CONFIGURATION);
+		status = S5P_MFC_STATUS;
+		break;
+	case PD_G3D:
+		__raw_writel(S5P_INT_LOCAL_PWR_EN, S5P_G3D_CONFIGURATION);
+		status = S5P_G3D_STATUS;
+		break;
+	case PD_LCD0:
+		__raw_writel(S5P_INT_LOCAL_PWR_EN, S5P_LCD0_CONFIGURATION);
+		status = S5P_LCD0_STATUS;
+		break;
+	case PD_LCD1:
+		__raw_writel(S5P_INT_LOCAL_PWR_EN, S5P_LCD1_CONFIGURATION);
+		status = S5P_LCD1_STATUS;
+		break;
+	case PD_CAM:
+		__raw_writel(S5P_INT_LOCAL_PWR_EN, S5P_CAM_CONFIGURATION);
+		status = S5P_CAM_STATUS;
+		break;
+	case PD_TV:
+		__raw_writel(S5P_INT_LOCAL_PWR_EN, S5P_TV_CONFIGURATION);
+		status = S5P_TV_STATUS;
+		break;
+	default:
+		printk(KERN_WARNING "Wrong PD enable request %d\n", pd);
+		return -EINVAL;
+	}
+
+	/* Wait max 1ms */
+	timeout = 10;
+	while ((__raw_readl(status) & S5P_INT_LOCAL_PWR_EN)
+		!= S5P_INT_LOCAL_PWR_EN) {
+		if (timeout == 0) {
+			printk(KERN_ERR "Power domain %d enable failed.\n", pd);
+			return -ETIMEDOUT;
+		}
+		timeout--;
+		udelay(100);
+	}
+
+	return 0;
+}
+
+static int s5pv310_pd_disable(enum s5pv310_pd_block pd)
+{
+	void __iomem *status;
+	u32 timeout;
+
+	switch (pd) {
+	case PD_MFC:
+		__raw_writel(0, S5P_MFC_CONFIGURATION);
+		status = S5P_MFC_STATUS;
+		break;
+	case PD_G3D:
+		__raw_writel(0, S5P_G3D_CONFIGURATION);
+		status = S5P_G3D_STATUS;
+		break;
+	case PD_LCD0:
+		__raw_writel(0, S5P_LCD0_CONFIGURATION);
+		status = S5P_LCD0_STATUS;
+		break;
+	case PD_LCD1:
+		__raw_writel(0, S5P_LCD1_CONFIGURATION);
+		status = S5P_LCD1_STATUS;
+		break;
+	case PD_CAM:
+		__raw_writel(0, S5P_CAM_CONFIGURATION);
+		status = S5P_CAM_STATUS;
+		break;
+	case PD_TV:
+		__raw_writel(0, S5P_TV_CONFIGURATION);
+		status = S5P_TV_STATUS;
+		break;
+	default:
+		printk(KERN_WARNING "Wrong PD disable request %d\n", pd);
+		return -EINVAL;
+	}
+
+	/* Wait max 1ms */
+	timeout = 10;
+	while (__raw_readl(status) & S5P_INT_LOCAL_PWR_EN) {
+		if (timeout == 0) {
+			printk(KERN_ERR "PD %d disable failed.\n", pd);
+			return -ETIMEDOUT;
+		}
+		timeout--;
+		udelay(100);
+	}
+
+	return 0;
+}
+
+static int s5pv310_pd_mfc_enable(void)
+{
+	return s5pv310_pd_enable(PD_MFC);
+}
+
+static int s5pv310_pd_mfc_disable(void)
+{
+	return s5pv310_pd_disable(PD_MFC);
+}
+
+static int s5pv310_pd_g3d_enable(void)
+{
+	return s5pv310_pd_enable(PD_G3D);
+}
+
+static int s5pv310_pd_g3d_disable(void)
+{
+	return s5pv310_pd_disable(PD_G3D);
+}
+
+static int s5pv310_pd_lcd0_enable(void)
+{
+	return s5pv310_pd_enable(PD_LCD0);
+}
+
+static int s5pv310_pd_lcd0_disable(void)
+{
+	return s5pv310_pd_disable(PD_LCD0);
+}
+
+static int s5pv310_pd_lcd1_enable(void)
+{
+	return s5pv310_pd_enable(PD_LCD1);
+}
+
+static int s5pv310_pd_lcd1_disable(void)
+{
+	return s5pv310_pd_disable(PD_LCD1);
+}
+
+static int s5pv310_pd_cam_enable(void)
+{
+	return s5pv310_pd_enable(PD_CAM);
+}
+
+static int s5pv310_pd_cam_disable(void)
+{
+	return s5pv310_pd_disable(PD_CAM);
+}
+
+static int s5pv310_pd_tv_enable(void)
+{
+	return s5pv310_pd_enable(PD_TV);
+}
+
+static int s5pv310_pd_tv_disable(void)
+{
+	return s5pv310_pd_disable(PD_TV);
+}
+
+static struct samsung_pd_info s5pv310_pd_mfc_pdata = {
+	.enable		= s5pv310_pd_mfc_enable,
+	.disable	= s5pv310_pd_mfc_disable,
+};
+
+static struct samsung_pd_info s5pv310_pd_g3d_pdata = {
+	.enable		= s5pv310_pd_g3d_enable,
+	.disable	= s5pv310_pd_g3d_disable,
+};
+
+static struct samsung_pd_info s5pv310_pd_lcd0_pdata = {
+	.enable		= s5pv310_pd_lcd0_enable,
+	.disable	= s5pv310_pd_lcd0_disable,
+};
+
+static struct samsung_pd_info s5pv310_pd_lcd1_pdata = {
+	.enable		= s5pv310_pd_lcd1_enable,
+	.disable	= s5pv310_pd_lcd1_disable,
+};
+
+static struct samsung_pd_info s5pv310_pd_tv_pdata = {
+	.enable		= s5pv310_pd_tv_enable,
+	.disable	= s5pv310_pd_tv_disable,
+};
+
+static struct samsung_pd_info s5pv310_pd_cam_pdata = {
+	.enable		= s5pv310_pd_cam_enable,

arch/arm/mach-s5pv310/dev-pd.c line 217

Quoted 10 lines
arch/arm/mach-s5pv310/dev-pd.c new file +10 -0
+	.disable	= s5pv310_pd_cam_disable,
+};
+
+struct platform_device s5pv310_device_pd[] = {
+	{
+		.name		= "samsung-pd",
+		.id		= 0,
+		.dev = {
+			.platform_data = &s5pv310_pd_mfc_pdata,
+		},

how about wrapping each device in a new struct with the pd base info in it, such as

struct samsung_pd_device {
	struct platform_device	pdev;
	void __iomem            *base;
}

this means you can squash out all the samsung_pd_info structures and have a single enable/disable function and avoid the switch statements in them.

you could also simply put the base address in the pdata and avoid this too. also see Marek's comments about inlining the platform data setting.

Quoted 77 lines
arch/arm/mach-s5pv310/dev-pd.c new file +32 -0
+	}, {
+		.name		= "samsung-pd",
+		.id		= 1,
+		.dev = {
+			.platform_data = &s5pv310_pd_g3d_pdata,
+		},
+	}, {
+		.name		= "samsung-pd",
+		.id		= 2,
+		.dev = {
+			.platform_data = &s5pv310_pd_lcd0_pdata,
+		},
+	}, {
+		.name		= "samsung-pd",
+		.id		= 3,
+		.dev = {
+			.platform_data = &s5pv310_pd_lcd1_pdata,
+		},
+	}, {
+		.name		= "samsung-pd",
+		.id		= 4,
+		.dev = {
+			.platform_data = &s5pv310_pd_tv_pdata,
+		},
+	}, {
+		.name		= "samsung-pd",
+		.id		= 5,
+		.dev = {
+			.platform_data = &s5pv310_pd_cam_pdata,
+		},
+	},
+};
arch/arm/mach-s5pv310/include/mach/map.h +2 -0
index 1429510..9decf02 100644
@@ -37,6 +37,8 @@
 #define S5PV310_PA_SYSCON		(0x10010000)
 #define S5P_PA_SYSCON			S5PV310_PA_SYSCON
 
+#define S5PV310_PA_PMU			(0x10020000)
+
 #define S5PV310_PA_CMU			(0x10030000)
 
 #define S5PV310_PA_WATCHDOG		(0x10060000)
arch/arm/mach-s5pv310/include/mach/regs-pmu.h new file +26 -0
new file mode 100644
index 0000000..f4b2229
@@ -0,0 +1,40 @@
+/* linux/arch/arm/mach-s5pv310/include/mach/regs-pmu.h
+ *
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com
+ *
+ * S5PV310 - Power management unit definition
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#ifndef __ASM_ARCH_REGS_PMU_H
+#define __ASM_ARCH_REGS_PMU_H __FILE__
+
+#include <mach/map.h>
+
+#define S5P_PMUREG(x)				(S5P_VA_PMU + (x))
+
+#define S5P_CAM_CONFIGURATION			S5P_PMUREG(0x3C00)
+#define S5P_CAM_STATUS				S5P_PMUREG(0x3C04)
+
+#define S5P_TV_CONFIGURATION			S5P_PMUREG(0x3C20)
+#define S5P_TV_STATUS				S5P_PMUREG(0x3C24)
+
+#define S5P_MFC_CONFIGURATION			S5P_PMUREG(0x3C40)

arch/arm/mach-s5pv310/include/mach/regs-pmu.h line 36

Quoted 10 lines
arch/arm/mach-s5pv310/include/mach/regs-pmu.h new file +10 -0
+#define S5P_MFC_STATUS				S5P_PMUREG(0x3C44)
+
+#define S5P_G3D_CONFIGURATION			S5P_PMUREG(0x3C60)
+#define S5P_G3D_STATUS				S5P_PMUREG(0x3C64)
+
+#define S5P_LCD0_CONFIGURATION			S5P_PMUREG(0x3C80)
+#define S5P_LCD0_STATUS				S5P_PMUREG(0x3C84)
+
+#define S5P_LCD1_CONFIGURATION			S5P_PMUREG(0x3CA0)
+#define S5P_LCD1_STATUS				S5P_PMUREG(0x3CA4)

give STATUS seems to be CONFIGURATION+0x04, why bother with them?

Quoted 64 lines
arch/arm/mach-s5pv310/include/mach/regs-pmu.h new file +4 -0
+
+#define S5P_INT_LOCAL_PWR_EN			0x7
+
+#endif /* __ASM_ARCH_REGS_PMU_H */
arch/arm/mach-s5pv310/mach-smdkc210.c +9 -0
index d2cf694..390befd 100644
@@ -22,6 +22,7 @@
 #include <plat/cpu.h>
 #include <plat/devs.h>
 #include <plat/sdhci.h>
+#include <plat/pd.h>
 
 #include <mach/map.h>
 
@@ -113,6 +114,12 @@ static struct platform_device *smdkc210_devices[] __initdata = {
 	&s3c_device_hsmmc3,
 	&s3c_device_rtc,
 	&s3c_device_wdt,
+	&s5pv310_device_pd[PD_MFC],
+	&s5pv310_device_pd[PD_G3D],
+	&s5pv310_device_pd[PD_LCD0],
+	&s5pv310_device_pd[PD_LCD1],
+	&s5pv310_device_pd[PD_CAM],
+	&s5pv310_device_pd[PD_TV],
 };
 
 static void __init smdkc210_map_io(void)
@@ -124,6 +131,8 @@ static void __init smdkc210_map_io(void)
 
 static void __init smdkc210_machine_init(void)
 {
+	samsung_pd_init();
+
 	s3c_sdhci0_set_platdata(&smdkc210_hsmmc0_pdata);
 	s3c_sdhci1_set_platdata(&smdkc210_hsmmc1_pdata);
 	s3c_sdhci2_set_platdata(&smdkc210_hsmmc2_pdata);
arch/arm/mach-s5pv310/mach-smdkv310.c +7 -0
index 10f8056..c6690cf 100644
@@ -22,6 +22,7 @@
 #include <plat/cpu.h>
 #include <plat/devs.h>
 #include <plat/sdhci.h>
+#include <plat/pd.h>
 
 #include <mach/map.h>
 
@@ -113,6 +114,12 @@ static struct platform_device *smdkv310_devices[] __initdata = {
 	&s3c_device_hsmmc3,
 	&s3c_device_rtc,
 	&s3c_device_wdt,
+	&s5pv310_device_pd[PD_MFC],
+	&s5pv310_device_pd[PD_G3D],
+	&s5pv310_device_pd[PD_LCD0],
+	&s5pv310_device_pd[PD_LCD1],
+	&s5pv310_device_pd[PD_CAM],
+	&s5pv310_device_pd[PD_TV],
 };
 
 static void __init smdkv310_map_io(void)

arch/arm/mach-s5pv310/mach-smdkv310.c static void __init smdkv310_map_io(void) · line 135

Quoted 5 lines
arch/arm/mach-s5pv310/mach-smdkv310.c +2 -0
@@ -124,6 +131,8 @@ static void __init smdkv310_map_io(void)
 
 static void __init smdkv310_machine_init(void)
 {
+	samsung_pd_init();
+

given the driver will only get called when the devices are registered, how about making it have its own initcall and avoid having to splatter these through each machine?

Quoted 28 lines
arch/arm/mach-s5pv310/mach-smdkv310.c +0 -0
 	s3c_sdhci0_set_platdata(&smdkv310_hsmmc0_pdata);
 	s3c_sdhci1_set_platdata(&smdkv310_hsmmc1_pdata);
 	s3c_sdhci2_set_platdata(&smdkv310_hsmmc2_pdata);
arch/arm/plat-s5p/include/plat/map-s5p.h +1 -0
index fef353d..d973d39 100644
@@ -15,6 +15,7 @@
 
 #define S5P_VA_CHIPID		S3C_ADDR(0x02000000)
 #define S5P_VA_CMU		S3C_ADDR(0x02100000)
+#define S5P_VA_PMU		S3C_ADDR(0x02180000)
 #define S5P_VA_GPIO		S3C_ADDR(0x02200000)
 #define S5P_VA_GPIO1		S5P_VA_GPIO
 #define S5P_VA_GPIO2		S3C_ADDR(0x02240000)
arch/arm/plat-samsung/include/plat/devs.h +2 -0
index 71bcc0f..c483480 100644
@@ -118,6 +118,8 @@ extern struct platform_device s5p_device_fimc0;
 extern struct platform_device s5p_device_fimc1;
 extern struct platform_device s5p_device_fimc2;
 
+extern struct platform_device s5pv310_device_pd[];
+
 /* s3c2440 specific devices */
 
 #ifdef CONFIG_CPU_S3C2440
#5 lore raw

cover ARM: SAMSUNG: Add Support Power Domain Control

In reply to Kukjin Kim
Quoted 6 lines · Kukjin Kim

This patch adds support Power Domain Control based on Runtim PM.

Each Power Domain is represented by a Power Domain device and the devices belong to these Power Domains should be set as a child device of the Power Domain devices. The corresponding drivers of the devices should implement Runtime PM to control the Power Domains.

This sounds like a reasonable way to do this, although we still need a way of signaling the drivers whether they've fully powered down or not.

Quoted 1 line

From [email protected] Fri Oct 22 17:57:35 2010

From: [email protected] ()
Date: Fri, 22 Oct 2010 21:57:35 -0000
Subject: No subject
Message-ID: <[email protected]>

a direct clock, it relies on the main ipu clock to function, but it is my first glance to omap4 and I might be wrong.

Quoted 2 lines

That being said, when you will change that code to switch to runtime PM, you will end up managing the module state in the ISR context.

Mainly this patch was sent on my laziness to add device enable/disable calls on all the parts the code is using clk disable/enable, given that they are not really needed.

Regards,

Omar

Quoted 1 line

From [email protected] Fri Oct 22 17:57:35 2010

From: [email protected] ()
Date: Fri, 22 Oct 2010 21:57:35 -0000
Subject: No subject
Message-ID: <[email protected]>

around - so I just hacked up a simple patch. I also didn't bother to use get_maintainer.pl for CC. As you may have noticed I also managed to get the code wrong for msm in V1, so I guess it would have been better to CC properly after all.

Anyway, I will break up the patch per sub-architecture in V3. That makes per sub-arch back porting easier.

Thanks,

/ magnus

Quoted 1 line

From [email protected] Fri Oct 22 17:57:35 2010

From: [email protected] ()
Date: Fri, 22 Oct 2010 21:57:35 -0000
Subject: No subject
Message-ID: <[email protected]>

types, which hwmod uses to define the rev field.

/* timer ip constants */
#define OMAP_TIMER_IP_LEGACY 0x1
#define OMAP_TIMER_IP_VERSION_2 0x2

Thank you,
Best regards,
Hari Kanigeri

Quoted 1 line

From [email protected] Fri Oct 22 17:57:35 2010

From: [email protected] ()
Date: Fri, 22 Oct 2010 21:57:35 -0000
Subject: No subject
Message-ID: <[email protected]>

does not help and if the bus is busy for too much time, there always was a h/w problem involved.

Quoted 20 lines
Quoted 10 lines
Quoted 10 lines
(quoted diff) +3 -1
+
+       return timeout < 0 ? I2C_RETRY : 0;
+}
 
 #ifdef CONFIG_I2C_PXA_SLAVE
 /*
--

1.7.3.2

Quoted 5 lines
Quoted 5 lines

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

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

Signature · 2 lines
Regards,
Igor.
Quoted 1 line

From [email protected] Fri Oct 22 17:57:35 2010

From: [email protected] ()
Date: Fri, 22 Oct 2010 21:57:35 -0000
Subject: No subject
Message-ID: <[email protected]>

larger than about 16K ?

A work-around would be to drop the MTU below 4K, which'll make these kinds of allocations order-0, and see whether you can reproduce the problem. If you can, it would suggest there is a memory leak somewhere.

Quoted 47 lines
[180923.061930] Unable to handle kernel paging request at virtual address 804f13e6
[180923.070060] pgd = c0e98000
[180923.072893] [804f13e6] *pgd=00000000
[180923.076583] Internal error: Oops: 801 [#1]
[180923.080782] last sysfs file: /sys/devices/virtual/net/ppp0/uevent
[180923.086990] Modules linked in: pppol2tp pppox ppp_generic slhc xfrm_user ah6 ah4 esp6 esp4 xfrm4_mode_beet xfrm4_tunnel xfrm4_mode_tunnel xfrm4_mode_transport xfrm6_mode_transport xfrm6_mode_ro xfrm6_mode_beet xfrm6_mode_tunnel ipcomp ipcomp6 xfrm6_tunnel af_key nls_cp437 authenc ccm ecb sha512_generic tunnel4 xfrm_ipcomp tunnel6 ipv6 ctr twofish twofish_common camellia serpent blowfish cast5 des_generic cbc aes_generic xcbc rmd160 sha256_generic sha1_generic hmac crypto_null ext2 loop vfat fat nls_utf8 cifs ext3 jbd dm_crypt dm_mod evdev sata_mv mv643xx_eth libata libphy gpio_keys inet_lro ext4 mbcache jbd2 sd_mod crc_t10dif usb_storage scsi_mod ehci_hcd usbcore nls_base [last unloaded: slhc]
[180923.149394] CPU: 0    Not tainted  (2.6.32-5-kirkwood #1)
[180923.154915] PC is at __kprobes_text_end+0x818/0xae8
[180923.159908] LR is at tcp_sendmsg+0x32c/0xae0
[180923.164288] pc : [<c02b8bb8>]    lr : [<c026f2d8>]    psr: 00000013
[180923.164294] sp : c0fabbb8  ip : 00000550  fp : c66f5790
[180923.176005] r10: 00001000  r9 : c0fabc40  r8 : 00000000
[180923.181342] r7 : 00000000  r6 : 00000550  r5 : 804f13e6  r4 : fffffff2
[180923.187987] r3 : 00000000  r2 : 00000550  r1 : dba88130  r0 : c66f5790
[180923.194633] Flags: nzcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
[180923.202061] Control: 0005397f  Table: 00e98000  DAC: 00000017
[180923.207922] Process vsftpd (pid: 11900, stack limit = 0xc0faa270)
[180923.214130] Stack: (0xc0fabbb8 to 0xc0fac000)
[180923.218595] bba0:                                                       dba88130 00000550
[180923.226901] bbc0: dfb0f600 df226400 00000550 00000000 00000000 c026f2d8 c0fabc0c 00000000
[180923.235211] bbe0: c0fabd68 00000000 00008000 00000550 00000790 00000870 00000550 df226470
[180923.243521] bc00: c0faa000 00000000 c002e220 00000000 7fffffff 00000550 c050e0c0 00000000
[180923.251832] bc20: 00000000 df9672c0 df617000 c0fabd4c c0fabc40 00001000 00000018 c022d094
[180923.260141] bc40: 00000000 df974074 00000000 00000001 ffffffff 00000000 00000000 00000000
[180923.268452] bc60: 00000000 00000000 df9672c0 c03d4fa0 00000000 00000000 1d260c67 df9672c0
[180923.276763] bc80: c005d2e4 c0fabc84 c0fabc84 dfabd200 c0dddc00 dfaa9c00 c0fabcd0 c0d6a280
[180923.285072] bca0: dfbff578 00000000 d6c1dde0 0003ffff 00000010 c0fabe08 d4e8c300 c0fabcd4
[180923.293383] bcc0: 00000010 c01acf68 c0fabcd4 c0c40480 0000f140 0000f160 c0c40480 00001000
[180923.301693] bce0: df617000 00000010 00000000 c0fabd4c 00000000 00000010 c0509ac0 c0fabe4c
[180923.310002] bd00: 00000000 00000011 d4e8c2fc 00000000 00000017 bf000000 c0fabd4c df617000
[180923.318314] bd20: 00001000 c00ea7c0 c02bf59c c022d3ec 00000018 000066f5 c66f5000 c022f8f4
[180923.326623] bd40: 00001000 c0c404c0 00000000 00000000 00000000 c0fabd68 00000001 00000000
[180923.334934] bd60: 00000000 00008000 c66f5000 00001000 df226400 c0c3f93c c0c40800 0000000b
[180923.343243] bd80: c0c3f93c c026fad0 00008000 00000014 00000000 00001000 00000000 00000000
[180923.351553] bda0: 00001000 c050dea0 00000000 00001000 c0c40800 00008000 c0c3f93c c0c40800
[180923.359864] bdc0: 0000000b c0c3f93c c00ea7c0 c02bf59c 00000018 c022be64 00008000 c0fabe48
[180923.368174] bde0: c0fabe48 c00ea834 00008000 00000001 0f15b000 00000000 00005000 c0fabe48
[180923.376484] be00: c0c3f800 c00ea888 c050daa0 c0fabe48 c0c3f800 00000001 c00ea7c0 c0c40800
[180923.384795] be20: 00010000 0f150000 050c9000 c00eac14 c050de80 00010000 c0c3f800 0f150000
[180923.393104] be40: 00000000 c00eac98 00001000 00005000 00000000 c0c40800 0f15b000 00000000
[180923.401415] be60: 0000b000 00000000 00000000 c0c40800 c0c3f800 00010000 c0fabf20 c0fabf10
[180923.409725] be80: 0f150000 c00ead14 00000000 c00ea7c0 c0fabf10 c00eb43c 00000000 c0c3f800
[180923.418035] bea0: c0fabf10 0f150000 00000000 00010000 c0c3f800 c00eb998 00000000 00010000
[180923.426345] bec0: c0c3f800 c00eb280 00000000 00000001 000003e8 c00eb974 c0c40480 00000000
[180923.434655] bee0: 0f160000 00000000 14219000 00000000 00000000 14219000 14219000 c0c40480
[180923.442965] bf00: c0c404a0 c0c40800 c0c40480 c00eb3a8 14219000 00010000 00000000 c0c40800
[180923.451275] bf20: 0f150000 00000000 00000000 00000000 df617028 d4e8c260 14219000 ff7fc000
Quoted 8 lines
[180923.459585] bf40: c0c40800 c0c404a0 000001fe c00cd528 00000000 00000000 00000000 00000000
[180923.467896] bf60: c0c40480 00000000 00000000 00000000 000000bb c0028048 c0faa000 00000000
[180923.476205] bf80: 0000ffff c00cd75c 00000000 00000000 00000000 0002a8a4 14219000 0002a8a4
[180923.484516] bfa0: 00000007 c0027ea0 14219000 0002a8a4 00000007 00000003 00000000 14219000
[180923.492826] bfc0: 14219000 0002a8a4 00000007 000000bb 0002a034 00000003 00000000 0000ffff
[180923.501136] bfe0: 00000003 bef27908 0001cac4 4029375c 60000010 00000007 00000000 00000000
[180923.509447] Code: 00000000 00000000 e3e0400d e59b5004 (e5854000)
[180923.518824] ---[ end trace 0c1f4f3521f172f3 ]---

This is not useful. Unlike OABI with frame pointers, EABI seems to omit the very important backtrace. Moreover, because the kprobes symbols appear in kallsyms, we don't know where PC was. So all in all, the above oops is undebuggable.

Can someone please fix the EABI backtracing to say _why_ it couldn't produce a backtrace.

Quoted 1 line

From [email protected] Fri Oct 22 17:57:35 2010

From: [email protected] ()
Date: Fri, 22 Oct 2010 21:57:35 -0000
Subject: No subject
Message-ID: <[email protected]>

is added so that Driver's can avoid doing ioremap. check Santosh's comment on this API
http://www.spinics.net/lists/arm-kernel/msg92260.html

Quoted 35 lines

static int __devinit =A0dev_probe (*pdev) {
=A0 struct resource *res;
=A0 void __iomem *base;
=A0 u16 irq;
=A0 ....
=A0 ....
=A0 res =3D platform_get_resource(pdev, IORESOURCE_MEM, 0); =A0 if (unlikely(!res)) {
=A0 =A0 =A0 =A0 =A0 =A0 =A0....
=A0 =A0 =A0 =A0 =A0 =A0 =A0return -ENODEV;
=A0 }

=A0 base =3D ioremap(res->start, resource_size(res)); =A0 if (base) {
=A0 =A0 =A0 =A0 =A0 =A0 =A0 ....
=A0 =A0 =A0 =A0 =A0 =A0 =A0 return -ENOMEM; =A0 }

=A0 res =3D platform_get_resource(pdev, IORESOURCE_IRQ, 0); =A0 if (unlikely(!res)) {
=A0 =A0 =A0 =A0 =A0 =A0 =A0 ....
=A0 =A0 =A0 =A0 =A0 =A0 =A0 return -ENODEV;
=A0 }
=A0 irq =3D res->start;
=A0 ....
=A0 ....
}

-V Charulatha
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo at vger.kernel.org
More majordomo info at =A0http://vger.kernel.org/majordomo-info.html