Brian Swetland | 9a47753 | 2009-01-01 11:40:02 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2008, Google Inc. |
| 3 | * All rights reserved. |
| 4 | * |
Channagoud Kadabi | fd47373 | 2011-10-19 22:43:41 +0530 | [diff] [blame] | 5 | * Copyright (c) 2009-2011, Code Aurora Forum. All rights reserved. |
Shashank Mittal | 52525ff | 2010-04-13 11:11:10 -0700 | [diff] [blame] | 6 | * |
Brian Swetland | 9a47753 | 2009-01-01 11:40:02 -0800 | [diff] [blame] | 7 | * Redistribution and use in source and binary forms, with or without |
| 8 | * modification, are permitted provided that the following conditions |
| 9 | * are met: |
| 10 | * * Redistributions of source code must retain the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer. |
| 12 | * * Redistributions in binary form must reproduce the above copyright |
| 13 | * notice, this list of conditions and the following disclaimer in |
| 14 | * the documentation and/or other materials provided with the |
| 15 | * distribution. |
| 16 | * |
| 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 18 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 19 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 20 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
| 21 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
| 23 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS |
| 24 | * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
| 25 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 26 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
| 27 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 28 | * SUCH DAMAGE. |
| 29 | */ |
| 30 | |
| 31 | #include <debug.h> |
| 32 | #include <reg.h> |
Greg Grisco | d2471ef | 2011-07-14 13:00:42 -0700 | [diff] [blame] | 33 | #include <dev/gpio.h> |
Brian Swetland | 9a47753 | 2009-01-01 11:40:02 -0800 | [diff] [blame] | 34 | |
| 35 | #include <platform/iomap.h> |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 36 | #define ACPU_CLK 0 /* Applications processor clock */ |
| 37 | #define ADM_CLK 1 /* Applications data mover clock */ |
| 38 | #define ADSP_CLK 2 /* ADSP clock */ |
| 39 | #define EBI1_CLK 3 /* External bus interface 1 clock */ |
| 40 | #define EBI2_CLK 4 /* External bus interface 2 clock */ |
| 41 | #define ECODEC_CLK 5 /* External CODEC clock */ |
| 42 | #define EMDH_CLK 6 /* External MDDI host clock */ |
| 43 | #define GP_CLK 7 /* General purpose clock */ |
| 44 | #define GRP_CLK 8 /* Graphics clock */ |
| 45 | #define I2C_CLK 9 /* I2C clock */ |
| 46 | #define ICODEC_RX_CLK 10 /* Internal CODEX RX clock */ |
| 47 | #define ICODEC_TX_CLK 11 /* Internal CODEX TX clock */ |
| 48 | #define IMEM_CLK 12 /* Internal graphics memory clock */ |
| 49 | #define MDC_CLK 13 /* MDDI client clock */ |
| 50 | #define MDP_CLK 14 /* Mobile display processor clock */ |
| 51 | #define PBUS_CLK 15 /* Peripheral bus clock */ |
| 52 | #define PCM_CLK 16 /* PCM clock */ |
| 53 | #define PMDH_CLK 17 /* Primary MDDI host clock */ |
| 54 | #define SDAC_CLK 18 /* Stereo DAC clock */ |
| 55 | #define SDC1_CLK 19 /* Secure Digital Card clocks */ |
Brian Swetland | 9a47753 | 2009-01-01 11:40:02 -0800 | [diff] [blame] | 56 | #define SDC1_PCLK 20 |
| 57 | #define SDC2_CLK 21 |
| 58 | #define SDC2_PCLK 22 |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 59 | #define SDC3_CLK 23 |
| 60 | #define SDC3_PCLK 24 |
Brian Swetland | 9a47753 | 2009-01-01 11:40:02 -0800 | [diff] [blame] | 61 | #define SDC4_CLK 25 |
| 62 | #define SDC4_PCLK 26 |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 63 | #define TSIF_CLK 27 /* Transport Stream Interface clocks */ |
Brian Swetland | 9a47753 | 2009-01-01 11:40:02 -0800 | [diff] [blame] | 64 | #define TSIF_REF_CLK 28 |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 65 | #define TV_DAC_CLK 29 /* TV clocks */ |
Brian Swetland | 9a47753 | 2009-01-01 11:40:02 -0800 | [diff] [blame] | 66 | #define TV_ENC_CLK 30 |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 67 | #define UART1_CLK 31 /* UART clocks */ |
Brian Swetland | 9a47753 | 2009-01-01 11:40:02 -0800 | [diff] [blame] | 68 | #define UART2_CLK 32 |
| 69 | #define UART3_CLK 33 |
| 70 | #define UART1DM_CLK 34 |
| 71 | #define UART2DM_CLK 35 |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 72 | #define USB_HS_CLK 36 /* High speed USB core clock */ |
| 73 | #define USB_HS_PCLK 37 /* High speed USB pbus clock */ |
| 74 | #define USB_OTG_CLK 38 /* Full speed USB clock */ |
| 75 | #define VDC_CLK 39 /* Video controller clock */ |
| 76 | #define VFE_CLK 40 /* Camera / Video Front End clock */ |
| 77 | #define VFE_MDC_CLK 41 /* VFE MDDI client clock */ |
Brian Swetland | 9a47753 | 2009-01-01 11:40:02 -0800 | [diff] [blame] | 78 | |
| 79 | /* qsd8k adds... */ |
| 80 | #define MDP_LCDC_PCLK_CLK 42 |
| 81 | #define MDP_LCDC_PAD_PCLK_CLK 43 |
| 82 | #define MDP_VSYNC_CLK 44 |
| 83 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 84 | #define P_USB_HS_CORE_CLK 53 /* High speed USB 1 core clock */ |
Shashank Mittal | 3704083 | 2010-08-24 15:57:57 -0700 | [diff] [blame] | 85 | /* msm7x30 adds... */ |
Chandan Uddaraju | c009e4d | 2010-09-08 17:06:45 -0700 | [diff] [blame] | 86 | #define PMDH_P_CLK 82 |
Shashank Mittal | 3704083 | 2010-08-24 15:57:57 -0700 | [diff] [blame] | 87 | #define MDP_P_CLK 86 |
| 88 | |
Brian Swetland | 9a47753 | 2009-01-01 11:40:02 -0800 | [diff] [blame] | 89 | enum { |
| 90 | PCOM_CMD_IDLE = 0x0, |
| 91 | PCOM_CMD_DONE, |
| 92 | PCOM_RESET_APPS, |
| 93 | PCOM_RESET_CHIP, |
| 94 | PCOM_CONFIG_NAND_MPU, |
| 95 | PCOM_CONFIG_USB_CLKS, |
| 96 | PCOM_GET_POWER_ON_STATUS, |
| 97 | PCOM_GET_WAKE_UP_STATUS, |
| 98 | PCOM_GET_BATT_LEVEL, |
| 99 | PCOM_CHG_IS_CHARGING, |
| 100 | PCOM_POWER_DOWN, |
| 101 | PCOM_USB_PIN_CONFIG, |
| 102 | PCOM_USB_PIN_SEL, |
| 103 | PCOM_SET_RTC_ALARM, |
| 104 | PCOM_NV_READ, |
| 105 | PCOM_NV_WRITE, |
| 106 | PCOM_GET_UUID_HIGH, |
| 107 | PCOM_GET_UUID_LOW, |
| 108 | PCOM_GET_HW_ENTROPY, |
| 109 | PCOM_RPC_GPIO_TLMM_CONFIG_REMOTE, |
| 110 | PCOM_CLKCTL_RPC_ENABLE, |
| 111 | PCOM_CLKCTL_RPC_DISABLE, |
| 112 | PCOM_CLKCTL_RPC_RESET, |
| 113 | PCOM_CLKCTL_RPC_SET_FLAGS, |
| 114 | PCOM_CLKCTL_RPC_SET_RATE, |
| 115 | PCOM_CLKCTL_RPC_MIN_RATE, |
| 116 | PCOM_CLKCTL_RPC_MAX_RATE, |
| 117 | PCOM_CLKCTL_RPC_RATE, |
| 118 | PCOM_CLKCTL_RPC_PLL_REQUEST, |
| 119 | PCOM_CLKCTL_RPC_ENABLED, |
| 120 | PCOM_VREG_SWITCH, |
| 121 | PCOM_VREG_SET_LEVEL, |
| 122 | PCOM_GPIO_TLMM_CONFIG_GROUP, |
| 123 | PCOM_GPIO_TLMM_UNCONFIG_GROUP, |
| 124 | PCOM_NV_READ_HIGH_BITS, |
| 125 | PCOM_NV_WRITE_HIGH_BITS, |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 126 | PCOM_RPC_GPIO_TLMM_CONFIG_EX = 0x25, |
Brian Swetland | 9a47753 | 2009-01-01 11:40:02 -0800 | [diff] [blame] | 127 | PCOM_NUM_CMDS, |
Channagoud Kadabi | 5c86fe3 | 2012-02-16 10:58:48 +0530 | [diff] [blame] | 128 | PCOM_KERNEL_SEC_BOOT = 0x7A, |
Brian Swetland | 9a47753 | 2009-01-01 11:40:02 -0800 | [diff] [blame] | 129 | }; |
| 130 | |
| 131 | enum { |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 132 | PCOM_INVALID_STATUS = 0x0, |
| 133 | PCOM_READY, |
| 134 | PCOM_CMD_RUNNING, |
| 135 | PCOM_CMD_SUCCESS, |
| 136 | PCOM_CMD_FAIL, |
Brian Swetland | 9a47753 | 2009-01-01 11:40:02 -0800 | [diff] [blame] | 137 | }; |
| 138 | |
Ajay Dudani | 232ce81 | 2009-12-02 00:14:11 -0800 | [diff] [blame] | 139 | #ifndef PLATFORM_MSM7X30 |
Brian Swetland | 9a47753 | 2009-01-01 11:40:02 -0800 | [diff] [blame] | 140 | #define MSM_A2M_INT(n) (MSM_CSR_BASE + 0x400 + (n) * 4) |
Ajay Dudani | 232ce81 | 2009-12-02 00:14:11 -0800 | [diff] [blame] | 141 | #endif |
Brian Swetland | 9a47753 | 2009-01-01 11:40:02 -0800 | [diff] [blame] | 142 | static inline void notify_other_proc_comm(void) |
| 143 | { |
Ajay Dudani | 232ce81 | 2009-12-02 00:14:11 -0800 | [diff] [blame] | 144 | #ifndef PLATFORM_MSM7X30 |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 145 | writel(1, MSM_A2M_INT(6)); |
Ajay Dudani | 232ce81 | 2009-12-02 00:14:11 -0800 | [diff] [blame] | 146 | #else |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 147 | writel(1 << 6, (MSM_GCC_BASE + 0x8)); |
Ajay Dudani | 232ce81 | 2009-12-02 00:14:11 -0800 | [diff] [blame] | 148 | #endif |
Brian Swetland | 9a47753 | 2009-01-01 11:40:02 -0800 | [diff] [blame] | 149 | } |
| 150 | |
| 151 | #define APP_COMMAND (MSM_SHARED_BASE + 0x00) |
| 152 | #define APP_STATUS (MSM_SHARED_BASE + 0x04) |
| 153 | #define APP_DATA1 (MSM_SHARED_BASE + 0x08) |
| 154 | #define APP_DATA2 (MSM_SHARED_BASE + 0x0C) |
| 155 | |
| 156 | #define MDM_COMMAND (MSM_SHARED_BASE + 0x10) |
| 157 | #define MDM_STATUS (MSM_SHARED_BASE + 0x14) |
| 158 | #define MDM_DATA1 (MSM_SHARED_BASE + 0x18) |
| 159 | #define MDM_DATA2 (MSM_SHARED_BASE + 0x1C) |
| 160 | |
| 161 | int msm_proc_comm(unsigned cmd, unsigned *data1, unsigned *data2) |
| 162 | { |
| 163 | int ret = -1; |
| 164 | unsigned status; |
| 165 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 166 | // dprintf(INFO, "proc_comm(%d,%d,%d)\n", |
| 167 | // cmd, data1 ? *data1 : 0, data2 ? *data2 : 0); |
Brian Swetland | 9a47753 | 2009-01-01 11:40:02 -0800 | [diff] [blame] | 168 | while (readl(MDM_STATUS) != PCOM_READY) { |
| 169 | /* XXX check for A9 reset */ |
| 170 | } |
| 171 | |
Brian Swetland | 9a47753 | 2009-01-01 11:40:02 -0800 | [diff] [blame] | 172 | if (data1) |
| 173 | writel(*data1, APP_DATA1); |
| 174 | if (data2) |
| 175 | writel(*data2, APP_DATA2); |
| 176 | |
Channagoud Kadabi | fd47373 | 2011-10-19 22:43:41 +0530 | [diff] [blame] | 177 | /* |
| 178 | * As per the specs write data, cmd, interrupt for |
| 179 | * proc comm processing |
| 180 | */ |
| 181 | writel(cmd, APP_COMMAND); |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 182 | // dprintf(INFO, "proc_comm tx\n"); |
Brian Swetland | 9a47753 | 2009-01-01 11:40:02 -0800 | [diff] [blame] | 183 | notify_other_proc_comm(); |
| 184 | while (readl(APP_COMMAND) != PCOM_CMD_DONE) { |
| 185 | /* XXX check for A9 reset */ |
| 186 | } |
| 187 | |
| 188 | status = readl(APP_STATUS); |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 189 | // dprintf(INFO, "proc_comm status %d\n", status); |
Brian Swetland | 9a47753 | 2009-01-01 11:40:02 -0800 | [diff] [blame] | 190 | |
| 191 | if (status != PCOM_CMD_FAIL) { |
| 192 | if (data1) |
| 193 | *data1 = readl(APP_DATA1); |
| 194 | if (data2) |
| 195 | *data2 = readl(APP_DATA2); |
| 196 | ret = 0; |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 197 | /* |
| 198 | * Write command idle to indicate non HLOS that |
| 199 | * apps has finished reading the status & data |
| 200 | * of proc comm command |
| 201 | */ |
Channagoud Kadabi | fd47373 | 2011-10-19 22:43:41 +0530 | [diff] [blame] | 202 | writel(PCOM_CMD_IDLE, APP_COMMAND); |
Brian Swetland | 9a47753 | 2009-01-01 11:40:02 -0800 | [diff] [blame] | 203 | } |
| 204 | |
| 205 | return ret; |
| 206 | } |
| 207 | |
| 208 | static int clock_enable(unsigned id) |
| 209 | { |
| 210 | return msm_proc_comm(PCOM_CLKCTL_RPC_ENABLE, &id, 0); |
| 211 | } |
| 212 | |
| 213 | static int clock_disable(unsigned id) |
| 214 | { |
| 215 | return msm_proc_comm(PCOM_CLKCTL_RPC_DISABLE, &id, 0); |
| 216 | } |
| 217 | |
| 218 | static int clock_set_rate(unsigned id, unsigned rate) |
| 219 | { |
| 220 | return msm_proc_comm(PCOM_CLKCTL_RPC_SET_RATE, &id, &rate); |
| 221 | } |
| 222 | |
Shashank Mittal | 52525ff | 2010-04-13 11:11:10 -0700 | [diff] [blame] | 223 | static int clock_get_rate(unsigned id) |
| 224 | { |
| 225 | if (msm_proc_comm(PCOM_CLKCTL_RPC_RATE, &id, 0)) { |
| 226 | return -1; |
| 227 | } else { |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 228 | return (int)id; |
Shashank Mittal | 52525ff | 2010-04-13 11:11:10 -0700 | [diff] [blame] | 229 | } |
| 230 | } |
| 231 | |
Ajay Dudani | 7d60552 | 2010-10-01 19:52:37 -0700 | [diff] [blame] | 232 | void usb_clock_init() |
| 233 | { |
| 234 | clock_enable(USB_HS_PCLK); |
| 235 | clock_enable(USB_HS_CLK); |
Chandan Uddaraju | 0af3482 | 2010-10-07 14:46:58 -0700 | [diff] [blame] | 236 | clock_enable(P_USB_HS_CORE_CLK); |
Ajay Dudani | 7d60552 | 2010-10-01 19:52:37 -0700 | [diff] [blame] | 237 | } |
| 238 | |
Brian Swetland | 9a47753 | 2009-01-01 11:40:02 -0800 | [diff] [blame] | 239 | void lcdc_clock_init(unsigned rate) |
| 240 | { |
Shashank Mittal | 3704083 | 2010-08-24 15:57:57 -0700 | [diff] [blame] | 241 | clock_set_rate(MDP_LCDC_PCLK_CLK, rate); |
Brian Swetland | 9a47753 | 2009-01-01 11:40:02 -0800 | [diff] [blame] | 242 | clock_enable(MDP_LCDC_PCLK_CLK); |
| 243 | clock_enable(MDP_LCDC_PAD_PCLK_CLK); |
Shashank Mittal | 3704083 | 2010-08-24 15:57:57 -0700 | [diff] [blame] | 244 | } |
Brian Swetland | 9a47753 | 2009-01-01 11:40:02 -0800 | [diff] [blame] | 245 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 246 | void mdp_clock_init(unsigned rate) |
Shashank Mittal | 3704083 | 2010-08-24 15:57:57 -0700 | [diff] [blame] | 247 | { |
| 248 | clock_set_rate(MDP_CLK, rate); |
Brian Swetland | 9a47753 | 2009-01-01 11:40:02 -0800 | [diff] [blame] | 249 | clock_enable(MDP_CLK); |
Shashank Mittal | 3704083 | 2010-08-24 15:57:57 -0700 | [diff] [blame] | 250 | clock_enable(MDP_P_CLK); |
Brian Swetland | 9a47753 | 2009-01-01 11:40:02 -0800 | [diff] [blame] | 251 | } |
| 252 | |
| 253 | void uart3_clock_init(void) |
| 254 | { |
| 255 | clock_enable(UART3_CLK); |
| 256 | clock_set_rate(UART3_CLK, 19200000 / 4); |
| 257 | } |
Brian Swetland | 977224f | 2009-01-02 01:33:04 -0800 | [diff] [blame] | 258 | |
Shashank Mittal | 1ddc04c | 2010-12-21 14:39:07 -0800 | [diff] [blame] | 259 | void uart2_clock_init(void) |
| 260 | { |
| 261 | clock_enable(UART2_CLK); |
| 262 | clock_set_rate(UART2_CLK, 19200000); |
| 263 | } |
| 264 | |
Shashank Mittal | 2fad67f | 2011-04-08 19:45:10 -0700 | [diff] [blame] | 265 | void uart1_clock_init(void) |
| 266 | { |
| 267 | clock_enable(UART1_CLK); |
| 268 | clock_set_rate(UART1_CLK, 19200000 / 4); |
| 269 | } |
| 270 | |
Dima Zavin | 36785e3 | 2009-01-28 17:26:43 -0800 | [diff] [blame] | 271 | void mddi_clock_init(unsigned num, unsigned rate) |
| 272 | { |
| 273 | unsigned clock_id; |
| 274 | |
| 275 | if (num == 0) |
| 276 | clock_id = PMDH_CLK; |
| 277 | else |
| 278 | clock_id = EMDH_CLK; |
| 279 | |
| 280 | clock_enable(clock_id); |
| 281 | clock_set_rate(clock_id, rate); |
Chandan Uddaraju | c009e4d | 2010-09-08 17:06:45 -0700 | [diff] [blame] | 282 | #ifdef PLATFORM_MSM7X30 |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 283 | clock_enable(PMDH_P_CLK); |
Chandan Uddaraju | c009e4d | 2010-09-08 17:06:45 -0700 | [diff] [blame] | 284 | #endif |
Dima Zavin | 36785e3 | 2009-01-28 17:26:43 -0800 | [diff] [blame] | 285 | } |
Chandan Uddaraju | 94183c0 | 2010-01-15 15:13:59 -0800 | [diff] [blame] | 286 | |
| 287 | void reboot(unsigned reboot_reason) |
| 288 | { |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 289 | msm_proc_comm(PCOM_RESET_CHIP, &reboot_reason, 0); |
| 290 | for (;;) ; |
Chandan Uddaraju | 94183c0 | 2010-01-15 15:13:59 -0800 | [diff] [blame] | 291 | } |
Chandan Uddaraju | 7f5b901 | 2010-02-06 16:37:48 -0800 | [diff] [blame] | 292 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 293 | int mmc_clock_enable_disable(unsigned id, unsigned enable) |
Shashank Mittal | 52525ff | 2010-04-13 11:11:10 -0700 | [diff] [blame] | 294 | { |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 295 | if (enable) { |
| 296 | return clock_enable(id); //Enable mmc clock rate |
| 297 | } else { |
| 298 | return clock_disable(id); //Disable mmc clock rate |
Shashank Mittal | 52525ff | 2010-04-13 11:11:10 -0700 | [diff] [blame] | 299 | } |
| 300 | } |
| 301 | |
| 302 | int mmc_clock_set_rate(unsigned id, unsigned rate) |
| 303 | { |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 304 | return clock_set_rate(id, rate); //Set mmc clock rate |
Shashank Mittal | 52525ff | 2010-04-13 11:11:10 -0700 | [diff] [blame] | 305 | } |
| 306 | |
| 307 | int mmc_clock_get_rate(unsigned id) |
| 308 | { |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 309 | return clock_get_rate(id); //Get mmc clock rate |
Shashank Mittal | 52525ff | 2010-04-13 11:11:10 -0700 | [diff] [blame] | 310 | } |
| 311 | |
Shashank Mittal | 3704083 | 2010-08-24 15:57:57 -0700 | [diff] [blame] | 312 | int gpio_tlmm_config(unsigned config, unsigned disable) |
| 313 | { |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 314 | return msm_proc_comm(PCOM_RPC_GPIO_TLMM_CONFIG_EX, &config, &disable); |
Shashank Mittal | 3704083 | 2010-08-24 15:57:57 -0700 | [diff] [blame] | 315 | } |
| 316 | |
| 317 | int vreg_set_level(unsigned id, unsigned mv) |
| 318 | { |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 319 | return msm_proc_comm(PCOM_VREG_SET_LEVEL, &id, &mv); |
Shashank Mittal | 3704083 | 2010-08-24 15:57:57 -0700 | [diff] [blame] | 320 | } |
| 321 | |
| 322 | int vreg_enable(unsigned id) |
| 323 | { |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 324 | int enable = 1; |
| 325 | return msm_proc_comm(PCOM_VREG_SWITCH, &id, &enable); |
Shashank Mittal | 3704083 | 2010-08-24 15:57:57 -0700 | [diff] [blame] | 326 | |
| 327 | } |
| 328 | |
| 329 | int vreg_disable(unsigned id) |
| 330 | { |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 331 | int enable = 0; |
| 332 | return msm_proc_comm(PCOM_VREG_SWITCH, &id, &enable); |
Shashank Mittal | 3704083 | 2010-08-24 15:57:57 -0700 | [diff] [blame] | 333 | } |
Channagoud Kadabi | 5c86fe3 | 2012-02-16 10:58:48 +0530 | [diff] [blame] | 334 | |
| 335 | void set_tamper_flag(int tamper) |
| 336 | { |
| 337 | return msm_proc_comm(PCOM_KERNEL_SEC_BOOT, &tamper, 0); |
| 338 | } |