blob: dd4bd222739a9e4b50310bac8b0d307ad0d8c7a7 [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
24#include <plat/common.h>
25
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
39static struct omap_vdd_info omap4_vdd_mpu_info = {
40 .vp_data = &omap4_vp_mpu_data,
Paul Walmsleyc0718df2011-03-10 22:17:45 -070041};
42
Kevin Hilman5892bb12011-03-29 14:36:04 -070043static const struct omap_vfsm_instance omap4_vdd_iva_vfsm = {
Paul Walmsleyc0718df2011-03-10 22:17:45 -070044 .voltsetup_reg = OMAP4_PRM_VOLTSETUP_IVA_RET_SLEEP_OFFSET,
45};
46
47static struct omap_vdd_info omap4_vdd_iva_info = {
48 .vp_data = &omap4_vp_iva_data,
Paul Walmsleyc0718df2011-03-10 22:17:45 -070049};
50
Kevin Hilman5892bb12011-03-29 14:36:04 -070051static const struct omap_vfsm_instance omap4_vdd_core_vfsm = {
Paul Walmsleyc0718df2011-03-10 22:17:45 -070052 .voltsetup_reg = OMAP4_PRM_VOLTSETUP_CORE_RET_SLEEP_OFFSET,
53};
54
55static struct omap_vdd_info omap4_vdd_core_info = {
56 .vp_data = &omap4_vp_core_data,
Paul Walmsleyc0718df2011-03-10 22:17:45 -070057};
58
Kevin Hilman81a60482011-03-16 14:25:45 -070059static struct voltagedomain omap4_voltdm_mpu = {
60 .name = "mpu",
Kevin Hilman37efca72011-03-23 17:00:21 -070061 .scalable = true,
Kevin Hilman4bcc4752011-03-28 10:40:15 -070062 .read = omap4_prm_vcvp_read,
63 .write = omap4_prm_vcvp_write,
64 .rmw = omap4_prm_vcvp_rmw,
Kevin Hilmand84adcf2011-03-22 16:14:57 -070065 .vc = &omap4_vc_mpu,
Kevin Hilman5892bb12011-03-29 14:36:04 -070066 .vfsm = &omap4_vdd_mpu_vfsm,
Kevin Hilman81a60482011-03-16 14:25:45 -070067 .vdd = &omap4_vdd_mpu_info,
Paul Walmsleyc0718df2011-03-10 22:17:45 -070068};
69
Kevin Hilman81a60482011-03-16 14:25:45 -070070static struct voltagedomain omap4_voltdm_iva = {
71 .name = "iva",
Kevin Hilman37efca72011-03-23 17:00:21 -070072 .scalable = true,
Kevin Hilman4bcc4752011-03-28 10:40:15 -070073 .read = omap4_prm_vcvp_read,
74 .write = omap4_prm_vcvp_write,
75 .rmw = omap4_prm_vcvp_rmw,
Kevin Hilmand84adcf2011-03-22 16:14:57 -070076 .vc = &omap4_vc_iva,
Kevin Hilman5892bb12011-03-29 14:36:04 -070077 .vfsm = &omap4_vdd_iva_vfsm,
Kevin Hilman81a60482011-03-16 14:25:45 -070078 .vdd = &omap4_vdd_iva_info,
79};
80
81static struct voltagedomain omap4_voltdm_core = {
82 .name = "core",
Kevin Hilman37efca72011-03-23 17:00:21 -070083 .scalable = true,
Kevin Hilman4bcc4752011-03-28 10:40:15 -070084 .read = omap4_prm_vcvp_read,
85 .write = omap4_prm_vcvp_write,
86 .rmw = omap4_prm_vcvp_rmw,
Kevin Hilmand84adcf2011-03-22 16:14:57 -070087 .vc = &omap4_vc_core,
Kevin Hilman5892bb12011-03-29 14:36:04 -070088 .vfsm = &omap4_vdd_core_vfsm,
Kevin Hilman81a60482011-03-16 14:25:45 -070089 .vdd = &omap4_vdd_core_info,
90};
91
Benoit Cousson7e1b9402011-03-21 12:11:54 +010092static struct voltagedomain omap4_voltdm_wkup = {
93 .name = "wakeup",
94};
95
Kevin Hilman81a60482011-03-16 14:25:45 -070096static struct voltagedomain *voltagedomains_omap4[] __initdata = {
97 &omap4_voltdm_mpu,
98 &omap4_voltdm_iva,
99 &omap4_voltdm_core,
Benoit Cousson7e1b9402011-03-21 12:11:54 +0100100 &omap4_voltdm_wkup,
Kevin Hilman81a60482011-03-16 14:25:45 -0700101 NULL,
102};
103
104void __init omap44xx_voltagedomains_init(void)
Paul Walmsleyc0718df2011-03-10 22:17:45 -0700105{
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 */
110 omap4_vdd_mpu_info.volt_data = omap44xx_vdd_mpu_volt_data;
111 omap4_vdd_iva_info.volt_data = omap44xx_vdd_iva_volt_data;
112 omap4_vdd_core_info.volt_data = omap44xx_vdd_core_volt_data;
113
Kevin Hilman81a60482011-03-16 14:25:45 -0700114 voltdm_init(voltagedomains_omap4);
Paul Walmsleyc0718df2011-03-10 22:17:45 -0700115};