1fd1478cdSNishanth Menon /*
2fd1478cdSNishanth Menon  * OMAP3 OPP table definitions.
3fd1478cdSNishanth Menon  *
4fd1478cdSNishanth Menon  * Copyright (C) 2009-2010 Texas Instruments Incorporated - http://www.ti.com/
5fd1478cdSNishanth Menon  *	Nishanth Menon
6fd1478cdSNishanth Menon  *	Kevin Hilman
7c0718df4SPaul Walmsley  * Copyright (C) 2010-2011 Nokia Corporation.
8fd1478cdSNishanth Menon  *      Eduardo Valentin
9c0718df4SPaul Walmsley  *      Paul Walmsley
10fd1478cdSNishanth Menon  *
11fd1478cdSNishanth Menon  * This program is free software; you can redistribute it and/or modify
12fd1478cdSNishanth Menon  * it under the terms of the GNU General Public License version 2 as
13fd1478cdSNishanth Menon  * published by the Free Software Foundation.
14fd1478cdSNishanth Menon  *
15fd1478cdSNishanth Menon  * This program is distributed "as is" WITHOUT ANY WARRANTY of any
16fd1478cdSNishanth Menon  * kind, whether express or implied; without even the implied warranty
17fd1478cdSNishanth Menon  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18fd1478cdSNishanth Menon  * GNU General Public License for more details.
19fd1478cdSNishanth Menon  */
20fd1478cdSNishanth Menon #include <linux/module.h>
21fd1478cdSNishanth Menon 
22fd1478cdSNishanth Menon #include <plat/cpu.h>
23fd1478cdSNishanth Menon 
24c0718df4SPaul Walmsley #include "control.h"
25fd1478cdSNishanth Menon #include "omap_opp_data.h"
26fd1478cdSNishanth Menon 
27c0718df4SPaul Walmsley /* 34xx */
28c0718df4SPaul Walmsley 
29c0718df4SPaul Walmsley /* VDD1 */
30c0718df4SPaul Walmsley 
31c0718df4SPaul Walmsley #define OMAP3430_VDD_MPU_OPP1_UV		975000
32c0718df4SPaul Walmsley #define OMAP3430_VDD_MPU_OPP2_UV		1075000
33c0718df4SPaul Walmsley #define OMAP3430_VDD_MPU_OPP3_UV		1200000
34c0718df4SPaul Walmsley #define OMAP3430_VDD_MPU_OPP4_UV		1270000
35c0718df4SPaul Walmsley #define OMAP3430_VDD_MPU_OPP5_UV		1350000
36c0718df4SPaul Walmsley 
37c0718df4SPaul Walmsley struct omap_volt_data omap34xx_vddmpu_volt_data[] = {
38c0718df4SPaul Walmsley 	VOLT_DATA_DEFINE(OMAP3430_VDD_MPU_OPP1_UV, OMAP343X_CONTROL_FUSE_OPP1_VDD1, 0xf4, 0x0c),
39c0718df4SPaul Walmsley 	VOLT_DATA_DEFINE(OMAP3430_VDD_MPU_OPP2_UV, OMAP343X_CONTROL_FUSE_OPP2_VDD1, 0xf4, 0x0c),
40c0718df4SPaul Walmsley 	VOLT_DATA_DEFINE(OMAP3430_VDD_MPU_OPP3_UV, OMAP343X_CONTROL_FUSE_OPP3_VDD1, 0xf9, 0x18),
41c0718df4SPaul Walmsley 	VOLT_DATA_DEFINE(OMAP3430_VDD_MPU_OPP4_UV, OMAP343X_CONTROL_FUSE_OPP4_VDD1, 0xf9, 0x18),
42c0718df4SPaul Walmsley 	VOLT_DATA_DEFINE(OMAP3430_VDD_MPU_OPP5_UV, OMAP343X_CONTROL_FUSE_OPP5_VDD1, 0xf9, 0x18),
43c0718df4SPaul Walmsley 	VOLT_DATA_DEFINE(0, 0, 0, 0),
44c0718df4SPaul Walmsley };
45c0718df4SPaul Walmsley 
46c0718df4SPaul Walmsley /* VDD2 */
47c0718df4SPaul Walmsley 
48c0718df4SPaul Walmsley #define OMAP3430_VDD_CORE_OPP1_UV		975000
49c0718df4SPaul Walmsley #define OMAP3430_VDD_CORE_OPP2_UV		1050000
50c0718df4SPaul Walmsley #define OMAP3430_VDD_CORE_OPP3_UV		1150000
51c0718df4SPaul Walmsley 
52c0718df4SPaul Walmsley struct omap_volt_data omap34xx_vddcore_volt_data[] = {
53c0718df4SPaul Walmsley 	VOLT_DATA_DEFINE(OMAP3430_VDD_CORE_OPP1_UV, OMAP343X_CONTROL_FUSE_OPP1_VDD2, 0xf4, 0x0c),
54c0718df4SPaul Walmsley 	VOLT_DATA_DEFINE(OMAP3430_VDD_CORE_OPP2_UV, OMAP343X_CONTROL_FUSE_OPP2_VDD2, 0xf4, 0x0c),
55c0718df4SPaul Walmsley 	VOLT_DATA_DEFINE(OMAP3430_VDD_CORE_OPP3_UV, OMAP343X_CONTROL_FUSE_OPP3_VDD2, 0xf9, 0x18),
56c0718df4SPaul Walmsley 	VOLT_DATA_DEFINE(0, 0, 0, 0),
57c0718df4SPaul Walmsley };
58c0718df4SPaul Walmsley 
59c0718df4SPaul Walmsley /* 36xx */
60c0718df4SPaul Walmsley 
61c0718df4SPaul Walmsley /* VDD1 */
62c0718df4SPaul Walmsley 
63c0718df4SPaul Walmsley #define OMAP3630_VDD_MPU_OPP50_UV		1012500
64c0718df4SPaul Walmsley #define OMAP3630_VDD_MPU_OPP100_UV		1200000
65c0718df4SPaul Walmsley #define OMAP3630_VDD_MPU_OPP120_UV		1325000
66c0718df4SPaul Walmsley #define OMAP3630_VDD_MPU_OPP1G_UV		1375000
67c0718df4SPaul Walmsley 
68c0718df4SPaul Walmsley struct omap_volt_data omap36xx_vddmpu_volt_data[] = {
69c0718df4SPaul Walmsley 	VOLT_DATA_DEFINE(OMAP3630_VDD_MPU_OPP50_UV, OMAP3630_CONTROL_FUSE_OPP50_VDD1, 0xf4, 0x0c),
70c0718df4SPaul Walmsley 	VOLT_DATA_DEFINE(OMAP3630_VDD_MPU_OPP100_UV, OMAP3630_CONTROL_FUSE_OPP100_VDD1, 0xf9, 0x16),
71c0718df4SPaul Walmsley 	VOLT_DATA_DEFINE(OMAP3630_VDD_MPU_OPP120_UV, OMAP3630_CONTROL_FUSE_OPP120_VDD1, 0xfa, 0x23),
72c0718df4SPaul Walmsley 	VOLT_DATA_DEFINE(OMAP3630_VDD_MPU_OPP1G_UV, OMAP3630_CONTROL_FUSE_OPP1G_VDD1, 0xfa, 0x27),
73c0718df4SPaul Walmsley 	VOLT_DATA_DEFINE(0, 0, 0, 0),
74c0718df4SPaul Walmsley };
75c0718df4SPaul Walmsley 
76c0718df4SPaul Walmsley /* VDD2 */
77c0718df4SPaul Walmsley 
78c0718df4SPaul Walmsley #define OMAP3630_VDD_CORE_OPP50_UV		1000000
79c0718df4SPaul Walmsley #define OMAP3630_VDD_CORE_OPP100_UV		1200000
80c0718df4SPaul Walmsley 
81c0718df4SPaul Walmsley struct omap_volt_data omap36xx_vddcore_volt_data[] = {
82c0718df4SPaul Walmsley 	VOLT_DATA_DEFINE(OMAP3630_VDD_CORE_OPP50_UV, OMAP3630_CONTROL_FUSE_OPP50_VDD2, 0xf4, 0x0c),
83c0718df4SPaul Walmsley 	VOLT_DATA_DEFINE(OMAP3630_VDD_CORE_OPP100_UV, OMAP3630_CONTROL_FUSE_OPP100_VDD2, 0xf9, 0x16),
84c0718df4SPaul Walmsley 	VOLT_DATA_DEFINE(0, 0, 0, 0),
85c0718df4SPaul Walmsley };
86c0718df4SPaul Walmsley 
87c0718df4SPaul Walmsley /* OPP data */
88c0718df4SPaul Walmsley 
89fd1478cdSNishanth Menon static struct omap_opp_def __initdata omap34xx_opp_def_list[] = {
90fd1478cdSNishanth Menon 	/* MPU OPP1 */
9115f13e23SVishwanath BS 	OPP_INITIALIZER("mpu", true, 125000000, OMAP3430_VDD_MPU_OPP1_UV),
92fd1478cdSNishanth Menon 	/* MPU OPP2 */
9315f13e23SVishwanath BS 	OPP_INITIALIZER("mpu", true, 250000000, OMAP3430_VDD_MPU_OPP2_UV),
94fd1478cdSNishanth Menon 	/* MPU OPP3 */
9515f13e23SVishwanath BS 	OPP_INITIALIZER("mpu", true, 500000000, OMAP3430_VDD_MPU_OPP3_UV),
96fd1478cdSNishanth Menon 	/* MPU OPP4 */
9715f13e23SVishwanath BS 	OPP_INITIALIZER("mpu", true, 550000000, OMAP3430_VDD_MPU_OPP4_UV),
98fd1478cdSNishanth Menon 	/* MPU OPP5 */
9915f13e23SVishwanath BS 	OPP_INITIALIZER("mpu", true, 600000000, OMAP3430_VDD_MPU_OPP5_UV),
100fd1478cdSNishanth Menon 
101fd1478cdSNishanth Menon 	/*
102fd1478cdSNishanth Menon 	 * L3 OPP1 - 41.5 MHz is disabled because: The voltage for that OPP is
103fd1478cdSNishanth Menon 	 * almost the same than the one at 83MHz thus providing very little
104fd1478cdSNishanth Menon 	 * gain for the power point of view. In term of energy it will even
105fd1478cdSNishanth Menon 	 * increase the consumption due to the very negative performance
106fd1478cdSNishanth Menon 	 * impact that frequency will do to the MPU and the whole system in
107fd1478cdSNishanth Menon 	 * general.
108fd1478cdSNishanth Menon 	 */
10915f13e23SVishwanath BS 	OPP_INITIALIZER("l3_main", false, 41500000, OMAP3430_VDD_CORE_OPP1_UV),
110fd1478cdSNishanth Menon 	/* L3 OPP2 */
11115f13e23SVishwanath BS 	OPP_INITIALIZER("l3_main", true, 83000000, OMAP3430_VDD_CORE_OPP2_UV),
112fd1478cdSNishanth Menon 	/* L3 OPP3 */
11315f13e23SVishwanath BS 	OPP_INITIALIZER("l3_main", true, 166000000, OMAP3430_VDD_CORE_OPP3_UV),
114fd1478cdSNishanth Menon 
115fd1478cdSNishanth Menon 	/* DSP OPP1 */
11615f13e23SVishwanath BS 	OPP_INITIALIZER("iva", true, 90000000, OMAP3430_VDD_MPU_OPP1_UV),
117fd1478cdSNishanth Menon 	/* DSP OPP2 */
11815f13e23SVishwanath BS 	OPP_INITIALIZER("iva", true, 180000000, OMAP3430_VDD_MPU_OPP2_UV),
119fd1478cdSNishanth Menon 	/* DSP OPP3 */
12015f13e23SVishwanath BS 	OPP_INITIALIZER("iva", true, 360000000, OMAP3430_VDD_MPU_OPP3_UV),
121fd1478cdSNishanth Menon 	/* DSP OPP4 */
12215f13e23SVishwanath BS 	OPP_INITIALIZER("iva", true, 400000000, OMAP3430_VDD_MPU_OPP4_UV),
123fd1478cdSNishanth Menon 	/* DSP OPP5 */
12415f13e23SVishwanath BS 	OPP_INITIALIZER("iva", true, 430000000, OMAP3430_VDD_MPU_OPP5_UV),
125fd1478cdSNishanth Menon };
126fd1478cdSNishanth Menon 
127fd1478cdSNishanth Menon static struct omap_opp_def __initdata omap36xx_opp_def_list[] = {
128fd1478cdSNishanth Menon 	/* MPU OPP1 - OPP50 */
12915f13e23SVishwanath BS 	OPP_INITIALIZER("mpu", true,  300000000, OMAP3630_VDD_MPU_OPP50_UV),
130fd1478cdSNishanth Menon 	/* MPU OPP2 - OPP100 */
13115f13e23SVishwanath BS 	OPP_INITIALIZER("mpu", true,  600000000, OMAP3630_VDD_MPU_OPP100_UV),
132fd1478cdSNishanth Menon 	/* MPU OPP3 - OPP-Turbo */
13315f13e23SVishwanath BS 	OPP_INITIALIZER("mpu", false, 800000000, OMAP3630_VDD_MPU_OPP120_UV),
134fd1478cdSNishanth Menon 	/* MPU OPP4 - OPP-SB */
13515f13e23SVishwanath BS 	OPP_INITIALIZER("mpu", false, 1000000000, OMAP3630_VDD_MPU_OPP1G_UV),
136fd1478cdSNishanth Menon 
137fd1478cdSNishanth Menon 	/* L3 OPP1 - OPP50 */
13815f13e23SVishwanath BS 	OPP_INITIALIZER("l3_main", true, 100000000, OMAP3630_VDD_CORE_OPP50_UV),
139fd1478cdSNishanth Menon 	/* L3 OPP2 - OPP100, OPP-Turbo, OPP-SB */
14015f13e23SVishwanath BS 	OPP_INITIALIZER("l3_main", true, 200000000, OMAP3630_VDD_CORE_OPP100_UV),
141fd1478cdSNishanth Menon 
142fd1478cdSNishanth Menon 	/* DSP OPP1 - OPP50 */
14315f13e23SVishwanath BS 	OPP_INITIALIZER("iva", true,  260000000, OMAP3630_VDD_MPU_OPP50_UV),
144fd1478cdSNishanth Menon 	/* DSP OPP2 - OPP100 */
14515f13e23SVishwanath BS 	OPP_INITIALIZER("iva", true,  520000000, OMAP3630_VDD_MPU_OPP100_UV),
146fd1478cdSNishanth Menon 	/* DSP OPP3 - OPP-Turbo */
14715f13e23SVishwanath BS 	OPP_INITIALIZER("iva", false, 660000000, OMAP3630_VDD_MPU_OPP120_UV),
148fd1478cdSNishanth Menon 	/* DSP OPP4 - OPP-SB */
14915f13e23SVishwanath BS 	OPP_INITIALIZER("iva", false, 800000000, OMAP3630_VDD_MPU_OPP1G_UV),
150fd1478cdSNishanth Menon };
151fd1478cdSNishanth Menon 
152fd1478cdSNishanth Menon /**
153fd1478cdSNishanth Menon  * omap3_opp_init() - initialize omap3 opp table
154fd1478cdSNishanth Menon  */
155fd1478cdSNishanth Menon static int __init omap3_opp_init(void)
156fd1478cdSNishanth Menon {
157fd1478cdSNishanth Menon 	int r = -ENODEV;
158fd1478cdSNishanth Menon 
159fd1478cdSNishanth Menon 	if (!cpu_is_omap34xx())
160fd1478cdSNishanth Menon 		return r;
161fd1478cdSNishanth Menon 
162fd1478cdSNishanth Menon 	if (cpu_is_omap3630())
163fd1478cdSNishanth Menon 		r = omap_init_opp_table(omap36xx_opp_def_list,
164fd1478cdSNishanth Menon 			ARRAY_SIZE(omap36xx_opp_def_list));
165fd1478cdSNishanth Menon 	else
166fd1478cdSNishanth Menon 		r = omap_init_opp_table(omap34xx_opp_def_list,
167fd1478cdSNishanth Menon 			ARRAY_SIZE(omap34xx_opp_def_list));
168fd1478cdSNishanth Menon 
169fd1478cdSNishanth Menon 	return r;
170fd1478cdSNishanth Menon }
171fd1478cdSNishanth Menon device_initcall(omap3_opp_init);
172