Skip to contentSkip to conversation

PM/Devfreq: Exynos4 bus frequency, vdd_int, and vdd_mif

PATCH New MyungJoo Ham 1 participant 5 messages Dec 14, 2011

Subsystems (4)
lore
Share & tools
lore

MyungJoo Ham

author maintainer
#0 lore raw

v2 cover PM/Devfreq: Exynos4 bus frequency, vdd_int, and vdd_mif

This patchset adds DVFS (Dynamic Voltage and Frequency Scaling) capability to the following three Exynos4 SoCs.
Exynos4210: memory-bus and vdd_int.
Exynos4212: memory-bus and vdd_int/vdd_mif.
Exynos4412: memory-bus and vdd_int/vdd_mif.

The Exynos4 bus devfreq driver uses PPMU counters of memory controllers (DMC0/DMC1 of Exynos4), and adjusts OPP based on the current load.

In other to support Exynos4 bus devfreq driver (patch 3/4), we have added patches:
1/4: Enable DMC1, Enable PPMU for DMC0/1.
2/4: Add register information for Exynos4212/4412 support. 3/4: The Exynos4 bus devfreq driver.
4/4: Add Exynos4210-bus devfreq device to Nuri board.

Note that any Exynos4210 board may add this capability by adding the platform device "exynos4210-busfreq" and provide a regulator (VDD_INT) to the added device.

For Exynos4212 boards, the device name is "exynos4212-busfreq" and for Exynos4412 boards, the device name is "exynos4412-busfreq".

This device driver has been tested in Exynos4210-NURI board and an Exynos4412 board, which is not upstreamed, yet. Because Exynos4212 and 4412 are supposed not to have any differences in this part, Exynos4212 was not tested.

ASV (Adaptive Supply Voltage) capability has been introduced in the ARM-kernel mailing list. However, it has not been merged, yet. Thus, the device driver (exynos4_bus.c) has a symbol "CONFIG_EXYNOS4_ASV" to block ASV-related code.
With support of ASV, this devfreq driver reduces power consumption futher; most Exynos4210 SoCs have lower voltage requirement than the worst case (ASV number 0) scenario.

MyungJoo Ham (4):
ARM: EXYNOS4: Add DMC1, allow PPMU access for DMC.
ARM: EXYNOS4: Add clock register addresses for Exynos4x12 bus devfreq
driver
PM/Devfreq: Add Exynos4-bus device DVFS driver for

    Exynos4210/4212/4412.

ARM Exynos4210-Nuri: support Exynos4210-bus Devfreq driver.

 arch/arm/mach-exynos/cpu.c                     |    7 +-
 arch/arm/mach-exynos/include/mach/map.h        |    1 +
 arch/arm/mach-exynos/include/mach/regs-clock.h |   42 +
 arch/arm/mach-exynos/mach-nuri.c               |   11 +-
 drivers/devfreq/Kconfig                        |   13 +
 drivers/devfreq/Makefile                       |    3 +
 drivers/devfreq/exynos4_bus.c                  | 1135 ++++++++++++++++++++++++
 7 files changed, 1208 insertions(+), 4 deletions(-)
 create mode 100644 drivers/devfreq/exynos4_bus.c
Signature · 1 line
1.7.4.1
author maintainer
#1 lore raw

PATCH v2 1/4 ARM: EXYNOS4: Add DMC1, allow PPMU access for DMC.

- Add DMC1
- Enlarge address space for DMC from 4k to 64k so that PPMU registers may be accessed.

---
 arch/arm/mach-exynos/cpu.c              |    7 ++++++-
 arch/arm/mach-exynos/include/mach/map.h |    1 +
 2 files changed, 7 insertions(+), 1 deletions(-)
arch/arm/mach-exynos/cpu.c +6 -1
index 90ec247..8bdcba9 100644
@@ -108,7 +108,12 @@ static struct map_desc exynos4_iodesc[] __initdata = {
 	}, {
 		.virtual	= (unsigned long)S5P_VA_DMC0,
 		.pfn		= __phys_to_pfn(EXYNOS4_PA_DMC0),
-		.length		= SZ_4K,
+		.length		= SZ_64K,
+		.type		= MT_DEVICE,
+	}, {
+		.virtual	= (unsigned long)S5P_VA_DMC1,
+		.pfn		= __phys_to_pfn(EXYNOS4_PA_DMC1),
+		.length		= SZ_64K,
 		.type		= MT_DEVICE,
 	}, {
 		.virtual	= (unsigned long)S5P_VA_SROMC,
arch/arm/mach-exynos/include/mach/map.h +1 -0
index 058541d..870a980 100644
@@ -57,6 +57,7 @@
 #define EXYNOS4_PA_KEYPAD		0x100A0000
 
 #define EXYNOS4_PA_DMC0			0x10400000
+#define EXYNOS4_PA_DMC1			0x10410000
 
 #define EXYNOS4_PA_COMBINER		0x10440000
 
Signature · 1 line
1.7.4.1
author maintainer
#2 lore raw

PATCH v2 2/4 ARM: EXYNOS4: Add clock register addresses for Exynos4x12 bus devfreq driver

In reply to MyungJoo Ham

Exynos4212/4412 memory bus devfreq driver requires some register addresses that were not defined with Exynos4210 support. This patch adds the required register addresses and shift/mask data.

---
 arch/arm/mach-exynos/include/mach/regs-clock.h |   42 ++++++++++++++++++++++++
 1 files changed, 42 insertions(+), 0 deletions(-)
arch/arm/mach-exynos/include/mach/regs-clock.h +42 -0
index 6c37ebe..2003251 100644
@@ -77,6 +77,7 @@
 #define S5P_CLKDIV2_RATIO		S5P_CLKREG(0x0C580)
 
 #define S5P_CLKDIV_STAT_TOP		S5P_CLKREG(0x0C610)
+#define S5P_CLKDIV_STAT_MFC		S5P_CLKREG(0x0C628)
 
 #define S5P_CLKGATE_SCLKCAM		S5P_CLKREG(0x0C820)
 #define S5P_CLKGATE_IP_CAM		S5P_CLKREG(0x0C920)
@@ -104,8 +105,12 @@
 #define S5P_CLKDIV_DMC0			S5P_CLKREG(0x10500)
 #define S5P_CLKDIV_DMC1			S5P_CLKREG(0x10504)
 #define S5P_CLKDIV_STAT_DMC0		S5P_CLKREG(0x10600)
+#define S5P_CLKDIV_STAT_DMC1		S5P_CLKREG(0x10604)
 #define S5P_CLKGATE_IP_DMC		S5P_CLKREG(0x10900)
 
+#define S5P_DMC_PAUSE_CTRL		S5P_CLKREG(0x11094)
+#define DMC_PAUSE_ENABLE		(1 << 0)
+
 #define S5P_APLL_LOCK			S5P_CLKREG(0x14000)
 #define S5P_MPLL_LOCK			(soc_is_exynos4210() ? \
 					S5P_CLKREG(0x14004) :  \
@@ -178,6 +183,22 @@
 #define S5P_CLKDIV_DMC0_CORETI_SHIFT	(28)
 #define S5P_CLKDIV_DMC0_CORETI_MASK	(0x7 << S5P_CLKDIV_DMC0_CORETI_SHIFT)
 
+#define S5P_CLKDIV_DMC1_G2D_ACP_SHIFT	(0)
+#define S5P_CLKDIV_DMC1_G2D_ACP_MASK	(0xf << S5P_CLKDIV_DMC1_G2D_ACP_SHIFT)
+#define S5P_CLKDIV_DMC1_C2C_SHIFT	(4)
+#define S5P_CLKDIV_DMC1_C2C_MASK	(0x7 << S5P_CLKDIV_DMC1_C2C_SHIFT)
+#define S5P_CLKDIV_DMC1_PWI_SHIFT	(8)
+#define S5P_CLKDIV_DMC1_PWI_MASK	(0xf << S5P_CLKDIV_DMC1_PWI_SHIFT)
+#define S5P_CLKDIV_DMC1_C2CACLK_SHIFT	(12)
+#define S5P_CLKDIV_DMC1_C2CACLK_MASK	(0x7 << S5P_CLKDIV_DMC1_C2CACLK_SHIFT)
+#define S5P_CLKDIV_DMC1_DVSEM_SHIFT	(16)
+#define S5P_CLKDIV_DMC1_DVSEM_MASK	(0x7f << S5P_CLKDIV_DMC1_DVSEM_SHIFT)
+#define S5P_CLKDIV_DMC1_DPM_SHIFT	(24)
+#define S5P_CLKDIV_DMC1_DPM_MASK	(0x7f << S5P_CLKDIV_DMC1_DPM_SHIFT)
+
+#define S5P_CLKDIV_MFC_SHIFT		(0)
+#define S5P_CLKDIV_MFC_MASK		(0x7 << S5P_CLKDIV_MFC_SHIFT)
+
 #define S5P_CLKDIV_TOP_ACLK200_SHIFT	(0)
 #define S5P_CLKDIV_TOP_ACLK200_MASK	(0x7 << S5P_CLKDIV_TOP_ACLK200_SHIFT)
 #define S5P_CLKDIV_TOP_ACLK100_SHIFT	(4)
@@ -188,12 +209,25 @@
 #define S5P_CLKDIV_TOP_ACLK133_MASK	(0x7 << S5P_CLKDIV_TOP_ACLK133_SHIFT)
 #define S5P_CLKDIV_TOP_ONENAND_SHIFT	(16)
 #define S5P_CLKDIV_TOP_ONENAND_MASK	(0x7 << S5P_CLKDIV_TOP_ONENAND_SHIFT)
+#define S5P_CLKDIV_TOP_ACLK266_GPS_SHIFT	(20)
+#define S5P_CLKDIV_TOP_ACLK266_GPS_MASK		(0x7 << S5P_CLKDIV_TOP_ACLK266_GPS_SHIFT)
+#define S5P_CLKDIV_TOP_ACLK400_MCUISP_SHIFT	(24)
+#define S5P_CLKDIV_TOP_ACLK400_MCUISP_MASK	(0x7 << S5P_CLKDIV_TOP_ACLK400_MCUISP_SHIFT)
 
 #define S5P_CLKDIV_BUS_GDLR_SHIFT	(0)
 #define S5P_CLKDIV_BUS_GDLR_MASK	(0x7 << S5P_CLKDIV_BUS_GDLR_SHIFT)
 #define S5P_CLKDIV_BUS_GPLR_SHIFT	(4)
 #define S5P_CLKDIV_BUS_GPLR_MASK	(0x7 << S5P_CLKDIV_BUS_GPLR_SHIFT)
 
+#define S5P_CLKDIV_CAM_FIMC0_SHIFT	(0)
+#define S5P_CLKDIV_CAM_FIMC0_MASK	(0xf << S5P_CLKDIV_CAM_FIMC0_SHIFT)
+#define S5P_CLKDIV_CAM_FIMC1_SHIFT	(4)
+#define S5P_CLKDIV_CAM_FIMC1_MASK	(0xf << S5P_CLKDIV_CAM_FIMC1_SHIFT)
+#define S5P_CLKDIV_CAM_FIMC2_SHIFT	(8)
+#define S5P_CLKDIV_CAM_FIMC2_MASK	(0xf << S5P_CLKDIV_CAM_FIMC2_SHIFT)
+#define S5P_CLKDIV_CAM_FIMC3_SHIFT	(12)
+#define S5P_CLKDIV_CAM_FIMC3_MASK	(0xf << S5P_CLKDIV_CAM_FIMC3_SHIFT)
+
 /* Only for EXYNOS4210 */
 
 #define S5P_CLKSRC_LCD1			S5P_CLKREG(0x0C238)
@@ -201,6 +235,14 @@
 #define S5P_CLKDIV_LCD1			S5P_CLKREG(0x0C538)
 #define S5P_CLKGATE_IP_LCD1		S5P_CLKREG(0x0C938)
 
+/* Only for EXYNOS4212 */
+#define S5P_CLKDIV_CAM1			S5P_CLKREG(0x0C568)
+
+#define S5P_CLKDIV_STAT_CAM1		S5P_CLKREG(0x0C668)
+
+#define S5P_CLKDIV_CAM1_JPEG_SHIFT	(0)
+#define S5P_CLKDIV_CAM1_JPEG_MASK	(0xf << S5P_CLKDIV_CAM1_JPEG_SHIFT)
+
 /* Compatibility defines and inclusion */
 
 #include <mach/regs-pmu.h>
Signature · 1 line
1.7.4.1
author maintainer
#3 lore raw

PATCH v2 3/4 PM/Devfreq: Add Exynos4-bus device DVFS driver for Exynos4210/4212/4412.

In reply to MyungJoo Ham

Exynos4-bus device devfreq driver add DVFS capability for Exynos4210/4212/4412-Bus (memory). The driver monitors PPMU counters of memory controllers and adjusts operating frequencies and voltages with OPP. For Exynos4210, vdd_int is controlled. For exynos4412/4212, vdd_mif and vdd_int are controlled.

Dependency (CONFIG_EXYNOS_ASV):
Exynos4 ASV driver has been posted in the mailing list; however, it si not yet upstreamed. Although the current revision of Exynos4 ASV patch does not contain "CONFIG_EXYNOS_ASV", we have added the symbol to hide the dependent from compilers for now. As soon as Exynos4 ASV drivers are merged, the #ifdef statement will be removed or the name will be changed.

However, enabling ASV is essential in most Exynos4 chips to reduce the power consumption of Exynos4210 because without ASV, this Devfreq driver assumes the worst case scenario, which consumes more power.

---
Changes from v1
- Support 4212 and 4412 as well as 4210.

---
 drivers/devfreq/Kconfig       |   13 +
 drivers/devfreq/Makefile      |    3 +
 drivers/devfreq/exynos4_bus.c | 1135 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 1151 insertions(+), 0 deletions(-)
 create mode 100644 drivers/devfreq/exynos4_bus.c
drivers/devfreq/Kconfig +13 -0
index 8f04910..464fa21 100644
@@ -65,4 +65,17 @@ config DEVFREQ_GOV_USERSPACE
 
 comment "DEVFREQ Drivers"
 
+config ARM_EXYNOS4_BUS_DEVFREQ
+	bool "ARM Exynos4210/4212/4412 Memory Bus DEVFREQ Driver"
+	depends on CPU_EXYNOS4210 || CPU_EXYNOS4212 || CPU_EXYNOS4412
+	select ARCH_HAS_OPP
+	select DEVFREQ_GOV_SIMPLE_ONDEMAND
+	help
+	  This adds the DEVFREQ driver for Exynos4210 memory bus (vdd_int)
+	  and Exynos4212/4412 memory interface and bus (vdd_mif + vdd_int).
+	  It reads PPMU counters of memory controllers and adjusts
+	  the operating frequencies and voltages with OPP support.
+	  To operate with optimal voltages, ASV support is required
+	  (CONFIG_EXYNOS_ASV).
+
 endif # PM_DEVFREQ
drivers/devfreq/Makefile +3 -0
index 4564a89..8c46423 100644
@@ -3,3 +3,6 @@ obj-$(CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND)	+= governor_simpleondemand.o
 obj-$(CONFIG_DEVFREQ_GOV_PERFORMANCE)	+= governor_performance.o
 obj-$(CONFIG_DEVFREQ_GOV_POWERSAVE)	+= governor_powersave.o
 obj-$(CONFIG_DEVFREQ_GOV_USERSPACE)	+= governor_userspace.o
+
+# DEVFREQ Drivers
+obj-$(CONFIG_ARM_EXYNOS4_BUS_DEVFREQ)	+= exynos4_bus.o
drivers/devfreq/exynos4_bus.c new file +1135 -0

1,135 lines not on this page · raw message

Signature · 1 line
1.7.4.1
author maintainer
#4 lore raw

PATCH v2 4/4 ARM Exynos4210-Nuri: support Exynos4210-bus Devfreq driver.

In reply to MyungJoo Ham

Support varying voltages:
- GPIODVS for Buck2 is removed.
- Voltage ragne for Buck2 is widen.

Support Buck2 regulator for Exynos4210-bus devfreq driver:
- Added device name for buck2 regulator
- Added exynos4210-busfreq platform device fro Nuri board.

---
 arch/arm/mach-exynos/mach-nuri.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
arch/arm/mach-exynos/mach-nuri.c +8 -3
index 236bbe1..c28f045 100644
@@ -434,7 +434,7 @@ static struct regulator_consumer_supply __initdata max8997_buck1_[] = {
 	REGULATOR_SUPPLY("vdd_arm", NULL), /* CPUFREQ */
 };
 static struct regulator_consumer_supply __initdata max8997_buck2_[] = {
-	REGULATOR_SUPPLY("vdd_int", NULL), /* CPUFREQ */
+	REGULATOR_SUPPLY("vdd_int", "exynos4210-busfreq.0"), /* CPUFREQ */
 };
 static struct regulator_consumer_supply __initdata max8997_buck3_[] = {
 	REGULATOR_SUPPLY("vdd", "mali_dev.0"), /* G3D of Exynos 4 */
@@ -745,7 +745,7 @@ static struct regulator_init_data __initdata max8997_buck2_data = {
 	.constraints	= {
 		.name		= "VINT_1.1V_C210",
 		.min_uV		= 900000,
-		.max_uV		= 1100000,
+		.max_uV		= 1200000,
 		.valid_ops_mask	= REGULATOR_CHANGE_VOLTAGE,
 		.always_on	= 1,
 		.state_mem	= {
@@ -960,7 +960,6 @@ static struct max8997_platform_data __initdata nuri_max8997_pdata = {
 	.regulators		= nuri_max8997_regulators,
 
 	.buck125_gpios = { EXYNOS4_GPX0(5), EXYNOS4_GPX0(6), EXYNOS4_GPL0(0) },
-	.buck2_gpiodvs = true,
 
 	.buck1_voltage[0] = 1350000, /* 1.35V */
 	.buck1_voltage[1] = 1300000, /* 1.3V */
@@ -1242,6 +1241,11 @@ static struct s3c2410_platform_i2c nuri_i2c0_platdata __initdata = {
 	.sda_delay	= 200,
 };
 
+/* DEVFREQ controlling memory/bus */
+static struct platform_device exynos4_bus_devfreq = {
+	.name			= "exynos4210-busfreq",
+};
+
 static struct platform_device *nuri_devices[] __initdata = {
 	/* Samsung Platform Devices */
 	&s3c_device_i2c5, /* PMIC should initialize first */
@@ -1279,6 +1283,7 @@ static struct platform_device *nuri_devices[] __initdata = {
 	&nuri_max8903_device,
 	&cam_vdda_fixed_rdev,
 	&cam_8m_12v_fixed_rdev,
+	&exynos4_bus_devfreq,
 };
 
 static void __init nuri_map_io(void)
Signature · 1 line
1.7.4.1