]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - arch/arm/include/asm/arch-am33xx/cpu.h
Unified codebase for TX28, TX48, TX51, TX53
[karo-tx-uboot.git] / arch / arm / include / asm / arch-am33xx / cpu.h
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_ID                       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 #define PRM_RSTCTRL                     0x44E00F00
55 #define PRM_RSTST                       0x44E00F08
56 #define PRM_RSTCTRL_RESET               0x01
57
58 #ifndef __KERNEL_STRICT_NAMES
59 #ifndef __ASSEMBLY__
60 /* Encapsulating core pll registers */
61 struct cm_wkuppll {
62         unsigned int wkclkstctrl;       /* offset 0x00 */
63         unsigned int wkctrlclkctrl;     /* offset 0x04 */
64         unsigned int gpio0clkctrl;
65         unsigned int wkl4wkclkctrl;     /* offset 0x0c */
66         unsigned int resv2[4];
67         unsigned int idlestdpllmpu;     /* offset 0x20 */
68         unsigned int resv3[2];
69         unsigned int clkseldpllmpu;     /* offset 0x2c */
70         unsigned int resv4[1];
71         unsigned int idlestdpllddr;     /* offset 0x34 */
72         unsigned int resv5[2];
73         unsigned int clkseldpllddr;     /* offset 0x40 */
74         unsigned int autoidledplldisp;  /* offset 0x44 */
75         unsigned int idlestdplldisp;    /* offset 0x48 */
76         unsigned int resv6[2];
77         unsigned int clkseldplldisp;    /* offset 0x54 */
78         unsigned int resv7[1];
79         unsigned int idlestdpllcore;    /* offset 0x5c */
80         unsigned int resv8[2];
81         unsigned int clkseldpllcore;    /* offset 0x68 */
82         unsigned int resv9[1];
83         unsigned int idlestdpllper;     /* offset 0x70 */
84         unsigned int resv10[3];
85         unsigned int divm4dpllcore;     /* offset 0x80 */
86         unsigned int divm5dpllcore;     /* offset 0x84 */
87         unsigned int clkmoddpllmpu;     /* offset 0x88 */
88         unsigned int clkmoddpllper;     /* offset 0x8c */
89         unsigned int clkmoddpllcore;    /* offset 0x90 */
90         unsigned int clkmoddpllddr;     /* offset 0x94 */
91         unsigned int clkmoddplldisp;    /* offset 0x98 */
92         unsigned int clkseldpllper;     /* offset 0x9c */
93         unsigned int divm2dpllddr;      /* offset 0xA0 */
94         unsigned int divm2dplldisp;     /* offset 0xA4 */
95         unsigned int divm2dpllmpu;      /* offset 0xA8 */
96         unsigned int divm2dpllper;      /* offset 0xAC */
97         unsigned int resv11[1];
98         unsigned int wkup_uart0ctrl;    /* offset 0xB4 */
99         unsigned int wkup_i2c0ctrl;     /* offset 0xB8 */
100         unsigned int resv12[6];
101         unsigned int wdtimer1ctrl;
102         unsigned int divm6dpllcore;     /* offset 0xD8 */
103 };
104
105 /**
106  * Encapsulating peripheral functional clocks
107  * pll registers
108  */
109 struct cm_perpll {
110         unsigned int l4lsclkstctrl;     /* offset 0x00 */
111         unsigned int l3sclkstctrl;      /* offset 0x04 */
112         unsigned int l4fwclkstctrl;     /* offset 0x08 */
113         unsigned int l3clkstctrl;       /* offset 0x0c */
114         unsigned int resv1;
115         unsigned int cpgmac0clkctrl;    /* offset 0x14 */
116         unsigned int lcdcclkctrl;       /* offset 0x18 */
117         unsigned int usb0clkctrl;       /* offset 0x1c */
118         unsigned int resv2[2];
119         unsigned int emifclkctrl;       /* offset 0x28 */
120         unsigned int ocmcramclkctrl;    /* offset 0x2c */
121         unsigned int gpmcclkctrl;       /* offset 0x30 */
122         unsigned int resv3[1];          /* offset 0x34 */
123         unsigned int uart5clkctrl;      /* offset 0x38 */
124         unsigned int mmc0clkctrl;       /* offset 0x3C */
125         unsigned int elmclkctrl;        /* offset 0x40 */
126         unsigned int i2c2clkctrl;       /* offset 0x44 */
127         unsigned int i2c1clkctrl;       /* offset 0x48 */
128         unsigned int spi0clkctrl;       /* offset 0x4C */
129         unsigned int spi1clkctrl;       /* offset 0x50 */
130         unsigned int resv4[3];
131         unsigned int l4lsclkctrl;       /* offset 0x60 */
132         unsigned int l4fwclkctrl;       /* offset 0x64 */
133         unsigned int mcasp1clkctrl;     /* offset 0x68 */
134         unsigned int uart1clkctrl;      /* offset 0x6c */
135         unsigned int uart2clkctrl;      /* offset 0x70 */
136         unsigned int uart3clkctrl;      /* offset 0x74 */
137         unsigned int uart4clkctrl;      /* offset 0x78 */
138         unsigned int timer7clkctrl;     /* offset 0x7c */
139         unsigned int timer2clkctrl;     /* offset 0x80 */
140         unsigned int resv6[10];
141         unsigned int gpio1clkctrl;      /* offset 0xAC */
142         unsigned int gpio2clkctrl;      /* offset 0xB0 */
143         unsigned int gpio3clkctrl;      /* offset 0xB4 */
144         unsigned int resv7[6];
145         unsigned int emiffwclkctrl;     /* offset 0xD0 */
146         unsigned int resv8[2];
147         unsigned int l3instrclkctrl;    /* offset 0xDC */
148         unsigned int l3clkctrl;         /* Offset 0xE0 */
149         unsigned int resv8a[4];
150         unsigned int mmc1clkctrl;       /* Offset 0xF4 */
151         unsigned int mmc2clkctrl;       /* Offset 0xF8 */
152         unsigned int resv9[8];
153         unsigned int l4hsclkstctrl;     /* offset 0x11C */
154         unsigned int l4hsclkctrl;       /* offset 0x120 */
155         unsigned int resv10[8];
156         unsigned int cpswclkctrl;       /* offset 0x144 */
157 };
158
159 /* Encapsulating Display pll registers */
160 struct cm_dpll {
161         unsigned int resv1[2];
162         unsigned int clktimer2clk;      /* offset 0x08 */
163 };
164
165 /* Watchdog timer registers */
166 struct wd_timer {
167         unsigned int resv1[4];
168         unsigned int wdtwdsc;   /* offset 0x010 */
169         unsigned int wdtwdst;   /* offset 0x014 */
170         unsigned int wdtwisr;   /* offset 0x018 */
171         unsigned int wdtwier;   /* offset 0x01C */
172         unsigned int wdtwwer;   /* offset 0x020 */
173         unsigned int wdtwclr;   /* offset 0x024 */
174         unsigned int wdtwcrr;   /* offset 0x028 */
175         unsigned int wdtwldr;   /* offset 0x02C */
176         unsigned int wdtwtgr;   /* offset 0x030 */
177         unsigned int wdtwwps;   /* offset 0x034 */
178         unsigned int resv2[3];
179         unsigned int wdtwdly;   /* offset 0x044 */
180         unsigned int wdtwspr;   /* offset 0x048 */
181         unsigned int resv3[1];
182         unsigned int wdtwqeoi;  /* offset 0x050 */
183         unsigned int wdtwqstar; /* offset 0x054 */
184         unsigned int wdtwqsta;  /* offset 0x058 */
185         unsigned int wdtwqens;  /* offset 0x05C */
186         unsigned int wdtwqenc;  /* offset 0x060 */
187         unsigned int resv4[39];
188         unsigned int wdt_unfr;  /* offset 0x100 */
189 };
190
191 /* Timer 32 bit registers */
192 struct gptimer {
193         unsigned int tidr;              /* offset 0x00 */
194         unsigned char res1[12];
195         unsigned int tiocp_cfg;         /* offset 0x10 */
196         unsigned char res2[12];
197         unsigned int tier;              /* offset 0x20 */
198         unsigned int tistatr;           /* offset 0x24 */
199         unsigned int tistat;            /* offset 0x28 */
200         unsigned int tisr;              /* offset 0x2c */
201         unsigned int tcicr;             /* offset 0x30 */
202         unsigned int twer;              /* offset 0x34 */
203         unsigned int tclr;              /* offset 0x38 */
204         unsigned int tcrr;              /* offset 0x3c */
205         unsigned int tldr;              /* offset 0x40 */
206         unsigned int ttgr;              /* offset 0x44 */
207         unsigned int twpc;              /* offset 0x48 */
208         unsigned int tmar;              /* offset 0x4c */
209         unsigned int tcar1;             /* offset 0x50 */
210         unsigned int tscir;             /* offset 0x54 */
211         unsigned int tcar2;             /* offset 0x58 */
212 };
213
214 /* UART Registers */
215 struct uart_sys {
216         unsigned int resv1[21];
217         unsigned int uartsyscfg;        /* offset 0x54 */
218         unsigned int uartsyssts;        /* offset 0x58 */
219 };
220
221 /* VTP Registers */
222 struct vtp_reg {
223         unsigned int vtp0ctrlreg;
224 };
225
226 /* Control Status Register */
227 struct ctrl_stat {
228         unsigned int resv1[16];
229         unsigned int statusreg;         /* ofset 0x40 */
230 };
231
232 struct gpmc_cs {
233         u32 config1;            /* 0x00 */
234         u32 config2;            /* 0x04 */
235         u32 config3;            /* 0x08 */
236         u32 config4;            /* 0x0C */
237         u32 config5;            /* 0x10 */
238         u32 config6;            /* 0x14 */
239         u32 config7;            /* 0x18 */
240         u32 nand_cmd;           /* 0x1C */
241         u32 nand_adr;           /* 0x20 */
242         u32 nand_dat;           /* 0x24 */
243         u8 res[8];              /* blow up to 0x30 byte */
244 };
245
246 struct bch_res_0_3 {
247         u32 bch_result_x[4];
248 };
249
250
251
252 struct gpmc {
253         u8 res1[0x10];
254         u32 sysconfig;          /* 0x10 */
255         u8 res2[0x4];
256         u32 irqstatus;          /* 0x18 */
257         u32 irqenable;          /* 0x1C */
258         u8 res3[0x20];
259         u32 timeout_control;    /* 0x40 */
260         u8 res4[0xC];
261         u32 config;             /* 0x50 */
262         u32 status;             /* 0x54 */
263         u8 res5[0x8];           /* 0x58 */
264         struct gpmc_cs cs[8];   /* 0x60, 0x90, .. */
265         u8 res6[0x14];          /* 0x1E0 */
266         u32 ecc_config;         /* 0x1F4 */
267         u32 ecc_control;        /* 0x1F8 */
268         u32 ecc_size_config;    /* 0x1FC */
269         u32 ecc1_result;        /* 0x200 */
270         u32 ecc2_result;        /* 0x204 */
271         u32 ecc3_result;        /* 0x208 */
272         u32 ecc4_result;        /* 0x20C */
273         u32 ecc5_result;        /* 0x210 */
274         u32 ecc6_result;        /* 0x214 */
275         u32 ecc7_result;        /* 0x218 */
276         u32 ecc8_result;        /* 0x21C */
277         u32 ecc9_result;        /* 0x220 */
278         u8 res7[12];            /* 0x224 */
279         u32 testmomde_ctrl;     /* 0x230 */
280         u8 res8[12];            /* 0x234 */
281         struct bch_res_0_3 bch_result_0_3[2];   /* 0x240 */
282 };
283
284 void init_timer(void);
285
286 #define clk_get_rate(c,p)                                       \
287         __clk_get_rate(readl(&(c)->clkseldpll##p),              \
288                 readl(&(c)->divm2dpll##p))
289
290 unsigned long __clk_get_rate(u32 m_n, u32 div_m2);
291
292 #endif /* __ASSEMBLY__ */
293 #endif /* __KERNEL_STRICT_NAMES */
294
295 /* Ethernet MAC ID from EFuse */
296 #define MAC_ID0_LO      (CTRL_BASE + 0x630)
297 #define MAC_ID0_HI      (CTRL_BASE + 0x634)
298 #define MAC_ID1_LO      (CTRL_BASE + 0x638)
299 #define MAC_ID1_HI      (CTRL_BASE + 0x63c)
300 #define MAC_MII_SEL     (CTRL_BASE + 0x650)
301
302 #endif /* _AM33XX_CPU_H */