Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
kernel_linux
提交
23618f7f
K
kernel_linux
项目概览
OpenHarmony
/
kernel_linux
上一次同步 4 年多
通知
15
Star
8
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kernel_linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
23618f7f
编写于
9月 15, 2011
作者:
T
Tony Lindgren
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'for_3.2/voltage-cleanup' of
git://gitorious.org/khilman/linux-omap-pm
into voltage
上级
ceb1c532
ee7fbba6
变更
34
隐藏空白更改
内联
并排
Showing
34 changed file
with
1599 addition
and
1271 deletion
+1599
-1271
arch/arm/mach-omap2/Makefile
arch/arm/mach-omap2/Makefile
+3
-2
arch/arm/mach-omap2/io.c
arch/arm/mach-omap2/io.c
+5
-0
arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+2
-2
arch/arm/mach-omap2/omap_twl.c
arch/arm/mach-omap2/omap_twl.c
+63
-44
arch/arm/mach-omap2/pm.c
arch/arm/mach-omap2/pm.c
+3
-3
arch/arm/mach-omap2/powerdomain.c
arch/arm/mach-omap2/powerdomain.c
+23
-0
arch/arm/mach-omap2/powerdomain.h
arch/arm/mach-omap2/powerdomain.h
+10
-0
arch/arm/mach-omap2/powerdomain2xxx_3xxx.c
arch/arm/mach-omap2/powerdomain2xxx_3xxx.c
+1
-1
arch/arm/mach-omap2/powerdomains2xxx_3xxx_data.c
arch/arm/mach-omap2/powerdomains2xxx_3xxx_data.c
+2
-0
arch/arm/mach-omap2/powerdomains2xxx_data.c
arch/arm/mach-omap2/powerdomains2xxx_data.c
+4
-0
arch/arm/mach-omap2/powerdomains3xxx_data.c
arch/arm/mach-omap2/powerdomains3xxx_data.c
+16
-0
arch/arm/mach-omap2/powerdomains44xx_data.c
arch/arm/mach-omap2/powerdomains44xx_data.c
+16
-0
arch/arm/mach-omap2/prm2xxx_3xxx.c
arch/arm/mach-omap2/prm2xxx_3xxx.c
+56
-0
arch/arm/mach-omap2/prm2xxx_3xxx.h
arch/arm/mach-omap2/prm2xxx_3xxx.h
+12
-0
arch/arm/mach-omap2/prm44xx.c
arch/arm/mach-omap2/prm44xx.c
+71
-0
arch/arm/mach-omap2/prm44xx.h
arch/arm/mach-omap2/prm44xx.h
+12
-0
arch/arm/mach-omap2/smartreflex-class3.c
arch/arm/mach-omap2/smartreflex-class3.c
+2
-2
arch/arm/mach-omap2/smartreflex.c
arch/arm/mach-omap2/smartreflex.c
+19
-10
arch/arm/mach-omap2/sr_device.c
arch/arm/mach-omap2/sr_device.c
+1
-1
arch/arm/mach-omap2/vc.c
arch/arm/mach-omap2/vc.c
+367
-0
arch/arm/mach-omap2/vc.h
arch/arm/mach-omap2/vc.h
+65
-23
arch/arm/mach-omap2/vc3xxx_data.c
arch/arm/mach-omap2/vc3xxx_data.c
+20
-11
arch/arm/mach-omap2/vc44xx_data.c
arch/arm/mach-omap2/vc44xx_data.c
+29
-15
arch/arm/mach-omap2/voltage.c
arch/arm/mach-omap2/voltage.c
+206
-882
arch/arm/mach-omap2/voltage.h
arch/arm/mach-omap2/voltage.h
+70
-68
arch/arm/mach-omap2/voltagedomains2xxx_data.c
arch/arm/mach-omap2/voltagedomains2xxx_data.c
+32
-0
arch/arm/mach-omap2/voltagedomains3xxx_data.c
arch/arm/mach-omap2/voltagedomains3xxx_data.c
+44
-39
arch/arm/mach-omap2/voltagedomains44xx_data.c
arch/arm/mach-omap2/voltagedomains44xx_data.c
+54
-45
arch/arm/mach-omap2/vp.c
arch/arm/mach-omap2/vp.c
+278
-0
arch/arm/mach-omap2/vp.h
arch/arm/mach-omap2/vp.h
+59
-74
arch/arm/mach-omap2/vp3xxx_data.c
arch/arm/mach-omap2/vp3xxx_data.c
+16
-19
arch/arm/mach-omap2/vp44xx_data.c
arch/arm/mach-omap2/vp44xx_data.c
+18
-29
arch/arm/plat-omap/include/plat/omap_hwmod.h
arch/arm/plat-omap/include/plat/omap_hwmod.h
+0
-1
arch/arm/plat-omap/include/plat/voltage.h
arch/arm/plat-omap/include/plat/voltage.h
+20
-0
未找到文件。
arch/arm/mach-omap2/Makefile
浏览文件 @
23618f7f
...
@@ -90,8 +90,9 @@ obj-$(CONFIG_ARCH_OMAP4) += prcm.o cm2xxx_3xxx.o cminst44xx.o \
...
@@ -90,8 +90,9 @@ obj-$(CONFIG_ARCH_OMAP4) += prcm.o cm2xxx_3xxx.o cminst44xx.o \
# OMAP voltage domains
# OMAP voltage domains
ifeq
($(CONFIG_PM),y)
ifeq
($(CONFIG_PM),y)
voltagedomain-common
:=
voltage.o
voltagedomain-common
:=
voltage.o vc.o vp.o
obj-$(CONFIG_ARCH_OMAP2)
+=
$
(
voltagedomain-common
)
obj-$(CONFIG_ARCH_OMAP2)
+=
$
(
voltagedomain-common
)
\
voltagedomains2xxx_data.o
obj-$(CONFIG_ARCH_OMAP3)
+=
$
(
voltagedomain-common
)
\
obj-$(CONFIG_ARCH_OMAP3)
+=
$
(
voltagedomain-common
)
\
voltagedomains3xxx_data.o
voltagedomains3xxx_data.o
obj-$(CONFIG_ARCH_OMAP4)
+=
$
(
voltagedomain-common
)
\
obj-$(CONFIG_ARCH_OMAP4)
+=
$
(
voltagedomain-common
)
\
...
...
arch/arm/mach-omap2/io.c
浏览文件 @
23618f7f
...
@@ -38,6 +38,7 @@
...
@@ -38,6 +38,7 @@
#include "io.h"
#include "io.h"
#include <plat/omap-pm.h>
#include <plat/omap-pm.h>
#include "voltage.h"
#include "powerdomain.h"
#include "powerdomain.h"
#include "clockdomain.h"
#include "clockdomain.h"
...
@@ -341,18 +342,22 @@ void __init omap2_init_common_infrastructure(void)
...
@@ -341,18 +342,22 @@ void __init omap2_init_common_infrastructure(void)
u8
postsetup_state
;
u8
postsetup_state
;
if
(
cpu_is_omap242x
())
{
if
(
cpu_is_omap242x
())
{
omap2xxx_voltagedomains_init
();
omap242x_powerdomains_init
();
omap242x_powerdomains_init
();
omap242x_clockdomains_init
();
omap242x_clockdomains_init
();
omap2420_hwmod_init
();
omap2420_hwmod_init
();
}
else
if
(
cpu_is_omap243x
())
{
}
else
if
(
cpu_is_omap243x
())
{
omap2xxx_voltagedomains_init
();
omap243x_powerdomains_init
();
omap243x_powerdomains_init
();
omap243x_clockdomains_init
();
omap243x_clockdomains_init
();
omap2430_hwmod_init
();
omap2430_hwmod_init
();
}
else
if
(
cpu_is_omap34xx
())
{
}
else
if
(
cpu_is_omap34xx
())
{
omap3xxx_voltagedomains_init
();
omap3xxx_powerdomains_init
();
omap3xxx_powerdomains_init
();
omap3xxx_clockdomains_init
();
omap3xxx_clockdomains_init
();
omap3xxx_hwmod_init
();
omap3xxx_hwmod_init
();
}
else
if
(
cpu_is_omap44xx
())
{
}
else
if
(
cpu_is_omap44xx
())
{
omap44xx_voltagedomains_init
();
omap44xx_powerdomains_init
();
omap44xx_powerdomains_init
();
omap44xx_clockdomains_init
();
omap44xx_clockdomains_init
();
omap44xx_hwmod_init
();
omap44xx_hwmod_init
();
...
...
arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
浏览文件 @
23618f7f
...
@@ -2542,7 +2542,7 @@ static struct omap_hwmod omap34xx_sr1_hwmod = {
...
@@ -2542,7 +2542,7 @@ static struct omap_hwmod omap34xx_sr1_hwmod = {
.
name
=
"sr1_hwmod"
,
.
name
=
"sr1_hwmod"
,
.
class
=
&
omap34xx_smartreflex_hwmod_class
,
.
class
=
&
omap34xx_smartreflex_hwmod_class
,
.
main_clk
=
"sr1_fck"
,
.
main_clk
=
"sr1_fck"
,
.
vdd_name
=
"mpu"
,
.
vdd_name
=
"mpu
_iva
"
,
.
prcm
=
{
.
prcm
=
{
.
omap2
=
{
.
omap2
=
{
.
prcm_reg_id
=
1
,
.
prcm_reg_id
=
1
,
...
@@ -2561,7 +2561,7 @@ static struct omap_hwmod omap36xx_sr1_hwmod = {
...
@@ -2561,7 +2561,7 @@ static struct omap_hwmod omap36xx_sr1_hwmod = {
.
name
=
"sr1_hwmod"
,
.
name
=
"sr1_hwmod"
,
.
class
=
&
omap36xx_smartreflex_hwmod_class
,
.
class
=
&
omap36xx_smartreflex_hwmod_class
,
.
main_clk
=
"sr1_fck"
,
.
main_clk
=
"sr1_fck"
,
.
vdd_name
=
"mpu"
,
.
vdd_name
=
"mpu
_iva
"
,
.
prcm
=
{
.
prcm
=
{
.
omap2
=
{
.
omap2
=
{
.
prcm_reg_id
=
1
,
.
prcm_reg_id
=
1
,
...
...
arch/arm/mach-omap2/omap_twl.c
浏览文件 @
23618f7f
...
@@ -42,8 +42,11 @@
...
@@ -42,8 +42,11 @@
#define OMAP4_SRI2C_SLAVE_ADDR 0x12
#define OMAP4_SRI2C_SLAVE_ADDR 0x12
#define OMAP4_VDD_MPU_SR_VOLT_REG 0x55
#define OMAP4_VDD_MPU_SR_VOLT_REG 0x55
#define OMAP4_VDD_MPU_SR_CMD_REG 0x56
#define OMAP4_VDD_IVA_SR_VOLT_REG 0x5B
#define OMAP4_VDD_IVA_SR_VOLT_REG 0x5B
#define OMAP4_VDD_IVA_SR_CMD_REG 0x5C
#define OMAP4_VDD_CORE_SR_VOLT_REG 0x61
#define OMAP4_VDD_CORE_SR_VOLT_REG 0x61
#define OMAP4_VDD_CORE_SR_CMD_REG 0x62
#define OMAP4_VP_CONFIG_ERROROFFSET 0x00
#define OMAP4_VP_CONFIG_ERROROFFSET 0x00
#define OMAP4_VP_VSTEPMIN_VSTEPMIN 0x01
#define OMAP4_VP_VSTEPMIN_VSTEPMIN 0x01
...
@@ -95,6 +98,8 @@ static unsigned long twl6030_vsel_to_uv(const u8 vsel)
...
@@ -95,6 +98,8 @@ static unsigned long twl6030_vsel_to_uv(const u8 vsel)
is_offset_valid
=
true
;
is_offset_valid
=
true
;
}
}
if
(
!
vsel
)
return
0
;
/*
/*
* There is no specific formula for voltage to vsel
* There is no specific formula for voltage to vsel
* conversion above 1.3V. There are special hardcoded
* conversion above 1.3V. There are special hardcoded
...
@@ -106,9 +111,9 @@ static unsigned long twl6030_vsel_to_uv(const u8 vsel)
...
@@ -106,9 +111,9 @@ static unsigned long twl6030_vsel_to_uv(const u8 vsel)
return
1350000
;
return
1350000
;
if
(
smps_offset
&
0x8
)
if
(
smps_offset
&
0x8
)
return
((((
vsel
-
1
)
*
12
5
)
+
7000
))
*
10
0
;
return
((((
vsel
-
1
)
*
12
66
)
+
70900
))
*
1
0
;
else
else
return
((((
vsel
-
1
)
*
12
5
)
+
6000
))
*
10
0
;
return
((((
vsel
-
1
)
*
12
66
)
+
60770
))
*
1
0
;
}
}
static
u8
twl6030_uv_to_vsel
(
unsigned
long
uv
)
static
u8
twl6030_uv_to_vsel
(
unsigned
long
uv
)
...
@@ -127,6 +132,8 @@ static u8 twl6030_uv_to_vsel(unsigned long uv)
...
@@ -127,6 +132,8 @@ static u8 twl6030_uv_to_vsel(unsigned long uv)
is_offset_valid
=
true
;
is_offset_valid
=
true
;
}
}
if
(
!
uv
)
return
0x00
;
/*
/*
* There is no specific formula for voltage to vsel
* There is no specific formula for voltage to vsel
* conversion above 1.3V. There are special hardcoded
* conversion above 1.3V. There are special hardcoded
...
@@ -134,16 +141,21 @@ static u8 twl6030_uv_to_vsel(unsigned long uv)
...
@@ -134,16 +141,21 @@ static u8 twl6030_uv_to_vsel(unsigned long uv)
* hardcoding only for 1.35 V which is used for 1GH OPP for
* hardcoding only for 1.35 V which is used for 1GH OPP for
* OMAP4430.
* OMAP4430.
*/
*/
if
(
uv
==
1350000
)
if
(
uv
>
twl6030_vsel_to_uv
(
0x39
))
{
if
(
uv
==
1350000
)
return
0x3A
;
pr_err
(
"%s:OUT OF RANGE! non mapped vsel for %ld Vs max %ld
\n
"
,
__func__
,
uv
,
twl6030_vsel_to_uv
(
0x39
));
return
0x3A
;
return
0x3A
;
}
if
(
smps_offset
&
0x8
)
if
(
smps_offset
&
0x8
)
return
DIV_ROUND_UP
(
uv
-
70
0000
,
1250
0
)
+
1
;
return
DIV_ROUND_UP
(
uv
-
70
9000
,
1266
0
)
+
1
;
else
else
return
DIV_ROUND_UP
(
uv
-
60
0000
,
1250
0
)
+
1
;
return
DIV_ROUND_UP
(
uv
-
60
7700
,
1266
0
)
+
1
;
}
}
static
struct
omap_volt
_pmic_info
omap3_mpu_volt_info
=
{
static
struct
omap_volt
dm_pmic
omap3_mpu_pmic
=
{
.
slew_rate
=
4000
,
.
slew_rate
=
4000
,
.
step_size
=
12500
,
.
step_size
=
12500
,
.
on_volt
=
1200000
,
.
on_volt
=
1200000
,
...
@@ -158,12 +170,13 @@ static struct omap_volt_pmic_info omap3_mpu_volt_info = {
...
@@ -158,12 +170,13 @@ static struct omap_volt_pmic_info omap3_mpu_volt_info = {
.
vp_vddmax
=
OMAP3430_VP1_VLIMITTO_VDDMAX
,
.
vp_vddmax
=
OMAP3430_VP1_VLIMITTO_VDDMAX
,
.
vp_timeout_us
=
OMAP3_VP_VLIMITTO_TIMEOUT_US
,
.
vp_timeout_us
=
OMAP3_VP_VLIMITTO_TIMEOUT_US
,
.
i2c_slave_addr
=
OMAP3_SRI2C_SLAVE_ADDR
,
.
i2c_slave_addr
=
OMAP3_SRI2C_SLAVE_ADDR
,
.
pmic_reg
=
OMAP3_VDD_MPU_SR_CONTROL_REG
,
.
volt_reg_addr
=
OMAP3_VDD_MPU_SR_CONTROL_REG
,
.
i2c_high_speed
=
true
,
.
vsel_to_uv
=
twl4030_vsel_to_uv
,
.
vsel_to_uv
=
twl4030_vsel_to_uv
,
.
uv_to_vsel
=
twl4030_uv_to_vsel
,
.
uv_to_vsel
=
twl4030_uv_to_vsel
,
};
};
static
struct
omap_volt
_pmic_info
omap3_core_volt_info
=
{
static
struct
omap_volt
dm_pmic
omap3_core_pmic
=
{
.
slew_rate
=
4000
,
.
slew_rate
=
4000
,
.
step_size
=
12500
,
.
step_size
=
12500
,
.
on_volt
=
1200000
,
.
on_volt
=
1200000
,
...
@@ -178,18 +191,19 @@ static struct omap_volt_pmic_info omap3_core_volt_info = {
...
@@ -178,18 +191,19 @@ static struct omap_volt_pmic_info omap3_core_volt_info = {
.
vp_vddmax
=
OMAP3430_VP2_VLIMITTO_VDDMAX
,
.
vp_vddmax
=
OMAP3430_VP2_VLIMITTO_VDDMAX
,
.
vp_timeout_us
=
OMAP3_VP_VLIMITTO_TIMEOUT_US
,
.
vp_timeout_us
=
OMAP3_VP_VLIMITTO_TIMEOUT_US
,
.
i2c_slave_addr
=
OMAP3_SRI2C_SLAVE_ADDR
,
.
i2c_slave_addr
=
OMAP3_SRI2C_SLAVE_ADDR
,
.
pmic_reg
=
OMAP3_VDD_CORE_SR_CONTROL_REG
,
.
volt_reg_addr
=
OMAP3_VDD_CORE_SR_CONTROL_REG
,
.
i2c_high_speed
=
true
,
.
vsel_to_uv
=
twl4030_vsel_to_uv
,
.
vsel_to_uv
=
twl4030_vsel_to_uv
,
.
uv_to_vsel
=
twl4030_uv_to_vsel
,
.
uv_to_vsel
=
twl4030_uv_to_vsel
,
};
};
static
struct
omap_volt
_pmic_info
omap4_mpu_volt_info
=
{
static
struct
omap_volt
dm_pmic
omap4_mpu_pmic
=
{
.
slew_rate
=
4000
,
.
slew_rate
=
4000
,
.
step_size
=
12
50
0
,
.
step_size
=
12
66
0
,
.
on_volt
=
13
50
000
,
.
on_volt
=
13
75
000
,
.
onlp_volt
=
13
50
000
,
.
onlp_volt
=
13
75
000
,
.
ret_volt
=
83
75
00
,
.
ret_volt
=
83
00
00
,
.
off_volt
=
60000
0
,
.
off_volt
=
0
,
.
volt_setup_time
=
0
,
.
volt_setup_time
=
0
,
.
vp_erroroffset
=
OMAP4_VP_CONFIG_ERROROFFSET
,
.
vp_erroroffset
=
OMAP4_VP_CONFIG_ERROROFFSET
,
.
vp_vstepmin
=
OMAP4_VP_VSTEPMIN_VSTEPMIN
,
.
vp_vstepmin
=
OMAP4_VP_VSTEPMIN_VSTEPMIN
,
...
@@ -198,18 +212,20 @@ static struct omap_volt_pmic_info omap4_mpu_volt_info = {
...
@@ -198,18 +212,20 @@ static struct omap_volt_pmic_info omap4_mpu_volt_info = {
.
vp_vddmax
=
OMAP4_VP_MPU_VLIMITTO_VDDMAX
,
.
vp_vddmax
=
OMAP4_VP_MPU_VLIMITTO_VDDMAX
,
.
vp_timeout_us
=
OMAP4_VP_VLIMITTO_TIMEOUT_US
,
.
vp_timeout_us
=
OMAP4_VP_VLIMITTO_TIMEOUT_US
,
.
i2c_slave_addr
=
OMAP4_SRI2C_SLAVE_ADDR
,
.
i2c_slave_addr
=
OMAP4_SRI2C_SLAVE_ADDR
,
.
pmic_reg
=
OMAP4_VDD_MPU_SR_VOLT_REG
,
.
volt_reg_addr
=
OMAP4_VDD_MPU_SR_VOLT_REG
,
.
cmd_reg_addr
=
OMAP4_VDD_MPU_SR_CMD_REG
,
.
i2c_high_speed
=
true
,
.
vsel_to_uv
=
twl6030_vsel_to_uv
,
.
vsel_to_uv
=
twl6030_vsel_to_uv
,
.
uv_to_vsel
=
twl6030_uv_to_vsel
,
.
uv_to_vsel
=
twl6030_uv_to_vsel
,
};
};
static
struct
omap_volt
_pmic_info
omap4_iva_volt_info
=
{
static
struct
omap_volt
dm_pmic
omap4_iva_pmic
=
{
.
slew_rate
=
4000
,
.
slew_rate
=
4000
,
.
step_size
=
12
50
0
,
.
step_size
=
12
66
0
,
.
on_volt
=
11
00
000
,
.
on_volt
=
11
88
000
,
.
onlp_volt
=
11
00
000
,
.
onlp_volt
=
11
88
000
,
.
ret_volt
=
83
75
00
,
.
ret_volt
=
83
00
00
,
.
off_volt
=
60000
0
,
.
off_volt
=
0
,
.
volt_setup_time
=
0
,
.
volt_setup_time
=
0
,
.
vp_erroroffset
=
OMAP4_VP_CONFIG_ERROROFFSET
,
.
vp_erroroffset
=
OMAP4_VP_CONFIG_ERROROFFSET
,
.
vp_vstepmin
=
OMAP4_VP_VSTEPMIN_VSTEPMIN
,
.
vp_vstepmin
=
OMAP4_VP_VSTEPMIN_VSTEPMIN
,
...
@@ -218,18 +234,20 @@ static struct omap_volt_pmic_info omap4_iva_volt_info = {
...
@@ -218,18 +234,20 @@ static struct omap_volt_pmic_info omap4_iva_volt_info = {
.
vp_vddmax
=
OMAP4_VP_IVA_VLIMITTO_VDDMAX
,
.
vp_vddmax
=
OMAP4_VP_IVA_VLIMITTO_VDDMAX
,
.
vp_timeout_us
=
OMAP4_VP_VLIMITTO_TIMEOUT_US
,
.
vp_timeout_us
=
OMAP4_VP_VLIMITTO_TIMEOUT_US
,
.
i2c_slave_addr
=
OMAP4_SRI2C_SLAVE_ADDR
,
.
i2c_slave_addr
=
OMAP4_SRI2C_SLAVE_ADDR
,
.
pmic_reg
=
OMAP4_VDD_IVA_SR_VOLT_REG
,
.
volt_reg_addr
=
OMAP4_VDD_IVA_SR_VOLT_REG
,
.
cmd_reg_addr
=
OMAP4_VDD_IVA_SR_CMD_REG
,
.
i2c_high_speed
=
true
,
.
vsel_to_uv
=
twl6030_vsel_to_uv
,
.
vsel_to_uv
=
twl6030_vsel_to_uv
,
.
uv_to_vsel
=
twl6030_uv_to_vsel
,
.
uv_to_vsel
=
twl6030_uv_to_vsel
,
};
};
static
struct
omap_volt
_pmic_info
omap4_core_volt_info
=
{
static
struct
omap_volt
dm_pmic
omap4_core_pmic
=
{
.
slew_rate
=
4000
,
.
slew_rate
=
4000
,
.
step_size
=
12
50
0
,
.
step_size
=
12
66
0
,
.
on_volt
=
1
1
00000
,
.
on_volt
=
1
2
00000
,
.
onlp_volt
=
1
1
00000
,
.
onlp_volt
=
1
2
00000
,
.
ret_volt
=
83
75
00
,
.
ret_volt
=
83
00
00
,
.
off_volt
=
60000
0
,
.
off_volt
=
0
,
.
volt_setup_time
=
0
,
.
volt_setup_time
=
0
,
.
vp_erroroffset
=
OMAP4_VP_CONFIG_ERROROFFSET
,
.
vp_erroroffset
=
OMAP4_VP_CONFIG_ERROROFFSET
,
.
vp_vstepmin
=
OMAP4_VP_VSTEPMIN_VSTEPMIN
,
.
vp_vstepmin
=
OMAP4_VP_VSTEPMIN_VSTEPMIN
,
...
@@ -238,7 +256,8 @@ static struct omap_volt_pmic_info omap4_core_volt_info = {
...
@@ -238,7 +256,8 @@ static struct omap_volt_pmic_info omap4_core_volt_info = {
.
vp_vddmax
=
OMAP4_VP_CORE_VLIMITTO_VDDMAX
,
.
vp_vddmax
=
OMAP4_VP_CORE_VLIMITTO_VDDMAX
,
.
vp_timeout_us
=
OMAP4_VP_VLIMITTO_TIMEOUT_US
,
.
vp_timeout_us
=
OMAP4_VP_VLIMITTO_TIMEOUT_US
,
.
i2c_slave_addr
=
OMAP4_SRI2C_SLAVE_ADDR
,
.
i2c_slave_addr
=
OMAP4_SRI2C_SLAVE_ADDR
,
.
pmic_reg
=
OMAP4_VDD_CORE_SR_VOLT_REG
,
.
volt_reg_addr
=
OMAP4_VDD_CORE_SR_VOLT_REG
,
.
cmd_reg_addr
=
OMAP4_VDD_CORE_SR_CMD_REG
,
.
vsel_to_uv
=
twl6030_vsel_to_uv
,
.
vsel_to_uv
=
twl6030_vsel_to_uv
,
.
uv_to_vsel
=
twl6030_uv_to_vsel
,
.
uv_to_vsel
=
twl6030_uv_to_vsel
,
};
};
...
@@ -250,14 +269,14 @@ int __init omap4_twl_init(void)
...
@@ -250,14 +269,14 @@ int __init omap4_twl_init(void)
if
(
!
cpu_is_omap44xx
())
if
(
!
cpu_is_omap44xx
())
return
-
ENODEV
;
return
-
ENODEV
;
voltdm
=
omap_voltage_domain
_lookup
(
"mpu"
);
voltdm
=
voltdm
_lookup
(
"mpu"
);
omap_voltage_register_pmic
(
voltdm
,
&
omap4_mpu_
volt_info
);
omap_voltage_register_pmic
(
voltdm
,
&
omap4_mpu_
pmic
);
voltdm
=
omap_voltage_domain
_lookup
(
"iva"
);
voltdm
=
voltdm
_lookup
(
"iva"
);
omap_voltage_register_pmic
(
voltdm
,
&
omap4_iva_
volt_info
);
omap_voltage_register_pmic
(
voltdm
,
&
omap4_iva_
pmic
);
voltdm
=
omap_voltage_domain
_lookup
(
"core"
);
voltdm
=
voltdm
_lookup
(
"core"
);
omap_voltage_register_pmic
(
voltdm
,
&
omap4_core_
volt_info
);
omap_voltage_register_pmic
(
voltdm
,
&
omap4_core_
pmic
);
return
0
;
return
0
;
}
}
...
@@ -270,10 +289,10 @@ int __init omap3_twl_init(void)
...
@@ -270,10 +289,10 @@ int __init omap3_twl_init(void)
return
-
ENODEV
;
return
-
ENODEV
;
if
(
cpu_is_omap3630
())
{
if
(
cpu_is_omap3630
())
{
omap3_mpu_
volt_info
.
vp_vddmin
=
OMAP3630_VP1_VLIMITTO_VDDMIN
;
omap3_mpu_
pmic
.
vp_vddmin
=
OMAP3630_VP1_VLIMITTO_VDDMIN
;
omap3_mpu_
volt_info
.
vp_vddmax
=
OMAP3630_VP1_VLIMITTO_VDDMAX
;
omap3_mpu_
pmic
.
vp_vddmax
=
OMAP3630_VP1_VLIMITTO_VDDMAX
;
omap3_core_
volt_info
.
vp_vddmin
=
OMAP3630_VP2_VLIMITTO_VDDMIN
;
omap3_core_
pmic
.
vp_vddmin
=
OMAP3630_VP2_VLIMITTO_VDDMIN
;
omap3_core_
volt_info
.
vp_vddmax
=
OMAP3630_VP2_VLIMITTO_VDDMAX
;
omap3_core_
pmic
.
vp_vddmax
=
OMAP3630_VP2_VLIMITTO_VDDMAX
;
}
}
/*
/*
...
@@ -288,11 +307,11 @@ int __init omap3_twl_init(void)
...
@@ -288,11 +307,11 @@ int __init omap3_twl_init(void)
if
(
!
twl_sr_enable_autoinit
)
if
(
!
twl_sr_enable_autoinit
)
omap3_twl_set_sr_bit
(
true
);
omap3_twl_set_sr_bit
(
true
);
voltdm
=
omap_voltage_domain_lookup
(
"mpu
"
);
voltdm
=
voltdm_lookup
(
"mpu_iva
"
);
omap_voltage_register_pmic
(
voltdm
,
&
omap3_mpu_
volt_info
);
omap_voltage_register_pmic
(
voltdm
,
&
omap3_mpu_
pmic
);
voltdm
=
omap_voltage_domain
_lookup
(
"core"
);
voltdm
=
voltdm
_lookup
(
"core"
);
omap_voltage_register_pmic
(
voltdm
,
&
omap3_core_
volt_info
);
omap_voltage_register_pmic
(
voltdm
,
&
omap3_core_
pmic
);
return
0
;
return
0
;
}
}
...
...
arch/arm/mach-omap2/pm.c
浏览文件 @
23618f7f
...
@@ -181,7 +181,7 @@ static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name,
...
@@ -181,7 +181,7 @@ static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name,
goto
exit
;
goto
exit
;
}
}
voltdm
=
omap_voltage_domain
_lookup
(
vdd_name
);
voltdm
=
voltdm
_lookup
(
vdd_name
);
if
(
IS_ERR
(
voltdm
))
{
if
(
IS_ERR
(
voltdm
))
{
printk
(
KERN_ERR
"%s: Unable to get vdd pointer for vdd_%s
\n
"
,
printk
(
KERN_ERR
"%s: Unable to get vdd pointer for vdd_%s
\n
"
,
__func__
,
vdd_name
);
__func__
,
vdd_name
);
...
@@ -212,7 +212,7 @@ static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name,
...
@@ -212,7 +212,7 @@ static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name,
goto
exit
;
goto
exit
;
}
}
omap_voltage_scale_vdd
(
voltdm
,
bootup_volt
);
voltdm_scale
(
voltdm
,
bootup_volt
);
return
0
;
return
0
;
exit:
exit:
...
@@ -226,7 +226,7 @@ static void __init omap3_init_voltages(void)
...
@@ -226,7 +226,7 @@ static void __init omap3_init_voltages(void)
if
(
!
cpu_is_omap34xx
())
if
(
!
cpu_is_omap34xx
())
return
;
return
;
omap2_set_init_voltage
(
"mpu"
,
"dpll1_ck"
,
mpu_dev
);
omap2_set_init_voltage
(
"mpu
_iva
"
,
"dpll1_ck"
,
mpu_dev
);
omap2_set_init_voltage
(
"core"
,
"l3_ick"
,
l3_dev
);
omap2_set_init_voltage
(
"core"
,
"l3_ick"
,
l3_dev
);
}
}
...
...
arch/arm/mach-omap2/powerdomain.c
浏览文件 @
23618f7f
...
@@ -77,6 +77,7 @@ static struct powerdomain *_pwrdm_lookup(const char *name)
...
@@ -77,6 +77,7 @@ static struct powerdomain *_pwrdm_lookup(const char *name)
static
int
_pwrdm_register
(
struct
powerdomain
*
pwrdm
)
static
int
_pwrdm_register
(
struct
powerdomain
*
pwrdm
)
{
{
int
i
;
int
i
;
struct
voltagedomain
*
voltdm
;
if
(
!
pwrdm
||
!
pwrdm
->
name
)
if
(
!
pwrdm
||
!
pwrdm
->
name
)
return
-
EINVAL
;
return
-
EINVAL
;
...
@@ -91,6 +92,16 @@ static int _pwrdm_register(struct powerdomain *pwrdm)
...
@@ -91,6 +92,16 @@ static int _pwrdm_register(struct powerdomain *pwrdm)
if
(
_pwrdm_lookup
(
pwrdm
->
name
))
if
(
_pwrdm_lookup
(
pwrdm
->
name
))
return
-
EEXIST
;
return
-
EEXIST
;
voltdm
=
voltdm_lookup
(
pwrdm
->
voltdm
.
name
);
if
(
!
voltdm
)
{
pr_err
(
"powerdomain: %s: voltagedomain %s does not exist
\n
"
,
pwrdm
->
name
,
pwrdm
->
voltdm
.
name
);
return
-
EINVAL
;
}
pwrdm
->
voltdm
.
ptr
=
voltdm
;
INIT_LIST_HEAD
(
&
pwrdm
->
voltdm_node
);
voltdm_add_pwrdm
(
voltdm
,
pwrdm
);
list_add
(
&
pwrdm
->
node
,
&
pwrdm_list
);
list_add
(
&
pwrdm
->
node
,
&
pwrdm_list
);
/* Initialize the powerdomain's state counter */
/* Initialize the powerdomain's state counter */
...
@@ -426,6 +437,18 @@ int pwrdm_for_each_clkdm(struct powerdomain *pwrdm,
...
@@ -426,6 +437,18 @@ int pwrdm_for_each_clkdm(struct powerdomain *pwrdm,
return
ret
;
return
ret
;
}
}
/**
* pwrdm_get_voltdm - return a ptr to the voltdm that this pwrdm resides in
* @pwrdm: struct powerdomain *
*
* Return a pointer to the struct voltageomain that the specified powerdomain
* @pwrdm exists in.
*/
struct
voltagedomain
*
pwrdm_get_voltdm
(
struct
powerdomain
*
pwrdm
)
{
return
pwrdm
->
voltdm
.
ptr
;
}
/**
/**
* pwrdm_get_mem_bank_count - get number of memory banks in this powerdomain
* pwrdm_get_mem_bank_count - get number of memory banks in this powerdomain
* @pwrdm: struct powerdomain *
* @pwrdm: struct powerdomain *
...
...
arch/arm/mach-omap2/powerdomain.h
浏览文件 @
23618f7f
...
@@ -24,6 +24,8 @@
...
@@ -24,6 +24,8 @@
#include <plat/cpu.h>
#include <plat/cpu.h>
#include "voltage.h"
/* Powerdomain basic power states */
/* Powerdomain basic power states */
#define PWRDM_POWER_OFF 0x0
#define PWRDM_POWER_OFF 0x0
#define PWRDM_POWER_RET 0x1
#define PWRDM_POWER_RET 0x1
...
@@ -78,6 +80,7 @@ struct powerdomain;
...
@@ -78,6 +80,7 @@ struct powerdomain;
/**
/**
* struct powerdomain - OMAP powerdomain
* struct powerdomain - OMAP powerdomain
* @name: Powerdomain name
* @name: Powerdomain name
* @voltdm: voltagedomain containing this powerdomain
* @prcm_offs: the address offset from CM_BASE/PRM_BASE
* @prcm_offs: the address offset from CM_BASE/PRM_BASE
* @prcm_partition: (OMAP4 only) the PRCM partition ID containing @prcm_offs
* @prcm_partition: (OMAP4 only) the PRCM partition ID containing @prcm_offs
* @pwrsts: Possible powerdomain power states
* @pwrsts: Possible powerdomain power states
...
@@ -88,6 +91,7 @@ struct powerdomain;
...
@@ -88,6 +91,7 @@ struct powerdomain;
* @pwrsts_mem_on: Possible memory bank pwrstates when pwrdm in ON
* @pwrsts_mem_on: Possible memory bank pwrstates when pwrdm in ON
* @pwrdm_clkdms: Clockdomains in this powerdomain
* @pwrdm_clkdms: Clockdomains in this powerdomain
* @node: list_head linking all powerdomains
* @node: list_head linking all powerdomains
* @voltdm_node: list_head linking all powerdomains in a voltagedomain
* @state:
* @state:
* @state_counter:
* @state_counter:
* @timer:
* @timer:
...
@@ -97,6 +101,10 @@ struct powerdomain;
...
@@ -97,6 +101,10 @@ struct powerdomain;
*/
*/
struct
powerdomain
{
struct
powerdomain
{
const
char
*
name
;
const
char
*
name
;
union
{
const
char
*
name
;
struct
voltagedomain
*
ptr
;
}
voltdm
;
const
s16
prcm_offs
;
const
s16
prcm_offs
;
const
u8
pwrsts
;
const
u8
pwrsts
;
const
u8
pwrsts_logic_ret
;
const
u8
pwrsts_logic_ret
;
...
@@ -107,6 +115,7 @@ struct powerdomain {
...
@@ -107,6 +115,7 @@ struct powerdomain {
const
u8
prcm_partition
;
const
u8
prcm_partition
;
struct
clockdomain
*
pwrdm_clkdms
[
PWRDM_MAX_CLKDMS
];
struct
clockdomain
*
pwrdm_clkdms
[
PWRDM_MAX_CLKDMS
];
struct
list_head
node
;
struct
list_head
node
;
struct
list_head
voltdm_node
;
int
state
;
int
state
;
unsigned
state_counter
[
PWRDM_MAX_PWRSTS
];
unsigned
state_counter
[
PWRDM_MAX_PWRSTS
];
unsigned
ret_logic_off_counter
;
unsigned
ret_logic_off_counter
;
...
@@ -176,6 +185,7 @@ int pwrdm_del_clkdm(struct powerdomain *pwrdm, struct clockdomain *clkdm);
...
@@ -176,6 +185,7 @@ int pwrdm_del_clkdm(struct powerdomain *pwrdm, struct clockdomain *clkdm);
int
pwrdm_for_each_clkdm
(
struct
powerdomain
*
pwrdm
,
int
pwrdm_for_each_clkdm
(
struct
powerdomain
*
pwrdm
,
int
(
*
fn
)(
struct
powerdomain
*
pwrdm
,
int
(
*
fn
)(
struct
powerdomain
*
pwrdm
,
struct
clockdomain
*
clkdm
));
struct
clockdomain
*
clkdm
));
struct
voltagedomain
*
pwrdm_get_voltdm
(
struct
powerdomain
*
pwrdm
);
int
pwrdm_get_mem_bank_count
(
struct
powerdomain
*
pwrdm
);
int
pwrdm_get_mem_bank_count
(
struct
powerdomain
*
pwrdm
);
...
...
arch/arm/mach-omap2/powerdomain2xxx_3xxx.c
浏览文件 @
23618f7f
/*
/*
* OMAP2 and OMAP3 powerdomain control
* OMAP2 and OMAP3 powerdomain control
*
*
* Copyright (C) 2009-201
0
Texas Instruments, Inc.
* Copyright (C) 2009-201
1
Texas Instruments, Inc.
* Copyright (C) 2007-2009 Nokia Corporation
* Copyright (C) 2007-2009 Nokia Corporation
*
*
* Derived from mach-omap2/powerdomain.c written by Paul Walmsley
* Derived from mach-omap2/powerdomain.c written by Paul Walmsley
...
...
arch/arm/mach-omap2/powerdomains2xxx_3xxx_data.c
浏览文件 @
23618f7f
...
@@ -54,10 +54,12 @@ struct powerdomain gfx_omap2_pwrdm = {
...
@@ -54,10 +54,12 @@ struct powerdomain gfx_omap2_pwrdm = {
.
pwrsts_mem_on
=
{
.
pwrsts_mem_on
=
{
[
0
]
=
PWRSTS_ON
,
/* MEMONSTATE */
[
0
]
=
PWRSTS_ON
,
/* MEMONSTATE */
},
},
.
voltdm
=
{
.
name
=
"core"
},
};
};
struct
powerdomain
wkup_omap2_pwrdm
=
{
struct
powerdomain
wkup_omap2_pwrdm
=
{
.
name
=
"wkup_pwrdm"
,
.
name
=
"wkup_pwrdm"
,
.
prcm_offs
=
WKUP_MOD
,
.
prcm_offs
=
WKUP_MOD
,
.
pwrsts
=
PWRSTS_ON
,
.
pwrsts
=
PWRSTS_ON
,
.
voltdm
=
{
.
name
=
"wakeup"
},
};
};
arch/arm/mach-omap2/powerdomains2xxx_data.c
浏览文件 @
23618f7f
...
@@ -37,6 +37,7 @@ static struct powerdomain dsp_pwrdm = {
...
@@ -37,6 +37,7 @@ static struct powerdomain dsp_pwrdm = {
.
pwrsts_mem_on
=
{
.
pwrsts_mem_on
=
{
[
0
]
=
PWRSTS_ON
,
[
0
]
=
PWRSTS_ON
,
},
},
.
voltdm
=
{
.
name
=
"core"
},
};
};
static
struct
powerdomain
mpu_24xx_pwrdm
=
{
static
struct
powerdomain
mpu_24xx_pwrdm
=
{
...
@@ -51,6 +52,7 @@ static struct powerdomain mpu_24xx_pwrdm = {
...
@@ -51,6 +52,7 @@ static struct powerdomain mpu_24xx_pwrdm = {
.
pwrsts_mem_on
=
{
.
pwrsts_mem_on
=
{
[
0
]
=
PWRSTS_ON
,
[
0
]
=
PWRSTS_ON
,
},
},
.
voltdm
=
{
.
name
=
"core"
},
};
};
static
struct
powerdomain
core_24xx_pwrdm
=
{
static
struct
powerdomain
core_24xx_pwrdm
=
{
...
@@ -68,6 +70,7 @@ static struct powerdomain core_24xx_pwrdm = {
...
@@ -68,6 +70,7 @@ static struct powerdomain core_24xx_pwrdm = {
[
1
]
=
PWRSTS_OFF_RET_ON
,
/* MEM2ONSTATE */
[
1
]
=
PWRSTS_OFF_RET_ON
,
/* MEM2ONSTATE */
[
2
]
=
PWRSTS_OFF_RET_ON
,
/* MEM3ONSTATE */
[
2
]
=
PWRSTS_OFF_RET_ON
,
/* MEM3ONSTATE */
},
},
.
voltdm
=
{
.
name
=
"core"
},
};
};
...
@@ -89,6 +92,7 @@ static struct powerdomain mdm_pwrdm = {
...
@@ -89,6 +92,7 @@ static struct powerdomain mdm_pwrdm = {
.
pwrsts_mem_on
=
{
.
pwrsts_mem_on
=
{
[
0
]
=
PWRSTS_ON
,
/* MEMONSTATE */
[
0
]
=
PWRSTS_ON
,
/* MEMONSTATE */
},
},
.
voltdm
=
{
.
name
=
"core"
},
};
};
/*
/*
...
...
arch/arm/mach-omap2/powerdomains3xxx_data.c
浏览文件 @
23618f7f
...
@@ -51,6 +51,7 @@ static struct powerdomain iva2_pwrdm = {
...
@@ -51,6 +51,7 @@ static struct powerdomain iva2_pwrdm = {
[
2
]
=
PWRSTS_OFF_ON
,
[
2
]
=
PWRSTS_OFF_ON
,
[
3
]
=
PWRSTS_ON
,
[
3
]
=
PWRSTS_ON
,
},
},
.
voltdm
=
{
.
name
=
"mpu_iva"
},
};
};
static
struct
powerdomain
mpu_3xxx_pwrdm
=
{
static
struct
powerdomain
mpu_3xxx_pwrdm
=
{
...
@@ -66,6 +67,7 @@ static struct powerdomain mpu_3xxx_pwrdm = {
...
@@ -66,6 +67,7 @@ static struct powerdomain mpu_3xxx_pwrdm = {
.
pwrsts_mem_on
=
{
.
pwrsts_mem_on
=
{
[
0
]
=
PWRSTS_OFF_ON
,
[
0
]
=
PWRSTS_OFF_ON
,
},
},
.
voltdm
=
{
.
name
=
"mpu_iva"
},
};
};
/*
/*
...
@@ -92,6 +94,7 @@ static struct powerdomain core_3xxx_pre_es3_1_pwrdm = {
...
@@ -92,6 +94,7 @@ static struct powerdomain core_3xxx_pre_es3_1_pwrdm = {
[
0
]
=
PWRSTS_OFF_RET_ON
,
/* MEM1ONSTATE */
[
0
]
=
PWRSTS_OFF_RET_ON
,
/* MEM1ONSTATE */
[
1
]
=
PWRSTS_OFF_RET_ON
,
/* MEM2ONSTATE */
[
1
]
=
PWRSTS_OFF_RET_ON
,
/* MEM2ONSTATE */
},
},
.
voltdm
=
{
.
name
=
"core"
},
};
};
static
struct
powerdomain
core_3xxx_es3_1_pwrdm
=
{
static
struct
powerdomain
core_3xxx_es3_1_pwrdm
=
{
...
@@ -113,6 +116,7 @@ static struct powerdomain core_3xxx_es3_1_pwrdm = {
...
@@ -113,6 +116,7 @@ static struct powerdomain core_3xxx_es3_1_pwrdm = {
[
0
]
=
PWRSTS_OFF_RET_ON
,
/* MEM1ONSTATE */
[
0
]
=
PWRSTS_OFF_RET_ON
,
/* MEM1ONSTATE */
[
1
]
=
PWRSTS_OFF_RET_ON
,
/* MEM2ONSTATE */
[
1
]
=
PWRSTS_OFF_RET_ON
,
/* MEM2ONSTATE */
},
},
.
voltdm
=
{
.
name
=
"core"
},
};
};
static
struct
powerdomain
dss_pwrdm
=
{
static
struct
powerdomain
dss_pwrdm
=
{
...
@@ -127,6 +131,7 @@ static struct powerdomain dss_pwrdm = {
...
@@ -127,6 +131,7 @@ static struct powerdomain dss_pwrdm = {
.
pwrsts_mem_on
=
{
.
pwrsts_mem_on
=
{
[
0
]
=
PWRSTS_ON
,
/* MEMONSTATE */
[
0
]
=
PWRSTS_ON
,
/* MEMONSTATE */
},
},
.
voltdm
=
{
.
name
=
"core"
},
};
};
/*
/*
...
@@ -147,6 +152,7 @@ static struct powerdomain sgx_pwrdm = {
...
@@ -147,6 +152,7 @@ static struct powerdomain sgx_pwrdm = {
.
pwrsts_mem_on
=
{
.
pwrsts_mem_on
=
{
[
0
]
=
PWRSTS_ON
,
/* MEMONSTATE */
[
0
]
=
PWRSTS_ON
,
/* MEMONSTATE */
},
},
.
voltdm
=
{
.
name
=
"core"
},
};
};
static
struct
powerdomain
cam_pwrdm
=
{
static
struct
powerdomain
cam_pwrdm
=
{
...
@@ -161,6 +167,7 @@ static struct powerdomain cam_pwrdm = {
...
@@ -161,6 +167,7 @@ static struct powerdomain cam_pwrdm = {
.
pwrsts_mem_on
=
{
.
pwrsts_mem_on
=
{
[
0
]
=
PWRSTS_ON
,
/* MEMONSTATE */
[
0
]
=
PWRSTS_ON
,
/* MEMONSTATE */
},
},
.
voltdm
=
{
.
name
=
"core"
},
};
};
static
struct
powerdomain
per_pwrdm
=
{
static
struct
powerdomain
per_pwrdm
=
{
...
@@ -175,11 +182,13 @@ static struct powerdomain per_pwrdm = {
...
@@ -175,11 +182,13 @@ static struct powerdomain per_pwrdm = {
.
pwrsts_mem_on
=
{
.
pwrsts_mem_on
=
{
[
0
]
=
PWRSTS_ON
,
/* MEMONSTATE */
[
0
]
=
PWRSTS_ON
,
/* MEMONSTATE */
},
},
.
voltdm
=
{
.
name
=
"core"
},
};
};
static
struct
powerdomain
emu_pwrdm
=
{
static
struct
powerdomain
emu_pwrdm
=
{
.
name
=
"emu_pwrdm"
,
.
name
=
"emu_pwrdm"
,
.
prcm_offs
=
OMAP3430_EMU_MOD
,
.
prcm_offs
=
OMAP3430_EMU_MOD
,
.
voltdm
=
{
.
name
=
"core"
},
};
};
static
struct
powerdomain
neon_pwrdm
=
{
static
struct
powerdomain
neon_pwrdm
=
{
...
@@ -187,6 +196,7 @@ static struct powerdomain neon_pwrdm = {
...
@@ -187,6 +196,7 @@ static struct powerdomain neon_pwrdm = {
.
prcm_offs
=
OMAP3430_NEON_MOD
,
.
prcm_offs
=
OMAP3430_NEON_MOD
,
.
pwrsts
=
PWRSTS_OFF_RET_ON
,
.
pwrsts
=
PWRSTS_OFF_RET_ON
,
.
pwrsts_logic_ret
=
PWRSTS_RET
,
.
pwrsts_logic_ret
=
PWRSTS_RET
,
.
voltdm
=
{
.
name
=
"mpu_iva"
},
};
};
static
struct
powerdomain
usbhost_pwrdm
=
{
static
struct
powerdomain
usbhost_pwrdm
=
{
...
@@ -208,31 +218,37 @@ static struct powerdomain usbhost_pwrdm = {
...
@@ -208,31 +218,37 @@ static struct powerdomain usbhost_pwrdm = {
.
pwrsts_mem_on
=
{
.
pwrsts_mem_on
=
{
[
0
]
=
PWRSTS_ON
,
/* MEMONSTATE */
[
0
]
=
PWRSTS_ON
,
/* MEMONSTATE */
},
},
.
voltdm
=
{
.
name
=
"core"
},
};
};
static
struct
powerdomain
dpll1_pwrdm
=
{
static
struct
powerdomain
dpll1_pwrdm
=
{
.
name
=
"dpll1_pwrdm"
,
.
name
=
"dpll1_pwrdm"
,
.
prcm_offs
=
MPU_MOD
,
.
prcm_offs
=
MPU_MOD
,
.
voltdm
=
{
.
name
=
"mpu_iva"
},
};
};
static
struct
powerdomain
dpll2_pwrdm
=
{
static
struct
powerdomain
dpll2_pwrdm
=
{
.
name
=
"dpll2_pwrdm"
,
.
name
=
"dpll2_pwrdm"
,
.
prcm_offs
=
OMAP3430_IVA2_MOD
,
.
prcm_offs
=
OMAP3430_IVA2_MOD
,
.
voltdm
=
{
.
name
=
"mpu_iva"
},
};
};
static
struct
powerdomain
dpll3_pwrdm
=
{
static
struct
powerdomain
dpll3_pwrdm
=
{
.
name
=
"dpll3_pwrdm"
,
.
name
=
"dpll3_pwrdm"
,
.
prcm_offs
=
PLL_MOD
,
.
prcm_offs
=
PLL_MOD
,
.
voltdm
=
{
.
name
=
"core"
},
};
};
static
struct
powerdomain
dpll4_pwrdm
=
{
static
struct
powerdomain
dpll4_pwrdm
=
{
.
name
=
"dpll4_pwrdm"
,
.
name
=
"dpll4_pwrdm"
,
.
prcm_offs
=
PLL_MOD
,
.
prcm_offs
=
PLL_MOD
,
.
voltdm
=
{
.
name
=
"core"
},
};
};
static
struct
powerdomain
dpll5_pwrdm
=
{
static
struct
powerdomain
dpll5_pwrdm
=
{
.
name
=
"dpll5_pwrdm"
,
.
name
=
"dpll5_pwrdm"
,
.
prcm_offs
=
PLL_MOD
,
.
prcm_offs
=
PLL_MOD
,
.
voltdm
=
{
.
name
=
"core"
},
};
};
/* As powerdomains are added or removed above, this list must also be changed */
/* As powerdomains are added or removed above, this list must also be changed */
...
...
arch/arm/mach-omap2/powerdomains44xx_data.c
浏览文件 @
23618f7f
...
@@ -33,6 +33,7 @@
...
@@ -33,6 +33,7 @@
/* core_44xx_pwrdm: CORE power domain */
/* core_44xx_pwrdm: CORE power domain */
static
struct
powerdomain
core_44xx_pwrdm
=
{
static
struct
powerdomain
core_44xx_pwrdm
=
{
.
name
=
"core_pwrdm"
,
.
name
=
"core_pwrdm"
,
.
voltdm
=
{
.
name
=
"core"
},
.
prcm_offs
=
OMAP4430_PRM_CORE_INST
,
.
prcm_offs
=
OMAP4430_PRM_CORE_INST
,
.
prcm_partition
=
OMAP4430_PRM_PARTITION
,
.
prcm_partition
=
OMAP4430_PRM_PARTITION
,
.
pwrsts
=
PWRSTS_RET_ON
,
.
pwrsts
=
PWRSTS_RET_ON
,
...
@@ -58,6 +59,7 @@ static struct powerdomain core_44xx_pwrdm = {
...
@@ -58,6 +59,7 @@ static struct powerdomain core_44xx_pwrdm = {
/* gfx_44xx_pwrdm: 3D accelerator power domain */
/* gfx_44xx_pwrdm: 3D accelerator power domain */
static
struct
powerdomain
gfx_44xx_pwrdm
=
{
static
struct
powerdomain
gfx_44xx_pwrdm
=
{
.
name
=
"gfx_pwrdm"
,
.
name
=
"gfx_pwrdm"
,
.
voltdm
=
{
.
name
=
"core"
},
.
prcm_offs
=
OMAP4430_PRM_GFX_INST
,
.
prcm_offs
=
OMAP4430_PRM_GFX_INST
,
.
prcm_partition
=
OMAP4430_PRM_PARTITION
,
.
prcm_partition
=
OMAP4430_PRM_PARTITION
,
.
pwrsts
=
PWRSTS_OFF_ON
,
.
pwrsts
=
PWRSTS_OFF_ON
,
...
@@ -74,6 +76,7 @@ static struct powerdomain gfx_44xx_pwrdm = {
...
@@ -74,6 +76,7 @@ static struct powerdomain gfx_44xx_pwrdm = {
/* abe_44xx_pwrdm: Audio back end power domain */
/* abe_44xx_pwrdm: Audio back end power domain */
static
struct
powerdomain
abe_44xx_pwrdm
=
{
static
struct
powerdomain
abe_44xx_pwrdm
=
{
.
name
=
"abe_pwrdm"
,
.
name
=
"abe_pwrdm"
,
.
voltdm
=
{
.
name
=
"iva"
},
.
prcm_offs
=
OMAP4430_PRM_ABE_INST
,
.
prcm_offs
=
OMAP4430_PRM_ABE_INST
,
.
prcm_partition
=
OMAP4430_PRM_PARTITION
,
.
prcm_partition
=
OMAP4430_PRM_PARTITION
,
.
pwrsts
=
PWRSTS_OFF_RET_ON
,
.
pwrsts
=
PWRSTS_OFF_RET_ON
,
...
@@ -93,6 +96,7 @@ static struct powerdomain abe_44xx_pwrdm = {
...
@@ -93,6 +96,7 @@ static struct powerdomain abe_44xx_pwrdm = {
/* dss_44xx_pwrdm: Display subsystem power domain */
/* dss_44xx_pwrdm: Display subsystem power domain */
static
struct
powerdomain
dss_44xx_pwrdm
=
{
static
struct
powerdomain
dss_44xx_pwrdm
=
{
.
name
=
"dss_pwrdm"
,
.
name
=
"dss_pwrdm"
,
.
voltdm
=
{
.
name
=
"core"
},
.
prcm_offs
=
OMAP4430_PRM_DSS_INST
,
.
prcm_offs
=
OMAP4430_PRM_DSS_INST
,
.
prcm_partition
=
OMAP4430_PRM_PARTITION
,
.
prcm_partition
=
OMAP4430_PRM_PARTITION
,
.
pwrsts
=
PWRSTS_OFF_RET_ON
,
.
pwrsts
=
PWRSTS_OFF_RET_ON
,
...
@@ -110,6 +114,7 @@ static struct powerdomain dss_44xx_pwrdm = {
...
@@ -110,6 +114,7 @@ static struct powerdomain dss_44xx_pwrdm = {
/* tesla_44xx_pwrdm: Tesla processor power domain */
/* tesla_44xx_pwrdm: Tesla processor power domain */
static
struct
powerdomain
tesla_44xx_pwrdm
=
{
static
struct
powerdomain
tesla_44xx_pwrdm
=
{
.
name
=
"tesla_pwrdm"
,
.
name
=
"tesla_pwrdm"
,
.
voltdm
=
{
.
name
=
"iva"
},
.
prcm_offs
=
OMAP4430_PRM_TESLA_INST
,
.
prcm_offs
=
OMAP4430_PRM_TESLA_INST
,
.
prcm_partition
=
OMAP4430_PRM_PARTITION
,
.
prcm_partition
=
OMAP4430_PRM_PARTITION
,
.
pwrsts
=
PWRSTS_OFF_RET_ON
,
.
pwrsts
=
PWRSTS_OFF_RET_ON
,
...
@@ -131,6 +136,7 @@ static struct powerdomain tesla_44xx_pwrdm = {
...
@@ -131,6 +136,7 @@ static struct powerdomain tesla_44xx_pwrdm = {
/* wkup_44xx_pwrdm: Wake-up power domain */
/* wkup_44xx_pwrdm: Wake-up power domain */
static
struct
powerdomain
wkup_44xx_pwrdm
=
{
static
struct
powerdomain
wkup_44xx_pwrdm
=
{
.
name
=
"wkup_pwrdm"
,
.
name
=
"wkup_pwrdm"
,
.
voltdm
=
{
.
name
=
"wakeup"
},
.
prcm_offs
=
OMAP4430_PRM_WKUP_INST
,
.
prcm_offs
=
OMAP4430_PRM_WKUP_INST
,
.
prcm_partition
=
OMAP4430_PRM_PARTITION
,
.
prcm_partition
=
OMAP4430_PRM_PARTITION
,
.
pwrsts
=
PWRSTS_ON
,
.
pwrsts
=
PWRSTS_ON
,
...
@@ -146,6 +152,7 @@ static struct powerdomain wkup_44xx_pwrdm = {
...
@@ -146,6 +152,7 @@ static struct powerdomain wkup_44xx_pwrdm = {
/* cpu0_44xx_pwrdm: MPU0 processor and Neon coprocessor power domain */
/* cpu0_44xx_pwrdm: MPU0 processor and Neon coprocessor power domain */
static
struct
powerdomain
cpu0_44xx_pwrdm
=
{
static
struct
powerdomain
cpu0_44xx_pwrdm
=
{
.
name
=
"cpu0_pwrdm"
,
.
name
=
"cpu0_pwrdm"
,
.
voltdm
=
{
.
name
=
"mpu"
},
.
prcm_offs
=
OMAP4430_PRCM_MPU_CPU0_INST
,
.
prcm_offs
=
OMAP4430_PRCM_MPU_CPU0_INST
,
.
prcm_partition
=
OMAP4430_PRCM_MPU_PARTITION
,
.
prcm_partition
=
OMAP4430_PRCM_MPU_PARTITION
,
.
pwrsts
=
PWRSTS_OFF_RET_ON
,
.
pwrsts
=
PWRSTS_OFF_RET_ON
,
...
@@ -162,6 +169,7 @@ static struct powerdomain cpu0_44xx_pwrdm = {
...
@@ -162,6 +169,7 @@ static struct powerdomain cpu0_44xx_pwrdm = {
/* cpu1_44xx_pwrdm: MPU1 processor and Neon coprocessor power domain */
/* cpu1_44xx_pwrdm: MPU1 processor and Neon coprocessor power domain */
static
struct
powerdomain
cpu1_44xx_pwrdm
=
{
static
struct
powerdomain
cpu1_44xx_pwrdm
=
{
.
name
=
"cpu1_pwrdm"
,
.
name
=
"cpu1_pwrdm"
,
.
voltdm
=
{
.
name
=
"mpu"
},
.
prcm_offs
=
OMAP4430_PRCM_MPU_CPU1_INST
,
.
prcm_offs
=
OMAP4430_PRCM_MPU_CPU1_INST
,
.
prcm_partition
=
OMAP4430_PRCM_MPU_PARTITION
,
.
prcm_partition
=
OMAP4430_PRCM_MPU_PARTITION
,
.
pwrsts
=
PWRSTS_OFF_RET_ON
,
.
pwrsts
=
PWRSTS_OFF_RET_ON
,
...
@@ -178,6 +186,7 @@ static struct powerdomain cpu1_44xx_pwrdm = {
...
@@ -178,6 +186,7 @@ static struct powerdomain cpu1_44xx_pwrdm = {
/* emu_44xx_pwrdm: Emulation power domain */
/* emu_44xx_pwrdm: Emulation power domain */
static
struct
powerdomain
emu_44xx_pwrdm
=
{
static
struct
powerdomain
emu_44xx_pwrdm
=
{
.
name
=
"emu_pwrdm"
,
.
name
=
"emu_pwrdm"
,
.
voltdm
=
{
.
name
=
"wakeup"
},
.
prcm_offs
=
OMAP4430_PRM_EMU_INST
,
.
prcm_offs
=
OMAP4430_PRM_EMU_INST
,
.
prcm_partition
=
OMAP4430_PRM_PARTITION
,
.
prcm_partition
=
OMAP4430_PRM_PARTITION
,
.
pwrsts
=
PWRSTS_OFF_ON
,
.
pwrsts
=
PWRSTS_OFF_ON
,
...
@@ -193,6 +202,7 @@ static struct powerdomain emu_44xx_pwrdm = {
...
@@ -193,6 +202,7 @@ static struct powerdomain emu_44xx_pwrdm = {
/* mpu_44xx_pwrdm: Modena processor and the Neon coprocessor power domain */
/* mpu_44xx_pwrdm: Modena processor and the Neon coprocessor power domain */
static
struct
powerdomain
mpu_44xx_pwrdm
=
{
static
struct
powerdomain
mpu_44xx_pwrdm
=
{
.
name
=
"mpu_pwrdm"
,
.
name
=
"mpu_pwrdm"
,
.
voltdm
=
{
.
name
=
"mpu"
},
.
prcm_offs
=
OMAP4430_PRM_MPU_INST
,
.
prcm_offs
=
OMAP4430_PRM_MPU_INST
,
.
prcm_partition
=
OMAP4430_PRM_PARTITION
,
.
prcm_partition
=
OMAP4430_PRM_PARTITION
,
.
pwrsts
=
PWRSTS_RET_ON
,
.
pwrsts
=
PWRSTS_RET_ON
,
...
@@ -213,6 +223,7 @@ static struct powerdomain mpu_44xx_pwrdm = {
...
@@ -213,6 +223,7 @@ static struct powerdomain mpu_44xx_pwrdm = {
/* ivahd_44xx_pwrdm: IVA-HD power domain */
/* ivahd_44xx_pwrdm: IVA-HD power domain */
static
struct
powerdomain
ivahd_44xx_pwrdm
=
{
static
struct
powerdomain
ivahd_44xx_pwrdm
=
{
.
name
=
"ivahd_pwrdm"
,
.
name
=
"ivahd_pwrdm"
,
.
voltdm
=
{
.
name
=
"iva"
},
.
prcm_offs
=
OMAP4430_PRM_IVAHD_INST
,
.
prcm_offs
=
OMAP4430_PRM_IVAHD_INST
,
.
prcm_partition
=
OMAP4430_PRM_PARTITION
,
.
prcm_partition
=
OMAP4430_PRM_PARTITION
,
.
pwrsts
=
PWRSTS_OFF_RET_ON
,
.
pwrsts
=
PWRSTS_OFF_RET_ON
,
...
@@ -236,6 +247,7 @@ static struct powerdomain ivahd_44xx_pwrdm = {
...
@@ -236,6 +247,7 @@ static struct powerdomain ivahd_44xx_pwrdm = {
/* cam_44xx_pwrdm: Camera subsystem power domain */
/* cam_44xx_pwrdm: Camera subsystem power domain */
static
struct
powerdomain
cam_44xx_pwrdm
=
{
static
struct
powerdomain
cam_44xx_pwrdm
=
{
.
name
=
"cam_pwrdm"
,
.
name
=
"cam_pwrdm"
,
.
voltdm
=
{
.
name
=
"core"
},
.
prcm_offs
=
OMAP4430_PRM_CAM_INST
,
.
prcm_offs
=
OMAP4430_PRM_CAM_INST
,
.
prcm_partition
=
OMAP4430_PRM_PARTITION
,
.
prcm_partition
=
OMAP4430_PRM_PARTITION
,
.
pwrsts
=
PWRSTS_OFF_ON
,
.
pwrsts
=
PWRSTS_OFF_ON
,
...
@@ -252,6 +264,7 @@ static struct powerdomain cam_44xx_pwrdm = {
...
@@ -252,6 +264,7 @@ static struct powerdomain cam_44xx_pwrdm = {
/* l3init_44xx_pwrdm: L3 initators pheripherals power domain */
/* l3init_44xx_pwrdm: L3 initators pheripherals power domain */
static
struct
powerdomain
l3init_44xx_pwrdm
=
{
static
struct
powerdomain
l3init_44xx_pwrdm
=
{
.
name
=
"l3init_pwrdm"
,
.
name
=
"l3init_pwrdm"
,
.
voltdm
=
{
.
name
=
"core"
},
.
prcm_offs
=
OMAP4430_PRM_L3INIT_INST
,
.
prcm_offs
=
OMAP4430_PRM_L3INIT_INST
,
.
prcm_partition
=
OMAP4430_PRM_PARTITION
,
.
prcm_partition
=
OMAP4430_PRM_PARTITION
,
.
pwrsts
=
PWRSTS_RET_ON
,
.
pwrsts
=
PWRSTS_RET_ON
,
...
@@ -269,6 +282,7 @@ static struct powerdomain l3init_44xx_pwrdm = {
...
@@ -269,6 +282,7 @@ static struct powerdomain l3init_44xx_pwrdm = {
/* l4per_44xx_pwrdm: Target peripherals power domain */
/* l4per_44xx_pwrdm: Target peripherals power domain */
static
struct
powerdomain
l4per_44xx_pwrdm
=
{
static
struct
powerdomain
l4per_44xx_pwrdm
=
{
.
name
=
"l4per_pwrdm"
,
.
name
=
"l4per_pwrdm"
,
.
voltdm
=
{
.
name
=
"core"
},
.
prcm_offs
=
OMAP4430_PRM_L4PER_INST
,
.
prcm_offs
=
OMAP4430_PRM_L4PER_INST
,
.
prcm_partition
=
OMAP4430_PRM_PARTITION
,
.
prcm_partition
=
OMAP4430_PRM_PARTITION
,
.
pwrsts
=
PWRSTS_RET_ON
,
.
pwrsts
=
PWRSTS_RET_ON
,
...
@@ -291,6 +305,7 @@ static struct powerdomain l4per_44xx_pwrdm = {
...
@@ -291,6 +305,7 @@ static struct powerdomain l4per_44xx_pwrdm = {
*/
*/
static
struct
powerdomain
always_on_core_44xx_pwrdm
=
{
static
struct
powerdomain
always_on_core_44xx_pwrdm
=
{
.
name
=
"always_on_core_pwrdm"
,
.
name
=
"always_on_core_pwrdm"
,
.
voltdm
=
{
.
name
=
"core"
},
.
prcm_offs
=
OMAP4430_PRM_ALWAYS_ON_INST
,
.
prcm_offs
=
OMAP4430_PRM_ALWAYS_ON_INST
,
.
prcm_partition
=
OMAP4430_PRM_PARTITION
,
.
prcm_partition
=
OMAP4430_PRM_PARTITION
,
.
pwrsts
=
PWRSTS_ON
,
.
pwrsts
=
PWRSTS_ON
,
...
@@ -299,6 +314,7 @@ static struct powerdomain always_on_core_44xx_pwrdm = {
...
@@ -299,6 +314,7 @@ static struct powerdomain always_on_core_44xx_pwrdm = {
/* cefuse_44xx_pwrdm: Customer efuse controller power domain */
/* cefuse_44xx_pwrdm: Customer efuse controller power domain */
static
struct
powerdomain
cefuse_44xx_pwrdm
=
{
static
struct
powerdomain
cefuse_44xx_pwrdm
=
{
.
name
=
"cefuse_pwrdm"
,
.
name
=
"cefuse_pwrdm"
,
.
voltdm
=
{
.
name
=
"core"
},
.
prcm_offs
=
OMAP4430_PRM_CEFUSE_INST
,
.
prcm_offs
=
OMAP4430_PRM_CEFUSE_INST
,
.
prcm_partition
=
OMAP4430_PRM_PARTITION
,
.
prcm_partition
=
OMAP4430_PRM_PARTITION
,
.
pwrsts
=
PWRSTS_OFF_ON
,
.
pwrsts
=
PWRSTS_OFF_ON
,
...
...
arch/arm/mach-omap2/prm2xxx_3xxx.c
浏览文件 @
23618f7f
...
@@ -20,6 +20,8 @@
...
@@ -20,6 +20,8 @@
#include <plat/cpu.h>
#include <plat/cpu.h>
#include <plat/prcm.h>
#include <plat/prcm.h>
#include "vp.h"
#include "prm2xxx_3xxx.h"
#include "prm2xxx_3xxx.h"
#include "cm2xxx_3xxx.h"
#include "cm2xxx_3xxx.h"
#include "prm-regbits-24xx.h"
#include "prm-regbits-24xx.h"
...
@@ -156,3 +158,57 @@ int omap2_prm_deassert_hardreset(s16 prm_mod, u8 rst_shift, u8 st_shift)
...
@@ -156,3 +158,57 @@ int omap2_prm_deassert_hardreset(s16 prm_mod, u8 rst_shift, u8 st_shift)
return
(
c
==
MAX_MODULE_HARDRESET_WAIT
)
?
-
EBUSY
:
0
;
return
(
c
==
MAX_MODULE_HARDRESET_WAIT
)
?
-
EBUSY
:
0
;
}
}
/* PRM VP */
/*
* struct omap3_vp - OMAP3 VP register access description.
* @tranxdone_status: VP_TRANXDONE_ST bitmask in PRM_IRQSTATUS_MPU reg
*/
struct
omap3_vp
{
u32
tranxdone_status
;
};
static
struct
omap3_vp
omap3_vp
[]
=
{
[
OMAP3_VP_VDD_MPU_ID
]
=
{
.
tranxdone_status
=
OMAP3430_VP1_TRANXDONE_ST_MASK
,
},
[
OMAP3_VP_VDD_CORE_ID
]
=
{
.
tranxdone_status
=
OMAP3430_VP2_TRANXDONE_ST_MASK
,
},
};
#define MAX_VP_ID ARRAY_SIZE(omap3_vp);
u32
omap3_prm_vp_check_txdone
(
u8
vp_id
)
{
struct
omap3_vp
*
vp
=
&
omap3_vp
[
vp_id
];
u32
irqstatus
;
irqstatus
=
omap2_prm_read_mod_reg
(
OCP_MOD
,
OMAP3_PRM_IRQSTATUS_MPU_OFFSET
);
return
irqstatus
&
vp
->
tranxdone_status
;
}
void
omap3_prm_vp_clear_txdone
(
u8
vp_id
)
{
struct
omap3_vp
*
vp
=
&
omap3_vp
[
vp_id
];
omap2_prm_write_mod_reg
(
vp
->
tranxdone_status
,
OCP_MOD
,
OMAP3_PRM_IRQSTATUS_MPU_OFFSET
);
}
u32
omap3_prm_vcvp_read
(
u8
offset
)
{
return
omap2_prm_read_mod_reg
(
OMAP3430_GR_MOD
,
offset
);
}
void
omap3_prm_vcvp_write
(
u32
val
,
u8
offset
)
{
omap2_prm_write_mod_reg
(
val
,
OMAP3430_GR_MOD
,
offset
);
}
u32
omap3_prm_vcvp_rmw
(
u32
mask
,
u32
bits
,
u8
offset
)
{
return
omap2_prm_rmw_mod_reg_bits
(
mask
,
bits
,
OMAP3430_GR_MOD
,
offset
);
}
arch/arm/mach-omap2/prm2xxx_3xxx.h
浏览文件 @
23618f7f
...
@@ -303,7 +303,19 @@ extern int omap2_prm_is_hardreset_asserted(s16 prm_mod, u8 shift);
...
@@ -303,7 +303,19 @@ extern int omap2_prm_is_hardreset_asserted(s16 prm_mod, u8 shift);
extern
int
omap2_prm_assert_hardreset
(
s16
prm_mod
,
u8
shift
);
extern
int
omap2_prm_assert_hardreset
(
s16
prm_mod
,
u8
shift
);
extern
int
omap2_prm_deassert_hardreset
(
s16
prm_mod
,
u8
rst_shift
,
u8
st_shift
);
extern
int
omap2_prm_deassert_hardreset
(
s16
prm_mod
,
u8
rst_shift
,
u8
st_shift
);
/* OMAP3-specific VP functions */
u32
omap3_prm_vp_check_txdone
(
u8
vp_id
);
void
omap3_prm_vp_clear_txdone
(
u8
vp_id
);
/*
* OMAP3 access functions for voltage controller (VC) and
* voltage proccessor (VP) in the PRM.
*/
extern
u32
omap3_prm_vcvp_read
(
u8
offset
);
extern
void
omap3_prm_vcvp_write
(
u32
val
,
u8
offset
);
extern
u32
omap3_prm_vcvp_rmw
(
u32
mask
,
u32
bits
,
u8
offset
);
#endif
/* CONFIG_ARCH_OMAP4 */
#endif
/* CONFIG_ARCH_OMAP4 */
#endif
#endif
/*
/*
...
...
arch/arm/mach-omap2/prm44xx.c
浏览文件 @
23618f7f
...
@@ -21,8 +21,11 @@
...
@@ -21,8 +21,11 @@
#include <plat/cpu.h>
#include <plat/cpu.h>
#include <plat/prcm.h>
#include <plat/prcm.h>
#include "vp.h"
#include "prm44xx.h"
#include "prm44xx.h"
#include "prm-regbits-44xx.h"
#include "prm-regbits-44xx.h"
#include "prcm44xx.h"
#include "prminst44xx.h"
/* PRM low-level functions */
/* PRM low-level functions */
...
@@ -50,3 +53,71 @@ u32 omap4_prm_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 reg)
...
@@ -50,3 +53,71 @@ u32 omap4_prm_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 reg)
return
v
;
return
v
;
}
}
/* PRM VP */
/*
* struct omap4_vp - OMAP4 VP register access description.
* @irqstatus_mpu: offset to IRQSTATUS_MPU register for VP
* @tranxdone_status: VP_TRANXDONE_ST bitmask in PRM_IRQSTATUS_MPU reg
*/
struct
omap4_vp
{
u32
irqstatus_mpu
;
u32
tranxdone_status
;
};
static
struct
omap4_vp
omap4_vp
[]
=
{
[
OMAP4_VP_VDD_MPU_ID
]
=
{
.
irqstatus_mpu
=
OMAP4_PRM_IRQSTATUS_MPU_2_OFFSET
,
.
tranxdone_status
=
OMAP4430_VP_MPU_TRANXDONE_ST_MASK
,
},
[
OMAP4_VP_VDD_IVA_ID
]
=
{
.
irqstatus_mpu
=
OMAP4_PRM_IRQSTATUS_MPU_OFFSET
,
.
tranxdone_status
=
OMAP4430_VP_IVA_TRANXDONE_ST_MASK
,
},
[
OMAP4_VP_VDD_CORE_ID
]
=
{
.
irqstatus_mpu
=
OMAP4_PRM_IRQSTATUS_MPU_OFFSET
,
.
tranxdone_status
=
OMAP4430_VP_CORE_TRANXDONE_ST_MASK
,
},
};
u32
omap4_prm_vp_check_txdone
(
u8
vp_id
)
{
struct
omap4_vp
*
vp
=
&
omap4_vp
[
vp_id
];
u32
irqstatus
;
irqstatus
=
omap4_prminst_read_inst_reg
(
OMAP4430_PRM_PARTITION
,
OMAP4430_PRM_OCP_SOCKET_INST
,
vp
->
irqstatus_mpu
);
return
irqstatus
&
vp
->
tranxdone_status
;
}
void
omap4_prm_vp_clear_txdone
(
u8
vp_id
)
{
struct
omap4_vp
*
vp
=
&
omap4_vp
[
vp_id
];
omap4_prminst_write_inst_reg
(
vp
->
tranxdone_status
,
OMAP4430_PRM_PARTITION
,
OMAP4430_PRM_OCP_SOCKET_INST
,
vp
->
irqstatus_mpu
);
};
u32
omap4_prm_vcvp_read
(
u8
offset
)
{
return
omap4_prminst_read_inst_reg
(
OMAP4430_PRM_PARTITION
,
OMAP4430_PRM_DEVICE_INST
,
offset
);
}
void
omap4_prm_vcvp_write
(
u32
val
,
u8
offset
)
{
omap4_prminst_write_inst_reg
(
val
,
OMAP4430_PRM_PARTITION
,
OMAP4430_PRM_DEVICE_INST
,
offset
);
}
u32
omap4_prm_vcvp_rmw
(
u32
mask
,
u32
bits
,
u8
offset
)
{
return
omap4_prminst_rmw_inst_reg_bits
(
mask
,
bits
,
OMAP4430_PRM_PARTITION
,
OMAP4430_PRM_DEVICE_INST
,
offset
);
}
arch/arm/mach-omap2/prm44xx.h
浏览文件 @
23618f7f
...
@@ -751,6 +751,18 @@ extern u32 omap4_prm_read_inst_reg(s16 inst, u16 idx);
...
@@ -751,6 +751,18 @@ extern u32 omap4_prm_read_inst_reg(s16 inst, u16 idx);
extern
void
omap4_prm_write_inst_reg
(
u32
val
,
s16
inst
,
u16
idx
);
extern
void
omap4_prm_write_inst_reg
(
u32
val
,
s16
inst
,
u16
idx
);
extern
u32
omap4_prm_rmw_inst_reg_bits
(
u32
mask
,
u32
bits
,
s16
inst
,
s16
idx
);
extern
u32
omap4_prm_rmw_inst_reg_bits
(
u32
mask
,
u32
bits
,
s16
inst
,
s16
idx
);
/* OMAP4-specific VP functions */
u32
omap4_prm_vp_check_txdone
(
u8
vp_id
);
void
omap4_prm_vp_clear_txdone
(
u8
vp_id
);
/*
* OMAP4 access functions for voltage controller (VC) and
* voltage proccessor (VP) in the PRM.
*/
extern
u32
omap4_prm_vcvp_read
(
u8
offset
);
extern
void
omap4_prm_vcvp_write
(
u32
val
,
u8
offset
);
extern
u32
omap4_prm_vcvp_rmw
(
u32
mask
,
u32
bits
,
u8
offset
);
# endif
# endif
#endif
#endif
arch/arm/mach-omap2/smartreflex-class3.c
浏览文件 @
23618f7f
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
static
int
sr_class3_enable
(
struct
voltagedomain
*
voltdm
)
static
int
sr_class3_enable
(
struct
voltagedomain
*
voltdm
)
{
{
unsigned
long
volt
=
omap_voltage_get_nom_volt
(
voltdm
);
unsigned
long
volt
=
voltdm_get_voltage
(
voltdm
);
if
(
!
volt
)
{
if
(
!
volt
)
{
pr_warning
(
"%s: Curr voltage unknown. Cannot enable sr_%s
\n
"
,
pr_warning
(
"%s: Curr voltage unknown. Cannot enable sr_%s
\n
"
,
...
@@ -32,7 +32,7 @@ static int sr_class3_disable(struct voltagedomain *voltdm, int is_volt_reset)
...
@@ -32,7 +32,7 @@ static int sr_class3_disable(struct voltagedomain *voltdm, int is_volt_reset)
omap_vp_disable
(
voltdm
);
omap_vp_disable
(
voltdm
);
sr_disable
(
voltdm
);
sr_disable
(
voltdm
);
if
(
is_volt_reset
)
if
(
is_volt_reset
)
omap_voltage
_reset
(
voltdm
);
voltdm
_reset
(
voltdm
);
return
0
;
return
0
;
}
}
...
...
arch/arm/mach-omap2/smartreflex.c
浏览文件 @
23618f7f
...
@@ -62,6 +62,7 @@ static LIST_HEAD(sr_list);
...
@@ -62,6 +62,7 @@ static LIST_HEAD(sr_list);
static
struct
omap_sr_class_data
*
sr_class
;
static
struct
omap_sr_class_data
*
sr_class
;
static
struct
omap_sr_pmic_data
*
sr_pmic_data
;
static
struct
omap_sr_pmic_data
*
sr_pmic_data
;
static
struct
dentry
*
sr_dbg_dir
;
static
inline
void
sr_write_reg
(
struct
omap_sr
*
sr
,
unsigned
offset
,
u32
value
)
static
inline
void
sr_write_reg
(
struct
omap_sr
*
sr
,
unsigned
offset
,
u32
value
)
{
{
...
@@ -826,9 +827,10 @@ static int __init omap_sr_probe(struct platform_device *pdev)
...
@@ -826,9 +827,10 @@ static int __init omap_sr_probe(struct platform_device *pdev)
struct
omap_sr
*
sr_info
=
kzalloc
(
sizeof
(
struct
omap_sr
),
GFP_KERNEL
);
struct
omap_sr
*
sr_info
=
kzalloc
(
sizeof
(
struct
omap_sr
),
GFP_KERNEL
);
struct
omap_sr_data
*
pdata
=
pdev
->
dev
.
platform_data
;
struct
omap_sr_data
*
pdata
=
pdev
->
dev
.
platform_data
;
struct
resource
*
mem
,
*
irq
;
struct
resource
*
mem
,
*
irq
;
struct
dentry
*
vdd_dbg_dir
,
*
nvalue_dir
;
struct
dentry
*
nvalue_dir
;
struct
omap_volt_data
*
volt_data
;
struct
omap_volt_data
*
volt_data
;
int
i
,
ret
=
0
;
int
i
,
ret
=
0
;
char
*
name
;
if
(
!
sr_info
)
{
if
(
!
sr_info
)
{
dev_err
(
&
pdev
->
dev
,
"%s: unable to allocate sr_info
\n
"
,
dev_err
(
&
pdev
->
dev
,
"%s: unable to allocate sr_info
\n
"
,
...
@@ -899,18 +901,25 @@ static int __init omap_sr_probe(struct platform_device *pdev)
...
@@ -899,18 +901,25 @@ static int __init omap_sr_probe(struct platform_device *pdev)
}
}
dev_info
(
&
pdev
->
dev
,
"%s: SmartReflex driver initialized
\n
"
,
__func__
);
dev_info
(
&
pdev
->
dev
,
"%s: SmartReflex driver initialized
\n
"
,
__func__
);
if
(
!
sr_dbg_dir
)
{
sr_dbg_dir
=
debugfs_create_dir
(
"smartreflex"
,
NULL
);
if
(
!
sr_dbg_dir
)
{
ret
=
PTR_ERR
(
sr_dbg_dir
);
pr_err
(
"%s:sr debugfs dir creation failed(%d)
\n
"
,
__func__
,
ret
);
goto
err_iounmap
;
}
}
/*
name
=
kasprintf
(
GFP_KERNEL
,
"sr_%s"
,
sr_info
->
voltdm
->
name
);
* If the voltage domain debugfs directory is not created, do
if
(
!
name
)
{
* not try to create rest of the debugfs entries.
dev_err
(
&
pdev
->
dev
,
"%s: Unable to alloc debugfs name
\n
"
,
*/
__func__
);
vdd_dbg_dir
=
omap_voltage_get_dbgdir
(
sr_info
->
voltdm
);
ret
=
-
ENOMEM
;
if
(
!
vdd_dbg_dir
)
{
ret
=
-
EINVAL
;
goto
err_iounmap
;
goto
err_iounmap
;
}
}
sr_info
->
dbg_dir
=
debugfs_create_dir
(
name
,
sr_dbg_dir
);
sr_info
->
dbg_dir
=
debugfs_create_dir
(
"smartreflex"
,
vdd_dbg_dir
);
kfree
(
name
);
if
(
IS_ERR
(
sr_info
->
dbg_dir
))
{
if
(
IS_ERR
(
sr_info
->
dbg_dir
))
{
dev_err
(
&
pdev
->
dev
,
"%s: Unable to create debugfs directory
\n
"
,
dev_err
(
&
pdev
->
dev
,
"%s: Unable to create debugfs directory
\n
"
,
__func__
);
__func__
);
...
...
arch/arm/mach-omap2/sr_device.c
浏览文件 @
23618f7f
...
@@ -102,7 +102,7 @@ static int sr_dev_init(struct omap_hwmod *oh, void *user)
...
@@ -102,7 +102,7 @@ static int sr_dev_init(struct omap_hwmod *oh, void *user)
sr_data
->
senn_mod
=
0x1
;
sr_data
->
senn_mod
=
0x1
;
sr_data
->
senp_mod
=
0x1
;
sr_data
->
senp_mod
=
0x1
;
sr_data
->
voltdm
=
omap_voltage_domain
_lookup
(
oh
->
vdd_name
);
sr_data
->
voltdm
=
voltdm
_lookup
(
oh
->
vdd_name
);
if
(
IS_ERR
(
sr_data
->
voltdm
))
{
if
(
IS_ERR
(
sr_data
->
voltdm
))
{
pr_err
(
"%s: Unable to get voltage domain pointer for VDD %s
\n
"
,
pr_err
(
"%s: Unable to get voltage domain pointer for VDD %s
\n
"
,
__func__
,
oh
->
vdd_name
);
__func__
,
oh
->
vdd_name
);
...
...
arch/arm/mach-omap2/vc.c
0 → 100644
浏览文件 @
23618f7f
/*
* OMAP Voltage Controller (VC) interface
*
* Copyright (C) 2011 Texas Instruments, Inc.
*
* This file is licensed under the terms of the GNU General Public
* License version 2. This program is licensed "as is" without any
* warranty of any kind, whether express or implied.
*/
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/init.h>
#include <plat/cpu.h>
#include "voltage.h"
#include "vc.h"
#include "prm-regbits-34xx.h"
#include "prm-regbits-44xx.h"
#include "prm44xx.h"
/**
* struct omap_vc_channel_cfg - describe the cfg_channel bitfield
* @sa: bit for slave address
* @rav: bit for voltage configuration register
* @rac: bit for command configuration register
* @racen: enable bit for RAC
* @cmd: bit for command value set selection
*
* Channel configuration bits, common for OMAP3+
* OMAP3 register: PRM_VC_CH_CONF
* OMAP4 register: PRM_VC_CFG_CHANNEL
* OMAP5 register: PRM_VC_SMPS_<voltdm>_CONFIG
*/
struct
omap_vc_channel_cfg
{
u8
sa
;
u8
rav
;
u8
rac
;
u8
racen
;
u8
cmd
;
};
static
struct
omap_vc_channel_cfg
vc_default_channel_cfg
=
{
.
sa
=
BIT
(
0
),
.
rav
=
BIT
(
1
),
.
rac
=
BIT
(
2
),
.
racen
=
BIT
(
3
),
.
cmd
=
BIT
(
4
),
};
/*
* On OMAP3+, all VC channels have the above default bitfield
* configuration, except the OMAP4 MPU channel. This appears
* to be a freak accident as every other VC channel has the
* default configuration, thus creating a mutant channel config.
*/
static
struct
omap_vc_channel_cfg
vc_mutant_channel_cfg
=
{
.
sa
=
BIT
(
0
),
.
rav
=
BIT
(
2
),
.
rac
=
BIT
(
3
),
.
racen
=
BIT
(
4
),
.
cmd
=
BIT
(
1
),
};
static
struct
omap_vc_channel_cfg
*
vc_cfg_bits
;
#define CFG_CHANNEL_MASK 0x1f
/**
* omap_vc_config_channel - configure VC channel to PMIC mappings
* @voltdm: pointer to voltagdomain defining the desired VC channel
*
* Configures the VC channel to PMIC mappings for the following
* PMIC settings
* - i2c slave address (SA)
* - voltage configuration address (RAV)
* - command configuration address (RAC) and enable bit (RACEN)
* - command values for ON, ONLP, RET and OFF (CMD)
*
* This function currently only allows flexible configuration of the
* non-default channel. Starting with OMAP4, there are more than 2
* channels, with one defined as the default (on OMAP4, it's MPU.)
* Only the non-default channel can be configured.
*/
static
int
omap_vc_config_channel
(
struct
voltagedomain
*
voltdm
)
{
struct
omap_vc_channel
*
vc
=
voltdm
->
vc
;
/*
* For default channel, the only configurable bit is RACEN.
* All others must stay at zero (see function comment above.)
*/
if
(
vc
->
flags
&
OMAP_VC_CHANNEL_DEFAULT
)
vc
->
cfg_channel
&=
vc_cfg_bits
->
racen
;
voltdm
->
rmw
(
CFG_CHANNEL_MASK
<<
vc
->
cfg_channel_sa_shift
,
vc
->
cfg_channel
<<
vc
->
cfg_channel_sa_shift
,
vc
->
cfg_channel_reg
);
return
0
;
}
/* Voltage scale and accessory APIs */
int
omap_vc_pre_scale
(
struct
voltagedomain
*
voltdm
,
unsigned
long
target_volt
,
u8
*
target_vsel
,
u8
*
current_vsel
)
{
struct
omap_vc_channel
*
vc
=
voltdm
->
vc
;
u32
vc_cmdval
;
/* Check if sufficient pmic info is available for this vdd */
if
(
!
voltdm
->
pmic
)
{
pr_err
(
"%s: Insufficient pmic info to scale the vdd_%s
\n
"
,
__func__
,
voltdm
->
name
);
return
-
EINVAL
;
}
if
(
!
voltdm
->
pmic
->
uv_to_vsel
)
{
pr_err
(
"%s: PMIC function to convert voltage in uV to"
"vsel not registered. Hence unable to scale voltage"
"for vdd_%s
\n
"
,
__func__
,
voltdm
->
name
);
return
-
ENODATA
;
}
if
(
!
voltdm
->
read
||
!
voltdm
->
write
)
{
pr_err
(
"%s: No read/write API for accessing vdd_%s regs
\n
"
,
__func__
,
voltdm
->
name
);
return
-
EINVAL
;
}
*
target_vsel
=
voltdm
->
pmic
->
uv_to_vsel
(
target_volt
);
*
current_vsel
=
voltdm
->
pmic
->
uv_to_vsel
(
voltdm
->
nominal_volt
);
/* Setting the ON voltage to the new target voltage */
vc_cmdval
=
voltdm
->
read
(
vc
->
cmdval_reg
);
vc_cmdval
&=
~
vc
->
common
->
cmd_on_mask
;
vc_cmdval
|=
(
*
target_vsel
<<
vc
->
common
->
cmd_on_shift
);
voltdm
->
write
(
vc_cmdval
,
vc
->
cmdval_reg
);
omap_vp_update_errorgain
(
voltdm
,
target_volt
);
return
0
;
}
void
omap_vc_post_scale
(
struct
voltagedomain
*
voltdm
,
unsigned
long
target_volt
,
u8
target_vsel
,
u8
current_vsel
)
{
u32
smps_steps
=
0
,
smps_delay
=
0
;
smps_steps
=
abs
(
target_vsel
-
current_vsel
);
/* SMPS slew rate / step size. 2us added as buffer. */
smps_delay
=
((
smps_steps
*
voltdm
->
pmic
->
step_size
)
/
voltdm
->
pmic
->
slew_rate
)
+
2
;
udelay
(
smps_delay
);
}
/* vc_bypass_scale - VC bypass method of voltage scaling */
int
omap_vc_bypass_scale
(
struct
voltagedomain
*
voltdm
,
unsigned
long
target_volt
)
{
struct
omap_vc_channel
*
vc
=
voltdm
->
vc
;
u32
loop_cnt
=
0
,
retries_cnt
=
0
;
u32
vc_valid
,
vc_bypass_val_reg
,
vc_bypass_value
;
u8
target_vsel
,
current_vsel
;
int
ret
;
ret
=
omap_vc_pre_scale
(
voltdm
,
target_volt
,
&
target_vsel
,
&
current_vsel
);
if
(
ret
)
return
ret
;
vc_valid
=
vc
->
common
->
valid
;
vc_bypass_val_reg
=
vc
->
common
->
bypass_val_reg
;
vc_bypass_value
=
(
target_vsel
<<
vc
->
common
->
data_shift
)
|
(
vc
->
volt_reg_addr
<<
vc
->
common
->
regaddr_shift
)
|
(
vc
->
i2c_slave_addr
<<
vc
->
common
->
slaveaddr_shift
);
voltdm
->
write
(
vc_bypass_value
,
vc_bypass_val_reg
);
voltdm
->
write
(
vc_bypass_value
|
vc_valid
,
vc_bypass_val_reg
);
vc_bypass_value
=
voltdm
->
read
(
vc_bypass_val_reg
);
/*
* Loop till the bypass command is acknowledged from the SMPS.
* NOTE: This is legacy code. The loop count and retry count needs
* to be revisited.
*/
while
(
!
(
vc_bypass_value
&
vc_valid
))
{
loop_cnt
++
;
if
(
retries_cnt
>
10
)
{
pr_warning
(
"%s: Retry count exceeded
\n
"
,
__func__
);
return
-
ETIMEDOUT
;
}
if
(
loop_cnt
>
50
)
{
retries_cnt
++
;
loop_cnt
=
0
;
udelay
(
10
);
}
vc_bypass_value
=
voltdm
->
read
(
vc_bypass_val_reg
);
}
omap_vc_post_scale
(
voltdm
,
target_volt
,
target_vsel
,
current_vsel
);
return
0
;
}
static
void
__init
omap3_vfsm_init
(
struct
voltagedomain
*
voltdm
)
{
/*
* Voltage Manager FSM parameters init
* XXX This data should be passed in from the board file
*/
voltdm
->
write
(
OMAP3_CLKSETUP
,
OMAP3_PRM_CLKSETUP_OFFSET
);
voltdm
->
write
(
OMAP3_VOLTOFFSET
,
OMAP3_PRM_VOLTOFFSET_OFFSET
);
voltdm
->
write
(
OMAP3_VOLTSETUP2
,
OMAP3_PRM_VOLTSETUP2_OFFSET
);
}
static
void
__init
omap3_vc_init_channel
(
struct
voltagedomain
*
voltdm
)
{
static
bool
is_initialized
;
if
(
is_initialized
)
return
;
omap3_vfsm_init
(
voltdm
);
is_initialized
=
true
;
}
/* OMAP4 specific voltage init functions */
static
void
__init
omap4_vc_init_channel
(
struct
voltagedomain
*
voltdm
)
{
static
bool
is_initialized
;
u32
vc_val
;
if
(
is_initialized
)
return
;
/* XXX These are magic numbers and do not belong! */
vc_val
=
(
0x60
<<
OMAP4430_SCLL_SHIFT
|
0x26
<<
OMAP4430_SCLH_SHIFT
);
voltdm
->
write
(
vc_val
,
OMAP4_PRM_VC_CFG_I2C_CLK_OFFSET
);
is_initialized
=
true
;
}
/**
* omap_vc_i2c_init - initialize I2C interface to PMIC
* @voltdm: voltage domain containing VC data
*
* Use PMIC supplied seetings for I2C high-speed mode and
* master code (if set) and program the VC I2C configuration
* register.
*
* The VC I2C configuration is common to all VC channels,
* so this function only configures I2C for the first VC
* channel registers. All other VC channels will use the
* same configuration.
*/
static
void
__init
omap_vc_i2c_init
(
struct
voltagedomain
*
voltdm
)
{
struct
omap_vc_channel
*
vc
=
voltdm
->
vc
;
static
bool
initialized
;
static
bool
i2c_high_speed
;
u8
mcode
;
if
(
initialized
)
{
if
(
voltdm
->
pmic
->
i2c_high_speed
!=
i2c_high_speed
)
pr_warn
(
"%s: I2C config for all channels must match."
,
__func__
);
return
;
}
i2c_high_speed
=
voltdm
->
pmic
->
i2c_high_speed
;
if
(
i2c_high_speed
)
voltdm
->
rmw
(
vc
->
common
->
i2c_cfg_hsen_mask
,
vc
->
common
->
i2c_cfg_hsen_mask
,
vc
->
common
->
i2c_cfg_reg
);
mcode
=
voltdm
->
pmic
->
i2c_mcode
;
if
(
mcode
)
voltdm
->
rmw
(
vc
->
common
->
i2c_mcode_mask
,
mcode
<<
__ffs
(
vc
->
common
->
i2c_mcode_mask
),
vc
->
common
->
i2c_cfg_reg
);
initialized
=
true
;
}
void
__init
omap_vc_init_channel
(
struct
voltagedomain
*
voltdm
)
{
struct
omap_vc_channel
*
vc
=
voltdm
->
vc
;
u8
on_vsel
,
onlp_vsel
,
ret_vsel
,
off_vsel
;
u32
val
;
if
(
!
voltdm
->
pmic
||
!
voltdm
->
pmic
->
uv_to_vsel
)
{
pr_err
(
"%s: PMIC info requried to configure vc for"
"vdd_%s not populated.Hence cannot initialize vc
\n
"
,
__func__
,
voltdm
->
name
);
return
;
}
if
(
!
voltdm
->
read
||
!
voltdm
->
write
)
{
pr_err
(
"%s: No read/write API for accessing vdd_%s regs
\n
"
,
__func__
,
voltdm
->
name
);
return
;
}
vc
->
cfg_channel
=
0
;
if
(
vc
->
flags
&
OMAP_VC_CHANNEL_CFG_MUTANT
)
vc_cfg_bits
=
&
vc_mutant_channel_cfg
;
else
vc_cfg_bits
=
&
vc_default_channel_cfg
;
/* get PMIC/board specific settings */
vc
->
i2c_slave_addr
=
voltdm
->
pmic
->
i2c_slave_addr
;
vc
->
volt_reg_addr
=
voltdm
->
pmic
->
volt_reg_addr
;
vc
->
cmd_reg_addr
=
voltdm
->
pmic
->
cmd_reg_addr
;
vc
->
setup_time
=
voltdm
->
pmic
->
volt_setup_time
;
/* Configure the i2c slave address for this VC */
voltdm
->
rmw
(
vc
->
smps_sa_mask
,
vc
->
i2c_slave_addr
<<
__ffs
(
vc
->
smps_sa_mask
),
vc
->
smps_sa_reg
);
vc
->
cfg_channel
|=
vc_cfg_bits
->
sa
;
/*
* Configure the PMIC register addresses.
*/
voltdm
->
rmw
(
vc
->
smps_volra_mask
,
vc
->
volt_reg_addr
<<
__ffs
(
vc
->
smps_volra_mask
),
vc
->
smps_volra_reg
);
vc
->
cfg_channel
|=
vc_cfg_bits
->
rav
;
if
(
vc
->
cmd_reg_addr
)
{
voltdm
->
rmw
(
vc
->
smps_cmdra_mask
,
vc
->
cmd_reg_addr
<<
__ffs
(
vc
->
smps_cmdra_mask
),
vc
->
smps_cmdra_reg
);
vc
->
cfg_channel
|=
vc_cfg_bits
->
rac
|
vc_cfg_bits
->
racen
;
}
/* Set up the on, inactive, retention and off voltage */
on_vsel
=
voltdm
->
pmic
->
uv_to_vsel
(
voltdm
->
pmic
->
on_volt
);
onlp_vsel
=
voltdm
->
pmic
->
uv_to_vsel
(
voltdm
->
pmic
->
onlp_volt
);
ret_vsel
=
voltdm
->
pmic
->
uv_to_vsel
(
voltdm
->
pmic
->
ret_volt
);
off_vsel
=
voltdm
->
pmic
->
uv_to_vsel
(
voltdm
->
pmic
->
off_volt
);
val
=
((
on_vsel
<<
vc
->
common
->
cmd_on_shift
)
|
(
onlp_vsel
<<
vc
->
common
->
cmd_onlp_shift
)
|
(
ret_vsel
<<
vc
->
common
->
cmd_ret_shift
)
|
(
off_vsel
<<
vc
->
common
->
cmd_off_shift
));
voltdm
->
write
(
val
,
vc
->
cmdval_reg
);
vc
->
cfg_channel
|=
vc_cfg_bits
->
cmd
;
/* Channel configuration */
omap_vc_config_channel
(
voltdm
);
/* Configure the setup times */
voltdm
->
rmw
(
voltdm
->
vfsm
->
voltsetup_mask
,
vc
->
setup_time
<<
__ffs
(
voltdm
->
vfsm
->
voltsetup_mask
),
voltdm
->
vfsm
->
voltsetup_reg
);
omap_vc_i2c_init
(
voltdm
);
if
(
cpu_is_omap34xx
())
omap3_vc_init_channel
(
voltdm
);
else
if
(
cpu_is_omap44xx
())
omap4_vc_init_channel
(
voltdm
);
}
arch/arm/mach-omap2/vc.h
浏览文件 @
23618f7f
...
@@ -19,12 +19,12 @@
...
@@ -19,12 +19,12 @@
#include <linux/kernel.h>
#include <linux/kernel.h>
struct
voltagedomain
;
/**
/**
* struct omap_vc_common
_data
- per-VC register/bitfield data
* struct omap_vc_common - per-VC register/bitfield data
* @cmd_on_mask: ON bitmask in PRM_VC_CMD_VAL* register
* @cmd_on_mask: ON bitmask in PRM_VC_CMD_VAL* register
* @valid: VALID bitmask in PRM_VC_BYPASS_VAL register
* @valid: VALID bitmask in PRM_VC_BYPASS_VAL register
* @smps_sa_reg: Offset of PRM_VC_SMPS_SA reg from PRM start
* @smps_volra_reg: Offset of PRM_VC_SMPS_VOL_RA reg from PRM start
* @bypass_val_reg: Offset of PRM_VC_BYPASS_VAL reg from PRM start
* @bypass_val_reg: Offset of PRM_VC_BYPASS_VAL reg from PRM start
* @data_shift: DATA field shift in PRM_VC_BYPASS_VAL register
* @data_shift: DATA field shift in PRM_VC_BYPASS_VAL register
* @slaveaddr_shift: SLAVEADDR field shift in PRM_VC_BYPASS_VAL register
* @slaveaddr_shift: SLAVEADDR field shift in PRM_VC_BYPASS_VAL register
...
@@ -33,15 +33,16 @@
...
@@ -33,15 +33,16 @@
* @cmd_onlp_shift: ONLP field shift in PRM_VC_CMD_VAL_* register
* @cmd_onlp_shift: ONLP field shift in PRM_VC_CMD_VAL_* register
* @cmd_ret_shift: RET field shift in PRM_VC_CMD_VAL_* register
* @cmd_ret_shift: RET field shift in PRM_VC_CMD_VAL_* register
* @cmd_off_shift: OFF field shift in PRM_VC_CMD_VAL_* register
* @cmd_off_shift: OFF field shift in PRM_VC_CMD_VAL_* register
* @i2c_cfg_reg: I2C configuration register offset
* @i2c_cfg_hsen_mask: high-speed mode bit field mask in I2C config register
* @i2c_mcode_mask: MCODE field mask for I2C config register
*
*
* XXX One of cmd_on_mask and cmd_on_shift are not needed
* XXX One of cmd_on_mask and cmd_on_shift are not needed
* XXX VALID should probably be a shift, not a mask
* XXX VALID should probably be a shift, not a mask
*/
*/
struct
omap_vc_common
_data
{
struct
omap_vc_common
{
u32
cmd_on_mask
;
u32
cmd_on_mask
;
u32
valid
;
u32
valid
;
u8
smps_sa_reg
;
u8
smps_volra_reg
;
u8
bypass_val_reg
;
u8
bypass_val_reg
;
u8
data_shift
;
u8
data_shift
;
u8
slaveaddr_shift
;
u8
slaveaddr_shift
;
...
@@ -50,34 +51,75 @@ struct omap_vc_common_data {
...
@@ -50,34 +51,75 @@ struct omap_vc_common_data {
u8
cmd_onlp_shift
;
u8
cmd_onlp_shift
;
u8
cmd_ret_shift
;
u8
cmd_ret_shift
;
u8
cmd_off_shift
;
u8
cmd_off_shift
;
u8
i2c_cfg_reg
;
u8
i2c_cfg_hsen_mask
;
u8
i2c_mcode_mask
;
};
};
/* omap_vc_channel.flags values */
#define OMAP_VC_CHANNEL_DEFAULT BIT(0)
#define OMAP_VC_CHANNEL_CFG_MUTANT BIT(1)
/**
/**
* struct omap_vc_instance_data - VC per-instance data
* struct omap_vc_channel - VC per-instance data
* @vc_common: pointer to VC common data for this platform
* @i2c_slave_addr: I2C slave address of PMIC for this VC channel
* @smps_sa_mask: SA* bitmask in the PRM_VC_SMPS_SA register
* @volt_reg_addr: voltage configuration register address
* @smps_volra_mask: VOLRA* bitmask in the PRM_VC_VOL_RA register
* @cmd_reg_addr: command configuration register address
* @smps_sa_shift: SA* field shift in the PRM_VC_SMPS_SA register
* @setup_time: setup time (in sys_clk cycles) of regulator for this channel
* @smps_volra_shift: VOLRA* field shift in the PRM_VC_VOL_RA register
* @cfg_channel: current value of VC channel configuration register
* @i2c_high_speed: whether or not to use I2C high-speed mode
*
*
* XXX It is not necessary to have both a *_mask and a *_shift -
* @common: pointer to VC common data for this platform
* remove one
* @smps_sa_mask: i2c slave address bitmask in the PRM_VC_SMPS_SA register
* @smps_volra_mask: VOLRA* bitmask in the PRM_VC_VOL_RA register
* @smps_cmdra_mask: CMDRA* bitmask in the PRM_VC_CMD_RA register
* @cmdval_reg: register for on/ret/off voltage level values for this channel
* @smps_sa_reg: Offset of PRM_VC_SMPS_SA reg from PRM start
* @smps_volra_reg: Offset of PRM_VC_SMPS_VOL_RA reg from PRM start
* @smps_cmdra_reg: Offset of PRM_VC_SMPS_CMD_RA reg from PRM start
* @cfg_channel_reg: VC channel configuration register
* @cfg_channel_sa_shift: bit shift for slave address cfg_channel register
* @flags: VC channel-specific flags (optional)
*/
*/
struct
omap_vc_instance_data
{
struct
omap_vc_channel
{
const
struct
omap_vc_common_data
*
vc_common
;
/* channel state */
u16
i2c_slave_addr
;
u16
volt_reg_addr
;
u16
cmd_reg_addr
;
u16
setup_time
;
u8
cfg_channel
;
bool
i2c_high_speed
;
/* register access data */
const
struct
omap_vc_common
*
common
;
u32
smps_sa_mask
;
u32
smps_sa_mask
;
u32
smps_volra_mask
;
u32
smps_volra_mask
;
u32
smps_cmdra_mask
;
u8
cmdval_reg
;
u8
cmdval_reg
;
u8
smps_sa_shift
;
u8
smps_sa_reg
;
u8
smps_volra_shift
;
u8
smps_volra_reg
;
u8
smps_cmdra_reg
;
u8
cfg_channel_reg
;
u8
cfg_channel_sa_shift
;
u8
flags
;
};
};
extern
struct
omap_vc_instance_data
omap3_vc1_data
;
extern
struct
omap_vc_channel
omap3_vc_mpu
;
extern
struct
omap_vc_instance_data
omap3_vc2_data
;
extern
struct
omap_vc_channel
omap3_vc_core
;
extern
struct
omap_vc_channel
omap4_vc_mpu
;
extern
struct
omap_vc_channel
omap4_vc_iva
;
extern
struct
omap_vc_channel
omap4_vc_core
;
extern
struct
omap_vc_instance_data
omap4_vc_mpu_data
;
void
omap_vc_init_channel
(
struct
voltagedomain
*
voltdm
);
extern
struct
omap_vc_instance_data
omap4_vc_iva_data
;
int
omap_vc_pre_scale
(
struct
voltagedomain
*
voltdm
,
extern
struct
omap_vc_instance_data
omap4_vc_core_data
;
unsigned
long
target_volt
,
u8
*
target_vsel
,
u8
*
current_vsel
);
void
omap_vc_post_scale
(
struct
voltagedomain
*
voltdm
,
unsigned
long
target_volt
,
u8
target_vsel
,
u8
current_vsel
);
int
omap_vc_bypass_scale
(
struct
voltagedomain
*
voltdm
,
unsigned
long
target_volt
);
#endif
#endif
arch/arm/mach-omap2/vc3xxx_data.c
浏览文件 @
23618f7f
...
@@ -29,9 +29,7 @@
...
@@ -29,9 +29,7 @@
* VC data common to 34xx/36xx chips
* VC data common to 34xx/36xx chips
* XXX This stuff presumably belongs in the vc3xxx.c or vc.c file.
* XXX This stuff presumably belongs in the vc3xxx.c or vc.c file.
*/
*/
static
struct
omap_vc_common_data
omap3_vc_common
=
{
static
struct
omap_vc_common
omap3_vc_common
=
{
.
smps_sa_reg
=
OMAP3_PRM_VC_SMPS_SA_OFFSET
,
.
smps_volra_reg
=
OMAP3_PRM_VC_SMPS_VOL_RA_OFFSET
,
.
bypass_val_reg
=
OMAP3_PRM_VC_BYPASS_VAL_OFFSET
,
.
bypass_val_reg
=
OMAP3_PRM_VC_BYPASS_VAL_OFFSET
,
.
data_shift
=
OMAP3430_DATA_SHIFT
,
.
data_shift
=
OMAP3430_DATA_SHIFT
,
.
slaveaddr_shift
=
OMAP3430_SLAVEADDR_SHIFT
,
.
slaveaddr_shift
=
OMAP3430_SLAVEADDR_SHIFT
,
...
@@ -42,22 +40,33 @@ static struct omap_vc_common_data omap3_vc_common = {
...
@@ -42,22 +40,33 @@ static struct omap_vc_common_data omap3_vc_common = {
.
cmd_onlp_shift
=
OMAP3430_VC_CMD_ONLP_SHIFT
,
.
cmd_onlp_shift
=
OMAP3430_VC_CMD_ONLP_SHIFT
,
.
cmd_ret_shift
=
OMAP3430_VC_CMD_RET_SHIFT
,
.
cmd_ret_shift
=
OMAP3430_VC_CMD_RET_SHIFT
,
.
cmd_off_shift
=
OMAP3430_VC_CMD_OFF_SHIFT
,
.
cmd_off_shift
=
OMAP3430_VC_CMD_OFF_SHIFT
,
.
i2c_cfg_hsen_mask
=
OMAP3430_HSEN_MASK
,
.
i2c_cfg_reg
=
OMAP3_PRM_VC_I2C_CFG_OFFSET
,
.
i2c_mcode_mask
=
OMAP3430_MCODE_MASK
,
};
};
struct
omap_vc_instance_data
omap3_vc1_data
=
{
struct
omap_vc_channel
omap3_vc_mpu
=
{
.
vc_common
=
&
omap3_vc_common
,
.
common
=
&
omap3_vc_common
,
.
smps_sa_reg
=
OMAP3_PRM_VC_SMPS_SA_OFFSET
,
.
smps_volra_reg
=
OMAP3_PRM_VC_SMPS_VOL_RA_OFFSET
,
.
smps_cmdra_reg
=
OMAP3_PRM_VC_SMPS_CMD_RA_OFFSET
,
.
cfg_channel_reg
=
OMAP3_PRM_VC_CH_CONF_OFFSET
,
.
cmdval_reg
=
OMAP3_PRM_VC_CMD_VAL_0_OFFSET
,
.
cmdval_reg
=
OMAP3_PRM_VC_CMD_VAL_0_OFFSET
,
.
smps_sa_shift
=
OMAP3430_PRM_VC_SMPS_SA_SA0_SHIFT
,
.
smps_sa_mask
=
OMAP3430_PRM_VC_SMPS_SA_SA0_MASK
,
.
smps_sa_mask
=
OMAP3430_PRM_VC_SMPS_SA_SA0_MASK
,
.
smps_volra_shift
=
OMAP3430_VOLRA0_SHIFT
,
.
smps_volra_mask
=
OMAP3430_VOLRA0_MASK
,
.
smps_volra_mask
=
OMAP3430_VOLRA0_MASK
,
.
smps_cmdra_mask
=
OMAP3430_CMDRA0_MASK
,
.
cfg_channel_sa_shift
=
OMAP3430_PRM_VC_SMPS_SA_SA0_SHIFT
,
};
};
struct
omap_vc_instance_data
omap3_vc2_data
=
{
struct
omap_vc_channel
omap3_vc_core
=
{
.
vc_common
=
&
omap3_vc_common
,
.
common
=
&
omap3_vc_common
,
.
smps_sa_reg
=
OMAP3_PRM_VC_SMPS_SA_OFFSET
,
.
smps_volra_reg
=
OMAP3_PRM_VC_SMPS_VOL_RA_OFFSET
,
.
smps_cmdra_reg
=
OMAP3_PRM_VC_SMPS_CMD_RA_OFFSET
,
.
cfg_channel_reg
=
OMAP3_PRM_VC_CH_CONF_OFFSET
,
.
cmdval_reg
=
OMAP3_PRM_VC_CMD_VAL_1_OFFSET
,
.
cmdval_reg
=
OMAP3_PRM_VC_CMD_VAL_1_OFFSET
,
.
smps_sa_shift
=
OMAP3430_PRM_VC_SMPS_SA_SA1_SHIFT
,
.
smps_sa_mask
=
OMAP3430_PRM_VC_SMPS_SA_SA1_MASK
,
.
smps_sa_mask
=
OMAP3430_PRM_VC_SMPS_SA_SA1_MASK
,
.
smps_volra_shift
=
OMAP3430_VOLRA1_SHIFT
,
.
smps_volra_mask
=
OMAP3430_VOLRA1_MASK
,
.
smps_volra_mask
=
OMAP3430_VOLRA1_MASK
,
.
smps_cmdra_mask
=
OMAP3430_CMDRA1_MASK
,
.
cfg_channel_sa_shift
=
OMAP3430_PRM_VC_SMPS_SA_SA1_SHIFT
,
};
};
arch/arm/mach-omap2/vc44xx_data.c
浏览文件 @
23618f7f
...
@@ -30,9 +30,7 @@
...
@@ -30,9 +30,7 @@
* VC data common to 44xx chips
* VC data common to 44xx chips
* XXX This stuff presumably belongs in the vc3xxx.c or vc.c file.
* XXX This stuff presumably belongs in the vc3xxx.c or vc.c file.
*/
*/
static
const
struct
omap_vc_common_data
omap4_vc_common
=
{
static
const
struct
omap_vc_common
omap4_vc_common
=
{
.
smps_sa_reg
=
OMAP4_PRM_VC_SMPS_SA_OFFSET
,
.
smps_volra_reg
=
OMAP4_PRM_VC_VAL_SMPS_RA_VOL_OFFSET
,
.
bypass_val_reg
=
OMAP4_PRM_VC_VAL_BYPASS_OFFSET
,
.
bypass_val_reg
=
OMAP4_PRM_VC_VAL_BYPASS_OFFSET
,
.
data_shift
=
OMAP4430_DATA_SHIFT
,
.
data_shift
=
OMAP4430_DATA_SHIFT
,
.
slaveaddr_shift
=
OMAP4430_SLAVEADDR_SHIFT
,
.
slaveaddr_shift
=
OMAP4430_SLAVEADDR_SHIFT
,
...
@@ -43,33 +41,49 @@ static const struct omap_vc_common_data omap4_vc_common = {
...
@@ -43,33 +41,49 @@ static const struct omap_vc_common_data omap4_vc_common = {
.
cmd_onlp_shift
=
OMAP4430_ONLP_SHIFT
,
.
cmd_onlp_shift
=
OMAP4430_ONLP_SHIFT
,
.
cmd_ret_shift
=
OMAP4430_RET_SHIFT
,
.
cmd_ret_shift
=
OMAP4430_RET_SHIFT
,
.
cmd_off_shift
=
OMAP4430_OFF_SHIFT
,
.
cmd_off_shift
=
OMAP4430_OFF_SHIFT
,
.
i2c_cfg_reg
=
OMAP4_PRM_VC_CFG_I2C_MODE_OFFSET
,
.
i2c_cfg_hsen_mask
=
OMAP4430_HSMODEEN_MASK
,
.
i2c_mcode_mask
=
OMAP4430_HSMCODE_MASK
,
};
};
/* VC instance data for each controllable voltage line */
/* VC instance data for each controllable voltage line */
struct
omap_vc_instance_data
omap4_vc_mpu_data
=
{
struct
omap_vc_channel
omap4_vc_mpu
=
{
.
vc_common
=
&
omap4_vc_common
,
.
flags
=
OMAP_VC_CHANNEL_DEFAULT
|
OMAP_VC_CHANNEL_CFG_MUTANT
,
.
common
=
&
omap4_vc_common
,
.
smps_sa_reg
=
OMAP4_PRM_VC_SMPS_SA_OFFSET
,
.
smps_volra_reg
=
OMAP4_PRM_VC_VAL_SMPS_RA_VOL_OFFSET
,
.
smps_cmdra_reg
=
OMAP4_PRM_VC_VAL_SMPS_RA_CMD_OFFSET
,
.
cfg_channel_reg
=
OMAP4_PRM_VC_CFG_CHANNEL_OFFSET
,
.
cmdval_reg
=
OMAP4_PRM_VC_VAL_CMD_VDD_MPU_L_OFFSET
,
.
cmdval_reg
=
OMAP4_PRM_VC_VAL_CMD_VDD_MPU_L_OFFSET
,
.
smps_sa_shift
=
OMAP4430_SA_VDD_MPU_L_PRM_VC_SMPS_SA_SHIFT
,
.
smps_sa_mask
=
OMAP4430_SA_VDD_MPU_L_PRM_VC_SMPS_SA_MASK
,
.
smps_sa_mask
=
OMAP4430_SA_VDD_MPU_L_PRM_VC_SMPS_SA_MASK
,
.
smps_volra_shift
=
OMAP4430_VOLRA_VDD_MPU_L_SHIFT
,
.
smps_volra_mask
=
OMAP4430_VOLRA_VDD_MPU_L_MASK
,
.
smps_volra_mask
=
OMAP4430_VOLRA_VDD_MPU_L_MASK
,
.
smps_cmdra_mask
=
OMAP4430_CMDRA_VDD_MPU_L_MASK
,
.
cfg_channel_sa_shift
=
OMAP4430_SA_VDD_MPU_L_SHIFT
,
};
};
struct
omap_vc_instance_data
omap4_vc_iva_data
=
{
struct
omap_vc_channel
omap4_vc_iva
=
{
.
vc_common
=
&
omap4_vc_common
,
.
common
=
&
omap4_vc_common
,
.
smps_sa_reg
=
OMAP4_PRM_VC_SMPS_SA_OFFSET
,
.
smps_volra_reg
=
OMAP4_PRM_VC_VAL_SMPS_RA_VOL_OFFSET
,
.
smps_cmdra_reg
=
OMAP4_PRM_VC_VAL_SMPS_RA_CMD_OFFSET
,
.
cfg_channel_reg
=
OMAP4_PRM_VC_CFG_CHANNEL_OFFSET
,
.
cmdval_reg
=
OMAP4_PRM_VC_VAL_CMD_VDD_IVA_L_OFFSET
,
.
cmdval_reg
=
OMAP4_PRM_VC_VAL_CMD_VDD_IVA_L_OFFSET
,
.
smps_sa_shift
=
OMAP4430_SA_VDD_IVA_L_PRM_VC_SMPS_SA_SHIFT
,
.
smps_sa_mask
=
OMAP4430_SA_VDD_IVA_L_PRM_VC_SMPS_SA_MASK
,
.
smps_sa_mask
=
OMAP4430_SA_VDD_IVA_L_PRM_VC_SMPS_SA_MASK
,
.
smps_volra_shift
=
OMAP4430_VOLRA_VDD_IVA_L_SHIFT
,
.
smps_volra_mask
=
OMAP4430_VOLRA_VDD_IVA_L_MASK
,
.
smps_volra_mask
=
OMAP4430_VOLRA_VDD_IVA_L_MASK
,
.
smps_cmdra_mask
=
OMAP4430_CMDRA_VDD_IVA_L_MASK
,
.
cfg_channel_sa_shift
=
OMAP4430_SA_VDD_IVA_L_SHIFT
,
};
};
struct
omap_vc_instance_data
omap4_vc_core_data
=
{
struct
omap_vc_channel
omap4_vc_core
=
{
.
vc_common
=
&
omap4_vc_common
,
.
common
=
&
omap4_vc_common
,
.
smps_sa_reg
=
OMAP4_PRM_VC_SMPS_SA_OFFSET
,
.
smps_volra_reg
=
OMAP4_PRM_VC_VAL_SMPS_RA_VOL_OFFSET
,
.
smps_cmdra_reg
=
OMAP4_PRM_VC_VAL_SMPS_RA_CMD_OFFSET
,
.
cfg_channel_reg
=
OMAP4_PRM_VC_CFG_CHANNEL_OFFSET
,
.
cmdval_reg
=
OMAP4_PRM_VC_VAL_CMD_VDD_CORE_L_OFFSET
,
.
cmdval_reg
=
OMAP4_PRM_VC_VAL_CMD_VDD_CORE_L_OFFSET
,
.
smps_sa_shift
=
OMAP4430_SA_VDD_CORE_L_0_6_SHIFT
,
.
smps_sa_mask
=
OMAP4430_SA_VDD_CORE_L_0_6_MASK
,
.
smps_sa_mask
=
OMAP4430_SA_VDD_CORE_L_0_6_MASK
,
.
smps_volra_shift
=
OMAP4430_VOLRA_VDD_CORE_L_SHIFT
,
.
smps_volra_mask
=
OMAP4430_VOLRA_VDD_CORE_L_MASK
,
.
smps_volra_mask
=
OMAP4430_VOLRA_VDD_CORE_L_MASK
,
.
smps_cmdra_mask
=
OMAP4430_CMDRA_VDD_CORE_L_MASK
,
.
cfg_channel_sa_shift
=
OMAP4430_SA_VDD_CORE_L_SHIFT
,
};
};
arch/arm/mach-omap2/voltage.c
浏览文件 @
23618f7f
...
@@ -21,10 +21,10 @@
...
@@ -21,10 +21,10 @@
#include <linux/delay.h>
#include <linux/delay.h>
#include <linux/io.h>
#include <linux/io.h>
#include <linux/clk.h>
#include <linux/err.h>
#include <linux/err.h>
#include <linux/debugfs.h>
#include <linux/debugfs.h>
#include <linux/slab.h>
#include <linux/slab.h>
#include <linux/clk.h>
#include <plat/common.h>
#include <plat/common.h>
...
@@ -36,839 +36,88 @@
...
@@ -36,839 +36,88 @@
#include "control.h"
#include "control.h"
#include "voltage.h"
#include "voltage.h"
#include "powerdomain.h"
#include "vc.h"
#include "vc.h"
#include "vp.h"
#include "vp.h"
#define VOLTAGE_DIR_SIZE 16
static
LIST_HEAD
(
voltdm_list
);
static
struct
omap_vdd_info
**
vdd_info
;
/*
* Number of scalable voltage domains.
*/
static
int
nr_scalable_vdd
;
/* XXX document */
static
s16
prm_mod_offs
;
static
s16
prm_irqst_ocp_mod_offs
;
static
struct
dentry
*
voltage_dir
;
/* Init function pointers */
static
int
vp_forceupdate_scale_voltage
(
struct
omap_vdd_info
*
vdd
,
unsigned
long
target_volt
);
static
u32
omap3_voltage_read_reg
(
u16
mod
,
u8
offset
)
{
return
omap2_prm_read_mod_reg
(
mod
,
offset
);
}
static
void
omap3_voltage_write_reg
(
u32
val
,
u16
mod
,
u8
offset
)
{
omap2_prm_write_mod_reg
(
val
,
mod
,
offset
);
}
static
u32
omap4_voltage_read_reg
(
u16
mod
,
u8
offset
)
{
return
omap4_prminst_read_inst_reg
(
OMAP4430_PRM_PARTITION
,
mod
,
offset
);
}
static
void
omap4_voltage_write_reg
(
u32
val
,
u16
mod
,
u8
offset
)
{
omap4_prminst_write_inst_reg
(
val
,
OMAP4430_PRM_PARTITION
,
mod
,
offset
);
}
static
int
__init
_config_common_vdd_data
(
struct
omap_vdd_info
*
vdd
)
{
char
*
sys_ck_name
;
struct
clk
*
sys_ck
;
u32
sys_clk_speed
,
timeout_val
,
waittime
;
/*
* XXX Clockfw should handle this, or this should be in a
* struct record
*/
if
(
cpu_is_omap24xx
()
||
cpu_is_omap34xx
())
sys_ck_name
=
"sys_ck"
;
else
if
(
cpu_is_omap44xx
())
sys_ck_name
=
"sys_clkin_ck"
;
else
return
-
EINVAL
;
/*
* Sys clk rate is require to calculate vp timeout value and
* smpswaittimemin and smpswaittimemax.
*/
sys_ck
=
clk_get
(
NULL
,
sys_ck_name
);
if
(
IS_ERR
(
sys_ck
))
{
pr_warning
(
"%s: Could not get the sys clk to calculate"
"various vdd_%s params
\n
"
,
__func__
,
vdd
->
voltdm
.
name
);
return
-
EINVAL
;
}
sys_clk_speed
=
clk_get_rate
(
sys_ck
);
clk_put
(
sys_ck
);
/* Divide to avoid overflow */
sys_clk_speed
/=
1000
;
/* Generic voltage parameters */
vdd
->
volt_scale
=
vp_forceupdate_scale_voltage
;
vdd
->
vp_enabled
=
false
;
vdd
->
vp_rt_data
.
vpconfig_erroroffset
=
(
vdd
->
pmic_info
->
vp_erroroffset
<<
vdd
->
vp_data
->
vp_common
->
vpconfig_erroroffset_shift
);
timeout_val
=
(
sys_clk_speed
*
vdd
->
pmic_info
->
vp_timeout_us
)
/
1000
;
vdd
->
vp_rt_data
.
vlimitto_timeout
=
timeout_val
;
vdd
->
vp_rt_data
.
vlimitto_vddmin
=
vdd
->
pmic_info
->
vp_vddmin
;
vdd
->
vp_rt_data
.
vlimitto_vddmax
=
vdd
->
pmic_info
->
vp_vddmax
;
waittime
=
((
vdd
->
pmic_info
->
step_size
/
vdd
->
pmic_info
->
slew_rate
)
*
sys_clk_speed
)
/
1000
;
vdd
->
vp_rt_data
.
vstepmin_smpswaittimemin
=
waittime
;
vdd
->
vp_rt_data
.
vstepmax_smpswaittimemax
=
waittime
;
vdd
->
vp_rt_data
.
vstepmin_stepmin
=
vdd
->
pmic_info
->
vp_vstepmin
;
vdd
->
vp_rt_data
.
vstepmax_stepmax
=
vdd
->
pmic_info
->
vp_vstepmax
;
return
0
;
}
/* Voltage debugfs support */
static
int
vp_volt_debug_get
(
void
*
data
,
u64
*
val
)
{
struct
omap_vdd_info
*
vdd
=
(
struct
omap_vdd_info
*
)
data
;
u8
vsel
;
if
(
!
vdd
)
{
pr_warning
(
"Wrong paramater passed
\n
"
);
return
-
EINVAL
;
}
vsel
=
vdd
->
read_reg
(
prm_mod_offs
,
vdd
->
vp_data
->
voltage
);
if
(
!
vdd
->
pmic_info
->
vsel_to_uv
)
{
pr_warning
(
"PMIC function to convert vsel to voltage"
"in uV not registerd
\n
"
);
return
-
EINVAL
;
}
*
val
=
vdd
->
pmic_info
->
vsel_to_uv
(
vsel
);
return
0
;
}
static
int
nom_volt_debug_get
(
void
*
data
,
u64
*
val
)
{
struct
omap_vdd_info
*
vdd
=
(
struct
omap_vdd_info
*
)
data
;
if
(
!
vdd
)
{
pr_warning
(
"Wrong paramater passed
\n
"
);
return
-
EINVAL
;
}
*
val
=
omap_voltage_get_nom_volt
(
&
vdd
->
voltdm
);
return
0
;
}
DEFINE_SIMPLE_ATTRIBUTE
(
vp_volt_debug_fops
,
vp_volt_debug_get
,
NULL
,
"%llu
\n
"
);
DEFINE_SIMPLE_ATTRIBUTE
(
nom_volt_debug_fops
,
nom_volt_debug_get
,
NULL
,
"%llu
\n
"
);
static
void
vp_latch_vsel
(
struct
omap_vdd_info
*
vdd
)
{
u32
vpconfig
;
unsigned
long
uvdc
;
char
vsel
;
uvdc
=
omap_voltage_get_nom_volt
(
&
vdd
->
voltdm
);
if
(
!
uvdc
)
{
pr_warning
(
"%s: unable to find current voltage for vdd_%s
\n
"
,
__func__
,
vdd
->
voltdm
.
name
);
return
;
}
if
(
!
vdd
->
pmic_info
||
!
vdd
->
pmic_info
->
uv_to_vsel
)
{
pr_warning
(
"%s: PMIC function to convert voltage in uV to"
" vsel not registered
\n
"
,
__func__
);
return
;
}
vsel
=
vdd
->
pmic_info
->
uv_to_vsel
(
uvdc
);
vpconfig
=
vdd
->
read_reg
(
prm_mod_offs
,
vdd
->
vp_data
->
vpconfig
);
vpconfig
&=
~
(
vdd
->
vp_data
->
vp_common
->
vpconfig_initvoltage_mask
|
vdd
->
vp_data
->
vp_common
->
vpconfig_initvdd
);
vpconfig
|=
vsel
<<
vdd
->
vp_data
->
vp_common
->
vpconfig_initvoltage_shift
;
vdd
->
write_reg
(
vpconfig
,
prm_mod_offs
,
vdd
->
vp_data
->
vpconfig
);
/* Trigger initVDD value copy to voltage processor */
vdd
->
write_reg
((
vpconfig
|
vdd
->
vp_data
->
vp_common
->
vpconfig_initvdd
),
prm_mod_offs
,
vdd
->
vp_data
->
vpconfig
);
/* Clear initVDD copy trigger bit */
vdd
->
write_reg
(
vpconfig
,
prm_mod_offs
,
vdd
->
vp_data
->
vpconfig
);
}
/* Generic voltage init functions */
static
void
__init
vp_init
(
struct
omap_vdd_info
*
vdd
)
{
u32
vp_val
;
if
(
!
vdd
->
read_reg
||
!
vdd
->
write_reg
)
{
pr_err
(
"%s: No read/write API for accessing vdd_%s regs
\n
"
,
__func__
,
vdd
->
voltdm
.
name
);
return
;
}
vp_val
=
vdd
->
vp_rt_data
.
vpconfig_erroroffset
|
(
vdd
->
vp_rt_data
.
vpconfig_errorgain
<<
vdd
->
vp_data
->
vp_common
->
vpconfig_errorgain_shift
)
|
vdd
->
vp_data
->
vp_common
->
vpconfig_timeouten
;
vdd
->
write_reg
(
vp_val
,
prm_mod_offs
,
vdd
->
vp_data
->
vpconfig
);
vp_val
=
((
vdd
->
vp_rt_data
.
vstepmin_smpswaittimemin
<<
vdd
->
vp_data
->
vp_common
->
vstepmin_smpswaittimemin_shift
)
|
(
vdd
->
vp_rt_data
.
vstepmin_stepmin
<<
vdd
->
vp_data
->
vp_common
->
vstepmin_stepmin_shift
));
vdd
->
write_reg
(
vp_val
,
prm_mod_offs
,
vdd
->
vp_data
->
vstepmin
);
vp_val
=
((
vdd
->
vp_rt_data
.
vstepmax_smpswaittimemax
<<
vdd
->
vp_data
->
vp_common
->
vstepmax_smpswaittimemax_shift
)
|
(
vdd
->
vp_rt_data
.
vstepmax_stepmax
<<
vdd
->
vp_data
->
vp_common
->
vstepmax_stepmax_shift
));
vdd
->
write_reg
(
vp_val
,
prm_mod_offs
,
vdd
->
vp_data
->
vstepmax
);
vp_val
=
((
vdd
->
vp_rt_data
.
vlimitto_vddmax
<<
vdd
->
vp_data
->
vp_common
->
vlimitto_vddmax_shift
)
|
(
vdd
->
vp_rt_data
.
vlimitto_vddmin
<<
vdd
->
vp_data
->
vp_common
->
vlimitto_vddmin_shift
)
|
(
vdd
->
vp_rt_data
.
vlimitto_timeout
<<
vdd
->
vp_data
->
vp_common
->
vlimitto_timeout_shift
));
vdd
->
write_reg
(
vp_val
,
prm_mod_offs
,
vdd
->
vp_data
->
vlimitto
);
}
static
void
__init
vdd_debugfs_init
(
struct
omap_vdd_info
*
vdd
)
{
char
*
name
;
name
=
kzalloc
(
VOLTAGE_DIR_SIZE
,
GFP_KERNEL
);
if
(
!
name
)
{
pr_warning
(
"%s: Unable to allocate memory for debugfs"
" directory name for vdd_%s"
,
__func__
,
vdd
->
voltdm
.
name
);
return
;
}
strcpy
(
name
,
"vdd_"
);
strcat
(
name
,
vdd
->
voltdm
.
name
);
vdd
->
debug_dir
=
debugfs_create_dir
(
name
,
voltage_dir
);
kfree
(
name
);
if
(
IS_ERR
(
vdd
->
debug_dir
))
{
pr_warning
(
"%s: Unable to create debugfs directory for"
" vdd_%s
\n
"
,
__func__
,
vdd
->
voltdm
.
name
);
vdd
->
debug_dir
=
NULL
;
return
;
}
(
void
)
debugfs_create_x16
(
"vp_errorgain"
,
S_IRUGO
,
vdd
->
debug_dir
,
&
(
vdd
->
vp_rt_data
.
vpconfig_errorgain
));
(
void
)
debugfs_create_x16
(
"vp_smpswaittimemin"
,
S_IRUGO
,
vdd
->
debug_dir
,
&
(
vdd
->
vp_rt_data
.
vstepmin_smpswaittimemin
));
(
void
)
debugfs_create_x8
(
"vp_stepmin"
,
S_IRUGO
,
vdd
->
debug_dir
,
&
(
vdd
->
vp_rt_data
.
vstepmin_stepmin
));
(
void
)
debugfs_create_x16
(
"vp_smpswaittimemax"
,
S_IRUGO
,
vdd
->
debug_dir
,
&
(
vdd
->
vp_rt_data
.
vstepmax_smpswaittimemax
));
(
void
)
debugfs_create_x8
(
"vp_stepmax"
,
S_IRUGO
,
vdd
->
debug_dir
,
&
(
vdd
->
vp_rt_data
.
vstepmax_stepmax
));
(
void
)
debugfs_create_x8
(
"vp_vddmax"
,
S_IRUGO
,
vdd
->
debug_dir
,
&
(
vdd
->
vp_rt_data
.
vlimitto_vddmax
));
(
void
)
debugfs_create_x8
(
"vp_vddmin"
,
S_IRUGO
,
vdd
->
debug_dir
,
&
(
vdd
->
vp_rt_data
.
vlimitto_vddmin
));
(
void
)
debugfs_create_x16
(
"vp_timeout"
,
S_IRUGO
,
vdd
->
debug_dir
,
&
(
vdd
->
vp_rt_data
.
vlimitto_timeout
));
(
void
)
debugfs_create_file
(
"curr_vp_volt"
,
S_IRUGO
,
vdd
->
debug_dir
,
(
void
*
)
vdd
,
&
vp_volt_debug_fops
);
(
void
)
debugfs_create_file
(
"curr_nominal_volt"
,
S_IRUGO
,
vdd
->
debug_dir
,
(
void
*
)
vdd
,
&
nom_volt_debug_fops
);
}
/* Voltage scale and accessory APIs */
static
int
_pre_volt_scale
(
struct
omap_vdd_info
*
vdd
,
unsigned
long
target_volt
,
u8
*
target_vsel
,
u8
*
current_vsel
)
{
struct
omap_volt_data
*
volt_data
;
const
struct
omap_vc_common_data
*
vc_common
;
const
struct
omap_vp_common_data
*
vp_common
;
u32
vc_cmdval
,
vp_errgain_val
;
vc_common
=
vdd
->
vc_data
->
vc_common
;
vp_common
=
vdd
->
vp_data
->
vp_common
;
/* Check if suffiecient pmic info is available for this vdd */
if
(
!
vdd
->
pmic_info
)
{
pr_err
(
"%s: Insufficient pmic info to scale the vdd_%s
\n
"
,
__func__
,
vdd
->
voltdm
.
name
);
return
-
EINVAL
;
}
if
(
!
vdd
->
pmic_info
->
uv_to_vsel
)
{
pr_err
(
"%s: PMIC function to convert voltage in uV to"
"vsel not registered. Hence unable to scale voltage"
"for vdd_%s
\n
"
,
__func__
,
vdd
->
voltdm
.
name
);
return
-
ENODATA
;
}
if
(
!
vdd
->
read_reg
||
!
vdd
->
write_reg
)
{
pr_err
(
"%s: No read/write API for accessing vdd_%s regs
\n
"
,
__func__
,
vdd
->
voltdm
.
name
);
return
-
EINVAL
;
}
/* Get volt_data corresponding to target_volt */
volt_data
=
omap_voltage_get_voltdata
(
&
vdd
->
voltdm
,
target_volt
);
if
(
IS_ERR
(
volt_data
))
volt_data
=
NULL
;
*
target_vsel
=
vdd
->
pmic_info
->
uv_to_vsel
(
target_volt
);
*
current_vsel
=
vdd
->
read_reg
(
prm_mod_offs
,
vdd
->
vp_data
->
voltage
);
/* Setting the ON voltage to the new target voltage */
vc_cmdval
=
vdd
->
read_reg
(
prm_mod_offs
,
vdd
->
vc_data
->
cmdval_reg
);
vc_cmdval
&=
~
vc_common
->
cmd_on_mask
;
vc_cmdval
|=
(
*
target_vsel
<<
vc_common
->
cmd_on_shift
);
vdd
->
write_reg
(
vc_cmdval
,
prm_mod_offs
,
vdd
->
vc_data
->
cmdval_reg
);
/* Setting vp errorgain based on the voltage */
if
(
volt_data
)
{
vp_errgain_val
=
vdd
->
read_reg
(
prm_mod_offs
,
vdd
->
vp_data
->
vpconfig
);
vdd
->
vp_rt_data
.
vpconfig_errorgain
=
volt_data
->
vp_errgain
;
vp_errgain_val
&=
~
vp_common
->
vpconfig_errorgain_mask
;
vp_errgain_val
|=
vdd
->
vp_rt_data
.
vpconfig_errorgain
<<
vp_common
->
vpconfig_errorgain_shift
;
vdd
->
write_reg
(
vp_errgain_val
,
prm_mod_offs
,
vdd
->
vp_data
->
vpconfig
);
}
return
0
;
}
static
void
_post_volt_scale
(
struct
omap_vdd_info
*
vdd
,
unsigned
long
target_volt
,
u8
target_vsel
,
u8
current_vsel
)
{
u32
smps_steps
=
0
,
smps_delay
=
0
;
smps_steps
=
abs
(
target_vsel
-
current_vsel
);
/* SMPS slew rate / step size. 2us added as buffer. */
smps_delay
=
((
smps_steps
*
vdd
->
pmic_info
->
step_size
)
/
vdd
->
pmic_info
->
slew_rate
)
+
2
;
udelay
(
smps_delay
);
vdd
->
curr_volt
=
target_volt
;
}
/* vc_bypass_scale_voltage - VC bypass method of voltage scaling */
static
int
vc_bypass_scale_voltage
(
struct
omap_vdd_info
*
vdd
,
unsigned
long
target_volt
)
{
u32
loop_cnt
=
0
,
retries_cnt
=
0
;
u32
vc_valid
,
vc_bypass_val_reg
,
vc_bypass_value
;
u8
target_vsel
,
current_vsel
;
int
ret
;
ret
=
_pre_volt_scale
(
vdd
,
target_volt
,
&
target_vsel
,
&
current_vsel
);
if
(
ret
)
return
ret
;
vc_valid
=
vdd
->
vc_data
->
vc_common
->
valid
;
vc_bypass_val_reg
=
vdd
->
vc_data
->
vc_common
->
bypass_val_reg
;
vc_bypass_value
=
(
target_vsel
<<
vdd
->
vc_data
->
vc_common
->
data_shift
)
|
(
vdd
->
pmic_info
->
pmic_reg
<<
vdd
->
vc_data
->
vc_common
->
regaddr_shift
)
|
(
vdd
->
pmic_info
->
i2c_slave_addr
<<
vdd
->
vc_data
->
vc_common
->
slaveaddr_shift
);
vdd
->
write_reg
(
vc_bypass_value
,
prm_mod_offs
,
vc_bypass_val_reg
);
vdd
->
write_reg
(
vc_bypass_value
|
vc_valid
,
prm_mod_offs
,
vc_bypass_val_reg
);
vc_bypass_value
=
vdd
->
read_reg
(
prm_mod_offs
,
vc_bypass_val_reg
);
/*
* Loop till the bypass command is acknowledged from the SMPS.
* NOTE: This is legacy code. The loop count and retry count needs
* to be revisited.
*/
while
(
!
(
vc_bypass_value
&
vc_valid
))
{
loop_cnt
++
;
if
(
retries_cnt
>
10
)
{
pr_warning
(
"%s: Retry count exceeded
\n
"
,
__func__
);
return
-
ETIMEDOUT
;
}
if
(
loop_cnt
>
50
)
{
retries_cnt
++
;
loop_cnt
=
0
;
udelay
(
10
);
}
vc_bypass_value
=
vdd
->
read_reg
(
prm_mod_offs
,
vc_bypass_val_reg
);
}
_post_volt_scale
(
vdd
,
target_volt
,
target_vsel
,
current_vsel
);
return
0
;
}
/* VP force update method of voltage scaling */
static
int
vp_forceupdate_scale_voltage
(
struct
omap_vdd_info
*
vdd
,
unsigned
long
target_volt
)
{
u32
vpconfig
;
u8
target_vsel
,
current_vsel
,
prm_irqst_reg
;
int
ret
,
timeout
=
0
;
ret
=
_pre_volt_scale
(
vdd
,
target_volt
,
&
target_vsel
,
&
current_vsel
);
if
(
ret
)
return
ret
;
prm_irqst_reg
=
vdd
->
vp_data
->
prm_irqst_data
->
prm_irqst_reg
;
/*
* Clear all pending TransactionDone interrupt/status. Typical latency
* is <3us
*/
while
(
timeout
++
<
VP_TRANXDONE_TIMEOUT
)
{
vdd
->
write_reg
(
vdd
->
vp_data
->
prm_irqst_data
->
tranxdone_status
,
prm_irqst_ocp_mod_offs
,
prm_irqst_reg
);
if
(
!
(
vdd
->
read_reg
(
prm_irqst_ocp_mod_offs
,
prm_irqst_reg
)
&
vdd
->
vp_data
->
prm_irqst_data
->
tranxdone_status
))
break
;
udelay
(
1
);
}
if
(
timeout
>=
VP_TRANXDONE_TIMEOUT
)
{
pr_warning
(
"%s: vdd_%s TRANXDONE timeout exceeded."
"Voltage change aborted"
,
__func__
,
vdd
->
voltdm
.
name
);
return
-
ETIMEDOUT
;
}
/* Configure for VP-Force Update */
vpconfig
=
vdd
->
read_reg
(
prm_mod_offs
,
vdd
->
vp_data
->
vpconfig
);
vpconfig
&=
~
(
vdd
->
vp_data
->
vp_common
->
vpconfig_initvdd
|
vdd
->
vp_data
->
vp_common
->
vpconfig_forceupdate
|
vdd
->
vp_data
->
vp_common
->
vpconfig_initvoltage_mask
);
vpconfig
|=
((
target_vsel
<<
vdd
->
vp_data
->
vp_common
->
vpconfig_initvoltage_shift
));
vdd
->
write_reg
(
vpconfig
,
prm_mod_offs
,
vdd
->
vp_data
->
vpconfig
);
/* Trigger initVDD value copy to voltage processor */
vpconfig
|=
vdd
->
vp_data
->
vp_common
->
vpconfig_initvdd
;
vdd
->
write_reg
(
vpconfig
,
prm_mod_offs
,
vdd
->
vp_data
->
vpconfig
);
/* Force update of voltage */
vpconfig
|=
vdd
->
vp_data
->
vp_common
->
vpconfig_forceupdate
;
vdd
->
write_reg
(
vpconfig
,
prm_mod_offs
,
vdd
->
vp_data
->
vpconfig
);
/*
* Wait for TransactionDone. Typical latency is <200us.
* Depends on SMPSWAITTIMEMIN/MAX and voltage change
*/
timeout
=
0
;
omap_test_timeout
((
vdd
->
read_reg
(
prm_irqst_ocp_mod_offs
,
prm_irqst_reg
)
&
vdd
->
vp_data
->
prm_irqst_data
->
tranxdone_status
),
VP_TRANXDONE_TIMEOUT
,
timeout
);
if
(
timeout
>=
VP_TRANXDONE_TIMEOUT
)
pr_err
(
"%s: vdd_%s TRANXDONE timeout exceeded."
"TRANXDONE never got set after the voltage update
\n
"
,
__func__
,
vdd
->
voltdm
.
name
);
_post_volt_scale
(
vdd
,
target_volt
,
target_vsel
,
current_vsel
);
/*
* Disable TransactionDone interrupt , clear all status, clear
* control registers
*/
timeout
=
0
;
while
(
timeout
++
<
VP_TRANXDONE_TIMEOUT
)
{
vdd
->
write_reg
(
vdd
->
vp_data
->
prm_irqst_data
->
tranxdone_status
,
prm_irqst_ocp_mod_offs
,
prm_irqst_reg
);
if
(
!
(
vdd
->
read_reg
(
prm_irqst_ocp_mod_offs
,
prm_irqst_reg
)
&
vdd
->
vp_data
->
prm_irqst_data
->
tranxdone_status
))
break
;
udelay
(
1
);
}
if
(
timeout
>=
VP_TRANXDONE_TIMEOUT
)
pr_warning
(
"%s: vdd_%s TRANXDONE timeout exceeded while trying"
"to clear the TRANXDONE status
\n
"
,
__func__
,
vdd
->
voltdm
.
name
);
vpconfig
=
vdd
->
read_reg
(
prm_mod_offs
,
vdd
->
vp_data
->
vpconfig
);
/* Clear initVDD copy trigger bit */
vpconfig
&=
~
vdd
->
vp_data
->
vp_common
->
vpconfig_initvdd
;
vdd
->
write_reg
(
vpconfig
,
prm_mod_offs
,
vdd
->
vp_data
->
vpconfig
);
/* Clear force bit */
vpconfig
&=
~
vdd
->
vp_data
->
vp_common
->
vpconfig_forceupdate
;
vdd
->
write_reg
(
vpconfig
,
prm_mod_offs
,
vdd
->
vp_data
->
vpconfig
);
return
0
;
}
static
void
__init
omap3_vfsm_init
(
struct
omap_vdd_info
*
vdd
)
{
/*
* Voltage Manager FSM parameters init
* XXX This data should be passed in from the board file
*/
vdd
->
write_reg
(
OMAP3_CLKSETUP
,
prm_mod_offs
,
OMAP3_PRM_CLKSETUP_OFFSET
);
vdd
->
write_reg
(
OMAP3_VOLTOFFSET
,
prm_mod_offs
,
OMAP3_PRM_VOLTOFFSET_OFFSET
);
vdd
->
write_reg
(
OMAP3_VOLTSETUP2
,
prm_mod_offs
,
OMAP3_PRM_VOLTSETUP2_OFFSET
);
}
static
void
__init
omap3_vc_init
(
struct
omap_vdd_info
*
vdd
)
{
static
bool
is_initialized
;
u8
on_vsel
,
onlp_vsel
,
ret_vsel
,
off_vsel
;
u32
vc_val
;
if
(
is_initialized
)
return
;
/* Set up the on, inactive, retention and off voltage */
on_vsel
=
vdd
->
pmic_info
->
uv_to_vsel
(
vdd
->
pmic_info
->
on_volt
);
onlp_vsel
=
vdd
->
pmic_info
->
uv_to_vsel
(
vdd
->
pmic_info
->
onlp_volt
);
ret_vsel
=
vdd
->
pmic_info
->
uv_to_vsel
(
vdd
->
pmic_info
->
ret_volt
);
off_vsel
=
vdd
->
pmic_info
->
uv_to_vsel
(
vdd
->
pmic_info
->
off_volt
);
vc_val
=
((
on_vsel
<<
vdd
->
vc_data
->
vc_common
->
cmd_on_shift
)
|
(
onlp_vsel
<<
vdd
->
vc_data
->
vc_common
->
cmd_onlp_shift
)
|
(
ret_vsel
<<
vdd
->
vc_data
->
vc_common
->
cmd_ret_shift
)
|
(
off_vsel
<<
vdd
->
vc_data
->
vc_common
->
cmd_off_shift
));
vdd
->
write_reg
(
vc_val
,
prm_mod_offs
,
vdd
->
vc_data
->
cmdval_reg
);
/*
* Generic VC parameters init
* XXX This data should be abstracted out
*/
vdd
->
write_reg
(
OMAP3430_CMD1_MASK
|
OMAP3430_RAV1_MASK
,
prm_mod_offs
,
OMAP3_PRM_VC_CH_CONF_OFFSET
);
vdd
->
write_reg
(
OMAP3430_MCODE_SHIFT
|
OMAP3430_HSEN_MASK
,
prm_mod_offs
,
OMAP3_PRM_VC_I2C_CFG_OFFSET
);
omap3_vfsm_init
(
vdd
);
is_initialized
=
true
;
}
/* OMAP4 specific voltage init functions */
static
void
__init
omap4_vc_init
(
struct
omap_vdd_info
*
vdd
)
{
static
bool
is_initialized
;
u32
vc_val
;
if
(
is_initialized
)
return
;
/* TODO: Configure setup times and CMD_VAL values*/
/*
* Generic VC parameters init
* XXX This data should be abstracted out
*/
vc_val
=
(
OMAP4430_RAV_VDD_MPU_L_MASK
|
OMAP4430_CMD_VDD_MPU_L_MASK
|
OMAP4430_RAV_VDD_IVA_L_MASK
|
OMAP4430_CMD_VDD_IVA_L_MASK
|
OMAP4430_RAV_VDD_CORE_L_MASK
|
OMAP4430_CMD_VDD_CORE_L_MASK
);
vdd
->
write_reg
(
vc_val
,
prm_mod_offs
,
OMAP4_PRM_VC_CFG_CHANNEL_OFFSET
);
/* XXX These are magic numbers and do not belong! */
vc_val
=
(
0x60
<<
OMAP4430_SCLL_SHIFT
|
0x26
<<
OMAP4430_SCLH_SHIFT
);
vdd
->
write_reg
(
vc_val
,
prm_mod_offs
,
OMAP4_PRM_VC_CFG_I2C_CLK_OFFSET
);
is_initialized
=
true
;
}
static
void
__init
omap_vc_init
(
struct
omap_vdd_info
*
vdd
)
{
u32
vc_val
;
if
(
!
vdd
->
pmic_info
||
!
vdd
->
pmic_info
->
uv_to_vsel
)
{
pr_err
(
"%s: PMIC info requried to configure vc for"
"vdd_%s not populated.Hence cannot initialize vc
\n
"
,
__func__
,
vdd
->
voltdm
.
name
);
return
;
}
if
(
!
vdd
->
read_reg
||
!
vdd
->
write_reg
)
{
pr_err
(
"%s: No read/write API for accessing vdd_%s regs
\n
"
,
__func__
,
vdd
->
voltdm
.
name
);
return
;
}
/* Set up the SMPS_SA(i2c slave address in VC */
vc_val
=
vdd
->
read_reg
(
prm_mod_offs
,
vdd
->
vc_data
->
vc_common
->
smps_sa_reg
);
vc_val
&=
~
vdd
->
vc_data
->
smps_sa_mask
;
vc_val
|=
vdd
->
pmic_info
->
i2c_slave_addr
<<
vdd
->
vc_data
->
smps_sa_shift
;
vdd
->
write_reg
(
vc_val
,
prm_mod_offs
,
vdd
->
vc_data
->
vc_common
->
smps_sa_reg
);
/* Setup the VOLRA(pmic reg addr) in VC */
vc_val
=
vdd
->
read_reg
(
prm_mod_offs
,
vdd
->
vc_data
->
vc_common
->
smps_volra_reg
);
vc_val
&=
~
vdd
->
vc_data
->
smps_volra_mask
;
vc_val
|=
vdd
->
pmic_info
->
pmic_reg
<<
vdd
->
vc_data
->
smps_volra_shift
;
vdd
->
write_reg
(
vc_val
,
prm_mod_offs
,
vdd
->
vc_data
->
vc_common
->
smps_volra_reg
);
/* Configure the setup times */
vc_val
=
vdd
->
read_reg
(
prm_mod_offs
,
vdd
->
vfsm
->
voltsetup_reg
);
vc_val
&=
~
vdd
->
vfsm
->
voltsetup_mask
;
vc_val
|=
vdd
->
pmic_info
->
volt_setup_time
<<
vdd
->
vfsm
->
voltsetup_shift
;
vdd
->
write_reg
(
vc_val
,
prm_mod_offs
,
vdd
->
vfsm
->
voltsetup_reg
);
if
(
cpu_is_omap34xx
())
omap3_vc_init
(
vdd
);
else
if
(
cpu_is_omap44xx
())
omap4_vc_init
(
vdd
);
}
static
int
__init
omap_vdd_data_configure
(
struct
omap_vdd_info
*
vdd
)
{
int
ret
=
-
EINVAL
;
if
(
!
vdd
->
pmic_info
)
{
pr_err
(
"%s: PMIC info requried to configure vdd_%s not"
"populated.Hence cannot initialize vdd_%s
\n
"
,
__func__
,
vdd
->
voltdm
.
name
,
vdd
->
voltdm
.
name
);
goto
ovdc_out
;
}
if
(
IS_ERR_VALUE
(
_config_common_vdd_data
(
vdd
)))
goto
ovdc_out
;
if
(
cpu_is_omap34xx
())
{
vdd
->
read_reg
=
omap3_voltage_read_reg
;
vdd
->
write_reg
=
omap3_voltage_write_reg
;
ret
=
0
;
}
else
if
(
cpu_is_omap44xx
())
{
vdd
->
read_reg
=
omap4_voltage_read_reg
;
vdd
->
write_reg
=
omap4_voltage_write_reg
;
ret
=
0
;
}
ovdc_out:
return
ret
;
}
/* Public functions */
/* Public functions */
/**
/**
*
omap_voltage_get_nom_volt
() - Gets the current non-auto-compensated voltage
*
voltdm_get_voltage
() - Gets the current non-auto-compensated voltage
* @voltdm: pointer to the
VDD
for which current voltage info is needed
* @voltdm: pointer to the
voltdm
for which current voltage info is needed
*
*
* API to get the current non-auto-compensated voltage for a
VDD
.
* API to get the current non-auto-compensated voltage for a
voltage domain
.
* Returns 0 in case of error else returns the current voltage
for the VDD
.
* Returns 0 in case of error else returns the current voltage.
*/
*/
unsigned
long
omap_voltage_get_nom_volt
(
struct
voltagedomain
*
voltdm
)
unsigned
long
voltdm_get_voltage
(
struct
voltagedomain
*
voltdm
)
{
{
struct
omap_vdd_info
*
vdd
;
if
(
!
voltdm
||
IS_ERR
(
voltdm
))
{
if
(
!
voltdm
||
IS_ERR
(
voltdm
))
{
pr_warning
(
"%s: VDD specified does not exist!
\n
"
,
__func__
);
pr_warning
(
"%s: VDD specified does not exist!
\n
"
,
__func__
);
return
0
;
return
0
;
}
}
vdd
=
container_of
(
voltdm
,
struct
omap_vdd_info
,
voltdm
);
return
voltdm
->
nominal_volt
;
return
vdd
->
curr_volt
;
}
}
/**
/**
* omap_vp_get_curr_volt() - API to get the current vp voltage.
* voltdm_scale() - API to scale voltage of a particular voltage domain.
* @voltdm: pointer to the VDD.
* @voltdm: pointer to the voltage domain which is to be scaled.
*
* @target_volt: The target voltage of the voltage domain
* This API returns the current voltage for the specified voltage processor
*/
unsigned
long
omap_vp_get_curr_volt
(
struct
voltagedomain
*
voltdm
)
{
struct
omap_vdd_info
*
vdd
;
u8
curr_vsel
;
if
(
!
voltdm
||
IS_ERR
(
voltdm
))
{
pr_warning
(
"%s: VDD specified does not exist!
\n
"
,
__func__
);
return
0
;
}
vdd
=
container_of
(
voltdm
,
struct
omap_vdd_info
,
voltdm
);
if
(
!
vdd
->
read_reg
)
{
pr_err
(
"%s: No read API for reading vdd_%s regs
\n
"
,
__func__
,
voltdm
->
name
);
return
0
;
}
curr_vsel
=
vdd
->
read_reg
(
prm_mod_offs
,
vdd
->
vp_data
->
voltage
);
if
(
!
vdd
->
pmic_info
||
!
vdd
->
pmic_info
->
vsel_to_uv
)
{
pr_warning
(
"%s: PMIC function to convert vsel to voltage"
"in uV not registerd
\n
"
,
__func__
);
return
0
;
}
return
vdd
->
pmic_info
->
vsel_to_uv
(
curr_vsel
);
}
/**
* omap_vp_enable() - API to enable a particular VP
* @voltdm: pointer to the VDD whose VP is to be enabled.
*
* This API enables a particular voltage processor. Needed by the smartreflex
* class drivers.
*/
void
omap_vp_enable
(
struct
voltagedomain
*
voltdm
)
{
struct
omap_vdd_info
*
vdd
;
u32
vpconfig
;
if
(
!
voltdm
||
IS_ERR
(
voltdm
))
{
pr_warning
(
"%s: VDD specified does not exist!
\n
"
,
__func__
);
return
;
}
vdd
=
container_of
(
voltdm
,
struct
omap_vdd_info
,
voltdm
);
if
(
!
vdd
->
read_reg
||
!
vdd
->
write_reg
)
{
pr_err
(
"%s: No read/write API for accessing vdd_%s regs
\n
"
,
__func__
,
voltdm
->
name
);
return
;
}
/* If VP is already enabled, do nothing. Return */
if
(
vdd
->
vp_enabled
)
return
;
vp_latch_vsel
(
vdd
);
/* Enable VP */
vpconfig
=
vdd
->
read_reg
(
prm_mod_offs
,
vdd
->
vp_data
->
vpconfig
);
vpconfig
|=
vdd
->
vp_data
->
vp_common
->
vpconfig_vpenable
;
vdd
->
write_reg
(
vpconfig
,
prm_mod_offs
,
vdd
->
vp_data
->
vpconfig
);
vdd
->
vp_enabled
=
true
;
}
/**
* omap_vp_disable() - API to disable a particular VP
* @voltdm: pointer to the VDD whose VP is to be disabled.
*
* This API disables a particular voltage processor. Needed by the smartreflex
* class drivers.
*/
void
omap_vp_disable
(
struct
voltagedomain
*
voltdm
)
{
struct
omap_vdd_info
*
vdd
;
u32
vpconfig
;
int
timeout
;
if
(
!
voltdm
||
IS_ERR
(
voltdm
))
{
pr_warning
(
"%s: VDD specified does not exist!
\n
"
,
__func__
);
return
;
}
vdd
=
container_of
(
voltdm
,
struct
omap_vdd_info
,
voltdm
);
if
(
!
vdd
->
read_reg
||
!
vdd
->
write_reg
)
{
pr_err
(
"%s: No read/write API for accessing vdd_%s regs
\n
"
,
__func__
,
voltdm
->
name
);
return
;
}
/* If VP is already disabled, do nothing. Return */
if
(
!
vdd
->
vp_enabled
)
{
pr_warning
(
"%s: Trying to disable VP for vdd_%s when"
"it is already disabled
\n
"
,
__func__
,
voltdm
->
name
);
return
;
}
/* Disable VP */
vpconfig
=
vdd
->
read_reg
(
prm_mod_offs
,
vdd
->
vp_data
->
vpconfig
);
vpconfig
&=
~
vdd
->
vp_data
->
vp_common
->
vpconfig_vpenable
;
vdd
->
write_reg
(
vpconfig
,
prm_mod_offs
,
vdd
->
vp_data
->
vpconfig
);
/*
* Wait for VP idle Typical latency is <2us. Maximum latency is ~100us
*/
omap_test_timeout
((
vdd
->
read_reg
(
prm_mod_offs
,
vdd
->
vp_data
->
vstatus
)),
VP_IDLE_TIMEOUT
,
timeout
);
if
(
timeout
>=
VP_IDLE_TIMEOUT
)
pr_warning
(
"%s: vdd_%s idle timedout
\n
"
,
__func__
,
voltdm
->
name
);
vdd
->
vp_enabled
=
false
;
return
;
}
/**
* omap_voltage_scale_vdd() - API to scale voltage of a particular
* voltage domain.
* @voltdm: pointer to the VDD which is to be scaled.
* @target_volt: The target voltage of the voltage domain
*
*
* This API should be called by the kernel to do the voltage scaling
* This API should be called by the kernel to do the voltage scaling
* for a particular voltage domain during
dvfs or any other situation
.
* for a particular voltage domain during
DVFS
.
*/
*/
int
omap_voltage_scale_vdd
(
struct
voltagedomain
*
voltdm
,
int
voltdm_scale
(
struct
voltagedomain
*
voltdm
,
unsigned
long
target_volt
)
unsigned
long
target_volt
)
{
{
struct
omap_vdd_info
*
vdd
;
int
ret
;
if
(
!
voltdm
||
IS_ERR
(
voltdm
))
{
if
(
!
voltdm
||
IS_ERR
(
voltdm
))
{
pr_warning
(
"%s: VDD specified does not exist!
\n
"
,
__func__
);
pr_warning
(
"%s: VDD specified does not exist!
\n
"
,
__func__
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
vdd
=
container_of
(
voltdm
,
struct
omap_vdd_info
,
voltdm
);
if
(
!
voltdm
->
scale
)
{
if
(
!
vdd
->
volt_scale
)
{
pr_err
(
"%s: No voltage scale API registered for vdd_%s
\n
"
,
pr_err
(
"%s: No voltage scale API registered for vdd_%s
\n
"
,
__func__
,
voltdm
->
name
);
__func__
,
voltdm
->
name
);
return
-
ENODATA
;
return
-
ENODATA
;
}
}
return
vdd
->
volt_scale
(
vdd
,
target_volt
);
ret
=
voltdm
->
scale
(
voltdm
,
target_volt
);
if
(
!
ret
)
voltdm
->
nominal_volt
=
target_volt
;
return
ret
;
}
}
/**
/**
*
omap_voltage
_reset() - Resets the voltage of a particular voltage domain
*
voltdm
_reset() - Resets the voltage of a particular voltage domain
*
to that of the current OPP.
*
to that of the current OPP.
* @voltdm:
pointer to the VDD
whose voltage is to be reset.
* @voltdm:
pointer to the voltage domain
whose voltage is to be reset.
*
*
* This API finds out the correct voltage the voltage domain is supposed
* This API finds out the correct voltage the voltage domain is supposed
* to be at and resets the voltage to that level. Should be used especially
* to be at and resets the voltage to that level. Should be used especially
* while disabling any voltage compensation modules.
* while disabling any voltage compensation modules.
*/
*/
void
omap_voltage
_reset
(
struct
voltagedomain
*
voltdm
)
void
voltdm
_reset
(
struct
voltagedomain
*
voltdm
)
{
{
unsigned
long
target_
uvdc
;
unsigned
long
target_
volt
;
if
(
!
voltdm
||
IS_ERR
(
voltdm
))
{
if
(
!
voltdm
||
IS_ERR
(
voltdm
))
{
pr_warning
(
"%s: VDD specified does not exist!
\n
"
,
__func__
);
pr_warning
(
"%s: VDD specified does not exist!
\n
"
,
__func__
);
return
;
return
;
}
}
target_
uvdc
=
omap_voltage_get_nom_volt
(
voltdm
);
target_
volt
=
voltdm_get_voltage
(
voltdm
);
if
(
!
target_
uvdc
)
{
if
(
!
target_
volt
)
{
pr_err
(
"%s: unable to find current voltage for vdd_%s
\n
"
,
pr_err
(
"%s: unable to find current voltage for vdd_%s
\n
"
,
__func__
,
voltdm
->
name
);
__func__
,
voltdm
->
name
);
return
;
return
;
}
}
omap_voltage_scale_vdd
(
voltdm
,
target_uvdc
);
voltdm_scale
(
voltdm
,
target_volt
);
}
}
/**
/**
...
@@ -884,18 +133,14 @@ void omap_voltage_reset(struct voltagedomain *voltdm)
...
@@ -884,18 +133,14 @@ void omap_voltage_reset(struct voltagedomain *voltdm)
*
*
*/
*/
void
omap_voltage_get_volttable
(
struct
voltagedomain
*
voltdm
,
void
omap_voltage_get_volttable
(
struct
voltagedomain
*
voltdm
,
struct
omap_volt_data
**
volt_data
)
struct
omap_volt_data
**
volt_data
)
{
{
struct
omap_vdd_info
*
vdd
;
if
(
!
voltdm
||
IS_ERR
(
voltdm
))
{
if
(
!
voltdm
||
IS_ERR
(
voltdm
))
{
pr_warning
(
"%s: VDD specified does not exist!
\n
"
,
__func__
);
pr_warning
(
"%s: VDD specified does not exist!
\n
"
,
__func__
);
return
;
return
;
}
}
vdd
=
container_of
(
voltdm
,
struct
omap_vdd_info
,
voltdm
);
*
volt_data
=
voltdm
->
volt_data
;
*
volt_data
=
vdd
->
volt_data
;
}
}
/**
/**
...
@@ -914,9 +159,8 @@ void omap_voltage_get_volttable(struct voltagedomain *voltdm,
...
@@ -914,9 +159,8 @@ void omap_voltage_get_volttable(struct voltagedomain *voltdm,
* domain or if there is no matching entry.
* domain or if there is no matching entry.
*/
*/
struct
omap_volt_data
*
omap_voltage_get_voltdata
(
struct
voltagedomain
*
voltdm
,
struct
omap_volt_data
*
omap_voltage_get_voltdata
(
struct
voltagedomain
*
voltdm
,
unsigned
long
volt
)
unsigned
long
volt
)
{
{
struct
omap_vdd_info
*
vdd
;
int
i
;
int
i
;
if
(
!
voltdm
||
IS_ERR
(
voltdm
))
{
if
(
!
voltdm
||
IS_ERR
(
voltdm
))
{
...
@@ -924,17 +168,15 @@ struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm,
...
@@ -924,17 +168,15 @@ struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm,
return
ERR_PTR
(
-
EINVAL
);
return
ERR_PTR
(
-
EINVAL
);
}
}
vdd
=
container_of
(
voltdm
,
struct
omap_vdd_info
,
voltdm
);
if
(
!
voltdm
->
volt_data
)
{
if
(
!
vdd
->
volt_data
)
{
pr_warning
(
"%s: voltage table does not exist for vdd_%s
\n
"
,
pr_warning
(
"%s: voltage table does not exist for vdd_%s
\n
"
,
__func__
,
voltdm
->
name
);
__func__
,
voltdm
->
name
);
return
ERR_PTR
(
-
ENODATA
);
return
ERR_PTR
(
-
ENODATA
);
}
}
for
(
i
=
0
;
v
dd
->
volt_data
[
i
].
volt_nominal
!=
0
;
i
++
)
{
for
(
i
=
0
;
v
oltdm
->
volt_data
[
i
].
volt_nominal
!=
0
;
i
++
)
{
if
(
v
dd
->
volt_data
[
i
].
volt_nominal
==
volt
)
if
(
v
oltdm
->
volt_data
[
i
].
volt_nominal
==
volt
)
return
&
v
dd
->
volt_data
[
i
];
return
&
v
oltdm
->
volt_data
[
i
];
}
}
pr_notice
(
"%s: Unable to match the current voltage with the voltage"
pr_notice
(
"%s: Unable to match the current voltage with the voltage"
...
@@ -947,53 +189,24 @@ struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm,
...
@@ -947,53 +189,24 @@ struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm,
* omap_voltage_register_pmic() - API to register PMIC specific data
* omap_voltage_register_pmic() - API to register PMIC specific data
* @voltdm: pointer to the VDD for which the PMIC specific data is
* @voltdm: pointer to the VDD for which the PMIC specific data is
* to be registered
* to be registered
* @pmic
_info
: the structure containing pmic info
* @pmic: the structure containing pmic info
*
*
* This API is to be called by the SOC/PMIC file to specify the
* This API is to be called by the SOC/PMIC file to specify the
* pmic specific info as present in omap_volt
_pmic_info
structure.
* pmic specific info as present in omap_volt
dm_pmic
structure.
*/
*/
int
omap_voltage_register_pmic
(
struct
voltagedomain
*
voltdm
,
int
omap_voltage_register_pmic
(
struct
voltagedomain
*
voltdm
,
struct
omap_volt_pmic_info
*
pmic_info
)
struct
omap_voltdm_pmic
*
pmic
)
{
{
struct
omap_vdd_info
*
vdd
;
if
(
!
voltdm
||
IS_ERR
(
voltdm
))
{
if
(
!
voltdm
||
IS_ERR
(
voltdm
))
{
pr_warning
(
"%s: VDD specified does not exist!
\n
"
,
__func__
);
pr_warning
(
"%s: VDD specified does not exist!
\n
"
,
__func__
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
vdd
=
container_of
(
voltdm
,
struct
omap_vdd_info
,
voltdm
);
voltdm
->
pmic
=
pmic
;
vdd
->
pmic_info
=
pmic_info
;
return
0
;
return
0
;
}
}
/**
* omap_voltage_get_dbgdir() - API to get pointer to the debugfs directory
* corresponding to a voltage domain.
*
* @voltdm: pointer to the VDD whose debug directory is required.
*
* This API returns pointer to the debugfs directory corresponding
* to the voltage domain. Should be used by drivers requiring to
* add any debug entry for a particular voltage domain. Returns NULL
* in case of error.
*/
struct
dentry
*
omap_voltage_get_dbgdir
(
struct
voltagedomain
*
voltdm
)
{
struct
omap_vdd_info
*
vdd
;
if
(
!
voltdm
||
IS_ERR
(
voltdm
))
{
pr_warning
(
"%s: VDD specified does not exist!
\n
"
,
__func__
);
return
NULL
;
}
vdd
=
container_of
(
voltdm
,
struct
omap_vdd_info
,
voltdm
);
return
vdd
->
debug_dir
;
}
/**
/**
* omap_change_voltscale_method() - API to change the voltage scaling method.
* omap_change_voltscale_method() - API to change the voltage scaling method.
* @voltdm: pointer to the VDD whose voltage scaling method
* @voltdm: pointer to the VDD whose voltage scaling method
...
@@ -1005,23 +218,19 @@ struct dentry *omap_voltage_get_dbgdir(struct voltagedomain *voltdm)
...
@@ -1005,23 +218,19 @@ struct dentry *omap_voltage_get_dbgdir(struct voltagedomain *voltdm)
* defined in voltage.h
* defined in voltage.h
*/
*/
void
omap_change_voltscale_method
(
struct
voltagedomain
*
voltdm
,
void
omap_change_voltscale_method
(
struct
voltagedomain
*
voltdm
,
int
voltscale_method
)
int
voltscale_method
)
{
{
struct
omap_vdd_info
*
vdd
;
if
(
!
voltdm
||
IS_ERR
(
voltdm
))
{
if
(
!
voltdm
||
IS_ERR
(
voltdm
))
{
pr_warning
(
"%s: VDD specified does not exist!
\n
"
,
__func__
);
pr_warning
(
"%s: VDD specified does not exist!
\n
"
,
__func__
);
return
;
return
;
}
}
vdd
=
container_of
(
voltdm
,
struct
omap_vdd_info
,
voltdm
);
switch
(
voltscale_method
)
{
switch
(
voltscale_method
)
{
case
VOLTSCALE_VPFORCEUPDATE
:
case
VOLTSCALE_VPFORCEUPDATE
:
v
dd
->
volt_scale
=
vp_forceupdate_scale_voltag
e
;
v
oltdm
->
scale
=
omap_vp_forceupdate_scal
e
;
return
;
return
;
case
VOLTSCALE_VCBYPASS
:
case
VOLTSCALE_VCBYPASS
:
v
dd
->
volt_scale
=
vc_bypass_scale_voltag
e
;
v
oltdm
->
scale
=
omap_vc_bypass_scal
e
;
return
;
return
;
default:
default:
pr_warning
(
"%s: Trying to change the method of voltage scaling"
pr_warning
(
"%s: Trying to change the method of voltage scaling"
...
@@ -1030,77 +239,192 @@ void omap_change_voltscale_method(struct voltagedomain *voltdm,
...
@@ -1030,77 +239,192 @@ void omap_change_voltscale_method(struct voltagedomain *voltdm,
}
}
/**
/**
* omap_voltage_domain_lookup() - API to get the voltage domain pointer
* omap_voltage_late_init() - Init the various voltage parameters
* @name: Name of the voltage domain
*
*
* This API looks up in the global vdd_info struct for the
* This API is to be called in the later stages of the
* existence of voltage domain <name>. If it exists, the API returns
* system boot to init the voltage controller and
* a pointer to the voltage domain structure corresponding to the
* voltage processors.
* VDD<name>. Else retuns error pointer.
*/
*/
struct
voltagedomain
*
omap_voltage_domain_lookup
(
char
*
name
)
int
__init
omap_voltage_late_init
(
void
)
{
{
int
i
;
struct
voltagedomain
*
voltdm
;
if
(
!
vdd_info
)
{
if
(
list_empty
(
&
voltdm_list
)
)
{
pr_err
(
"%s: Voltage driver
init not yet happened.Faulting!
\n
"
,
pr_err
(
"%s: Voltage driver
support not added
\n
"
,
__func__
);
__func__
);
return
ERR_PTR
(
-
EINVAL
)
;
return
-
EINVAL
;
}
}
if
(
!
name
)
{
list_for_each_entry
(
voltdm
,
&
voltdm_list
,
node
)
{
pr_err
(
"%s: No name to get the votage domain!
\n
"
,
__func__
);
struct
clk
*
sys_ck
;
return
ERR_PTR
(
-
EINVAL
);
if
(
!
voltdm
->
scalable
)
continue
;
sys_ck
=
clk_get
(
NULL
,
voltdm
->
sys_clk
.
name
);
if
(
IS_ERR
(
sys_ck
))
{
pr_warning
(
"%s: Could not get sys clk.
\n
"
,
__func__
);
return
-
EINVAL
;
}
voltdm
->
sys_clk
.
rate
=
clk_get_rate
(
sys_ck
);
WARN_ON
(
!
voltdm
->
sys_clk
.
rate
);
clk_put
(
sys_ck
);
if
(
voltdm
->
vc
)
{
voltdm
->
scale
=
omap_vc_bypass_scale
;
omap_vc_init_channel
(
voltdm
);
}
if
(
voltdm
->
vp
)
{
voltdm
->
scale
=
omap_vp_forceupdate_scale
;
omap_vp_init
(
voltdm
);
}
}
}
for
(
i
=
0
;
i
<
nr_scalable_vdd
;
i
++
)
{
return
0
;
if
(
!
(
strcmp
(
name
,
vdd_info
[
i
]
->
voltdm
.
name
)))
}
return
&
vdd_info
[
i
]
->
voltdm
;
static
struct
voltagedomain
*
_voltdm_lookup
(
const
char
*
name
)
{
struct
voltagedomain
*
voltdm
,
*
temp_voltdm
;
voltdm
=
NULL
;
list_for_each_entry
(
temp_voltdm
,
&
voltdm_list
,
node
)
{
if
(
!
strcmp
(
name
,
temp_voltdm
->
name
))
{
voltdm
=
temp_voltdm
;
break
;
}
}
}
return
ERR_PTR
(
-
EINVAL
)
;
return
voltdm
;
}
}
/**
/**
* omap_voltage_late_init() - Init the various voltage parameters
* voltdm_add_pwrdm - add a powerdomain to a voltagedomain
* @voltdm: struct voltagedomain * to add the powerdomain to
* @pwrdm: struct powerdomain * to associate with a voltagedomain
*
*
* This API is to be called in the later stages of the
* Associate the powerdomain @pwrdm with a voltagedomain @voltdm. This
* system boot to init the voltage controller and
* enables the use of voltdm_for_each_pwrdm(). Returns -EINVAL if
* voltage processors.
* presented with invalid pointers; -ENOMEM if memory could not be allocated;
* or 0 upon success.
*/
*/
int
__init
omap_voltage_late_init
(
void
)
int
voltdm_add_pwrdm
(
struct
voltagedomain
*
voltdm
,
struct
powerdomain
*
pwrdm
)
{
{
int
i
;
if
(
!
voltdm
||
!
pwrdm
)
return
-
EINVAL
;
if
(
!
vdd_info
)
{
pr_debug
(
"voltagedomain: associating powerdomain %s with voltagedomain "
pr_err
(
"%s: Voltage driver support not added
\n
"
,
"%s
\n
"
,
pwrdm
->
name
,
voltdm
->
name
);
__func__
);
list_add
(
&
pwrdm
->
voltdm_node
,
&
voltdm
->
pwrdm_list
);
return
0
;
}
/**
* voltdm_for_each_pwrdm - call function for each pwrdm in a voltdm
* @voltdm: struct voltagedomain * to iterate over
* @fn: callback function *
*
* Call the supplied function @fn for each powerdomain in the
* voltagedomain @voltdm. Returns -EINVAL if presented with invalid
* pointers; or passes along the last return value of the callback
* function, which should be 0 for success or anything else to
* indicate failure.
*/
int
voltdm_for_each_pwrdm
(
struct
voltagedomain
*
voltdm
,
int
(
*
fn
)(
struct
voltagedomain
*
voltdm
,
struct
powerdomain
*
pwrdm
))
{
struct
powerdomain
*
pwrdm
;
int
ret
=
0
;
if
(
!
fn
)
return
-
EINVAL
;
return
-
EINVAL
;
}
voltage_dir
=
debugfs_create_dir
(
"voltage"
,
NULL
);
list_for_each_entry
(
pwrdm
,
&
voltdm
->
pwrdm_list
,
voltdm_node
)
if
(
IS_ERR
(
voltage_dir
))
ret
=
(
*
fn
)(
voltdm
,
pwrdm
);
pr_err
(
"%s: Unable to create voltage debugfs main dir
\n
"
,
__func__
);
return
ret
;
for
(
i
=
0
;
i
<
nr_scalable_vdd
;
i
++
)
{
}
if
(
omap_vdd_data_configure
(
vdd_info
[
i
]))
continue
;
/**
omap_vc_init
(
vdd_info
[
i
]);
* voltdm_for_each - call function on each registered voltagedomain
vp_init
(
vdd_info
[
i
]);
* @fn: callback function *
vdd_debugfs_init
(
vdd_info
[
i
]);
*
* Call the supplied function @fn for each registered voltagedomain.
* The callback function @fn can return anything but 0 to bail out
* early from the iterator. Returns the last return value of the
* callback function, which should be 0 for success or anything else
* to indicate failure; or -EINVAL if the function pointer is null.
*/
int
voltdm_for_each
(
int
(
*
fn
)(
struct
voltagedomain
*
voltdm
,
void
*
user
),
void
*
user
)
{
struct
voltagedomain
*
temp_voltdm
;
int
ret
=
0
;
if
(
!
fn
)
return
-
EINVAL
;
list_for_each_entry
(
temp_voltdm
,
&
voltdm_list
,
node
)
{
ret
=
(
*
fn
)(
temp_voltdm
,
user
);
if
(
ret
)
break
;
}
}
return
0
;
return
ret
;
}
}
/* XXX document */
static
int
_voltdm_register
(
struct
voltagedomain
*
voltdm
)
int
__init
omap_voltage_early_init
(
s16
prm_mod
,
s16
prm_irqst_ocp_mod
,
struct
omap_vdd_info
*
omap_vdd_array
[],
u8
omap_vdd_count
)
{
{
prm_mod_offs
=
prm_mod
;
if
(
!
voltdm
||
!
voltdm
->
name
)
prm_irqst_ocp_mod_offs
=
prm_irqst_ocp_mod
;
return
-
EINVAL
;
vdd_info
=
omap_vdd_array
;
nr_scalable_vdd
=
omap_vdd_count
;
INIT_LIST_HEAD
(
&
voltdm
->
pwrdm_list
);
list_add
(
&
voltdm
->
node
,
&
voltdm_list
);
pr_debug
(
"voltagedomain: registered %s
\n
"
,
voltdm
->
name
);
return
0
;
return
0
;
}
}
/**
* voltdm_lookup - look up a voltagedomain by name, return a pointer
* @name: name of voltagedomain
*
* Find a registered voltagedomain by its name @name. Returns a pointer
* to the struct voltagedomain if found, or NULL otherwise.
*/
struct
voltagedomain
*
voltdm_lookup
(
const
char
*
name
)
{
struct
voltagedomain
*
voltdm
;
if
(
!
name
)
return
NULL
;
voltdm
=
_voltdm_lookup
(
name
);
return
voltdm
;
}
/**
* voltdm_init - set up the voltagedomain layer
* @voltdm_list: array of struct voltagedomain pointers to register
*
* Loop through the array of voltagedomains @voltdm_list, registering all
* that are available on the current CPU. If voltdm_list is supplied
* and not null, all of the referenced voltagedomains will be
* registered. No return value.
*/
void
voltdm_init
(
struct
voltagedomain
**
voltdms
)
{
struct
voltagedomain
**
v
;
if
(
voltdms
)
{
for
(
v
=
voltdms
;
*
v
;
v
++
)
_voltdm_register
(
*
v
);
}
}
arch/arm/mach-omap2/voltage.h
浏览文件 @
23618f7f
...
@@ -19,6 +19,8 @@
...
@@ -19,6 +19,8 @@
#include "vc.h"
#include "vc.h"
#include "vp.h"
#include "vp.h"
struct
powerdomain
;
/* XXX document */
/* XXX document */
#define VOLTSCALE_VPFORCEUPDATE 1
#define VOLTSCALE_VPFORCEUPDATE 1
#define VOLTSCALE_VCBYPASS 2
#define VOLTSCALE_VCBYPASS 2
...
@@ -32,29 +34,60 @@
...
@@ -32,29 +34,60 @@
#define OMAP3_VOLTSETUP2 0xff
#define OMAP3_VOLTSETUP2 0xff
/**
/**
* struct omap_vfsm_instance
_data
- per-voltage manager FSM register/bitfield
* struct omap_vfsm_instance - per-voltage manager FSM register/bitfield
* data
* data
* @voltsetup_mask: SETUP_TIME* bitmask in the PRM_VOLTSETUP* register
* @voltsetup_mask: SETUP_TIME* bitmask in the PRM_VOLTSETUP* register
* @voltsetup_reg: register offset of PRM_VOLTSETUP from PRM base
* @voltsetup_reg: register offset of PRM_VOLTSETUP from PRM base
* @voltsetup_shift: SETUP_TIME* field shift in the PRM_VOLTSETUP* register
*
*
* XXX What about VOLTOFFSET/VOLTCTRL?
* XXX What about VOLTOFFSET/VOLTCTRL?
* XXX It is not necessary to have both a _mask and a _shift for the same
* bitfield - remove one!
*/
*/
struct
omap_vfsm_instance
_data
{
struct
omap_vfsm_instance
{
u32
voltsetup_mask
;
u32
voltsetup_mask
;
u8
voltsetup_reg
;
u8
voltsetup_reg
;
u8
voltsetup_shift
;
};
};
/**
/**
* struct voltagedomain - omap voltage domain global structure.
* struct voltagedomain - omap voltage domain global structure.
* @name: Name of the voltage domain which can be used as a unique
* @name: Name of the voltage domain which can be used as a unique identifier.
* identifier.
* @scalable: Whether or not this voltage domain is scalable
* @node: list_head linking all voltage domains
* @pwrdm_list: list_head linking all powerdomains in this voltagedomain
* @vc: pointer to VC channel associated with this voltagedomain
* @vp: pointer to VP associated with this voltagedomain
* @read: read a VC/VP register
* @write: write a VC/VP register
* @read: read-modify-write a VC/VP register
* @sys_clk: system clock name/frequency, used for various timing calculations
* @scale: function used to scale the voltage of the voltagedomain
* @nominal_volt: current nominal voltage for this voltage domain
* @volt_data: voltage table having the distinct voltages supported
* by the domain and other associated per voltage data.
*/
*/
struct
voltagedomain
{
struct
voltagedomain
{
char
*
name
;
char
*
name
;
bool
scalable
;
struct
list_head
node
;
struct
list_head
pwrdm_list
;
struct
omap_vc_channel
*
vc
;
const
struct
omap_vfsm_instance
*
vfsm
;
struct
omap_vp_instance
*
vp
;
struct
omap_voltdm_pmic
*
pmic
;
/* VC/VP register access functions: SoC specific */
u32
(
*
read
)
(
u8
offset
);
void
(
*
write
)
(
u32
val
,
u8
offset
);
u32
(
*
rmw
)(
u32
mask
,
u32
bits
,
u8
offset
);
union
{
const
char
*
name
;
u32
rate
;
}
sys_clk
;
int
(
*
scale
)
(
struct
voltagedomain
*
voltdm
,
unsigned
long
target_volt
);
u32
nominal_volt
;
struct
omap_volt_data
*
volt_data
;
};
};
/**
/**
...
@@ -77,13 +110,18 @@ struct omap_volt_data {
...
@@ -77,13 +110,18 @@ struct omap_volt_data {
};
};
/**
/**
* struct omap_volt
_pmic_info
- PMIC specific data required by voltage driver.
* struct omap_volt
dm_pmic
- PMIC specific data required by voltage driver.
* @slew_rate: PMIC slew rate (in uv/us)
* @slew_rate: PMIC slew rate (in uv/us)
* @step_size: PMIC voltage step size (in uv)
* @step_size: PMIC voltage step size (in uv)
* @i2c_slave_addr: I2C slave address of PMIC
* @volt_reg_addr: voltage configuration register address
* @cmd_reg_addr: command (on, on-LP, ret, off) configuration register address
* @i2c_high_speed: whether VC uses I2C high-speed mode to PMIC
* @i2c_mcode: master code value for I2C high-speed preamble transmission
* @vsel_to_uv: PMIC API to convert vsel value to actual voltage in uV.
* @vsel_to_uv: PMIC API to convert vsel value to actual voltage in uV.
* @uv_to_vsel: PMIC API to convert voltage in uV to vsel value.
* @uv_to_vsel: PMIC API to convert voltage in uV to vsel value.
*/
*/
struct
omap_volt
_pmic_info
{
struct
omap_volt
dm_pmic
{
int
slew_rate
;
int
slew_rate
;
int
step_size
;
int
step_size
;
u32
on_volt
;
u32
on_volt
;
...
@@ -91,81 +129,34 @@ struct omap_volt_pmic_info {
...
@@ -91,81 +129,34 @@ struct omap_volt_pmic_info {
u32
ret_volt
;
u32
ret_volt
;
u32
off_volt
;
u32
off_volt
;
u16
volt_setup_time
;
u16
volt_setup_time
;
u16
i2c_slave_addr
;
u16
volt_reg_addr
;
u16
cmd_reg_addr
;
u8
vp_erroroffset
;
u8
vp_erroroffset
;
u8
vp_vstepmin
;
u8
vp_vstepmin
;
u8
vp_vstepmax
;
u8
vp_vstepmax
;
u8
vp_vddmin
;
u8
vp_vddmin
;
u8
vp_vddmax
;
u8
vp_vddmax
;
u8
vp_timeout_us
;
u8
vp_timeout_us
;
u8
i2c_slave_addr
;
bool
i2c_high_speed
;
u8
pmic_reg
;
u8
i2c_mcode
;
unsigned
long
(
*
vsel_to_uv
)
(
const
u8
vsel
);
unsigned
long
(
*
vsel_to_uv
)
(
const
u8
vsel
);
u8
(
*
uv_to_vsel
)
(
unsigned
long
uV
);
u8
(
*
uv_to_vsel
)
(
unsigned
long
uV
);
};
};
/**
* omap_vdd_info - Per Voltage Domain info
*
* @volt_data : voltage table having the distinct voltages supported
* by the domain and other associated per voltage data.
* @pmic_info : pmic specific parameters which should be populted by
* the pmic drivers.
* @vp_data : the register values, shifts, masks for various
* vp registers
* @vp_rt_data : VP data derived at runtime, not predefined
* @vc_data : structure containing various various vc registers,
* shifts, masks etc.
* @vfsm : voltage manager FSM data
* @voltdm : pointer to the voltage domain structure
* @debug_dir : debug directory for this voltage domain.
* @curr_volt : current voltage for this vdd.
* @vp_enabled : flag to keep track of whether vp is enabled or not
* @volt_scale : API to scale the voltage of the vdd.
*/
struct
omap_vdd_info
{
struct
omap_volt_data
*
volt_data
;
struct
omap_volt_pmic_info
*
pmic_info
;
struct
omap_vp_instance_data
*
vp_data
;
struct
omap_vp_runtime_data
vp_rt_data
;
struct
omap_vc_instance_data
*
vc_data
;
const
struct
omap_vfsm_instance_data
*
vfsm
;
struct
voltagedomain
voltdm
;
struct
dentry
*
debug_dir
;
u32
curr_volt
;
bool
vp_enabled
;
u32
(
*
read_reg
)
(
u16
mod
,
u8
offset
);
void
(
*
write_reg
)
(
u32
val
,
u16
mod
,
u8
offset
);
int
(
*
volt_scale
)
(
struct
omap_vdd_info
*
vdd
,
unsigned
long
target_volt
);
};
unsigned
long
omap_vp_get_curr_volt
(
struct
voltagedomain
*
voltdm
);
void
omap_vp_enable
(
struct
voltagedomain
*
voltdm
);
void
omap_vp_disable
(
struct
voltagedomain
*
voltdm
);
int
omap_voltage_scale_vdd
(
struct
voltagedomain
*
voltdm
,
unsigned
long
target_volt
);
void
omap_voltage_reset
(
struct
voltagedomain
*
voltdm
);
void
omap_voltage_get_volttable
(
struct
voltagedomain
*
voltdm
,
void
omap_voltage_get_volttable
(
struct
voltagedomain
*
voltdm
,
struct
omap_volt_data
**
volt_data
);
struct
omap_volt_data
**
volt_data
);
struct
omap_volt_data
*
omap_voltage_get_voltdata
(
struct
voltagedomain
*
voltdm
,
struct
omap_volt_data
*
omap_voltage_get_voltdata
(
struct
voltagedomain
*
voltdm
,
unsigned
long
volt
);
unsigned
long
volt
);
unsigned
long
omap_voltage_get_nom_volt
(
struct
voltagedomain
*
voltdm
);
struct
dentry
*
omap_voltage_get_dbgdir
(
struct
voltagedomain
*
voltdm
);
int
__init
omap_voltage_early_init
(
s16
prm_mod
,
s16
prm_irqst_mod
,
struct
omap_vdd_info
*
omap_vdd_array
[],
u8
omap_vdd_count
);
#ifdef CONFIG_PM
#ifdef CONFIG_PM
int
omap_voltage_register_pmic
(
struct
voltagedomain
*
voltdm
,
int
omap_voltage_register_pmic
(
struct
voltagedomain
*
voltdm
,
struct
omap_volt_pmic_info
*
pmic_info
);
struct
omap_voltdm_pmic
*
pmic
);
void
omap_change_voltscale_method
(
struct
voltagedomain
*
voltdm
,
void
omap_change_voltscale_method
(
struct
voltagedomain
*
voltdm
,
int
voltscale_method
);
int
voltscale_method
);
/* API to get the voltagedomain pointer */
struct
voltagedomain
*
omap_voltage_domain_lookup
(
char
*
name
);
int
omap_voltage_late_init
(
void
);
int
omap_voltage_late_init
(
void
);
#else
#else
static
inline
int
omap_voltage_register_pmic
(
struct
voltagedomain
*
voltdm
,
static
inline
int
omap_voltage_register_pmic
(
struct
voltagedomain
*
voltdm
,
struct
omap_volt_pmic_info
*
pmic_info
)
struct
omap_voltdm_pmic
*
pmic
)
{
{
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
@@ -175,10 +166,21 @@ static inline int omap_voltage_late_init(void)
...
@@ -175,10 +166,21 @@ static inline int omap_voltage_late_init(void)
{
{
return
-
EINVAL
;
return
-
EINVAL
;
}
}
static
inline
struct
voltagedomain
*
omap_voltage_domain_lookup
(
char
*
name
)
{
return
ERR_PTR
(
-
EINVAL
);
}
#endif
#endif
extern
void
omap2xxx_voltagedomains_init
(
void
);
extern
void
omap3xxx_voltagedomains_init
(
void
);
extern
void
omap44xx_voltagedomains_init
(
void
);
struct
voltagedomain
*
voltdm_lookup
(
const
char
*
name
);
void
voltdm_init
(
struct
voltagedomain
**
voltdm_list
);
int
voltdm_add_pwrdm
(
struct
voltagedomain
*
voltdm
,
struct
powerdomain
*
pwrdm
);
int
voltdm_for_each
(
int
(
*
fn
)(
struct
voltagedomain
*
voltdm
,
void
*
user
),
void
*
user
);
int
voltdm_for_each_pwrdm
(
struct
voltagedomain
*
voltdm
,
int
(
*
fn
)(
struct
voltagedomain
*
voltdm
,
struct
powerdomain
*
pwrdm
));
int
voltdm_scale
(
struct
voltagedomain
*
voltdm
,
unsigned
long
target_volt
);
void
voltdm_reset
(
struct
voltagedomain
*
voltdm
);
unsigned
long
voltdm_get_voltage
(
struct
voltagedomain
*
voltdm
);
#endif
#endif
arch/arm/mach-omap2/voltagedomains2xxx_data.c
0 → 100644
浏览文件 @
23618f7f
/*
* OMAP3 voltage domain data
*
* Copyright (C) 2011 Texas Instruments, Inc.
*
* 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/kernel.h>
#include <linux/init.h>
#include "voltage.h"
static
struct
voltagedomain
omap2_voltdm_core
=
{
.
name
=
"core"
,
};
static
struct
voltagedomain
omap2_voltdm_wkup
=
{
.
name
=
"wakeup"
,
};
static
struct
voltagedomain
*
voltagedomains_omap2
[]
__initdata
=
{
&
omap2_voltdm_core
,
&
omap2_voltdm_wkup
,
NULL
,
};
void
__init
omap2xxx_voltagedomains_init
(
void
)
{
voltdm_init
(
voltagedomains_omap2
);
}
arch/arm/mach-omap2/voltagedomains3xxx_data.c
浏览文件 @
23618f7f
...
@@ -31,65 +31,70 @@
...
@@ -31,65 +31,70 @@
* VDD data
* VDD data
*/
*/
static
const
struct
omap_vfsm_instance
_data
omap3_vdd1_vfsm_data
=
{
static
const
struct
omap_vfsm_instance
omap3_vdd1_vfsm
=
{
.
voltsetup_reg
=
OMAP3_PRM_VOLTSETUP1_OFFSET
,
.
voltsetup_reg
=
OMAP3_PRM_VOLTSETUP1_OFFSET
,
.
voltsetup_shift
=
OMAP3430_SETUP_TIME1_SHIFT
,
.
voltsetup_mask
=
OMAP3430_SETUP_TIME1_MASK
,
.
voltsetup_mask
=
OMAP3430_SETUP_TIME1_MASK
,
};
};
static
struct
omap_vdd_info
omap3_vdd1_info
=
{
static
const
struct
omap_vfsm_instance
omap3_vdd2_vfsm
=
{
.
vp_data
=
&
omap3_vp1_data
,
.
vc_data
=
&
omap3_vc1_data
,
.
vfsm
=
&
omap3_vdd1_vfsm_data
,
.
voltdm
=
{
.
name
=
"mpu"
,
},
};
static
const
struct
omap_vfsm_instance_data
omap3_vdd2_vfsm_data
=
{
.
voltsetup_reg
=
OMAP3_PRM_VOLTSETUP1_OFFSET
,
.
voltsetup_reg
=
OMAP3_PRM_VOLTSETUP1_OFFSET
,
.
voltsetup_shift
=
OMAP3430_SETUP_TIME2_SHIFT
,
.
voltsetup_mask
=
OMAP3430_SETUP_TIME2_MASK
,
.
voltsetup_mask
=
OMAP3430_SETUP_TIME2_MASK
,
};
};
static
struct
omap_vdd_info
omap3_vdd2_info
=
{
static
struct
voltagedomain
omap3_voltdm_mpu
=
{
.
vp_data
=
&
omap3_vp2_data
,
.
name
=
"mpu_iva"
,
.
vc_data
=
&
omap3_vc2_data
,
.
scalable
=
true
,
.
vfsm
=
&
omap3_vdd2_vfsm_data
,
.
read
=
omap3_prm_vcvp_read
,
.
voltdm
=
{
.
write
=
omap3_prm_vcvp_write
,
.
name
=
"core"
,
.
rmw
=
omap3_prm_vcvp_rmw
,
},
.
vc
=
&
omap3_vc_mpu
,
.
vfsm
=
&
omap3_vdd1_vfsm
,
.
vp
=
&
omap3_vp_mpu
,
};
};
/* OMAP3 VDD structures */
static
struct
voltagedomain
omap3_voltdm_core
=
{
static
struct
omap_vdd_info
*
omap3_vdd_info
[]
=
{
.
name
=
"core"
,
&
omap3_vdd1_info
,
.
scalable
=
true
,
&
omap3_vdd2_info
,
.
read
=
omap3_prm_vcvp_read
,
.
write
=
omap3_prm_vcvp_write
,
.
rmw
=
omap3_prm_vcvp_rmw
,
.
vc
=
&
omap3_vc_core
,
.
vfsm
=
&
omap3_vdd2_vfsm
,
.
vp
=
&
omap3_vp_core
,
};
};
/* OMAP3 specific voltage init functions */
static
struct
voltagedomain
omap3_voltdm_wkup
=
{
static
int
__init
omap3xxx_voltage_early_init
(
void
)
.
name
=
"wakeup"
,
{
};
s16
prm_mod
=
OMAP3430_GR_MOD
;
s16
prm_irqst_ocp_mod
=
OCP_MOD
;
if
(
!
cpu_is_omap34xx
())
static
struct
voltagedomain
*
voltagedomains_omap3
[]
__initdata
=
{
return
0
;
&
omap3_voltdm_mpu
,
&
omap3_voltdm_core
,
&
omap3_voltdm_wkup
,
NULL
,
};
static
const
char
*
sys_clk_name
__initdata
=
"sys_ck"
;
void
__init
omap3xxx_voltagedomains_init
(
void
)
{
struct
voltagedomain
*
voltdm
;
int
i
;
/*
/*
* XXX Will depend on the process, validation, and binning
* XXX Will depend on the process, validation, and binning
* for the currently-running IC
* for the currently-running IC
*/
*/
if
(
cpu_is_omap3630
())
{
if
(
cpu_is_omap3630
())
{
omap3_v
dd1_info
.
volt_data
=
omap36xx_vddmpu_volt_data
;
omap3_v
oltdm_mpu
.
volt_data
=
omap36xx_vddmpu_volt_data
;
omap3_v
dd2_info
.
volt_data
=
omap36xx_vddcore_volt_data
;
omap3_v
oltdm_core
.
volt_data
=
omap36xx_vddcore_volt_data
;
}
else
{
}
else
{
omap3_v
dd1_info
.
volt_data
=
omap34xx_vddmpu_volt_data
;
omap3_v
oltdm_mpu
.
volt_data
=
omap34xx_vddmpu_volt_data
;
omap3_v
dd2_info
.
volt_data
=
omap34xx_vddcore_volt_data
;
omap3_v
oltdm_core
.
volt_data
=
omap34xx_vddcore_volt_data
;
}
}
return
omap_voltage_early_init
(
prm_mod
,
prm_irqst_ocp_mod
,
for
(
i
=
0
;
voltdm
=
voltagedomains_omap3
[
i
],
voltdm
;
i
++
)
omap3_vdd_info
,
voltdm
->
sys_clk
.
name
=
sys_clk_name
;
ARRAY_SIZE
(
omap3_vdd_info
));
voltdm_init
(
voltagedomains_omap3
);
};
};
core_initcall
(
omap3xxx_voltage_early_init
);
arch/arm/mach-omap2/voltagedomains44xx_data.c
浏览文件 @
23618f7f
...
@@ -32,71 +32,80 @@
...
@@ -32,71 +32,80 @@
#include "vc.h"
#include "vc.h"
#include "vp.h"
#include "vp.h"
static
const
struct
omap_vfsm_instance
_data
omap4_vdd_mpu_vfsm_data
=
{
static
const
struct
omap_vfsm_instance
omap4_vdd_mpu_vfsm
=
{
.
voltsetup_reg
=
OMAP4_PRM_VOLTSETUP_MPU_RET_SLEEP_OFFSET
,
.
voltsetup_reg
=
OMAP4_PRM_VOLTSETUP_MPU_RET_SLEEP_OFFSET
,
};
};
static
struct
omap_vdd_info
omap4_vdd_mpu_info
=
{
static
const
struct
omap_vfsm_instance
omap4_vdd_iva_vfsm
=
{
.
vp_data
=
&
omap4_vp_mpu_data
,
.
voltsetup_reg
=
OMAP4_PRM_VOLTSETUP_IVA_RET_SLEEP_OFFSET
,
.
vc_data
=
&
omap4_vc_mpu_data
,
.
vfsm
=
&
omap4_vdd_mpu_vfsm_data
,
.
voltdm
=
{
.
name
=
"mpu"
,
},
};
};
static
const
struct
omap_vfsm_instance
_data
omap4_vdd_iva_vfsm_data
=
{
static
const
struct
omap_vfsm_instance
omap4_vdd_core_vfsm
=
{
.
voltsetup_reg
=
OMAP4_PRM_VOLTSETUP_
IVA
_RET_SLEEP_OFFSET
,
.
voltsetup_reg
=
OMAP4_PRM_VOLTSETUP_
CORE
_RET_SLEEP_OFFSET
,
};
};
static
struct
omap_vdd_info
omap4_vdd_iva_info
=
{
static
struct
voltagedomain
omap4_voltdm_mpu
=
{
.
vp_data
=
&
omap4_vp_iva_data
,
.
name
=
"mpu"
,
.
vc_data
=
&
omap4_vc_iva_data
,
.
scalable
=
true
,
.
vfsm
=
&
omap4_vdd_iva_vfsm_data
,
.
read
=
omap4_prm_vcvp_read
,
.
voltdm
=
{
.
write
=
omap4_prm_vcvp_write
,
.
name
=
"iva"
,
.
rmw
=
omap4_prm_vcvp_rmw
,
},
.
vc
=
&
omap4_vc_mpu
,
.
vfsm
=
&
omap4_vdd_mpu_vfsm
,
.
vp
=
&
omap4_vp_mpu
,
};
};
static
const
struct
omap_vfsm_instance_data
omap4_vdd_core_vfsm_data
=
{
static
struct
voltagedomain
omap4_voltdm_iva
=
{
.
voltsetup_reg
=
OMAP4_PRM_VOLTSETUP_CORE_RET_SLEEP_OFFSET
,
.
name
=
"iva"
,
.
scalable
=
true
,
.
read
=
omap4_prm_vcvp_read
,
.
write
=
omap4_prm_vcvp_write
,
.
rmw
=
omap4_prm_vcvp_rmw
,
.
vc
=
&
omap4_vc_iva
,
.
vfsm
=
&
omap4_vdd_iva_vfsm
,
.
vp
=
&
omap4_vp_iva
,
};
};
static
struct
omap_vdd_info
omap4_vdd_core_info
=
{
static
struct
voltagedomain
omap4_voltdm_core
=
{
.
vp_data
=
&
omap4_vp_core_data
,
.
name
=
"core"
,
.
vc_data
=
&
omap4_vc_core_data
,
.
scalable
=
true
,
.
vfsm
=
&
omap4_vdd_core_vfsm_data
,
.
read
=
omap4_prm_vcvp_read
,
.
voltdm
=
{
.
write
=
omap4_prm_vcvp_write
,
.
name
=
"core"
,
.
rmw
=
omap4_prm_vcvp_rmw
,
},
.
vc
=
&
omap4_vc_core
,
.
vfsm
=
&
omap4_vdd_core_vfsm
,
.
vp
=
&
omap4_vp_core
,
};
};
/* OMAP4 VDD structures */
static
struct
voltagedomain
omap4_voltdm_wkup
=
{
static
struct
omap_vdd_info
*
omap4_vdd_info
[]
=
{
.
name
=
"wakeup"
,
&
omap4_vdd_mpu_info
,
&
omap4_vdd_iva_info
,
&
omap4_vdd_core_info
,
};
};
/* OMAP4 specific voltage init functions */
static
struct
voltagedomain
*
voltagedomains_omap4
[]
__initdata
=
{
static
int
__init
omap44xx_voltage_early_init
(
void
)
&
omap4_voltdm_mpu
,
{
&
omap4_voltdm_iva
,
s16
prm_mod
=
OMAP4430_PRM_DEVICE_INST
;
&
omap4_voltdm_core
,
s16
prm_irqst_ocp_mod
=
OMAP4430_PRM_OCP_SOCKET_INST
;
&
omap4_voltdm_wkup
,
NULL
,
};
static
const
char
*
sys_clk_name
__initdata
=
"sys_clkin_ck"
;
if
(
!
cpu_is_omap44xx
())
void
__init
omap44xx_voltagedomains_init
(
void
)
return
0
;
{
struct
voltagedomain
*
voltdm
;
int
i
;
/*
/*
* XXX Will depend on the process, validation, and binning
* XXX Will depend on the process, validation, and binning
* for the currently-running IC
* for the currently-running IC
*/
*/
omap4_vdd_mpu_info
.
volt_data
=
omap44xx_vdd_mpu_volt_data
;
omap4_voltdm_mpu
.
volt_data
=
omap44xx_vdd_mpu_volt_data
;
omap4_vdd_iva_info
.
volt_data
=
omap44xx_vdd_iva_volt_data
;
omap4_voltdm_iva
.
volt_data
=
omap44xx_vdd_iva_volt_data
;
omap4_vdd_core_info
.
volt_data
=
omap44xx_vdd_core_volt_data
;
omap4_voltdm_core
.
volt_data
=
omap44xx_vdd_core_volt_data
;
for
(
i
=
0
;
voltdm
=
voltagedomains_omap4
[
i
],
voltdm
;
i
++
)
voltdm
->
sys_clk
.
name
=
sys_clk_name
;
return
omap_voltage_early_init
(
prm_mod
,
prm_irqst_ocp_mod
,
voltdm_init
(
voltagedomains_omap4
);
omap4_vdd_info
,
ARRAY_SIZE
(
omap4_vdd_info
));
};
};
core_initcall
(
omap44xx_voltage_early_init
);
arch/arm/mach-omap2/vp.c
0 → 100644
浏览文件 @
23618f7f
#include <linux/kernel.h>
#include <linux/init.h>
#include <plat/common.h>
#include "voltage.h"
#include "vp.h"
#include "prm-regbits-34xx.h"
#include "prm-regbits-44xx.h"
#include "prm44xx.h"
static
u32
_vp_set_init_voltage
(
struct
voltagedomain
*
voltdm
,
u32
volt
)
{
struct
omap_vp_instance
*
vp
=
voltdm
->
vp
;
u32
vpconfig
;
char
vsel
;
vsel
=
voltdm
->
pmic
->
uv_to_vsel
(
volt
);
vpconfig
=
voltdm
->
read
(
vp
->
vpconfig
);
vpconfig
&=
~
(
vp
->
common
->
vpconfig_initvoltage_mask
|
vp
->
common
->
vpconfig_forceupdate
|
vp
->
common
->
vpconfig_initvdd
);
vpconfig
|=
vsel
<<
__ffs
(
vp
->
common
->
vpconfig_initvoltage_mask
);
voltdm
->
write
(
vpconfig
,
vp
->
vpconfig
);
/* Trigger initVDD value copy to voltage processor */
voltdm
->
write
((
vpconfig
|
vp
->
common
->
vpconfig_initvdd
),
vp
->
vpconfig
);
/* Clear initVDD copy trigger bit */
voltdm
->
write
(
vpconfig
,
vp
->
vpconfig
);
return
vpconfig
;
}
/* Generic voltage init functions */
void
__init
omap_vp_init
(
struct
voltagedomain
*
voltdm
)
{
struct
omap_vp_instance
*
vp
=
voltdm
->
vp
;
u32
val
,
sys_clk_rate
,
timeout
,
waittime
;
u32
vddmin
,
vddmax
,
vstepmin
,
vstepmax
;
if
(
!
voltdm
->
read
||
!
voltdm
->
write
)
{
pr_err
(
"%s: No read/write API for accessing vdd_%s regs
\n
"
,
__func__
,
voltdm
->
name
);
return
;
}
vp
->
enabled
=
false
;
/* Divide to avoid overflow */
sys_clk_rate
=
voltdm
->
sys_clk
.
rate
/
1000
;
timeout
=
(
sys_clk_rate
*
voltdm
->
pmic
->
vp_timeout_us
)
/
1000
;
vddmin
=
voltdm
->
pmic
->
vp_vddmin
;
vddmax
=
voltdm
->
pmic
->
vp_vddmax
;
waittime
=
((
voltdm
->
pmic
->
step_size
/
voltdm
->
pmic
->
slew_rate
)
*
sys_clk_rate
)
/
1000
;
vstepmin
=
voltdm
->
pmic
->
vp_vstepmin
;
vstepmax
=
voltdm
->
pmic
->
vp_vstepmax
;
/*
* VP_CONFIG: error gain is not set here, it will be updated
* on each scale, based on OPP.
*/
val
=
(
voltdm
->
pmic
->
vp_erroroffset
<<
__ffs
(
voltdm
->
vp
->
common
->
vpconfig_erroroffset_mask
))
|
vp
->
common
->
vpconfig_timeouten
;
voltdm
->
write
(
val
,
vp
->
vpconfig
);
/* VSTEPMIN */
val
=
(
waittime
<<
vp
->
common
->
vstepmin_smpswaittimemin_shift
)
|
(
vstepmin
<<
vp
->
common
->
vstepmin_stepmin_shift
);
voltdm
->
write
(
val
,
vp
->
vstepmin
);
/* VSTEPMAX */
val
=
(
vstepmax
<<
vp
->
common
->
vstepmax_stepmax_shift
)
|
(
waittime
<<
vp
->
common
->
vstepmax_smpswaittimemax_shift
);
voltdm
->
write
(
val
,
vp
->
vstepmax
);
/* VLIMITTO */
val
=
(
vddmax
<<
vp
->
common
->
vlimitto_vddmax_shift
)
|
(
vddmin
<<
vp
->
common
->
vlimitto_vddmin_shift
)
|
(
timeout
<<
vp
->
common
->
vlimitto_timeout_shift
);
voltdm
->
write
(
val
,
vp
->
vlimitto
);
}
int
omap_vp_update_errorgain
(
struct
voltagedomain
*
voltdm
,
unsigned
long
target_volt
)
{
struct
omap_volt_data
*
volt_data
;
if
(
!
voltdm
->
vp
)
return
-
EINVAL
;
/* Get volt_data corresponding to target_volt */
volt_data
=
omap_voltage_get_voltdata
(
voltdm
,
target_volt
);
if
(
IS_ERR
(
volt_data
))
return
-
EINVAL
;
/* Setting vp errorgain based on the voltage */
voltdm
->
rmw
(
voltdm
->
vp
->
common
->
vpconfig_errorgain_mask
,
volt_data
->
vp_errgain
<<
__ffs
(
voltdm
->
vp
->
common
->
vpconfig_errorgain_mask
),
voltdm
->
vp
->
vpconfig
);
return
0
;
}
/* VP force update method of voltage scaling */
int
omap_vp_forceupdate_scale
(
struct
voltagedomain
*
voltdm
,
unsigned
long
target_volt
)
{
struct
omap_vp_instance
*
vp
=
voltdm
->
vp
;
u32
vpconfig
;
u8
target_vsel
,
current_vsel
;
int
ret
,
timeout
=
0
;
ret
=
omap_vc_pre_scale
(
voltdm
,
target_volt
,
&
target_vsel
,
&
current_vsel
);
if
(
ret
)
return
ret
;
/*
* Clear all pending TransactionDone interrupt/status. Typical latency
* is <3us
*/
while
(
timeout
++
<
VP_TRANXDONE_TIMEOUT
)
{
vp
->
common
->
ops
->
clear_txdone
(
vp
->
id
);
if
(
!
vp
->
common
->
ops
->
check_txdone
(
vp
->
id
))
break
;
udelay
(
1
);
}
if
(
timeout
>=
VP_TRANXDONE_TIMEOUT
)
{
pr_warning
(
"%s: vdd_%s TRANXDONE timeout exceeded."
"Voltage change aborted"
,
__func__
,
voltdm
->
name
);
return
-
ETIMEDOUT
;
}
vpconfig
=
_vp_set_init_voltage
(
voltdm
,
target_volt
);
/* Force update of voltage */
voltdm
->
write
(
vpconfig
|
vp
->
common
->
vpconfig_forceupdate
,
voltdm
->
vp
->
vpconfig
);
/*
* Wait for TransactionDone. Typical latency is <200us.
* Depends on SMPSWAITTIMEMIN/MAX and voltage change
*/
timeout
=
0
;
omap_test_timeout
(
vp
->
common
->
ops
->
check_txdone
(
vp
->
id
),
VP_TRANXDONE_TIMEOUT
,
timeout
);
if
(
timeout
>=
VP_TRANXDONE_TIMEOUT
)
pr_err
(
"%s: vdd_%s TRANXDONE timeout exceeded."
"TRANXDONE never got set after the voltage update
\n
"
,
__func__
,
voltdm
->
name
);
omap_vc_post_scale
(
voltdm
,
target_volt
,
target_vsel
,
current_vsel
);
/*
* Disable TransactionDone interrupt , clear all status, clear
* control registers
*/
timeout
=
0
;
while
(
timeout
++
<
VP_TRANXDONE_TIMEOUT
)
{
vp
->
common
->
ops
->
clear_txdone
(
vp
->
id
);
if
(
!
vp
->
common
->
ops
->
check_txdone
(
vp
->
id
))
break
;
udelay
(
1
);
}
if
(
timeout
>=
VP_TRANXDONE_TIMEOUT
)
pr_warning
(
"%s: vdd_%s TRANXDONE timeout exceeded while trying"
"to clear the TRANXDONE status
\n
"
,
__func__
,
voltdm
->
name
);
/* Clear force bit */
voltdm
->
write
(
vpconfig
,
vp
->
vpconfig
);
return
0
;
}
/**
* omap_vp_enable() - API to enable a particular VP
* @voltdm: pointer to the VDD whose VP is to be enabled.
*
* This API enables a particular voltage processor. Needed by the smartreflex
* class drivers.
*/
void
omap_vp_enable
(
struct
voltagedomain
*
voltdm
)
{
struct
omap_vp_instance
*
vp
;
u32
vpconfig
,
volt
;
if
(
!
voltdm
||
IS_ERR
(
voltdm
))
{
pr_warning
(
"%s: VDD specified does not exist!
\n
"
,
__func__
);
return
;
}
vp
=
voltdm
->
vp
;
if
(
!
voltdm
->
read
||
!
voltdm
->
write
)
{
pr_err
(
"%s: No read/write API for accessing vdd_%s regs
\n
"
,
__func__
,
voltdm
->
name
);
return
;
}
/* If VP is already enabled, do nothing. Return */
if
(
vp
->
enabled
)
return
;
volt
=
voltdm_get_voltage
(
voltdm
);
if
(
!
volt
)
{
pr_warning
(
"%s: unable to find current voltage for %s
\n
"
,
__func__
,
voltdm
->
name
);
return
;
}
vpconfig
=
_vp_set_init_voltage
(
voltdm
,
volt
);
/* Enable VP */
vpconfig
|=
vp
->
common
->
vpconfig_vpenable
;
voltdm
->
write
(
vpconfig
,
vp
->
vpconfig
);
vp
->
enabled
=
true
;
}
/**
* omap_vp_disable() - API to disable a particular VP
* @voltdm: pointer to the VDD whose VP is to be disabled.
*
* This API disables a particular voltage processor. Needed by the smartreflex
* class drivers.
*/
void
omap_vp_disable
(
struct
voltagedomain
*
voltdm
)
{
struct
omap_vp_instance
*
vp
;
u32
vpconfig
;
int
timeout
;
if
(
!
voltdm
||
IS_ERR
(
voltdm
))
{
pr_warning
(
"%s: VDD specified does not exist!
\n
"
,
__func__
);
return
;
}
vp
=
voltdm
->
vp
;
if
(
!
voltdm
->
read
||
!
voltdm
->
write
)
{
pr_err
(
"%s: No read/write API for accessing vdd_%s regs
\n
"
,
__func__
,
voltdm
->
name
);
return
;
}
/* If VP is already disabled, do nothing. Return */
if
(
!
vp
->
enabled
)
{
pr_warning
(
"%s: Trying to disable VP for vdd_%s when"
"it is already disabled
\n
"
,
__func__
,
voltdm
->
name
);
return
;
}
/* Disable VP */
vpconfig
=
voltdm
->
read
(
vp
->
vpconfig
);
vpconfig
&=
~
vp
->
common
->
vpconfig_vpenable
;
voltdm
->
write
(
vpconfig
,
vp
->
vpconfig
);
/*
* Wait for VP idle Typical latency is <2us. Maximum latency is ~100us
*/
omap_test_timeout
((
voltdm
->
read
(
vp
->
vstatus
)),
VP_IDLE_TIMEOUT
,
timeout
);
if
(
timeout
>=
VP_IDLE_TIMEOUT
)
pr_warning
(
"%s: vdd_%s idle timedout
\n
"
,
__func__
,
voltdm
->
name
);
vp
->
enabled
=
false
;
return
;
}
arch/arm/mach-omap2/vp.h
浏览文件 @
23618f7f
...
@@ -19,44 +19,60 @@
...
@@ -19,44 +19,60 @@
#include <linux/kernel.h>
#include <linux/kernel.h>
struct
voltagedomain
;
/*
* Voltage Processor (VP) identifiers
*/
#define OMAP3_VP_VDD_MPU_ID 0
#define OMAP3_VP_VDD_CORE_ID 1
#define OMAP4_VP_VDD_CORE_ID 0
#define OMAP4_VP_VDD_IVA_ID 1
#define OMAP4_VP_VDD_MPU_ID 2
/* XXX document */
/* XXX document */
#define VP_IDLE_TIMEOUT 200
#define VP_IDLE_TIMEOUT 200
#define VP_TRANXDONE_TIMEOUT 300
#define VP_TRANXDONE_TIMEOUT 300
/**
* struct omap_vp_ops - per-VP operations
* @check_txdone: check for VP transaction done
* @clear_txdone: clear VP transaction done status
*/
struct
omap_vp_ops
{
u32
(
*
check_txdone
)(
u8
vp_id
);
void
(
*
clear_txdone
)(
u8
vp_id
);
};
/**
/**
* struct omap_vp_common_data - register data common to all VDDs
* struct omap_vp_common - register data common to all VDDs
* @vpconfig_erroroffset_mask: ERROROFFSET bitmask in the PRM_VP*_CONFIG reg
* @vpconfig_errorgain_mask: ERRORGAIN bitmask in the PRM_VP*_CONFIG reg
* @vpconfig_errorgain_mask: ERRORGAIN bitmask in the PRM_VP*_CONFIG reg
* @vpconfig_initvoltage_mask: INITVOLTAGE bitmask in the PRM_VP*_CONFIG reg
* @vpconfig_initvoltage_mask: INITVOLTAGE bitmask in the PRM_VP*_CONFIG reg
* @vpconfig_timeouten
_mask
: TIMEOUT bitmask in the PRM_VP*_CONFIG reg
* @vpconfig_timeouten: TIMEOUT bitmask in the PRM_VP*_CONFIG reg
* @vpconfig_initvdd: INITVDD bitmask in the PRM_VP*_CONFIG reg
* @vpconfig_initvdd: INITVDD bitmask in the PRM_VP*_CONFIG reg
* @vpconfig_forceupdate: FORCEUPDATE bitmask in the PRM_VP*_CONFIG reg
* @vpconfig_forceupdate: FORCEUPDATE bitmask in the PRM_VP*_CONFIG reg
* @vpconfig_vpenable: VPENABLE bitmask in the PRM_VP*_CONFIG reg
* @vpconfig_vpenable: VPENABLE bitmask in the PRM_VP*_CONFIG reg
* @vpconfig_erroroffset_shift: ERROROFFSET field shift in PRM_VP*_CONFIG reg
* @vpconfig_erroroffset_shift: ERROROFFSET field shift in PRM_VP*_CONFIG reg
* @vpconfig_errorgain_shift: ERRORGAIN field shift in PRM_VP*_CONFIG reg
* @vpconfig_errorgain_shift: ERRORGAIN field shift in PRM_VP*_CONFIG reg
* @vpconfig_initvoltage_shift: INITVOLTAGE field shift in PRM_VP*_CONFIG reg
* @vpconfig_initvoltage_shift: INITVOLTAGE field shift in PRM_VP*_CONFIG reg
* @vpconfig_stepmin_shift: VSTEPMIN field shift in the PRM_VP*_VSTEPMIN reg
* @vstepmin_stepmin_shift: VSTEPMIN field shift in the PRM_VP*_VSTEPMIN reg
* @vpconfig_smpswaittimemin_shift: SMPSWAITTIMEMIN field shift in PRM_VP*_VSTEPMIN reg
* @vstepmin_smpswaittimemin_shift: SMPSWAITTIMEMIN field shift in PRM_VP*_VSTEPMIN reg
* @vpconfig_stepmax_shift: VSTEPMAX field shift in the PRM_VP*_VSTEPMAX reg
* @vstepmax_stepmax_shift: VSTEPMAX field shift in the PRM_VP*_VSTEPMAX reg
* @vpconfig_smpswaittimemax_shift: SMPSWAITTIMEMAX field shift in PRM_VP*_VSTEPMAX reg
* @vstepmax_smpswaittimemax_shift: SMPSWAITTIMEMAX field shift in PRM_VP*_VSTEPMAX reg
* @vpconfig_vlimitto_vddmin_shift: VDDMIN field shift in PRM_VP*_VLIMITTO reg
* @vlimitto_vddmin_shift: VDDMIN field shift in PRM_VP*_VLIMITTO reg
* @vpconfig_vlimitto_vddmax_shift: VDDMAX field shift in PRM_VP*_VLIMITTO reg
* @vlimitto_vddmax_shift: VDDMAX field shift in PRM_VP*_VLIMITTO reg
* @vpconfig_vlimitto_timeout_shift: TIMEOUT field shift in PRM_VP*_VLIMITTO reg
* @vlimitto_timeout_shift: TIMEOUT field shift in PRM_VP*_VLIMITTO reg
*
* @vpvoltage_mask: VPVOLTAGE field mask in PRM_VP*_VOLTAGE reg
* XXX It it not necessary to have both a mask and a shift for the same
* bitfield - remove one
* XXX Many of these fields are wrongly named -- e.g., vpconfig_smps* -- fix!
*/
*/
struct
omap_vp_common_data
{
struct
omap_vp_common
{
u32
vpconfig_erroroffset_mask
;
u32
vpconfig_errorgain_mask
;
u32
vpconfig_errorgain_mask
;
u32
vpconfig_initvoltage_mask
;
u32
vpconfig_initvoltage_mask
;
u32
vpconfig_timeouten
;
u8
vpconfig_timeouten
;
u32
vpconfig_initvdd
;
u8
vpconfig_initvdd
;
u32
vpconfig_forceupdate
;
u8
vpconfig_forceupdate
;
u32
vpconfig_vpenable
;
u8
vpconfig_vpenable
;
u8
vpconfig_erroroffset_shift
;
u8
vpconfig_errorgain_shift
;
u8
vpconfig_initvoltage_shift
;
u8
vstepmin_stepmin_shift
;
u8
vstepmin_stepmin_shift
;
u8
vstepmin_smpswaittimemin_shift
;
u8
vstepmin_smpswaittimemin_shift
;
u8
vstepmax_stepmax_shift
;
u8
vstepmax_stepmax_shift
;
...
@@ -64,80 +80,49 @@ struct omap_vp_common_data {
...
@@ -64,80 +80,49 @@ struct omap_vp_common_data {
u8
vlimitto_vddmin_shift
;
u8
vlimitto_vddmin_shift
;
u8
vlimitto_vddmax_shift
;
u8
vlimitto_vddmax_shift
;
u8
vlimitto_timeout_shift
;
u8
vlimitto_timeout_shift
;
}
;
u8
vpvoltage_mask
;
/**
const
struct
omap_vp_ops
*
ops
;
* struct omap_vp_prm_irqst_data - PRM_IRQSTATUS_MPU.VP_TRANXDONE_ST data
* @prm_irqst_reg: reg offset for PRM_IRQSTATUS_MPU from top of PRM
* @tranxdone_status: VP_TRANXDONE_ST bitmask in PRM_IRQSTATUS_MPU reg
*
* XXX prm_irqst_reg does not belong here
* XXX Note that on OMAP3, VP_TRANXDONE interrupt may not work due to a
* hardware bug
* XXX This structure is probably not needed
*/
struct
omap_vp_prm_irqst_data
{
u8
prm_irqst_reg
;
u32
tranxdone_status
;
};
};
/**
/**
* struct omap_vp_instance_data - VP register offsets (per-VDD)
* struct omap_vp_instance - VP register offsets (per-VDD)
* @vp_common: pointer to struct omap_vp_common_data * for this SoC
* @common: pointer to struct omap_vp_common * for this SoC
* @prm_irqst_data: pointer to struct omap_vp_prm_irqst_data for this VDD
* @vpconfig: PRM_VP*_CONFIG reg offset from PRM start
* @vpconfig: PRM_VP*_CONFIG reg offset from PRM start
* @vstepmin: PRM_VP*_VSTEPMIN reg offset from PRM start
* @vstepmin: PRM_VP*_VSTEPMIN reg offset from PRM start
* @vlimitto: PRM_VP*_VLIMITTO reg offset from PRM start
* @vlimitto: PRM_VP*_VLIMITTO reg offset from PRM start
* @vstatus: PRM_VP*_VSTATUS reg offset from PRM start
* @vstatus: PRM_VP*_VSTATUS reg offset from PRM start
* @voltage: PRM_VP*_VOLTAGE reg offset from PRM start
* @voltage: PRM_VP*_VOLTAGE reg offset from PRM start
* @id: Unique identifier for VP instance.
* @enabled: flag to keep track of whether vp is enabled or not
*
*
* XXX vp_common is probably not needed since it is per-SoC
* XXX vp_common is probably not needed since it is per-SoC
*/
*/
struct
omap_vp_instance_data
{
struct
omap_vp_instance
{
const
struct
omap_vp_common_data
*
vp_common
;
const
struct
omap_vp_common
*
common
;
const
struct
omap_vp_prm_irqst_data
*
prm_irqst_data
;
u8
vpconfig
;
u8
vpconfig
;
u8
vstepmin
;
u8
vstepmin
;
u8
vstepmax
;
u8
vstepmax
;
u8
vlimitto
;
u8
vlimitto
;
u8
vstatus
;
u8
vstatus
;
u8
voltage
;
u8
voltage
;
u8
id
;
bool
enabled
;
};
};
/**
extern
struct
omap_vp_instance
omap3_vp_mpu
;
* struct omap_vp_runtime_data - VP data populated at runtime by code
extern
struct
omap_vp_instance
omap3_vp_core
;
* @vpconfig_erroroffset: value of ERROROFFSET bitfield in PRM_VP*_CONFIG
* @vpconfig_errorgain: value of ERRORGAIN bitfield in PRM_VP*_CONFIG
* @vstepmin_smpswaittimemin: value of SMPSWAITTIMEMIN bitfield in PRM_VP*_VSTEPMIN
* @vstepmax_smpswaittimemax: value of SMPSWAITTIMEMAX bitfield in PRM_VP*_VSTEPMAX
* @vlimitto_timeout: value of TIMEOUT bitfield in PRM_VP*_VLIMITTO
* @vstepmin_stepmin: value of VSTEPMIN bitfield in PRM_VP*_VSTEPMIN
* @vstepmax_stepmax: value of VSTEPMAX bitfield in PRM_VP*_VSTEPMAX
* @vlimitto_vddmin: value of VDDMIN bitfield in PRM_VP*_VLIMITTO
* @vlimitto_vddmax: value of VDDMAX bitfield in PRM_VP*_VLIMITTO
*
* XXX Is this structure really needed? Why not just program the
* device directly? They are in PRM space, therefore in the WKUP
* powerdomain, so register contents should not be lost in off-mode.
* XXX Some of these fields are incorrectly named, e.g., vstep*
*/
struct
omap_vp_runtime_data
{
u32
vpconfig_erroroffset
;
u16
vpconfig_errorgain
;
u16
vstepmin_smpswaittimemin
;
u16
vstepmax_smpswaittimemax
;
u16
vlimitto_timeout
;
u8
vstepmin_stepmin
;
u8
vstepmax_stepmax
;
u8
vlimitto_vddmin
;
u8
vlimitto_vddmax
;
};
extern
struct
omap_vp_instance_data
omap3_vp1_data
;
extern
struct
omap_vp_instance
omap4_vp_mpu
;
extern
struct
omap_vp_instance_data
omap3_vp2_data
;
extern
struct
omap_vp_instance
omap4_vp_iva
;
extern
struct
omap_vp_instance
omap4_vp_core
;
extern
struct
omap_vp_instance_data
omap4_vp_mpu_data
;
void
omap_vp_init
(
struct
voltagedomain
*
voltdm
);
extern
struct
omap_vp_instance_data
omap4_vp_iva_data
;
void
omap_vp_enable
(
struct
voltagedomain
*
voltdm
);
extern
struct
omap_vp_instance_data
omap4_vp_core_data
;
void
omap_vp_disable
(
struct
voltagedomain
*
voltdm
);
int
omap_vp_forceupdate_scale
(
struct
voltagedomain
*
voltdm
,
unsigned
long
target_volt
);
int
omap_vp_update_errorgain
(
struct
voltagedomain
*
voltdm
,
unsigned
long
target_volt
);
#endif
#endif
arch/arm/mach-omap2/vp3xxx_data.c
浏览文件 @
23618f7f
...
@@ -25,16 +25,20 @@
...
@@ -25,16 +25,20 @@
#include "voltage.h"
#include "voltage.h"
#include "vp.h"
#include "vp.h"
#include "prm2xxx_3xxx.h"
static
const
struct
omap_vp_ops
omap3_vp_ops
=
{
.
check_txdone
=
omap3_prm_vp_check_txdone
,
.
clear_txdone
=
omap3_prm_vp_clear_txdone
,
};
/*
/*
* VP data common to 34xx/36xx chips
* VP data common to 34xx/36xx chips
* XXX This stuff presumably belongs in the vp3xxx.c or vp.c file.
* XXX This stuff presumably belongs in the vp3xxx.c or vp.c file.
*/
*/
static
const
struct
omap_vp_common
_data
omap3_vp_common
=
{
static
const
struct
omap_vp_common
omap3_vp_common
=
{
.
vpconfig_erroroffset_
shift
=
OMAP3430_ERROROFFSET_SHIFT
,
.
vpconfig_erroroffset_
mask
=
OMAP3430_ERROROFFSET_MASK
,
.
vpconfig_errorgain_mask
=
OMAP3430_ERRORGAIN_MASK
,
.
vpconfig_errorgain_mask
=
OMAP3430_ERRORGAIN_MASK
,
.
vpconfig_errorgain_shift
=
OMAP3430_ERRORGAIN_SHIFT
,
.
vpconfig_initvoltage_shift
=
OMAP3430_INITVOLTAGE_SHIFT
,
.
vpconfig_initvoltage_mask
=
OMAP3430_INITVOLTAGE_MASK
,
.
vpconfig_initvoltage_mask
=
OMAP3430_INITVOLTAGE_MASK
,
.
vpconfig_timeouten
=
OMAP3430_TIMEOUTEN_MASK
,
.
vpconfig_timeouten
=
OMAP3430_TIMEOUTEN_MASK
,
.
vpconfig_initvdd
=
OMAP3430_INITVDD_MASK
,
.
vpconfig_initvdd
=
OMAP3430_INITVDD_MASK
,
...
@@ -47,36 +51,29 @@ static const struct omap_vp_common_data omap3_vp_common = {
...
@@ -47,36 +51,29 @@ static const struct omap_vp_common_data omap3_vp_common = {
.
vlimitto_vddmin_shift
=
OMAP3430_VDDMIN_SHIFT
,
.
vlimitto_vddmin_shift
=
OMAP3430_VDDMIN_SHIFT
,
.
vlimitto_vddmax_shift
=
OMAP3430_VDDMAX_SHIFT
,
.
vlimitto_vddmax_shift
=
OMAP3430_VDDMAX_SHIFT
,
.
vlimitto_timeout_shift
=
OMAP3430_TIMEOUT_SHIFT
,
.
vlimitto_timeout_shift
=
OMAP3430_TIMEOUT_SHIFT
,
};
.
vpvoltage_mask
=
OMAP3430_VPVOLTAGE_MASK
,
static
const
struct
omap_vp_prm_irqst_data
omap3_vp1_prm_irqst_data
=
{
.
ops
=
&
omap3_vp_ops
,
.
prm_irqst_reg
=
OMAP3_PRM_IRQSTATUS_MPU_OFFSET
,
.
tranxdone_status
=
OMAP3430_VP1_TRANXDONE_ST_MASK
,
};
};
struct
omap_vp_instance_data
omap3_vp1_data
=
{
struct
omap_vp_instance
omap3_vp_mpu
=
{
.
vp_common
=
&
omap3_vp_common
,
.
id
=
OMAP3_VP_VDD_MPU_ID
,
.
common
=
&
omap3_vp_common
,
.
vpconfig
=
OMAP3_PRM_VP1_CONFIG_OFFSET
,
.
vpconfig
=
OMAP3_PRM_VP1_CONFIG_OFFSET
,
.
vstepmin
=
OMAP3_PRM_VP1_VSTEPMIN_OFFSET
,
.
vstepmin
=
OMAP3_PRM_VP1_VSTEPMIN_OFFSET
,
.
vstepmax
=
OMAP3_PRM_VP1_VSTEPMAX_OFFSET
,
.
vstepmax
=
OMAP3_PRM_VP1_VSTEPMAX_OFFSET
,
.
vlimitto
=
OMAP3_PRM_VP1_VLIMITTO_OFFSET
,
.
vlimitto
=
OMAP3_PRM_VP1_VLIMITTO_OFFSET
,
.
vstatus
=
OMAP3_PRM_VP1_STATUS_OFFSET
,
.
vstatus
=
OMAP3_PRM_VP1_STATUS_OFFSET
,
.
voltage
=
OMAP3_PRM_VP1_VOLTAGE_OFFSET
,
.
voltage
=
OMAP3_PRM_VP1_VOLTAGE_OFFSET
,
.
prm_irqst_data
=
&
omap3_vp1_prm_irqst_data
,
};
static
const
struct
omap_vp_prm_irqst_data
omap3_vp2_prm_irqst_data
=
{
.
prm_irqst_reg
=
OMAP3_PRM_IRQSTATUS_MPU_OFFSET
,
.
tranxdone_status
=
OMAP3430_VP2_TRANXDONE_ST_MASK
,
};
};
struct
omap_vp_instance_data
omap3_vp2_data
=
{
struct
omap_vp_instance
omap3_vp_core
=
{
.
vp_common
=
&
omap3_vp_common
,
.
id
=
OMAP3_VP_VDD_CORE_ID
,
.
common
=
&
omap3_vp_common
,
.
vpconfig
=
OMAP3_PRM_VP2_CONFIG_OFFSET
,
.
vpconfig
=
OMAP3_PRM_VP2_CONFIG_OFFSET
,
.
vstepmin
=
OMAP3_PRM_VP2_VSTEPMIN_OFFSET
,
.
vstepmin
=
OMAP3_PRM_VP2_VSTEPMIN_OFFSET
,
.
vstepmax
=
OMAP3_PRM_VP2_VSTEPMAX_OFFSET
,
.
vstepmax
=
OMAP3_PRM_VP2_VSTEPMAX_OFFSET
,
.
vlimitto
=
OMAP3_PRM_VP2_VLIMITTO_OFFSET
,
.
vlimitto
=
OMAP3_PRM_VP2_VLIMITTO_OFFSET
,
.
vstatus
=
OMAP3_PRM_VP2_STATUS_OFFSET
,
.
vstatus
=
OMAP3_PRM_VP2_STATUS_OFFSET
,
.
voltage
=
OMAP3_PRM_VP2_VOLTAGE_OFFSET
,
.
voltage
=
OMAP3_PRM_VP2_VOLTAGE_OFFSET
,
.
prm_irqst_data
=
&
omap3_vp2_prm_irqst_data
,
};
};
arch/arm/mach-omap2/vp44xx_data.c
浏览文件 @
23618f7f
...
@@ -27,15 +27,18 @@
...
@@ -27,15 +27,18 @@
#include "vp.h"
#include "vp.h"
static
const
struct
omap_vp_ops
omap4_vp_ops
=
{
.
check_txdone
=
omap4_prm_vp_check_txdone
,
.
clear_txdone
=
omap4_prm_vp_clear_txdone
,
};
/*
/*
* VP data common to 44xx chips
* VP data common to 44xx chips
* XXX This stuff presumably belongs in the vp44xx.c or vp.c file.
* XXX This stuff presumably belongs in the vp44xx.c or vp.c file.
*/
*/
static
const
struct
omap_vp_common
_data
omap4_vp_common
=
{
static
const
struct
omap_vp_common
omap4_vp_common
=
{
.
vpconfig_erroroffset_
shift
=
OMAP4430_ERROROFFSET_SHIFT
,
.
vpconfig_erroroffset_
mask
=
OMAP4430_ERROROFFSET_MASK
,
.
vpconfig_errorgain_mask
=
OMAP4430_ERRORGAIN_MASK
,
.
vpconfig_errorgain_mask
=
OMAP4430_ERRORGAIN_MASK
,
.
vpconfig_errorgain_shift
=
OMAP4430_ERRORGAIN_SHIFT
,
.
vpconfig_initvoltage_shift
=
OMAP4430_INITVOLTAGE_SHIFT
,
.
vpconfig_initvoltage_mask
=
OMAP4430_INITVOLTAGE_MASK
,
.
vpconfig_initvoltage_mask
=
OMAP4430_INITVOLTAGE_MASK
,
.
vpconfig_timeouten
=
OMAP4430_TIMEOUTEN_MASK
,
.
vpconfig_timeouten
=
OMAP4430_TIMEOUTEN_MASK
,
.
vpconfig_initvdd
=
OMAP4430_INITVDD_MASK
,
.
vpconfig_initvdd
=
OMAP4430_INITVDD_MASK
,
...
@@ -48,53 +51,39 @@ static const struct omap_vp_common_data omap4_vp_common = {
...
@@ -48,53 +51,39 @@ static const struct omap_vp_common_data omap4_vp_common = {
.
vlimitto_vddmin_shift
=
OMAP4430_VDDMIN_SHIFT
,
.
vlimitto_vddmin_shift
=
OMAP4430_VDDMIN_SHIFT
,
.
vlimitto_vddmax_shift
=
OMAP4430_VDDMAX_SHIFT
,
.
vlimitto_vddmax_shift
=
OMAP4430_VDDMAX_SHIFT
,
.
vlimitto_timeout_shift
=
OMAP4430_TIMEOUT_SHIFT
,
.
vlimitto_timeout_shift
=
OMAP4430_TIMEOUT_SHIFT
,
.
vpvoltage_mask
=
OMAP4430_VPVOLTAGE_MASK
,
.
ops
=
&
omap4_vp_ops
,
};
};
static
const
struct
omap_vp_prm_irqst_data
omap4_vp_mpu_prm_irqst_data
=
{
struct
omap_vp_instance
omap4_vp_mpu
=
{
.
prm_irqst_reg
=
OMAP4_PRM_IRQSTATUS_MPU_2_OFFSET
,
.
id
=
OMAP4_VP_VDD_MPU_ID
,
.
tranxdone_status
=
OMAP4430_VP_MPU_TRANXDONE_ST_MASK
,
.
common
=
&
omap4_vp_common
,
};
struct
omap_vp_instance_data
omap4_vp_mpu_data
=
{
.
vp_common
=
&
omap4_vp_common
,
.
vpconfig
=
OMAP4_PRM_VP_MPU_CONFIG_OFFSET
,
.
vpconfig
=
OMAP4_PRM_VP_MPU_CONFIG_OFFSET
,
.
vstepmin
=
OMAP4_PRM_VP_MPU_VSTEPMIN_OFFSET
,
.
vstepmin
=
OMAP4_PRM_VP_MPU_VSTEPMIN_OFFSET
,
.
vstepmax
=
OMAP4_PRM_VP_MPU_VSTEPMAX_OFFSET
,
.
vstepmax
=
OMAP4_PRM_VP_MPU_VSTEPMAX_OFFSET
,
.
vlimitto
=
OMAP4_PRM_VP_MPU_VLIMITTO_OFFSET
,
.
vlimitto
=
OMAP4_PRM_VP_MPU_VLIMITTO_OFFSET
,
.
vstatus
=
OMAP4_PRM_VP_MPU_STATUS_OFFSET
,
.
vstatus
=
OMAP4_PRM_VP_MPU_STATUS_OFFSET
,
.
voltage
=
OMAP4_PRM_VP_MPU_VOLTAGE_OFFSET
,
.
voltage
=
OMAP4_PRM_VP_MPU_VOLTAGE_OFFSET
,
.
prm_irqst_data
=
&
omap4_vp_mpu_prm_irqst_data
,
};
};
static
const
struct
omap_vp_prm_irqst_data
omap4_vp_iva_prm_irqst_data
=
{
struct
omap_vp_instance
omap4_vp_iva
=
{
.
prm_irqst_reg
=
OMAP4_PRM_IRQSTATUS_MPU_OFFSET
,
.
id
=
OMAP4_VP_VDD_IVA_ID
,
.
tranxdone_status
=
OMAP4430_VP_IVA_TRANXDONE_ST_MASK
,
.
common
=
&
omap4_vp_common
,
};
struct
omap_vp_instance_data
omap4_vp_iva_data
=
{
.
vp_common
=
&
omap4_vp_common
,
.
vpconfig
=
OMAP4_PRM_VP_IVA_CONFIG_OFFSET
,
.
vpconfig
=
OMAP4_PRM_VP_IVA_CONFIG_OFFSET
,
.
vstepmin
=
OMAP4_PRM_VP_IVA_VSTEPMIN_OFFSET
,
.
vstepmin
=
OMAP4_PRM_VP_IVA_VSTEPMIN_OFFSET
,
.
vstepmax
=
OMAP4_PRM_VP_IVA_VSTEPMAX_OFFSET
,
.
vstepmax
=
OMAP4_PRM_VP_IVA_VSTEPMAX_OFFSET
,
.
vlimitto
=
OMAP4_PRM_VP_IVA_VLIMITTO_OFFSET
,
.
vlimitto
=
OMAP4_PRM_VP_IVA_VLIMITTO_OFFSET
,
.
vstatus
=
OMAP4_PRM_VP_IVA_STATUS_OFFSET
,
.
vstatus
=
OMAP4_PRM_VP_IVA_STATUS_OFFSET
,
.
voltage
=
OMAP4_PRM_VP_IVA_VOLTAGE_OFFSET
,
.
voltage
=
OMAP4_PRM_VP_IVA_VOLTAGE_OFFSET
,
.
prm_irqst_data
=
&
omap4_vp_iva_prm_irqst_data
,
};
static
const
struct
omap_vp_prm_irqst_data
omap4_vp_core_prm_irqst_data
=
{
.
prm_irqst_reg
=
OMAP4_PRM_IRQSTATUS_MPU_OFFSET
,
.
tranxdone_status
=
OMAP4430_VP_CORE_TRANXDONE_ST_MASK
,
};
};
struct
omap_vp_instance_data
omap4_vp_core_data
=
{
struct
omap_vp_instance
omap4_vp_core
=
{
.
vp_common
=
&
omap4_vp_common
,
.
id
=
OMAP4_VP_VDD_CORE_ID
,
.
common
=
&
omap4_vp_common
,
.
vpconfig
=
OMAP4_PRM_VP_CORE_CONFIG_OFFSET
,
.
vpconfig
=
OMAP4_PRM_VP_CORE_CONFIG_OFFSET
,
.
vstepmin
=
OMAP4_PRM_VP_CORE_VSTEPMIN_OFFSET
,
.
vstepmin
=
OMAP4_PRM_VP_CORE_VSTEPMIN_OFFSET
,
.
vstepmax
=
OMAP4_PRM_VP_CORE_VSTEPMAX_OFFSET
,
.
vstepmax
=
OMAP4_PRM_VP_CORE_VSTEPMAX_OFFSET
,
.
vlimitto
=
OMAP4_PRM_VP_CORE_VLIMITTO_OFFSET
,
.
vlimitto
=
OMAP4_PRM_VP_CORE_VLIMITTO_OFFSET
,
.
vstatus
=
OMAP4_PRM_VP_CORE_STATUS_OFFSET
,
.
vstatus
=
OMAP4_PRM_VP_CORE_STATUS_OFFSET
,
.
voltage
=
OMAP4_PRM_VP_CORE_VOLTAGE_OFFSET
,
.
voltage
=
OMAP4_PRM_VP_CORE_VOLTAGE_OFFSET
,
.
prm_irqst_data
=
&
omap4_vp_core_prm_irqst_data
,
};
};
arch/arm/plat-omap/include/plat/omap_hwmod.h
浏览文件 @
23618f7f
...
@@ -525,7 +525,6 @@ struct omap_hwmod {
...
@@ -525,7 +525,6 @@ struct omap_hwmod {
char
*
clkdm_name
;
char
*
clkdm_name
;
struct
clockdomain
*
clkdm
;
struct
clockdomain
*
clkdm
;
char
*
vdd_name
;
char
*
vdd_name
;
struct
voltagedomain
*
voltdm
;
struct
omap_hwmod_ocp_if
**
masters
;
/* connect to *_IA */
struct
omap_hwmod_ocp_if
**
masters
;
/* connect to *_IA */
struct
omap_hwmod_ocp_if
**
slaves
;
/* connect to *_TA */
struct
omap_hwmod_ocp_if
**
slaves
;
/* connect to *_TA */
void
*
dev_attr
;
void
*
dev_attr
;
...
...
arch/arm/plat-omap/include/plat/voltage.h
0 → 100644
浏览文件 @
23618f7f
/*
* OMAP Voltage Management Routines
*
* Copyright (C) 2011, Texas Instruments, Inc.
*
* 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 __ARCH_ARM_OMAP_VOLTAGE_H
#define __ARCH_ARM_OMAP_VOLTAGE_H
struct
voltagedomain
;
struct
voltagedomain
*
voltdm_lookup
(
const
char
*
name
);
int
voltdm_scale
(
struct
voltagedomain
*
voltdm
,
unsigned
long
target_volt
);
unsigned
long
voltdm_get_voltage
(
struct
voltagedomain
*
voltdm
);
#endif
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录