1/*
2 * OMAP5 Voltage Management Routines
3 *
4 * Based on voltagedomains44xx_data.c
5 *
6 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12#include <linux/kernel.h>
13#include <linux/err.h>
14#include <linux/init.h>
15
16#include "common.h"
17
18#include "prm54xx.h"
19#include "voltage.h"
20#include "omap_opp_data.h"
21#include "vc.h"
22#include "vp.h"
23
24static const struct omap_vfsm_instance omap5_vdd_mpu_vfsm = {
25	.voltsetup_reg = OMAP54XX_PRM_VOLTSETUP_MPU_RET_SLEEP_OFFSET,
26};
27
28static const struct omap_vfsm_instance omap5_vdd_mm_vfsm = {
29	.voltsetup_reg = OMAP54XX_PRM_VOLTSETUP_MM_RET_SLEEP_OFFSET,
30};
31
32static const struct omap_vfsm_instance omap5_vdd_core_vfsm = {
33	.voltsetup_reg = OMAP54XX_PRM_VOLTSETUP_CORE_RET_SLEEP_OFFSET,
34};
35
36static struct voltagedomain omap5_voltdm_mpu = {
37	.name = "mpu",
38	.scalable = true,
39	.read = omap4_prm_vcvp_read,
40	.write = omap4_prm_vcvp_write,
41	.rmw = omap4_prm_vcvp_rmw,
42	.vc = &omap4_vc_mpu,
43	.vfsm = &omap5_vdd_mpu_vfsm,
44	.vp = &omap4_vp_mpu,
45};
46
47static struct voltagedomain omap5_voltdm_mm = {
48	.name = "mm",
49	.scalable = true,
50	.read = omap4_prm_vcvp_read,
51	.write = omap4_prm_vcvp_write,
52	.rmw = omap4_prm_vcvp_rmw,
53	.vc = &omap4_vc_iva,
54	.vfsm = &omap5_vdd_mm_vfsm,
55	.vp = &omap4_vp_iva,
56};
57
58static struct voltagedomain omap5_voltdm_core = {
59	.name = "core",
60	.scalable = true,
61	.read = omap4_prm_vcvp_read,
62	.write = omap4_prm_vcvp_write,
63	.rmw = omap4_prm_vcvp_rmw,
64	.vc = &omap4_vc_core,
65	.vfsm = &omap5_vdd_core_vfsm,
66	.vp = &omap4_vp_core,
67};
68
69static struct voltagedomain omap5_voltdm_wkup = {
70	.name = "wkup",
71};
72
73static struct voltagedomain *voltagedomains_omap5[] __initdata = {
74	&omap5_voltdm_mpu,
75	&omap5_voltdm_mm,
76	&omap5_voltdm_core,
77	&omap5_voltdm_wkup,
78	NULL,
79};
80
81static const char *sys_clk_name __initdata = "sys_clkin";
82
83void __init omap54xx_voltagedomains_init(void)
84{
85	struct voltagedomain *voltdm;
86	int i;
87
88	for (i = 0; voltdm = voltagedomains_omap5[i], voltdm; i++)
89		voltdm->sys_clk.name = sys_clk_name;
90
91	voltdm_init(voltagedomains_omap5);
92};
93