Pushkar Joshi | e0e8a7e | 2012-12-15 18:27:04 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -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/regulator/consumer.h> |
| 22 | #include <linux/iopoll.h> |
| 23 | |
| 24 | #include <mach/clk.h> |
| 25 | #include <mach/rpm-regulator-smd.h> |
| 26 | #include <mach/socinfo.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" |
| 33 | |
| 34 | enum { |
| 35 | GCC_BASE, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 36 | APCS_BASE, |
| 37 | APCS_PLL_BASE, |
| 38 | N_BASES, |
| 39 | }; |
| 40 | |
| 41 | static void __iomem *virt_bases[N_BASES]; |
| 42 | |
| 43 | #define GCC_REG_BASE(x) (void __iomem *)(virt_bases[GCC_BASE] + (x)) |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 44 | #define APCS_REG_BASE(x) (void __iomem *)(virt_bases[APCS_BASE] + (x)) |
| 45 | #define APCS_PLL_REG_BASE(x) (void __iomem *)(virt_bases[APCS_PLL_BASE] + (x)) |
| 46 | |
| 47 | /* GCC registers */ |
| 48 | #define GPLL0_MODE_REG 0x0000 |
| 49 | #define GPLL0_L_REG 0x0004 |
| 50 | #define GPLL0_M_REG 0x0008 |
| 51 | #define GPLL0_N_REG 0x000C |
| 52 | #define GPLL0_USER_CTL_REG 0x0010 |
| 53 | #define GPLL0_CONFIG_CTL_REG 0x0014 |
| 54 | #define GPLL0_TEST_CTL_REG 0x0018 |
| 55 | #define GPLL0_STATUS_REG 0x001C |
| 56 | |
| 57 | #define GPLL1_MODE_REG 0x0040 |
| 58 | #define GPLL1_L_REG 0x0044 |
| 59 | #define GPLL1_M_REG 0x0048 |
| 60 | #define GPLL1_N_REG 0x004C |
| 61 | #define GPLL1_USER_CTL_REG 0x0050 |
| 62 | #define GPLL1_CONFIG_CTL_REG 0x0054 |
| 63 | #define GPLL1_TEST_CTL_REG 0x0058 |
| 64 | #define GPLL1_STATUS_REG 0x005C |
| 65 | |
| 66 | #define GCC_DEBUG_CLK_CTL_REG 0x1880 |
| 67 | #define CLOCK_FRQ_MEASURE_CTL_REG 0x1884 |
| 68 | #define CLOCK_FRQ_MEASURE_STATUS_REG 0x1888 |
| 69 | #define GCC_PLLTEST_PAD_CFG_REG 0x188C |
| 70 | #define GCC_XO_DIV4_CBCR_REG 0x10C8 |
| 71 | #define APCS_GPLL_ENA_VOTE_REG 0x1480 |
| 72 | #define APCS_CLOCK_BRANCH_ENA_VOTE 0x1484 |
| 73 | #define APCS_CLOCK_SLEEP_ENA_VOTE 0x1488 |
| 74 | |
| 75 | #define APCS_CLK_DIAG_REG 0x001C |
| 76 | |
| 77 | #define APCS_CPU_PLL_MODE_REG 0x0000 |
| 78 | #define APCS_CPU_PLL_L_REG 0x0004 |
| 79 | #define APCS_CPU_PLL_M_REG 0x0008 |
| 80 | #define APCS_CPU_PLL_N_REG 0x000C |
| 81 | #define APCS_CPU_PLL_USER_CTL_REG 0x0010 |
| 82 | #define APCS_CPU_PLL_CONFIG_CTL_REG 0x0014 |
| 83 | #define APCS_CPU_PLL_TEST_CTL_REG 0x0018 |
| 84 | #define APCS_CPU_PLL_STATUS_REG 0x001C |
| 85 | |
| 86 | #define USB_HSIC_SYSTEM_CMD_RCGR 0x041C |
| 87 | #define USB_HSIC_XCVR_FS_CMD_RCGR 0x0424 |
| 88 | #define USB_HSIC_CMD_RCGR 0x0440 |
| 89 | #define USB_HSIC_IO_CAL_CMD_RCGR 0x0458 |
| 90 | #define USB_HS_SYSTEM_CMD_RCGR 0x0490 |
| 91 | #define SDCC2_APPS_CMD_RCGR 0x0510 |
| 92 | #define SDCC3_APPS_CMD_RCGR 0x0550 |
| 93 | #define BLSP1_QUP1_SPI_APPS_CMD_RCGR 0x064C |
Tianyi Gou | b1d1397 | 2013-01-23 22:55:22 -0800 | [diff] [blame] | 94 | #define BLSP1_QUP1_I2C_APPS_CMD_RCGR 0x0660 |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 95 | #define BLSP1_UART1_APPS_CMD_RCGR 0x068C |
| 96 | #define BLSP1_QUP2_SPI_APPS_CMD_RCGR 0x06CC |
Tianyi Gou | b1d1397 | 2013-01-23 22:55:22 -0800 | [diff] [blame] | 97 | #define BLSP1_QUP2_I2C_APPS_CMD_RCGR 0x06E0 |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 98 | #define BLSP1_UART2_APPS_CMD_RCGR 0x070C |
| 99 | #define BLSP1_QUP3_SPI_APPS_CMD_RCGR 0x074C |
Tianyi Gou | b1d1397 | 2013-01-23 22:55:22 -0800 | [diff] [blame] | 100 | #define BLSP1_QUP3_I2C_APPS_CMD_RCGR 0x0760 |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 101 | #define BLSP1_UART3_APPS_CMD_RCGR 0x078C |
| 102 | #define BLSP1_QUP4_SPI_APPS_CMD_RCGR 0x07CC |
Tianyi Gou | b1d1397 | 2013-01-23 22:55:22 -0800 | [diff] [blame] | 103 | #define BLSP1_QUP4_I2C_APPS_CMD_RCGR 0x07E0 |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 104 | #define BLSP1_UART4_APPS_CMD_RCGR 0x080C |
| 105 | #define BLSP1_QUP5_SPI_APPS_CMD_RCGR 0x084C |
Tianyi Gou | b1d1397 | 2013-01-23 22:55:22 -0800 | [diff] [blame] | 106 | #define BLSP1_QUP5_I2C_APPS_CMD_RCGR 0x0860 |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 107 | #define BLSP1_UART5_APPS_CMD_RCGR 0x088C |
| 108 | #define BLSP1_QUP6_SPI_APPS_CMD_RCGR 0x08CC |
Tianyi Gou | b1d1397 | 2013-01-23 22:55:22 -0800 | [diff] [blame] | 109 | #define BLSP1_QUP6_I2C_APPS_CMD_RCGR 0x08E0 |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 110 | #define BLSP1_UART6_APPS_CMD_RCGR 0x090C |
| 111 | #define PDM2_CMD_RCGR 0x0CD0 |
| 112 | #define CE1_CMD_RCGR 0x1050 |
| 113 | #define GP1_CMD_RCGR 0x1904 |
| 114 | #define GP2_CMD_RCGR 0x1944 |
| 115 | #define GP3_CMD_RCGR 0x1984 |
| 116 | #define QPIC_CMD_RCGR 0x1A50 |
| 117 | #define IPA_CMD_RCGR 0x1A90 |
| 118 | |
| 119 | #define USB_HS_HSIC_BCR 0x0400 |
| 120 | #define USB_HS_BCR 0x0480 |
| 121 | #define SDCC2_BCR 0x0500 |
| 122 | #define SDCC3_BCR 0x0540 |
| 123 | #define BLSP1_BCR 0x05C0 |
| 124 | #define BLSP1_QUP1_BCR 0x0640 |
| 125 | #define BLSP1_UART1_BCR 0x0680 |
| 126 | #define BLSP1_QUP2_BCR 0x06C0 |
| 127 | #define BLSP1_UART2_BCR 0x0700 |
| 128 | #define BLSP1_QUP3_BCR 0x0740 |
| 129 | #define BLSP1_UART3_BCR 0x0780 |
| 130 | #define BLSP1_QUP4_BCR 0x07C0 |
| 131 | #define BLSP1_UART4_BCR 0x0800 |
| 132 | #define BLSP1_QUP5_BCR 0x0840 |
| 133 | #define BLSP1_UART5_BCR 0x0880 |
| 134 | #define BLSP1_QUP6_BCR 0x08C0 |
| 135 | #define BLSP1_UART6_BCR 0x0900 |
| 136 | #define PDM_BCR 0x0CC0 |
| 137 | #define PRNG_BCR 0x0D00 |
| 138 | #define BAM_DMA_BCR 0x0D40 |
| 139 | #define BOOT_ROM_BCR 0x0E00 |
| 140 | #define CE1_BCR 0x1040 |
| 141 | #define QPIC_BCR 0x1040 |
| 142 | #define IPA_BCR 0x1A80 |
| 143 | |
| 144 | |
| 145 | #define SYS_NOC_IPA_AXI_CBCR 0x0128 |
| 146 | #define USB_HSIC_AHB_CBCR 0x0408 |
| 147 | #define USB_HSIC_SYSTEM_CBCR 0x040C |
| 148 | #define USB_HSIC_CBCR 0x0410 |
| 149 | #define USB_HSIC_IO_CAL_CBCR 0x0414 |
Tianyi Gou | 55b805b | 2013-02-28 21:46:03 -0800 | [diff] [blame] | 150 | #define USB_HSIC_IO_CAL_SLEEP_CBCR 0x0418 |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 151 | #define USB_HSIC_XCVR_FS_CBCR 0x042C |
| 152 | #define USB_HS_SYSTEM_CBCR 0x0484 |
| 153 | #define USB_HS_AHB_CBCR 0x0488 |
| 154 | #define SDCC2_APPS_CBCR 0x0504 |
| 155 | #define SDCC2_AHB_CBCR 0x0508 |
| 156 | #define SDCC3_APPS_CBCR 0x0544 |
| 157 | #define SDCC3_AHB_CBCR 0x0548 |
| 158 | #define BLSP1_AHB_CBCR 0x05C4 |
| 159 | #define BLSP1_QUP1_SPI_APPS_CBCR 0x0644 |
| 160 | #define BLSP1_QUP1_I2C_APPS_CBCR 0x0648 |
| 161 | #define BLSP1_UART1_APPS_CBCR 0x0684 |
| 162 | #define BLSP1_UART1_SIM_CBCR 0x0688 |
| 163 | #define BLSP1_QUP2_SPI_APPS_CBCR 0x06C4 |
| 164 | #define BLSP1_QUP2_I2C_APPS_CBCR 0x06C8 |
| 165 | #define BLSP1_UART2_APPS_CBCR 0x0704 |
| 166 | #define BLSP1_UART2_SIM_CBCR 0x0708 |
| 167 | #define BLSP1_QUP3_SPI_APPS_CBCR 0x0744 |
| 168 | #define BLSP1_QUP3_I2C_APPS_CBCR 0x0748 |
| 169 | #define BLSP1_UART3_APPS_CBCR 0x0784 |
| 170 | #define BLSP1_UART3_SIM_CBCR 0x0788 |
| 171 | #define BLSP1_QUP4_SPI_APPS_CBCR 0x07C4 |
| 172 | #define BLSP1_QUP4_I2C_APPS_CBCR 0x07C8 |
| 173 | #define BLSP1_UART4_APPS_CBCR 0x0804 |
| 174 | #define BLSP1_UART4_SIM_CBCR 0x0808 |
| 175 | #define BLSP1_QUP5_SPI_APPS_CBCR 0x0844 |
| 176 | #define BLSP1_QUP5_I2C_APPS_CBCR 0x0848 |
| 177 | #define BLSP1_UART5_APPS_CBCR 0x0884 |
| 178 | #define BLSP1_UART5_SIM_CBCR 0x0888 |
| 179 | #define BLSP1_QUP6_SPI_APPS_CBCR 0x08C4 |
| 180 | #define BLSP1_QUP6_I2C_APPS_CBCR 0x08C8 |
| 181 | #define BLSP1_UART6_APPS_CBCR 0x0904 |
| 182 | #define BLSP1_UART6_SIM_CBCR 0x0908 |
| 183 | #define BOOT_ROM_AHB_CBCR 0x0E04 |
| 184 | #define PDM_AHB_CBCR 0x0CC4 |
| 185 | #define PDM_XO4_CBCR 0x0CC8 |
| 186 | #define PDM_AHB_CBCR 0x0CC4 |
| 187 | #define PDM_XO4_CBCR 0x0CC8 |
| 188 | #define PDM2_CBCR 0x0CCC |
| 189 | #define PRNG_AHB_CBCR 0x0D04 |
| 190 | #define BAM_DMA_AHB_CBCR 0x0D44 |
Tianyi Gou | 55b805b | 2013-02-28 21:46:03 -0800 | [diff] [blame] | 191 | #define BAM_DMA_INACTIVITY_TIMERS_CBCR 0x0D48 |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 192 | #define MSG_RAM_AHB_CBCR 0x0E44 |
| 193 | #define CE1_CBCR 0x1044 |
| 194 | #define CE1_AXI_CBCR 0x1048 |
| 195 | #define CE1_AHB_CBCR 0x104C |
| 196 | #define GCC_AHB_CBCR 0x10C0 |
| 197 | #define GP1_CBCR 0x1900 |
| 198 | #define GP2_CBCR 0x1940 |
| 199 | #define GP3_CBCR 0x1980 |
| 200 | #define QPIC_CBCR 0x1A44 |
| 201 | #define QPIC_AHB_CBCR 0x1A48 |
| 202 | #define IPA_CBCR 0x1A84 |
| 203 | #define IPA_CNOC_CBCR 0x1A88 |
| 204 | #define IPA_SLEEP_CBCR 0x1A8C |
| 205 | |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 206 | /* Mux source select values */ |
| 207 | #define cxo_source_val 0 |
| 208 | #define gpll0_source_val 1 |
| 209 | #define gpll1_hsic_source_val 4 |
| 210 | #define gnd_source_val 5 |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 211 | |
Vikram Mulukutla | d3dca65 | 2012-11-19 11:04:13 -0800 | [diff] [blame] | 212 | #define F_GCC_GND \ |
| 213 | { \ |
| 214 | .freq_hz = 0, \ |
| 215 | .m_val = 0, \ |
| 216 | .n_val = 0, \ |
| 217 | .div_src_val = BVAL(4, 0, 1) | BVAL(10, 8, gnd_source_val), \ |
| 218 | } |
| 219 | |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 220 | #define F(f, s, div, m, n) \ |
| 221 | { \ |
| 222 | .freq_hz = (f), \ |
| 223 | .src_clk = &s##_clk_src.c, \ |
| 224 | .m_val = (m), \ |
| 225 | .n_val = ~((n)-(m)) * !!(n), \ |
| 226 | .d_val = ~(n),\ |
| 227 | .div_src_val = BVAL(4, 0, (int)(2*(div) - 1)) \ |
| 228 | | BVAL(10, 8, s##_source_val), \ |
| 229 | } |
| 230 | |
| 231 | #define F_HSIC(f, s, div, m, n) \ |
| 232 | { \ |
| 233 | .freq_hz = (f), \ |
| 234 | .src_clk = &s##_clk_src.c, \ |
| 235 | .m_val = (m), \ |
| 236 | .n_val = ~((n)-(m)) * !!(n), \ |
| 237 | .d_val = ~(n),\ |
| 238 | .div_src_val = BVAL(4, 0, (int)(2*(div) - 1)) \ |
| 239 | | BVAL(10, 8, s##_hsic_source_val), \ |
| 240 | } |
| 241 | |
Tianyi Gou | a717ddd | 2012-10-05 17:06:24 -0700 | [diff] [blame] | 242 | #define F_APCS_PLL(f, l, m, n, pre_div, post_div, vco) \ |
| 243 | { \ |
| 244 | .freq_hz = (f), \ |
| 245 | .l_val = (l), \ |
| 246 | .m_val = (m), \ |
| 247 | .n_val = (n), \ |
| 248 | .pre_div_val = BVAL(14, 12, (pre_div)), \ |
| 249 | .post_div_val = BVAL(9, 8, (post_div)), \ |
| 250 | .vco_val = BVAL(21, 20, (vco)), \ |
| 251 | } |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 252 | |
| 253 | #define VDD_DIG_FMAX_MAP1(l1, f1) \ |
Saravana Kannan | 55e959d | 2012-10-15 22:16:04 -0700 | [diff] [blame] | 254 | .vdd_class = &vdd_dig, \ |
| 255 | .fmax = (unsigned long[VDD_DIG_NUM]) { \ |
| 256 | [VDD_DIG_##l1] = (f1), \ |
| 257 | }, \ |
| 258 | .num_fmax = VDD_DIG_NUM |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 259 | #define VDD_DIG_FMAX_MAP2(l1, f1, l2, f2) \ |
Saravana Kannan | 55e959d | 2012-10-15 22:16:04 -0700 | [diff] [blame] | 260 | .vdd_class = &vdd_dig, \ |
| 261 | .fmax = (unsigned long[VDD_DIG_NUM]) { \ |
| 262 | [VDD_DIG_##l1] = (f1), \ |
| 263 | [VDD_DIG_##l2] = (f2), \ |
| 264 | }, \ |
| 265 | .num_fmax = VDD_DIG_NUM |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 266 | #define VDD_DIG_FMAX_MAP3(l1, f1, l2, f2, l3, f3) \ |
Saravana Kannan | 55e959d | 2012-10-15 22:16:04 -0700 | [diff] [blame] | 267 | .vdd_class = &vdd_dig, \ |
| 268 | .fmax = (unsigned long[VDD_DIG_NUM]) { \ |
| 269 | [VDD_DIG_##l1] = (f1), \ |
| 270 | [VDD_DIG_##l2] = (f2), \ |
| 271 | [VDD_DIG_##l3] = (f3), \ |
| 272 | }, \ |
| 273 | .num_fmax = VDD_DIG_NUM |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 274 | |
| 275 | enum vdd_dig_levels { |
| 276 | VDD_DIG_NONE, |
| 277 | VDD_DIG_LOW, |
| 278 | VDD_DIG_NOMINAL, |
Saravana Kannan | 55e959d | 2012-10-15 22:16:04 -0700 | [diff] [blame] | 279 | VDD_DIG_HIGH, |
| 280 | VDD_DIG_NUM |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 281 | }; |
| 282 | |
Patrick Daly | ebc26bc | 2013-02-05 11:49:07 -0800 | [diff] [blame] | 283 | static const int *vdd_corner[] = { |
| 284 | [VDD_DIG_NONE] = VDD_UV(RPM_REGULATOR_CORNER_NONE), |
| 285 | [VDD_DIG_LOW] = VDD_UV(RPM_REGULATOR_CORNER_SVS_SOC), |
| 286 | [VDD_DIG_NOMINAL] = VDD_UV(RPM_REGULATOR_CORNER_NORMAL), |
| 287 | [VDD_DIG_HIGH] = VDD_UV(RPM_REGULATOR_CORNER_SUPER_TURBO), |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 288 | }; |
| 289 | |
Patrick Daly | ebc26bc | 2013-02-05 11:49:07 -0800 | [diff] [blame] | 290 | static DEFINE_VDD_REGULATORS(vdd_dig, VDD_DIG_NUM, 1, vdd_corner); |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 291 | |
| 292 | /* TODO: Needs to confirm the below values */ |
| 293 | #define RPM_MISC_CLK_TYPE 0x306b6c63 |
| 294 | #define RPM_BUS_CLK_TYPE 0x316b6c63 |
| 295 | #define RPM_MEM_CLK_TYPE 0x326b6c63 |
| 296 | |
| 297 | #define RPM_SMD_KEY_ENABLE 0x62616E45 |
| 298 | |
| 299 | #define CXO_ID 0x0 |
| 300 | #define QDSS_ID 0x1 |
| 301 | |
| 302 | #define PNOC_ID 0x0 |
| 303 | #define SNOC_ID 0x1 |
| 304 | #define CNOC_ID 0x2 |
| 305 | |
| 306 | #define BIMC_ID 0x0 |
| 307 | |
| 308 | #define D0_ID 1 |
| 309 | #define D1_ID 2 |
| 310 | #define A0_ID 3 |
| 311 | #define A1_ID 4 |
| 312 | #define A2_ID 5 |
| 313 | |
| 314 | DEFINE_CLK_RPM_SMD_BRANCH(cxo_clk_src, cxo_a_clk_src, |
| 315 | RPM_MISC_CLK_TYPE, CXO_ID, 19200000); |
| 316 | |
| 317 | DEFINE_CLK_RPM_SMD(cnoc_clk, cnoc_a_clk, RPM_BUS_CLK_TYPE, CNOC_ID, NULL); |
| 318 | DEFINE_CLK_RPM_SMD(pnoc_clk, pnoc_a_clk, RPM_BUS_CLK_TYPE, PNOC_ID, NULL); |
| 319 | DEFINE_CLK_RPM_SMD(snoc_clk, snoc_a_clk, RPM_BUS_CLK_TYPE, SNOC_ID, NULL); |
| 320 | |
| 321 | DEFINE_CLK_RPM_SMD(bimc_clk, bimc_a_clk, RPM_MEM_CLK_TYPE, BIMC_ID, NULL); |
| 322 | |
| 323 | DEFINE_CLK_RPM_SMD_QDSS(qdss_clk, qdss_a_clk, RPM_MISC_CLK_TYPE, QDSS_ID); |
| 324 | |
| 325 | DEFINE_CLK_RPM_SMD_XO_BUFFER(cxo_d0, cxo_d0_a, D0_ID); |
| 326 | DEFINE_CLK_RPM_SMD_XO_BUFFER(cxo_d1, cxo_d1_a, D1_ID); |
| 327 | DEFINE_CLK_RPM_SMD_XO_BUFFER(cxo_a0, cxo_a0_a, A0_ID); |
| 328 | DEFINE_CLK_RPM_SMD_XO_BUFFER(cxo_a1, cxo_a1_a, A1_ID); |
| 329 | DEFINE_CLK_RPM_SMD_XO_BUFFER(cxo_a2, cxo_a2_a, A2_ID); |
| 330 | |
| 331 | DEFINE_CLK_RPM_SMD_XO_BUFFER_PINCTRL(cxo_d0_pin, cxo_d0_a_pin, D0_ID); |
| 332 | DEFINE_CLK_RPM_SMD_XO_BUFFER_PINCTRL(cxo_d1_pin, cxo_d1_a_pin, D1_ID); |
| 333 | DEFINE_CLK_RPM_SMD_XO_BUFFER_PINCTRL(cxo_a0_pin, cxo_a0_a_pin, A0_ID); |
| 334 | DEFINE_CLK_RPM_SMD_XO_BUFFER_PINCTRL(cxo_a1_pin, cxo_a1_a_pin, A1_ID); |
| 335 | DEFINE_CLK_RPM_SMD_XO_BUFFER_PINCTRL(cxo_a2_pin, cxo_a2_a_pin, A2_ID); |
| 336 | |
Tianyi Gou | 27df1bb | 2012-10-11 14:44:01 -0700 | [diff] [blame] | 337 | static unsigned int soft_vote_gpll0; |
| 338 | |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 339 | static struct pll_vote_clk gpll0_clk_src = { |
| 340 | .en_reg = (void __iomem *)APCS_GPLL_ENA_VOTE_REG, |
Tianyi Gou | 2aee465 | 2013-03-11 19:15:22 -0700 | [diff] [blame] | 341 | .en_mask = BIT(0), |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 342 | .status_reg = (void __iomem *)GPLL0_STATUS_REG, |
| 343 | .status_mask = BIT(17), |
Tianyi Gou | 27df1bb | 2012-10-11 14:44:01 -0700 | [diff] [blame] | 344 | .soft_vote = &soft_vote_gpll0, |
| 345 | .soft_vote_mask = PLL_SOFT_VOTE_PRIMARY, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 346 | .base = &virt_bases[GCC_BASE], |
| 347 | .c = { |
Saravana Kannan | 7a6532e | 2012-10-18 20:51:13 -0700 | [diff] [blame] | 348 | .parent = &cxo_clk_src.c, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 349 | .rate = 600000000, |
| 350 | .dbg_name = "gpll0_clk_src", |
Tianyi Gou | 27df1bb | 2012-10-11 14:44:01 -0700 | [diff] [blame] | 351 | .ops = &clk_ops_pll_acpu_vote, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 352 | CLK_INIT(gpll0_clk_src.c), |
| 353 | }, |
| 354 | }; |
| 355 | |
Tianyi Gou | 27df1bb | 2012-10-11 14:44:01 -0700 | [diff] [blame] | 356 | static struct pll_vote_clk gpll0_activeonly_clk_src = { |
| 357 | .en_reg = (void __iomem *)APCS_GPLL_ENA_VOTE_REG, |
Tianyi Gou | 2aee465 | 2013-03-11 19:15:22 -0700 | [diff] [blame] | 358 | .en_mask = BIT(0), |
Tianyi Gou | 27df1bb | 2012-10-11 14:44:01 -0700 | [diff] [blame] | 359 | .status_reg = (void __iomem *)GPLL0_STATUS_REG, |
| 360 | .status_mask = BIT(17), |
| 361 | .soft_vote = &soft_vote_gpll0, |
| 362 | .soft_vote_mask = PLL_SOFT_VOTE_ACPU, |
| 363 | .base = &virt_bases[GCC_BASE], |
| 364 | .c = { |
| 365 | .rate = 600000000, |
| 366 | .dbg_name = "gpll0_activeonly_clk_src", |
| 367 | .ops = &clk_ops_pll_acpu_vote, |
| 368 | CLK_INIT(gpll0_activeonly_clk_src.c), |
| 369 | }, |
| 370 | }; |
| 371 | |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 372 | static struct pll_vote_clk gpll1_clk_src = { |
| 373 | .en_reg = (void __iomem *)APCS_GPLL_ENA_VOTE_REG, |
| 374 | .en_mask = BIT(1), |
| 375 | .status_reg = (void __iomem *)GPLL1_STATUS_REG, |
| 376 | .status_mask = BIT(17), |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 377 | .base = &virt_bases[GCC_BASE], |
| 378 | .c = { |
Saravana Kannan | 7a6532e | 2012-10-18 20:51:13 -0700 | [diff] [blame] | 379 | .parent = &cxo_clk_src.c, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 380 | .rate = 480000000, |
| 381 | .dbg_name = "gpll1_clk_src", |
| 382 | .ops = &clk_ops_pll_vote, |
| 383 | CLK_INIT(gpll1_clk_src.c), |
| 384 | }, |
| 385 | }; |
| 386 | |
Tianyi Gou | a717ddd | 2012-10-05 17:06:24 -0700 | [diff] [blame] | 387 | static struct pll_freq_tbl apcs_pll_freq[] = { |
| 388 | F_APCS_PLL(748800000, 0x27, 0x0, 0x1, 0x0, 0x0, 0x0), |
| 389 | F_APCS_PLL(998400000, 0x34, 0x0, 0x1, 0x0, 0x0, 0x0), |
| 390 | PLL_F_END |
| 391 | }; |
| 392 | |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 393 | /* |
| 394 | * Need to skip handoff of the acpu pll to avoid handoff code |
| 395 | * to turn off the pll when the acpu is running off this pll. |
| 396 | */ |
| 397 | static struct pll_clk apcspll_clk_src = { |
| 398 | .mode_reg = (void __iomem *)APCS_CPU_PLL_MODE_REG, |
Tianyi Gou | a717ddd | 2012-10-05 17:06:24 -0700 | [diff] [blame] | 399 | .l_reg = (void __iomem *)APCS_CPU_PLL_L_REG, |
| 400 | .m_reg = (void __iomem *)APCS_CPU_PLL_M_REG, |
| 401 | .n_reg = (void __iomem *)APCS_CPU_PLL_N_REG, |
| 402 | .config_reg = (void __iomem *)APCS_CPU_PLL_USER_CTL_REG, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 403 | .status_reg = (void __iomem *)APCS_CPU_PLL_STATUS_REG, |
Tianyi Gou | a717ddd | 2012-10-05 17:06:24 -0700 | [diff] [blame] | 404 | .freq_tbl = apcs_pll_freq, |
| 405 | .masks = { |
| 406 | .vco_mask = BM(21, 20), |
| 407 | .pre_div_mask = BM(14, 12), |
| 408 | .post_div_mask = BM(9, 8), |
| 409 | .mn_en_mask = BIT(24), |
| 410 | .main_output_mask = BIT(0), |
| 411 | }, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 412 | .base = &virt_bases[APCS_PLL_BASE], |
| 413 | .c = { |
Patrick Daly | 9bdc8a5 | 2013-03-21 19:12:40 -0700 | [diff] [blame] | 414 | .parent = &cxo_a_clk_src.c, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 415 | .dbg_name = "apcspll_clk_src", |
| 416 | .ops = &clk_ops_local_pll, |
| 417 | CLK_INIT(apcspll_clk_src.c), |
| 418 | .flags = CLKFLAG_SKIP_HANDOFF, |
| 419 | }, |
| 420 | }; |
| 421 | |
| 422 | static DEFINE_CLK_VOTER(pnoc_msmbus_clk, &pnoc_clk.c, LONG_MAX); |
| 423 | static DEFINE_CLK_VOTER(snoc_msmbus_clk, &snoc_clk.c, LONG_MAX); |
| 424 | static DEFINE_CLK_VOTER(cnoc_msmbus_clk, &cnoc_clk.c, LONG_MAX); |
| 425 | static DEFINE_CLK_VOTER(pnoc_msmbus_a_clk, &pnoc_a_clk.c, LONG_MAX); |
| 426 | static DEFINE_CLK_VOTER(snoc_msmbus_a_clk, &snoc_a_clk.c, LONG_MAX); |
| 427 | static DEFINE_CLK_VOTER(cnoc_msmbus_a_clk, &cnoc_a_clk.c, LONG_MAX); |
| 428 | |
| 429 | static DEFINE_CLK_VOTER(bimc_msmbus_clk, &bimc_clk.c, LONG_MAX); |
| 430 | static DEFINE_CLK_VOTER(bimc_msmbus_a_clk, &bimc_a_clk.c, LONG_MAX); |
| 431 | |
| 432 | static DEFINE_CLK_VOTER(pnoc_sdcc2_clk, &pnoc_clk.c, LONG_MAX); |
| 433 | static DEFINE_CLK_VOTER(pnoc_sdcc3_clk, &pnoc_clk.c, LONG_MAX); |
| 434 | |
| 435 | static DEFINE_CLK_VOTER(pnoc_sps_clk, &pnoc_clk.c, LONG_MAX); |
| 436 | |
| 437 | static struct clk_freq_tbl ftbl_gcc_ipa_clk[] = { |
| 438 | F( 50000000, gpll0, 12, 0, 0), |
| 439 | F( 92310000, gpll0, 6.5, 0, 0), |
| 440 | F(100000000, gpll0, 6, 0, 0), |
| 441 | F_END |
| 442 | }; |
| 443 | |
| 444 | static struct rcg_clk ipa_clk_src = { |
| 445 | .cmd_rcgr_reg = IPA_CMD_RCGR, |
| 446 | .set_rate = set_rate_mnd, |
| 447 | .freq_tbl = ftbl_gcc_ipa_clk, |
| 448 | .current_freq = &rcg_dummy_freq, |
| 449 | .base = &virt_bases[GCC_BASE], |
| 450 | .c = { |
| 451 | .dbg_name = "ipa_clk_src", |
| 452 | .ops = &clk_ops_rcg_mnd, |
| 453 | VDD_DIG_FMAX_MAP2(LOW, 50000000, NOMINAL, 100000000), |
| 454 | CLK_INIT(ipa_clk_src.c) |
| 455 | }, |
| 456 | }; |
| 457 | |
Tianyi Gou | b1d1397 | 2013-01-23 22:55:22 -0800 | [diff] [blame] | 458 | static struct clk_freq_tbl ftbl_gcc_blsp1_qup1_6_i2c_apps_clk[] = { |
| 459 | F(19200000, cxo, 1, 0, 0), |
| 460 | F(50000000, gpll0, 12, 0, 0), |
| 461 | F_END |
| 462 | }; |
| 463 | |
| 464 | static struct rcg_clk blsp1_qup1_i2c_apps_clk_src = { |
| 465 | .cmd_rcgr_reg = BLSP1_QUP1_I2C_APPS_CMD_RCGR, |
| 466 | .set_rate = set_rate_hid, |
| 467 | .freq_tbl = ftbl_gcc_blsp1_qup1_6_i2c_apps_clk, |
| 468 | .current_freq = &rcg_dummy_freq, |
| 469 | .base = &virt_bases[GCC_BASE], |
| 470 | .c = { |
| 471 | .dbg_name = "blsp1_qup1_i2c_apps_clk_src", |
| 472 | .ops = &clk_ops_rcg, |
| 473 | VDD_DIG_FMAX_MAP1(LOW, 50000000), |
| 474 | CLK_INIT(blsp1_qup1_i2c_apps_clk_src.c), |
| 475 | }, |
| 476 | }; |
| 477 | |
| 478 | static struct rcg_clk blsp1_qup2_i2c_apps_clk_src = { |
| 479 | .cmd_rcgr_reg = BLSP1_QUP2_I2C_APPS_CMD_RCGR, |
| 480 | .set_rate = set_rate_hid, |
| 481 | .freq_tbl = ftbl_gcc_blsp1_qup1_6_i2c_apps_clk, |
| 482 | .current_freq = &rcg_dummy_freq, |
| 483 | .base = &virt_bases[GCC_BASE], |
| 484 | .c = { |
| 485 | .dbg_name = "blsp1_qup2_i2c_apps_clk_src", |
| 486 | .ops = &clk_ops_rcg, |
| 487 | VDD_DIG_FMAX_MAP1(LOW, 50000000), |
| 488 | CLK_INIT(blsp1_qup2_i2c_apps_clk_src.c), |
| 489 | }, |
| 490 | }; |
| 491 | |
| 492 | static struct rcg_clk blsp1_qup3_i2c_apps_clk_src = { |
| 493 | .cmd_rcgr_reg = BLSP1_QUP3_I2C_APPS_CMD_RCGR, |
| 494 | .set_rate = set_rate_hid, |
| 495 | .freq_tbl = ftbl_gcc_blsp1_qup1_6_i2c_apps_clk, |
| 496 | .current_freq = &rcg_dummy_freq, |
| 497 | .base = &virt_bases[GCC_BASE], |
| 498 | .c = { |
| 499 | .dbg_name = "blsp1_qup3_i2c_apps_clk_src", |
| 500 | .ops = &clk_ops_rcg, |
| 501 | VDD_DIG_FMAX_MAP1(LOW, 50000000), |
| 502 | CLK_INIT(blsp1_qup3_i2c_apps_clk_src.c), |
| 503 | }, |
| 504 | }; |
| 505 | |
| 506 | static struct rcg_clk blsp1_qup4_i2c_apps_clk_src = { |
| 507 | .cmd_rcgr_reg = BLSP1_QUP4_I2C_APPS_CMD_RCGR, |
| 508 | .set_rate = set_rate_hid, |
| 509 | .freq_tbl = ftbl_gcc_blsp1_qup1_6_i2c_apps_clk, |
| 510 | .current_freq = &rcg_dummy_freq, |
| 511 | .base = &virt_bases[GCC_BASE], |
| 512 | .c = { |
| 513 | .dbg_name = "blsp1_qup4_i2c_apps_clk_src", |
| 514 | .ops = &clk_ops_rcg, |
| 515 | VDD_DIG_FMAX_MAP1(LOW, 50000000), |
| 516 | CLK_INIT(blsp1_qup4_i2c_apps_clk_src.c), |
| 517 | }, |
| 518 | }; |
| 519 | |
| 520 | static struct rcg_clk blsp1_qup5_i2c_apps_clk_src = { |
| 521 | .cmd_rcgr_reg = BLSP1_QUP5_I2C_APPS_CMD_RCGR, |
| 522 | .set_rate = set_rate_hid, |
| 523 | .freq_tbl = ftbl_gcc_blsp1_qup1_6_i2c_apps_clk, |
| 524 | .current_freq = &rcg_dummy_freq, |
| 525 | .base = &virt_bases[GCC_BASE], |
| 526 | .c = { |
| 527 | .dbg_name = "blsp1_qup5_i2c_apps_clk_src", |
| 528 | .ops = &clk_ops_rcg, |
| 529 | VDD_DIG_FMAX_MAP1(LOW, 50000000), |
| 530 | CLK_INIT(blsp1_qup5_i2c_apps_clk_src.c), |
| 531 | }, |
| 532 | }; |
| 533 | |
| 534 | static struct rcg_clk blsp1_qup6_i2c_apps_clk_src = { |
| 535 | .cmd_rcgr_reg = BLSP1_QUP6_I2C_APPS_CMD_RCGR, |
| 536 | .set_rate = set_rate_hid, |
| 537 | .freq_tbl = ftbl_gcc_blsp1_qup1_6_i2c_apps_clk, |
| 538 | .current_freq = &rcg_dummy_freq, |
| 539 | .base = &virt_bases[GCC_BASE], |
| 540 | .c = { |
| 541 | .dbg_name = "blsp1_qup6_i2c_apps_clk_src", |
| 542 | .ops = &clk_ops_rcg, |
| 543 | VDD_DIG_FMAX_MAP1(LOW, 50000000), |
| 544 | CLK_INIT(blsp1_qup6_i2c_apps_clk_src.c), |
| 545 | }, |
| 546 | }; |
| 547 | |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 548 | static struct clk_freq_tbl ftbl_gcc_blsp1_qup1_6_spi_apps_clk[] = { |
| 549 | F( 960000, cxo, 10, 1, 2), |
| 550 | F( 4800000, cxo, 4, 0, 0), |
| 551 | F( 9600000, cxo, 2, 0, 0), |
| 552 | F(15000000, gpll0, 10, 1, 4), |
| 553 | F(19200000, cxo, 1, 0, 0), |
| 554 | F(25000000, gpll0, 12, 1, 2), |
| 555 | F(50000000, gpll0, 12, 0, 0), |
| 556 | F_END |
| 557 | }; |
| 558 | |
| 559 | static struct rcg_clk blsp1_qup1_spi_apps_clk_src = { |
| 560 | .cmd_rcgr_reg = BLSP1_QUP1_SPI_APPS_CMD_RCGR, |
| 561 | .set_rate = set_rate_mnd, |
| 562 | .freq_tbl = ftbl_gcc_blsp1_qup1_6_spi_apps_clk, |
| 563 | .current_freq = &rcg_dummy_freq, |
| 564 | .base = &virt_bases[GCC_BASE], |
| 565 | .c = { |
| 566 | .dbg_name = "blsp1_qup1_spi_apps_clk_src", |
| 567 | .ops = &clk_ops_rcg_mnd, |
| 568 | VDD_DIG_FMAX_MAP2(LOW, 25000000, NOMINAL, 50000000), |
| 569 | CLK_INIT(blsp1_qup1_spi_apps_clk_src.c) |
| 570 | }, |
| 571 | }; |
| 572 | |
| 573 | static struct rcg_clk blsp1_qup2_spi_apps_clk_src = { |
| 574 | .cmd_rcgr_reg = BLSP1_QUP2_SPI_APPS_CMD_RCGR, |
| 575 | .set_rate = set_rate_mnd, |
| 576 | .freq_tbl = ftbl_gcc_blsp1_qup1_6_spi_apps_clk, |
| 577 | .current_freq = &rcg_dummy_freq, |
| 578 | .base = &virt_bases[GCC_BASE], |
| 579 | .c = { |
| 580 | .dbg_name = "blsp1_qup2_spi_apps_clk_src", |
| 581 | .ops = &clk_ops_rcg_mnd, |
| 582 | VDD_DIG_FMAX_MAP2(LOW, 25000000, NOMINAL, 50000000), |
| 583 | CLK_INIT(blsp1_qup2_spi_apps_clk_src.c) |
| 584 | }, |
| 585 | }; |
| 586 | |
| 587 | static struct rcg_clk blsp1_qup3_spi_apps_clk_src = { |
| 588 | .cmd_rcgr_reg = BLSP1_QUP3_SPI_APPS_CMD_RCGR, |
| 589 | .set_rate = set_rate_mnd, |
| 590 | .freq_tbl = ftbl_gcc_blsp1_qup1_6_spi_apps_clk, |
| 591 | .current_freq = &rcg_dummy_freq, |
| 592 | .base = &virt_bases[GCC_BASE], |
| 593 | .c = { |
| 594 | .dbg_name = "blsp1_qup3_spi_apps_clk_src", |
| 595 | .ops = &clk_ops_rcg_mnd, |
| 596 | VDD_DIG_FMAX_MAP2(LOW, 25000000, NOMINAL, 50000000), |
| 597 | CLK_INIT(blsp1_qup3_spi_apps_clk_src.c) |
| 598 | }, |
| 599 | }; |
| 600 | |
| 601 | static struct rcg_clk blsp1_qup4_spi_apps_clk_src = { |
| 602 | .cmd_rcgr_reg = BLSP1_QUP4_SPI_APPS_CMD_RCGR, |
| 603 | .set_rate = set_rate_mnd, |
| 604 | .freq_tbl = ftbl_gcc_blsp1_qup1_6_spi_apps_clk, |
| 605 | .current_freq = &rcg_dummy_freq, |
| 606 | .base = &virt_bases[GCC_BASE], |
| 607 | .c = { |
| 608 | .dbg_name = "blsp1_qup4_spi_apps_clk_src", |
| 609 | .ops = &clk_ops_rcg_mnd, |
| 610 | VDD_DIG_FMAX_MAP2(LOW, 25000000, NOMINAL, 50000000), |
| 611 | CLK_INIT(blsp1_qup4_spi_apps_clk_src.c) |
| 612 | }, |
| 613 | }; |
| 614 | |
| 615 | static struct rcg_clk blsp1_qup5_spi_apps_clk_src = { |
| 616 | .cmd_rcgr_reg = BLSP1_QUP5_SPI_APPS_CMD_RCGR, |
| 617 | .set_rate = set_rate_mnd, |
| 618 | .freq_tbl = ftbl_gcc_blsp1_qup1_6_spi_apps_clk, |
| 619 | .current_freq = &rcg_dummy_freq, |
| 620 | .base = &virt_bases[GCC_BASE], |
| 621 | .c = { |
| 622 | .dbg_name = "blsp1_qup5_spi_apps_clk_src", |
| 623 | .ops = &clk_ops_rcg_mnd, |
| 624 | VDD_DIG_FMAX_MAP2(LOW, 25000000, NOMINAL, 50000000), |
| 625 | CLK_INIT(blsp1_qup5_spi_apps_clk_src.c) |
| 626 | }, |
| 627 | }; |
| 628 | |
| 629 | static struct rcg_clk blsp1_qup6_spi_apps_clk_src = { |
| 630 | .cmd_rcgr_reg = BLSP1_QUP6_SPI_APPS_CMD_RCGR, |
| 631 | .set_rate = set_rate_mnd, |
| 632 | .freq_tbl = ftbl_gcc_blsp1_qup1_6_spi_apps_clk, |
| 633 | .current_freq = &rcg_dummy_freq, |
| 634 | .base = &virt_bases[GCC_BASE], |
| 635 | .c = { |
| 636 | .dbg_name = "blsp1_qup6_spi_apps_clk_src", |
| 637 | .ops = &clk_ops_rcg_mnd, |
| 638 | VDD_DIG_FMAX_MAP2(LOW, 25000000, NOMINAL, 50000000), |
| 639 | CLK_INIT(blsp1_qup6_spi_apps_clk_src.c) |
| 640 | }, |
| 641 | }; |
| 642 | |
| 643 | static struct clk_freq_tbl ftbl_gcc_blsp1_uart1_6_apps_clk[] = { |
Vikram Mulukutla | d3dca65 | 2012-11-19 11:04:13 -0800 | [diff] [blame] | 644 | F_GCC_GND, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 645 | F( 3686400, gpll0, 1, 96, 15625), |
| 646 | F( 7372800, gpll0, 1, 192, 15625), |
| 647 | F(14745600, gpll0, 1, 384, 15625), |
| 648 | F(16000000, gpll0, 5, 2, 15), |
| 649 | F(19200000, cxo, 1, 0, 0), |
| 650 | F(24000000, gpll0, 5, 1, 5), |
| 651 | F(32000000, gpll0, 1, 4, 75), |
| 652 | F(40000000, gpll0, 15, 0, 0), |
| 653 | F(46400000, gpll0, 1, 29, 375), |
| 654 | F(48000000, gpll0, 12.5, 0, 0), |
| 655 | F(51200000, gpll0, 1, 32, 375), |
| 656 | F(56000000, gpll0, 1, 7, 75), |
| 657 | F(58982400, gpll0, 1, 1536, 15625), |
| 658 | F(60000000, gpll0, 10, 0, 0), |
| 659 | F_END |
| 660 | }; |
| 661 | |
| 662 | static struct rcg_clk blsp1_uart1_apps_clk_src = { |
| 663 | .cmd_rcgr_reg = BLSP1_UART1_APPS_CMD_RCGR, |
| 664 | .set_rate = set_rate_mnd, |
| 665 | .freq_tbl = ftbl_gcc_blsp1_uart1_6_apps_clk, |
| 666 | .current_freq = &rcg_dummy_freq, |
| 667 | .base = &virt_bases[GCC_BASE], |
| 668 | .c = { |
| 669 | .dbg_name = "blsp1_uart1_apps_clk_src", |
| 670 | .ops = &clk_ops_rcg_mnd, |
| 671 | VDD_DIG_FMAX_MAP2(LOW, 31580000, NOMINAL, 63160000), |
| 672 | CLK_INIT(blsp1_uart1_apps_clk_src.c) |
| 673 | }, |
| 674 | }; |
| 675 | |
| 676 | static struct rcg_clk blsp1_uart2_apps_clk_src = { |
| 677 | .cmd_rcgr_reg = BLSP1_UART2_APPS_CMD_RCGR, |
| 678 | .set_rate = set_rate_mnd, |
| 679 | .freq_tbl = ftbl_gcc_blsp1_uart1_6_apps_clk, |
| 680 | .current_freq = &rcg_dummy_freq, |
| 681 | .base = &virt_bases[GCC_BASE], |
| 682 | .c = { |
| 683 | .dbg_name = "blsp1_uart2_apps_clk_src", |
| 684 | .ops = &clk_ops_rcg_mnd, |
| 685 | VDD_DIG_FMAX_MAP2(LOW, 31580000, NOMINAL, 63160000), |
| 686 | CLK_INIT(blsp1_uart2_apps_clk_src.c) |
| 687 | }, |
| 688 | }; |
| 689 | |
| 690 | static struct rcg_clk blsp1_uart3_apps_clk_src = { |
| 691 | .cmd_rcgr_reg = BLSP1_UART3_APPS_CMD_RCGR, |
| 692 | .set_rate = set_rate_mnd, |
| 693 | .freq_tbl = ftbl_gcc_blsp1_uart1_6_apps_clk, |
| 694 | .current_freq = &rcg_dummy_freq, |
| 695 | .base = &virt_bases[GCC_BASE], |
| 696 | .c = { |
| 697 | .dbg_name = "blsp1_uart3_apps_clk_src", |
| 698 | .ops = &clk_ops_rcg_mnd, |
| 699 | VDD_DIG_FMAX_MAP2(LOW, 31580000, NOMINAL, 63160000), |
| 700 | CLK_INIT(blsp1_uart3_apps_clk_src.c) |
| 701 | }, |
| 702 | }; |
| 703 | |
| 704 | static struct rcg_clk blsp1_uart4_apps_clk_src = { |
| 705 | .cmd_rcgr_reg = BLSP1_UART4_APPS_CMD_RCGR, |
| 706 | .set_rate = set_rate_mnd, |
| 707 | .freq_tbl = ftbl_gcc_blsp1_uart1_6_apps_clk, |
| 708 | .current_freq = &rcg_dummy_freq, |
| 709 | .base = &virt_bases[GCC_BASE], |
| 710 | .c = { |
| 711 | .dbg_name = "blsp1_uart4_apps_clk_src", |
| 712 | .ops = &clk_ops_rcg_mnd, |
| 713 | VDD_DIG_FMAX_MAP2(LOW, 31580000, NOMINAL, 63160000), |
| 714 | CLK_INIT(blsp1_uart4_apps_clk_src.c) |
| 715 | }, |
| 716 | }; |
| 717 | |
| 718 | static struct rcg_clk blsp1_uart5_apps_clk_src = { |
| 719 | .cmd_rcgr_reg = BLSP1_UART5_APPS_CMD_RCGR, |
| 720 | .set_rate = set_rate_mnd, |
| 721 | .freq_tbl = ftbl_gcc_blsp1_uart1_6_apps_clk, |
| 722 | .current_freq = &rcg_dummy_freq, |
| 723 | .base = &virt_bases[GCC_BASE], |
| 724 | .c = { |
| 725 | .dbg_name = "blsp1_uart5_apps_clk_src", |
| 726 | .ops = &clk_ops_rcg_mnd, |
| 727 | VDD_DIG_FMAX_MAP2(LOW, 31580000, NOMINAL, 63160000), |
| 728 | CLK_INIT(blsp1_uart5_apps_clk_src.c) |
| 729 | }, |
| 730 | }; |
| 731 | |
| 732 | static struct rcg_clk blsp1_uart6_apps_clk_src = { |
| 733 | .cmd_rcgr_reg = BLSP1_UART6_APPS_CMD_RCGR, |
| 734 | .set_rate = set_rate_mnd, |
| 735 | .freq_tbl = ftbl_gcc_blsp1_uart1_6_apps_clk, |
| 736 | .current_freq = &rcg_dummy_freq, |
| 737 | .base = &virt_bases[GCC_BASE], |
| 738 | .c = { |
| 739 | .dbg_name = "blsp1_uart6_apps_clk_src", |
| 740 | .ops = &clk_ops_rcg_mnd, |
| 741 | VDD_DIG_FMAX_MAP2(LOW, 31580000, NOMINAL, 63160000), |
| 742 | CLK_INIT(blsp1_uart6_apps_clk_src.c) |
| 743 | }, |
| 744 | }; |
| 745 | |
| 746 | static struct clk_freq_tbl ftbl_gcc_ce1_clk[] = { |
| 747 | F( 50000000, gpll0, 12, 0, 0), |
| 748 | F(100000000, gpll0, 6, 0, 0), |
| 749 | F_END |
| 750 | }; |
| 751 | |
| 752 | static struct rcg_clk ce1_clk_src = { |
| 753 | .cmd_rcgr_reg = CE1_CMD_RCGR, |
| 754 | .set_rate = set_rate_hid, |
| 755 | .freq_tbl = ftbl_gcc_ce1_clk, |
| 756 | .current_freq = &rcg_dummy_freq, |
| 757 | .base = &virt_bases[GCC_BASE], |
| 758 | .c = { |
| 759 | .dbg_name = "ce1_clk_src", |
| 760 | .ops = &clk_ops_rcg, |
| 761 | VDD_DIG_FMAX_MAP2(LOW, 50000000, NOMINAL, 100000000), |
| 762 | CLK_INIT(ce1_clk_src.c), |
| 763 | }, |
| 764 | }; |
| 765 | |
| 766 | static struct clk_freq_tbl ftbl_gcc_gp_clk[] = { |
| 767 | F(19200000, cxo, 1, 0, 0), |
| 768 | F_END |
| 769 | }; |
| 770 | |
| 771 | static struct rcg_clk gp1_clk_src = { |
| 772 | .cmd_rcgr_reg = GP1_CMD_RCGR, |
| 773 | .set_rate = set_rate_mnd, |
| 774 | .freq_tbl = ftbl_gcc_gp_clk, |
| 775 | .current_freq = &rcg_dummy_freq, |
| 776 | .base = &virt_bases[GCC_BASE], |
| 777 | .c = { |
| 778 | .dbg_name = "gp1_clk_src", |
| 779 | .ops = &clk_ops_rcg_mnd, |
| 780 | VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000), |
| 781 | CLK_INIT(gp1_clk_src.c) |
| 782 | }, |
| 783 | }; |
| 784 | |
| 785 | static struct rcg_clk gp2_clk_src = { |
| 786 | .cmd_rcgr_reg = GP2_CMD_RCGR, |
| 787 | .set_rate = set_rate_mnd, |
| 788 | .freq_tbl = ftbl_gcc_gp_clk, |
| 789 | .current_freq = &rcg_dummy_freq, |
| 790 | .base = &virt_bases[GCC_BASE], |
| 791 | .c = { |
| 792 | .dbg_name = "gp2_clk_src", |
| 793 | .ops = &clk_ops_rcg_mnd, |
| 794 | VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000), |
| 795 | CLK_INIT(gp2_clk_src.c) |
| 796 | }, |
| 797 | }; |
| 798 | |
| 799 | static struct rcg_clk gp3_clk_src = { |
| 800 | .cmd_rcgr_reg = GP3_CMD_RCGR, |
| 801 | .set_rate = set_rate_mnd, |
| 802 | .freq_tbl = ftbl_gcc_gp_clk, |
| 803 | .current_freq = &rcg_dummy_freq, |
| 804 | .base = &virt_bases[GCC_BASE], |
| 805 | .c = { |
| 806 | .dbg_name = "gp3_clk_src", |
| 807 | .ops = &clk_ops_rcg_mnd, |
| 808 | VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000), |
| 809 | CLK_INIT(gp3_clk_src.c) |
| 810 | }, |
| 811 | }; |
| 812 | |
| 813 | static struct clk_freq_tbl ftbl_gcc_pdm2_clk[] = { |
| 814 | F(60000000, gpll0, 10, 0, 0), |
| 815 | F_END |
| 816 | }; |
| 817 | |
| 818 | static struct rcg_clk pdm2_clk_src = { |
| 819 | .cmd_rcgr_reg = PDM2_CMD_RCGR, |
| 820 | .set_rate = set_rate_hid, |
| 821 | .freq_tbl = ftbl_gcc_pdm2_clk, |
| 822 | .current_freq = &rcg_dummy_freq, |
| 823 | .base = &virt_bases[GCC_BASE], |
| 824 | .c = { |
| 825 | .dbg_name = "pdm2_clk_src", |
| 826 | .ops = &clk_ops_rcg, |
| 827 | VDD_DIG_FMAX_MAP1(LOW, 60000000), |
| 828 | CLK_INIT(pdm2_clk_src.c), |
| 829 | }, |
| 830 | }; |
| 831 | |
| 832 | static struct clk_freq_tbl ftbl_gcc_qpic_clk[] = { |
| 833 | F( 50000000, gpll0, 12, 0, 0), |
| 834 | F(100000000, gpll0, 6, 0, 0), |
| 835 | F_END |
| 836 | }; |
| 837 | |
| 838 | static struct rcg_clk qpic_clk_src = { |
| 839 | .cmd_rcgr_reg = QPIC_CMD_RCGR, |
| 840 | .set_rate = set_rate_mnd, |
| 841 | .freq_tbl = ftbl_gcc_qpic_clk, |
| 842 | .current_freq = &rcg_dummy_freq, |
| 843 | .base = &virt_bases[GCC_BASE], |
| 844 | .c = { |
| 845 | .dbg_name = "qpic_clk_src", |
| 846 | .ops = &clk_ops_rcg_mnd, |
| 847 | VDD_DIG_FMAX_MAP2(LOW, 50000000, NOMINAL, 100000000), |
| 848 | CLK_INIT(qpic_clk_src.c) |
| 849 | }, |
| 850 | }; |
| 851 | |
| 852 | static struct clk_freq_tbl ftbl_gcc_sdcc2_apps_clk[] = { |
| 853 | F( 144000, cxo, 16, 3, 25), |
| 854 | F( 400000, cxo, 12, 1, 4), |
| 855 | F( 20000000, gpll0, 15, 1, 2), |
| 856 | F( 25000000, gpll0, 12, 1, 2), |
| 857 | F( 50000000, gpll0, 12, 0, 0), |
| 858 | F(100000000, gpll0, 6, 0, 0), |
| 859 | F(200000000, gpll0, 3, 0, 0), |
| 860 | F_END |
| 861 | }; |
| 862 | |
| 863 | static struct clk_freq_tbl ftbl_gcc_sdcc3_apps_clk[] = { |
| 864 | F( 144000, cxo, 16, 3, 25), |
| 865 | F( 400000, cxo, 12, 1, 4), |
| 866 | F( 20000000, gpll0, 15, 1, 2), |
| 867 | F( 25000000, gpll0, 12, 1, 2), |
| 868 | F( 50000000, gpll0, 12, 0, 0), |
| 869 | F(100000000, gpll0, 6, 0, 0), |
| 870 | F_END |
| 871 | }; |
| 872 | |
| 873 | static struct rcg_clk sdcc2_apps_clk_src = { |
| 874 | .cmd_rcgr_reg = SDCC2_APPS_CMD_RCGR, |
| 875 | .set_rate = set_rate_mnd, |
| 876 | .freq_tbl = ftbl_gcc_sdcc2_apps_clk, |
| 877 | .current_freq = &rcg_dummy_freq, |
| 878 | .base = &virt_bases[GCC_BASE], |
| 879 | .c = { |
| 880 | .dbg_name = "sdcc2_apps_clk_src", |
| 881 | .ops = &clk_ops_rcg_mnd, |
| 882 | VDD_DIG_FMAX_MAP2(LOW, 100000000, NOMINAL, 200000000), |
| 883 | CLK_INIT(sdcc2_apps_clk_src.c) |
| 884 | }, |
| 885 | }; |
| 886 | |
| 887 | static struct rcg_clk sdcc3_apps_clk_src = { |
| 888 | .cmd_rcgr_reg = SDCC3_APPS_CMD_RCGR, |
| 889 | .set_rate = set_rate_mnd, |
| 890 | .freq_tbl = ftbl_gcc_sdcc3_apps_clk, |
| 891 | .current_freq = &rcg_dummy_freq, |
| 892 | .base = &virt_bases[GCC_BASE], |
| 893 | .c = { |
| 894 | .dbg_name = "sdcc3_apps_clk_src", |
| 895 | .ops = &clk_ops_rcg_mnd, |
| 896 | VDD_DIG_FMAX_MAP2(LOW, 50000000, NOMINAL, 100000000), |
| 897 | CLK_INIT(sdcc3_apps_clk_src.c) |
| 898 | }, |
| 899 | }; |
| 900 | |
| 901 | static struct clk_freq_tbl ftbl_gcc_usb_hs_system_clk[] = { |
| 902 | F(75000000, gpll0, 8, 0, 0), |
| 903 | F_END |
| 904 | }; |
| 905 | |
| 906 | static struct rcg_clk usb_hs_system_clk_src = { |
| 907 | .cmd_rcgr_reg = USB_HS_SYSTEM_CMD_RCGR, |
| 908 | .set_rate = set_rate_hid, |
| 909 | .freq_tbl = ftbl_gcc_usb_hs_system_clk, |
| 910 | .current_freq = &rcg_dummy_freq, |
| 911 | .base = &virt_bases[GCC_BASE], |
| 912 | .c = { |
| 913 | .dbg_name = "usb_hs_system_clk_src", |
| 914 | .ops = &clk_ops_rcg, |
| 915 | VDD_DIG_FMAX_MAP2(LOW, 37500000, NOMINAL, 75000000), |
| 916 | CLK_INIT(usb_hs_system_clk_src.c), |
| 917 | }, |
| 918 | }; |
| 919 | |
| 920 | static struct clk_freq_tbl ftbl_gcc_usb_hsic_clk[] = { |
| 921 | F_HSIC(480000000, gpll1, 1, 0, 0), |
| 922 | F_END |
| 923 | }; |
| 924 | |
| 925 | static struct rcg_clk usb_hsic_clk_src = { |
| 926 | .cmd_rcgr_reg = USB_HSIC_CMD_RCGR, |
| 927 | .set_rate = set_rate_hid, |
| 928 | .freq_tbl = ftbl_gcc_usb_hsic_clk, |
| 929 | .current_freq = &rcg_dummy_freq, |
| 930 | .base = &virt_bases[GCC_BASE], |
| 931 | .c = { |
| 932 | .dbg_name = "usb_hsic_clk_src", |
| 933 | .ops = &clk_ops_rcg, |
| 934 | VDD_DIG_FMAX_MAP1(LOW, 480000000), |
| 935 | CLK_INIT(usb_hsic_clk_src.c), |
| 936 | }, |
| 937 | }; |
| 938 | |
| 939 | static struct clk_freq_tbl ftbl_gcc_usb_hsic_io_cal_clk[] = { |
| 940 | F(9600000, cxo, 2, 0, 0), |
| 941 | F_END |
| 942 | }; |
| 943 | |
| 944 | static struct rcg_clk usb_hsic_io_cal_clk_src = { |
| 945 | .cmd_rcgr_reg = USB_HSIC_IO_CAL_CMD_RCGR, |
| 946 | .set_rate = set_rate_hid, |
| 947 | .freq_tbl = ftbl_gcc_usb_hsic_io_cal_clk, |
| 948 | .current_freq = &rcg_dummy_freq, |
| 949 | .base = &virt_bases[GCC_BASE], |
| 950 | .c = { |
| 951 | .dbg_name = "usb_hsic_io_cal_clk_src", |
| 952 | .ops = &clk_ops_rcg, |
| 953 | VDD_DIG_FMAX_MAP1(LOW, 9600000), |
| 954 | CLK_INIT(usb_hsic_io_cal_clk_src.c), |
| 955 | }, |
| 956 | }; |
| 957 | |
| 958 | static struct clk_freq_tbl ftbl_gcc_usb_hsic_system_clk[] = { |
| 959 | F(75000000, gpll0, 8, 0, 0), |
| 960 | F_END |
| 961 | }; |
| 962 | |
| 963 | static struct rcg_clk usb_hsic_system_clk_src = { |
| 964 | .cmd_rcgr_reg = USB_HSIC_SYSTEM_CMD_RCGR, |
| 965 | .set_rate = set_rate_hid, |
| 966 | .freq_tbl = ftbl_gcc_usb_hsic_system_clk, |
| 967 | .current_freq = &rcg_dummy_freq, |
| 968 | .base = &virt_bases[GCC_BASE], |
| 969 | .c = { |
| 970 | .dbg_name = "usb_hsic_system_clk_src", |
| 971 | .ops = &clk_ops_rcg, |
| 972 | VDD_DIG_FMAX_MAP2(LOW, 60000000, NOMINAL, 75000000), |
| 973 | CLK_INIT(usb_hsic_system_clk_src.c), |
| 974 | }, |
| 975 | }; |
| 976 | |
| 977 | static struct clk_freq_tbl ftbl_gcc_usb_hsic_xcvr_fs_clk[] = { |
| 978 | F(60000000, gpll0, 10, 0, 0), |
| 979 | F_END |
| 980 | }; |
| 981 | |
| 982 | static struct rcg_clk usb_hsic_xcvr_fs_clk_src = { |
| 983 | .cmd_rcgr_reg = USB_HSIC_XCVR_FS_CMD_RCGR, |
| 984 | .set_rate = set_rate_hid, |
| 985 | .freq_tbl = ftbl_gcc_usb_hsic_xcvr_fs_clk, |
| 986 | .current_freq = &rcg_dummy_freq, |
| 987 | .base = &virt_bases[GCC_BASE], |
| 988 | .c = { |
| 989 | .dbg_name = "usb_hsic_xcvr_fs_clk_src", |
| 990 | .ops = &clk_ops_rcg, |
| 991 | VDD_DIG_FMAX_MAP1(LOW, 60000000), |
| 992 | CLK_INIT(usb_hsic_xcvr_fs_clk_src.c), |
| 993 | }, |
| 994 | }; |
| 995 | |
| 996 | static struct local_vote_clk gcc_bam_dma_ahb_clk = { |
| 997 | .cbcr_reg = BAM_DMA_AHB_CBCR, |
| 998 | .vote_reg = APCS_CLOCK_BRANCH_ENA_VOTE, |
| 999 | .en_mask = BIT(12), |
| 1000 | .base = &virt_bases[GCC_BASE], |
| 1001 | .c = { |
| 1002 | .dbg_name = "gcc_bam_dma_ahb_clk", |
| 1003 | .ops = &clk_ops_vote, |
| 1004 | CLK_INIT(gcc_bam_dma_ahb_clk.c), |
| 1005 | }, |
| 1006 | }; |
| 1007 | |
Tianyi Gou | 55b805b | 2013-02-28 21:46:03 -0800 | [diff] [blame] | 1008 | static struct local_vote_clk gcc_bam_dma_inactivity_timers_clk = { |
| 1009 | .cbcr_reg = BAM_DMA_INACTIVITY_TIMERS_CBCR, |
| 1010 | .vote_reg = APCS_CLOCK_BRANCH_ENA_VOTE, |
| 1011 | .en_mask = BIT(11), |
| 1012 | .base = &virt_bases[GCC_BASE], |
| 1013 | .c = { |
| 1014 | .dbg_name = "gcc_bam_dma_inactivity_timers_clk", |
| 1015 | .ops = &clk_ops_vote, |
| 1016 | CLK_INIT(gcc_bam_dma_inactivity_timers_clk.c), |
| 1017 | }, |
| 1018 | }; |
| 1019 | |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1020 | static struct local_vote_clk gcc_blsp1_ahb_clk = { |
| 1021 | .cbcr_reg = BLSP1_AHB_CBCR, |
| 1022 | .vote_reg = APCS_CLOCK_BRANCH_ENA_VOTE, |
| 1023 | .en_mask = BIT(17), |
| 1024 | .base = &virt_bases[GCC_BASE], |
| 1025 | .c = { |
| 1026 | .dbg_name = "gcc_blsp1_ahb_clk", |
| 1027 | .ops = &clk_ops_vote, |
| 1028 | CLK_INIT(gcc_blsp1_ahb_clk.c), |
| 1029 | }, |
| 1030 | }; |
| 1031 | |
| 1032 | static struct branch_clk gcc_blsp1_qup1_i2c_apps_clk = { |
| 1033 | .cbcr_reg = BLSP1_QUP1_I2C_APPS_CBCR, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1034 | .base = &virt_bases[GCC_BASE], |
| 1035 | .c = { |
Saravana Kannan | 7a6532e | 2012-10-18 20:51:13 -0700 | [diff] [blame] | 1036 | .parent = &cxo_clk_src.c, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1037 | .dbg_name = "gcc_blsp1_qup1_i2c_apps_clk", |
| 1038 | .ops = &clk_ops_branch, |
| 1039 | CLK_INIT(gcc_blsp1_qup1_i2c_apps_clk.c), |
| 1040 | }, |
| 1041 | }; |
| 1042 | |
| 1043 | static struct branch_clk gcc_blsp1_qup1_spi_apps_clk = { |
| 1044 | .cbcr_reg = BLSP1_QUP1_SPI_APPS_CBCR, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1045 | .has_sibling = 0, |
| 1046 | .base = &virt_bases[GCC_BASE], |
| 1047 | .c = { |
Saravana Kannan | 7a6532e | 2012-10-18 20:51:13 -0700 | [diff] [blame] | 1048 | .parent = &blsp1_qup1_spi_apps_clk_src.c, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1049 | .dbg_name = "gcc_blsp1_qup1_spi_apps_clk", |
| 1050 | .ops = &clk_ops_branch, |
| 1051 | CLK_INIT(gcc_blsp1_qup1_spi_apps_clk.c), |
| 1052 | }, |
| 1053 | }; |
| 1054 | |
| 1055 | static struct branch_clk gcc_blsp1_qup2_i2c_apps_clk = { |
| 1056 | .cbcr_reg = BLSP1_QUP2_I2C_APPS_CBCR, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1057 | .base = &virt_bases[GCC_BASE], |
| 1058 | .c = { |
Saravana Kannan | 7a6532e | 2012-10-18 20:51:13 -0700 | [diff] [blame] | 1059 | .parent = &cxo_clk_src.c, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1060 | .dbg_name = "gcc_blsp1_qup2_i2c_apps_clk", |
| 1061 | .ops = &clk_ops_branch, |
| 1062 | CLK_INIT(gcc_blsp1_qup2_i2c_apps_clk.c), |
| 1063 | }, |
| 1064 | }; |
| 1065 | |
| 1066 | static struct branch_clk gcc_blsp1_qup2_spi_apps_clk = { |
| 1067 | .cbcr_reg = BLSP1_QUP2_SPI_APPS_CBCR, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1068 | .has_sibling = 0, |
| 1069 | .base = &virt_bases[GCC_BASE], |
| 1070 | .c = { |
Saravana Kannan | 7a6532e | 2012-10-18 20:51:13 -0700 | [diff] [blame] | 1071 | .parent = &blsp1_qup2_spi_apps_clk_src.c, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1072 | .dbg_name = "gcc_blsp1_qup2_spi_apps_clk", |
| 1073 | .ops = &clk_ops_branch, |
| 1074 | CLK_INIT(gcc_blsp1_qup2_spi_apps_clk.c), |
| 1075 | }, |
| 1076 | }; |
| 1077 | |
| 1078 | static struct branch_clk gcc_blsp1_qup3_i2c_apps_clk = { |
| 1079 | .cbcr_reg = BLSP1_QUP3_I2C_APPS_CBCR, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1080 | .base = &virt_bases[GCC_BASE], |
| 1081 | .c = { |
Saravana Kannan | 7a6532e | 2012-10-18 20:51:13 -0700 | [diff] [blame] | 1082 | .parent = &cxo_clk_src.c, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1083 | .dbg_name = "gcc_blsp1_qup3_i2c_apps_clk", |
| 1084 | .ops = &clk_ops_branch, |
| 1085 | CLK_INIT(gcc_blsp1_qup3_i2c_apps_clk.c), |
| 1086 | }, |
| 1087 | }; |
| 1088 | |
| 1089 | static struct branch_clk gcc_blsp1_qup3_spi_apps_clk = { |
| 1090 | .cbcr_reg = BLSP1_QUP3_SPI_APPS_CBCR, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1091 | .has_sibling = 0, |
| 1092 | .base = &virt_bases[GCC_BASE], |
| 1093 | .c = { |
Saravana Kannan | 7a6532e | 2012-10-18 20:51:13 -0700 | [diff] [blame] | 1094 | .parent = &blsp1_qup3_spi_apps_clk_src.c, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1095 | .dbg_name = "gcc_blsp1_qup3_spi_apps_clk", |
| 1096 | .ops = &clk_ops_branch, |
| 1097 | CLK_INIT(gcc_blsp1_qup3_spi_apps_clk.c), |
| 1098 | }, |
| 1099 | }; |
| 1100 | |
| 1101 | static struct branch_clk gcc_blsp1_qup4_i2c_apps_clk = { |
| 1102 | .cbcr_reg = BLSP1_QUP4_I2C_APPS_CBCR, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1103 | .base = &virt_bases[GCC_BASE], |
| 1104 | .c = { |
Saravana Kannan | 7a6532e | 2012-10-18 20:51:13 -0700 | [diff] [blame] | 1105 | .parent = &cxo_clk_src.c, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1106 | .dbg_name = "gcc_blsp1_qup4_i2c_apps_clk", |
| 1107 | .ops = &clk_ops_branch, |
| 1108 | CLK_INIT(gcc_blsp1_qup4_i2c_apps_clk.c), |
| 1109 | }, |
| 1110 | }; |
| 1111 | |
| 1112 | static struct branch_clk gcc_blsp1_qup4_spi_apps_clk = { |
| 1113 | .cbcr_reg = BLSP1_QUP4_SPI_APPS_CBCR, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1114 | .has_sibling = 0, |
| 1115 | .base = &virt_bases[GCC_BASE], |
| 1116 | .c = { |
Saravana Kannan | 7a6532e | 2012-10-18 20:51:13 -0700 | [diff] [blame] | 1117 | .parent = &blsp1_qup4_spi_apps_clk_src.c, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1118 | .dbg_name = "gcc_blsp1_qup4_spi_apps_clk", |
| 1119 | .ops = &clk_ops_branch, |
| 1120 | CLK_INIT(gcc_blsp1_qup4_spi_apps_clk.c), |
| 1121 | }, |
| 1122 | }; |
| 1123 | |
| 1124 | static struct branch_clk gcc_blsp1_qup5_i2c_apps_clk = { |
| 1125 | .cbcr_reg = BLSP1_QUP5_I2C_APPS_CBCR, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1126 | .base = &virt_bases[GCC_BASE], |
| 1127 | .c = { |
Saravana Kannan | 7a6532e | 2012-10-18 20:51:13 -0700 | [diff] [blame] | 1128 | .parent = &cxo_clk_src.c, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1129 | .dbg_name = "gcc_blsp1_qup5_i2c_apps_clk", |
| 1130 | .ops = &clk_ops_branch, |
| 1131 | CLK_INIT(gcc_blsp1_qup5_i2c_apps_clk.c), |
| 1132 | }, |
| 1133 | }; |
| 1134 | |
| 1135 | static struct branch_clk gcc_blsp1_qup5_spi_apps_clk = { |
| 1136 | .cbcr_reg = BLSP1_QUP5_SPI_APPS_CBCR, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1137 | .has_sibling = 0, |
| 1138 | .base = &virt_bases[GCC_BASE], |
| 1139 | .c = { |
Saravana Kannan | 7a6532e | 2012-10-18 20:51:13 -0700 | [diff] [blame] | 1140 | .parent = &blsp1_qup5_spi_apps_clk_src.c, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1141 | .dbg_name = "gcc_blsp1_qup5_spi_apps_clk", |
| 1142 | .ops = &clk_ops_branch, |
| 1143 | CLK_INIT(gcc_blsp1_qup5_spi_apps_clk.c), |
| 1144 | }, |
| 1145 | }; |
| 1146 | |
| 1147 | static struct branch_clk gcc_blsp1_qup6_i2c_apps_clk = { |
| 1148 | .cbcr_reg = BLSP1_QUP6_I2C_APPS_CBCR, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1149 | .base = &virt_bases[GCC_BASE], |
| 1150 | .c = { |
Saravana Kannan | 7a6532e | 2012-10-18 20:51:13 -0700 | [diff] [blame] | 1151 | .parent = &cxo_clk_src.c, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1152 | .dbg_name = "gcc_blsp1_qup6_i2c_apps_clk", |
| 1153 | .ops = &clk_ops_branch, |
| 1154 | CLK_INIT(gcc_blsp1_qup6_i2c_apps_clk.c), |
| 1155 | }, |
| 1156 | }; |
| 1157 | |
| 1158 | static struct branch_clk gcc_blsp1_qup6_spi_apps_clk = { |
| 1159 | .cbcr_reg = BLSP1_QUP6_SPI_APPS_CBCR, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1160 | .has_sibling = 0, |
| 1161 | .base = &virt_bases[GCC_BASE], |
| 1162 | .c = { |
Saravana Kannan | 7a6532e | 2012-10-18 20:51:13 -0700 | [diff] [blame] | 1163 | .parent = &blsp1_qup6_spi_apps_clk_src.c, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1164 | .dbg_name = "gcc_blsp1_qup6_spi_apps_clk", |
| 1165 | .ops = &clk_ops_branch, |
| 1166 | CLK_INIT(gcc_blsp1_qup6_spi_apps_clk.c), |
| 1167 | }, |
| 1168 | }; |
| 1169 | |
| 1170 | static struct branch_clk gcc_blsp1_uart1_apps_clk = { |
| 1171 | .cbcr_reg = BLSP1_UART1_APPS_CBCR, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1172 | .has_sibling = 0, |
| 1173 | .base = &virt_bases[GCC_BASE], |
| 1174 | .c = { |
Saravana Kannan | 7a6532e | 2012-10-18 20:51:13 -0700 | [diff] [blame] | 1175 | .parent = &blsp1_uart1_apps_clk_src.c, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1176 | .dbg_name = "gcc_blsp1_uart1_apps_clk", |
| 1177 | .ops = &clk_ops_branch, |
| 1178 | CLK_INIT(gcc_blsp1_uart1_apps_clk.c), |
| 1179 | }, |
| 1180 | }; |
| 1181 | |
| 1182 | static struct branch_clk gcc_blsp1_uart2_apps_clk = { |
| 1183 | .cbcr_reg = BLSP1_UART2_APPS_CBCR, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1184 | .has_sibling = 0, |
| 1185 | .base = &virt_bases[GCC_BASE], |
| 1186 | .c = { |
Saravana Kannan | 7a6532e | 2012-10-18 20:51:13 -0700 | [diff] [blame] | 1187 | .parent = &blsp1_uart2_apps_clk_src.c, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1188 | .dbg_name = "gcc_blsp1_uart2_apps_clk", |
| 1189 | .ops = &clk_ops_branch, |
| 1190 | CLK_INIT(gcc_blsp1_uart2_apps_clk.c), |
| 1191 | }, |
| 1192 | }; |
| 1193 | |
| 1194 | static struct branch_clk gcc_blsp1_uart3_apps_clk = { |
| 1195 | .cbcr_reg = BLSP1_UART3_APPS_CBCR, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1196 | .has_sibling = 0, |
| 1197 | .base = &virt_bases[GCC_BASE], |
| 1198 | .c = { |
Saravana Kannan | 7a6532e | 2012-10-18 20:51:13 -0700 | [diff] [blame] | 1199 | .parent = &blsp1_uart3_apps_clk_src.c, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1200 | .dbg_name = "gcc_blsp1_uart3_apps_clk", |
| 1201 | .ops = &clk_ops_branch, |
| 1202 | CLK_INIT(gcc_blsp1_uart3_apps_clk.c), |
| 1203 | }, |
| 1204 | }; |
| 1205 | |
| 1206 | static struct branch_clk gcc_blsp1_uart4_apps_clk = { |
| 1207 | .cbcr_reg = BLSP1_UART4_APPS_CBCR, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1208 | .has_sibling = 0, |
| 1209 | .base = &virt_bases[GCC_BASE], |
| 1210 | .c = { |
Saravana Kannan | 7a6532e | 2012-10-18 20:51:13 -0700 | [diff] [blame] | 1211 | .parent = &blsp1_uart4_apps_clk_src.c, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1212 | .dbg_name = "gcc_blsp1_uart4_apps_clk", |
| 1213 | .ops = &clk_ops_branch, |
| 1214 | CLK_INIT(gcc_blsp1_uart4_apps_clk.c), |
| 1215 | }, |
| 1216 | }; |
| 1217 | |
| 1218 | static struct branch_clk gcc_blsp1_uart5_apps_clk = { |
| 1219 | .cbcr_reg = BLSP1_UART5_APPS_CBCR, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1220 | .has_sibling = 0, |
| 1221 | .base = &virt_bases[GCC_BASE], |
| 1222 | .c = { |
Saravana Kannan | 7a6532e | 2012-10-18 20:51:13 -0700 | [diff] [blame] | 1223 | .parent = &blsp1_uart5_apps_clk_src.c, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1224 | .dbg_name = "gcc_blsp1_uart5_apps_clk", |
| 1225 | .ops = &clk_ops_branch, |
| 1226 | CLK_INIT(gcc_blsp1_uart5_apps_clk.c), |
| 1227 | }, |
| 1228 | }; |
| 1229 | |
| 1230 | static struct branch_clk gcc_blsp1_uart6_apps_clk = { |
| 1231 | .cbcr_reg = BLSP1_UART6_APPS_CBCR, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1232 | .has_sibling = 0, |
| 1233 | .base = &virt_bases[GCC_BASE], |
| 1234 | .c = { |
Saravana Kannan | 7a6532e | 2012-10-18 20:51:13 -0700 | [diff] [blame] | 1235 | .parent = &blsp1_uart6_apps_clk_src.c, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1236 | .dbg_name = "gcc_blsp1_uart6_apps_clk", |
| 1237 | .ops = &clk_ops_branch, |
| 1238 | CLK_INIT(gcc_blsp1_uart6_apps_clk.c), |
| 1239 | }, |
| 1240 | }; |
| 1241 | |
| 1242 | static struct local_vote_clk gcc_boot_rom_ahb_clk = { |
| 1243 | .cbcr_reg = BOOT_ROM_AHB_CBCR, |
| 1244 | .vote_reg = APCS_CLOCK_BRANCH_ENA_VOTE, |
| 1245 | .en_mask = BIT(10), |
| 1246 | .base = &virt_bases[GCC_BASE], |
| 1247 | .c = { |
| 1248 | .dbg_name = "gcc_boot_rom_ahb_clk", |
| 1249 | .ops = &clk_ops_vote, |
| 1250 | CLK_INIT(gcc_boot_rom_ahb_clk.c), |
| 1251 | }, |
| 1252 | }; |
| 1253 | |
| 1254 | static struct local_vote_clk gcc_ce1_ahb_clk = { |
| 1255 | .cbcr_reg = CE1_AHB_CBCR, |
| 1256 | .vote_reg = APCS_CLOCK_BRANCH_ENA_VOTE, |
| 1257 | .en_mask = BIT(3), |
| 1258 | .base = &virt_bases[GCC_BASE], |
| 1259 | .c = { |
| 1260 | .dbg_name = "gcc_ce1_ahb_clk", |
| 1261 | .ops = &clk_ops_vote, |
| 1262 | CLK_INIT(gcc_ce1_ahb_clk.c), |
| 1263 | }, |
| 1264 | }; |
| 1265 | |
| 1266 | static struct local_vote_clk gcc_ce1_axi_clk = { |
| 1267 | .cbcr_reg = CE1_AXI_CBCR, |
| 1268 | .vote_reg = APCS_CLOCK_BRANCH_ENA_VOTE, |
| 1269 | .en_mask = BIT(4), |
| 1270 | .base = &virt_bases[GCC_BASE], |
| 1271 | .c = { |
| 1272 | .dbg_name = "gcc_ce1_axi_clk", |
| 1273 | .ops = &clk_ops_vote, |
| 1274 | CLK_INIT(gcc_ce1_axi_clk.c), |
| 1275 | }, |
| 1276 | }; |
| 1277 | |
| 1278 | static struct local_vote_clk gcc_ce1_clk = { |
| 1279 | .cbcr_reg = CE1_CBCR, |
| 1280 | .vote_reg = APCS_CLOCK_BRANCH_ENA_VOTE, |
| 1281 | .en_mask = BIT(5), |
| 1282 | .base = &virt_bases[GCC_BASE], |
| 1283 | .c = { |
| 1284 | .dbg_name = "gcc_ce1_clk", |
| 1285 | .ops = &clk_ops_vote, |
| 1286 | CLK_INIT(gcc_ce1_clk.c), |
| 1287 | }, |
| 1288 | }; |
| 1289 | |
| 1290 | static struct branch_clk gcc_gp1_clk = { |
| 1291 | .cbcr_reg = GP1_CBCR, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1292 | .has_sibling = 0, |
| 1293 | .base = &virt_bases[GCC_BASE], |
| 1294 | .c = { |
Saravana Kannan | 7a6532e | 2012-10-18 20:51:13 -0700 | [diff] [blame] | 1295 | .parent = &gp1_clk_src.c, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1296 | .dbg_name = "gcc_gp1_clk", |
| 1297 | .ops = &clk_ops_branch, |
| 1298 | CLK_INIT(gcc_gp1_clk.c), |
| 1299 | }, |
| 1300 | }; |
| 1301 | |
| 1302 | static struct branch_clk gcc_gp2_clk = { |
| 1303 | .cbcr_reg = GP2_CBCR, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1304 | .has_sibling = 0, |
| 1305 | .base = &virt_bases[GCC_BASE], |
| 1306 | .c = { |
Saravana Kannan | 7a6532e | 2012-10-18 20:51:13 -0700 | [diff] [blame] | 1307 | .parent = &gp2_clk_src.c, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1308 | .dbg_name = "gcc_gp2_clk", |
| 1309 | .ops = &clk_ops_branch, |
| 1310 | CLK_INIT(gcc_gp2_clk.c), |
| 1311 | }, |
| 1312 | }; |
| 1313 | |
| 1314 | static struct branch_clk gcc_gp3_clk = { |
| 1315 | .cbcr_reg = GP3_CBCR, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1316 | .has_sibling = 0, |
| 1317 | .base = &virt_bases[GCC_BASE], |
| 1318 | .c = { |
Saravana Kannan | 7a6532e | 2012-10-18 20:51:13 -0700 | [diff] [blame] | 1319 | .parent = &gp3_clk_src.c, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1320 | .dbg_name = "gcc_gp3_clk", |
| 1321 | .ops = &clk_ops_branch, |
| 1322 | CLK_INIT(gcc_gp3_clk.c), |
| 1323 | }, |
| 1324 | }; |
| 1325 | |
| 1326 | static struct branch_clk gcc_ipa_clk = { |
| 1327 | .cbcr_reg = IPA_CBCR, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1328 | .has_sibling = 1, |
| 1329 | .base = &virt_bases[GCC_BASE], |
| 1330 | .c = { |
Saravana Kannan | 7a6532e | 2012-10-18 20:51:13 -0700 | [diff] [blame] | 1331 | .parent = &ipa_clk_src.c, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1332 | .dbg_name = "gcc_ipa_clk", |
| 1333 | .ops = &clk_ops_branch, |
| 1334 | CLK_INIT(gcc_ipa_clk.c), |
| 1335 | }, |
| 1336 | }; |
| 1337 | |
| 1338 | static struct branch_clk gcc_ipa_cnoc_clk = { |
| 1339 | .cbcr_reg = IPA_CNOC_CBCR, |
| 1340 | .has_sibling = 1, |
| 1341 | .base = &virt_bases[GCC_BASE], |
| 1342 | .c = { |
| 1343 | .dbg_name = "gcc_ipa_cnoc_clk", |
| 1344 | .ops = &clk_ops_branch, |
| 1345 | CLK_INIT(gcc_ipa_cnoc_clk.c), |
| 1346 | }, |
| 1347 | }; |
| 1348 | |
Tianyi Gou | 0e10e79 | 2012-11-29 18:28:32 -0800 | [diff] [blame] | 1349 | static struct branch_clk gcc_ipa_sleep_clk = { |
| 1350 | .cbcr_reg = IPA_SLEEP_CBCR, |
| 1351 | .has_sibling = 1, |
| 1352 | .base = &virt_bases[GCC_BASE], |
| 1353 | .c = { |
| 1354 | .dbg_name = "gcc_ipa_sleep_clk", |
| 1355 | .ops = &clk_ops_branch, |
| 1356 | CLK_INIT(gcc_ipa_sleep_clk.c), |
| 1357 | }, |
| 1358 | }; |
| 1359 | |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1360 | static struct branch_clk gcc_pdm2_clk = { |
| 1361 | .cbcr_reg = PDM2_CBCR, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1362 | .has_sibling = 0, |
| 1363 | .base = &virt_bases[GCC_BASE], |
| 1364 | .c = { |
Saravana Kannan | 7a6532e | 2012-10-18 20:51:13 -0700 | [diff] [blame] | 1365 | .parent = &pdm2_clk_src.c, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1366 | .dbg_name = "gcc_pdm2_clk", |
| 1367 | .ops = &clk_ops_branch, |
| 1368 | CLK_INIT(gcc_pdm2_clk.c), |
| 1369 | }, |
| 1370 | }; |
| 1371 | |
| 1372 | static struct branch_clk gcc_pdm_ahb_clk = { |
| 1373 | .cbcr_reg = PDM_AHB_CBCR, |
| 1374 | .has_sibling = 1, |
| 1375 | .base = &virt_bases[GCC_BASE], |
| 1376 | .c = { |
| 1377 | .dbg_name = "gcc_pdm_ahb_clk", |
| 1378 | .ops = &clk_ops_branch, |
| 1379 | CLK_INIT(gcc_pdm_ahb_clk.c), |
| 1380 | }, |
| 1381 | }; |
| 1382 | |
| 1383 | static struct local_vote_clk gcc_prng_ahb_clk = { |
| 1384 | .cbcr_reg = PRNG_AHB_CBCR, |
| 1385 | .vote_reg = APCS_CLOCK_BRANCH_ENA_VOTE, |
| 1386 | .en_mask = BIT(13), |
| 1387 | .base = &virt_bases[GCC_BASE], |
| 1388 | .c = { |
| 1389 | .dbg_name = "gcc_prng_ahb_clk", |
| 1390 | .ops = &clk_ops_vote, |
| 1391 | CLK_INIT(gcc_prng_ahb_clk.c), |
| 1392 | }, |
| 1393 | }; |
| 1394 | |
| 1395 | static struct branch_clk gcc_qpic_ahb_clk = { |
| 1396 | .cbcr_reg = QPIC_AHB_CBCR, |
| 1397 | .has_sibling = 1, |
| 1398 | .base = &virt_bases[GCC_BASE], |
| 1399 | .c = { |
| 1400 | .dbg_name = "gcc_qpic_ahb_clk", |
| 1401 | .ops = &clk_ops_branch, |
| 1402 | CLK_INIT(gcc_qpic_ahb_clk.c), |
| 1403 | }, |
| 1404 | }; |
| 1405 | |
| 1406 | static struct branch_clk gcc_qpic_clk = { |
| 1407 | .cbcr_reg = QPIC_CBCR, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1408 | .has_sibling = 0, |
| 1409 | .base = &virt_bases[GCC_BASE], |
| 1410 | .c = { |
Saravana Kannan | 7a6532e | 2012-10-18 20:51:13 -0700 | [diff] [blame] | 1411 | .parent = &qpic_clk_src.c, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1412 | .dbg_name = "gcc_qpic_clk", |
| 1413 | .ops = &clk_ops_branch, |
| 1414 | CLK_INIT(gcc_qpic_clk.c), |
| 1415 | }, |
| 1416 | }; |
| 1417 | |
| 1418 | static struct branch_clk gcc_sdcc2_ahb_clk = { |
| 1419 | .cbcr_reg = SDCC2_AHB_CBCR, |
| 1420 | .has_sibling = 1, |
| 1421 | .base = &virt_bases[GCC_BASE], |
| 1422 | .c = { |
| 1423 | .dbg_name = "gcc_sdcc2_ahb_clk", |
| 1424 | .ops = &clk_ops_branch, |
| 1425 | CLK_INIT(gcc_sdcc2_ahb_clk.c), |
| 1426 | }, |
| 1427 | }; |
| 1428 | |
| 1429 | static struct branch_clk gcc_sdcc2_apps_clk = { |
| 1430 | .cbcr_reg = SDCC2_APPS_CBCR, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1431 | .has_sibling = 0, |
| 1432 | .base = &virt_bases[GCC_BASE], |
| 1433 | .c = { |
Saravana Kannan | 7a6532e | 2012-10-18 20:51:13 -0700 | [diff] [blame] | 1434 | .parent = &sdcc2_apps_clk_src.c, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1435 | .dbg_name = "gcc_sdcc2_apps_clk", |
| 1436 | .ops = &clk_ops_branch, |
| 1437 | CLK_INIT(gcc_sdcc2_apps_clk.c), |
| 1438 | }, |
| 1439 | }; |
| 1440 | |
| 1441 | static struct branch_clk gcc_sdcc3_ahb_clk = { |
| 1442 | .cbcr_reg = SDCC3_AHB_CBCR, |
| 1443 | .has_sibling = 1, |
| 1444 | .base = &virt_bases[GCC_BASE], |
| 1445 | .c = { |
| 1446 | .dbg_name = "gcc_sdcc3_ahb_clk", |
| 1447 | .ops = &clk_ops_branch, |
| 1448 | CLK_INIT(gcc_sdcc3_ahb_clk.c), |
| 1449 | }, |
| 1450 | }; |
| 1451 | |
| 1452 | static struct branch_clk gcc_sdcc3_apps_clk = { |
| 1453 | .cbcr_reg = SDCC3_APPS_CBCR, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1454 | .has_sibling = 0, |
| 1455 | .base = &virt_bases[GCC_BASE], |
| 1456 | .c = { |
Saravana Kannan | 7a6532e | 2012-10-18 20:51:13 -0700 | [diff] [blame] | 1457 | .parent = &sdcc3_apps_clk_src.c, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1458 | .dbg_name = "gcc_sdcc3_apps_clk", |
| 1459 | .ops = &clk_ops_branch, |
| 1460 | CLK_INIT(gcc_sdcc3_apps_clk.c), |
| 1461 | }, |
| 1462 | }; |
| 1463 | |
| 1464 | static struct branch_clk gcc_sys_noc_ipa_axi_clk = { |
| 1465 | .cbcr_reg = SYS_NOC_IPA_AXI_CBCR, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1466 | .has_sibling = 1, |
| 1467 | .base = &virt_bases[GCC_BASE], |
| 1468 | .c = { |
Saravana Kannan | 7a6532e | 2012-10-18 20:51:13 -0700 | [diff] [blame] | 1469 | .parent = &ipa_clk_src.c, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1470 | .dbg_name = "gcc_sys_noc_ipa_axi_clk", |
| 1471 | .ops = &clk_ops_branch, |
| 1472 | CLK_INIT(gcc_sys_noc_ipa_axi_clk.c), |
| 1473 | }, |
| 1474 | }; |
| 1475 | |
| 1476 | static struct branch_clk gcc_usb_hs_ahb_clk = { |
| 1477 | .cbcr_reg = USB_HS_AHB_CBCR, |
| 1478 | .has_sibling = 1, |
| 1479 | .base = &virt_bases[GCC_BASE], |
| 1480 | .c = { |
| 1481 | .dbg_name = "gcc_usb_hs_ahb_clk", |
| 1482 | .ops = &clk_ops_branch, |
| 1483 | CLK_INIT(gcc_usb_hs_ahb_clk.c), |
| 1484 | }, |
| 1485 | }; |
| 1486 | |
| 1487 | static struct branch_clk gcc_usb_hs_system_clk = { |
| 1488 | .cbcr_reg = USB_HS_SYSTEM_CBCR, |
| 1489 | .bcr_reg = USB_HS_BCR, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1490 | .has_sibling = 0, |
| 1491 | .base = &virt_bases[GCC_BASE], |
| 1492 | .c = { |
Saravana Kannan | 7a6532e | 2012-10-18 20:51:13 -0700 | [diff] [blame] | 1493 | .parent = &usb_hs_system_clk_src.c, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1494 | .dbg_name = "gcc_usb_hs_system_clk", |
| 1495 | .ops = &clk_ops_branch, |
| 1496 | CLK_INIT(gcc_usb_hs_system_clk.c), |
| 1497 | }, |
| 1498 | }; |
| 1499 | |
| 1500 | static struct branch_clk gcc_usb_hsic_ahb_clk = { |
| 1501 | .cbcr_reg = USB_HSIC_AHB_CBCR, |
| 1502 | .has_sibling = 1, |
| 1503 | .base = &virt_bases[GCC_BASE], |
| 1504 | .c = { |
| 1505 | .dbg_name = "gcc_usb_hsic_ahb_clk", |
| 1506 | .ops = &clk_ops_branch, |
| 1507 | CLK_INIT(gcc_usb_hsic_ahb_clk.c), |
| 1508 | }, |
| 1509 | }; |
| 1510 | |
| 1511 | static struct branch_clk gcc_usb_hsic_clk = { |
| 1512 | .cbcr_reg = USB_HSIC_CBCR, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1513 | .has_sibling = 0, |
| 1514 | .base = &virt_bases[GCC_BASE], |
| 1515 | .c = { |
Saravana Kannan | 7a6532e | 2012-10-18 20:51:13 -0700 | [diff] [blame] | 1516 | .parent = &usb_hsic_clk_src.c, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1517 | .dbg_name = "gcc_usb_hsic_clk", |
| 1518 | .ops = &clk_ops_branch, |
| 1519 | CLK_INIT(gcc_usb_hsic_clk.c), |
| 1520 | }, |
| 1521 | }; |
| 1522 | |
| 1523 | static struct branch_clk gcc_usb_hsic_io_cal_clk = { |
| 1524 | .cbcr_reg = USB_HSIC_IO_CAL_CBCR, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1525 | .has_sibling = 0, |
| 1526 | .base = &virt_bases[GCC_BASE], |
| 1527 | .c = { |
Saravana Kannan | 7a6532e | 2012-10-18 20:51:13 -0700 | [diff] [blame] | 1528 | .parent = &usb_hsic_io_cal_clk_src.c, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1529 | .dbg_name = "gcc_usb_hsic_io_cal_clk", |
| 1530 | .ops = &clk_ops_branch, |
| 1531 | CLK_INIT(gcc_usb_hsic_io_cal_clk.c), |
| 1532 | }, |
| 1533 | }; |
| 1534 | |
Tianyi Gou | 55b805b | 2013-02-28 21:46:03 -0800 | [diff] [blame] | 1535 | static struct branch_clk gcc_usb_hsic_io_cal_sleep_clk = { |
| 1536 | .cbcr_reg = USB_HSIC_IO_CAL_SLEEP_CBCR, |
| 1537 | .has_sibling = 1, |
| 1538 | .base = &virt_bases[GCC_BASE], |
| 1539 | .c = { |
| 1540 | .dbg_name = "gcc_usb_hsic_io_cal_sleep_clk", |
| 1541 | .ops = &clk_ops_branch, |
| 1542 | CLK_INIT(gcc_usb_hsic_io_cal_sleep_clk.c), |
| 1543 | }, |
| 1544 | }; |
| 1545 | |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1546 | static struct branch_clk gcc_usb_hsic_system_clk = { |
| 1547 | .cbcr_reg = USB_HSIC_SYSTEM_CBCR, |
| 1548 | .bcr_reg = USB_HS_HSIC_BCR, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1549 | .has_sibling = 0, |
| 1550 | .base = &virt_bases[GCC_BASE], |
| 1551 | .c = { |
Saravana Kannan | 7a6532e | 2012-10-18 20:51:13 -0700 | [diff] [blame] | 1552 | .parent = &usb_hsic_system_clk_src.c, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1553 | .dbg_name = "gcc_usb_hsic_system_clk", |
| 1554 | .ops = &clk_ops_branch, |
| 1555 | CLK_INIT(gcc_usb_hsic_system_clk.c), |
| 1556 | }, |
| 1557 | }; |
| 1558 | |
| 1559 | static struct branch_clk gcc_usb_hsic_xcvr_fs_clk = { |
| 1560 | .cbcr_reg = USB_HSIC_XCVR_FS_CBCR, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1561 | .has_sibling = 0, |
| 1562 | .base = &virt_bases[GCC_BASE], |
| 1563 | .c = { |
Saravana Kannan | 7a6532e | 2012-10-18 20:51:13 -0700 | [diff] [blame] | 1564 | .parent = &usb_hsic_xcvr_fs_clk_src.c, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1565 | .dbg_name = "gcc_usb_hsic_xcvr_fs_clk", |
| 1566 | .ops = &clk_ops_branch, |
| 1567 | CLK_INIT(gcc_usb_hsic_xcvr_fs_clk.c), |
| 1568 | }, |
| 1569 | }; |
| 1570 | |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1571 | static DEFINE_CLK_MEASURE(a5_m_clk); |
| 1572 | |
| 1573 | #ifdef CONFIG_DEBUG_FS |
| 1574 | |
| 1575 | struct measure_mux_entry { |
| 1576 | struct clk *c; |
| 1577 | int base; |
| 1578 | u32 debug_mux; |
| 1579 | }; |
| 1580 | |
Tianyi Gou | abcddb7 | 2013-02-23 18:10:11 -0800 | [diff] [blame] | 1581 | struct measure_mux_entry measure_mux_common[] __initdata = { |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1582 | {&gcc_pdm_ahb_clk.c, GCC_BASE, 0x00d0}, |
Tianyi Gou | 55b805b | 2013-02-28 21:46:03 -0800 | [diff] [blame] | 1583 | {&gcc_usb_hsic_io_cal_sleep_clk.c, GCC_BASE, 0x005c}, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1584 | {&gcc_usb_hsic_xcvr_fs_clk.c, GCC_BASE, 0x005d}, |
| 1585 | {&gcc_usb_hsic_system_clk.c, GCC_BASE, 0x0059}, |
| 1586 | {&gcc_usb_hsic_io_cal_clk.c, GCC_BASE, 0x005b}, |
| 1587 | {&gcc_sdcc3_ahb_clk.c, GCC_BASE, 0x0079}, |
| 1588 | {&gcc_blsp1_qup5_i2c_apps_clk.c, GCC_BASE, 0x009d}, |
| 1589 | {&gcc_blsp1_qup1_spi_apps_clk.c, GCC_BASE, 0x008a}, |
| 1590 | {&gcc_blsp1_uart2_apps_clk.c, GCC_BASE, 0x0091}, |
| 1591 | {&gcc_blsp1_qup4_spi_apps_clk.c, GCC_BASE, 0x0098}, |
| 1592 | {&gcc_blsp1_qup3_spi_apps_clk.c, GCC_BASE, 0x0093}, |
| 1593 | {&gcc_blsp1_qup6_i2c_apps_clk.c, GCC_BASE, 0x00a2}, |
| 1594 | {&gcc_bam_dma_ahb_clk.c, GCC_BASE, 0x00e0}, |
| 1595 | {&gcc_sdcc3_apps_clk.c, GCC_BASE, 0x0078}, |
| 1596 | {&gcc_usb_hs_system_clk.c, GCC_BASE, 0x0060}, |
| 1597 | {&gcc_blsp1_ahb_clk.c, GCC_BASE, 0x0088}, |
| 1598 | {&gcc_blsp1_uart4_apps_clk.c, GCC_BASE, 0x009a}, |
| 1599 | {&gcc_blsp1_qup2_spi_apps_clk.c, GCC_BASE, 0x008e}, |
| 1600 | {&gcc_usb_hsic_ahb_clk.c, GCC_BASE, 0x0058}, |
| 1601 | {&gcc_blsp1_uart3_apps_clk.c, GCC_BASE, 0x0095}, |
| 1602 | {&gcc_ce1_axi_clk.c, GCC_BASE, 0x0139}, |
| 1603 | {&gcc_blsp1_qup5_spi_apps_clk.c, GCC_BASE, 0x009c}, |
| 1604 | {&gcc_usb_hs_ahb_clk.c, GCC_BASE, 0x0061}, |
| 1605 | {&gcc_blsp1_qup6_spi_apps_clk.c, GCC_BASE, 0x00a1}, |
| 1606 | {&gcc_prng_ahb_clk.c, GCC_BASE, 0x00d8}, |
| 1607 | {&gcc_blsp1_qup3_i2c_apps_clk.c, GCC_BASE, 0x0094}, |
| 1608 | {&gcc_usb_hsic_clk.c, GCC_BASE, 0x005a}, |
| 1609 | {&gcc_blsp1_uart6_apps_clk.c, GCC_BASE, 0x00a3}, |
| 1610 | {&gcc_sdcc2_apps_clk.c, GCC_BASE, 0x0070}, |
| 1611 | {&gcc_blsp1_uart1_apps_clk.c, GCC_BASE, 0x008c}, |
| 1612 | {&gcc_blsp1_qup4_i2c_apps_clk.c, GCC_BASE, 0x0099}, |
Tianyi Gou | 55b805b | 2013-02-28 21:46:03 -0800 | [diff] [blame] | 1613 | {&gcc_bam_dma_inactivity_timers_clk.c, GCC_BASE, 0x00E1}, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1614 | {&gcc_boot_rom_ahb_clk.c, GCC_BASE, 0x00f8}, |
| 1615 | {&gcc_ce1_ahb_clk.c, GCC_BASE, 0x013a}, |
| 1616 | {&gcc_pdm2_clk.c, GCC_BASE, 0x00d2}, |
| 1617 | {&gcc_blsp1_uart5_apps_clk.c, GCC_BASE, 0x009e}, |
| 1618 | {&gcc_blsp1_qup2_i2c_apps_clk.c, GCC_BASE, 0x0090}, |
| 1619 | {&gcc_blsp1_qup1_i2c_apps_clk.c, GCC_BASE, 0x008b}, |
| 1620 | {&gcc_sdcc2_ahb_clk.c, GCC_BASE, 0x0071}, |
| 1621 | {&gcc_ce1_clk.c, GCC_BASE, 0x0138}, |
| 1622 | {&gcc_sys_noc_ipa_axi_clk.c, GCC_BASE, 0x0007}, |
Tianyi Gou | 8512ac4 | 2013-01-23 18:32:04 -0800 | [diff] [blame] | 1623 | {&gcc_ipa_clk.c, GCC_BASE, 0x01E0}, |
| 1624 | {&gcc_ipa_cnoc_clk.c, GCC_BASE, 0x01E1}, |
| 1625 | {&gcc_ipa_sleep_clk.c, GCC_BASE, 0x01E2}, |
| 1626 | {&gcc_qpic_clk.c, GCC_BASE, 0x01D8}, |
| 1627 | {&gcc_qpic_ahb_clk.c, GCC_BASE, 0x01D9}, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1628 | |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1629 | {&a5_m_clk, APCS_BASE, 0x3}, |
| 1630 | |
| 1631 | {&dummy_clk, N_BASES, 0x0000}, |
| 1632 | }; |
| 1633 | |
Tianyi Gou | abcddb7 | 2013-02-23 18:10:11 -0800 | [diff] [blame] | 1634 | struct measure_mux_entry measure_mux_v2_only[] __initdata = { |
| 1635 | {&gcc_ipa_clk.c, GCC_BASE, 0x01E0}, |
| 1636 | {&gcc_ipa_cnoc_clk.c, GCC_BASE, 0x01E1}, |
| 1637 | {&gcc_ipa_sleep_clk.c, GCC_BASE, 0x01E2}, |
| 1638 | {&gcc_qpic_clk.c, GCC_BASE, 0x01D8}, |
| 1639 | {&gcc_qpic_ahb_clk.c, GCC_BASE, 0x01D9}, |
| 1640 | }; |
| 1641 | |
| 1642 | struct measure_mux_entry measure_mux[ARRAY_SIZE(measure_mux_common) |
| 1643 | + ARRAY_SIZE(measure_mux_v2_only)]; |
| 1644 | |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1645 | static int measure_clk_set_parent(struct clk *c, struct clk *parent) |
| 1646 | { |
| 1647 | struct measure_clk *clk = to_measure_clk(c); |
| 1648 | unsigned long flags; |
| 1649 | u32 regval, clk_sel, i; |
| 1650 | |
| 1651 | if (!parent) |
| 1652 | return -EINVAL; |
| 1653 | |
| 1654 | for (i = 0; i < (ARRAY_SIZE(measure_mux) - 1); i++) |
| 1655 | if (measure_mux[i].c == parent) |
| 1656 | break; |
| 1657 | |
| 1658 | if (measure_mux[i].c == &dummy_clk) |
| 1659 | return -EINVAL; |
| 1660 | |
| 1661 | spin_lock_irqsave(&local_clock_reg_lock, flags); |
| 1662 | /* |
| 1663 | * Program the test vector, measurement period (sample_ticks) |
| 1664 | * and scaling multiplier. |
| 1665 | */ |
| 1666 | clk->sample_ticks = 0x10000; |
| 1667 | clk->multiplier = 1; |
| 1668 | |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1669 | writel_relaxed(0, GCC_REG_BASE(GCC_DEBUG_CLK_CTL_REG)); |
| 1670 | |
| 1671 | switch (measure_mux[i].base) { |
| 1672 | |
| 1673 | case GCC_BASE: |
| 1674 | clk_sel = measure_mux[i].debug_mux; |
| 1675 | break; |
| 1676 | |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1677 | case APCS_BASE: |
| 1678 | clk_sel = 0x16A; |
| 1679 | regval = BVAL(5, 3, measure_mux[i].debug_mux); |
| 1680 | writel_relaxed(regval, APCS_REG_BASE(APCS_CLK_DIAG_REG)); |
| 1681 | |
| 1682 | /* Activate debug clock output */ |
| 1683 | regval |= BIT(7); |
| 1684 | writel_relaxed(regval, APCS_REG_BASE(APCS_CLK_DIAG_REG)); |
| 1685 | break; |
| 1686 | |
| 1687 | default: |
| 1688 | return -EINVAL; |
| 1689 | } |
| 1690 | |
| 1691 | /* Set debug mux clock index */ |
| 1692 | regval = BVAL(8, 0, clk_sel); |
| 1693 | writel_relaxed(regval, GCC_REG_BASE(GCC_DEBUG_CLK_CTL_REG)); |
| 1694 | |
| 1695 | /* Activate debug clock output */ |
| 1696 | regval |= BIT(16); |
| 1697 | writel_relaxed(regval, GCC_REG_BASE(GCC_DEBUG_CLK_CTL_REG)); |
| 1698 | |
| 1699 | /* Make sure test vector is set before starting measurements. */ |
| 1700 | mb(); |
| 1701 | spin_unlock_irqrestore(&local_clock_reg_lock, flags); |
| 1702 | |
| 1703 | return 0; |
| 1704 | } |
| 1705 | |
| 1706 | /* Sample clock for 'ticks' reference clock ticks. */ |
| 1707 | static u32 run_measurement(unsigned ticks) |
| 1708 | { |
| 1709 | /* Stop counters and set the XO4 counter start value. */ |
| 1710 | writel_relaxed(ticks, GCC_REG_BASE(CLOCK_FRQ_MEASURE_CTL_REG)); |
| 1711 | |
| 1712 | /* Wait for timer to become ready. */ |
| 1713 | while ((readl_relaxed(GCC_REG_BASE(CLOCK_FRQ_MEASURE_STATUS_REG)) & |
| 1714 | BIT(25)) != 0) |
| 1715 | cpu_relax(); |
| 1716 | |
| 1717 | /* Run measurement and wait for completion. */ |
| 1718 | writel_relaxed(BIT(20)|ticks, GCC_REG_BASE(CLOCK_FRQ_MEASURE_CTL_REG)); |
| 1719 | while ((readl_relaxed(GCC_REG_BASE(CLOCK_FRQ_MEASURE_STATUS_REG)) & |
| 1720 | BIT(25)) == 0) |
| 1721 | cpu_relax(); |
| 1722 | |
| 1723 | /* Return measured ticks. */ |
| 1724 | return readl_relaxed(GCC_REG_BASE(CLOCK_FRQ_MEASURE_STATUS_REG)) & |
| 1725 | BM(24, 0); |
| 1726 | } |
| 1727 | |
| 1728 | /* |
| 1729 | * Perform a hardware rate measurement for a given clock. |
| 1730 | * FOR DEBUG USE ONLY: Measurements take ~15 ms! |
| 1731 | */ |
| 1732 | static unsigned long measure_clk_get_rate(struct clk *c) |
| 1733 | { |
| 1734 | unsigned long flags; |
| 1735 | u32 gcc_xo4_reg_backup; |
| 1736 | u64 raw_count_short, raw_count_full; |
| 1737 | struct measure_clk *clk = to_measure_clk(c); |
| 1738 | unsigned ret; |
| 1739 | |
| 1740 | ret = clk_prepare_enable(&cxo_clk_src.c); |
| 1741 | if (ret) { |
| 1742 | pr_warning("CXO clock failed to enable. Can't measure\n"); |
| 1743 | return 0; |
| 1744 | } |
| 1745 | |
| 1746 | spin_lock_irqsave(&local_clock_reg_lock, flags); |
| 1747 | |
| 1748 | /* Enable CXO/4 and RINGOSC branch. */ |
| 1749 | gcc_xo4_reg_backup = readl_relaxed(GCC_REG_BASE(GCC_XO_DIV4_CBCR_REG)); |
| 1750 | writel_relaxed(0x1, GCC_REG_BASE(GCC_XO_DIV4_CBCR_REG)); |
| 1751 | |
| 1752 | /* |
| 1753 | * The ring oscillator counter will not reset if the measured clock |
| 1754 | * is not running. To detect this, run a short measurement before |
| 1755 | * the full measurement. If the raw results of the two are the same |
| 1756 | * then the clock must be off. |
| 1757 | */ |
| 1758 | |
| 1759 | /* Run a short measurement. (~1 ms) */ |
| 1760 | raw_count_short = run_measurement(0x1000); |
| 1761 | /* Run a full measurement. (~14 ms) */ |
| 1762 | raw_count_full = run_measurement(clk->sample_ticks); |
| 1763 | |
| 1764 | writel_relaxed(gcc_xo4_reg_backup, GCC_REG_BASE(GCC_XO_DIV4_CBCR_REG)); |
| 1765 | |
| 1766 | /* Return 0 if the clock is off. */ |
| 1767 | if (raw_count_full == raw_count_short) { |
| 1768 | ret = 0; |
| 1769 | } else { |
| 1770 | /* Compute rate in Hz. */ |
| 1771 | raw_count_full = ((raw_count_full * 10) + 15) * 4800000; |
| 1772 | do_div(raw_count_full, ((clk->sample_ticks * 10) + 35)); |
| 1773 | ret = (raw_count_full * clk->multiplier); |
| 1774 | } |
| 1775 | |
| 1776 | writel_relaxed(0x51A00, GCC_REG_BASE(GCC_PLLTEST_PAD_CFG_REG)); |
| 1777 | spin_unlock_irqrestore(&local_clock_reg_lock, flags); |
| 1778 | |
| 1779 | clk_disable_unprepare(&cxo_clk_src.c); |
| 1780 | |
| 1781 | return ret; |
| 1782 | } |
| 1783 | #else /* !CONFIG_DEBUG_FS */ |
| 1784 | static int measure_clk_set_parent(struct clk *clk, struct clk *parent) |
| 1785 | { |
| 1786 | return -EINVAL; |
| 1787 | } |
| 1788 | |
| 1789 | static unsigned long measure_clk_get_rate(struct clk *clk) |
| 1790 | { |
| 1791 | return 0; |
| 1792 | } |
| 1793 | #endif /* CONFIG_DEBUG_FS */ |
| 1794 | |
| 1795 | static struct clk_ops clk_ops_measure = { |
| 1796 | .set_parent = measure_clk_set_parent, |
| 1797 | .get_rate = measure_clk_get_rate, |
| 1798 | }; |
| 1799 | |
| 1800 | static struct measure_clk measure_clk = { |
| 1801 | .c = { |
| 1802 | .dbg_name = "measure_clk", |
| 1803 | .ops = &clk_ops_measure, |
| 1804 | CLK_INIT(measure_clk.c), |
| 1805 | }, |
| 1806 | .multiplier = 1, |
| 1807 | }; |
| 1808 | |
| 1809 | static struct clk_lookup msm_clocks_9625[] = { |
| 1810 | CLK_LOOKUP("xo", cxo_clk_src.c, ""), |
| 1811 | CLK_LOOKUP("measure", measure_clk.c, "debug"), |
| 1812 | |
Tianyi Gou | 27df1bb | 2012-10-11 14:44:01 -0700 | [diff] [blame] | 1813 | CLK_LOOKUP("pll0", gpll0_activeonly_clk_src.c, "f9010008.qcom,acpuclk"), |
| 1814 | CLK_LOOKUP("pll14", apcspll_clk_src.c, "f9010008.qcom,acpuclk"), |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1815 | |
| 1816 | CLK_LOOKUP("dma_bam_pclk", gcc_bam_dma_ahb_clk.c, "msm_sps"), |
Tianyi Gou | 55b805b | 2013-02-28 21:46:03 -0800 | [diff] [blame] | 1817 | CLK_LOOKUP("inactivity_clk", gcc_bam_dma_inactivity_timers_clk.c, |
| 1818 | "msm_sps"), |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1819 | CLK_LOOKUP("iface_clk", gcc_blsp1_ahb_clk.c, "msm_serial_hsl.0"), |
Gilad Avidov | 09c78ec | 2012-10-18 09:34:35 -0600 | [diff] [blame] | 1820 | CLK_LOOKUP("iface_clk", gcc_blsp1_ahb_clk.c, "f9924000.spi"), |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1821 | CLK_LOOKUP("iface_clk", gcc_blsp1_ahb_clk.c, "f9925000.i2c"), |
Saket Saurabh | d72ee92 | 2013-01-22 16:56:52 +0530 | [diff] [blame] | 1822 | CLK_LOOKUP("iface_clk", gcc_blsp1_ahb_clk.c, "f991d000.uart"), |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1823 | CLK_LOOKUP("core_clk", gcc_blsp1_qup1_i2c_apps_clk.c, ""), |
Gilad Avidov | 09c78ec | 2012-10-18 09:34:35 -0600 | [diff] [blame] | 1824 | CLK_LOOKUP("core_clk", gcc_blsp1_qup1_spi_apps_clk.c, ""), |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1825 | CLK_LOOKUP("core_clk", gcc_blsp1_qup2_i2c_apps_clk.c, ""), |
Gilad Avidov | 09c78ec | 2012-10-18 09:34:35 -0600 | [diff] [blame] | 1826 | CLK_LOOKUP("core_clk", gcc_blsp1_qup2_spi_apps_clk.c, "f9924000.spi"), |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1827 | CLK_LOOKUP("core_clk", gcc_blsp1_qup3_i2c_apps_clk.c, "f9925000.i2c"), |
| 1828 | CLK_LOOKUP("core_clk", gcc_blsp1_qup3_spi_apps_clk.c, ""), |
| 1829 | CLK_LOOKUP("core_clk", gcc_blsp1_qup4_i2c_apps_clk.c, ""), |
| 1830 | CLK_LOOKUP("core_clk", gcc_blsp1_qup4_spi_apps_clk.c, ""), |
| 1831 | CLK_LOOKUP("core_clk", gcc_blsp1_qup5_i2c_apps_clk.c, ""), |
| 1832 | CLK_LOOKUP("core_clk", gcc_blsp1_qup5_spi_apps_clk.c, ""), |
| 1833 | CLK_LOOKUP("core_clk", gcc_blsp1_qup6_i2c_apps_clk.c, ""), |
| 1834 | CLK_LOOKUP("core_clk", gcc_blsp1_qup6_spi_apps_clk.c, ""), |
Saket Saurabh | d72ee92 | 2013-01-22 16:56:52 +0530 | [diff] [blame] | 1835 | CLK_LOOKUP("core_clk", gcc_blsp1_uart1_apps_clk.c, "f991d000.uart"), |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1836 | CLK_LOOKUP("core_clk", gcc_blsp1_uart2_apps_clk.c, ""), |
| 1837 | CLK_LOOKUP("core_clk", gcc_blsp1_uart3_apps_clk.c, "msm_serial_hsl.0"), |
| 1838 | CLK_LOOKUP("core_clk", gcc_blsp1_uart4_apps_clk.c, ""), |
| 1839 | CLK_LOOKUP("core_clk", gcc_blsp1_uart5_apps_clk.c, ""), |
| 1840 | CLK_LOOKUP("core_clk", gcc_blsp1_uart6_apps_clk.c, ""), |
| 1841 | |
| 1842 | CLK_LOOKUP("core_clk_src", ce1_clk_src.c, ""), |
| 1843 | CLK_LOOKUP("core_clk", gcc_ce1_clk.c, ""), |
| 1844 | CLK_LOOKUP("iface_clk", gcc_ce1_ahb_clk.c, ""), |
| 1845 | CLK_LOOKUP("bus_clk", gcc_ce1_axi_clk.c, ""), |
| 1846 | |
| 1847 | CLK_LOOKUP("core_clk", gcc_gp1_clk.c, ""), |
| 1848 | CLK_LOOKUP("core_clk", gcc_gp2_clk.c, ""), |
| 1849 | CLK_LOOKUP("core_clk", gcc_gp3_clk.c, ""), |
| 1850 | |
Hariprasad Dhalinarasimha | 9abfe78 | 2012-11-07 19:40:14 -0800 | [diff] [blame] | 1851 | CLK_LOOKUP("iface_clk", gcc_prng_ahb_clk.c, "f9bff000.qcom,msm-rng"), |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1852 | CLK_LOOKUP("core_src_clk", ipa_clk_src.c, "fd4c0000.qcom,ipa"), |
| 1853 | CLK_LOOKUP("core_clk", gcc_ipa_clk.c, "fd4c0000.qcom,ipa"), |
| 1854 | CLK_LOOKUP("bus_clk", gcc_sys_noc_ipa_axi_clk.c, "fd4c0000.qcom,ipa"), |
| 1855 | CLK_LOOKUP("iface_clk", gcc_ipa_cnoc_clk.c, "fd4c0000.qcom,ipa"), |
Tianyi Gou | 0e10e79 | 2012-11-29 18:28:32 -0800 | [diff] [blame] | 1856 | CLK_LOOKUP("inactivity_clk", gcc_ipa_sleep_clk.c, "fd4c0000.qcom,ipa"), |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1857 | |
| 1858 | CLK_LOOKUP("core_clk", gcc_pdm2_clk.c, ""), |
| 1859 | CLK_LOOKUP("iface_clk", gcc_pdm_ahb_clk.c, ""), |
| 1860 | |
Oluwafemi Adeyemi | 61df118 | 2012-10-12 18:51:11 -0700 | [diff] [blame] | 1861 | CLK_LOOKUP("iface_clk", gcc_sdcc2_ahb_clk.c, "msm_sdcc.2"), |
| 1862 | CLK_LOOKUP("core_clk", gcc_sdcc2_apps_clk.c, "msm_sdcc.2"), |
| 1863 | CLK_LOOKUP("bus_clk", pnoc_sdcc2_clk.c, "msm_sdcc.2"), |
| 1864 | CLK_LOOKUP("iface_clk", gcc_sdcc3_ahb_clk.c, "msm_sdcc.3"), |
| 1865 | CLK_LOOKUP("core_clk", gcc_sdcc3_apps_clk.c, "msm_sdcc.3"), |
| 1866 | CLK_LOOKUP("bus_clk", pnoc_sdcc3_clk.c, "msm_sdcc.3"), |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1867 | |
| 1868 | CLK_LOOKUP("iface_clk", gcc_usb_hs_ahb_clk.c, "f9a55000.usb"), |
| 1869 | CLK_LOOKUP("core_clk", gcc_usb_hs_system_clk.c, "f9a55000.usb"), |
Ido Shayevitz | d2b722b | 2013-01-09 13:08:54 +0200 | [diff] [blame] | 1870 | CLK_LOOKUP("iface_clk", gcc_usb_hsic_ahb_clk.c, "msm_hsic_host"), |
| 1871 | CLK_LOOKUP("phy_clk", gcc_usb_hsic_clk.c, "msm_hsic_host"), |
| 1872 | CLK_LOOKUP("cal_clk", gcc_usb_hsic_io_cal_clk.c, "msm_hsic_host"), |
| 1873 | CLK_LOOKUP("core_clk", gcc_usb_hsic_system_clk.c, "msm_hsic_host"), |
Ofir Cohen | b512a5f | 2012-12-13 09:46:34 +0200 | [diff] [blame] | 1874 | CLK_LOOKUP("alt_core_clk", gcc_usb_hsic_xcvr_fs_clk.c, ""), |
Tianyi Gou | 55b805b | 2013-02-28 21:46:03 -0800 | [diff] [blame] | 1875 | CLK_LOOKUP("inactivity_clk", gcc_usb_hsic_io_cal_sleep_clk.c, |
| 1876 | "msm_hsic_host"), |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1877 | |
Hariprasad Dhalinarasimha | 96252de | 2012-11-21 17:52:36 -0800 | [diff] [blame] | 1878 | CLK_LOOKUP("core_clk", gcc_ce1_clk.c, "fd400000.qcom,qcedev"), |
| 1879 | CLK_LOOKUP("iface_clk", gcc_ce1_ahb_clk.c, "fd400000.qcom,qcedev"), |
| 1880 | CLK_LOOKUP("bus_clk", gcc_ce1_axi_clk.c, "fd400000.qcom,qcedev"), |
| 1881 | CLK_LOOKUP("core_clk_src", ce1_clk_src.c, "fd400000.qcom,qcedev"), |
| 1882 | |
| 1883 | CLK_LOOKUP("core_clk", gcc_ce1_clk.c, "fd400000.qcom,qcrypto"), |
| 1884 | CLK_LOOKUP("iface_clk", gcc_ce1_ahb_clk.c, "fd400000.qcom,qcrypto"), |
| 1885 | CLK_LOOKUP("bus_clk", gcc_ce1_axi_clk.c, "fd400000.qcom,qcrypto"), |
| 1886 | CLK_LOOKUP("core_clk_src", ce1_clk_src.c, "fd400000.qcom,qcrypto"), |
| 1887 | |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1888 | /* RPM and voter clocks */ |
| 1889 | CLK_LOOKUP("bus_clk", snoc_clk.c, ""), |
| 1890 | CLK_LOOKUP("bus_clk", pnoc_clk.c, ""), |
| 1891 | CLK_LOOKUP("bus_clk", cnoc_clk.c, ""), |
| 1892 | CLK_LOOKUP("mem_clk", bimc_clk.c, ""), |
| 1893 | CLK_LOOKUP("bus_clk", snoc_a_clk.c, ""), |
| 1894 | CLK_LOOKUP("bus_clk", pnoc_a_clk.c, ""), |
| 1895 | CLK_LOOKUP("bus_clk", cnoc_a_clk.c, ""), |
| 1896 | CLK_LOOKUP("mem_clk", bimc_a_clk.c, ""), |
| 1897 | |
| 1898 | CLK_LOOKUP("bus_clk", cnoc_msmbus_clk.c, "msm_config_noc"), |
| 1899 | CLK_LOOKUP("bus_a_clk", cnoc_msmbus_a_clk.c, "msm_config_noc"), |
| 1900 | CLK_LOOKUP("bus_clk", snoc_msmbus_clk.c, "msm_sys_noc"), |
| 1901 | CLK_LOOKUP("bus_a_clk", snoc_msmbus_a_clk.c, "msm_sys_noc"), |
| 1902 | CLK_LOOKUP("bus_clk", pnoc_msmbus_clk.c, "msm_periph_noc"), |
| 1903 | CLK_LOOKUP("bus_a_clk", pnoc_msmbus_a_clk.c, "msm_periph_noc"), |
| 1904 | CLK_LOOKUP("mem_clk", bimc_msmbus_clk.c, "msm_bimc"), |
| 1905 | CLK_LOOKUP("mem_a_clk", bimc_msmbus_a_clk.c, "msm_bimc"), |
| 1906 | |
| 1907 | CLK_LOOKUP("dfab_clk", pnoc_sps_clk.c, "msm_sps"), |
| 1908 | |
| 1909 | CLK_LOOKUP("a5_m_clk", a5_m_clk, ""), |
Pushkar Joshi | 4e48304 | 2012-10-29 18:10:08 -0700 | [diff] [blame] | 1910 | |
Pratik Patel | 2d15d56 | 2013-02-07 19:10:35 -0800 | [diff] [blame] | 1911 | /* CoreSight clocks */ |
Pushkar Joshi | 4e48304 | 2012-10-29 18:10:08 -0700 | [diff] [blame] | 1912 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc322000.tmc"), |
| 1913 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc318000.tpiu"), |
| 1914 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc31c000.replicator"), |
| 1915 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc307000.tmc"), |
| 1916 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc31b000.funnel"), |
| 1917 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc319000.funnel"), |
| 1918 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc31a000.funnel"), |
| 1919 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc321000.stm"), |
Pushkar Joshi | 2a51a12 | 2012-12-06 10:49:07 -0800 | [diff] [blame] | 1920 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc332000.etm"), |
Pushkar Joshi | e0e8a7e | 2012-12-15 18:27:04 -0800 | [diff] [blame] | 1921 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc332000.jtagmm"), |
Pratik Patel | 9332c38 | 2013-02-08 11:54:28 -0800 | [diff] [blame] | 1922 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc308000.cti"), |
| 1923 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc309000.cti"), |
| 1924 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc30a000.cti"), |
| 1925 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc30b000.cti"), |
| 1926 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc30c000.cti"), |
| 1927 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc30d000.cti"), |
| 1928 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc30e000.cti"), |
| 1929 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc30f000.cti"), |
| 1930 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc310000.cti"), |
| 1931 | CLK_LOOKUP("core_clk", qdss_clk.c, "fc333000.cti"), |
Pushkar Joshi | 4e48304 | 2012-10-29 18:10:08 -0700 | [diff] [blame] | 1932 | |
Pratik Patel | 2d15d56 | 2013-02-07 19:10:35 -0800 | [diff] [blame] | 1933 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc322000.tmc"), |
| 1934 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc318000.tpiu"), |
| 1935 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc31c000.replicator"), |
| 1936 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc307000.tmc"), |
| 1937 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc31b000.funnel"), |
| 1938 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc319000.funnel"), |
| 1939 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc31a000.funnel"), |
| 1940 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc321000.stm"), |
| 1941 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc332000.etm"), |
| 1942 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc332000.jtagmm"), |
Pratik Patel | 9332c38 | 2013-02-08 11:54:28 -0800 | [diff] [blame] | 1943 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc308000.cti"), |
| 1944 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc309000.cti"), |
| 1945 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc30a000.cti"), |
| 1946 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc30b000.cti"), |
| 1947 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc30c000.cti"), |
| 1948 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc30d000.cti"), |
| 1949 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc30e000.cti"), |
| 1950 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc30f000.cti"), |
| 1951 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc310000.cti"), |
| 1952 | CLK_LOOKUP("core_a_clk", qdss_a_clk.c, "fc333000.cti"), |
Pushkar Joshi | 4e48304 | 2012-10-29 18:10:08 -0700 | [diff] [blame] | 1953 | |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1954 | }; |
| 1955 | |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1956 | #define PLL_AUX_OUTPUT_BIT 1 |
| 1957 | #define PLL_AUX2_OUTPUT_BIT 2 |
| 1958 | |
| 1959 | /* |
| 1960 | * TODO: Need to remove this function when the v2 hardware |
| 1961 | * fix the broken lock status bit. |
| 1962 | */ |
| 1963 | #define PLL_OUTCTRL BIT(0) |
| 1964 | #define PLL_BYPASSNL BIT(1) |
| 1965 | #define PLL_RESET_N BIT(2) |
| 1966 | |
| 1967 | static DEFINE_SPINLOCK(sr_pll_reg_lock); |
| 1968 | |
| 1969 | static int sr_pll_clk_enable_9625(struct clk *c) |
| 1970 | { |
| 1971 | unsigned long flags; |
| 1972 | struct pll_clk *pll = to_pll_clk(c); |
| 1973 | u32 mode; |
| 1974 | void __iomem *mode_reg = *pll->base + (u32)pll->mode_reg; |
| 1975 | |
| 1976 | spin_lock_irqsave(&sr_pll_reg_lock, flags); |
| 1977 | |
| 1978 | /* Disable PLL bypass mode and de-assert reset. */ |
| 1979 | mode = readl_relaxed(mode_reg); |
| 1980 | mode |= PLL_BYPASSNL | PLL_RESET_N; |
| 1981 | writel_relaxed(mode, mode_reg); |
| 1982 | |
| 1983 | /* Wait for pll to lock. */ |
| 1984 | udelay(100); |
| 1985 | |
| 1986 | /* Enable PLL output. */ |
| 1987 | mode |= PLL_OUTCTRL; |
| 1988 | writel_relaxed(mode, mode_reg); |
| 1989 | |
| 1990 | /* Ensure the write above goes through before returning. */ |
| 1991 | mb(); |
| 1992 | |
| 1993 | spin_unlock_irqrestore(&sr_pll_reg_lock, flags); |
| 1994 | return 0; |
| 1995 | } |
| 1996 | |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 1997 | static void __init reg_init(void) |
| 1998 | { |
Tianyi Gou | 781ff67 | 2013-02-21 15:29:40 -0800 | [diff] [blame] | 1999 | u32 regval; |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 2000 | |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 2001 | /* Vote for GPLL0 to turn on. Needed by acpuclock. */ |
| 2002 | regval = readl_relaxed(GCC_REG_BASE(APCS_GPLL_ENA_VOTE_REG)); |
| 2003 | regval |= BIT(0); |
| 2004 | writel_relaxed(regval, GCC_REG_BASE(APCS_GPLL_ENA_VOTE_REG)); |
| 2005 | |
| 2006 | /* |
| 2007 | * TODO: Confirm that no clocks need to be voted on in this sleep vote |
| 2008 | * register. |
| 2009 | */ |
| 2010 | writel_relaxed(0x0, GCC_REG_BASE(APCS_CLOCK_SLEEP_ENA_VOTE)); |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 2011 | } |
| 2012 | |
| 2013 | static void __init msm9625_clock_post_init(void) |
| 2014 | { |
| 2015 | /* |
| 2016 | * Hold an active set vote for CXO; this is because CXO is expected |
| 2017 | * to remain on whenever CPUs aren't power collapsed. |
| 2018 | */ |
| 2019 | clk_prepare_enable(&cxo_a_clk_src.c); |
| 2020 | |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 2021 | /* Set rates for single-rate clocks. */ |
| 2022 | clk_set_rate(&usb_hs_system_clk_src.c, |
| 2023 | usb_hs_system_clk_src.freq_tbl[0].freq_hz); |
| 2024 | clk_set_rate(&usb_hsic_clk_src.c, |
| 2025 | usb_hsic_clk_src.freq_tbl[0].freq_hz); |
| 2026 | clk_set_rate(&usb_hsic_io_cal_clk_src.c, |
| 2027 | usb_hsic_io_cal_clk_src.freq_tbl[0].freq_hz); |
| 2028 | clk_set_rate(&usb_hsic_system_clk_src.c, |
| 2029 | usb_hsic_system_clk_src.freq_tbl[0].freq_hz); |
| 2030 | clk_set_rate(&usb_hsic_xcvr_fs_clk_src.c, |
| 2031 | usb_hsic_xcvr_fs_clk_src.freq_tbl[0].freq_hz); |
| 2032 | clk_set_rate(&pdm2_clk_src.c, pdm2_clk_src.freq_tbl[0].freq_hz); |
Tianyi Gou | b1d1397 | 2013-01-23 22:55:22 -0800 | [diff] [blame] | 2033 | /* |
| 2034 | * TODO: set rate on behalf of the i2c driver until the i2c driver |
| 2035 | * distinguish v1/v2 and call set rate accordingly. |
| 2036 | */ |
| 2037 | if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) == 2) |
| 2038 | clk_set_rate(&blsp1_qup3_i2c_apps_clk_src.c, |
| 2039 | blsp1_qup3_i2c_apps_clk_src.freq_tbl[0].freq_hz); |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 2040 | } |
| 2041 | |
| 2042 | #define GCC_CC_PHYS 0xFC400000 |
| 2043 | #define GCC_CC_SIZE SZ_16K |
| 2044 | |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 2045 | #define APCS_GCC_CC_PHYS 0xF9011000 |
| 2046 | #define APCS_GCC_CC_SIZE SZ_4K |
| 2047 | |
| 2048 | #define APCS_PLL_PHYS 0xF9008018 |
| 2049 | #define APCS_PLL_SIZE 0x18 |
| 2050 | |
Tianyi Gou | b1d1397 | 2013-01-23 22:55:22 -0800 | [diff] [blame] | 2051 | static struct clk *i2c_apps_clks[][2] __initdata = { |
| 2052 | {&gcc_blsp1_qup1_i2c_apps_clk.c, &blsp1_qup1_i2c_apps_clk_src.c}, |
| 2053 | {&gcc_blsp1_qup2_i2c_apps_clk.c, &blsp1_qup2_i2c_apps_clk_src.c}, |
| 2054 | {&gcc_blsp1_qup3_i2c_apps_clk.c, &blsp1_qup3_i2c_apps_clk_src.c}, |
| 2055 | {&gcc_blsp1_qup4_i2c_apps_clk.c, &blsp1_qup4_i2c_apps_clk_src.c}, |
| 2056 | {&gcc_blsp1_qup5_i2c_apps_clk.c, &blsp1_qup5_i2c_apps_clk_src.c}, |
| 2057 | {&gcc_blsp1_qup6_i2c_apps_clk.c, &blsp1_qup6_i2c_apps_clk_src.c}, |
| 2058 | }; |
| 2059 | |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 2060 | static void __init msm9625_clock_pre_init(void) |
| 2061 | { |
| 2062 | virt_bases[GCC_BASE] = ioremap(GCC_CC_PHYS, GCC_CC_SIZE); |
| 2063 | if (!virt_bases[GCC_BASE]) |
| 2064 | panic("clock-9625: Unable to ioremap GCC memory!"); |
| 2065 | |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 2066 | virt_bases[APCS_BASE] = ioremap(APCS_GCC_CC_PHYS, APCS_GCC_CC_SIZE); |
| 2067 | if (!virt_bases[APCS_BASE]) |
| 2068 | panic("clock-9625: Unable to ioremap APCS_GCC_CC memory!"); |
| 2069 | |
| 2070 | virt_bases[APCS_PLL_BASE] = ioremap(APCS_PLL_PHYS, APCS_PLL_SIZE); |
| 2071 | if (!virt_bases[APCS_PLL_BASE]) |
| 2072 | panic("clock-9625: Unable to ioremap APCS_PLL memory!"); |
| 2073 | |
Tianyi Gou | b1d1397 | 2013-01-23 22:55:22 -0800 | [diff] [blame] | 2074 | /* The parent of each of the QUP I2C APPS clocks is an RCG on v2 */ |
| 2075 | if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) == 2) { |
| 2076 | int i, num_cores = ARRAY_SIZE(i2c_apps_clks); |
| 2077 | for (i = 0; i < num_cores; i++) |
| 2078 | i2c_apps_clks[i][0]->parent = i2c_apps_clks[i][1]; |
| 2079 | } |
| 2080 | |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 2081 | clk_ops_local_pll.enable = sr_pll_clk_enable_9625; |
| 2082 | |
Patrick Daly | ebc26bc | 2013-02-05 11:49:07 -0800 | [diff] [blame] | 2083 | vdd_dig.regulator[0] = regulator_get(NULL, "vdd_dig"); |
| 2084 | if (IS_ERR(vdd_dig.regulator[0])) |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 2085 | panic("clock-9625: Unable to get the vdd_dig regulator!"); |
| 2086 | |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 2087 | enable_rpm_scaling(); |
| 2088 | |
| 2089 | reg_init(); |
Tianyi Gou | abcddb7 | 2013-02-23 18:10:11 -0800 | [diff] [blame] | 2090 | |
| 2091 | /* Construct measurement mux array */ |
| 2092 | if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) == 2) { |
| 2093 | memcpy(measure_mux, |
| 2094 | measure_mux_v2_only, sizeof(measure_mux_v2_only)); |
| 2095 | memcpy(measure_mux + ARRAY_SIZE(measure_mux_v2_only), |
| 2096 | measure_mux_common, sizeof(measure_mux_common)); |
| 2097 | } else |
| 2098 | memcpy(measure_mux, |
| 2099 | measure_mux_common, sizeof(measure_mux_common)); |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 2100 | } |
| 2101 | |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 2102 | struct clock_init_data msm9625_clock_init_data __initdata = { |
| 2103 | .table = msm_clocks_9625, |
| 2104 | .size = ARRAY_SIZE(msm_clocks_9625), |
| 2105 | .pre_init = msm9625_clock_pre_init, |
| 2106 | .post_init = msm9625_clock_post_init, |
Tianyi Gou | 389ba43 | 2012-10-01 13:58:38 -0700 | [diff] [blame] | 2107 | }; |