Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  * OMAP3/OMAP4 Voltage Management Routines
0004  *
0005  * Author: Thara Gopinath   <thara@ti.com>
0006  *
0007  * Copyright (C) 2007 Texas Instruments, Inc.
0008  * Rajendra Nayak <rnayak@ti.com>
0009  * Lesly A M <x0080970@ti.com>
0010  *
0011  * Copyright (C) 2008 Nokia Corporation
0012  * Kalle Jokiniemi
0013  *
0014  * Copyright (C) 2010 Texas Instruments, Inc.
0015  * Thara Gopinath <thara@ti.com>
0016  */
0017 #include <linux/kernel.h>
0018 #include <linux/err.h>
0019 #include <linux/init.h>
0020 
0021 #include "common.h"
0022 #include "soc.h"
0023 #include "prm-regbits-44xx.h"
0024 #include "prm44xx.h"
0025 #include "prcm44xx.h"
0026 #include "prminst44xx.h"
0027 #include "voltage.h"
0028 #include "omap_opp_data.h"
0029 #include "vc.h"
0030 #include "vp.h"
0031 
0032 static const struct omap_vfsm_instance omap4_vdd_mpu_vfsm = {
0033     .voltsetup_reg = OMAP4_PRM_VOLTSETUP_MPU_RET_SLEEP_OFFSET,
0034     .voltsetup_off_reg = OMAP4_PRM_VOLTSETUP_MPU_OFF_OFFSET,
0035 };
0036 
0037 static const struct omap_vfsm_instance omap4_vdd_iva_vfsm = {
0038     .voltsetup_reg = OMAP4_PRM_VOLTSETUP_IVA_RET_SLEEP_OFFSET,
0039     .voltsetup_off_reg = OMAP4_PRM_VOLTSETUP_IVA_OFF_OFFSET,
0040 };
0041 
0042 static const struct omap_vfsm_instance omap4_vdd_core_vfsm = {
0043     .voltsetup_reg = OMAP4_PRM_VOLTSETUP_CORE_RET_SLEEP_OFFSET,
0044     .voltsetup_off_reg = OMAP4_PRM_VOLTSETUP_CORE_OFF_OFFSET,
0045 };
0046 
0047 static struct voltagedomain omap4_voltdm_mpu = {
0048     .name = "mpu",
0049     .scalable = true,
0050     .read = omap4_prm_vcvp_read,
0051     .write = omap4_prm_vcvp_write,
0052     .rmw = omap4_prm_vcvp_rmw,
0053     .vc = &omap4_vc_mpu,
0054     .vfsm = &omap4_vdd_mpu_vfsm,
0055     .vp = &omap4_vp_mpu,
0056 };
0057 
0058 static struct voltagedomain omap4_voltdm_iva = {
0059     .name = "iva",
0060     .scalable = true,
0061     .read = omap4_prm_vcvp_read,
0062     .write = omap4_prm_vcvp_write,
0063     .rmw = omap4_prm_vcvp_rmw,
0064     .vc = &omap4_vc_iva,
0065     .vfsm = &omap4_vdd_iva_vfsm,
0066     .vp = &omap4_vp_iva,
0067 };
0068 
0069 static struct voltagedomain omap4_voltdm_core = {
0070     .name = "core",
0071     .scalable = true,
0072     .read = omap4_prm_vcvp_read,
0073     .write = omap4_prm_vcvp_write,
0074     .rmw = omap4_prm_vcvp_rmw,
0075     .vc = &omap4_vc_core,
0076     .vfsm = &omap4_vdd_core_vfsm,
0077     .vp = &omap4_vp_core,
0078 };
0079 
0080 static struct voltagedomain omap4_voltdm_wkup = {
0081     .name = "wakeup",
0082 };
0083 
0084 static struct voltagedomain *voltagedomains_omap4[] __initdata = {
0085     &omap4_voltdm_mpu,
0086     &omap4_voltdm_iva,
0087     &omap4_voltdm_core,
0088     &omap4_voltdm_wkup,
0089     NULL,
0090 };
0091 
0092 static const char *const sys_clk_name __initconst = "sys_clkin_ck";
0093 
0094 void __init omap44xx_voltagedomains_init(void)
0095 {
0096     struct voltagedomain *voltdm;
0097     int i;
0098 
0099     /*
0100      * XXX Will depend on the process, validation, and binning
0101      * for the currently-running IC
0102      */
0103 #ifdef CONFIG_PM_OPP
0104     if (cpu_is_omap443x()) {
0105         omap4_voltdm_mpu.volt_data = omap443x_vdd_mpu_volt_data;
0106         omap4_voltdm_iva.volt_data = omap443x_vdd_iva_volt_data;
0107         omap4_voltdm_core.volt_data = omap443x_vdd_core_volt_data;
0108     } else if (cpu_is_omap446x()) {
0109         omap4_voltdm_mpu.volt_data = omap446x_vdd_mpu_volt_data;
0110         omap4_voltdm_iva.volt_data = omap446x_vdd_iva_volt_data;
0111         omap4_voltdm_core.volt_data = omap446x_vdd_core_volt_data;
0112     }
0113 #endif
0114 
0115     omap4_voltdm_mpu.vp_param = &omap4_mpu_vp_data;
0116     omap4_voltdm_iva.vp_param = &omap4_iva_vp_data;
0117     omap4_voltdm_core.vp_param = &omap4_core_vp_data;
0118 
0119     omap4_voltdm_mpu.vc_param = &omap4_mpu_vc_data;
0120     omap4_voltdm_iva.vc_param = &omap4_iva_vc_data;
0121     omap4_voltdm_core.vc_param = &omap4_core_vc_data;
0122 
0123     for (i = 0; voltdm = voltagedomains_omap4[i], voltdm; i++)
0124         voltdm->sys_clk.name = sys_clk_name;
0125 
0126     voltdm_init(voltagedomains_omap4);
0127 };