1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * keystone2: common pll clock definitions
4 * (C) Copyright 2012-2014
5 * Texas Instruments Incorporated, <www.ti.com>
11 #include <asm/arch/hardware.h>
13 /* PLL Control Registers */
49 static struct pllctl_regs *pllctl_regs[] = {
50 (struct pllctl_regs *)(KS2_CLOCK_BASE + 0x100)
53 #define pllctl_reg(pll, reg) (&(pllctl_regs[pll]->reg))
54 #define pllctl_reg_read(pll, reg) __raw_readl(pllctl_reg(pll, reg))
55 #define pllctl_reg_write(pll, reg, val) __raw_writel(val, pllctl_reg(pll, reg))
57 #define pllctl_reg_rmw(pll, reg, mask, val) \
58 pllctl_reg_write(pll, reg, \
59 (pllctl_reg_read(pll, reg) & ~(mask)) | val)
61 #define pllctl_reg_setbits(pll, reg, mask) \
62 pllctl_reg_rmw(pll, reg, 0, mask)
64 #define pllctl_reg_clrbits(pll, reg, mask) \
65 pllctl_reg_rmw(pll, reg, mask, 0)
67 #define pll0div_read(N) ((pllctl_reg_read(CORE_PLL, div##N) & 0xff) + 1)
70 #define PLLCTL_PLLENSRC_SHIF 5
71 #define PLLCTL_PLLENSRC_MASK BIT(5)
72 #define PLLCTL_PLLRST_SHIFT 3
73 #define PLLCTL_PLLRST_MASK BIT(3)
74 #define PLLCTL_PLLPWRDN_SHIFT 1
75 #define PLLCTL_PLLPWRDN_MASK BIT(1)
76 #define PLLCTL_PLLEN_SHIFT 0
77 #define PLLCTL_PLLEN_MASK BIT(0)
80 #define SECCTL_BYPASS_SHIFT 23
81 #define SECCTL_BYPASS_MASK BIT(23)
82 #define SECCTL_OP_DIV_SHIFT 19
83 #define SECCTL_OP_DIV_MASK (0xf << 19)
86 #define PLLM_MULT_LO_SHIFT 0
87 #define PLLM_MULT_LO_MASK 0x3f
88 #define PLLM_MULT_LO_BITS 6
91 #define PLLDIV_ENABLE_SHIFT 15
92 #define PLLDIV_ENABLE_MASK BIT(15)
93 #define PLLDIV_RATIO_SHIFT 0x0
94 #define PLLDIV_RATIO_MASK 0xff
98 #define PLLCMD_GOSET_SHIFT 0
99 #define PLLCMD_GOSET_MASK BIT(0)
102 #define PLLSTAT_GOSTAT_SHIFT 0
103 #define PLLSTAT_GOSTAT_MASK BIT(0)
105 /* Device Config PLLCTL0 */
106 #define CFG_PLLCTL0_BWADJ_SHIFT 24
107 #define CFG_PLLCTL0_BWADJ_MASK (0xff << 24)
108 #define CFG_PLLCTL0_BWADJ_BITS 8
109 #define CFG_PLLCTL0_BYPASS_SHIFT 23
110 #define CFG_PLLCTL0_BYPASS_MASK BIT(23)
111 #define CFG_PLLCTL0_CLKOD_SHIFT 19
112 #define CFG_PLLCTL0_CLKOD_MASK (0xf << 19)
113 #define CFG_PLLCTL0_PLLM_HI_SHIFT 12
114 #define CFG_PLLCTL0_PLLM_HI_MASK (0x7f << 12)
115 #define CFG_PLLCTL0_PLLM_SHIFT 6
116 #define CFG_PLLCTL0_PLLM_MASK (0x1fff << 6)
117 #define CFG_PLLCTL0_PLLD_SHIFT 0
118 #define CFG_PLLCTL0_PLLD_MASK 0x3f
120 /* Device Config PLLCTL1 */
121 #define CFG_PLLCTL1_RST_SHIFT 14
122 #define CFG_PLLCTL1_RST_MASK BIT(14)
123 #define CFG_PLLCTL1_PAPLL_SHIFT 13
124 #define CFG_PLLCTL1_PAPLL_MASK BIT(13)
125 #define CFG_PLLCTL1_ENSAT_SHIFT 6
126 #define CFG_PLLCTL1_ENSAT_MASK BIT(6)
127 #define CFG_PLLCTL1_BWADJ_SHIFT 0
128 #define CFG_PLLCTL1_BWADJ_MASK 0xf
130 #define MISC_CTL1_ARM_PLL_EN BIT(13)
132 #endif /* _CLOCK_DEFS_H_ */