Linux Audio

Check our new training course

Loading...
v3.5.6
 
  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#include <linux/i2c/twl.h>
 20
 
 21#include "voltage.h"
 22
 23#include "pm.h"
 24
 25#define OMAP3_SRI2C_SLAVE_ADDR		0x12
 26#define OMAP3_VDD_MPU_SR_CONTROL_REG	0x00
 27#define OMAP3_VDD_CORE_SR_CONTROL_REG	0x01
 28#define OMAP3_VP_CONFIG_ERROROFFSET	0x00
 29#define OMAP3_VP_VSTEPMIN_VSTEPMIN	0x1
 30#define OMAP3_VP_VSTEPMAX_VSTEPMAX	0x04
 31#define OMAP3_VP_VLIMITTO_TIMEOUT_US	200
 32
 33#define OMAP3430_VP1_VLIMITTO_VDDMIN	0x14
 34#define OMAP3430_VP1_VLIMITTO_VDDMAX	0x42
 35#define OMAP3430_VP2_VLIMITTO_VDDMIN	0x18
 36#define OMAP3430_VP2_VLIMITTO_VDDMAX	0x2c
 37
 38#define OMAP3630_VP1_VLIMITTO_VDDMIN	0x18
 39#define OMAP3630_VP1_VLIMITTO_VDDMAX	0x3c
 40#define OMAP3630_VP2_VLIMITTO_VDDMIN	0x18
 41#define OMAP3630_VP2_VLIMITTO_VDDMAX	0x30
 42
 43#define OMAP4_SRI2C_SLAVE_ADDR		0x12
 44#define OMAP4_VDD_MPU_SR_VOLT_REG	0x55
 45#define OMAP4_VDD_MPU_SR_CMD_REG	0x56
 46#define OMAP4_VDD_IVA_SR_VOLT_REG	0x5B
 47#define OMAP4_VDD_IVA_SR_CMD_REG	0x5C
 48#define OMAP4_VDD_CORE_SR_VOLT_REG	0x61
 49#define OMAP4_VDD_CORE_SR_CMD_REG	0x62
 50
 51#define OMAP4_VP_CONFIG_ERROROFFSET	0x00
 52#define OMAP4_VP_VSTEPMIN_VSTEPMIN	0x01
 53#define OMAP4_VP_VSTEPMAX_VSTEPMAX	0x04
 54#define OMAP4_VP_VLIMITTO_TIMEOUT_US	200
 55
 56#define OMAP4_VP_MPU_VLIMITTO_VDDMIN	0xA
 57#define OMAP4_VP_MPU_VLIMITTO_VDDMAX	0x39
 58#define OMAP4_VP_IVA_VLIMITTO_VDDMIN	0xA
 59#define OMAP4_VP_IVA_VLIMITTO_VDDMAX	0x2D
 60#define OMAP4_VP_CORE_VLIMITTO_VDDMIN	0xA
 61#define OMAP4_VP_CORE_VLIMITTO_VDDMAX	0x28
 62
 63static bool is_offset_valid;
 64static u8 smps_offset;
 65/*
 66 * Flag to ensure Smartreflex bit in TWL
 67 * being cleared in board file is not overwritten.
 68 */
 69static bool __initdata twl_sr_enable_autoinit;
 70
 71#define TWL4030_DCDC_GLOBAL_CFG        0x06
 72#define REG_SMPS_OFFSET         0xE0
 73#define SMARTREFLEX_ENABLE     BIT(3)
 74
 75static unsigned long twl4030_vsel_to_uv(const u8 vsel)
 76{
 77	return (((vsel * 125) + 6000)) * 100;
 78}
 79
 80static u8 twl4030_uv_to_vsel(unsigned long uv)
 81{
 82	return DIV_ROUND_UP(uv - 600000, 12500);
 83}
 84
 85static unsigned long twl6030_vsel_to_uv(const u8 vsel)
 86{
 87	/*
 88	 * In TWL6030 depending on the value of SMPS_OFFSET
 89	 * efuse register the voltage range supported in
 90	 * standard mode can be either between 0.6V - 1.3V or
 91	 * 0.7V - 1.4V. In TWL6030 ES1.0 SMPS_OFFSET efuse
 92	 * is programmed to all 0's where as starting from
 93	 * TWL6030 ES1.1 the efuse is programmed to 1
 94	 */
 95	if (!is_offset_valid) {
 96		twl_i2c_read_u8(TWL6030_MODULE_ID0, &smps_offset,
 97				REG_SMPS_OFFSET);
 98		is_offset_valid = true;
 99	}
100
101	if (!vsel)
102		return 0;
103	/*
104	 * There is no specific formula for voltage to vsel
105	 * conversion above 1.3V. There are special hardcoded
106	 * values for voltages above 1.3V. Currently we are
107	 * hardcoding only for 1.35 V which is used for 1GH OPP for
108	 * OMAP4430.
109	 */
110	if (vsel == 0x3A)
111		return 1350000;
112
113	if (smps_offset & 0x8)
114		return ((((vsel - 1) * 1266) + 70900)) * 10;
115	else
116		return ((((vsel - 1) * 1266) + 60770)) * 10;
117}
118
119static u8 twl6030_uv_to_vsel(unsigned long uv)
120{
121	/*
122	 * In TWL6030 depending on the value of SMPS_OFFSET
123	 * efuse register the voltage range supported in
124	 * standard mode can be either between 0.6V - 1.3V or
125	 * 0.7V - 1.4V. In TWL6030 ES1.0 SMPS_OFFSET efuse
126	 * is programmed to all 0's where as starting from
127	 * TWL6030 ES1.1 the efuse is programmed to 1
128	 */
129	if (!is_offset_valid) {
130		twl_i2c_read_u8(TWL6030_MODULE_ID0, &smps_offset,
131				REG_SMPS_OFFSET);
132		is_offset_valid = true;
133	}
134
135	if (!uv)
136		return 0x00;
137	/*
138	 * There is no specific formula for voltage to vsel
139	 * conversion above 1.3V. There are special hardcoded
140	 * values for voltages above 1.3V. Currently we are
141	 * hardcoding only for 1.35 V which is used for 1GH OPP for
142	 * OMAP4430.
143	 */
144	if (uv > twl6030_vsel_to_uv(0x39)) {
145		if (uv == 1350000)
146			return 0x3A;
147		pr_err("%s:OUT OF RANGE! non mapped vsel for %ld Vs max %ld\n",
148			__func__, uv, twl6030_vsel_to_uv(0x39));
149		return 0x3A;
150	}
151
152	if (smps_offset & 0x8)
153		return DIV_ROUND_UP(uv - 709000, 12660) + 1;
154	else
155		return DIV_ROUND_UP(uv - 607700, 12660) + 1;
156}
157
158static struct omap_voltdm_pmic omap3_mpu_pmic = {
159	.slew_rate		= 4000,
160	.step_size		= 12500,
161	.on_volt		= 1200000,
162	.onlp_volt		= 1000000,
163	.ret_volt		= 975000,
164	.off_volt		= 600000,
165	.volt_setup_time	= 0xfff,
166	.vp_erroroffset		= OMAP3_VP_CONFIG_ERROROFFSET,
167	.vp_vstepmin		= OMAP3_VP_VSTEPMIN_VSTEPMIN,
168	.vp_vstepmax		= OMAP3_VP_VSTEPMAX_VSTEPMAX,
169	.vp_vddmin		= OMAP3430_VP1_VLIMITTO_VDDMIN,
170	.vp_vddmax		= OMAP3430_VP1_VLIMITTO_VDDMAX,
171	.vp_timeout_us		= OMAP3_VP_VLIMITTO_TIMEOUT_US,
172	.i2c_slave_addr		= OMAP3_SRI2C_SLAVE_ADDR,
173	.volt_reg_addr		= OMAP3_VDD_MPU_SR_CONTROL_REG,
174	.i2c_high_speed		= true,
175	.vsel_to_uv		= twl4030_vsel_to_uv,
176	.uv_to_vsel		= twl4030_uv_to_vsel,
177};
178
179static struct omap_voltdm_pmic omap3_core_pmic = {
180	.slew_rate		= 4000,
181	.step_size		= 12500,
182	.on_volt                = 1200000,
183	.onlp_volt              = 1000000,
184	.ret_volt               = 975000,
185	.off_volt               = 600000,
186	.volt_setup_time        = 0xfff,
187	.vp_erroroffset		= OMAP3_VP_CONFIG_ERROROFFSET,
188	.vp_vstepmin		= OMAP3_VP_VSTEPMIN_VSTEPMIN,
189	.vp_vstepmax		= OMAP3_VP_VSTEPMAX_VSTEPMAX,
190	.vp_vddmin		= OMAP3430_VP2_VLIMITTO_VDDMIN,
191	.vp_vddmax		= OMAP3430_VP2_VLIMITTO_VDDMAX,
192	.vp_timeout_us		= OMAP3_VP_VLIMITTO_TIMEOUT_US,
193	.i2c_slave_addr		= OMAP3_SRI2C_SLAVE_ADDR,
194	.volt_reg_addr		= OMAP3_VDD_CORE_SR_CONTROL_REG,
195	.i2c_high_speed		= true,
196	.vsel_to_uv		= twl4030_vsel_to_uv,
197	.uv_to_vsel		= twl4030_uv_to_vsel,
198};
199
200static struct omap_voltdm_pmic omap4_mpu_pmic = {
201	.slew_rate		= 4000,
202	.step_size		= 12660,
203	.on_volt		= 1375000,
204	.onlp_volt		= 1375000,
205	.ret_volt		= 830000,
206	.off_volt		= 0,
207	.volt_setup_time	= 0,
208	.vp_erroroffset		= OMAP4_VP_CONFIG_ERROROFFSET,
209	.vp_vstepmin		= OMAP4_VP_VSTEPMIN_VSTEPMIN,
210	.vp_vstepmax		= OMAP4_VP_VSTEPMAX_VSTEPMAX,
211	.vp_vddmin		= OMAP4_VP_MPU_VLIMITTO_VDDMIN,
212	.vp_vddmax		= OMAP4_VP_MPU_VLIMITTO_VDDMAX,
213	.vp_timeout_us		= OMAP4_VP_VLIMITTO_TIMEOUT_US,
214	.i2c_slave_addr		= OMAP4_SRI2C_SLAVE_ADDR,
215	.volt_reg_addr		= OMAP4_VDD_MPU_SR_VOLT_REG,
216	.cmd_reg_addr		= OMAP4_VDD_MPU_SR_CMD_REG,
217	.i2c_high_speed		= true,
 
218	.vsel_to_uv		= twl6030_vsel_to_uv,
219	.uv_to_vsel		= twl6030_uv_to_vsel,
220};
221
222static struct omap_voltdm_pmic omap4_iva_pmic = {
223	.slew_rate		= 4000,
224	.step_size		= 12660,
225	.on_volt		= 1188000,
226	.onlp_volt		= 1188000,
227	.ret_volt		= 830000,
228	.off_volt		= 0,
229	.volt_setup_time	= 0,
230	.vp_erroroffset		= OMAP4_VP_CONFIG_ERROROFFSET,
231	.vp_vstepmin		= OMAP4_VP_VSTEPMIN_VSTEPMIN,
232	.vp_vstepmax		= OMAP4_VP_VSTEPMAX_VSTEPMAX,
233	.vp_vddmin		= OMAP4_VP_IVA_VLIMITTO_VDDMIN,
234	.vp_vddmax		= OMAP4_VP_IVA_VLIMITTO_VDDMAX,
235	.vp_timeout_us		= OMAP4_VP_VLIMITTO_TIMEOUT_US,
236	.i2c_slave_addr		= OMAP4_SRI2C_SLAVE_ADDR,
237	.volt_reg_addr		= OMAP4_VDD_IVA_SR_VOLT_REG,
238	.cmd_reg_addr		= OMAP4_VDD_IVA_SR_CMD_REG,
239	.i2c_high_speed		= true,
 
240	.vsel_to_uv		= twl6030_vsel_to_uv,
241	.uv_to_vsel		= twl6030_uv_to_vsel,
242};
243
244static struct omap_voltdm_pmic omap4_core_pmic = {
245	.slew_rate		= 4000,
246	.step_size		= 12660,
247	.on_volt		= 1200000,
248	.onlp_volt		= 1200000,
249	.ret_volt		= 830000,
250	.off_volt		= 0,
251	.volt_setup_time	= 0,
252	.vp_erroroffset		= OMAP4_VP_CONFIG_ERROROFFSET,
253	.vp_vstepmin		= OMAP4_VP_VSTEPMIN_VSTEPMIN,
254	.vp_vstepmax		= OMAP4_VP_VSTEPMAX_VSTEPMAX,
255	.vp_vddmin		= OMAP4_VP_CORE_VLIMITTO_VDDMIN,
256	.vp_vddmax		= OMAP4_VP_CORE_VLIMITTO_VDDMAX,
257	.vp_timeout_us		= OMAP4_VP_VLIMITTO_TIMEOUT_US,
258	.i2c_slave_addr		= OMAP4_SRI2C_SLAVE_ADDR,
259	.volt_reg_addr		= OMAP4_VDD_CORE_SR_VOLT_REG,
260	.cmd_reg_addr		= OMAP4_VDD_CORE_SR_CMD_REG,
 
 
261	.vsel_to_uv		= twl6030_vsel_to_uv,
262	.uv_to_vsel		= twl6030_uv_to_vsel,
263};
264
265int __init omap4_twl_init(void)
266{
267	struct voltagedomain *voltdm;
268
269	if (!cpu_is_omap44xx())
270		return -ENODEV;
271
272	voltdm = voltdm_lookup("mpu");
273	omap_voltage_register_pmic(voltdm, &omap4_mpu_pmic);
274
275	voltdm = voltdm_lookup("iva");
276	omap_voltage_register_pmic(voltdm, &omap4_iva_pmic);
277
278	voltdm = voltdm_lookup("core");
279	omap_voltage_register_pmic(voltdm, &omap4_core_pmic);
280
281	return 0;
282}
283
284int __init omap3_twl_init(void)
285{
286	struct voltagedomain *voltdm;
287
288	if (!cpu_is_omap34xx())
289		return -ENODEV;
290
291	if (cpu_is_omap3630()) {
292		omap3_mpu_pmic.vp_vddmin = OMAP3630_VP1_VLIMITTO_VDDMIN;
293		omap3_mpu_pmic.vp_vddmax = OMAP3630_VP1_VLIMITTO_VDDMAX;
294		omap3_core_pmic.vp_vddmin = OMAP3630_VP2_VLIMITTO_VDDMIN;
295		omap3_core_pmic.vp_vddmax = OMAP3630_VP2_VLIMITTO_VDDMAX;
296	}
297
298	/*
299	 * The smartreflex bit on twl4030 specifies if the setting of voltage
300	 * is done over the I2C_SR path. Since this setting is independent of
301	 * the actual usage of smartreflex AVS module, we enable TWL SR bit
302	 * by default irrespective of whether smartreflex AVS module is enabled
303	 * on the OMAP side or not. This is because without this bit enabled,
304	 * the voltage scaling through vp forceupdate/bypass mechanism of
305	 * voltage scaling will not function on TWL over I2C_SR.
306	 */
307	if (!twl_sr_enable_autoinit)
308		omap3_twl_set_sr_bit(true);
309
310	voltdm = voltdm_lookup("mpu_iva");
311	omap_voltage_register_pmic(voltdm, &omap3_mpu_pmic);
312
313	voltdm = voltdm_lookup("core");
314	omap_voltage_register_pmic(voltdm, &omap3_core_pmic);
315
316	return 0;
317}
318
319/**
320 * omap3_twl_set_sr_bit() - Set/Clear SR bit on TWL
321 * @enable: enable SR mode in twl or not
322 *
323 * If 'enable' is true, enables Smartreflex bit on TWL 4030 to make sure
324 * voltage scaling through OMAP SR works. Else, the smartreflex bit
325 * on twl4030 is cleared as there are platforms which use OMAP3 and T2 but
326 * use Synchronized Scaling Hardware Strategy (ENABLE_VMODE=1) and Direct
327 * Strategy Software Scaling Mode (ENABLE_VMODE=0), for setting the voltages,
328 * in those scenarios this bit is to be cleared (enable = false).
329 *
330 * Returns 0 on success, error is returned if I2C read/write fails.
331 */
332int __init omap3_twl_set_sr_bit(bool enable)
333{
334	u8 temp;
335	int ret;
336	if (twl_sr_enable_autoinit)
337		pr_warning("%s: unexpected multiple calls\n", __func__);
338
339	ret = twl_i2c_read_u8(TWL4030_MODULE_PM_RECEIVER, &temp,
340					TWL4030_DCDC_GLOBAL_CFG);
341	if (ret)
342		goto err;
343
344	if (enable)
345		temp |= SMARTREFLEX_ENABLE;
346	else
347		temp &= ~SMARTREFLEX_ENABLE;
348
349	ret = twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, temp,
350				TWL4030_DCDC_GLOBAL_CFG);
351	if (!ret) {
352		twl_sr_enable_autoinit = true;
353		return 0;
354	}
355err:
356	pr_err("%s: Error access to TWL4030 (%d)\n", __func__, ret);
357	return ret;
358}
v5.4
  1// SPDX-License-Identifier: GPL-2.0-only
  2/**
  3 * OMAP and TWL PMIC specific initializations.
  4 *
  5 * Copyright (C) 2010 Texas Instruments Incorporated.
  6 * Thara Gopinath
  7 * Copyright (C) 2009 Texas Instruments Incorporated.
  8 * Nishanth Menon
  9 * Copyright (C) 2009 Nokia Corporation
 10 * Paul Walmsley
 
 
 
 
 11 */
 12
 13#include <linux/err.h>
 14#include <linux/io.h>
 15#include <linux/kernel.h>
 16#include <linux/mfd/twl.h>
 17
 18#include "soc.h"
 19#include "voltage.h"
 20
 21#include "pm.h"
 22
 23#define OMAP3_SRI2C_SLAVE_ADDR		0x12
 24#define OMAP3_VDD_MPU_SR_CONTROL_REG	0x00
 25#define OMAP3_VDD_CORE_SR_CONTROL_REG	0x01
 26#define OMAP3_VP_CONFIG_ERROROFFSET	0x00
 27#define OMAP3_VP_VSTEPMIN_VSTEPMIN	0x1
 28#define OMAP3_VP_VSTEPMAX_VSTEPMAX	0x04
 29#define OMAP3_VP_VLIMITTO_TIMEOUT_US	200
 30
 
 
 
 
 
 
 
 
 
 
 31#define OMAP4_SRI2C_SLAVE_ADDR		0x12
 32#define OMAP4_VDD_MPU_SR_VOLT_REG	0x55
 33#define OMAP4_VDD_MPU_SR_CMD_REG	0x56
 34#define OMAP4_VDD_IVA_SR_VOLT_REG	0x5B
 35#define OMAP4_VDD_IVA_SR_CMD_REG	0x5C
 36#define OMAP4_VDD_CORE_SR_VOLT_REG	0x61
 37#define OMAP4_VDD_CORE_SR_CMD_REG	0x62
 38
 39#define OMAP4_VP_CONFIG_ERROROFFSET	0x00
 40#define OMAP4_VP_VSTEPMIN_VSTEPMIN	0x01
 41#define OMAP4_VP_VSTEPMAX_VSTEPMAX	0x04
 42#define OMAP4_VP_VLIMITTO_TIMEOUT_US	200
 43
 
 
 
 
 
 
 
 44static bool is_offset_valid;
 45static u8 smps_offset;
 
 
 
 
 
 46
 
 47#define REG_SMPS_OFFSET         0xE0
 
 48
 49static unsigned long twl4030_vsel_to_uv(const u8 vsel)
 50{
 51	return (((vsel * 125) + 6000)) * 100;
 52}
 53
 54static u8 twl4030_uv_to_vsel(unsigned long uv)
 55{
 56	return DIV_ROUND_UP(uv - 600000, 12500);
 57}
 58
 59static unsigned long twl6030_vsel_to_uv(const u8 vsel)
 60{
 61	/*
 62	 * In TWL6030 depending on the value of SMPS_OFFSET
 63	 * efuse register the voltage range supported in
 64	 * standard mode can be either between 0.6V - 1.3V or
 65	 * 0.7V - 1.4V. In TWL6030 ES1.0 SMPS_OFFSET efuse
 66	 * is programmed to all 0's where as starting from
 67	 * TWL6030 ES1.1 the efuse is programmed to 1
 68	 */
 69	if (!is_offset_valid) {
 70		twl_i2c_read_u8(TWL6030_MODULE_ID0, &smps_offset,
 71				REG_SMPS_OFFSET);
 72		is_offset_valid = true;
 73	}
 74
 75	if (!vsel)
 76		return 0;
 77	/*
 78	 * There is no specific formula for voltage to vsel
 79	 * conversion above 1.3V. There are special hardcoded
 80	 * values for voltages above 1.3V. Currently we are
 81	 * hardcoding only for 1.35 V which is used for 1GH OPP for
 82	 * OMAP4430.
 83	 */
 84	if (vsel == 0x3A)
 85		return 1350000;
 86
 87	if (smps_offset & 0x8)
 88		return ((((vsel - 1) * 1266) + 70900)) * 10;
 89	else
 90		return ((((vsel - 1) * 1266) + 60770)) * 10;
 91}
 92
 93static u8 twl6030_uv_to_vsel(unsigned long uv)
 94{
 95	/*
 96	 * In TWL6030 depending on the value of SMPS_OFFSET
 97	 * efuse register the voltage range supported in
 98	 * standard mode can be either between 0.6V - 1.3V or
 99	 * 0.7V - 1.4V. In TWL6030 ES1.0 SMPS_OFFSET efuse
100	 * is programmed to all 0's where as starting from
101	 * TWL6030 ES1.1 the efuse is programmed to 1
102	 */
103	if (!is_offset_valid) {
104		twl_i2c_read_u8(TWL6030_MODULE_ID0, &smps_offset,
105				REG_SMPS_OFFSET);
106		is_offset_valid = true;
107	}
108
109	if (!uv)
110		return 0x00;
111	/*
112	 * There is no specific formula for voltage to vsel
113	 * conversion above 1.3V. There are special hardcoded
114	 * values for voltages above 1.3V. Currently we are
115	 * hardcoding only for 1.35 V which is used for 1GH OPP for
116	 * OMAP4430.
117	 */
118	if (uv > twl6030_vsel_to_uv(0x39)) {
119		if (uv == 1350000)
120			return 0x3A;
121		pr_err("%s:OUT OF RANGE! non mapped vsel for %ld Vs max %ld\n",
122			__func__, uv, twl6030_vsel_to_uv(0x39));
123		return 0x3A;
124	}
125
126	if (smps_offset & 0x8)
127		return DIV_ROUND_UP(uv - 709000, 12660) + 1;
128	else
129		return DIV_ROUND_UP(uv - 607700, 12660) + 1;
130}
131
132static struct omap_voltdm_pmic omap3_mpu_pmic = {
133	.slew_rate		= 4000,
134	.step_size		= 12500,
 
 
 
 
 
135	.vp_erroroffset		= OMAP3_VP_CONFIG_ERROROFFSET,
136	.vp_vstepmin		= OMAP3_VP_VSTEPMIN_VSTEPMIN,
137	.vp_vstepmax		= OMAP3_VP_VSTEPMAX_VSTEPMAX,
138	.vddmin			= 600000,
139	.vddmax			= 1450000,
140	.vp_timeout_us		= OMAP3_VP_VLIMITTO_TIMEOUT_US,
141	.i2c_slave_addr		= OMAP3_SRI2C_SLAVE_ADDR,
142	.volt_reg_addr		= OMAP3_VDD_MPU_SR_CONTROL_REG,
143	.i2c_high_speed		= true,
144	.vsel_to_uv		= twl4030_vsel_to_uv,
145	.uv_to_vsel		= twl4030_uv_to_vsel,
146};
147
148static struct omap_voltdm_pmic omap3_core_pmic = {
149	.slew_rate		= 4000,
150	.step_size		= 12500,
 
 
 
 
 
151	.vp_erroroffset		= OMAP3_VP_CONFIG_ERROROFFSET,
152	.vp_vstepmin		= OMAP3_VP_VSTEPMIN_VSTEPMIN,
153	.vp_vstepmax		= OMAP3_VP_VSTEPMAX_VSTEPMAX,
154	.vddmin			= 600000,
155	.vddmax			= 1450000,
156	.vp_timeout_us		= OMAP3_VP_VLIMITTO_TIMEOUT_US,
157	.i2c_slave_addr		= OMAP3_SRI2C_SLAVE_ADDR,
158	.volt_reg_addr		= OMAP3_VDD_CORE_SR_CONTROL_REG,
159	.i2c_high_speed		= true,
160	.vsel_to_uv		= twl4030_vsel_to_uv,
161	.uv_to_vsel		= twl4030_uv_to_vsel,
162};
163
164static struct omap_voltdm_pmic omap4_mpu_pmic = {
165	.slew_rate		= 4000,
166	.step_size		= 12660,
 
 
 
 
 
167	.vp_erroroffset		= OMAP4_VP_CONFIG_ERROROFFSET,
168	.vp_vstepmin		= OMAP4_VP_VSTEPMIN_VSTEPMIN,
169	.vp_vstepmax		= OMAP4_VP_VSTEPMAX_VSTEPMAX,
170	.vddmin			= 0,
171	.vddmax			= 2100000,
172	.vp_timeout_us		= OMAP4_VP_VLIMITTO_TIMEOUT_US,
173	.i2c_slave_addr		= OMAP4_SRI2C_SLAVE_ADDR,
174	.volt_reg_addr		= OMAP4_VDD_MPU_SR_VOLT_REG,
175	.cmd_reg_addr		= OMAP4_VDD_MPU_SR_CMD_REG,
176	.i2c_high_speed		= true,
177	.i2c_pad_load		= 3,
178	.vsel_to_uv		= twl6030_vsel_to_uv,
179	.uv_to_vsel		= twl6030_uv_to_vsel,
180};
181
182static struct omap_voltdm_pmic omap4_iva_pmic = {
183	.slew_rate		= 4000,
184	.step_size		= 12660,
 
 
 
 
 
185	.vp_erroroffset		= OMAP4_VP_CONFIG_ERROROFFSET,
186	.vp_vstepmin		= OMAP4_VP_VSTEPMIN_VSTEPMIN,
187	.vp_vstepmax		= OMAP4_VP_VSTEPMAX_VSTEPMAX,
188	.vddmin			= 0,
189	.vddmax			= 2100000,
190	.vp_timeout_us		= OMAP4_VP_VLIMITTO_TIMEOUT_US,
191	.i2c_slave_addr		= OMAP4_SRI2C_SLAVE_ADDR,
192	.volt_reg_addr		= OMAP4_VDD_IVA_SR_VOLT_REG,
193	.cmd_reg_addr		= OMAP4_VDD_IVA_SR_CMD_REG,
194	.i2c_high_speed		= true,
195	.i2c_pad_load		= 3,
196	.vsel_to_uv		= twl6030_vsel_to_uv,
197	.uv_to_vsel		= twl6030_uv_to_vsel,
198};
199
200static struct omap_voltdm_pmic omap4_core_pmic = {
201	.slew_rate		= 4000,
202	.step_size		= 12660,
 
 
 
 
 
203	.vp_erroroffset		= OMAP4_VP_CONFIG_ERROROFFSET,
204	.vp_vstepmin		= OMAP4_VP_VSTEPMIN_VSTEPMIN,
205	.vp_vstepmax		= OMAP4_VP_VSTEPMAX_VSTEPMAX,
206	.vddmin			= 0,
207	.vddmax			= 2100000,
208	.vp_timeout_us		= OMAP4_VP_VLIMITTO_TIMEOUT_US,
209	.i2c_slave_addr		= OMAP4_SRI2C_SLAVE_ADDR,
210	.volt_reg_addr		= OMAP4_VDD_CORE_SR_VOLT_REG,
211	.cmd_reg_addr		= OMAP4_VDD_CORE_SR_CMD_REG,
212	.i2c_high_speed		= true,
213	.i2c_pad_load		= 3,
214	.vsel_to_uv		= twl6030_vsel_to_uv,
215	.uv_to_vsel		= twl6030_uv_to_vsel,
216};
217
218int __init omap4_twl_init(void)
219{
220	struct voltagedomain *voltdm;
221
222	if (!cpu_is_omap44xx())
223		return -ENODEV;
224
225	voltdm = voltdm_lookup("mpu");
226	omap_voltage_register_pmic(voltdm, &omap4_mpu_pmic);
227
228	voltdm = voltdm_lookup("iva");
229	omap_voltage_register_pmic(voltdm, &omap4_iva_pmic);
230
231	voltdm = voltdm_lookup("core");
232	omap_voltage_register_pmic(voltdm, &omap4_core_pmic);
233
234	return 0;
235}
236
237int __init omap3_twl_init(void)
238{
239	struct voltagedomain *voltdm;
240
241	if (!cpu_is_omap34xx())
242		return -ENODEV;
243
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
244	voltdm = voltdm_lookup("mpu_iva");
245	omap_voltage_register_pmic(voltdm, &omap3_mpu_pmic);
246
247	voltdm = voltdm_lookup("core");
248	omap_voltage_register_pmic(voltdm, &omap3_core_pmic);
249
250	return 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
251}