1 // SPDX-License-Identifier: GPL-2.0-only
3 * OMAP3/OMAP4 Voltage Management Routines
5 * Author: Thara Gopinath <thara@ti.com>
7 * Copyright (C) 2007 Texas Instruments, Inc.
8 * Rajendra Nayak <rnayak@ti.com>
9 * Lesly A M <x0080970@ti.com>
11 * Copyright (C) 2008 Nokia Corporation
14 * Copyright (C) 2010 Texas Instruments, Inc.
15 * Thara Gopinath <thara@ti.com>
17 #include <linux/kernel.h>
18 #include <linux/err.h>
19 #include <linux/init.h>
23 #include "prm-regbits-44xx.h"
26 #include "prminst44xx.h"
28 #include "omap_opp_data.h"
32 static const struct omap_vfsm_instance omap4_vdd_mpu_vfsm = {
33 .voltsetup_reg = OMAP4_PRM_VOLTSETUP_MPU_RET_SLEEP_OFFSET,
34 .voltsetup_off_reg = OMAP4_PRM_VOLTSETUP_MPU_OFF_OFFSET,
37 static const struct omap_vfsm_instance omap4_vdd_iva_vfsm = {
38 .voltsetup_reg = OMAP4_PRM_VOLTSETUP_IVA_RET_SLEEP_OFFSET,
39 .voltsetup_off_reg = OMAP4_PRM_VOLTSETUP_IVA_OFF_OFFSET,
42 static const struct omap_vfsm_instance omap4_vdd_core_vfsm = {
43 .voltsetup_reg = OMAP4_PRM_VOLTSETUP_CORE_RET_SLEEP_OFFSET,
44 .voltsetup_off_reg = OMAP4_PRM_VOLTSETUP_CORE_OFF_OFFSET,
47 static struct voltagedomain omap4_voltdm_mpu = {
50 .read = omap4_prm_vcvp_read,
51 .write = omap4_prm_vcvp_write,
52 .rmw = omap4_prm_vcvp_rmw,
54 .vfsm = &omap4_vdd_mpu_vfsm,
58 static struct voltagedomain omap4_voltdm_iva = {
61 .read = omap4_prm_vcvp_read,
62 .write = omap4_prm_vcvp_write,
63 .rmw = omap4_prm_vcvp_rmw,
65 .vfsm = &omap4_vdd_iva_vfsm,
69 static struct voltagedomain omap4_voltdm_core = {
72 .read = omap4_prm_vcvp_read,
73 .write = omap4_prm_vcvp_write,
74 .rmw = omap4_prm_vcvp_rmw,
76 .vfsm = &omap4_vdd_core_vfsm,
80 static struct voltagedomain omap4_voltdm_wkup = {
84 static struct voltagedomain *voltagedomains_omap4[] __initdata = {
92 static const char *const sys_clk_name __initconst = "sys_clkin_ck";
94 void __init omap44xx_voltagedomains_init(void)
96 struct voltagedomain *voltdm;
100 * XXX Will depend on the process, validation, and binning
101 * for the currently-running IC
104 if (cpu_is_omap443x()) {
105 omap4_voltdm_mpu.volt_data = omap443x_vdd_mpu_volt_data;
106 omap4_voltdm_iva.volt_data = omap443x_vdd_iva_volt_data;
107 omap4_voltdm_core.volt_data = omap443x_vdd_core_volt_data;
108 } else if (cpu_is_omap446x()) {
109 omap4_voltdm_mpu.volt_data = omap446x_vdd_mpu_volt_data;
110 omap4_voltdm_iva.volt_data = omap446x_vdd_iva_volt_data;
111 omap4_voltdm_core.volt_data = omap446x_vdd_core_volt_data;
115 omap4_voltdm_mpu.vp_param = &omap4_mpu_vp_data;
116 omap4_voltdm_iva.vp_param = &omap4_iva_vp_data;
117 omap4_voltdm_core.vp_param = &omap4_core_vp_data;
119 omap4_voltdm_mpu.vc_param = &omap4_mpu_vc_data;
120 omap4_voltdm_iva.vc_param = &omap4_iva_vc_data;
121 omap4_voltdm_core.vc_param = &omap4_core_vc_data;
123 for (i = 0; voltdm = voltagedomains_omap4[i], voltdm; i++)
124 voltdm->sys_clk.name = sys_clk_name;
126 voltdm_init(voltagedomains_omap4);