1 /* $NetBSD: imx51_ccmreg.h,v 1.1 2012/04/17 09:33:31 bsh Exp $ */ 2 /*- 3 * SPDX-License-Identifier: BSD-2-Clause AND BSD-2-Clause-FreeBSD 4 * 5 * Copyright (c) 2011, 2012 Genetec Corporation. All rights reserved. 6 * Written by Hashimoto Kenichi for Genetec Corporation. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 17 * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``AS IS'' AND 18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 19 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 20 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GENETEC CORPORATION 21 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 * POSSIBILITY OF SUCH DAMAGE. 28 */ 29 30 /*- 31 * Copyright (c) 2012, 2013 The FreeBSD Foundation 32 * All rights reserved. 33 * 34 * Portions of this software were developed by Oleksandr Rybalko 35 * under sponsorship from the FreeBSD Foundation. 36 * 37 * Redistribution and use in source and binary forms, with or without 38 * modification, are permitted provided that the following conditions 39 * are met: 40 * 1. Redistributions of source code must retain the above copyright 41 * notice, this list of conditions and the following disclaimer. 42 * 2. Redistributions in binary form must reproduce the above copyright 43 * notice, this list of conditions and the following disclaimer in the 44 * documentation and/or other materials provided with the distribution. 45 * 46 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 47 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 48 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 49 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 50 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 51 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 52 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 53 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 54 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 55 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 56 * SUCH DAMAGE. 57 * 58 * $FreeBSD$ 59 */ 60 61 #ifndef _IMX51_CCMREG_H 62 #define _IMX51_CCMREG_H 63 64 #include <sys/cdefs.h> 65 66 /* register offset address */ 67 68 #define CCMC_BASE 0x73fd4000 69 #define CCMC_CCR 0x0000 70 #define CCR_FPM_MULT 0x00001000 71 #define CCMC_CCDR 0x0004 72 #define CCMC_CSR 0x0008 73 #define CCMC_CCSR 0x000c 74 #define CCSR_LP_APM 0x00000200 75 #define CCSR_STEP_SEL_SHIFT 7 76 #define CCSR_STEP_SEL_MASK 0x00000180 77 #define CCSR_PLL2_DIV_PODF_SHIFT 5 78 #define CCSR_PLL2_DIV_PODF_MASK 0x00000060 79 #define CCSR_PLL3_DIV_PODF_SHIFT 3 80 #define CCSR_PLL3_DIV_PODF_MASK 0x00000030 81 #define CCSR_PLL1_SW_CLK_SEL 0x00000004 82 #define CCSR_PLL2_SW_CLK_SEL 0x00000002 83 #define CCSR_PLL3_SW_CLK_SEL 0x00000001 84 #define CCMC_CACRR 0x0010 85 #define CCMC_CBCDR 0x0014 86 #define CBCDR_DDR_HIGH_FREQ_CLK_SEL 0x40000000 87 #define CBCDR_DDR_CLK_PODF_SHIFT 27 88 #define CBCDR_DDR_CLK_PODF_MASK 0x38000000 89 #define CBCDR_EMI_CLK_SEL 0x04000000 90 #define CBCDR_PERIPH_CLK_SEL 0x02000000 91 #define CBCDR_EMI_SLOW_PODF_SHIFT 22 92 #define CBCDR_EMI_SLOW_PODF_MASK 0x01c00000 93 #define CBCDR_AXI_B_PODF_SHIFT 19 94 #define CBCDR_AXI_B_PODF_MASK 0x00380000 95 #define CBCDR_AXI_A_PODF_SHIFT 16 96 #define CBCDR_AXI_A_PODF_MASK 0x1fff0000 97 #define CBCDR_NFC_PODF_SHIFT 13 98 #define CBCDR_NFC_PODF_MASK 0x00018000 99 #define CBCDR_AHB_PODF_SHIFT 10 100 #define CBCDR_AHB_PODF_MASK 0x00001c00 101 #define CBCDR_IPG_PODF_SHIFT 8 102 #define CBCDR_IPG_PODF_MASK 0x00000300 103 #define CBCDR_PERCLK_PRED1_SHIFT 6 104 #define CBCDR_PERCLK_PRED1_MASK 0x000000c0 105 #define CBCDR_PERCLK_PRED2_SHIFT 3 106 #define CBCDR_PERCLK_PRED2_MASK 0x00000038 107 #define CBCDR_PERCLK_PODF_SHIFT 0 108 #define CBCDR_PERCLK_PODF_MASK 0x00000007 109 #define CCMC_CBCMR 0x0018 110 #define CBCMR_PERIPH_APM_SEL_SHIFT 12 111 #define CBCMR_PERIPH_APM_SEL_MASK 0x00003000 112 #define CBCMR_IPU_HSP_CLK_SEL_SHIFT 6 113 #define CBCMR_IPU_HSP_CLK_SEL_MASK 0x000000c0 114 #define CBCMR_PERCLK_LP_APM_SEL 0x00000002 115 #define CBCMR_PERCLK_IPG_SEL 0x00000001 116 #define CCMC_CSCMR1 0x001c 117 #define CSCMR1_UART_CLK_SEL_SHIFT 24 118 #define CSCMR1_UART_CLK_SEL_MASK 0x03000000 119 #define CSCMR1_USBPHY_CLK_SEL_SHIFT 26 120 #define CSCMR1_USBPHY_CLK_SEL_MASK 0x04000000 121 #define CSCMR1_USBOH3_CLK_SEL_SHIFT 22 122 #define CSCMR1_USBOH3_CLK_SEL_MASK 0x00c00000 123 #define CCMC_CSCMR2 0x0020 124 #define CCMC_CSCDR1 0x0024 125 #define CSCDR1_UART_CLK_PRED_SHIFT 3 126 #define CSCDR1_UART_CLK_PRED_MASK 0x00000038 127 #define CSCDR1_UART_CLK_PODF_SHIFT 0 128 #define CSCDR1_UART_CLK_PODF_MASK 0x00000007 129 #define CSCDR1_USBOH3_CLK_PRED_SHIFT 8 130 #define CSCDR1_USBOH3_CLK_PRED_MASK 0x00000700 131 #define CSCDR1_USBOH3_CLK_PODF_SHIFT 6 132 #define CSCDR1_USBOH3_CLK_PODF_MASK 0x000000c0 133 #define CCMC_CS1CDR 0x0028 134 #define CCMC_CS2CDR 0x002c 135 #define CCMC_CDCDR 0x0030 136 #define CCMC_CSCDR2 0x0038 137 #define CCMC_CSCDR3 0x003c 138 #define CCMC_CSCDR4 0x0040 139 #define CCMC_CWDR 0x0044 140 #define CCMC_CDHIPR 0x0048 141 #define CCMC_CDCR 0x004c 142 #define CDCR_PERIPH_CLK_DVFS_PODF_SHIFT 0 143 #define CDCR_PERIPH_CLK_DVFS_PODF_MASK 0x00000003 144 #define CCMC_CTOR 0x0050 145 #define CCMC_CLPCR 0x0054 146 #define CCMC_CISR 0x0058 147 #define CCMC_CIMR 0x005c 148 #define CCMC_CCOSR 0x0060 149 #define CCMC_CGPR 0x0064 150 #define CCMC_CCGR(n) (0x0068 + (n) * 4) 151 #define CCMC_CMEOR 0x0084 152 153 #define CCMC_SIZE 0x88 154 155 /* CCGR Clock Gate Register */ 156 157 #define CCMR_CCGR_NSOURCE 16 158 #define CCMR_CCGR_NGROUPS 7 159 #define CCMR_CCGR_MODULE(clk) ((clk) / CCMR_CCGR_NSOURCE) 160 #define __CCGR_NUM(a, b) ((a) * 16 + (b)) 161 162 #define CCGR_ARM_BUS_CLK __CCGR_NUM(0, 0) 163 #define CCGR_ARM_AXI_CLK __CCGR_NUM(0, 1) 164 #define CCGR_ARM_DEBUG_CLK __CCGR_NUM(0, 2) 165 #define CCGR_TZIC_CLK __CCGR_NUM(0, 3) 166 #define CCGR_DAP_CLK __CCGR_NUM(0, 4) 167 #define CCGR_TPIU_CLK __CCGR_NUM(0, 5) 168 #define CCGR_CTI2_CLK __CCGR_NUM(0, 6) 169 #define CCGR_CTI3_CLK __CCGR_NUM(0, 7) 170 #define CCGR_AHBMUX1_CLK __CCGR_NUM(0, 8) 171 #define CCGR_AHBMUX2_CLK __CCGR_NUM(0, 9) 172 #define CCGR_ROMCP_CLK __CCGR_NUM(0, 10) 173 #define CCGR_ROM_CLK __CCGR_NUM(0, 11) 174 #define CCGR_AIPS_TZ1_CLK __CCGR_NUM(0, 12) 175 #define CCGR_AIPS_TZ2_CLK __CCGR_NUM(0, 13) 176 #define CCGR_AHB_MAX_CLK __CCGR_NUM(0, 14) 177 #define CCGR_IIM_CLK __CCGR_NUM(0, 15) 178 #define CCGR_TMAX1_CLK __CCGR_NUM(1, 0) 179 #define CCGR_TMAX2_CLK __CCGR_NUM(1, 1) 180 #define CCGR_TMAX3_CLK __CCGR_NUM(1, 2) 181 #define CCGR_UART1_CLK __CCGR_NUM(1, 3) 182 #define CCGR_UART1_SERIAL_CLK __CCGR_NUM(1, 4) 183 #define CCGR_UART2_CLK __CCGR_NUM(1, 5) 184 #define CCGR_UART2_SERIAL_CLK __CCGR_NUM(1, 6) 185 #define CCGR_UART3_CLK __CCGR_NUM(1, 7) 186 #define CCGR_UART3_SERIAL_CLK __CCGR_NUM(1, 8) 187 #define CCGR_I2C1_SERIAL_CLK __CCGR_NUM(1, 9) 188 #define CCGR_I2C2_SERIAL_CLK __CCGR_NUM(1, 10) 189 #define CCGR_HSI2C_CLK __CCGR_NUM(1, 11) 190 #define CCGR_HSI2C_SERIAL_CLK __CCGR_NUM(1, 12) 191 #define CCGR_FIRI_CLK __CCGR_NUM(1, 13) 192 #define CCGR_FIRI_SERIAL_CLK __CCGR_NUM(1, 14) 193 #define CCGR_SCC_CLK __CCGR_NUM(1, 15) 194 195 #define CCGR_USB_PHY_CLK __CCGR_NUM(2, 0) 196 #define CCGR_EPIT1_CLK __CCGR_NUM(2, 1) 197 #define CCGR_EPIT1_SERIAL_CLK __CCGR_NUM(2, 2) 198 #define CCGR_EPIT2_CLK __CCGR_NUM(2, 3) 199 #define CCGR_EPIT2_SERIAL_CLK __CCGR_NUM(2, 4) 200 #define CCGR_PWM1_CLK __CCGR_NUM(2, 5) 201 #define CCGR_PWM1_SERIAL_CLK __CCGR_NUM(2, 6) 202 #define CCGR_PWM2_CLK __CCGR_NUM(2, 7) 203 #define CCGR_PWM2_SERIAL_CLK __CCGR_NUM(2, 8) 204 #define CCGR_GPT_CLK __CCGR_NUM(2, 9) 205 #define CCGR_GPT_SERIAL_CLK __CCGR_NUM(2, 10) 206 #define CCGR_OWIRE_CLK __CCGR_NUM(2, 11) 207 #define CCGR_FEC_CLK __CCGR_NUM(2, 12) 208 #define CCGR_USBOH3_IPG_AHB_CLK __CCGR_NUM(2, 13) 209 #define CCGR_USBOH3_60M_CLK __CCGR_NUM(2, 14) 210 #define CCGR_TVE_CLK __CCGR_NUM(2, 15) 211 212 #define CCGR_ESDHC1_CLK __CCGR_NUM(3, 0) 213 #define CCGR_ESDHC1_SERIAL_CLK __CCGR_NUM(3, 1) 214 #define CCGR_ESDHC2_CLK __CCGR_NUM(3, 2) 215 #define CCGR_ESDHC2_SERIAL_CLK __CCGR_NUM(3, 3) 216 #define CCGR_ESDHC3_CLK __CCGR_NUM(3, 4) 217 #define CCGR_ESDHC3_SERIAL_CLK __CCGR_NUM(3, 5) 218 #define CCGR_ESDHC4_CLK __CCGR_NUM(3, 6) 219 #define CCGR_ESDHC4_SERIAL_CLK __CCGR_NUM(3, 7) 220 #define CCGR_SSI1_CLK __CCGR_NUM(3, 8) 221 #define CCGR_SSI1_SERIAL_CLK __CCGR_NUM(3, 9) 222 #define CCGR_SSI2_CLK __CCGR_NUM(3, 10) 223 #define CCGR_SSI2_SERIAL_CLK __CCGR_NUM(3, 11) 224 #define CCGR_SSI3_CLK __CCGR_NUM(3, 12) 225 #define CCGR_SSI3_SERIAL_CLK __CCGR_NUM(3, 13) 226 #define CCGR_SSI_EXT1_CLK __CCGR_NUM(3, 14) 227 #define CCGR_SSI_EXT2_CLK __CCGR_NUM(3, 15) 228 229 #define CCGR_PATA_CLK __CCGR_NUM(4, 0) 230 #define CCGR_SIM_CLK __CCGR_NUM(4, 1) 231 #define CCGR_SIM_SERIAL_CLK __CCGR_NUM(4, 2) 232 #define CCGR_SAHARA_CLK __CCGR_NUM(4, 3) 233 #define CCGR_RTIC_CLK __CCGR_NUM(4, 4) 234 #define CCGR_ECSPI1_CLK __CCGR_NUM(4, 5) 235 #define CCGR_ECSPI1_SERIAL_CLK __CCGR_NUM(4, 6) 236 #define CCGR_ECSPI2_CLK __CCGR_NUM(4, 7) 237 #define CCGR_ECSPI2_SERIAL_CLK __CCGR_NUM(4, 8) 238 #define CCGR_CSPI_CLK __CCGR_NUM(4, 9) 239 #define CCGR_SRTC_CLK __CCGR_NUM(4, 10) 240 #define CCGR_SDMA_CLK __CCGR_NUM(4, 11) 241 242 #define CCGR_SPBA_CLK __CCGR_NUM(5, 0) 243 #define CCGR_GPU_CLK __CCGR_NUM(5, 1) 244 #define CCGR_GARB_CLK __CCGR_NUM(5, 2) 245 #define CCGR_VPU_CLK __CCGR_NUM(5, 3) 246 #define CCGR_VPU_SERIAL_CLK __CCGR_NUM(5, 4) 247 #define CCGR_IPU_CLK __CCGR_NUM(5, 5) 248 #define CCGR_EMI_GARB_CLK __CCGR_NUM(6, 0) 249 #define CCGR_IPU_DI0_CLK __CCGR_NUM(6, 1) 250 #define CCGR_IPU_DI1_CLK __CCGR_NUM(6, 2) 251 #define CCGR_GPU2D_CLK __CCGR_NUM(6, 3) 252 #define CCGR_SLIMBUS_CLK __CCGR_NUM(6, 4) 253 #define CCGR_SLIMBUS_SERIAL_CLK __CCGR_NUM(6, 5) 254 255 #define CCGR_CLK_MODE_OFF 0 256 #define CCGR_CLK_MODE_RUNMODE 1 257 #define CCGR_CLK_MODE_ALWAYS 3 258 259 #endif /* _IMX51_CCMREG_H */ 260