blob: 4e11d022595d13fa349601bf5c194fe69e0a40d3 [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"
Paul Walmsleyc0718df2011-03-10 22:17:45 -070025
26#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,
37};
38
Kevin Hilman5892bb12011-03-29 14:36:04 -070039static const struct omap_vfsm_instance omap4_vdd_iva_vfsm = {
Paul Walmsleyc0718df2011-03-10 22:17:45 -070040 .voltsetup_reg = OMAP4_PRM_VOLTSETUP_IVA_RET_SLEEP_OFFSET,
41};
42
Kevin Hilman5892bb12011-03-29 14:36:04 -070043static const struct omap_vfsm_instance omap4_vdd_core_vfsm = {
Paul Walmsleyc0718df2011-03-10 22:17:45 -070044 .voltsetup_reg = OMAP4_PRM_VOLTSETUP_CORE_RET_SLEEP_OFFSET,
45};
46
Kevin Hilman81a60482011-03-16 14:25:45 -070047static struct voltagedomain omap4_voltdm_mpu = {
48 .name = "mpu",
Kevin Hilman37efca72011-03-23 17:00:21 -070049 .scalable = true,
Kevin Hilman4bcc4752011-03-28 10:40:15 -070050 .read = omap4_prm_vcvp_read,
51 .write = omap4_prm_vcvp_write,
52 .rmw = omap4_prm_vcvp_rmw,
Kevin Hilmand84adcf2011-03-22 16:14:57 -070053 .vc = &omap4_vc_mpu,
Kevin Hilman5892bb12011-03-29 14:36:04 -070054 .vfsm = &omap4_vdd_mpu_vfsm,
Kevin Hilmanb7ea8032011-04-04 15:25:07 -070055 .vp = &omap4_vp_mpu,
Paul Walmsleyc0718df2011-03-10 22:17:45 -070056};
57
Kevin Hilman81a60482011-03-16 14:25:45 -070058static struct voltagedomain omap4_voltdm_iva = {
59 .name = "iva",
Kevin Hilman37efca72011-03-23 17:00:21 -070060 .scalable = true,
Kevin Hilman4bcc4752011-03-28 10:40:15 -070061 .read = omap4_prm_vcvp_read,
62 .write = omap4_prm_vcvp_write,
63 .rmw = omap4_prm_vcvp_rmw,
Kevin Hilmand84adcf2011-03-22 16:14:57 -070064 .vc = &omap4_vc_iva,
Kevin Hilman5892bb12011-03-29 14:36:04 -070065 .vfsm = &omap4_vdd_iva_vfsm,
Kevin Hilmanb7ea8032011-04-04 15:25:07 -070066 .vp = &omap4_vp_iva,
Kevin Hilman81a60482011-03-16 14:25:45 -070067};
68
69static struct voltagedomain omap4_voltdm_core = {
70 .name = "core",
Kevin Hilman37efca72011-03-23 17:00:21 -070071 .scalable = true,
Kevin Hilman4bcc4752011-03-28 10:40:15 -070072 .read = omap4_prm_vcvp_read,
73 .write = omap4_prm_vcvp_write,
74 .rmw = omap4_prm_vcvp_rmw,
Kevin Hilmand84adcf2011-03-22 16:14:57 -070075 .vc = &omap4_vc_core,
Kevin Hilman5892bb12011-03-29 14:36:04 -070076 .vfsm = &omap4_vdd_core_vfsm,
Kevin Hilmanb7ea8032011-04-04 15:25:07 -070077 .vp = &omap4_vp_core,
Kevin Hilman81a60482011-03-16 14:25:45 -070078};
79
Benoit Cousson7e1b9402011-03-21 12:11:54 +010080static struct voltagedomain omap4_voltdm_wkup = {
81 .name = "wakeup",
82};
83
Kevin Hilman81a60482011-03-16 14:25:45 -070084static struct voltagedomain *voltagedomains_omap4[] __initdata = {
85 &omap4_voltdm_mpu,
86 &omap4_voltdm_iva,
87 &omap4_voltdm_core,
Benoit Cousson7e1b9402011-03-21 12:11:54 +010088 &omap4_voltdm_wkup,
Kevin Hilman81a60482011-03-16 14:25:45 -070089 NULL,
90};
91
Kevin Hilman0e2f3d92011-04-04 17:22:28 -070092static const char *sys_clk_name __initdata = "sys_clkin_ck";
93
Kevin Hilman81a60482011-03-16 14:25:45 -070094void __init omap44xx_voltagedomains_init(void)
Paul Walmsleyc0718df2011-03-10 22:17:45 -070095{
Kevin Hilman0e2f3d92011-04-04 17:22:28 -070096 struct voltagedomain *voltdm;
97 int i;
98
Paul Walmsleyc0718df2011-03-10 22:17:45 -070099 /*
100 * XXX Will depend on the process, validation, and binning
101 * for the currently-running IC
102 */
Kevin Hilmane3277882011-07-14 11:29:06 -0700103 omap4_voltdm_mpu.volt_data = omap44xx_vdd_mpu_volt_data;
104 omap4_voltdm_iva.volt_data = omap44xx_vdd_iva_volt_data;
105 omap4_voltdm_core.volt_data = omap44xx_vdd_core_volt_data;
Paul Walmsleyc0718df2011-03-10 22:17:45 -0700106
Kevin Hilman0e2f3d92011-04-04 17:22:28 -0700107 for (i = 0; voltdm = voltagedomains_omap4[i], voltdm; i++)
108 voltdm->sys_clk.name = sys_clk_name;
109
Kevin Hilman81a60482011-03-16 14:25:45 -0700110 voltdm_init(voltagedomains_omap4);
Paul Walmsleyc0718df2011-03-10 22:17:45 -0700111};