blob: 9b1f245b57d61319504c15a8af652784835a8d9c [file] [log] [blame]
Paul Walmsleyc0718df2011-03-10 22:17:45 -07001/*
2 * OMAP3/OMAP4 Voltage Management Routines
3 *
4 * Author: Thara Gopinath <thara@ti.com>
5 *
6 * Copyright (C) 2007 Texas Instruments, Inc.
7 * Rajendra Nayak <rnayak@ti.com>
8 * Lesly A M <x0080970@ti.com>
9 *
10 * Copyright (C) 2008 Nokia Corporation
11 * Kalle Jokiniemi
12 *
13 * Copyright (C) 2010 Texas Instruments, Inc.
14 * Thara Gopinath <thara@ti.com>
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License version 2 as
18 * published by the Free Software Foundation.
19 */
20#include <linux/kernel.h>
21#include <linux/err.h>
22#include <linux/init.h>
23
Tony Lindgren4e653312011-11-10 22:45:17 +010024#include "common.h"
Tony Lindgren89ab2162012-11-13 13:25:38 -080025#include "soc.h"
Paul Walmsleyc0718df2011-03-10 22:17:45 -070026#include "prm-regbits-44xx.h"
27#include "prm44xx.h"
28#include "prcm44xx.h"
29#include "prminst44xx.h"
30#include "voltage.h"
31#include "omap_opp_data.h"
32#include "vc.h"
33#include "vp.h"
34
Kevin Hilman5892bb12011-03-29 14:36:04 -070035static const struct omap_vfsm_instance omap4_vdd_mpu_vfsm = {
Paul Walmsleyc0718df2011-03-10 22:17:45 -070036 .voltsetup_reg = OMAP4_PRM_VOLTSETUP_MPU_RET_SLEEP_OFFSET,
Tero Kristo27c16b72012-09-25 19:33:37 +030037 .voltsetup_off_reg = OMAP4_PRM_VOLTSETUP_MPU_OFF_OFFSET,
Paul Walmsleyc0718df2011-03-10 22:17:45 -070038};
39
Kevin Hilman5892bb12011-03-29 14:36:04 -070040static const struct omap_vfsm_instance omap4_vdd_iva_vfsm = {
Paul Walmsleyc0718df2011-03-10 22:17:45 -070041 .voltsetup_reg = OMAP4_PRM_VOLTSETUP_IVA_RET_SLEEP_OFFSET,
Tero Kristo27c16b72012-09-25 19:33:37 +030042 .voltsetup_off_reg = OMAP4_PRM_VOLTSETUP_IVA_OFF_OFFSET,
Paul Walmsleyc0718df2011-03-10 22:17:45 -070043};
44
Kevin Hilman5892bb12011-03-29 14:36:04 -070045static const struct omap_vfsm_instance omap4_vdd_core_vfsm = {
Paul Walmsleyc0718df2011-03-10 22:17:45 -070046 .voltsetup_reg = OMAP4_PRM_VOLTSETUP_CORE_RET_SLEEP_OFFSET,
Tero Kristo27c16b72012-09-25 19:33:37 +030047 .voltsetup_off_reg = OMAP4_PRM_VOLTSETUP_CORE_OFF_OFFSET,
Paul Walmsleyc0718df2011-03-10 22:17:45 -070048};
49
Kevin Hilman81a60482011-03-16 14:25:45 -070050static struct voltagedomain omap4_voltdm_mpu = {
51 .name = "mpu",
Kevin Hilman37efca72011-03-23 17:00:21 -070052 .scalable = true,
Kevin Hilman4bcc4752011-03-28 10:40:15 -070053 .read = omap4_prm_vcvp_read,
54 .write = omap4_prm_vcvp_write,
55 .rmw = omap4_prm_vcvp_rmw,
Kevin Hilmand84adcf2011-03-22 16:14:57 -070056 .vc = &omap4_vc_mpu,
Kevin Hilman5892bb12011-03-29 14:36:04 -070057 .vfsm = &omap4_vdd_mpu_vfsm,
Kevin Hilmanb7ea8032011-04-04 15:25:07 -070058 .vp = &omap4_vp_mpu,
Paul Walmsleyc0718df2011-03-10 22:17:45 -070059};
60
Kevin Hilman81a60482011-03-16 14:25:45 -070061static struct voltagedomain omap4_voltdm_iva = {
62 .name = "iva",
Kevin Hilman37efca72011-03-23 17:00:21 -070063 .scalable = true,
Kevin Hilman4bcc4752011-03-28 10:40:15 -070064 .read = omap4_prm_vcvp_read,
65 .write = omap4_prm_vcvp_write,
66 .rmw = omap4_prm_vcvp_rmw,
Kevin Hilmand84adcf2011-03-22 16:14:57 -070067 .vc = &omap4_vc_iva,
Kevin Hilman5892bb12011-03-29 14:36:04 -070068 .vfsm = &omap4_vdd_iva_vfsm,
Kevin Hilmanb7ea8032011-04-04 15:25:07 -070069 .vp = &omap4_vp_iva,
Kevin Hilman81a60482011-03-16 14:25:45 -070070};
71
72static struct voltagedomain omap4_voltdm_core = {
73 .name = "core",
Kevin Hilman37efca72011-03-23 17:00:21 -070074 .scalable = true,
Kevin Hilman4bcc4752011-03-28 10:40:15 -070075 .read = omap4_prm_vcvp_read,
76 .write = omap4_prm_vcvp_write,
77 .rmw = omap4_prm_vcvp_rmw,
Kevin Hilmand84adcf2011-03-22 16:14:57 -070078 .vc = &omap4_vc_core,
Kevin Hilman5892bb12011-03-29 14:36:04 -070079 .vfsm = &omap4_vdd_core_vfsm,
Kevin Hilmanb7ea8032011-04-04 15:25:07 -070080 .vp = &omap4_vp_core,
Kevin Hilman81a60482011-03-16 14:25:45 -070081};
82
Benoit Cousson7e1b9402011-03-21 12:11:54 +010083static struct voltagedomain omap4_voltdm_wkup = {
84 .name = "wakeup",
85};
86
Kevin Hilman81a60482011-03-16 14:25:45 -070087static struct voltagedomain *voltagedomains_omap4[] __initdata = {
88 &omap4_voltdm_mpu,
89 &omap4_voltdm_iva,
90 &omap4_voltdm_core,
Benoit Cousson7e1b9402011-03-21 12:11:54 +010091 &omap4_voltdm_wkup,
Kevin Hilman81a60482011-03-16 14:25:45 -070092 NULL,
93};
94
Nicolas Pitre19c233b2015-07-27 18:27:52 -040095static const char *const sys_clk_name __initconst = "sys_clkin_ck";
Kevin Hilman0e2f3d92011-04-04 17:22:28 -070096
Kevin Hilman81a60482011-03-16 14:25:45 -070097void __init omap44xx_voltagedomains_init(void)
Paul Walmsleyc0718df2011-03-10 22:17:45 -070098{
Kevin Hilman0e2f3d92011-04-04 17:22:28 -070099 struct voltagedomain *voltdm;
100 int i;
101
Paul Walmsleyc0718df2011-03-10 22:17:45 -0700102 /*
103 * XXX Will depend on the process, validation, and binning
104 * for the currently-running IC
105 */
Russell King3ddd4d02012-02-15 11:28:06 +0000106#ifdef CONFIG_PM_OPP
Vishwanath Sripathydf7cded2012-09-25 19:33:50 +0300107 if (cpu_is_omap443x()) {
108 omap4_voltdm_mpu.volt_data = omap443x_vdd_mpu_volt_data;
109 omap4_voltdm_iva.volt_data = omap443x_vdd_iva_volt_data;
110 omap4_voltdm_core.volt_data = omap443x_vdd_core_volt_data;
111 } else if (cpu_is_omap446x()) {
112 omap4_voltdm_mpu.volt_data = omap446x_vdd_mpu_volt_data;
113 omap4_voltdm_iva.volt_data = omap446x_vdd_iva_volt_data;
114 omap4_voltdm_core.volt_data = omap446x_vdd_core_volt_data;
115 }
Russell King3ddd4d02012-02-15 11:28:06 +0000116#endif
Paul Walmsleyc0718df2011-03-10 22:17:45 -0700117
Tero Kristo8b5d8c02012-09-25 19:33:35 +0300118 omap4_voltdm_mpu.vp_param = &omap4_mpu_vp_data;
119 omap4_voltdm_iva.vp_param = &omap4_iva_vp_data;
120 omap4_voltdm_core.vp_param = &omap4_core_vp_data;
121
122 omap4_voltdm_mpu.vc_param = &omap4_mpu_vc_data;
123 omap4_voltdm_iva.vc_param = &omap4_iva_vc_data;
124 omap4_voltdm_core.vc_param = &omap4_core_vc_data;
125
Kevin Hilman0e2f3d92011-04-04 17:22:28 -0700126 for (i = 0; voltdm = voltagedomains_omap4[i], voltdm; i++)
127 voltdm->sys_clk.name = sys_clk_name;
128
Kevin Hilman81a60482011-03-16 14:25:45 -0700129 voltdm_init(voltagedomains_omap4);
Paul Walmsleyc0718df2011-03-10 22:17:45 -0700130};