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