xref: /rk3399_rockchip-uboot/arch/arm/include/asm/arch-am33xx/cpu.h (revision fb072a3ead8cc9f4a5e236a4b424e4df16f5e5ef)
1 /*
2  * cpu.h
3  *
4  * AM33xx specific header file
5  *
6  * Copyright (C) 2011, Texas Instruments, Incorporated - http://www.ti.com/
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 
19 #ifndef _AM33XX_CPU_H
20 #define _AM33XX_CPU_H
21 
22 #if !(defined(__KERNEL_STRICT_NAMES) || defined(__ASSEMBLY__))
23 #include <asm/types.h>
24 #endif /* !(__KERNEL_STRICT_NAMES || __ASSEMBLY__) */
25 
26 #include <asm/arch/hardware.h>
27 
28 #define BIT(x)				(1 << x)
29 #define CL_BIT(x)			(0 << x)
30 
31 /* Timer register bits */
32 #define TCLR_ST				BIT(0)	/* Start=1 Stop=0 */
33 #define TCLR_AR				BIT(1)	/* Auto reload */
34 #define TCLR_PRE			BIT(5)	/* Pre-scaler enable */
35 #define TCLR_PTV_SHIFT			(2)	/* Pre-scaler shift value */
36 #define TCLR_PRE_DISABLE		CL_BIT(5) /* Pre-scalar disable */
37 
38 /* device type */
39 #define DEVICE_MASK			(BIT(8) | BIT(9) | BIT(10))
40 #define TST_DEVICE			0x0
41 #define EMU_DEVICE			0x1
42 #define HS_DEVICE			0x2
43 #define GP_DEVICE			0x3
44 
45 /* cpu-id for AM33XX family */
46 #define AM335X				0xB944
47 #define DEVICE_ID			0x44E10600
48 
49 /* This gives the status of the boot mode pins on the evm */
50 #define SYSBOOT_MASK			(BIT(0) | BIT(1) | BIT(2)\
51 					| BIT(3) | BIT(4))
52 
53 /* Reset control */
54 #ifdef CONFIG_AM33XX
55 #define PRM_RSTCTRL			0x44E00F00
56 #endif
57 #define PRM_RSTCTRL_RESET		0x01
58 
59 #ifndef __KERNEL_STRICT_NAMES
60 #ifndef __ASSEMBLY__
61 /* Encapsulating core pll registers */
62 struct cm_wkuppll {
63 	unsigned int wkclkstctrl;	/* offset 0x00 */
64 	unsigned int wkctrlclkctrl;	/* offset 0x04 */
65 	unsigned int resv1[1];
66 	unsigned int wkl4wkclkctrl;	/* offset 0x0c */
67 	unsigned int resv2[4];
68 	unsigned int idlestdpllmpu;	/* offset 0x20 */
69 	unsigned int resv3[2];
70 	unsigned int clkseldpllmpu;	/* offset 0x2c */
71 	unsigned int resv4[1];
72 	unsigned int idlestdpllddr;	/* offset 0x34 */
73 	unsigned int resv5[2];
74 	unsigned int clkseldpllddr;	/* offset 0x40 */
75 	unsigned int resv6[4];
76 	unsigned int clkseldplldisp;	/* offset 0x54 */
77 	unsigned int resv7[1];
78 	unsigned int idlestdpllcore;	/* offset 0x5c */
79 	unsigned int resv8[2];
80 	unsigned int clkseldpllcore;	/* offset 0x68 */
81 	unsigned int resv9[1];
82 	unsigned int idlestdpllper;	/* offset 0x70 */
83 	unsigned int resv10[3];
84 	unsigned int divm4dpllcore;	/* offset 0x80 */
85 	unsigned int divm5dpllcore;	/* offset 0x84 */
86 	unsigned int clkmoddpllmpu;	/* offset 0x88 */
87 	unsigned int clkmoddpllper;	/* offset 0x8c */
88 	unsigned int clkmoddpllcore;	/* offset 0x90 */
89 	unsigned int clkmoddpllddr;	/* offset 0x94 */
90 	unsigned int clkmoddplldisp;	/* offset 0x98 */
91 	unsigned int clkseldpllper;	/* offset 0x9c */
92 	unsigned int divm2dpllddr;	/* offset 0xA0 */
93 	unsigned int divm2dplldisp;	/* offset 0xA4 */
94 	unsigned int divm2dpllmpu;	/* offset 0xA8 */
95 	unsigned int divm2dpllper;	/* offset 0xAC */
96 	unsigned int resv11[1];
97 	unsigned int wkup_uart0ctrl;	/* offset 0xB4 */
98 	unsigned int resv12[8];
99 	unsigned int divm6dpllcore;	/* offset 0xD8 */
100 };
101 
102 /**
103  * Encapsulating peripheral functional clocks
104  * pll registers
105  */
106 struct cm_perpll {
107 	unsigned int l4lsclkstctrl;	/* offset 0x00 */
108 	unsigned int l3sclkstctrl;	/* offset 0x04 */
109 	unsigned int l4fwclkstctrl;	/* offset 0x08 */
110 	unsigned int l3clkstctrl;	/* offset 0x0c */
111 	unsigned int resv1;
112 	unsigned int cpgmac0clkctrl;	/* offset 0x14 */
113 	unsigned int resv2[4];
114 	unsigned int emifclkctrl;	/* offset 0x28 */
115 	unsigned int ocmcramclkctrl;	/* offset 0x2c */
116 	unsigned int gpmcclkctrl;	/* offset 0x30 */
117 	unsigned int resv3[2];
118 	unsigned int mmc0clkctrl;	/* offset 0x3C */
119 	unsigned int elmclkctrl;	/* offset 0x40 */
120 	unsigned int i2c2clkctrl;	/* offset 0x44 */
121 	unsigned int i2c1clkctrl;	/* offset 0x48 */
122 	unsigned int spi0clkctrl;	/* offset 0x4C */
123 	unsigned int spi1clkctrl;	/* offset 0x50 */
124 	unsigned int resv4[3];
125 	unsigned int l4lsclkctrl;	/* offset 0x60 */
126 	unsigned int l4fwclkctrl;	/* offset 0x64 */
127 	unsigned int resv5[6];
128 	unsigned int timer2clkctrl;	/* offset 0x80 */
129 	unsigned int resv6[11];
130 	unsigned int gpio2clkctrl;	/* offset 0xB0 */
131 	unsigned int resv7[7];
132 	unsigned int emiffwclkctrl;	/* offset 0xD0 */
133 	unsigned int resv8[2];
134 	unsigned int l3instrclkctrl;	/* offset 0xDC */
135 	unsigned int l3clkctrl;		/* Offset 0xE0 */
136 	unsigned int resv9[14];
137 	unsigned int l4hsclkstctrl;	/* offset 0x11C */
138 	unsigned int l4hsclkctrl;	/* offset 0x120 */
139 	unsigned int resv10[8];
140 	unsigned int cpswclkctrl;	/* offset 0x144 */
141 };
142 
143 /* Encapsulating Display pll registers */
144 struct cm_dpll {
145 	unsigned int resv1[2];
146 	unsigned int clktimer2clk;	/* offset 0x08 */
147 };
148 
149 /* Watchdog timer registers */
150 struct wd_timer {
151 	unsigned int resv1[4];
152 	unsigned int wdtwdsc;	/* offset 0x010 */
153 	unsigned int wdtwdst;	/* offset 0x014 */
154 	unsigned int wdtwisr;	/* offset 0x018 */
155 	unsigned int wdtwier;	/* offset 0x01C */
156 	unsigned int wdtwwer;	/* offset 0x020 */
157 	unsigned int wdtwclr;	/* offset 0x024 */
158 	unsigned int wdtwcrr;	/* offset 0x028 */
159 	unsigned int wdtwldr;	/* offset 0x02C */
160 	unsigned int wdtwtgr;	/* offset 0x030 */
161 	unsigned int wdtwwps;	/* offset 0x034 */
162 	unsigned int resv2[3];
163 	unsigned int wdtwdly;	/* offset 0x044 */
164 	unsigned int wdtwspr;	/* offset 0x048 */
165 	unsigned int resv3[1];
166 	unsigned int wdtwqeoi;	/* offset 0x050 */
167 	unsigned int wdtwqstar;	/* offset 0x054 */
168 	unsigned int wdtwqsta;	/* offset 0x058 */
169 	unsigned int wdtwqens;	/* offset 0x05C */
170 	unsigned int wdtwqenc;	/* offset 0x060 */
171 	unsigned int resv4[39];
172 	unsigned int wdt_unfr;	/* offset 0x100 */
173 };
174 
175 /* Timer 32 bit registers */
176 struct gptimer {
177 	unsigned int tidr;		/* offset 0x00 */
178 	unsigned char res1[12];
179 	unsigned int tiocp_cfg;		/* offset 0x10 */
180 	unsigned char res2[12];
181 	unsigned int tier;		/* offset 0x20 */
182 	unsigned int tistatr;		/* offset 0x24 */
183 	unsigned int tistat;		/* offset 0x28 */
184 	unsigned int tisr;		/* offset 0x2c */
185 	unsigned int tcicr;		/* offset 0x30 */
186 	unsigned int twer;		/* offset 0x34 */
187 	unsigned int tclr;		/* offset 0x38 */
188 	unsigned int tcrr;		/* offset 0x3c */
189 	unsigned int tldr;		/* offset 0x40 */
190 	unsigned int ttgr;		/* offset 0x44 */
191 	unsigned int twpc;		/* offset 0x48 */
192 	unsigned int tmar;		/* offset 0x4c */
193 	unsigned int tcar1;		/* offset 0x50 */
194 	unsigned int tscir;		/* offset 0x54 */
195 	unsigned int tcar2;		/* offset 0x58 */
196 };
197 
198 /* UART Registers */
199 struct uart_sys {
200 	unsigned int resv1[21];
201 	unsigned int uartsyscfg;	/* offset 0x54 */
202 	unsigned int uartsyssts;	/* offset 0x58 */
203 };
204 
205 /* VTP Registers */
206 struct vtp_reg {
207 	unsigned int vtp0ctrlreg;
208 };
209 
210 /* Control Status Register */
211 struct ctrl_stat {
212 	unsigned int resv1[16];
213 	unsigned int statusreg;		/* ofset 0x40 */
214 };
215 
216 void init_timer(void);
217 #endif /* __ASSEMBLY__ */
218 #endif /* __KERNEL_STRICT_NAMES */
219 
220 #endif /* _AM33XX_CPU_H */
221