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