18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * OMAP4 Voltage Controller (VC) data 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (C) 2007, 2010 Texas Instruments, Inc. 68c2ecf20Sopenharmony_ci * Rajendra Nayak <rnayak@ti.com> 78c2ecf20Sopenharmony_ci * Lesly A M <x0080970@ti.com> 88c2ecf20Sopenharmony_ci * Thara Gopinath <thara@ti.com> 98c2ecf20Sopenharmony_ci * 108c2ecf20Sopenharmony_ci * Copyright (C) 2008, 2011 Nokia Corporation 118c2ecf20Sopenharmony_ci * Kalle Jokiniemi 128c2ecf20Sopenharmony_ci * Paul Walmsley 138c2ecf20Sopenharmony_ci */ 148c2ecf20Sopenharmony_ci#include <linux/io.h> 158c2ecf20Sopenharmony_ci#include <linux/err.h> 168c2ecf20Sopenharmony_ci#include <linux/init.h> 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci#include "common.h" 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci#include "prm44xx.h" 218c2ecf20Sopenharmony_ci#include "prm-regbits-44xx.h" 228c2ecf20Sopenharmony_ci#include "voltage.h" 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci#include "vc.h" 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci/* 278c2ecf20Sopenharmony_ci * VC data common to 44xx chips 288c2ecf20Sopenharmony_ci * XXX This stuff presumably belongs in the vc3xxx.c or vc.c file. 298c2ecf20Sopenharmony_ci */ 308c2ecf20Sopenharmony_cistatic const struct omap_vc_common omap4_vc_common = { 318c2ecf20Sopenharmony_ci .bypass_val_reg = OMAP4_PRM_VC_VAL_BYPASS_OFFSET, 328c2ecf20Sopenharmony_ci .data_shift = OMAP4430_DATA_SHIFT, 338c2ecf20Sopenharmony_ci .slaveaddr_shift = OMAP4430_SLAVEADDR_SHIFT, 348c2ecf20Sopenharmony_ci .regaddr_shift = OMAP4430_REGADDR_SHIFT, 358c2ecf20Sopenharmony_ci .valid = OMAP4430_VALID_MASK, 368c2ecf20Sopenharmony_ci .cmd_on_shift = OMAP4430_ON_SHIFT, 378c2ecf20Sopenharmony_ci .cmd_on_mask = OMAP4430_ON_MASK, 388c2ecf20Sopenharmony_ci .cmd_onlp_shift = OMAP4430_ONLP_SHIFT, 398c2ecf20Sopenharmony_ci .cmd_ret_shift = OMAP4430_RET_SHIFT, 408c2ecf20Sopenharmony_ci .cmd_off_shift = OMAP4430_OFF_SHIFT, 418c2ecf20Sopenharmony_ci .i2c_cfg_reg = OMAP4_PRM_VC_CFG_I2C_MODE_OFFSET, 428c2ecf20Sopenharmony_ci .i2c_cfg_clear_mask = OMAP4430_SRMODEEN_MASK | OMAP4430_HSMODEEN_MASK, 438c2ecf20Sopenharmony_ci .i2c_cfg_hsen_mask = OMAP4430_HSMODEEN_MASK, 448c2ecf20Sopenharmony_ci .i2c_mcode_mask = OMAP4430_HSMCODE_MASK, 458c2ecf20Sopenharmony_ci}; 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ci/* VC instance data for each controllable voltage line */ 488c2ecf20Sopenharmony_cistruct omap_vc_channel omap4_vc_mpu = { 498c2ecf20Sopenharmony_ci .flags = OMAP_VC_CHANNEL_DEFAULT | OMAP_VC_CHANNEL_CFG_MUTANT, 508c2ecf20Sopenharmony_ci .common = &omap4_vc_common, 518c2ecf20Sopenharmony_ci .smps_sa_reg = OMAP4_PRM_VC_SMPS_SA_OFFSET, 528c2ecf20Sopenharmony_ci .smps_volra_reg = OMAP4_PRM_VC_VAL_SMPS_RA_VOL_OFFSET, 538c2ecf20Sopenharmony_ci .smps_cmdra_reg = OMAP4_PRM_VC_VAL_SMPS_RA_CMD_OFFSET, 548c2ecf20Sopenharmony_ci .cfg_channel_reg = OMAP4_PRM_VC_CFG_CHANNEL_OFFSET, 558c2ecf20Sopenharmony_ci .cmdval_reg = OMAP4_PRM_VC_VAL_CMD_VDD_MPU_L_OFFSET, 568c2ecf20Sopenharmony_ci .smps_sa_mask = OMAP4430_SA_VDD_MPU_L_PRM_VC_SMPS_SA_MASK, 578c2ecf20Sopenharmony_ci .smps_volra_mask = OMAP4430_VOLRA_VDD_MPU_L_MASK, 588c2ecf20Sopenharmony_ci .smps_cmdra_mask = OMAP4430_CMDRA_VDD_MPU_L_MASK, 598c2ecf20Sopenharmony_ci .cfg_channel_sa_shift = OMAP4430_SA_VDD_MPU_L_SHIFT, 608c2ecf20Sopenharmony_ci}; 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_cistruct omap_vc_channel omap4_vc_iva = { 638c2ecf20Sopenharmony_ci .common = &omap4_vc_common, 648c2ecf20Sopenharmony_ci .smps_sa_reg = OMAP4_PRM_VC_SMPS_SA_OFFSET, 658c2ecf20Sopenharmony_ci .smps_volra_reg = OMAP4_PRM_VC_VAL_SMPS_RA_VOL_OFFSET, 668c2ecf20Sopenharmony_ci .smps_cmdra_reg = OMAP4_PRM_VC_VAL_SMPS_RA_CMD_OFFSET, 678c2ecf20Sopenharmony_ci .cfg_channel_reg = OMAP4_PRM_VC_CFG_CHANNEL_OFFSET, 688c2ecf20Sopenharmony_ci .cmdval_reg = OMAP4_PRM_VC_VAL_CMD_VDD_IVA_L_OFFSET, 698c2ecf20Sopenharmony_ci .smps_sa_mask = OMAP4430_SA_VDD_IVA_L_PRM_VC_SMPS_SA_MASK, 708c2ecf20Sopenharmony_ci .smps_volra_mask = OMAP4430_VOLRA_VDD_IVA_L_MASK, 718c2ecf20Sopenharmony_ci .smps_cmdra_mask = OMAP4430_CMDRA_VDD_IVA_L_MASK, 728c2ecf20Sopenharmony_ci .cfg_channel_sa_shift = OMAP4430_SA_VDD_IVA_L_SHIFT, 738c2ecf20Sopenharmony_ci}; 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_cistruct omap_vc_channel omap4_vc_core = { 768c2ecf20Sopenharmony_ci .common = &omap4_vc_common, 778c2ecf20Sopenharmony_ci .smps_sa_reg = OMAP4_PRM_VC_SMPS_SA_OFFSET, 788c2ecf20Sopenharmony_ci .smps_volra_reg = OMAP4_PRM_VC_VAL_SMPS_RA_VOL_OFFSET, 798c2ecf20Sopenharmony_ci .smps_cmdra_reg = OMAP4_PRM_VC_VAL_SMPS_RA_CMD_OFFSET, 808c2ecf20Sopenharmony_ci .cfg_channel_reg = OMAP4_PRM_VC_CFG_CHANNEL_OFFSET, 818c2ecf20Sopenharmony_ci .cmdval_reg = OMAP4_PRM_VC_VAL_CMD_VDD_CORE_L_OFFSET, 828c2ecf20Sopenharmony_ci .smps_sa_mask = OMAP4430_SA_VDD_CORE_L_0_6_MASK, 838c2ecf20Sopenharmony_ci .smps_volra_mask = OMAP4430_VOLRA_VDD_CORE_L_MASK, 848c2ecf20Sopenharmony_ci .smps_cmdra_mask = OMAP4430_CMDRA_VDD_CORE_L_MASK, 858c2ecf20Sopenharmony_ci .cfg_channel_sa_shift = OMAP4430_SA_VDD_CORE_L_SHIFT, 868c2ecf20Sopenharmony_ci}; 878c2ecf20Sopenharmony_ci 888c2ecf20Sopenharmony_ci/* 898c2ecf20Sopenharmony_ci * Voltage levels for different operating modes: on, sleep, retention and off 908c2ecf20Sopenharmony_ci */ 918c2ecf20Sopenharmony_ci#define OMAP4_ON_VOLTAGE_UV 1375000 928c2ecf20Sopenharmony_ci#define OMAP4_ONLP_VOLTAGE_UV 1375000 938c2ecf20Sopenharmony_ci#define OMAP4_RET_VOLTAGE_UV 837500 948c2ecf20Sopenharmony_ci#define OMAP4_OFF_VOLTAGE_UV 0 958c2ecf20Sopenharmony_ci 968c2ecf20Sopenharmony_cistruct omap_vc_param omap4_mpu_vc_data = { 978c2ecf20Sopenharmony_ci .on = OMAP4_ON_VOLTAGE_UV, 988c2ecf20Sopenharmony_ci .onlp = OMAP4_ONLP_VOLTAGE_UV, 998c2ecf20Sopenharmony_ci .ret = OMAP4_RET_VOLTAGE_UV, 1008c2ecf20Sopenharmony_ci .off = OMAP4_OFF_VOLTAGE_UV, 1018c2ecf20Sopenharmony_ci}; 1028c2ecf20Sopenharmony_ci 1038c2ecf20Sopenharmony_cistruct omap_vc_param omap4_iva_vc_data = { 1048c2ecf20Sopenharmony_ci .on = OMAP4_ON_VOLTAGE_UV, 1058c2ecf20Sopenharmony_ci .onlp = OMAP4_ONLP_VOLTAGE_UV, 1068c2ecf20Sopenharmony_ci .ret = OMAP4_RET_VOLTAGE_UV, 1078c2ecf20Sopenharmony_ci .off = OMAP4_OFF_VOLTAGE_UV, 1088c2ecf20Sopenharmony_ci}; 1098c2ecf20Sopenharmony_ci 1108c2ecf20Sopenharmony_cistruct omap_vc_param omap4_core_vc_data = { 1118c2ecf20Sopenharmony_ci .on = OMAP4_ON_VOLTAGE_UV, 1128c2ecf20Sopenharmony_ci .onlp = OMAP4_ONLP_VOLTAGE_UV, 1138c2ecf20Sopenharmony_ci .ret = OMAP4_RET_VOLTAGE_UV, 1148c2ecf20Sopenharmony_ci .off = OMAP4_OFF_VOLTAGE_UV, 1158c2ecf20Sopenharmony_ci}; 116