1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * (C) Copyright 2015 Google, Inc
5 * (C) Copyright 2008-2014 Rockchip Electronics
6 * Peter, Software Engineering, <superpeter.cai@gmail.com>.
8 #ifndef _ASM_ARCH_CRU_RK3288_H
9 #define _ASM_ARCH_CRU_RK3288_H
11 #define OSC_HZ (24 * 1000 * 1000)
13 #define APLL_HZ (1800 * 1000000)
14 #define GPLL_HZ (594 * 1000000)
15 #define CPLL_HZ (384 * 1000000)
16 #define NPLL_HZ (384 * 1000000)
18 /* The SRAM is clocked off aclk_bus, so we want to max it out for boot speed */
19 #define PD_BUS_ACLK_HZ 297000000
20 #define PD_BUS_HCLK_HZ 148500000
21 #define PD_BUS_PCLK_HZ 74250000
23 #define PERI_ACLK_HZ 148500000
24 #define PERI_HCLK_HZ 148500000
25 #define PERI_PCLK_HZ 74250000
27 /* Private data for the clock driver - used by rockchip_get_cru() */
28 struct rk3288_clk_priv {
29 struct rk3288_grf *grf;
30 struct rockchip_cru *cru;
43 u32 cru_clksel_con[43];
45 u32 cru_clkgate_con[19];
47 u32 cru_glb_srst_fst_value;
48 u32 cru_glb_srst_snd_value;
49 u32 cru_softrst_con[12];
61 check_member(rockchip_cru, cru_emmc_con[1], 0x021c);
63 /* CRU_CLKSEL11_CON */
65 HSICPHY_DIV_SHIFT = 8,
66 HSICPHY_DIV_MASK = 0x3f << HSICPHY_DIV_SHIFT,
69 MMC0_PLL_MASK = 3 << MMC0_PLL_SHIFT,
70 MMC0_PLL_SELECT_CODEC = 0,
71 MMC0_PLL_SELECT_GENERAL,
72 MMC0_PLL_SELECT_24MHZ,
75 MMC0_DIV_MASK = 0x3f << MMC0_DIV_SHIFT,
80 I2S0_FRAC_DENOM_SHIFT = 0,
81 I2S0_FRAC_DENOM_MASK = 0xffff << I2S0_FRAC_DENOM_SHIFT,
82 I2S0_FRAC_NUMER_SHIFT = 16,
83 I2S0_FRAC_NUMER_MASK = 0xffffu << I2S0_FRAC_NUMER_SHIFT,
86 /* CRU_CLKSEL12_CON */
89 EMMC_PLL_MASK = 3 << EMMC_PLL_SHIFT,
90 EMMC_PLL_SELECT_CODEC = 0,
91 EMMC_PLL_SELECT_GENERAL,
92 EMMC_PLL_SELECT_24MHZ,
95 EMMC_DIV_MASK = 0x3f << EMMC_DIV_SHIFT,
98 SDIO0_PLL_MASK = 3 << SDIO0_PLL_SHIFT,
99 SDIO0_PLL_SELECT_CODEC = 0,
100 SDIO0_PLL_SELECT_GENERAL,
101 SDIO0_PLL_SELECT_24MHZ,
104 SDIO0_DIV_MASK = 0x3f << SDIO0_DIV_SHIFT,
107 /* CRU_CLKSEL21_CON */
109 MAC_DIV_CON_SHIFT = 0xf,
110 MAC_DIV_CON_MASK = 0x1f << MAC_DIV_CON_SHIFT,
112 RMII_EXTCLK_SHIFT = 4,
113 RMII_EXTCLK_MASK = 1 << RMII_EXTCLK_SHIFT,
114 RMII_EXTCLK_SELECT_INT_DIV_CLK = 0,
115 RMII_EXTCLK_SELECT_EXT_CLK = 1,
118 EMAC_PLL_MASK = 0x3 << EMAC_PLL_SHIFT,
119 EMAC_PLL_SELECT_NEW = 0x0,
120 EMAC_PLL_SELECT_CODEC = 0x1,
121 EMAC_PLL_SELECT_GENERAL = 0x2,
124 /* CRU_CLKSEL25_CON */
126 SPI1_PLL_SHIFT = 0xf,
127 SPI1_PLL_MASK = 1 << SPI1_PLL_SHIFT,
128 SPI1_PLL_SELECT_CODEC = 0,
129 SPI1_PLL_SELECT_GENERAL,
132 SPI1_DIV_MASK = 0x7f << SPI1_DIV_SHIFT,
135 SPI0_PLL_MASK = 1 << SPI0_PLL_SHIFT,
136 SPI0_PLL_SELECT_CODEC = 0,
137 SPI0_PLL_SELECT_GENERAL,
140 SPI0_DIV_MASK = 0x7f << SPI0_DIV_SHIFT,
143 /* CRU_CLKSEL37_CON */
145 PCLK_CORE_DBG_DIV_SHIFT = 9,
146 PCLK_CORE_DBG_DIV_MASK = 0x1f << PCLK_CORE_DBG_DIV_SHIFT,
148 ATCLK_CORE_DIV_CON_SHIFT = 4,
149 ATCLK_CORE_DIV_CON_MASK = 0x1f << ATCLK_CORE_DIV_CON_SHIFT,
151 CLK_L2RAM_DIV_SHIFT = 0,
152 CLK_L2RAM_DIV_MASK = 7 << CLK_L2RAM_DIV_SHIFT,
155 /* CRU_CLKSEL39_CON */
157 ACLK_HEVC_PLL_SHIFT = 0xe,
158 ACLK_HEVC_PLL_MASK = 3 << ACLK_HEVC_PLL_SHIFT,
159 ACLK_HEVC_PLL_SELECT_CODEC = 0,
160 ACLK_HEVC_PLL_SELECT_GENERAL,
161 ACLK_HEVC_PLL_SELECT_NEW,
163 ACLK_HEVC_DIV_SHIFT = 8,
164 ACLK_HEVC_DIV_MASK = 0x1f << ACLK_HEVC_DIV_SHIFT,
167 SPI2_PLL_MASK = 1 << SPI2_PLL_SHIFT,
168 SPI2_PLL_SELECT_CODEC = 0,
169 SPI2_PLL_SELECT_GENERAL,
172 SPI2_DIV_MASK = 0x7f << SPI2_DIV_SHIFT,
179 NPLL_MODE_SHIFT = 0xe,
180 NPLL_MODE_MASK = CRU_MODE_MASK << NPLL_MODE_SHIFT,
185 GPLL_MODE_SHIFT = 0xc,
186 GPLL_MODE_MASK = CRU_MODE_MASK << GPLL_MODE_SHIFT,
192 CPLL_MODE_MASK = CRU_MODE_MASK << CPLL_MODE_SHIFT,
198 DPLL_MODE_MASK = CRU_MODE_MASK << DPLL_MODE_SHIFT,
204 APLL_MODE_MASK = CRU_MODE_MASK << APLL_MODE_SHIFT,
213 CLKR_MASK = 0x3f << CLKR_SHIFT,
216 CLKOD_MASK = 0xf << CLKOD_SHIFT,
222 LOCK_MASK = 1 << LOCK_SHIFT,
227 CLKF_MASK = 0x1fff << CLKF_SHIFT,