Syed Rameez Mustafa | 3971c14 | 2013-01-09 19:04:53 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | */ |
| 12 | |
| 13 | #include <linux/kernel.h> |
| 14 | #include <linux/init.h> |
| 15 | #include <linux/err.h> |
| 16 | #include <linux/ctype.h> |
| 17 | #include <linux/io.h> |
| 18 | #include <linux/spinlock.h> |
| 19 | #include <linux/delay.h> |
| 20 | #include <linux/clk.h> |
| 21 | #include <linux/iopoll.h> |
Vikram Mulukutla | f7c52d3 | 2013-01-31 11:39:58 -0800 | [diff] [blame] | 22 | #include <linux/regulator/consumer.h> |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 23 | |
| 24 | #include <mach/rpm-regulator-smd.h> |
| 25 | #include <mach/socinfo.h> |
| 26 | #include <mach/rpm-smd.h> |
| 27 | |
| 28 | #include "clock-local2.h" |
| 29 | #include "clock-pll.h" |
| 30 | #include "clock-rpm.h" |
| 31 | #include "clock-voter.h" |
| 32 | #include "clock.h" |
Vikram Mulukutla | e03b4b6 | 2013-03-20 17:45:37 -0700 | [diff] [blame] | 33 | #include "clock-dsi-8610.h" |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 34 | |
| 35 | enum { |
| 36 | GCC_BASE, |
| 37 | MMSS_BASE, |
| 38 | LPASS_BASE, |
| 39 | APCS_BASE, |
Vikram Mulukutla | 4157cca | 2013-01-24 15:42:41 -0800 | [diff] [blame] | 40 | APCS_PLL_BASE, |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 41 | N_BASES, |
| 42 | }; |
| 43 | |
| 44 | static void __iomem *virt_bases[N_BASES]; |
| 45 | |
| 46 | #define GCC_REG_BASE(x) (void __iomem *)(virt_bases[GCC_BASE] + (x)) |
| 47 | #define MMSS_REG_BASE(x) (void __iomem *)(virt_bases[MMSS_BASE] + (x)) |
| 48 | #define LPASS_REG_BASE(x) (void __iomem *)(virt_bases[LPASS_BASE] + (x)) |
| 49 | #define APCS_REG_BASE(x) (void __iomem *)(virt_bases[APCS_BASE] + (x)) |
| 50 | |
| 51 | #define GPLL0_MODE 0x0000 |
| 52 | #define GPLL0_L_VAL 0x0004 |
| 53 | #define GPLL0_M_VAL 0x0008 |
| 54 | #define GPLL0_N_VAL 0x000C |
| 55 | #define GPLL0_USER_CTL 0x0010 |
| 56 | #define GPLL0_STATUS 0x001C |
| 57 | #define GPLL2_MODE 0x0080 |
| 58 | #define GPLL2_L_VAL 0x0084 |
| 59 | #define GPLL2_M_VAL 0x0088 |
| 60 | #define GPLL2_N_VAL 0x008C |
| 61 | #define GPLL2_USER_CTL 0x0090 |
| 62 | #define GPLL2_STATUS 0x009C |
| 63 | #define CONFIG_NOC_BCR 0x0140 |
| 64 | #define MMSS_BCR 0x0240 |
| 65 | #define MMSS_NOC_CFG_AHB_CBCR 0x024C |
| 66 | #define MSS_CFG_AHB_CBCR 0x0280 |
| 67 | #define MSS_Q6_BIMC_AXI_CBCR 0x0284 |
| 68 | #define USB_HS_BCR 0x0480 |
| 69 | #define USB_HS_SYSTEM_CBCR 0x0484 |
| 70 | #define USB_HS_AHB_CBCR 0x0488 |
| 71 | #define USB_HS_SYSTEM_CMD_RCGR 0x0490 |
| 72 | #define USB2A_PHY_BCR 0x04A8 |
| 73 | #define USB2A_PHY_SLEEP_CBCR 0x04AC |
| 74 | #define SDCC1_BCR 0x04C0 |
| 75 | #define SDCC1_APPS_CMD_RCGR 0x04D0 |
| 76 | #define SDCC1_APPS_CBCR 0x04C4 |
| 77 | #define SDCC1_AHB_CBCR 0x04C8 |
| 78 | #define SDCC2_BCR 0x0500 |
| 79 | #define SDCC2_APPS_CMD_RCGR 0x0510 |
| 80 | #define SDCC2_APPS_CBCR 0x0504 |
| 81 | #define SDCC2_AHB_CBCR 0x0508 |
| 82 | #define BLSP1_BCR 0x05C0 |
| 83 | #define BLSP1_AHB_CBCR 0x05C4 |
| 84 | #define BLSP1_QUP1_BCR 0x0640 |
| 85 | #define BLSP1_QUP1_SPI_APPS_CBCR 0x0644 |
| 86 | #define BLSP1_QUP1_I2C_APPS_CBCR 0x0648 |
| 87 | #define BLSP1_QUP1_SPI_APPS_CMD_RCGR 0x064C |
| 88 | #define BLSP1_UART1_BCR 0x0680 |
| 89 | #define BLSP1_UART1_APPS_CBCR 0x0684 |
| 90 | #define BLSP1_UART1_SIM_CBCR 0x0688 |
| 91 | #define BLSP1_UART1_APPS_CMD_RCGR 0x068C |
| 92 | #define BLSP1_QUP2_BCR 0x06C0 |
| 93 | #define BLSP1_QUP2_SPI_APPS_CBCR 0x06C4 |
| 94 | #define BLSP1_QUP2_I2C_APPS_CBCR 0x06C8 |
| 95 | #define BLSP1_QUP2_SPI_APPS_CMD_RCGR 0x06CC |
| 96 | #define BLSP1_UART2_BCR 0x0700 |
| 97 | #define BLSP1_UART2_APPS_CBCR 0x0704 |
| 98 | #define BLSP1_UART2_SIM_CBCR 0x0708 |
| 99 | #define BLSP1_UART2_APPS_CMD_RCGR 0x070C |
| 100 | #define BLSP1_QUP3_BCR 0x0740 |
| 101 | #define BLSP1_QUP3_SPI_APPS_CBCR 0x0744 |
| 102 | #define BLSP1_QUP3_I2C_APPS_CBCR 0x0748 |
| 103 | #define BLSP1_QUP3_SPI_APPS_CMD_RCGR 0x074C |
| 104 | #define BLSP1_UART3_BCR 0x0780 |
| 105 | #define BLSP1_UART3_APPS_CBCR 0x0784 |
| 106 | #define BLSP1_UART3_SIM_CBCR 0x0788 |
| 107 | #define BLSP1_UART3_APPS_CMD_RCGR 0x078C |
| 108 | #define BLSP1_QUP4_BCR 0x07C0 |
| 109 | #define BLSP1_QUP4_SPI_APPS_CBCR 0x07C4 |
| 110 | #define BLSP1_QUP4_I2C_APPS_CBCR 0x07C8 |
| 111 | #define BLSP1_QUP4_SPI_APPS_CMD_RCGR 0x07CC |
| 112 | #define BLSP1_UART4_BCR 0x0800 |
| 113 | #define BLSP1_UART4_APPS_CBCR 0x0804 |
| 114 | #define BLSP1_UART4_SIM_CBCR 0x0808 |
| 115 | #define BLSP1_UART4_APPS_CMD_RCGR 0x080C |
| 116 | #define BLSP1_QUP5_BCR 0x0840 |
| 117 | #define BLSP1_QUP5_SPI_APPS_CBCR 0x0844 |
| 118 | #define BLSP1_QUP5_I2C_APPS_CBCR 0x0848 |
| 119 | #define BLSP1_QUP5_SPI_APPS_CMD_RCGR 0x084C |
| 120 | #define BLSP1_UART5_BCR 0x0880 |
| 121 | #define BLSP1_UART5_APPS_CBCR 0x0884 |
| 122 | #define BLSP1_UART5_SIM_CBCR 0x0888 |
| 123 | #define BLSP1_UART5_APPS_CMD_RCGR 0x088C |
| 124 | #define BLSP1_QUP6_BCR 0x08C0 |
| 125 | #define BLSP1_QUP6_SPI_APPS_CBCR 0x08C4 |
| 126 | #define BLSP1_QUP6_I2C_APPS_CBCR 0x08C8 |
| 127 | #define BLSP1_QUP6_SPI_APPS_CMD_RCGR 0x08CC |
| 128 | #define BLSP1_UART6_BCR 0x0900 |
| 129 | #define BLSP1_UART6_APPS_CBCR 0x0904 |
| 130 | #define BLSP1_UART6_SIM_CBCR 0x0908 |
| 131 | #define BLSP1_UART6_APPS_CMD_RCGR 0x090C |
| 132 | #define PDM_BCR 0x0CC0 |
| 133 | #define PDM_AHB_CBCR 0x0CC4 |
| 134 | #define PDM2_CBCR 0x0CCC |
| 135 | #define PDM2_CMD_RCGR 0x0CD0 |
| 136 | #define PRNG_BCR 0x0D00 |
| 137 | #define PRNG_AHB_CBCR 0x0D04 |
| 138 | #define BOOT_ROM_BCR 0x0E00 |
| 139 | #define BOOT_ROM_AHB_CBCR 0x0E04 |
| 140 | #define CE1_BCR 0x1040 |
| 141 | #define CE1_CMD_RCGR 0x1050 |
| 142 | #define CE1_CBCR 0x1044 |
| 143 | #define CE1_AXI_CBCR 0x1048 |
| 144 | #define CE1_AHB_CBCR 0x104C |
| 145 | #define COPSS_SMMU_AHB_CBCR 0x015C |
| 146 | #define LPSS_SMMU_AHB_CBCR 0x0158 |
Vikram Mulukutla | 55318acb | 2013-04-15 17:47:34 -0700 | [diff] [blame] | 147 | #define BIMC_SMMU_CBCR 0x1120 |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 148 | #define LPASS_Q6_AXI_CBCR 0x11C0 |
| 149 | #define APCS_GPLL_ENA_VOTE 0x1480 |
| 150 | #define APCS_CLOCK_BRANCH_ENA_VOTE 0x1484 |
| 151 | #define APCS_CLOCK_SLEEP_ENA_VOTE 0x1488 |
| 152 | #define GP1_CBCR 0x1900 |
| 153 | #define GP1_CMD_RCGR 0x1904 |
| 154 | #define GP2_CBCR 0x1940 |
| 155 | #define GP2_CMD_RCGR 0x1944 |
| 156 | #define GP3_CBCR 0x1980 |
| 157 | #define GP3_CMD_RCGR 0x1984 |
| 158 | #define XO_CBCR 0x0034 |
| 159 | |
| 160 | #define MMPLL0_PLL_MODE 0x0000 |
| 161 | #define MMPLL0_PLL_L_VAL 0x0004 |
| 162 | #define MMPLL0_PLL_M_VAL 0x0008 |
| 163 | #define MMPLL0_PLL_N_VAL 0x000C |
| 164 | #define MMPLL0_PLL_USER_CTL 0x0010 |
| 165 | #define MMPLL0_PLL_STATUS 0x001C |
| 166 | #define MMSS_PLL_VOTE_APCS_REG 0x0100 |
| 167 | #define MMPLL1_PLL_MODE 0x4100 |
| 168 | #define MMPLL1_PLL_L_VAL 0x4104 |
| 169 | #define MMPLL1_PLL_M_VAL 0x4108 |
| 170 | #define MMPLL1_PLL_N_VAL 0x410C |
| 171 | #define MMPLL1_PLL_USER_CTL 0x4110 |
| 172 | #define MMPLL1_PLL_STATUS 0x411C |
| 173 | #define DSI_PCLK_CMD_RCGR 0x2000 |
| 174 | #define DSI_CMD_RCGR 0x2020 |
| 175 | #define MDP_VSYNC_CMD_RCGR 0x2080 |
| 176 | #define DSI_BYTE_CMD_RCGR 0x2120 |
| 177 | #define DSI_ESC_CMD_RCGR 0x2160 |
| 178 | #define DSI_BCR 0x2200 |
| 179 | #define DSI_BYTE_BCR 0x2204 |
| 180 | #define DSI_ESC_BCR 0x2208 |
| 181 | #define DSI_AHB_BCR 0x220C |
| 182 | #define DSI_PCLK_BCR 0x2214 |
| 183 | #define MDP_LCDC_BCR 0x2218 |
| 184 | #define MDP_DSI_BCR 0x221C |
| 185 | #define MDP_VSYNC_BCR 0x2220 |
| 186 | #define MDP_AXI_BCR 0x2224 |
| 187 | #define MDP_AHB_BCR 0x2228 |
| 188 | #define MDP_AXI_CBCR 0x2314 |
| 189 | #define MDP_VSYNC_CBCR 0x231C |
| 190 | #define MDP_AHB_CBCR 0x2318 |
| 191 | #define DSI_PCLK_CBCR 0x233C |
| 192 | #define GMEM_GFX3D_CBCR 0x4038 |
| 193 | #define MDP_LCDC_CBCR 0x2340 |
| 194 | #define MDP_DSI_CBCR 0x2320 |
| 195 | #define DSI_CBCR 0x2324 |
| 196 | #define DSI_BYTE_CBCR 0x2328 |
| 197 | #define DSI_ESC_CBCR 0x232C |
| 198 | #define DSI_AHB_CBCR 0x2330 |
| 199 | #define CSI0PHYTIMER_CMD_RCGR 0x3000 |
| 200 | #define CSI0PHYTIMER_BCR 0x3020 |
| 201 | #define CSI0PHYTIMER_CBCR 0x3024 |
| 202 | #define CSI1PHYTIMER_CMD_RCGR 0x3030 |
| 203 | #define CSI1PHYTIMER_BCR 0x3050 |
| 204 | #define CSI1PHYTIMER_CBCR 0x3054 |
| 205 | #define CSI0_CMD_RCGR 0x3090 |
| 206 | #define CSI0_BCR 0x30B0 |
| 207 | #define CSI0_CBCR 0x30B4 |
| 208 | #define CSI_AHB_BCR 0x30B8 |
| 209 | #define CSI_AHB_CBCR 0x30BC |
| 210 | #define CSI0PHY_BCR 0x30C0 |
| 211 | #define CSI0PHY_CBCR 0x30C4 |
| 212 | #define CSI0RDI_BCR 0x30D0 |
| 213 | #define CSI0RDI_CBCR 0x30D4 |
| 214 | #define CSI0PIX_BCR 0x30E0 |
| 215 | #define CSI0PIX_CBCR 0x30E4 |
| 216 | #define CSI1_CMD_RCGR 0x3100 |
| 217 | #define CSI1_BCR 0x3120 |
| 218 | #define CSI1_CBCR 0x3124 |
| 219 | #define CSI1PHY_BCR 0x3130 |
| 220 | #define CSI1PHY_CBCR 0x3134 |
| 221 | #define CSI1RDI_BCR 0x3140 |
| 222 | #define CSI1RDI_CBCR 0x3144 |
| 223 | #define CSI1PIX_BCR 0x3150 |
| 224 | #define CSI1PIX_CBCR 0x3154 |
| 225 | #define MCLK0_CMD_RCGR 0x3360 |
| 226 | #define MCLK0_BCR 0x3380 |
| 227 | #define MCLK0_CBCR 0x3384 |
| 228 | #define MCLK1_CMD_RCGR 0x3390 |
| 229 | #define MCLK1_BCR 0x33B0 |
| 230 | #define MCLK1_CBCR 0x33B4 |
| 231 | #define VFE_CMD_RCGR 0x3600 |
| 232 | #define VFE_BCR 0x36A0 |
| 233 | #define VFE_AHB_BCR 0x36AC |
| 234 | #define VFE_AXI_BCR 0x36B0 |
| 235 | #define VFE_CBCR 0x36A8 |
| 236 | #define VFE_AHB_CBCR 0x36B8 |
| 237 | #define VFE_AXI_CBCR 0x36BC |
| 238 | #define CSI_VFE_BCR 0x3700 |
| 239 | #define CSI_VFE_CBCR 0x3704 |
| 240 | #define GFX3D_CMD_RCGR 0x4000 |
| 241 | #define OXILI_GFX3D_CBCR 0x4028 |
| 242 | #define OXILI_GFX3D_BCR 0x4030 |
| 243 | #define OXILI_AHB_BCR 0x4044 |
| 244 | #define OXILI_AHB_CBCR 0x403C |
| 245 | #define AHB_CMD_RCGR 0x5000 |
| 246 | #define MMSSNOCAHB_BCR 0x5020 |
| 247 | #define MMSSNOCAHB_BTO_BCR 0x5030 |
| 248 | #define MMSS_MISC_AHB_BCR 0x5034 |
| 249 | #define MMSS_MMSSNOC_AHB_CBCR 0x5024 |
| 250 | #define MMSS_MMSSNOC_BTO_AHB_CBCR 0x5028 |
| 251 | #define MMSS_MISC_AHB_CBCR 0x502C |
| 252 | #define AXI_CMD_RCGR 0x5040 |
| 253 | #define MMSSNOCAXI_BCR 0x5060 |
| 254 | #define MMSS_S0_AXI_BCR 0x5068 |
| 255 | #define MMSS_S0_AXI_CBCR 0x5064 |
| 256 | #define MMSS_MMSSNOC_AXI_CBCR 0x506C |
| 257 | #define BIMC_GFX_BCR 0x5090 |
| 258 | #define BIMC_GFX_CBCR 0x5094 |
Vikram Mulukutla | 8964a38 | 2013-04-10 14:30:50 -0700 | [diff] [blame] | 259 | #define MMSS_CAMSS_MISC 0x3718 |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 260 | |
| 261 | #define AUDIO_CORE_GDSCR 0x7000 |
| 262 | #define SPDM_BCR 0x1000 |
| 263 | #define LPAAUDIO_PLL_MODE 0x0000 |
| 264 | #define LPAAUDIO_PLL_L_VAL 0x0004 |
| 265 | #define LPAAUDIO_PLL_M_VAL 0x0008 |
| 266 | #define LPAAUDIO_PLL_N_VAL 0x000C |
| 267 | #define LPAAUDIO_PLL_USER_CTL 0x0010 |
| 268 | #define LPAAUDIO_PLL_STATUS 0x001C |
| 269 | #define LPAQ6_PLL_MODE 0x1000 |
| 270 | #define LPAQ6_PLL_USER_CTL 0x1010 |
| 271 | #define LPAQ6_PLL_STATUS 0x101C |
| 272 | #define LPA_PLL_VOTE_APPS 0x2000 |
| 273 | #define AUDIO_CORE_BCR_SLP_CBCR 0x4004 |
| 274 | #define Q6SS_BCR_SLP_CBCR 0x6004 |
| 275 | #define AUDIO_CORE_GDSC_XO_CBCR 0x7004 |
| 276 | #define AUDIO_CORE_LPAIF_DMA_CBCR 0x9000 |
| 277 | #define AUDIO_CORE_LPAIF_CSR_CBCR 0x9004 |
| 278 | #define LPAIF_SPKR_CMD_RCGR 0xA000 |
| 279 | #define AUDIO_CORE_LPAIF_CODEC_SPKR_OSR_CBCR 0xA014 |
| 280 | #define AUDIO_CORE_LPAIF_CODEC_SPKR_IBIT_CBCR 0xA018 |
| 281 | #define AUDIO_CORE_LPAIF_CODEC_SPKR_EBIT_CBCR 0xA01C |
| 282 | #define LPAIF_PRI_CMD_RCGR 0xB000 |
| 283 | #define AUDIO_CORE_LPAIF_PRI_OSR_CBCR 0xB014 |
| 284 | #define AUDIO_CORE_LPAIF_PRI_IBIT_CBCR 0xB018 |
| 285 | #define AUDIO_CORE_LPAIF_PRI_EBIT_CBCR 0xB01C |
| 286 | #define LPAIF_SEC_CMD_RCGR 0xC000 |
| 287 | #define AUDIO_CORE_LPAIF_SEC_OSR_CBCR 0xC014 |
| 288 | #define AUDIO_CORE_LPAIF_SEC_IBIT_CBCR 0xC018 |
| 289 | #define AUDIO_CORE_LPAIF_SEC_EBIT_CBCR 0xC01C |
| 290 | #define LPAIF_TER_CMD_RCGR 0xD000 |
| 291 | #define AUDIO_CORE_LPAIF_TER_OSR_CBCR 0xD014 |
| 292 | #define AUDIO_CORE_LPAIF_TER_IBIT_CBCR 0xD018 |
| 293 | #define AUDIO_CORE_LPAIF_TER_EBIT_CBCR 0xD01C |
| 294 | #define LPAIF_QUAD_CMD_RCGR 0xE000 |
| 295 | #define AUDIO_CORE_LPAIF_QUAD_OSR_CBCR 0xE014 |
| 296 | #define AUDIO_CORE_LPAIF_QUAD_IBIT_CBCR 0xE018 |
| 297 | #define AUDIO_CORE_LPAIF_QUAD_EBIT_CBCR 0xE01C |
| 298 | #define LPAIF_PCM0_CMD_RCGR 0xF000 |
| 299 | #define AUDIO_CORE_LPAIF_PCM0_IBIT_CBCR 0xF014 |
| 300 | #define AUDIO_CORE_LPAIF_PCM0_EBIT_CBCR 0xF018 |
| 301 | #define LPAIF_PCM1_CMD_RCGR 0x10000 |
| 302 | #define AUDIO_CORE_LPAIF_PCM1_IBIT_CBCR 0x10014 |
| 303 | #define AUDIO_CORE_LPAIF_PCM1_EBIT_CBCR 0x10018 |
| 304 | #define SLIMBUS_CMD_RCGR 0x12000 |
| 305 | #define AUDIO_CORE_SLIMBUS_CORE_CBCR 0x12014 |
| 306 | #define LPAIF_PCMOE_CMD_RCGR 0x13000 |
| 307 | #define AUDIO_CORE_LPAIF_PCM_DATA_OE_CBCR 0x13014 |
| 308 | #define Q6CORE_CMD_RCGR 0x14000 |
| 309 | #define SLEEP_CMD_RCGR 0x15000 |
| 310 | #define SPDM_CMD_RCGR 0x16000 |
| 311 | #define AUDIO_WRAPPER_SPDM_CBCR 0x16014 |
| 312 | #define XO_CMD_RCGR 0x17000 |
| 313 | #define AHBFABRIC_CMD_RCGR 0x18000 |
| 314 | #define AUDIO_CORE_LPM_CBCR 0x19000 |
| 315 | #define AUDIO_CORE_AVSYNC_CSR_CBCR 0x1A000 |
| 316 | #define AUDIO_CORE_AVSYNC_XO_CBCR 0x1A004 |
| 317 | #define AUDIO_CORE_AVSYNC_BT_XO_CBCR 0x1A008 |
| 318 | #define AUDIO_CORE_AVSYNC_FM_XO_CBCR 0x1A00C |
| 319 | #define AUDIO_CORE_IXFABRIC_CBCR 0x1B000 |
| 320 | #define AUDIO_WRAPPER_EFABRIC_CBCR 0x1B004 |
| 321 | #define AUDIO_CORE_TCM_SLAVE_CBCR 0x1C000 |
| 322 | #define AUDIO_CORE_CSR_CBCR 0x1D000 |
| 323 | #define AUDIO_CORE_DML_CBCR 0x1E000 |
| 324 | #define AUDIO_CORE_SYSNOC_CBCR 0x1F000 |
| 325 | #define AUDIO_WRAPPER_SYSNOC_SWAY_CBCR 0x1F004 |
| 326 | #define AUDIO_CORE_TIMEOUT_CBCR 0x20000 |
| 327 | #define AUDIO_WRAPPER_TIMEOUT_CBCR 0x20004 |
| 328 | #define AUDIO_CORE_SECURITY_CBCR 0x21000 |
| 329 | #define AUDIO_WRAPPER_SECURITY_CBCR 0x21004 |
| 330 | #define Q6SS_AHB_LFABIF_CBCR 0x22000 |
| 331 | #define Q6SS_AHBM_CBCR 0x22004 |
| 332 | #define AUDIO_WRAPPER_LCC_CSR_CBCR 0x23000 |
| 333 | #define AUDIO_WRAPPER_BR_CBCR 0x24000 |
| 334 | #define AUDIO_WRAPPER_SMEM_CBCR 0x25000 |
| 335 | #define Q6SS_XO_CBCR 0x26000 |
| 336 | #define Q6SS_SLP_CBCR 0x26004 |
| 337 | #define LPASS_Q6SS_BCR 0x6000 |
| 338 | #define AUDIO_WRAPPER_STM_XO_CBCR 0x27000 |
| 339 | #define AUDIO_CORE_IXFABRIC_SPDMTM_CSR_CBCR 0x28000 |
| 340 | #define AUDIO_WRAPPER_EFABRIC_SPDMTM_CSR_CBCR 0x28004 |
| 341 | |
| 342 | /* Mux source select values */ |
| 343 | #define gcc_xo_source_val 0 |
| 344 | #define gpll0_source_val 1 |
| 345 | #define gnd_source_val 5 |
| 346 | #define mmpll0_mm_source_val 1 |
| 347 | #define mmpll1_mm_source_val 2 |
| 348 | #define gpll0_mm_source_val 5 |
| 349 | #define gcc_xo_mm_source_val 0 |
| 350 | #define mm_gnd_source_val 6 |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 351 | #define dsipll_mm_source_val 1 |
| 352 | |
| 353 | #define F(f, s, div, m, n) \ |
| 354 | { \ |
| 355 | .freq_hz = (f), \ |
| 356 | .src_clk = &s##_clk_src.c, \ |
| 357 | .m_val = (m), \ |
| 358 | .n_val = ~((n)-(m)) * !!(n), \ |
| 359 | .d_val = ~(n),\ |
| 360 | .div_src_val = BVAL(4, 0, (int)(2*(div) - 1)) \ |
| 361 | | BVAL(10, 8, s##_source_val), \ |
| 362 | } |
| 363 | |
Vikram Mulukutla | 4157cca | 2013-01-24 15:42:41 -0800 | [diff] [blame] | 364 | #define F_APCS_PLL(f, l, m, n, pre_div, post_div, vco) \ |
| 365 | { \ |
| 366 | .freq_hz = (f), \ |
| 367 | .l_val = (l), \ |
| 368 | .m_val = (m), \ |
| 369 | .n_val = (n), \ |
| 370 | .pre_div_val = BVAL(12, 12, (pre_div)), \ |
| 371 | .post_div_val = BVAL(9, 8, (post_div)), \ |
| 372 | .vco_val = BVAL(29, 28, (vco)), \ |
| 373 | } |
| 374 | |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 375 | #define F_MM(f, s, div, m, n) \ |
| 376 | { \ |
| 377 | .freq_hz = (f), \ |
| 378 | .src_clk = &s##_clk_src.c, \ |
| 379 | .m_val = (m), \ |
| 380 | .n_val = ~((n)-(m)) * !!(n), \ |
| 381 | .d_val = ~(n),\ |
| 382 | .div_src_val = BVAL(4, 0, (int)(2*(div) - 1)) \ |
| 383 | | BVAL(10, 8, s##_mm_source_val), \ |
| 384 | } |
| 385 | |
| 386 | #define F_HDMI(f, s, div, m, n) \ |
| 387 | { \ |
| 388 | .freq_hz = (f), \ |
| 389 | .src_clk = &s##_clk_src, \ |
| 390 | .m_val = (m), \ |
| 391 | .n_val = ~((n)-(m)) * !!(n), \ |
| 392 | .d_val = ~(n),\ |
| 393 | .div_src_val = BVAL(4, 0, (int)(2*(div) - 1)) \ |
| 394 | | BVAL(10, 8, s##_mm_source_val), \ |
| 395 | } |
| 396 | |
| 397 | #define F_MDSS(f, s, div, m, n) \ |
| 398 | { \ |
| 399 | .freq_hz = (f), \ |
| 400 | .m_val = (m), \ |
| 401 | .n_val = ~((n)-(m)) * !!(n), \ |
| 402 | .d_val = ~(n),\ |
| 403 | .div_src_val = BVAL(4, 0, (int)(2*(div) - 1)) \ |
| 404 | | BVAL(10, 8, s##_mm_source_val), \ |
| 405 | } |
| 406 | |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 407 | #define VDD_DIG_FMAX_MAP1(l1, f1) \ |
| 408 | .vdd_class = &vdd_dig, \ |
| 409 | .fmax = (unsigned long[VDD_DIG_NUM]) { \ |
| 410 | [VDD_DIG_##l1] = (f1), \ |
| 411 | }, \ |
| 412 | .num_fmax = VDD_DIG_NUM |
| 413 | #define VDD_DIG_FMAX_MAP2(l1, f1, l2, f2) \ |
| 414 | .vdd_class = &vdd_dig, \ |
| 415 | .fmax = (unsigned long[VDD_DIG_NUM]) { \ |
| 416 | [VDD_DIG_##l1] = (f1), \ |
| 417 | [VDD_DIG_##l2] = (f2), \ |
| 418 | }, \ |
| 419 | .num_fmax = VDD_DIG_NUM |
| 420 | #define VDD_DIG_FMAX_MAP3(l1, f1, l2, f2, l3, f3) \ |
| 421 | .vdd_class = &vdd_dig, \ |
| 422 | .fmax = (unsigned long[VDD_DIG_NUM]) { \ |
| 423 | [VDD_DIG_##l1] = (f1), \ |
| 424 | [VDD_DIG_##l2] = (f2), \ |
| 425 | [VDD_DIG_##l3] = (f3), \ |
| 426 | }, \ |
| 427 | .num_fmax = VDD_DIG_NUM |
| 428 | |
| 429 | enum vdd_dig_levels { |
| 430 | VDD_DIG_NONE, |
| 431 | VDD_DIG_LOW, |
| 432 | VDD_DIG_NOMINAL, |
| 433 | VDD_DIG_HIGH, |
| 434 | VDD_DIG_NUM |
| 435 | }; |
| 436 | |
Patrick Daly | cbdceb7 | 2013-04-16 17:02:34 -0700 | [diff] [blame] | 437 | static int *vdd_corner[] = { |
Patrick Daly | ebc26bc | 2013-02-05 11:49:07 -0800 | [diff] [blame] | 438 | [VDD_DIG_NONE] = VDD_UV(RPM_REGULATOR_CORNER_NONE), |
| 439 | [VDD_DIG_LOW] = VDD_UV(RPM_REGULATOR_CORNER_SVS_SOC), |
| 440 | [VDD_DIG_NOMINAL] = VDD_UV(RPM_REGULATOR_CORNER_NORMAL), |
| 441 | [VDD_DIG_HIGH] = VDD_UV(RPM_REGULATOR_CORNER_SUPER_TURBO), |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 442 | }; |
| 443 | |
Patrick Daly | ebc26bc | 2013-02-05 11:49:07 -0800 | [diff] [blame] | 444 | static DEFINE_VDD_REGULATORS(vdd_dig, VDD_DIG_NUM, 1, vdd_corner); |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 445 | |
| 446 | #define RPM_MISC_CLK_TYPE 0x306b6c63 |
| 447 | #define RPM_BUS_CLK_TYPE 0x316b6c63 |
| 448 | #define RPM_MEM_CLK_TYPE 0x326b6c63 |
| 449 | |
| 450 | #define RPM_SMD_KEY_ENABLE 0x62616E45 |
| 451 | |
| 452 | #define CXO_ID 0x0 |
| 453 | #define QDSS_ID 0x1 |
| 454 | #define RPM_SCALING_ENABLE_ID 0x2 |
| 455 | |
| 456 | #define PNOC_ID 0x0 |
| 457 | #define SNOC_ID 0x1 |
| 458 | #define CNOC_ID 0x2 |
| 459 | #define MMSSNOC_AHB_ID 0x3 |
| 460 | |
| 461 | #define BIMC_ID 0x0 |
| 462 | #define OXILI_ID 0x1 |
| 463 | #define OCMEM_ID 0x2 |
| 464 | |
| 465 | #define D0_ID 1 |
| 466 | #define D1_ID 2 |
Vikram Mulukutla | 7e5b311 | 2013-04-15 16:32:40 -0700 | [diff] [blame] | 467 | #define A0_ID 4 |
| 468 | #define A1_ID 5 |
| 469 | #define A2_ID 6 |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 470 | #define DIFF_CLK_ID 7 |
| 471 | #define DIV_CLK_ID 11 |
| 472 | |
| 473 | DEFINE_CLK_RPM_SMD(pnoc_clk, pnoc_a_clk, RPM_BUS_CLK_TYPE, PNOC_ID, NULL); |
| 474 | DEFINE_CLK_RPM_SMD(snoc_clk, snoc_a_clk, RPM_BUS_CLK_TYPE, SNOC_ID, NULL); |
| 475 | DEFINE_CLK_RPM_SMD(cnoc_clk, cnoc_a_clk, RPM_BUS_CLK_TYPE, CNOC_ID, NULL); |
| 476 | DEFINE_CLK_RPM_SMD(mmssnoc_ahb_clk, mmssnoc_ahb_a_clk, RPM_BUS_CLK_TYPE, |
| 477 | MMSSNOC_AHB_ID, NULL); |
| 478 | |
| 479 | DEFINE_CLK_RPM_SMD(bimc_clk, bimc_a_clk, RPM_MEM_CLK_TYPE, BIMC_ID, NULL); |
| 480 | |
| 481 | DEFINE_CLK_RPM_SMD_BRANCH(gcc_xo_clk_src, gcc_xo_a_clk_src, |
| 482 | RPM_MISC_CLK_TYPE, CXO_ID, 19200000); |
| 483 | DEFINE_CLK_RPM_SMD_QDSS(qdss_clk, qdss_a_clk, RPM_MISC_CLK_TYPE, QDSS_ID); |
| 484 | |
| 485 | DEFINE_CLK_RPM_SMD_XO_BUFFER(cxo_d0, cxo_d0_a, D0_ID); |
| 486 | DEFINE_CLK_RPM_SMD_XO_BUFFER(cxo_d1, cxo_d1_a, D1_ID); |
| 487 | DEFINE_CLK_RPM_SMD_XO_BUFFER(cxo_a0, cxo_a0_a, A0_ID); |
| 488 | DEFINE_CLK_RPM_SMD_XO_BUFFER(cxo_a1, cxo_a1_a, A1_ID); |
| 489 | DEFINE_CLK_RPM_SMD_XO_BUFFER(cxo_a2, cxo_a2_a, A2_ID); |
| 490 | DEFINE_CLK_RPM_SMD_XO_BUFFER(div_clk, div_a_clk, DIV_CLK_ID); |
| 491 | DEFINE_CLK_RPM_SMD_XO_BUFFER(diff_clk, diff_a_clk, DIFF_CLK_ID); |
| 492 | |
| 493 | DEFINE_CLK_RPM_SMD_XO_BUFFER_PINCTRL(cxo_d0_pin, cxo_d0_a_pin, D0_ID); |
| 494 | DEFINE_CLK_RPM_SMD_XO_BUFFER_PINCTRL(cxo_d1_pin, cxo_d1_a_pin, D1_ID); |
| 495 | DEFINE_CLK_RPM_SMD_XO_BUFFER_PINCTRL(cxo_a0_pin, cxo_a0_a_pin, A0_ID); |
| 496 | DEFINE_CLK_RPM_SMD_XO_BUFFER_PINCTRL(cxo_a1_pin, cxo_a1_a_pin, A1_ID); |
| 497 | DEFINE_CLK_RPM_SMD_XO_BUFFER_PINCTRL(cxo_a2_pin, cxo_a2_a_pin, A2_ID); |
| 498 | |
| 499 | static DEFINE_CLK_VOTER(pnoc_msmbus_clk, &pnoc_clk.c, LONG_MAX); |
| 500 | static DEFINE_CLK_VOTER(snoc_msmbus_clk, &snoc_clk.c, LONG_MAX); |
| 501 | static DEFINE_CLK_VOTER(cnoc_msmbus_clk, &cnoc_clk.c, LONG_MAX); |
| 502 | static DEFINE_CLK_VOTER(pnoc_msmbus_a_clk, &pnoc_a_clk.c, LONG_MAX); |
| 503 | static DEFINE_CLK_VOTER(snoc_msmbus_a_clk, &snoc_a_clk.c, LONG_MAX); |
| 504 | static DEFINE_CLK_VOTER(cnoc_msmbus_a_clk, &cnoc_a_clk.c, LONG_MAX); |
| 505 | |
| 506 | static DEFINE_CLK_VOTER(bimc_msmbus_clk, &bimc_clk.c, LONG_MAX); |
| 507 | static DEFINE_CLK_VOTER(bimc_msmbus_a_clk, &bimc_a_clk.c, LONG_MAX); |
| 508 | static DEFINE_CLK_VOTER(bimc_acpu_a_clk, &bimc_a_clk.c, LONG_MAX); |
| 509 | |
| 510 | static DEFINE_CLK_VOTER(pnoc_sps_clk, &pnoc_clk.c, LONG_MAX); |
| 511 | static DEFINE_CLK_VOTER(pnoc_iommu_clk, &pnoc_clk.c, LONG_MAX); |
| 512 | static DEFINE_CLK_VOTER(pnoc_qseecom_clk, &pnoc_clk.c, LONG_MAX); |
| 513 | |
Vikram Mulukutla | 4157cca | 2013-01-24 15:42:41 -0800 | [diff] [blame] | 514 | static DEFINE_CLK_MEASURE(apc0_m_clk); |
| 515 | static DEFINE_CLK_MEASURE(apc1_m_clk); |
| 516 | static DEFINE_CLK_MEASURE(apc2_m_clk); |
| 517 | static DEFINE_CLK_MEASURE(apc3_m_clk); |
| 518 | static DEFINE_CLK_MEASURE(l2_m_clk); |
| 519 | |
| 520 | #define APCS_SH_PLL_MODE 0x000 |
| 521 | #define APCS_SH_PLL_L_VAL 0x004 |
| 522 | #define APCS_SH_PLL_M_VAL 0x008 |
| 523 | #define APCS_SH_PLL_N_VAL 0x00C |
| 524 | #define APCS_SH_PLL_USER_CTL 0x010 |
| 525 | #define APCS_SH_PLL_CONFIG_CTL 0x014 |
| 526 | #define APCS_SH_PLL_STATUS 0x01C |
| 527 | |
| 528 | enum vdd_sr2_pll_levels { |
| 529 | VDD_SR2_PLL_OFF, |
Patrick Daly | 6fb589a | 2013-03-29 17:55:55 -0700 | [diff] [blame] | 530 | VDD_SR2_PLL_SVS, |
| 531 | VDD_SR2_PLL_NOM, |
| 532 | VDD_SR2_PLL_TUR, |
Vikram Mulukutla | 4157cca | 2013-01-24 15:42:41 -0800 | [diff] [blame] | 533 | VDD_SR2_PLL_NUM |
| 534 | }; |
| 535 | |
Patrick Daly | cbdceb7 | 2013-04-16 17:02:34 -0700 | [diff] [blame] | 536 | static int *vdd_sr2_levels[] = { |
Patrick Daly | 6fb589a | 2013-03-29 17:55:55 -0700 | [diff] [blame] | 537 | [VDD_SR2_PLL_OFF] = VDD_UV(0, RPM_REGULATOR_CORNER_NONE), |
| 538 | [VDD_SR2_PLL_SVS] = VDD_UV(1800000, RPM_REGULATOR_CORNER_SVS_SOC), |
| 539 | [VDD_SR2_PLL_NOM] = VDD_UV(1800000, RPM_REGULATOR_CORNER_NORMAL), |
| 540 | [VDD_SR2_PLL_TUR] = VDD_UV(1800000, RPM_REGULATOR_CORNER_SUPER_TURBO), |
Patrick Daly | ebc26bc | 2013-02-05 11:49:07 -0800 | [diff] [blame] | 541 | }; |
Vikram Mulukutla | 4157cca | 2013-01-24 15:42:41 -0800 | [diff] [blame] | 542 | |
Patrick Daly | 6fb589a | 2013-03-29 17:55:55 -0700 | [diff] [blame] | 543 | static DEFINE_VDD_REGULATORS(vdd_sr2_pll, VDD_SR2_PLL_NUM, 2, vdd_sr2_levels); |
Vikram Mulukutla | 4157cca | 2013-01-24 15:42:41 -0800 | [diff] [blame] | 544 | |
| 545 | static struct pll_freq_tbl apcs_pll_freq[] = { |
| 546 | F_APCS_PLL( 384000000, 20, 0x0, 0x1, 0x0, 0x0, 0x0), |
| 547 | F_APCS_PLL( 787200000, 41, 0x0, 0x1, 0x0, 0x0, 0x0), |
| 548 | F_APCS_PLL( 998400000, 52, 0x0, 0x1, 0x0, 0x0, 0x0), |
| 549 | F_APCS_PLL(1190400000, 62, 0x0, 0x1, 0x0, 0x0, 0x0), |
| 550 | PLL_F_END |
| 551 | }; |
| 552 | |
| 553 | static struct pll_clk a7sspll = { |
| 554 | .mode_reg = (void __iomem *)APCS_SH_PLL_MODE, |
| 555 | .l_reg = (void __iomem *)APCS_SH_PLL_L_VAL, |
| 556 | .m_reg = (void __iomem *)APCS_SH_PLL_M_VAL, |
| 557 | .n_reg = (void __iomem *)APCS_SH_PLL_N_VAL, |
| 558 | .config_reg = (void __iomem *)APCS_SH_PLL_USER_CTL, |
| 559 | .status_reg = (void __iomem *)APCS_SH_PLL_STATUS, |
| 560 | .freq_tbl = apcs_pll_freq, |
| 561 | .masks = { |
| 562 | .vco_mask = BM(29, 28), |
| 563 | .pre_div_mask = BIT(12), |
| 564 | .post_div_mask = BM(9, 8), |
| 565 | .mn_en_mask = BIT(24), |
| 566 | .main_output_mask = BIT(0), |
| 567 | }, |
| 568 | .base = &virt_bases[APCS_PLL_BASE], |
| 569 | .c = { |
Patrick Daly | 9bdc8a5 | 2013-03-21 19:12:40 -0700 | [diff] [blame] | 570 | .parent = &gcc_xo_a_clk_src.c, |
Vikram Mulukutla | 4157cca | 2013-01-24 15:42:41 -0800 | [diff] [blame] | 571 | .dbg_name = "a7sspll", |
| 572 | .ops = &clk_ops_sr2_pll, |
| 573 | .vdd_class = &vdd_sr2_pll, |
| 574 | .fmax = (unsigned long [VDD_SR2_PLL_NUM]) { |
Patrick Daly | 6fb589a | 2013-03-29 17:55:55 -0700 | [diff] [blame] | 575 | [VDD_SR2_PLL_SVS] = 1000000000, |
| 576 | [VDD_SR2_PLL_NOM] = 1900000000, |
Vikram Mulukutla | 4157cca | 2013-01-24 15:42:41 -0800 | [diff] [blame] | 577 | }, |
| 578 | .num_fmax = VDD_SR2_PLL_NUM, |
| 579 | CLK_INIT(a7sspll.c), |
| 580 | /* |
| 581 | * Need to skip handoff of the acpu pll to avoid |
| 582 | * turning off the pll when the cpu is using it |
| 583 | */ |
| 584 | .flags = CLKFLAG_SKIP_HANDOFF, |
| 585 | }, |
| 586 | }; |
| 587 | |
| 588 | static unsigned int soft_vote_gpll0; |
| 589 | |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 590 | static struct pll_vote_clk gpll0_clk_src = { |
| 591 | .en_reg = (void __iomem *)APCS_GPLL_ENA_VOTE, |
| 592 | .en_mask = BIT(0), |
| 593 | .status_reg = (void __iomem *)GPLL0_STATUS, |
| 594 | .status_mask = BIT(17), |
Vikram Mulukutla | 4157cca | 2013-01-24 15:42:41 -0800 | [diff] [blame] | 595 | .soft_vote = &soft_vote_gpll0, |
| 596 | .soft_vote_mask = PLL_SOFT_VOTE_PRIMARY, |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 597 | .base = &virt_bases[GCC_BASE], |
| 598 | .c = { |
| 599 | .parent = &gcc_xo_clk_src.c, |
| 600 | .rate = 600000000, |
| 601 | .dbg_name = "gpll0_clk_src", |
Vikram Mulukutla | 4157cca | 2013-01-24 15:42:41 -0800 | [diff] [blame] | 602 | .ops = &clk_ops_pll_acpu_vote, |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 603 | CLK_INIT(gpll0_clk_src.c), |
| 604 | }, |
| 605 | }; |
| 606 | |
Vikram Mulukutla | 4157cca | 2013-01-24 15:42:41 -0800 | [diff] [blame] | 607 | static struct pll_vote_clk gpll0_ao_clk_src = { |
| 608 | .en_reg = (void __iomem *)APCS_GPLL_ENA_VOTE, |
| 609 | .en_mask = BIT(0), |
| 610 | .status_reg = (void __iomem *)GPLL0_STATUS, |
| 611 | .status_mask = BIT(17), |
| 612 | .soft_vote = &soft_vote_gpll0, |
| 613 | .soft_vote_mask = PLL_SOFT_VOTE_ACPU, |
| 614 | .base = &virt_bases[GCC_BASE], |
| 615 | .c = { |
| 616 | .rate = 600000000, |
| 617 | .dbg_name = "gpll0_ao_clk_src", |
| 618 | .ops = &clk_ops_pll_acpu_vote, |
| 619 | CLK_INIT(gpll0_ao_clk_src.c), |
| 620 | }, |
| 621 | }; |
| 622 | |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 623 | static struct pll_vote_clk mmpll0_clk_src = { |
| 624 | .en_reg = (void __iomem *)MMSS_PLL_VOTE_APCS_REG, |
| 625 | .en_mask = BIT(0), |
| 626 | .status_reg = (void __iomem *)MMPLL0_PLL_STATUS, |
| 627 | .status_mask = BIT(17), |
| 628 | .base = &virt_bases[MMSS_BASE], |
| 629 | .c = { |
| 630 | .parent = &gcc_xo_clk_src.c, |
| 631 | .dbg_name = "mmpll0_clk_src", |
| 632 | .rate = 800000000, |
| 633 | .ops = &clk_ops_pll_vote, |
| 634 | CLK_INIT(mmpll0_clk_src.c), |
| 635 | }, |
| 636 | }; |
| 637 | |
| 638 | static struct pll_config_regs mmpll0_regs __initdata = { |
| 639 | .l_reg = (void __iomem *)MMPLL0_PLL_L_VAL, |
| 640 | .m_reg = (void __iomem *)MMPLL0_PLL_M_VAL, |
| 641 | .n_reg = (void __iomem *)MMPLL0_PLL_N_VAL, |
| 642 | .config_reg = (void __iomem *)MMPLL0_PLL_USER_CTL, |
| 643 | .mode_reg = (void __iomem *)MMPLL0_PLL_MODE, |
| 644 | .base = &virt_bases[MMSS_BASE], |
| 645 | }; |
| 646 | |
| 647 | static struct pll_clk mmpll1_clk_src = { |
| 648 | .mode_reg = (void __iomem *)MMPLL1_PLL_MODE, |
| 649 | .status_reg = (void __iomem *)MMPLL1_PLL_STATUS, |
| 650 | .base = &virt_bases[MMSS_BASE], |
| 651 | .c = { |
| 652 | .parent = &gcc_xo_clk_src.c, |
| 653 | .dbg_name = "mmpll1_clk_src", |
| 654 | .rate = 1200000000, |
| 655 | .ops = &clk_ops_local_pll, |
| 656 | CLK_INIT(mmpll1_clk_src.c), |
| 657 | }, |
| 658 | }; |
| 659 | |
| 660 | static struct pll_config_regs mmpll1_regs __initdata = { |
| 661 | .l_reg = (void __iomem *)MMPLL1_PLL_L_VAL, |
| 662 | .m_reg = (void __iomem *)MMPLL1_PLL_M_VAL, |
| 663 | .n_reg = (void __iomem *)MMPLL1_PLL_N_VAL, |
| 664 | .config_reg = (void __iomem *)MMPLL1_PLL_USER_CTL, |
| 665 | .mode_reg = (void __iomem *)MMPLL1_PLL_MODE, |
| 666 | .base = &virt_bases[MMSS_BASE], |
| 667 | }; |
| 668 | |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 669 | static struct clk_freq_tbl ftbl_gcc_blsp1_qup1_6_spi_apps_clk[] = { |
| 670 | F( 960000, gcc_xo, 10, 1, 2), |
| 671 | F( 4800000, gcc_xo, 4, 0, 0), |
| 672 | F( 9600000, gcc_xo, 2, 0, 0), |
| 673 | F(15000000, gpll0, 10, 1, 4), |
| 674 | F(19200000, gcc_xo, 1, 0, 0), |
| 675 | F(25000000, gpll0, 12, 1, 2), |
| 676 | F(50000000, gpll0, 12, 0, 0), |
| 677 | F_END, |
| 678 | }; |
| 679 | |
| 680 | static struct rcg_clk blsp1_qup1_spi_apps_clk_src = { |
| 681 | .cmd_rcgr_reg = BLSP1_QUP1_SPI_APPS_CMD_RCGR, |
| 682 | .set_rate = set_rate_mnd, |
| 683 | .freq_tbl = ftbl_gcc_blsp1_qup1_6_spi_apps_clk, |
| 684 | .current_freq = &rcg_dummy_freq, |
| 685 | .base = &virt_bases[GCC_BASE], |
| 686 | .c = { |
| 687 | .dbg_name = "blsp1_qup1_spi_apps_clk_src", |
| 688 | .ops = &clk_ops_rcg_mnd, |
| 689 | VDD_DIG_FMAX_MAP2(LOW, 25000000, NOMINAL, 50000000), |
| 690 | CLK_INIT(blsp1_qup1_spi_apps_clk_src.c), |
| 691 | }, |
| 692 | }; |
| 693 | |
| 694 | static struct rcg_clk blsp1_qup2_spi_apps_clk_src = { |
| 695 | .cmd_rcgr_reg = BLSP1_QUP2_SPI_APPS_CMD_RCGR, |
| 696 | .set_rate = set_rate_mnd, |
| 697 | .freq_tbl = ftbl_gcc_blsp1_qup1_6_spi_apps_clk, |
| 698 | .current_freq = &rcg_dummy_freq, |
| 699 | .base = &virt_bases[GCC_BASE], |
| 700 | .c = { |
| 701 | .dbg_name = "blsp1_qup2_spi_apps_clk_src", |
| 702 | .ops = &clk_ops_rcg_mnd, |
| 703 | VDD_DIG_FMAX_MAP2(LOW, 25000000, NOMINAL, 50000000), |
| 704 | CLK_INIT(blsp1_qup2_spi_apps_clk_src.c), |
| 705 | }, |
| 706 | }; |
| 707 | |
| 708 | static struct rcg_clk blsp1_qup3_spi_apps_clk_src = { |
| 709 | .cmd_rcgr_reg = BLSP1_QUP3_SPI_APPS_CMD_RCGR, |
| 710 | .set_rate = set_rate_mnd, |
| 711 | .freq_tbl = ftbl_gcc_blsp1_qup1_6_spi_apps_clk, |
| 712 | .current_freq = &rcg_dummy_freq, |
| 713 | .base = &virt_bases[GCC_BASE], |
| 714 | .c = { |
| 715 | .dbg_name = "blsp1_qup3_spi_apps_clk_src", |
| 716 | .ops = &clk_ops_rcg_mnd, |
| 717 | VDD_DIG_FMAX_MAP2(LOW, 25000000, NOMINAL, 50000000), |
| 718 | CLK_INIT(blsp1_qup3_spi_apps_clk_src.c), |
| 719 | }, |
| 720 | }; |
| 721 | |
| 722 | static struct rcg_clk blsp1_qup4_spi_apps_clk_src = { |
| 723 | .cmd_rcgr_reg = BLSP1_QUP4_SPI_APPS_CMD_RCGR, |
| 724 | .set_rate = set_rate_mnd, |
| 725 | .freq_tbl = ftbl_gcc_blsp1_qup1_6_spi_apps_clk, |
| 726 | .current_freq = &rcg_dummy_freq, |
| 727 | .base = &virt_bases[GCC_BASE], |
| 728 | .c = { |
| 729 | .dbg_name = "blsp1_qup4_spi_apps_clk_src", |
| 730 | .ops = &clk_ops_rcg_mnd, |
| 731 | VDD_DIG_FMAX_MAP2(LOW, 25000000, NOMINAL, 50000000), |
| 732 | CLK_INIT(blsp1_qup4_spi_apps_clk_src.c), |
| 733 | }, |
| 734 | }; |
| 735 | |
| 736 | static struct rcg_clk blsp1_qup5_spi_apps_clk_src = { |
| 737 | .cmd_rcgr_reg = BLSP1_QUP5_SPI_APPS_CMD_RCGR, |
| 738 | .set_rate = set_rate_mnd, |
| 739 | .freq_tbl = ftbl_gcc_blsp1_qup1_6_spi_apps_clk, |
| 740 | .current_freq = &rcg_dummy_freq, |
| 741 | .base = &virt_bases[GCC_BASE], |
| 742 | .c = { |
| 743 | .dbg_name = "blsp1_qup5_spi_apps_clk_src", |
| 744 | .ops = &clk_ops_rcg_mnd, |
| 745 | VDD_DIG_FMAX_MAP2(LOW, 25000000, NOMINAL, 50000000), |
| 746 | CLK_INIT(blsp1_qup5_spi_apps_clk_src.c), |
| 747 | }, |
| 748 | }; |
| 749 | |
| 750 | static struct rcg_clk blsp1_qup6_spi_apps_clk_src = { |
| 751 | .cmd_rcgr_reg = BLSP1_QUP6_SPI_APPS_CMD_RCGR, |
| 752 | .set_rate = set_rate_mnd, |
| 753 | .freq_tbl = ftbl_gcc_blsp1_qup1_6_spi_apps_clk, |
| 754 | .current_freq = &rcg_dummy_freq, |
| 755 | .base = &virt_bases[GCC_BASE], |
| 756 | .c = { |
| 757 | .dbg_name = "blsp1_qup6_spi_apps_clk_src", |
| 758 | .ops = &clk_ops_rcg_mnd, |
| 759 | VDD_DIG_FMAX_MAP2(LOW, 25000000, NOMINAL, 50000000), |
| 760 | CLK_INIT(blsp1_qup6_spi_apps_clk_src.c), |
| 761 | }, |
| 762 | }; |
| 763 | |
| 764 | static struct clk_freq_tbl ftbl_gcc_blsp1_uart1_6_apps_clk[] = { |
| 765 | F( 3686400, gpll0, 1, 96, 15625), |
| 766 | F( 7372800, gpll0, 1, 192, 15625), |
| 767 | F(14745600, gpll0, 1, 384, 15625), |
| 768 | F(16000000, gpll0, 5, 2, 15), |
| 769 | F(19200000, gcc_xo, 1, 0, 0), |
| 770 | F(24000000, gpll0, 5, 1, 5), |
| 771 | F(32000000, gpll0, 1, 4, 75), |
| 772 | F(40000000, gpll0, 15, 0, 0), |
| 773 | F(46400000, gpll0, 1, 29, 375), |
| 774 | F(48000000, gpll0, 12.5, 0, 0), |
| 775 | F(51200000, gpll0, 1, 32, 375), |
| 776 | F(56000000, gpll0, 1, 7, 75), |
| 777 | F(58982400, gpll0, 1, 1536, 15625), |
| 778 | F(60000000, gpll0, 10, 0, 0), |
| 779 | F_END, |
| 780 | }; |
| 781 | |
| 782 | static struct rcg_clk blsp1_uart1_apps_clk_src = { |
| 783 | .cmd_rcgr_reg = BLSP1_UART1_APPS_CMD_RCGR, |
| 784 | .set_rate = set_rate_mnd, |
| 785 | .freq_tbl = ftbl_gcc_blsp1_uart1_6_apps_clk, |
| 786 | .current_freq = &rcg_dummy_freq, |
| 787 | .base = &virt_bases[GCC_BASE], |
| 788 | .c = { |
| 789 | .dbg_name = "blsp1_uart1_apps_clk_src", |
| 790 | .ops = &clk_ops_rcg_mnd, |
| 791 | VDD_DIG_FMAX_MAP2(LOW, 31580000, NOMINAL, 63160000), |
| 792 | CLK_INIT(blsp1_uart1_apps_clk_src.c), |
| 793 | }, |
| 794 | }; |
| 795 | |
| 796 | static struct rcg_clk blsp1_uart2_apps_clk_src = { |
| 797 | .cmd_rcgr_reg = BLSP1_UART2_APPS_CMD_RCGR, |
| 798 | .set_rate = set_rate_mnd, |
| 799 | .freq_tbl = ftbl_gcc_blsp1_uart1_6_apps_clk, |
| 800 | .current_freq = &rcg_dummy_freq, |
| 801 | .base = &virt_bases[GCC_BASE], |
| 802 | .c = { |
| 803 | .dbg_name = "blsp1_uart2_apps_clk_src", |
| 804 | .ops = &clk_ops_rcg_mnd, |
| 805 | VDD_DIG_FMAX_MAP2(LOW, 31580000, NOMINAL, 63160000), |
| 806 | CLK_INIT(blsp1_uart2_apps_clk_src.c), |
| 807 | }, |
| 808 | }; |
| 809 | |
| 810 | static struct rcg_clk blsp1_uart3_apps_clk_src = { |
| 811 | .cmd_rcgr_reg = BLSP1_UART3_APPS_CMD_RCGR, |
| 812 | .set_rate = set_rate_mnd, |
| 813 | .freq_tbl = ftbl_gcc_blsp1_uart1_6_apps_clk, |
| 814 | .current_freq = &rcg_dummy_freq, |
| 815 | .base = &virt_bases[GCC_BASE], |
| 816 | .c = { |
| 817 | .dbg_name = "blsp1_uart3_apps_clk_src", |
| 818 | .ops = &clk_ops_rcg_mnd, |
| 819 | VDD_DIG_FMAX_MAP2(LOW, 31580000, NOMINAL, 63160000), |
| 820 | CLK_INIT(blsp1_uart3_apps_clk_src.c), |
| 821 | }, |
| 822 | }; |
| 823 | |
| 824 | static struct rcg_clk blsp1_uart4_apps_clk_src = { |
| 825 | .cmd_rcgr_reg = BLSP1_UART4_APPS_CMD_RCGR, |
| 826 | .set_rate = set_rate_mnd, |
| 827 | .freq_tbl = ftbl_gcc_blsp1_uart1_6_apps_clk, |
| 828 | .current_freq = &rcg_dummy_freq, |
| 829 | .base = &virt_bases[GCC_BASE], |
| 830 | .c = { |
| 831 | .dbg_name = "blsp1_uart4_apps_clk_src", |
| 832 | .ops = &clk_ops_rcg_mnd, |
| 833 | VDD_DIG_FMAX_MAP2(LOW, 31580000, NOMINAL, 63160000), |
| 834 | CLK_INIT(blsp1_uart4_apps_clk_src.c), |
| 835 | }, |
| 836 | }; |
| 837 | |
| 838 | static struct rcg_clk blsp1_uart5_apps_clk_src = { |
| 839 | .cmd_rcgr_reg = BLSP1_UART5_APPS_CMD_RCGR, |
| 840 | .set_rate = set_rate_mnd, |
| 841 | .freq_tbl = ftbl_gcc_blsp1_uart1_6_apps_clk, |
| 842 | .current_freq = &rcg_dummy_freq, |
| 843 | .base = &virt_bases[GCC_BASE], |
| 844 | .c = { |
| 845 | .dbg_name = "blsp1_uart5_apps_clk_src", |
| 846 | .ops = &clk_ops_rcg_mnd, |
| 847 | VDD_DIG_FMAX_MAP2(LOW, 31580000, NOMINAL, 63160000), |
| 848 | CLK_INIT(blsp1_uart5_apps_clk_src.c), |
| 849 | }, |
| 850 | }; |
| 851 | |
| 852 | static struct rcg_clk blsp1_uart6_apps_clk_src = { |
| 853 | .cmd_rcgr_reg = BLSP1_UART6_APPS_CMD_RCGR, |
| 854 | .set_rate = set_rate_mnd, |
| 855 | .freq_tbl = ftbl_gcc_blsp1_uart1_6_apps_clk, |
| 856 | .current_freq = &rcg_dummy_freq, |
| 857 | .base = &virt_bases[GCC_BASE], |
| 858 | .c = { |
| 859 | .dbg_name = "blsp1_uart6_apps_clk_src", |
| 860 | .ops = &clk_ops_rcg_mnd, |
| 861 | VDD_DIG_FMAX_MAP2(LOW, 31580000, NOMINAL, 63160000), |
| 862 | CLK_INIT(blsp1_uart6_apps_clk_src.c), |
| 863 | }, |
| 864 | }; |
| 865 | |
| 866 | static struct clk_freq_tbl ftbl_gcc_ce1_clk[] = { |
| 867 | F(50000000, gpll0, 12, 0, 0), |
| 868 | F(100000000, gpll0, 6, 0, 0), |
| 869 | F_END, |
| 870 | }; |
| 871 | |
| 872 | static struct rcg_clk ce1_clk_src = { |
| 873 | .cmd_rcgr_reg = CE1_CMD_RCGR, |
| 874 | .set_rate = set_rate_hid, |
| 875 | .freq_tbl = ftbl_gcc_ce1_clk, |
| 876 | .current_freq = &rcg_dummy_freq, |
| 877 | .base = &virt_bases[GCC_BASE], |
| 878 | .c = { |
| 879 | .dbg_name = "ce1_clk_src", |
| 880 | .ops = &clk_ops_rcg, |
| 881 | VDD_DIG_FMAX_MAP2(LOW, 50000000, NOMINAL, 100000000), |
| 882 | CLK_INIT(ce1_clk_src.c), |
| 883 | }, |
| 884 | }; |
| 885 | |
| 886 | static struct clk_freq_tbl ftbl_gcc_gp1_3_clk[] = { |
| 887 | F(19200000, gcc_xo, 1, 0, 0), |
| 888 | F_END, |
| 889 | }; |
| 890 | |
| 891 | static struct rcg_clk gp1_clk_src = { |
| 892 | .cmd_rcgr_reg = GP1_CMD_RCGR, |
| 893 | .set_rate = set_rate_mnd, |
| 894 | .freq_tbl = ftbl_gcc_gp1_3_clk, |
| 895 | .current_freq = &rcg_dummy_freq, |
| 896 | .base = &virt_bases[GCC_BASE], |
| 897 | .c = { |
| 898 | .dbg_name = "gp1_clk_src", |
| 899 | .ops = &clk_ops_rcg_mnd, |
| 900 | VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000), |
| 901 | CLK_INIT(gp1_clk_src.c), |
| 902 | }, |
| 903 | }; |
| 904 | |
| 905 | static struct rcg_clk gp2_clk_src = { |
| 906 | .cmd_rcgr_reg = GP2_CMD_RCGR, |
| 907 | .set_rate = set_rate_mnd, |
| 908 | .freq_tbl = ftbl_gcc_gp1_3_clk, |
| 909 | .current_freq = &rcg_dummy_freq, |
| 910 | .base = &virt_bases[GCC_BASE], |
| 911 | .c = { |
| 912 | .dbg_name = "gp2_clk_src", |
| 913 | .ops = &clk_ops_rcg_mnd, |
| 914 | VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000), |
| 915 | CLK_INIT(gp2_clk_src.c), |
| 916 | }, |
| 917 | }; |
| 918 | |
| 919 | static struct rcg_clk gp3_clk_src = { |
| 920 | .cmd_rcgr_reg = GP3_CMD_RCGR, |
| 921 | .set_rate = set_rate_mnd, |
| 922 | .freq_tbl = ftbl_gcc_gp1_3_clk, |
| 923 | .current_freq = &rcg_dummy_freq, |
| 924 | .base = &virt_bases[GCC_BASE], |
| 925 | .c = { |
| 926 | .dbg_name = "gp3_clk_src", |
| 927 | .ops = &clk_ops_rcg_mnd, |
| 928 | VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000), |
| 929 | CLK_INIT(gp3_clk_src.c), |
| 930 | }, |
| 931 | }; |
| 932 | |
| 933 | static struct clk_freq_tbl ftbl_gcc_pdm2_clk[] = { |
| 934 | F(60000000, gpll0, 10, 0, 0), |
| 935 | F_END, |
| 936 | }; |
| 937 | |
| 938 | static struct rcg_clk pdm2_clk_src = { |
| 939 | .cmd_rcgr_reg = PDM2_CMD_RCGR, |
| 940 | .set_rate = set_rate_hid, |
| 941 | .freq_tbl = ftbl_gcc_pdm2_clk, |
| 942 | .current_freq = &rcg_dummy_freq, |
| 943 | .base = &virt_bases[GCC_BASE], |
| 944 | .c = { |
| 945 | .dbg_name = "pdm2_clk_src", |
| 946 | .ops = &clk_ops_rcg, |
| 947 | VDD_DIG_FMAX_MAP1(LOW, 120000000), |
| 948 | CLK_INIT(pdm2_clk_src.c), |
| 949 | }, |
| 950 | }; |
| 951 | |
| 952 | static struct clk_freq_tbl ftbl_gcc_sdcc1_2_apps_clk[] = { |
| 953 | F( 144000, gcc_xo, 16, 3, 25), |
| 954 | F( 400000, gcc_xo, 12, 1, 4), |
| 955 | F( 20000000, gpll0, 15, 1, 2), |
| 956 | F( 25000000, gpll0, 12, 1, 2), |
| 957 | F( 50000000, gpll0, 12, 0, 0), |
| 958 | F(100000000, gpll0, 6, 0, 0), |
| 959 | F(200000000, gpll0, 3, 0, 0), |
| 960 | F_END, |
| 961 | }; |
| 962 | |
| 963 | static struct rcg_clk sdcc1_apps_clk_src = { |
| 964 | .cmd_rcgr_reg = SDCC1_APPS_CMD_RCGR, |
| 965 | .set_rate = set_rate_mnd, |
| 966 | .freq_tbl = ftbl_gcc_sdcc1_2_apps_clk, |
| 967 | .current_freq = &rcg_dummy_freq, |
| 968 | .base = &virt_bases[GCC_BASE], |
| 969 | .c = { |
| 970 | .dbg_name = "sdcc1_apps_clk_src", |
| 971 | .ops = &clk_ops_rcg_mnd, |
| 972 | VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000), |
| 973 | CLK_INIT(sdcc1_apps_clk_src.c), |
| 974 | }, |
| 975 | }; |
| 976 | |
| 977 | static struct rcg_clk sdcc2_apps_clk_src = { |
| 978 | .cmd_rcgr_reg = SDCC2_APPS_CMD_RCGR, |
| 979 | .set_rate = set_rate_mnd, |
| 980 | .freq_tbl = ftbl_gcc_sdcc1_2_apps_clk, |
| 981 | .current_freq = &rcg_dummy_freq, |
| 982 | .base = &virt_bases[GCC_BASE], |
| 983 | .c = { |
| 984 | .dbg_name = "sdcc2_apps_clk_src", |
| 985 | .ops = &clk_ops_rcg_mnd, |
| 986 | VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000), |
| 987 | CLK_INIT(sdcc2_apps_clk_src.c), |
| 988 | }, |
| 989 | }; |
| 990 | |
| 991 | static struct clk_freq_tbl ftbl_gcc_usb_hs_system_clk[] = { |
| 992 | F(75000000, gpll0, 8, 0, 0), |
| 993 | F_END, |
| 994 | }; |
| 995 | |
| 996 | static struct rcg_clk usb_hs_system_clk_src = { |
| 997 | .cmd_rcgr_reg = USB_HS_SYSTEM_CMD_RCGR, |
| 998 | .set_rate = set_rate_hid, |
| 999 | .freq_tbl = ftbl_gcc_usb_hs_system_clk, |
| 1000 | .current_freq = &rcg_dummy_freq, |
| 1001 | .base = &virt_bases[GCC_BASE], |
| 1002 | .c = { |
| 1003 | .dbg_name = "usb_hs_system_clk_src", |
| 1004 | .ops = &clk_ops_rcg, |
| 1005 | VDD_DIG_FMAX_MAP2(LOW, 60000000, NOMINAL, 100000000), |
| 1006 | CLK_INIT(usb_hs_system_clk_src.c), |
| 1007 | }, |
| 1008 | }; |
| 1009 | |
| 1010 | static struct local_vote_clk gcc_blsp1_ahb_clk = { |
| 1011 | .cbcr_reg = BLSP1_AHB_CBCR, |
| 1012 | .vote_reg = APCS_CLOCK_BRANCH_ENA_VOTE, |
| 1013 | .en_mask = BIT(17), |
| 1014 | .base = &virt_bases[GCC_BASE], |
| 1015 | .c = { |
| 1016 | .dbg_name = "gcc_blsp1_ahb_clk", |
| 1017 | .ops = &clk_ops_vote, |
| 1018 | CLK_INIT(gcc_blsp1_ahb_clk.c), |
| 1019 | }, |
| 1020 | }; |
| 1021 | |
| 1022 | static struct branch_clk gcc_blsp1_qup1_i2c_apps_clk = { |
| 1023 | .cbcr_reg = BLSP1_QUP1_I2C_APPS_CBCR, |
| 1024 | .has_sibling = 1, |
| 1025 | .base = &virt_bases[GCC_BASE], |
| 1026 | .c = { |
| 1027 | .parent = &gcc_xo_clk_src.c, |
| 1028 | .dbg_name = "gcc_blsp1_qup1_i2c_apps_clk", |
| 1029 | .ops = &clk_ops_branch, |
| 1030 | CLK_INIT(gcc_blsp1_qup1_i2c_apps_clk.c), |
| 1031 | }, |
| 1032 | }; |
| 1033 | |
| 1034 | static struct branch_clk gcc_blsp1_qup1_spi_apps_clk = { |
| 1035 | .cbcr_reg = BLSP1_QUP1_SPI_APPS_CBCR, |
| 1036 | .has_sibling = 0, |
| 1037 | .base = &virt_bases[GCC_BASE], |
| 1038 | .c = { |
| 1039 | .parent = &blsp1_qup1_spi_apps_clk_src.c, |
| 1040 | .dbg_name = "gcc_blsp1_qup1_spi_apps_clk", |
| 1041 | .ops = &clk_ops_branch, |
| 1042 | CLK_INIT(gcc_blsp1_qup1_spi_apps_clk.c), |
| 1043 | }, |
| 1044 | }; |
| 1045 | |
| 1046 | static struct branch_clk gcc_blsp1_qup2_i2c_apps_clk = { |
| 1047 | .cbcr_reg = BLSP1_QUP2_I2C_APPS_CBCR, |
| 1048 | .has_sibling = 1, |
| 1049 | .base = &virt_bases[GCC_BASE], |
| 1050 | .c = { |
| 1051 | .parent = &gcc_xo_clk_src.c, |
| 1052 | .dbg_name = "gcc_blsp1_qup2_i2c_apps_clk", |
| 1053 | .ops = &clk_ops_branch, |
| 1054 | CLK_INIT(gcc_blsp1_qup2_i2c_apps_clk.c), |
| 1055 | }, |
| 1056 | }; |
| 1057 | |
| 1058 | static struct branch_clk gcc_blsp1_qup2_spi_apps_clk = { |
| 1059 | .cbcr_reg = BLSP1_QUP2_SPI_APPS_CBCR, |
| 1060 | .has_sibling = 0, |
| 1061 | .base = &virt_bases[GCC_BASE], |
| 1062 | .c = { |
| 1063 | .parent = &blsp1_qup2_spi_apps_clk_src.c, |
| 1064 | .dbg_name = "gcc_blsp1_qup2_spi_apps_clk", |
| 1065 | .ops = &clk_ops_branch, |
| 1066 | CLK_INIT(gcc_blsp1_qup2_spi_apps_clk.c), |
| 1067 | }, |
| 1068 | }; |
| 1069 | |
| 1070 | static struct branch_clk gcc_blsp1_qup3_i2c_apps_clk = { |
| 1071 | .cbcr_reg = BLSP1_QUP3_I2C_APPS_CBCR, |
| 1072 | .has_sibling = 1, |
| 1073 | .base = &virt_bases[GCC_BASE], |
| 1074 | .c = { |
| 1075 | .parent = &gcc_xo_clk_src.c, |
| 1076 | .dbg_name = "gcc_blsp1_qup3_i2c_apps_clk", |
| 1077 | .ops = &clk_ops_branch, |
| 1078 | CLK_INIT(gcc_blsp1_qup3_i2c_apps_clk.c), |
| 1079 | }, |
| 1080 | }; |
| 1081 | |
| 1082 | static struct branch_clk gcc_blsp1_qup3_spi_apps_clk = { |
| 1083 | .cbcr_reg = BLSP1_QUP3_SPI_APPS_CBCR, |
| 1084 | .has_sibling = 0, |
| 1085 | .base = &virt_bases[GCC_BASE], |
| 1086 | .c = { |
| 1087 | .parent = &blsp1_qup3_spi_apps_clk_src.c, |
| 1088 | .dbg_name = "gcc_blsp1_qup3_spi_apps_clk", |
| 1089 | .ops = &clk_ops_branch, |
| 1090 | CLK_INIT(gcc_blsp1_qup3_spi_apps_clk.c), |
| 1091 | }, |
| 1092 | }; |
| 1093 | |
| 1094 | static struct branch_clk gcc_blsp1_qup4_i2c_apps_clk = { |
| 1095 | .cbcr_reg = BLSP1_QUP4_I2C_APPS_CBCR, |
| 1096 | .has_sibling = 1, |
| 1097 | .base = &virt_bases[GCC_BASE], |
| 1098 | .c = { |
| 1099 | .parent = &gcc_xo_clk_src.c, |
| 1100 | .dbg_name = "gcc_blsp1_qup4_i2c_apps_clk", |
| 1101 | .ops = &clk_ops_branch, |
| 1102 | CLK_INIT(gcc_blsp1_qup4_i2c_apps_clk.c), |
| 1103 | }, |
| 1104 | }; |
| 1105 | |
| 1106 | static struct branch_clk gcc_blsp1_qup4_spi_apps_clk = { |
| 1107 | .cbcr_reg = BLSP1_QUP4_SPI_APPS_CBCR, |
| 1108 | .has_sibling = 0, |
| 1109 | .base = &virt_bases[GCC_BASE], |
| 1110 | .c = { |
| 1111 | .parent = &blsp1_qup4_spi_apps_clk_src.c, |
| 1112 | .dbg_name = "gcc_blsp1_qup4_spi_apps_clk", |
| 1113 | .ops = &clk_ops_branch, |
| 1114 | CLK_INIT(gcc_blsp1_qup4_spi_apps_clk.c), |
| 1115 | }, |
| 1116 | }; |
| 1117 | |
| 1118 | static struct branch_clk gcc_blsp1_qup5_i2c_apps_clk = { |
| 1119 | .cbcr_reg = BLSP1_QUP5_I2C_APPS_CBCR, |
| 1120 | .has_sibling = 1, |
| 1121 | .base = &virt_bases[GCC_BASE], |
| 1122 | .c = { |
| 1123 | .parent = &gcc_xo_clk_src.c, |
| 1124 | .dbg_name = "gcc_blsp1_qup5_i2c_apps_clk", |
| 1125 | .ops = &clk_ops_branch, |
| 1126 | CLK_INIT(gcc_blsp1_qup5_i2c_apps_clk.c), |
| 1127 | }, |
| 1128 | }; |
| 1129 | |
| 1130 | static struct branch_clk gcc_blsp1_qup5_spi_apps_clk = { |
| 1131 | .cbcr_reg = BLSP1_QUP5_SPI_APPS_CBCR, |
| 1132 | .has_sibling = 0, |
| 1133 | .base = &virt_bases[GCC_BASE], |
| 1134 | .c = { |
| 1135 | .parent = &blsp1_qup5_spi_apps_clk_src.c, |
| 1136 | .dbg_name = "gcc_blsp1_qup5_spi_apps_clk", |
| 1137 | .ops = &clk_ops_branch, |
| 1138 | CLK_INIT(gcc_blsp1_qup5_spi_apps_clk.c), |
| 1139 | }, |
| 1140 | }; |
| 1141 | |
| 1142 | static struct branch_clk gcc_blsp1_qup6_i2c_apps_clk = { |
| 1143 | .cbcr_reg = BLSP1_QUP6_I2C_APPS_CBCR, |
| 1144 | .has_sibling = 1, |
| 1145 | .base = &virt_bases[GCC_BASE], |
| 1146 | .c = { |
| 1147 | .parent = &gcc_xo_clk_src.c, |
| 1148 | .dbg_name = "gcc_blsp1_qup6_i2c_apps_clk", |
| 1149 | .ops = &clk_ops_branch, |
| 1150 | CLK_INIT(gcc_blsp1_qup6_i2c_apps_clk.c), |
| 1151 | }, |
| 1152 | }; |
| 1153 | |
| 1154 | static struct branch_clk gcc_blsp1_qup6_spi_apps_clk = { |
| 1155 | .cbcr_reg = BLSP1_QUP6_SPI_APPS_CBCR, |
| 1156 | .has_sibling = 0, |
| 1157 | .base = &virt_bases[GCC_BASE], |
| 1158 | .c = { |
| 1159 | .parent = &blsp1_qup6_spi_apps_clk_src.c, |
| 1160 | .dbg_name = "gcc_blsp1_qup6_spi_apps_clk", |
| 1161 | .ops = &clk_ops_branch, |
| 1162 | CLK_INIT(gcc_blsp1_qup6_spi_apps_clk.c), |
| 1163 | }, |
| 1164 | }; |
| 1165 | |
| 1166 | static struct branch_clk gcc_blsp1_uart1_apps_clk = { |
| 1167 | .cbcr_reg = BLSP1_UART1_APPS_CBCR, |
| 1168 | .has_sibling = 0, |
| 1169 | .base = &virt_bases[GCC_BASE], |
| 1170 | .c = { |
| 1171 | .parent = &blsp1_uart1_apps_clk_src.c, |
| 1172 | .dbg_name = "gcc_blsp1_uart1_apps_clk", |
| 1173 | .ops = &clk_ops_branch, |
| 1174 | CLK_INIT(gcc_blsp1_uart1_apps_clk.c), |
| 1175 | }, |
| 1176 | }; |
| 1177 | |
| 1178 | static struct branch_clk gcc_blsp1_uart2_apps_clk = { |
| 1179 | .cbcr_reg = BLSP1_UART2_APPS_CBCR, |
| 1180 | .has_sibling = 0, |
| 1181 | .base = &virt_bases[GCC_BASE], |
| 1182 | .c = { |
| 1183 | .parent = &blsp1_uart2_apps_clk_src.c, |
| 1184 | .dbg_name = "gcc_blsp1_uart2_apps_clk", |
| 1185 | .ops = &clk_ops_branch, |
| 1186 | CLK_INIT(gcc_blsp1_uart2_apps_clk.c), |
| 1187 | }, |
| 1188 | }; |
| 1189 | |
| 1190 | static struct branch_clk gcc_blsp1_uart3_apps_clk = { |
| 1191 | .cbcr_reg = BLSP1_UART3_APPS_CBCR, |
| 1192 | .has_sibling = 0, |
| 1193 | .base = &virt_bases[GCC_BASE], |
| 1194 | .c = { |
| 1195 | .parent = &blsp1_uart3_apps_clk_src.c, |
| 1196 | .dbg_name = "gcc_blsp1_uart3_apps_clk", |
| 1197 | .ops = &clk_ops_branch, |
| 1198 | CLK_INIT(gcc_blsp1_uart3_apps_clk.c), |
| 1199 | }, |
| 1200 | }; |
| 1201 | |
| 1202 | static struct branch_clk gcc_blsp1_uart4_apps_clk = { |
| 1203 | .cbcr_reg = BLSP1_UART4_APPS_CBCR, |
| 1204 | .has_sibling = 0, |
| 1205 | .base = &virt_bases[GCC_BASE], |
| 1206 | .c = { |
| 1207 | .parent = &blsp1_uart4_apps_clk_src.c, |
| 1208 | .dbg_name = "gcc_blsp1_uart4_apps_clk", |
| 1209 | .ops = &clk_ops_branch, |
| 1210 | CLK_INIT(gcc_blsp1_uart4_apps_clk.c), |
| 1211 | }, |
| 1212 | }; |
| 1213 | |
| 1214 | static struct branch_clk gcc_blsp1_uart5_apps_clk = { |
| 1215 | .cbcr_reg = BLSP1_UART5_APPS_CBCR, |
| 1216 | .has_sibling = 0, |
| 1217 | .base = &virt_bases[GCC_BASE], |
| 1218 | .c = { |
| 1219 | .parent = &blsp1_uart5_apps_clk_src.c, |
| 1220 | .dbg_name = "gcc_blsp1_uart5_apps_clk", |
| 1221 | .ops = &clk_ops_branch, |
| 1222 | CLK_INIT(gcc_blsp1_uart5_apps_clk.c), |
| 1223 | }, |
| 1224 | }; |
| 1225 | |
| 1226 | static struct branch_clk gcc_blsp1_uart6_apps_clk = { |
| 1227 | .cbcr_reg = BLSP1_UART6_APPS_CBCR, |
| 1228 | .has_sibling = 0, |
| 1229 | .base = &virt_bases[GCC_BASE], |
| 1230 | .c = { |
| 1231 | .parent = &blsp1_uart6_apps_clk_src.c, |
| 1232 | .dbg_name = "gcc_blsp1_uart6_apps_clk", |
| 1233 | .ops = &clk_ops_branch, |
| 1234 | CLK_INIT(gcc_blsp1_uart6_apps_clk.c), |
| 1235 | }, |
| 1236 | }; |
| 1237 | |
| 1238 | static struct local_vote_clk gcc_boot_rom_ahb_clk = { |
| 1239 | .cbcr_reg = BOOT_ROM_AHB_CBCR, |
| 1240 | .vote_reg = APCS_CLOCK_BRANCH_ENA_VOTE, |
| 1241 | .en_mask = BIT(10), |
| 1242 | .base = &virt_bases[GCC_BASE], |
| 1243 | .c = { |
| 1244 | .dbg_name = "gcc_boot_rom_ahb_clk", |
| 1245 | .ops = &clk_ops_vote, |
| 1246 | CLK_INIT(gcc_boot_rom_ahb_clk.c), |
| 1247 | }, |
| 1248 | }; |
| 1249 | |
| 1250 | static struct local_vote_clk gcc_ce1_ahb_clk = { |
| 1251 | .cbcr_reg = CE1_AHB_CBCR, |
| 1252 | .vote_reg = APCS_CLOCK_BRANCH_ENA_VOTE, |
| 1253 | .en_mask = BIT(3), |
| 1254 | .base = &virt_bases[GCC_BASE], |
| 1255 | .c = { |
| 1256 | .dbg_name = "gcc_ce1_ahb_clk", |
| 1257 | .ops = &clk_ops_vote, |
| 1258 | CLK_INIT(gcc_ce1_ahb_clk.c), |
| 1259 | }, |
| 1260 | }; |
| 1261 | |
| 1262 | static struct local_vote_clk gcc_ce1_axi_clk = { |
| 1263 | .cbcr_reg = CE1_AXI_CBCR, |
| 1264 | .vote_reg = APCS_CLOCK_BRANCH_ENA_VOTE, |
| 1265 | .en_mask = BIT(4), |
| 1266 | .base = &virt_bases[GCC_BASE], |
| 1267 | .c = { |
| 1268 | .dbg_name = "gcc_ce1_axi_clk", |
| 1269 | .ops = &clk_ops_vote, |
| 1270 | CLK_INIT(gcc_ce1_axi_clk.c), |
| 1271 | }, |
| 1272 | }; |
| 1273 | |
| 1274 | static struct local_vote_clk gcc_ce1_clk = { |
| 1275 | .cbcr_reg = CE1_CBCR, |
| 1276 | .vote_reg = APCS_CLOCK_BRANCH_ENA_VOTE, |
| 1277 | .en_mask = BIT(5), |
| 1278 | .base = &virt_bases[GCC_BASE], |
| 1279 | .c = { |
| 1280 | .dbg_name = "gcc_ce1_clk", |
| 1281 | .ops = &clk_ops_vote, |
| 1282 | CLK_INIT(gcc_ce1_clk.c), |
| 1283 | }, |
| 1284 | }; |
| 1285 | |
| 1286 | static struct branch_clk gcc_copss_smmu_ahb_clk = { |
| 1287 | .cbcr_reg = COPSS_SMMU_AHB_CBCR, |
| 1288 | .has_sibling = 1, |
| 1289 | .base = &virt_bases[GCC_BASE], |
| 1290 | .c = { |
| 1291 | .dbg_name = "gcc_copss_smmu_ahb_clk", |
| 1292 | .ops = &clk_ops_branch, |
| 1293 | CLK_INIT(gcc_copss_smmu_ahb_clk.c), |
| 1294 | }, |
| 1295 | }; |
| 1296 | |
| 1297 | static struct branch_clk gcc_lpss_smmu_ahb_clk = { |
| 1298 | .cbcr_reg = LPSS_SMMU_AHB_CBCR, |
| 1299 | .has_sibling = 1, |
| 1300 | .base = &virt_bases[GCC_BASE], |
| 1301 | .c = { |
| 1302 | .dbg_name = "gcc_lpss_smmu_ahb_clk", |
| 1303 | .ops = &clk_ops_branch, |
| 1304 | CLK_INIT(gcc_lpss_smmu_ahb_clk.c), |
| 1305 | }, |
| 1306 | }; |
| 1307 | |
| 1308 | static struct branch_clk gcc_gp1_clk = { |
| 1309 | .cbcr_reg = GP1_CBCR, |
| 1310 | .has_sibling = 0, |
| 1311 | .base = &virt_bases[GCC_BASE], |
| 1312 | .c = { |
| 1313 | .parent = &gp1_clk_src.c, |
| 1314 | .dbg_name = "gcc_gp1_clk", |
| 1315 | .ops = &clk_ops_branch, |
| 1316 | CLK_INIT(gcc_gp1_clk.c), |
| 1317 | }, |
| 1318 | }; |
| 1319 | |
| 1320 | static struct branch_clk gcc_gp2_clk = { |
| 1321 | .cbcr_reg = GP2_CBCR, |
| 1322 | .has_sibling = 0, |
| 1323 | .base = &virt_bases[GCC_BASE], |
| 1324 | .c = { |
| 1325 | .parent = &gp2_clk_src.c, |
| 1326 | .dbg_name = "gcc_gp2_clk", |
| 1327 | .ops = &clk_ops_branch, |
| 1328 | CLK_INIT(gcc_gp2_clk.c), |
| 1329 | }, |
| 1330 | }; |
| 1331 | |
| 1332 | static struct branch_clk gcc_gp3_clk = { |
| 1333 | .cbcr_reg = GP3_CBCR, |
| 1334 | .has_sibling = 0, |
| 1335 | .base = &virt_bases[GCC_BASE], |
| 1336 | .c = { |
| 1337 | .parent = &gp3_clk_src.c, |
| 1338 | .dbg_name = "gcc_gp3_clk", |
| 1339 | .ops = &clk_ops_branch, |
| 1340 | CLK_INIT(gcc_gp3_clk.c), |
| 1341 | }, |
| 1342 | }; |
| 1343 | |
| 1344 | static struct branch_clk gcc_lpass_q6_axi_clk = { |
| 1345 | .cbcr_reg = LPASS_Q6_AXI_CBCR, |
| 1346 | .has_sibling = 1, |
| 1347 | .base = &virt_bases[GCC_BASE], |
Vikram Mulukutla | 2dfa8b1 | 2013-01-15 18:17:10 -0800 | [diff] [blame] | 1348 | /* FIXME: Remove this once simulation is fixed. */ |
| 1349 | .halt_check = DELAY, |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 1350 | .c = { |
| 1351 | .dbg_name = "gcc_lpass_q6_axi_clk", |
| 1352 | .ops = &clk_ops_branch, |
| 1353 | CLK_INIT(gcc_lpass_q6_axi_clk.c), |
| 1354 | }, |
| 1355 | }; |
| 1356 | |
| 1357 | static struct branch_clk gcc_mmss_noc_cfg_ahb_clk = { |
| 1358 | .cbcr_reg = MMSS_NOC_CFG_AHB_CBCR, |
| 1359 | .has_sibling = 1, |
| 1360 | .base = &virt_bases[GCC_BASE], |
| 1361 | .c = { |
| 1362 | .dbg_name = "gcc_mmss_noc_cfg_ahb_clk", |
| 1363 | .ops = &clk_ops_branch, |
| 1364 | CLK_INIT(gcc_mmss_noc_cfg_ahb_clk.c), |
| 1365 | }, |
| 1366 | }; |
| 1367 | |
| 1368 | static struct branch_clk gcc_mss_cfg_ahb_clk = { |
| 1369 | .cbcr_reg = MSS_CFG_AHB_CBCR, |
| 1370 | .has_sibling = 1, |
| 1371 | .base = &virt_bases[GCC_BASE], |
| 1372 | .c = { |
| 1373 | .dbg_name = "gcc_mss_cfg_ahb_clk", |
| 1374 | .ops = &clk_ops_branch, |
| 1375 | CLK_INIT(gcc_mss_cfg_ahb_clk.c), |
| 1376 | }, |
| 1377 | }; |
| 1378 | |
| 1379 | static struct branch_clk gcc_mss_q6_bimc_axi_clk = { |
| 1380 | .cbcr_reg = MSS_Q6_BIMC_AXI_CBCR, |
| 1381 | .has_sibling = 1, |
| 1382 | .base = &virt_bases[GCC_BASE], |
| 1383 | .c = { |
| 1384 | .dbg_name = "gcc_mss_q6_bimc_axi_clk", |
| 1385 | .ops = &clk_ops_branch, |
| 1386 | CLK_INIT(gcc_mss_q6_bimc_axi_clk.c), |
| 1387 | }, |
| 1388 | }; |
| 1389 | |
| 1390 | static struct branch_clk gcc_pdm2_clk = { |
| 1391 | .cbcr_reg = PDM2_CBCR, |
| 1392 | .has_sibling = 0, |
| 1393 | .base = &virt_bases[GCC_BASE], |
| 1394 | .c = { |
| 1395 | .parent = &pdm2_clk_src.c, |
| 1396 | .dbg_name = "gcc_pdm2_clk", |
| 1397 | .ops = &clk_ops_branch, |
| 1398 | CLK_INIT(gcc_pdm2_clk.c), |
| 1399 | }, |
| 1400 | }; |
| 1401 | |
| 1402 | static struct branch_clk gcc_pdm_ahb_clk = { |
| 1403 | .cbcr_reg = PDM_AHB_CBCR, |
| 1404 | .has_sibling = 1, |
| 1405 | .base = &virt_bases[GCC_BASE], |
| 1406 | .c = { |
| 1407 | .dbg_name = "gcc_pdm_ahb_clk", |
| 1408 | .ops = &clk_ops_branch, |
| 1409 | CLK_INIT(gcc_pdm_ahb_clk.c), |
| 1410 | }, |
| 1411 | }; |
| 1412 | |
| 1413 | static struct local_vote_clk gcc_prng_ahb_clk = { |
| 1414 | .cbcr_reg = PRNG_AHB_CBCR, |
| 1415 | .vote_reg = APCS_CLOCK_BRANCH_ENA_VOTE, |
| 1416 | .en_mask = BIT(13), |
| 1417 | .base = &virt_bases[GCC_BASE], |
| 1418 | .c = { |
| 1419 | .dbg_name = "gcc_prng_ahb_clk", |
| 1420 | .ops = &clk_ops_vote, |
| 1421 | CLK_INIT(gcc_prng_ahb_clk.c), |
| 1422 | }, |
| 1423 | }; |
| 1424 | |
| 1425 | static struct branch_clk gcc_sdcc1_ahb_clk = { |
| 1426 | .cbcr_reg = SDCC1_AHB_CBCR, |
| 1427 | .has_sibling = 1, |
| 1428 | .base = &virt_bases[GCC_BASE], |
| 1429 | .c = { |
| 1430 | .dbg_name = "gcc_sdcc1_ahb_clk", |
| 1431 | .ops = &clk_ops_branch, |
| 1432 | CLK_INIT(gcc_sdcc1_ahb_clk.c), |
| 1433 | }, |
| 1434 | }; |
| 1435 | |
| 1436 | static struct branch_clk gcc_sdcc1_apps_clk = { |
| 1437 | .cbcr_reg = SDCC1_APPS_CBCR, |
| 1438 | .has_sibling = 0, |
| 1439 | .base = &virt_bases[GCC_BASE], |
| 1440 | .c = { |
| 1441 | .parent = &sdcc1_apps_clk_src.c, |
| 1442 | .dbg_name = "gcc_sdcc1_apps_clk", |
| 1443 | .ops = &clk_ops_branch, |
| 1444 | CLK_INIT(gcc_sdcc1_apps_clk.c), |
| 1445 | }, |
| 1446 | }; |
| 1447 | |
| 1448 | static struct branch_clk gcc_sdcc2_ahb_clk = { |
| 1449 | .cbcr_reg = SDCC2_AHB_CBCR, |
| 1450 | .has_sibling = 1, |
| 1451 | .base = &virt_bases[GCC_BASE], |
| 1452 | .c = { |
| 1453 | .dbg_name = "gcc_sdcc2_ahb_clk", |
| 1454 | .ops = &clk_ops_branch, |
| 1455 | CLK_INIT(gcc_sdcc2_ahb_clk.c), |
| 1456 | }, |
| 1457 | }; |
| 1458 | |
| 1459 | static struct branch_clk gcc_sdcc2_apps_clk = { |
| 1460 | .cbcr_reg = SDCC2_APPS_CBCR, |
| 1461 | .has_sibling = 0, |
| 1462 | .base = &virt_bases[GCC_BASE], |
| 1463 | .c = { |
| 1464 | .parent = &sdcc2_apps_clk_src.c, |
| 1465 | .dbg_name = "gcc_sdcc2_apps_clk", |
| 1466 | .ops = &clk_ops_branch, |
| 1467 | CLK_INIT(gcc_sdcc2_apps_clk.c), |
| 1468 | }, |
| 1469 | }; |
| 1470 | |
| 1471 | static struct branch_clk gcc_usb2a_phy_sleep_clk = { |
| 1472 | .cbcr_reg = USB2A_PHY_SLEEP_CBCR, |
| 1473 | .has_sibling = 1, |
| 1474 | .base = &virt_bases[GCC_BASE], |
| 1475 | .c = { |
| 1476 | .dbg_name = "gcc_usb2a_phy_sleep_clk", |
| 1477 | .ops = &clk_ops_branch, |
| 1478 | CLK_INIT(gcc_usb2a_phy_sleep_clk.c), |
| 1479 | }, |
| 1480 | }; |
| 1481 | |
| 1482 | static struct branch_clk gcc_usb_hs_ahb_clk = { |
| 1483 | .cbcr_reg = USB_HS_AHB_CBCR, |
| 1484 | .has_sibling = 1, |
| 1485 | .base = &virt_bases[GCC_BASE], |
| 1486 | .c = { |
| 1487 | .dbg_name = "gcc_usb_hs_ahb_clk", |
| 1488 | .ops = &clk_ops_branch, |
| 1489 | CLK_INIT(gcc_usb_hs_ahb_clk.c), |
| 1490 | }, |
| 1491 | }; |
| 1492 | |
| 1493 | static struct branch_clk gcc_usb_hs_system_clk = { |
| 1494 | .cbcr_reg = USB_HS_SYSTEM_CBCR, |
| 1495 | .has_sibling = 0, |
| 1496 | .bcr_reg = USB_HS_BCR, |
| 1497 | .base = &virt_bases[GCC_BASE], |
| 1498 | .c = { |
| 1499 | .parent = &usb_hs_system_clk_src.c, |
| 1500 | .dbg_name = "gcc_usb_hs_system_clk", |
| 1501 | .ops = &clk_ops_branch, |
| 1502 | CLK_INIT(gcc_usb_hs_system_clk.c), |
| 1503 | }, |
| 1504 | }; |
| 1505 | |
Vikram Mulukutla | 55318acb | 2013-04-15 17:47:34 -0700 | [diff] [blame] | 1506 | static struct branch_clk gcc_bimc_smmu_clk = { |
| 1507 | .cbcr_reg = BIMC_SMMU_CBCR, |
| 1508 | .has_sibling = 0, |
| 1509 | .base = &virt_bases[GCC_BASE], |
| 1510 | .c = { |
| 1511 | .dbg_name = "gcc_bimc_smmu_clk", |
| 1512 | .ops = &clk_ops_branch, |
| 1513 | CLK_INIT(gcc_bimc_smmu_clk.c), |
| 1514 | }, |
| 1515 | }; |
| 1516 | |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 1517 | static struct clk_freq_tbl ftbl_csi0_1_clk[] = { |
| 1518 | F_MM(100000000, gpll0, 6, 0, 0), |
| 1519 | F_MM(200000000, mmpll0, 4, 0, 0), |
| 1520 | F_END, |
| 1521 | }; |
| 1522 | |
| 1523 | static struct rcg_clk csi0_clk_src = { |
| 1524 | .cmd_rcgr_reg = CSI0_CMD_RCGR, |
| 1525 | .set_rate = set_rate_hid, |
| 1526 | .freq_tbl = ftbl_csi0_1_clk, |
| 1527 | .current_freq = &rcg_dummy_freq, |
| 1528 | .base = &virt_bases[MMSS_BASE], |
| 1529 | .c = { |
| 1530 | .dbg_name = "csi0_clk_src", |
| 1531 | .ops = &clk_ops_rcg, |
| 1532 | VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000), |
| 1533 | CLK_INIT(csi0_clk_src.c), |
| 1534 | }, |
| 1535 | }; |
| 1536 | |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 1537 | static struct clk_freq_tbl ftbl_mmss_mmssnoc_axi_clk[] = { |
| 1538 | F_MM( 19200000, gcc_xo, 1, 0, 0), |
| 1539 | F_MM( 37500000, gpll0, 16, 0, 0), |
| 1540 | F_MM( 50000000, gpll0, 12, 0, 0), |
| 1541 | F_MM( 75000000, gpll0, 8, 0, 0), |
| 1542 | F_MM(100000000, gpll0, 6, 0, 0), |
| 1543 | F_MM(150000000, gpll0, 4, 0, 0), |
| 1544 | F_MM(200000000, mmpll0, 4, 0, 0), |
| 1545 | F_END, |
| 1546 | }; |
| 1547 | |
| 1548 | static struct rcg_clk axi_clk_src = { |
| 1549 | .cmd_rcgr_reg = AXI_CMD_RCGR, |
| 1550 | .set_rate = set_rate_hid, |
| 1551 | .freq_tbl = ftbl_mmss_mmssnoc_axi_clk, |
| 1552 | .current_freq = &rcg_dummy_freq, |
| 1553 | .base = &virt_bases[MMSS_BASE], |
| 1554 | .c = { |
| 1555 | .dbg_name = "axi_clk_src", |
| 1556 | .ops = &clk_ops_rcg, |
| 1557 | VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000), |
| 1558 | CLK_INIT(axi_clk_src.c), |
| 1559 | }, |
| 1560 | }; |
| 1561 | |
Vikram Mulukutla | e1e5c48 | 2013-01-28 14:43:20 -0800 | [diff] [blame] | 1562 | static DEFINE_CLK_VOTER(mdp_axi_clk_src, &axi_clk_src.c, 200000000); |
| 1563 | static DEFINE_CLK_VOTER(mmssnoc_axi_clk_src, &axi_clk_src.c, 200000000); |
| 1564 | |
Vikram Mulukutla | e03b4b6 | 2013-03-20 17:45:37 -0700 | [diff] [blame] | 1565 | static struct clk_ops dsi_byte_clk_src_ops; |
| 1566 | static struct clk_ops dsi_pixel_clk_src_ops; |
| 1567 | static struct clk_ops dsi_dsi_clk_src_ops; |
| 1568 | |
| 1569 | static struct dsi_pll_vco_clk dsi_vco = { |
| 1570 | .vco_clk_min = 600000000, |
| 1571 | .vco_clk_max = 1200000000, |
| 1572 | .pref_div_ratio = 26, |
| 1573 | .c = { |
| 1574 | .parent = &gcc_xo_clk_src.c, |
| 1575 | .dbg_name = "dsi_vco", |
| 1576 | .ops = &clk_ops_dsi_vco, |
| 1577 | CLK_INIT(dsi_vco.c), |
| 1578 | }, |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 1579 | }; |
| 1580 | |
Vikram Mulukutla | e03b4b6 | 2013-03-20 17:45:37 -0700 | [diff] [blame] | 1581 | static struct clk dsi_pll_byte = { |
| 1582 | .parent = &dsi_vco.c, |
| 1583 | .dbg_name = "dsi_pll_byte", |
| 1584 | .ops = &clk_ops_dsi_byteclk, |
| 1585 | CLK_INIT(dsi_pll_byte), |
| 1586 | }; |
| 1587 | |
| 1588 | static struct clk dsi_pll_pixel = { |
| 1589 | .parent = &dsi_vco.c, |
| 1590 | .dbg_name = "dsi_pll_pixel", |
| 1591 | .ops = &clk_ops_dsi_dsiclk, |
| 1592 | CLK_INIT(dsi_pll_pixel), |
| 1593 | }; |
| 1594 | |
| 1595 | static struct clk_freq_tbl pixel_freq_tbl[] = { |
| 1596 | { |
| 1597 | .src_clk = &dsi_pll_pixel, |
| 1598 | .div_src_val = BVAL(10, 8, dsipll_mm_source_val), |
| 1599 | }, |
| 1600 | F_END |
| 1601 | }; |
| 1602 | |
| 1603 | #define CFG_RCGR_DIV_MASK BM(4, 0) |
| 1604 | |
| 1605 | static int set_rate_pixel_byte_clk(struct clk *clk, unsigned long rate) |
| 1606 | { |
| 1607 | struct rcg_clk *rcg = to_rcg_clk(clk); |
| 1608 | struct clk *pll = clk->parent; |
| 1609 | unsigned long source_rate, div; |
| 1610 | struct clk_freq_tbl *cur_freq = rcg->current_freq; |
| 1611 | int rc; |
| 1612 | |
| 1613 | if (rate == 0) |
| 1614 | return clk_set_rate(pll, 0); |
| 1615 | |
| 1616 | source_rate = clk_round_rate(pll, rate); |
| 1617 | if (!source_rate || ((2 * source_rate) % rate)) |
| 1618 | return -EINVAL; |
| 1619 | |
| 1620 | div = ((2 * source_rate)/rate) - 1; |
| 1621 | if (div > CFG_RCGR_DIV_MASK) |
| 1622 | return -EINVAL; |
| 1623 | |
| 1624 | rc = clk_set_rate(pll, source_rate); |
| 1625 | if (rc) |
| 1626 | return rc; |
| 1627 | |
| 1628 | cur_freq->div_src_val &= ~CFG_RCGR_DIV_MASK; |
| 1629 | cur_freq->div_src_val |= BVAL(4, 0, div); |
| 1630 | rcg->set_rate(rcg, cur_freq); |
| 1631 | |
| 1632 | return 0; |
| 1633 | } |
| 1634 | |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 1635 | static struct rcg_clk dsi_pclk_clk_src = { |
| 1636 | .cmd_rcgr_reg = DSI_PCLK_CMD_RCGR, |
| 1637 | .set_rate = set_rate_mnd, |
Vikram Mulukutla | e03b4b6 | 2013-03-20 17:45:37 -0700 | [diff] [blame] | 1638 | .current_freq = pixel_freq_tbl, |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 1639 | .base = &virt_bases[MMSS_BASE], |
| 1640 | .c = { |
Vikram Mulukutla | e03b4b6 | 2013-03-20 17:45:37 -0700 | [diff] [blame] | 1641 | .parent = &dsi_pll_pixel, |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 1642 | .dbg_name = "dsi_pclk_clk_src", |
Vikram Mulukutla | e03b4b6 | 2013-03-20 17:45:37 -0700 | [diff] [blame] | 1643 | .ops = &dsi_pixel_clk_src_ops, |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 1644 | VDD_DIG_FMAX_MAP2(LOW, 50000000, NOMINAL, 103330000), |
| 1645 | CLK_INIT(dsi_pclk_clk_src.c), |
| 1646 | }, |
| 1647 | }; |
| 1648 | |
| 1649 | static struct clk_freq_tbl ftbl_oxili_gfx3d_clk[] = { |
| 1650 | F_MM( 19200000, gcc_xo, 1, 0, 0), |
| 1651 | F_MM( 37500000, gpll0, 16, 0, 0), |
| 1652 | F_MM( 50000000, gpll0, 12, 0, 0), |
| 1653 | F_MM( 75000000, gpll0, 8, 0, 0), |
| 1654 | F_MM(100000000, gpll0, 6, 0, 0), |
| 1655 | F_MM(150000000, gpll0, 4, 0, 0), |
| 1656 | F_MM(200000000, gpll0, 3, 0, 0), |
| 1657 | F_MM(300000000, gpll0, 2, 0, 0), |
| 1658 | F_MM(400000000, mmpll1, 3, 0, 0), |
| 1659 | F_END, |
| 1660 | }; |
| 1661 | |
| 1662 | static struct rcg_clk gfx3d_clk_src = { |
| 1663 | .cmd_rcgr_reg = GFX3D_CMD_RCGR, |
| 1664 | .set_rate = set_rate_hid, |
| 1665 | .freq_tbl = ftbl_oxili_gfx3d_clk, |
| 1666 | .current_freq = &rcg_dummy_freq, |
| 1667 | .base = &virt_bases[MMSS_BASE], |
| 1668 | .c = { |
| 1669 | .dbg_name = "gfx3d_clk_src", |
| 1670 | .ops = &clk_ops_rcg, |
| 1671 | VDD_DIG_FMAX_MAP3(LOW, 150000000, NOMINAL, 300000000, HIGH, |
| 1672 | 400000000), |
| 1673 | CLK_INIT(gfx3d_clk_src.c), |
| 1674 | }, |
| 1675 | }; |
| 1676 | |
| 1677 | static struct clk_freq_tbl ftbl_vfe_clk[] = { |
| 1678 | F_MM( 37500000, gpll0, 16, 0, 0), |
| 1679 | F_MM( 50000000, gpll0, 12, 0, 0), |
| 1680 | F_MM( 60000000, gpll0, 10, 0, 0), |
| 1681 | F_MM( 80000000, gpll0, 7.5, 0, 0), |
| 1682 | F_MM(100000000, gpll0, 6, 0, 0), |
| 1683 | F_MM(109090000, gpll0, 5.5, 0, 0), |
| 1684 | F_MM(133330000, gpll0, 4.5, 0, 0), |
| 1685 | F_MM(200000000, gpll0, 3, 0, 0), |
| 1686 | F_MM(228570000, mmpll0, 3.5, 0, 0), |
| 1687 | F_MM(266670000, mmpll0, 3, 0, 0), |
| 1688 | F_MM(320000000, mmpll0, 2.5, 0, 0), |
| 1689 | F_END, |
| 1690 | }; |
| 1691 | |
| 1692 | static struct rcg_clk vfe_clk_src = { |
| 1693 | .cmd_rcgr_reg = VFE_CMD_RCGR, |
| 1694 | .set_rate = set_rate_hid, |
| 1695 | .freq_tbl = ftbl_vfe_clk, |
| 1696 | .current_freq = &rcg_dummy_freq, |
| 1697 | .base = &virt_bases[MMSS_BASE], |
| 1698 | .c = { |
| 1699 | .dbg_name = "vfe_clk_src", |
| 1700 | .ops = &clk_ops_rcg, |
| 1701 | VDD_DIG_FMAX_MAP3(LOW, 133330000, NOMINAL, 266670000, HIGH, |
| 1702 | 320000000), |
| 1703 | CLK_INIT(vfe_clk_src.c), |
| 1704 | }, |
| 1705 | }; |
| 1706 | |
| 1707 | static struct rcg_clk csi1_clk_src = { |
| 1708 | .cmd_rcgr_reg = CSI1_CMD_RCGR, |
| 1709 | .set_rate = set_rate_hid, |
| 1710 | .freq_tbl = ftbl_csi0_1_clk, |
| 1711 | .current_freq = &rcg_dummy_freq, |
| 1712 | .base = &virt_bases[MMSS_BASE], |
| 1713 | .c = { |
| 1714 | .dbg_name = "csi1_clk_src", |
| 1715 | .ops = &clk_ops_rcg, |
| 1716 | VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000), |
| 1717 | CLK_INIT(csi1_clk_src.c), |
| 1718 | }, |
| 1719 | }; |
| 1720 | |
| 1721 | static struct clk_freq_tbl ftbl_csi0_1phytimer_clk[] = { |
| 1722 | F_MM(100000000, gpll0, 6, 0, 0), |
| 1723 | F_MM(200000000, mmpll0, 4, 0, 0), |
| 1724 | F_END, |
| 1725 | }; |
| 1726 | |
| 1727 | static struct rcg_clk csi0phytimer_clk_src = { |
| 1728 | .cmd_rcgr_reg = CSI0PHYTIMER_CMD_RCGR, |
| 1729 | .set_rate = set_rate_hid, |
| 1730 | .freq_tbl = ftbl_csi0_1phytimer_clk, |
| 1731 | .current_freq = &rcg_dummy_freq, |
| 1732 | .base = &virt_bases[MMSS_BASE], |
| 1733 | .c = { |
| 1734 | .dbg_name = "csi0phytimer_clk_src", |
| 1735 | .ops = &clk_ops_rcg, |
| 1736 | VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000), |
| 1737 | CLK_INIT(csi0phytimer_clk_src.c), |
| 1738 | }, |
| 1739 | }; |
| 1740 | |
| 1741 | static struct rcg_clk csi1phytimer_clk_src = { |
| 1742 | .cmd_rcgr_reg = CSI1PHYTIMER_CMD_RCGR, |
| 1743 | .set_rate = set_rate_hid, |
| 1744 | .freq_tbl = ftbl_csi0_1phytimer_clk, |
| 1745 | .current_freq = &rcg_dummy_freq, |
| 1746 | .base = &virt_bases[MMSS_BASE], |
| 1747 | .c = { |
| 1748 | .dbg_name = "csi1phytimer_clk_src", |
| 1749 | .ops = &clk_ops_rcg, |
| 1750 | VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000), |
| 1751 | CLK_INIT(csi1phytimer_clk_src.c), |
| 1752 | }, |
| 1753 | }; |
| 1754 | |
Vikram Mulukutla | e03b4b6 | 2013-03-20 17:45:37 -0700 | [diff] [blame] | 1755 | /* |
| 1756 | * The DSI clock will always use a divider of 1. However, we still |
| 1757 | * need to set the right voltage and source. |
| 1758 | */ |
| 1759 | static int set_rate_dsi_clk(struct clk *clk, unsigned long rate) |
| 1760 | { |
| 1761 | struct rcg_clk *rcg = to_rcg_clk(clk); |
| 1762 | struct clk_freq_tbl *cur_freq = rcg->current_freq; |
| 1763 | |
| 1764 | rcg->set_rate(rcg, cur_freq); |
| 1765 | |
| 1766 | return 0; |
| 1767 | } |
| 1768 | |
| 1769 | static struct clk_freq_tbl dsi_freq_tbl[] = { |
| 1770 | { |
| 1771 | .src_clk = &dsi_pll_pixel, |
| 1772 | .div_src_val = BVAL(4, 0, 0) | |
| 1773 | BVAL(10, 8, dsipll_mm_source_val), |
| 1774 | }, |
| 1775 | F_END |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 1776 | }; |
| 1777 | |
| 1778 | static struct rcg_clk dsi_clk_src = { |
| 1779 | .cmd_rcgr_reg = DSI_CMD_RCGR, |
| 1780 | .set_rate = set_rate_mnd, |
Vikram Mulukutla | e03b4b6 | 2013-03-20 17:45:37 -0700 | [diff] [blame] | 1781 | .current_freq = dsi_freq_tbl, |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 1782 | .base = &virt_bases[MMSS_BASE], |
| 1783 | .c = { |
Vikram Mulukutla | e03b4b6 | 2013-03-20 17:45:37 -0700 | [diff] [blame] | 1784 | .parent = &dsi_pll_pixel, |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 1785 | .dbg_name = "dsi_clk_src", |
Vikram Mulukutla | e03b4b6 | 2013-03-20 17:45:37 -0700 | [diff] [blame] | 1786 | .ops = &dsi_dsi_clk_src_ops, |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 1787 | VDD_DIG_FMAX_MAP2(LOW, 155000000, NOMINAL, 310000000), |
| 1788 | CLK_INIT(dsi_clk_src.c), |
| 1789 | }, |
| 1790 | }; |
| 1791 | |
Vikram Mulukutla | e03b4b6 | 2013-03-20 17:45:37 -0700 | [diff] [blame] | 1792 | static struct clk_freq_tbl byte_freq_tbl[] = { |
| 1793 | { |
| 1794 | .src_clk = &dsi_pll_byte, |
| 1795 | .div_src_val = BVAL(10, 8, dsipll_mm_source_val), |
| 1796 | }, |
| 1797 | F_END |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 1798 | }; |
| 1799 | |
| 1800 | static struct rcg_clk dsi_byte_clk_src = { |
| 1801 | .cmd_rcgr_reg = DSI_BYTE_CMD_RCGR, |
| 1802 | .set_rate = set_rate_hid, |
Vikram Mulukutla | e03b4b6 | 2013-03-20 17:45:37 -0700 | [diff] [blame] | 1803 | .current_freq = byte_freq_tbl, |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 1804 | .base = &virt_bases[MMSS_BASE], |
| 1805 | .c = { |
Vikram Mulukutla | e03b4b6 | 2013-03-20 17:45:37 -0700 | [diff] [blame] | 1806 | .parent = &dsi_pll_byte, |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 1807 | .dbg_name = "dsi_byte_clk_src", |
Vikram Mulukutla | e03b4b6 | 2013-03-20 17:45:37 -0700 | [diff] [blame] | 1808 | .ops = &dsi_byte_clk_src_ops, |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 1809 | VDD_DIG_FMAX_MAP2(LOW, 62500000, NOMINAL, 125000000), |
| 1810 | CLK_INIT(dsi_byte_clk_src.c), |
| 1811 | }, |
| 1812 | }; |
| 1813 | |
| 1814 | static struct clk_freq_tbl ftbl_dsi_esc_clk[] = { |
| 1815 | F_MM(19200000, gcc_xo, 1, 0, 0), |
| 1816 | F_END, |
| 1817 | }; |
| 1818 | |
| 1819 | static struct rcg_clk dsi_esc_clk_src = { |
| 1820 | .cmd_rcgr_reg = DSI_ESC_CMD_RCGR, |
| 1821 | .set_rate = set_rate_hid, |
| 1822 | .freq_tbl = ftbl_dsi_esc_clk, |
| 1823 | .current_freq = &rcg_dummy_freq, |
| 1824 | .base = &virt_bases[MMSS_BASE], |
| 1825 | .c = { |
| 1826 | .dbg_name = "dsi_esc_clk_src", |
| 1827 | .ops = &clk_ops_rcg, |
| 1828 | VDD_DIG_FMAX_MAP1(LOW, 19200000), |
| 1829 | CLK_INIT(dsi_esc_clk_src.c), |
| 1830 | }, |
| 1831 | }; |
| 1832 | |
| 1833 | static struct clk_freq_tbl ftbl_mclk0_1_clk[] = { |
| 1834 | F_MM(66670000, gpll0, 9, 0, 0), |
| 1835 | F_END, |
| 1836 | }; |
| 1837 | |
| 1838 | static struct rcg_clk mclk0_clk_src = { |
| 1839 | .cmd_rcgr_reg = MCLK0_CMD_RCGR, |
| 1840 | .set_rate = set_rate_mnd, |
| 1841 | .freq_tbl = ftbl_mclk0_1_clk, |
| 1842 | .current_freq = &rcg_dummy_freq, |
| 1843 | .base = &virt_bases[MMSS_BASE], |
| 1844 | .c = { |
| 1845 | .dbg_name = "mclk0_clk_src", |
| 1846 | .ops = &clk_ops_rcg_mnd, |
| 1847 | VDD_DIG_FMAX_MAP1(LOW, 66670000), |
| 1848 | CLK_INIT(mclk0_clk_src.c), |
| 1849 | }, |
| 1850 | }; |
| 1851 | |
| 1852 | static struct rcg_clk mclk1_clk_src = { |
| 1853 | .cmd_rcgr_reg = MCLK1_CMD_RCGR, |
| 1854 | .set_rate = set_rate_mnd, |
| 1855 | .freq_tbl = ftbl_mclk0_1_clk, |
| 1856 | .current_freq = &rcg_dummy_freq, |
| 1857 | .base = &virt_bases[MMSS_BASE], |
| 1858 | .c = { |
| 1859 | .dbg_name = "mclk1_clk_src", |
| 1860 | .ops = &clk_ops_rcg_mnd, |
| 1861 | VDD_DIG_FMAX_MAP1(LOW, 66670000), |
| 1862 | CLK_INIT(mclk1_clk_src.c), |
| 1863 | }, |
| 1864 | }; |
| 1865 | |
| 1866 | static struct clk_freq_tbl ftbl_mdp_vsync_clk[] = { |
| 1867 | F_MM(19200000, gcc_xo, 1, 0, 0), |
| 1868 | F_END, |
| 1869 | }; |
| 1870 | |
| 1871 | static struct rcg_clk mdp_vsync_clk_src = { |
| 1872 | .cmd_rcgr_reg = MDP_VSYNC_CMD_RCGR, |
| 1873 | .set_rate = set_rate_hid, |
| 1874 | .freq_tbl = ftbl_mdp_vsync_clk, |
| 1875 | .current_freq = &rcg_dummy_freq, |
| 1876 | .base = &virt_bases[MMSS_BASE], |
| 1877 | .c = { |
| 1878 | .dbg_name = "mdp_vsync_clk_src", |
| 1879 | .ops = &clk_ops_rcg, |
| 1880 | VDD_DIG_FMAX_MAP1(LOW, 19200000), |
| 1881 | CLK_INIT(mdp_vsync_clk_src.c), |
| 1882 | }, |
| 1883 | }; |
| 1884 | |
| 1885 | static struct branch_clk bimc_gfx_clk = { |
| 1886 | .cbcr_reg = BIMC_GFX_CBCR, |
| 1887 | .has_sibling = 1, |
| 1888 | .base = &virt_bases[MMSS_BASE], |
Vikram Mulukutla | 2dfa8b1 | 2013-01-15 18:17:10 -0800 | [diff] [blame] | 1889 | /* FIXME: Remove this once simulation is fixed. */ |
| 1890 | .halt_check = DELAY, |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 1891 | .c = { |
| 1892 | .dbg_name = "bimc_gfx_clk", |
| 1893 | .ops = &clk_ops_branch, |
| 1894 | CLK_INIT(bimc_gfx_clk.c), |
Vikram Mulukutla | 55318acb | 2013-04-15 17:47:34 -0700 | [diff] [blame] | 1895 | /* FIXME: Remove once kgsl votes on the depends clock. */ |
| 1896 | .depends = &gcc_bimc_smmu_clk.c, |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 1897 | }, |
| 1898 | }; |
| 1899 | |
| 1900 | static struct branch_clk csi0_clk = { |
| 1901 | .cbcr_reg = CSI0_CBCR, |
| 1902 | .has_sibling = 1, |
| 1903 | .base = &virt_bases[MMSS_BASE], |
| 1904 | .c = { |
| 1905 | .parent = &csi0_clk_src.c, |
| 1906 | .dbg_name = "csi0_clk", |
| 1907 | .ops = &clk_ops_branch, |
| 1908 | CLK_INIT(csi0_clk.c), |
| 1909 | }, |
| 1910 | }; |
| 1911 | |
| 1912 | static struct branch_clk csi0phy_clk = { |
| 1913 | .cbcr_reg = CSI0PHY_CBCR, |
| 1914 | .has_sibling = 1, |
| 1915 | .base = &virt_bases[MMSS_BASE], |
| 1916 | .c = { |
| 1917 | .parent = &csi0_clk_src.c, |
| 1918 | .dbg_name = "csi0phy_clk", |
| 1919 | .ops = &clk_ops_branch, |
| 1920 | CLK_INIT(csi0phy_clk.c), |
| 1921 | }, |
| 1922 | }; |
| 1923 | |
| 1924 | static struct branch_clk csi0phytimer_clk = { |
| 1925 | .cbcr_reg = CSI0PHYTIMER_CBCR, |
| 1926 | .has_sibling = 0, |
| 1927 | .base = &virt_bases[MMSS_BASE], |
| 1928 | .c = { |
| 1929 | .parent = &csi0phytimer_clk_src.c, |
| 1930 | .dbg_name = "csi0phytimer_clk", |
| 1931 | .ops = &clk_ops_branch, |
| 1932 | CLK_INIT(csi0phytimer_clk.c), |
| 1933 | }, |
| 1934 | }; |
| 1935 | |
| 1936 | static struct branch_clk csi0pix_clk = { |
| 1937 | .cbcr_reg = CSI0PIX_CBCR, |
| 1938 | .has_sibling = 1, |
| 1939 | .base = &virt_bases[MMSS_BASE], |
| 1940 | .c = { |
| 1941 | .parent = &csi0_clk_src.c, |
| 1942 | .dbg_name = "csi0pix_clk", |
| 1943 | .ops = &clk_ops_branch, |
| 1944 | CLK_INIT(csi0pix_clk.c), |
| 1945 | }, |
| 1946 | }; |
| 1947 | |
| 1948 | static struct branch_clk csi0rdi_clk = { |
| 1949 | .cbcr_reg = CSI0RDI_CBCR, |
| 1950 | .has_sibling = 1, |
| 1951 | .base = &virt_bases[MMSS_BASE], |
| 1952 | .c = { |
| 1953 | .parent = &csi0_clk_src.c, |
| 1954 | .dbg_name = "csi0rdi_clk", |
| 1955 | .ops = &clk_ops_branch, |
| 1956 | CLK_INIT(csi0rdi_clk.c), |
| 1957 | }, |
| 1958 | }; |
| 1959 | |
| 1960 | static struct branch_clk csi1_clk = { |
| 1961 | .cbcr_reg = CSI1_CBCR, |
| 1962 | .has_sibling = 1, |
| 1963 | .base = &virt_bases[MMSS_BASE], |
| 1964 | .c = { |
| 1965 | .parent = &csi1_clk_src.c, |
| 1966 | .dbg_name = "csi1_clk", |
| 1967 | .ops = &clk_ops_branch, |
| 1968 | CLK_INIT(csi1_clk.c), |
| 1969 | }, |
| 1970 | }; |
| 1971 | |
| 1972 | static struct branch_clk csi1phy_clk = { |
| 1973 | .cbcr_reg = CSI1PHY_CBCR, |
| 1974 | .has_sibling = 1, |
| 1975 | .base = &virt_bases[MMSS_BASE], |
| 1976 | .c = { |
| 1977 | .parent = &csi1_clk_src.c, |
| 1978 | .dbg_name = "csi1phy_clk", |
| 1979 | .ops = &clk_ops_branch, |
| 1980 | CLK_INIT(csi1phy_clk.c), |
| 1981 | }, |
| 1982 | }; |
| 1983 | |
| 1984 | static struct branch_clk csi1phytimer_clk = { |
| 1985 | .cbcr_reg = CSI1PHYTIMER_CBCR, |
| 1986 | .has_sibling = 0, |
| 1987 | .base = &virt_bases[MMSS_BASE], |
| 1988 | .c = { |
| 1989 | .parent = &csi1phytimer_clk_src.c, |
| 1990 | .dbg_name = "csi1phytimer_clk", |
| 1991 | .ops = &clk_ops_branch, |
| 1992 | CLK_INIT(csi1phytimer_clk.c), |
| 1993 | }, |
| 1994 | }; |
| 1995 | |
| 1996 | static struct branch_clk csi1pix_clk = { |
| 1997 | .cbcr_reg = CSI1PIX_CBCR, |
| 1998 | .has_sibling = 1, |
| 1999 | .base = &virt_bases[MMSS_BASE], |
| 2000 | .c = { |
Vikram Mulukutla | a1d5c14 | 2013-01-16 10:30:12 -0800 | [diff] [blame] | 2001 | .parent = &csi1_clk_src.c, |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 2002 | .dbg_name = "csi1pix_clk", |
| 2003 | .ops = &clk_ops_branch, |
| 2004 | CLK_INIT(csi1pix_clk.c), |
| 2005 | }, |
| 2006 | }; |
| 2007 | |
| 2008 | static struct branch_clk csi1rdi_clk = { |
| 2009 | .cbcr_reg = CSI1RDI_CBCR, |
| 2010 | .has_sibling = 1, |
| 2011 | .base = &virt_bases[MMSS_BASE], |
| 2012 | .c = { |
Vikram Mulukutla | a1d5c14 | 2013-01-16 10:30:12 -0800 | [diff] [blame] | 2013 | .parent = &csi1_clk_src.c, |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 2014 | .dbg_name = "csi1rdi_clk", |
| 2015 | .ops = &clk_ops_branch, |
| 2016 | CLK_INIT(csi1rdi_clk.c), |
| 2017 | }, |
| 2018 | }; |
| 2019 | |
Vikram Mulukutla | 4942339 | 2013-05-02 09:03:02 -0700 | [diff] [blame] | 2020 | static struct cam_mux_clk csi0phy_cam_mux_clk = { |
Vikram Mulukutla | 8964a38 | 2013-04-10 14:30:50 -0700 | [diff] [blame] | 2021 | .enable_reg = MMSS_CAMSS_MISC, |
| 2022 | .enable_mask = BIT(11), |
| 2023 | .select_reg = MMSS_CAMSS_MISC, |
| 2024 | .select_mask = BIT(9), |
| 2025 | .sources = (struct mux_source[]) { |
| 2026 | { &csi0phy_clk.c, 0 }, |
| 2027 | { &csi1phy_clk.c, BIT(9) }, |
| 2028 | { 0 }, |
| 2029 | }, |
| 2030 | .base = &virt_bases[MMSS_BASE], |
| 2031 | .c = { |
Vikram Mulukutla | 4942339 | 2013-05-02 09:03:02 -0700 | [diff] [blame] | 2032 | .dbg_name = "csi0phy_cam_mux_clk", |
| 2033 | .ops = &clk_ops_cam_mux, |
| 2034 | CLK_INIT(csi0phy_cam_mux_clk.c), |
Vikram Mulukutla | 8964a38 | 2013-04-10 14:30:50 -0700 | [diff] [blame] | 2035 | }, |
| 2036 | }; |
| 2037 | |
Vikram Mulukutla | 4942339 | 2013-05-02 09:03:02 -0700 | [diff] [blame] | 2038 | static struct cam_mux_clk csi1phy_cam_mux_clk = { |
Vikram Mulukutla | 8964a38 | 2013-04-10 14:30:50 -0700 | [diff] [blame] | 2039 | .enable_reg = MMSS_CAMSS_MISC, |
| 2040 | .enable_mask = BIT(10), |
| 2041 | .select_reg = MMSS_CAMSS_MISC, |
| 2042 | .select_mask = BIT(8), |
| 2043 | .sources = (struct mux_source[]) { |
| 2044 | { &csi0phy_clk.c, 0 }, |
| 2045 | { &csi1phy_clk.c, BIT(8) }, |
| 2046 | { 0 }, |
| 2047 | }, |
| 2048 | .base = &virt_bases[MMSS_BASE], |
| 2049 | .c = { |
Vikram Mulukutla | 4942339 | 2013-05-02 09:03:02 -0700 | [diff] [blame] | 2050 | .dbg_name = "csi1phy_cam_mux_clk", |
| 2051 | .ops = &clk_ops_cam_mux, |
| 2052 | CLK_INIT(csi1phy_cam_mux_clk.c), |
Vikram Mulukutla | 8964a38 | 2013-04-10 14:30:50 -0700 | [diff] [blame] | 2053 | }, |
| 2054 | }; |
| 2055 | |
Vikram Mulukutla | 4942339 | 2013-05-02 09:03:02 -0700 | [diff] [blame] | 2056 | static struct cam_mux_clk csi0pix_cam_mux_clk = { |
Vikram Mulukutla | 8964a38 | 2013-04-10 14:30:50 -0700 | [diff] [blame] | 2057 | .enable_reg = MMSS_CAMSS_MISC, |
| 2058 | .enable_mask = BIT(7), |
| 2059 | .select_reg = MMSS_CAMSS_MISC, |
| 2060 | .select_mask = BIT(3), |
| 2061 | .sources = (struct mux_source[]) { |
| 2062 | { &csi0pix_clk.c, 0 }, |
| 2063 | { &csi1pix_clk.c, BIT(3) }, |
| 2064 | { 0 }, |
| 2065 | }, |
| 2066 | .base = &virt_bases[MMSS_BASE], |
| 2067 | .c = { |
Vikram Mulukutla | 4942339 | 2013-05-02 09:03:02 -0700 | [diff] [blame] | 2068 | .dbg_name = "csi0pix_cam_mux_clk", |
| 2069 | .ops = &clk_ops_cam_mux, |
| 2070 | CLK_INIT(csi0pix_cam_mux_clk.c), |
Vikram Mulukutla | 8964a38 | 2013-04-10 14:30:50 -0700 | [diff] [blame] | 2071 | }, |
| 2072 | }; |
| 2073 | |
| 2074 | |
Vikram Mulukutla | 4942339 | 2013-05-02 09:03:02 -0700 | [diff] [blame] | 2075 | static struct cam_mux_clk rdi2_cam_mux_clk = { |
Vikram Mulukutla | 8964a38 | 2013-04-10 14:30:50 -0700 | [diff] [blame] | 2076 | .enable_reg = MMSS_CAMSS_MISC, |
| 2077 | .enable_mask = BIT(6), |
| 2078 | .select_reg = MMSS_CAMSS_MISC, |
| 2079 | .select_mask = BIT(2), |
| 2080 | .sources = (struct mux_source[]) { |
| 2081 | { &csi0rdi_clk.c, 0 }, |
| 2082 | { &csi1rdi_clk.c, BIT(2) }, |
| 2083 | { 0 }, |
| 2084 | }, |
| 2085 | .base = &virt_bases[MMSS_BASE], |
| 2086 | .c = { |
Vikram Mulukutla | 4942339 | 2013-05-02 09:03:02 -0700 | [diff] [blame] | 2087 | .dbg_name = "rdi2_cam_mux_clk", |
| 2088 | .ops = &clk_ops_cam_mux, |
| 2089 | CLK_INIT(rdi2_cam_mux_clk.c), |
Vikram Mulukutla | 8964a38 | 2013-04-10 14:30:50 -0700 | [diff] [blame] | 2090 | }, |
| 2091 | }; |
| 2092 | |
Vikram Mulukutla | 4942339 | 2013-05-02 09:03:02 -0700 | [diff] [blame] | 2093 | static struct cam_mux_clk rdi1_cam_mux_clk = { |
Vikram Mulukutla | 8964a38 | 2013-04-10 14:30:50 -0700 | [diff] [blame] | 2094 | .enable_reg = MMSS_CAMSS_MISC, |
| 2095 | .enable_mask = BIT(5), |
| 2096 | .select_reg = MMSS_CAMSS_MISC, |
| 2097 | .select_mask = BIT(1), |
| 2098 | .sources = (struct mux_source[]) { |
| 2099 | { &csi0rdi_clk.c, 0 }, |
| 2100 | { &csi1rdi_clk.c, BIT(1) }, |
| 2101 | { 0 }, |
| 2102 | }, |
| 2103 | .base = &virt_bases[MMSS_BASE], |
| 2104 | .c = { |
Vikram Mulukutla | 4942339 | 2013-05-02 09:03:02 -0700 | [diff] [blame] | 2105 | .dbg_name = "rdi1_cam_mux_clk", |
| 2106 | .ops = &clk_ops_cam_mux, |
| 2107 | CLK_INIT(rdi1_cam_mux_clk.c), |
Vikram Mulukutla | 8964a38 | 2013-04-10 14:30:50 -0700 | [diff] [blame] | 2108 | }, |
| 2109 | }; |
| 2110 | |
Vikram Mulukutla | 4942339 | 2013-05-02 09:03:02 -0700 | [diff] [blame] | 2111 | static struct cam_mux_clk rdi0_cam_mux_clk = { |
Vikram Mulukutla | 8964a38 | 2013-04-10 14:30:50 -0700 | [diff] [blame] | 2112 | .enable_reg = MMSS_CAMSS_MISC, |
| 2113 | .enable_mask = BIT(4), |
| 2114 | .select_reg = MMSS_CAMSS_MISC, |
| 2115 | .select_mask = BIT(0), |
| 2116 | .sources = (struct mux_source[]) { |
| 2117 | { &csi0rdi_clk.c, 0 }, |
| 2118 | { &csi1rdi_clk.c, BIT(0) }, |
| 2119 | { 0 }, |
| 2120 | }, |
| 2121 | .base = &virt_bases[MMSS_BASE], |
| 2122 | .c = { |
Vikram Mulukutla | 4942339 | 2013-05-02 09:03:02 -0700 | [diff] [blame] | 2123 | .dbg_name = "rdi0_cam_mux_clk", |
| 2124 | .ops = &clk_ops_cam_mux, |
| 2125 | CLK_INIT(rdi0_cam_mux_clk.c), |
Vikram Mulukutla | 8964a38 | 2013-04-10 14:30:50 -0700 | [diff] [blame] | 2126 | }, |
| 2127 | }; |
| 2128 | |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 2129 | static struct branch_clk csi_ahb_clk = { |
| 2130 | .cbcr_reg = CSI_AHB_CBCR, |
| 2131 | .has_sibling = 1, |
| 2132 | .base = &virt_bases[MMSS_BASE], |
| 2133 | .c = { |
| 2134 | .dbg_name = "csi_ahb_clk", |
| 2135 | .ops = &clk_ops_branch, |
| 2136 | CLK_INIT(csi_ahb_clk.c), |
| 2137 | }, |
| 2138 | }; |
| 2139 | |
| 2140 | static struct branch_clk csi_vfe_clk = { |
| 2141 | .cbcr_reg = CSI_VFE_CBCR, |
| 2142 | .has_sibling = 1, |
| 2143 | .base = &virt_bases[MMSS_BASE], |
| 2144 | .c = { |
| 2145 | .parent = &vfe_clk_src.c, |
| 2146 | .dbg_name = "csi_vfe_clk", |
| 2147 | .ops = &clk_ops_branch, |
| 2148 | CLK_INIT(csi_vfe_clk.c), |
| 2149 | }, |
| 2150 | }; |
| 2151 | |
| 2152 | static struct branch_clk dsi_clk = { |
| 2153 | .cbcr_reg = DSI_CBCR, |
| 2154 | .has_sibling = 0, |
| 2155 | .base = &virt_bases[MMSS_BASE], |
| 2156 | .c = { |
| 2157 | .parent = &dsi_clk_src.c, |
| 2158 | .dbg_name = "dsi_clk", |
| 2159 | .ops = &clk_ops_branch, |
| 2160 | CLK_INIT(dsi_clk.c), |
| 2161 | }, |
| 2162 | }; |
| 2163 | |
| 2164 | static struct branch_clk dsi_ahb_clk = { |
| 2165 | .cbcr_reg = DSI_AHB_CBCR, |
| 2166 | .has_sibling = 1, |
| 2167 | .base = &virt_bases[MMSS_BASE], |
| 2168 | .c = { |
| 2169 | .dbg_name = "dsi_ahb_clk", |
| 2170 | .ops = &clk_ops_branch, |
| 2171 | CLK_INIT(dsi_ahb_clk.c), |
| 2172 | }, |
| 2173 | }; |
| 2174 | |
| 2175 | static struct branch_clk dsi_byte_clk = { |
| 2176 | .cbcr_reg = DSI_BYTE_CBCR, |
| 2177 | .has_sibling = 0, |
| 2178 | .base = &virt_bases[MMSS_BASE], |
| 2179 | .c = { |
| 2180 | .parent = &dsi_byte_clk_src.c, |
| 2181 | .dbg_name = "dsi_byte_clk", |
| 2182 | .ops = &clk_ops_branch, |
| 2183 | CLK_INIT(dsi_byte_clk.c), |
| 2184 | }, |
| 2185 | }; |
| 2186 | |
| 2187 | static struct branch_clk dsi_esc_clk = { |
| 2188 | .cbcr_reg = DSI_ESC_CBCR, |
| 2189 | .has_sibling = 0, |
| 2190 | .base = &virt_bases[MMSS_BASE], |
| 2191 | .c = { |
| 2192 | .parent = &dsi_esc_clk_src.c, |
| 2193 | .dbg_name = "dsi_esc_clk", |
| 2194 | .ops = &clk_ops_branch, |
| 2195 | CLK_INIT(dsi_esc_clk.c), |
| 2196 | }, |
| 2197 | }; |
| 2198 | |
| 2199 | static struct branch_clk dsi_pclk_clk = { |
| 2200 | .cbcr_reg = DSI_PCLK_CBCR, |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 2201 | .base = &virt_bases[MMSS_BASE], |
| 2202 | .c = { |
| 2203 | .parent = &dsi_pclk_clk_src.c, |
| 2204 | .dbg_name = "dsi_pclk_clk", |
| 2205 | .ops = &clk_ops_branch, |
| 2206 | CLK_INIT(dsi_pclk_clk.c), |
| 2207 | }, |
| 2208 | }; |
| 2209 | |
| 2210 | static struct branch_clk gmem_gfx3d_clk = { |
| 2211 | .cbcr_reg = GMEM_GFX3D_CBCR, |
| 2212 | .has_sibling = 1, |
| 2213 | .base = &virt_bases[MMSS_BASE], |
| 2214 | .c = { |
| 2215 | .parent = &gfx3d_clk_src.c, |
| 2216 | .dbg_name = "gmem_gfx3d_clk", |
| 2217 | .ops = &clk_ops_branch, |
| 2218 | CLK_INIT(gmem_gfx3d_clk.c), |
| 2219 | }, |
| 2220 | }; |
| 2221 | |
| 2222 | static struct branch_clk mclk0_clk = { |
| 2223 | .cbcr_reg = MCLK0_CBCR, |
| 2224 | .has_sibling = 0, |
| 2225 | .base = &virt_bases[MMSS_BASE], |
| 2226 | .c = { |
| 2227 | .parent = &mclk0_clk_src.c, |
| 2228 | .dbg_name = "mclk0_clk", |
| 2229 | .ops = &clk_ops_branch, |
| 2230 | CLK_INIT(mclk0_clk.c), |
| 2231 | }, |
| 2232 | }; |
| 2233 | |
| 2234 | static struct branch_clk mclk1_clk = { |
| 2235 | .cbcr_reg = MCLK1_CBCR, |
| 2236 | .has_sibling = 0, |
| 2237 | .base = &virt_bases[MMSS_BASE], |
| 2238 | .c = { |
| 2239 | .parent = &mclk1_clk_src.c, |
| 2240 | .dbg_name = "mclk1_clk", |
| 2241 | .ops = &clk_ops_branch, |
| 2242 | CLK_INIT(mclk1_clk.c), |
| 2243 | }, |
| 2244 | }; |
| 2245 | |
| 2246 | static struct branch_clk mdp_ahb_clk = { |
| 2247 | .cbcr_reg = MDP_AHB_CBCR, |
| 2248 | .has_sibling = 1, |
| 2249 | .base = &virt_bases[MMSS_BASE], |
| 2250 | .c = { |
| 2251 | .dbg_name = "mdp_ahb_clk", |
| 2252 | .ops = &clk_ops_branch, |
| 2253 | CLK_INIT(mdp_ahb_clk.c), |
| 2254 | }, |
| 2255 | }; |
| 2256 | |
| 2257 | static struct branch_clk mdp_axi_clk = { |
| 2258 | .cbcr_reg = MDP_AXI_CBCR, |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 2259 | .base = &virt_bases[MMSS_BASE], |
Vikram Mulukutla | 2dfa8b1 | 2013-01-15 18:17:10 -0800 | [diff] [blame] | 2260 | /* FIXME: Remove this once simulation is fixed. */ |
| 2261 | .halt_check = DELAY, |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 2262 | .c = { |
Vikram Mulukutla | e1e5c48 | 2013-01-28 14:43:20 -0800 | [diff] [blame] | 2263 | .parent = &mdp_axi_clk_src.c, |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 2264 | .dbg_name = "mdp_axi_clk", |
| 2265 | .ops = &clk_ops_branch, |
| 2266 | CLK_INIT(mdp_axi_clk.c), |
| 2267 | }, |
| 2268 | }; |
| 2269 | |
| 2270 | static struct branch_clk mdp_dsi_clk = { |
| 2271 | .cbcr_reg = MDP_DSI_CBCR, |
| 2272 | .has_sibling = 1, |
| 2273 | .base = &virt_bases[MMSS_BASE], |
| 2274 | .c = { |
| 2275 | .parent = &dsi_pclk_clk_src.c, |
| 2276 | .dbg_name = "mdp_dsi_clk", |
| 2277 | .ops = &clk_ops_branch, |
| 2278 | CLK_INIT(mdp_dsi_clk.c), |
| 2279 | }, |
| 2280 | }; |
| 2281 | |
| 2282 | static struct branch_clk mdp_lcdc_clk = { |
| 2283 | .cbcr_reg = MDP_LCDC_CBCR, |
| 2284 | .has_sibling = 1, |
| 2285 | .base = &virt_bases[MMSS_BASE], |
| 2286 | .c = { |
| 2287 | .parent = &dsi_pclk_clk_src.c, |
| 2288 | .dbg_name = "mdp_lcdc_clk", |
| 2289 | .ops = &clk_ops_branch, |
| 2290 | CLK_INIT(mdp_lcdc_clk.c), |
| 2291 | }, |
| 2292 | }; |
| 2293 | |
| 2294 | static struct branch_clk mdp_vsync_clk = { |
| 2295 | .cbcr_reg = MDP_VSYNC_CBCR, |
| 2296 | .has_sibling = 0, |
| 2297 | .base = &virt_bases[MMSS_BASE], |
| 2298 | .c = { |
| 2299 | .parent = &mdp_vsync_clk_src.c, |
| 2300 | .dbg_name = "mdp_vsync_clk", |
| 2301 | .ops = &clk_ops_branch, |
| 2302 | CLK_INIT(mdp_vsync_clk.c), |
| 2303 | }, |
| 2304 | }; |
| 2305 | |
| 2306 | static struct branch_clk mmss_misc_ahb_clk = { |
| 2307 | .cbcr_reg = MMSS_MISC_AHB_CBCR, |
| 2308 | .has_sibling = 1, |
| 2309 | .base = &virt_bases[MMSS_BASE], |
| 2310 | .c = { |
| 2311 | .dbg_name = "mmss_misc_ahb_clk", |
| 2312 | .ops = &clk_ops_branch, |
| 2313 | CLK_INIT(mmss_misc_ahb_clk.c), |
| 2314 | }, |
| 2315 | }; |
| 2316 | |
| 2317 | static struct branch_clk mmss_mmssnoc_axi_clk = { |
| 2318 | .cbcr_reg = MMSS_MMSSNOC_AXI_CBCR, |
| 2319 | .has_sibling = 1, |
| 2320 | .base = &virt_bases[MMSS_BASE], |
| 2321 | .c = { |
| 2322 | .parent = &axi_clk_src.c, |
| 2323 | .dbg_name = "mmss_mmssnoc_axi_clk", |
| 2324 | .ops = &clk_ops_branch, |
| 2325 | CLK_INIT(mmss_mmssnoc_axi_clk.c), |
| 2326 | }, |
| 2327 | }; |
| 2328 | |
| 2329 | static struct branch_clk mmss_s0_axi_clk = { |
| 2330 | .cbcr_reg = MMSS_S0_AXI_CBCR, |
| 2331 | .has_sibling = 0, |
| 2332 | .base = &virt_bases[MMSS_BASE], |
| 2333 | .c = { |
Vikram Mulukutla | e1e5c48 | 2013-01-28 14:43:20 -0800 | [diff] [blame] | 2334 | .parent = &mmssnoc_axi_clk_src.c, |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 2335 | .dbg_name = "mmss_s0_axi_clk", |
| 2336 | .ops = &clk_ops_branch, |
| 2337 | CLK_INIT(mmss_s0_axi_clk.c), |
| 2338 | .depends = &mmss_mmssnoc_axi_clk.c, |
| 2339 | }, |
| 2340 | }; |
| 2341 | |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 2342 | static struct branch_clk mmss_mmssnoc_bto_ahb_clk = { |
| 2343 | .cbcr_reg = MMSS_MMSSNOC_BTO_AHB_CBCR, |
| 2344 | .has_sibling = 1, |
| 2345 | .base = &virt_bases[MMSS_BASE], |
| 2346 | .c = { |
| 2347 | .dbg_name = "mmss_mmssnoc_bto_ahb_clk", |
| 2348 | .ops = &clk_ops_branch, |
| 2349 | CLK_INIT(mmss_mmssnoc_bto_ahb_clk.c), |
| 2350 | }, |
| 2351 | }; |
| 2352 | |
| 2353 | static struct branch_clk oxili_ahb_clk = { |
| 2354 | .cbcr_reg = OXILI_AHB_CBCR, |
| 2355 | .has_sibling = 1, |
| 2356 | .base = &virt_bases[MMSS_BASE], |
| 2357 | .c = { |
| 2358 | .dbg_name = "oxili_ahb_clk", |
| 2359 | .ops = &clk_ops_branch, |
| 2360 | CLK_INIT(oxili_ahb_clk.c), |
| 2361 | }, |
| 2362 | }; |
| 2363 | |
| 2364 | static struct branch_clk oxili_gfx3d_clk = { |
| 2365 | .cbcr_reg = OXILI_GFX3D_CBCR, |
| 2366 | .has_sibling = 0, |
| 2367 | .base = &virt_bases[MMSS_BASE], |
| 2368 | .c = { |
| 2369 | .parent = &gfx3d_clk_src.c, |
| 2370 | .dbg_name = "oxili_gfx3d_clk", |
| 2371 | .ops = &clk_ops_branch, |
| 2372 | CLK_INIT(oxili_gfx3d_clk.c), |
| 2373 | }, |
| 2374 | }; |
| 2375 | |
| 2376 | static struct branch_clk vfe_clk = { |
| 2377 | .cbcr_reg = VFE_CBCR, |
| 2378 | .has_sibling = 1, |
| 2379 | .base = &virt_bases[MMSS_BASE], |
| 2380 | .c = { |
| 2381 | .parent = &vfe_clk_src.c, |
| 2382 | .dbg_name = "vfe_clk", |
| 2383 | .ops = &clk_ops_branch, |
| 2384 | CLK_INIT(vfe_clk.c), |
| 2385 | }, |
| 2386 | }; |
| 2387 | |
| 2388 | static struct branch_clk vfe_ahb_clk = { |
| 2389 | .cbcr_reg = VFE_AHB_CBCR, |
| 2390 | .has_sibling = 1, |
| 2391 | .base = &virt_bases[MMSS_BASE], |
| 2392 | .c = { |
| 2393 | .dbg_name = "vfe_ahb_clk", |
| 2394 | .ops = &clk_ops_branch, |
| 2395 | CLK_INIT(vfe_ahb_clk.c), |
| 2396 | }, |
| 2397 | }; |
| 2398 | |
| 2399 | static struct branch_clk vfe_axi_clk = { |
| 2400 | .cbcr_reg = VFE_AXI_CBCR, |
| 2401 | .has_sibling = 1, |
| 2402 | .base = &virt_bases[MMSS_BASE], |
Vikram Mulukutla | 2dfa8b1 | 2013-01-15 18:17:10 -0800 | [diff] [blame] | 2403 | /* FIXME: Remove this once simulation is fixed. */ |
| 2404 | .halt_check = DELAY, |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 2405 | .c = { |
| 2406 | .parent = &axi_clk_src.c, |
| 2407 | .dbg_name = "vfe_axi_clk", |
| 2408 | .ops = &clk_ops_branch, |
| 2409 | CLK_INIT(vfe_axi_clk.c), |
| 2410 | }, |
| 2411 | }; |
| 2412 | |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 2413 | static struct branch_clk q6ss_ahb_lfabif_clk = { |
| 2414 | .cbcr_reg = Q6SS_AHB_LFABIF_CBCR, |
| 2415 | .has_sibling = 1, |
| 2416 | .base = &virt_bases[LPASS_BASE], |
| 2417 | .c = { |
| 2418 | .dbg_name = "q6ss_ahb_lfabif_clk", |
| 2419 | .ops = &clk_ops_branch, |
| 2420 | CLK_INIT(q6ss_ahb_lfabif_clk.c), |
| 2421 | }, |
| 2422 | }; |
| 2423 | |
| 2424 | static struct branch_clk q6ss_ahbm_clk = { |
| 2425 | .cbcr_reg = Q6SS_AHBM_CBCR, |
| 2426 | .has_sibling = 1, |
| 2427 | .base = &virt_bases[LPASS_BASE], |
| 2428 | .c = { |
| 2429 | .dbg_name = "q6ss_ahbm_clk", |
| 2430 | .ops = &clk_ops_branch, |
| 2431 | CLK_INIT(q6ss_ahbm_clk.c), |
| 2432 | }, |
| 2433 | }; |
| 2434 | |
| 2435 | static struct branch_clk q6ss_xo_clk = { |
| 2436 | .cbcr_reg = Q6SS_XO_CBCR, |
| 2437 | .has_sibling = 1, |
| 2438 | .bcr_reg = LPASS_Q6SS_BCR, |
| 2439 | .base = &virt_bases[LPASS_BASE], |
| 2440 | .c = { |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 2441 | .dbg_name = "q6ss_xo_clk", |
| 2442 | .ops = &clk_ops_branch, |
| 2443 | CLK_INIT(q6ss_xo_clk.c), |
| 2444 | }, |
| 2445 | }; |
| 2446 | |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 2447 | #ifdef CONFIG_DEBUG_FS |
| 2448 | |
| 2449 | struct measure_mux_entry { |
| 2450 | struct clk *c; |
| 2451 | int base; |
| 2452 | u32 debug_mux; |
| 2453 | }; |
| 2454 | |
| 2455 | static struct measure_mux_entry measure_mux[] = { |
| 2456 | { &snoc_clk.c, GCC_BASE, 0x0000}, |
| 2457 | { &cnoc_clk.c, GCC_BASE, 0x0008}, |
| 2458 | { &gcc_copss_smmu_ahb_clk.c, GCC_BASE, 0x000c}, |
| 2459 | { &gcc_lpss_smmu_ahb_clk.c, GCC_BASE, 0x000d}, |
| 2460 | { &pnoc_clk.c, GCC_BASE, 0x0010}, |
| 2461 | { &gcc_mmss_noc_cfg_ahb_clk.c, GCC_BASE, 0x002a}, |
| 2462 | { &gcc_mss_cfg_ahb_clk.c, GCC_BASE, 0x0030}, |
| 2463 | { &gcc_mss_q6_bimc_axi_clk.c, GCC_BASE, 0x0031}, |
| 2464 | { &gcc_usb_hs_system_clk.c, GCC_BASE, 0x0060}, |
| 2465 | { &gcc_usb_hs_ahb_clk.c, GCC_BASE, 0x0061}, |
| 2466 | { &gcc_usb2a_phy_sleep_clk.c, GCC_BASE, 0x0063}, |
| 2467 | { &gcc_sdcc1_apps_clk.c, GCC_BASE, 0x0068}, |
| 2468 | { &gcc_sdcc1_ahb_clk.c, GCC_BASE, 0x0069}, |
| 2469 | { &gcc_sdcc2_apps_clk.c, GCC_BASE, 0x0070}, |
| 2470 | { &gcc_sdcc2_ahb_clk.c, GCC_BASE, 0x0071}, |
| 2471 | { &gcc_blsp1_ahb_clk.c, GCC_BASE, 0x0088}, |
| 2472 | {&gcc_blsp1_qup1_spi_apps_clk.c, GCC_BASE, 0x008a}, |
| 2473 | {&gcc_blsp1_qup1_i2c_apps_clk.c, GCC_BASE, 0x008b}, |
| 2474 | { &gcc_blsp1_uart1_apps_clk.c, GCC_BASE, 0x008c}, |
| 2475 | {&gcc_blsp1_qup2_spi_apps_clk.c, GCC_BASE, 0x008e}, |
| 2476 | {&gcc_blsp1_qup2_i2c_apps_clk.c, GCC_BASE, 0x0090}, |
| 2477 | { &gcc_blsp1_uart2_apps_clk.c, GCC_BASE, 0x0091}, |
| 2478 | {&gcc_blsp1_qup3_spi_apps_clk.c, GCC_BASE, 0x0093}, |
| 2479 | {&gcc_blsp1_qup3_i2c_apps_clk.c, GCC_BASE, 0x0094}, |
| 2480 | { &gcc_blsp1_uart3_apps_clk.c, GCC_BASE, 0x0095}, |
| 2481 | {&gcc_blsp1_qup4_spi_apps_clk.c, GCC_BASE, 0x0098}, |
| 2482 | {&gcc_blsp1_qup4_i2c_apps_clk.c, GCC_BASE, 0x0099}, |
| 2483 | { &gcc_blsp1_uart4_apps_clk.c, GCC_BASE, 0x009a}, |
| 2484 | {&gcc_blsp1_qup5_spi_apps_clk.c, GCC_BASE, 0x009c}, |
| 2485 | {&gcc_blsp1_qup5_i2c_apps_clk.c, GCC_BASE, 0x009d}, |
| 2486 | { &gcc_blsp1_uart5_apps_clk.c, GCC_BASE, 0x009e}, |
| 2487 | {&gcc_blsp1_qup6_spi_apps_clk.c, GCC_BASE, 0x00a1}, |
| 2488 | {&gcc_blsp1_qup6_i2c_apps_clk.c, GCC_BASE, 0x00a2}, |
| 2489 | { &gcc_blsp1_uart6_apps_clk.c, GCC_BASE, 0x00a3}, |
| 2490 | { &gcc_pdm_ahb_clk.c, GCC_BASE, 0x00d0}, |
| 2491 | { &gcc_pdm2_clk.c, GCC_BASE, 0x00d2}, |
| 2492 | { &gcc_prng_ahb_clk.c, GCC_BASE, 0x00d8}, |
| 2493 | { &gcc_boot_rom_ahb_clk.c, GCC_BASE, 0x00f8}, |
| 2494 | { &gcc_ce1_clk.c, GCC_BASE, 0x0138}, |
| 2495 | { &gcc_ce1_axi_clk.c, GCC_BASE, 0x0139}, |
| 2496 | { &gcc_ce1_ahb_clk.c, GCC_BASE, 0x013a}, |
| 2497 | { &gcc_xo_clk_src.c, GCC_BASE, 0x0149}, |
| 2498 | { &bimc_clk.c, GCC_BASE, 0x0154}, |
Vikram Mulukutla | 55318acb | 2013-04-15 17:47:34 -0700 | [diff] [blame] | 2499 | { &gcc_bimc_smmu_clk.c, GCC_BASE, 0x015e}, |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 2500 | { &gcc_lpass_q6_axi_clk.c, GCC_BASE, 0x0160}, |
| 2501 | |
Vikram Mulukutla | 82cb844 | 2013-01-28 13:36:51 -0800 | [diff] [blame] | 2502 | { &mmssnoc_ahb_clk.c, MMSS_BASE, 0x0001}, |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 2503 | { &mmss_misc_ahb_clk.c, MMSS_BASE, 0x0003}, |
| 2504 | {&mmss_mmssnoc_axi_clk.c, MMSS_BASE, 0x0004}, |
| 2505 | { &mmss_s0_axi_clk.c, MMSS_BASE, 0x0005}, |
| 2506 | { &oxili_ahb_clk.c, MMSS_BASE, 0x0007}, |
| 2507 | { &oxili_gfx3d_clk.c, MMSS_BASE, 0x0008}, |
| 2508 | { &gmem_gfx3d_clk.c, MMSS_BASE, 0x0009}, |
| 2509 | { &mdp_axi_clk.c, MMSS_BASE, 0x000a}, |
| 2510 | { &mdp_vsync_clk.c, MMSS_BASE, 0x000b}, |
| 2511 | { &mdp_ahb_clk.c, MMSS_BASE, 0x000c}, |
| 2512 | { &dsi_pclk_clk.c, MMSS_BASE, 0x000d}, |
| 2513 | { &mdp_dsi_clk.c, MMSS_BASE, 0x000e}, |
| 2514 | { &mdp_lcdc_clk.c, MMSS_BASE, 0x000f}, |
| 2515 | { &dsi_clk.c, MMSS_BASE, 0x0010}, |
| 2516 | { &dsi_byte_clk.c, MMSS_BASE, 0x0011}, |
| 2517 | { &dsi_esc_clk.c, MMSS_BASE, 0x0012}, |
| 2518 | { &dsi_ahb_clk.c, MMSS_BASE, 0x0013}, |
| 2519 | { &mclk0_clk.c, MMSS_BASE, 0x0015}, |
| 2520 | { &mclk1_clk.c, MMSS_BASE, 0x0016}, |
| 2521 | { &csi0phytimer_clk.c, MMSS_BASE, 0x0017}, |
| 2522 | { &csi1phytimer_clk.c, MMSS_BASE, 0x0018}, |
| 2523 | { &vfe_clk.c, MMSS_BASE, 0x0019}, |
| 2524 | { &vfe_ahb_clk.c, MMSS_BASE, 0x001a}, |
| 2525 | { &vfe_axi_clk.c, MMSS_BASE, 0x001b}, |
| 2526 | { &csi_vfe_clk.c, MMSS_BASE, 0x001c}, |
| 2527 | { &csi0_clk.c, MMSS_BASE, 0x001d}, |
| 2528 | { &csi_ahb_clk.c, MMSS_BASE, 0x001e}, |
| 2529 | { &csi0phy_clk.c, MMSS_BASE, 0x001f}, |
| 2530 | { &csi0rdi_clk.c, MMSS_BASE, 0x0020}, |
| 2531 | { &csi0pix_clk.c, MMSS_BASE, 0x0021}, |
| 2532 | { &csi1_clk.c, MMSS_BASE, 0x0022}, |
| 2533 | { &csi1phy_clk.c, MMSS_BASE, 0x0023}, |
| 2534 | { &csi1rdi_clk.c, MMSS_BASE, 0x0024}, |
| 2535 | { &csi1pix_clk.c, MMSS_BASE, 0x0025}, |
| 2536 | { &bimc_gfx_clk.c, MMSS_BASE, 0x0032}, |
| 2537 | |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 2538 | { &q6ss_ahbm_clk.c, LPASS_BASE, 0x001d}, |
| 2539 | { &q6ss_ahb_lfabif_clk.c, LPASS_BASE, 0x001e}, |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 2540 | { &q6ss_xo_clk.c, LPASS_BASE, 0x002b}, |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 2541 | |
Vikram Mulukutla | 4157cca | 2013-01-24 15:42:41 -0800 | [diff] [blame] | 2542 | {&apc0_m_clk, APCS_BASE, 0x10}, |
| 2543 | {&apc1_m_clk, APCS_BASE, 0x11}, |
| 2544 | {&apc2_m_clk, APCS_BASE, 0x12}, |
| 2545 | {&apc3_m_clk, APCS_BASE, 0x13}, |
| 2546 | {&l2_m_clk, APCS_BASE, 0x15}, |
| 2547 | |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 2548 | {&dummy_clk, N_BASES, 0x0000}, |
| 2549 | }; |
| 2550 | |
| 2551 | #define GCC_DEBUG_CLK_CTL 0x1880 |
| 2552 | #define MMSS_DEBUG_CLK_CTL 0x0900 |
| 2553 | #define LPASS_DEBUG_CLK_CTL 0x29000 |
| 2554 | #define GLB_CLK_DIAG 0x001C |
| 2555 | |
| 2556 | static int measure_clk_set_parent(struct clk *c, struct clk *parent) |
| 2557 | { |
| 2558 | struct measure_clk *clk = to_measure_clk(c); |
| 2559 | unsigned long flags; |
| 2560 | u32 regval, clk_sel, i; |
| 2561 | |
| 2562 | if (!parent) |
| 2563 | return -EINVAL; |
| 2564 | |
| 2565 | for (i = 0; i < (ARRAY_SIZE(measure_mux) - 1); i++) |
| 2566 | if (measure_mux[i].c == parent) |
| 2567 | break; |
| 2568 | |
| 2569 | if (measure_mux[i].c == &dummy_clk) |
| 2570 | return -EINVAL; |
| 2571 | |
| 2572 | spin_lock_irqsave(&local_clock_reg_lock, flags); |
| 2573 | /* |
| 2574 | * Program the test vector, measurement period (sample_ticks) |
| 2575 | * and scaling multiplier. |
| 2576 | */ |
| 2577 | clk->sample_ticks = 0x10000; |
| 2578 | clk->multiplier = 1; |
| 2579 | |
| 2580 | switch (measure_mux[i].base) { |
| 2581 | |
| 2582 | case GCC_BASE: |
| 2583 | writel_relaxed(0, GCC_REG_BASE(GCC_DEBUG_CLK_CTL)); |
| 2584 | clk_sel = measure_mux[i].debug_mux; |
| 2585 | break; |
| 2586 | |
| 2587 | case MMSS_BASE: |
| 2588 | writel_relaxed(0, MMSS_REG_BASE(MMSS_DEBUG_CLK_CTL)); |
| 2589 | clk_sel = 0x02C; |
| 2590 | regval = BVAL(11, 0, measure_mux[i].debug_mux); |
| 2591 | writel_relaxed(regval, MMSS_REG_BASE(MMSS_DEBUG_CLK_CTL)); |
| 2592 | |
| 2593 | /* Activate debug clock output */ |
| 2594 | regval |= BIT(16); |
| 2595 | writel_relaxed(regval, MMSS_REG_BASE(MMSS_DEBUG_CLK_CTL)); |
| 2596 | break; |
| 2597 | |
| 2598 | case LPASS_BASE: |
| 2599 | writel_relaxed(0, LPASS_REG_BASE(LPASS_DEBUG_CLK_CTL)); |
| 2600 | clk_sel = 0x161; |
| 2601 | regval = BVAL(11, 0, measure_mux[i].debug_mux); |
| 2602 | writel_relaxed(regval, LPASS_REG_BASE(LPASS_DEBUG_CLK_CTL)); |
| 2603 | |
| 2604 | /* Activate debug clock output */ |
| 2605 | regval |= BIT(20); |
| 2606 | writel_relaxed(regval, LPASS_REG_BASE(LPASS_DEBUG_CLK_CTL)); |
| 2607 | break; |
| 2608 | |
| 2609 | case APCS_BASE: |
| 2610 | clk->multiplier = 4; |
| 2611 | clk_sel = 0x16A; |
| 2612 | regval = measure_mux[i].debug_mux; |
| 2613 | writel_relaxed(regval, APCS_REG_BASE(GLB_CLK_DIAG)); |
| 2614 | break; |
| 2615 | |
| 2616 | default: |
| 2617 | return -EINVAL; |
| 2618 | } |
| 2619 | |
| 2620 | /* Set debug mux clock index */ |
| 2621 | regval = BVAL(8, 0, clk_sel); |
| 2622 | writel_relaxed(regval, GCC_REG_BASE(GCC_DEBUG_CLK_CTL)); |
| 2623 | |
| 2624 | /* Activate debug clock output */ |
| 2625 | regval |= BIT(16); |
| 2626 | writel_relaxed(regval, GCC_REG_BASE(GCC_DEBUG_CLK_CTL)); |
| 2627 | |
| 2628 | /* Make sure test vector is set before starting measurements. */ |
| 2629 | mb(); |
| 2630 | spin_unlock_irqrestore(&local_clock_reg_lock, flags); |
| 2631 | |
| 2632 | return 0; |
| 2633 | } |
| 2634 | |
| 2635 | #define CLOCK_FRQ_MEASURE_CTL 0x1884 |
| 2636 | #define CLOCK_FRQ_MEASURE_STATUS 0x1888 |
| 2637 | |
| 2638 | /* Sample clock for 'ticks' reference clock ticks. */ |
| 2639 | static u32 run_measurement(unsigned ticks) |
| 2640 | { |
| 2641 | /* Stop counters and set the XO4 counter start value. */ |
| 2642 | writel_relaxed(ticks, GCC_REG_BASE(CLOCK_FRQ_MEASURE_CTL)); |
| 2643 | |
| 2644 | /* Wait for timer to become ready. */ |
| 2645 | while ((readl_relaxed(GCC_REG_BASE(CLOCK_FRQ_MEASURE_STATUS)) & |
| 2646 | BIT(25)) != 0) |
| 2647 | cpu_relax(); |
| 2648 | |
| 2649 | /* Run measurement and wait for completion. */ |
| 2650 | writel_relaxed(BIT(20)|ticks, GCC_REG_BASE(CLOCK_FRQ_MEASURE_CTL)); |
| 2651 | while ((readl_relaxed(GCC_REG_BASE(CLOCK_FRQ_MEASURE_STATUS)) & |
| 2652 | BIT(25)) == 0) |
| 2653 | cpu_relax(); |
| 2654 | |
| 2655 | /* Return measured ticks. */ |
| 2656 | return readl_relaxed(GCC_REG_BASE(CLOCK_FRQ_MEASURE_STATUS)) & |
| 2657 | BM(24, 0); |
| 2658 | } |
| 2659 | |
| 2660 | #define GCC_XO_DIV4_CBCR 0x10C8 |
| 2661 | #define PLLTEST_PAD_CFG 0x188C |
| 2662 | |
| 2663 | /* |
| 2664 | * Perform a hardware rate measurement for a given clock. |
| 2665 | * FOR DEBUG USE ONLY: Measurements take ~15 ms! |
| 2666 | */ |
| 2667 | static unsigned long measure_clk_get_rate(struct clk *c) |
| 2668 | { |
| 2669 | unsigned long flags; |
| 2670 | u32 gcc_xo4_reg_backup; |
| 2671 | u64 raw_count_short, raw_count_full; |
| 2672 | struct measure_clk *clk = to_measure_clk(c); |
| 2673 | unsigned ret; |
| 2674 | |
| 2675 | ret = clk_prepare_enable(&gcc_xo_clk_src.c); |
| 2676 | if (ret) { |
| 2677 | pr_warning("CXO clock failed to enable. Can't measure\n"); |
| 2678 | return 0; |
| 2679 | } |
| 2680 | |
| 2681 | spin_lock_irqsave(&local_clock_reg_lock, flags); |
| 2682 | |
| 2683 | /* Enable CXO/4 and RINGOSC branch. */ |
| 2684 | gcc_xo4_reg_backup = readl_relaxed(GCC_REG_BASE(GCC_XO_DIV4_CBCR)); |
| 2685 | writel_relaxed(0x1, GCC_REG_BASE(GCC_XO_DIV4_CBCR)); |
| 2686 | |
| 2687 | /* |
| 2688 | * The ring oscillator counter will not reset if the measured clock |
| 2689 | * is not running. To detect this, run a short measurement before |
| 2690 | * the full measurement. If the raw results of the two are the same |
| 2691 | * then the clock must be off. |
| 2692 | */ |
| 2693 | |
| 2694 | /* Run a short measurement. (~1 ms) */ |
| 2695 | raw_count_short = run_measurement(0x1000); |
| 2696 | /* Run a full measurement. (~14 ms) */ |
| 2697 | raw_count_full = run_measurement(clk->sample_ticks); |
| 2698 | |
| 2699 | writel_relaxed(gcc_xo4_reg_backup, GCC_REG_BASE(GCC_XO_DIV4_CBCR)); |
| 2700 | |
| 2701 | /* Return 0 if the clock is off. */ |
| 2702 | if (raw_count_full == raw_count_short) { |
| 2703 | ret = 0; |
| 2704 | } else { |
| 2705 | /* Compute rate in Hz. */ |
| 2706 | raw_count_full = ((raw_count_full * 10) + 15) * 4800000; |
| 2707 | do_div(raw_count_full, ((clk->sample_ticks * 10) + 35)); |
| 2708 | ret = (raw_count_full * clk->multiplier); |
| 2709 | } |
| 2710 | |
| 2711 | writel_relaxed(0x51A00, GCC_REG_BASE(PLLTEST_PAD_CFG)); |
| 2712 | spin_unlock_irqrestore(&local_clock_reg_lock, flags); |
| 2713 | |
| 2714 | clk_disable_unprepare(&gcc_xo_clk_src.c); |
| 2715 | |
| 2716 | return ret; |
| 2717 | } |
| 2718 | #else /* !CONFIG_DEBUG_FS */ |
| 2719 | static int measure_clk_set_parent(struct clk *clk, struct clk *parent) |
| 2720 | { |
| 2721 | return -EINVAL; |
| 2722 | } |
| 2723 | |
| 2724 | static unsigned long measure_clk_get_rate(struct clk *clk) |
| 2725 | { |
| 2726 | return 0; |
| 2727 | } |
| 2728 | #endif /* CONFIG_DEBUG_FS */ |
| 2729 | |
| 2730 | static struct clk_ops clk_ops_measure = { |
| 2731 | .set_parent = measure_clk_set_parent, |
| 2732 | .get_rate = measure_clk_get_rate, |
| 2733 | }; |
| 2734 | |
| 2735 | static struct measure_clk measure_clk = { |
| 2736 | .c = { |
| 2737 | .dbg_name = "measure_clk", |
| 2738 | .ops = &clk_ops_measure, |
| 2739 | CLK_INIT(measure_clk.c), |
| 2740 | }, |
| 2741 | .multiplier = 1, |
| 2742 | }; |
| 2743 | |
Syed Rameez Mustafa | 3971c14 | 2013-01-09 19:04:53 -0800 | [diff] [blame] | 2744 | static struct clk_lookup msm_clocks_8610[] = { |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 2745 | CLK_LOOKUP("xo", gcc_xo_clk_src.c, "msm_otg"), |
| 2746 | CLK_LOOKUP("xo", gcc_xo_clk_src.c, "fe200000.qcom,lpass"), |
Vikram Mulukutla | cee3bcf | 2013-03-13 15:55:45 -0700 | [diff] [blame] | 2747 | |
| 2748 | CLK_LOOKUP("xo", gcc_xo_clk_src.c, "fc880000.qcom,mss"), |
| 2749 | CLK_LOOKUP("bus_clk", gcc_mss_q6_bimc_axi_clk.c, "fc880000.qcom,mss"), |
| 2750 | CLK_LOOKUP("iface_clk", gcc_mss_cfg_ahb_clk.c, "fc880000.qcom,mss"), |
| 2751 | CLK_LOOKUP("mem_clk", gcc_boot_rom_ahb_clk.c, "fc880000.qcom,mss"), |
| 2752 | |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 2753 | CLK_LOOKUP("xo", gcc_xo_clk_src.c, "pil-mba"), |
| 2754 | CLK_LOOKUP("xo", gcc_xo_clk_src.c, "fb000000.qcom,wcnss-wlan"), |
Vikram Mulukutla | 381df18 | 2013-01-28 11:39:51 -0800 | [diff] [blame] | 2755 | CLK_LOOKUP("xo", gcc_xo_clk_src.c, "fb21b000.qcom,pronto"), |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 2756 | CLK_LOOKUP("measure", measure_clk.c, "debug"), |
| 2757 | |
| 2758 | CLK_LOOKUP("iface_clk", gcc_blsp1_ahb_clk.c, "f991f000.serial"), |
| 2759 | CLK_LOOKUP("core_clk", gcc_blsp1_uart3_apps_clk.c, "f991f000.serial"), |
Hanumant Singh | bbf01da | 2013-04-09 16:27:28 -0700 | [diff] [blame] | 2760 | CLK_LOOKUP("iface_clk", gcc_blsp1_ahb_clk.c, "f991e000.serial"), |
| 2761 | CLK_LOOKUP("core_clk", gcc_blsp1_uart2_apps_clk.c, "f991e000.serial"), |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 2762 | |
| 2763 | CLK_LOOKUP("dfab_clk", pnoc_sps_clk.c, "msm_sps"), |
| 2764 | CLK_LOOKUP("bus_clk", pnoc_qseecom_clk.c, "qseecom"), |
| 2765 | |
| 2766 | CLK_LOOKUP("bus_clk", snoc_clk.c, ""), |
| 2767 | CLK_LOOKUP("bus_clk", pnoc_clk.c, ""), |
| 2768 | CLK_LOOKUP("bus_clk", cnoc_clk.c, ""), |
| 2769 | CLK_LOOKUP("mem_clk", bimc_clk.c, ""), |
| 2770 | CLK_LOOKUP("bus_clk", snoc_a_clk.c, ""), |
| 2771 | CLK_LOOKUP("bus_clk", pnoc_a_clk.c, ""), |
| 2772 | CLK_LOOKUP("bus_clk", cnoc_a_clk.c, ""), |
| 2773 | CLK_LOOKUP("mem_clk", bimc_a_clk.c, ""), |
| 2774 | |
| 2775 | CLK_LOOKUP("bus_clk", cnoc_msmbus_clk.c, "msm_config_noc"), |
| 2776 | CLK_LOOKUP("bus_a_clk", cnoc_msmbus_a_clk.c, "msm_config_noc"), |
| 2777 | CLK_LOOKUP("bus_clk", snoc_msmbus_clk.c, "msm_sys_noc"), |
| 2778 | CLK_LOOKUP("bus_a_clk", snoc_msmbus_a_clk.c, "msm_sys_noc"), |
| 2779 | CLK_LOOKUP("bus_clk", pnoc_msmbus_clk.c, "msm_periph_noc"), |
| 2780 | CLK_LOOKUP("bus_a_clk", pnoc_msmbus_a_clk.c, "msm_periph_noc"), |
| 2781 | CLK_LOOKUP("mem_clk", bimc_msmbus_clk.c, "msm_bimc"), |
| 2782 | CLK_LOOKUP("mem_a_clk", bimc_msmbus_a_clk.c, "msm_bimc"), |
| 2783 | CLK_LOOKUP("mem_clk", bimc_acpu_a_clk.c, ""), |
Gagan Mac | 125029b | 2013-03-07 17:24:27 -0700 | [diff] [blame] | 2784 | CLK_LOOKUP("bus_clk", mmss_s0_axi_clk.c, "msm_mmss_noc"), |
| 2785 | CLK_LOOKUP("bus_a_clk", mmss_s0_axi_clk.c, "msm_mmss_noc"), |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 2786 | |
Aparna Das | 0f5a6ea | 2013-03-06 15:28:08 -0800 | [diff] [blame] | 2787 | /* CoreSight clocks */ |
| 2788 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc326000.tmc"), |
| 2789 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc320000.tpiu"), |
| 2790 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc324000.replicator"), |
| 2791 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc325000.tmc"), |
| 2792 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc323000.funnel"), |
| 2793 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc321000.funnel"), |
| 2794 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc322000.funnel"), |
| 2795 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc355000.funnel"), |
| 2796 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc302000.stm"), |
| 2797 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc34c000.etm"), |
| 2798 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc34d000.etm"), |
| 2799 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc34e000.etm"), |
| 2800 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc34f000.etm"), |
| 2801 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc301000.csr"), |
| 2802 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc310000.cti"), |
| 2803 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc311000.cti"), |
| 2804 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc312000.cti"), |
| 2805 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc313000.cti"), |
| 2806 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc314000.cti"), |
| 2807 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc315000.cti"), |
| 2808 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc316000.cti"), |
| 2809 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc317000.cti"), |
| 2810 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc318000.cti"), |
| 2811 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc351000.cti"), |
| 2812 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc352000.cti"), |
| 2813 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc353000.cti"), |
| 2814 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc354000.cti"), |
Aparna Das | 29e2343 | 2013-04-16 16:37:39 -0700 | [diff] [blame] | 2815 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc34c000.jtagmm"), |
| 2816 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc34d000.jtagmm"), |
| 2817 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc34e000.jtagmm"), |
| 2818 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc34f000.jtagmm"), |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 2819 | |
Aparna Das | 0f5a6ea | 2013-03-06 15:28:08 -0800 | [diff] [blame] | 2820 | |
| 2821 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc326000.tmc"), |
| 2822 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc320000.tpiu"), |
| 2823 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc324000.replicator"), |
| 2824 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc325000.tmc"), |
| 2825 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc323000.funnel"), |
| 2826 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc321000.funnel"), |
| 2827 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc322000.funnel"), |
| 2828 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc355000.funnel"), |
| 2829 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc302000.stm"), |
| 2830 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc34c000.etm"), |
| 2831 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc34d000.etm"), |
| 2832 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc34e000.etm"), |
| 2833 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc34f000.etm"), |
| 2834 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc301000.csr"), |
| 2835 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc310000.cti"), |
| 2836 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc311000.cti"), |
| 2837 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc312000.cti"), |
| 2838 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc313000.cti"), |
| 2839 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc314000.cti"), |
| 2840 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc315000.cti"), |
| 2841 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc316000.cti"), |
| 2842 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc317000.cti"), |
| 2843 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc318000.cti"), |
| 2844 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc351000.cti"), |
| 2845 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc352000.cti"), |
| 2846 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc353000.cti"), |
| 2847 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc354000.cti"), |
Aparna Das | 29e2343 | 2013-04-16 16:37:39 -0700 | [diff] [blame] | 2848 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc34c000.jtagmm"), |
| 2849 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc34d000.jtagmm"), |
| 2850 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc34e000.jtagmm"), |
| 2851 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc34f000.jtagmm"), |
Aparna Das | 0f5a6ea | 2013-03-06 15:28:08 -0800 | [diff] [blame] | 2852 | |
| 2853 | |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 2854 | |
| 2855 | CLK_LOOKUP("core_clk_src", blsp1_qup1_spi_apps_clk_src.c, ""), |
| 2856 | CLK_LOOKUP("core_clk_src", blsp1_qup2_spi_apps_clk_src.c, ""), |
| 2857 | CLK_LOOKUP("core_clk_src", blsp1_qup3_spi_apps_clk_src.c, ""), |
| 2858 | CLK_LOOKUP("core_clk_src", blsp1_qup4_spi_apps_clk_src.c, ""), |
| 2859 | CLK_LOOKUP("core_clk_src", blsp1_qup5_spi_apps_clk_src.c, ""), |
| 2860 | CLK_LOOKUP("core_clk_src", blsp1_qup6_spi_apps_clk_src.c, ""), |
| 2861 | CLK_LOOKUP("core_clk_src", blsp1_uart1_apps_clk_src.c, ""), |
| 2862 | CLK_LOOKUP("core_clk_src", blsp1_uart2_apps_clk_src.c, ""), |
| 2863 | CLK_LOOKUP("core_clk_src", blsp1_uart3_apps_clk_src.c, ""), |
| 2864 | CLK_LOOKUP("core_clk_src", blsp1_uart4_apps_clk_src.c, ""), |
| 2865 | CLK_LOOKUP("core_clk_src", blsp1_uart5_apps_clk_src.c, ""), |
| 2866 | CLK_LOOKUP("core_clk_src", blsp1_uart6_apps_clk_src.c, ""), |
| 2867 | CLK_LOOKUP("core_clk_src", ce1_clk_src.c, ""), |
| 2868 | CLK_LOOKUP("core_clk_src", gp1_clk_src.c, ""), |
| 2869 | CLK_LOOKUP("core_clk_src", gp2_clk_src.c, ""), |
| 2870 | CLK_LOOKUP("core_clk_src", gp3_clk_src.c, ""), |
| 2871 | CLK_LOOKUP("core_clk_src", pdm2_clk_src.c, ""), |
| 2872 | CLK_LOOKUP("core_clk_src", sdcc1_apps_clk_src.c, ""), |
| 2873 | CLK_LOOKUP("core_clk_src", sdcc2_apps_clk_src.c, ""), |
| 2874 | CLK_LOOKUP("core_clk_src", usb_hs_system_clk_src.c, ""), |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 2875 | CLK_LOOKUP("iface_clk", gcc_blsp1_ahb_clk.c, "f9923000.i2c"), |
Gilad Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 2876 | CLK_LOOKUP("iface_clk", gcc_blsp1_ahb_clk.c, "f9925000.i2c"), |
Kuirong Wang | c6d072c | 2013-01-29 10:33:03 -0800 | [diff] [blame] | 2877 | CLK_LOOKUP("iface_clk", gcc_blsp1_ahb_clk.c, "f9927000.i2c"), |
Chun Zhang | f39a065 | 2013-05-01 15:57:54 -0700 | [diff] [blame] | 2878 | CLK_LOOKUP("core_clk", gcc_blsp1_qup1_i2c_apps_clk.c, "f9923000.i2c"), |
| 2879 | CLK_LOOKUP("core_clk", gcc_blsp1_qup1_spi_apps_clk.c, ""), |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 2880 | CLK_LOOKUP("core_clk", gcc_blsp1_qup2_i2c_apps_clk.c, ""), |
| 2881 | CLK_LOOKUP("core_clk", gcc_blsp1_qup2_spi_apps_clk.c, ""), |
Gilad Avidov | f84f279 | 2013-01-31 13:26:39 -0700 | [diff] [blame] | 2882 | CLK_LOOKUP("core_clk", gcc_blsp1_qup3_i2c_apps_clk.c, "f9925000.i2c"), |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 2883 | CLK_LOOKUP("core_clk", gcc_blsp1_qup3_spi_apps_clk.c, ""), |
| 2884 | CLK_LOOKUP("core_clk", gcc_blsp1_qup4_i2c_apps_clk.c, ""), |
| 2885 | CLK_LOOKUP("core_clk", gcc_blsp1_qup4_spi_apps_clk.c, ""), |
Kuirong Wang | c6d072c | 2013-01-29 10:33:03 -0800 | [diff] [blame] | 2886 | CLK_LOOKUP("core_clk", gcc_blsp1_qup5_i2c_apps_clk.c, "f9927000.i2c"), |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 2887 | CLK_LOOKUP("core_clk", gcc_blsp1_qup5_spi_apps_clk.c, ""), |
Kenneth Heitke | 0d4fbb1 | 2013-04-10 12:51:14 -0600 | [diff] [blame] | 2888 | CLK_LOOKUP("iface_clk", gcc_blsp1_ahb_clk.c, "f9928000.i2c"), |
| 2889 | CLK_LOOKUP("core_clk", gcc_blsp1_qup6_i2c_apps_clk.c, "f9928000.i2c"), |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 2890 | CLK_LOOKUP("core_clk", gcc_blsp1_qup6_spi_apps_clk.c, ""), |
| 2891 | CLK_LOOKUP("core_clk", gcc_blsp1_uart1_apps_clk.c, ""), |
| 2892 | CLK_LOOKUP("core_clk", gcc_blsp1_uart2_apps_clk.c, ""), |
| 2893 | CLK_LOOKUP("core_clk", gcc_blsp1_uart3_apps_clk.c, ""), |
| 2894 | CLK_LOOKUP("core_clk", gcc_blsp1_uart4_apps_clk.c, ""), |
| 2895 | CLK_LOOKUP("core_clk", gcc_blsp1_uart5_apps_clk.c, ""), |
| 2896 | CLK_LOOKUP("core_clk", gcc_blsp1_uart6_apps_clk.c, ""), |
| 2897 | CLK_LOOKUP("iface_clk", gcc_boot_rom_ahb_clk.c, ""), |
| 2898 | CLK_LOOKUP("iface_clk", gcc_ce1_ahb_clk.c, ""), |
| 2899 | CLK_LOOKUP("core_clk", gcc_ce1_axi_clk.c, ""), |
| 2900 | CLK_LOOKUP("core_clk", gcc_ce1_clk.c, ""), |
| 2901 | CLK_LOOKUP("iface_clk", gcc_copss_smmu_ahb_clk.c, ""), |
| 2902 | CLK_LOOKUP("iface_clk", gcc_lpss_smmu_ahb_clk.c, ""), |
| 2903 | CLK_LOOKUP("core_clk", gcc_gp1_clk.c, ""), |
| 2904 | CLK_LOOKUP("core_clk", gcc_gp2_clk.c, ""), |
| 2905 | CLK_LOOKUP("core_clk", gcc_gp3_clk.c, ""), |
| 2906 | CLK_LOOKUP("core_clk", gcc_lpass_q6_axi_clk.c, ""), |
| 2907 | CLK_LOOKUP("iface_clk", gcc_mss_cfg_ahb_clk.c, ""), |
| 2908 | CLK_LOOKUP("core_clk", gcc_mss_q6_bimc_axi_clk.c, ""), |
| 2909 | CLK_LOOKUP("core_clk", gcc_pdm2_clk.c, ""), |
| 2910 | CLK_LOOKUP("iface_clk", gcc_pdm_ahb_clk.c, ""), |
Hariprasad Dhalinarasimha | 2cced7d | 2013-04-13 17:25:58 -0700 | [diff] [blame] | 2911 | CLK_LOOKUP("iface_clk", gcc_prng_ahb_clk.c, "f9bff000.qcom,msm-rng"), |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 2912 | CLK_LOOKUP("iface_clk", gcc_sdcc1_ahb_clk.c, "msm_sdcc.1"), |
| 2913 | CLK_LOOKUP("core_clk", gcc_sdcc1_apps_clk.c, "msm_sdcc.1"), |
| 2914 | CLK_LOOKUP("iface_clk", gcc_sdcc2_ahb_clk.c, "msm_sdcc.2"), |
| 2915 | CLK_LOOKUP("core_clk", gcc_sdcc2_apps_clk.c, "msm_sdcc.2"), |
| 2916 | CLK_LOOKUP("core_clk", gcc_usb2a_phy_sleep_clk.c, ""), |
| 2917 | CLK_LOOKUP("iface_clk", gcc_usb_hs_ahb_clk.c, "f9a55000.usb"), |
| 2918 | CLK_LOOKUP("core_clk", gcc_usb_hs_system_clk.c, "f9a55000.usb"), |
| 2919 | |
| 2920 | CLK_LOOKUP("core_clk_src", csi0_clk_src.c, ""), |
| 2921 | CLK_LOOKUP("core_clk_src", axi_clk_src.c, ""), |
Vikram Mulukutla | e1e5c48 | 2013-01-28 14:43:20 -0800 | [diff] [blame] | 2922 | CLK_LOOKUP("", mdp_axi_clk_src.c, ""), |
| 2923 | CLK_LOOKUP("", mmssnoc_axi_clk_src.c, ""), |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 2924 | CLK_LOOKUP("core_clk_src", dsi_pclk_clk_src.c, ""), |
| 2925 | CLK_LOOKUP("core_clk_src", gfx3d_clk_src.c, ""), |
| 2926 | CLK_LOOKUP("core_clk_src", vfe_clk_src.c, ""), |
| 2927 | CLK_LOOKUP("core_clk_src", csi1_clk_src.c, ""), |
| 2928 | CLK_LOOKUP("core_clk_src", csi0phytimer_clk_src.c, ""), |
| 2929 | CLK_LOOKUP("core_clk_src", csi1phytimer_clk_src.c, ""), |
| 2930 | CLK_LOOKUP("core_clk_src", dsi_clk_src.c, ""), |
| 2931 | CLK_LOOKUP("core_clk_src", dsi_byte_clk_src.c, ""), |
| 2932 | CLK_LOOKUP("core_clk_src", dsi_esc_clk_src.c, ""), |
| 2933 | CLK_LOOKUP("core_clk_src", mclk0_clk_src.c, ""), |
| 2934 | CLK_LOOKUP("core_clk_src", mclk1_clk_src.c, ""), |
| 2935 | CLK_LOOKUP("core_clk_src", mdp_vsync_clk_src.c, ""), |
| 2936 | |
| 2937 | CLK_LOOKUP("core_clk", bimc_gfx_clk.c, ""), |
| 2938 | CLK_LOOKUP("core_clk", csi0_clk.c, ""), |
| 2939 | CLK_LOOKUP("core_clk", csi0phy_clk.c, ""), |
| 2940 | CLK_LOOKUP("core_clk", csi0phytimer_clk.c, ""), |
| 2941 | CLK_LOOKUP("core_clk", csi0pix_clk.c, ""), |
| 2942 | CLK_LOOKUP("core_clk", csi0rdi_clk.c, ""), |
| 2943 | CLK_LOOKUP("core_clk", csi1_clk.c, ""), |
| 2944 | CLK_LOOKUP("core_clk", csi1phy_clk.c, ""), |
| 2945 | CLK_LOOKUP("core_clk", csi1phytimer_clk.c, ""), |
| 2946 | CLK_LOOKUP("core_clk", csi1pix_clk.c, ""), |
| 2947 | CLK_LOOKUP("core_clk", csi1rdi_clk.c, ""), |
| 2948 | CLK_LOOKUP("core_clk", csi_ahb_clk.c, ""), |
| 2949 | CLK_LOOKUP("core_clk", csi_vfe_clk.c, ""), |
| 2950 | CLK_LOOKUP("core_clk", dsi_clk.c, ""), |
| 2951 | CLK_LOOKUP("core_clk", dsi_ahb_clk.c, ""), |
| 2952 | CLK_LOOKUP("core_clk", dsi_byte_clk.c, ""), |
| 2953 | CLK_LOOKUP("core_clk", dsi_esc_clk.c, ""), |
| 2954 | CLK_LOOKUP("core_clk", dsi_pclk_clk.c, ""), |
| 2955 | CLK_LOOKUP("core_clk", gmem_gfx3d_clk.c, ""), |
| 2956 | CLK_LOOKUP("core_clk", mclk0_clk.c, ""), |
| 2957 | CLK_LOOKUP("core_clk", mclk1_clk.c, ""), |
| 2958 | CLK_LOOKUP("core_clk", mdp_ahb_clk.c, ""), |
| 2959 | CLK_LOOKUP("core_clk", mdp_axi_clk.c, ""), |
| 2960 | CLK_LOOKUP("core_clk", mdp_dsi_clk.c, ""), |
| 2961 | CLK_LOOKUP("core_clk", mdp_lcdc_clk.c, ""), |
| 2962 | CLK_LOOKUP("core_clk", mdp_vsync_clk.c, ""), |
| 2963 | CLK_LOOKUP("core_clk", mmss_misc_ahb_clk.c, ""), |
| 2964 | CLK_LOOKUP("core_clk", mmss_s0_axi_clk.c, ""), |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 2965 | CLK_LOOKUP("core_clk", mmss_mmssnoc_bto_ahb_clk.c, ""), |
| 2966 | CLK_LOOKUP("core_clk", mmss_mmssnoc_axi_clk.c, ""), |
| 2967 | CLK_LOOKUP("core_clk", vfe_clk.c, ""), |
| 2968 | CLK_LOOKUP("core_clk", vfe_ahb_clk.c, ""), |
| 2969 | CLK_LOOKUP("core_clk", vfe_axi_clk.c, ""), |
| 2970 | |
Vikram Mulukutla | 4942339 | 2013-05-02 09:03:02 -0700 | [diff] [blame] | 2971 | CLK_LOOKUP("core_clk", csi0pix_cam_mux_clk.c, ""), |
| 2972 | CLK_LOOKUP("core_clk", csi0phy_cam_mux_clk.c, ""), |
| 2973 | CLK_LOOKUP("core_clk", csi1phy_cam_mux_clk.c, ""), |
| 2974 | CLK_LOOKUP("core_clk", rdi2_cam_mux_clk.c, ""), |
| 2975 | CLK_LOOKUP("core_clk", rdi1_cam_mux_clk.c, ""), |
| 2976 | CLK_LOOKUP("core_clk", rdi0_cam_mux_clk.c, ""), |
Vikram Mulukutla | 8964a38 | 2013-04-10 14:30:50 -0700 | [diff] [blame] | 2977 | |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 2978 | CLK_LOOKUP("core_clk", oxili_gfx3d_clk.c, "fdc00000.qcom,kgsl-3d0"), |
| 2979 | CLK_LOOKUP("iface_clk", oxili_ahb_clk.c, "fdc00000.qcom,kgsl-3d0"), |
| 2980 | CLK_LOOKUP("mem_iface_clk", bimc_gfx_clk.c, "fdc00000.qcom,kgsl-3d0"), |
| 2981 | CLK_LOOKUP("mem_clk", gmem_gfx3d_clk.c, "fdc00000.qcom,kgsl-3d0"), |
Vikram Mulukutla | 55318acb | 2013-04-15 17:47:34 -0700 | [diff] [blame] | 2982 | CLK_LOOKUP("alt_mem_iface_clk", gcc_bimc_smmu_clk.c, |
| 2983 | "fdc00000.qcom,kgsl-3d0"), |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 2984 | |
| 2985 | CLK_LOOKUP("iface_clk", vfe_ahb_clk.c, "fd890000.qcom,iommu"), |
| 2986 | CLK_LOOKUP("core_clk", vfe_axi_clk.c, "fd890000.qcom,iommu"), |
| 2987 | CLK_LOOKUP("iface_clk", mdp_ahb_clk.c, "fd860000.qcom,iommu"), |
| 2988 | CLK_LOOKUP("core_clk", mdp_axi_clk.c, "fd860000.qcom,iommu"), |
| 2989 | CLK_LOOKUP("iface_clk", mdp_ahb_clk.c, "fd870000.qcom,iommu"), |
| 2990 | CLK_LOOKUP("core_clk", mdp_axi_clk.c, "fd870000.qcom,iommu"), |
| 2991 | CLK_LOOKUP("iface_clk", oxili_ahb_clk.c, "fd880000.qcom,iommu"), |
| 2992 | CLK_LOOKUP("core_clk", bimc_gfx_clk.c, "fd880000.qcom,iommu"), |
Vikram Mulukutla | 55318acb | 2013-04-15 17:47:34 -0700 | [diff] [blame] | 2993 | CLK_LOOKUP("alt_core_clk", gcc_bimc_smmu_clk.c, "fd880000.qcom,iommu"), |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 2994 | CLK_LOOKUP("iface_clk", gcc_lpss_smmu_ahb_clk.c, "fd000000.qcom,iommu"), |
| 2995 | CLK_LOOKUP("core_clk", gcc_lpass_q6_axi_clk.c, "fd000000.qcom,iommu"), |
| 2996 | CLK_LOOKUP("iface_clk", gcc_copss_smmu_ahb_clk.c, |
| 2997 | "fd010000.qcom,iommu"), |
| 2998 | CLK_LOOKUP("core_clk", pnoc_iommu_clk.c, "fd010000.qcom,iommu"), |
| 2999 | |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 3000 | CLK_LOOKUP("core_clk", q6ss_xo_clk.c, "fe200000.qcom,lpass"), |
| 3001 | CLK_LOOKUP("bus_clk", gcc_lpass_q6_axi_clk.c, "fe200000.qcom,lpass"), |
| 3002 | CLK_LOOKUP("iface_clk", q6ss_ahb_lfabif_clk.c, "fe200000.qcom,lpass"), |
| 3003 | CLK_LOOKUP("reg_clk", q6ss_ahbm_clk.c, "fe200000.qcom,lpass"), |
Vikram Mulukutla | 4157cca | 2013-01-24 15:42:41 -0800 | [diff] [blame] | 3004 | |
| 3005 | CLK_LOOKUP("xo", gcc_xo_a_clk_src.c, "f9011050.qcom,acpuclk"), |
| 3006 | CLK_LOOKUP("gpll0", gpll0_ao_clk_src.c, "f9011050.qcom,acpuclk"), |
| 3007 | CLK_LOOKUP("a7sspll", a7sspll.c, "f9011050.qcom,acpuclk"), |
| 3008 | |
| 3009 | CLK_LOOKUP("measure_clk", apc0_m_clk, ""), |
| 3010 | CLK_LOOKUP("measure_clk", apc1_m_clk, ""), |
| 3011 | CLK_LOOKUP("measure_clk", apc2_m_clk, ""), |
| 3012 | CLK_LOOKUP("measure_clk", apc3_m_clk, ""), |
| 3013 | CLK_LOOKUP("measure_clk", l2_m_clk, ""), |
Xiaoming Zhou | 8150acf | 2013-04-04 16:31:17 -0400 | [diff] [blame] | 3014 | |
Vikram Mulukutla | ed07851 | 2013-04-09 14:15:33 -0700 | [diff] [blame] | 3015 | CLK_LOOKUP("xo", gcc_xo_clk_src.c, "fb000000.qcom,wcnss-wlan"), |
Vikram Mulukutla | 7e5b311 | 2013-04-15 16:32:40 -0700 | [diff] [blame] | 3016 | CLK_LOOKUP("rf_clk", cxo_a1.c, "fb000000.qcom,wcnss-wlan"), |
Vikram Mulukutla | ed07851 | 2013-04-09 14:15:33 -0700 | [diff] [blame] | 3017 | |
Xiaoming Zhou | 8150acf | 2013-04-04 16:31:17 -0400 | [diff] [blame] | 3018 | CLK_LOOKUP("iface_clk", mdp_ahb_clk.c, "fd900000.qcom,mdss_mdp"), |
| 3019 | CLK_LOOKUP("core_clk", mdp_axi_clk.c, "fd900000.qcom,mdss_mdp"), |
| 3020 | CLK_LOOKUP("lcdc_clk", mdp_lcdc_clk.c, "fd900000.qcom,mdss_mdp"), |
| 3021 | CLK_LOOKUP("vsync_clk", mdp_vsync_clk.c, "fd900000.qcom,mdss_mdp"), |
Xiaoming Zhou | d58589e | 2013-04-10 22:30:51 -0400 | [diff] [blame] | 3022 | CLK_LOOKUP("dsi_clk", mdp_dsi_clk.c, "fd900000.qcom,mdss_mdp"), |
Xiaoming Zhou | 8150acf | 2013-04-04 16:31:17 -0400 | [diff] [blame] | 3023 | CLK_LOOKUP("iface_clk", dsi_ahb_clk.c, "fdd00000.qcom,mdss_dsi"), |
Xiaoming Zhou | d58589e | 2013-04-10 22:30:51 -0400 | [diff] [blame] | 3024 | CLK_LOOKUP("dsi_clk", dsi_clk.c, "fdd00000.qcom,mdss_dsi"), |
Xiaoming Zhou | 8150acf | 2013-04-04 16:31:17 -0400 | [diff] [blame] | 3025 | CLK_LOOKUP("byte_clk", dsi_byte_clk.c, "fdd00000.qcom,mdss_dsi"), |
| 3026 | CLK_LOOKUP("esc_clk", dsi_esc_clk.c, "fdd00000.qcom,mdss_dsi"), |
| 3027 | CLK_LOOKUP("pixel_clk", dsi_pclk_clk.c, "fdd00000.qcom,mdss_dsi"), |
Hariprasad Dhalinarasimha | d9ede5a | 2013-04-14 16:30:09 -0700 | [diff] [blame] | 3028 | |
| 3029 | /* QSEECOM Clocks */ |
| 3030 | CLK_LOOKUP("core_clk", gcc_ce1_clk.c, "qseecom"), |
| 3031 | CLK_LOOKUP("iface_clk", gcc_ce1_ahb_clk.c, "qseecom"), |
| 3032 | CLK_LOOKUP("bus_clk", gcc_ce1_axi_clk.c, "qseecom"), |
| 3033 | CLK_LOOKUP("core_clk_src", ce1_clk_src.c, "qseecom"), |
Vikram Mulukutla | fd6833c | 2013-04-18 12:46:48 -0700 | [diff] [blame] | 3034 | |
| 3035 | CLK_LOOKUP("core_clk", gcc_ce1_clk.c, "scm"), |
| 3036 | CLK_LOOKUP("iface_clk", gcc_ce1_ahb_clk.c, "scm"), |
| 3037 | CLK_LOOKUP("bus_clk", gcc_ce1_axi_clk.c, "scm"), |
| 3038 | CLK_LOOKUP("core_clk_src", ce1_clk_src.c, "scm"), |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 3039 | }; |
| 3040 | |
Syed Rameez Mustafa | 3971c14 | 2013-01-09 19:04:53 -0800 | [diff] [blame] | 3041 | static struct clk_lookup msm_clocks_8610_rumi[] = { |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 3042 | CLK_DUMMY("core_clk", BLSP1_UART_CLK, "f991f000.serial", OFF), |
| 3043 | CLK_DUMMY("iface_clk", BLSP1_UART_CLK, "f991f000.serial", OFF), |
| 3044 | CLK_DUMMY("iface_clk", HSUSB_IFACE_CLK, "f9a55000.usb", OFF), |
| 3045 | CLK_DUMMY("core_clk", HSUSB_CORE_CLK, "f9a55000.usb", OFF), |
| 3046 | CLK_DUMMY("iface_clk", NULL, "msm_sdcc.1", OFF), |
| 3047 | CLK_DUMMY("core_clk", NULL, "msm_sdcc.1", OFF), |
| 3048 | CLK_DUMMY("bus_clk", NULL, "msm_sdcc.1", OFF), |
| 3049 | CLK_DUMMY("iface_clk", NULL, "msm_sdcc.2", OFF), |
| 3050 | CLK_DUMMY("core_clk", NULL, "msm_sdcc.2", OFF), |
| 3051 | CLK_DUMMY("bus_clk", NULL, "msm_sdcc.2", OFF), |
| 3052 | CLK_DUMMY("dfab_clk", DFAB_CLK, "msm_sps", OFF), |
| 3053 | CLK_DUMMY("iface_clk", NULL, "fd890000.qcom,iommu", OFF), |
| 3054 | CLK_DUMMY("core_clk", NULL, "fd890000.qcom,iommu", OFF), |
| 3055 | CLK_DUMMY("iface_clk", NULL, "fd860000.qcom,iommu", OFF), |
| 3056 | CLK_DUMMY("core_clk", NULL, "fd860000.qcom,iommu", OFF), |
| 3057 | CLK_DUMMY("iface_clk", NULL, "fd870000.qcom,iommu", OFF), |
| 3058 | CLK_DUMMY("core_clk", NULL, "fd870000.qcom,iommu", OFF), |
| 3059 | CLK_DUMMY("iface_clk", NULL, "fd880000.qcom,iommu", OFF), |
| 3060 | CLK_DUMMY("core_clk", NULL, "fd880000.qcom,iommu", OFF), |
| 3061 | CLK_DUMMY("iface_clk", NULL, "fd000000.qcom,iommu", OFF), |
| 3062 | CLK_DUMMY("core_clk", NULL, "fd000000.qcom,iommu", OFF), |
| 3063 | CLK_DUMMY("iface_clk", NULL, "fd010000.qcom,iommu", OFF), |
| 3064 | CLK_DUMMY("core_clk", NULL, "fd010000.qcom,iommu", OFF), |
Vikram Mulukutla | 4157cca | 2013-01-24 15:42:41 -0800 | [diff] [blame] | 3065 | CLK_DUMMY("xo", NULL, "f9011050.qcom,acpuclk", OFF), |
| 3066 | CLK_DUMMY("gpll0", NULL, "f9011050.qcom,acpuclk", OFF), |
| 3067 | CLK_DUMMY("a7sspll", NULL, "f9011050.qcom,acpuclk", OFF), |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 3068 | }; |
| 3069 | |
Syed Rameez Mustafa | 3971c14 | 2013-01-09 19:04:53 -0800 | [diff] [blame] | 3070 | struct clock_init_data msm8610_rumi_clock_init_data __initdata = { |
| 3071 | .table = msm_clocks_8610_rumi, |
| 3072 | .size = ARRAY_SIZE(msm_clocks_8610_rumi), |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 3073 | }; |
| 3074 | |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 3075 | /* MMPLL0 at 800 MHz, main output enabled. */ |
| 3076 | static struct pll_config mmpll0_config __initdata = { |
| 3077 | .l = 0x29, |
| 3078 | .m = 0x2, |
| 3079 | .n = 0x3, |
| 3080 | .vco_val = 0x0, |
| 3081 | .vco_mask = BM(21, 20), |
| 3082 | .pre_div_val = 0x0, |
| 3083 | .pre_div_mask = BM(14, 12), |
| 3084 | .post_div_val = 0x0, |
| 3085 | .post_div_mask = BM(9, 8), |
| 3086 | .mn_ena_val = BIT(24), |
| 3087 | .mn_ena_mask = BIT(24), |
| 3088 | .main_output_val = BIT(0), |
| 3089 | .main_output_mask = BIT(0), |
| 3090 | }; |
| 3091 | |
| 3092 | /* MMPLL1 at 1200 MHz, main output enabled. */ |
| 3093 | static struct pll_config mmpll1_config __initdata = { |
| 3094 | .l = 0x3E, |
| 3095 | .m = 0x1, |
| 3096 | .n = 0x2, |
| 3097 | .vco_val = 0x0, |
| 3098 | .vco_mask = BM(21, 20), |
| 3099 | .pre_div_val = 0x0, |
| 3100 | .pre_div_mask = BM(14, 12), |
| 3101 | .post_div_val = 0x0, |
| 3102 | .post_div_mask = BM(9, 8), |
| 3103 | .mn_ena_val = BIT(24), |
| 3104 | .mn_ena_mask = BIT(24), |
| 3105 | .main_output_val = BIT(0), |
| 3106 | .main_output_mask = BIT(0), |
| 3107 | }; |
| 3108 | |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 3109 | #define PLL_AUX_OUTPUT_BIT 1 |
| 3110 | #define PLL_AUX2_OUTPUT_BIT 2 |
| 3111 | |
| 3112 | #define PWR_ON_MASK BIT(31) |
| 3113 | #define EN_REST_WAIT_MASK (0xF << 20) |
| 3114 | #define EN_FEW_WAIT_MASK (0xF << 16) |
| 3115 | #define CLK_DIS_WAIT_MASK (0xF << 12) |
| 3116 | #define SW_OVERRIDE_MASK BIT(2) |
| 3117 | #define HW_CONTROL_MASK BIT(1) |
| 3118 | #define SW_COLLAPSE_MASK BIT(0) |
| 3119 | |
| 3120 | /* Wait 2^n CXO cycles between all states. Here, n=2 (4 cycles). */ |
| 3121 | #define EN_REST_WAIT_VAL (0x2 << 20) |
| 3122 | #define EN_FEW_WAIT_VAL (0x2 << 16) |
| 3123 | #define CLK_DIS_WAIT_VAL (0x2 << 12) |
| 3124 | #define GDSC_TIMEOUT_US 50000 |
| 3125 | |
| 3126 | static void __init reg_init(void) |
| 3127 | { |
Vikram Mulukutla | 81577ab | 2013-03-25 10:55:36 -0700 | [diff] [blame] | 3128 | u32 regval; |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 3129 | |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 3130 | configure_sr_hpm_lp_pll(&mmpll0_config, &mmpll0_regs, 1); |
| 3131 | configure_sr_hpm_lp_pll(&mmpll1_config, &mmpll1_regs, 1); |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 3132 | |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 3133 | /* Vote for GPLL0 to turn on. Needed by acpuclock. */ |
| 3134 | regval = readl_relaxed(GCC_REG_BASE(APCS_GPLL_ENA_VOTE)); |
| 3135 | regval |= BIT(0); |
| 3136 | writel_relaxed(regval, GCC_REG_BASE(APCS_GPLL_ENA_VOTE)); |
| 3137 | |
| 3138 | /* |
| 3139 | * TODO: Confirm that no clocks need to be voted on in this sleep vote |
| 3140 | * register. |
| 3141 | */ |
| 3142 | writel_relaxed(0x0, GCC_REG_BASE(APCS_CLOCK_SLEEP_ENA_VOTE)); |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 3143 | } |
| 3144 | |
Syed Rameez Mustafa | 3971c14 | 2013-01-09 19:04:53 -0800 | [diff] [blame] | 3145 | static void __init msm8610_clock_post_init(void) |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 3146 | { |
| 3147 | /* |
| 3148 | * Hold an active set vote for CXO; this is because CXO is expected |
| 3149 | * to remain on whenever CPUs aren't power collapsed. |
| 3150 | */ |
| 3151 | clk_prepare_enable(&gcc_xo_a_clk_src.c); |
| 3152 | |
| 3153 | |
| 3154 | /* Set rates for single-rate clocks. */ |
| 3155 | clk_set_rate(&usb_hs_system_clk_src.c, |
| 3156 | usb_hs_system_clk_src.freq_tbl[0].freq_hz); |
| 3157 | clk_set_rate(&pdm2_clk_src.c, pdm2_clk_src.freq_tbl[0].freq_hz); |
| 3158 | clk_set_rate(&mclk0_clk_src.c, mclk0_clk_src.freq_tbl[0].freq_hz); |
| 3159 | clk_set_rate(&mclk1_clk_src.c, mclk1_clk_src.freq_tbl[0].freq_hz); |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 3160 | } |
| 3161 | |
Vikram Mulukutla | e03b4b6 | 2013-03-20 17:45:37 -0700 | [diff] [blame] | 3162 | static void dsi_init(void) |
| 3163 | { |
| 3164 | dsi_byte_clk_src_ops = clk_ops_rcg; |
| 3165 | dsi_byte_clk_src_ops.set_rate = set_rate_pixel_byte_clk; |
| 3166 | dsi_byte_clk_src_ops.handoff = byte_rcg_handoff; |
| 3167 | dsi_byte_clk_src_ops.get_parent = NULL; |
| 3168 | |
| 3169 | dsi_dsi_clk_src_ops = clk_ops_rcg_mnd; |
| 3170 | dsi_dsi_clk_src_ops.set_rate = set_rate_dsi_clk; |
| 3171 | dsi_dsi_clk_src_ops.handoff = pixel_rcg_handoff; |
| 3172 | dsi_dsi_clk_src_ops.get_parent = NULL; |
| 3173 | |
| 3174 | dsi_pixel_clk_src_ops = clk_ops_rcg_mnd; |
| 3175 | dsi_pixel_clk_src_ops.set_rate = set_rate_pixel_byte_clk; |
| 3176 | dsi_pixel_clk_src_ops.handoff = pixel_rcg_handoff; |
| 3177 | dsi_pixel_clk_src_ops.get_parent = NULL; |
| 3178 | |
| 3179 | dsi_clk_ctrl_init(&dsi_ahb_clk.c); |
| 3180 | } |
| 3181 | |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 3182 | #define GCC_CC_PHYS 0xFC400000 |
| 3183 | #define GCC_CC_SIZE SZ_16K |
| 3184 | |
| 3185 | #define MMSS_CC_PHYS 0xFD8C0000 |
| 3186 | #define MMSS_CC_SIZE SZ_256K |
| 3187 | |
| 3188 | #define LPASS_CC_PHYS 0xFE000000 |
| 3189 | #define LPASS_CC_SIZE SZ_256K |
| 3190 | |
| 3191 | #define APCS_GCC_CC_PHYS 0xF9011000 |
| 3192 | #define APCS_GCC_CC_SIZE SZ_4K |
| 3193 | |
Vikram Mulukutla | 4157cca | 2013-01-24 15:42:41 -0800 | [diff] [blame] | 3194 | #define APCS_KPSS_SH_PLL_PHYS 0xF9016000 |
| 3195 | #define APCS_KPSS_SH_PLL_SIZE SZ_64 |
| 3196 | |
Syed Rameez Mustafa | 3971c14 | 2013-01-09 19:04:53 -0800 | [diff] [blame] | 3197 | static void __init msm8610_clock_pre_init(void) |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 3198 | { |
| 3199 | virt_bases[GCC_BASE] = ioremap(GCC_CC_PHYS, GCC_CC_SIZE); |
| 3200 | if (!virt_bases[GCC_BASE]) |
Syed Rameez Mustafa | 3971c14 | 2013-01-09 19:04:53 -0800 | [diff] [blame] | 3201 | panic("clock-8610: Unable to ioremap GCC memory!"); |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 3202 | |
| 3203 | virt_bases[MMSS_BASE] = ioremap(MMSS_CC_PHYS, MMSS_CC_SIZE); |
| 3204 | if (!virt_bases[MMSS_BASE]) |
Syed Rameez Mustafa | 3971c14 | 2013-01-09 19:04:53 -0800 | [diff] [blame] | 3205 | panic("clock-8610: Unable to ioremap MMSS_CC memory!"); |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 3206 | |
| 3207 | virt_bases[LPASS_BASE] = ioremap(LPASS_CC_PHYS, LPASS_CC_SIZE); |
| 3208 | if (!virt_bases[LPASS_BASE]) |
Syed Rameez Mustafa | 3971c14 | 2013-01-09 19:04:53 -0800 | [diff] [blame] | 3209 | panic("clock-8610: Unable to ioremap LPASS_CC memory!"); |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 3210 | |
| 3211 | virt_bases[APCS_BASE] = ioremap(APCS_GCC_CC_PHYS, APCS_GCC_CC_SIZE); |
| 3212 | if (!virt_bases[APCS_BASE]) |
Syed Rameez Mustafa | 3971c14 | 2013-01-09 19:04:53 -0800 | [diff] [blame] | 3213 | panic("clock-8610: Unable to ioremap APCS_GCC_CC memory!"); |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 3214 | |
Vikram Mulukutla | 4157cca | 2013-01-24 15:42:41 -0800 | [diff] [blame] | 3215 | virt_bases[APCS_PLL_BASE] = ioremap(APCS_KPSS_SH_PLL_PHYS, |
| 3216 | APCS_KPSS_SH_PLL_SIZE); |
| 3217 | if (!virt_bases[APCS_PLL_BASE]) |
| 3218 | panic("clock-8610: Unable to ioremap APCS_GCC_CC memory!"); |
| 3219 | |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 3220 | clk_ops_local_pll.enable = sr_hpm_lp_pll_clk_enable; |
| 3221 | |
Patrick Daly | ebc26bc | 2013-02-05 11:49:07 -0800 | [diff] [blame] | 3222 | vdd_dig.regulator[0] = regulator_get(NULL, "vdd_dig"); |
| 3223 | if (IS_ERR(vdd_dig.regulator[0])) |
Syed Rameez Mustafa | 3971c14 | 2013-01-09 19:04:53 -0800 | [diff] [blame] | 3224 | panic("clock-8610: Unable to get the vdd_dig regulator!"); |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 3225 | |
Patrick Daly | ebc26bc | 2013-02-05 11:49:07 -0800 | [diff] [blame] | 3226 | vdd_sr2_pll.regulator[0] = regulator_get(NULL, "vdd_sr2_pll"); |
| 3227 | if (IS_ERR(vdd_sr2_pll.regulator[0])) |
Vikram Mulukutla | 4157cca | 2013-01-24 15:42:41 -0800 | [diff] [blame] | 3228 | panic("clock-8610: Unable to get the vdd_sr2_pll regulator!"); |
| 3229 | |
Patrick Daly | 6fb589a | 2013-03-29 17:55:55 -0700 | [diff] [blame] | 3230 | vdd_sr2_pll.regulator[1] = regulator_get(NULL, "vdd_sr2_dig"); |
| 3231 | if (IS_ERR(vdd_sr2_pll.regulator[1])) |
| 3232 | panic("clock-8610: Unable to get the vdd_sr2_dig regulator!"); |
| 3233 | |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 3234 | enable_rpm_scaling(); |
| 3235 | |
| 3236 | /* Enable a clock to allow access to MMSS clock registers */ |
| 3237 | clk_prepare_enable(&gcc_mmss_noc_cfg_ahb_clk.c), |
| 3238 | |
| 3239 | reg_init(); |
| 3240 | |
Vikram Mulukutla | e03b4b6 | 2013-03-20 17:45:37 -0700 | [diff] [blame] | 3241 | dsi_init(); |
| 3242 | |
Vikram Mulukutla | 82cb844 | 2013-01-28 13:36:51 -0800 | [diff] [blame] | 3243 | /* Maintain the max nominal frequency on the MMSSNOC AHB bus. */ |
| 3244 | clk_set_rate(&mmssnoc_ahb_a_clk.c, 40000000); |
| 3245 | clk_prepare_enable(&mmssnoc_ahb_a_clk.c); |
| 3246 | |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 3247 | /* TODO: Remove this once the bus driver is in place */ |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 3248 | clk_set_rate(&axi_clk_src.c, 200000000); |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 3249 | clk_prepare_enable(&mmss_s0_axi_clk.c); |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 3250 | } |
| 3251 | |
Syed Rameez Mustafa | 3971c14 | 2013-01-09 19:04:53 -0800 | [diff] [blame] | 3252 | struct clock_init_data msm8610_clock_init_data __initdata = { |
| 3253 | .table = msm_clocks_8610, |
| 3254 | .size = ARRAY_SIZE(msm_clocks_8610), |
| 3255 | .pre_init = msm8610_clock_pre_init, |
| 3256 | .post_init = msm8610_clock_post_init, |
Vikram Mulukutla | b13abe4 | 2012-10-03 11:38:48 -0700 | [diff] [blame] | 3257 | }; |