1 /* 2 * This file is provided under a dual BSD/GPLv2 license. When using or 3 * redistributing this file, you may do so under either license. 4 * 5 * GPL LICENSE SUMMARY 6 * 7 * Copyright (c) 2016 AmLogic, Inc. 8 * Author: Michael Turquette <mturquette@baylibre.com> 9 * 10 * This program is free software; you can redistribute it and/or modify 11 * it under the terms of version 2 of the GNU General Public License as 12 * published by the Free Software Foundation. 13 * 14 * This program is distributed in the hope that it will be useful, but 15 * WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 * General Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public License 20 * along with this program; if not, write to the Free Software 21 * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 22 * The full GNU General Public License is included in this distribution 23 * in the file called COPYING 24 * 25 * BSD LICENSE 26 * 27 * Copyright (c) 2016 BayLibre, Inc. 28 * Author: Michael Turquette <mturquette@baylibre.com> 29 * 30 * Redistribution and use in source and binary forms, with or without 31 * modification, are permitted provided that the following conditions 32 * are met: 33 * 34 * * Redistributions of source code must retain the above copyright 35 * notice, this list of conditions and the following disclaimer. 36 * * Redistributions in binary form must reproduce the above copyright 37 * notice, this list of conditions and the following disclaimer in 38 * the documentation and/or other materials provided with the 39 * distribution. 40 * * Neither the name of Intel Corporation nor the names of its 41 * contributors may be used to endorse or promote products derived 42 * from this software without specific prior written permission. 43 * 44 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 45 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 46 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 47 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 48 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 49 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 50 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 51 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 52 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 53 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 54 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 55 */ 56 57 #ifndef __GXBB_H 58 #define __GXBB_H 59 60 /* 61 * Clock controller register offsets 62 * 63 * Register offsets from the data sheet are listed in comment blocks below. 64 * Those offsets must be multiplied by 4 before adding them to the base address 65 * to get the right value 66 */ 67 #define SCR 0x2C /* 0x0b offset in data sheet */ 68 #define TIMEOUT_VALUE 0x3c /* 0x0f offset in data sheet */ 69 70 #define HHI_GP0_PLL_CNTL 0x40 /* 0x10 offset in data sheet */ 71 #define HHI_GP0_PLL_CNTL2 0x44 /* 0x11 offset in data sheet */ 72 #define HHI_GP0_PLL_CNTL3 0x48 /* 0x12 offset in data sheet */ 73 #define HHI_GP0_PLL_CNTL4 0x4c /* 0x13 offset in data sheet */ 74 #define HHI_GP0_PLL_CNTL5 0x50 /* 0x14 offset in data sheet */ 75 #define HHI_GP0_PLL_CNTL1 0x58 /* 0x16 offset in data sheet */ 76 77 #define HHI_XTAL_DIVN_CNTL 0xbc /* 0x2f offset in data sheet */ 78 #define HHI_TIMER90K 0xec /* 0x3b offset in data sheet */ 79 80 #define HHI_MEM_PD_REG0 0x100 /* 0x40 offset in data sheet */ 81 #define HHI_MEM_PD_REG1 0x104 /* 0x41 offset in data sheet */ 82 #define HHI_VPU_MEM_PD_REG1 0x108 /* 0x42 offset in data sheet */ 83 #define HHI_VIID_CLK_DIV 0x128 /* 0x4a offset in data sheet */ 84 #define HHI_VIID_CLK_CNTL 0x12c /* 0x4b offset in data sheet */ 85 86 #define HHI_GCLK_MPEG0 0x140 /* 0x50 offset in data sheet */ 87 #define HHI_GCLK_MPEG1 0x144 /* 0x51 offset in data sheet */ 88 #define HHI_GCLK_MPEG2 0x148 /* 0x52 offset in data sheet */ 89 #define HHI_GCLK_OTHER 0x150 /* 0x54 offset in data sheet */ 90 #define HHI_GCLK_AO 0x154 /* 0x55 offset in data sheet */ 91 #define HHI_SYS_OSCIN_CNTL 0x158 /* 0x56 offset in data sheet */ 92 #define HHI_SYS_CPU_CLK_CNTL1 0x15c /* 0x57 offset in data sheet */ 93 #define HHI_SYS_CPU_RESET_CNTL 0x160 /* 0x58 offset in data sheet */ 94 #define HHI_VID_CLK_DIV 0x164 /* 0x59 offset in data sheet */ 95 96 #define HHI_MPEG_CLK_CNTL 0x174 /* 0x5d offset in data sheet */ 97 #define HHI_AUD_CLK_CNTL 0x178 /* 0x5e offset in data sheet */ 98 #define HHI_VID_CLK_CNTL 0x17c /* 0x5f offset in data sheet */ 99 #define HHI_AUD_CLK_CNTL2 0x190 /* 0x64 offset in data sheet */ 100 #define HHI_VID_CLK_CNTL2 0x194 /* 0x65 offset in data sheet */ 101 #define HHI_SYS_CPU_CLK_CNTL0 0x19c /* 0x67 offset in data sheet */ 102 #define HHI_VID_PLL_CLK_DIV 0x1a0 /* 0x68 offset in data sheet */ 103 #define HHI_AUD_CLK_CNTL3 0x1a4 /* 0x69 offset in data sheet */ 104 #define HHI_MALI_CLK_CNTL 0x1b0 /* 0x6c offset in data sheet */ 105 #define HHI_VPU_CLK_CNTL 0x1bC /* 0x6f offset in data sheet */ 106 107 #define HHI_HDMI_CLK_CNTL 0x1CC /* 0x73 offset in data sheet */ 108 #define HHI_VDEC_CLK_CNTL 0x1E0 /* 0x78 offset in data sheet */ 109 #define HHI_VDEC2_CLK_CNTL 0x1E4 /* 0x79 offset in data sheet */ 110 #define HHI_VDEC3_CLK_CNTL 0x1E8 /* 0x7a offset in data sheet */ 111 #define HHI_VDEC4_CLK_CNTL 0x1EC /* 0x7b offset in data sheet */ 112 #define HHI_HDCP22_CLK_CNTL 0x1F0 /* 0x7c offset in data sheet */ 113 #define HHI_VAPBCLK_CNTL 0x1F4 /* 0x7d offset in data sheet */ 114 115 #define HHI_VPU_CLKB_CNTL 0x20C /* 0x83 offset in data sheet */ 116 #define HHI_USB_CLK_CNTL 0x220 /* 0x88 offset in data sheet */ 117 #define HHI_32K_CLK_CNTL 0x224 /* 0x89 offset in data sheet */ 118 #define HHI_GEN_CLK_CNTL 0x228 /* 0x8a offset in data sheet */ 119 #define HHI_GEN_CLK_CNTL 0x228 /* 0x8a offset in data sheet */ 120 121 #define HHI_PCM_CLK_CNTL 0x258 /* 0x96 offset in data sheet */ 122 #define HHI_NAND_CLK_CNTL 0x25C /* 0x97 offset in data sheet */ 123 #define HHI_SD_EMMC_CLK_CNTL 0x264 /* 0x99 offset in data sheet */ 124 125 #define HHI_MPLL_CNTL 0x280 /* 0xa0 offset in data sheet */ 126 #define HHI_MPLL_CNTL2 0x284 /* 0xa1 offset in data sheet */ 127 #define HHI_MPLL_CNTL3 0x288 /* 0xa2 offset in data sheet */ 128 #define HHI_MPLL_CNTL4 0x28C /* 0xa3 offset in data sheet */ 129 #define HHI_MPLL_CNTL5 0x290 /* 0xa4 offset in data sheet */ 130 #define HHI_MPLL_CNTL6 0x294 /* 0xa5 offset in data sheet */ 131 #define HHI_MPLL_CNTL7 0x298 /* MP0, 0xa6 offset in data sheet */ 132 #define HHI_MPLL_CNTL8 0x29C /* MP1, 0xa7 offset in data sheet */ 133 #define HHI_MPLL_CNTL9 0x2A0 /* MP2, 0xa8 offset in data sheet */ 134 #define HHI_MPLL_CNTL10 0x2A4 /* MP2, 0xa9 offset in data sheet */ 135 136 #define HHI_MPLL3_CNTL0 0x2E0 /* 0xb8 offset in data sheet */ 137 #define HHI_MPLL3_CNTL1 0x2E4 /* 0xb9 offset in data sheet */ 138 #define HHI_VDAC_CNTL0 0x2F4 /* 0xbd offset in data sheet */ 139 #define HHI_VDAC_CNTL1 0x2F8 /* 0xbe offset in data sheet */ 140 141 #define HHI_SYS_PLL_CNTL 0x300 /* 0xc0 offset in data sheet */ 142 #define HHI_SYS_PLL_CNTL2 0x304 /* 0xc1 offset in data sheet */ 143 #define HHI_SYS_PLL_CNTL3 0x308 /* 0xc2 offset in data sheet */ 144 #define HHI_SYS_PLL_CNTL4 0x30c /* 0xc3 offset in data sheet */ 145 #define HHI_SYS_PLL_CNTL5 0x310 /* 0xc4 offset in data sheet */ 146 #define HHI_DPLL_TOP_I 0x318 /* 0xc6 offset in data sheet */ 147 #define HHI_DPLL_TOP2_I 0x31C /* 0xc7 offset in data sheet */ 148 #define HHI_HDMI_PLL_CNTL 0x320 /* 0xc8 offset in data sheet */ 149 #define HHI_HDMI_PLL_CNTL2 0x324 /* 0xc9 offset in data sheet */ 150 #define HHI_HDMI_PLL_CNTL3 0x328 /* 0xca offset in data sheet */ 151 #define HHI_HDMI_PLL_CNTL4 0x32C /* 0xcb offset in data sheet */ 152 #define HHI_HDMI_PLL_CNTL5 0x330 /* 0xcc offset in data sheet */ 153 #define HHI_HDMI_PLL_CNTL6 0x334 /* 0xcd offset in data sheet */ 154 #define HHI_HDMI_PLL_CNTL_I 0x338 /* 0xce offset in data sheet */ 155 #define HHI_HDMI_PLL_CNTL7 0x33C /* 0xcf offset in data sheet */ 156 157 #define HHI_HDMI_PHY_CNTL0 0x3A0 /* 0xe8 offset in data sheet */ 158 #define HHI_HDMI_PHY_CNTL1 0x3A4 /* 0xe9 offset in data sheet */ 159 #define HHI_HDMI_PHY_CNTL2 0x3A8 /* 0xea offset in data sheet */ 160 #define HHI_HDMI_PHY_CNTL3 0x3AC /* 0xeb offset in data sheet */ 161 162 #define HHI_VID_LOCK_CLK_CNTL 0x3C8 /* 0xf2 offset in data sheet */ 163 #define HHI_BT656_CLK_CNTL 0x3D4 /* 0xf5 offset in data sheet */ 164 #define HHI_SAR_CLK_CNTL 0x3D8 /* 0xf6 offset in data sheet */ 165 166 /* 167 * CLKID index values 168 * 169 * These indices are entirely contrived and do not map onto the hardware. 170 * Migrate them out of this header and into the DT header file when they need 171 * to be exposed to client nodes in DT: include/dt-bindings/clock/gxbb-clkc.h 172 */ 173 #define CLKID_SYS_PLL 0 174 /* ID 1 is unused (it was used by the non-existing CLKID_CPUCLK before) */ 175 /* CLKID_HDMI_PLL */ 176 #define CLKID_FIXED_PLL 3 177 /* CLKID_FCLK_DIV2 */ 178 /* CLKID_FCLK_DIV3 */ 179 /* CLKID_FCLK_DIV4 */ 180 #define CLKID_FCLK_DIV5 7 181 #define CLKID_FCLK_DIV7 8 182 /* CLKID_GP0_PLL */ 183 #define CLKID_MPEG_SEL 10 184 #define CLKID_MPEG_DIV 11 185 /* CLKID_CLK81 */ 186 #define CLKID_MPLL0 13 187 #define CLKID_MPLL1 14 188 /* CLKID_MPLL2 */ 189 #define CLKID_DDR 16 190 #define CLKID_DOS 17 191 #define CLKID_ISA 18 192 #define CLKID_PL301 19 193 #define CLKID_PERIPHS 20 194 /* CLKID_SPICC */ 195 /* CLKID_I2C */ 196 /* #define CLKID_SAR_ADC */ 197 #define CLKID_SMART_CARD 24 198 /* CLKID_RNG0 */ 199 /* CLKID_UART0 */ 200 #define CLKID_SDHC 27 201 #define CLKID_STREAM 28 202 #define CLKID_ASYNC_FIFO 29 203 #define CLKID_SDIO 30 204 #define CLKID_ABUF 31 205 #define CLKID_HIU_IFACE 32 206 #define CLKID_ASSIST_MISC 33 207 /* CLKID_SPI */ 208 #define CLKID_I2S_SPDIF 35 209 /* CLKID_ETH */ 210 #define CLKID_DEMUX 37 211 /* CLKID_AIU_GLUE */ 212 /* CLKID_IEC958 */ 213 /* CLKID_I2S_OUT */ 214 #define CLKID_AMCLK 41 215 #define CLKID_AIFIFO2 42 216 #define CLKID_MIXER 43 217 /* CLKID_MIXER_IFACE */ 218 #define CLKID_ADC 45 219 #define CLKID_BLKMV 46 220 /* CLKID_AIU */ 221 /* CLKID_UART1 */ 222 #define CLKID_G2D 49 223 /* CLKID_USB0 */ 224 /* CLKID_USB1 */ 225 #define CLKID_RESET 52 226 #define CLKID_NAND 53 227 #define CLKID_DOS_PARSER 54 228 /* CLKID_USB */ 229 #define CLKID_VDIN1 56 230 #define CLKID_AHB_ARB0 57 231 #define CLKID_EFUSE 58 232 #define CLKID_BOOT_ROM 59 233 #define CLKID_AHB_DATA_BUS 60 234 #define CLKID_AHB_CTRL_BUS 61 235 #define CLKID_HDMI_INTR_SYNC 62 236 /* CLKID_HDMI_PCLK */ 237 /* CLKID_USB1_DDR_BRIDGE */ 238 /* CLKID_USB0_DDR_BRIDGE */ 239 #define CLKID_MMC_PCLK 66 240 #define CLKID_DVIN 67 241 /* CLKID_UART2 */ 242 /* #define CLKID_SANA */ 243 #define CLKID_VPU_INTR 70 244 #define CLKID_SEC_AHB_AHB3_BRIDGE 71 245 #define CLKID_CLK81_A53 72 246 #define CLKID_VCLK2_VENCI0 73 247 #define CLKID_VCLK2_VENCI1 74 248 #define CLKID_VCLK2_VENCP0 75 249 #define CLKID_VCLK2_VENCP1 76 250 /* CLKID_GCLK_VENCI_INT0 */ 251 #define CLKID_GCLK_VENCI_INT 78 252 #define CLKID_DAC_CLK 79 253 /* CLKID_AOCLK_GATE */ 254 /* CLKID_IEC958_GATE */ 255 #define CLKID_ENC480P 82 256 #define CLKID_RNG1 83 257 #define CLKID_GCLK_VENCI_INT1 84 258 #define CLKID_VCLK2_VENCLMCC 85 259 #define CLKID_VCLK2_VENCL 86 260 #define CLKID_VCLK_OTHER 87 261 #define CLKID_EDP 88 262 #define CLKID_AO_MEDIA_CPU 89 263 #define CLKID_AO_AHB_SRAM 90 264 #define CLKID_AO_AHB_BUS 91 265 #define CLKID_AO_IFACE 92 266 /* CLKID_AO_I2C */ 267 /* CLKID_SD_EMMC_A */ 268 /* CLKID_SD_EMMC_B */ 269 /* CLKID_SD_EMMC_C */ 270 /* CLKID_SAR_ADC_CLK */ 271 /* CLKID_SAR_ADC_SEL */ 272 #define CLKID_SAR_ADC_DIV 99 273 /* CLKID_MALI_0_SEL */ 274 #define CLKID_MALI_0_DIV 101 275 /* CLKID_MALI_0 */ 276 /* CLKID_MALI_1_SEL */ 277 #define CLKID_MALI_1_DIV 104 278 /* CLKID_MALI_1 */ 279 /* CLKID_MALI */ 280 /* CLKID_CTS_AMCLK */ 281 #define CLKID_CTS_AMCLK_SEL 108 282 #define CLKID_CTS_AMCLK_DIV 109 283 /* CLKID_CTS_MCLK_I958 */ 284 #define CLKID_CTS_MCLK_I958_SEL 111 285 #define CLKID_CTS_MCLK_I958_DIV 112 286 /* CLKID_CTS_I958 */ 287 #define CLKID_32K_CLK 114 288 #define CLKID_32K_CLK_SEL 115 289 #define CLKID_32K_CLK_DIV 116 290 291 #define NR_CLKS 117 292 293 /* include the CLKIDs that have been made part of the stable DT binding */ 294 #include <dt-bindings/clock/gxbb-clkc.h> 295 296 #endif /* __GXBB_H */ 297