1
2
3
4
5
6
7
8
9
10#ifndef _AM33XX_CPU_H
11#define _AM33XX_CPU_H
12
13#if !(defined(__KERNEL_STRICT_NAMES) || defined(__ASSEMBLY__))
14#include <asm/types.h>
15#include <linux/bitops.h>
16#endif
17
18#include <asm/arch/hardware.h>
19
20#define CL_BIT(x) (0 << x)
21
22
23#define TCLR_ST BIT(0)
24#define TCLR_AR BIT(1)
25#define TCLR_PRE BIT(5)
26#define TCLR_PTV_SHIFT (2)
27#define TCLR_PRE_DISABLE CL_BIT(5)
28#define TCLR_CE BIT(6)
29#define TCLR_SCPWM BIT(7)
30#define TCLR_TCM BIT(8)
31#define TCLR_TRG_SHIFT (10)
32#define TCLR_PT BIT(12)
33#define TCLR_CAPTMODE BIT(13)
34#define TCLR_GPOCFG BIT(14)
35
36#define TCFG_RESET BIT(0)
37#define TCFG_EMUFREE BIT(1)
38#define TCFG_IDLEMOD_SHIFT (2)
39
40
41#define AM437X 0xB98C
42#define AM335X 0xB944
43#define TI81XX 0xB81E
44#define DEVICE_ID (CTRL_BASE + 0x0600)
45#define DEVICE_ID_MASK 0x1FFF
46#define PACKAGE_TYPE_SHIFT 16
47#define PACKAGE_TYPE_MASK (3 << 16)
48
49
50#define PACKAGE_TYPE_UNDEFINED 0x0
51#define PACKAGE_TYPE_ZCZ 0x1
52#define PACKAGE_TYPE_ZCE 0x2
53#define PACKAGE_TYPE_RESERVED 0x3
54
55
56#define AM335X_ZCZ_300 0x1FEF
57#define AM335X_ZCZ_600 0x1FAF
58#define AM335X_ZCZ_720 0x1F2F
59#define AM335X_ZCZ_800 0x1E2F
60#define AM335X_ZCZ_1000 0x1C2F
61#define AM335X_ZCE_300 0x1FDF
62#define AM335X_ZCE_600 0x1F9F
63
64
65#define SYSBOOT_MASK (BIT(0) | BIT(1) | BIT(2)\
66 | BIT(3) | BIT(4))
67
68#define PRM_RSTCTRL_RESET 0x01
69#define PRM_RSTST_WARM_RESET_MASK 0x232
70
71
72#define EMIF_CTRL_DEVOFF BIT(0)
73
74#ifndef __KERNEL_STRICT_NAMES
75#ifndef __ASSEMBLY__
76#include <asm/ti-common/omap_wdt.h>
77
78#ifndef CONFIG_AM43XX
79
80struct cm_wkuppll {
81 unsigned int wkclkstctrl;
82 unsigned int wkctrlclkctrl;
83 unsigned int wkgpio0clkctrl;
84 unsigned int wkl4wkclkctrl;
85 unsigned int timer0clkctrl;
86 unsigned int resv2[3];
87 unsigned int idlestdpllmpu;
88 unsigned int sscdeltamstepdllmpu;
89 unsigned int sscmodfreqdivdpllmpu;
90 unsigned int clkseldpllmpu;
91 unsigned int resv4[1];
92 unsigned int idlestdpllddr;
93 unsigned int resv5[2];
94 unsigned int clkseldpllddr;
95 unsigned int resv6[4];
96 unsigned int clkseldplldisp;
97 unsigned int resv7[1];
98 unsigned int idlestdpllcore;
99 unsigned int resv8[2];
100 unsigned int clkseldpllcore;
101 unsigned int resv9[1];
102 unsigned int idlestdpllper;
103 unsigned int resv10[2];
104 unsigned int clkdcoldodpllper;
105 unsigned int divm4dpllcore;
106 unsigned int divm5dpllcore;
107 unsigned int clkmoddpllmpu;
108 unsigned int clkmoddpllper;
109 unsigned int clkmoddpllcore;
110 unsigned int clkmoddpllddr;
111 unsigned int clkmoddplldisp;
112 unsigned int clkseldpllper;
113 unsigned int divm2dpllddr;
114 unsigned int divm2dplldisp;
115 unsigned int divm2dpllmpu;
116 unsigned int divm2dpllper;
117 unsigned int resv11[1];
118 unsigned int wkup_uart0ctrl;
119 unsigned int wkup_i2c0ctrl;
120 unsigned int wkup_adctscctrl;
121 unsigned int resv12;
122 unsigned int timer1clkctrl;
123 unsigned int resv13[4];
124 unsigned int divm6dpllcore;
125};
126
127
128
129
130
131struct cm_perpll {
132 unsigned int l4lsclkstctrl;
133 unsigned int l3sclkstctrl;
134 unsigned int l4fwclkstctrl;
135 unsigned int l3clkstctrl;
136 unsigned int resv1;
137 unsigned int cpgmac0clkctrl;
138 unsigned int lcdclkctrl;
139 unsigned int usb0clkctrl;
140 unsigned int resv2;
141 unsigned int tptc0clkctrl;
142 unsigned int emifclkctrl;
143 unsigned int ocmcramclkctrl;
144 unsigned int gpmcclkctrl;
145 unsigned int mcasp0clkctrl;
146 unsigned int uart5clkctrl;
147 unsigned int mmc0clkctrl;
148 unsigned int elmclkctrl;
149 unsigned int i2c2clkctrl;
150 unsigned int i2c1clkctrl;
151 unsigned int spi0clkctrl;
152 unsigned int spi1clkctrl;
153 unsigned int resv3[3];
154 unsigned int l4lsclkctrl;
155 unsigned int l4fwclkctrl;
156 unsigned int mcasp1clkctrl;
157 unsigned int uart1clkctrl;
158 unsigned int uart2clkctrl;
159 unsigned int uart3clkctrl;
160 unsigned int uart4clkctrl;
161 unsigned int timer7clkctrl;
162 unsigned int timer2clkctrl;
163 unsigned int timer3clkctrl;
164 unsigned int timer4clkctrl;
165 unsigned int resv4[8];
166 unsigned int gpio1clkctrl;
167 unsigned int gpio2clkctrl;
168 unsigned int gpio3clkctrl;
169 unsigned int resv5;
170 unsigned int tpccclkctrl;
171 unsigned int dcan0clkctrl;
172 unsigned int dcan1clkctrl;
173 unsigned int resv6;
174 unsigned int epwmss1clkctrl;
175 unsigned int emiffwclkctrl;
176 unsigned int epwmss0clkctrl;
177 unsigned int epwmss2clkctrl;
178 unsigned int l3instrclkctrl;
179 unsigned int l3clkctrl;
180 unsigned int resv8[2];
181 unsigned int timer5clkctrl;
182 unsigned int timer6clkctrl;
183 unsigned int mmc1clkctrl;
184 unsigned int mmc2clkctrl;
185 unsigned int resv9[8];
186 unsigned int l4hsclkstctrl;
187 unsigned int l4hsclkctrl;
188 unsigned int resv10[8];
189 unsigned int cpswclkstctrl;
190 unsigned int lcdcclkstctrl;
191};
192
193
194struct cm_dpll {
195 unsigned int resv1;
196 unsigned int clktimer7clk;
197 unsigned int clktimer2clk;
198 unsigned int clktimer3clk;
199 unsigned int clktimer4clk;
200 unsigned int resv2;
201 unsigned int clktimer5clk;
202 unsigned int clktimer6clk;
203 unsigned int resv3[2];
204 unsigned int clktimer1clk;
205 unsigned int resv4[2];
206 unsigned int clklcdcpixelclk;
207};
208
209struct prm_device_inst {
210 unsigned int prm_rstctrl;
211 unsigned int prm_rsttime;
212 unsigned int prm_rstst;
213};
214#else
215
216struct cm_wkuppll {
217 unsigned int resv0[136];
218 unsigned int wkl4wkclkctrl;
219 unsigned int resv1[7];
220 unsigned int usbphy0clkctrl;
221 unsigned int resv112;
222 unsigned int usbphy1clkctrl;
223 unsigned int resv113[45];
224 unsigned int wkclkstctrl;
225 unsigned int resv2[15];
226 unsigned int wkup_i2c0ctrl;
227 unsigned int resv3;
228 unsigned int wkup_uart0ctrl;
229 unsigned int resv4[5];
230 unsigned int wkctrlclkctrl;
231 unsigned int resv5;
232 unsigned int wkgpio0clkctrl;
233
234 unsigned int resv6[109];
235 unsigned int clkmoddpllcore;
236 unsigned int idlestdpllcore;
237 unsigned int resv61;
238 unsigned int clkseldpllcore;
239 unsigned int resv7[2];
240 unsigned int divm4dpllcore;
241 unsigned int divm5dpllcore;
242 unsigned int divm6dpllcore;
243
244 unsigned int resv8[7];
245 unsigned int clkmoddpllmpu;
246 unsigned int idlestdpllmpu;
247 unsigned int resv9;
248 unsigned int clkseldpllmpu;
249 unsigned int divm2dpllmpu;
250
251 unsigned int resv10[11];
252 unsigned int clkmoddpllddr;
253 unsigned int idlestdpllddr;
254 unsigned int resv11;
255 unsigned int clkseldpllddr;
256 unsigned int divm2dpllddr;
257
258 unsigned int resv12[11];
259 unsigned int clkmoddpllper;
260 unsigned int idlestdpllper;
261 unsigned int resv13;
262 unsigned int clkseldpllper;
263 unsigned int divm2dpllper;
264 unsigned int resv14[8];
265 unsigned int clkdcoldodpllper;
266
267 unsigned int resv15[2];
268 unsigned int clkmoddplldisp;
269 unsigned int resv16[2];
270 unsigned int clkseldplldisp;
271 unsigned int divm2dplldisp;
272};
273
274
275
276
277
278struct cm_perpll {
279 unsigned int l3clkstctrl;
280 unsigned int resv0[7];
281 unsigned int l3clkctrl;
282 unsigned int resv112[7];
283 unsigned int l3instrclkctrl;
284 unsigned int resv2[3];
285 unsigned int ocmcramclkctrl;
286 unsigned int resv3[9];
287 unsigned int tpccclkctrl;
288 unsigned int resv4;
289 unsigned int tptc0clkctrl;
290
291 unsigned int resv5[7];
292 unsigned int l4hsclkctrl;
293 unsigned int resv6;
294 unsigned int l4fwclkctrl;
295 unsigned int resv7[85];
296 unsigned int l3sclkstctrl;
297 unsigned int resv8[7];
298 unsigned int gpmcclkctrl;
299 unsigned int resv9[5];
300 unsigned int mcasp0clkctrl;
301 unsigned int resv10;
302 unsigned int mcasp1clkctrl;
303 unsigned int resv11;
304 unsigned int mmc2clkctrl;
305 unsigned int resv12[3];
306 unsigned int qspiclkctrl;
307 unsigned int resv121;
308 unsigned int usb0clkctrl;
309 unsigned int resv122;
310 unsigned int usb1clkctrl;
311 unsigned int resv13[101];
312 unsigned int l4lsclkstctrl;
313 unsigned int resv14[7];
314 unsigned int l4lsclkctrl;
315 unsigned int resv15;
316 unsigned int dcan0clkctrl;
317 unsigned int resv16;
318 unsigned int dcan1clkctrl;
319 unsigned int resv17[13];
320 unsigned int elmclkctrl;
321
322 unsigned int resv18[3];
323 unsigned int gpio1clkctrl;
324 unsigned int resv19;
325 unsigned int gpio2clkctrl;
326 unsigned int resv20;
327 unsigned int gpio3clkctrl;
328 unsigned int resv41;
329 unsigned int gpio4clkctrl;
330 unsigned int resv42;
331 unsigned int gpio5clkctrl;
332 unsigned int resv21[3];
333
334 unsigned int i2c1clkctrl;
335 unsigned int resv22;
336 unsigned int i2c2clkctrl;
337 unsigned int resv23[3];
338 unsigned int mmc0clkctrl;
339 unsigned int resv24;
340 unsigned int mmc1clkctrl;
341
342 unsigned int resv25[13];
343 unsigned int spi0clkctrl;
344 unsigned int resv26;
345 unsigned int spi1clkctrl;
346 unsigned int resv27[9];
347 unsigned int timer2clkctrl;
348 unsigned int resv28;
349 unsigned int timer3clkctrl;
350 unsigned int resv29;
351 unsigned int timer4clkctrl;
352 unsigned int resv30[5];
353 unsigned int timer7clkctrl;
354
355 unsigned int resv31[9];
356 unsigned int uart1clkctrl;
357 unsigned int resv32;
358 unsigned int uart2clkctrl;
359 unsigned int resv33;
360 unsigned int uart3clkctrl;
361 unsigned int resv34;
362 unsigned int uart4clkctrl;
363 unsigned int resv35;
364 unsigned int uart5clkctrl;
365 unsigned int resv36[5];
366 unsigned int usbphyocp2scp0clkctrl;
367 unsigned int resv361;
368 unsigned int usbphyocp2scp1clkctrl;
369 unsigned int resv3611[79];
370
371 unsigned int emifclkstctrl;
372 unsigned int resv362[7];
373 unsigned int emifclkctrl;
374 unsigned int resv37[3];
375 unsigned int emiffwclkctrl;
376 unsigned int resv371;
377 unsigned int otfaemifclkctrl;
378 unsigned int resv38[57];
379 unsigned int lcdclkctrl;
380 unsigned int resv39[183];
381 unsigned int cpswclkstctrl;
382 unsigned int resv40[7];
383 unsigned int cpgmac0clkctrl;
384};
385
386struct cm_device_inst {
387 unsigned int cm_clkout1_ctrl;
388 unsigned int cm_dll_ctrl;
389};
390
391struct prm_device_inst {
392 unsigned int rstctrl;
393 unsigned int rstst;
394 unsigned int rsttime;
395 unsigned int sram_count;
396 unsigned int ldo_sram_core_set;
397 unsigned int ldo_sram_core_ctr;
398 unsigned int ldo_sram_mpu_setu;
399 unsigned int ldo_sram_mpu_ctrl;
400 unsigned int io_count;
401 unsigned int io_pmctrl;
402 unsigned int vc_val_bypass;
403 unsigned int resv1;
404 unsigned int emif_ctrl;
405};
406
407struct cm_dpll {
408 unsigned int resv1;
409 unsigned int clktimer2clk;
410 unsigned int resv2[11];
411 unsigned int clkselmacclk;
412};
413#endif
414
415
416struct cm_rtc {
417 unsigned int rtcclkctrl;
418 unsigned int clkstctrl;
419};
420
421
422struct gptimer {
423 unsigned int tidr;
424 unsigned char res1[12];
425 unsigned int tiocp_cfg;
426 unsigned char res2[12];
427 unsigned int tier;
428 unsigned int tistatr;
429 unsigned int tistat;
430 unsigned int tisr;
431 unsigned int tcicr;
432 unsigned int twer;
433 unsigned int tclr;
434 unsigned int tcrr;
435 unsigned int tldr;
436 unsigned int ttgr;
437 unsigned int twpc;
438 unsigned int tmar;
439 unsigned int tcar1;
440 unsigned int tscir;
441 unsigned int tcar2;
442};
443
444
445struct uart_sys {
446 unsigned int resv1[21];
447 unsigned int uartsyscfg;
448 unsigned int uartsyssts;
449};
450
451
452struct vtp_reg {
453 unsigned int vtp0ctrlreg;
454};
455
456
457struct ctrl_stat {
458 unsigned int resv1[16];
459 unsigned int statusreg;
460 unsigned int resv2[51];
461 unsigned int secure_emif_sdram_config;
462 unsigned int resv3[319];
463 unsigned int dev_attr;
464};
465
466
467#define OMAP_GPIO_REVISION 0x0000
468#define OMAP_GPIO_SYSCONFIG 0x0010
469#define OMAP_GPIO_SYSSTATUS 0x0114
470#define OMAP_GPIO_IRQSTATUS1 0x002c
471#define OMAP_GPIO_IRQSTATUS2 0x0030
472#define OMAP_GPIO_IRQSTATUS_SET_0 0x0034
473#define OMAP_GPIO_IRQSTATUS_SET_1 0x0038
474#define OMAP_GPIO_CTRL 0x0130
475#define OMAP_GPIO_OE 0x0134
476#define OMAP_GPIO_DATAIN 0x0138
477#define OMAP_GPIO_DATAOUT 0x013c
478#define OMAP_GPIO_LEVELDETECT0 0x0140
479#define OMAP_GPIO_LEVELDETECT1 0x0144
480#define OMAP_GPIO_RISINGDETECT 0x0148
481#define OMAP_GPIO_FALLINGDETECT 0x014c
482#define OMAP_GPIO_DEBOUNCE_EN 0x0150
483#define OMAP_GPIO_DEBOUNCE_VAL 0x0154
484#define OMAP_GPIO_CLEARDATAOUT 0x0190
485#define OMAP_GPIO_SETDATAOUT 0x0194
486
487
488
489
490#define MREQPRIO_0_SAB_INIT1_MASK 0xFFFFFF8F
491#define MREQPRIO_0_SAB_INIT0_MASK 0xFFFFFFF8
492#define MREQPRIO_1_DSS_MASK 0xFFFFFF8F
493
494struct ctrl_dev {
495 unsigned int deviceid;
496 unsigned int resv1[7];
497 unsigned int usb_ctrl0;
498 unsigned int resv2;
499 unsigned int usb_ctrl1;
500 unsigned int resv3;
501 unsigned int macid0l;
502 unsigned int macid0h;
503 unsigned int macid1l;
504 unsigned int macid1h;
505 unsigned int resv4[4];
506 unsigned int miisel;
507 unsigned int resv5[7];
508 unsigned int mreqprio_0;
509 unsigned int mreqprio_1;
510 unsigned int resv6[97];
511 unsigned int efuse_sma;
512};
513
514
515#define BW_LIMITER_BW_FRAC_MASK 0xFFFFFFE0
516#define BW_LIMITER_BW_INT_MASK 0xFFFFFFF0
517#define BW_LIMITER_BW_WATERMARK_MASK 0xFFFFF800
518
519struct l3f_cfg_bwlimiter {
520 u32 padding0[2];
521 u32 modena_init0_bw_fractional;
522 u32 modena_init0_bw_integer;
523 u32 modena_init0_watermark_0;
524};
525
526
527#define GMII1_SEL_MII 0x0
528#define GMII1_SEL_RMII 0x1
529#define GMII1_SEL_RGMII 0x2
530#define GMII2_SEL_MII 0x0
531#define GMII2_SEL_RMII 0x4
532#define GMII2_SEL_RGMII 0x8
533#define RGMII1_IDMODE BIT(4)
534#define RGMII2_IDMODE BIT(5)
535#define RMII1_IO_CLK_EN BIT(6)
536#define RMII2_IO_CLK_EN BIT(7)
537
538#define MII_MODE_ENABLE (GMII1_SEL_MII | GMII2_SEL_MII)
539#define RMII_MODE_ENABLE (GMII1_SEL_RMII | GMII2_SEL_RMII)
540#define RGMII_MODE_ENABLE (GMII1_SEL_RGMII | GMII2_SEL_RGMII)
541#define RGMII_INT_DELAY (RGMII1_IDMODE | RGMII2_IDMODE)
542#define RMII_CHIPCKL_ENABLE (RMII1_IO_CLK_EN | RMII2_IO_CLK_EN)
543
544
545struct pwmss_regs {
546 unsigned int idver;
547 unsigned int sysconfig;
548 unsigned int clkconfig;
549 unsigned int clkstatus;
550};
551#define ECAP_CLK_EN BIT(0)
552#define ECAP_CLK_STOP_REQ BIT(1)
553#define EPWM_CLK_EN BIT(8)
554#define EPWM_CLK_STOP_REQ BIT(9)
555
556struct pwmss_ecap_regs {
557 unsigned int tsctr;
558 unsigned int ctrphs;
559 unsigned int cap1;
560 unsigned int cap2;
561 unsigned int cap3;
562 unsigned int cap4;
563 unsigned int resv1[4];
564 unsigned short ecctl1;
565 unsigned short ecctl2;
566};
567
568struct pwmss_epwm_regs {
569 unsigned short tbctl;
570 unsigned short tbsts;
571 unsigned short tbphshr;
572 unsigned short tbphs;
573 unsigned short tbcnt;
574 unsigned short tbprd;
575 unsigned short res1;
576 unsigned short cmpctl;
577 unsigned short cmpahr;
578 unsigned short cmpa;
579 unsigned short cmpb;
580 unsigned short aqctla;
581 unsigned short aqctlb;
582 unsigned short aqsfrc;
583 unsigned short aqcsfrc;
584 unsigned short dbctl;
585 unsigned short dbred;
586 unsigned short dbfed;
587 unsigned short tzsel;
588 unsigned short tzctl;
589 unsigned short tzflg;
590 unsigned short tzclr;
591 unsigned short tzfrc;
592 unsigned short etsel;
593 unsigned short etps;
594 unsigned short etflg;
595 unsigned short etclr;
596 unsigned short etfrc;
597 unsigned short pcctl;
598 unsigned int res2[66];
599 unsigned short hrcnfg;
600};
601
602
603#define ECTRL2_SYNCOSEL_MASK (0x03 << 6)
604#define ECTRL2_MDSL_ECAP BIT(9)
605#define ECTRL2_CTRSTP_FREERUN BIT(4)
606#define ECTRL2_PLSL_LOW BIT(10)
607#define ECTRL2_SYNC_EN BIT(5)
608
609#endif
610#endif
611
612#endif
613