blob: 307676d8c53c808d852f0d06368a3eff163eb256 [file] [log] [blame]
Paul Walmsleyc0718df2011-03-10 22:17:45 -07001/*
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
Tony Lindgrendbc04162012-08-31 10:59:07 -070021#include "soc.h"
Tony Lindgren4e653312011-11-10 22:45:17 +010022#include "common.h"
Paul Walmsleyc0718df2011-03-10 22:17:45 -070023#include "prm-regbits-34xx.h"
24#include "omap_opp_data.h"
25#include "voltage.h"
26#include "vc.h"
27#include "vp.h"
28
29/*
30 * VDD data
31 */
32
Paul Walmsleyddf536d2011-12-16 16:09:11 -080033/* OMAP3-common voltagedomain data */
34
35static struct voltagedomain omap3_voltdm_wkup = {
36 .name = "wakeup",
37};
38
39/* 34xx/36xx voltagedomain data */
40
Kevin Hilman5892bb12011-03-29 14:36:04 -070041static const struct omap_vfsm_instance omap3_vdd1_vfsm = {
Paul Walmsleyc0718df2011-03-10 22:17:45 -070042 .voltsetup_reg = OMAP3_PRM_VOLTSETUP1_OFFSET,
Paul Walmsleyc0718df2011-03-10 22:17:45 -070043 .voltsetup_mask = OMAP3430_SETUP_TIME1_MASK,
44};
45
Kevin Hilman5892bb12011-03-29 14:36:04 -070046static const struct omap_vfsm_instance omap3_vdd2_vfsm = {
Paul Walmsleyc0718df2011-03-10 22:17:45 -070047 .voltsetup_reg = OMAP3_PRM_VOLTSETUP1_OFFSET,
Paul Walmsleyc0718df2011-03-10 22:17:45 -070048 .voltsetup_mask = OMAP3430_SETUP_TIME2_MASK,
49};
50
Kevin Hilman81a60482011-03-16 14:25:45 -070051static struct voltagedomain omap3_voltdm_mpu = {
Kevin Hilman280a7272011-03-23 11:18:08 -070052 .name = "mpu_iva",
Kevin Hilman37efca72011-03-23 17:00:21 -070053 .scalable = true,
Kevin Hilman4bcc4752011-03-28 10:40:15 -070054 .read = omap3_prm_vcvp_read,
55 .write = omap3_prm_vcvp_write,
56 .rmw = omap3_prm_vcvp_rmw,
Kevin Hilmand84adcf2011-03-22 16:14:57 -070057 .vc = &omap3_vc_mpu,
Kevin Hilman5892bb12011-03-29 14:36:04 -070058 .vfsm = &omap3_vdd1_vfsm,
Kevin Hilmanb7ea8032011-04-04 15:25:07 -070059 .vp = &omap3_vp_mpu,
Paul Walmsleyc0718df2011-03-10 22:17:45 -070060};
61
Kevin Hilman81a60482011-03-16 14:25:45 -070062static struct voltagedomain omap3_voltdm_core = {
63 .name = "core",
Kevin Hilman37efca72011-03-23 17:00:21 -070064 .scalable = true,
Kevin Hilman4bcc4752011-03-28 10:40:15 -070065 .read = omap3_prm_vcvp_read,
66 .write = omap3_prm_vcvp_write,
67 .rmw = omap3_prm_vcvp_rmw,
Kevin Hilmand84adcf2011-03-22 16:14:57 -070068 .vc = &omap3_vc_core,
Kevin Hilman5892bb12011-03-29 14:36:04 -070069 .vfsm = &omap3_vdd2_vfsm,
Kevin Hilmanb7ea8032011-04-04 15:25:07 -070070 .vp = &omap3_vp_core,
Kevin Hilman81a60482011-03-16 14:25:45 -070071};
72
73static struct voltagedomain *voltagedomains_omap3[] __initdata = {
74 &omap3_voltdm_mpu,
75 &omap3_voltdm_core,
Kevin Hilmanace19ff2011-03-23 13:30:33 -070076 &omap3_voltdm_wkup,
Kevin Hilman81a60482011-03-16 14:25:45 -070077 NULL,
78};
79
Paul Walmsleyddf536d2011-12-16 16:09:11 -080080/* AM35xx voltagedomain data */
81
82static struct voltagedomain am35xx_voltdm_mpu = {
83 .name = "mpu_iva",
84};
85
86static struct voltagedomain am35xx_voltdm_core = {
87 .name = "core",
88};
89
90static struct voltagedomain *voltagedomains_am35xx[] __initdata = {
91 &am35xx_voltdm_mpu,
92 &am35xx_voltdm_core,
93 &omap3_voltdm_wkup,
94 NULL,
95};
96
97
Nicolas Pitre19c233b2015-07-27 18:27:52 -040098static const char *const sys_clk_name __initconst = "sys_ck";
Kevin Hilman0e2f3d92011-04-04 17:22:28 -070099
Kevin Hilman81a60482011-03-16 14:25:45 -0700100void __init omap3xxx_voltagedomains_init(void)
Paul Walmsleyc0718df2011-03-10 22:17:45 -0700101{
Kevin Hilman0e2f3d92011-04-04 17:22:28 -0700102 struct voltagedomain *voltdm;
Paul Walmsleyddf536d2011-12-16 16:09:11 -0800103 struct voltagedomain **voltdms;
Kevin Hilman0e2f3d92011-04-04 17:22:28 -0700104 int i;
105
Paul Walmsleyc0718df2011-03-10 22:17:45 -0700106 /*
107 * XXX Will depend on the process, validation, and binning
108 * for the currently-running IC
109 */
Russell King3ddd4d02012-02-15 11:28:06 +0000110#ifdef CONFIG_PM_OPP
Paul Walmsleyc0718df2011-03-10 22:17:45 -0700111 if (cpu_is_omap3630()) {
Kevin Hilmane3277882011-07-14 11:29:06 -0700112 omap3_voltdm_mpu.volt_data = omap36xx_vddmpu_volt_data;
113 omap3_voltdm_core.volt_data = omap36xx_vddcore_volt_data;
Paul Walmsleyc0718df2011-03-10 22:17:45 -0700114 } else {
Kevin Hilmane3277882011-07-14 11:29:06 -0700115 omap3_voltdm_mpu.volt_data = omap34xx_vddmpu_volt_data;
116 omap3_voltdm_core.volt_data = omap34xx_vddcore_volt_data;
Paul Walmsleyc0718df2011-03-10 22:17:45 -0700117 }
Russell King3ddd4d02012-02-15 11:28:06 +0000118#endif
Paul Walmsleyc0718df2011-03-10 22:17:45 -0700119
Tero Kristo8b5d8c02012-09-25 19:33:35 +0300120 omap3_voltdm_mpu.vp_param = &omap3_mpu_vp_data;
121 omap3_voltdm_core.vp_param = &omap3_core_vp_data;
122 omap3_voltdm_mpu.vc_param = &omap3_mpu_vc_data;
123 omap3_voltdm_core.vc_param = &omap3_core_vc_data;
124
Kevin Hilman68a88b92012-04-30 16:37:10 -0700125 if (soc_is_am35xx())
Paul Walmsleyddf536d2011-12-16 16:09:11 -0800126 voltdms = voltagedomains_am35xx;
127 else
128 voltdms = voltagedomains_omap3;
129
130 for (i = 0; voltdm = voltdms[i], voltdm; i++)
Kevin Hilman0e2f3d92011-04-04 17:22:28 -0700131 voltdm->sys_clk.name = sys_clk_name;
132
Paul Walmsleyddf536d2011-12-16 16:09:11 -0800133 voltdm_init(voltdms);
Paul Walmsleyc0718df2011-03-10 22:17:45 -0700134};