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