/* * Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * */ #ifndef __NVKM_CLK_GK20A_H__ #define __NVKM_CLK_GK20A_H__ #define SYS_GPCPLL_CFG_BASE 0x00137000 #define GPC_BCASE_GPCPLL_CFG_BASE 0x00132800 #define GPCPLL_CFG (SYS_GPCPLL_CFG_BASE + 0) #define GPCPLL_CFG_ENABLE BIT(0) #define GPCPLL_CFG_IDDQ BIT(1) #define GPCPLL_CFG_SYNC_MODE BIT(2) #define GPCPLL_CFG_LOCK_DET_OFF BIT(4) #define GPCPLL_CFG_LOCK BIT(17) #define GPCPLL_COEFF (SYS_GPCPLL_CFG_BASE + 4) #define GPCPLL_COEFF_M_SHIFT 0 #define GPCPLL_COEFF_M_WIDTH 8 #define GPCPLL_COEFF_N_SHIFT 8 #define GPCPLL_COEFF_N_WIDTH 8 #define GPCPLL_COEFF_P_SHIFT 16 #define GPCPLL_COEFF_P_WIDTH 6 #define GPCPLL_CFG2 (SYS_GPCPLL_CFG_BASE + 0xc) #define GPCPLL_CFG2_SDM_DIN_SHIFT 0 #define GPCPLL_CFG2_SDM_DIN_WIDTH 8 #define GPCPLL_CFG2_SDM_DIN_NEW_SHIFT 8 #define GPCPLL_CFG2_SDM_DIN_NEW_WIDTH 15 #define GPCPLL_CFG2_SETUP2_SHIFT 16 #define GPCPLL_CFG2_PLL_STEPA_SHIFT 24 #define GPCPLL_CFG3 (SYS_GPCPLL_CFG_BASE + 0x18) #define GPCPLL_CFG3_VCO_CTRL_SHIFT 0 #define GPCPLL_CFG3_VCO_CTRL_WIDTH 9 #define GPCPLL_CFG3_PLL_STEPB_SHIFT 16 #define GPCPLL_CFG3_PLL_STEPB_WIDTH 8 #define GPCPLL_CFG3_PLL_DFS_TESTOUT_SHIFT 24 #define GPCPLL_CFG3_PLL_DFS_TESTOUT_WIDTH 7 #define GPCPLL_NDIV_SLOWDOWN (SYS_GPCPLL_CFG_BASE + 0x1c) #define GPCPLL_NDIV_SLOWDOWN_NDIV_LO_SHIFT 0 #define GPCPLL_NDIV_SLOWDOWN_NDIV_MID_SHIFT 8 #define GPCPLL_NDIV_SLOWDOWN_STEP_SIZE_LO2MID_SHIFT 16 #define GPCPLL_NDIV_SLOWDOWN_SLOWDOWN_USING_PLL_SHIFT 22 #define GPCPLL_NDIV_SLOWDOWN_EN_DYNRAMP_SHIFT 31 #define SEL_VCO (SYS_GPCPLL_CFG_BASE + 0x100) #define SEL_VCO_GPC2CLK_OUT_SHIFT 0 #define GPC2CLK_OUT (SYS_GPCPLL_CFG_BASE + 0x250) #define GPC2CLK_OUT_SDIV14_INDIV4_WIDTH 1 #define GPC2CLK_OUT_SDIV14_INDIV4_SHIFT 31 #define GPC2CLK_OUT_SDIV14_INDIV4_MODE 1 #define GPC2CLK_OUT_VCODIV_WIDTH 6 #define GPC2CLK_OUT_VCODIV_SHIFT 8 #define GPC2CLK_OUT_VCODIV1 0 #define GPC2CLK_OUT_VCODIV_MASK (MASK(GPC2CLK_OUT_VCODIV_WIDTH) << \ GPC2CLK_OUT_VCODIV_SHIFT) #define GPC2CLK_OUT_BYPDIV_WIDTH 6 #define GPC2CLK_OUT_BYPDIV_SHIFT 0 #define GPC2CLK_OUT_BYPDIV31 0x3c #define GPC2CLK_OUT_INIT_MASK ((MASK(GPC2CLK_OUT_SDIV14_INDIV4_WIDTH) << \ GPC2CLK_OUT_SDIV14_INDIV4_SHIFT)\ | (MASK(GPC2CLK_OUT_VCODIV_WIDTH) << GPC2CLK_OUT_VCODIV_SHIFT)\ | (MASK(GPC2CLK_OUT_BYPDIV_WIDTH) << GPC2CLK_OUT_BYPDIV_SHIFT)) #define GPC2CLK_OUT_INIT_VAL ((GPC2CLK_OUT_SDIV14_INDIV4_MODE << \ GPC2CLK_OUT_SDIV14_INDIV4_SHIFT) \ | (GPC2CLK_OUT_VCODIV1 << GPC2CLK_OUT_VCODIV_SHIFT) \ | (GPC2CLK_OUT_BYPDIV31 << GPC2CLK_OUT_BYPDIV_SHIFT)) #define GPC_BCAST_NDIV_SLOWDOWN_DEBUG (GPC_BCASE_GPCPLL_CFG_BASE + 0xa0) #define GPC_BCAST_NDIV_SLOWDOWN_DEBUG_PLL_DYNRAMP_DONE_SYNCED_SHIFT 24 #define GPC_BCAST_NDIV_SLOWDOWN_DEBUG_PLL_DYNRAMP_DONE_SYNCED_MASK \ (0x1 << GPC_BCAST_NDIV_SLOWDOWN_DEBUG_PLL_DYNRAMP_DONE_SYNCED_SHIFT) /* All frequencies in Khz */ struct gk20a_clk_pllg_params { u32 min_vco, max_vco; u32 min_u, max_u; u32 min_m, max_m; u32 min_n, max_n; u32 min_pl, max_pl; }; struct gk20a_pll { u32 m; u32 n; u32 pl; }; void gk20a_pllg_read_mnp(struct nvkm_clk *clk, struct gk20a_pll *pll); #endif