Kyle Swenson | 8d8f654 | 2021-03-15 11:02:55 -0600 | [diff] [blame^] | 1 | /* |
| 2 | * OMAP4 Voltage Controller (VC) data |
| 3 | * |
| 4 | * Copyright (C) 2007, 2010 Texas Instruments, Inc. |
| 5 | * Rajendra Nayak <rnayak@ti.com> |
| 6 | * Lesly A M <x0080970@ti.com> |
| 7 | * Thara Gopinath <thara@ti.com> |
| 8 | * |
| 9 | * Copyright (C) 2008, 2011 Nokia Corporation |
| 10 | * Kalle Jokiniemi |
| 11 | * Paul Walmsley |
| 12 | * |
| 13 | * This program is free software; you can redistribute it and/or modify |
| 14 | * it under the terms of the GNU General Public License version 2 as |
| 15 | * published by the Free Software Foundation. |
| 16 | */ |
| 17 | #include <linux/io.h> |
| 18 | #include <linux/err.h> |
| 19 | #include <linux/init.h> |
| 20 | |
| 21 | #include "common.h" |
| 22 | |
| 23 | #include "prm44xx.h" |
| 24 | #include "prm-regbits-44xx.h" |
| 25 | #include "voltage.h" |
| 26 | |
| 27 | #include "vc.h" |
| 28 | |
| 29 | /* |
| 30 | * VC data common to 44xx chips |
| 31 | * XXX This stuff presumably belongs in the vc3xxx.c or vc.c file. |
| 32 | */ |
| 33 | static const struct omap_vc_common omap4_vc_common = { |
| 34 | .bypass_val_reg = OMAP4_PRM_VC_VAL_BYPASS_OFFSET, |
| 35 | .data_shift = OMAP4430_DATA_SHIFT, |
| 36 | .slaveaddr_shift = OMAP4430_SLAVEADDR_SHIFT, |
| 37 | .regaddr_shift = OMAP4430_REGADDR_SHIFT, |
| 38 | .valid = OMAP4430_VALID_MASK, |
| 39 | .cmd_on_shift = OMAP4430_ON_SHIFT, |
| 40 | .cmd_on_mask = OMAP4430_ON_MASK, |
| 41 | .cmd_onlp_shift = OMAP4430_ONLP_SHIFT, |
| 42 | .cmd_ret_shift = OMAP4430_RET_SHIFT, |
| 43 | .cmd_off_shift = OMAP4430_OFF_SHIFT, |
| 44 | .i2c_cfg_reg = OMAP4_PRM_VC_CFG_I2C_MODE_OFFSET, |
| 45 | .i2c_cfg_clear_mask = OMAP4430_SRMODEEN_MASK | OMAP4430_HSMODEEN_MASK, |
| 46 | .i2c_cfg_hsen_mask = OMAP4430_HSMODEEN_MASK, |
| 47 | .i2c_mcode_mask = OMAP4430_HSMCODE_MASK, |
| 48 | }; |
| 49 | |
| 50 | /* VC instance data for each controllable voltage line */ |
| 51 | struct omap_vc_channel omap4_vc_mpu = { |
| 52 | .flags = OMAP_VC_CHANNEL_DEFAULT | OMAP_VC_CHANNEL_CFG_MUTANT, |
| 53 | .common = &omap4_vc_common, |
| 54 | .smps_sa_reg = OMAP4_PRM_VC_SMPS_SA_OFFSET, |
| 55 | .smps_volra_reg = OMAP4_PRM_VC_VAL_SMPS_RA_VOL_OFFSET, |
| 56 | .smps_cmdra_reg = OMAP4_PRM_VC_VAL_SMPS_RA_CMD_OFFSET, |
| 57 | .cfg_channel_reg = OMAP4_PRM_VC_CFG_CHANNEL_OFFSET, |
| 58 | .cmdval_reg = OMAP4_PRM_VC_VAL_CMD_VDD_MPU_L_OFFSET, |
| 59 | .smps_sa_mask = OMAP4430_SA_VDD_MPU_L_PRM_VC_SMPS_SA_MASK, |
| 60 | .smps_volra_mask = OMAP4430_VOLRA_VDD_MPU_L_MASK, |
| 61 | .smps_cmdra_mask = OMAP4430_CMDRA_VDD_MPU_L_MASK, |
| 62 | .cfg_channel_sa_shift = OMAP4430_SA_VDD_MPU_L_SHIFT, |
| 63 | }; |
| 64 | |
| 65 | struct omap_vc_channel omap4_vc_iva = { |
| 66 | .common = &omap4_vc_common, |
| 67 | .smps_sa_reg = OMAP4_PRM_VC_SMPS_SA_OFFSET, |
| 68 | .smps_volra_reg = OMAP4_PRM_VC_VAL_SMPS_RA_VOL_OFFSET, |
| 69 | .smps_cmdra_reg = OMAP4_PRM_VC_VAL_SMPS_RA_CMD_OFFSET, |
| 70 | .cfg_channel_reg = OMAP4_PRM_VC_CFG_CHANNEL_OFFSET, |
| 71 | .cmdval_reg = OMAP4_PRM_VC_VAL_CMD_VDD_IVA_L_OFFSET, |
| 72 | .smps_sa_mask = OMAP4430_SA_VDD_IVA_L_PRM_VC_SMPS_SA_MASK, |
| 73 | .smps_volra_mask = OMAP4430_VOLRA_VDD_IVA_L_MASK, |
| 74 | .smps_cmdra_mask = OMAP4430_CMDRA_VDD_IVA_L_MASK, |
| 75 | .cfg_channel_sa_shift = OMAP4430_SA_VDD_IVA_L_SHIFT, |
| 76 | }; |
| 77 | |
| 78 | struct omap_vc_channel omap4_vc_core = { |
| 79 | .common = &omap4_vc_common, |
| 80 | .smps_sa_reg = OMAP4_PRM_VC_SMPS_SA_OFFSET, |
| 81 | .smps_volra_reg = OMAP4_PRM_VC_VAL_SMPS_RA_VOL_OFFSET, |
| 82 | .smps_cmdra_reg = OMAP4_PRM_VC_VAL_SMPS_RA_CMD_OFFSET, |
| 83 | .cfg_channel_reg = OMAP4_PRM_VC_CFG_CHANNEL_OFFSET, |
| 84 | .cmdval_reg = OMAP4_PRM_VC_VAL_CMD_VDD_CORE_L_OFFSET, |
| 85 | .smps_sa_mask = OMAP4430_SA_VDD_CORE_L_0_6_MASK, |
| 86 | .smps_volra_mask = OMAP4430_VOLRA_VDD_CORE_L_MASK, |
| 87 | .smps_cmdra_mask = OMAP4430_CMDRA_VDD_CORE_L_MASK, |
| 88 | .cfg_channel_sa_shift = OMAP4430_SA_VDD_CORE_L_SHIFT, |
| 89 | }; |
| 90 | |
| 91 | /* |
| 92 | * Voltage levels for different operating modes: on, sleep, retention and off |
| 93 | */ |
| 94 | #define OMAP4_ON_VOLTAGE_UV 1375000 |
| 95 | #define OMAP4_ONLP_VOLTAGE_UV 1375000 |
| 96 | #define OMAP4_RET_VOLTAGE_UV 837500 |
| 97 | #define OMAP4_OFF_VOLTAGE_UV 0 |
| 98 | |
| 99 | struct omap_vc_param omap4_mpu_vc_data = { |
| 100 | .on = OMAP4_ON_VOLTAGE_UV, |
| 101 | .onlp = OMAP4_ONLP_VOLTAGE_UV, |
| 102 | .ret = OMAP4_RET_VOLTAGE_UV, |
| 103 | .off = OMAP4_OFF_VOLTAGE_UV, |
| 104 | }; |
| 105 | |
| 106 | struct omap_vc_param omap4_iva_vc_data = { |
| 107 | .on = OMAP4_ON_VOLTAGE_UV, |
| 108 | .onlp = OMAP4_ONLP_VOLTAGE_UV, |
| 109 | .ret = OMAP4_RET_VOLTAGE_UV, |
| 110 | .off = OMAP4_OFF_VOLTAGE_UV, |
| 111 | }; |
| 112 | |
| 113 | struct omap_vc_param omap4_core_vc_data = { |
| 114 | .on = OMAP4_ON_VOLTAGE_UV, |
| 115 | .onlp = OMAP4_ONLP_VOLTAGE_UV, |
| 116 | .ret = OMAP4_RET_VOLTAGE_UV, |
| 117 | .off = OMAP4_OFF_VOLTAGE_UV, |
| 118 | }; |