blob: bd9d9ade9037254776b8b438b0af936b038bfcbb [file] [log] [blame]
Tom Warren41b68382011-01-27 10:58:05 +00001/*
2 * (C) Copyright 2010,2011
3 * NVIDIA Corporation <www.nvidia.com>
4 *
5 * See file CREDITS for list of people who contributed to this
6 * project.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21 * MA 02111-1307 USA
22 */
23
24#ifndef _CLK_RST_H_
25#define _CLK_RST_H_
26
Simon Glass16134fd2011-08-30 06:23:13 +000027/* PLL registers - there are several PLLs in the clock controller */
28struct clk_pll {
29 uint pll_base; /* the control register */
30 uint pll_out; /* output control */
31 uint reserved;
32 uint pll_misc; /* other misc things */
33};
34
35/* PLL registers - there are several PLLs in the clock controller */
36struct clk_pll_simple {
37 uint pll_base; /* the control register */
38 uint pll_misc; /* other misc things */
39};
40
41/*
42 * Most PLLs use the clk_pll structure, but some have a simpler two-member
43 * structure for which we use clk_pll_simple. The reason for this non-
44 * othogonal setup is not stated.
45 */
46#define TEGRA_CLK_PLLS 6
47#define TEGRA_CLK_SIMPLE_PLLS 3 /* Number of simple PLLs */
48#define TEGRA_CLK_REGS 3 /* Number of clock enable registers */
49
Tom Warren41b68382011-01-27 10:58:05 +000050/* Clock/Reset Controller (CLK_RST_CONTROLLER_) regs */
51struct clk_rst_ctlr {
Simon Glass16134fd2011-08-30 06:23:13 +000052 uint crc_rst_src; /* _RST_SOURCE_0,0x00 */
53 uint crc_rst_dev[TEGRA_CLK_REGS]; /* _RST_DEVICES_L/H/U_0 */
54 uint crc_clk_out_enb[TEGRA_CLK_REGS]; /* _CLK_OUT_ENB_L/H/U_0 */
Tom Warren41b68382011-01-27 10:58:05 +000055 uint crc_reserved0; /* reserved_0, 0x1C */
56 uint crc_cclk_brst_pol; /* _CCLK_BURST_POLICY_0,0x20 */
57 uint crc_super_cclk_div; /* _SUPER_CCLK_DIVIDER_0,0x24 */
58 uint crc_sclk_brst_pol; /* _SCLK_BURST_POLICY_0, 0x28 */
59 uint crc_super_sclk_div; /* _SUPER_SCLK_DIVIDER_0,0x2C */
60 uint crc_clk_sys_rate; /* _CLK_SYSTEM_RATE_0, 0x30 */
61 uint crc_prog_dly_clk; /* _PROG_DLY_CLK_0, 0x34 */
62 uint crc_aud_sync_clk_rate; /* _AUDIO_SYNC_CLK_RATE_0,0x38 */
63 uint crc_reserved1; /* reserved_1, 0x3C */
64 uint crc_cop_clk_skip_plcy; /* _COP_CLK_SKIP_POLICY_0,0x40 */
65 uint crc_clk_mask_arm; /* _CLK_MASK_ARM_0, 0x44 */
66 uint crc_misc_clk_enb; /* _MISC_CLK_ENB_0, 0x48 */
67 uint crc_clk_cpu_cmplx; /* _CLK_CPU_CMPLX_0, 0x4C */
68 uint crc_osc_ctrl; /* _OSC_CTRL_0, 0x50 */
69 uint crc_pll_lfsr; /* _PLL_LFSR_0, 0x54 */
70 uint crc_osc_freq_det; /* _OSC_FREQ_DET_0, 0x58 */
71 uint crc_osc_freq_det_stat; /* _OSC_FREQ_DET_STATUS_0,0x5C */
72 uint crc_reserved2[8]; /* reserved_2[8], 0x60-7C */
73
Simon Glass16134fd2011-08-30 06:23:13 +000074 struct clk_pll crc_pll[TEGRA_CLK_PLLS]; /* PLLs from 0x80 to 0xdc */
Tom Warren41b68382011-01-27 10:58:05 +000075
Simon Glass16134fd2011-08-30 06:23:13 +000076 /* PLLs from 0xe0 to 0xf4 */
77 struct clk_pll_simple crc_pll_simple[TEGRA_CLK_SIMPLE_PLLS];
Tom Warren41b68382011-01-27 10:58:05 +000078
Tom Warren41b68382011-01-27 10:58:05 +000079 uint crc_reserved10; /* _reserved_10, 0xF8 */
80 uint crc_reserved11; /* _reserved_11, 0xFC */
81
82 uint crc_clk_src_i2s1; /*_I2S1_0, 0x100 */
83 uint crc_clk_src_i2s2; /*_I2S2_0, 0x104 */
84 uint crc_clk_src_spdif_out; /*_SPDIF_OUT_0, 0x108 */
85 uint crc_clk_src_spdif_in; /*_SPDIF_IN_0, 0x10C */
86 uint crc_clk_src_pwm; /*_PWM_0, 0x110 */
87 uint crc_clk_src_spi1; /*_SPI1_0, 0x114 */
88 uint crc_clk_src_sbc2; /*_SBC2_0, 0x118 */
89 uint crc_clk_src_sbc3; /*_SBC3_0, 0x11C */
90 uint crc_clk_src_xio; /*_XIO_0, 0x120 */
91 uint crc_clk_src_i2c1; /*_I2C1_0, 0x124 */
92 uint crc_clk_src_dvc_i2c; /*_DVC_I2C_0, 0x128 */
93 uint crc_clk_src_twc; /*_TWC_0, 0x12C */
94 uint crc_reserved12; /* 0x130 */
95 uint crc_clk_src_sbc1; /*_SBC1_0, 0x134 */
96 uint crc_clk_src_disp1; /*_DISP1_0, 0x138 */
97 uint crc_clk_src_disp2; /*_DISP2_0, 0x13C */
98 uint crc_clk_src_cve; /*_CVE_0, 0x140 */
99 uint crc_clk_src_ide; /*_IDE_0, 0x144 */
100 uint crc_clk_src_vi; /*_VI_0, 0x148 */
101 uint crc_reserved13; /* 0x14C */
102 uint crc_clk_src_sdmmc1; /*_SDMMC1_0, 0x150 */
103 uint crc_clk_src_sdmmc2; /*_SDMMC2_0, 0x154 */
104 uint crc_clk_src_g3d; /*_G3D_0, 0x158 */
105 uint crc_clk_src_g2d; /*_G2D_0, 0x15C */
106 uint crc_clk_src_ndflash; /*_NDFLASH_0, 0x160 */
107 uint crc_clk_src_sdmmc4; /*_SDMMC4_0, 0x164 */
108 uint crc_clk_src_vfir; /*_VFIR_0, 0x168 */
109 uint crc_clk_src_epp; /*_EPP_0, 0x16C */
110 uint crc_clk_src_mp3; /*_MPE_0, 0x170 */
111 uint crc_clk_src_mipi; /*_MIPI_0, 0x174 */
112 uint crc_clk_src_uarta; /*_UARTA_0, 0x178 */
113 uint crc_clk_src_uartb; /*_UARTB_0, 0x17C */
114 uint crc_clk_src_host1x; /*_HOST1X_0, 0x180 */
115 uint crc_reserved14; /* 0x184 */
116 uint crc_clk_src_tvo; /*_TVO_0, 0x188 */
117 uint crc_clk_src_hdmi; /*_HDMI_0, 0x18C */
118 uint crc_reserved15; /* 0x190 */
119 uint crc_clk_src_tvdac; /*_TVDAC_0, 0x194 */
120 uint crc_clk_src_i2c2; /*_I2C2_0, 0x198 */
121 uint crc_clk_src_emc; /*_EMC_0, 0x19C */
122 uint crc_clk_src_uartc; /*_UARTC_0, 0x1A0 */
123 uint crc_reserved16; /* 0x1A4 */
124 uint crc_clk_src_vi_sensor; /*_VI_SENSOR_0, 0x1A8 */
125 uint crc_reserved17; /* 0x1AC */
126 uint crc_reserved18; /* 0x1B0 */
127 uint crc_clk_src_sbc4; /*_SBC4_0, 0x1B4 */
128 uint crc_clk_src_i2c3; /*_I2C3_0, 0x1B8 */
129 uint crc_clk_src_sdmmc3; /*_SDMMC3_0, 0x1BC */
130 uint crc_clk_src_uartd; /*_UARTD_0, 0x1C0 */
131 uint crc_clk_src_uarte; /*_UARTE_0, 0x1C4 */
132 uint crc_clk_src_vde; /*_VDE_0, 0x1C8 */
133 uint crc_clk_src_owr; /*_OWR_0, 0x1CC */
134 uint crc_clk_src_nor; /*_NOR_0, 0x1D0 */
135 uint crc_clk_src_csite; /*_CSITE_0, 0x1D4 */
136 uint crc_reserved19[9]; /* 0x1D8-1F8 */
137 uint crc_clk_src_osc; /*_OSC_0, 0x1FC */
Tom Warren112a1882011-04-14 12:18:06 +0000138 uint crc_reserved20[80]; /* 0x200-33C */
139 uint crc_cpu_cmplx_set; /* _CPU_CMPLX_SET_0, 0x340 */
140 uint crc_cpu_cmplx_clr; /* _CPU_CMPLX_CLR_0, 0x344 */
Tom Warren41b68382011-01-27 10:58:05 +0000141};
142
Simon Glass16134fd2011-08-30 06:23:13 +0000143/* CLK_RST_CONTROLLER_CLK_CPU_CMPLX_0 */
144#define CPU1_CLK_STP_SHIFT 9
145
146#define CPU0_CLK_STP_SHIFT 8
147#define CPU0_CLK_STP_MASK (1U << CPU0_CLK_STP_SHIFT)
148
149/* CLK_RST_CONTROLLER_PLLx_BASE_0 */
150#define PLL_BYPASS_SHIFT 31
151#define PLL_BYPASS_MASK (1U << PLL_BYPASS_SHIFT)
152
153#define PLL_ENABLE_SHIFT 30
154#define PLL_ENABLE_MASK (1U << PLL_ENABLE_SHIFT)
155
156#define PLL_BASE_OVRRIDE_MASK (1U << 28)
157
158#define PLL_DIVP_SHIFT 20
159
160#define PLL_DIVN_SHIFT 8
161
162#define PLL_DIVM_SHIFT 0
163
164/* CLK_RST_CONTROLLER_PLLx_MISC_0 */
165#define PLL_CPCON_SHIFT 8
166#define PLL_CPCON_MASK (15U << PLL_CPCON_SHIFT)
167
168#define PLL_LFCON_SHIFT 4
169
170#define PLLU_VCO_FREQ_SHIFT 20
171
172/* CLK_RST_CONTROLLER_OSC_CTRL_0 */
173#define OSC_FREQ_SHIFT 30
174#define OSC_FREQ_MASK (3U << OSC_FREQ_SHIFT)
Tom Warren85f0ee42011-05-31 10:30:37 +0000175
Tom Warren41b68382011-01-27 10:58:05 +0000176#endif /* CLK_RST_H */