aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-omap2/Makefile2
-rw-r--r--arch/arm/mach-omap2/omap_twl.c111
-rw-r--r--arch/arm/mach-omap2/pm.c4
-rw-r--r--arch/arm/mach-omap2/pm.h9
4 files changed, 126 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index ec48c4cf8ae5..c6efd25fe03c 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -18,6 +18,8 @@ obj-$(CONFIG_ARCH_OMAP4) += prm44xx.o $(hwmod-common)
18 18
19obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o 19obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o
20 20
21obj-$(CONFIG_TWL4030_CORE) += omap_twl.o
22
21# SMP support ONLY available for OMAP4 23# SMP support ONLY available for OMAP4
22obj-$(CONFIG_SMP) += omap-smp.o omap-headsmp.o 24obj-$(CONFIG_SMP) += omap-smp.o omap-headsmp.o
23obj-$(CONFIG_LOCAL_TIMERS) += timer-mpu.o 25obj-$(CONFIG_LOCAL_TIMERS) += timer-mpu.o
diff --git a/arch/arm/mach-omap2/omap_twl.c b/arch/arm/mach-omap2/omap_twl.c
new file mode 100644
index 000000000000..b8f08742a6f0
--- /dev/null
+++ b/arch/arm/mach-omap2/omap_twl.c
@@ -0,0 +1,111 @@
1/**
2 * OMAP and TWL PMIC specific intializations.
3 *
4 * Copyright (C) 2010 Texas Instruments Incorporated.
5 * Thara Gopinath
6 * Copyright (C) 2009 Texas Instruments Incorporated.
7 * Nishanth Menon
8 * Copyright (C) 2009 Nokia Corporation
9 * Paul Walmsley
10 *
11 * 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 * published by the Free Software Foundation.
14 */
15
16#include <linux/err.h>
17#include <linux/io.h>
18#include <linux/kernel.h>
19
20#include <plat/voltage.h>
21
22#define OMAP3_SRI2C_SLAVE_ADDR 0x12
23#define OMAP3_VDD_MPU_SR_CONTROL_REG 0x00
24#define OMAP3_VDD_CORE_SR_CONTROL_REG 0x01
25#define OMAP3_VP_CONFIG_ERROROFFSET 0x00
26#define OMAP3_VP_VSTEPMIN_VSTEPMIN 0x1
27#define OMAP3_VP_VSTEPMAX_VSTEPMAX 0x04
28#define OMAP3_VP_VLIMITTO_TIMEOUT_US 200
29
30#define OMAP3430_VP1_VLIMITTO_VDDMIN 0x14
31#define OMAP3430_VP1_VLIMITTO_VDDMAX 0x42
32#define OMAP3430_VP2_VLIMITTO_VDDMIN 0x18
33#define OMAP3430_VP2_VLIMITTO_VDDMAX 0x2c
34
35#define OMAP3630_VP1_VLIMITTO_VDDMIN 0x18
36#define OMAP3630_VP1_VLIMITTO_VDDMAX 0x3c
37#define OMAP3630_VP2_VLIMITTO_VDDMIN 0x18
38#define OMAP3630_VP2_VLIMITTO_VDDMAX 0x30
39
40unsigned long twl4030_vsel_to_uv(const u8 vsel)
41{
42 return (((vsel * 125) + 6000)) * 100;
43}
44
45u8 twl4030_uv_to_vsel(unsigned long uv)
46{
47 return DIV_ROUND_UP(uv - 600000, 12500);
48}
49
50static struct omap_volt_pmic_info omap3_mpu_volt_info = {
51 .slew_rate = 4000,
52 .step_size = 12500,
53 .on_volt = 1200000,
54 .onlp_volt = 1000000,
55 .ret_volt = 975000,
56 .off_volt = 600000,
57 .volt_setup_time = 0xfff,
58 .vp_erroroffset = OMAP3_VP_CONFIG_ERROROFFSET,
59 .vp_vstepmin = OMAP3_VP_VSTEPMIN_VSTEPMIN,
60 .vp_vstepmax = OMAP3_VP_VSTEPMAX_VSTEPMAX,
61 .vp_vddmin = OMAP3430_VP1_VLIMITTO_VDDMIN,
62 .vp_vddmax = OMAP3430_VP1_VLIMITTO_VDDMAX,
63 .vp_timeout_us = OMAP3_VP_VLIMITTO_TIMEOUT_US,
64 .i2c_slave_addr = OMAP3_SRI2C_SLAVE_ADDR,
65 .pmic_reg = OMAP3_VDD_MPU_SR_CONTROL_REG,
66 .vsel_to_uv = twl4030_vsel_to_uv,
67 .uv_to_vsel = twl4030_uv_to_vsel,
68};
69
70static struct omap_volt_pmic_info omap3_core_volt_info = {
71 .slew_rate = 4000,
72 .step_size = 12500,
73 .on_volt = 1200000,
74 .onlp_volt = 1000000,
75 .ret_volt = 975000,
76 .off_volt = 600000,
77 .volt_setup_time = 0xfff,
78 .vp_erroroffset = OMAP3_VP_CONFIG_ERROROFFSET,
79 .vp_vstepmin = OMAP3_VP_VSTEPMIN_VSTEPMIN,
80 .vp_vstepmax = OMAP3_VP_VSTEPMAX_VSTEPMAX,
81 .vp_vddmin = OMAP3430_VP2_VLIMITTO_VDDMIN,
82 .vp_vddmax = OMAP3430_VP2_VLIMITTO_VDDMAX,
83 .vp_timeout_us = OMAP3_VP_VLIMITTO_TIMEOUT_US,
84 .i2c_slave_addr = OMAP3_SRI2C_SLAVE_ADDR,
85 .pmic_reg = OMAP3_VDD_CORE_SR_CONTROL_REG,
86 .vsel_to_uv = twl4030_vsel_to_uv,
87 .uv_to_vsel = twl4030_uv_to_vsel,
88};
89
90int __init omap3_twl_init(void)
91{
92 struct voltagedomain *voltdm;
93
94 if (!cpu_is_omap34xx())
95 return -ENODEV;
96
97 if (cpu_is_omap3630()) {
98 omap3_mpu_volt_info.vp_vddmin = OMAP3630_VP1_VLIMITTO_VDDMIN;
99 omap3_mpu_volt_info.vp_vddmax = OMAP3630_VP1_VLIMITTO_VDDMAX;
100 omap3_core_volt_info.vp_vddmin = OMAP3630_VP2_VLIMITTO_VDDMIN;
101 omap3_core_volt_info.vp_vddmax = OMAP3630_VP2_VLIMITTO_VDDMAX;
102 }
103
104 voltdm = omap_voltage_domain_lookup("mpu");
105 omap_voltage_register_pmic(voltdm, &omap3_mpu_volt_info);
106
107 voltdm = omap_voltage_domain_lookup("core");
108 omap_voltage_register_pmic(voltdm, &omap3_core_volt_info);
109
110 return 0;
111}
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index d702ba9405c5..83358f920e4c 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -167,7 +167,11 @@ postcore_initcall(omap2_common_pm_init);
167 167
168static int __init omap2_common_pm_late_init(void) 168static int __init omap2_common_pm_late_init(void)
169{ 169{
170 /* Init the OMAP TWL parameters */
171 omap3_twl_init();
172 /* Init the voltage layer */
170 omap_voltage_late_init(); 173 omap_voltage_late_init();
174 /* Smartreflex device init */
171 omap_devinit_smartreflex(); 175 omap_devinit_smartreflex();
172 176
173 return 0; 177 return 0;
diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
index cc9f18b5c61d..c975a79691b7 100644
--- a/arch/arm/mach-omap2/pm.h
+++ b/arch/arm/mach-omap2/pm.h
@@ -124,4 +124,13 @@ static inline int omap_devinit_smartreflex(void)
124static inline void omap_enable_smartreflex_on_init(void) {} 124static inline void omap_enable_smartreflex_on_init(void) {}
125#endif 125#endif
126 126
127#ifdef CONFIG_TWL4030_CORE
128extern int omap3_twl_init(void);
129#else
130static inline int omap3_twl_init(void)
131{
132 return -EINVAL;
133}
134#endif
135
127#endif 136#endif