-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ARM: S5PV310: Add support Power Domain
This patch adds support Power Domain for S5PV310 and S5PC210. Signed-off-by: Changhwan Youn <chaos.youn at samsung.com> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
- Loading branch information
Changhwan Youn
authored and
Kukjin Kim
committed
Dec 30, 2010
1 parent
a50eb1c
commit d6d8b48
Showing
10 changed files
with
205 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
/* 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(struct device *dev) | ||
{ | ||
struct samsung_pd_info *pdata = dev->platform_data; | ||
u32 timeout; | ||
|
||
__raw_writel(S5P_INT_LOCAL_PWR_EN, pdata->base); | ||
|
||
/* Wait max 1ms */ | ||
timeout = 10; | ||
while ((__raw_readl(pdata->base + 0x4) & S5P_INT_LOCAL_PWR_EN) | ||
!= S5P_INT_LOCAL_PWR_EN) { | ||
if (timeout == 0) { | ||
printk(KERN_ERR "Power domain %s enable failed.\n", | ||
dev_name(dev)); | ||
return -ETIMEDOUT; | ||
} | ||
timeout--; | ||
udelay(100); | ||
} | ||
|
||
return 0; | ||
} | ||
|
||
static int s5pv310_pd_disable(struct device *dev) | ||
{ | ||
struct samsung_pd_info *pdata = dev->platform_data; | ||
u32 timeout; | ||
|
||
__raw_writel(0, pdata->base); | ||
|
||
/* Wait max 1ms */ | ||
timeout = 10; | ||
while (__raw_readl(pdata->base + 0x4) & S5P_INT_LOCAL_PWR_EN) { | ||
if (timeout == 0) { | ||
printk(KERN_ERR "Power domain %s disable failed.\n", | ||
dev_name(dev)); | ||
return -ETIMEDOUT; | ||
} | ||
timeout--; | ||
udelay(100); | ||
} | ||
|
||
return 0; | ||
} | ||
|
||
struct platform_device s5pv310_device_pd[] = { | ||
{ | ||
.name = "samsung-pd", | ||
.id = 0, | ||
.dev = { | ||
.platform_data = &(struct samsung_pd_info) { | ||
.enable = s5pv310_pd_enable, | ||
.disable = s5pv310_pd_disable, | ||
.base = S5P_PMU_MFC_CONF, | ||
}, | ||
}, | ||
}, { | ||
.name = "samsung-pd", | ||
.id = 1, | ||
.dev = { | ||
.platform_data = &(struct samsung_pd_info) { | ||
.enable = s5pv310_pd_enable, | ||
.disable = s5pv310_pd_disable, | ||
.base = S5P_PMU_G3D_CONF, | ||
}, | ||
}, | ||
}, { | ||
.name = "samsung-pd", | ||
.id = 2, | ||
.dev = { | ||
.platform_data = &(struct samsung_pd_info) { | ||
.enable = s5pv310_pd_enable, | ||
.disable = s5pv310_pd_disable, | ||
.base = S5P_PMU_LCD0_CONF, | ||
}, | ||
}, | ||
}, { | ||
.name = "samsung-pd", | ||
.id = 3, | ||
.dev = { | ||
.platform_data = &(struct samsung_pd_info) { | ||
.enable = s5pv310_pd_enable, | ||
.disable = s5pv310_pd_disable, | ||
.base = S5P_PMU_LCD1_CONF, | ||
}, | ||
}, | ||
}, { | ||
.name = "samsung-pd", | ||
.id = 4, | ||
.dev = { | ||
.platform_data = &(struct samsung_pd_info) { | ||
.enable = s5pv310_pd_enable, | ||
.disable = s5pv310_pd_disable, | ||
.base = S5P_PMU_TV_CONF, | ||
}, | ||
}, | ||
}, { | ||
.name = "samsung-pd", | ||
.id = 5, | ||
.dev = { | ||
.platform_data = &(struct samsung_pd_info) { | ||
.enable = s5pv310_pd_enable, | ||
.disable = s5pv310_pd_disable, | ||
.base = S5P_PMU_CAM_CONF, | ||
}, | ||
}, | ||
}, { | ||
.name = "samsung-pd", | ||
.id = 6, | ||
.dev = { | ||
.platform_data = &(struct samsung_pd_info) { | ||
.enable = s5pv310_pd_enable, | ||
.disable = s5pv310_pd_disable, | ||
.base = S5P_PMU_GPS_CONF, | ||
}, | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* 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_PMU_CAM_CONF S5P_PMUREG(0x3C00) | ||
#define S5P_PMU_TV_CONF S5P_PMUREG(0x3C20) | ||
#define S5P_PMU_MFC_CONF S5P_PMUREG(0x3C40) | ||
#define S5P_PMU_G3D_CONF S5P_PMUREG(0x3C60) | ||
#define S5P_PMU_LCD0_CONF S5P_PMUREG(0x3C80) | ||
#define S5P_PMU_LCD1_CONF S5P_PMUREG(0x3CA0) | ||
#define S5P_PMU_GPS_CONF S5P_PMUREG(0x3CE0) | ||
|
||
#define S5P_INT_LOCAL_PWR_EN 0x7 | ||
|
||
#endif /* __ASM_ARCH_REGS_PMU_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters