aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/omap_twl.c
diff options
context:
space:
mode:
authorThara Gopinath <thara@ti.com>2010-12-10 12:21:05 -0500
committerKevin Hilman <khilman@deeprootsystems.com>2010-12-22 17:31:41 -0500
commitfbc319f67660ede23cc22f3af5df559693f8062e (patch)
tree52c817cbc5110d9018d7e6fa5a8d34cd840655c5 /arch/arm/mach-omap2/omap_twl.c
parentfa765823a3cbb9ce1b13ce2832109a50d899c471 (diff)
OMAP3: PM: Register TWL4030 pmic info with the voltage driver.
This patch registers the TWL4030 PMIC specific informtion with the voltage driver. Failing this patch the voltage driver is unware of the formula to use for vsel to voltage and vice versa conversion and lot of other PMIC dependent parameters. This file is based on the arch/arm/plat-omap opp_twl_tpl.c file by Paul Walmsley. The original file is replaced by this file. Signed-off-by: Thara Gopinath <thara@ti.com> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch/arm/mach-omap2/omap_twl.c')
-rw-r--r--arch/arm/mach-omap2/omap_twl.c111
1 files changed, 111 insertions, 0 deletions
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}