Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2009-2011, Code Aurora Forum. All rights reserved. |
| 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/bitops.h> |
| 18 | #include <linux/io.h> |
| 19 | #include <linux/spinlock.h> |
| 20 | #include <linux/delay.h> |
| 21 | #include <linux/clk.h> |
| 22 | |
| 23 | #include <asm/clkdev.h> |
| 24 | #include <asm/mach-types.h> |
| 25 | |
| 26 | #include <mach/msm_iomap.h> |
| 27 | #include <mach/clk.h> |
| 28 | #include <mach/rpm-regulator.h> |
| 29 | #include <mach/msm_xo.h> |
Stephen Boyd | 94625ef | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 30 | #include <mach/socinfo.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 31 | |
| 32 | #include "clock-local.h" |
| 33 | #include "clock-rpm.h" |
| 34 | #include "clock-voter.h" |
| 35 | #include "clock-dss-8960.h" |
| 36 | #include "devices.h" |
| 37 | |
| 38 | #define REG(off) (MSM_CLK_CTL_BASE + (off)) |
| 39 | #define REG_MM(off) (MSM_MMSS_CLK_CTL_BASE + (off)) |
| 40 | #define REG_LPA(off) (MSM_LPASS_CLK_CTL_BASE + (off)) |
Matt Wagantall | 8b38f94 | 2011-08-02 18:23:18 -0700 | [diff] [blame] | 41 | #define REG_GCC(off) (MSM_APCS_GCC_BASE + (off)) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 42 | |
| 43 | /* Peripheral clock registers. */ |
| 44 | #define CE1_HCLK_CTL_REG REG(0x2720) |
| 45 | #define CE1_CORE_CLK_CTL_REG REG(0x2724) |
| 46 | #define DMA_BAM_HCLK_CTL REG(0x25C0) |
| 47 | #define CLK_HALT_CFPB_STATEA_REG REG(0x2FCC) |
| 48 | #define CLK_HALT_CFPB_STATEB_REG REG(0x2FD0) |
| 49 | #define CLK_HALT_CFPB_STATEC_REG REG(0x2FD4) |
| 50 | #define CLK_HALT_DFAB_STATE_REG REG(0x2FC8) |
| 51 | #define CLK_HALT_MSS_SMPSS_MISC_STATE_REG REG(0x2FDC) |
| 52 | #define CLK_HALT_SFPB_MISC_STATE_REG REG(0x2FD8) |
Stephen Boyd | 973e4ba | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 53 | #define CLK_HALT_AFAB_SFAB_STATEB_REG REG(0x2FC4) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 54 | #define CLK_TEST_REG REG(0x2FA0) |
| 55 | #define GSBIn_HCLK_CTL_REG(n) REG(0x29C0+(0x20*((n)-1))) |
| 56 | #define GSBIn_QUP_APPS_MD_REG(n) REG(0x29C8+(0x20*((n)-1))) |
| 57 | #define GSBIn_QUP_APPS_NS_REG(n) REG(0x29CC+(0x20*((n)-1))) |
| 58 | #define GSBIn_RESET_REG(n) REG(0x29DC+(0x20*((n)-1))) |
| 59 | #define GSBIn_UART_APPS_MD_REG(n) REG(0x29D0+(0x20*((n)-1))) |
| 60 | #define GSBIn_UART_APPS_NS_REG(n) REG(0x29D4+(0x20*((n)-1))) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 61 | #define PDM_CLK_NS_REG REG(0x2CC0) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 62 | #define BB_PLL_ENA_SC0_REG REG(0x34C0) |
| 63 | #define BB_PLL0_STATUS_REG REG(0x30D8) |
| 64 | #define BB_PLL5_STATUS_REG REG(0x30F8) |
| 65 | #define BB_PLL6_STATUS_REG REG(0x3118) |
| 66 | #define BB_PLL7_STATUS_REG REG(0x3138) |
| 67 | #define BB_PLL8_L_VAL_REG REG(0x3144) |
| 68 | #define BB_PLL8_M_VAL_REG REG(0x3148) |
| 69 | #define BB_PLL8_MODE_REG REG(0x3140) |
| 70 | #define BB_PLL8_N_VAL_REG REG(0x314C) |
| 71 | #define BB_PLL8_STATUS_REG REG(0x3158) |
| 72 | #define BB_PLL8_CONFIG_REG REG(0x3154) |
| 73 | #define BB_PLL8_TEST_CTL_REG REG(0x3150) |
Stephen Boyd | 94625ef | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 74 | #define BB_MMCC_PLL2_MODE_REG REG(0x3160) |
| 75 | #define BB_MMCC_PLL2_TEST_CTL_REG REG(0x3170) |
| 76 | #define BB_PLL14_STATUS_REG REG(0x31D8) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 77 | #define PLLTEST_PAD_CFG_REG REG(0x2FA4) |
| 78 | #define PMEM_ACLK_CTL_REG REG(0x25A0) |
Stephen Boyd | 973e4ba | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 79 | #define QDSS_AT_CLK_SRC0_NS_REG REG(0x2180) |
| 80 | #define QDSS_AT_CLK_SRC1_NS_REG REG(0x2184) |
| 81 | #define QDSS_AT_CLK_SRC_CTL_REG REG(0x2188) |
| 82 | #define QDSS_AT_CLK_NS_REG REG(0x218C) |
| 83 | #define QDSS_HCLK_CTL_REG REG(0x22A0) |
| 84 | #define QDSS_RESETS_REG REG(0x2260) |
| 85 | #define QDSS_STM_CLK_CTL_REG REG(0x2060) |
| 86 | #define QDSS_TRACECLKIN_CLK_SRC0_NS_REG REG(0x21A0) |
| 87 | #define QDSS_TRACECLKIN_CLK_SRC1_NS_REG REG(0x21A4) |
| 88 | #define QDSS_TRACECLKIN_CLK_SRC_CTL_REG REG(0x21A8) |
| 89 | #define QDSS_TRACECLKIN_CTL_REG REG(0x21AC) |
| 90 | #define QDSS_TSCTR_CLK_SRC0_NS_REG REG(0x21C0) |
| 91 | #define QDSS_TSCTR_CLK_SRC1_NS_REG REG(0x21C4) |
| 92 | #define QDSS_TSCTR_CLK_SRC_CTL_REG REG(0x21C8) |
| 93 | #define QDSS_TSCTR_CLK_SRC_CTL_REG REG(0x21C8) |
| 94 | #define QDSS_TSCTR_CTL_REG REG(0x21CC) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 95 | #define RINGOSC_NS_REG REG(0x2DC0) |
| 96 | #define RINGOSC_STATUS_REG REG(0x2DCC) |
| 97 | #define RINGOSC_TCXO_CTL_REG REG(0x2DC4) |
| 98 | #define SC0_U_CLK_BRANCH_ENA_VOTE_REG REG(0x3080) |
| 99 | #define SDCn_APPS_CLK_MD_REG(n) REG(0x2828+(0x20*((n)-1))) |
| 100 | #define SDCn_APPS_CLK_NS_REG(n) REG(0x282C+(0x20*((n)-1))) |
| 101 | #define SDCn_HCLK_CTL_REG(n) REG(0x2820+(0x20*((n)-1))) |
| 102 | #define SDCn_RESET_REG(n) REG(0x2830+(0x20*((n)-1))) |
| 103 | #define SLIMBUS_XO_SRC_CLK_CTL_REG REG(0x2628) |
| 104 | #define TSIF_HCLK_CTL_REG REG(0x2700) |
| 105 | #define TSIF_REF_CLK_MD_REG REG(0x270C) |
| 106 | #define TSIF_REF_CLK_NS_REG REG(0x2710) |
| 107 | #define TSSC_CLK_CTL_REG REG(0x2CA0) |
| 108 | #define USB_FSn_HCLK_CTL_REG(n) REG(0x2960+(0x20*((n)-1))) |
| 109 | #define USB_FSn_RESET_REG(n) REG(0x2974+(0x20*((n)-1))) |
| 110 | #define USB_FSn_SYSTEM_CLK_CTL_REG(n) REG(0x296C+(0x20*((n)-1))) |
| 111 | #define USB_FSn_XCVR_FS_CLK_MD_REG(n) REG(0x2964+(0x20*((n)-1))) |
| 112 | #define USB_FSn_XCVR_FS_CLK_NS_REG(n) REG(0x2968+(0x20*((n)-1))) |
| 113 | #define USB_HS1_HCLK_CTL_REG REG(0x2900) |
| 114 | #define USB_HS1_RESET_REG REG(0x2910) |
| 115 | #define USB_HS1_XCVR_FS_CLK_MD_REG REG(0x2908) |
| 116 | #define USB_HS1_XCVR_FS_CLK_NS_REG REG(0x290C) |
Stephen Boyd | 94625ef | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 117 | #define USB_HSIC_HCLK_CTL_REG REG(0x2920) |
| 118 | #define USB_HSIC_HSIC_CLK_CTL_REG REG(0x2B44) |
| 119 | #define USB_HSIC_HSIC_CLK_SRC_CTL_REG REG(0x2B40) |
| 120 | #define USB_HSIC_HSIO_CAL_CLK_CTL_REG REG(0x2B48) |
| 121 | #define USB_HSIC_RESET_REG REG(0x2934) |
| 122 | #define USB_HSIC_SYSTEM_CLK_CTL_REG REG(0x292C) |
| 123 | #define USB_HSIC_XCVR_FS_CLK_MD_REG REG(0x2924) |
| 124 | #define USB_HSIC_XCVR_FS_CLK_NS_REG REG(0x2928) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 125 | #define USB_PHY0_RESET_REG REG(0x2E20) |
| 126 | |
| 127 | /* Multimedia clock registers. */ |
| 128 | #define AHB_EN_REG REG_MM(0x0008) |
| 129 | #define AHB_EN2_REG REG_MM(0x0038) |
| 130 | #define AHB_NS_REG REG_MM(0x0004) |
| 131 | #define AXI_NS_REG REG_MM(0x0014) |
Stephen Boyd | 94625ef | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 132 | #define CAMCLK0_NS_REG REG_MM(0x0148) |
| 133 | #define CAMCLK0_CC_REG REG_MM(0x0140) |
| 134 | #define CAMCLK0_MD_REG REG_MM(0x0144) |
| 135 | #define CAMCLK1_NS_REG REG_MM(0x015C) |
| 136 | #define CAMCLK1_CC_REG REG_MM(0x0154) |
| 137 | #define CAMCLK1_MD_REG REG_MM(0x0158) |
| 138 | #define CAMCLK2_NS_REG REG_MM(0x0228) |
| 139 | #define CAMCLK2_CC_REG REG_MM(0x0220) |
| 140 | #define CAMCLK2_MD_REG REG_MM(0x0224) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 141 | #define CSI0_NS_REG REG_MM(0x0048) |
| 142 | #define CSI0_CC_REG REG_MM(0x0040) |
| 143 | #define CSI0_MD_REG REG_MM(0x0044) |
| 144 | #define CSI1_NS_REG REG_MM(0x0010) |
| 145 | #define CSI1_CC_REG REG_MM(0x0024) |
| 146 | #define CSI1_MD_REG REG_MM(0x0028) |
Stephen Boyd | 94625ef | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 147 | #define CSI2_NS_REG REG_MM(0x0234) |
| 148 | #define CSI2_CC_REG REG_MM(0x022C) |
| 149 | #define CSI2_MD_REG REG_MM(0x0230) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 150 | #define CSIPHYTIMER_CC_REG REG_MM(0x0160) |
| 151 | #define CSIPHYTIMER_MD_REG REG_MM(0x0164) |
| 152 | #define CSIPHYTIMER_NS_REG REG_MM(0x0168) |
| 153 | #define DSI1_BYTE_NS_REG REG_MM(0x00B0) |
| 154 | #define DSI1_BYTE_CC_REG REG_MM(0x0090) |
| 155 | #define DSI2_BYTE_NS_REG REG_MM(0x00BC) |
| 156 | #define DSI2_BYTE_CC_REG REG_MM(0x00B4) |
| 157 | #define DSI1_ESC_NS_REG REG_MM(0x011C) |
| 158 | #define DSI1_ESC_CC_REG REG_MM(0x00CC) |
| 159 | #define DSI2_ESC_NS_REG REG_MM(0x0150) |
| 160 | #define DSI2_ESC_CC_REG REG_MM(0x013C) |
| 161 | #define DSI_PIXEL_CC_REG REG_MM(0x0130) |
| 162 | #define DSI2_PIXEL_CC_REG REG_MM(0x0094) |
| 163 | #define DBG_BUS_VEC_A_REG REG_MM(0x01C8) |
| 164 | #define DBG_BUS_VEC_B_REG REG_MM(0x01CC) |
| 165 | #define DBG_BUS_VEC_C_REG REG_MM(0x01D0) |
| 166 | #define DBG_BUS_VEC_D_REG REG_MM(0x01D4) |
| 167 | #define DBG_BUS_VEC_E_REG REG_MM(0x01D8) |
| 168 | #define DBG_BUS_VEC_F_REG REG_MM(0x01DC) |
| 169 | #define DBG_BUS_VEC_G_REG REG_MM(0x01E0) |
| 170 | #define DBG_BUS_VEC_H_REG REG_MM(0x01E4) |
| 171 | #define DBG_BUS_VEC_I_REG REG_MM(0x01E8) |
| 172 | #define DBG_CFG_REG_HS_REG REG_MM(0x01B4) |
| 173 | #define DBG_CFG_REG_LS_REG REG_MM(0x01B8) |
| 174 | #define GFX2D0_CC_REG REG_MM(0x0060) |
| 175 | #define GFX2D0_MD0_REG REG_MM(0x0064) |
| 176 | #define GFX2D0_MD1_REG REG_MM(0x0068) |
| 177 | #define GFX2D0_NS_REG REG_MM(0x0070) |
| 178 | #define GFX2D1_CC_REG REG_MM(0x0074) |
| 179 | #define GFX2D1_MD0_REG REG_MM(0x0078) |
| 180 | #define GFX2D1_MD1_REG REG_MM(0x006C) |
| 181 | #define GFX2D1_NS_REG REG_MM(0x007C) |
| 182 | #define GFX3D_CC_REG REG_MM(0x0080) |
| 183 | #define GFX3D_MD0_REG REG_MM(0x0084) |
| 184 | #define GFX3D_MD1_REG REG_MM(0x0088) |
| 185 | #define GFX3D_NS_REG REG_MM(0x008C) |
| 186 | #define IJPEG_CC_REG REG_MM(0x0098) |
| 187 | #define IJPEG_MD_REG REG_MM(0x009C) |
| 188 | #define IJPEG_NS_REG REG_MM(0x00A0) |
| 189 | #define JPEGD_CC_REG REG_MM(0x00A4) |
| 190 | #define JPEGD_NS_REG REG_MM(0x00AC) |
| 191 | #define MAXI_EN_REG REG_MM(0x0018) |
| 192 | #define MAXI_EN2_REG REG_MM(0x0020) |
| 193 | #define MAXI_EN3_REG REG_MM(0x002C) |
| 194 | #define MAXI_EN4_REG REG_MM(0x0114) |
| 195 | #define MDP_CC_REG REG_MM(0x00C0) |
| 196 | #define MDP_LUT_CC_REG REG_MM(0x016C) |
| 197 | #define MDP_MD0_REG REG_MM(0x00C4) |
| 198 | #define MDP_MD1_REG REG_MM(0x00C8) |
| 199 | #define MDP_NS_REG REG_MM(0x00D0) |
| 200 | #define MISC_CC_REG REG_MM(0x0058) |
| 201 | #define MISC_CC2_REG REG_MM(0x005C) |
Stephen Boyd | 94625ef | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 202 | #define MISC_CC3_REG REG_MM(0x0238) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 203 | #define MM_PLL1_MODE_REG REG_MM(0x031C) |
| 204 | #define ROT_CC_REG REG_MM(0x00E0) |
| 205 | #define ROT_NS_REG REG_MM(0x00E8) |
| 206 | #define SAXI_EN_REG REG_MM(0x0030) |
| 207 | #define SW_RESET_AHB_REG REG_MM(0x020C) |
| 208 | #define SW_RESET_AHB2_REG REG_MM(0x0200) |
| 209 | #define SW_RESET_ALL_REG REG_MM(0x0204) |
| 210 | #define SW_RESET_AXI_REG REG_MM(0x0208) |
| 211 | #define SW_RESET_CORE_REG REG_MM(0x0210) |
Stephen Boyd | 94625ef | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 212 | #define SW_RESET_CORE2_REG REG_MM(0x0214) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 213 | #define TV_CC_REG REG_MM(0x00EC) |
| 214 | #define TV_CC2_REG REG_MM(0x0124) |
| 215 | #define TV_MD_REG REG_MM(0x00F0) |
| 216 | #define TV_NS_REG REG_MM(0x00F4) |
| 217 | #define VCODEC_CC_REG REG_MM(0x00F8) |
| 218 | #define VCODEC_MD0_REG REG_MM(0x00FC) |
| 219 | #define VCODEC_MD1_REG REG_MM(0x0128) |
| 220 | #define VCODEC_NS_REG REG_MM(0x0100) |
| 221 | #define VFE_CC_REG REG_MM(0x0104) |
| 222 | #define VFE_MD_REG REG_MM(0x0108) |
| 223 | #define VFE_NS_REG REG_MM(0x010C) |
Stephen Boyd | 94625ef | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 224 | #define VFE_CC2_REG REG_MM(0x023C) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 225 | #define VPE_CC_REG REG_MM(0x0110) |
| 226 | #define VPE_NS_REG REG_MM(0x0118) |
| 227 | |
| 228 | /* Low-power Audio clock registers. */ |
Stephen Boyd | 3939c8d | 2011-08-29 17:36:22 -0700 | [diff] [blame] | 229 | #define LCC_CLK_HS_DEBUG_CFG_REG REG_LPA(0x00A4) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 230 | #define LCC_CLK_LS_DEBUG_CFG_REG REG_LPA(0x00A8) |
| 231 | #define LCC_CODEC_I2S_MIC_MD_REG REG_LPA(0x0064) |
| 232 | #define LCC_CODEC_I2S_MIC_NS_REG REG_LPA(0x0060) |
| 233 | #define LCC_CODEC_I2S_MIC_STATUS_REG REG_LPA(0x0068) |
| 234 | #define LCC_CODEC_I2S_SPKR_MD_REG REG_LPA(0x0070) |
| 235 | #define LCC_CODEC_I2S_SPKR_NS_REG REG_LPA(0x006C) |
| 236 | #define LCC_CODEC_I2S_SPKR_STATUS_REG REG_LPA(0x0074) |
| 237 | #define LCC_MI2S_MD_REG REG_LPA(0x004C) |
| 238 | #define LCC_MI2S_NS_REG REG_LPA(0x0048) |
| 239 | #define LCC_MI2S_STATUS_REG REG_LPA(0x0050) |
| 240 | #define LCC_PCM_MD_REG REG_LPA(0x0058) |
| 241 | #define LCC_PCM_NS_REG REG_LPA(0x0054) |
| 242 | #define LCC_PCM_STATUS_REG REG_LPA(0x005C) |
| 243 | #define LCC_PLL0_STATUS_REG REG_LPA(0x0018) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 244 | #define LCC_SPARE_I2S_MIC_MD_REG REG_LPA(0x007C) |
| 245 | #define LCC_SPARE_I2S_MIC_NS_REG REG_LPA(0x0078) |
| 246 | #define LCC_SPARE_I2S_MIC_STATUS_REG REG_LPA(0x0080) |
| 247 | #define LCC_SPARE_I2S_SPKR_MD_REG REG_LPA(0x0088) |
| 248 | #define LCC_SPARE_I2S_SPKR_NS_REG REG_LPA(0x0084) |
| 249 | #define LCC_SPARE_I2S_SPKR_STATUS_REG REG_LPA(0x008C) |
| 250 | #define LCC_SLIMBUS_NS_REG REG_LPA(0x00CC) |
| 251 | #define LCC_SLIMBUS_MD_REG REG_LPA(0x00D0) |
| 252 | #define LCC_SLIMBUS_STATUS_REG REG_LPA(0x00D4) |
| 253 | #define LCC_AHBEX_BRANCH_CTL_REG REG_LPA(0x00E4) |
| 254 | |
Matt Wagantall | 8b38f94 | 2011-08-02 18:23:18 -0700 | [diff] [blame] | 255 | #define GCC_APCS_CLK_DIAG REG_GCC(0x001C) |
| 256 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 257 | /* MUX source input identifiers. */ |
| 258 | #define pxo_to_bb_mux 0 |
| 259 | #define cxo_to_bb_mux pxo_to_bb_mux |
| 260 | #define pll0_to_bb_mux 2 |
| 261 | #define pll8_to_bb_mux 3 |
| 262 | #define pll6_to_bb_mux 4 |
| 263 | #define gnd_to_bb_mux 5 |
Stephen Boyd | 94625ef | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 264 | #define pll3_to_bb_mux 6 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 265 | #define pxo_to_mm_mux 0 |
| 266 | #define pll1_to_mm_mux 1 |
| 267 | #define pll2_to_mm_mux 1 |
| 268 | #define pll8_to_mm_mux 2 |
| 269 | #define pll0_to_mm_mux 3 |
| 270 | #define gnd_to_mm_mux 4 |
Stephen Boyd | 94625ef | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 271 | #define pll3_to_mm_mux 5 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 272 | #define hdmi_pll_to_mm_mux 3 |
| 273 | #define cxo_to_xo_mux 0 |
| 274 | #define pxo_to_xo_mux 1 |
| 275 | #define gnd_to_xo_mux 3 |
| 276 | #define pxo_to_lpa_mux 0 |
| 277 | #define cxo_to_lpa_mux 1 |
| 278 | #define pll4_to_lpa_mux 2 |
| 279 | #define gnd_to_lpa_mux 6 |
| 280 | |
| 281 | /* Test Vector Macros */ |
| 282 | #define TEST_TYPE_PER_LS 1 |
| 283 | #define TEST_TYPE_PER_HS 2 |
| 284 | #define TEST_TYPE_MM_LS 3 |
| 285 | #define TEST_TYPE_MM_HS 4 |
| 286 | #define TEST_TYPE_LPA 5 |
Matt Wagantall | 8b38f94 | 2011-08-02 18:23:18 -0700 | [diff] [blame] | 287 | #define TEST_TYPE_CPUL2 6 |
Stephen Boyd | 3939c8d | 2011-08-29 17:36:22 -0700 | [diff] [blame] | 288 | #define TEST_TYPE_LPA_HS 7 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 289 | #define TEST_TYPE_SHIFT 24 |
| 290 | #define TEST_CLK_SEL_MASK BM(23, 0) |
| 291 | #define TEST_VECTOR(s, t) (((t) << TEST_TYPE_SHIFT) | BVAL(23, 0, (s))) |
| 292 | #define TEST_PER_LS(s) TEST_VECTOR((s), TEST_TYPE_PER_LS) |
| 293 | #define TEST_PER_HS(s) TEST_VECTOR((s), TEST_TYPE_PER_HS) |
| 294 | #define TEST_MM_LS(s) TEST_VECTOR((s), TEST_TYPE_MM_LS) |
| 295 | #define TEST_MM_HS(s) TEST_VECTOR((s), TEST_TYPE_MM_HS) |
| 296 | #define TEST_LPA(s) TEST_VECTOR((s), TEST_TYPE_LPA) |
Stephen Boyd | 3939c8d | 2011-08-29 17:36:22 -0700 | [diff] [blame] | 297 | #define TEST_LPA_HS(s) TEST_VECTOR((s), TEST_TYPE_LPA_HS) |
Matt Wagantall | 8b38f94 | 2011-08-02 18:23:18 -0700 | [diff] [blame] | 298 | #define TEST_CPUL2(s) TEST_VECTOR((s), TEST_TYPE_CPUL2) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 299 | |
| 300 | #define MN_MODE_DUAL_EDGE 0x2 |
| 301 | |
| 302 | /* MD Registers */ |
| 303 | #define MD4(m_lsb, m, n_lsb, n) \ |
| 304 | (BVAL((m_lsb+3), m_lsb, m) | BVAL((n_lsb+3), n_lsb, ~(n))) |
| 305 | #define MD8(m_lsb, m, n_lsb, n) \ |
| 306 | (BVAL((m_lsb+7), m_lsb, m) | BVAL((n_lsb+7), n_lsb, ~(n))) |
| 307 | #define MD16(m, n) (BVAL(31, 16, m) | BVAL(15, 0, ~(n))) |
| 308 | |
| 309 | /* NS Registers */ |
| 310 | #define NS(n_msb, n_lsb, n, m, mde_lsb, d_msb, d_lsb, d, s_msb, s_lsb, s) \ |
| 311 | (BVAL(n_msb, n_lsb, ~(n-m)) \ |
| 312 | | (BVAL((mde_lsb+1), mde_lsb, MN_MODE_DUAL_EDGE) * !!(n)) \ |
| 313 | | BVAL(d_msb, d_lsb, (d-1)) | BVAL(s_msb, s_lsb, s)) |
| 314 | |
| 315 | #define NS_MM(n_msb, n_lsb, n, m, d_msb, d_lsb, d, s_msb, s_lsb, s) \ |
| 316 | (BVAL(n_msb, n_lsb, ~(n-m)) | BVAL(d_msb, d_lsb, (d-1)) \ |
| 317 | | BVAL(s_msb, s_lsb, s)) |
| 318 | |
| 319 | #define NS_DIVSRC(d_msb , d_lsb, d, s_msb, s_lsb, s) \ |
| 320 | (BVAL(d_msb, d_lsb, (d-1)) | BVAL(s_msb, s_lsb, s)) |
| 321 | |
| 322 | #define NS_DIV(d_msb , d_lsb, d) \ |
| 323 | BVAL(d_msb, d_lsb, (d-1)) |
| 324 | |
| 325 | #define NS_SRC_SEL(s_msb, s_lsb, s) \ |
| 326 | BVAL(s_msb, s_lsb, s) |
| 327 | |
| 328 | #define NS_MND_BANKED4(n0_lsb, n1_lsb, n, m, s0_lsb, s1_lsb, s) \ |
| 329 | (BVAL((n0_lsb+3), n0_lsb, ~(n-m)) \ |
| 330 | | BVAL((n1_lsb+3), n1_lsb, ~(n-m)) \ |
| 331 | | BVAL((s0_lsb+2), s0_lsb, s) \ |
| 332 | | BVAL((s1_lsb+2), s1_lsb, s)) |
| 333 | |
| 334 | #define NS_MND_BANKED8(n0_lsb, n1_lsb, n, m, s0_lsb, s1_lsb, s) \ |
| 335 | (BVAL((n0_lsb+7), n0_lsb, ~(n-m)) \ |
| 336 | | BVAL((n1_lsb+7), n1_lsb, ~(n-m)) \ |
| 337 | | BVAL((s0_lsb+2), s0_lsb, s) \ |
| 338 | | BVAL((s1_lsb+2), s1_lsb, s)) |
| 339 | |
| 340 | #define NS_DIVSRC_BANKED(d0_msb, d0_lsb, d1_msb, d1_lsb, d, \ |
| 341 | s0_msb, s0_lsb, s1_msb, s1_lsb, s) \ |
| 342 | (BVAL(d0_msb, d0_lsb, (d-1)) | BVAL(d1_msb, d1_lsb, (d-1)) \ |
| 343 | | BVAL(s0_msb, s0_lsb, s) \ |
| 344 | | BVAL(s1_msb, s1_lsb, s)) |
| 345 | |
| 346 | /* CC Registers */ |
| 347 | #define CC(mde_lsb, n) (BVAL((mde_lsb+1), mde_lsb, MN_MODE_DUAL_EDGE) * !!(n)) |
| 348 | #define CC_BANKED(mde0_lsb, mde1_lsb, n) \ |
| 349 | ((BVAL((mde0_lsb+1), mde0_lsb, MN_MODE_DUAL_EDGE) \ |
| 350 | | BVAL((mde1_lsb+1), mde1_lsb, MN_MODE_DUAL_EDGE)) \ |
| 351 | * !!(n)) |
| 352 | |
| 353 | struct pll_rate { |
| 354 | const uint32_t l_val; |
| 355 | const uint32_t m_val; |
| 356 | const uint32_t n_val; |
| 357 | const uint32_t vco; |
| 358 | const uint32_t post_div; |
| 359 | const uint32_t i_bits; |
| 360 | }; |
| 361 | #define PLL_RATE(l, m, n, v, d, i) { l, m, n, v, (d>>1), i } |
| 362 | |
| 363 | /* |
| 364 | * Clock Descriptions |
| 365 | */ |
| 366 | |
| 367 | static struct msm_xo_voter *xo_pxo, *xo_cxo; |
| 368 | |
| 369 | static int pxo_clk_enable(struct clk *clk) |
| 370 | { |
| 371 | return msm_xo_mode_vote(xo_pxo, MSM_XO_MODE_ON); |
| 372 | } |
| 373 | |
| 374 | static void pxo_clk_disable(struct clk *clk) |
| 375 | { |
| 376 | msm_xo_mode_vote(xo_pxo, MSM_XO_MODE_OFF); |
| 377 | } |
| 378 | |
| 379 | static struct clk_ops clk_ops_pxo = { |
| 380 | .enable = pxo_clk_enable, |
| 381 | .disable = pxo_clk_disable, |
| 382 | .get_rate = fixed_clk_get_rate, |
| 383 | .is_local = local_clk_is_local, |
| 384 | }; |
| 385 | |
| 386 | static struct fixed_clk pxo_clk = { |
| 387 | .rate = 27000000, |
| 388 | .c = { |
| 389 | .dbg_name = "pxo_clk", |
| 390 | .ops = &clk_ops_pxo, |
| 391 | CLK_INIT(pxo_clk.c), |
| 392 | }, |
| 393 | }; |
| 394 | |
| 395 | static int cxo_clk_enable(struct clk *clk) |
| 396 | { |
| 397 | return msm_xo_mode_vote(xo_cxo, MSM_XO_MODE_ON); |
| 398 | } |
| 399 | |
| 400 | static void cxo_clk_disable(struct clk *clk) |
| 401 | { |
| 402 | msm_xo_mode_vote(xo_cxo, MSM_XO_MODE_OFF); |
| 403 | } |
| 404 | |
| 405 | static struct clk_ops clk_ops_cxo = { |
| 406 | .enable = cxo_clk_enable, |
| 407 | .disable = cxo_clk_disable, |
| 408 | .get_rate = fixed_clk_get_rate, |
| 409 | .is_local = local_clk_is_local, |
| 410 | }; |
| 411 | |
| 412 | static struct fixed_clk cxo_clk = { |
| 413 | .rate = 19200000, |
| 414 | .c = { |
| 415 | .dbg_name = "cxo_clk", |
| 416 | .ops = &clk_ops_cxo, |
| 417 | CLK_INIT(cxo_clk.c), |
| 418 | }, |
| 419 | }; |
| 420 | |
| 421 | static struct pll_clk pll2_clk = { |
| 422 | .rate = 800000000, |
| 423 | .mode_reg = MM_PLL1_MODE_REG, |
| 424 | .parent = &pxo_clk.c, |
| 425 | .c = { |
| 426 | .dbg_name = "pll2_clk", |
| 427 | .ops = &clk_ops_pll, |
| 428 | CLK_INIT(pll2_clk.c), |
| 429 | }, |
| 430 | }; |
| 431 | |
Stephen Boyd | 94625ef | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 432 | static struct pll_clk pll3_clk = { |
| 433 | .rate = 1200000000, |
| 434 | .mode_reg = BB_MMCC_PLL2_MODE_REG, |
| 435 | .parent = &pxo_clk.c, |
| 436 | .c = { |
| 437 | .dbg_name = "pll3_clk", |
| 438 | .ops = &clk_ops_pll, |
| 439 | CLK_INIT(pll3_clk.c), |
| 440 | }, |
| 441 | }; |
| 442 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 443 | static struct pll_vote_clk pll4_clk = { |
| 444 | .rate = 393216000, |
| 445 | .en_reg = BB_PLL_ENA_SC0_REG, |
| 446 | .en_mask = BIT(4), |
| 447 | .status_reg = LCC_PLL0_STATUS_REG, |
| 448 | .parent = &pxo_clk.c, |
| 449 | .c = { |
| 450 | .dbg_name = "pll4_clk", |
| 451 | .ops = &clk_ops_pll_vote, |
| 452 | CLK_INIT(pll4_clk.c), |
| 453 | }, |
| 454 | }; |
| 455 | |
| 456 | static struct pll_vote_clk pll8_clk = { |
| 457 | .rate = 384000000, |
| 458 | .en_reg = BB_PLL_ENA_SC0_REG, |
| 459 | .en_mask = BIT(8), |
| 460 | .status_reg = BB_PLL8_STATUS_REG, |
| 461 | .parent = &pxo_clk.c, |
| 462 | .c = { |
| 463 | .dbg_name = "pll8_clk", |
| 464 | .ops = &clk_ops_pll_vote, |
| 465 | CLK_INIT(pll8_clk.c), |
| 466 | }, |
| 467 | }; |
| 468 | |
Stephen Boyd | 94625ef | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 469 | static struct pll_vote_clk pll14_clk = { |
| 470 | .rate = 480000000, |
| 471 | .en_reg = BB_PLL_ENA_SC0_REG, |
| 472 | .en_mask = BIT(14), |
| 473 | .status_reg = BB_PLL14_STATUS_REG, |
| 474 | .parent = &pxo_clk.c, |
| 475 | .c = { |
| 476 | .dbg_name = "pll14_clk", |
| 477 | .ops = &clk_ops_pll_vote, |
| 478 | CLK_INIT(pll14_clk.c), |
| 479 | }, |
| 480 | }; |
| 481 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 482 | /* |
| 483 | * SoC-specific functions required by clock-local driver |
| 484 | */ |
| 485 | |
| 486 | /* Update the sys_vdd voltage given a level. */ |
| 487 | static int msm8960_update_sys_vdd(enum sys_vdd_level level) |
| 488 | { |
| 489 | static const int vdd_uv[] = { |
| 490 | [NONE...LOW] = 945000, |
| 491 | [NOMINAL] = 1050000, |
| 492 | [HIGH] = 1150000, |
| 493 | }; |
| 494 | |
| 495 | return rpm_vreg_set_voltage(RPM_VREG_ID_PM8921_S3, RPM_VREG_VOTER3, |
| 496 | vdd_uv[level], vdd_uv[HIGH], 1); |
| 497 | } |
| 498 | |
| 499 | static int soc_clk_reset(struct clk *clk, enum clk_reset_action action) |
| 500 | { |
| 501 | return branch_reset(&to_rcg_clk(clk)->b, action); |
| 502 | } |
| 503 | |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 504 | static struct clk_ops clk_ops_rcg_8960 = { |
Matt Wagantall | 0625ea0 | 2011-07-13 18:51:56 -0700 | [diff] [blame] | 505 | .enable = rcg_clk_enable, |
| 506 | .disable = rcg_clk_disable, |
| 507 | .auto_off = rcg_clk_auto_off, |
Matt Wagantall | 53d968f | 2011-07-19 13:22:53 -0700 | [diff] [blame] | 508 | .handoff = rcg_clk_handoff, |
Matt Wagantall | 0625ea0 | 2011-07-13 18:51:56 -0700 | [diff] [blame] | 509 | .set_rate = rcg_clk_set_rate, |
| 510 | .set_min_rate = rcg_clk_set_min_rate, |
Matt Wagantall | 0625ea0 | 2011-07-13 18:51:56 -0700 | [diff] [blame] | 511 | .get_rate = rcg_clk_get_rate, |
| 512 | .list_rate = rcg_clk_list_rate, |
| 513 | .is_enabled = rcg_clk_is_enabled, |
| 514 | .round_rate = rcg_clk_round_rate, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 515 | .reset = soc_clk_reset, |
| 516 | .is_local = local_clk_is_local, |
Matt Wagantall | 0625ea0 | 2011-07-13 18:51:56 -0700 | [diff] [blame] | 517 | .get_parent = rcg_clk_get_parent, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 518 | }; |
| 519 | |
| 520 | static struct clk_ops clk_ops_branch = { |
| 521 | .enable = branch_clk_enable, |
| 522 | .disable = branch_clk_disable, |
| 523 | .auto_off = branch_clk_auto_off, |
| 524 | .is_enabled = branch_clk_is_enabled, |
| 525 | .reset = branch_clk_reset, |
| 526 | .is_local = local_clk_is_local, |
| 527 | .get_parent = branch_clk_get_parent, |
| 528 | .set_parent = branch_clk_set_parent, |
| 529 | }; |
| 530 | |
| 531 | static struct clk_ops clk_ops_reset = { |
| 532 | .reset = branch_clk_reset, |
| 533 | .is_local = local_clk_is_local, |
| 534 | }; |
| 535 | |
| 536 | /* AXI Interfaces */ |
| 537 | static struct branch_clk gmem_axi_clk = { |
| 538 | .b = { |
| 539 | .ctl_reg = MAXI_EN_REG, |
| 540 | .en_mask = BIT(24), |
| 541 | .halt_reg = DBG_BUS_VEC_E_REG, |
| 542 | .halt_bit = 6, |
| 543 | }, |
| 544 | .c = { |
| 545 | .dbg_name = "gmem_axi_clk", |
| 546 | .ops = &clk_ops_branch, |
| 547 | CLK_INIT(gmem_axi_clk.c), |
| 548 | }, |
| 549 | }; |
| 550 | |
| 551 | static struct branch_clk ijpeg_axi_clk = { |
| 552 | .b = { |
| 553 | .ctl_reg = MAXI_EN_REG, |
| 554 | .en_mask = BIT(21), |
| 555 | .reset_reg = SW_RESET_AXI_REG, |
| 556 | .reset_mask = BIT(14), |
| 557 | .halt_reg = DBG_BUS_VEC_E_REG, |
| 558 | .halt_bit = 4, |
| 559 | }, |
| 560 | .c = { |
| 561 | .dbg_name = "ijpeg_axi_clk", |
| 562 | .ops = &clk_ops_branch, |
| 563 | CLK_INIT(ijpeg_axi_clk.c), |
| 564 | }, |
| 565 | }; |
| 566 | |
| 567 | static struct branch_clk imem_axi_clk = { |
| 568 | .b = { |
| 569 | .ctl_reg = MAXI_EN_REG, |
| 570 | .en_mask = BIT(22), |
| 571 | .reset_reg = SW_RESET_CORE_REG, |
| 572 | .reset_mask = BIT(10), |
| 573 | .halt_reg = DBG_BUS_VEC_E_REG, |
| 574 | .halt_bit = 7, |
| 575 | }, |
| 576 | .c = { |
| 577 | .dbg_name = "imem_axi_clk", |
| 578 | .ops = &clk_ops_branch, |
| 579 | CLK_INIT(imem_axi_clk.c), |
| 580 | }, |
| 581 | }; |
| 582 | |
| 583 | static struct branch_clk jpegd_axi_clk = { |
| 584 | .b = { |
| 585 | .ctl_reg = MAXI_EN_REG, |
| 586 | .en_mask = BIT(25), |
| 587 | .halt_reg = DBG_BUS_VEC_E_REG, |
| 588 | .halt_bit = 5, |
| 589 | }, |
| 590 | .c = { |
| 591 | .dbg_name = "jpegd_axi_clk", |
| 592 | .ops = &clk_ops_branch, |
| 593 | CLK_INIT(jpegd_axi_clk.c), |
| 594 | }, |
| 595 | }; |
| 596 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 597 | static struct branch_clk vcodec_axi_b_clk = { |
| 598 | .b = { |
| 599 | .ctl_reg = MAXI_EN4_REG, |
| 600 | .en_mask = BIT(23), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 601 | .halt_reg = DBG_BUS_VEC_I_REG, |
| 602 | .halt_bit = 25, |
| 603 | }, |
| 604 | .c = { |
| 605 | .dbg_name = "vcodec_axi_b_clk", |
| 606 | .ops = &clk_ops_branch, |
| 607 | CLK_INIT(vcodec_axi_b_clk.c), |
| 608 | }, |
| 609 | }; |
| 610 | |
Matt Wagantall | 91f4270 | 2011-07-14 12:01:15 -0700 | [diff] [blame] | 611 | static struct branch_clk vcodec_axi_a_clk = { |
| 612 | .b = { |
| 613 | .ctl_reg = MAXI_EN4_REG, |
| 614 | .en_mask = BIT(25), |
Matt Wagantall | 91f4270 | 2011-07-14 12:01:15 -0700 | [diff] [blame] | 615 | .halt_reg = DBG_BUS_VEC_I_REG, |
| 616 | .halt_bit = 26, |
| 617 | }, |
Matt Wagantall | 91f4270 | 2011-07-14 12:01:15 -0700 | [diff] [blame] | 618 | .c = { |
| 619 | .dbg_name = "vcodec_axi_a_clk", |
| 620 | .ops = &clk_ops_branch, |
| 621 | CLK_INIT(vcodec_axi_a_clk.c), |
Stephen Boyd | 7fa2674 | 2011-08-11 23:22:29 -0700 | [diff] [blame] | 622 | .depends = &vcodec_axi_b_clk.c, |
Matt Wagantall | 91f4270 | 2011-07-14 12:01:15 -0700 | [diff] [blame] | 623 | }, |
| 624 | }; |
| 625 | |
| 626 | static struct branch_clk vcodec_axi_clk = { |
| 627 | .b = { |
| 628 | .ctl_reg = MAXI_EN_REG, |
| 629 | .en_mask = BIT(19), |
| 630 | .reset_reg = SW_RESET_AXI_REG, |
Matt Wagantall | fe2ee05 | 2011-07-14 13:33:44 -0700 | [diff] [blame] | 631 | .reset_mask = BIT(4)|BIT(5)|BIT(7), |
Matt Wagantall | 91f4270 | 2011-07-14 12:01:15 -0700 | [diff] [blame] | 632 | .halt_reg = DBG_BUS_VEC_E_REG, |
| 633 | .halt_bit = 3, |
| 634 | }, |
Matt Wagantall | 91f4270 | 2011-07-14 12:01:15 -0700 | [diff] [blame] | 635 | .c = { |
| 636 | .dbg_name = "vcodec_axi_clk", |
| 637 | .ops = &clk_ops_branch, |
| 638 | CLK_INIT(vcodec_axi_clk.c), |
Stephen Boyd | 7fa2674 | 2011-08-11 23:22:29 -0700 | [diff] [blame] | 639 | .depends = &vcodec_axi_a_clk.c, |
Matt Wagantall | 91f4270 | 2011-07-14 12:01:15 -0700 | [diff] [blame] | 640 | }, |
| 641 | }; |
| 642 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 643 | static struct branch_clk vfe_axi_clk = { |
| 644 | .b = { |
| 645 | .ctl_reg = MAXI_EN_REG, |
| 646 | .en_mask = BIT(18), |
| 647 | .reset_reg = SW_RESET_AXI_REG, |
| 648 | .reset_mask = BIT(9), |
| 649 | .halt_reg = DBG_BUS_VEC_E_REG, |
| 650 | .halt_bit = 0, |
| 651 | }, |
| 652 | .c = { |
| 653 | .dbg_name = "vfe_axi_clk", |
| 654 | .ops = &clk_ops_branch, |
| 655 | CLK_INIT(vfe_axi_clk.c), |
| 656 | }, |
| 657 | }; |
| 658 | |
| 659 | static struct branch_clk mdp_axi_clk = { |
| 660 | .b = { |
| 661 | .ctl_reg = MAXI_EN_REG, |
| 662 | .en_mask = BIT(23), |
| 663 | .reset_reg = SW_RESET_AXI_REG, |
| 664 | .reset_mask = BIT(13), |
| 665 | .halt_reg = DBG_BUS_VEC_E_REG, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 666 | .halt_bit = 8, |
| 667 | }, |
| 668 | .c = { |
| 669 | .dbg_name = "mdp_axi_clk", |
| 670 | .ops = &clk_ops_branch, |
| 671 | CLK_INIT(mdp_axi_clk.c), |
| 672 | }, |
| 673 | }; |
| 674 | |
| 675 | static struct branch_clk rot_axi_clk = { |
| 676 | .b = { |
| 677 | .ctl_reg = MAXI_EN2_REG, |
| 678 | .en_mask = BIT(24), |
| 679 | .reset_reg = SW_RESET_AXI_REG, |
| 680 | .reset_mask = BIT(6), |
| 681 | .halt_reg = DBG_BUS_VEC_E_REG, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 682 | .halt_bit = 2, |
| 683 | }, |
| 684 | .c = { |
| 685 | .dbg_name = "rot_axi_clk", |
| 686 | .ops = &clk_ops_branch, |
| 687 | CLK_INIT(rot_axi_clk.c), |
| 688 | }, |
| 689 | }; |
| 690 | |
| 691 | static struct branch_clk vpe_axi_clk = { |
| 692 | .b = { |
| 693 | .ctl_reg = MAXI_EN2_REG, |
| 694 | .en_mask = BIT(26), |
| 695 | .reset_reg = SW_RESET_AXI_REG, |
| 696 | .reset_mask = BIT(15), |
| 697 | .halt_reg = DBG_BUS_VEC_E_REG, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 698 | .halt_bit = 1, |
| 699 | }, |
| 700 | .c = { |
| 701 | .dbg_name = "vpe_axi_clk", |
| 702 | .ops = &clk_ops_branch, |
| 703 | CLK_INIT(vpe_axi_clk.c), |
| 704 | }, |
| 705 | }; |
| 706 | |
| 707 | /* AHB Interfaces */ |
| 708 | static struct branch_clk amp_p_clk = { |
| 709 | .b = { |
| 710 | .ctl_reg = AHB_EN_REG, |
| 711 | .en_mask = BIT(24), |
| 712 | .halt_reg = DBG_BUS_VEC_F_REG, |
| 713 | .halt_bit = 18, |
| 714 | }, |
| 715 | .c = { |
| 716 | .dbg_name = "amp_p_clk", |
| 717 | .ops = &clk_ops_branch, |
| 718 | CLK_INIT(amp_p_clk.c), |
| 719 | }, |
| 720 | }; |
| 721 | |
Matt Wagantall | c23eee9 | 2011-08-16 23:06:52 -0700 | [diff] [blame] | 722 | static struct branch_clk csi_p_clk = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 723 | .b = { |
| 724 | .ctl_reg = AHB_EN_REG, |
| 725 | .en_mask = BIT(7), |
| 726 | .reset_reg = SW_RESET_AHB_REG, |
| 727 | .reset_mask = BIT(17), |
| 728 | .halt_reg = DBG_BUS_VEC_F_REG, |
| 729 | .halt_bit = 16, |
| 730 | }, |
| 731 | .c = { |
Matt Wagantall | c23eee9 | 2011-08-16 23:06:52 -0700 | [diff] [blame] | 732 | .dbg_name = "csi_p_clk", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 733 | .ops = &clk_ops_branch, |
Matt Wagantall | c23eee9 | 2011-08-16 23:06:52 -0700 | [diff] [blame] | 734 | CLK_INIT(csi_p_clk.c), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 735 | }, |
| 736 | }; |
| 737 | |
| 738 | static struct branch_clk dsi1_m_p_clk = { |
| 739 | .b = { |
| 740 | .ctl_reg = AHB_EN_REG, |
| 741 | .en_mask = BIT(9), |
| 742 | .reset_reg = SW_RESET_AHB_REG, |
| 743 | .reset_mask = BIT(6), |
| 744 | .halt_reg = DBG_BUS_VEC_F_REG, |
| 745 | .halt_bit = 19, |
| 746 | }, |
| 747 | .c = { |
| 748 | .dbg_name = "dsi1_m_p_clk", |
| 749 | .ops = &clk_ops_branch, |
| 750 | CLK_INIT(dsi1_m_p_clk.c), |
| 751 | }, |
| 752 | }; |
| 753 | |
| 754 | static struct branch_clk dsi1_s_p_clk = { |
| 755 | .b = { |
| 756 | .ctl_reg = AHB_EN_REG, |
| 757 | .en_mask = BIT(18), |
| 758 | .reset_reg = SW_RESET_AHB_REG, |
| 759 | .reset_mask = BIT(5), |
| 760 | .halt_reg = DBG_BUS_VEC_F_REG, |
| 761 | .halt_bit = 21, |
| 762 | }, |
| 763 | .c = { |
| 764 | .dbg_name = "dsi1_s_p_clk", |
| 765 | .ops = &clk_ops_branch, |
| 766 | CLK_INIT(dsi1_s_p_clk.c), |
| 767 | }, |
| 768 | }; |
| 769 | |
| 770 | static struct branch_clk dsi2_m_p_clk = { |
| 771 | .b = { |
| 772 | .ctl_reg = AHB_EN_REG, |
| 773 | .en_mask = BIT(17), |
| 774 | .reset_reg = SW_RESET_AHB2_REG, |
| 775 | .reset_mask = BIT(1), |
| 776 | .halt_reg = DBG_BUS_VEC_E_REG, |
| 777 | .halt_bit = 18, |
| 778 | }, |
| 779 | .c = { |
| 780 | .dbg_name = "dsi2_m_p_clk", |
| 781 | .ops = &clk_ops_branch, |
| 782 | CLK_INIT(dsi2_m_p_clk.c), |
| 783 | }, |
| 784 | }; |
| 785 | |
| 786 | static struct branch_clk dsi2_s_p_clk = { |
| 787 | .b = { |
| 788 | .ctl_reg = AHB_EN_REG, |
| 789 | .en_mask = BIT(22), |
| 790 | .reset_reg = SW_RESET_AHB2_REG, |
| 791 | .reset_mask = BIT(0), |
| 792 | .halt_reg = DBG_BUS_VEC_F_REG, |
| 793 | .halt_bit = 20, |
| 794 | }, |
| 795 | .c = { |
| 796 | .dbg_name = "dsi2_s_p_clk", |
| 797 | .ops = &clk_ops_branch, |
| 798 | CLK_INIT(dsi2_s_p_clk.c), |
| 799 | }, |
| 800 | }; |
| 801 | |
| 802 | static struct branch_clk gfx2d0_p_clk = { |
| 803 | .b = { |
| 804 | .ctl_reg = AHB_EN_REG, |
| 805 | .en_mask = BIT(19), |
| 806 | .reset_reg = SW_RESET_AHB_REG, |
| 807 | .reset_mask = BIT(12), |
| 808 | .halt_reg = DBG_BUS_VEC_F_REG, |
| 809 | .halt_bit = 2, |
| 810 | }, |
| 811 | .c = { |
| 812 | .dbg_name = "gfx2d0_p_clk", |
| 813 | .ops = &clk_ops_branch, |
| 814 | CLK_INIT(gfx2d0_p_clk.c), |
| 815 | }, |
| 816 | }; |
| 817 | |
| 818 | static struct branch_clk gfx2d1_p_clk = { |
| 819 | .b = { |
| 820 | .ctl_reg = AHB_EN_REG, |
| 821 | .en_mask = BIT(2), |
| 822 | .reset_reg = SW_RESET_AHB_REG, |
| 823 | .reset_mask = BIT(11), |
| 824 | .halt_reg = DBG_BUS_VEC_F_REG, |
| 825 | .halt_bit = 3, |
| 826 | }, |
| 827 | .c = { |
| 828 | .dbg_name = "gfx2d1_p_clk", |
| 829 | .ops = &clk_ops_branch, |
| 830 | CLK_INIT(gfx2d1_p_clk.c), |
| 831 | }, |
| 832 | }; |
| 833 | |
| 834 | static struct branch_clk gfx3d_p_clk = { |
| 835 | .b = { |
| 836 | .ctl_reg = AHB_EN_REG, |
| 837 | .en_mask = BIT(3), |
| 838 | .reset_reg = SW_RESET_AHB_REG, |
| 839 | .reset_mask = BIT(10), |
| 840 | .halt_reg = DBG_BUS_VEC_F_REG, |
| 841 | .halt_bit = 4, |
| 842 | }, |
| 843 | .c = { |
| 844 | .dbg_name = "gfx3d_p_clk", |
| 845 | .ops = &clk_ops_branch, |
| 846 | CLK_INIT(gfx3d_p_clk.c), |
| 847 | }, |
| 848 | }; |
| 849 | |
| 850 | static struct branch_clk hdmi_m_p_clk = { |
| 851 | .b = { |
| 852 | .ctl_reg = AHB_EN_REG, |
| 853 | .en_mask = BIT(14), |
| 854 | .reset_reg = SW_RESET_AHB_REG, |
| 855 | .reset_mask = BIT(9), |
| 856 | .halt_reg = DBG_BUS_VEC_F_REG, |
| 857 | .halt_bit = 5, |
| 858 | }, |
| 859 | .c = { |
| 860 | .dbg_name = "hdmi_m_p_clk", |
| 861 | .ops = &clk_ops_branch, |
| 862 | CLK_INIT(hdmi_m_p_clk.c), |
| 863 | }, |
| 864 | }; |
| 865 | |
| 866 | static struct branch_clk hdmi_s_p_clk = { |
| 867 | .b = { |
| 868 | .ctl_reg = AHB_EN_REG, |
| 869 | .en_mask = BIT(4), |
| 870 | .reset_reg = SW_RESET_AHB_REG, |
| 871 | .reset_mask = BIT(9), |
| 872 | .halt_reg = DBG_BUS_VEC_F_REG, |
| 873 | .halt_bit = 6, |
| 874 | }, |
| 875 | .c = { |
| 876 | .dbg_name = "hdmi_s_p_clk", |
| 877 | .ops = &clk_ops_branch, |
| 878 | CLK_INIT(hdmi_s_p_clk.c), |
| 879 | }, |
| 880 | }; |
| 881 | |
| 882 | static struct branch_clk ijpeg_p_clk = { |
| 883 | .b = { |
| 884 | .ctl_reg = AHB_EN_REG, |
| 885 | .en_mask = BIT(5), |
| 886 | .reset_reg = SW_RESET_AHB_REG, |
| 887 | .reset_mask = BIT(7), |
| 888 | .halt_reg = DBG_BUS_VEC_F_REG, |
| 889 | .halt_bit = 9, |
| 890 | }, |
| 891 | .c = { |
| 892 | .dbg_name = "ijpeg_p_clk", |
| 893 | .ops = &clk_ops_branch, |
| 894 | CLK_INIT(ijpeg_p_clk.c), |
| 895 | }, |
| 896 | }; |
| 897 | |
| 898 | static struct branch_clk imem_p_clk = { |
| 899 | .b = { |
| 900 | .ctl_reg = AHB_EN_REG, |
| 901 | .en_mask = BIT(6), |
| 902 | .reset_reg = SW_RESET_AHB_REG, |
| 903 | .reset_mask = BIT(8), |
| 904 | .halt_reg = DBG_BUS_VEC_F_REG, |
| 905 | .halt_bit = 10, |
| 906 | }, |
| 907 | .c = { |
| 908 | .dbg_name = "imem_p_clk", |
| 909 | .ops = &clk_ops_branch, |
| 910 | CLK_INIT(imem_p_clk.c), |
| 911 | }, |
| 912 | }; |
| 913 | |
| 914 | static struct branch_clk jpegd_p_clk = { |
| 915 | .b = { |
| 916 | .ctl_reg = AHB_EN_REG, |
| 917 | .en_mask = BIT(21), |
| 918 | .reset_reg = SW_RESET_AHB_REG, |
| 919 | .reset_mask = BIT(4), |
| 920 | .halt_reg = DBG_BUS_VEC_F_REG, |
| 921 | .halt_bit = 7, |
| 922 | }, |
| 923 | .c = { |
| 924 | .dbg_name = "jpegd_p_clk", |
| 925 | .ops = &clk_ops_branch, |
| 926 | CLK_INIT(jpegd_p_clk.c), |
| 927 | }, |
| 928 | }; |
| 929 | |
| 930 | static struct branch_clk mdp_p_clk = { |
| 931 | .b = { |
| 932 | .ctl_reg = AHB_EN_REG, |
| 933 | .en_mask = BIT(10), |
| 934 | .reset_reg = SW_RESET_AHB_REG, |
| 935 | .reset_mask = BIT(3), |
| 936 | .halt_reg = DBG_BUS_VEC_F_REG, |
| 937 | .halt_bit = 11, |
| 938 | }, |
| 939 | .c = { |
| 940 | .dbg_name = "mdp_p_clk", |
| 941 | .ops = &clk_ops_branch, |
| 942 | CLK_INIT(mdp_p_clk.c), |
| 943 | }, |
| 944 | }; |
| 945 | |
| 946 | static struct branch_clk rot_p_clk = { |
| 947 | .b = { |
| 948 | .ctl_reg = AHB_EN_REG, |
| 949 | .en_mask = BIT(12), |
| 950 | .reset_reg = SW_RESET_AHB_REG, |
| 951 | .reset_mask = BIT(2), |
| 952 | .halt_reg = DBG_BUS_VEC_F_REG, |
| 953 | .halt_bit = 13, |
| 954 | }, |
| 955 | .c = { |
| 956 | .dbg_name = "rot_p_clk", |
| 957 | .ops = &clk_ops_branch, |
| 958 | CLK_INIT(rot_p_clk.c), |
| 959 | }, |
| 960 | }; |
| 961 | |
| 962 | static struct branch_clk smmu_p_clk = { |
| 963 | .b = { |
| 964 | .ctl_reg = AHB_EN_REG, |
| 965 | .en_mask = BIT(15), |
| 966 | .halt_reg = DBG_BUS_VEC_F_REG, |
| 967 | .halt_bit = 22, |
| 968 | }, |
| 969 | .c = { |
| 970 | .dbg_name = "smmu_p_clk", |
| 971 | .ops = &clk_ops_branch, |
| 972 | CLK_INIT(smmu_p_clk.c), |
| 973 | }, |
| 974 | }; |
| 975 | |
| 976 | static struct branch_clk tv_enc_p_clk = { |
| 977 | .b = { |
| 978 | .ctl_reg = AHB_EN_REG, |
| 979 | .en_mask = BIT(25), |
| 980 | .reset_reg = SW_RESET_AHB_REG, |
| 981 | .reset_mask = BIT(15), |
| 982 | .halt_reg = DBG_BUS_VEC_F_REG, |
| 983 | .halt_bit = 23, |
| 984 | }, |
| 985 | .c = { |
| 986 | .dbg_name = "tv_enc_p_clk", |
| 987 | .ops = &clk_ops_branch, |
| 988 | CLK_INIT(tv_enc_p_clk.c), |
| 989 | }, |
| 990 | }; |
| 991 | |
| 992 | static struct branch_clk vcodec_p_clk = { |
| 993 | .b = { |
| 994 | .ctl_reg = AHB_EN_REG, |
| 995 | .en_mask = BIT(11), |
| 996 | .reset_reg = SW_RESET_AHB_REG, |
| 997 | .reset_mask = BIT(1), |
| 998 | .halt_reg = DBG_BUS_VEC_F_REG, |
| 999 | .halt_bit = 12, |
| 1000 | }, |
| 1001 | .c = { |
| 1002 | .dbg_name = "vcodec_p_clk", |
| 1003 | .ops = &clk_ops_branch, |
| 1004 | CLK_INIT(vcodec_p_clk.c), |
| 1005 | }, |
| 1006 | }; |
| 1007 | |
| 1008 | static struct branch_clk vfe_p_clk = { |
| 1009 | .b = { |
| 1010 | .ctl_reg = AHB_EN_REG, |
| 1011 | .en_mask = BIT(13), |
| 1012 | .reset_reg = SW_RESET_AHB_REG, |
| 1013 | .reset_mask = BIT(0), |
| 1014 | .halt_reg = DBG_BUS_VEC_F_REG, |
| 1015 | .halt_bit = 14, |
| 1016 | }, |
| 1017 | .c = { |
| 1018 | .dbg_name = "vfe_p_clk", |
| 1019 | .ops = &clk_ops_branch, |
| 1020 | CLK_INIT(vfe_p_clk.c), |
| 1021 | }, |
| 1022 | }; |
| 1023 | |
| 1024 | static struct branch_clk vpe_p_clk = { |
| 1025 | .b = { |
| 1026 | .ctl_reg = AHB_EN_REG, |
| 1027 | .en_mask = BIT(16), |
| 1028 | .reset_reg = SW_RESET_AHB_REG, |
| 1029 | .reset_mask = BIT(14), |
| 1030 | .halt_reg = DBG_BUS_VEC_F_REG, |
| 1031 | .halt_bit = 15, |
| 1032 | }, |
| 1033 | .c = { |
| 1034 | .dbg_name = "vpe_p_clk", |
| 1035 | .ops = &clk_ops_branch, |
| 1036 | CLK_INIT(vpe_p_clk.c), |
| 1037 | }, |
| 1038 | }; |
| 1039 | |
| 1040 | /* |
| 1041 | * Peripheral Clocks |
| 1042 | */ |
| 1043 | #define CLK_GSBI_UART(i, n, h_r, h_b) \ |
| 1044 | struct rcg_clk i##_clk = { \ |
| 1045 | .b = { \ |
| 1046 | .ctl_reg = GSBIn_UART_APPS_NS_REG(n), \ |
| 1047 | .en_mask = BIT(9), \ |
| 1048 | .reset_reg = GSBIn_RESET_REG(n), \ |
| 1049 | .reset_mask = BIT(0), \ |
| 1050 | .halt_reg = h_r, \ |
| 1051 | .halt_bit = h_b, \ |
| 1052 | }, \ |
| 1053 | .ns_reg = GSBIn_UART_APPS_NS_REG(n), \ |
| 1054 | .md_reg = GSBIn_UART_APPS_MD_REG(n), \ |
| 1055 | .root_en_mask = BIT(11), \ |
| 1056 | .ns_mask = (BM(31, 16) | BM(6, 0)), \ |
| 1057 | .set_rate = set_rate_mnd, \ |
| 1058 | .freq_tbl = clk_tbl_gsbi_uart, \ |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1059 | .current_freq = &rcg_dummy_freq, \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1060 | .c = { \ |
| 1061 | .dbg_name = #i "_clk", \ |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1062 | .ops = &clk_ops_rcg_8960, \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1063 | CLK_INIT(i##_clk.c), \ |
| 1064 | }, \ |
| 1065 | } |
| 1066 | #define F_GSBI_UART(f, s, d, m, n, v) \ |
| 1067 | { \ |
| 1068 | .freq_hz = f, \ |
| 1069 | .src_clk = &s##_clk.c, \ |
| 1070 | .md_val = MD16(m, n), \ |
| 1071 | .ns_val = NS(31, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \ |
| 1072 | .mnd_en_mask = BIT(8) * !!(n), \ |
| 1073 | .sys_vdd = v, \ |
| 1074 | } |
| 1075 | static struct clk_freq_tbl clk_tbl_gsbi_uart[] = { |
| 1076 | F_GSBI_UART( 0, gnd, 1, 0, 0, NONE), |
| 1077 | F_GSBI_UART( 1843200, pll8, 1, 3, 625, LOW), |
| 1078 | F_GSBI_UART( 3686400, pll8, 1, 6, 625, LOW), |
| 1079 | F_GSBI_UART( 7372800, pll8, 1, 12, 625, LOW), |
| 1080 | F_GSBI_UART(14745600, pll8, 1, 24, 625, LOW), |
| 1081 | F_GSBI_UART(16000000, pll8, 4, 1, 6, LOW), |
| 1082 | F_GSBI_UART(24000000, pll8, 4, 1, 4, LOW), |
| 1083 | F_GSBI_UART(32000000, pll8, 4, 1, 3, LOW), |
| 1084 | F_GSBI_UART(40000000, pll8, 1, 5, 48, NOMINAL), |
| 1085 | F_GSBI_UART(46400000, pll8, 1, 29, 240, NOMINAL), |
| 1086 | F_GSBI_UART(48000000, pll8, 4, 1, 2, NOMINAL), |
| 1087 | F_GSBI_UART(51200000, pll8, 1, 2, 15, NOMINAL), |
| 1088 | F_GSBI_UART(56000000, pll8, 1, 7, 48, NOMINAL), |
| 1089 | F_GSBI_UART(58982400, pll8, 1, 96, 625, NOMINAL), |
| 1090 | F_GSBI_UART(64000000, pll8, 2, 1, 3, NOMINAL), |
| 1091 | F_END |
| 1092 | }; |
| 1093 | |
| 1094 | static CLK_GSBI_UART(gsbi1_uart, 1, CLK_HALT_CFPB_STATEA_REG, 10); |
| 1095 | static CLK_GSBI_UART(gsbi2_uart, 2, CLK_HALT_CFPB_STATEA_REG, 6); |
| 1096 | static CLK_GSBI_UART(gsbi3_uart, 3, CLK_HALT_CFPB_STATEA_REG, 2); |
| 1097 | static CLK_GSBI_UART(gsbi4_uart, 4, CLK_HALT_CFPB_STATEB_REG, 26); |
| 1098 | static CLK_GSBI_UART(gsbi5_uart, 5, CLK_HALT_CFPB_STATEB_REG, 22); |
| 1099 | static CLK_GSBI_UART(gsbi6_uart, 6, CLK_HALT_CFPB_STATEB_REG, 18); |
| 1100 | static CLK_GSBI_UART(gsbi7_uart, 7, CLK_HALT_CFPB_STATEB_REG, 14); |
| 1101 | static CLK_GSBI_UART(gsbi8_uart, 8, CLK_HALT_CFPB_STATEB_REG, 10); |
| 1102 | static CLK_GSBI_UART(gsbi9_uart, 9, CLK_HALT_CFPB_STATEB_REG, 6); |
| 1103 | static CLK_GSBI_UART(gsbi10_uart, 10, CLK_HALT_CFPB_STATEB_REG, 2); |
| 1104 | static CLK_GSBI_UART(gsbi11_uart, 11, CLK_HALT_CFPB_STATEC_REG, 17); |
| 1105 | static CLK_GSBI_UART(gsbi12_uart, 12, CLK_HALT_CFPB_STATEC_REG, 13); |
| 1106 | |
| 1107 | #define CLK_GSBI_QUP(i, n, h_r, h_b) \ |
| 1108 | struct rcg_clk i##_clk = { \ |
| 1109 | .b = { \ |
| 1110 | .ctl_reg = GSBIn_QUP_APPS_NS_REG(n), \ |
| 1111 | .en_mask = BIT(9), \ |
| 1112 | .reset_reg = GSBIn_RESET_REG(n), \ |
| 1113 | .reset_mask = BIT(0), \ |
| 1114 | .halt_reg = h_r, \ |
| 1115 | .halt_bit = h_b, \ |
| 1116 | }, \ |
| 1117 | .ns_reg = GSBIn_QUP_APPS_NS_REG(n), \ |
| 1118 | .md_reg = GSBIn_QUP_APPS_MD_REG(n), \ |
| 1119 | .root_en_mask = BIT(11), \ |
| 1120 | .ns_mask = (BM(23, 16) | BM(6, 0)), \ |
| 1121 | .set_rate = set_rate_mnd, \ |
| 1122 | .freq_tbl = clk_tbl_gsbi_qup, \ |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1123 | .current_freq = &rcg_dummy_freq, \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1124 | .c = { \ |
| 1125 | .dbg_name = #i "_clk", \ |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1126 | .ops = &clk_ops_rcg_8960, \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1127 | CLK_INIT(i##_clk.c), \ |
| 1128 | }, \ |
| 1129 | } |
| 1130 | #define F_GSBI_QUP(f, s, d, m, n, v) \ |
| 1131 | { \ |
| 1132 | .freq_hz = f, \ |
| 1133 | .src_clk = &s##_clk.c, \ |
| 1134 | .md_val = MD8(16, m, 0, n), \ |
| 1135 | .ns_val = NS(23, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \ |
| 1136 | .mnd_en_mask = BIT(8) * !!(n), \ |
| 1137 | .sys_vdd = v, \ |
| 1138 | } |
| 1139 | static struct clk_freq_tbl clk_tbl_gsbi_qup[] = { |
| 1140 | F_GSBI_QUP( 0, gnd, 1, 0, 0, NONE), |
| 1141 | F_GSBI_QUP( 1100000, pxo, 1, 2, 49, LOW), |
| 1142 | F_GSBI_QUP( 5400000, pxo, 1, 1, 5, LOW), |
| 1143 | F_GSBI_QUP(10800000, pxo, 1, 2, 5, LOW), |
| 1144 | F_GSBI_QUP(15060000, pll8, 1, 2, 51, LOW), |
| 1145 | F_GSBI_QUP(24000000, pll8, 4, 1, 4, LOW), |
| 1146 | F_GSBI_QUP(25600000, pll8, 1, 1, 15, NOMINAL), |
| 1147 | F_GSBI_QUP(27000000, pxo, 1, 0, 0, NOMINAL), |
| 1148 | F_GSBI_QUP(48000000, pll8, 4, 1, 2, NOMINAL), |
| 1149 | F_GSBI_QUP(51200000, pll8, 1, 2, 15, NOMINAL), |
| 1150 | F_END |
| 1151 | }; |
| 1152 | |
| 1153 | static CLK_GSBI_QUP(gsbi1_qup, 1, CLK_HALT_CFPB_STATEA_REG, 9); |
| 1154 | static CLK_GSBI_QUP(gsbi2_qup, 2, CLK_HALT_CFPB_STATEA_REG, 4); |
| 1155 | static CLK_GSBI_QUP(gsbi3_qup, 3, CLK_HALT_CFPB_STATEA_REG, 0); |
| 1156 | static CLK_GSBI_QUP(gsbi4_qup, 4, CLK_HALT_CFPB_STATEB_REG, 24); |
| 1157 | static CLK_GSBI_QUP(gsbi5_qup, 5, CLK_HALT_CFPB_STATEB_REG, 20); |
| 1158 | static CLK_GSBI_QUP(gsbi6_qup, 6, CLK_HALT_CFPB_STATEB_REG, 16); |
| 1159 | static CLK_GSBI_QUP(gsbi7_qup, 7, CLK_HALT_CFPB_STATEB_REG, 12); |
| 1160 | static CLK_GSBI_QUP(gsbi8_qup, 8, CLK_HALT_CFPB_STATEB_REG, 8); |
| 1161 | static CLK_GSBI_QUP(gsbi9_qup, 9, CLK_HALT_CFPB_STATEB_REG, 4); |
| 1162 | static CLK_GSBI_QUP(gsbi10_qup, 10, CLK_HALT_CFPB_STATEB_REG, 0); |
| 1163 | static CLK_GSBI_QUP(gsbi11_qup, 11, CLK_HALT_CFPB_STATEC_REG, 15); |
| 1164 | static CLK_GSBI_QUP(gsbi12_qup, 12, CLK_HALT_CFPB_STATEC_REG, 11); |
| 1165 | |
Stephen Boyd | 973e4ba | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 1166 | #define F_QDSS(f, s, d, v) \ |
| 1167 | { \ |
| 1168 | .freq_hz = f, \ |
| 1169 | .src_clk = &s##_clk.c, \ |
| 1170 | .ns_val = NS_DIVSRC(6, 3, d, 2, 0, s##_to_bb_mux), \ |
| 1171 | .sys_vdd = v, \ |
| 1172 | } |
| 1173 | static struct clk_freq_tbl clk_tbl_qdss[] = { |
| 1174 | F_QDSS(128000000, pll8, 3, LOW), |
| 1175 | F_QDSS(300000000, pll3, 4, NOMINAL), |
| 1176 | F_END |
| 1177 | }; |
| 1178 | |
| 1179 | struct qdss_bank { |
| 1180 | const u32 bank_sel_mask; |
| 1181 | void __iomem *const ns_reg; |
| 1182 | const u32 ns_mask; |
| 1183 | }; |
| 1184 | |
| 1185 | static void set_rate_qdss(struct rcg_clk *clk, struct clk_freq_tbl *nf) |
| 1186 | { |
| 1187 | const struct qdss_bank *bank = clk->bank_info; |
| 1188 | u32 reg, bank_sel_mask = bank->bank_sel_mask; |
| 1189 | |
| 1190 | /* Switch to bank 0 (always sourced from PXO) */ |
| 1191 | reg = readl_relaxed(clk->ns_reg); |
| 1192 | reg &= ~bank_sel_mask; |
| 1193 | writel_relaxed(reg, clk->ns_reg); |
| 1194 | /* |
| 1195 | * Wait at least 6 cycles of slowest bank's clock for the glitch-free |
| 1196 | * MUX to fully switch sources. |
| 1197 | */ |
| 1198 | mb(); |
| 1199 | udelay(1); |
| 1200 | |
| 1201 | /* Set source and divider */ |
| 1202 | reg = readl_relaxed(bank->ns_reg); |
| 1203 | reg &= ~bank->ns_mask; |
| 1204 | reg |= nf->ns_val; |
| 1205 | writel_relaxed(reg, bank->ns_reg); |
| 1206 | |
| 1207 | /* Switch to reprogrammed bank */ |
| 1208 | reg = readl_relaxed(clk->ns_reg); |
| 1209 | reg |= bank_sel_mask; |
| 1210 | writel_relaxed(reg, clk->ns_reg); |
| 1211 | /* |
| 1212 | * Wait at least 6 cycles of slowest bank's clock for the glitch-free |
| 1213 | * MUX to fully switch sources. |
| 1214 | */ |
| 1215 | mb(); |
| 1216 | udelay(1); |
| 1217 | } |
| 1218 | |
Stephen Boyd | 973e4ba | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 1219 | static int qdss_clk_enable(struct clk *c) |
| 1220 | { |
| 1221 | struct rcg_clk *clk = to_rcg_clk(c); |
| 1222 | const struct qdss_bank *bank = clk->bank_info; |
| 1223 | u32 reg, bank_sel_mask = bank->bank_sel_mask; |
| 1224 | int ret; |
| 1225 | |
| 1226 | /* Switch to bank 1 */ |
| 1227 | reg = readl_relaxed(clk->ns_reg); |
| 1228 | reg |= bank_sel_mask; |
| 1229 | writel_relaxed(reg, clk->ns_reg); |
Stephen Boyd | 973e4ba | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 1230 | |
| 1231 | ret = rcg_clk_enable(c); |
| 1232 | if (ret) { |
Stephen Boyd | 973e4ba | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 1233 | /* Switch to bank 0 */ |
| 1234 | reg &= ~bank_sel_mask; |
| 1235 | writel_relaxed(reg, clk->ns_reg); |
| 1236 | } |
| 1237 | return ret; |
| 1238 | } |
| 1239 | |
| 1240 | static void qdss_clk_disable(struct clk *c) |
| 1241 | { |
| 1242 | struct rcg_clk *clk = to_rcg_clk(c); |
| 1243 | const struct qdss_bank *bank = clk->bank_info; |
| 1244 | u32 reg, bank_sel_mask = bank->bank_sel_mask; |
| 1245 | |
| 1246 | rcg_clk_disable(c); |
Stephen Boyd | 973e4ba | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 1247 | /* Switch to bank 0 */ |
Stephen Boyd | dbeca47 | 2011-09-12 19:21:22 -0700 | [diff] [blame] | 1248 | reg = readl_relaxed(clk->ns_reg); |
Stephen Boyd | 973e4ba | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 1249 | reg &= ~bank_sel_mask; |
| 1250 | writel_relaxed(reg, clk->ns_reg); |
| 1251 | } |
| 1252 | |
| 1253 | static void qdss_clk_auto_off(struct clk *c) |
| 1254 | { |
| 1255 | struct rcg_clk *clk = to_rcg_clk(c); |
| 1256 | const struct qdss_bank *bank = clk->bank_info; |
| 1257 | u32 reg, bank_sel_mask = bank->bank_sel_mask; |
| 1258 | |
| 1259 | rcg_clk_auto_off(c); |
Stephen Boyd | 973e4ba | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 1260 | /* Switch to bank 0 */ |
Stephen Boyd | dbeca47 | 2011-09-12 19:21:22 -0700 | [diff] [blame] | 1261 | reg = readl_relaxed(clk->ns_reg); |
Stephen Boyd | 973e4ba | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 1262 | reg &= ~bank_sel_mask; |
| 1263 | writel_relaxed(reg, clk->ns_reg); |
| 1264 | } |
| 1265 | |
| 1266 | static struct clk_ops clk_ops_qdss = { |
| 1267 | .enable = qdss_clk_enable, |
| 1268 | .disable = qdss_clk_disable, |
| 1269 | .auto_off = qdss_clk_auto_off, |
| 1270 | .set_rate = rcg_clk_set_rate, |
| 1271 | .set_min_rate = rcg_clk_set_min_rate, |
| 1272 | .get_rate = rcg_clk_get_rate, |
| 1273 | .list_rate = rcg_clk_list_rate, |
| 1274 | .is_enabled = rcg_clk_is_enabled, |
| 1275 | .round_rate = rcg_clk_round_rate, |
| 1276 | .reset = soc_clk_reset, |
| 1277 | .is_local = local_clk_is_local, |
| 1278 | .get_parent = rcg_clk_get_parent, |
| 1279 | }; |
| 1280 | |
| 1281 | static struct qdss_bank bdiv_info_qdss = { |
| 1282 | .bank_sel_mask = BIT(0), |
| 1283 | .ns_reg = QDSS_AT_CLK_SRC1_NS_REG, |
| 1284 | .ns_mask = BM(6, 0), |
| 1285 | }; |
| 1286 | |
| 1287 | static struct rcg_clk qdss_at_clk = { |
| 1288 | .b = { |
| 1289 | .ctl_reg = QDSS_AT_CLK_NS_REG, |
| 1290 | .en_mask = BIT(6), |
| 1291 | .reset_reg = QDSS_RESETS_REG, |
| 1292 | .reset_mask = BIT(0), |
| 1293 | .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG, |
| 1294 | .halt_bit = 10, |
| 1295 | .halt_check = HALT_VOTED, |
| 1296 | }, |
| 1297 | .ns_reg = QDSS_AT_CLK_SRC_CTL_REG, |
| 1298 | .set_rate = set_rate_qdss, |
| 1299 | .freq_tbl = clk_tbl_qdss, |
| 1300 | .bank_info = &bdiv_info_qdss, |
| 1301 | .current_freq = &rcg_dummy_freq, |
| 1302 | .c = { |
| 1303 | .dbg_name = "qdss_at_clk", |
| 1304 | .ops = &clk_ops_qdss, |
| 1305 | CLK_INIT(qdss_at_clk.c), |
Stephen Boyd | 078c9e3 | 2011-08-29 19:33:15 -0700 | [diff] [blame] | 1306 | .flags = CLKFLAG_SKIP_AUTO_OFF, |
Stephen Boyd | 973e4ba | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 1307 | }, |
| 1308 | }; |
| 1309 | |
| 1310 | static struct branch_clk qdss_pclkdbg_clk = { |
| 1311 | .b = { |
| 1312 | .ctl_reg = QDSS_AT_CLK_NS_REG, |
| 1313 | .en_mask = BIT(4), |
| 1314 | .reset_reg = QDSS_RESETS_REG, |
| 1315 | .reset_mask = BIT(0), |
| 1316 | .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG, |
| 1317 | .halt_bit = 9, |
| 1318 | .halt_check = HALT_VOTED |
| 1319 | }, |
| 1320 | .parent = &qdss_at_clk.c, |
| 1321 | .c = { |
| 1322 | .dbg_name = "qdss_pclkdbg_clk", |
| 1323 | .ops = &clk_ops_branch, |
| 1324 | CLK_INIT(qdss_pclkdbg_clk.c), |
| 1325 | }, |
| 1326 | }; |
| 1327 | |
| 1328 | static struct qdss_bank bdiv_info_qdss_trace = { |
| 1329 | .bank_sel_mask = BIT(0), |
| 1330 | .ns_reg = QDSS_TRACECLKIN_CLK_SRC1_NS_REG, |
| 1331 | .ns_mask = BM(6, 0), |
| 1332 | }; |
| 1333 | |
| 1334 | static struct rcg_clk qdss_traceclkin_clk = { |
| 1335 | .b = { |
| 1336 | .ctl_reg = QDSS_TRACECLKIN_CTL_REG, |
| 1337 | .en_mask = BIT(4), |
| 1338 | .reset_reg = QDSS_RESETS_REG, |
| 1339 | .reset_mask = BIT(0), |
| 1340 | .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG, |
| 1341 | .halt_bit = 8, |
| 1342 | .halt_check = HALT_VOTED, |
| 1343 | }, |
| 1344 | .ns_reg = QDSS_TRACECLKIN_CLK_SRC_CTL_REG, |
| 1345 | .set_rate = set_rate_qdss, |
| 1346 | .freq_tbl = clk_tbl_qdss, |
| 1347 | .bank_info = &bdiv_info_qdss_trace, |
| 1348 | .current_freq = &rcg_dummy_freq, |
| 1349 | .c = { |
| 1350 | .dbg_name = "qdss_traceclkin_clk", |
| 1351 | .ops = &clk_ops_qdss, |
| 1352 | CLK_INIT(qdss_traceclkin_clk.c), |
| 1353 | }, |
| 1354 | }; |
| 1355 | |
| 1356 | static struct clk_freq_tbl clk_tbl_qdss_tsctr[] = { |
| 1357 | F_QDSS(200000000, pll3, 6, LOW), |
| 1358 | F_QDSS(400000000, pll3, 3, NOMINAL), |
| 1359 | F_END |
| 1360 | }; |
| 1361 | |
| 1362 | static struct qdss_bank bdiv_info_qdss_tsctr = { |
| 1363 | .bank_sel_mask = BIT(0), |
| 1364 | .ns_reg = QDSS_TSCTR_CLK_SRC1_NS_REG, |
| 1365 | .ns_mask = BM(6, 0), |
| 1366 | }; |
| 1367 | |
| 1368 | static struct rcg_clk qdss_tsctr_clk = { |
| 1369 | .b = { |
| 1370 | .ctl_reg = QDSS_TSCTR_CTL_REG, |
| 1371 | .en_mask = BIT(4), |
| 1372 | .reset_reg = QDSS_RESETS_REG, |
| 1373 | .reset_mask = BIT(3), |
| 1374 | .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG, |
| 1375 | .halt_bit = 7, |
| 1376 | .halt_check = HALT_VOTED, |
| 1377 | }, |
| 1378 | .ns_reg = QDSS_TSCTR_CLK_SRC_CTL_REG, |
| 1379 | .set_rate = set_rate_qdss, |
| 1380 | .freq_tbl = clk_tbl_qdss_tsctr, |
| 1381 | .bank_info = &bdiv_info_qdss_tsctr, |
| 1382 | .current_freq = &rcg_dummy_freq, |
| 1383 | .c = { |
| 1384 | .dbg_name = "qdss_tsctr_clk", |
| 1385 | .ops = &clk_ops_qdss, |
| 1386 | CLK_INIT(qdss_tsctr_clk.c), |
| 1387 | }, |
| 1388 | }; |
| 1389 | |
| 1390 | static struct branch_clk qdss_stm_clk = { |
| 1391 | .b = { |
| 1392 | .ctl_reg = QDSS_STM_CLK_CTL_REG, |
| 1393 | .en_mask = BIT(4), |
| 1394 | .reset_reg = QDSS_RESETS_REG, |
| 1395 | .reset_mask = BIT(1), |
| 1396 | .halt_reg = CLK_HALT_AFAB_SFAB_STATEB_REG, |
| 1397 | .halt_bit = 20, |
| 1398 | .halt_check = HALT_VOTED, |
| 1399 | }, |
| 1400 | .c = { |
| 1401 | .dbg_name = "qdss_stm_clk", |
| 1402 | .ops = &clk_ops_branch, |
| 1403 | CLK_INIT(qdss_stm_clk.c), |
| 1404 | }, |
| 1405 | }; |
| 1406 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1407 | #define F_PDM(f, s, d, v) \ |
| 1408 | { \ |
| 1409 | .freq_hz = f, \ |
| 1410 | .src_clk = &s##_clk.c, \ |
| 1411 | .ns_val = NS_SRC_SEL(1, 0, s##_to_xo_mux), \ |
| 1412 | .sys_vdd = v, \ |
| 1413 | } |
| 1414 | static struct clk_freq_tbl clk_tbl_pdm[] = { |
| 1415 | F_PDM( 0, gnd, 1, NONE), |
| 1416 | F_PDM(27000000, pxo, 1, LOW), |
| 1417 | F_END |
| 1418 | }; |
| 1419 | |
| 1420 | static struct rcg_clk pdm_clk = { |
| 1421 | .b = { |
| 1422 | .ctl_reg = PDM_CLK_NS_REG, |
| 1423 | .en_mask = BIT(9), |
| 1424 | .reset_reg = PDM_CLK_NS_REG, |
| 1425 | .reset_mask = BIT(12), |
| 1426 | .halt_reg = CLK_HALT_CFPB_STATEC_REG, |
| 1427 | .halt_bit = 3, |
| 1428 | }, |
| 1429 | .ns_reg = PDM_CLK_NS_REG, |
| 1430 | .root_en_mask = BIT(11), |
| 1431 | .ns_mask = BM(1, 0), |
| 1432 | .set_rate = set_rate_nop, |
| 1433 | .freq_tbl = clk_tbl_pdm, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1434 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1435 | .c = { |
| 1436 | .dbg_name = "pdm_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1437 | .ops = &clk_ops_rcg_8960, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1438 | CLK_INIT(pdm_clk.c), |
| 1439 | }, |
| 1440 | }; |
| 1441 | |
| 1442 | static struct branch_clk pmem_clk = { |
| 1443 | .b = { |
| 1444 | .ctl_reg = PMEM_ACLK_CTL_REG, |
| 1445 | .en_mask = BIT(4), |
| 1446 | .halt_reg = CLK_HALT_DFAB_STATE_REG, |
| 1447 | .halt_bit = 20, |
| 1448 | }, |
| 1449 | .c = { |
| 1450 | .dbg_name = "pmem_clk", |
| 1451 | .ops = &clk_ops_branch, |
| 1452 | CLK_INIT(pmem_clk.c), |
| 1453 | }, |
| 1454 | }; |
| 1455 | |
| 1456 | #define F_PRNG(f, s, v) \ |
| 1457 | { \ |
| 1458 | .freq_hz = f, \ |
| 1459 | .src_clk = &s##_clk.c, \ |
| 1460 | .sys_vdd = v, \ |
| 1461 | } |
| 1462 | static struct clk_freq_tbl clk_tbl_prng[] = { |
| 1463 | F_PRNG(64000000, pll8, NOMINAL), |
| 1464 | F_END |
| 1465 | }; |
| 1466 | |
| 1467 | static struct rcg_clk prng_clk = { |
| 1468 | .b = { |
| 1469 | .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG, |
| 1470 | .en_mask = BIT(10), |
| 1471 | .halt_reg = CLK_HALT_SFPB_MISC_STATE_REG, |
| 1472 | .halt_check = HALT_VOTED, |
| 1473 | .halt_bit = 10, |
| 1474 | }, |
| 1475 | .set_rate = set_rate_nop, |
| 1476 | .freq_tbl = clk_tbl_prng, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1477 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1478 | .c = { |
| 1479 | .dbg_name = "prng_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1480 | .ops = &clk_ops_rcg_8960, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1481 | CLK_INIT(prng_clk.c), |
| 1482 | }, |
| 1483 | }; |
| 1484 | |
Stephen Boyd | a78a740 | 2011-08-02 11:23:39 -0700 | [diff] [blame] | 1485 | #define CLK_SDC(name, n, h_b, f_table) \ |
| 1486 | struct rcg_clk name = { \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1487 | .b = { \ |
| 1488 | .ctl_reg = SDCn_APPS_CLK_NS_REG(n), \ |
| 1489 | .en_mask = BIT(9), \ |
| 1490 | .reset_reg = SDCn_RESET_REG(n), \ |
| 1491 | .reset_mask = BIT(0), \ |
Stephen Boyd | a78a740 | 2011-08-02 11:23:39 -0700 | [diff] [blame] | 1492 | .halt_reg = CLK_HALT_DFAB_STATE_REG, \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1493 | .halt_bit = h_b, \ |
| 1494 | }, \ |
| 1495 | .ns_reg = SDCn_APPS_CLK_NS_REG(n), \ |
| 1496 | .md_reg = SDCn_APPS_CLK_MD_REG(n), \ |
| 1497 | .root_en_mask = BIT(11), \ |
| 1498 | .ns_mask = (BM(23, 16) | BM(6, 0)), \ |
| 1499 | .set_rate = set_rate_mnd, \ |
Stephen Boyd | a78a740 | 2011-08-02 11:23:39 -0700 | [diff] [blame] | 1500 | .freq_tbl = f_table, \ |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1501 | .current_freq = &rcg_dummy_freq, \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1502 | .c = { \ |
Stephen Boyd | a78a740 | 2011-08-02 11:23:39 -0700 | [diff] [blame] | 1503 | .dbg_name = #name, \ |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1504 | .ops = &clk_ops_rcg_8960, \ |
Stephen Boyd | a78a740 | 2011-08-02 11:23:39 -0700 | [diff] [blame] | 1505 | CLK_INIT(name.c), \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1506 | }, \ |
| 1507 | } |
| 1508 | #define F_SDC(f, s, d, m, n, v) \ |
| 1509 | { \ |
| 1510 | .freq_hz = f, \ |
| 1511 | .src_clk = &s##_clk.c, \ |
| 1512 | .md_val = MD8(16, m, 0, n), \ |
| 1513 | .ns_val = NS(23, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \ |
| 1514 | .mnd_en_mask = BIT(8) * !!(n), \ |
| 1515 | .sys_vdd = v, \ |
| 1516 | } |
Stephen Boyd | a78a740 | 2011-08-02 11:23:39 -0700 | [diff] [blame] | 1517 | static struct clk_freq_tbl clk_tbl_sdc1_2[] = { |
| 1518 | F_SDC( 0, gnd, 1, 0, 0, NONE), |
| 1519 | F_SDC( 144000, pxo, 3, 2, 125, LOW), |
| 1520 | F_SDC( 400000, pll8, 4, 1, 240, LOW), |
| 1521 | F_SDC( 16000000, pll8, 4, 1, 6, LOW), |
| 1522 | F_SDC( 17070000, pll8, 1, 2, 45, LOW), |
| 1523 | F_SDC( 20210000, pll8, 1, 1, 19, LOW), |
| 1524 | F_SDC( 24000000, pll8, 4, 1, 4, LOW), |
| 1525 | F_SDC( 48000000, pll8, 4, 1, 2, LOW), |
| 1526 | F_SDC( 64000000, pll8, 3, 1, 2, NOMINAL), |
| 1527 | F_SDC( 96000000, pll8, 4, 0, 0, NOMINAL), |
| 1528 | F_END |
| 1529 | }; |
| 1530 | |
| 1531 | static CLK_SDC(sdc1_clk, 1, 6, clk_tbl_sdc1_2); |
| 1532 | static CLK_SDC(sdc2_clk, 2, 5, clk_tbl_sdc1_2); |
| 1533 | |
| 1534 | static struct clk_freq_tbl clk_tbl_sdc3[] = { |
| 1535 | F_SDC( 0, gnd, 1, 0, 0, NONE), |
| 1536 | F_SDC( 144000, pxo, 3, 2, 125, LOW), |
| 1537 | F_SDC( 400000, pll8, 4, 1, 240, LOW), |
| 1538 | F_SDC( 16000000, pll8, 4, 1, 6, LOW), |
| 1539 | F_SDC( 17070000, pll8, 1, 2, 45, LOW), |
| 1540 | F_SDC( 20210000, pll8, 1, 1, 19, LOW), |
| 1541 | F_SDC( 24000000, pll8, 4, 1, 4, LOW), |
| 1542 | F_SDC( 48000000, pll8, 4, 1, 2, LOW), |
| 1543 | F_SDC( 64000000, pll8, 3, 1, 2, LOW), |
| 1544 | F_SDC( 96000000, pll8, 4, 0, 0, LOW), |
| 1545 | F_SDC(192000000, pll8, 2, 0, 0, NOMINAL), |
| 1546 | F_END |
| 1547 | }; |
| 1548 | |
| 1549 | static CLK_SDC(sdc3_clk, 3, 4, clk_tbl_sdc3); |
| 1550 | |
| 1551 | static struct clk_freq_tbl clk_tbl_sdc4_5[] = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1552 | F_SDC( 0, gnd, 1, 0, 0, NONE), |
| 1553 | F_SDC( 144000, pxo, 3, 2, 125, LOW), |
| 1554 | F_SDC( 400000, pll8, 4, 1, 240, LOW), |
| 1555 | F_SDC( 16000000, pll8, 4, 1, 6, LOW), |
| 1556 | F_SDC( 17070000, pll8, 1, 2, 45, LOW), |
| 1557 | F_SDC( 20210000, pll8, 1, 1, 19, LOW), |
| 1558 | F_SDC( 24000000, pll8, 4, 1, 4, LOW), |
| 1559 | F_SDC( 48000000, pll8, 4, 1, 2, NOMINAL), |
| 1560 | F_SDC( 64000000, pll8, 3, 1, 2, NOMINAL), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1561 | F_END |
| 1562 | }; |
| 1563 | |
Stephen Boyd | a78a740 | 2011-08-02 11:23:39 -0700 | [diff] [blame] | 1564 | static CLK_SDC(sdc4_clk, 4, 3, clk_tbl_sdc4_5); |
| 1565 | static CLK_SDC(sdc5_clk, 5, 2, clk_tbl_sdc4_5); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1566 | |
| 1567 | #define F_TSIF_REF(f, s, d, m, n, v) \ |
| 1568 | { \ |
| 1569 | .freq_hz = f, \ |
| 1570 | .src_clk = &s##_clk.c, \ |
| 1571 | .md_val = MD16(m, n), \ |
| 1572 | .ns_val = NS(31, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \ |
| 1573 | .mnd_en_mask = BIT(8) * !!(n), \ |
| 1574 | .sys_vdd = v, \ |
| 1575 | } |
| 1576 | static struct clk_freq_tbl clk_tbl_tsif_ref[] = { |
| 1577 | F_TSIF_REF( 0, gnd, 1, 0, 0, NONE), |
| 1578 | F_TSIF_REF(105000, pxo, 1, 1, 256, LOW), |
| 1579 | F_END |
| 1580 | }; |
| 1581 | |
| 1582 | static struct rcg_clk tsif_ref_clk = { |
| 1583 | .b = { |
| 1584 | .ctl_reg = TSIF_REF_CLK_NS_REG, |
| 1585 | .en_mask = BIT(9), |
| 1586 | .halt_reg = CLK_HALT_CFPB_STATEC_REG, |
| 1587 | .halt_bit = 5, |
| 1588 | }, |
| 1589 | .ns_reg = TSIF_REF_CLK_NS_REG, |
| 1590 | .md_reg = TSIF_REF_CLK_MD_REG, |
| 1591 | .root_en_mask = BIT(11), |
| 1592 | .ns_mask = (BM(31, 16) | BM(6, 0)), |
| 1593 | .set_rate = set_rate_mnd, |
| 1594 | .freq_tbl = clk_tbl_tsif_ref, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1595 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1596 | .c = { |
| 1597 | .dbg_name = "tsif_ref_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1598 | .ops = &clk_ops_rcg_8960, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1599 | CLK_INIT(tsif_ref_clk.c), |
| 1600 | }, |
| 1601 | }; |
| 1602 | |
| 1603 | #define F_TSSC(f, s, v) \ |
| 1604 | { \ |
| 1605 | .freq_hz = f, \ |
| 1606 | .src_clk = &s##_clk.c, \ |
| 1607 | .ns_val = NS_SRC_SEL(1, 0, s##_to_xo_mux), \ |
| 1608 | .sys_vdd = v, \ |
| 1609 | } |
| 1610 | static struct clk_freq_tbl clk_tbl_tssc[] = { |
| 1611 | F_TSSC( 0, gnd, NONE), |
| 1612 | F_TSSC(27000000, pxo, LOW), |
| 1613 | F_END |
| 1614 | }; |
| 1615 | |
| 1616 | static struct rcg_clk tssc_clk = { |
| 1617 | .b = { |
| 1618 | .ctl_reg = TSSC_CLK_CTL_REG, |
| 1619 | .en_mask = BIT(4), |
| 1620 | .halt_reg = CLK_HALT_CFPB_STATEC_REG, |
| 1621 | .halt_bit = 4, |
| 1622 | }, |
| 1623 | .ns_reg = TSSC_CLK_CTL_REG, |
| 1624 | .ns_mask = BM(1, 0), |
| 1625 | .set_rate = set_rate_nop, |
| 1626 | .freq_tbl = clk_tbl_tssc, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1627 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1628 | .c = { |
| 1629 | .dbg_name = "tssc_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1630 | .ops = &clk_ops_rcg_8960, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1631 | CLK_INIT(tssc_clk.c), |
| 1632 | }, |
| 1633 | }; |
| 1634 | |
| 1635 | #define F_USB(f, s, d, m, n, v) \ |
| 1636 | { \ |
| 1637 | .freq_hz = f, \ |
| 1638 | .src_clk = &s##_clk.c, \ |
| 1639 | .md_val = MD8(16, m, 0, n), \ |
| 1640 | .ns_val = NS(23, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_bb_mux), \ |
| 1641 | .mnd_en_mask = BIT(8) * !!(n), \ |
| 1642 | .sys_vdd = v, \ |
| 1643 | } |
| 1644 | static struct clk_freq_tbl clk_tbl_usb[] = { |
| 1645 | F_USB( 0, gnd, 1, 0, 0, NONE), |
| 1646 | F_USB(60000000, pll8, 1, 5, 32, NOMINAL), |
| 1647 | F_END |
| 1648 | }; |
| 1649 | |
| 1650 | static struct rcg_clk usb_hs1_xcvr_clk = { |
| 1651 | .b = { |
| 1652 | .ctl_reg = USB_HS1_XCVR_FS_CLK_NS_REG, |
| 1653 | .en_mask = BIT(9), |
| 1654 | .reset_reg = USB_HS1_RESET_REG, |
| 1655 | .reset_mask = BIT(0), |
| 1656 | .halt_reg = CLK_HALT_DFAB_STATE_REG, |
| 1657 | .halt_bit = 0, |
| 1658 | }, |
| 1659 | .ns_reg = USB_HS1_XCVR_FS_CLK_NS_REG, |
| 1660 | .md_reg = USB_HS1_XCVR_FS_CLK_MD_REG, |
| 1661 | .root_en_mask = BIT(11), |
| 1662 | .ns_mask = (BM(23, 16) | BM(6, 0)), |
| 1663 | .set_rate = set_rate_mnd, |
| 1664 | .freq_tbl = clk_tbl_usb, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1665 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1666 | .c = { |
| 1667 | .dbg_name = "usb_hs1_xcvr_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1668 | .ops = &clk_ops_rcg_8960, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1669 | CLK_INIT(usb_hs1_xcvr_clk.c), |
| 1670 | }, |
| 1671 | }; |
| 1672 | |
Stephen Boyd | 94625ef | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 1673 | static struct clk_freq_tbl clk_tbl_usb_hsic[] = { |
| 1674 | F_USB( 0, gnd, 1, 0, 0, NONE), |
| 1675 | F_USB(60000000, pll8, 1, 5, 32, LOW), |
| 1676 | F_END |
| 1677 | }; |
| 1678 | |
| 1679 | static struct rcg_clk usb_hsic_xcvr_fs_clk = { |
| 1680 | .b = { |
| 1681 | .ctl_reg = USB_HSIC_XCVR_FS_CLK_NS_REG, |
| 1682 | .en_mask = BIT(9), |
| 1683 | .halt_reg = CLK_HALT_CFPB_STATEA_REG, |
| 1684 | .halt_bit = 26, |
| 1685 | }, |
| 1686 | .ns_reg = USB_HSIC_XCVR_FS_CLK_NS_REG, |
| 1687 | .md_reg = USB_HSIC_XCVR_FS_CLK_MD_REG, |
| 1688 | .root_en_mask = BIT(11), |
| 1689 | .ns_mask = (BM(23, 16) | BM(6, 0)), |
| 1690 | .set_rate = set_rate_mnd, |
| 1691 | .freq_tbl = clk_tbl_usb_hsic, |
| 1692 | .current_freq = &rcg_dummy_freq, |
| 1693 | .c = { |
| 1694 | .dbg_name = "usb_hsic_xcvr_fs_clk", |
| 1695 | .ops = &clk_ops_rcg_8960, |
| 1696 | CLK_INIT(usb_hsic_xcvr_fs_clk.c), |
| 1697 | }, |
| 1698 | }; |
| 1699 | |
| 1700 | static struct branch_clk usb_hsic_system_clk = { |
| 1701 | .b = { |
| 1702 | .ctl_reg = USB_HSIC_SYSTEM_CLK_CTL_REG, |
| 1703 | .en_mask = BIT(4), |
| 1704 | .reset_reg = USB_HSIC_RESET_REG, |
| 1705 | .reset_mask = BIT(0), |
| 1706 | .halt_reg = CLK_HALT_CFPB_STATEA_REG, |
| 1707 | .halt_bit = 24, |
| 1708 | }, |
| 1709 | .parent = &usb_hsic_xcvr_fs_clk.c, |
| 1710 | .c = { |
| 1711 | .dbg_name = "usb_hsic_system_clk", |
| 1712 | .ops = &clk_ops_branch, |
| 1713 | CLK_INIT(usb_hsic_system_clk.c), |
| 1714 | }, |
| 1715 | }; |
| 1716 | |
| 1717 | #define F_USB_HSIC(f, s, v) \ |
| 1718 | { \ |
| 1719 | .freq_hz = f, \ |
| 1720 | .src_clk = &s##_clk.c, \ |
| 1721 | .sys_vdd = v, \ |
| 1722 | } |
| 1723 | static struct clk_freq_tbl clk_tbl_usb2_hsic[] = { |
| 1724 | F_USB_HSIC(480000000, pll14, LOW), |
| 1725 | F_END |
| 1726 | }; |
| 1727 | |
| 1728 | static struct rcg_clk usb_hsic_hsic_src_clk = { |
| 1729 | .b = { |
| 1730 | .ctl_reg = USB_HSIC_HSIC_CLK_SRC_CTL_REG, |
| 1731 | .halt_check = NOCHECK, |
| 1732 | }, |
| 1733 | .root_en_mask = BIT(0), |
| 1734 | .set_rate = set_rate_nop, |
| 1735 | .freq_tbl = clk_tbl_usb2_hsic, |
| 1736 | .current_freq = &rcg_dummy_freq, |
| 1737 | .c = { |
| 1738 | .dbg_name = "usb_hsic_hsic_src_clk", |
| 1739 | .ops = &clk_ops_rcg_8960, |
| 1740 | CLK_INIT(usb_hsic_hsic_src_clk.c), |
| 1741 | }, |
| 1742 | }; |
| 1743 | |
| 1744 | static struct branch_clk usb_hsic_hsic_clk = { |
| 1745 | .b = { |
| 1746 | .ctl_reg = USB_HSIC_HSIC_CLK_CTL_REG, |
| 1747 | .en_mask = BIT(0), |
| 1748 | .halt_reg = CLK_HALT_CFPB_STATEA_REG, |
| 1749 | .halt_bit = 19, |
| 1750 | }, |
| 1751 | .parent = &usb_hsic_hsic_src_clk.c, |
| 1752 | .c = { |
| 1753 | .dbg_name = "usb_hsic_hsic_clk", |
| 1754 | .ops = &clk_ops_branch, |
| 1755 | CLK_INIT(usb_hsic_hsic_clk.c), |
| 1756 | }, |
| 1757 | }; |
| 1758 | |
| 1759 | #define F_USB_HSIO_CAL(f, s, v) \ |
| 1760 | { \ |
| 1761 | .freq_hz = f, \ |
| 1762 | .src_clk = &s##_clk.c, \ |
| 1763 | .sys_vdd = v, \ |
| 1764 | } |
| 1765 | static struct clk_freq_tbl clk_tbl_usb_hsio_cal[] = { |
| 1766 | F_USB_HSIO_CAL(9000000, pxo, LOW), |
| 1767 | F_END |
| 1768 | }; |
| 1769 | |
| 1770 | static struct rcg_clk usb_hsic_hsio_cal_clk = { |
| 1771 | .b = { |
| 1772 | .ctl_reg = USB_HSIC_HSIO_CAL_CLK_CTL_REG, |
| 1773 | .en_mask = BIT(0), |
| 1774 | .halt_reg = CLK_HALT_CFPB_STATEA_REG, |
| 1775 | .halt_bit = 23, |
| 1776 | }, |
| 1777 | .set_rate = set_rate_nop, |
| 1778 | .freq_tbl = clk_tbl_usb_hsio_cal, |
| 1779 | .current_freq = &rcg_dummy_freq, |
| 1780 | .c = { |
| 1781 | .dbg_name = "usb_hsic_hsio_cal_clk", |
| 1782 | .ops = &clk_ops_branch, |
| 1783 | CLK_INIT(usb_hsic_hsio_cal_clk.c), |
| 1784 | }, |
| 1785 | }; |
| 1786 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1787 | static struct branch_clk usb_phy0_clk = { |
| 1788 | .b = { |
| 1789 | .reset_reg = USB_PHY0_RESET_REG, |
| 1790 | .reset_mask = BIT(0), |
| 1791 | }, |
| 1792 | .c = { |
| 1793 | .dbg_name = "usb_phy0_clk", |
| 1794 | .ops = &clk_ops_reset, |
| 1795 | CLK_INIT(usb_phy0_clk.c), |
| 1796 | }, |
| 1797 | }; |
| 1798 | |
| 1799 | #define CLK_USB_FS(i, n) \ |
| 1800 | struct rcg_clk i##_clk = { \ |
| 1801 | .ns_reg = USB_FSn_XCVR_FS_CLK_NS_REG(n), \ |
| 1802 | .b = { \ |
| 1803 | .ctl_reg = USB_FSn_XCVR_FS_CLK_NS_REG(n), \ |
| 1804 | .halt_check = NOCHECK, \ |
| 1805 | }, \ |
| 1806 | .md_reg = USB_FSn_XCVR_FS_CLK_MD_REG(n), \ |
| 1807 | .root_en_mask = BIT(11), \ |
| 1808 | .ns_mask = (BM(23, 16) | BM(6, 0)), \ |
| 1809 | .set_rate = set_rate_mnd, \ |
| 1810 | .freq_tbl = clk_tbl_usb, \ |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1811 | .current_freq = &rcg_dummy_freq, \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1812 | .c = { \ |
| 1813 | .dbg_name = #i "_clk", \ |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 1814 | .ops = &clk_ops_rcg_8960, \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1815 | CLK_INIT(i##_clk.c), \ |
| 1816 | }, \ |
| 1817 | } |
| 1818 | |
| 1819 | static CLK_USB_FS(usb_fs1_src, 1); |
| 1820 | static struct branch_clk usb_fs1_xcvr_clk = { |
| 1821 | .b = { |
| 1822 | .ctl_reg = USB_FSn_XCVR_FS_CLK_NS_REG(1), |
| 1823 | .en_mask = BIT(9), |
| 1824 | .reset_reg = USB_FSn_RESET_REG(1), |
| 1825 | .reset_mask = BIT(1), |
| 1826 | .halt_reg = CLK_HALT_CFPB_STATEA_REG, |
| 1827 | .halt_bit = 15, |
| 1828 | }, |
| 1829 | .parent = &usb_fs1_src_clk.c, |
| 1830 | .c = { |
| 1831 | .dbg_name = "usb_fs1_xcvr_clk", |
| 1832 | .ops = &clk_ops_branch, |
| 1833 | CLK_INIT(usb_fs1_xcvr_clk.c), |
| 1834 | }, |
| 1835 | }; |
| 1836 | |
| 1837 | static struct branch_clk usb_fs1_sys_clk = { |
| 1838 | .b = { |
| 1839 | .ctl_reg = USB_FSn_SYSTEM_CLK_CTL_REG(1), |
| 1840 | .en_mask = BIT(4), |
| 1841 | .reset_reg = USB_FSn_RESET_REG(1), |
| 1842 | .reset_mask = BIT(0), |
| 1843 | .halt_reg = CLK_HALT_CFPB_STATEA_REG, |
| 1844 | .halt_bit = 16, |
| 1845 | }, |
| 1846 | .parent = &usb_fs1_src_clk.c, |
| 1847 | .c = { |
| 1848 | .dbg_name = "usb_fs1_sys_clk", |
| 1849 | .ops = &clk_ops_branch, |
| 1850 | CLK_INIT(usb_fs1_sys_clk.c), |
| 1851 | }, |
| 1852 | }; |
| 1853 | |
| 1854 | static CLK_USB_FS(usb_fs2_src, 2); |
| 1855 | static struct branch_clk usb_fs2_xcvr_clk = { |
| 1856 | .b = { |
| 1857 | .ctl_reg = USB_FSn_XCVR_FS_CLK_NS_REG(2), |
| 1858 | .en_mask = BIT(9), |
| 1859 | .reset_reg = USB_FSn_RESET_REG(2), |
| 1860 | .reset_mask = BIT(1), |
| 1861 | .halt_reg = CLK_HALT_CFPB_STATEA_REG, |
| 1862 | .halt_bit = 12, |
| 1863 | }, |
| 1864 | .parent = &usb_fs2_src_clk.c, |
| 1865 | .c = { |
| 1866 | .dbg_name = "usb_fs2_xcvr_clk", |
| 1867 | .ops = &clk_ops_branch, |
| 1868 | CLK_INIT(usb_fs2_xcvr_clk.c), |
| 1869 | }, |
| 1870 | }; |
| 1871 | |
| 1872 | static struct branch_clk usb_fs2_sys_clk = { |
| 1873 | .b = { |
| 1874 | .ctl_reg = USB_FSn_SYSTEM_CLK_CTL_REG(2), |
| 1875 | .en_mask = BIT(4), |
| 1876 | .reset_reg = USB_FSn_RESET_REG(2), |
| 1877 | .reset_mask = BIT(0), |
| 1878 | .halt_reg = CLK_HALT_CFPB_STATEA_REG, |
| 1879 | .halt_bit = 13, |
| 1880 | }, |
| 1881 | .parent = &usb_fs2_src_clk.c, |
| 1882 | .c = { |
| 1883 | .dbg_name = "usb_fs2_sys_clk", |
| 1884 | .ops = &clk_ops_branch, |
| 1885 | CLK_INIT(usb_fs2_sys_clk.c), |
| 1886 | }, |
| 1887 | }; |
| 1888 | |
| 1889 | /* Fast Peripheral Bus Clocks */ |
| 1890 | static struct branch_clk ce1_core_clk = { |
| 1891 | .b = { |
| 1892 | .ctl_reg = CE1_CORE_CLK_CTL_REG, |
| 1893 | .en_mask = BIT(4), |
| 1894 | .halt_reg = CLK_HALT_CFPB_STATEC_REG, |
| 1895 | .halt_bit = 27, |
| 1896 | }, |
| 1897 | .c = { |
| 1898 | .dbg_name = "ce1_core_clk", |
| 1899 | .ops = &clk_ops_branch, |
| 1900 | CLK_INIT(ce1_core_clk.c), |
| 1901 | }, |
| 1902 | }; |
| 1903 | static struct branch_clk ce1_p_clk = { |
| 1904 | .b = { |
| 1905 | .ctl_reg = CE1_HCLK_CTL_REG, |
| 1906 | .en_mask = BIT(4), |
| 1907 | .halt_reg = CLK_HALT_CFPB_STATEC_REG, |
| 1908 | .halt_bit = 1, |
| 1909 | }, |
| 1910 | .c = { |
| 1911 | .dbg_name = "ce1_p_clk", |
| 1912 | .ops = &clk_ops_branch, |
| 1913 | CLK_INIT(ce1_p_clk.c), |
| 1914 | }, |
| 1915 | }; |
| 1916 | |
| 1917 | static struct branch_clk dma_bam_p_clk = { |
| 1918 | .b = { |
| 1919 | .ctl_reg = DMA_BAM_HCLK_CTL, |
| 1920 | .en_mask = BIT(4), |
| 1921 | .halt_reg = CLK_HALT_DFAB_STATE_REG, |
| 1922 | .halt_bit = 12, |
| 1923 | }, |
| 1924 | .c = { |
| 1925 | .dbg_name = "dma_bam_p_clk", |
| 1926 | .ops = &clk_ops_branch, |
| 1927 | CLK_INIT(dma_bam_p_clk.c), |
| 1928 | }, |
| 1929 | }; |
| 1930 | |
| 1931 | static struct branch_clk gsbi1_p_clk = { |
| 1932 | .b = { |
| 1933 | .ctl_reg = GSBIn_HCLK_CTL_REG(1), |
| 1934 | .en_mask = BIT(4), |
| 1935 | .halt_reg = CLK_HALT_CFPB_STATEA_REG, |
| 1936 | .halt_bit = 11, |
| 1937 | }, |
| 1938 | .c = { |
| 1939 | .dbg_name = "gsbi1_p_clk", |
| 1940 | .ops = &clk_ops_branch, |
| 1941 | CLK_INIT(gsbi1_p_clk.c), |
| 1942 | }, |
| 1943 | }; |
| 1944 | |
| 1945 | static struct branch_clk gsbi2_p_clk = { |
| 1946 | .b = { |
| 1947 | .ctl_reg = GSBIn_HCLK_CTL_REG(2), |
| 1948 | .en_mask = BIT(4), |
| 1949 | .halt_reg = CLK_HALT_CFPB_STATEA_REG, |
| 1950 | .halt_bit = 7, |
| 1951 | }, |
| 1952 | .c = { |
| 1953 | .dbg_name = "gsbi2_p_clk", |
| 1954 | .ops = &clk_ops_branch, |
| 1955 | CLK_INIT(gsbi2_p_clk.c), |
| 1956 | }, |
| 1957 | }; |
| 1958 | |
| 1959 | static struct branch_clk gsbi3_p_clk = { |
| 1960 | .b = { |
| 1961 | .ctl_reg = GSBIn_HCLK_CTL_REG(3), |
| 1962 | .en_mask = BIT(4), |
| 1963 | .halt_reg = CLK_HALT_CFPB_STATEA_REG, |
| 1964 | .halt_bit = 3, |
| 1965 | }, |
| 1966 | .c = { |
| 1967 | .dbg_name = "gsbi3_p_clk", |
| 1968 | .ops = &clk_ops_branch, |
| 1969 | CLK_INIT(gsbi3_p_clk.c), |
| 1970 | }, |
| 1971 | }; |
| 1972 | |
| 1973 | static struct branch_clk gsbi4_p_clk = { |
| 1974 | .b = { |
| 1975 | .ctl_reg = GSBIn_HCLK_CTL_REG(4), |
| 1976 | .en_mask = BIT(4), |
| 1977 | .halt_reg = CLK_HALT_CFPB_STATEB_REG, |
| 1978 | .halt_bit = 27, |
| 1979 | }, |
| 1980 | .c = { |
| 1981 | .dbg_name = "gsbi4_p_clk", |
| 1982 | .ops = &clk_ops_branch, |
| 1983 | CLK_INIT(gsbi4_p_clk.c), |
| 1984 | }, |
| 1985 | }; |
| 1986 | |
| 1987 | static struct branch_clk gsbi5_p_clk = { |
| 1988 | .b = { |
| 1989 | .ctl_reg = GSBIn_HCLK_CTL_REG(5), |
| 1990 | .en_mask = BIT(4), |
| 1991 | .halt_reg = CLK_HALT_CFPB_STATEB_REG, |
| 1992 | .halt_bit = 23, |
| 1993 | }, |
| 1994 | .c = { |
| 1995 | .dbg_name = "gsbi5_p_clk", |
| 1996 | .ops = &clk_ops_branch, |
| 1997 | CLK_INIT(gsbi5_p_clk.c), |
| 1998 | }, |
| 1999 | }; |
| 2000 | |
| 2001 | static struct branch_clk gsbi6_p_clk = { |
| 2002 | .b = { |
| 2003 | .ctl_reg = GSBIn_HCLK_CTL_REG(6), |
| 2004 | .en_mask = BIT(4), |
| 2005 | .halt_reg = CLK_HALT_CFPB_STATEB_REG, |
| 2006 | .halt_bit = 19, |
| 2007 | }, |
| 2008 | .c = { |
| 2009 | .dbg_name = "gsbi6_p_clk", |
| 2010 | .ops = &clk_ops_branch, |
| 2011 | CLK_INIT(gsbi6_p_clk.c), |
| 2012 | }, |
| 2013 | }; |
| 2014 | |
| 2015 | static struct branch_clk gsbi7_p_clk = { |
| 2016 | .b = { |
| 2017 | .ctl_reg = GSBIn_HCLK_CTL_REG(7), |
| 2018 | .en_mask = BIT(4), |
| 2019 | .halt_reg = CLK_HALT_CFPB_STATEB_REG, |
| 2020 | .halt_bit = 15, |
| 2021 | }, |
| 2022 | .c = { |
| 2023 | .dbg_name = "gsbi7_p_clk", |
| 2024 | .ops = &clk_ops_branch, |
| 2025 | CLK_INIT(gsbi7_p_clk.c), |
| 2026 | }, |
| 2027 | }; |
| 2028 | |
| 2029 | static struct branch_clk gsbi8_p_clk = { |
| 2030 | .b = { |
| 2031 | .ctl_reg = GSBIn_HCLK_CTL_REG(8), |
| 2032 | .en_mask = BIT(4), |
| 2033 | .halt_reg = CLK_HALT_CFPB_STATEB_REG, |
| 2034 | .halt_bit = 11, |
| 2035 | }, |
| 2036 | .c = { |
| 2037 | .dbg_name = "gsbi8_p_clk", |
| 2038 | .ops = &clk_ops_branch, |
| 2039 | CLK_INIT(gsbi8_p_clk.c), |
| 2040 | }, |
| 2041 | }; |
| 2042 | |
| 2043 | static struct branch_clk gsbi9_p_clk = { |
| 2044 | .b = { |
| 2045 | .ctl_reg = GSBIn_HCLK_CTL_REG(9), |
| 2046 | .en_mask = BIT(4), |
| 2047 | .halt_reg = CLK_HALT_CFPB_STATEB_REG, |
| 2048 | .halt_bit = 7, |
| 2049 | }, |
| 2050 | .c = { |
| 2051 | .dbg_name = "gsbi9_p_clk", |
| 2052 | .ops = &clk_ops_branch, |
| 2053 | CLK_INIT(gsbi9_p_clk.c), |
| 2054 | }, |
| 2055 | }; |
| 2056 | |
| 2057 | static struct branch_clk gsbi10_p_clk = { |
| 2058 | .b = { |
| 2059 | .ctl_reg = GSBIn_HCLK_CTL_REG(10), |
| 2060 | .en_mask = BIT(4), |
| 2061 | .halt_reg = CLK_HALT_CFPB_STATEB_REG, |
| 2062 | .halt_bit = 3, |
| 2063 | }, |
| 2064 | .c = { |
| 2065 | .dbg_name = "gsbi10_p_clk", |
| 2066 | .ops = &clk_ops_branch, |
| 2067 | CLK_INIT(gsbi10_p_clk.c), |
| 2068 | }, |
| 2069 | }; |
| 2070 | |
| 2071 | static struct branch_clk gsbi11_p_clk = { |
| 2072 | .b = { |
| 2073 | .ctl_reg = GSBIn_HCLK_CTL_REG(11), |
| 2074 | .en_mask = BIT(4), |
| 2075 | .halt_reg = CLK_HALT_CFPB_STATEC_REG, |
| 2076 | .halt_bit = 18, |
| 2077 | }, |
| 2078 | .c = { |
| 2079 | .dbg_name = "gsbi11_p_clk", |
| 2080 | .ops = &clk_ops_branch, |
| 2081 | CLK_INIT(gsbi11_p_clk.c), |
| 2082 | }, |
| 2083 | }; |
| 2084 | |
| 2085 | static struct branch_clk gsbi12_p_clk = { |
| 2086 | .b = { |
| 2087 | .ctl_reg = GSBIn_HCLK_CTL_REG(12), |
| 2088 | .en_mask = BIT(4), |
| 2089 | .halt_reg = CLK_HALT_CFPB_STATEC_REG, |
| 2090 | .halt_bit = 14, |
| 2091 | }, |
| 2092 | .c = { |
| 2093 | .dbg_name = "gsbi12_p_clk", |
| 2094 | .ops = &clk_ops_branch, |
| 2095 | CLK_INIT(gsbi12_p_clk.c), |
| 2096 | }, |
| 2097 | }; |
| 2098 | |
Stephen Boyd | 973e4ba | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 2099 | static struct branch_clk qdss_p_clk = { |
| 2100 | .b = { |
| 2101 | .ctl_reg = QDSS_HCLK_CTL_REG, |
| 2102 | .en_mask = BIT(4), |
| 2103 | .halt_reg = CLK_HALT_SFPB_MISC_STATE_REG, |
| 2104 | .halt_bit = 11, |
| 2105 | .halt_check = HALT_VOTED, |
| 2106 | .reset_reg = QDSS_RESETS_REG, |
| 2107 | .reset_mask = BIT(2), |
| 2108 | }, |
| 2109 | .c = { |
| 2110 | .dbg_name = "qdss_p_clk", |
| 2111 | .ops = &clk_ops_branch, |
| 2112 | CLK_INIT(qdss_p_clk.c), |
| 2113 | }, |
| 2114 | }; |
| 2115 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2116 | static struct branch_clk tsif_p_clk = { |
| 2117 | .b = { |
| 2118 | .ctl_reg = TSIF_HCLK_CTL_REG, |
| 2119 | .en_mask = BIT(4), |
| 2120 | .halt_reg = CLK_HALT_CFPB_STATEC_REG, |
| 2121 | .halt_bit = 7, |
| 2122 | }, |
| 2123 | .c = { |
| 2124 | .dbg_name = "tsif_p_clk", |
| 2125 | .ops = &clk_ops_branch, |
| 2126 | CLK_INIT(tsif_p_clk.c), |
| 2127 | }, |
| 2128 | }; |
| 2129 | |
| 2130 | static struct branch_clk usb_fs1_p_clk = { |
| 2131 | .b = { |
| 2132 | .ctl_reg = USB_FSn_HCLK_CTL_REG(1), |
| 2133 | .en_mask = BIT(4), |
| 2134 | .halt_reg = CLK_HALT_CFPB_STATEA_REG, |
| 2135 | .halt_bit = 17, |
| 2136 | }, |
| 2137 | .c = { |
| 2138 | .dbg_name = "usb_fs1_p_clk", |
| 2139 | .ops = &clk_ops_branch, |
| 2140 | CLK_INIT(usb_fs1_p_clk.c), |
| 2141 | }, |
| 2142 | }; |
| 2143 | |
| 2144 | static struct branch_clk usb_fs2_p_clk = { |
| 2145 | .b = { |
| 2146 | .ctl_reg = USB_FSn_HCLK_CTL_REG(2), |
| 2147 | .en_mask = BIT(4), |
| 2148 | .halt_reg = CLK_HALT_CFPB_STATEA_REG, |
| 2149 | .halt_bit = 14, |
| 2150 | }, |
| 2151 | .c = { |
| 2152 | .dbg_name = "usb_fs2_p_clk", |
| 2153 | .ops = &clk_ops_branch, |
| 2154 | CLK_INIT(usb_fs2_p_clk.c), |
| 2155 | }, |
| 2156 | }; |
| 2157 | |
| 2158 | static struct branch_clk usb_hs1_p_clk = { |
| 2159 | .b = { |
| 2160 | .ctl_reg = USB_HS1_HCLK_CTL_REG, |
| 2161 | .en_mask = BIT(4), |
| 2162 | .halt_reg = CLK_HALT_DFAB_STATE_REG, |
| 2163 | .halt_bit = 1, |
| 2164 | }, |
| 2165 | .c = { |
| 2166 | .dbg_name = "usb_hs1_p_clk", |
| 2167 | .ops = &clk_ops_branch, |
| 2168 | CLK_INIT(usb_hs1_p_clk.c), |
| 2169 | }, |
| 2170 | }; |
| 2171 | |
Stephen Boyd | 94625ef | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 2172 | static struct branch_clk usb_hsic_p_clk = { |
| 2173 | .b = { |
| 2174 | .ctl_reg = USB_HSIC_HCLK_CTL_REG, |
| 2175 | .en_mask = BIT(4), |
| 2176 | .halt_reg = CLK_HALT_CFPB_STATEA_REG, |
| 2177 | .halt_bit = 28, |
| 2178 | }, |
| 2179 | .c = { |
| 2180 | .dbg_name = "usb_hsic_p_clk", |
| 2181 | .ops = &clk_ops_branch, |
| 2182 | CLK_INIT(usb_hsic_p_clk.c), |
| 2183 | }, |
| 2184 | }; |
| 2185 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2186 | static struct branch_clk sdc1_p_clk = { |
| 2187 | .b = { |
| 2188 | .ctl_reg = SDCn_HCLK_CTL_REG(1), |
| 2189 | .en_mask = BIT(4), |
| 2190 | .halt_reg = CLK_HALT_DFAB_STATE_REG, |
| 2191 | .halt_bit = 11, |
| 2192 | }, |
| 2193 | .c = { |
| 2194 | .dbg_name = "sdc1_p_clk", |
| 2195 | .ops = &clk_ops_branch, |
| 2196 | CLK_INIT(sdc1_p_clk.c), |
| 2197 | }, |
| 2198 | }; |
| 2199 | |
| 2200 | static struct branch_clk sdc2_p_clk = { |
| 2201 | .b = { |
| 2202 | .ctl_reg = SDCn_HCLK_CTL_REG(2), |
| 2203 | .en_mask = BIT(4), |
| 2204 | .halt_reg = CLK_HALT_DFAB_STATE_REG, |
| 2205 | .halt_bit = 10, |
| 2206 | }, |
| 2207 | .c = { |
| 2208 | .dbg_name = "sdc2_p_clk", |
| 2209 | .ops = &clk_ops_branch, |
| 2210 | CLK_INIT(sdc2_p_clk.c), |
| 2211 | }, |
| 2212 | }; |
| 2213 | |
| 2214 | static struct branch_clk sdc3_p_clk = { |
| 2215 | .b = { |
| 2216 | .ctl_reg = SDCn_HCLK_CTL_REG(3), |
| 2217 | .en_mask = BIT(4), |
| 2218 | .halt_reg = CLK_HALT_DFAB_STATE_REG, |
| 2219 | .halt_bit = 9, |
| 2220 | }, |
| 2221 | .c = { |
| 2222 | .dbg_name = "sdc3_p_clk", |
| 2223 | .ops = &clk_ops_branch, |
| 2224 | CLK_INIT(sdc3_p_clk.c), |
| 2225 | }, |
| 2226 | }; |
| 2227 | |
| 2228 | static struct branch_clk sdc4_p_clk = { |
| 2229 | .b = { |
| 2230 | .ctl_reg = SDCn_HCLK_CTL_REG(4), |
| 2231 | .en_mask = BIT(4), |
| 2232 | .halt_reg = CLK_HALT_DFAB_STATE_REG, |
| 2233 | .halt_bit = 8, |
| 2234 | }, |
| 2235 | .c = { |
| 2236 | .dbg_name = "sdc4_p_clk", |
| 2237 | .ops = &clk_ops_branch, |
| 2238 | CLK_INIT(sdc4_p_clk.c), |
| 2239 | }, |
| 2240 | }; |
| 2241 | |
| 2242 | static struct branch_clk sdc5_p_clk = { |
| 2243 | .b = { |
| 2244 | .ctl_reg = SDCn_HCLK_CTL_REG(5), |
| 2245 | .en_mask = BIT(4), |
| 2246 | .halt_reg = CLK_HALT_DFAB_STATE_REG, |
| 2247 | .halt_bit = 7, |
| 2248 | }, |
| 2249 | .c = { |
| 2250 | .dbg_name = "sdc5_p_clk", |
| 2251 | .ops = &clk_ops_branch, |
| 2252 | CLK_INIT(sdc5_p_clk.c), |
| 2253 | }, |
| 2254 | }; |
| 2255 | |
| 2256 | /* HW-Voteable Clocks */ |
| 2257 | static struct branch_clk adm0_clk = { |
| 2258 | .b = { |
| 2259 | .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG, |
| 2260 | .en_mask = BIT(2), |
| 2261 | .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG, |
| 2262 | .halt_check = HALT_VOTED, |
| 2263 | .halt_bit = 14, |
| 2264 | }, |
| 2265 | .c = { |
| 2266 | .dbg_name = "adm0_clk", |
| 2267 | .ops = &clk_ops_branch, |
| 2268 | CLK_INIT(adm0_clk.c), |
| 2269 | }, |
| 2270 | }; |
| 2271 | |
| 2272 | static struct branch_clk adm0_p_clk = { |
| 2273 | .b = { |
| 2274 | .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG, |
| 2275 | .en_mask = BIT(3), |
| 2276 | .halt_reg = CLK_HALT_MSS_SMPSS_MISC_STATE_REG, |
| 2277 | .halt_check = HALT_VOTED, |
| 2278 | .halt_bit = 13, |
| 2279 | }, |
| 2280 | .c = { |
| 2281 | .dbg_name = "adm0_p_clk", |
| 2282 | .ops = &clk_ops_branch, |
| 2283 | CLK_INIT(adm0_p_clk.c), |
| 2284 | }, |
| 2285 | }; |
| 2286 | |
| 2287 | static struct branch_clk pmic_arb0_p_clk = { |
| 2288 | .b = { |
| 2289 | .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG, |
| 2290 | .en_mask = BIT(8), |
| 2291 | .halt_reg = CLK_HALT_SFPB_MISC_STATE_REG, |
| 2292 | .halt_check = HALT_VOTED, |
| 2293 | .halt_bit = 22, |
| 2294 | }, |
| 2295 | .c = { |
| 2296 | .dbg_name = "pmic_arb0_p_clk", |
| 2297 | .ops = &clk_ops_branch, |
| 2298 | CLK_INIT(pmic_arb0_p_clk.c), |
| 2299 | }, |
| 2300 | }; |
| 2301 | |
| 2302 | static struct branch_clk pmic_arb1_p_clk = { |
| 2303 | .b = { |
| 2304 | .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG, |
| 2305 | .en_mask = BIT(9), |
| 2306 | .halt_reg = CLK_HALT_SFPB_MISC_STATE_REG, |
| 2307 | .halt_check = HALT_VOTED, |
| 2308 | .halt_bit = 21, |
| 2309 | }, |
| 2310 | .c = { |
| 2311 | .dbg_name = "pmic_arb1_p_clk", |
| 2312 | .ops = &clk_ops_branch, |
| 2313 | CLK_INIT(pmic_arb1_p_clk.c), |
| 2314 | }, |
| 2315 | }; |
| 2316 | |
| 2317 | static struct branch_clk pmic_ssbi2_clk = { |
| 2318 | .b = { |
| 2319 | .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG, |
| 2320 | .en_mask = BIT(7), |
| 2321 | .halt_reg = CLK_HALT_SFPB_MISC_STATE_REG, |
| 2322 | .halt_check = HALT_VOTED, |
| 2323 | .halt_bit = 23, |
| 2324 | }, |
| 2325 | .c = { |
| 2326 | .dbg_name = "pmic_ssbi2_clk", |
| 2327 | .ops = &clk_ops_branch, |
| 2328 | CLK_INIT(pmic_ssbi2_clk.c), |
| 2329 | }, |
| 2330 | }; |
| 2331 | |
| 2332 | static struct branch_clk rpm_msg_ram_p_clk = { |
| 2333 | .b = { |
| 2334 | .ctl_reg = SC0_U_CLK_BRANCH_ENA_VOTE_REG, |
| 2335 | .en_mask = BIT(6), |
| 2336 | .halt_reg = CLK_HALT_SFPB_MISC_STATE_REG, |
| 2337 | .halt_check = HALT_VOTED, |
| 2338 | .halt_bit = 12, |
| 2339 | }, |
| 2340 | .c = { |
| 2341 | .dbg_name = "rpm_msg_ram_p_clk", |
| 2342 | .ops = &clk_ops_branch, |
| 2343 | CLK_INIT(rpm_msg_ram_p_clk.c), |
| 2344 | }, |
| 2345 | }; |
| 2346 | |
| 2347 | /* |
| 2348 | * Multimedia Clocks |
| 2349 | */ |
| 2350 | |
| 2351 | static struct branch_clk amp_clk = { |
| 2352 | .b = { |
| 2353 | .reset_reg = SW_RESET_CORE_REG, |
| 2354 | .reset_mask = BIT(20), |
| 2355 | }, |
| 2356 | .c = { |
| 2357 | .dbg_name = "amp_clk", |
| 2358 | .ops = &clk_ops_reset, |
| 2359 | CLK_INIT(amp_clk.c), |
| 2360 | }, |
| 2361 | }; |
| 2362 | |
Stephen Boyd | 94625ef | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 2363 | #define CLK_CAM(name, n, hb) \ |
| 2364 | struct rcg_clk name = { \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2365 | .b = { \ |
Stephen Boyd | 94625ef | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 2366 | .ctl_reg = CAMCLK##n##_CC_REG, \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2367 | .en_mask = BIT(0), \ |
| 2368 | .halt_reg = DBG_BUS_VEC_I_REG, \ |
| 2369 | .halt_bit = hb, \ |
| 2370 | }, \ |
Stephen Boyd | 94625ef | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 2371 | .ns_reg = CAMCLK##n##_NS_REG, \ |
| 2372 | .md_reg = CAMCLK##n##_MD_REG, \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2373 | .root_en_mask = BIT(2), \ |
Stephen Boyd | 94625ef | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 2374 | .ns_mask = BM(31, 24) | BM(15, 14) | BM(2, 0), \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2375 | .ctl_mask = BM(7, 6), \ |
| 2376 | .set_rate = set_rate_mnd_8, \ |
| 2377 | .freq_tbl = clk_tbl_cam, \ |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2378 | .current_freq = &rcg_dummy_freq, \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2379 | .c = { \ |
Stephen Boyd | 94625ef | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 2380 | .dbg_name = #name, \ |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2381 | .ops = &clk_ops_rcg_8960, \ |
Stephen Boyd | 94625ef | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 2382 | CLK_INIT(name.c), \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2383 | }, \ |
| 2384 | } |
| 2385 | #define F_CAM(f, s, d, m, n, v) \ |
| 2386 | { \ |
| 2387 | .freq_hz = f, \ |
| 2388 | .src_clk = &s##_clk.c, \ |
| 2389 | .md_val = MD8(8, m, 0, n), \ |
| 2390 | .ns_val = NS_MM(31, 24, n, m, 15, 14, d, 2, 0, s##_to_mm_mux), \ |
| 2391 | .ctl_val = CC(6, n), \ |
| 2392 | .mnd_en_mask = BIT(5) * !!(n), \ |
| 2393 | .sys_vdd = v, \ |
| 2394 | } |
| 2395 | static struct clk_freq_tbl clk_tbl_cam[] = { |
| 2396 | F_CAM( 0, gnd, 1, 0, 0, NONE), |
| 2397 | F_CAM( 6000000, pll8, 4, 1, 16, LOW), |
| 2398 | F_CAM( 8000000, pll8, 4, 1, 12, LOW), |
| 2399 | F_CAM( 12000000, pll8, 4, 1, 8, LOW), |
| 2400 | F_CAM( 16000000, pll8, 4, 1, 6, LOW), |
| 2401 | F_CAM( 19200000, pll8, 4, 1, 5, LOW), |
| 2402 | F_CAM( 24000000, pll8, 4, 1, 4, LOW), |
| 2403 | F_CAM( 32000000, pll8, 4, 1, 3, LOW), |
| 2404 | F_CAM( 48000000, pll8, 4, 1, 2, LOW), |
| 2405 | F_CAM( 64000000, pll8, 3, 1, 2, LOW), |
| 2406 | F_CAM( 96000000, pll8, 4, 0, 0, NOMINAL), |
| 2407 | F_CAM(128000000, pll8, 3, 0, 0, NOMINAL), |
| 2408 | F_END |
| 2409 | }; |
| 2410 | |
Stephen Boyd | 94625ef | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 2411 | static CLK_CAM(cam0_clk, 0, 15); |
| 2412 | static CLK_CAM(cam1_clk, 1, 16); |
| 2413 | static CLK_CAM(cam2_clk, 2, 31); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2414 | |
| 2415 | #define F_CSI(f, s, d, m, n, v) \ |
| 2416 | { \ |
| 2417 | .freq_hz = f, \ |
| 2418 | .src_clk = &s##_clk.c, \ |
| 2419 | .md_val = MD8(8, m, 0, n), \ |
| 2420 | .ns_val = NS_MM(31, 24, n, m, 15, 14, d, 2, 0, s##_to_mm_mux), \ |
| 2421 | .ctl_val = CC(6, n), \ |
| 2422 | .mnd_en_mask = BIT(5) * !!(n), \ |
| 2423 | .sys_vdd = v, \ |
| 2424 | } |
| 2425 | static struct clk_freq_tbl clk_tbl_csi[] = { |
| 2426 | F_CSI( 0, gnd, 1, 0, 0, NONE), |
| 2427 | F_CSI( 85330000, pll8, 1, 2, 9, LOW), |
| 2428 | F_CSI(177780000, pll2, 1, 2, 9, NOMINAL), |
| 2429 | F_END |
| 2430 | }; |
| 2431 | |
| 2432 | static struct rcg_clk csi0_src_clk = { |
| 2433 | .ns_reg = CSI0_NS_REG, |
| 2434 | .b = { |
| 2435 | .ctl_reg = CSI0_CC_REG, |
| 2436 | .halt_check = NOCHECK, |
| 2437 | }, |
| 2438 | .md_reg = CSI0_MD_REG, |
| 2439 | .root_en_mask = BIT(2), |
Stephen Boyd | 94625ef | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 2440 | .ns_mask = BM(31, 24) | BM(15, 14) | BM(2, 0), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2441 | .ctl_mask = BM(7, 6), |
| 2442 | .set_rate = set_rate_mnd, |
| 2443 | .freq_tbl = clk_tbl_csi, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2444 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2445 | .c = { |
| 2446 | .dbg_name = "csi0_src_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2447 | .ops = &clk_ops_rcg_8960, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2448 | CLK_INIT(csi0_src_clk.c), |
| 2449 | }, |
| 2450 | }; |
| 2451 | |
| 2452 | static struct branch_clk csi0_clk = { |
| 2453 | .b = { |
| 2454 | .ctl_reg = CSI0_CC_REG, |
| 2455 | .en_mask = BIT(0), |
| 2456 | .reset_reg = SW_RESET_CORE_REG, |
| 2457 | .reset_mask = BIT(8), |
| 2458 | .halt_reg = DBG_BUS_VEC_B_REG, |
| 2459 | .halt_bit = 13, |
| 2460 | }, |
| 2461 | .parent = &csi0_src_clk.c, |
| 2462 | .c = { |
| 2463 | .dbg_name = "csi0_clk", |
| 2464 | .ops = &clk_ops_branch, |
| 2465 | CLK_INIT(csi0_clk.c), |
| 2466 | }, |
| 2467 | }; |
| 2468 | |
| 2469 | static struct branch_clk csi0_phy_clk = { |
| 2470 | .b = { |
| 2471 | .ctl_reg = CSI0_CC_REG, |
| 2472 | .en_mask = BIT(8), |
| 2473 | .reset_reg = SW_RESET_CORE_REG, |
| 2474 | .reset_mask = BIT(29), |
| 2475 | .halt_reg = DBG_BUS_VEC_I_REG, |
| 2476 | .halt_bit = 9, |
| 2477 | }, |
| 2478 | .parent = &csi0_src_clk.c, |
| 2479 | .c = { |
| 2480 | .dbg_name = "csi0_phy_clk", |
| 2481 | .ops = &clk_ops_branch, |
| 2482 | CLK_INIT(csi0_phy_clk.c), |
| 2483 | }, |
| 2484 | }; |
| 2485 | |
| 2486 | static struct rcg_clk csi1_src_clk = { |
| 2487 | .ns_reg = CSI1_NS_REG, |
| 2488 | .b = { |
| 2489 | .ctl_reg = CSI1_CC_REG, |
| 2490 | .halt_check = NOCHECK, |
| 2491 | }, |
| 2492 | .md_reg = CSI1_MD_REG, |
| 2493 | .root_en_mask = BIT(2), |
Stephen Boyd | 94625ef | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 2494 | .ns_mask = BM(31, 24) | BM(15, 14) | BM(2, 0), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2495 | .ctl_mask = BM(7, 6), |
| 2496 | .set_rate = set_rate_mnd, |
| 2497 | .freq_tbl = clk_tbl_csi, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2498 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2499 | .c = { |
| 2500 | .dbg_name = "csi1_src_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2501 | .ops = &clk_ops_rcg_8960, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2502 | CLK_INIT(csi1_src_clk.c), |
| 2503 | }, |
| 2504 | }; |
| 2505 | |
| 2506 | static struct branch_clk csi1_clk = { |
| 2507 | .b = { |
| 2508 | .ctl_reg = CSI1_CC_REG, |
| 2509 | .en_mask = BIT(0), |
| 2510 | .reset_reg = SW_RESET_CORE_REG, |
| 2511 | .reset_mask = BIT(18), |
| 2512 | .halt_reg = DBG_BUS_VEC_B_REG, |
| 2513 | .halt_bit = 14, |
| 2514 | }, |
| 2515 | .parent = &csi1_src_clk.c, |
| 2516 | .c = { |
| 2517 | .dbg_name = "csi1_clk", |
| 2518 | .ops = &clk_ops_branch, |
| 2519 | CLK_INIT(csi1_clk.c), |
| 2520 | }, |
| 2521 | }; |
| 2522 | |
| 2523 | static struct branch_clk csi1_phy_clk = { |
| 2524 | .b = { |
| 2525 | .ctl_reg = CSI1_CC_REG, |
| 2526 | .en_mask = BIT(8), |
| 2527 | .reset_reg = SW_RESET_CORE_REG, |
| 2528 | .reset_mask = BIT(28), |
| 2529 | .halt_reg = DBG_BUS_VEC_I_REG, |
| 2530 | .halt_bit = 10, |
| 2531 | }, |
| 2532 | .parent = &csi1_src_clk.c, |
| 2533 | .c = { |
| 2534 | .dbg_name = "csi1_phy_clk", |
| 2535 | .ops = &clk_ops_branch, |
| 2536 | CLK_INIT(csi1_phy_clk.c), |
| 2537 | }, |
| 2538 | }; |
| 2539 | |
Stephen Boyd | 94625ef | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 2540 | static struct rcg_clk csi2_src_clk = { |
| 2541 | .ns_reg = CSI2_NS_REG, |
| 2542 | .b = { |
| 2543 | .ctl_reg = CSI2_CC_REG, |
| 2544 | .halt_check = NOCHECK, |
| 2545 | }, |
| 2546 | .md_reg = CSI2_MD_REG, |
| 2547 | .root_en_mask = BIT(2), |
| 2548 | .ns_mask = BM(31, 24) | BM(15, 14) | BM(2, 0), |
| 2549 | .ctl_mask = BM(7, 6), |
| 2550 | .set_rate = set_rate_mnd, |
| 2551 | .freq_tbl = clk_tbl_csi, |
| 2552 | .current_freq = &rcg_dummy_freq, |
| 2553 | .c = { |
| 2554 | .dbg_name = "csi2_src_clk", |
| 2555 | .ops = &clk_ops_rcg_8960, |
| 2556 | CLK_INIT(csi2_src_clk.c), |
| 2557 | }, |
| 2558 | }; |
| 2559 | |
| 2560 | static struct branch_clk csi2_clk = { |
| 2561 | .b = { |
| 2562 | .ctl_reg = CSI2_CC_REG, |
| 2563 | .en_mask = BIT(0), |
| 2564 | .reset_reg = SW_RESET_CORE2_REG, |
| 2565 | .reset_mask = BIT(2), |
| 2566 | .halt_reg = DBG_BUS_VEC_B_REG, |
| 2567 | .halt_bit = 29, |
| 2568 | }, |
| 2569 | .parent = &csi2_src_clk.c, |
| 2570 | .c = { |
| 2571 | .dbg_name = "csi2_clk", |
| 2572 | .ops = &clk_ops_branch, |
| 2573 | CLK_INIT(csi2_clk.c), |
| 2574 | }, |
| 2575 | }; |
| 2576 | |
| 2577 | static struct branch_clk csi2_phy_clk = { |
| 2578 | .b = { |
| 2579 | .ctl_reg = CSI2_CC_REG, |
| 2580 | .en_mask = BIT(8), |
| 2581 | .reset_reg = SW_RESET_CORE_REG, |
| 2582 | .reset_mask = BIT(31), |
| 2583 | .halt_reg = DBG_BUS_VEC_I_REG, |
| 2584 | .halt_bit = 29, |
| 2585 | }, |
| 2586 | .parent = &csi2_src_clk.c, |
| 2587 | .c = { |
| 2588 | .dbg_name = "csi2_phy_clk", |
| 2589 | .ops = &clk_ops_branch, |
| 2590 | CLK_INIT(csi2_phy_clk.c), |
| 2591 | }, |
| 2592 | }; |
| 2593 | |
| 2594 | /* |
| 2595 | * The csi pix and csi rdi clocks have two bits in two registers to control a |
| 2596 | * three input mux. So we have the generic rcg_clk_enable() path handle the |
| 2597 | * first bit, and this function handle the second bit. |
| 2598 | */ |
| 2599 | static void set_rate_pix_rdi(struct rcg_clk *clk, struct clk_freq_tbl *nf) |
| 2600 | { |
| 2601 | u32 reg = readl_relaxed(MISC_CC3_REG); |
| 2602 | u32 bit = (u32)nf->extra_freq_data; |
| 2603 | if (nf->freq_hz == 2) |
| 2604 | reg |= bit; |
| 2605 | else |
| 2606 | reg &= ~bit; |
| 2607 | writel_relaxed(reg, MISC_CC3_REG); |
| 2608 | } |
| 2609 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2610 | #define F_CSI_PIX(s) \ |
| 2611 | { \ |
| 2612 | .src_clk = &csi##s##_clk.c, \ |
| 2613 | .freq_hz = s, \ |
| 2614 | .ns_val = BVAL(25, 25, s), \ |
Stephen Boyd | 94625ef | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 2615 | .extra_freq_data = (void *)BIT(13), \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2616 | } |
| 2617 | static struct clk_freq_tbl clk_tbl_csi_pix[] = { |
| 2618 | F_CSI_PIX(0), /* CSI0 source */ |
| 2619 | F_CSI_PIX(1), /* CSI1 source */ |
Stephen Boyd | 94625ef | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 2620 | F_CSI_PIX(2), /* CSI2 source */ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2621 | F_END |
| 2622 | }; |
| 2623 | |
| 2624 | static struct rcg_clk csi_pix_clk = { |
| 2625 | .b = { |
| 2626 | .ctl_reg = MISC_CC_REG, |
| 2627 | .en_mask = BIT(26), |
| 2628 | .halt_check = DELAY, |
| 2629 | .reset_reg = SW_RESET_CORE_REG, |
| 2630 | .reset_mask = BIT(26), |
| 2631 | }, |
| 2632 | .ns_reg = MISC_CC_REG, |
| 2633 | .ns_mask = BIT(25), |
Stephen Boyd | 94625ef | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 2634 | .set_rate = set_rate_pix_rdi, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2635 | .freq_tbl = clk_tbl_csi_pix, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2636 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2637 | .c = { |
| 2638 | .dbg_name = "csi_pix_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2639 | .ops = &clk_ops_rcg_8960, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2640 | CLK_INIT(csi_pix_clk.c), |
| 2641 | }, |
| 2642 | }; |
| 2643 | |
Stephen Boyd | 94625ef | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 2644 | #define F_CSI_PIX1(s) \ |
| 2645 | { \ |
| 2646 | .src_clk = &csi##s##_clk.c, \ |
| 2647 | .freq_hz = s, \ |
| 2648 | .ns_val = BVAL(9, 8, s), \ |
| 2649 | } |
| 2650 | static struct clk_freq_tbl clk_tbl_csi_pix1[] = { |
| 2651 | F_CSI_PIX1(0), /* CSI0 source */ |
| 2652 | F_CSI_PIX1(1), /* CSI1 source */ |
| 2653 | F_CSI_PIX1(2), /* CSI2 source */ |
| 2654 | F_END |
| 2655 | }; |
| 2656 | |
| 2657 | static struct rcg_clk csi_pix1_clk = { |
| 2658 | .b = { |
| 2659 | .ctl_reg = MISC_CC3_REG, |
| 2660 | .en_mask = BIT(10), |
| 2661 | .halt_check = DELAY, |
| 2662 | .reset_reg = SW_RESET_CORE_REG, |
| 2663 | .reset_mask = BIT(30), |
| 2664 | }, |
| 2665 | .ns_reg = MISC_CC3_REG, |
| 2666 | .ns_mask = BM(9, 8), |
| 2667 | .set_rate = set_rate_nop, |
| 2668 | .freq_tbl = clk_tbl_csi_pix1, |
| 2669 | .current_freq = &rcg_dummy_freq, |
| 2670 | .c = { |
| 2671 | .dbg_name = "csi_pix1_clk", |
| 2672 | .ops = &clk_ops_rcg_8960, |
| 2673 | CLK_INIT(csi_pix1_clk.c), |
| 2674 | }, |
| 2675 | }; |
| 2676 | |
| 2677 | #define F_CSI_RDI(s) \ |
| 2678 | { \ |
| 2679 | .src_clk = &csi##s##_clk.c, \ |
| 2680 | .freq_hz = s, \ |
| 2681 | .ns_val = BVAL(12, 12, s), \ |
| 2682 | .extra_freq_data = (void *)BIT(12), \ |
| 2683 | } |
| 2684 | static struct clk_freq_tbl clk_tbl_csi_rdi[] = { |
| 2685 | F_CSI_RDI(0), /* CSI0 source */ |
| 2686 | F_CSI_RDI(1), /* CSI1 source */ |
| 2687 | F_CSI_RDI(2), /* CSI2 source */ |
| 2688 | F_END |
| 2689 | }; |
| 2690 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2691 | static struct rcg_clk csi_rdi_clk = { |
| 2692 | .b = { |
| 2693 | .ctl_reg = MISC_CC_REG, |
| 2694 | .en_mask = BIT(13), |
| 2695 | .halt_check = DELAY, |
| 2696 | .reset_reg = SW_RESET_CORE_REG, |
| 2697 | .reset_mask = BIT(27), |
| 2698 | }, |
| 2699 | .ns_reg = MISC_CC_REG, |
| 2700 | .ns_mask = BIT(12), |
Stephen Boyd | 94625ef | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 2701 | .set_rate = set_rate_pix_rdi, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2702 | .freq_tbl = clk_tbl_csi_rdi, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2703 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2704 | .c = { |
| 2705 | .dbg_name = "csi_rdi_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2706 | .ops = &clk_ops_rcg_8960, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2707 | CLK_INIT(csi_rdi_clk.c), |
| 2708 | }, |
| 2709 | }; |
| 2710 | |
Stephen Boyd | 94625ef | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 2711 | #define F_CSI_RDI1(s) \ |
| 2712 | { \ |
| 2713 | .src_clk = &csi##s##_clk.c, \ |
| 2714 | .freq_hz = s, \ |
| 2715 | .ns_val = BVAL(1, 0, s), \ |
| 2716 | } |
| 2717 | static struct clk_freq_tbl clk_tbl_csi_rdi1[] = { |
| 2718 | F_CSI_RDI1(0), /* CSI0 source */ |
| 2719 | F_CSI_RDI1(1), /* CSI1 source */ |
| 2720 | F_CSI_RDI1(2), /* CSI2 source */ |
| 2721 | F_END |
| 2722 | }; |
| 2723 | |
| 2724 | static struct rcg_clk csi_rdi1_clk = { |
| 2725 | .b = { |
| 2726 | .ctl_reg = MISC_CC3_REG, |
| 2727 | .en_mask = BIT(2), |
| 2728 | .halt_check = DELAY, |
| 2729 | .reset_reg = SW_RESET_CORE2_REG, |
| 2730 | .reset_mask = BIT(1), |
| 2731 | }, |
| 2732 | .ns_reg = MISC_CC3_REG, |
| 2733 | .ns_mask = BM(1, 0), |
| 2734 | .set_rate = set_rate_nop, |
| 2735 | .freq_tbl = clk_tbl_csi_rdi1, |
| 2736 | .current_freq = &rcg_dummy_freq, |
| 2737 | .c = { |
| 2738 | .dbg_name = "csi_rdi1_clk", |
| 2739 | .ops = &clk_ops_rcg_8960, |
| 2740 | CLK_INIT(csi_rdi1_clk.c), |
| 2741 | }, |
| 2742 | }; |
| 2743 | |
| 2744 | #define F_CSI_RDI2(s) \ |
| 2745 | { \ |
| 2746 | .src_clk = &csi##s##_clk.c, \ |
| 2747 | .freq_hz = s, \ |
| 2748 | .ns_val = BVAL(5, 4, s), \ |
| 2749 | } |
| 2750 | static struct clk_freq_tbl clk_tbl_csi_rdi2[] = { |
| 2751 | F_CSI_RDI2(0), /* CSI0 source */ |
| 2752 | F_CSI_RDI2(1), /* CSI1 source */ |
| 2753 | F_CSI_RDI2(2), /* CSI2 source */ |
| 2754 | F_END |
| 2755 | }; |
| 2756 | |
| 2757 | static struct rcg_clk csi_rdi2_clk = { |
| 2758 | .b = { |
| 2759 | .ctl_reg = MISC_CC3_REG, |
| 2760 | .en_mask = BIT(6), |
| 2761 | .halt_check = DELAY, |
| 2762 | .reset_reg = SW_RESET_CORE2_REG, |
| 2763 | .reset_mask = BIT(0), |
| 2764 | }, |
| 2765 | .ns_reg = MISC_CC3_REG, |
| 2766 | .ns_mask = BM(5, 4), |
| 2767 | .set_rate = set_rate_nop, |
| 2768 | .freq_tbl = clk_tbl_csi_rdi2, |
| 2769 | .current_freq = &rcg_dummy_freq, |
| 2770 | .c = { |
| 2771 | .dbg_name = "csi_rdi2_clk", |
| 2772 | .ops = &clk_ops_rcg_8960, |
| 2773 | CLK_INIT(csi_rdi2_clk.c), |
| 2774 | }, |
| 2775 | }; |
| 2776 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2777 | #define F_CSI_PHYTIMER(f, s, d, m, n, v) \ |
| 2778 | { \ |
| 2779 | .freq_hz = f, \ |
| 2780 | .src_clk = &s##_clk.c, \ |
| 2781 | .md_val = MD8(8, m, 0, n), \ |
| 2782 | .ns_val = NS_MM(31, 24, n, m, 15, 14, d, 2, 0, s##_to_mm_mux), \ |
| 2783 | .ctl_val = CC(6, n), \ |
| 2784 | .mnd_en_mask = BIT(5) * !!(n), \ |
| 2785 | .sys_vdd = v, \ |
| 2786 | } |
| 2787 | static struct clk_freq_tbl clk_tbl_csi_phytimer[] = { |
| 2788 | F_CSI_PHYTIMER( 0, gnd, 1, 0, 0, NONE), |
| 2789 | F_CSI_PHYTIMER( 85330000, pll8, 1, 2, 9, LOW), |
| 2790 | F_CSI_PHYTIMER(177780000, pll2, 1, 2, 9, NOMINAL), |
| 2791 | F_END |
| 2792 | }; |
| 2793 | |
| 2794 | static struct rcg_clk csiphy_timer_src_clk = { |
| 2795 | .ns_reg = CSIPHYTIMER_NS_REG, |
| 2796 | .b = { |
| 2797 | .ctl_reg = CSIPHYTIMER_CC_REG, |
| 2798 | .halt_check = NOCHECK, |
| 2799 | }, |
| 2800 | .md_reg = CSIPHYTIMER_MD_REG, |
| 2801 | .root_en_mask = BIT(2), |
| 2802 | .ns_mask = (BM(31, 24) | BM(15, 14) | BM(2, 0)), |
| 2803 | .ctl_mask = BM(7, 6), |
| 2804 | .set_rate = set_rate_mnd_8, |
| 2805 | .freq_tbl = clk_tbl_csi_phytimer, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2806 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2807 | .c = { |
| 2808 | .dbg_name = "csiphy_timer_src_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2809 | .ops = &clk_ops_rcg_8960, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2810 | CLK_INIT(csiphy_timer_src_clk.c), |
| 2811 | }, |
| 2812 | }; |
| 2813 | |
| 2814 | static struct branch_clk csi0phy_timer_clk = { |
| 2815 | .b = { |
| 2816 | .ctl_reg = CSIPHYTIMER_CC_REG, |
| 2817 | .en_mask = BIT(0), |
| 2818 | .halt_reg = DBG_BUS_VEC_I_REG, |
| 2819 | .halt_bit = 17, |
| 2820 | }, |
| 2821 | .parent = &csiphy_timer_src_clk.c, |
| 2822 | .c = { |
| 2823 | .dbg_name = "csi0phy_timer_clk", |
| 2824 | .ops = &clk_ops_branch, |
| 2825 | CLK_INIT(csi0phy_timer_clk.c), |
| 2826 | }, |
| 2827 | }; |
| 2828 | |
| 2829 | static struct branch_clk csi1phy_timer_clk = { |
| 2830 | .b = { |
| 2831 | .ctl_reg = CSIPHYTIMER_CC_REG, |
| 2832 | .en_mask = BIT(9), |
| 2833 | .halt_reg = DBG_BUS_VEC_I_REG, |
| 2834 | .halt_bit = 18, |
| 2835 | }, |
| 2836 | .parent = &csiphy_timer_src_clk.c, |
| 2837 | .c = { |
| 2838 | .dbg_name = "csi1phy_timer_clk", |
| 2839 | .ops = &clk_ops_branch, |
| 2840 | CLK_INIT(csi1phy_timer_clk.c), |
| 2841 | }, |
| 2842 | }; |
| 2843 | |
Stephen Boyd | 94625ef | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 2844 | static struct branch_clk csi2phy_timer_clk = { |
| 2845 | .b = { |
| 2846 | .ctl_reg = CSIPHYTIMER_CC_REG, |
| 2847 | .en_mask = BIT(11), |
| 2848 | .halt_reg = DBG_BUS_VEC_I_REG, |
| 2849 | .halt_bit = 30, |
| 2850 | }, |
| 2851 | .parent = &csiphy_timer_src_clk.c, |
| 2852 | .c = { |
| 2853 | .dbg_name = "csi2phy_timer_clk", |
| 2854 | .ops = &clk_ops_branch, |
| 2855 | CLK_INIT(csi2phy_timer_clk.c), |
| 2856 | }, |
| 2857 | }; |
| 2858 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2859 | #define F_DSI(d) \ |
| 2860 | { \ |
| 2861 | .freq_hz = d, \ |
| 2862 | .ns_val = BVAL(15, 12, (d-1)), \ |
| 2863 | } |
| 2864 | /* |
| 2865 | * The DSI_BYTE/ESC clock is sourced from the DSI PHY PLL, which may change rate |
| 2866 | * without this clock driver knowing. So, overload the clk_set_rate() to set |
| 2867 | * the divider (1 to 16) of the clock with respect to the PLL rate. |
| 2868 | */ |
| 2869 | static struct clk_freq_tbl clk_tbl_dsi_byte[] = { |
| 2870 | F_DSI(1), F_DSI(2), F_DSI(3), F_DSI(4), |
| 2871 | F_DSI(5), F_DSI(6), F_DSI(7), F_DSI(8), |
| 2872 | F_DSI(9), F_DSI(10), F_DSI(11), F_DSI(12), |
| 2873 | F_DSI(13), F_DSI(14), F_DSI(15), F_DSI(16), |
| 2874 | F_END |
| 2875 | }; |
| 2876 | |
| 2877 | static struct rcg_clk dsi1_byte_clk = { |
| 2878 | .b = { |
| 2879 | .ctl_reg = DSI1_BYTE_CC_REG, |
| 2880 | .en_mask = BIT(0), |
| 2881 | .reset_reg = SW_RESET_CORE_REG, |
| 2882 | .reset_mask = BIT(7), |
| 2883 | .halt_reg = DBG_BUS_VEC_B_REG, |
| 2884 | .halt_bit = 21, |
| 2885 | }, |
| 2886 | .ns_reg = DSI1_BYTE_NS_REG, |
| 2887 | .root_en_mask = BIT(2), |
| 2888 | .ns_mask = BM(15, 12), |
| 2889 | .set_rate = set_rate_nop, |
| 2890 | .freq_tbl = clk_tbl_dsi_byte, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2891 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2892 | .c = { |
| 2893 | .dbg_name = "dsi1_byte_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2894 | .ops = &clk_ops_rcg_8960, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2895 | CLK_INIT(dsi1_byte_clk.c), |
| 2896 | }, |
| 2897 | }; |
| 2898 | |
| 2899 | static struct rcg_clk dsi2_byte_clk = { |
| 2900 | .b = { |
| 2901 | .ctl_reg = DSI2_BYTE_CC_REG, |
| 2902 | .en_mask = BIT(0), |
| 2903 | .reset_reg = SW_RESET_CORE_REG, |
| 2904 | .reset_mask = BIT(25), |
| 2905 | .halt_reg = DBG_BUS_VEC_B_REG, |
| 2906 | .halt_bit = 20, |
| 2907 | }, |
| 2908 | .ns_reg = DSI2_BYTE_NS_REG, |
| 2909 | .root_en_mask = BIT(2), |
| 2910 | .ns_mask = BM(15, 12), |
| 2911 | .set_rate = set_rate_nop, |
| 2912 | .freq_tbl = clk_tbl_dsi_byte, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2913 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2914 | .c = { |
| 2915 | .dbg_name = "dsi2_byte_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2916 | .ops = &clk_ops_rcg_8960, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2917 | CLK_INIT(dsi2_byte_clk.c), |
| 2918 | }, |
| 2919 | }; |
| 2920 | |
| 2921 | static struct rcg_clk dsi1_esc_clk = { |
| 2922 | .b = { |
| 2923 | .ctl_reg = DSI1_ESC_CC_REG, |
| 2924 | .en_mask = BIT(0), |
| 2925 | .reset_reg = SW_RESET_CORE_REG, |
| 2926 | .halt_reg = DBG_BUS_VEC_I_REG, |
| 2927 | .halt_bit = 1, |
| 2928 | }, |
| 2929 | .ns_reg = DSI1_ESC_NS_REG, |
| 2930 | .root_en_mask = BIT(2), |
| 2931 | .ns_mask = BM(15, 12), |
| 2932 | .set_rate = set_rate_nop, |
| 2933 | .freq_tbl = clk_tbl_dsi_byte, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2934 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2935 | .c = { |
| 2936 | .dbg_name = "dsi1_esc_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2937 | .ops = &clk_ops_rcg_8960, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2938 | CLK_INIT(dsi1_esc_clk.c), |
| 2939 | }, |
| 2940 | }; |
| 2941 | |
| 2942 | static struct rcg_clk dsi2_esc_clk = { |
| 2943 | .b = { |
| 2944 | .ctl_reg = DSI2_ESC_CC_REG, |
| 2945 | .en_mask = BIT(0), |
| 2946 | .halt_reg = DBG_BUS_VEC_I_REG, |
| 2947 | .halt_bit = 3, |
| 2948 | }, |
| 2949 | .ns_reg = DSI2_ESC_NS_REG, |
| 2950 | .root_en_mask = BIT(2), |
| 2951 | .ns_mask = BM(15, 12), |
| 2952 | .set_rate = set_rate_nop, |
| 2953 | .freq_tbl = clk_tbl_dsi_byte, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2954 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2955 | .c = { |
| 2956 | .dbg_name = "dsi2_esc_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 2957 | .ops = &clk_ops_rcg_8960, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2958 | CLK_INIT(dsi2_esc_clk.c), |
| 2959 | }, |
| 2960 | }; |
| 2961 | |
| 2962 | #define F_GFX2D(f, s, m, n, v) \ |
| 2963 | { \ |
| 2964 | .freq_hz = f, \ |
| 2965 | .src_clk = &s##_clk.c, \ |
| 2966 | .md_val = MD4(4, m, 0, n), \ |
| 2967 | .ns_val = NS_MND_BANKED4(20, 16, n, m, 3, 0, s##_to_mm_mux), \ |
| 2968 | .ctl_val = CC_BANKED(9, 6, n), \ |
| 2969 | .mnd_en_mask = (BIT(8) | BIT(5)) * !!(n), \ |
| 2970 | .sys_vdd = v, \ |
| 2971 | } |
| 2972 | static struct clk_freq_tbl clk_tbl_gfx2d[] = { |
| 2973 | F_GFX2D( 0, gnd, 0, 0, NONE), |
| 2974 | F_GFX2D( 27000000, pxo, 0, 0, LOW), |
| 2975 | F_GFX2D( 48000000, pll8, 1, 8, LOW), |
| 2976 | F_GFX2D( 54857000, pll8, 1, 7, LOW), |
| 2977 | F_GFX2D( 64000000, pll8, 1, 6, LOW), |
| 2978 | F_GFX2D( 76800000, pll8, 1, 5, LOW), |
| 2979 | F_GFX2D( 96000000, pll8, 1, 4, LOW), |
| 2980 | F_GFX2D(128000000, pll8, 1, 3, NOMINAL), |
| 2981 | F_GFX2D(145455000, pll2, 2, 11, NOMINAL), |
| 2982 | F_GFX2D(160000000, pll2, 1, 5, NOMINAL), |
| 2983 | F_GFX2D(177778000, pll2, 2, 9, NOMINAL), |
| 2984 | F_GFX2D(200000000, pll2, 1, 4, NOMINAL), |
| 2985 | F_GFX2D(228571000, pll2, 2, 7, HIGH), |
| 2986 | F_END |
| 2987 | }; |
| 2988 | |
| 2989 | static struct bank_masks bmnd_info_gfx2d0 = { |
| 2990 | .bank_sel_mask = BIT(11), |
| 2991 | .bank0_mask = { |
| 2992 | .md_reg = GFX2D0_MD0_REG, |
| 2993 | .ns_mask = BM(23, 20) | BM(5, 3), |
| 2994 | .rst_mask = BIT(25), |
| 2995 | .mnd_en_mask = BIT(8), |
| 2996 | .mode_mask = BM(10, 9), |
| 2997 | }, |
| 2998 | .bank1_mask = { |
| 2999 | .md_reg = GFX2D0_MD1_REG, |
| 3000 | .ns_mask = BM(19, 16) | BM(2, 0), |
| 3001 | .rst_mask = BIT(24), |
| 3002 | .mnd_en_mask = BIT(5), |
| 3003 | .mode_mask = BM(7, 6), |
| 3004 | }, |
| 3005 | }; |
| 3006 | |
| 3007 | static struct rcg_clk gfx2d0_clk = { |
| 3008 | .b = { |
| 3009 | .ctl_reg = GFX2D0_CC_REG, |
| 3010 | .en_mask = BIT(0), |
| 3011 | .reset_reg = SW_RESET_CORE_REG, |
| 3012 | .reset_mask = BIT(14), |
| 3013 | .halt_reg = DBG_BUS_VEC_A_REG, |
| 3014 | .halt_bit = 9, |
| 3015 | }, |
| 3016 | .ns_reg = GFX2D0_NS_REG, |
| 3017 | .root_en_mask = BIT(2), |
| 3018 | .set_rate = set_rate_mnd_banked, |
| 3019 | .freq_tbl = clk_tbl_gfx2d, |
Stephen Boyd | c78d9a7 | 2011-07-20 00:46:24 -0700 | [diff] [blame] | 3020 | .bank_info = &bmnd_info_gfx2d0, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 3021 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3022 | .c = { |
| 3023 | .dbg_name = "gfx2d0_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 3024 | .ops = &clk_ops_rcg_8960, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3025 | CLK_INIT(gfx2d0_clk.c), |
| 3026 | }, |
| 3027 | }; |
| 3028 | |
| 3029 | static struct bank_masks bmnd_info_gfx2d1 = { |
| 3030 | .bank_sel_mask = BIT(11), |
| 3031 | .bank0_mask = { |
| 3032 | .md_reg = GFX2D1_MD0_REG, |
| 3033 | .ns_mask = BM(23, 20) | BM(5, 3), |
| 3034 | .rst_mask = BIT(25), |
| 3035 | .mnd_en_mask = BIT(8), |
| 3036 | .mode_mask = BM(10, 9), |
| 3037 | }, |
| 3038 | .bank1_mask = { |
| 3039 | .md_reg = GFX2D1_MD1_REG, |
| 3040 | .ns_mask = BM(19, 16) | BM(2, 0), |
| 3041 | .rst_mask = BIT(24), |
| 3042 | .mnd_en_mask = BIT(5), |
| 3043 | .mode_mask = BM(7, 6), |
| 3044 | }, |
| 3045 | }; |
| 3046 | |
| 3047 | static struct rcg_clk gfx2d1_clk = { |
| 3048 | .b = { |
| 3049 | .ctl_reg = GFX2D1_CC_REG, |
| 3050 | .en_mask = BIT(0), |
| 3051 | .reset_reg = SW_RESET_CORE_REG, |
| 3052 | .reset_mask = BIT(13), |
| 3053 | .halt_reg = DBG_BUS_VEC_A_REG, |
| 3054 | .halt_bit = 14, |
| 3055 | }, |
| 3056 | .ns_reg = GFX2D1_NS_REG, |
| 3057 | .root_en_mask = BIT(2), |
| 3058 | .set_rate = set_rate_mnd_banked, |
| 3059 | .freq_tbl = clk_tbl_gfx2d, |
Stephen Boyd | c78d9a7 | 2011-07-20 00:46:24 -0700 | [diff] [blame] | 3060 | .bank_info = &bmnd_info_gfx2d1, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 3061 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3062 | .c = { |
| 3063 | .dbg_name = "gfx2d1_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 3064 | .ops = &clk_ops_rcg_8960, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3065 | CLK_INIT(gfx2d1_clk.c), |
| 3066 | }, |
| 3067 | }; |
| 3068 | |
| 3069 | #define F_GFX3D(f, s, m, n, v) \ |
| 3070 | { \ |
| 3071 | .freq_hz = f, \ |
| 3072 | .src_clk = &s##_clk.c, \ |
| 3073 | .md_val = MD4(4, m, 0, n), \ |
| 3074 | .ns_val = NS_MND_BANKED4(18, 14, n, m, 3, 0, s##_to_mm_mux), \ |
| 3075 | .ctl_val = CC_BANKED(9, 6, n), \ |
| 3076 | .mnd_en_mask = (BIT(8) | BIT(5)) * !!(n), \ |
| 3077 | .sys_vdd = v, \ |
| 3078 | } |
| 3079 | static struct clk_freq_tbl clk_tbl_gfx3d[] = { |
| 3080 | F_GFX3D( 0, gnd, 0, 0, NONE), |
| 3081 | F_GFX3D( 27000000, pxo, 0, 0, LOW), |
| 3082 | F_GFX3D( 48000000, pll8, 1, 8, LOW), |
| 3083 | F_GFX3D( 54857000, pll8, 1, 7, LOW), |
| 3084 | F_GFX3D( 64000000, pll8, 1, 6, LOW), |
| 3085 | F_GFX3D( 76800000, pll8, 1, 5, LOW), |
| 3086 | F_GFX3D( 96000000, pll8, 1, 4, LOW), |
Stephen Boyd | d779742 | 2011-08-10 16:01:45 -0700 | [diff] [blame] | 3087 | F_GFX3D(128000000, pll8, 1, 3, LOW), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3088 | F_GFX3D(145455000, pll2, 2, 11, NOMINAL), |
| 3089 | F_GFX3D(160000000, pll2, 1, 5, NOMINAL), |
| 3090 | F_GFX3D(177778000, pll2, 2, 9, NOMINAL), |
| 3091 | F_GFX3D(200000000, pll2, 1, 4, NOMINAL), |
| 3092 | F_GFX3D(228571000, pll2, 2, 7, NOMINAL), |
| 3093 | F_GFX3D(266667000, pll2, 1, 3, NOMINAL), |
| 3094 | F_GFX3D(320000000, pll2, 2, 5, HIGH), |
| 3095 | F_END |
| 3096 | }; |
| 3097 | |
Stephen Boyd | 94625ef | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 3098 | static struct clk_freq_tbl clk_tbl_gfx3d_v2[] = { |
| 3099 | F_GFX3D( 0, gnd, 0, 0, NONE), |
| 3100 | F_GFX3D( 27000000, pxo, 0, 0, LOW), |
| 3101 | F_GFX3D( 48000000, pll8, 1, 8, LOW), |
| 3102 | F_GFX3D( 54857000, pll8, 1, 7, LOW), |
| 3103 | F_GFX3D( 64000000, pll8, 1, 6, LOW), |
| 3104 | F_GFX3D( 76800000, pll8, 1, 5, LOW), |
| 3105 | F_GFX3D( 96000000, pll8, 1, 4, LOW), |
| 3106 | F_GFX3D(128000000, pll8, 1, 3, LOW), |
| 3107 | F_GFX3D(145455000, pll2, 2, 11, NOMINAL), |
| 3108 | F_GFX3D(160000000, pll2, 1, 5, NOMINAL), |
| 3109 | F_GFX3D(177778000, pll2, 2, 9, NOMINAL), |
| 3110 | F_GFX3D(200000000, pll2, 1, 4, NOMINAL), |
| 3111 | F_GFX3D(228571000, pll2, 2, 7, NOMINAL), |
| 3112 | F_GFX3D(266667000, pll2, 1, 3, NOMINAL), |
| 3113 | F_GFX3D(300000000, pll3, 1, 4, NOMINAL), |
| 3114 | F_GFX3D(320000000, pll2, 2, 5, HIGH), |
| 3115 | F_GFX3D(400000000, pll2, 1, 2, HIGH), |
| 3116 | F_END |
| 3117 | }; |
| 3118 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3119 | static struct bank_masks bmnd_info_gfx3d = { |
| 3120 | .bank_sel_mask = BIT(11), |
| 3121 | .bank0_mask = { |
| 3122 | .md_reg = GFX3D_MD0_REG, |
| 3123 | .ns_mask = BM(21, 18) | BM(5, 3), |
| 3124 | .rst_mask = BIT(23), |
| 3125 | .mnd_en_mask = BIT(8), |
| 3126 | .mode_mask = BM(10, 9), |
| 3127 | }, |
| 3128 | .bank1_mask = { |
| 3129 | .md_reg = GFX3D_MD1_REG, |
| 3130 | .ns_mask = BM(17, 14) | BM(2, 0), |
| 3131 | .rst_mask = BIT(22), |
| 3132 | .mnd_en_mask = BIT(5), |
| 3133 | .mode_mask = BM(7, 6), |
| 3134 | }, |
| 3135 | }; |
| 3136 | |
| 3137 | static struct rcg_clk gfx3d_clk = { |
| 3138 | .b = { |
| 3139 | .ctl_reg = GFX3D_CC_REG, |
| 3140 | .en_mask = BIT(0), |
| 3141 | .reset_reg = SW_RESET_CORE_REG, |
| 3142 | .reset_mask = BIT(12), |
| 3143 | .halt_reg = DBG_BUS_VEC_A_REG, |
| 3144 | .halt_bit = 4, |
| 3145 | }, |
| 3146 | .ns_reg = GFX3D_NS_REG, |
| 3147 | .root_en_mask = BIT(2), |
| 3148 | .set_rate = set_rate_mnd_banked, |
| 3149 | .freq_tbl = clk_tbl_gfx3d, |
Stephen Boyd | c78d9a7 | 2011-07-20 00:46:24 -0700 | [diff] [blame] | 3150 | .bank_info = &bmnd_info_gfx3d, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 3151 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3152 | .c = { |
| 3153 | .dbg_name = "gfx3d_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 3154 | .ops = &clk_ops_rcg_8960, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3155 | CLK_INIT(gfx3d_clk.c), |
Stephen Boyd | 7fa2674 | 2011-08-11 23:22:29 -0700 | [diff] [blame] | 3156 | .depends = &gmem_axi_clk.c, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3157 | }, |
| 3158 | }; |
| 3159 | |
| 3160 | #define F_IJPEG(f, s, d, m, n, v) \ |
| 3161 | { \ |
| 3162 | .freq_hz = f, \ |
| 3163 | .src_clk = &s##_clk.c, \ |
| 3164 | .md_val = MD8(8, m, 0, n), \ |
| 3165 | .ns_val = NS_MM(23, 16, n, m, 15, 12, d, 2, 0, s##_to_mm_mux), \ |
| 3166 | .ctl_val = CC(6, n), \ |
| 3167 | .mnd_en_mask = BIT(5) * !!(n), \ |
| 3168 | .sys_vdd = v, \ |
| 3169 | } |
| 3170 | static struct clk_freq_tbl clk_tbl_ijpeg[] = { |
| 3171 | F_IJPEG( 0, gnd, 1, 0, 0, NONE), |
| 3172 | F_IJPEG( 27000000, pxo, 1, 0, 0, LOW), |
| 3173 | F_IJPEG( 36570000, pll8, 1, 2, 21, LOW), |
| 3174 | F_IJPEG( 54860000, pll8, 7, 0, 0, LOW), |
| 3175 | F_IJPEG( 96000000, pll8, 4, 0, 0, LOW), |
| 3176 | F_IJPEG(109710000, pll8, 1, 2, 7, LOW), |
| 3177 | F_IJPEG(128000000, pll8, 3, 0, 0, NOMINAL), |
| 3178 | F_IJPEG(153600000, pll8, 1, 2, 5, NOMINAL), |
| 3179 | F_IJPEG(200000000, pll2, 4, 0, 0, NOMINAL), |
| 3180 | F_IJPEG(228571000, pll2, 1, 2, 7, NOMINAL), |
Matt Wagantall | 393bdb5 | 2011-09-07 10:15:28 -0700 | [diff] [blame] | 3181 | F_IJPEG(266667000, pll2, 1, 1, 3, NOMINAL), |
Stephen Boyd | 94625ef | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 3182 | F_IJPEG(320000000, pll2, 1, 2, 5, HIGH), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3183 | F_END |
| 3184 | }; |
| 3185 | |
| 3186 | static struct rcg_clk ijpeg_clk = { |
| 3187 | .b = { |
| 3188 | .ctl_reg = IJPEG_CC_REG, |
| 3189 | .en_mask = BIT(0), |
| 3190 | .reset_reg = SW_RESET_CORE_REG, |
| 3191 | .reset_mask = BIT(9), |
| 3192 | .halt_reg = DBG_BUS_VEC_A_REG, |
| 3193 | .halt_bit = 24, |
| 3194 | }, |
| 3195 | .ns_reg = IJPEG_NS_REG, |
| 3196 | .md_reg = IJPEG_MD_REG, |
| 3197 | .root_en_mask = BIT(2), |
| 3198 | .ns_mask = (BM(23, 16) | BM(15, 12) | BM(2, 0)), |
| 3199 | .ctl_mask = BM(7, 6), |
| 3200 | .set_rate = set_rate_mnd, |
| 3201 | .freq_tbl = clk_tbl_ijpeg, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 3202 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3203 | .c = { |
| 3204 | .dbg_name = "ijpeg_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 3205 | .ops = &clk_ops_rcg_8960, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3206 | CLK_INIT(ijpeg_clk.c), |
Stephen Boyd | 7fa2674 | 2011-08-11 23:22:29 -0700 | [diff] [blame] | 3207 | .depends = &ijpeg_axi_clk.c, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3208 | }, |
| 3209 | }; |
| 3210 | |
| 3211 | #define F_JPEGD(f, s, d, v) \ |
| 3212 | { \ |
| 3213 | .freq_hz = f, \ |
| 3214 | .src_clk = &s##_clk.c, \ |
| 3215 | .ns_val = NS_DIVSRC(15, 12, d, 2, 0, s##_to_mm_mux), \ |
| 3216 | .sys_vdd = v, \ |
| 3217 | } |
| 3218 | static struct clk_freq_tbl clk_tbl_jpegd[] = { |
| 3219 | F_JPEGD( 0, gnd, 1, NONE), |
| 3220 | F_JPEGD( 64000000, pll8, 6, LOW), |
| 3221 | F_JPEGD( 76800000, pll8, 5, LOW), |
| 3222 | F_JPEGD( 96000000, pll8, 4, LOW), |
| 3223 | F_JPEGD(160000000, pll2, 5, NOMINAL), |
| 3224 | F_JPEGD(200000000, pll2, 4, NOMINAL), |
| 3225 | F_END |
| 3226 | }; |
| 3227 | |
| 3228 | static struct rcg_clk jpegd_clk = { |
| 3229 | .b = { |
| 3230 | .ctl_reg = JPEGD_CC_REG, |
| 3231 | .en_mask = BIT(0), |
| 3232 | .reset_reg = SW_RESET_CORE_REG, |
| 3233 | .reset_mask = BIT(19), |
| 3234 | .halt_reg = DBG_BUS_VEC_A_REG, |
| 3235 | .halt_bit = 19, |
| 3236 | }, |
| 3237 | .ns_reg = JPEGD_NS_REG, |
| 3238 | .root_en_mask = BIT(2), |
| 3239 | .ns_mask = (BM(15, 12) | BM(2, 0)), |
| 3240 | .set_rate = set_rate_nop, |
| 3241 | .freq_tbl = clk_tbl_jpegd, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 3242 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3243 | .c = { |
| 3244 | .dbg_name = "jpegd_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 3245 | .ops = &clk_ops_rcg_8960, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3246 | CLK_INIT(jpegd_clk.c), |
Stephen Boyd | 7fa2674 | 2011-08-11 23:22:29 -0700 | [diff] [blame] | 3247 | .depends = &jpegd_axi_clk.c, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3248 | }, |
| 3249 | }; |
| 3250 | |
| 3251 | #define F_MDP(f, s, m, n, v) \ |
| 3252 | { \ |
| 3253 | .freq_hz = f, \ |
| 3254 | .src_clk = &s##_clk.c, \ |
| 3255 | .md_val = MD8(8, m, 0, n), \ |
| 3256 | .ns_val = NS_MND_BANKED8(22, 14, n, m, 3, 0, s##_to_mm_mux), \ |
| 3257 | .ctl_val = CC_BANKED(9, 6, n), \ |
| 3258 | .mnd_en_mask = (BIT(8) | BIT(5)) * !!(n), \ |
| 3259 | .sys_vdd = v, \ |
| 3260 | } |
| 3261 | static struct clk_freq_tbl clk_tbl_mdp[] = { |
| 3262 | F_MDP( 0, gnd, 0, 0, NONE), |
| 3263 | F_MDP( 9600000, pll8, 1, 40, LOW), |
| 3264 | F_MDP( 13710000, pll8, 1, 28, LOW), |
| 3265 | F_MDP( 27000000, pxo, 0, 0, LOW), |
| 3266 | F_MDP( 29540000, pll8, 1, 13, LOW), |
| 3267 | F_MDP( 34910000, pll8, 1, 11, LOW), |
| 3268 | F_MDP( 38400000, pll8, 1, 10, LOW), |
| 3269 | F_MDP( 59080000, pll8, 2, 13, LOW), |
| 3270 | F_MDP( 76800000, pll8, 1, 5, LOW), |
| 3271 | F_MDP( 85330000, pll8, 2, 9, LOW), |
| 3272 | F_MDP( 96000000, pll8, 1, 4, NOMINAL), |
| 3273 | F_MDP(128000000, pll8, 1, 3, NOMINAL), |
| 3274 | F_MDP(160000000, pll2, 1, 5, NOMINAL), |
| 3275 | F_MDP(177780000, pll2, 2, 9, NOMINAL), |
| 3276 | F_MDP(200000000, pll2, 1, 4, NOMINAL), |
| 3277 | F_END |
| 3278 | }; |
| 3279 | |
| 3280 | static struct bank_masks bmnd_info_mdp = { |
| 3281 | .bank_sel_mask = BIT(11), |
| 3282 | .bank0_mask = { |
| 3283 | .md_reg = MDP_MD0_REG, |
| 3284 | .ns_mask = BM(29, 22) | BM(5, 3), |
| 3285 | .rst_mask = BIT(31), |
| 3286 | .mnd_en_mask = BIT(8), |
| 3287 | .mode_mask = BM(10, 9), |
| 3288 | }, |
| 3289 | .bank1_mask = { |
| 3290 | .md_reg = MDP_MD1_REG, |
| 3291 | .ns_mask = BM(21, 14) | BM(2, 0), |
| 3292 | .rst_mask = BIT(30), |
| 3293 | .mnd_en_mask = BIT(5), |
| 3294 | .mode_mask = BM(7, 6), |
| 3295 | }, |
| 3296 | }; |
| 3297 | |
| 3298 | static struct rcg_clk mdp_clk = { |
| 3299 | .b = { |
| 3300 | .ctl_reg = MDP_CC_REG, |
| 3301 | .en_mask = BIT(0), |
| 3302 | .reset_reg = SW_RESET_CORE_REG, |
| 3303 | .reset_mask = BIT(21), |
| 3304 | .halt_reg = DBG_BUS_VEC_C_REG, |
| 3305 | .halt_bit = 10, |
| 3306 | }, |
| 3307 | .ns_reg = MDP_NS_REG, |
| 3308 | .root_en_mask = BIT(2), |
| 3309 | .set_rate = set_rate_mnd_banked, |
| 3310 | .freq_tbl = clk_tbl_mdp, |
Stephen Boyd | c78d9a7 | 2011-07-20 00:46:24 -0700 | [diff] [blame] | 3311 | .bank_info = &bmnd_info_mdp, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 3312 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3313 | .c = { |
| 3314 | .dbg_name = "mdp_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 3315 | .ops = &clk_ops_rcg_8960, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3316 | CLK_INIT(mdp_clk.c), |
Stephen Boyd | 7fa2674 | 2011-08-11 23:22:29 -0700 | [diff] [blame] | 3317 | .depends = &mdp_axi_clk.c, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3318 | }, |
| 3319 | }; |
| 3320 | |
| 3321 | static struct branch_clk lut_mdp_clk = { |
| 3322 | .b = { |
| 3323 | .ctl_reg = MDP_LUT_CC_REG, |
| 3324 | .en_mask = BIT(0), |
| 3325 | .halt_reg = DBG_BUS_VEC_I_REG, |
| 3326 | .halt_bit = 13, |
| 3327 | }, |
| 3328 | .parent = &mdp_clk.c, |
| 3329 | .c = { |
| 3330 | .dbg_name = "lut_mdp_clk", |
| 3331 | .ops = &clk_ops_branch, |
| 3332 | CLK_INIT(lut_mdp_clk.c), |
| 3333 | }, |
| 3334 | }; |
| 3335 | |
| 3336 | #define F_MDP_VSYNC(f, s, v) \ |
| 3337 | { \ |
| 3338 | .freq_hz = f, \ |
| 3339 | .src_clk = &s##_clk.c, \ |
| 3340 | .ns_val = NS_SRC_SEL(13, 13, s##_to_bb_mux), \ |
| 3341 | .sys_vdd = v, \ |
| 3342 | } |
| 3343 | static struct clk_freq_tbl clk_tbl_mdp_vsync[] = { |
| 3344 | F_MDP_VSYNC(27000000, pxo, LOW), |
| 3345 | F_END |
| 3346 | }; |
| 3347 | |
| 3348 | static struct rcg_clk mdp_vsync_clk = { |
| 3349 | .b = { |
| 3350 | .ctl_reg = MISC_CC_REG, |
| 3351 | .en_mask = BIT(6), |
| 3352 | .reset_reg = SW_RESET_CORE_REG, |
| 3353 | .reset_mask = BIT(3), |
| 3354 | .halt_reg = DBG_BUS_VEC_B_REG, |
| 3355 | .halt_bit = 22, |
| 3356 | }, |
| 3357 | .ns_reg = MISC_CC2_REG, |
| 3358 | .ns_mask = BIT(13), |
| 3359 | .set_rate = set_rate_nop, |
| 3360 | .freq_tbl = clk_tbl_mdp_vsync, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 3361 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3362 | .c = { |
| 3363 | .dbg_name = "mdp_vsync_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 3364 | .ops = &clk_ops_rcg_8960, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3365 | CLK_INIT(mdp_vsync_clk.c), |
| 3366 | }, |
| 3367 | }; |
| 3368 | |
| 3369 | #define F_ROT(f, s, d, v) \ |
| 3370 | { \ |
| 3371 | .freq_hz = f, \ |
| 3372 | .src_clk = &s##_clk.c, \ |
| 3373 | .ns_val = NS_DIVSRC_BANKED(29, 26, 25, 22, d, \ |
| 3374 | 21, 19, 18, 16, s##_to_mm_mux), \ |
| 3375 | .sys_vdd = v, \ |
| 3376 | } |
| 3377 | static struct clk_freq_tbl clk_tbl_rot[] = { |
| 3378 | F_ROT( 0, gnd, 1, NONE), |
| 3379 | F_ROT( 27000000, pxo, 1, LOW), |
| 3380 | F_ROT( 29540000, pll8, 13, LOW), |
| 3381 | F_ROT( 32000000, pll8, 12, LOW), |
| 3382 | F_ROT( 38400000, pll8, 10, LOW), |
| 3383 | F_ROT( 48000000, pll8, 8, LOW), |
| 3384 | F_ROT( 54860000, pll8, 7, LOW), |
| 3385 | F_ROT( 64000000, pll8, 6, LOW), |
| 3386 | F_ROT( 76800000, pll8, 5, LOW), |
Matt Wagantall | 448db0f | 2011-09-07 10:17:40 -0700 | [diff] [blame^] | 3387 | F_ROT( 96000000, pll8, 4, LOW), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3388 | F_ROT(100000000, pll2, 8, NOMINAL), |
| 3389 | F_ROT(114290000, pll2, 7, NOMINAL), |
| 3390 | F_ROT(133330000, pll2, 6, NOMINAL), |
| 3391 | F_ROT(160000000, pll2, 5, NOMINAL), |
Stephen Boyd | 8487f71 | 2011-08-29 12:10:09 -0700 | [diff] [blame] | 3392 | F_ROT(200000000, pll2, 4, NOMINAL), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3393 | F_END |
| 3394 | }; |
| 3395 | |
| 3396 | static struct bank_masks bdiv_info_rot = { |
| 3397 | .bank_sel_mask = BIT(30), |
| 3398 | .bank0_mask = { |
| 3399 | .ns_mask = BM(25, 22) | BM(18, 16), |
| 3400 | }, |
| 3401 | .bank1_mask = { |
| 3402 | .ns_mask = BM(29, 26) | BM(21, 19), |
| 3403 | }, |
| 3404 | }; |
| 3405 | |
| 3406 | static struct rcg_clk rot_clk = { |
| 3407 | .b = { |
| 3408 | .ctl_reg = ROT_CC_REG, |
| 3409 | .en_mask = BIT(0), |
| 3410 | .reset_reg = SW_RESET_CORE_REG, |
| 3411 | .reset_mask = BIT(2), |
| 3412 | .halt_reg = DBG_BUS_VEC_C_REG, |
| 3413 | .halt_bit = 15, |
| 3414 | }, |
| 3415 | .ns_reg = ROT_NS_REG, |
| 3416 | .root_en_mask = BIT(2), |
| 3417 | .set_rate = set_rate_div_banked, |
| 3418 | .freq_tbl = clk_tbl_rot, |
Stephen Boyd | c78d9a7 | 2011-07-20 00:46:24 -0700 | [diff] [blame] | 3419 | .bank_info = &bdiv_info_rot, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 3420 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3421 | .c = { |
| 3422 | .dbg_name = "rot_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 3423 | .ops = &clk_ops_rcg_8960, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3424 | CLK_INIT(rot_clk.c), |
Stephen Boyd | 7fa2674 | 2011-08-11 23:22:29 -0700 | [diff] [blame] | 3425 | .depends = &rot_axi_clk.c, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3426 | }, |
| 3427 | }; |
| 3428 | |
| 3429 | static int hdmi_pll_clk_enable(struct clk *clk) |
| 3430 | { |
| 3431 | int ret; |
| 3432 | unsigned long flags; |
| 3433 | spin_lock_irqsave(&local_clock_reg_lock, flags); |
| 3434 | ret = hdmi_pll_enable(); |
| 3435 | spin_unlock_irqrestore(&local_clock_reg_lock, flags); |
| 3436 | return ret; |
| 3437 | } |
| 3438 | |
| 3439 | static void hdmi_pll_clk_disable(struct clk *clk) |
| 3440 | { |
| 3441 | unsigned long flags; |
| 3442 | spin_lock_irqsave(&local_clock_reg_lock, flags); |
| 3443 | hdmi_pll_disable(); |
| 3444 | spin_unlock_irqrestore(&local_clock_reg_lock, flags); |
| 3445 | } |
| 3446 | |
| 3447 | static unsigned hdmi_pll_clk_get_rate(struct clk *clk) |
| 3448 | { |
| 3449 | return hdmi_pll_get_rate(); |
| 3450 | } |
| 3451 | |
| 3452 | static struct clk_ops clk_ops_hdmi_pll = { |
| 3453 | .enable = hdmi_pll_clk_enable, |
| 3454 | .disable = hdmi_pll_clk_disable, |
| 3455 | .get_rate = hdmi_pll_clk_get_rate, |
| 3456 | .is_local = local_clk_is_local, |
| 3457 | }; |
| 3458 | |
| 3459 | static struct clk hdmi_pll_clk = { |
| 3460 | .dbg_name = "hdmi_pll_clk", |
| 3461 | .ops = &clk_ops_hdmi_pll, |
| 3462 | CLK_INIT(hdmi_pll_clk), |
| 3463 | }; |
| 3464 | |
| 3465 | #define F_TV_GND(f, s, p_r, d, m, n, v) \ |
| 3466 | { \ |
| 3467 | .freq_hz = f, \ |
| 3468 | .src_clk = &s##_clk.c, \ |
| 3469 | .md_val = MD8(8, m, 0, n), \ |
| 3470 | .ns_val = NS_MM(23, 16, n, m, 15, 14, d, 2, 0, s##_to_mm_mux), \ |
| 3471 | .ctl_val = CC(6, n), \ |
| 3472 | .mnd_en_mask = BIT(5) * !!(n), \ |
| 3473 | .sys_vdd = v, \ |
| 3474 | } |
| 3475 | #define F_TV(f, s, p_r, d, m, n, v) \ |
| 3476 | { \ |
| 3477 | .freq_hz = f, \ |
| 3478 | .src_clk = &s##_clk, \ |
| 3479 | .md_val = MD8(8, m, 0, n), \ |
| 3480 | .ns_val = NS_MM(23, 16, n, m, 15, 14, d, 2, 0, s##_to_mm_mux), \ |
| 3481 | .ctl_val = CC(6, n), \ |
| 3482 | .mnd_en_mask = BIT(5) * !!(n), \ |
| 3483 | .sys_vdd = v, \ |
| 3484 | .extra_freq_data = (void *)p_r, \ |
| 3485 | } |
| 3486 | /* Switching TV freqs requires PLL reconfiguration. */ |
| 3487 | static struct clk_freq_tbl clk_tbl_tv[] = { |
| 3488 | F_TV_GND( 0, gnd, 0, 1, 0, 0, NONE), |
| 3489 | F_TV( 25200000, hdmi_pll, 25200000, 1, 0, 0, LOW), |
| 3490 | F_TV( 27000000, hdmi_pll, 27000000, 1, 0, 0, LOW), |
| 3491 | F_TV( 27030000, hdmi_pll, 27030000, 1, 0, 0, LOW), |
| 3492 | F_TV( 74250000, hdmi_pll, 74250000, 1, 0, 0, NOMINAL), |
| 3493 | F_TV(148500000, hdmi_pll, 148500000, 1, 0, 0, NOMINAL), |
| 3494 | F_END |
| 3495 | }; |
| 3496 | |
| 3497 | /* |
| 3498 | * Unlike other clocks, the TV rate is adjusted through PLL |
| 3499 | * re-programming. It is also routed through an MND divider. |
| 3500 | */ |
| 3501 | void set_rate_tv(struct rcg_clk *clk, struct clk_freq_tbl *nf) |
| 3502 | { |
| 3503 | unsigned long pll_rate = (unsigned long)nf->extra_freq_data; |
| 3504 | if (pll_rate) |
| 3505 | hdmi_pll_set_rate(pll_rate); |
| 3506 | set_rate_mnd(clk, nf); |
| 3507 | } |
| 3508 | |
| 3509 | static struct rcg_clk tv_src_clk = { |
| 3510 | .ns_reg = TV_NS_REG, |
| 3511 | .b = { |
| 3512 | .ctl_reg = TV_CC_REG, |
| 3513 | .halt_check = NOCHECK, |
| 3514 | }, |
| 3515 | .md_reg = TV_MD_REG, |
| 3516 | .root_en_mask = BIT(2), |
| 3517 | .ns_mask = (BM(23, 16) | BM(15, 14) | BM(2, 0)), |
| 3518 | .ctl_mask = BM(7, 6), |
| 3519 | .set_rate = set_rate_tv, |
| 3520 | .freq_tbl = clk_tbl_tv, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 3521 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3522 | .c = { |
| 3523 | .dbg_name = "tv_src_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 3524 | .ops = &clk_ops_rcg_8960, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3525 | CLK_INIT(tv_src_clk.c), |
| 3526 | }, |
| 3527 | }; |
| 3528 | |
| 3529 | static struct branch_clk tv_enc_clk = { |
| 3530 | .b = { |
| 3531 | .ctl_reg = TV_CC_REG, |
| 3532 | .en_mask = BIT(8), |
| 3533 | .reset_reg = SW_RESET_CORE_REG, |
| 3534 | .reset_mask = BIT(0), |
| 3535 | .halt_reg = DBG_BUS_VEC_D_REG, |
| 3536 | .halt_bit = 9, |
| 3537 | }, |
| 3538 | .parent = &tv_src_clk.c, |
| 3539 | .c = { |
| 3540 | .dbg_name = "tv_enc_clk", |
| 3541 | .ops = &clk_ops_branch, |
| 3542 | CLK_INIT(tv_enc_clk.c), |
| 3543 | }, |
| 3544 | }; |
| 3545 | |
| 3546 | static struct branch_clk tv_dac_clk = { |
| 3547 | .b = { |
| 3548 | .ctl_reg = TV_CC_REG, |
| 3549 | .en_mask = BIT(10), |
| 3550 | .halt_reg = DBG_BUS_VEC_D_REG, |
| 3551 | .halt_bit = 10, |
| 3552 | }, |
| 3553 | .parent = &tv_src_clk.c, |
| 3554 | .c = { |
| 3555 | .dbg_name = "tv_dac_clk", |
| 3556 | .ops = &clk_ops_branch, |
| 3557 | CLK_INIT(tv_dac_clk.c), |
| 3558 | }, |
| 3559 | }; |
| 3560 | |
| 3561 | static struct branch_clk mdp_tv_clk = { |
| 3562 | .b = { |
| 3563 | .ctl_reg = TV_CC_REG, |
| 3564 | .en_mask = BIT(0), |
| 3565 | .reset_reg = SW_RESET_CORE_REG, |
| 3566 | .reset_mask = BIT(4), |
| 3567 | .halt_reg = DBG_BUS_VEC_D_REG, |
| 3568 | .halt_bit = 12, |
| 3569 | }, |
| 3570 | .parent = &tv_src_clk.c, |
| 3571 | .c = { |
| 3572 | .dbg_name = "mdp_tv_clk", |
| 3573 | .ops = &clk_ops_branch, |
| 3574 | CLK_INIT(mdp_tv_clk.c), |
| 3575 | }, |
| 3576 | }; |
| 3577 | |
| 3578 | static struct branch_clk hdmi_tv_clk = { |
| 3579 | .b = { |
| 3580 | .ctl_reg = TV_CC_REG, |
| 3581 | .en_mask = BIT(12), |
| 3582 | .reset_reg = SW_RESET_CORE_REG, |
| 3583 | .reset_mask = BIT(1), |
| 3584 | .halt_reg = DBG_BUS_VEC_D_REG, |
| 3585 | .halt_bit = 11, |
| 3586 | }, |
| 3587 | .parent = &tv_src_clk.c, |
| 3588 | .c = { |
| 3589 | .dbg_name = "hdmi_tv_clk", |
| 3590 | .ops = &clk_ops_branch, |
| 3591 | CLK_INIT(hdmi_tv_clk.c), |
| 3592 | }, |
| 3593 | }; |
| 3594 | |
| 3595 | static struct branch_clk hdmi_app_clk = { |
| 3596 | .b = { |
| 3597 | .ctl_reg = MISC_CC2_REG, |
| 3598 | .en_mask = BIT(11), |
| 3599 | .reset_reg = SW_RESET_CORE_REG, |
| 3600 | .reset_mask = BIT(11), |
| 3601 | .halt_reg = DBG_BUS_VEC_B_REG, |
| 3602 | .halt_bit = 25, |
| 3603 | }, |
| 3604 | .c = { |
| 3605 | .dbg_name = "hdmi_app_clk", |
| 3606 | .ops = &clk_ops_branch, |
| 3607 | CLK_INIT(hdmi_app_clk.c), |
| 3608 | }, |
| 3609 | }; |
| 3610 | |
| 3611 | static struct bank_masks bmnd_info_vcodec = { |
| 3612 | .bank_sel_mask = BIT(13), |
| 3613 | .bank0_mask = { |
| 3614 | .md_reg = VCODEC_MD0_REG, |
| 3615 | .ns_mask = BM(18, 11) | BM(2, 0), |
| 3616 | .rst_mask = BIT(31), |
| 3617 | .mnd_en_mask = BIT(5), |
| 3618 | .mode_mask = BM(7, 6), |
| 3619 | }, |
| 3620 | .bank1_mask = { |
| 3621 | .md_reg = VCODEC_MD1_REG, |
| 3622 | .ns_mask = BM(26, 19) | BM(29, 27), |
| 3623 | .rst_mask = BIT(30), |
| 3624 | .mnd_en_mask = BIT(10), |
| 3625 | .mode_mask = BM(12, 11), |
| 3626 | }, |
| 3627 | }; |
| 3628 | #define F_VCODEC(f, s, m, n, v) \ |
| 3629 | { \ |
| 3630 | .freq_hz = f, \ |
| 3631 | .src_clk = &s##_clk.c, \ |
| 3632 | .md_val = MD8(8, m, 0, n), \ |
| 3633 | .ns_val = NS_MND_BANKED8(11, 19, n, m, 0, 27, s##_to_mm_mux), \ |
| 3634 | .ctl_val = CC_BANKED(6, 11, n), \ |
| 3635 | .mnd_en_mask = (BIT(10) | BIT(5)) * !!(n), \ |
| 3636 | .sys_vdd = v, \ |
| 3637 | } |
| 3638 | static struct clk_freq_tbl clk_tbl_vcodec[] = { |
| 3639 | F_VCODEC( 0, gnd, 0, 0, NONE), |
| 3640 | F_VCODEC( 27000000, pxo, 0, 0, LOW), |
| 3641 | F_VCODEC( 32000000, pll8, 1, 12, LOW), |
| 3642 | F_VCODEC( 48000000, pll8, 1, 8, LOW), |
| 3643 | F_VCODEC( 54860000, pll8, 1, 7, LOW), |
| 3644 | F_VCODEC( 96000000, pll8, 1, 4, LOW), |
| 3645 | F_VCODEC(133330000, pll2, 1, 6, NOMINAL), |
| 3646 | F_VCODEC(200000000, pll2, 1, 4, NOMINAL), |
| 3647 | F_VCODEC(228570000, pll2, 2, 7, HIGH), |
| 3648 | F_END |
| 3649 | }; |
| 3650 | |
| 3651 | static struct rcg_clk vcodec_clk = { |
| 3652 | .b = { |
| 3653 | .ctl_reg = VCODEC_CC_REG, |
| 3654 | .en_mask = BIT(0), |
| 3655 | .reset_reg = SW_RESET_CORE_REG, |
| 3656 | .reset_mask = BIT(6), |
| 3657 | .halt_reg = DBG_BUS_VEC_C_REG, |
| 3658 | .halt_bit = 29, |
| 3659 | }, |
| 3660 | .ns_reg = VCODEC_NS_REG, |
| 3661 | .root_en_mask = BIT(2), |
| 3662 | .set_rate = set_rate_mnd_banked, |
Stephen Boyd | c78d9a7 | 2011-07-20 00:46:24 -0700 | [diff] [blame] | 3663 | .bank_info = &bmnd_info_vcodec, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3664 | .freq_tbl = clk_tbl_vcodec, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 3665 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3666 | .c = { |
| 3667 | .dbg_name = "vcodec_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 3668 | .ops = &clk_ops_rcg_8960, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3669 | CLK_INIT(vcodec_clk.c), |
Stephen Boyd | 7fa2674 | 2011-08-11 23:22:29 -0700 | [diff] [blame] | 3670 | .depends = &vcodec_axi_clk.c, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3671 | }, |
| 3672 | }; |
| 3673 | |
| 3674 | #define F_VPE(f, s, d, v) \ |
| 3675 | { \ |
| 3676 | .freq_hz = f, \ |
| 3677 | .src_clk = &s##_clk.c, \ |
| 3678 | .ns_val = NS_DIVSRC(15, 12, d, 2, 0, s##_to_mm_mux), \ |
| 3679 | .sys_vdd = v, \ |
| 3680 | } |
| 3681 | static struct clk_freq_tbl clk_tbl_vpe[] = { |
| 3682 | F_VPE( 0, gnd, 1, NONE), |
| 3683 | F_VPE( 27000000, pxo, 1, LOW), |
| 3684 | F_VPE( 34909000, pll8, 11, LOW), |
| 3685 | F_VPE( 38400000, pll8, 10, LOW), |
| 3686 | F_VPE( 64000000, pll8, 6, LOW), |
| 3687 | F_VPE( 76800000, pll8, 5, LOW), |
| 3688 | F_VPE( 96000000, pll8, 4, NOMINAL), |
| 3689 | F_VPE(100000000, pll2, 8, NOMINAL), |
| 3690 | F_VPE(160000000, pll2, 5, NOMINAL), |
| 3691 | F_END |
| 3692 | }; |
| 3693 | |
| 3694 | static struct rcg_clk vpe_clk = { |
| 3695 | .b = { |
| 3696 | .ctl_reg = VPE_CC_REG, |
| 3697 | .en_mask = BIT(0), |
| 3698 | .reset_reg = SW_RESET_CORE_REG, |
| 3699 | .reset_mask = BIT(17), |
| 3700 | .halt_reg = DBG_BUS_VEC_A_REG, |
| 3701 | .halt_bit = 28, |
| 3702 | }, |
| 3703 | .ns_reg = VPE_NS_REG, |
| 3704 | .root_en_mask = BIT(2), |
| 3705 | .ns_mask = (BM(15, 12) | BM(2, 0)), |
| 3706 | .set_rate = set_rate_nop, |
| 3707 | .freq_tbl = clk_tbl_vpe, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 3708 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3709 | .c = { |
| 3710 | .dbg_name = "vpe_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 3711 | .ops = &clk_ops_rcg_8960, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3712 | CLK_INIT(vpe_clk.c), |
Stephen Boyd | 7fa2674 | 2011-08-11 23:22:29 -0700 | [diff] [blame] | 3713 | .depends = &vpe_axi_clk.c, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3714 | }, |
| 3715 | }; |
| 3716 | |
| 3717 | #define F_VFE(f, s, d, m, n, v) \ |
| 3718 | { \ |
| 3719 | .freq_hz = f, \ |
| 3720 | .src_clk = &s##_clk.c, \ |
| 3721 | .md_val = MD8(8, m, 0, n), \ |
| 3722 | .ns_val = NS_MM(23, 16, n, m, 11, 10, d, 2, 0, s##_to_mm_mux), \ |
| 3723 | .ctl_val = CC(6, n), \ |
| 3724 | .mnd_en_mask = BIT(5) * !!(n), \ |
| 3725 | .sys_vdd = v, \ |
| 3726 | } |
| 3727 | static struct clk_freq_tbl clk_tbl_vfe[] = { |
| 3728 | F_VFE( 0, gnd, 1, 0, 0, NONE), |
| 3729 | F_VFE( 13960000, pll8, 1, 2, 55, LOW), |
| 3730 | F_VFE( 27000000, pxo, 1, 0, 0, LOW), |
| 3731 | F_VFE( 36570000, pll8, 1, 2, 21, LOW), |
| 3732 | F_VFE( 38400000, pll8, 2, 1, 5, LOW), |
| 3733 | F_VFE( 45180000, pll8, 1, 2, 17, LOW), |
| 3734 | F_VFE( 48000000, pll8, 2, 1, 4, LOW), |
| 3735 | F_VFE( 54860000, pll8, 1, 1, 7, LOW), |
| 3736 | F_VFE( 64000000, pll8, 2, 1, 3, LOW), |
| 3737 | F_VFE( 76800000, pll8, 1, 1, 5, LOW), |
| 3738 | F_VFE( 96000000, pll8, 2, 1, 2, LOW), |
| 3739 | F_VFE(109710000, pll8, 1, 2, 7, LOW), |
| 3740 | F_VFE(128000000, pll8, 1, 1, 3, NOMINAL), |
| 3741 | F_VFE(153600000, pll8, 1, 2, 5, NOMINAL), |
| 3742 | F_VFE(200000000, pll2, 2, 1, 2, NOMINAL), |
| 3743 | F_VFE(228570000, pll2, 1, 2, 7, NOMINAL), |
| 3744 | F_VFE(266667000, pll2, 1, 1, 3, NOMINAL), |
Stephen Boyd | 94625ef | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 3745 | F_VFE(320000000, pll2, 1, 2, 5, HIGH), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3746 | F_END |
| 3747 | }; |
| 3748 | |
| 3749 | |
| 3750 | static struct rcg_clk vfe_clk = { |
| 3751 | .b = { |
| 3752 | .ctl_reg = VFE_CC_REG, |
| 3753 | .reset_reg = SW_RESET_CORE_REG, |
| 3754 | .reset_mask = BIT(15), |
| 3755 | .halt_reg = DBG_BUS_VEC_B_REG, |
| 3756 | .halt_bit = 6, |
| 3757 | .en_mask = BIT(0), |
| 3758 | }, |
| 3759 | .ns_reg = VFE_NS_REG, |
| 3760 | .md_reg = VFE_MD_REG, |
| 3761 | .root_en_mask = BIT(2), |
| 3762 | .ns_mask = (BM(23, 16) | BM(11, 10) | BM(2, 0)), |
| 3763 | .ctl_mask = BM(7, 6), |
| 3764 | .set_rate = set_rate_mnd, |
| 3765 | .freq_tbl = clk_tbl_vfe, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 3766 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3767 | .c = { |
| 3768 | .dbg_name = "vfe_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 3769 | .ops = &clk_ops_rcg_8960, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3770 | CLK_INIT(vfe_clk.c), |
Stephen Boyd | 7fa2674 | 2011-08-11 23:22:29 -0700 | [diff] [blame] | 3771 | .depends = &vfe_axi_clk.c, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3772 | }, |
| 3773 | }; |
| 3774 | |
Matt Wagantall | c23eee9 | 2011-08-16 23:06:52 -0700 | [diff] [blame] | 3775 | static struct branch_clk csi_vfe_clk = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3776 | .b = { |
| 3777 | .ctl_reg = VFE_CC_REG, |
| 3778 | .en_mask = BIT(12), |
| 3779 | .reset_reg = SW_RESET_CORE_REG, |
| 3780 | .reset_mask = BIT(24), |
| 3781 | .halt_reg = DBG_BUS_VEC_B_REG, |
| 3782 | .halt_bit = 8, |
| 3783 | }, |
| 3784 | .parent = &vfe_clk.c, |
| 3785 | .c = { |
Matt Wagantall | c23eee9 | 2011-08-16 23:06:52 -0700 | [diff] [blame] | 3786 | .dbg_name = "csi_vfe_clk", |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3787 | .ops = &clk_ops_branch, |
Matt Wagantall | c23eee9 | 2011-08-16 23:06:52 -0700 | [diff] [blame] | 3788 | CLK_INIT(csi_vfe_clk.c), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3789 | }, |
| 3790 | }; |
| 3791 | |
| 3792 | /* |
| 3793 | * Low Power Audio Clocks |
| 3794 | */ |
| 3795 | #define F_AIF_OSR(f, s, d, m, n, v) \ |
| 3796 | { \ |
| 3797 | .freq_hz = f, \ |
| 3798 | .src_clk = &s##_clk.c, \ |
| 3799 | .md_val = MD8(8, m, 0, n), \ |
| 3800 | .ns_val = NS(31, 24, n, m, 5, 4, 3, d, 2, 0, s##_to_lpa_mux), \ |
| 3801 | .mnd_en_mask = BIT(8) * !!(n), \ |
| 3802 | .sys_vdd = v, \ |
| 3803 | } |
| 3804 | static struct clk_freq_tbl clk_tbl_aif_osr[] = { |
| 3805 | F_AIF_OSR( 0, gnd, 1, 0, 0, NONE), |
| 3806 | F_AIF_OSR( 768000, pll4, 4, 1, 128, LOW), |
| 3807 | F_AIF_OSR( 1024000, pll4, 4, 1, 96, LOW), |
| 3808 | F_AIF_OSR( 1536000, pll4, 4, 1, 64, LOW), |
| 3809 | F_AIF_OSR( 2048000, pll4, 4, 1, 48, LOW), |
| 3810 | F_AIF_OSR( 3072000, pll4, 4, 1, 32, LOW), |
| 3811 | F_AIF_OSR( 4096000, pll4, 4, 1, 24, LOW), |
| 3812 | F_AIF_OSR( 6144000, pll4, 4, 1, 16, LOW), |
| 3813 | F_AIF_OSR( 8192000, pll4, 4, 1, 12, LOW), |
| 3814 | F_AIF_OSR(12288000, pll4, 4, 1, 8, LOW), |
| 3815 | F_AIF_OSR(24576000, pll4, 4, 1, 4, LOW), |
| 3816 | F_END |
| 3817 | }; |
| 3818 | |
| 3819 | #define CLK_AIF_OSR(i, ns, md, h_r) \ |
| 3820 | struct rcg_clk i##_clk = { \ |
| 3821 | .b = { \ |
| 3822 | .ctl_reg = ns, \ |
| 3823 | .en_mask = BIT(17), \ |
| 3824 | .reset_reg = ns, \ |
| 3825 | .reset_mask = BIT(19), \ |
| 3826 | .halt_reg = h_r, \ |
| 3827 | .halt_check = ENABLE, \ |
| 3828 | .halt_bit = 1, \ |
| 3829 | }, \ |
| 3830 | .ns_reg = ns, \ |
| 3831 | .md_reg = md, \ |
| 3832 | .root_en_mask = BIT(9), \ |
| 3833 | .ns_mask = (BM(31, 24) | BM(6, 0)), \ |
| 3834 | .set_rate = set_rate_mnd, \ |
| 3835 | .freq_tbl = clk_tbl_aif_osr, \ |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 3836 | .current_freq = &rcg_dummy_freq, \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3837 | .c = { \ |
| 3838 | .dbg_name = #i "_clk", \ |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 3839 | .ops = &clk_ops_rcg_8960, \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3840 | CLK_INIT(i##_clk.c), \ |
| 3841 | }, \ |
| 3842 | } |
| 3843 | #define CLK_AIF_OSR_DIV(i, ns, md, h_r) \ |
| 3844 | struct rcg_clk i##_clk = { \ |
| 3845 | .b = { \ |
| 3846 | .ctl_reg = ns, \ |
| 3847 | .en_mask = BIT(21), \ |
| 3848 | .reset_reg = ns, \ |
| 3849 | .reset_mask = BIT(23), \ |
| 3850 | .halt_reg = h_r, \ |
| 3851 | .halt_check = ENABLE, \ |
| 3852 | .halt_bit = 1, \ |
| 3853 | }, \ |
| 3854 | .ns_reg = ns, \ |
| 3855 | .md_reg = md, \ |
| 3856 | .root_en_mask = BIT(9), \ |
| 3857 | .ns_mask = (BM(31, 24) | BM(6, 0)), \ |
| 3858 | .set_rate = set_rate_mnd, \ |
| 3859 | .freq_tbl = clk_tbl_aif_osr, \ |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 3860 | .current_freq = &rcg_dummy_freq, \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3861 | .c = { \ |
| 3862 | .dbg_name = #i "_clk", \ |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 3863 | .ops = &clk_ops_rcg_8960, \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3864 | CLK_INIT(i##_clk.c), \ |
| 3865 | }, \ |
| 3866 | } |
| 3867 | |
| 3868 | #define F_AIF_BIT(d, s) \ |
| 3869 | { \ |
| 3870 | .freq_hz = d, \ |
| 3871 | .ns_val = (BVAL(14, 14, s) | BVAL(13, 10, (d-1))) \ |
| 3872 | } |
| 3873 | static struct clk_freq_tbl clk_tbl_aif_bit[] = { |
| 3874 | F_AIF_BIT(0, 1), /* Use external clock. */ |
| 3875 | F_AIF_BIT(1, 0), F_AIF_BIT(2, 0), F_AIF_BIT(3, 0), F_AIF_BIT(4, 0), |
| 3876 | F_AIF_BIT(5, 0), F_AIF_BIT(6, 0), F_AIF_BIT(7, 0), F_AIF_BIT(8, 0), |
| 3877 | F_AIF_BIT(9, 0), F_AIF_BIT(10, 0), F_AIF_BIT(11, 0), F_AIF_BIT(12, 0), |
| 3878 | F_AIF_BIT(13, 0), F_AIF_BIT(14, 0), F_AIF_BIT(15, 0), F_AIF_BIT(16, 0), |
| 3879 | F_END |
| 3880 | }; |
| 3881 | |
| 3882 | #define CLK_AIF_BIT(i, ns, h_r) \ |
| 3883 | struct rcg_clk i##_clk = { \ |
| 3884 | .b = { \ |
| 3885 | .ctl_reg = ns, \ |
| 3886 | .en_mask = BIT(15), \ |
| 3887 | .halt_reg = h_r, \ |
| 3888 | .halt_check = DELAY, \ |
| 3889 | }, \ |
| 3890 | .ns_reg = ns, \ |
| 3891 | .ns_mask = BM(14, 10), \ |
| 3892 | .set_rate = set_rate_nop, \ |
| 3893 | .freq_tbl = clk_tbl_aif_bit, \ |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 3894 | .current_freq = &rcg_dummy_freq, \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3895 | .c = { \ |
| 3896 | .dbg_name = #i "_clk", \ |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 3897 | .ops = &clk_ops_rcg_8960, \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3898 | CLK_INIT(i##_clk.c), \ |
| 3899 | }, \ |
| 3900 | } |
| 3901 | |
| 3902 | #define F_AIF_BIT_D(d, s) \ |
| 3903 | { \ |
| 3904 | .freq_hz = d, \ |
| 3905 | .ns_val = (BVAL(18, 18, s) | BVAL(17, 10, (d-1))) \ |
| 3906 | } |
| 3907 | static struct clk_freq_tbl clk_tbl_aif_bit_div[] = { |
| 3908 | F_AIF_BIT_D(0, 1), /* Use external clock. */ |
| 3909 | F_AIF_BIT_D(1, 0), F_AIF_BIT_D(2, 0), F_AIF_BIT_D(3, 0), |
| 3910 | F_AIF_BIT_D(4, 0), F_AIF_BIT_D(5, 0), F_AIF_BIT_D(6, 0), |
| 3911 | F_AIF_BIT_D(7, 0), F_AIF_BIT_D(8, 0), F_AIF_BIT_D(9, 0), |
| 3912 | F_AIF_BIT_D(10, 0), F_AIF_BIT_D(11, 0), F_AIF_BIT_D(12, 0), |
| 3913 | F_AIF_BIT_D(13, 0), F_AIF_BIT_D(14, 0), F_AIF_BIT_D(15, 0), |
| 3914 | F_AIF_BIT_D(16, 0), |
| 3915 | F_END |
| 3916 | }; |
| 3917 | |
| 3918 | #define CLK_AIF_BIT_DIV(i, ns, h_r) \ |
| 3919 | struct rcg_clk i##_clk = { \ |
| 3920 | .b = { \ |
| 3921 | .ctl_reg = ns, \ |
| 3922 | .en_mask = BIT(19), \ |
| 3923 | .halt_reg = h_r, \ |
| 3924 | .halt_check = ENABLE, \ |
| 3925 | }, \ |
| 3926 | .ns_reg = ns, \ |
| 3927 | .ns_mask = BM(18, 10), \ |
| 3928 | .set_rate = set_rate_nop, \ |
| 3929 | .freq_tbl = clk_tbl_aif_bit_div, \ |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 3930 | .current_freq = &rcg_dummy_freq, \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3931 | .c = { \ |
| 3932 | .dbg_name = #i "_clk", \ |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 3933 | .ops = &clk_ops_rcg_8960, \ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3934 | CLK_INIT(i##_clk.c), \ |
| 3935 | }, \ |
| 3936 | } |
| 3937 | |
| 3938 | static CLK_AIF_OSR(mi2s_osr, LCC_MI2S_NS_REG, LCC_MI2S_MD_REG, |
| 3939 | LCC_MI2S_STATUS_REG); |
| 3940 | static CLK_AIF_BIT(mi2s_bit, LCC_MI2S_NS_REG, LCC_MI2S_STATUS_REG); |
| 3941 | |
| 3942 | static CLK_AIF_OSR_DIV(codec_i2s_mic_osr, LCC_CODEC_I2S_MIC_NS_REG, |
| 3943 | LCC_CODEC_I2S_MIC_MD_REG, LCC_CODEC_I2S_MIC_STATUS_REG); |
| 3944 | static CLK_AIF_BIT_DIV(codec_i2s_mic_bit, LCC_CODEC_I2S_MIC_NS_REG, |
| 3945 | LCC_CODEC_I2S_MIC_STATUS_REG); |
| 3946 | |
| 3947 | static CLK_AIF_OSR_DIV(spare_i2s_mic_osr, LCC_SPARE_I2S_MIC_NS_REG, |
| 3948 | LCC_SPARE_I2S_MIC_MD_REG, LCC_SPARE_I2S_MIC_STATUS_REG); |
| 3949 | static CLK_AIF_BIT_DIV(spare_i2s_mic_bit, LCC_SPARE_I2S_MIC_NS_REG, |
| 3950 | LCC_SPARE_I2S_MIC_STATUS_REG); |
| 3951 | |
| 3952 | static CLK_AIF_OSR_DIV(codec_i2s_spkr_osr, LCC_CODEC_I2S_SPKR_NS_REG, |
| 3953 | LCC_CODEC_I2S_SPKR_MD_REG, LCC_CODEC_I2S_SPKR_STATUS_REG); |
| 3954 | static CLK_AIF_BIT_DIV(codec_i2s_spkr_bit, LCC_CODEC_I2S_SPKR_NS_REG, |
| 3955 | LCC_CODEC_I2S_SPKR_STATUS_REG); |
| 3956 | |
| 3957 | static CLK_AIF_OSR_DIV(spare_i2s_spkr_osr, LCC_SPARE_I2S_SPKR_NS_REG, |
| 3958 | LCC_SPARE_I2S_SPKR_MD_REG, LCC_SPARE_I2S_SPKR_STATUS_REG); |
| 3959 | static CLK_AIF_BIT_DIV(spare_i2s_spkr_bit, LCC_SPARE_I2S_SPKR_NS_REG, |
| 3960 | LCC_SPARE_I2S_SPKR_STATUS_REG); |
| 3961 | |
| 3962 | #define F_PCM(f, s, d, m, n, v) \ |
| 3963 | { \ |
| 3964 | .freq_hz = f, \ |
| 3965 | .src_clk = &s##_clk.c, \ |
| 3966 | .md_val = MD16(m, n), \ |
| 3967 | .ns_val = NS(31, 16, n, m, 5, 4, 3, d, 2, 0, s##_to_lpa_mux), \ |
| 3968 | .mnd_en_mask = BIT(8) * !!(n), \ |
| 3969 | .sys_vdd = v, \ |
| 3970 | } |
| 3971 | static struct clk_freq_tbl clk_tbl_pcm[] = { |
| 3972 | F_PCM( 0, gnd, 1, 0, 0, NONE), |
| 3973 | F_PCM( 512000, pll4, 4, 1, 192, LOW), |
| 3974 | F_PCM( 768000, pll4, 4, 1, 128, LOW), |
| 3975 | F_PCM( 1024000, pll4, 4, 1, 96, LOW), |
| 3976 | F_PCM( 1536000, pll4, 4, 1, 64, LOW), |
| 3977 | F_PCM( 2048000, pll4, 4, 1, 48, LOW), |
| 3978 | F_PCM( 3072000, pll4, 4, 1, 32, LOW), |
| 3979 | F_PCM( 4096000, pll4, 4, 1, 24, LOW), |
| 3980 | F_PCM( 6144000, pll4, 4, 1, 16, LOW), |
| 3981 | F_PCM( 8192000, pll4, 4, 1, 12, LOW), |
| 3982 | F_PCM(12288000, pll4, 4, 1, 8, LOW), |
| 3983 | F_PCM(24576000, pll4, 4, 1, 4, LOW), |
| 3984 | F_END |
| 3985 | }; |
| 3986 | |
| 3987 | static struct rcg_clk pcm_clk = { |
| 3988 | .b = { |
| 3989 | .ctl_reg = LCC_PCM_NS_REG, |
| 3990 | .en_mask = BIT(11), |
| 3991 | .reset_reg = LCC_PCM_NS_REG, |
| 3992 | .reset_mask = BIT(13), |
| 3993 | .halt_reg = LCC_PCM_STATUS_REG, |
| 3994 | .halt_check = ENABLE, |
| 3995 | .halt_bit = 0, |
| 3996 | }, |
| 3997 | .ns_reg = LCC_PCM_NS_REG, |
| 3998 | .md_reg = LCC_PCM_MD_REG, |
| 3999 | .root_en_mask = BIT(9), |
| 4000 | .ns_mask = (BM(31, 16) | BM(6, 0)), |
| 4001 | .set_rate = set_rate_mnd, |
| 4002 | .freq_tbl = clk_tbl_pcm, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 4003 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4004 | .c = { |
| 4005 | .dbg_name = "pcm_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 4006 | .ops = &clk_ops_rcg_8960, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4007 | CLK_INIT(pcm_clk.c), |
| 4008 | }, |
| 4009 | }; |
| 4010 | |
| 4011 | static struct rcg_clk audio_slimbus_clk = { |
| 4012 | .b = { |
| 4013 | .ctl_reg = LCC_SLIMBUS_NS_REG, |
| 4014 | .en_mask = BIT(10), |
| 4015 | .reset_reg = LCC_AHBEX_BRANCH_CTL_REG, |
| 4016 | .reset_mask = BIT(5), |
| 4017 | .halt_reg = LCC_SLIMBUS_STATUS_REG, |
| 4018 | .halt_check = ENABLE, |
| 4019 | .halt_bit = 0, |
| 4020 | }, |
| 4021 | .ns_reg = LCC_SLIMBUS_NS_REG, |
| 4022 | .md_reg = LCC_SLIMBUS_MD_REG, |
| 4023 | .root_en_mask = BIT(9), |
| 4024 | .ns_mask = (BM(31, 24) | BM(6, 0)), |
| 4025 | .set_rate = set_rate_mnd, |
| 4026 | .freq_tbl = clk_tbl_aif_osr, |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 4027 | .current_freq = &rcg_dummy_freq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4028 | .c = { |
| 4029 | .dbg_name = "audio_slimbus_clk", |
Matt Wagantall | 84f43fd | 2011-08-16 23:28:38 -0700 | [diff] [blame] | 4030 | .ops = &clk_ops_rcg_8960, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4031 | CLK_INIT(audio_slimbus_clk.c), |
| 4032 | }, |
| 4033 | }; |
| 4034 | |
| 4035 | static struct branch_clk sps_slimbus_clk = { |
| 4036 | .b = { |
| 4037 | .ctl_reg = LCC_SLIMBUS_NS_REG, |
| 4038 | .en_mask = BIT(12), |
| 4039 | .halt_reg = LCC_SLIMBUS_STATUS_REG, |
| 4040 | .halt_check = ENABLE, |
| 4041 | .halt_bit = 1, |
| 4042 | }, |
| 4043 | .parent = &audio_slimbus_clk.c, |
| 4044 | .c = { |
| 4045 | .dbg_name = "sps_slimbus_clk", |
| 4046 | .ops = &clk_ops_branch, |
| 4047 | CLK_INIT(sps_slimbus_clk.c), |
| 4048 | }, |
| 4049 | }; |
| 4050 | |
| 4051 | static struct branch_clk slimbus_xo_src_clk = { |
| 4052 | .b = { |
| 4053 | .ctl_reg = SLIMBUS_XO_SRC_CLK_CTL_REG, |
| 4054 | .en_mask = BIT(2), |
| 4055 | .halt_reg = CLK_HALT_DFAB_STATE_REG, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4056 | .halt_bit = 28, |
| 4057 | }, |
| 4058 | .parent = &sps_slimbus_clk.c, |
| 4059 | .c = { |
| 4060 | .dbg_name = "slimbus_xo_src_clk", |
| 4061 | .ops = &clk_ops_branch, |
| 4062 | CLK_INIT(slimbus_xo_src_clk.c), |
| 4063 | }, |
| 4064 | }; |
| 4065 | |
Matt Wagantall | 735f01a | 2011-08-12 12:40:28 -0700 | [diff] [blame] | 4066 | DEFINE_CLK_RPM(afab_clk, afab_a_clk, APPS_FABRIC, NULL); |
| 4067 | DEFINE_CLK_RPM(cfpb_clk, cfpb_a_clk, CFPB, NULL); |
| 4068 | DEFINE_CLK_RPM(dfab_clk, dfab_a_clk, DAYTONA_FABRIC, NULL); |
| 4069 | DEFINE_CLK_RPM(ebi1_clk, ebi1_a_clk, EBI1, NULL); |
| 4070 | DEFINE_CLK_RPM(mmfab_clk, mmfab_a_clk, MM_FABRIC, NULL); |
| 4071 | DEFINE_CLK_RPM(mmfpb_clk, mmfpb_a_clk, MMFPB, NULL); |
| 4072 | DEFINE_CLK_RPM(sfab_clk, sfab_a_clk, SYSTEM_FABRIC, NULL); |
| 4073 | DEFINE_CLK_RPM(sfpb_clk, sfpb_a_clk, SFPB, NULL); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4074 | |
| 4075 | static DEFINE_CLK_VOTER(dfab_dsps_clk, &dfab_clk.c); |
| 4076 | static DEFINE_CLK_VOTER(dfab_usb_hs_clk, &dfab_clk.c); |
| 4077 | static DEFINE_CLK_VOTER(dfab_sdc1_clk, &dfab_clk.c); |
| 4078 | static DEFINE_CLK_VOTER(dfab_sdc2_clk, &dfab_clk.c); |
| 4079 | static DEFINE_CLK_VOTER(dfab_sdc3_clk, &dfab_clk.c); |
| 4080 | static DEFINE_CLK_VOTER(dfab_sdc4_clk, &dfab_clk.c); |
| 4081 | static DEFINE_CLK_VOTER(dfab_sdc5_clk, &dfab_clk.c); |
| 4082 | static DEFINE_CLK_VOTER(dfab_sps_clk, &dfab_clk.c); |
| 4083 | |
| 4084 | static DEFINE_CLK_VOTER(ebi1_msmbus_clk, &ebi1_clk.c); |
| 4085 | /* |
| 4086 | * TODO: replace dummy_clk below with ebi1_clk.c once the |
| 4087 | * bus driver starts voting on ebi1 rates. |
| 4088 | */ |
| 4089 | static DEFINE_CLK_VOTER(ebi1_adm_clk, &dummy_clk); |
| 4090 | |
| 4091 | #ifdef CONFIG_DEBUG_FS |
| 4092 | struct measure_sel { |
| 4093 | u32 test_vector; |
| 4094 | struct clk *clk; |
| 4095 | }; |
| 4096 | |
Matt Wagantall | 8b38f94 | 2011-08-02 18:23:18 -0700 | [diff] [blame] | 4097 | static DEFINE_CLK_MEASURE(l2_m_clk); |
| 4098 | static DEFINE_CLK_MEASURE(krait0_m_clk); |
| 4099 | static DEFINE_CLK_MEASURE(krait1_m_clk); |
Stephen Boyd | 3939c8d | 2011-08-29 17:36:22 -0700 | [diff] [blame] | 4100 | static DEFINE_CLK_MEASURE(q6sw_clk); |
| 4101 | static DEFINE_CLK_MEASURE(q6fw_clk); |
| 4102 | static DEFINE_CLK_MEASURE(q6_func_clk); |
Matt Wagantall | 8b38f94 | 2011-08-02 18:23:18 -0700 | [diff] [blame] | 4103 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4104 | static struct measure_sel measure_mux[] = { |
Stephen Boyd | 973e4ba | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 4105 | { TEST_PER_LS(0x05), &qdss_p_clk.c }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4106 | { TEST_PER_LS(0x08), &slimbus_xo_src_clk.c }, |
| 4107 | { TEST_PER_LS(0x12), &sdc1_p_clk.c }, |
| 4108 | { TEST_PER_LS(0x13), &sdc1_clk.c }, |
| 4109 | { TEST_PER_LS(0x14), &sdc2_p_clk.c }, |
| 4110 | { TEST_PER_LS(0x15), &sdc2_clk.c }, |
| 4111 | { TEST_PER_LS(0x16), &sdc3_p_clk.c }, |
| 4112 | { TEST_PER_LS(0x17), &sdc3_clk.c }, |
| 4113 | { TEST_PER_LS(0x18), &sdc4_p_clk.c }, |
| 4114 | { TEST_PER_LS(0x19), &sdc4_clk.c }, |
| 4115 | { TEST_PER_LS(0x1A), &sdc5_p_clk.c }, |
| 4116 | { TEST_PER_LS(0x1B), &sdc5_clk.c }, |
| 4117 | { TEST_PER_LS(0x25), &dfab_clk.c }, |
| 4118 | { TEST_PER_LS(0x25), &dfab_a_clk.c }, |
| 4119 | { TEST_PER_LS(0x26), &pmem_clk.c }, |
| 4120 | { TEST_PER_LS(0x32), &dma_bam_p_clk.c }, |
| 4121 | { TEST_PER_LS(0x33), &cfpb_clk.c }, |
| 4122 | { TEST_PER_LS(0x33), &cfpb_a_clk.c }, |
| 4123 | { TEST_PER_LS(0x3D), &gsbi1_p_clk.c }, |
| 4124 | { TEST_PER_LS(0x3E), &gsbi1_uart_clk.c }, |
| 4125 | { TEST_PER_LS(0x3F), &gsbi1_qup_clk.c }, |
| 4126 | { TEST_PER_LS(0x41), &gsbi2_p_clk.c }, |
| 4127 | { TEST_PER_LS(0x42), &gsbi2_uart_clk.c }, |
| 4128 | { TEST_PER_LS(0x44), &gsbi2_qup_clk.c }, |
| 4129 | { TEST_PER_LS(0x45), &gsbi3_p_clk.c }, |
| 4130 | { TEST_PER_LS(0x46), &gsbi3_uart_clk.c }, |
| 4131 | { TEST_PER_LS(0x48), &gsbi3_qup_clk.c }, |
| 4132 | { TEST_PER_LS(0x49), &gsbi4_p_clk.c }, |
| 4133 | { TEST_PER_LS(0x4A), &gsbi4_uart_clk.c }, |
| 4134 | { TEST_PER_LS(0x4C), &gsbi4_qup_clk.c }, |
| 4135 | { TEST_PER_LS(0x4D), &gsbi5_p_clk.c }, |
| 4136 | { TEST_PER_LS(0x4E), &gsbi5_uart_clk.c }, |
| 4137 | { TEST_PER_LS(0x50), &gsbi5_qup_clk.c }, |
| 4138 | { TEST_PER_LS(0x51), &gsbi6_p_clk.c }, |
| 4139 | { TEST_PER_LS(0x52), &gsbi6_uart_clk.c }, |
| 4140 | { TEST_PER_LS(0x54), &gsbi6_qup_clk.c }, |
| 4141 | { TEST_PER_LS(0x55), &gsbi7_p_clk.c }, |
| 4142 | { TEST_PER_LS(0x56), &gsbi7_uart_clk.c }, |
| 4143 | { TEST_PER_LS(0x58), &gsbi7_qup_clk.c }, |
| 4144 | { TEST_PER_LS(0x59), &gsbi8_p_clk.c }, |
| 4145 | { TEST_PER_LS(0x5A), &gsbi8_uart_clk.c }, |
| 4146 | { TEST_PER_LS(0x5C), &gsbi8_qup_clk.c }, |
| 4147 | { TEST_PER_LS(0x5D), &gsbi9_p_clk.c }, |
| 4148 | { TEST_PER_LS(0x5E), &gsbi9_uart_clk.c }, |
| 4149 | { TEST_PER_LS(0x60), &gsbi9_qup_clk.c }, |
| 4150 | { TEST_PER_LS(0x61), &gsbi10_p_clk.c }, |
| 4151 | { TEST_PER_LS(0x62), &gsbi10_uart_clk.c }, |
| 4152 | { TEST_PER_LS(0x64), &gsbi10_qup_clk.c }, |
| 4153 | { TEST_PER_LS(0x65), &gsbi11_p_clk.c }, |
| 4154 | { TEST_PER_LS(0x66), &gsbi11_uart_clk.c }, |
| 4155 | { TEST_PER_LS(0x68), &gsbi11_qup_clk.c }, |
| 4156 | { TEST_PER_LS(0x69), &gsbi12_p_clk.c }, |
| 4157 | { TEST_PER_LS(0x6A), &gsbi12_uart_clk.c }, |
| 4158 | { TEST_PER_LS(0x6C), &gsbi12_qup_clk.c }, |
| 4159 | { TEST_PER_LS(0x78), &sfpb_clk.c }, |
| 4160 | { TEST_PER_LS(0x78), &sfpb_a_clk.c }, |
| 4161 | { TEST_PER_LS(0x7A), &pmic_ssbi2_clk.c }, |
| 4162 | { TEST_PER_LS(0x7B), &pmic_arb0_p_clk.c }, |
| 4163 | { TEST_PER_LS(0x7C), &pmic_arb1_p_clk.c }, |
| 4164 | { TEST_PER_LS(0x7D), &prng_clk.c }, |
| 4165 | { TEST_PER_LS(0x7F), &rpm_msg_ram_p_clk.c }, |
| 4166 | { TEST_PER_LS(0x80), &adm0_p_clk.c }, |
| 4167 | { TEST_PER_LS(0x84), &usb_hs1_p_clk.c }, |
| 4168 | { TEST_PER_LS(0x85), &usb_hs1_xcvr_clk.c }, |
Stephen Boyd | 94625ef | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 4169 | { TEST_PER_LS(0x86), &usb_hsic_p_clk.c }, |
| 4170 | { TEST_PER_LS(0x87), &usb_hsic_system_clk.c }, |
| 4171 | { TEST_PER_LS(0x88), &usb_hsic_xcvr_fs_clk.c }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4172 | { TEST_PER_LS(0x89), &usb_fs1_p_clk.c }, |
| 4173 | { TEST_PER_LS(0x8A), &usb_fs1_sys_clk.c }, |
| 4174 | { TEST_PER_LS(0x8B), &usb_fs1_xcvr_clk.c }, |
| 4175 | { TEST_PER_LS(0x8C), &usb_fs2_p_clk.c }, |
| 4176 | { TEST_PER_LS(0x8D), &usb_fs2_sys_clk.c }, |
| 4177 | { TEST_PER_LS(0x8E), &usb_fs2_xcvr_clk.c }, |
| 4178 | { TEST_PER_LS(0x8F), &tsif_p_clk.c }, |
| 4179 | { TEST_PER_LS(0x91), &tsif_ref_clk.c }, |
| 4180 | { TEST_PER_LS(0x92), &ce1_p_clk.c }, |
| 4181 | { TEST_PER_LS(0x94), &tssc_clk.c }, |
Stephen Boyd | 94625ef | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 4182 | { TEST_PER_LS(0x9D), &usb_hsic_hsio_cal_clk.c }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4183 | { TEST_PER_LS(0xA4), &ce1_core_clk.c }, |
| 4184 | |
| 4185 | { TEST_PER_HS(0x07), &afab_clk.c }, |
| 4186 | { TEST_PER_HS(0x07), &afab_a_clk.c }, |
| 4187 | { TEST_PER_HS(0x18), &sfab_clk.c }, |
| 4188 | { TEST_PER_HS(0x18), &sfab_a_clk.c }, |
Stephen Boyd | 3939c8d | 2011-08-29 17:36:22 -0700 | [diff] [blame] | 4189 | { TEST_PER_HS(0x26), &q6sw_clk }, |
| 4190 | { TEST_PER_HS(0x27), &q6fw_clk }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4191 | { TEST_PER_HS(0x2A), &adm0_clk.c }, |
| 4192 | { TEST_PER_HS(0x34), &ebi1_clk.c }, |
| 4193 | { TEST_PER_HS(0x34), &ebi1_a_clk.c }, |
Stephen Boyd | 973e4ba | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 4194 | { TEST_PER_HS(0x48), &qdss_at_clk.c }, |
| 4195 | { TEST_PER_HS(0x49), &qdss_pclkdbg_clk.c }, |
| 4196 | { TEST_PER_HS(0x4A), &qdss_traceclkin_clk.c }, |
| 4197 | { TEST_PER_HS(0x4B), &qdss_tsctr_clk.c }, |
| 4198 | { TEST_PER_HS(0x4F), &qdss_stm_clk.c }, |
Stephen Boyd | 94625ef | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 4199 | { TEST_PER_HS(0x50), &usb_hsic_hsic_clk.c }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4200 | |
| 4201 | { TEST_MM_LS(0x00), &dsi1_byte_clk.c }, |
| 4202 | { TEST_MM_LS(0x01), &dsi2_byte_clk.c }, |
| 4203 | { TEST_MM_LS(0x02), &cam1_clk.c }, |
| 4204 | { TEST_MM_LS(0x06), &_p_clk.c }, |
Matt Wagantall | c23eee9 | 2011-08-16 23:06:52 -0700 | [diff] [blame] | 4205 | { TEST_MM_LS(0x07), &csi_p_clk.c }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4206 | { TEST_MM_LS(0x08), &dsi2_s_p_clk.c }, |
| 4207 | { TEST_MM_LS(0x09), &dsi1_m_p_clk.c }, |
| 4208 | { TEST_MM_LS(0x0A), &dsi1_s_p_clk.c }, |
| 4209 | { TEST_MM_LS(0x0C), &gfx2d0_p_clk.c }, |
| 4210 | { TEST_MM_LS(0x0D), &gfx2d1_p_clk.c }, |
| 4211 | { TEST_MM_LS(0x0E), &gfx3d_p_clk.c }, |
| 4212 | { TEST_MM_LS(0x0F), &hdmi_m_p_clk.c }, |
| 4213 | { TEST_MM_LS(0x10), &hdmi_s_p_clk.c }, |
| 4214 | { TEST_MM_LS(0x11), &ijpeg_p_clk.c }, |
| 4215 | { TEST_MM_LS(0x12), &imem_p_clk.c }, |
| 4216 | { TEST_MM_LS(0x13), &jpegd_p_clk.c }, |
| 4217 | { TEST_MM_LS(0x14), &mdp_p_clk.c }, |
| 4218 | { TEST_MM_LS(0x16), &rot_p_clk.c }, |
| 4219 | { TEST_MM_LS(0x17), &dsi1_esc_clk.c }, |
| 4220 | { TEST_MM_LS(0x18), &smmu_p_clk.c }, |
| 4221 | { TEST_MM_LS(0x19), &tv_enc_p_clk.c }, |
| 4222 | { TEST_MM_LS(0x1A), &vcodec_p_clk.c }, |
| 4223 | { TEST_MM_LS(0x1B), &vfe_p_clk.c }, |
| 4224 | { TEST_MM_LS(0x1C), &vpe_p_clk.c }, |
| 4225 | { TEST_MM_LS(0x1D), &cam0_clk.c }, |
| 4226 | { TEST_MM_LS(0x1F), &hdmi_app_clk.c }, |
| 4227 | { TEST_MM_LS(0x20), &mdp_vsync_clk.c }, |
| 4228 | { TEST_MM_LS(0x21), &tv_dac_clk.c }, |
| 4229 | { TEST_MM_LS(0x22), &tv_enc_clk.c }, |
| 4230 | { TEST_MM_LS(0x23), &dsi2_esc_clk.c }, |
| 4231 | { TEST_MM_LS(0x25), &mmfpb_clk.c }, |
| 4232 | { TEST_MM_LS(0x25), &mmfpb_a_clk.c }, |
| 4233 | { TEST_MM_LS(0x26), &dsi2_m_p_clk.c }, |
Stephen Boyd | 94625ef | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 4234 | { TEST_MM_LS(0x27), &cam2_clk.c }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4235 | |
| 4236 | { TEST_MM_HS(0x00), &csi0_clk.c }, |
| 4237 | { TEST_MM_HS(0x01), &csi1_clk.c }, |
Matt Wagantall | c23eee9 | 2011-08-16 23:06:52 -0700 | [diff] [blame] | 4238 | { TEST_MM_HS(0x04), &csi_vfe_clk.c }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4239 | { TEST_MM_HS(0x05), &ijpeg_clk.c }, |
| 4240 | { TEST_MM_HS(0x06), &vfe_clk.c }, |
| 4241 | { TEST_MM_HS(0x07), &gfx2d0_clk.c }, |
| 4242 | { TEST_MM_HS(0x08), &gfx2d1_clk.c }, |
| 4243 | { TEST_MM_HS(0x09), &gfx3d_clk.c }, |
| 4244 | { TEST_MM_HS(0x0A), &jpegd_clk.c }, |
| 4245 | { TEST_MM_HS(0x0B), &vcodec_clk.c }, |
| 4246 | { TEST_MM_HS(0x0F), &mmfab_clk.c }, |
| 4247 | { TEST_MM_HS(0x0F), &mmfab_a_clk.c }, |
| 4248 | { TEST_MM_HS(0x11), &gmem_axi_clk.c }, |
| 4249 | { TEST_MM_HS(0x12), &ijpeg_axi_clk.c }, |
| 4250 | { TEST_MM_HS(0x13), &imem_axi_clk.c }, |
| 4251 | { TEST_MM_HS(0x14), &jpegd_axi_clk.c }, |
| 4252 | { TEST_MM_HS(0x15), &mdp_axi_clk.c }, |
| 4253 | { TEST_MM_HS(0x16), &rot_axi_clk.c }, |
| 4254 | { TEST_MM_HS(0x17), &vcodec_axi_clk.c }, |
| 4255 | { TEST_MM_HS(0x18), &vfe_axi_clk.c }, |
| 4256 | { TEST_MM_HS(0x19), &vpe_axi_clk.c }, |
| 4257 | { TEST_MM_HS(0x1A), &mdp_clk.c }, |
| 4258 | { TEST_MM_HS(0x1B), &rot_clk.c }, |
| 4259 | { TEST_MM_HS(0x1C), &vpe_clk.c }, |
| 4260 | { TEST_MM_HS(0x1E), &hdmi_tv_clk.c }, |
| 4261 | { TEST_MM_HS(0x1F), &mdp_tv_clk.c }, |
| 4262 | { TEST_MM_HS(0x24), &csi0_phy_clk.c }, |
| 4263 | { TEST_MM_HS(0x25), &csi1_phy_clk.c }, |
| 4264 | { TEST_MM_HS(0x26), &csi_pix_clk.c }, |
| 4265 | { TEST_MM_HS(0x27), &csi_rdi_clk.c }, |
| 4266 | { TEST_MM_HS(0x28), &lut_mdp_clk.c }, |
| 4267 | { TEST_MM_HS(0x29), &vcodec_axi_a_clk.c }, |
| 4268 | { TEST_MM_HS(0x2A), &vcodec_axi_b_clk.c }, |
| 4269 | { TEST_MM_HS(0x2B), &csi1phy_timer_clk.c }, |
| 4270 | { TEST_MM_HS(0x2C), &csi0phy_timer_clk.c }, |
Stephen Boyd | 94625ef | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 4271 | { TEST_MM_HS(0x2D), &csi2_clk.c }, |
| 4272 | { TEST_MM_HS(0x2E), &csi2_phy_clk.c }, |
| 4273 | { TEST_MM_HS(0x2F), &csi2phy_timer_clk.c }, |
| 4274 | { TEST_MM_HS(0x30), &csi_pix1_clk.c }, |
| 4275 | { TEST_MM_HS(0x31), &csi_rdi1_clk.c }, |
| 4276 | { TEST_MM_HS(0x32), &csi_rdi2_clk.c }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4277 | |
| 4278 | { TEST_LPA(0x0F), &mi2s_bit_clk.c }, |
| 4279 | { TEST_LPA(0x10), &codec_i2s_mic_bit_clk.c }, |
| 4280 | { TEST_LPA(0x11), &codec_i2s_spkr_bit_clk.c }, |
| 4281 | { TEST_LPA(0x12), &spare_i2s_mic_bit_clk.c }, |
| 4282 | { TEST_LPA(0x13), &spare_i2s_spkr_bit_clk.c }, |
| 4283 | { TEST_LPA(0x14), &pcm_clk.c }, |
| 4284 | { TEST_LPA(0x1D), &audio_slimbus_clk.c }, |
Matt Wagantall | 8b38f94 | 2011-08-02 18:23:18 -0700 | [diff] [blame] | 4285 | |
Stephen Boyd | 3939c8d | 2011-08-29 17:36:22 -0700 | [diff] [blame] | 4286 | { TEST_LPA_HS(0x00), &q6_func_clk }, |
| 4287 | |
Matt Wagantall | 8b38f94 | 2011-08-02 18:23:18 -0700 | [diff] [blame] | 4288 | { TEST_CPUL2(0x1), &l2_m_clk }, |
| 4289 | { TEST_CPUL2(0x2), &krait0_m_clk }, |
| 4290 | { TEST_CPUL2(0x3), &krait1_m_clk }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4291 | }; |
| 4292 | |
| 4293 | static struct measure_sel *find_measure_sel(struct clk *clk) |
| 4294 | { |
| 4295 | int i; |
| 4296 | |
| 4297 | for (i = 0; i < ARRAY_SIZE(measure_mux); i++) |
| 4298 | if (measure_mux[i].clk == clk) |
| 4299 | return &measure_mux[i]; |
| 4300 | return NULL; |
| 4301 | } |
| 4302 | |
Matt Wagantall | 8b38f94 | 2011-08-02 18:23:18 -0700 | [diff] [blame] | 4303 | static int measure_clk_set_parent(struct clk *c, struct clk *parent) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4304 | { |
| 4305 | int ret = 0; |
| 4306 | u32 clk_sel; |
| 4307 | struct measure_sel *p; |
Matt Wagantall | 8b38f94 | 2011-08-02 18:23:18 -0700 | [diff] [blame] | 4308 | struct measure_clk *clk = to_measure_clk(c); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4309 | unsigned long flags; |
| 4310 | |
| 4311 | if (!parent) |
| 4312 | return -EINVAL; |
| 4313 | |
| 4314 | p = find_measure_sel(parent); |
| 4315 | if (!p) |
| 4316 | return -EINVAL; |
| 4317 | |
| 4318 | spin_lock_irqsave(&local_clock_reg_lock, flags); |
| 4319 | |
Matt Wagantall | 8b38f94 | 2011-08-02 18:23:18 -0700 | [diff] [blame] | 4320 | /* |
| 4321 | * Program the test vector, measurement period (sample_ticks) |
| 4322 | * and scaling multiplier. |
| 4323 | */ |
| 4324 | clk->sample_ticks = 0x10000; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4325 | clk_sel = p->test_vector & TEST_CLK_SEL_MASK; |
Matt Wagantall | 8b38f94 | 2011-08-02 18:23:18 -0700 | [diff] [blame] | 4326 | clk->multiplier = 1; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4327 | switch (p->test_vector >> TEST_TYPE_SHIFT) { |
| 4328 | case TEST_TYPE_PER_LS: |
| 4329 | writel_relaxed(0x4030D00|BVAL(7, 0, clk_sel), CLK_TEST_REG); |
| 4330 | break; |
| 4331 | case TEST_TYPE_PER_HS: |
| 4332 | writel_relaxed(0x4020000|BVAL(16, 10, clk_sel), CLK_TEST_REG); |
| 4333 | break; |
| 4334 | case TEST_TYPE_MM_LS: |
| 4335 | writel_relaxed(0x4030D97, CLK_TEST_REG); |
| 4336 | writel_relaxed(BVAL(6, 1, clk_sel)|BIT(0), DBG_CFG_REG_LS_REG); |
| 4337 | break; |
| 4338 | case TEST_TYPE_MM_HS: |
| 4339 | writel_relaxed(0x402B800, CLK_TEST_REG); |
| 4340 | writel_relaxed(BVAL(6, 1, clk_sel)|BIT(0), DBG_CFG_REG_HS_REG); |
| 4341 | break; |
| 4342 | case TEST_TYPE_LPA: |
| 4343 | writel_relaxed(0x4030D98, CLK_TEST_REG); |
| 4344 | writel_relaxed(BVAL(6, 1, clk_sel)|BIT(0), |
| 4345 | LCC_CLK_LS_DEBUG_CFG_REG); |
| 4346 | break; |
Stephen Boyd | 3939c8d | 2011-08-29 17:36:22 -0700 | [diff] [blame] | 4347 | case TEST_TYPE_LPA_HS: |
| 4348 | writel_relaxed(0x402BC00, CLK_TEST_REG); |
| 4349 | writel_relaxed(BVAL(2, 1, clk_sel)|BIT(0), |
| 4350 | LCC_CLK_HS_DEBUG_CFG_REG); |
| 4351 | break; |
Matt Wagantall | 8b38f94 | 2011-08-02 18:23:18 -0700 | [diff] [blame] | 4352 | case TEST_TYPE_CPUL2: |
| 4353 | writel_relaxed(0x4030400, CLK_TEST_REG); |
| 4354 | writel_relaxed(0x80|BVAL(5, 3, clk_sel), GCC_APCS_CLK_DIAG); |
| 4355 | clk->sample_ticks = 0x4000; |
| 4356 | clk->multiplier = 2; |
| 4357 | break; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4358 | default: |
| 4359 | ret = -EPERM; |
| 4360 | } |
| 4361 | /* Make sure test vector is set before starting measurements. */ |
| 4362 | mb(); |
| 4363 | |
| 4364 | spin_unlock_irqrestore(&local_clock_reg_lock, flags); |
| 4365 | |
| 4366 | return ret; |
| 4367 | } |
| 4368 | |
| 4369 | /* Sample clock for 'ticks' reference clock ticks. */ |
| 4370 | static u32 run_measurement(unsigned ticks) |
| 4371 | { |
| 4372 | /* Stop counters and set the XO4 counter start value. */ |
| 4373 | writel_relaxed(0x0, RINGOSC_TCXO_CTL_REG); |
| 4374 | writel_relaxed(ticks, RINGOSC_TCXO_CTL_REG); |
| 4375 | |
| 4376 | /* Wait for timer to become ready. */ |
| 4377 | while ((readl_relaxed(RINGOSC_STATUS_REG) & BIT(25)) != 0) |
| 4378 | cpu_relax(); |
| 4379 | |
| 4380 | /* Run measurement and wait for completion. */ |
| 4381 | writel_relaxed(BIT(20)|ticks, RINGOSC_TCXO_CTL_REG); |
| 4382 | while ((readl_relaxed(RINGOSC_STATUS_REG) & BIT(25)) == 0) |
| 4383 | cpu_relax(); |
| 4384 | |
| 4385 | /* Stop counters. */ |
| 4386 | writel_relaxed(0x0, RINGOSC_TCXO_CTL_REG); |
| 4387 | |
| 4388 | /* Return measured ticks. */ |
| 4389 | return readl_relaxed(RINGOSC_STATUS_REG) & BM(24, 0); |
| 4390 | } |
| 4391 | |
| 4392 | |
| 4393 | /* Perform a hardware rate measurement for a given clock. |
| 4394 | FOR DEBUG USE ONLY: Measurements take ~15 ms! */ |
Matt Wagantall | 8b38f94 | 2011-08-02 18:23:18 -0700 | [diff] [blame] | 4395 | static unsigned measure_clk_get_rate(struct clk *c) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4396 | { |
| 4397 | unsigned long flags; |
| 4398 | u32 pdm_reg_backup, ringosc_reg_backup; |
| 4399 | u64 raw_count_short, raw_count_full; |
Matt Wagantall | 8b38f94 | 2011-08-02 18:23:18 -0700 | [diff] [blame] | 4400 | struct measure_clk *clk = to_measure_clk(c); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4401 | unsigned ret; |
| 4402 | |
| 4403 | spin_lock_irqsave(&local_clock_reg_lock, flags); |
| 4404 | |
| 4405 | /* Enable CXO/4 and RINGOSC branch and root. */ |
| 4406 | pdm_reg_backup = readl_relaxed(PDM_CLK_NS_REG); |
| 4407 | ringosc_reg_backup = readl_relaxed(RINGOSC_NS_REG); |
| 4408 | writel_relaxed(0x2898, PDM_CLK_NS_REG); |
| 4409 | writel_relaxed(0xA00, RINGOSC_NS_REG); |
| 4410 | |
| 4411 | /* |
| 4412 | * The ring oscillator counter will not reset if the measured clock |
| 4413 | * is not running. To detect this, run a short measurement before |
| 4414 | * the full measurement. If the raw results of the two are the same |
| 4415 | * then the clock must be off. |
| 4416 | */ |
| 4417 | |
| 4418 | /* Run a short measurement. (~1 ms) */ |
| 4419 | raw_count_short = run_measurement(0x1000); |
| 4420 | /* Run a full measurement. (~14 ms) */ |
Matt Wagantall | 8b38f94 | 2011-08-02 18:23:18 -0700 | [diff] [blame] | 4421 | raw_count_full = run_measurement(clk->sample_ticks); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4422 | |
| 4423 | writel_relaxed(ringosc_reg_backup, RINGOSC_NS_REG); |
| 4424 | writel_relaxed(pdm_reg_backup, PDM_CLK_NS_REG); |
| 4425 | |
| 4426 | /* Return 0 if the clock is off. */ |
| 4427 | if (raw_count_full == raw_count_short) |
| 4428 | ret = 0; |
| 4429 | else { |
| 4430 | /* Compute rate in Hz. */ |
| 4431 | raw_count_full = ((raw_count_full * 10) + 15) * 4800000; |
Matt Wagantall | 8b38f94 | 2011-08-02 18:23:18 -0700 | [diff] [blame] | 4432 | do_div(raw_count_full, ((clk->sample_ticks * 10) + 35)); |
| 4433 | ret = (raw_count_full * clk->multiplier); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4434 | } |
| 4435 | |
| 4436 | /* Route dbg_hs_clk to PLLTEST. 300mV single-ended amplitude. */ |
Stephen Boyd | 69da840 | 2011-07-14 17:45:31 -0700 | [diff] [blame] | 4437 | writel_relaxed(0x38F8, PLLTEST_PAD_CFG_REG); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4438 | spin_unlock_irqrestore(&local_clock_reg_lock, flags); |
| 4439 | |
| 4440 | return ret; |
| 4441 | } |
| 4442 | #else /* !CONFIG_DEBUG_FS */ |
| 4443 | static int measure_clk_set_parent(struct clk *clk, struct clk *parent) |
| 4444 | { |
| 4445 | return -EINVAL; |
| 4446 | } |
| 4447 | |
| 4448 | static unsigned measure_clk_get_rate(struct clk *clk) |
| 4449 | { |
| 4450 | return 0; |
| 4451 | } |
| 4452 | #endif /* CONFIG_DEBUG_FS */ |
| 4453 | |
| 4454 | static struct clk_ops measure_clk_ops = { |
| 4455 | .set_parent = measure_clk_set_parent, |
| 4456 | .get_rate = measure_clk_get_rate, |
| 4457 | .is_local = local_clk_is_local, |
| 4458 | }; |
| 4459 | |
Matt Wagantall | 8b38f94 | 2011-08-02 18:23:18 -0700 | [diff] [blame] | 4460 | static struct measure_clk measure_clk = { |
| 4461 | .c = { |
| 4462 | .dbg_name = "measure_clk", |
| 4463 | .ops = &measure_clk_ops, |
| 4464 | CLK_INIT(measure_clk.c), |
| 4465 | }, |
| 4466 | .multiplier = 1, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4467 | }; |
| 4468 | |
Stephen Boyd | 94625ef | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 4469 | static struct clk_lookup msm_clocks_8960_v1[] __initdata = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4470 | CLK_LOOKUP("cxo", cxo_clk.c, NULL), |
| 4471 | CLK_LOOKUP("pll2", pll2_clk.c, NULL), |
| 4472 | CLK_LOOKUP("pll8", pll8_clk.c, NULL), |
| 4473 | CLK_LOOKUP("pll4", pll4_clk.c, NULL), |
Matt Wagantall | 8b38f94 | 2011-08-02 18:23:18 -0700 | [diff] [blame] | 4474 | CLK_LOOKUP("measure", measure_clk.c, "debug"), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4475 | |
| 4476 | CLK_LOOKUP("afab_clk", afab_clk.c, NULL), |
| 4477 | CLK_LOOKUP("afab_a_clk", afab_a_clk.c, NULL), |
| 4478 | CLK_LOOKUP("cfpb_clk", cfpb_clk.c, NULL), |
| 4479 | CLK_LOOKUP("cfpb_a_clk", cfpb_a_clk.c, NULL), |
| 4480 | CLK_LOOKUP("dfab_clk", dfab_clk.c, NULL), |
| 4481 | CLK_LOOKUP("dfab_a_clk", dfab_a_clk.c, NULL), |
| 4482 | CLK_LOOKUP("ebi1_clk", ebi1_clk.c, NULL), |
| 4483 | CLK_LOOKUP("ebi1_a_clk", ebi1_a_clk.c, NULL), |
| 4484 | CLK_LOOKUP("mmfab_clk", mmfab_clk.c, NULL), |
| 4485 | CLK_LOOKUP("mmfab_a_clk", mmfab_a_clk.c, NULL), |
| 4486 | CLK_LOOKUP("mmfpb_clk", mmfpb_clk.c, NULL), |
| 4487 | CLK_LOOKUP("mmfpb_a_clk", mmfpb_a_clk.c, NULL), |
| 4488 | CLK_LOOKUP("sfab_clk", sfab_clk.c, NULL), |
| 4489 | CLK_LOOKUP("sfab_a_clk", sfab_a_clk.c, NULL), |
| 4490 | CLK_LOOKUP("sfpb_clk", sfpb_clk.c, NULL), |
| 4491 | CLK_LOOKUP("sfpb_a_clk", sfpb_a_clk.c, NULL), |
| 4492 | |
Matt Wagantall | e252237 | 2011-08-17 14:52:21 -0700 | [diff] [blame] | 4493 | CLK_LOOKUP("core_clk", gsbi1_uart_clk.c, NULL), |
| 4494 | CLK_LOOKUP("core_clk", gsbi2_uart_clk.c, NULL), |
| 4495 | CLK_LOOKUP("core_clk", gsbi3_uart_clk.c, NULL), |
| 4496 | CLK_LOOKUP("core_clk", gsbi4_uart_clk.c, NULL), |
| 4497 | CLK_LOOKUP("core_clk", gsbi5_uart_clk.c, "msm_serial_hsl.0"), |
| 4498 | CLK_LOOKUP("core_clk", gsbi6_uart_clk.c, "msm_serial_hs.0"), |
| 4499 | CLK_LOOKUP("core_clk", gsbi7_uart_clk.c, NULL), |
| 4500 | CLK_LOOKUP("core_clk", gsbi8_uart_clk.c, NULL), |
| 4501 | CLK_LOOKUP("core_clk", gsbi9_uart_clk.c, NULL), |
| 4502 | CLK_LOOKUP("core_clk", gsbi10_uart_clk.c, NULL), |
| 4503 | CLK_LOOKUP("core_clk", gsbi11_uart_clk.c, NULL), |
| 4504 | CLK_LOOKUP("core_clk", gsbi12_uart_clk.c, NULL), |
Matt Wagantall | ac29485 | 2011-08-17 15:44:58 -0700 | [diff] [blame] | 4505 | CLK_LOOKUP("core_clk", gsbi1_qup_clk.c, "spi_qsd.0"), |
Matt Wagantall | 62cf63e | 2011-08-17 16:34:47 -0700 | [diff] [blame] | 4506 | CLK_LOOKUP("core_clk", gsbi2_qup_clk.c, NULL), |
Matt Wagantall | ac29485 | 2011-08-17 15:44:58 -0700 | [diff] [blame] | 4507 | CLK_LOOKUP("core_clk", gsbi3_qup_clk.c, "qup_i2c.3"), |
| 4508 | CLK_LOOKUP("core_clk", gsbi4_qup_clk.c, "qup_i2c.4"), |
Matt Wagantall | 62cf63e | 2011-08-17 16:34:47 -0700 | [diff] [blame] | 4509 | CLK_LOOKUP("core_clk", gsbi5_qup_clk.c, NULL), |
| 4510 | CLK_LOOKUP("core_clk", gsbi6_qup_clk.c, NULL), |
| 4511 | CLK_LOOKUP("core_clk", gsbi7_qup_clk.c, NULL), |
| 4512 | CLK_LOOKUP("core_clk", gsbi8_qup_clk.c, NULL), |
| 4513 | CLK_LOOKUP("core_clk", gsbi9_qup_clk.c, NULL), |
Matt Wagantall | ac29485 | 2011-08-17 15:44:58 -0700 | [diff] [blame] | 4514 | CLK_LOOKUP("core_clk", gsbi10_qup_clk.c, "qup_i2c.10"), |
Matt Wagantall | 62cf63e | 2011-08-17 16:34:47 -0700 | [diff] [blame] | 4515 | CLK_LOOKUP("core_clk", gsbi11_qup_clk.c, NULL), |
Matt Wagantall | ac29485 | 2011-08-17 15:44:58 -0700 | [diff] [blame] | 4516 | CLK_LOOKUP("core_clk", gsbi12_qup_clk.c, "qup_i2c.12"), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4517 | CLK_LOOKUP("pdm_clk", pdm_clk.c, NULL), |
Matt Wagantall | d86d683 | 2011-08-17 14:06:55 -0700 | [diff] [blame] | 4518 | CLK_LOOKUP("mem_clk", pmem_clk.c, NULL), |
Matt Wagantall | c120529 | 2011-08-11 17:19:31 -0700 | [diff] [blame] | 4519 | CLK_LOOKUP("core_clk", prng_clk.c, "msm_rng.0"), |
Matt Wagantall | 37ce384 | 2011-08-17 16:00:36 -0700 | [diff] [blame] | 4520 | CLK_LOOKUP("core_clk", sdc1_clk.c, "msm_sdcc.1"), |
| 4521 | CLK_LOOKUP("core_clk", sdc2_clk.c, "msm_sdcc.2"), |
| 4522 | CLK_LOOKUP("core_clk", sdc3_clk.c, "msm_sdcc.3"), |
| 4523 | CLK_LOOKUP("core_clk", sdc4_clk.c, "msm_sdcc.4"), |
| 4524 | CLK_LOOKUP("core_clk", sdc5_clk.c, "msm_sdcc.5"), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4525 | CLK_LOOKUP("slimbus_xo_src_clk", slimbus_xo_src_clk.c, NULL), |
Matt Wagantall | 640e5fd | 2011-08-17 16:08:53 -0700 | [diff] [blame] | 4526 | CLK_LOOKUP("ref_clk", tsif_ref_clk.c, NULL), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4527 | CLK_LOOKUP("tssc_clk", tssc_clk.c, NULL), |
| 4528 | CLK_LOOKUP("usb_hs_clk", usb_hs1_xcvr_clk.c, NULL), |
| 4529 | CLK_LOOKUP("usb_phy_clk", usb_phy0_clk.c, NULL), |
| 4530 | CLK_LOOKUP("usb_fs_clk", usb_fs1_xcvr_clk.c, NULL), |
| 4531 | CLK_LOOKUP("usb_fs_sys_clk", usb_fs1_sys_clk.c, NULL), |
| 4532 | CLK_LOOKUP("usb_fs_src_clk", usb_fs1_src_clk.c, NULL), |
| 4533 | CLK_LOOKUP("usb_fs_clk", usb_fs2_xcvr_clk.c, NULL), |
| 4534 | CLK_LOOKUP("usb_fs_sys_clk", usb_fs2_sys_clk.c, NULL), |
| 4535 | CLK_LOOKUP("usb_fs_src_clk", usb_fs2_src_clk.c, NULL), |
Matt Wagantall | c4b3a4d | 2011-08-17 16:58:39 -0700 | [diff] [blame] | 4536 | CLK_LOOKUP("iface_clk", ce1_p_clk.c, "qce.0"), |
| 4537 | CLK_LOOKUP("core_clk", ce1_core_clk.c, "qce.0"), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4538 | CLK_LOOKUP("dma_bam_pclk", dma_bam_p_clk.c, NULL), |
Matt Wagantall | ac29485 | 2011-08-17 15:44:58 -0700 | [diff] [blame] | 4539 | CLK_LOOKUP("iface_clk", gsbi1_p_clk.c, "spi_qsd.0"), |
Matt Wagantall | 62cf63e | 2011-08-17 16:34:47 -0700 | [diff] [blame] | 4540 | CLK_LOOKUP("iface_clk", gsbi2_p_clk.c, NULL), |
Matt Wagantall | ac29485 | 2011-08-17 15:44:58 -0700 | [diff] [blame] | 4541 | CLK_LOOKUP("iface_clk", gsbi3_p_clk.c, "qup_i2c.3"), |
| 4542 | CLK_LOOKUP("iface_clk", gsbi4_p_clk.c, "qup_i2c.4"), |
Matt Wagantall | e252237 | 2011-08-17 14:52:21 -0700 | [diff] [blame] | 4543 | CLK_LOOKUP("iface_clk", gsbi5_p_clk.c, "msm_serial_hsl.0"), |
| 4544 | CLK_LOOKUP("iface_clk", gsbi6_p_clk.c, "msm_serial_hs.0"), |
Matt Wagantall | 62cf63e | 2011-08-17 16:34:47 -0700 | [diff] [blame] | 4545 | CLK_LOOKUP("iface_clk", gsbi7_p_clk.c, NULL), |
| 4546 | CLK_LOOKUP("iface_clk", gsbi8_p_clk.c, NULL), |
| 4547 | CLK_LOOKUP("iface_clk", gsbi9_p_clk.c, NULL), |
Matt Wagantall | ac29485 | 2011-08-17 15:44:58 -0700 | [diff] [blame] | 4548 | CLK_LOOKUP("iface_clk", gsbi10_p_clk.c, "qup_i2c.10"), |
Matt Wagantall | 62cf63e | 2011-08-17 16:34:47 -0700 | [diff] [blame] | 4549 | CLK_LOOKUP("iface_clk", gsbi11_p_clk.c, NULL), |
Matt Wagantall | ac29485 | 2011-08-17 15:44:58 -0700 | [diff] [blame] | 4550 | CLK_LOOKUP("iface_clk", gsbi12_p_clk.c, "qup_i2c.12"), |
Matt Wagantall | 640e5fd | 2011-08-17 16:08:53 -0700 | [diff] [blame] | 4551 | CLK_LOOKUP("iface_clk", tsif_p_clk.c, NULL), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4552 | CLK_LOOKUP("usb_fs_pclk", usb_fs1_p_clk.c, NULL), |
| 4553 | CLK_LOOKUP("usb_fs_pclk", usb_fs2_p_clk.c, NULL), |
| 4554 | CLK_LOOKUP("usb_hs_pclk", usb_hs1_p_clk.c, NULL), |
Matt Wagantall | 37ce384 | 2011-08-17 16:00:36 -0700 | [diff] [blame] | 4555 | CLK_LOOKUP("iface_clk", sdc1_p_clk.c, "msm_sdcc.1"), |
| 4556 | CLK_LOOKUP("iface_clk", sdc2_p_clk.c, "msm_sdcc.2"), |
| 4557 | CLK_LOOKUP("iface_clk", sdc3_p_clk.c, "msm_sdcc.3"), |
| 4558 | CLK_LOOKUP("iface_clk", sdc4_p_clk.c, "msm_sdcc.4"), |
| 4559 | CLK_LOOKUP("iface_clk", sdc5_p_clk.c, "msm_sdcc.5"), |
Matt Wagantall | e1a8606 | 2011-08-18 17:46:10 -0700 | [diff] [blame] | 4560 | CLK_LOOKUP("core_clk", adm0_clk.c, "msm_dmov"), |
| 4561 | CLK_LOOKUP("iface_clk", adm0_p_clk.c, "msm_dmov"), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4562 | CLK_LOOKUP("pmic_arb_pclk", pmic_arb0_p_clk.c, NULL), |
| 4563 | CLK_LOOKUP("pmic_arb_pclk", pmic_arb1_p_clk.c, NULL), |
| 4564 | CLK_LOOKUP("pmic_ssbi2", pmic_ssbi2_clk.c, NULL), |
| 4565 | CLK_LOOKUP("rpm_msg_ram_pclk", rpm_msg_ram_p_clk.c, NULL), |
| 4566 | CLK_LOOKUP("amp_clk", amp_clk.c, NULL), |
| 4567 | CLK_LOOKUP("cam_clk", cam0_clk.c, NULL), |
| 4568 | CLK_LOOKUP("cam_clk", cam1_clk.c, NULL), |
| 4569 | CLK_LOOKUP("cam_clk", cam0_clk.c, "msm_camera_imx074.0"), |
| 4570 | CLK_LOOKUP("cam_clk", cam0_clk.c, "msm_camera_ov2720.0"), |
Kevin Chan | dfecce2 | 2011-07-13 10:52:41 -0700 | [diff] [blame] | 4571 | CLK_LOOKUP("cam_clk", cam0_clk.c, "msm_camera_qs_mt9p017.0"), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4572 | CLK_LOOKUP("csi_src_clk", csi0_src_clk.c, NULL), |
| 4573 | CLK_LOOKUP("csi_src_clk", csi1_src_clk.c, NULL), |
| 4574 | CLK_LOOKUP("csi_src_clk", csi0_src_clk.c, "msm_camera_imx074.0"), |
Kevin Chan | dfecce2 | 2011-07-13 10:52:41 -0700 | [diff] [blame] | 4575 | CLK_LOOKUP("csi_src_clk", csi0_src_clk.c, "msm_camera_qs_mt9p017.0"), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4576 | CLK_LOOKUP("csi_src_clk", csi1_src_clk.c, "msm_camera_ov2720.0"), |
| 4577 | CLK_LOOKUP("csi_clk", csi0_clk.c, NULL), |
| 4578 | CLK_LOOKUP("csi_clk", csi1_clk.c, NULL), |
| 4579 | CLK_LOOKUP("csi_clk", csi0_clk.c, "msm_camera_imx074.0"), |
Kevin Chan | dfecce2 | 2011-07-13 10:52:41 -0700 | [diff] [blame] | 4580 | CLK_LOOKUP("csi_clk", csi0_clk.c, "msm_camera_qs_mt9p017.0"), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4581 | CLK_LOOKUP("csi_clk", csi1_clk.c, "msm_camera_ov2720.0"), |
| 4582 | CLK_LOOKUP("csi_phy_clk", csi0_phy_clk.c, NULL), |
| 4583 | CLK_LOOKUP("csi_phy_clk", csi1_phy_clk.c, NULL), |
| 4584 | CLK_LOOKUP("csi_phy_clk", csi0_phy_clk.c, "msm_camera_imx074.0"), |
Kevin Chan | dfecce2 | 2011-07-13 10:52:41 -0700 | [diff] [blame] | 4585 | CLK_LOOKUP("csi_phy_clk", csi0_phy_clk.c, "msm_camera_qs_mt9p017.0"), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4586 | CLK_LOOKUP("csi_phy_clk", csi1_phy_clk.c, "msm_camera_ov2720.0"), |
| 4587 | CLK_LOOKUP("csi_pix_clk", csi_pix_clk.c, NULL), |
| 4588 | CLK_LOOKUP("csi_rdi_clk", csi_rdi_clk.c, NULL), |
| 4589 | CLK_LOOKUP("csiphy_timer_src_clk", csiphy_timer_src_clk.c, NULL), |
| 4590 | CLK_LOOKUP("csi0phy_timer_clk", csi0phy_timer_clk.c, NULL), |
| 4591 | CLK_LOOKUP("csi1phy_timer_clk", csi1phy_timer_clk.c, NULL), |
| 4592 | CLK_LOOKUP("dsi_byte_div_clk", dsi1_byte_clk.c, NULL), |
| 4593 | CLK_LOOKUP("dsi_byte_div_clk", dsi2_byte_clk.c, NULL), |
| 4594 | CLK_LOOKUP("dsi_esc_clk", dsi1_esc_clk.c, NULL), |
| 4595 | CLK_LOOKUP("dsi_esc_clk", dsi2_esc_clk.c, NULL), |
| 4596 | CLK_LOOKUP("gfx2d0_clk", gfx2d0_clk.c, NULL), |
| 4597 | CLK_LOOKUP("gfx2d1_clk", gfx2d1_clk.c, NULL), |
| 4598 | CLK_LOOKUP("gfx3d_clk", gfx3d_clk.c, NULL), |
| 4599 | CLK_LOOKUP("ijpeg_axi_clk", ijpeg_axi_clk.c, NULL), |
| 4600 | CLK_LOOKUP("imem_axi_clk", imem_axi_clk.c, NULL), |
| 4601 | CLK_LOOKUP("ijpeg_clk", ijpeg_clk.c, NULL), |
| 4602 | CLK_LOOKUP("jpegd_clk", jpegd_clk.c, NULL), |
| 4603 | CLK_LOOKUP("mdp_clk", mdp_clk.c, NULL), |
| 4604 | CLK_LOOKUP("mdp_vsync_clk", mdp_vsync_clk.c, NULL), |
| 4605 | CLK_LOOKUP("lut_mdp", lut_mdp_clk.c, NULL), |
Stephen Boyd | 973e4ba | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 4606 | CLK_LOOKUP("qdss_pclk", qdss_p_clk.c, NULL), |
| 4607 | CLK_LOOKUP("qdss_at_clk", qdss_at_clk.c, NULL), |
| 4608 | CLK_LOOKUP("qdss_pclkdbg_clk", qdss_pclkdbg_clk.c, NULL), |
| 4609 | CLK_LOOKUP("qdss_traceclkin_clk", qdss_traceclkin_clk.c, NULL), |
| 4610 | CLK_LOOKUP("qdss_tsctr_clk", qdss_tsctr_clk.c, NULL), |
| 4611 | CLK_LOOKUP("qdss_stm_clk", qdss_stm_clk.c, NULL), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4612 | CLK_LOOKUP("rot_clk", rot_clk.c, NULL), |
| 4613 | CLK_LOOKUP("tv_src_clk", tv_src_clk.c, NULL), |
| 4614 | CLK_LOOKUP("tv_enc_clk", tv_enc_clk.c, NULL), |
| 4615 | CLK_LOOKUP("tv_dac_clk", tv_dac_clk.c, NULL), |
| 4616 | CLK_LOOKUP("vcodec_clk", vcodec_clk.c, NULL), |
| 4617 | CLK_LOOKUP("mdp_tv_clk", mdp_tv_clk.c, NULL), |
| 4618 | CLK_LOOKUP("hdmi_clk", hdmi_tv_clk.c, NULL), |
| 4619 | CLK_LOOKUP("hdmi_app_clk", hdmi_app_clk.c, NULL), |
| 4620 | CLK_LOOKUP("vpe_clk", vpe_clk.c, NULL), |
| 4621 | CLK_LOOKUP("vfe_clk", vfe_clk.c, NULL), |
Matt Wagantall | c23eee9 | 2011-08-16 23:06:52 -0700 | [diff] [blame] | 4622 | CLK_LOOKUP("csi_vfe_clk", csi_vfe_clk.c, NULL), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4623 | CLK_LOOKUP("vfe_axi_clk", vfe_axi_clk.c, NULL), |
| 4624 | CLK_LOOKUP("mdp_axi_clk", mdp_axi_clk.c, NULL), |
| 4625 | CLK_LOOKUP("rot_axi_clk", rot_axi_clk.c, NULL), |
| 4626 | CLK_LOOKUP("vcodec_axi_clk", vcodec_axi_clk.c, NULL), |
| 4627 | CLK_LOOKUP("vcodec_axi_a_clk", vcodec_axi_a_clk.c, NULL), |
| 4628 | CLK_LOOKUP("vcodec_axi_b_clk", vcodec_axi_b_clk.c, NULL), |
| 4629 | CLK_LOOKUP("vpe_axi_clk", vpe_axi_clk.c, NULL), |
| 4630 | CLK_LOOKUP("amp_pclk", amp_p_clk.c, NULL), |
Matt Wagantall | c23eee9 | 2011-08-16 23:06:52 -0700 | [diff] [blame] | 4631 | CLK_LOOKUP("csi_pclk", csi_p_clk.c, NULL), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4632 | CLK_LOOKUP("dsi_m_pclk", dsi1_m_p_clk.c, NULL), |
| 4633 | CLK_LOOKUP("dsi_s_pclk", dsi1_s_p_clk.c, NULL), |
| 4634 | CLK_LOOKUP("dsi_m_pclk", dsi2_m_p_clk.c, NULL), |
| 4635 | CLK_LOOKUP("dsi_s_pclk", dsi2_s_p_clk.c, NULL), |
| 4636 | CLK_LOOKUP("gfx2d0_pclk", gfx2d0_p_clk.c, NULL), |
| 4637 | CLK_LOOKUP("gfx2d1_pclk", gfx2d1_p_clk.c, NULL), |
| 4638 | CLK_LOOKUP("gfx3d_pclk", gfx3d_p_clk.c, NULL), |
| 4639 | CLK_LOOKUP("hdmi_m_pclk", hdmi_m_p_clk.c, NULL), |
| 4640 | CLK_LOOKUP("hdmi_s_pclk", hdmi_s_p_clk.c, NULL), |
| 4641 | CLK_LOOKUP("ijpeg_pclk", ijpeg_p_clk.c, NULL), |
| 4642 | CLK_LOOKUP("jpegd_pclk", jpegd_p_clk.c, NULL), |
| 4643 | CLK_LOOKUP("imem_pclk", imem_p_clk.c, NULL), |
| 4644 | CLK_LOOKUP("mdp_pclk", mdp_p_clk.c, NULL), |
| 4645 | CLK_LOOKUP("smmu_pclk", smmu_p_clk.c, NULL), |
| 4646 | CLK_LOOKUP("rotator_pclk", rot_p_clk.c, NULL), |
| 4647 | CLK_LOOKUP("tv_enc_pclk", tv_enc_p_clk.c, NULL), |
| 4648 | CLK_LOOKUP("vcodec_pclk", vcodec_p_clk.c, NULL), |
| 4649 | CLK_LOOKUP("vfe_pclk", vfe_p_clk.c, NULL), |
| 4650 | CLK_LOOKUP("vpe_pclk", vpe_p_clk.c, NULL), |
| 4651 | CLK_LOOKUP("mi2s_bit_clk", mi2s_bit_clk.c, NULL), |
| 4652 | CLK_LOOKUP("mi2s_osr_clk", mi2s_osr_clk.c, NULL), |
| 4653 | CLK_LOOKUP("i2s_mic_bit_clk", codec_i2s_mic_bit_clk.c, NULL), |
| 4654 | CLK_LOOKUP("i2s_mic_osr_clk", codec_i2s_mic_osr_clk.c, NULL), |
| 4655 | CLK_LOOKUP("i2s_mic_bit_clk", spare_i2s_mic_bit_clk.c, NULL), |
| 4656 | CLK_LOOKUP("i2s_mic_osr_clk", spare_i2s_mic_osr_clk.c, NULL), |
| 4657 | CLK_LOOKUP("i2s_spkr_bit_clk", codec_i2s_spkr_bit_clk.c, NULL), |
| 4658 | CLK_LOOKUP("i2s_spkr_osr_clk", codec_i2s_spkr_osr_clk.c, NULL), |
| 4659 | CLK_LOOKUP("i2s_spkr_bit_clk", spare_i2s_spkr_bit_clk.c, NULL), |
| 4660 | CLK_LOOKUP("i2s_spkr_osr_clk", spare_i2s_spkr_osr_clk.c, NULL), |
| 4661 | CLK_LOOKUP("pcm_clk", pcm_clk.c, NULL), |
| 4662 | CLK_LOOKUP("sps_slimbus_clk", sps_slimbus_clk.c, NULL), |
| 4663 | CLK_LOOKUP("audio_slimbus_clk", audio_slimbus_clk.c, NULL), |
| 4664 | CLK_LOOKUP("iommu_clk", jpegd_axi_clk.c, "msm_iommu.0"), |
| 4665 | CLK_LOOKUP("iommu_clk", vpe_axi_clk.c, "msm_iommu.1"), |
| 4666 | CLK_LOOKUP("iommu_clk", mdp_axi_clk.c, "msm_iommu.2"), |
| 4667 | CLK_LOOKUP("iommu_clk", mdp_axi_clk.c, "msm_iommu.3"), |
| 4668 | CLK_LOOKUP("iommu_clk", rot_axi_clk.c, "msm_iommu.4"), |
| 4669 | CLK_LOOKUP("iommu_clk", ijpeg_axi_clk.c, "msm_iommu.5"), |
| 4670 | CLK_LOOKUP("iommu_clk", vfe_axi_clk.c, "msm_iommu.6"), |
| 4671 | CLK_LOOKUP("iommu_clk", vcodec_axi_a_clk.c, "msm_iommu.7"), |
| 4672 | CLK_LOOKUP("iommu_clk", vcodec_axi_b_clk.c, "msm_iommu.8"), |
| 4673 | CLK_LOOKUP("iommu_clk", gfx3d_clk.c, "msm_iommu.9"), |
| 4674 | CLK_LOOKUP("iommu_clk", gfx2d0_clk.c, "msm_iommu.10"), |
| 4675 | CLK_LOOKUP("iommu_clk", gfx2d1_clk.c, "msm_iommu.11"), |
| 4676 | CLK_LOOKUP("dfab_dsps_clk", dfab_dsps_clk.c, NULL), |
| 4677 | CLK_LOOKUP("dfab_usb_hs_clk", dfab_usb_hs_clk.c, NULL), |
Matt Wagantall | 37ce384 | 2011-08-17 16:00:36 -0700 | [diff] [blame] | 4678 | CLK_LOOKUP("bus_clk", dfab_sdc1_clk.c, "msm_sdcc.1"), |
| 4679 | CLK_LOOKUP("bus_clk", dfab_sdc2_clk.c, "msm_sdcc.2"), |
| 4680 | CLK_LOOKUP("bus_clk", dfab_sdc3_clk.c, "msm_sdcc.3"), |
| 4681 | CLK_LOOKUP("bus_clk", dfab_sdc4_clk.c, "msm_sdcc.4"), |
| 4682 | CLK_LOOKUP("bus_clk", dfab_sdc5_clk.c, "msm_sdcc.5"), |
Yan He | 160633e | 2011-06-30 12:18:56 -0700 | [diff] [blame] | 4683 | CLK_LOOKUP("dfab_clk", dfab_sps_clk.c, "msm_sps"), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4684 | |
| 4685 | CLK_LOOKUP("ebi1_msmbus_clk", ebi1_msmbus_clk.c, NULL), |
Matt Wagantall | e1a8606 | 2011-08-18 17:46:10 -0700 | [diff] [blame] | 4686 | CLK_LOOKUP("mem_clk", ebi1_adm_clk.c, "msm_dmov"), |
Matt Wagantall | 8b38f94 | 2011-08-02 18:23:18 -0700 | [diff] [blame] | 4687 | |
| 4688 | CLK_LOOKUP("l2_mclk", l2_m_clk, NULL), |
| 4689 | CLK_LOOKUP("krait0_mclk", krait0_m_clk, NULL), |
| 4690 | CLK_LOOKUP("krait1_mclk", krait1_m_clk, NULL), |
Stephen Boyd | 3939c8d | 2011-08-29 17:36:22 -0700 | [diff] [blame] | 4691 | CLK_LOOKUP("q6sw_clk", q6sw_clk, NULL), |
| 4692 | CLK_LOOKUP("q6fw_clk", q6fw_clk, NULL), |
| 4693 | CLK_LOOKUP("q6_func_clk", q6_func_clk, NULL), |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4694 | }; |
| 4695 | |
Stephen Boyd | 94625ef | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 4696 | static struct clk_lookup msm_clocks_8960_v2[] __initdata = { |
| 4697 | CLK_LOOKUP("cam_clk", cam2_clk.c, NULL), |
| 4698 | CLK_LOOKUP("csi_src_clk", csi2_src_clk.c, NULL), |
| 4699 | CLK_LOOKUP("csi_clk", csi2_clk.c, NULL), |
| 4700 | CLK_LOOKUP("csi_pix1_clk", csi_pix1_clk.c, NULL), |
| 4701 | CLK_LOOKUP("csi_rdi1_clk", csi_rdi1_clk.c, NULL), |
| 4702 | CLK_LOOKUP("csi_rdi2_clk", csi_rdi2_clk.c, NULL), |
| 4703 | CLK_LOOKUP("csi_phy_clk", csi2_phy_clk.c, NULL), |
| 4704 | CLK_LOOKUP("csi2phy_timer_clk", csi2phy_timer_clk.c, NULL), |
| 4705 | CLK_LOOKUP("usb_hsic_xcvr_fs_clk", usb_hsic_xcvr_fs_clk.c, NULL), |
| 4706 | CLK_LOOKUP("usb_hsic_hsic_clk", usb_hsic_hsic_clk.c, NULL), |
| 4707 | CLK_LOOKUP("usb_hsic_hsio_cal_clk", usb_hsic_hsio_cal_clk.c, NULL), |
| 4708 | CLK_LOOKUP("usb_hsic_system_clk", usb_hsic_system_clk.c, NULL), |
| 4709 | CLK_LOOKUP("usb_hsic_p_clk", usb_hsic_p_clk.c, NULL), |
| 4710 | }; |
| 4711 | |
| 4712 | /* Add v2 clocks dynamically at runtime */ |
| 4713 | static struct clk_lookup msm_clocks_8960[ARRAY_SIZE(msm_clocks_8960_v1) + |
| 4714 | ARRAY_SIZE(msm_clocks_8960_v2)]; |
| 4715 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4716 | /* |
| 4717 | * Miscellaneous clock register initializations |
| 4718 | */ |
| 4719 | |
| 4720 | /* Read, modify, then write-back a register. */ |
| 4721 | static void __init rmwreg(uint32_t val, void *reg, uint32_t mask) |
| 4722 | { |
| 4723 | uint32_t regval = readl_relaxed(reg); |
| 4724 | regval &= ~mask; |
| 4725 | regval |= val; |
| 4726 | writel_relaxed(regval, reg); |
| 4727 | } |
| 4728 | |
| 4729 | static void __init reg_init(void) |
| 4730 | { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4731 | /* Deassert MM SW_RESET_ALL signal. */ |
| 4732 | writel_relaxed(0, SW_RESET_ALL_REG); |
| 4733 | |
| 4734 | /* Initialize MM AHB registers: Enable the FPB clock and disable HW |
| 4735 | * gating for all clocks. Also set VFE_AHB's FORCE_CORE_ON bit to |
| 4736 | * prevent its memory from being collapsed when the clock is halted. |
| 4737 | * The sleep and wake-up delays are set to safe values. */ |
Matt Wagantall | 53d968f | 2011-07-19 13:22:53 -0700 | [diff] [blame] | 4738 | rmwreg(0x00000003, AHB_EN_REG, 0x6C000103); |
| 4739 | writel_relaxed(0x000007F9, AHB_EN2_REG); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4740 | |
| 4741 | /* Deassert all locally-owned MM AHB resets. */ |
| 4742 | rmwreg(0, SW_RESET_AHB_REG, 0xFFF7DFFF); |
| 4743 | |
| 4744 | /* Initialize MM AXI registers: Enable HW gating for all clocks that |
| 4745 | * support it. Also set FORCE_CORE_ON bits, and any sleep and wake-up |
| 4746 | * delays to safe values. */ |
| 4747 | /* TODO: Enable HW Gating */ |
Matt Wagantall | 53d968f | 2011-07-19 13:22:53 -0700 | [diff] [blame] | 4748 | rmwreg(0x000007F9, MAXI_EN_REG, 0x0803FFFF); |
| 4749 | rmwreg(0x3027FCFF, MAXI_EN2_REG, 0x3A3FFFFF); |
| 4750 | rmwreg(0x0027FCFF, MAXI_EN3_REG, 0x003FFFFF); |
| 4751 | rmwreg(0x0027FCFF, MAXI_EN4_REG, 0x017FFFFF); |
| 4752 | rmwreg(0x000003C7, SAXI_EN_REG, 0x00003FFF); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4753 | |
| 4754 | /* Initialize MM CC registers: Set MM FORCE_CORE_ON bits so that core |
| 4755 | * memories retain state even when not clocked. Also, set sleep and |
| 4756 | * wake-up delays to safe values. */ |
Matt Wagantall | 53d968f | 2011-07-19 13:22:53 -0700 | [diff] [blame] | 4757 | rmwreg(0x00000000, CSI0_CC_REG, 0x00000410); |
| 4758 | rmwreg(0x00000000, CSI1_CC_REG, 0x00000410); |
| 4759 | rmwreg(0x80FF0000, DSI1_BYTE_CC_REG, 0xE0FF0010); |
| 4760 | rmwreg(0x80FF0000, DSI2_BYTE_CC_REG, 0xE0FF0010); |
| 4761 | rmwreg(0x80FF0000, DSI_PIXEL_CC_REG, 0xE0FF0010); |
| 4762 | rmwreg(0x80FF0000, DSI2_PIXEL_CC_REG, 0xE0FF0010); |
| 4763 | rmwreg(0x80FF0000, GFX2D0_CC_REG, 0xE0FF0010); |
| 4764 | rmwreg(0x80FF0000, GFX2D1_CC_REG, 0xE0FF0010); |
| 4765 | rmwreg(0x80FF0000, GFX3D_CC_REG, 0xE0FF0010); |
| 4766 | rmwreg(0x80FF0000, IJPEG_CC_REG, 0xE0FF0010); |
| 4767 | rmwreg(0x80FF0000, JPEGD_CC_REG, 0xE0FF0010); |
| 4768 | rmwreg(0x80FF0000, MDP_CC_REG, 0xE1FF0010); |
| 4769 | rmwreg(0x80FF0000, MDP_LUT_CC_REG, 0xE0FF0010); |
| 4770 | rmwreg(0x80FF0000, ROT_CC_REG, 0xE0FF0010); |
| 4771 | rmwreg(0x80FF0000, TV_CC_REG, 0xE1FFC010); |
| 4772 | rmwreg(0x000004FF, TV_CC2_REG, 0x000007FF); |
| 4773 | rmwreg(0xC0FF0000, VCODEC_CC_REG, 0xE0FF0010); |
| 4774 | rmwreg(0x80FF0000, VFE_CC_REG, 0xE0FF4010); |
Stephen Boyd | 94625ef | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 4775 | rmwreg(0x800000FF, VFE_CC2_REG, 0xE00000FF); |
Matt Wagantall | 53d968f | 2011-07-19 13:22:53 -0700 | [diff] [blame] | 4776 | rmwreg(0x80FF0000, VPE_CC_REG, 0xE0FF0010); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4777 | |
| 4778 | /* De-assert MM AXI resets to all hardware blocks. */ |
| 4779 | writel_relaxed(0, SW_RESET_AXI_REG); |
| 4780 | |
| 4781 | /* Deassert all MM core resets. */ |
| 4782 | writel_relaxed(0, SW_RESET_CORE_REG); |
| 4783 | |
| 4784 | /* Reset 3D core once more, with its clock enabled. This can |
| 4785 | * eventually be done as part of the GDFS footswitch driver. */ |
| 4786 | clk_set_rate(&gfx3d_clk.c, 27000000); |
| 4787 | clk_enable(&gfx3d_clk.c); |
| 4788 | writel_relaxed(BIT(12), SW_RESET_CORE_REG); |
| 4789 | mb(); |
| 4790 | udelay(5); |
| 4791 | writel_relaxed(0, SW_RESET_CORE_REG); |
| 4792 | /* Make sure reset is de-asserted before clock is disabled. */ |
| 4793 | mb(); |
| 4794 | clk_disable(&gfx3d_clk.c); |
| 4795 | |
| 4796 | /* Enable TSSC and PDM PXO sources. */ |
| 4797 | writel_relaxed(BIT(11), TSSC_CLK_CTL_REG); |
| 4798 | writel_relaxed(BIT(15), PDM_CLK_NS_REG); |
| 4799 | |
| 4800 | /* Source SLIMBus xo src from slimbus reference clock */ |
| 4801 | writel_relaxed(0x3, SLIMBUS_XO_SRC_CLK_CTL_REG); |
| 4802 | |
| 4803 | /* Source the dsi_byte_clks from the DSI PHY PLLs */ |
| 4804 | rmwreg(0x1, DSI1_BYTE_NS_REG, 0x7); |
| 4805 | rmwreg(0x2, DSI2_BYTE_NS_REG, 0x7); |
| 4806 | } |
| 4807 | |
Stephen Boyd | 94625ef | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 4808 | struct clock_init_data msm8960_clock_init_data __initdata; |
| 4809 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4810 | /* Local clock driver initialization. */ |
Stephen Boyd | bb600ae | 2011-08-02 20:11:40 -0700 | [diff] [blame] | 4811 | static void __init msm8960_clock_init(void) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4812 | { |
Stephen Boyd | 94625ef | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 4813 | size_t num_lookups = ARRAY_SIZE(msm_clocks_8960_v1); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4814 | xo_pxo = msm_xo_get(MSM_XO_PXO, "clock-8960"); |
| 4815 | if (IS_ERR(xo_pxo)) { |
| 4816 | pr_err("%s: msm_xo_get(PXO) failed.\n", __func__); |
| 4817 | BUG(); |
| 4818 | } |
| 4819 | xo_cxo = msm_xo_get(MSM_XO_TCXO_D0, "clock-8960"); |
| 4820 | if (IS_ERR(xo_cxo)) { |
| 4821 | pr_err("%s: msm_xo_get(CXO) failed.\n", __func__); |
| 4822 | BUG(); |
| 4823 | } |
| 4824 | |
Stephen Boyd | 94625ef | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 4825 | memcpy(msm_clocks_8960, msm_clocks_8960_v1, sizeof(msm_clocks_8960_v1)); |
| 4826 | if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2) { |
Tianyi Gou | baf6d34 | 2011-08-30 21:49:02 -0700 | [diff] [blame] | 4827 | gfx3d_clk.freq_tbl = clk_tbl_gfx3d_v2; |
Stephen Boyd | 94625ef | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 4828 | memcpy(msm_clocks_8960 + ARRAY_SIZE(msm_clocks_8960_v1), |
| 4829 | msm_clocks_8960_v2, sizeof(msm_clocks_8960_v2)); |
| 4830 | num_lookups = ARRAY_SIZE(msm_clocks_8960); |
| 4831 | } |
| 4832 | msm8960_clock_init_data.size = num_lookups; |
| 4833 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4834 | soc_update_sys_vdd = msm8960_update_sys_vdd; |
| 4835 | local_vote_sys_vdd(HIGH); |
| 4836 | |
Vikram Mulukutla | 489e39e | 2011-08-31 18:04:05 -0700 | [diff] [blame] | 4837 | clk_ops_pll.enable = sr_pll_clk_enable; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4838 | |
| 4839 | /* Initialize clock registers. */ |
| 4840 | reg_init(); |
| 4841 | |
| 4842 | /* Initialize rates for clocks that only support one. */ |
| 4843 | clk_set_rate(&pdm_clk.c, 27000000); |
| 4844 | clk_set_rate(&prng_clk.c, 64000000); |
| 4845 | clk_set_rate(&mdp_vsync_clk.c, 27000000); |
| 4846 | clk_set_rate(&tsif_ref_clk.c, 105000); |
| 4847 | clk_set_rate(&tssc_clk.c, 27000000); |
| 4848 | clk_set_rate(&usb_hs1_xcvr_clk.c, 60000000); |
| 4849 | clk_set_rate(&usb_fs1_src_clk.c, 60000000); |
| 4850 | clk_set_rate(&usb_fs2_src_clk.c, 60000000); |
Stephen Boyd | 94625ef | 2011-07-12 17:06:01 -0700 | [diff] [blame] | 4851 | clk_set_rate(&usb_hsic_xcvr_fs_clk.c, 60000000); |
| 4852 | clk_set_rate(&usb_hsic_hsic_src_clk.c, 480000000); |
| 4853 | clk_set_rate(&usb_hsic_hsio_cal_clk.c, 9000000); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4854 | |
| 4855 | /* |
| 4856 | * The halt status bits for PDM and TSSC may be incorrect at boot. |
| 4857 | * Toggle these clocks on and off to refresh them. |
| 4858 | */ |
Matt Wagantall | 0625ea0 | 2011-07-13 18:51:56 -0700 | [diff] [blame] | 4859 | rcg_clk_enable(&pdm_clk.c); |
| 4860 | rcg_clk_disable(&pdm_clk.c); |
| 4861 | rcg_clk_enable(&tssc_clk.c); |
| 4862 | rcg_clk_disable(&tssc_clk.c); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4863 | |
| 4864 | if (machine_is_msm8960_sim()) { |
| 4865 | clk_set_rate(&sdc1_clk.c, 48000000); |
| 4866 | clk_enable(&sdc1_clk.c); |
| 4867 | clk_enable(&sdc1_p_clk.c); |
| 4868 | clk_set_rate(&sdc3_clk.c, 48000000); |
| 4869 | clk_enable(&sdc3_clk.c); |
| 4870 | clk_enable(&sdc3_p_clk.c); |
| 4871 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4872 | } |
| 4873 | |
Stephen Boyd | bb600ae | 2011-08-02 20:11:40 -0700 | [diff] [blame] | 4874 | static int __init msm8960_clock_late_init(void) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 4875 | { |
| 4876 | return local_unvote_sys_vdd(HIGH); |
| 4877 | } |
Stephen Boyd | bb600ae | 2011-08-02 20:11:40 -0700 | [diff] [blame] | 4878 | |
| 4879 | struct clock_init_data msm8960_clock_init_data __initdata = { |
| 4880 | .table = msm_clocks_8960, |
| 4881 | .size = ARRAY_SIZE(msm_clocks_8960), |
| 4882 | .init = msm8960_clock_init, |
| 4883 | .late_init = msm8960_clock_late_init, |
| 4884 | }; |