diff options
author | Paul Walmsley <paul@pwsan.com> | 2011-03-11 00:43:32 -0500 |
---|---|---|
committer | Paul Walmsley <paul@pwsan.com> | 2011-03-11 00:43:32 -0500 |
commit | a08572ae529b1e8de12393eeced661feae8fd44c (patch) | |
tree | e9b48848ab72c953d778832336eb8e1d43abdc8d /arch/arm | |
parent | 2d403fe03070b541cc93cfa915f6e6c592cf231c (diff) | |
parent | c0718df4d666cc5fd8837ac93c82995a17bfdbf5 (diff) |
Merge remote branch 'remotes/origin/voltage_split_2.6.39' into tmp-integration-2.6.39-20110310-024
Conflicts:
arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
Diffstat (limited to 'arch/arm')
22 files changed, 1236 insertions, 788 deletions
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index 534d89a60dd9..82b2a67f42b7 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile | |||
@@ -59,10 +59,10 @@ endif | |||
59 | # Power Management | 59 | # Power Management |
60 | ifeq ($(CONFIG_PM),y) | 60 | ifeq ($(CONFIG_PM),y) |
61 | obj-$(CONFIG_ARCH_OMAP2) += pm24xx.o | 61 | obj-$(CONFIG_ARCH_OMAP2) += pm24xx.o |
62 | obj-$(CONFIG_ARCH_OMAP2) += sleep24xx.o pm_bus.o voltage.o | 62 | obj-$(CONFIG_ARCH_OMAP2) += sleep24xx.o pm_bus.o |
63 | obj-$(CONFIG_ARCH_OMAP3) += pm34xx.o sleep34xx.o voltage.o \ | 63 | obj-$(CONFIG_ARCH_OMAP3) += pm34xx.o sleep34xx.o \ |
64 | cpuidle34xx.o pm_bus.o | 64 | cpuidle34xx.o pm_bus.o |
65 | obj-$(CONFIG_ARCH_OMAP4) += pm44xx.o voltage.o pm_bus.o | 65 | obj-$(CONFIG_ARCH_OMAP4) += pm44xx.o pm_bus.o |
66 | obj-$(CONFIG_PM_DEBUG) += pm-debug.o | 66 | obj-$(CONFIG_PM_DEBUG) += pm-debug.o |
67 | obj-$(CONFIG_OMAP_SMARTREFLEX) += sr_device.o smartreflex.o | 67 | obj-$(CONFIG_OMAP_SMARTREFLEX) += sr_device.o smartreflex.o |
68 | obj-$(CONFIG_OMAP_SMARTREFLEX_CLASS3) += smartreflex-class3.o | 68 | obj-$(CONFIG_OMAP_SMARTREFLEX_CLASS3) += smartreflex-class3.o |
@@ -78,13 +78,25 @@ endif | |||
78 | 78 | ||
79 | # PRCM | 79 | # PRCM |
80 | obj-$(CONFIG_ARCH_OMAP2) += prcm.o cm2xxx_3xxx.o prm2xxx_3xxx.o | 80 | obj-$(CONFIG_ARCH_OMAP2) += prcm.o cm2xxx_3xxx.o prm2xxx_3xxx.o |
81 | obj-$(CONFIG_ARCH_OMAP3) += prcm.o cm2xxx_3xxx.o prm2xxx_3xxx.o | 81 | obj-$(CONFIG_ARCH_OMAP3) += prcm.o cm2xxx_3xxx.o prm2xxx_3xxx.o \ |
82 | vc3xxx_data.o vp3xxx_data.o | ||
82 | # XXX The presence of cm2xxx_3xxx.o on the line below is temporary and | 83 | # XXX The presence of cm2xxx_3xxx.o on the line below is temporary and |
83 | # will be removed once the OMAP4 part of the codebase is converted to | 84 | # will be removed once the OMAP4 part of the codebase is converted to |
84 | # use OMAP4-specific PRCM functions. | 85 | # use OMAP4-specific PRCM functions. |
85 | obj-$(CONFIG_ARCH_OMAP4) += prcm.o cm2xxx_3xxx.o cminst44xx.o \ | 86 | obj-$(CONFIG_ARCH_OMAP4) += prcm.o cm2xxx_3xxx.o cminst44xx.o \ |
86 | cm44xx.o prcm_mpu44xx.o \ | 87 | cm44xx.o prcm_mpu44xx.o \ |
87 | prminst44xx.o | 88 | prminst44xx.o vc44xx_data.o \ |
89 | vp44xx_data.o | ||
90 | |||
91 | # OMAP voltage domains | ||
92 | ifeq ($(CONFIG_PM),y) | ||
93 | voltagedomain-common := voltage.o | ||
94 | obj-$(CONFIG_ARCH_OMAP2) += $(voltagedomain-common) | ||
95 | obj-$(CONFIG_ARCH_OMAP3) += $(voltagedomain-common) \ | ||
96 | voltagedomains3xxx_data.o | ||
97 | obj-$(CONFIG_ARCH_OMAP4) += $(voltagedomain-common) \ | ||
98 | voltagedomains44xx_data.o | ||
99 | endif | ||
88 | 100 | ||
89 | # OMAP powerdomain framework | 101 | # OMAP powerdomain framework |
90 | powerdomain-common += powerdomain.o powerdomain-common.o | 102 | powerdomain-common += powerdomain.o powerdomain-common.o |
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c index 17b4fb8c3479..c819c306693a 100644 --- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include <plat/i2c.h> | 23 | #include <plat/i2c.h> |
24 | #include <plat/gpio.h> | 24 | #include <plat/gpio.h> |
25 | #include <plat/mmc.h> | 25 | #include <plat/mmc.h> |
26 | #include <plat/smartreflex.h> | ||
27 | #include <plat/mcbsp.h> | 26 | #include <plat/mcbsp.h> |
28 | #include <plat/mcspi.h> | 27 | #include <plat/mcspi.h> |
29 | #include <plat/dmtimer.h> | 28 | #include <plat/dmtimer.h> |
diff --git a/arch/arm/mach-omap2/omap_opp_data.h b/arch/arm/mach-omap2/omap_opp_data.h index 46ac27dd6c84..c784c12f98a1 100644 --- a/arch/arm/mach-omap2/omap_opp_data.h +++ b/arch/arm/mach-omap2/omap_opp_data.h | |||
@@ -21,6 +21,8 @@ | |||
21 | 21 | ||
22 | #include <plat/omap_hwmod.h> | 22 | #include <plat/omap_hwmod.h> |
23 | 23 | ||
24 | #include "voltage.h" | ||
25 | |||
24 | /* | 26 | /* |
25 | * *BIG FAT WARNING*: | 27 | * *BIG FAT WARNING*: |
26 | * USE the following ONLY in opp data initialization common to an SoC. | 28 | * USE the following ONLY in opp data initialization common to an SoC. |
@@ -65,8 +67,30 @@ struct omap_opp_def { | |||
65 | .u_volt = _uv, \ | 67 | .u_volt = _uv, \ |
66 | } | 68 | } |
67 | 69 | ||
70 | /* | ||
71 | * Initialization wrapper used to define SmartReflex process data | ||
72 | * XXX Is this needed? Just use C99 initializers in data files? | ||
73 | */ | ||
74 | #define VOLT_DATA_DEFINE(_v_nom, _efuse_offs, _errminlimit, _errgain) \ | ||
75 | { \ | ||
76 | .volt_nominal = _v_nom, \ | ||
77 | .sr_efuse_offs = _efuse_offs, \ | ||
78 | .sr_errminlimit = _errminlimit, \ | ||
79 | .vp_errgain = _errgain \ | ||
80 | } | ||
81 | |||
68 | /* Use this to initialize the default table */ | 82 | /* Use this to initialize the default table */ |
69 | extern int __init omap_init_opp_table(struct omap_opp_def *opp_def, | 83 | extern int __init omap_init_opp_table(struct omap_opp_def *opp_def, |
70 | u32 opp_def_size); | 84 | u32 opp_def_size); |
71 | 85 | ||
86 | |||
87 | extern struct omap_volt_data omap34xx_vddmpu_volt_data[]; | ||
88 | extern struct omap_volt_data omap34xx_vddcore_volt_data[]; | ||
89 | extern struct omap_volt_data omap36xx_vddmpu_volt_data[]; | ||
90 | extern struct omap_volt_data omap36xx_vddcore_volt_data[]; | ||
91 | |||
92 | extern struct omap_volt_data omap44xx_vdd_mpu_volt_data[]; | ||
93 | extern struct omap_volt_data omap44xx_vdd_iva_volt_data[]; | ||
94 | extern struct omap_volt_data omap44xx_vdd_core_volt_data[]; | ||
95 | |||
72 | #endif /* __ARCH_ARM_MACH_OMAP2_OMAP_OPP_DATA_H */ | 96 | #endif /* __ARCH_ARM_MACH_OMAP2_OMAP_OPP_DATA_H */ |
diff --git a/arch/arm/mach-omap2/omap_twl.c b/arch/arm/mach-omap2/omap_twl.c index 00e1d2b53683..ad8c18a45ce1 100644 --- a/arch/arm/mach-omap2/omap_twl.c +++ b/arch/arm/mach-omap2/omap_twl.c | |||
@@ -18,7 +18,7 @@ | |||
18 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
19 | #include <linux/i2c/twl.h> | 19 | #include <linux/i2c/twl.h> |
20 | 20 | ||
21 | #include <plat/voltage.h> | 21 | #include "voltage.h" |
22 | 22 | ||
23 | #include "pm.h" | 23 | #include "pm.h" |
24 | 24 | ||
diff --git a/arch/arm/mach-omap2/opp3xxx_data.c b/arch/arm/mach-omap2/opp3xxx_data.c index 0486fce8a92c..3bba9204a174 100644 --- a/arch/arm/mach-omap2/opp3xxx_data.c +++ b/arch/arm/mach-omap2/opp3xxx_data.c | |||
@@ -4,8 +4,9 @@ | |||
4 | * Copyright (C) 2009-2010 Texas Instruments Incorporated - http://www.ti.com/ | 4 | * Copyright (C) 2009-2010 Texas Instruments Incorporated - http://www.ti.com/ |
5 | * Nishanth Menon | 5 | * Nishanth Menon |
6 | * Kevin Hilman | 6 | * Kevin Hilman |
7 | * Copyright (C) 2010 Nokia Corporation. | 7 | * Copyright (C) 2010-2011 Nokia Corporation. |
8 | * Eduardo Valentin | 8 | * Eduardo Valentin |
9 | * Paul Walmsley | ||
9 | * | 10 | * |
10 | * This program is free software; you can redistribute it and/or modify | 11 | * This program is free software; you can redistribute it and/or modify |
11 | * it under the terms of the GNU General Public License version 2 as | 12 | * it under the terms of the GNU General Public License version 2 as |
@@ -20,8 +21,71 @@ | |||
20 | 21 | ||
21 | #include <plat/cpu.h> | 22 | #include <plat/cpu.h> |
22 | 23 | ||
24 | #include "control.h" | ||
23 | #include "omap_opp_data.h" | 25 | #include "omap_opp_data.h" |
24 | 26 | ||
27 | /* 34xx */ | ||
28 | |||
29 | /* VDD1 */ | ||
30 | |||
31 | #define OMAP3430_VDD_MPU_OPP1_UV 975000 | ||
32 | #define OMAP3430_VDD_MPU_OPP2_UV 1075000 | ||
33 | #define OMAP3430_VDD_MPU_OPP3_UV 1200000 | ||
34 | #define OMAP3430_VDD_MPU_OPP4_UV 1270000 | ||
35 | #define OMAP3430_VDD_MPU_OPP5_UV 1350000 | ||
36 | |||
37 | struct omap_volt_data omap34xx_vddmpu_volt_data[] = { | ||
38 | VOLT_DATA_DEFINE(OMAP3430_VDD_MPU_OPP1_UV, OMAP343X_CONTROL_FUSE_OPP1_VDD1, 0xf4, 0x0c), | ||
39 | VOLT_DATA_DEFINE(OMAP3430_VDD_MPU_OPP2_UV, OMAP343X_CONTROL_FUSE_OPP2_VDD1, 0xf4, 0x0c), | ||
40 | VOLT_DATA_DEFINE(OMAP3430_VDD_MPU_OPP3_UV, OMAP343X_CONTROL_FUSE_OPP3_VDD1, 0xf9, 0x18), | ||
41 | VOLT_DATA_DEFINE(OMAP3430_VDD_MPU_OPP4_UV, OMAP343X_CONTROL_FUSE_OPP4_VDD1, 0xf9, 0x18), | ||
42 | VOLT_DATA_DEFINE(OMAP3430_VDD_MPU_OPP5_UV, OMAP343X_CONTROL_FUSE_OPP5_VDD1, 0xf9, 0x18), | ||
43 | VOLT_DATA_DEFINE(0, 0, 0, 0), | ||
44 | }; | ||
45 | |||
46 | /* VDD2 */ | ||
47 | |||
48 | #define OMAP3430_VDD_CORE_OPP1_UV 975000 | ||
49 | #define OMAP3430_VDD_CORE_OPP2_UV 1050000 | ||
50 | #define OMAP3430_VDD_CORE_OPP3_UV 1150000 | ||
51 | |||
52 | struct omap_volt_data omap34xx_vddcore_volt_data[] = { | ||
53 | VOLT_DATA_DEFINE(OMAP3430_VDD_CORE_OPP1_UV, OMAP343X_CONTROL_FUSE_OPP1_VDD2, 0xf4, 0x0c), | ||
54 | VOLT_DATA_DEFINE(OMAP3430_VDD_CORE_OPP2_UV, OMAP343X_CONTROL_FUSE_OPP2_VDD2, 0xf4, 0x0c), | ||
55 | VOLT_DATA_DEFINE(OMAP3430_VDD_CORE_OPP3_UV, OMAP343X_CONTROL_FUSE_OPP3_VDD2, 0xf9, 0x18), | ||
56 | VOLT_DATA_DEFINE(0, 0, 0, 0), | ||
57 | }; | ||
58 | |||
59 | /* 36xx */ | ||
60 | |||
61 | /* VDD1 */ | ||
62 | |||
63 | #define OMAP3630_VDD_MPU_OPP50_UV 1012500 | ||
64 | #define OMAP3630_VDD_MPU_OPP100_UV 1200000 | ||
65 | #define OMAP3630_VDD_MPU_OPP120_UV 1325000 | ||
66 | #define OMAP3630_VDD_MPU_OPP1G_UV 1375000 | ||
67 | |||
68 | struct omap_volt_data omap36xx_vddmpu_volt_data[] = { | ||
69 | VOLT_DATA_DEFINE(OMAP3630_VDD_MPU_OPP50_UV, OMAP3630_CONTROL_FUSE_OPP50_VDD1, 0xf4, 0x0c), | ||
70 | VOLT_DATA_DEFINE(OMAP3630_VDD_MPU_OPP100_UV, OMAP3630_CONTROL_FUSE_OPP100_VDD1, 0xf9, 0x16), | ||
71 | VOLT_DATA_DEFINE(OMAP3630_VDD_MPU_OPP120_UV, OMAP3630_CONTROL_FUSE_OPP120_VDD1, 0xfa, 0x23), | ||
72 | VOLT_DATA_DEFINE(OMAP3630_VDD_MPU_OPP1G_UV, OMAP3630_CONTROL_FUSE_OPP1G_VDD1, 0xfa, 0x27), | ||
73 | VOLT_DATA_DEFINE(0, 0, 0, 0), | ||
74 | }; | ||
75 | |||
76 | /* VDD2 */ | ||
77 | |||
78 | #define OMAP3630_VDD_CORE_OPP50_UV 1000000 | ||
79 | #define OMAP3630_VDD_CORE_OPP100_UV 1200000 | ||
80 | |||
81 | struct omap_volt_data omap36xx_vddcore_volt_data[] = { | ||
82 | VOLT_DATA_DEFINE(OMAP3630_VDD_CORE_OPP50_UV, OMAP3630_CONTROL_FUSE_OPP50_VDD2, 0xf4, 0x0c), | ||
83 | VOLT_DATA_DEFINE(OMAP3630_VDD_CORE_OPP100_UV, OMAP3630_CONTROL_FUSE_OPP100_VDD2, 0xf9, 0x16), | ||
84 | VOLT_DATA_DEFINE(0, 0, 0, 0), | ||
85 | }; | ||
86 | |||
87 | /* OPP data */ | ||
88 | |||
25 | static struct omap_opp_def __initdata omap34xx_opp_def_list[] = { | 89 | static struct omap_opp_def __initdata omap34xx_opp_def_list[] = { |
26 | /* MPU OPP1 */ | 90 | /* MPU OPP1 */ |
27 | OPP_INITIALIZER("mpu", true, 125000000, 975000), | 91 | OPP_INITIALIZER("mpu", true, 125000000, 975000), |
diff --git a/arch/arm/mach-omap2/opp4xxx_data.c b/arch/arm/mach-omap2/opp4xxx_data.c index a11fa566d8ee..fdee8d4186ab 100644 --- a/arch/arm/mach-omap2/opp4xxx_data.c +++ b/arch/arm/mach-omap2/opp4xxx_data.c | |||
@@ -5,8 +5,9 @@ | |||
5 | * Nishanth Menon | 5 | * Nishanth Menon |
6 | * Kevin Hilman | 6 | * Kevin Hilman |
7 | * Thara Gopinath | 7 | * Thara Gopinath |
8 | * Copyright (C) 2010 Nokia Corporation. | 8 | * Copyright (C) 2010-2011 Nokia Corporation. |
9 | * Eduardo Valentin | 9 | * Eduardo Valentin |
10 | * Paul Walmsley | ||
10 | * | 11 | * |
11 | * This program is free software; you can redistribute it and/or modify | 12 | * This program is free software; you can redistribute it and/or modify |
12 | * it under the terms of the GNU General Public License version 2 as | 13 | * it under the terms of the GNU General Public License version 2 as |
@@ -21,8 +22,48 @@ | |||
21 | 22 | ||
22 | #include <plat/cpu.h> | 23 | #include <plat/cpu.h> |
23 | 24 | ||
25 | #include "control.h" | ||
24 | #include "omap_opp_data.h" | 26 | #include "omap_opp_data.h" |
25 | 27 | ||
28 | /* | ||
29 | * Structures containing OMAP4430 voltage supported and various | ||
30 | * voltage dependent data for each VDD. | ||
31 | */ | ||
32 | |||
33 | #define OMAP4430_VDD_MPU_OPP50_UV 930000 | ||
34 | #define OMAP4430_VDD_MPU_OPP100_UV 1100000 | ||
35 | #define OMAP4430_VDD_MPU_OPPTURBO_UV 1260000 | ||
36 | #define OMAP4430_VDD_MPU_OPPNITRO_UV 1350000 | ||
37 | |||
38 | struct omap_volt_data omap44xx_vdd_mpu_volt_data[] = { | ||
39 | VOLT_DATA_DEFINE(OMAP4430_VDD_MPU_OPP50_UV, OMAP44XX_CONTROL_FUSE_MPU_OPP50, 0xf4, 0x0c), | ||
40 | VOLT_DATA_DEFINE(OMAP4430_VDD_MPU_OPP100_UV, OMAP44XX_CONTROL_FUSE_MPU_OPP100, 0xf9, 0x16), | ||
41 | VOLT_DATA_DEFINE(OMAP4430_VDD_MPU_OPPTURBO_UV, OMAP44XX_CONTROL_FUSE_MPU_OPPTURBO, 0xfa, 0x23), | ||
42 | VOLT_DATA_DEFINE(OMAP4430_VDD_MPU_OPPNITRO_UV, OMAP44XX_CONTROL_FUSE_MPU_OPPNITRO, 0xfa, 0x27), | ||
43 | VOLT_DATA_DEFINE(0, 0, 0, 0), | ||
44 | }; | ||
45 | |||
46 | #define OMAP4430_VDD_IVA_OPP50_UV 930000 | ||
47 | #define OMAP4430_VDD_IVA_OPP100_UV 1100000 | ||
48 | #define OMAP4430_VDD_IVA_OPPTURBO_UV 1260000 | ||
49 | |||
50 | struct omap_volt_data omap44xx_vdd_iva_volt_data[] = { | ||
51 | VOLT_DATA_DEFINE(OMAP4430_VDD_IVA_OPP50_UV, OMAP44XX_CONTROL_FUSE_IVA_OPP50, 0xf4, 0x0c), | ||
52 | VOLT_DATA_DEFINE(OMAP4430_VDD_IVA_OPP100_UV, OMAP44XX_CONTROL_FUSE_IVA_OPP100, 0xf9, 0x16), | ||
53 | VOLT_DATA_DEFINE(OMAP4430_VDD_IVA_OPPTURBO_UV, OMAP44XX_CONTROL_FUSE_IVA_OPPTURBO, 0xfa, 0x23), | ||
54 | VOLT_DATA_DEFINE(0, 0, 0, 0), | ||
55 | }; | ||
56 | |||
57 | #define OMAP4430_VDD_CORE_OPP50_UV 930000 | ||
58 | #define OMAP4430_VDD_CORE_OPP100_UV 1100000 | ||
59 | |||
60 | struct omap_volt_data omap44xx_vdd_core_volt_data[] = { | ||
61 | VOLT_DATA_DEFINE(OMAP4430_VDD_CORE_OPP50_UV, OMAP44XX_CONTROL_FUSE_CORE_OPP50, 0xf4, 0x0c), | ||
62 | VOLT_DATA_DEFINE(OMAP4430_VDD_CORE_OPP100_UV, OMAP44XX_CONTROL_FUSE_CORE_OPP100, 0xf9, 0x16), | ||
63 | VOLT_DATA_DEFINE(0, 0, 0, 0), | ||
64 | }; | ||
65 | |||
66 | |||
26 | static struct omap_opp_def __initdata omap44xx_opp_def_list[] = { | 67 | static struct omap_opp_def __initdata omap44xx_opp_def_list[] = { |
27 | /* MPU OPP1 - OPP50 */ | 68 | /* MPU OPP1 - OPP50 */ |
28 | OPP_INITIALIZER("mpu", true, 300000000, 1100000), | 69 | OPP_INITIALIZER("mpu", true, 300000000, 1100000), |
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c index 7bb64d8121a7..2c3a2531e678 100644 --- a/arch/arm/mach-omap2/pm.c +++ b/arch/arm/mach-omap2/pm.c | |||
@@ -18,8 +18,8 @@ | |||
18 | #include <plat/omap-pm.h> | 18 | #include <plat/omap-pm.h> |
19 | #include <plat/omap_device.h> | 19 | #include <plat/omap_device.h> |
20 | #include <plat/common.h> | 20 | #include <plat/common.h> |
21 | #include <plat/voltage.h> | ||
22 | 21 | ||
22 | #include "voltage.h" | ||
23 | #include "powerdomain.h" | 23 | #include "powerdomain.h" |
24 | #include "clockdomain.h" | 24 | #include "clockdomain.h" |
25 | #include "pm.h" | 25 | #include "pm.h" |
diff --git a/arch/arm/mach-omap2/smartreflex-class3.c b/arch/arm/mach-omap2/smartreflex-class3.c index 60e70552b4c5..f438cf4d847b 100644 --- a/arch/arm/mach-omap2/smartreflex-class3.c +++ b/arch/arm/mach-omap2/smartreflex-class3.c | |||
@@ -11,7 +11,7 @@ | |||
11 | * published by the Free Software Foundation. | 11 | * published by the Free Software Foundation. |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <plat/smartreflex.h> | 14 | #include "smartreflex.h" |
15 | 15 | ||
16 | static int sr_class3_enable(struct voltagedomain *voltdm) | 16 | static int sr_class3_enable(struct voltagedomain *voltdm) |
17 | { | 17 | { |
diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c index 95ac336fe3f7..cf0bf5db47dd 100644 --- a/arch/arm/mach-omap2/smartreflex.c +++ b/arch/arm/mach-omap2/smartreflex.c | |||
@@ -26,9 +26,9 @@ | |||
26 | #include <linux/pm_runtime.h> | 26 | #include <linux/pm_runtime.h> |
27 | 27 | ||
28 | #include <plat/common.h> | 28 | #include <plat/common.h> |
29 | #include <plat/smartreflex.h> | ||
30 | 29 | ||
31 | #include "pm.h" | 30 | #include "pm.h" |
31 | #include "smartreflex.h" | ||
32 | 32 | ||
33 | #define SMARTREFLEX_NAME_LEN 16 | 33 | #define SMARTREFLEX_NAME_LEN 16 |
34 | #define NVALUE_NAME_LEN 40 | 34 | #define NVALUE_NAME_LEN 40 |
diff --git a/arch/arm/plat-omap/include/plat/smartreflex.h b/arch/arm/mach-omap2/smartreflex.h index 6568c885f37a..5f35b9e25556 100644 --- a/arch/arm/plat-omap/include/plat/smartreflex.h +++ b/arch/arm/mach-omap2/smartreflex.h | |||
@@ -21,7 +21,8 @@ | |||
21 | #define __ASM_ARM_OMAP_SMARTREFLEX_H | 21 | #define __ASM_ARM_OMAP_SMARTREFLEX_H |
22 | 22 | ||
23 | #include <linux/platform_device.h> | 23 | #include <linux/platform_device.h> |
24 | #include <plat/voltage.h> | 24 | |
25 | #include "voltage.h" | ||
25 | 26 | ||
26 | /* | 27 | /* |
27 | * Different Smartreflex IPs version. The v1 is the 65nm version used in | 28 | * Different Smartreflex IPs version. The v1 is the 65nm version used in |
diff --git a/arch/arm/mach-omap2/sr_device.c b/arch/arm/mach-omap2/sr_device.c index b1e0af18a26a..10d3c5ee8018 100644 --- a/arch/arm/mach-omap2/sr_device.c +++ b/arch/arm/mach-omap2/sr_device.c | |||
@@ -23,9 +23,9 @@ | |||
23 | #include <linux/io.h> | 23 | #include <linux/io.h> |
24 | 24 | ||
25 | #include <plat/omap_device.h> | 25 | #include <plat/omap_device.h> |
26 | #include <plat/smartreflex.h> | ||
27 | #include <plat/voltage.h> | ||
28 | 26 | ||
27 | #include "smartreflex.h" | ||
28 | #include "voltage.h" | ||
29 | #include "control.h" | 29 | #include "control.h" |
30 | #include "pm.h" | 30 | #include "pm.h" |
31 | 31 | ||
diff --git a/arch/arm/mach-omap2/vc.h b/arch/arm/mach-omap2/vc.h new file mode 100644 index 000000000000..e7767771de49 --- /dev/null +++ b/arch/arm/mach-omap2/vc.h | |||
@@ -0,0 +1,83 @@ | |||
1 | /* | ||
2 | * OMAP3/4 Voltage Controller (VC) structure and macro definitions | ||
3 | * | ||
4 | * Copyright (C) 2007, 2010 Texas Instruments, Inc. | ||
5 | * Rajendra Nayak <rnayak@ti.com> | ||
6 | * Lesly A M <x0080970@ti.com> | ||
7 | * Thara Gopinath <thara@ti.com> | ||
8 | * | ||
9 | * Copyright (C) 2008, 2011 Nokia Corporation | ||
10 | * Kalle Jokiniemi | ||
11 | * Paul Walmsley | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or | ||
14 | * modify it under the terms of the GNU General Public License version | ||
15 | * 2 as published by the Free Software Foundation. | ||
16 | */ | ||
17 | #ifndef __ARCH_ARM_MACH_OMAP2_VC_H | ||
18 | #define __ARCH_ARM_MACH_OMAP2_VC_H | ||
19 | |||
20 | #include <linux/kernel.h> | ||
21 | |||
22 | /** | ||
23 | * struct omap_vc_common_data - per-VC register/bitfield data | ||
24 | * @cmd_on_mask: ON bitmask in PRM_VC_CMD_VAL* register | ||
25 | * @valid: VALID bitmask in PRM_VC_BYPASS_VAL register | ||
26 | * @smps_sa_reg: Offset of PRM_VC_SMPS_SA reg from PRM start | ||
27 | * @smps_volra_reg: Offset of PRM_VC_SMPS_VOL_RA reg from PRM start | ||
28 | * @bypass_val_reg: Offset of PRM_VC_BYPASS_VAL reg from PRM start | ||
29 | * @data_shift: DATA field shift in PRM_VC_BYPASS_VAL register | ||
30 | * @slaveaddr_shift: SLAVEADDR field shift in PRM_VC_BYPASS_VAL register | ||
31 | * @regaddr_shift: REGADDR field shift in PRM_VC_BYPASS_VAL register | ||
32 | * @cmd_on_shift: ON field shift in PRM_VC_CMD_VAL_* register | ||
33 | * @cmd_onlp_shift: ONLP field shift in PRM_VC_CMD_VAL_* register | ||
34 | * @cmd_ret_shift: RET field shift in PRM_VC_CMD_VAL_* register | ||
35 | * @cmd_off_shift: OFF field shift in PRM_VC_CMD_VAL_* register | ||
36 | * | ||
37 | * XXX One of cmd_on_mask and cmd_on_shift are not needed | ||
38 | * XXX VALID should probably be a shift, not a mask | ||
39 | */ | ||
40 | struct omap_vc_common_data { | ||
41 | u32 cmd_on_mask; | ||
42 | u32 valid; | ||
43 | u8 smps_sa_reg; | ||
44 | u8 smps_volra_reg; | ||
45 | u8 bypass_val_reg; | ||
46 | u8 data_shift; | ||
47 | u8 slaveaddr_shift; | ||
48 | u8 regaddr_shift; | ||
49 | u8 cmd_on_shift; | ||
50 | u8 cmd_onlp_shift; | ||
51 | u8 cmd_ret_shift; | ||
52 | u8 cmd_off_shift; | ||
53 | }; | ||
54 | |||
55 | /** | ||
56 | * struct omap_vc_instance_data - VC per-instance data | ||
57 | * @vc_common: pointer to VC common data for this platform | ||
58 | * @smps_sa_mask: SA* bitmask in the PRM_VC_SMPS_SA register | ||
59 | * @smps_volra_mask: VOLRA* bitmask in the PRM_VC_VOL_RA register | ||
60 | * @smps_sa_shift: SA* field shift in the PRM_VC_SMPS_SA register | ||
61 | * @smps_volra_shift: VOLRA* field shift in the PRM_VC_VOL_RA register | ||
62 | * | ||
63 | * XXX It is not necessary to have both a *_mask and a *_shift - | ||
64 | * remove one | ||
65 | */ | ||
66 | struct omap_vc_instance_data { | ||
67 | const struct omap_vc_common_data *vc_common; | ||
68 | u32 smps_sa_mask; | ||
69 | u32 smps_volra_mask; | ||
70 | u8 cmdval_reg; | ||
71 | u8 smps_sa_shift; | ||
72 | u8 smps_volra_shift; | ||
73 | }; | ||
74 | |||
75 | extern struct omap_vc_instance_data omap3_vc1_data; | ||
76 | extern struct omap_vc_instance_data omap3_vc2_data; | ||
77 | |||
78 | extern struct omap_vc_instance_data omap4_vc_mpu_data; | ||
79 | extern struct omap_vc_instance_data omap4_vc_iva_data; | ||
80 | extern struct omap_vc_instance_data omap4_vc_core_data; | ||
81 | |||
82 | #endif | ||
83 | |||
diff --git a/arch/arm/mach-omap2/vc3xxx_data.c b/arch/arm/mach-omap2/vc3xxx_data.c new file mode 100644 index 000000000000..f37dc4bc379a --- /dev/null +++ b/arch/arm/mach-omap2/vc3xxx_data.c | |||
@@ -0,0 +1,63 @@ | |||
1 | /* | ||
2 | * OMAP3 Voltage Controller (VC) data | ||
3 | * | ||
4 | * Copyright (C) 2007, 2010 Texas Instruments, Inc. | ||
5 | * Rajendra Nayak <rnayak@ti.com> | ||
6 | * Lesly A M <x0080970@ti.com> | ||
7 | * Thara Gopinath <thara@ti.com> | ||
8 | * | ||
9 | * Copyright (C) 2008, 2011 Nokia Corporation | ||
10 | * Kalle Jokiniemi | ||
11 | * Paul Walmsley | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify | ||
14 | * it under the terms of the GNU General Public License version 2 as | ||
15 | * published by the Free Software Foundation. | ||
16 | */ | ||
17 | #include <linux/io.h> | ||
18 | #include <linux/err.h> | ||
19 | #include <linux/init.h> | ||
20 | |||
21 | #include <plat/common.h> | ||
22 | |||
23 | #include "prm-regbits-34xx.h" | ||
24 | #include "voltage.h" | ||
25 | |||
26 | #include "vc.h" | ||
27 | |||
28 | /* | ||
29 | * VC data common to 34xx/36xx chips | ||
30 | * XXX This stuff presumably belongs in the vc3xxx.c or vc.c file. | ||
31 | */ | ||
32 | static struct omap_vc_common_data omap3_vc_common = { | ||
33 | .smps_sa_reg = OMAP3_PRM_VC_SMPS_SA_OFFSET, | ||
34 | .smps_volra_reg = OMAP3_PRM_VC_SMPS_VOL_RA_OFFSET, | ||
35 | .bypass_val_reg = OMAP3_PRM_VC_BYPASS_VAL_OFFSET, | ||
36 | .data_shift = OMAP3430_DATA_SHIFT, | ||
37 | .slaveaddr_shift = OMAP3430_SLAVEADDR_SHIFT, | ||
38 | .regaddr_shift = OMAP3430_REGADDR_SHIFT, | ||
39 | .valid = OMAP3430_VALID_MASK, | ||
40 | .cmd_on_shift = OMAP3430_VC_CMD_ON_SHIFT, | ||
41 | .cmd_on_mask = OMAP3430_VC_CMD_ON_MASK, | ||
42 | .cmd_onlp_shift = OMAP3430_VC_CMD_ONLP_SHIFT, | ||
43 | .cmd_ret_shift = OMAP3430_VC_CMD_RET_SHIFT, | ||
44 | .cmd_off_shift = OMAP3430_VC_CMD_OFF_SHIFT, | ||
45 | }; | ||
46 | |||
47 | struct omap_vc_instance_data omap3_vc1_data = { | ||
48 | .vc_common = &omap3_vc_common, | ||
49 | .cmdval_reg = OMAP3_PRM_VC_CMD_VAL_0_OFFSET, | ||
50 | .smps_sa_shift = OMAP3430_PRM_VC_SMPS_SA_SA0_SHIFT, | ||
51 | .smps_sa_mask = OMAP3430_PRM_VC_SMPS_SA_SA0_MASK, | ||
52 | .smps_volra_shift = OMAP3430_VOLRA0_SHIFT, | ||
53 | .smps_volra_mask = OMAP3430_VOLRA0_MASK, | ||
54 | }; | ||
55 | |||
56 | struct omap_vc_instance_data omap3_vc2_data = { | ||
57 | .vc_common = &omap3_vc_common, | ||
58 | .cmdval_reg = OMAP3_PRM_VC_CMD_VAL_1_OFFSET, | ||
59 | .smps_sa_shift = OMAP3430_PRM_VC_SMPS_SA_SA1_SHIFT, | ||
60 | .smps_sa_mask = OMAP3430_PRM_VC_SMPS_SA_SA1_MASK, | ||
61 | .smps_volra_shift = OMAP3430_VOLRA1_SHIFT, | ||
62 | .smps_volra_mask = OMAP3430_VOLRA1_MASK, | ||
63 | }; | ||
diff --git a/arch/arm/mach-omap2/vc44xx_data.c b/arch/arm/mach-omap2/vc44xx_data.c new file mode 100644 index 000000000000..a98da8ddec52 --- /dev/null +++ b/arch/arm/mach-omap2/vc44xx_data.c | |||
@@ -0,0 +1,75 @@ | |||
1 | /* | ||
2 | * OMAP4 Voltage Controller (VC) data | ||
3 | * | ||
4 | * Copyright (C) 2007, 2010 Texas Instruments, Inc. | ||
5 | * Rajendra Nayak <rnayak@ti.com> | ||
6 | * Lesly A M <x0080970@ti.com> | ||
7 | * Thara Gopinath <thara@ti.com> | ||
8 | * | ||
9 | * Copyright (C) 2008, 2011 Nokia Corporation | ||
10 | * Kalle Jokiniemi | ||
11 | * Paul Walmsley | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify | ||
14 | * it under the terms of the GNU General Public License version 2 as | ||
15 | * published by the Free Software Foundation. | ||
16 | */ | ||
17 | #include <linux/io.h> | ||
18 | #include <linux/err.h> | ||
19 | #include <linux/init.h> | ||
20 | |||
21 | #include <plat/common.h> | ||
22 | |||
23 | #include "prm44xx.h" | ||
24 | #include "prm-regbits-44xx.h" | ||
25 | #include "voltage.h" | ||
26 | |||
27 | #include "vc.h" | ||
28 | |||
29 | /* | ||
30 | * VC data common to 44xx chips | ||
31 | * XXX This stuff presumably belongs in the vc3xxx.c or vc.c file. | ||
32 | */ | ||
33 | static const struct omap_vc_common_data omap4_vc_common = { | ||
34 | .smps_sa_reg = OMAP4_PRM_VC_SMPS_SA_OFFSET, | ||
35 | .smps_volra_reg = OMAP4_PRM_VC_VAL_SMPS_RA_VOL_OFFSET, | ||
36 | .bypass_val_reg = OMAP4_PRM_VC_VAL_BYPASS_OFFSET, | ||
37 | .data_shift = OMAP4430_DATA_SHIFT, | ||
38 | .slaveaddr_shift = OMAP4430_SLAVEADDR_SHIFT, | ||
39 | .regaddr_shift = OMAP4430_REGADDR_SHIFT, | ||
40 | .valid = OMAP4430_VALID_MASK, | ||
41 | .cmd_on_shift = OMAP4430_ON_SHIFT, | ||
42 | .cmd_on_mask = OMAP4430_ON_MASK, | ||
43 | .cmd_onlp_shift = OMAP4430_ONLP_SHIFT, | ||
44 | .cmd_ret_shift = OMAP4430_RET_SHIFT, | ||
45 | .cmd_off_shift = OMAP4430_OFF_SHIFT, | ||
46 | }; | ||
47 | |||
48 | /* VC instance data for each controllable voltage line */ | ||
49 | struct omap_vc_instance_data omap4_vc_mpu_data = { | ||
50 | .vc_common = &omap4_vc_common, | ||
51 | .cmdval_reg = OMAP4_PRM_VC_VAL_CMD_VDD_MPU_L_OFFSET, | ||
52 | .smps_sa_shift = OMAP4430_SA_VDD_MPU_L_PRM_VC_SMPS_SA_SHIFT, | ||
53 | .smps_sa_mask = OMAP4430_SA_VDD_MPU_L_PRM_VC_SMPS_SA_MASK, | ||
54 | .smps_volra_shift = OMAP4430_VOLRA_VDD_MPU_L_SHIFT, | ||
55 | .smps_volra_mask = OMAP4430_VOLRA_VDD_MPU_L_MASK, | ||
56 | }; | ||
57 | |||
58 | struct omap_vc_instance_data omap4_vc_iva_data = { | ||
59 | .vc_common = &omap4_vc_common, | ||
60 | .cmdval_reg = OMAP4_PRM_VC_VAL_CMD_VDD_IVA_L_OFFSET, | ||
61 | .smps_sa_shift = OMAP4430_SA_VDD_IVA_L_PRM_VC_SMPS_SA_SHIFT, | ||
62 | .smps_sa_mask = OMAP4430_SA_VDD_IVA_L_PRM_VC_SMPS_SA_MASK, | ||
63 | .smps_volra_shift = OMAP4430_VOLRA_VDD_IVA_L_SHIFT, | ||
64 | .smps_volra_mask = OMAP4430_VOLRA_VDD_IVA_L_MASK, | ||
65 | }; | ||
66 | |||
67 | struct omap_vc_instance_data omap4_vc_core_data = { | ||
68 | .vc_common = &omap4_vc_common, | ||
69 | .cmdval_reg = OMAP4_PRM_VC_VAL_CMD_VDD_CORE_L_OFFSET, | ||
70 | .smps_sa_shift = OMAP4430_SA_VDD_CORE_L_0_6_SHIFT, | ||
71 | .smps_sa_mask = OMAP4430_SA_VDD_CORE_L_0_6_MASK, | ||
72 | .smps_volra_shift = OMAP4430_VOLRA_VDD_CORE_L_SHIFT, | ||
73 | .smps_volra_mask = OMAP4430_VOLRA_VDD_CORE_L_MASK, | ||
74 | }; | ||
75 | |||
diff --git a/arch/arm/mach-omap2/voltage.c b/arch/arm/mach-omap2/voltage.c index 12be525b8df4..c6facf7becf8 100644 --- a/arch/arm/mach-omap2/voltage.c +++ b/arch/arm/mach-omap2/voltage.c | |||
@@ -7,8 +7,9 @@ | |||
7 | * Rajendra Nayak <rnayak@ti.com> | 7 | * Rajendra Nayak <rnayak@ti.com> |
8 | * Lesly A M <x0080970@ti.com> | 8 | * Lesly A M <x0080970@ti.com> |
9 | * | 9 | * |
10 | * Copyright (C) 2008 Nokia Corporation | 10 | * Copyright (C) 2008, 2011 Nokia Corporation |
11 | * Kalle Jokiniemi | 11 | * Kalle Jokiniemi |
12 | * Paul Walmsley | ||
12 | * | 13 | * |
13 | * Copyright (C) 2010 Texas Instruments, Inc. | 14 | * Copyright (C) 2010 Texas Instruments, Inc. |
14 | * Thara Gopinath <thara@ti.com> | 15 | * Thara Gopinath <thara@ti.com> |
@@ -26,7 +27,6 @@ | |||
26 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
27 | 28 | ||
28 | #include <plat/common.h> | 29 | #include <plat/common.h> |
29 | #include <plat/voltage.h> | ||
30 | 30 | ||
31 | #include "prm-regbits-34xx.h" | 31 | #include "prm-regbits-34xx.h" |
32 | #include "prm-regbits-44xx.h" | 32 | #include "prm-regbits-44xx.h" |
@@ -35,284 +35,30 @@ | |||
35 | #include "prminst44xx.h" | 35 | #include "prminst44xx.h" |
36 | #include "control.h" | 36 | #include "control.h" |
37 | 37 | ||
38 | #define VP_IDLE_TIMEOUT 200 | 38 | #include "voltage.h" |
39 | #define VP_TRANXDONE_TIMEOUT 300 | 39 | |
40 | #include "vc.h" | ||
41 | #include "vp.h" | ||
42 | |||
40 | #define VOLTAGE_DIR_SIZE 16 | 43 | #define VOLTAGE_DIR_SIZE 16 |
41 | 44 | ||
42 | /* Voltage processor register offsets */ | ||
43 | struct vp_reg_offs { | ||
44 | u8 vpconfig; | ||
45 | u8 vstepmin; | ||
46 | u8 vstepmax; | ||
47 | u8 vlimitto; | ||
48 | u8 vstatus; | ||
49 | u8 voltage; | ||
50 | }; | ||
51 | |||
52 | /* Voltage Processor bit field values, shifts and masks */ | ||
53 | struct vp_reg_val { | ||
54 | /* PRM module */ | ||
55 | u16 prm_mod; | ||
56 | /* VPx_VPCONFIG */ | ||
57 | u32 vpconfig_erroroffset; | ||
58 | u16 vpconfig_errorgain; | ||
59 | u32 vpconfig_errorgain_mask; | ||
60 | u8 vpconfig_errorgain_shift; | ||
61 | u32 vpconfig_initvoltage_mask; | ||
62 | u8 vpconfig_initvoltage_shift; | ||
63 | u32 vpconfig_timeouten; | ||
64 | u32 vpconfig_initvdd; | ||
65 | u32 vpconfig_forceupdate; | ||
66 | u32 vpconfig_vpenable; | ||
67 | /* VPx_VSTEPMIN */ | ||
68 | u8 vstepmin_stepmin; | ||
69 | u16 vstepmin_smpswaittimemin; | ||
70 | u8 vstepmin_stepmin_shift; | ||
71 | u8 vstepmin_smpswaittimemin_shift; | ||
72 | /* VPx_VSTEPMAX */ | ||
73 | u8 vstepmax_stepmax; | ||
74 | u16 vstepmax_smpswaittimemax; | ||
75 | u8 vstepmax_stepmax_shift; | ||
76 | u8 vstepmax_smpswaittimemax_shift; | ||
77 | /* VPx_VLIMITTO */ | ||
78 | u8 vlimitto_vddmin; | ||
79 | u8 vlimitto_vddmax; | ||
80 | u16 vlimitto_timeout; | ||
81 | u8 vlimitto_vddmin_shift; | ||
82 | u8 vlimitto_vddmax_shift; | ||
83 | u8 vlimitto_timeout_shift; | ||
84 | /* PRM_IRQSTATUS*/ | ||
85 | u32 tranxdone_status; | ||
86 | }; | ||
87 | |||
88 | /* Voltage controller registers and offsets */ | ||
89 | struct vc_reg_info { | ||
90 | /* PRM module */ | ||
91 | u16 prm_mod; | ||
92 | /* VC register offsets */ | ||
93 | u8 smps_sa_reg; | ||
94 | u8 smps_volra_reg; | ||
95 | u8 bypass_val_reg; | ||
96 | u8 cmdval_reg; | ||
97 | u8 voltsetup_reg; | ||
98 | /*VC_SMPS_SA*/ | ||
99 | u8 smps_sa_shift; | ||
100 | u32 smps_sa_mask; | ||
101 | /* VC_SMPS_VOL_RA */ | ||
102 | u8 smps_volra_shift; | ||
103 | u32 smps_volra_mask; | ||
104 | /* VC_BYPASS_VAL */ | ||
105 | u8 data_shift; | ||
106 | u8 slaveaddr_shift; | ||
107 | u8 regaddr_shift; | ||
108 | u32 valid; | ||
109 | /* VC_CMD_VAL */ | ||
110 | u8 cmd_on_shift; | ||
111 | u8 cmd_onlp_shift; | ||
112 | u8 cmd_ret_shift; | ||
113 | u8 cmd_off_shift; | ||
114 | u32 cmd_on_mask; | ||
115 | /* PRM_VOLTSETUP */ | ||
116 | u8 voltsetup_shift; | ||
117 | u32 voltsetup_mask; | ||
118 | }; | ||
119 | 45 | ||
120 | /** | 46 | static struct omap_vdd_info **vdd_info; |
121 | * omap_vdd_info - Per Voltage Domain info | 47 | |
122 | * | ||
123 | * @volt_data : voltage table having the distinct voltages supported | ||
124 | * by the domain and other associated per voltage data. | ||
125 | * @pmic_info : pmic specific parameters which should be populted by | ||
126 | * the pmic drivers. | ||
127 | * @vp_offs : structure containing the offsets for various | ||
128 | * vp registers | ||
129 | * @vp_reg : the register values, shifts, masks for various | ||
130 | * vp registers | ||
131 | * @vc_reg : structure containing various various vc registers, | ||
132 | * shifts, masks etc. | ||
133 | * @voltdm : pointer to the voltage domain structure | ||
134 | * @debug_dir : debug directory for this voltage domain. | ||
135 | * @curr_volt : current voltage for this vdd. | ||
136 | * @ocp_mod : The prm module for accessing the prm irqstatus reg. | ||
137 | * @prm_irqst_reg : prm irqstatus register. | ||
138 | * @vp_enabled : flag to keep track of whether vp is enabled or not | ||
139 | * @volt_scale : API to scale the voltage of the vdd. | ||
140 | */ | ||
141 | struct omap_vdd_info { | ||
142 | struct omap_volt_data *volt_data; | ||
143 | struct omap_volt_pmic_info *pmic_info; | ||
144 | struct vp_reg_offs vp_offs; | ||
145 | struct vp_reg_val vp_reg; | ||
146 | struct vc_reg_info vc_reg; | ||
147 | struct voltagedomain voltdm; | ||
148 | struct dentry *debug_dir; | ||
149 | u32 curr_volt; | ||
150 | u16 ocp_mod; | ||
151 | u8 prm_irqst_reg; | ||
152 | bool vp_enabled; | ||
153 | u32 (*read_reg) (u16 mod, u8 offset); | ||
154 | void (*write_reg) (u32 val, u16 mod, u8 offset); | ||
155 | int (*volt_scale) (struct omap_vdd_info *vdd, | ||
156 | unsigned long target_volt); | ||
157 | }; | ||
158 | |||
159 | static struct omap_vdd_info *vdd_info; | ||
160 | /* | 48 | /* |
161 | * Number of scalable voltage domains. | 49 | * Number of scalable voltage domains. |
162 | */ | 50 | */ |
163 | static int nr_scalable_vdd; | 51 | static int nr_scalable_vdd; |
164 | 52 | ||
165 | /* OMAP3 VDD sturctures */ | 53 | /* XXX document */ |
166 | static struct omap_vdd_info omap3_vdd_info[] = { | 54 | static s16 prm_mod_offs; |
167 | { | 55 | static s16 prm_irqst_ocp_mod_offs; |
168 | .vp_offs = { | ||
169 | .vpconfig = OMAP3_PRM_VP1_CONFIG_OFFSET, | ||
170 | .vstepmin = OMAP3_PRM_VP1_VSTEPMIN_OFFSET, | ||
171 | .vstepmax = OMAP3_PRM_VP1_VSTEPMAX_OFFSET, | ||
172 | .vlimitto = OMAP3_PRM_VP1_VLIMITTO_OFFSET, | ||
173 | .vstatus = OMAP3_PRM_VP1_STATUS_OFFSET, | ||
174 | .voltage = OMAP3_PRM_VP1_VOLTAGE_OFFSET, | ||
175 | }, | ||
176 | .voltdm = { | ||
177 | .name = "mpu", | ||
178 | }, | ||
179 | }, | ||
180 | { | ||
181 | .vp_offs = { | ||
182 | .vpconfig = OMAP3_PRM_VP2_CONFIG_OFFSET, | ||
183 | .vstepmin = OMAP3_PRM_VP2_VSTEPMIN_OFFSET, | ||
184 | .vstepmax = OMAP3_PRM_VP2_VSTEPMAX_OFFSET, | ||
185 | .vlimitto = OMAP3_PRM_VP2_VLIMITTO_OFFSET, | ||
186 | .vstatus = OMAP3_PRM_VP2_STATUS_OFFSET, | ||
187 | .voltage = OMAP3_PRM_VP2_VOLTAGE_OFFSET, | ||
188 | }, | ||
189 | .voltdm = { | ||
190 | .name = "core", | ||
191 | }, | ||
192 | }, | ||
193 | }; | ||
194 | |||
195 | #define OMAP3_NR_SCALABLE_VDD ARRAY_SIZE(omap3_vdd_info) | ||
196 | |||
197 | /* OMAP4 VDD sturctures */ | ||
198 | static struct omap_vdd_info omap4_vdd_info[] = { | ||
199 | { | ||
200 | .vp_offs = { | ||
201 | .vpconfig = OMAP4_PRM_VP_MPU_CONFIG_OFFSET, | ||
202 | .vstepmin = OMAP4_PRM_VP_MPU_VSTEPMIN_OFFSET, | ||
203 | .vstepmax = OMAP4_PRM_VP_MPU_VSTEPMAX_OFFSET, | ||
204 | .vlimitto = OMAP4_PRM_VP_MPU_VLIMITTO_OFFSET, | ||
205 | .vstatus = OMAP4_PRM_VP_MPU_STATUS_OFFSET, | ||
206 | .voltage = OMAP4_PRM_VP_MPU_VOLTAGE_OFFSET, | ||
207 | }, | ||
208 | .voltdm = { | ||
209 | .name = "mpu", | ||
210 | }, | ||
211 | }, | ||
212 | { | ||
213 | .vp_offs = { | ||
214 | .vpconfig = OMAP4_PRM_VP_IVA_CONFIG_OFFSET, | ||
215 | .vstepmin = OMAP4_PRM_VP_IVA_VSTEPMIN_OFFSET, | ||
216 | .vstepmax = OMAP4_PRM_VP_IVA_VSTEPMAX_OFFSET, | ||
217 | .vlimitto = OMAP4_PRM_VP_IVA_VLIMITTO_OFFSET, | ||
218 | .vstatus = OMAP4_PRM_VP_IVA_STATUS_OFFSET, | ||
219 | .voltage = OMAP4_PRM_VP_IVA_VOLTAGE_OFFSET, | ||
220 | }, | ||
221 | .voltdm = { | ||
222 | .name = "iva", | ||
223 | }, | ||
224 | }, | ||
225 | { | ||
226 | .vp_offs = { | ||
227 | .vpconfig = OMAP4_PRM_VP_CORE_CONFIG_OFFSET, | ||
228 | .vstepmin = OMAP4_PRM_VP_CORE_VSTEPMIN_OFFSET, | ||
229 | .vstepmax = OMAP4_PRM_VP_CORE_VSTEPMAX_OFFSET, | ||
230 | .vlimitto = OMAP4_PRM_VP_CORE_VLIMITTO_OFFSET, | ||
231 | .vstatus = OMAP4_PRM_VP_CORE_STATUS_OFFSET, | ||
232 | .voltage = OMAP4_PRM_VP_CORE_VOLTAGE_OFFSET, | ||
233 | }, | ||
234 | .voltdm = { | ||
235 | .name = "core", | ||
236 | }, | ||
237 | }, | ||
238 | }; | ||
239 | |||
240 | #define OMAP4_NR_SCALABLE_VDD ARRAY_SIZE(omap4_vdd_info) | ||
241 | |||
242 | /* | ||
243 | * Structures containing OMAP3430/OMAP3630 voltage supported and various | ||
244 | * voltage dependent data for each VDD. | ||
245 | */ | ||
246 | #define VOLT_DATA_DEFINE(_v_nom, _efuse_offs, _errminlimit, _errgain) \ | ||
247 | { \ | ||
248 | .volt_nominal = _v_nom, \ | ||
249 | .sr_efuse_offs = _efuse_offs, \ | ||
250 | .sr_errminlimit = _errminlimit, \ | ||
251 | .vp_errgain = _errgain \ | ||
252 | } | ||
253 | |||
254 | /* VDD1 */ | ||
255 | static struct omap_volt_data omap34xx_vddmpu_volt_data[] = { | ||
256 | VOLT_DATA_DEFINE(OMAP3430_VDD_MPU_OPP1_UV, OMAP343X_CONTROL_FUSE_OPP1_VDD1, 0xf4, 0x0c), | ||
257 | VOLT_DATA_DEFINE(OMAP3430_VDD_MPU_OPP2_UV, OMAP343X_CONTROL_FUSE_OPP2_VDD1, 0xf4, 0x0c), | ||
258 | VOLT_DATA_DEFINE(OMAP3430_VDD_MPU_OPP3_UV, OMAP343X_CONTROL_FUSE_OPP3_VDD1, 0xf9, 0x18), | ||
259 | VOLT_DATA_DEFINE(OMAP3430_VDD_MPU_OPP4_UV, OMAP343X_CONTROL_FUSE_OPP4_VDD1, 0xf9, 0x18), | ||
260 | VOLT_DATA_DEFINE(OMAP3430_VDD_MPU_OPP5_UV, OMAP343X_CONTROL_FUSE_OPP5_VDD1, 0xf9, 0x18), | ||
261 | VOLT_DATA_DEFINE(0, 0, 0, 0), | ||
262 | }; | ||
263 | |||
264 | static struct omap_volt_data omap36xx_vddmpu_volt_data[] = { | ||
265 | VOLT_DATA_DEFINE(OMAP3630_VDD_MPU_OPP50_UV, OMAP3630_CONTROL_FUSE_OPP50_VDD1, 0xf4, 0x0c), | ||
266 | VOLT_DATA_DEFINE(OMAP3630_VDD_MPU_OPP100_UV, OMAP3630_CONTROL_FUSE_OPP100_VDD1, 0xf9, 0x16), | ||
267 | VOLT_DATA_DEFINE(OMAP3630_VDD_MPU_OPP120_UV, OMAP3630_CONTROL_FUSE_OPP120_VDD1, 0xfa, 0x23), | ||
268 | VOLT_DATA_DEFINE(OMAP3630_VDD_MPU_OPP1G_UV, OMAP3630_CONTROL_FUSE_OPP1G_VDD1, 0xfa, 0x27), | ||
269 | VOLT_DATA_DEFINE(0, 0, 0, 0), | ||
270 | }; | ||
271 | |||
272 | /* VDD2 */ | ||
273 | static struct omap_volt_data omap34xx_vddcore_volt_data[] = { | ||
274 | VOLT_DATA_DEFINE(OMAP3430_VDD_CORE_OPP1_UV, OMAP343X_CONTROL_FUSE_OPP1_VDD2, 0xf4, 0x0c), | ||
275 | VOLT_DATA_DEFINE(OMAP3430_VDD_CORE_OPP2_UV, OMAP343X_CONTROL_FUSE_OPP2_VDD2, 0xf4, 0x0c), | ||
276 | VOLT_DATA_DEFINE(OMAP3430_VDD_CORE_OPP3_UV, OMAP343X_CONTROL_FUSE_OPP3_VDD2, 0xf9, 0x18), | ||
277 | VOLT_DATA_DEFINE(0, 0, 0, 0), | ||
278 | }; | ||
279 | |||
280 | static struct omap_volt_data omap36xx_vddcore_volt_data[] = { | ||
281 | VOLT_DATA_DEFINE(OMAP3630_VDD_CORE_OPP50_UV, OMAP3630_CONTROL_FUSE_OPP50_VDD2, 0xf4, 0x0c), | ||
282 | VOLT_DATA_DEFINE(OMAP3630_VDD_CORE_OPP100_UV, OMAP3630_CONTROL_FUSE_OPP100_VDD2, 0xf9, 0x16), | ||
283 | VOLT_DATA_DEFINE(0, 0, 0, 0), | ||
284 | }; | ||
285 | |||
286 | /* | ||
287 | * Structures containing OMAP4430 voltage supported and various | ||
288 | * voltage dependent data for each VDD. | ||
289 | */ | ||
290 | static struct omap_volt_data omap44xx_vdd_mpu_volt_data[] = { | ||
291 | VOLT_DATA_DEFINE(OMAP4430_VDD_MPU_OPP50_UV, OMAP44XX_CONTROL_FUSE_MPU_OPP50, 0xf4, 0x0c), | ||
292 | VOLT_DATA_DEFINE(OMAP4430_VDD_MPU_OPP100_UV, OMAP44XX_CONTROL_FUSE_MPU_OPP100, 0xf9, 0x16), | ||
293 | VOLT_DATA_DEFINE(OMAP4430_VDD_MPU_OPPTURBO_UV, OMAP44XX_CONTROL_FUSE_MPU_OPPTURBO, 0xfa, 0x23), | ||
294 | VOLT_DATA_DEFINE(OMAP4430_VDD_MPU_OPPNITRO_UV, OMAP44XX_CONTROL_FUSE_MPU_OPPNITRO, 0xfa, 0x27), | ||
295 | VOLT_DATA_DEFINE(0, 0, 0, 0), | ||
296 | }; | ||
297 | |||
298 | static struct omap_volt_data omap44xx_vdd_iva_volt_data[] = { | ||
299 | VOLT_DATA_DEFINE(OMAP4430_VDD_IVA_OPP50_UV, OMAP44XX_CONTROL_FUSE_IVA_OPP50, 0xf4, 0x0c), | ||
300 | VOLT_DATA_DEFINE(OMAP4430_VDD_IVA_OPP100_UV, OMAP44XX_CONTROL_FUSE_IVA_OPP100, 0xf9, 0x16), | ||
301 | VOLT_DATA_DEFINE(OMAP4430_VDD_IVA_OPPTURBO_UV, OMAP44XX_CONTROL_FUSE_IVA_OPPTURBO, 0xfa, 0x23), | ||
302 | VOLT_DATA_DEFINE(0, 0, 0, 0), | ||
303 | }; | ||
304 | |||
305 | static struct omap_volt_data omap44xx_vdd_core_volt_data[] = { | ||
306 | VOLT_DATA_DEFINE(OMAP4430_VDD_CORE_OPP50_UV, OMAP44XX_CONTROL_FUSE_CORE_OPP50, 0xf4, 0x0c), | ||
307 | VOLT_DATA_DEFINE(OMAP4430_VDD_CORE_OPP100_UV, OMAP44XX_CONTROL_FUSE_CORE_OPP100, 0xf9, 0x16), | ||
308 | VOLT_DATA_DEFINE(0, 0, 0, 0), | ||
309 | }; | ||
310 | 56 | ||
311 | static struct dentry *voltage_dir; | 57 | static struct dentry *voltage_dir; |
312 | 58 | ||
313 | /* Init function pointers */ | 59 | /* Init function pointers */ |
314 | static void (*vc_init) (struct omap_vdd_info *vdd); | 60 | static int vp_forceupdate_scale_voltage(struct omap_vdd_info *vdd, |
315 | static int (*vdd_data_configure) (struct omap_vdd_info *vdd); | 61 | unsigned long target_volt); |
316 | 62 | ||
317 | static u32 omap3_voltage_read_reg(u16 mod, u8 offset) | 63 | static u32 omap3_voltage_read_reg(u16 mod, u8 offset) |
318 | { | 64 | { |
@@ -335,6 +81,62 @@ static void omap4_voltage_write_reg(u32 val, u16 mod, u8 offset) | |||
335 | omap4_prminst_write_inst_reg(val, OMAP4430_PRM_PARTITION, mod, offset); | 81 | omap4_prminst_write_inst_reg(val, OMAP4430_PRM_PARTITION, mod, offset); |
336 | } | 82 | } |
337 | 83 | ||
84 | static int __init _config_common_vdd_data(struct omap_vdd_info *vdd) | ||
85 | { | ||
86 | char *sys_ck_name; | ||
87 | struct clk *sys_ck; | ||
88 | u32 sys_clk_speed, timeout_val, waittime; | ||
89 | |||
90 | /* | ||
91 | * XXX Clockfw should handle this, or this should be in a | ||
92 | * struct record | ||
93 | */ | ||
94 | if (cpu_is_omap24xx() || cpu_is_omap34xx()) | ||
95 | sys_ck_name = "sys_ck"; | ||
96 | else if (cpu_is_omap44xx()) | ||
97 | sys_ck_name = "sys_clkin_ck"; | ||
98 | else | ||
99 | return -EINVAL; | ||
100 | |||
101 | /* | ||
102 | * Sys clk rate is require to calculate vp timeout value and | ||
103 | * smpswaittimemin and smpswaittimemax. | ||
104 | */ | ||
105 | sys_ck = clk_get(NULL, sys_ck_name); | ||
106 | if (IS_ERR(sys_ck)) { | ||
107 | pr_warning("%s: Could not get the sys clk to calculate" | ||
108 | "various vdd_%s params\n", __func__, vdd->voltdm.name); | ||
109 | return -EINVAL; | ||
110 | } | ||
111 | sys_clk_speed = clk_get_rate(sys_ck); | ||
112 | clk_put(sys_ck); | ||
113 | /* Divide to avoid overflow */ | ||
114 | sys_clk_speed /= 1000; | ||
115 | |||
116 | /* Generic voltage parameters */ | ||
117 | vdd->curr_volt = 1200000; | ||
118 | vdd->volt_scale = vp_forceupdate_scale_voltage; | ||
119 | vdd->vp_enabled = false; | ||
120 | |||
121 | vdd->vp_rt_data.vpconfig_erroroffset = | ||
122 | (vdd->pmic_info->vp_erroroffset << | ||
123 | vdd->vp_data->vp_common->vpconfig_erroroffset_shift); | ||
124 | |||
125 | timeout_val = (sys_clk_speed * vdd->pmic_info->vp_timeout_us) / 1000; | ||
126 | vdd->vp_rt_data.vlimitto_timeout = timeout_val; | ||
127 | vdd->vp_rt_data.vlimitto_vddmin = vdd->pmic_info->vp_vddmin; | ||
128 | vdd->vp_rt_data.vlimitto_vddmax = vdd->pmic_info->vp_vddmax; | ||
129 | |||
130 | waittime = ((vdd->pmic_info->step_size / vdd->pmic_info->slew_rate) * | ||
131 | sys_clk_speed) / 1000; | ||
132 | vdd->vp_rt_data.vstepmin_smpswaittimemin = waittime; | ||
133 | vdd->vp_rt_data.vstepmax_smpswaittimemax = waittime; | ||
134 | vdd->vp_rt_data.vstepmin_stepmin = vdd->pmic_info->vp_vstepmin; | ||
135 | vdd->vp_rt_data.vstepmax_stepmax = vdd->pmic_info->vp_vstepmax; | ||
136 | |||
137 | return 0; | ||
138 | } | ||
139 | |||
338 | /* Voltage debugfs support */ | 140 | /* Voltage debugfs support */ |
339 | static int vp_volt_debug_get(void *data, u64 *val) | 141 | static int vp_volt_debug_get(void *data, u64 *val) |
340 | { | 142 | { |
@@ -346,7 +148,7 @@ static int vp_volt_debug_get(void *data, u64 *val) | |||
346 | return -EINVAL; | 148 | return -EINVAL; |
347 | } | 149 | } |
348 | 150 | ||
349 | vsel = vdd->read_reg(vdd->vp_reg.prm_mod, vdd->vp_offs.voltage); | 151 | vsel = vdd->read_reg(prm_mod_offs, vdd->vp_data->voltage); |
350 | pr_notice("curr_vsel = %x\n", vsel); | 152 | pr_notice("curr_vsel = %x\n", vsel); |
351 | 153 | ||
352 | if (!vdd->pmic_info->vsel_to_uv) { | 154 | if (!vdd->pmic_info->vsel_to_uv) { |
@@ -379,7 +181,6 @@ DEFINE_SIMPLE_ATTRIBUTE(nom_volt_debug_fops, nom_volt_debug_get, NULL, | |||
379 | static void vp_latch_vsel(struct omap_vdd_info *vdd) | 181 | static void vp_latch_vsel(struct omap_vdd_info *vdd) |
380 | { | 182 | { |
381 | u32 vpconfig; | 183 | u32 vpconfig; |
382 | u16 mod; | ||
383 | unsigned long uvdc; | 184 | unsigned long uvdc; |
384 | char vsel; | 185 | char vsel; |
385 | 186 | ||
@@ -396,30 +197,27 @@ static void vp_latch_vsel(struct omap_vdd_info *vdd) | |||
396 | return; | 197 | return; |
397 | } | 198 | } |
398 | 199 | ||
399 | mod = vdd->vp_reg.prm_mod; | ||
400 | |||
401 | vsel = vdd->pmic_info->uv_to_vsel(uvdc); | 200 | vsel = vdd->pmic_info->uv_to_vsel(uvdc); |
402 | 201 | ||
403 | vpconfig = vdd->read_reg(mod, vdd->vp_offs.vpconfig); | 202 | vpconfig = vdd->read_reg(prm_mod_offs, vdd->vp_data->vpconfig); |
404 | vpconfig &= ~(vdd->vp_reg.vpconfig_initvoltage_mask | | 203 | vpconfig &= ~(vdd->vp_data->vp_common->vpconfig_initvoltage_mask | |
405 | vdd->vp_reg.vpconfig_initvdd); | 204 | vdd->vp_data->vp_common->vpconfig_initvdd); |
406 | vpconfig |= vsel << vdd->vp_reg.vpconfig_initvoltage_shift; | 205 | vpconfig |= vsel << vdd->vp_data->vp_common->vpconfig_initvoltage_shift; |
407 | 206 | ||
408 | vdd->write_reg(vpconfig, mod, vdd->vp_offs.vpconfig); | 207 | vdd->write_reg(vpconfig, prm_mod_offs, vdd->vp_data->vpconfig); |
409 | 208 | ||
410 | /* Trigger initVDD value copy to voltage processor */ | 209 | /* Trigger initVDD value copy to voltage processor */ |
411 | vdd->write_reg((vpconfig | vdd->vp_reg.vpconfig_initvdd), mod, | 210 | vdd->write_reg((vpconfig | vdd->vp_data->vp_common->vpconfig_initvdd), |
412 | vdd->vp_offs.vpconfig); | 211 | prm_mod_offs, vdd->vp_data->vpconfig); |
413 | 212 | ||
414 | /* Clear initVDD copy trigger bit */ | 213 | /* Clear initVDD copy trigger bit */ |
415 | vdd->write_reg(vpconfig, mod, vdd->vp_offs.vpconfig); | 214 | vdd->write_reg(vpconfig, prm_mod_offs, vdd->vp_data->vpconfig); |
416 | } | 215 | } |
417 | 216 | ||
418 | /* Generic voltage init functions */ | 217 | /* Generic voltage init functions */ |
419 | static void __init vp_init(struct omap_vdd_info *vdd) | 218 | static void __init vp_init(struct omap_vdd_info *vdd) |
420 | { | 219 | { |
421 | u32 vp_val; | 220 | u32 vp_val; |
422 | u16 mod; | ||
423 | 221 | ||
424 | if (!vdd->read_reg || !vdd->write_reg) { | 222 | if (!vdd->read_reg || !vdd->write_reg) { |
425 | pr_err("%s: No read/write API for accessing vdd_%s regs\n", | 223 | pr_err("%s: No read/write API for accessing vdd_%s regs\n", |
@@ -427,33 +225,31 @@ static void __init vp_init(struct omap_vdd_info *vdd) | |||
427 | return; | 225 | return; |
428 | } | 226 | } |
429 | 227 | ||
430 | mod = vdd->vp_reg.prm_mod; | 228 | vp_val = vdd->vp_rt_data.vpconfig_erroroffset | |
431 | 229 | (vdd->vp_rt_data.vpconfig_errorgain << | |
432 | vp_val = vdd->vp_reg.vpconfig_erroroffset | | 230 | vdd->vp_data->vp_common->vpconfig_errorgain_shift) | |
433 | (vdd->vp_reg.vpconfig_errorgain << | 231 | vdd->vp_data->vp_common->vpconfig_timeouten; |
434 | vdd->vp_reg.vpconfig_errorgain_shift) | | 232 | vdd->write_reg(vp_val, prm_mod_offs, vdd->vp_data->vpconfig); |
435 | vdd->vp_reg.vpconfig_timeouten; | 233 | |
436 | vdd->write_reg(vp_val, mod, vdd->vp_offs.vpconfig); | 234 | vp_val = ((vdd->vp_rt_data.vstepmin_smpswaittimemin << |
437 | 235 | vdd->vp_data->vp_common->vstepmin_smpswaittimemin_shift) | | |
438 | vp_val = ((vdd->vp_reg.vstepmin_smpswaittimemin << | 236 | (vdd->vp_rt_data.vstepmin_stepmin << |
439 | vdd->vp_reg.vstepmin_smpswaittimemin_shift) | | 237 | vdd->vp_data->vp_common->vstepmin_stepmin_shift)); |
440 | (vdd->vp_reg.vstepmin_stepmin << | 238 | vdd->write_reg(vp_val, prm_mod_offs, vdd->vp_data->vstepmin); |
441 | vdd->vp_reg.vstepmin_stepmin_shift)); | 239 | |
442 | vdd->write_reg(vp_val, mod, vdd->vp_offs.vstepmin); | 240 | vp_val = ((vdd->vp_rt_data.vstepmax_smpswaittimemax << |
443 | 241 | vdd->vp_data->vp_common->vstepmax_smpswaittimemax_shift) | | |
444 | vp_val = ((vdd->vp_reg.vstepmax_smpswaittimemax << | 242 | (vdd->vp_rt_data.vstepmax_stepmax << |
445 | vdd->vp_reg.vstepmax_smpswaittimemax_shift) | | 243 | vdd->vp_data->vp_common->vstepmax_stepmax_shift)); |
446 | (vdd->vp_reg.vstepmax_stepmax << | 244 | vdd->write_reg(vp_val, prm_mod_offs, vdd->vp_data->vstepmax); |
447 | vdd->vp_reg.vstepmax_stepmax_shift)); | 245 | |
448 | vdd->write_reg(vp_val, mod, vdd->vp_offs.vstepmax); | 246 | vp_val = ((vdd->vp_rt_data.vlimitto_vddmax << |
449 | 247 | vdd->vp_data->vp_common->vlimitto_vddmax_shift) | | |
450 | vp_val = ((vdd->vp_reg.vlimitto_vddmax << | 248 | (vdd->vp_rt_data.vlimitto_vddmin << |
451 | vdd->vp_reg.vlimitto_vddmax_shift) | | 249 | vdd->vp_data->vp_common->vlimitto_vddmin_shift) | |
452 | (vdd->vp_reg.vlimitto_vddmin << | 250 | (vdd->vp_rt_data.vlimitto_timeout << |
453 | vdd->vp_reg.vlimitto_vddmin_shift) | | 251 | vdd->vp_data->vp_common->vlimitto_timeout_shift)); |
454 | (vdd->vp_reg.vlimitto_timeout << | 252 | vdd->write_reg(vp_val, prm_mod_offs, vdd->vp_data->vlimitto); |
455 | vdd->vp_reg.vlimitto_timeout_shift)); | ||
456 | vdd->write_reg(vp_val, mod, vdd->vp_offs.vlimitto); | ||
457 | } | 253 | } |
458 | 254 | ||
459 | static void __init vdd_debugfs_init(struct omap_vdd_info *vdd) | 255 | static void __init vdd_debugfs_init(struct omap_vdd_info *vdd) |
@@ -480,23 +276,23 @@ static void __init vdd_debugfs_init(struct omap_vdd_info *vdd) | |||
480 | } | 276 | } |
481 | 277 | ||
482 | (void) debugfs_create_x16("vp_errorgain", S_IRUGO, vdd->debug_dir, | 278 | (void) debugfs_create_x16("vp_errorgain", S_IRUGO, vdd->debug_dir, |
483 | &(vdd->vp_reg.vpconfig_errorgain)); | 279 | &(vdd->vp_rt_data.vpconfig_errorgain)); |
484 | (void) debugfs_create_x16("vp_smpswaittimemin", S_IRUGO, | 280 | (void) debugfs_create_x16("vp_smpswaittimemin", S_IRUGO, |
485 | vdd->debug_dir, | 281 | vdd->debug_dir, |
486 | &(vdd->vp_reg.vstepmin_smpswaittimemin)); | 282 | &(vdd->vp_rt_data.vstepmin_smpswaittimemin)); |
487 | (void) debugfs_create_x8("vp_stepmin", S_IRUGO, vdd->debug_dir, | 283 | (void) debugfs_create_x8("vp_stepmin", S_IRUGO, vdd->debug_dir, |
488 | &(vdd->vp_reg.vstepmin_stepmin)); | 284 | &(vdd->vp_rt_data.vstepmin_stepmin)); |
489 | (void) debugfs_create_x16("vp_smpswaittimemax", S_IRUGO, | 285 | (void) debugfs_create_x16("vp_smpswaittimemax", S_IRUGO, |
490 | vdd->debug_dir, | 286 | vdd->debug_dir, |
491 | &(vdd->vp_reg.vstepmax_smpswaittimemax)); | 287 | &(vdd->vp_rt_data.vstepmax_smpswaittimemax)); |
492 | (void) debugfs_create_x8("vp_stepmax", S_IRUGO, vdd->debug_dir, | 288 | (void) debugfs_create_x8("vp_stepmax", S_IRUGO, vdd->debug_dir, |
493 | &(vdd->vp_reg.vstepmax_stepmax)); | 289 | &(vdd->vp_rt_data.vstepmax_stepmax)); |
494 | (void) debugfs_create_x8("vp_vddmax", S_IRUGO, vdd->debug_dir, | 290 | (void) debugfs_create_x8("vp_vddmax", S_IRUGO, vdd->debug_dir, |
495 | &(vdd->vp_reg.vlimitto_vddmax)); | 291 | &(vdd->vp_rt_data.vlimitto_vddmax)); |
496 | (void) debugfs_create_x8("vp_vddmin", S_IRUGO, vdd->debug_dir, | 292 | (void) debugfs_create_x8("vp_vddmin", S_IRUGO, vdd->debug_dir, |
497 | &(vdd->vp_reg.vlimitto_vddmin)); | 293 | &(vdd->vp_rt_data.vlimitto_vddmin)); |
498 | (void) debugfs_create_x16("vp_timeout", S_IRUGO, vdd->debug_dir, | 294 | (void) debugfs_create_x16("vp_timeout", S_IRUGO, vdd->debug_dir, |
499 | &(vdd->vp_reg.vlimitto_timeout)); | 295 | &(vdd->vp_rt_data.vlimitto_timeout)); |
500 | (void) debugfs_create_file("curr_vp_volt", S_IRUGO, vdd->debug_dir, | 296 | (void) debugfs_create_file("curr_vp_volt", S_IRUGO, vdd->debug_dir, |
501 | (void *) vdd, &vp_volt_debug_fops); | 297 | (void *) vdd, &vp_volt_debug_fops); |
502 | (void) debugfs_create_file("curr_nominal_volt", S_IRUGO, | 298 | (void) debugfs_create_file("curr_nominal_volt", S_IRUGO, |
@@ -509,8 +305,12 @@ static int _pre_volt_scale(struct omap_vdd_info *vdd, | |||
509 | unsigned long target_volt, u8 *target_vsel, u8 *current_vsel) | 305 | unsigned long target_volt, u8 *target_vsel, u8 *current_vsel) |
510 | { | 306 | { |
511 | struct omap_volt_data *volt_data; | 307 | struct omap_volt_data *volt_data; |
308 | const struct omap_vc_common_data *vc_common; | ||
309 | const struct omap_vp_common_data *vp_common; | ||
512 | u32 vc_cmdval, vp_errgain_val; | 310 | u32 vc_cmdval, vp_errgain_val; |
513 | u16 vp_mod, vc_mod; | 311 | |
312 | vc_common = vdd->vc_data->vc_common; | ||
313 | vp_common = vdd->vp_data->vp_common; | ||
514 | 314 | ||
515 | /* Check if suffiecient pmic info is available for this vdd */ | 315 | /* Check if suffiecient pmic info is available for this vdd */ |
516 | if (!vdd->pmic_info) { | 316 | if (!vdd->pmic_info) { |
@@ -532,33 +332,30 @@ static int _pre_volt_scale(struct omap_vdd_info *vdd, | |||
532 | return -EINVAL; | 332 | return -EINVAL; |
533 | } | 333 | } |
534 | 334 | ||
535 | vp_mod = vdd->vp_reg.prm_mod; | ||
536 | vc_mod = vdd->vc_reg.prm_mod; | ||
537 | |||
538 | /* Get volt_data corresponding to target_volt */ | 335 | /* Get volt_data corresponding to target_volt */ |
539 | volt_data = omap_voltage_get_voltdata(&vdd->voltdm, target_volt); | 336 | volt_data = omap_voltage_get_voltdata(&vdd->voltdm, target_volt); |
540 | if (IS_ERR(volt_data)) | 337 | if (IS_ERR(volt_data)) |
541 | volt_data = NULL; | 338 | volt_data = NULL; |
542 | 339 | ||
543 | *target_vsel = vdd->pmic_info->uv_to_vsel(target_volt); | 340 | *target_vsel = vdd->pmic_info->uv_to_vsel(target_volt); |
544 | *current_vsel = vdd->read_reg(vp_mod, vdd->vp_offs.voltage); | 341 | *current_vsel = vdd->read_reg(prm_mod_offs, vdd->vp_data->voltage); |
545 | 342 | ||
546 | /* Setting the ON voltage to the new target voltage */ | 343 | /* Setting the ON voltage to the new target voltage */ |
547 | vc_cmdval = vdd->read_reg(vc_mod, vdd->vc_reg.cmdval_reg); | 344 | vc_cmdval = vdd->read_reg(prm_mod_offs, vdd->vc_data->cmdval_reg); |
548 | vc_cmdval &= ~vdd->vc_reg.cmd_on_mask; | 345 | vc_cmdval &= ~vc_common->cmd_on_mask; |
549 | vc_cmdval |= (*target_vsel << vdd->vc_reg.cmd_on_shift); | 346 | vc_cmdval |= (*target_vsel << vc_common->cmd_on_shift); |
550 | vdd->write_reg(vc_cmdval, vc_mod, vdd->vc_reg.cmdval_reg); | 347 | vdd->write_reg(vc_cmdval, prm_mod_offs, vdd->vc_data->cmdval_reg); |
551 | 348 | ||
552 | /* Setting vp errorgain based on the voltage */ | 349 | /* Setting vp errorgain based on the voltage */ |
553 | if (volt_data) { | 350 | if (volt_data) { |
554 | vp_errgain_val = vdd->read_reg(vp_mod, | 351 | vp_errgain_val = vdd->read_reg(prm_mod_offs, |
555 | vdd->vp_offs.vpconfig); | 352 | vdd->vp_data->vpconfig); |
556 | vdd->vp_reg.vpconfig_errorgain = volt_data->vp_errgain; | 353 | vdd->vp_rt_data.vpconfig_errorgain = volt_data->vp_errgain; |
557 | vp_errgain_val &= ~vdd->vp_reg.vpconfig_errorgain_mask; | 354 | vp_errgain_val &= ~vp_common->vpconfig_errorgain_mask; |
558 | vp_errgain_val |= vdd->vp_reg.vpconfig_errorgain << | 355 | vp_errgain_val |= vdd->vp_rt_data.vpconfig_errorgain << |
559 | vdd->vp_reg.vpconfig_errorgain_shift; | 356 | vp_common->vpconfig_errorgain_shift; |
560 | vdd->write_reg(vp_errgain_val, vp_mod, | 357 | vdd->write_reg(vp_errgain_val, prm_mod_offs, |
561 | vdd->vp_offs.vpconfig); | 358 | vdd->vp_data->vpconfig); |
562 | } | 359 | } |
563 | 360 | ||
564 | return 0; | 361 | return 0; |
@@ -584,7 +381,6 @@ static int vc_bypass_scale_voltage(struct omap_vdd_info *vdd, | |||
584 | { | 381 | { |
585 | u32 loop_cnt = 0, retries_cnt = 0; | 382 | u32 loop_cnt = 0, retries_cnt = 0; |
586 | u32 vc_valid, vc_bypass_val_reg, vc_bypass_value; | 383 | u32 vc_valid, vc_bypass_val_reg, vc_bypass_value; |
587 | u16 mod; | ||
588 | u8 target_vsel, current_vsel; | 384 | u8 target_vsel, current_vsel; |
589 | int ret; | 385 | int ret; |
590 | 386 | ||
@@ -592,20 +388,19 @@ static int vc_bypass_scale_voltage(struct omap_vdd_info *vdd, | |||
592 | if (ret) | 388 | if (ret) |
593 | return ret; | 389 | return ret; |
594 | 390 | ||
595 | mod = vdd->vc_reg.prm_mod; | 391 | vc_valid = vdd->vc_data->vc_common->valid; |
596 | 392 | vc_bypass_val_reg = vdd->vc_data->vc_common->bypass_val_reg; | |
597 | vc_valid = vdd->vc_reg.valid; | 393 | vc_bypass_value = (target_vsel << vdd->vc_data->vc_common->data_shift) | |
598 | vc_bypass_val_reg = vdd->vc_reg.bypass_val_reg; | ||
599 | vc_bypass_value = (target_vsel << vdd->vc_reg.data_shift) | | ||
600 | (vdd->pmic_info->pmic_reg << | 394 | (vdd->pmic_info->pmic_reg << |
601 | vdd->vc_reg.regaddr_shift) | | 395 | vdd->vc_data->vc_common->regaddr_shift) | |
602 | (vdd->pmic_info->i2c_slave_addr << | 396 | (vdd->pmic_info->i2c_slave_addr << |
603 | vdd->vc_reg.slaveaddr_shift); | 397 | vdd->vc_data->vc_common->slaveaddr_shift); |
604 | 398 | ||
605 | vdd->write_reg(vc_bypass_value, mod, vc_bypass_val_reg); | 399 | vdd->write_reg(vc_bypass_value, prm_mod_offs, vc_bypass_val_reg); |
606 | vdd->write_reg(vc_bypass_value | vc_valid, mod, vc_bypass_val_reg); | 400 | vdd->write_reg(vc_bypass_value | vc_valid, prm_mod_offs, |
401 | vc_bypass_val_reg); | ||
607 | 402 | ||
608 | vc_bypass_value = vdd->read_reg(mod, vc_bypass_val_reg); | 403 | vc_bypass_value = vdd->read_reg(prm_mod_offs, vc_bypass_val_reg); |
609 | /* | 404 | /* |
610 | * Loop till the bypass command is acknowledged from the SMPS. | 405 | * Loop till the bypass command is acknowledged from the SMPS. |
611 | * NOTE: This is legacy code. The loop count and retry count needs | 406 | * NOTE: This is legacy code. The loop count and retry count needs |
@@ -624,7 +419,8 @@ static int vc_bypass_scale_voltage(struct omap_vdd_info *vdd, | |||
624 | loop_cnt = 0; | 419 | loop_cnt = 0; |
625 | udelay(10); | 420 | udelay(10); |
626 | } | 421 | } |
627 | vc_bypass_value = vdd->read_reg(mod, vc_bypass_val_reg); | 422 | vc_bypass_value = vdd->read_reg(prm_mod_offs, |
423 | vc_bypass_val_reg); | ||
628 | } | 424 | } |
629 | 425 | ||
630 | _post_volt_scale(vdd, target_volt, target_vsel, current_vsel); | 426 | _post_volt_scale(vdd, target_volt, target_vsel, current_vsel); |
@@ -636,7 +432,6 @@ static int vp_forceupdate_scale_voltage(struct omap_vdd_info *vdd, | |||
636 | unsigned long target_volt) | 432 | unsigned long target_volt) |
637 | { | 433 | { |
638 | u32 vpconfig; | 434 | u32 vpconfig; |
639 | u16 mod, ocp_mod; | ||
640 | u8 target_vsel, current_vsel, prm_irqst_reg; | 435 | u8 target_vsel, current_vsel, prm_irqst_reg; |
641 | int ret, timeout = 0; | 436 | int ret, timeout = 0; |
642 | 437 | ||
@@ -644,20 +439,18 @@ static int vp_forceupdate_scale_voltage(struct omap_vdd_info *vdd, | |||
644 | if (ret) | 439 | if (ret) |
645 | return ret; | 440 | return ret; |
646 | 441 | ||
647 | mod = vdd->vp_reg.prm_mod; | 442 | prm_irqst_reg = vdd->vp_data->prm_irqst_data->prm_irqst_reg; |
648 | ocp_mod = vdd->ocp_mod; | ||
649 | prm_irqst_reg = vdd->prm_irqst_reg; | ||
650 | 443 | ||
651 | /* | 444 | /* |
652 | * Clear all pending TransactionDone interrupt/status. Typical latency | 445 | * Clear all pending TransactionDone interrupt/status. Typical latency |
653 | * is <3us | 446 | * is <3us |
654 | */ | 447 | */ |
655 | while (timeout++ < VP_TRANXDONE_TIMEOUT) { | 448 | while (timeout++ < VP_TRANXDONE_TIMEOUT) { |
656 | vdd->write_reg(vdd->vp_reg.tranxdone_status, | 449 | vdd->write_reg(vdd->vp_data->prm_irqst_data->tranxdone_status, |
657 | ocp_mod, prm_irqst_reg); | 450 | prm_irqst_ocp_mod_offs, prm_irqst_reg); |
658 | if (!(vdd->read_reg(ocp_mod, prm_irqst_reg) & | 451 | if (!(vdd->read_reg(prm_irqst_ocp_mod_offs, prm_irqst_reg) & |
659 | vdd->vp_reg.tranxdone_status)) | 452 | vdd->vp_data->prm_irqst_data->tranxdone_status)) |
660 | break; | 453 | break; |
661 | udelay(1); | 454 | udelay(1); |
662 | } | 455 | } |
663 | if (timeout >= VP_TRANXDONE_TIMEOUT) { | 456 | if (timeout >= VP_TRANXDONE_TIMEOUT) { |
@@ -667,30 +460,30 @@ static int vp_forceupdate_scale_voltage(struct omap_vdd_info *vdd, | |||
667 | } | 460 | } |
668 | 461 | ||
669 | /* Configure for VP-Force Update */ | 462 | /* Configure for VP-Force Update */ |
670 | vpconfig = vdd->read_reg(mod, vdd->vp_offs.vpconfig); | 463 | vpconfig = vdd->read_reg(prm_mod_offs, vdd->vp_data->vpconfig); |
671 | vpconfig &= ~(vdd->vp_reg.vpconfig_initvdd | | 464 | vpconfig &= ~(vdd->vp_data->vp_common->vpconfig_initvdd | |
672 | vdd->vp_reg.vpconfig_forceupdate | | 465 | vdd->vp_data->vp_common->vpconfig_forceupdate | |
673 | vdd->vp_reg.vpconfig_initvoltage_mask); | 466 | vdd->vp_data->vp_common->vpconfig_initvoltage_mask); |
674 | vpconfig |= ((target_vsel << | 467 | vpconfig |= ((target_vsel << |
675 | vdd->vp_reg.vpconfig_initvoltage_shift)); | 468 | vdd->vp_data->vp_common->vpconfig_initvoltage_shift)); |
676 | vdd->write_reg(vpconfig, mod, vdd->vp_offs.vpconfig); | 469 | vdd->write_reg(vpconfig, prm_mod_offs, vdd->vp_data->vpconfig); |
677 | 470 | ||
678 | /* Trigger initVDD value copy to voltage processor */ | 471 | /* Trigger initVDD value copy to voltage processor */ |
679 | vpconfig |= vdd->vp_reg.vpconfig_initvdd; | 472 | vpconfig |= vdd->vp_data->vp_common->vpconfig_initvdd; |
680 | vdd->write_reg(vpconfig, mod, vdd->vp_offs.vpconfig); | 473 | vdd->write_reg(vpconfig, prm_mod_offs, vdd->vp_data->vpconfig); |
681 | 474 | ||
682 | /* Force update of voltage */ | 475 | /* Force update of voltage */ |
683 | vpconfig |= vdd->vp_reg.vpconfig_forceupdate; | 476 | vpconfig |= vdd->vp_data->vp_common->vpconfig_forceupdate; |
684 | vdd->write_reg(vpconfig, mod, vdd->vp_offs.vpconfig); | 477 | vdd->write_reg(vpconfig, prm_mod_offs, vdd->vp_data->vpconfig); |
685 | 478 | ||
686 | /* | 479 | /* |
687 | * Wait for TransactionDone. Typical latency is <200us. | 480 | * Wait for TransactionDone. Typical latency is <200us. |
688 | * Depends on SMPSWAITTIMEMIN/MAX and voltage change | 481 | * Depends on SMPSWAITTIMEMIN/MAX and voltage change |
689 | */ | 482 | */ |
690 | timeout = 0; | 483 | timeout = 0; |
691 | omap_test_timeout((vdd->read_reg(ocp_mod, prm_irqst_reg) & | 484 | omap_test_timeout((vdd->read_reg(prm_irqst_ocp_mod_offs, prm_irqst_reg) & |
692 | vdd->vp_reg.tranxdone_status), | 485 | vdd->vp_data->prm_irqst_data->tranxdone_status), |
693 | VP_TRANXDONE_TIMEOUT, timeout); | 486 | VP_TRANXDONE_TIMEOUT, timeout); |
694 | if (timeout >= VP_TRANXDONE_TIMEOUT) | 487 | if (timeout >= VP_TRANXDONE_TIMEOUT) |
695 | pr_err("%s: vdd_%s TRANXDONE timeout exceeded." | 488 | pr_err("%s: vdd_%s TRANXDONE timeout exceeded." |
696 | "TRANXDONE never got set after the voltage update\n", | 489 | "TRANXDONE never got set after the voltage update\n", |
@@ -704,11 +497,11 @@ static int vp_forceupdate_scale_voltage(struct omap_vdd_info *vdd, | |||
704 | */ | 497 | */ |
705 | timeout = 0; | 498 | timeout = 0; |
706 | while (timeout++ < VP_TRANXDONE_TIMEOUT) { | 499 | while (timeout++ < VP_TRANXDONE_TIMEOUT) { |
707 | vdd->write_reg(vdd->vp_reg.tranxdone_status, | 500 | vdd->write_reg(vdd->vp_data->prm_irqst_data->tranxdone_status, |
708 | ocp_mod, prm_irqst_reg); | 501 | prm_irqst_ocp_mod_offs, prm_irqst_reg); |
709 | if (!(vdd->read_reg(ocp_mod, prm_irqst_reg) & | 502 | if (!(vdd->read_reg(prm_irqst_ocp_mod_offs, prm_irqst_reg) & |
710 | vdd->vp_reg.tranxdone_status)) | 503 | vdd->vp_data->prm_irqst_data->tranxdone_status)) |
711 | break; | 504 | break; |
712 | udelay(1); | 505 | udelay(1); |
713 | } | 506 | } |
714 | 507 | ||
@@ -717,222 +510,95 @@ static int vp_forceupdate_scale_voltage(struct omap_vdd_info *vdd, | |||
717 | "to clear the TRANXDONE status\n", | 510 | "to clear the TRANXDONE status\n", |
718 | __func__, vdd->voltdm.name); | 511 | __func__, vdd->voltdm.name); |
719 | 512 | ||
720 | vpconfig = vdd->read_reg(mod, vdd->vp_offs.vpconfig); | 513 | vpconfig = vdd->read_reg(prm_mod_offs, vdd->vp_data->vpconfig); |
721 | /* Clear initVDD copy trigger bit */ | 514 | /* Clear initVDD copy trigger bit */ |
722 | vpconfig &= ~vdd->vp_reg.vpconfig_initvdd;; | 515 | vpconfig &= ~vdd->vp_data->vp_common->vpconfig_initvdd; |
723 | vdd->write_reg(vpconfig, mod, vdd->vp_offs.vpconfig); | 516 | vdd->write_reg(vpconfig, prm_mod_offs, vdd->vp_data->vpconfig); |
724 | /* Clear force bit */ | 517 | /* Clear force bit */ |
725 | vpconfig &= ~vdd->vp_reg.vpconfig_forceupdate; | 518 | vpconfig &= ~vdd->vp_data->vp_common->vpconfig_forceupdate; |
726 | vdd->write_reg(vpconfig, mod, vdd->vp_offs.vpconfig); | 519 | vdd->write_reg(vpconfig, prm_mod_offs, vdd->vp_data->vpconfig); |
727 | 520 | ||
728 | return 0; | 521 | return 0; |
729 | } | 522 | } |
730 | 523 | ||
731 | /* OMAP3 specific voltage init functions */ | 524 | static void __init omap3_vfsm_init(struct omap_vdd_info *vdd) |
525 | { | ||
526 | /* | ||
527 | * Voltage Manager FSM parameters init | ||
528 | * XXX This data should be passed in from the board file | ||
529 | */ | ||
530 | vdd->write_reg(OMAP3_CLKSETUP, prm_mod_offs, OMAP3_PRM_CLKSETUP_OFFSET); | ||
531 | vdd->write_reg(OMAP3_VOLTOFFSET, prm_mod_offs, | ||
532 | OMAP3_PRM_VOLTOFFSET_OFFSET); | ||
533 | vdd->write_reg(OMAP3_VOLTSETUP2, prm_mod_offs, | ||
534 | OMAP3_PRM_VOLTSETUP2_OFFSET); | ||
535 | } | ||
732 | 536 | ||
733 | /* | ||
734 | * Intializes the voltage controller registers with the PMIC and board | ||
735 | * specific parameters and voltage setup times for OMAP3. | ||
736 | */ | ||
737 | static void __init omap3_vc_init(struct omap_vdd_info *vdd) | 537 | static void __init omap3_vc_init(struct omap_vdd_info *vdd) |
738 | { | 538 | { |
739 | u32 vc_val; | ||
740 | u16 mod; | ||
741 | u8 on_vsel, onlp_vsel, ret_vsel, off_vsel; | ||
742 | static bool is_initialized; | 539 | static bool is_initialized; |
540 | u8 on_vsel, onlp_vsel, ret_vsel, off_vsel; | ||
541 | u32 vc_val; | ||
743 | 542 | ||
744 | if (!vdd->pmic_info || !vdd->pmic_info->uv_to_vsel) { | 543 | if (is_initialized) |
745 | pr_err("%s: PMIC info requried to configure vc for" | ||
746 | "vdd_%s not populated.Hence cannot initialize vc\n", | ||
747 | __func__, vdd->voltdm.name); | ||
748 | return; | ||
749 | } | ||
750 | |||
751 | if (!vdd->read_reg || !vdd->write_reg) { | ||
752 | pr_err("%s: No read/write API for accessing vdd_%s regs\n", | ||
753 | __func__, vdd->voltdm.name); | ||
754 | return; | 544 | return; |
755 | } | ||
756 | |||
757 | mod = vdd->vc_reg.prm_mod; | ||
758 | |||
759 | /* Set up the SMPS_SA(i2c slave address in VC */ | ||
760 | vc_val = vdd->read_reg(mod, vdd->vc_reg.smps_sa_reg); | ||
761 | vc_val &= ~vdd->vc_reg.smps_sa_mask; | ||
762 | vc_val |= vdd->pmic_info->i2c_slave_addr << vdd->vc_reg.smps_sa_shift; | ||
763 | vdd->write_reg(vc_val, mod, vdd->vc_reg.smps_sa_reg); | ||
764 | |||
765 | /* Setup the VOLRA(pmic reg addr) in VC */ | ||
766 | vc_val = vdd->read_reg(mod, vdd->vc_reg.smps_volra_reg); | ||
767 | vc_val &= ~vdd->vc_reg.smps_volra_mask; | ||
768 | vc_val |= vdd->pmic_info->pmic_reg << vdd->vc_reg.smps_volra_shift; | ||
769 | vdd->write_reg(vc_val, mod, vdd->vc_reg.smps_volra_reg); | ||
770 | |||
771 | /*Configure the setup times */ | ||
772 | vc_val = vdd->read_reg(mod, vdd->vc_reg.voltsetup_reg); | ||
773 | vc_val &= ~vdd->vc_reg.voltsetup_mask; | ||
774 | vc_val |= vdd->pmic_info->volt_setup_time << | ||
775 | vdd->vc_reg.voltsetup_shift; | ||
776 | vdd->write_reg(vc_val, mod, vdd->vc_reg.voltsetup_reg); | ||
777 | 545 | ||
778 | /* Set up the on, inactive, retention and off voltage */ | 546 | /* Set up the on, inactive, retention and off voltage */ |
779 | on_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->on_volt); | 547 | on_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->on_volt); |
780 | onlp_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->onlp_volt); | 548 | onlp_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->onlp_volt); |
781 | ret_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->ret_volt); | 549 | ret_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->ret_volt); |
782 | off_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->off_volt); | 550 | off_vsel = vdd->pmic_info->uv_to_vsel(vdd->pmic_info->off_volt); |
783 | vc_val = ((on_vsel << vdd->vc_reg.cmd_on_shift) | | 551 | vc_val = ((on_vsel << vdd->vc_data->vc_common->cmd_on_shift) | |
784 | (onlp_vsel << vdd->vc_reg.cmd_onlp_shift) | | 552 | (onlp_vsel << vdd->vc_data->vc_common->cmd_onlp_shift) | |
785 | (ret_vsel << vdd->vc_reg.cmd_ret_shift) | | 553 | (ret_vsel << vdd->vc_data->vc_common->cmd_ret_shift) | |
786 | (off_vsel << vdd->vc_reg.cmd_off_shift)); | 554 | (off_vsel << vdd->vc_data->vc_common->cmd_off_shift)); |
787 | vdd->write_reg(vc_val, mod, vdd->vc_reg.cmdval_reg); | 555 | vdd->write_reg(vc_val, prm_mod_offs, vdd->vc_data->cmdval_reg); |
788 | |||
789 | if (is_initialized) | ||
790 | return; | ||
791 | 556 | ||
792 | /* Generic VC parameters init */ | 557 | /* |
793 | vdd->write_reg(OMAP3430_CMD1_MASK | OMAP3430_RAV1_MASK, mod, | 558 | * Generic VC parameters init |
559 | * XXX This data should be abstracted out | ||
560 | */ | ||
561 | vdd->write_reg(OMAP3430_CMD1_MASK | OMAP3430_RAV1_MASK, prm_mod_offs, | ||
794 | OMAP3_PRM_VC_CH_CONF_OFFSET); | 562 | OMAP3_PRM_VC_CH_CONF_OFFSET); |
795 | vdd->write_reg(OMAP3430_MCODE_SHIFT | OMAP3430_HSEN_MASK, mod, | 563 | vdd->write_reg(OMAP3430_MCODE_SHIFT | OMAP3430_HSEN_MASK, prm_mod_offs, |
796 | OMAP3_PRM_VC_I2C_CFG_OFFSET); | 564 | OMAP3_PRM_VC_I2C_CFG_OFFSET); |
797 | vdd->write_reg(OMAP3_CLKSETUP, mod, OMAP3_PRM_CLKSETUP_OFFSET); | 565 | |
798 | vdd->write_reg(OMAP3_VOLTOFFSET, mod, OMAP3_PRM_VOLTOFFSET_OFFSET); | 566 | omap3_vfsm_init(vdd); |
799 | vdd->write_reg(OMAP3_VOLTSETUP2, mod, OMAP3_PRM_VOLTSETUP2_OFFSET); | 567 | |
800 | is_initialized = true; | 568 | is_initialized = true; |
801 | } | 569 | } |
802 | 570 | ||
803 | /* Sets up all the VDD related info for OMAP3 */ | 571 | |
804 | static int __init omap3_vdd_data_configure(struct omap_vdd_info *vdd) | 572 | /* OMAP4 specific voltage init functions */ |
573 | static void __init omap4_vc_init(struct omap_vdd_info *vdd) | ||
805 | { | 574 | { |
806 | struct clk *sys_ck; | 575 | static bool is_initialized; |
807 | u32 sys_clk_speed, timeout_val, waittime; | 576 | u32 vc_val; |
808 | 577 | ||
809 | if (!vdd->pmic_info) { | 578 | if (is_initialized) |
810 | pr_err("%s: PMIC info requried to configure vdd_%s not" | 579 | return; |
811 | "populated.Hence cannot initialize vdd_%s\n", | ||
812 | __func__, vdd->voltdm.name, vdd->voltdm.name); | ||
813 | return -EINVAL; | ||
814 | } | ||
815 | 580 | ||
816 | if (!strcmp(vdd->voltdm.name, "mpu")) { | 581 | /* TODO: Configure setup times and CMD_VAL values*/ |
817 | if (cpu_is_omap3630()) | ||
818 | vdd->volt_data = omap36xx_vddmpu_volt_data; | ||
819 | else | ||
820 | vdd->volt_data = omap34xx_vddmpu_volt_data; | ||
821 | |||
822 | vdd->vp_reg.tranxdone_status = OMAP3430_VP1_TRANXDONE_ST_MASK; | ||
823 | vdd->vc_reg.cmdval_reg = OMAP3_PRM_VC_CMD_VAL_0_OFFSET; | ||
824 | vdd->vc_reg.smps_sa_shift = OMAP3430_PRM_VC_SMPS_SA_SA0_SHIFT; | ||
825 | vdd->vc_reg.smps_sa_mask = OMAP3430_PRM_VC_SMPS_SA_SA0_MASK; | ||
826 | vdd->vc_reg.smps_volra_shift = OMAP3430_VOLRA0_SHIFT; | ||
827 | vdd->vc_reg.smps_volra_mask = OMAP3430_VOLRA0_MASK; | ||
828 | vdd->vc_reg.voltsetup_shift = OMAP3430_SETUP_TIME1_SHIFT; | ||
829 | vdd->vc_reg.voltsetup_mask = OMAP3430_SETUP_TIME1_MASK; | ||
830 | } else if (!strcmp(vdd->voltdm.name, "core")) { | ||
831 | if (cpu_is_omap3630()) | ||
832 | vdd->volt_data = omap36xx_vddcore_volt_data; | ||
833 | else | ||
834 | vdd->volt_data = omap34xx_vddcore_volt_data; | ||
835 | |||
836 | vdd->vp_reg.tranxdone_status = OMAP3430_VP2_TRANXDONE_ST_MASK; | ||
837 | vdd->vc_reg.cmdval_reg = OMAP3_PRM_VC_CMD_VAL_1_OFFSET; | ||
838 | vdd->vc_reg.smps_sa_shift = OMAP3430_PRM_VC_SMPS_SA_SA1_SHIFT; | ||
839 | vdd->vc_reg.smps_sa_mask = OMAP3430_PRM_VC_SMPS_SA_SA1_MASK; | ||
840 | vdd->vc_reg.smps_volra_shift = OMAP3430_VOLRA1_SHIFT; | ||
841 | vdd->vc_reg.smps_volra_mask = OMAP3430_VOLRA1_MASK; | ||
842 | vdd->vc_reg.voltsetup_shift = OMAP3430_SETUP_TIME2_SHIFT; | ||
843 | vdd->vc_reg.voltsetup_mask = OMAP3430_SETUP_TIME2_MASK; | ||
844 | } else { | ||
845 | pr_warning("%s: vdd_%s does not exisit in OMAP3\n", | ||
846 | __func__, vdd->voltdm.name); | ||
847 | return -EINVAL; | ||
848 | } | ||
849 | 582 | ||
850 | /* | 583 | /* |
851 | * Sys clk rate is require to calculate vp timeout value and | 584 | * Generic VC parameters init |
852 | * smpswaittimemin and smpswaittimemax. | 585 | * XXX This data should be abstracted out |
853 | */ | 586 | */ |
854 | sys_ck = clk_get(NULL, "sys_ck"); | 587 | vc_val = (OMAP4430_RAV_VDD_MPU_L_MASK | OMAP4430_CMD_VDD_MPU_L_MASK | |
855 | if (IS_ERR(sys_ck)) { | 588 | OMAP4430_RAV_VDD_IVA_L_MASK | OMAP4430_CMD_VDD_IVA_L_MASK | |
856 | pr_warning("%s: Could not get the sys clk to calculate" | 589 | OMAP4430_RAV_VDD_CORE_L_MASK | OMAP4430_CMD_VDD_CORE_L_MASK); |
857 | "various vdd_%s params\n", __func__, vdd->voltdm.name); | 590 | vdd->write_reg(vc_val, prm_mod_offs, OMAP4_PRM_VC_CFG_CHANNEL_OFFSET); |
858 | return -EINVAL; | ||
859 | } | ||
860 | sys_clk_speed = clk_get_rate(sys_ck); | ||
861 | clk_put(sys_ck); | ||
862 | /* Divide to avoid overflow */ | ||
863 | sys_clk_speed /= 1000; | ||
864 | |||
865 | /* Generic voltage parameters */ | ||
866 | vdd->curr_volt = 1200000; | ||
867 | vdd->ocp_mod = OCP_MOD; | ||
868 | vdd->prm_irqst_reg = OMAP3_PRM_IRQSTATUS_MPU_OFFSET; | ||
869 | vdd->read_reg = omap3_voltage_read_reg; | ||
870 | vdd->write_reg = omap3_voltage_write_reg; | ||
871 | vdd->volt_scale = vp_forceupdate_scale_voltage; | ||
872 | vdd->vp_enabled = false; | ||
873 | 591 | ||
874 | /* VC parameters */ | 592 | /* XXX These are magic numbers and do not belong! */ |
875 | vdd->vc_reg.prm_mod = OMAP3430_GR_MOD; | 593 | vc_val = (0x60 << OMAP4430_SCLL_SHIFT | 0x26 << OMAP4430_SCLH_SHIFT); |
876 | vdd->vc_reg.smps_sa_reg = OMAP3_PRM_VC_SMPS_SA_OFFSET; | 594 | vdd->write_reg(vc_val, prm_mod_offs, OMAP4_PRM_VC_CFG_I2C_CLK_OFFSET); |
877 | vdd->vc_reg.smps_volra_reg = OMAP3_PRM_VC_SMPS_VOL_RA_OFFSET; | ||
878 | vdd->vc_reg.bypass_val_reg = OMAP3_PRM_VC_BYPASS_VAL_OFFSET; | ||
879 | vdd->vc_reg.voltsetup_reg = OMAP3_PRM_VOLTSETUP1_OFFSET; | ||
880 | vdd->vc_reg.data_shift = OMAP3430_DATA_SHIFT; | ||
881 | vdd->vc_reg.slaveaddr_shift = OMAP3430_SLAVEADDR_SHIFT; | ||
882 | vdd->vc_reg.regaddr_shift = OMAP3430_REGADDR_SHIFT; | ||
883 | vdd->vc_reg.valid = OMAP3430_VALID_MASK; | ||
884 | vdd->vc_reg.cmd_on_shift = OMAP3430_VC_CMD_ON_SHIFT; | ||
885 | vdd->vc_reg.cmd_on_mask = OMAP3430_VC_CMD_ON_MASK; | ||
886 | vdd->vc_reg.cmd_onlp_shift = OMAP3430_VC_CMD_ONLP_SHIFT; | ||
887 | vdd->vc_reg.cmd_ret_shift = OMAP3430_VC_CMD_RET_SHIFT; | ||
888 | vdd->vc_reg.cmd_off_shift = OMAP3430_VC_CMD_OFF_SHIFT; | ||
889 | |||
890 | vdd->vp_reg.prm_mod = OMAP3430_GR_MOD; | ||
891 | |||
892 | /* VPCONFIG bit fields */ | ||
893 | vdd->vp_reg.vpconfig_erroroffset = (vdd->pmic_info->vp_erroroffset << | ||
894 | OMAP3430_ERROROFFSET_SHIFT); | ||
895 | vdd->vp_reg.vpconfig_errorgain_mask = OMAP3430_ERRORGAIN_MASK; | ||
896 | vdd->vp_reg.vpconfig_errorgain_shift = OMAP3430_ERRORGAIN_SHIFT; | ||
897 | vdd->vp_reg.vpconfig_initvoltage_shift = OMAP3430_INITVOLTAGE_SHIFT; | ||
898 | vdd->vp_reg.vpconfig_initvoltage_mask = OMAP3430_INITVOLTAGE_MASK; | ||
899 | vdd->vp_reg.vpconfig_timeouten = OMAP3430_TIMEOUTEN_MASK; | ||
900 | vdd->vp_reg.vpconfig_initvdd = OMAP3430_INITVDD_MASK; | ||
901 | vdd->vp_reg.vpconfig_forceupdate = OMAP3430_FORCEUPDATE_MASK; | ||
902 | vdd->vp_reg.vpconfig_vpenable = OMAP3430_VPENABLE_MASK; | ||
903 | |||
904 | /* VSTEPMIN VSTEPMAX bit fields */ | ||
905 | waittime = ((vdd->pmic_info->step_size / vdd->pmic_info->slew_rate) * | ||
906 | sys_clk_speed) / 1000; | ||
907 | vdd->vp_reg.vstepmin_smpswaittimemin = waittime; | ||
908 | vdd->vp_reg.vstepmax_smpswaittimemax = waittime; | ||
909 | vdd->vp_reg.vstepmin_stepmin = vdd->pmic_info->vp_vstepmin; | ||
910 | vdd->vp_reg.vstepmax_stepmax = vdd->pmic_info->vp_vstepmax; | ||
911 | vdd->vp_reg.vstepmin_smpswaittimemin_shift = | ||
912 | OMAP3430_SMPSWAITTIMEMIN_SHIFT; | ||
913 | vdd->vp_reg.vstepmax_smpswaittimemax_shift = | ||
914 | OMAP3430_SMPSWAITTIMEMAX_SHIFT; | ||
915 | vdd->vp_reg.vstepmin_stepmin_shift = OMAP3430_VSTEPMIN_SHIFT; | ||
916 | vdd->vp_reg.vstepmax_stepmax_shift = OMAP3430_VSTEPMAX_SHIFT; | ||
917 | |||
918 | /* VLIMITTO bit fields */ | ||
919 | timeout_val = (sys_clk_speed * vdd->pmic_info->vp_timeout_us) / 1000; | ||
920 | vdd->vp_reg.vlimitto_timeout = timeout_val; | ||
921 | vdd->vp_reg.vlimitto_vddmin = vdd->pmic_info->vp_vddmin; | ||
922 | vdd->vp_reg.vlimitto_vddmax = vdd->pmic_info->vp_vddmax; | ||
923 | vdd->vp_reg.vlimitto_vddmin_shift = OMAP3430_VDDMIN_SHIFT; | ||
924 | vdd->vp_reg.vlimitto_vddmax_shift = OMAP3430_VDDMAX_SHIFT; | ||
925 | vdd->vp_reg.vlimitto_timeout_shift = OMAP3430_TIMEOUT_SHIFT; | ||
926 | 595 | ||
927 | return 0; | 596 | is_initialized = true; |
928 | } | 597 | } |
929 | 598 | ||
930 | /* OMAP4 specific voltage init functions */ | 599 | static void __init omap_vc_init(struct omap_vdd_info *vdd) |
931 | static void __init omap4_vc_init(struct omap_vdd_info *vdd) | ||
932 | { | 600 | { |
933 | u32 vc_val; | 601 | u32 vc_val; |
934 | u16 mod; | ||
935 | static bool is_initialized; | ||
936 | 602 | ||
937 | if (!vdd->pmic_info || !vdd->pmic_info->uv_to_vsel) { | 603 | if (!vdd->pmic_info || !vdd->pmic_info->uv_to_vsel) { |
938 | pr_err("%s: PMIC info requried to configure vc for" | 604 | pr_err("%s: PMIC info requried to configure vc for" |
@@ -947,173 +613,61 @@ static void __init omap4_vc_init(struct omap_vdd_info *vdd) | |||
947 | return; | 613 | return; |
948 | } | 614 | } |
949 | 615 | ||
950 | mod = vdd->vc_reg.prm_mod; | ||
951 | |||
952 | /* Set up the SMPS_SA(i2c slave address in VC */ | 616 | /* Set up the SMPS_SA(i2c slave address in VC */ |
953 | vc_val = vdd->read_reg(mod, vdd->vc_reg.smps_sa_reg); | 617 | vc_val = vdd->read_reg(prm_mod_offs, |
954 | vc_val &= ~vdd->vc_reg.smps_sa_mask; | 618 | vdd->vc_data->vc_common->smps_sa_reg); |
955 | vc_val |= vdd->pmic_info->i2c_slave_addr << vdd->vc_reg.smps_sa_shift; | 619 | vc_val &= ~vdd->vc_data->smps_sa_mask; |
956 | vdd->write_reg(vc_val, mod, vdd->vc_reg.smps_sa_reg); | 620 | vc_val |= vdd->pmic_info->i2c_slave_addr << vdd->vc_data->smps_sa_shift; |
621 | vdd->write_reg(vc_val, prm_mod_offs, | ||
622 | vdd->vc_data->vc_common->smps_sa_reg); | ||
957 | 623 | ||
958 | /* Setup the VOLRA(pmic reg addr) in VC */ | 624 | /* Setup the VOLRA(pmic reg addr) in VC */ |
959 | vc_val = vdd->read_reg(mod, vdd->vc_reg.smps_volra_reg); | 625 | vc_val = vdd->read_reg(prm_mod_offs, |
960 | vc_val &= ~vdd->vc_reg.smps_volra_mask; | 626 | vdd->vc_data->vc_common->smps_volra_reg); |
961 | vc_val |= vdd->pmic_info->pmic_reg << vdd->vc_reg.smps_volra_shift; | 627 | vc_val &= ~vdd->vc_data->smps_volra_mask; |
962 | vdd->write_reg(vc_val, mod, vdd->vc_reg.smps_volra_reg); | 628 | vc_val |= vdd->pmic_info->pmic_reg << vdd->vc_data->smps_volra_shift; |
963 | 629 | vdd->write_reg(vc_val, prm_mod_offs, | |
964 | /* TODO: Configure setup times and CMD_VAL values*/ | 630 | vdd->vc_data->vc_common->smps_volra_reg); |
965 | 631 | ||
966 | if (is_initialized) | 632 | /* Configure the setup times */ |
967 | return; | 633 | vc_val = vdd->read_reg(prm_mod_offs, vdd->vfsm->voltsetup_reg); |
968 | 634 | vc_val &= ~vdd->vfsm->voltsetup_mask; | |
969 | /* Generic VC parameters init */ | 635 | vc_val |= vdd->pmic_info->volt_setup_time << |
970 | vc_val = (OMAP4430_RAV_VDD_MPU_L_MASK | OMAP4430_CMD_VDD_MPU_L_MASK | | 636 | vdd->vfsm->voltsetup_shift; |
971 | OMAP4430_RAV_VDD_IVA_L_MASK | OMAP4430_CMD_VDD_IVA_L_MASK | | 637 | vdd->write_reg(vc_val, prm_mod_offs, vdd->vfsm->voltsetup_reg); |
972 | OMAP4430_RAV_VDD_CORE_L_MASK | OMAP4430_CMD_VDD_CORE_L_MASK); | ||
973 | vdd->write_reg(vc_val, mod, OMAP4_PRM_VC_CFG_CHANNEL_OFFSET); | ||
974 | |||
975 | vc_val = (0x60 << OMAP4430_SCLL_SHIFT | 0x26 << OMAP4430_SCLH_SHIFT); | ||
976 | vdd->write_reg(vc_val, mod, OMAP4_PRM_VC_CFG_I2C_CLK_OFFSET); | ||
977 | 638 | ||
978 | is_initialized = true; | 639 | if (cpu_is_omap34xx()) |
640 | omap3_vc_init(vdd); | ||
641 | else if (cpu_is_omap44xx()) | ||
642 | omap4_vc_init(vdd); | ||
979 | } | 643 | } |
980 | 644 | ||
981 | /* Sets up all the VDD related info for OMAP4 */ | 645 | static int __init omap_vdd_data_configure(struct omap_vdd_info *vdd) |
982 | static int __init omap4_vdd_data_configure(struct omap_vdd_info *vdd) | ||
983 | { | 646 | { |
984 | struct clk *sys_ck; | 647 | int ret = -EINVAL; |
985 | u32 sys_clk_speed, timeout_val, waittime; | ||
986 | 648 | ||
987 | if (!vdd->pmic_info) { | 649 | if (!vdd->pmic_info) { |
988 | pr_err("%s: PMIC info requried to configure vdd_%s not" | 650 | pr_err("%s: PMIC info requried to configure vdd_%s not" |
989 | "populated.Hence cannot initialize vdd_%s\n", | 651 | "populated.Hence cannot initialize vdd_%s\n", |
990 | __func__, vdd->voltdm.name, vdd->voltdm.name); | 652 | __func__, vdd->voltdm.name, vdd->voltdm.name); |
991 | return -EINVAL; | 653 | goto ovdc_out; |
992 | } | 654 | } |
993 | 655 | ||
994 | if (!strcmp(vdd->voltdm.name, "mpu")) { | 656 | if (IS_ERR_VALUE(_config_common_vdd_data(vdd))) |
995 | vdd->volt_data = omap44xx_vdd_mpu_volt_data; | 657 | goto ovdc_out; |
996 | vdd->vp_reg.tranxdone_status = | ||
997 | OMAP4430_VP_MPU_TRANXDONE_ST_MASK; | ||
998 | vdd->vc_reg.cmdval_reg = OMAP4_PRM_VC_VAL_CMD_VDD_MPU_L_OFFSET; | ||
999 | vdd->vc_reg.smps_sa_shift = | ||
1000 | OMAP4430_SA_VDD_MPU_L_PRM_VC_SMPS_SA_SHIFT; | ||
1001 | vdd->vc_reg.smps_sa_mask = | ||
1002 | OMAP4430_SA_VDD_MPU_L_PRM_VC_SMPS_SA_MASK; | ||
1003 | vdd->vc_reg.smps_volra_shift = OMAP4430_VOLRA_VDD_MPU_L_SHIFT; | ||
1004 | vdd->vc_reg.smps_volra_mask = OMAP4430_VOLRA_VDD_MPU_L_MASK; | ||
1005 | vdd->vc_reg.voltsetup_reg = | ||
1006 | OMAP4_PRM_VOLTSETUP_MPU_RET_SLEEP_OFFSET; | ||
1007 | vdd->prm_irqst_reg = OMAP4_PRM_IRQSTATUS_MPU_2_OFFSET; | ||
1008 | } else if (!strcmp(vdd->voltdm.name, "core")) { | ||
1009 | vdd->volt_data = omap44xx_vdd_core_volt_data; | ||
1010 | vdd->vp_reg.tranxdone_status = | ||
1011 | OMAP4430_VP_CORE_TRANXDONE_ST_MASK; | ||
1012 | vdd->vc_reg.cmdval_reg = | ||
1013 | OMAP4_PRM_VC_VAL_CMD_VDD_CORE_L_OFFSET; | ||
1014 | vdd->vc_reg.smps_sa_shift = OMAP4430_SA_VDD_CORE_L_0_6_SHIFT; | ||
1015 | vdd->vc_reg.smps_sa_mask = OMAP4430_SA_VDD_CORE_L_0_6_MASK; | ||
1016 | vdd->vc_reg.smps_volra_shift = OMAP4430_VOLRA_VDD_CORE_L_SHIFT; | ||
1017 | vdd->vc_reg.smps_volra_mask = OMAP4430_VOLRA_VDD_CORE_L_MASK; | ||
1018 | vdd->vc_reg.voltsetup_reg = | ||
1019 | OMAP4_PRM_VOLTSETUP_CORE_RET_SLEEP_OFFSET; | ||
1020 | vdd->prm_irqst_reg = OMAP4_PRM_IRQSTATUS_MPU_OFFSET; | ||
1021 | } else if (!strcmp(vdd->voltdm.name, "iva")) { | ||
1022 | vdd->volt_data = omap44xx_vdd_iva_volt_data; | ||
1023 | vdd->vp_reg.tranxdone_status = | ||
1024 | OMAP4430_VP_IVA_TRANXDONE_ST_MASK; | ||
1025 | vdd->vc_reg.cmdval_reg = OMAP4_PRM_VC_VAL_CMD_VDD_IVA_L_OFFSET; | ||
1026 | vdd->vc_reg.smps_sa_shift = | ||
1027 | OMAP4430_SA_VDD_IVA_L_PRM_VC_SMPS_SA_SHIFT; | ||
1028 | vdd->vc_reg.smps_sa_mask = | ||
1029 | OMAP4430_SA_VDD_IVA_L_PRM_VC_SMPS_SA_MASK; | ||
1030 | vdd->vc_reg.smps_volra_shift = OMAP4430_VOLRA_VDD_IVA_L_SHIFT; | ||
1031 | vdd->vc_reg.smps_volra_mask = OMAP4430_VOLRA_VDD_IVA_L_MASK; | ||
1032 | vdd->vc_reg.voltsetup_reg = | ||
1033 | OMAP4_PRM_VOLTSETUP_IVA_RET_SLEEP_OFFSET; | ||
1034 | vdd->prm_irqst_reg = OMAP4_PRM_IRQSTATUS_MPU_OFFSET; | ||
1035 | } else { | ||
1036 | pr_warning("%s: vdd_%s does not exisit in OMAP4\n", | ||
1037 | __func__, vdd->voltdm.name); | ||
1038 | return -EINVAL; | ||
1039 | } | ||
1040 | 658 | ||
1041 | /* | 659 | if (cpu_is_omap34xx()) { |
1042 | * Sys clk rate is require to calculate vp timeout value and | 660 | vdd->read_reg = omap3_voltage_read_reg; |
1043 | * smpswaittimemin and smpswaittimemax. | 661 | vdd->write_reg = omap3_voltage_write_reg; |
1044 | */ | 662 | ret = 0; |
1045 | sys_ck = clk_get(NULL, "sys_clkin_ck"); | 663 | } else if (cpu_is_omap44xx()) { |
1046 | if (IS_ERR(sys_ck)) { | 664 | vdd->read_reg = omap4_voltage_read_reg; |
1047 | pr_warning("%s: Could not get the sys clk to calculate" | 665 | vdd->write_reg = omap4_voltage_write_reg; |
1048 | "various vdd_%s params\n", __func__, vdd->voltdm.name); | 666 | ret = 0; |
1049 | return -EINVAL; | ||
1050 | } | 667 | } |
1051 | sys_clk_speed = clk_get_rate(sys_ck); | ||
1052 | clk_put(sys_ck); | ||
1053 | /* Divide to avoid overflow */ | ||
1054 | sys_clk_speed /= 1000; | ||
1055 | |||
1056 | /* Generic voltage parameters */ | ||
1057 | vdd->curr_volt = 1200000; | ||
1058 | vdd->ocp_mod = OMAP4430_PRM_OCP_SOCKET_INST; | ||
1059 | vdd->read_reg = omap4_voltage_read_reg; | ||
1060 | vdd->write_reg = omap4_voltage_write_reg; | ||
1061 | vdd->volt_scale = vp_forceupdate_scale_voltage; | ||
1062 | vdd->vp_enabled = false; | ||
1063 | 668 | ||
1064 | /* VC parameters */ | 669 | ovdc_out: |
1065 | vdd->vc_reg.prm_mod = OMAP4430_PRM_DEVICE_INST; | 670 | return ret; |
1066 | vdd->vc_reg.smps_sa_reg = OMAP4_PRM_VC_SMPS_SA_OFFSET; | ||
1067 | vdd->vc_reg.smps_volra_reg = OMAP4_PRM_VC_VAL_SMPS_RA_VOL_OFFSET; | ||
1068 | vdd->vc_reg.bypass_val_reg = OMAP4_PRM_VC_VAL_BYPASS_OFFSET; | ||
1069 | vdd->vc_reg.data_shift = OMAP4430_DATA_SHIFT; | ||
1070 | vdd->vc_reg.slaveaddr_shift = OMAP4430_SLAVEADDR_SHIFT; | ||
1071 | vdd->vc_reg.regaddr_shift = OMAP4430_REGADDR_SHIFT; | ||
1072 | vdd->vc_reg.valid = OMAP4430_VALID_MASK; | ||
1073 | vdd->vc_reg.cmd_on_shift = OMAP4430_ON_SHIFT; | ||
1074 | vdd->vc_reg.cmd_on_mask = OMAP4430_ON_MASK; | ||
1075 | vdd->vc_reg.cmd_onlp_shift = OMAP4430_ONLP_SHIFT; | ||
1076 | vdd->vc_reg.cmd_ret_shift = OMAP4430_RET_SHIFT; | ||
1077 | vdd->vc_reg.cmd_off_shift = OMAP4430_OFF_SHIFT; | ||
1078 | |||
1079 | vdd->vp_reg.prm_mod = OMAP4430_PRM_DEVICE_INST; | ||
1080 | |||
1081 | /* VPCONFIG bit fields */ | ||
1082 | vdd->vp_reg.vpconfig_erroroffset = (vdd->pmic_info->vp_erroroffset << | ||
1083 | OMAP4430_ERROROFFSET_SHIFT); | ||
1084 | vdd->vp_reg.vpconfig_errorgain_mask = OMAP4430_ERRORGAIN_MASK; | ||
1085 | vdd->vp_reg.vpconfig_errorgain_shift = OMAP4430_ERRORGAIN_SHIFT; | ||
1086 | vdd->vp_reg.vpconfig_initvoltage_shift = OMAP4430_INITVOLTAGE_SHIFT; | ||
1087 | vdd->vp_reg.vpconfig_initvoltage_mask = OMAP4430_INITVOLTAGE_MASK; | ||
1088 | vdd->vp_reg.vpconfig_timeouten = OMAP4430_TIMEOUTEN_MASK; | ||
1089 | vdd->vp_reg.vpconfig_initvdd = OMAP4430_INITVDD_MASK; | ||
1090 | vdd->vp_reg.vpconfig_forceupdate = OMAP4430_FORCEUPDATE_MASK; | ||
1091 | vdd->vp_reg.vpconfig_vpenable = OMAP4430_VPENABLE_MASK; | ||
1092 | |||
1093 | /* VSTEPMIN VSTEPMAX bit fields */ | ||
1094 | waittime = ((vdd->pmic_info->step_size / vdd->pmic_info->slew_rate) * | ||
1095 | sys_clk_speed) / 1000; | ||
1096 | vdd->vp_reg.vstepmin_smpswaittimemin = waittime; | ||
1097 | vdd->vp_reg.vstepmax_smpswaittimemax = waittime; | ||
1098 | vdd->vp_reg.vstepmin_stepmin = vdd->pmic_info->vp_vstepmin; | ||
1099 | vdd->vp_reg.vstepmax_stepmax = vdd->pmic_info->vp_vstepmax; | ||
1100 | vdd->vp_reg.vstepmin_smpswaittimemin_shift = | ||
1101 | OMAP4430_SMPSWAITTIMEMIN_SHIFT; | ||
1102 | vdd->vp_reg.vstepmax_smpswaittimemax_shift = | ||
1103 | OMAP4430_SMPSWAITTIMEMAX_SHIFT; | ||
1104 | vdd->vp_reg.vstepmin_stepmin_shift = OMAP4430_VSTEPMIN_SHIFT; | ||
1105 | vdd->vp_reg.vstepmax_stepmax_shift = OMAP4430_VSTEPMAX_SHIFT; | ||
1106 | |||
1107 | /* VLIMITTO bit fields */ | ||
1108 | timeout_val = (sys_clk_speed * vdd->pmic_info->vp_timeout_us) / 1000; | ||
1109 | vdd->vp_reg.vlimitto_timeout = timeout_val; | ||
1110 | vdd->vp_reg.vlimitto_vddmin = vdd->pmic_info->vp_vddmin; | ||
1111 | vdd->vp_reg.vlimitto_vddmax = vdd->pmic_info->vp_vddmax; | ||
1112 | vdd->vp_reg.vlimitto_vddmin_shift = OMAP4430_VDDMIN_SHIFT; | ||
1113 | vdd->vp_reg.vlimitto_vddmax_shift = OMAP4430_VDDMAX_SHIFT; | ||
1114 | vdd->vp_reg.vlimitto_timeout_shift = OMAP4430_TIMEOUT_SHIFT; | ||
1115 | |||
1116 | return 0; | ||
1117 | } | 671 | } |
1118 | 672 | ||
1119 | /* Public functions */ | 673 | /* Public functions */ |
@@ -1161,8 +715,7 @@ unsigned long omap_vp_get_curr_volt(struct voltagedomain *voltdm) | |||
1161 | return 0; | 715 | return 0; |
1162 | } | 716 | } |
1163 | 717 | ||
1164 | curr_vsel = vdd->read_reg(vdd->vp_reg.prm_mod, | 718 | curr_vsel = vdd->read_reg(prm_mod_offs, vdd->vp_data->voltage); |
1165 | vdd->vp_offs.voltage); | ||
1166 | 719 | ||
1167 | if (!vdd->pmic_info || !vdd->pmic_info->vsel_to_uv) { | 720 | if (!vdd->pmic_info || !vdd->pmic_info->vsel_to_uv) { |
1168 | pr_warning("%s: PMIC function to convert vsel to voltage" | 721 | pr_warning("%s: PMIC function to convert vsel to voltage" |
@@ -1184,7 +737,6 @@ void omap_vp_enable(struct voltagedomain *voltdm) | |||
1184 | { | 737 | { |
1185 | struct omap_vdd_info *vdd; | 738 | struct omap_vdd_info *vdd; |
1186 | u32 vpconfig; | 739 | u32 vpconfig; |
1187 | u16 mod; | ||
1188 | 740 | ||
1189 | if (!voltdm || IS_ERR(voltdm)) { | 741 | if (!voltdm || IS_ERR(voltdm)) { |
1190 | pr_warning("%s: VDD specified does not exist!\n", __func__); | 742 | pr_warning("%s: VDD specified does not exist!\n", __func__); |
@@ -1198,8 +750,6 @@ void omap_vp_enable(struct voltagedomain *voltdm) | |||
1198 | return; | 750 | return; |
1199 | } | 751 | } |
1200 | 752 | ||
1201 | mod = vdd->vp_reg.prm_mod; | ||
1202 | |||
1203 | /* If VP is already enabled, do nothing. Return */ | 753 | /* If VP is already enabled, do nothing. Return */ |
1204 | if (vdd->vp_enabled) | 754 | if (vdd->vp_enabled) |
1205 | return; | 755 | return; |
@@ -1207,9 +757,9 @@ void omap_vp_enable(struct voltagedomain *voltdm) | |||
1207 | vp_latch_vsel(vdd); | 757 | vp_latch_vsel(vdd); |
1208 | 758 | ||
1209 | /* Enable VP */ | 759 | /* Enable VP */ |
1210 | vpconfig = vdd->read_reg(mod, vdd->vp_offs.vpconfig); | 760 | vpconfig = vdd->read_reg(prm_mod_offs, vdd->vp_data->vpconfig); |
1211 | vpconfig |= vdd->vp_reg.vpconfig_vpenable; | 761 | vpconfig |= vdd->vp_data->vp_common->vpconfig_vpenable; |
1212 | vdd->write_reg(vpconfig, mod, vdd->vp_offs.vpconfig); | 762 | vdd->write_reg(vpconfig, prm_mod_offs, vdd->vp_data->vpconfig); |
1213 | vdd->vp_enabled = true; | 763 | vdd->vp_enabled = true; |
1214 | } | 764 | } |
1215 | 765 | ||
@@ -1224,7 +774,6 @@ void omap_vp_disable(struct voltagedomain *voltdm) | |||
1224 | { | 774 | { |
1225 | struct omap_vdd_info *vdd; | 775 | struct omap_vdd_info *vdd; |
1226 | u32 vpconfig; | 776 | u32 vpconfig; |
1227 | u16 mod; | ||
1228 | int timeout; | 777 | int timeout; |
1229 | 778 | ||
1230 | if (!voltdm || IS_ERR(voltdm)) { | 779 | if (!voltdm || IS_ERR(voltdm)) { |
@@ -1239,8 +788,6 @@ void omap_vp_disable(struct voltagedomain *voltdm) | |||
1239 | return; | 788 | return; |
1240 | } | 789 | } |
1241 | 790 | ||
1242 | mod = vdd->vp_reg.prm_mod; | ||
1243 | |||
1244 | /* If VP is already disabled, do nothing. Return */ | 791 | /* If VP is already disabled, do nothing. Return */ |
1245 | if (!vdd->vp_enabled) { | 792 | if (!vdd->vp_enabled) { |
1246 | pr_warning("%s: Trying to disable VP for vdd_%s when" | 793 | pr_warning("%s: Trying to disable VP for vdd_%s when" |
@@ -1249,14 +796,14 @@ void omap_vp_disable(struct voltagedomain *voltdm) | |||
1249 | } | 796 | } |
1250 | 797 | ||
1251 | /* Disable VP */ | 798 | /* Disable VP */ |
1252 | vpconfig = vdd->read_reg(mod, vdd->vp_offs.vpconfig); | 799 | vpconfig = vdd->read_reg(prm_mod_offs, vdd->vp_data->vpconfig); |
1253 | vpconfig &= ~vdd->vp_reg.vpconfig_vpenable; | 800 | vpconfig &= ~vdd->vp_data->vp_common->vpconfig_vpenable; |
1254 | vdd->write_reg(vpconfig, mod, vdd->vp_offs.vpconfig); | 801 | vdd->write_reg(vpconfig, prm_mod_offs, vdd->vp_data->vpconfig); |
1255 | 802 | ||
1256 | /* | 803 | /* |
1257 | * Wait for VP idle Typical latency is <2us. Maximum latency is ~100us | 804 | * Wait for VP idle Typical latency is <2us. Maximum latency is ~100us |
1258 | */ | 805 | */ |
1259 | omap_test_timeout((vdd->read_reg(mod, vdd->vp_offs.vstatus)), | 806 | omap_test_timeout((vdd->read_reg(prm_mod_offs, vdd->vp_data->vstatus)), |
1260 | VP_IDLE_TIMEOUT, timeout); | 807 | VP_IDLE_TIMEOUT, timeout); |
1261 | 808 | ||
1262 | if (timeout >= VP_IDLE_TIMEOUT) | 809 | if (timeout >= VP_IDLE_TIMEOUT) |
@@ -1509,8 +1056,8 @@ struct voltagedomain *omap_voltage_domain_lookup(char *name) | |||
1509 | } | 1056 | } |
1510 | 1057 | ||
1511 | for (i = 0; i < nr_scalable_vdd; i++) { | 1058 | for (i = 0; i < nr_scalable_vdd; i++) { |
1512 | if (!(strcmp(name, vdd_info[i].voltdm.name))) | 1059 | if (!(strcmp(name, vdd_info[i]->voltdm.name))) |
1513 | return &vdd_info[i].voltdm; | 1060 | return &vdd_info[i]->voltdm; |
1514 | } | 1061 | } |
1515 | 1062 | ||
1516 | return ERR_PTR(-EINVAL); | 1063 | return ERR_PTR(-EINVAL); |
@@ -1538,35 +1085,24 @@ int __init omap_voltage_late_init(void) | |||
1538 | pr_err("%s: Unable to create voltage debugfs main dir\n", | 1085 | pr_err("%s: Unable to create voltage debugfs main dir\n", |
1539 | __func__); | 1086 | __func__); |
1540 | for (i = 0; i < nr_scalable_vdd; i++) { | 1087 | for (i = 0; i < nr_scalable_vdd; i++) { |
1541 | if (vdd_data_configure(&vdd_info[i])) | 1088 | if (omap_vdd_data_configure(vdd_info[i])) |
1542 | continue; | 1089 | continue; |
1543 | vc_init(&vdd_info[i]); | 1090 | omap_vc_init(vdd_info[i]); |
1544 | vp_init(&vdd_info[i]); | 1091 | vp_init(vdd_info[i]); |
1545 | vdd_debugfs_init(&vdd_info[i]); | 1092 | vdd_debugfs_init(vdd_info[i]); |
1546 | } | 1093 | } |
1547 | 1094 | ||
1548 | return 0; | 1095 | return 0; |
1549 | } | 1096 | } |
1550 | 1097 | ||
1551 | /** | 1098 | /* XXX document */ |
1552 | * omap_voltage_early_init()- Volatage driver early init | 1099 | int __init omap_voltage_early_init(s16 prm_mod, s16 prm_irqst_ocp_mod, |
1553 | */ | 1100 | struct omap_vdd_info *omap_vdd_array[], |
1554 | static int __init omap_voltage_early_init(void) | 1101 | u8 omap_vdd_count) |
1555 | { | 1102 | { |
1556 | if (cpu_is_omap34xx()) { | 1103 | prm_mod_offs = prm_mod; |
1557 | vdd_info = omap3_vdd_info; | 1104 | prm_irqst_ocp_mod_offs = prm_irqst_ocp_mod; |
1558 | nr_scalable_vdd = OMAP3_NR_SCALABLE_VDD; | 1105 | vdd_info = omap_vdd_array; |
1559 | vc_init = omap3_vc_init; | 1106 | nr_scalable_vdd = omap_vdd_count; |
1560 | vdd_data_configure = omap3_vdd_data_configure; | ||
1561 | } else if (cpu_is_omap44xx()) { | ||
1562 | vdd_info = omap4_vdd_info; | ||
1563 | nr_scalable_vdd = OMAP4_NR_SCALABLE_VDD; | ||
1564 | vc_init = omap4_vc_init; | ||
1565 | vdd_data_configure = omap4_vdd_data_configure; | ||
1566 | } else { | ||
1567 | pr_warning("%s: voltage driver support not added\n", __func__); | ||
1568 | } | ||
1569 | |||
1570 | return 0; | 1107 | return 0; |
1571 | } | 1108 | } |
1572 | core_initcall(omap_voltage_early_init); | ||
diff --git a/arch/arm/plat-omap/include/plat/voltage.h b/arch/arm/mach-omap2/voltage.h index 5bd204e55c32..e9f5408244e0 100644 --- a/arch/arm/plat-omap/include/plat/voltage.h +++ b/arch/arm/mach-omap2/voltage.h | |||
@@ -16,6 +16,10 @@ | |||
16 | 16 | ||
17 | #include <linux/err.h> | 17 | #include <linux/err.h> |
18 | 18 | ||
19 | #include "vc.h" | ||
20 | #include "vp.h" | ||
21 | |||
22 | /* XXX document */ | ||
19 | #define VOLTSCALE_VPFORCEUPDATE 1 | 23 | #define VOLTSCALE_VPFORCEUPDATE 1 |
20 | #define VOLTSCALE_VCBYPASS 2 | 24 | #define VOLTSCALE_VCBYPASS 2 |
21 | 25 | ||
@@ -27,36 +31,22 @@ | |||
27 | #define OMAP3_VOLTOFFSET 0xff | 31 | #define OMAP3_VOLTOFFSET 0xff |
28 | #define OMAP3_VOLTSETUP2 0xff | 32 | #define OMAP3_VOLTSETUP2 0xff |
29 | 33 | ||
30 | /* Voltage value defines */ | 34 | /** |
31 | #define OMAP3430_VDD_MPU_OPP1_UV 975000 | 35 | * struct omap_vfsm_instance_data - per-voltage manager FSM register/bitfield |
32 | #define OMAP3430_VDD_MPU_OPP2_UV 1075000 | 36 | * data |
33 | #define OMAP3430_VDD_MPU_OPP3_UV 1200000 | 37 | * @voltsetup_mask: SETUP_TIME* bitmask in the PRM_VOLTSETUP* register |
34 | #define OMAP3430_VDD_MPU_OPP4_UV 1270000 | 38 | * @voltsetup_reg: register offset of PRM_VOLTSETUP from PRM base |
35 | #define OMAP3430_VDD_MPU_OPP5_UV 1350000 | 39 | * @voltsetup_shift: SETUP_TIME* field shift in the PRM_VOLTSETUP* register |
36 | 40 | * | |
37 | #define OMAP3430_VDD_CORE_OPP1_UV 975000 | 41 | * XXX What about VOLTOFFSET/VOLTCTRL? |
38 | #define OMAP3430_VDD_CORE_OPP2_UV 1050000 | 42 | * XXX It is not necessary to have both a _mask and a _shift for the same |
39 | #define OMAP3430_VDD_CORE_OPP3_UV 1150000 | 43 | * bitfield - remove one! |
40 | 44 | */ | |
41 | #define OMAP3630_VDD_MPU_OPP50_UV 1012500 | 45 | struct omap_vfsm_instance_data { |
42 | #define OMAP3630_VDD_MPU_OPP100_UV 1200000 | 46 | u32 voltsetup_mask; |
43 | #define OMAP3630_VDD_MPU_OPP120_UV 1325000 | 47 | u8 voltsetup_reg; |
44 | #define OMAP3630_VDD_MPU_OPP1G_UV 1375000 | 48 | u8 voltsetup_shift; |
45 | 49 | }; | |
46 | #define OMAP3630_VDD_CORE_OPP50_UV 1000000 | ||
47 | #define OMAP3630_VDD_CORE_OPP100_UV 1200000 | ||
48 | |||
49 | #define OMAP4430_VDD_MPU_OPP50_UV 930000 | ||
50 | #define OMAP4430_VDD_MPU_OPP100_UV 1100000 | ||
51 | #define OMAP4430_VDD_MPU_OPPTURBO_UV 1260000 | ||
52 | #define OMAP4430_VDD_MPU_OPPNITRO_UV 1350000 | ||
53 | |||
54 | #define OMAP4430_VDD_IVA_OPP50_UV 930000 | ||
55 | #define OMAP4430_VDD_IVA_OPP100_UV 1100000 | ||
56 | #define OMAP4430_VDD_IVA_OPPTURBO_UV 1260000 | ||
57 | |||
58 | #define OMAP4430_VDD_CORE_OPP50_UV 930000 | ||
59 | #define OMAP4430_VDD_CORE_OPP100_UV 1100000 | ||
60 | 50 | ||
61 | /** | 51 | /** |
62 | * struct voltagedomain - omap voltage domain global structure. | 52 | * struct voltagedomain - omap voltage domain global structure. |
@@ -113,6 +103,42 @@ struct omap_volt_pmic_info { | |||
113 | u8 (*uv_to_vsel) (unsigned long uV); | 103 | u8 (*uv_to_vsel) (unsigned long uV); |
114 | }; | 104 | }; |
115 | 105 | ||
106 | /** | ||
107 | * omap_vdd_info - Per Voltage Domain info | ||
108 | * | ||
109 | * @volt_data : voltage table having the distinct voltages supported | ||
110 | * by the domain and other associated per voltage data. | ||
111 | * @pmic_info : pmic specific parameters which should be populted by | ||
112 | * the pmic drivers. | ||
113 | * @vp_data : the register values, shifts, masks for various | ||
114 | * vp registers | ||
115 | * @vp_rt_data : VP data derived at runtime, not predefined | ||
116 | * @vc_data : structure containing various various vc registers, | ||
117 | * shifts, masks etc. | ||
118 | * @vfsm : voltage manager FSM data | ||
119 | * @voltdm : pointer to the voltage domain structure | ||
120 | * @debug_dir : debug directory for this voltage domain. | ||
121 | * @curr_volt : current voltage for this vdd. | ||
122 | * @vp_enabled : flag to keep track of whether vp is enabled or not | ||
123 | * @volt_scale : API to scale the voltage of the vdd. | ||
124 | */ | ||
125 | struct omap_vdd_info { | ||
126 | struct omap_volt_data *volt_data; | ||
127 | struct omap_volt_pmic_info *pmic_info; | ||
128 | struct omap_vp_instance_data *vp_data; | ||
129 | struct omap_vp_runtime_data vp_rt_data; | ||
130 | struct omap_vc_instance_data *vc_data; | ||
131 | const struct omap_vfsm_instance_data *vfsm; | ||
132 | struct voltagedomain voltdm; | ||
133 | struct dentry *debug_dir; | ||
134 | u32 curr_volt; | ||
135 | bool vp_enabled; | ||
136 | u32 (*read_reg) (u16 mod, u8 offset); | ||
137 | void (*write_reg) (u32 val, u16 mod, u8 offset); | ||
138 | int (*volt_scale) (struct omap_vdd_info *vdd, | ||
139 | unsigned long target_volt); | ||
140 | }; | ||
141 | |||
116 | unsigned long omap_vp_get_curr_volt(struct voltagedomain *voltdm); | 142 | unsigned long omap_vp_get_curr_volt(struct voltagedomain *voltdm); |
117 | void omap_vp_enable(struct voltagedomain *voltdm); | 143 | void omap_vp_enable(struct voltagedomain *voltdm); |
118 | void omap_vp_disable(struct voltagedomain *voltdm); | 144 | void omap_vp_disable(struct voltagedomain *voltdm); |
@@ -125,6 +151,9 @@ struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm, | |||
125 | unsigned long volt); | 151 | unsigned long volt); |
126 | unsigned long omap_voltage_get_nom_volt(struct voltagedomain *voltdm); | 152 | unsigned long omap_voltage_get_nom_volt(struct voltagedomain *voltdm); |
127 | struct dentry *omap_voltage_get_dbgdir(struct voltagedomain *voltdm); | 153 | struct dentry *omap_voltage_get_dbgdir(struct voltagedomain *voltdm); |
154 | int __init omap_voltage_early_init(s16 prm_mod, s16 prm_irqst_mod, | ||
155 | struct omap_vdd_info *omap_vdd_array[], | ||
156 | u8 omap_vdd_count); | ||
128 | #ifdef CONFIG_PM | 157 | #ifdef CONFIG_PM |
129 | int omap_voltage_register_pmic(struct voltagedomain *voltdm, | 158 | int omap_voltage_register_pmic(struct voltagedomain *voltdm, |
130 | struct omap_volt_pmic_info *pmic_info); | 159 | struct omap_volt_pmic_info *pmic_info); |
diff --git a/arch/arm/mach-omap2/voltagedomains3xxx_data.c b/arch/arm/mach-omap2/voltagedomains3xxx_data.c new file mode 100644 index 000000000000..def230fd2fde --- /dev/null +++ b/arch/arm/mach-omap2/voltagedomains3xxx_data.c | |||
@@ -0,0 +1,95 @@ | |||
1 | /* | ||
2 | * OMAP3 voltage domain data | ||
3 | * | ||
4 | * Copyright (C) 2007, 2010 Texas Instruments, Inc. | ||
5 | * Rajendra Nayak <rnayak@ti.com> | ||
6 | * Lesly A M <x0080970@ti.com> | ||
7 | * Thara Gopinath <thara@ti.com> | ||
8 | * | ||
9 | * Copyright (C) 2008, 2011 Nokia Corporation | ||
10 | * Kalle Jokiniemi | ||
11 | * Paul Walmsley | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify | ||
14 | * it under the terms of the GNU General Public License version 2 as | ||
15 | * published by the Free Software Foundation. | ||
16 | */ | ||
17 | #include <linux/kernel.h> | ||
18 | #include <linux/err.h> | ||
19 | #include <linux/init.h> | ||
20 | |||
21 | #include <plat/common.h> | ||
22 | #include <plat/cpu.h> | ||
23 | |||
24 | #include "prm-regbits-34xx.h" | ||
25 | #include "omap_opp_data.h" | ||
26 | #include "voltage.h" | ||
27 | #include "vc.h" | ||
28 | #include "vp.h" | ||
29 | |||
30 | /* | ||
31 | * VDD data | ||
32 | */ | ||
33 | |||
34 | static const struct omap_vfsm_instance_data omap3_vdd1_vfsm_data = { | ||
35 | .voltsetup_reg = OMAP3_PRM_VOLTSETUP1_OFFSET, | ||
36 | .voltsetup_shift = OMAP3430_SETUP_TIME1_SHIFT, | ||
37 | .voltsetup_mask = OMAP3430_SETUP_TIME1_MASK, | ||
38 | }; | ||
39 | |||
40 | static struct omap_vdd_info omap3_vdd1_info = { | ||
41 | .vp_data = &omap3_vp1_data, | ||
42 | .vc_data = &omap3_vc1_data, | ||
43 | .vfsm = &omap3_vdd1_vfsm_data, | ||
44 | .voltdm = { | ||
45 | .name = "mpu", | ||
46 | }, | ||
47 | }; | ||
48 | |||
49 | static const struct omap_vfsm_instance_data omap3_vdd2_vfsm_data = { | ||
50 | .voltsetup_reg = OMAP3_PRM_VOLTSETUP1_OFFSET, | ||
51 | .voltsetup_shift = OMAP3430_SETUP_TIME2_SHIFT, | ||
52 | .voltsetup_mask = OMAP3430_SETUP_TIME2_MASK, | ||
53 | }; | ||
54 | |||
55 | static struct omap_vdd_info omap3_vdd2_info = { | ||
56 | .vp_data = &omap3_vp2_data, | ||
57 | .vc_data = &omap3_vc2_data, | ||
58 | .vfsm = &omap3_vdd2_vfsm_data, | ||
59 | .voltdm = { | ||
60 | .name = "core", | ||
61 | }, | ||
62 | }; | ||
63 | |||
64 | /* OMAP3 VDD structures */ | ||
65 | static struct omap_vdd_info *omap3_vdd_info[] = { | ||
66 | &omap3_vdd1_info, | ||
67 | &omap3_vdd2_info, | ||
68 | }; | ||
69 | |||
70 | /* OMAP3 specific voltage init functions */ | ||
71 | static int __init omap3xxx_voltage_early_init(void) | ||
72 | { | ||
73 | s16 prm_mod = OMAP3430_GR_MOD; | ||
74 | s16 prm_irqst_ocp_mod = OCP_MOD; | ||
75 | |||
76 | if (!cpu_is_omap34xx()) | ||
77 | return 0; | ||
78 | |||
79 | /* | ||
80 | * XXX Will depend on the process, validation, and binning | ||
81 | * for the currently-running IC | ||
82 | */ | ||
83 | if (cpu_is_omap3630()) { | ||
84 | omap3_vdd1_info.volt_data = omap36xx_vddmpu_volt_data; | ||
85 | omap3_vdd2_info.volt_data = omap36xx_vddcore_volt_data; | ||
86 | } else { | ||
87 | omap3_vdd1_info.volt_data = omap34xx_vddmpu_volt_data; | ||
88 | omap3_vdd2_info.volt_data = omap34xx_vddcore_volt_data; | ||
89 | } | ||
90 | |||
91 | return omap_voltage_early_init(prm_mod, prm_irqst_ocp_mod, | ||
92 | omap3_vdd_info, | ||
93 | ARRAY_SIZE(omap3_vdd_info)); | ||
94 | }; | ||
95 | core_initcall(omap3xxx_voltage_early_init); | ||
diff --git a/arch/arm/mach-omap2/voltagedomains44xx_data.c b/arch/arm/mach-omap2/voltagedomains44xx_data.c new file mode 100644 index 000000000000..cb64996de0e1 --- /dev/null +++ b/arch/arm/mach-omap2/voltagedomains44xx_data.c | |||
@@ -0,0 +1,102 @@ | |||
1 | /* | ||
2 | * OMAP3/OMAP4 Voltage Management Routines | ||
3 | * | ||
4 | * Author: Thara Gopinath <thara@ti.com> | ||
5 | * | ||
6 | * Copyright (C) 2007 Texas Instruments, Inc. | ||
7 | * Rajendra Nayak <rnayak@ti.com> | ||
8 | * Lesly A M <x0080970@ti.com> | ||
9 | * | ||
10 | * Copyright (C) 2008 Nokia Corporation | ||
11 | * Kalle Jokiniemi | ||
12 | * | ||
13 | * Copyright (C) 2010 Texas Instruments, Inc. | ||
14 | * Thara Gopinath <thara@ti.com> | ||
15 | * | ||
16 | * This program is free software; you can redistribute it and/or modify | ||
17 | * it under the terms of the GNU General Public License version 2 as | ||
18 | * published by the Free Software Foundation. | ||
19 | */ | ||
20 | #include <linux/kernel.h> | ||
21 | #include <linux/err.h> | ||
22 | #include <linux/init.h> | ||
23 | |||
24 | #include <plat/common.h> | ||
25 | |||
26 | #include "prm-regbits-44xx.h" | ||
27 | #include "prm44xx.h" | ||
28 | #include "prcm44xx.h" | ||
29 | #include "prminst44xx.h" | ||
30 | #include "voltage.h" | ||
31 | #include "omap_opp_data.h" | ||
32 | #include "vc.h" | ||
33 | #include "vp.h" | ||
34 | |||
35 | static const struct omap_vfsm_instance_data omap4_vdd_mpu_vfsm_data = { | ||
36 | .voltsetup_reg = OMAP4_PRM_VOLTSETUP_MPU_RET_SLEEP_OFFSET, | ||
37 | }; | ||
38 | |||
39 | static struct omap_vdd_info omap4_vdd_mpu_info = { | ||
40 | .vp_data = &omap4_vp_mpu_data, | ||
41 | .vc_data = &omap4_vc_mpu_data, | ||
42 | .vfsm = &omap4_vdd_mpu_vfsm_data, | ||
43 | .voltdm = { | ||
44 | .name = "mpu", | ||
45 | }, | ||
46 | }; | ||
47 | |||
48 | static const struct omap_vfsm_instance_data omap4_vdd_iva_vfsm_data = { | ||
49 | .voltsetup_reg = OMAP4_PRM_VOLTSETUP_IVA_RET_SLEEP_OFFSET, | ||
50 | }; | ||
51 | |||
52 | static struct omap_vdd_info omap4_vdd_iva_info = { | ||
53 | .vp_data = &omap4_vp_iva_data, | ||
54 | .vc_data = &omap4_vc_iva_data, | ||
55 | .vfsm = &omap4_vdd_iva_vfsm_data, | ||
56 | .voltdm = { | ||
57 | .name = "iva", | ||
58 | }, | ||
59 | }; | ||
60 | |||
61 | static const struct omap_vfsm_instance_data omap4_vdd_core_vfsm_data = { | ||
62 | .voltsetup_reg = OMAP4_PRM_VOLTSETUP_CORE_RET_SLEEP_OFFSET, | ||
63 | }; | ||
64 | |||
65 | static struct omap_vdd_info omap4_vdd_core_info = { | ||
66 | .vp_data = &omap4_vp_core_data, | ||
67 | .vc_data = &omap4_vc_core_data, | ||
68 | .vfsm = &omap4_vdd_core_vfsm_data, | ||
69 | .voltdm = { | ||
70 | .name = "core", | ||
71 | }, | ||
72 | }; | ||
73 | |||
74 | /* OMAP4 VDD structures */ | ||
75 | static struct omap_vdd_info *omap4_vdd_info[] = { | ||
76 | &omap4_vdd_mpu_info, | ||
77 | &omap4_vdd_iva_info, | ||
78 | &omap4_vdd_core_info, | ||
79 | }; | ||
80 | |||
81 | /* OMAP4 specific voltage init functions */ | ||
82 | static int __init omap44xx_voltage_early_init(void) | ||
83 | { | ||
84 | s16 prm_mod = OMAP4430_PRM_DEVICE_INST; | ||
85 | s16 prm_irqst_ocp_mod = OMAP4430_PRM_OCP_SOCKET_INST; | ||
86 | |||
87 | if (!cpu_is_omap44xx()) | ||
88 | return 0; | ||
89 | |||
90 | /* | ||
91 | * XXX Will depend on the process, validation, and binning | ||
92 | * for the currently-running IC | ||
93 | */ | ||
94 | omap4_vdd_mpu_info.volt_data = omap44xx_vdd_mpu_volt_data; | ||
95 | omap4_vdd_iva_info.volt_data = omap44xx_vdd_iva_volt_data; | ||
96 | omap4_vdd_core_info.volt_data = omap44xx_vdd_core_volt_data; | ||
97 | |||
98 | return omap_voltage_early_init(prm_mod, prm_irqst_ocp_mod, | ||
99 | omap4_vdd_info, | ||
100 | ARRAY_SIZE(omap4_vdd_info)); | ||
101 | }; | ||
102 | core_initcall(omap44xx_voltage_early_init); | ||
diff --git a/arch/arm/mach-omap2/vp.h b/arch/arm/mach-omap2/vp.h new file mode 100644 index 000000000000..7ce134f7de79 --- /dev/null +++ b/arch/arm/mach-omap2/vp.h | |||
@@ -0,0 +1,143 @@ | |||
1 | /* | ||
2 | * OMAP3/4 Voltage Processor (VP) structure and macro definitions | ||
3 | * | ||
4 | * Copyright (C) 2007, 2010 Texas Instruments, Inc. | ||
5 | * Rajendra Nayak <rnayak@ti.com> | ||
6 | * Lesly A M <x0080970@ti.com> | ||
7 | * Thara Gopinath <thara@ti.com> | ||
8 | * | ||
9 | * Copyright (C) 2008, 2011 Nokia Corporation | ||
10 | * Kalle Jokiniemi | ||
11 | * Paul Walmsley | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or | ||
14 | * modify it under the terms of the GNU General Public License version | ||
15 | * 2 as published by the Free Software Foundation. | ||
16 | */ | ||
17 | #ifndef __ARCH_ARM_MACH_OMAP2_VP_H | ||
18 | #define __ARCH_ARM_MACH_OMAP2_VP_H | ||
19 | |||
20 | #include <linux/kernel.h> | ||
21 | |||
22 | /* XXX document */ | ||
23 | #define VP_IDLE_TIMEOUT 200 | ||
24 | #define VP_TRANXDONE_TIMEOUT 300 | ||
25 | |||
26 | |||
27 | /** | ||
28 | * struct omap_vp_common_data - register data common to all VDDs | ||
29 | * @vpconfig_errorgain_mask: ERRORGAIN bitmask in the PRM_VP*_CONFIG reg | ||
30 | * @vpconfig_initvoltage_mask: INITVOLTAGE bitmask in the PRM_VP*_CONFIG reg | ||
31 | * @vpconfig_timeouten_mask: TIMEOUT bitmask in the PRM_VP*_CONFIG reg | ||
32 | * @vpconfig_initvdd: INITVDD bitmask in the PRM_VP*_CONFIG reg | ||
33 | * @vpconfig_forceupdate: FORCEUPDATE bitmask in the PRM_VP*_CONFIG reg | ||
34 | * @vpconfig_vpenable: VPENABLE bitmask in the PRM_VP*_CONFIG reg | ||
35 | * @vpconfig_erroroffset_shift: ERROROFFSET field shift in PRM_VP*_CONFIG reg | ||
36 | * @vpconfig_errorgain_shift: ERRORGAIN field shift in PRM_VP*_CONFIG reg | ||
37 | * @vpconfig_initvoltage_shift: INITVOLTAGE field shift in PRM_VP*_CONFIG reg | ||
38 | * @vpconfig_stepmin_shift: VSTEPMIN field shift in the PRM_VP*_VSTEPMIN reg | ||
39 | * @vpconfig_smpswaittimemin_shift: SMPSWAITTIMEMIN field shift in PRM_VP*_VSTEPMIN reg | ||
40 | * @vpconfig_stepmax_shift: VSTEPMAX field shift in the PRM_VP*_VSTEPMAX reg | ||
41 | * @vpconfig_smpswaittimemax_shift: SMPSWAITTIMEMAX field shift in PRM_VP*_VSTEPMAX reg | ||
42 | * @vpconfig_vlimitto_vddmin_shift: VDDMIN field shift in PRM_VP*_VLIMITTO reg | ||
43 | * @vpconfig_vlimitto_vddmax_shift: VDDMAX field shift in PRM_VP*_VLIMITTO reg | ||
44 | * @vpconfig_vlimitto_timeout_shift: TIMEOUT field shift in PRM_VP*_VLIMITTO reg | ||
45 | * | ||
46 | * XXX It it not necessary to have both a mask and a shift for the same | ||
47 | * bitfield - remove one | ||
48 | * XXX Many of these fields are wrongly named -- e.g., vpconfig_smps* -- fix! | ||
49 | */ | ||
50 | struct omap_vp_common_data { | ||
51 | u32 vpconfig_errorgain_mask; | ||
52 | u32 vpconfig_initvoltage_mask; | ||
53 | u32 vpconfig_timeouten; | ||
54 | u32 vpconfig_initvdd; | ||
55 | u32 vpconfig_forceupdate; | ||
56 | u32 vpconfig_vpenable; | ||
57 | u8 vpconfig_erroroffset_shift; | ||
58 | u8 vpconfig_errorgain_shift; | ||
59 | u8 vpconfig_initvoltage_shift; | ||
60 | u8 vstepmin_stepmin_shift; | ||
61 | u8 vstepmin_smpswaittimemin_shift; | ||
62 | u8 vstepmax_stepmax_shift; | ||
63 | u8 vstepmax_smpswaittimemax_shift; | ||
64 | u8 vlimitto_vddmin_shift; | ||
65 | u8 vlimitto_vddmax_shift; | ||
66 | u8 vlimitto_timeout_shift; | ||
67 | }; | ||
68 | |||
69 | /** | ||
70 | * struct omap_vp_prm_irqst_data - PRM_IRQSTATUS_MPU.VP_TRANXDONE_ST data | ||
71 | * @prm_irqst_reg: reg offset for PRM_IRQSTATUS_MPU from top of PRM | ||
72 | * @tranxdone_status: VP_TRANXDONE_ST bitmask in PRM_IRQSTATUS_MPU reg | ||
73 | * | ||
74 | * XXX prm_irqst_reg does not belong here | ||
75 | * XXX Note that on OMAP3, VP_TRANXDONE interrupt may not work due to a | ||
76 | * hardware bug | ||
77 | * XXX This structure is probably not needed | ||
78 | */ | ||
79 | struct omap_vp_prm_irqst_data { | ||
80 | u8 prm_irqst_reg; | ||
81 | u32 tranxdone_status; | ||
82 | }; | ||
83 | |||
84 | /** | ||
85 | * struct omap_vp_instance_data - VP register offsets (per-VDD) | ||
86 | * @vp_common: pointer to struct omap_vp_common_data * for this SoC | ||
87 | * @prm_irqst_data: pointer to struct omap_vp_prm_irqst_data for this VDD | ||
88 | * @vpconfig: PRM_VP*_CONFIG reg offset from PRM start | ||
89 | * @vstepmin: PRM_VP*_VSTEPMIN reg offset from PRM start | ||
90 | * @vlimitto: PRM_VP*_VLIMITTO reg offset from PRM start | ||
91 | * @vstatus: PRM_VP*_VSTATUS reg offset from PRM start | ||
92 | * @voltage: PRM_VP*_VOLTAGE reg offset from PRM start | ||
93 | * | ||
94 | * XXX vp_common is probably not needed since it is per-SoC | ||
95 | */ | ||
96 | struct omap_vp_instance_data { | ||
97 | const struct omap_vp_common_data *vp_common; | ||
98 | const struct omap_vp_prm_irqst_data *prm_irqst_data; | ||
99 | u8 vpconfig; | ||
100 | u8 vstepmin; | ||
101 | u8 vstepmax; | ||
102 | u8 vlimitto; | ||
103 | u8 vstatus; | ||
104 | u8 voltage; | ||
105 | }; | ||
106 | |||
107 | /** | ||
108 | * struct omap_vp_runtime_data - VP data populated at runtime by code | ||
109 | * @vpconfig_erroroffset: value of ERROROFFSET bitfield in PRM_VP*_CONFIG | ||
110 | * @vpconfig_errorgain: value of ERRORGAIN bitfield in PRM_VP*_CONFIG | ||
111 | * @vstepmin_smpswaittimemin: value of SMPSWAITTIMEMIN bitfield in PRM_VP*_VSTEPMIN | ||
112 | * @vstepmax_smpswaittimemax: value of SMPSWAITTIMEMAX bitfield in PRM_VP*_VSTEPMAX | ||
113 | * @vlimitto_timeout: value of TIMEOUT bitfield in PRM_VP*_VLIMITTO | ||
114 | * @vstepmin_stepmin: value of VSTEPMIN bitfield in PRM_VP*_VSTEPMIN | ||
115 | * @vstepmax_stepmax: value of VSTEPMAX bitfield in PRM_VP*_VSTEPMAX | ||
116 | * @vlimitto_vddmin: value of VDDMIN bitfield in PRM_VP*_VLIMITTO | ||
117 | * @vlimitto_vddmax: value of VDDMAX bitfield in PRM_VP*_VLIMITTO | ||
118 | * | ||
119 | * XXX Is this structure really needed? Why not just program the | ||
120 | * device directly? They are in PRM space, therefore in the WKUP | ||
121 | * powerdomain, so register contents should not be lost in off-mode. | ||
122 | * XXX Some of these fields are incorrectly named, e.g., vstep* | ||
123 | */ | ||
124 | struct omap_vp_runtime_data { | ||
125 | u32 vpconfig_erroroffset; | ||
126 | u16 vpconfig_errorgain; | ||
127 | u16 vstepmin_smpswaittimemin; | ||
128 | u16 vstepmax_smpswaittimemax; | ||
129 | u16 vlimitto_timeout; | ||
130 | u8 vstepmin_stepmin; | ||
131 | u8 vstepmax_stepmax; | ||
132 | u8 vlimitto_vddmin; | ||
133 | u8 vlimitto_vddmax; | ||
134 | }; | ||
135 | |||
136 | extern struct omap_vp_instance_data omap3_vp1_data; | ||
137 | extern struct omap_vp_instance_data omap3_vp2_data; | ||
138 | |||
139 | extern struct omap_vp_instance_data omap4_vp_mpu_data; | ||
140 | extern struct omap_vp_instance_data omap4_vp_iva_data; | ||
141 | extern struct omap_vp_instance_data omap4_vp_core_data; | ||
142 | |||
143 | #endif | ||
diff --git a/arch/arm/mach-omap2/vp3xxx_data.c b/arch/arm/mach-omap2/vp3xxx_data.c new file mode 100644 index 000000000000..645217094e51 --- /dev/null +++ b/arch/arm/mach-omap2/vp3xxx_data.c | |||
@@ -0,0 +1,82 @@ | |||
1 | /* | ||
2 | * OMAP3 Voltage Processor (VP) data | ||
3 | * | ||
4 | * Copyright (C) 2007, 2010 Texas Instruments, Inc. | ||
5 | * Rajendra Nayak <rnayak@ti.com> | ||
6 | * Lesly A M <x0080970@ti.com> | ||
7 | * Thara Gopinath <thara@ti.com> | ||
8 | * | ||
9 | * Copyright (C) 2008, 2011 Nokia Corporation | ||
10 | * Kalle Jokiniemi | ||
11 | * Paul Walmsley | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify | ||
14 | * it under the terms of the GNU General Public License version 2 as | ||
15 | * published by the Free Software Foundation. | ||
16 | */ | ||
17 | |||
18 | #include <linux/io.h> | ||
19 | #include <linux/err.h> | ||
20 | #include <linux/init.h> | ||
21 | |||
22 | #include <plat/common.h> | ||
23 | |||
24 | #include "prm-regbits-34xx.h" | ||
25 | #include "voltage.h" | ||
26 | |||
27 | #include "vp.h" | ||
28 | |||
29 | /* | ||
30 | * VP data common to 34xx/36xx chips | ||
31 | * XXX This stuff presumably belongs in the vp3xxx.c or vp.c file. | ||
32 | */ | ||
33 | static const struct omap_vp_common_data omap3_vp_common = { | ||
34 | .vpconfig_erroroffset_shift = OMAP3430_ERROROFFSET_SHIFT, | ||
35 | .vpconfig_errorgain_mask = OMAP3430_ERRORGAIN_MASK, | ||
36 | .vpconfig_errorgain_shift = OMAP3430_ERRORGAIN_SHIFT, | ||
37 | .vpconfig_initvoltage_shift = OMAP3430_INITVOLTAGE_SHIFT, | ||
38 | .vpconfig_initvoltage_mask = OMAP3430_INITVOLTAGE_MASK, | ||
39 | .vpconfig_timeouten = OMAP3430_TIMEOUTEN_MASK, | ||
40 | .vpconfig_initvdd = OMAP3430_INITVDD_MASK, | ||
41 | .vpconfig_forceupdate = OMAP3430_FORCEUPDATE_MASK, | ||
42 | .vpconfig_vpenable = OMAP3430_VPENABLE_MASK, | ||
43 | .vstepmin_smpswaittimemin_shift = OMAP3430_SMPSWAITTIMEMIN_SHIFT, | ||
44 | .vstepmax_smpswaittimemax_shift = OMAP3430_SMPSWAITTIMEMAX_SHIFT, | ||
45 | .vstepmin_stepmin_shift = OMAP3430_VSTEPMIN_SHIFT, | ||
46 | .vstepmax_stepmax_shift = OMAP3430_VSTEPMAX_SHIFT, | ||
47 | .vlimitto_vddmin_shift = OMAP3430_VDDMIN_SHIFT, | ||
48 | .vlimitto_vddmax_shift = OMAP3430_VDDMAX_SHIFT, | ||
49 | .vlimitto_timeout_shift = OMAP3430_TIMEOUT_SHIFT, | ||
50 | }; | ||
51 | |||
52 | static const struct omap_vp_prm_irqst_data omap3_vp1_prm_irqst_data = { | ||
53 | .prm_irqst_reg = OMAP3_PRM_IRQSTATUS_MPU_OFFSET, | ||
54 | .tranxdone_status = OMAP3430_VP1_TRANXDONE_ST_MASK, | ||
55 | }; | ||
56 | |||
57 | struct omap_vp_instance_data omap3_vp1_data = { | ||
58 | .vp_common = &omap3_vp_common, | ||
59 | .vpconfig = OMAP3_PRM_VP1_CONFIG_OFFSET, | ||
60 | .vstepmin = OMAP3_PRM_VP1_VSTEPMIN_OFFSET, | ||
61 | .vstepmax = OMAP3_PRM_VP1_VSTEPMAX_OFFSET, | ||
62 | .vlimitto = OMAP3_PRM_VP1_VLIMITTO_OFFSET, | ||
63 | .vstatus = OMAP3_PRM_VP1_STATUS_OFFSET, | ||
64 | .voltage = OMAP3_PRM_VP1_VOLTAGE_OFFSET, | ||
65 | .prm_irqst_data = &omap3_vp1_prm_irqst_data, | ||
66 | }; | ||
67 | |||
68 | static const struct omap_vp_prm_irqst_data omap3_vp2_prm_irqst_data = { | ||
69 | .prm_irqst_reg = OMAP3_PRM_IRQSTATUS_MPU_OFFSET, | ||
70 | .tranxdone_status = OMAP3430_VP2_TRANXDONE_ST_MASK, | ||
71 | }; | ||
72 | |||
73 | struct omap_vp_instance_data omap3_vp2_data = { | ||
74 | .vp_common = &omap3_vp_common, | ||
75 | .vpconfig = OMAP3_PRM_VP2_CONFIG_OFFSET, | ||
76 | .vstepmin = OMAP3_PRM_VP2_VSTEPMIN_OFFSET, | ||
77 | .vstepmax = OMAP3_PRM_VP2_VSTEPMAX_OFFSET, | ||
78 | .vlimitto = OMAP3_PRM_VP2_VLIMITTO_OFFSET, | ||
79 | .vstatus = OMAP3_PRM_VP2_STATUS_OFFSET, | ||
80 | .voltage = OMAP3_PRM_VP2_VOLTAGE_OFFSET, | ||
81 | .prm_irqst_data = &omap3_vp2_prm_irqst_data, | ||
82 | }; | ||
diff --git a/arch/arm/mach-omap2/vp44xx_data.c b/arch/arm/mach-omap2/vp44xx_data.c new file mode 100644 index 000000000000..65d1ad63800a --- /dev/null +++ b/arch/arm/mach-omap2/vp44xx_data.c | |||
@@ -0,0 +1,100 @@ | |||
1 | /* | ||
2 | * OMAP3 Voltage Processor (VP) data | ||
3 | * | ||
4 | * Copyright (C) 2007, 2010 Texas Instruments, Inc. | ||
5 | * Rajendra Nayak <rnayak@ti.com> | ||
6 | * Lesly A M <x0080970@ti.com> | ||
7 | * Thara Gopinath <thara@ti.com> | ||
8 | * | ||
9 | * Copyright (C) 2008, 2011 Nokia Corporation | ||
10 | * Kalle Jokiniemi | ||
11 | * Paul Walmsley | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or modify | ||
14 | * it under the terms of the GNU General Public License version 2 as | ||
15 | * published by the Free Software Foundation. | ||
16 | */ | ||
17 | |||
18 | #include <linux/io.h> | ||
19 | #include <linux/err.h> | ||
20 | #include <linux/init.h> | ||
21 | |||
22 | #include <plat/common.h> | ||
23 | |||
24 | #include "prm44xx.h" | ||
25 | #include "prm-regbits-44xx.h" | ||
26 | #include "voltage.h" | ||
27 | |||
28 | #include "vp.h" | ||
29 | |||
30 | /* | ||
31 | * VP data common to 44xx chips | ||
32 | * XXX This stuff presumably belongs in the vp44xx.c or vp.c file. | ||
33 | */ | ||
34 | static const struct omap_vp_common_data omap4_vp_common = { | ||
35 | .vpconfig_erroroffset_shift = OMAP4430_ERROROFFSET_SHIFT, | ||
36 | .vpconfig_errorgain_mask = OMAP4430_ERRORGAIN_MASK, | ||
37 | .vpconfig_errorgain_shift = OMAP4430_ERRORGAIN_SHIFT, | ||
38 | .vpconfig_initvoltage_shift = OMAP4430_INITVOLTAGE_SHIFT, | ||
39 | .vpconfig_initvoltage_mask = OMAP4430_INITVOLTAGE_MASK, | ||
40 | .vpconfig_timeouten = OMAP4430_TIMEOUTEN_MASK, | ||
41 | .vpconfig_initvdd = OMAP4430_INITVDD_MASK, | ||
42 | .vpconfig_forceupdate = OMAP4430_FORCEUPDATE_MASK, | ||
43 | .vpconfig_vpenable = OMAP4430_VPENABLE_MASK, | ||
44 | .vstepmin_smpswaittimemin_shift = OMAP4430_SMPSWAITTIMEMIN_SHIFT, | ||
45 | .vstepmax_smpswaittimemax_shift = OMAP4430_SMPSWAITTIMEMAX_SHIFT, | ||
46 | .vstepmin_stepmin_shift = OMAP4430_VSTEPMIN_SHIFT, | ||
47 | .vstepmax_stepmax_shift = OMAP4430_VSTEPMAX_SHIFT, | ||
48 | .vlimitto_vddmin_shift = OMAP4430_VDDMIN_SHIFT, | ||
49 | .vlimitto_vddmax_shift = OMAP4430_VDDMAX_SHIFT, | ||
50 | .vlimitto_timeout_shift = OMAP4430_TIMEOUT_SHIFT, | ||
51 | }; | ||
52 | |||
53 | static const struct omap_vp_prm_irqst_data omap4_vp_mpu_prm_irqst_data = { | ||
54 | .prm_irqst_reg = OMAP4_PRM_IRQSTATUS_MPU_2_OFFSET, | ||
55 | .tranxdone_status = OMAP4430_VP_MPU_TRANXDONE_ST_MASK, | ||
56 | }; | ||
57 | |||
58 | struct omap_vp_instance_data omap4_vp_mpu_data = { | ||
59 | .vp_common = &omap4_vp_common, | ||
60 | .vpconfig = OMAP4_PRM_VP_MPU_CONFIG_OFFSET, | ||
61 | .vstepmin = OMAP4_PRM_VP_MPU_VSTEPMIN_OFFSET, | ||
62 | .vstepmax = OMAP4_PRM_VP_MPU_VSTEPMAX_OFFSET, | ||
63 | .vlimitto = OMAP4_PRM_VP_MPU_VLIMITTO_OFFSET, | ||
64 | .vstatus = OMAP4_PRM_VP_MPU_STATUS_OFFSET, | ||
65 | .voltage = OMAP4_PRM_VP_MPU_VOLTAGE_OFFSET, | ||
66 | .prm_irqst_data = &omap4_vp_mpu_prm_irqst_data, | ||
67 | }; | ||
68 | |||
69 | static const struct omap_vp_prm_irqst_data omap4_vp_iva_prm_irqst_data = { | ||
70 | .prm_irqst_reg = OMAP4_PRM_IRQSTATUS_MPU_OFFSET, | ||
71 | .tranxdone_status = OMAP4430_VP_IVA_TRANXDONE_ST_MASK, | ||
72 | }; | ||
73 | |||
74 | struct omap_vp_instance_data omap4_vp_iva_data = { | ||
75 | .vp_common = &omap4_vp_common, | ||
76 | .vpconfig = OMAP4_PRM_VP_IVA_CONFIG_OFFSET, | ||
77 | .vstepmin = OMAP4_PRM_VP_IVA_VSTEPMIN_OFFSET, | ||
78 | .vstepmax = OMAP4_PRM_VP_IVA_VSTEPMAX_OFFSET, | ||
79 | .vlimitto = OMAP4_PRM_VP_IVA_VLIMITTO_OFFSET, | ||
80 | .vstatus = OMAP4_PRM_VP_IVA_STATUS_OFFSET, | ||
81 | .voltage = OMAP4_PRM_VP_IVA_VOLTAGE_OFFSET, | ||
82 | .prm_irqst_data = &omap4_vp_iva_prm_irqst_data, | ||
83 | }; | ||
84 | |||
85 | static const struct omap_vp_prm_irqst_data omap4_vp_core_prm_irqst_data = { | ||
86 | .prm_irqst_reg = OMAP4_PRM_IRQSTATUS_MPU_OFFSET, | ||
87 | .tranxdone_status = OMAP4430_VP_CORE_TRANXDONE_ST_MASK, | ||
88 | }; | ||
89 | |||
90 | struct omap_vp_instance_data omap4_vp_core_data = { | ||
91 | .vp_common = &omap4_vp_common, | ||
92 | .vpconfig = OMAP4_PRM_VP_CORE_CONFIG_OFFSET, | ||
93 | .vstepmin = OMAP4_PRM_VP_CORE_VSTEPMIN_OFFSET, | ||
94 | .vstepmax = OMAP4_PRM_VP_CORE_VSTEPMAX_OFFSET, | ||
95 | .vlimitto = OMAP4_PRM_VP_CORE_VLIMITTO_OFFSET, | ||
96 | .vstatus = OMAP4_PRM_VP_CORE_STATUS_OFFSET, | ||
97 | .voltage = OMAP4_PRM_VP_CORE_VOLTAGE_OFFSET, | ||
98 | .prm_irqst_data = &omap4_vp_core_prm_irqst_data, | ||
99 | }; | ||
100 | |||
diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/plat-omap/include/plat/omap_hwmod.h index fca0cbce4659..23c77cd4abed 100644 --- a/arch/arm/plat-omap/include/plat/omap_hwmod.h +++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h | |||
@@ -35,7 +35,6 @@ | |||
35 | #include <linux/ioport.h> | 35 | #include <linux/ioport.h> |
36 | #include <linux/spinlock.h> | 36 | #include <linux/spinlock.h> |
37 | #include <plat/cpu.h> | 37 | #include <plat/cpu.h> |
38 | #include <plat/voltage.h> | ||
39 | 38 | ||
40 | struct omap_device; | 39 | struct omap_device; |
41 | 40 | ||