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 "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 /* OMAP3-common voltagedomain data */
35 
36 static struct voltagedomain omap3_voltdm_wkup = {
37 	.name = "wakeup",
38 };
39 
40 /* 34xx/36xx voltagedomain data */
41 
42 static const struct omap_vfsm_instance omap3_vdd1_vfsm = {
43 	.voltsetup_reg = OMAP3_PRM_VOLTSETUP1_OFFSET,
44 	.voltsetup_mask = OMAP3430_SETUP_TIME1_MASK,
45 };
46 
47 static const struct omap_vfsm_instance omap3_vdd2_vfsm = {
48 	.voltsetup_reg = OMAP3_PRM_VOLTSETUP1_OFFSET,
49 	.voltsetup_mask = OMAP3430_SETUP_TIME2_MASK,
50 };
51 
52 static struct voltagedomain omap3_voltdm_mpu = {
53 	.name = "mpu_iva",
54 	.scalable = true,
55 	.read = omap3_prm_vcvp_read,
56 	.write = omap3_prm_vcvp_write,
57 	.rmw = omap3_prm_vcvp_rmw,
58 	.vc = &omap3_vc_mpu,
59 	.vfsm = &omap3_vdd1_vfsm,
60 	.vp = &omap3_vp_mpu,
61 };
62 
63 static struct voltagedomain omap3_voltdm_core = {
64 	.name = "core",
65 	.scalable = true,
66 	.read = omap3_prm_vcvp_read,
67 	.write = omap3_prm_vcvp_write,
68 	.rmw = omap3_prm_vcvp_rmw,
69 	.vc = &omap3_vc_core,
70 	.vfsm = &omap3_vdd2_vfsm,
71 	.vp = &omap3_vp_core,
72 };
73 
74 static struct voltagedomain *voltagedomains_omap3[] __initdata = {
75 	&omap3_voltdm_mpu,
76 	&omap3_voltdm_core,
77 	&omap3_voltdm_wkup,
78 	NULL,
79 };
80 
81 /* AM35xx voltagedomain data */
82 
83 static struct voltagedomain am35xx_voltdm_mpu = {
84 	.name = "mpu_iva",
85 };
86 
87 static struct voltagedomain am35xx_voltdm_core = {
88 	.name = "core",
89 };
90 
91 static struct voltagedomain *voltagedomains_am35xx[] __initdata = {
92 	&am35xx_voltdm_mpu,
93 	&am35xx_voltdm_core,
94 	&omap3_voltdm_wkup,
95 	NULL,
96 };
97 
98 
99 static const char *sys_clk_name __initdata = "sys_ck";
100 
omap3xxx_voltagedomains_init(void)101 void __init omap3xxx_voltagedomains_init(void)
102 {
103 	struct voltagedomain *voltdm;
104 	struct voltagedomain **voltdms;
105 	int i;
106 
107 	/*
108 	 * XXX Will depend on the process, validation, and binning
109 	 * for the currently-running IC
110 	 */
111 #ifdef CONFIG_PM_OPP
112 	if (cpu_is_omap3630()) {
113 		omap3_voltdm_mpu.volt_data = omap36xx_vddmpu_volt_data;
114 		omap3_voltdm_core.volt_data = omap36xx_vddcore_volt_data;
115 	} else {
116 		omap3_voltdm_mpu.volt_data = omap34xx_vddmpu_volt_data;
117 		omap3_voltdm_core.volt_data = omap34xx_vddcore_volt_data;
118 	}
119 #endif
120 
121 	if (cpu_is_omap3517() || cpu_is_omap3505())
122 		voltdms = voltagedomains_am35xx;
123 	else
124 		voltdms = voltagedomains_omap3;
125 
126 	for (i = 0; voltdm = voltdms[i], voltdm; i++)
127 		voltdm->sys_clk.name = sys_clk_name;
128 
129 	voltdm_init(voltdms);
130 };
131