blob: 9c20fbb41f6acf722a089feff1deccfccfb498ac [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
Kevin Hilmanb7ea8032011-04-04 15:25:07 -070039static struct omap_vdd_info omap4_vdd_mpu_info;
Paul Walmsleyc0718df2011-03-10 22:17:45 -070040
Kevin Hilman5892bb12011-03-29 14:36:04 -070041static const struct omap_vfsm_instance omap4_vdd_iva_vfsm = {
Paul Walmsleyc0718df2011-03-10 22:17:45 -070042 .voltsetup_reg = OMAP4_PRM_VOLTSETUP_IVA_RET_SLEEP_OFFSET,
43};
44
Kevin Hilmanb7ea8032011-04-04 15:25:07 -070045static struct omap_vdd_info omap4_vdd_iva_info;
Paul Walmsleyc0718df2011-03-10 22:17:45 -070046
Kevin Hilman5892bb12011-03-29 14:36:04 -070047static const struct omap_vfsm_instance omap4_vdd_core_vfsm = {
Paul Walmsleyc0718df2011-03-10 22:17:45 -070048 .voltsetup_reg = OMAP4_PRM_VOLTSETUP_CORE_RET_SLEEP_OFFSET,
49};
50
Kevin Hilmanb7ea8032011-04-04 15:25:07 -070051static struct omap_vdd_info omap4_vdd_core_info;
Paul Walmsleyc0718df2011-03-10 22:17:45 -070052
Kevin Hilman81a60482011-03-16 14:25:45 -070053static struct voltagedomain omap4_voltdm_mpu = {
54 .name = "mpu",
Kevin Hilman37efca72011-03-23 17:00:21 -070055 .scalable = true,
Kevin Hilman4bcc4752011-03-28 10:40:15 -070056 .read = omap4_prm_vcvp_read,
57 .write = omap4_prm_vcvp_write,
58 .rmw = omap4_prm_vcvp_rmw,
Kevin Hilmand84adcf2011-03-22 16:14:57 -070059 .vc = &omap4_vc_mpu,
Kevin Hilman5892bb12011-03-29 14:36:04 -070060 .vfsm = &omap4_vdd_mpu_vfsm,
Kevin Hilmanb7ea8032011-04-04 15:25:07 -070061 .vp = &omap4_vp_mpu,
Kevin Hilman81a60482011-03-16 14:25:45 -070062 .vdd = &omap4_vdd_mpu_info,
Paul Walmsleyc0718df2011-03-10 22:17:45 -070063};
64
Kevin Hilman81a60482011-03-16 14:25:45 -070065static struct voltagedomain omap4_voltdm_iva = {
66 .name = "iva",
Kevin Hilman37efca72011-03-23 17:00:21 -070067 .scalable = true,
Kevin Hilman4bcc4752011-03-28 10:40:15 -070068 .read = omap4_prm_vcvp_read,
69 .write = omap4_prm_vcvp_write,
70 .rmw = omap4_prm_vcvp_rmw,
Kevin Hilmand84adcf2011-03-22 16:14:57 -070071 .vc = &omap4_vc_iva,
Kevin Hilman5892bb12011-03-29 14:36:04 -070072 .vfsm = &omap4_vdd_iva_vfsm,
Kevin Hilmanb7ea8032011-04-04 15:25:07 -070073 .vp = &omap4_vp_iva,
Kevin Hilman81a60482011-03-16 14:25:45 -070074 .vdd = &omap4_vdd_iva_info,
75};
76
77static struct voltagedomain omap4_voltdm_core = {
78 .name = "core",
Kevin Hilman37efca72011-03-23 17:00:21 -070079 .scalable = true,
Kevin Hilman4bcc4752011-03-28 10:40:15 -070080 .read = omap4_prm_vcvp_read,
81 .write = omap4_prm_vcvp_write,
82 .rmw = omap4_prm_vcvp_rmw,
Kevin Hilmand84adcf2011-03-22 16:14:57 -070083 .vc = &omap4_vc_core,
Kevin Hilman5892bb12011-03-29 14:36:04 -070084 .vfsm = &omap4_vdd_core_vfsm,
Kevin Hilmanb7ea8032011-04-04 15:25:07 -070085 .vp = &omap4_vp_core,
Kevin Hilman81a60482011-03-16 14:25:45 -070086 .vdd = &omap4_vdd_core_info,
87};
88
Benoit Cousson7e1b9402011-03-21 12:11:54 +010089static struct voltagedomain omap4_voltdm_wkup = {
90 .name = "wakeup",
91};
92
Kevin Hilman81a60482011-03-16 14:25:45 -070093static struct voltagedomain *voltagedomains_omap4[] __initdata = {
94 &omap4_voltdm_mpu,
95 &omap4_voltdm_iva,
96 &omap4_voltdm_core,
Benoit Cousson7e1b9402011-03-21 12:11:54 +010097 &omap4_voltdm_wkup,
Kevin Hilman81a60482011-03-16 14:25:45 -070098 NULL,
99};
100
Kevin Hilman0e2f3d92011-04-04 17:22:28 -0700101static const char *sys_clk_name __initdata = "sys_clkin_ck";
102
Kevin Hilman81a60482011-03-16 14:25:45 -0700103void __init omap44xx_voltagedomains_init(void)
Paul Walmsleyc0718df2011-03-10 22:17:45 -0700104{
Kevin Hilman0e2f3d92011-04-04 17:22:28 -0700105 struct voltagedomain *voltdm;
106 int i;
107
Paul Walmsleyc0718df2011-03-10 22:17:45 -0700108 /*
109 * XXX Will depend on the process, validation, and binning
110 * for the currently-running IC
111 */
112 omap4_vdd_mpu_info.volt_data = omap44xx_vdd_mpu_volt_data;
113 omap4_vdd_iva_info.volt_data = omap44xx_vdd_iva_volt_data;
114 omap4_vdd_core_info.volt_data = omap44xx_vdd_core_volt_data;
115
Kevin Hilman0e2f3d92011-04-04 17:22:28 -0700116 for (i = 0; voltdm = voltagedomains_omap4[i], voltdm; i++)
117 voltdm->sys_clk.name = sys_clk_name;
118
Kevin Hilman81a60482011-03-16 14:25:45 -0700119 voltdm_init(voltagedomains_omap4);
Paul Walmsleyc0718df2011-03-10 22:17:45 -0700120};