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