blob: d6c038e3aec225a46dd13af6ded8e59c1ed621e9 [file] [log] [blame]
Chandan Nath56551082011-10-14 02:58:22 +00001/*
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 */
Chandan Nathf16da742012-01-09 20:38:55 +000054#ifdef CONFIG_AM33XX
Chandan Nath56551082011-10-14 02:58:22 +000055#define PRM_RSTCTRL 0x44E00F00
Lokesh Vutla70239502012-05-29 19:26:41 +000056#define PRM_RSTST 0x44E00F08
Chandan Nath56551082011-10-14 02:58:22 +000057#endif
58#define PRM_RSTCTRL_RESET 0x01
Lokesh Vutla70239502012-05-29 19:26:41 +000059#define PRM_RSTST_WARM_RESET_MASK 0x232
Chandan Nath56551082011-10-14 02:58:22 +000060
61#ifndef __KERNEL_STRICT_NAMES
62#ifndef __ASSEMBLY__
63/* Encapsulating core pll registers */
64struct cm_wkuppll {
65 unsigned int wkclkstctrl; /* offset 0x00 */
66 unsigned int wkctrlclkctrl; /* offset 0x04 */
Tom Rinid88bc042012-05-21 06:46:31 +000067 unsigned int wkgpio0clkctrl; /* offset 0x08 */
Chandan Nath56551082011-10-14 02:58:22 +000068 unsigned int wkl4wkclkctrl; /* offset 0x0c */
69 unsigned int resv2[4];
70 unsigned int idlestdpllmpu; /* offset 0x20 */
71 unsigned int resv3[2];
72 unsigned int clkseldpllmpu; /* offset 0x2c */
73 unsigned int resv4[1];
74 unsigned int idlestdpllddr; /* offset 0x34 */
75 unsigned int resv5[2];
76 unsigned int clkseldpllddr; /* offset 0x40 */
77 unsigned int resv6[4];
78 unsigned int clkseldplldisp; /* offset 0x54 */
79 unsigned int resv7[1];
80 unsigned int idlestdpllcore; /* offset 0x5c */
81 unsigned int resv8[2];
82 unsigned int clkseldpllcore; /* offset 0x68 */
83 unsigned int resv9[1];
84 unsigned int idlestdpllper; /* offset 0x70 */
Ilya Yanok7df5cf32012-11-06 13:48:23 +000085 unsigned int resv10[2];
86 unsigned int clkdcoldodpllper; /* offset 0x7c */
Chandan Nath56551082011-10-14 02:58:22 +000087 unsigned int divm4dpllcore; /* offset 0x80 */
88 unsigned int divm5dpllcore; /* offset 0x84 */
89 unsigned int clkmoddpllmpu; /* offset 0x88 */
90 unsigned int clkmoddpllper; /* offset 0x8c */
91 unsigned int clkmoddpllcore; /* offset 0x90 */
92 unsigned int clkmoddpllddr; /* offset 0x94 */
93 unsigned int clkmoddplldisp; /* offset 0x98 */
94 unsigned int clkseldpllper; /* offset 0x9c */
95 unsigned int divm2dpllddr; /* offset 0xA0 */
96 unsigned int divm2dplldisp; /* offset 0xA4 */
97 unsigned int divm2dpllmpu; /* offset 0xA8 */
98 unsigned int divm2dpllper; /* offset 0xAC */
99 unsigned int resv11[1];
100 unsigned int wkup_uart0ctrl; /* offset 0xB4 */
Patil, Rachnab4116ed2012-01-22 23:47:01 +0000101 unsigned int wkup_i2c0ctrl; /* offset 0xB8 */
102 unsigned int resv12[7];
Chandan Nath56551082011-10-14 02:58:22 +0000103 unsigned int divm6dpllcore; /* offset 0xD8 */
104};
105
106/**
107 * Encapsulating peripheral functional clocks
108 * pll registers
109 */
110struct cm_perpll {
111 unsigned int l4lsclkstctrl; /* offset 0x00 */
112 unsigned int l3sclkstctrl; /* offset 0x04 */
113 unsigned int l4fwclkstctrl; /* offset 0x08 */
114 unsigned int l3clkstctrl; /* offset 0x0c */
Chandan Nathfb072a32012-01-09 20:38:56 +0000115 unsigned int resv1;
116 unsigned int cpgmac0clkctrl; /* offset 0x14 */
Tom Rinid88bc042012-05-21 06:46:31 +0000117 unsigned int lcdclkctrl; /* offset 0x18 */
118 unsigned int usb0clkctrl; /* offset 0x1C */
119 unsigned int resv2;
120 unsigned int tptc0clkctrl; /* offset 0x24 */
Chandan Nath56551082011-10-14 02:58:22 +0000121 unsigned int emifclkctrl; /* offset 0x28 */
122 unsigned int ocmcramclkctrl; /* offset 0x2c */
Chandan Nathfb072a32012-01-09 20:38:56 +0000123 unsigned int gpmcclkctrl; /* offset 0x30 */
Tom Rinid88bc042012-05-21 06:46:31 +0000124 unsigned int mcasp0clkctrl; /* offset 0x34 */
125 unsigned int uart5clkctrl; /* offset 0x38 */
Chandan Nathfb072a32012-01-09 20:38:56 +0000126 unsigned int mmc0clkctrl; /* offset 0x3C */
127 unsigned int elmclkctrl; /* offset 0x40 */
128 unsigned int i2c2clkctrl; /* offset 0x44 */
129 unsigned int i2c1clkctrl; /* offset 0x48 */
130 unsigned int spi0clkctrl; /* offset 0x4C */
131 unsigned int spi1clkctrl; /* offset 0x50 */
Tom Rinid88bc042012-05-21 06:46:31 +0000132 unsigned int resv3[3];
Chandan Nath56551082011-10-14 02:58:22 +0000133 unsigned int l4lsclkctrl; /* offset 0x60 */
134 unsigned int l4fwclkctrl; /* offset 0x64 */
Tom Rinid88bc042012-05-21 06:46:31 +0000135 unsigned int mcasp1clkctrl; /* offset 0x68 */
136 unsigned int uart1clkctrl; /* offset 0x6C */
137 unsigned int uart2clkctrl; /* offset 0x70 */
138 unsigned int uart3clkctrl; /* offset 0x74 */
139 unsigned int uart4clkctrl; /* offset 0x78 */
140 unsigned int timer7clkctrl; /* offset 0x7C */
Chandan Nath56551082011-10-14 02:58:22 +0000141 unsigned int timer2clkctrl; /* offset 0x80 */
Tom Rinid88bc042012-05-21 06:46:31 +0000142 unsigned int timer3clkctrl; /* offset 0x84 */
143 unsigned int timer4clkctrl; /* offset 0x88 */
144 unsigned int resv4[8];
145 unsigned int gpio1clkctrl; /* offset 0xAC */
Chandan Nathfb072a32012-01-09 20:38:56 +0000146 unsigned int gpio2clkctrl; /* offset 0xB0 */
Tom Rinid88bc042012-05-21 06:46:31 +0000147 unsigned int gpio3clkctrl; /* offset 0xB4 */
148 unsigned int resv5;
149 unsigned int tpccclkctrl; /* offset 0xBC */
150 unsigned int dcan0clkctrl; /* offset 0xC0 */
151 unsigned int dcan1clkctrl; /* offset 0xC4 */
152 unsigned int resv6[2];
Chandan Nath56551082011-10-14 02:58:22 +0000153 unsigned int emiffwclkctrl; /* offset 0xD0 */
Tom Rinid88bc042012-05-21 06:46:31 +0000154 unsigned int resv7[2];
Chandan Nath56551082011-10-14 02:58:22 +0000155 unsigned int l3instrclkctrl; /* offset 0xDC */
156 unsigned int l3clkctrl; /* Offset 0xE0 */
Tom Rinid88bc042012-05-21 06:46:31 +0000157 unsigned int resv8[4];
158 unsigned int mmc1clkctrl; /* offset 0xF4 */
159 unsigned int mmc2clkctrl; /* offset 0xF8 */
160 unsigned int resv9[8];
Chandan Nath56551082011-10-14 02:58:22 +0000161 unsigned int l4hsclkstctrl; /* offset 0x11C */
162 unsigned int l4hsclkctrl; /* offset 0x120 */
Chandan Nathfb072a32012-01-09 20:38:56 +0000163 unsigned int resv10[8];
Tom Rinid88bc042012-05-21 06:46:31 +0000164 unsigned int cpswclkstctrl; /* offset 0x144 */
Chandan Nath56551082011-10-14 02:58:22 +0000165};
166
167/* Encapsulating Display pll registers */
168struct cm_dpll {
169 unsigned int resv1[2];
170 unsigned int clktimer2clk; /* offset 0x08 */
171};
172
Vaibhav Hiremath000820b2012-03-08 17:15:47 +0530173/* Control Module RTC registers */
174struct cm_rtc {
175 unsigned int rtcclkctrl; /* offset 0x0 */
176 unsigned int clkstctrl; /* offset 0x4 */
177};
178
Chandan Nath56551082011-10-14 02:58:22 +0000179/* Watchdog timer registers */
180struct wd_timer {
181 unsigned int resv1[4];
182 unsigned int wdtwdsc; /* offset 0x010 */
183 unsigned int wdtwdst; /* offset 0x014 */
184 unsigned int wdtwisr; /* offset 0x018 */
185 unsigned int wdtwier; /* offset 0x01C */
186 unsigned int wdtwwer; /* offset 0x020 */
187 unsigned int wdtwclr; /* offset 0x024 */
188 unsigned int wdtwcrr; /* offset 0x028 */
189 unsigned int wdtwldr; /* offset 0x02C */
190 unsigned int wdtwtgr; /* offset 0x030 */
191 unsigned int wdtwwps; /* offset 0x034 */
192 unsigned int resv2[3];
193 unsigned int wdtwdly; /* offset 0x044 */
194 unsigned int wdtwspr; /* offset 0x048 */
195 unsigned int resv3[1];
196 unsigned int wdtwqeoi; /* offset 0x050 */
197 unsigned int wdtwqstar; /* offset 0x054 */
198 unsigned int wdtwqsta; /* offset 0x058 */
199 unsigned int wdtwqens; /* offset 0x05C */
200 unsigned int wdtwqenc; /* offset 0x060 */
201 unsigned int resv4[39];
202 unsigned int wdt_unfr; /* offset 0x100 */
203};
204
Chandan Nath56551082011-10-14 02:58:22 +0000205/* Timer 32 bit registers */
206struct gptimer {
207 unsigned int tidr; /* offset 0x00 */
Chandan Nathfb072a32012-01-09 20:38:56 +0000208 unsigned char res1[12];
Chandan Nath56551082011-10-14 02:58:22 +0000209 unsigned int tiocp_cfg; /* offset 0x10 */
Chandan Nathfb072a32012-01-09 20:38:56 +0000210 unsigned char res2[12];
Chandan Nath56551082011-10-14 02:58:22 +0000211 unsigned int tier; /* offset 0x20 */
212 unsigned int tistatr; /* offset 0x24 */
213 unsigned int tistat; /* offset 0x28 */
214 unsigned int tisr; /* offset 0x2c */
215 unsigned int tcicr; /* offset 0x30 */
216 unsigned int twer; /* offset 0x34 */
217 unsigned int tclr; /* offset 0x38 */
218 unsigned int tcrr; /* offset 0x3c */
219 unsigned int tldr; /* offset 0x40 */
220 unsigned int ttgr; /* offset 0x44 */
221 unsigned int twpc; /* offset 0x48 */
222 unsigned int tmar; /* offset 0x4c */
223 unsigned int tcar1; /* offset 0x50 */
224 unsigned int tscir; /* offset 0x54 */
225 unsigned int tcar2; /* offset 0x58 */
226};
227
Vaibhav Hiremath000820b2012-03-08 17:15:47 +0530228/* RTC Registers */
229struct rtc_regs {
230 unsigned int res[21];
231 unsigned int osc; /* offset 0x54 */
232 unsigned int res2[5];
233 unsigned int kick0r; /* offset 0x6c */
234 unsigned int kick1r; /* offset 0x70 */
235};
236
Chandan Nath56551082011-10-14 02:58:22 +0000237/* UART Registers */
238struct uart_sys {
239 unsigned int resv1[21];
240 unsigned int uartsyscfg; /* offset 0x54 */
241 unsigned int uartsyssts; /* offset 0x58 */
242};
243
244/* VTP Registers */
245struct vtp_reg {
246 unsigned int vtp0ctrlreg;
247};
248
249/* Control Status Register */
250struct ctrl_stat {
251 unsigned int resv1[16];
252 unsigned int statusreg; /* ofset 0x40 */
Satyanarayana, Sandhya6995a282012-08-09 18:29:57 +0000253 unsigned int resv2[51];
254 unsigned int secure_emif_sdram_config; /* offset 0x0110 */
Chandan Nath56551082011-10-14 02:58:22 +0000255};
Steve Sakoman3b971522012-06-04 05:35:34 +0000256
257/* AM33XX GPIO registers */
258#define OMAP_GPIO_REVISION 0x0000
259#define OMAP_GPIO_SYSCONFIG 0x0010
260#define OMAP_GPIO_SYSSTATUS 0x0114
261#define OMAP_GPIO_IRQSTATUS1 0x002c
262#define OMAP_GPIO_IRQSTATUS2 0x0030
263#define OMAP_GPIO_CTRL 0x0130
264#define OMAP_GPIO_OE 0x0134
265#define OMAP_GPIO_DATAIN 0x0138
266#define OMAP_GPIO_DATAOUT 0x013c
267#define OMAP_GPIO_LEVELDETECT0 0x0140
268#define OMAP_GPIO_LEVELDETECT1 0x0144
269#define OMAP_GPIO_RISINGDETECT 0x0148
270#define OMAP_GPIO_FALLINGDETECT 0x014c
271#define OMAP_GPIO_DEBOUNCE_EN 0x0150
272#define OMAP_GPIO_DEBOUNCE_VAL 0x0154
273#define OMAP_GPIO_CLEARDATAOUT 0x0190
274#define OMAP_GPIO_SETDATAOUT 0x0194
275
Chandan Nathe79cd8e2012-07-24 12:22:17 +0000276/* Control Device Register */
277struct ctrl_dev {
278 unsigned int deviceid; /* offset 0x00 */
Ilya Yanok7df5cf32012-11-06 13:48:23 +0000279 unsigned int resv1[7];
280 unsigned int usb_ctrl0; /* offset 0x20 */
281 unsigned int resv2;
282 unsigned int usb_ctrl1; /* offset 0x28 */
283 unsigned int resv3;
Chandan Nathe79cd8e2012-07-24 12:22:17 +0000284 unsigned int macid0l; /* offset 0x30 */
285 unsigned int macid0h; /* offset 0x34 */
286 unsigned int macid1l; /* offset 0x38 */
287 unsigned int macid1h; /* offset 0x3c */
Ilya Yanok7df5cf32012-11-06 13:48:23 +0000288 unsigned int resv4[4];
Chandan Nathe79cd8e2012-07-24 12:22:17 +0000289 unsigned int miisel; /* offset 0x50 */
290};
Chandan Nath56551082011-10-14 02:58:22 +0000291#endif /* __ASSEMBLY__ */
292#endif /* __KERNEL_STRICT_NAMES */
293
294#endif /* _AM33XX_CPU_H */