xref: /minix3/minix/kernel/arch/earm/bsp/ti/omap_timer_registers.h (revision 222afb38ac2ffd175d501786a8456d2269c52ffb)
1433d6423SLionel Sambuc #ifndef _OMAP_TIMER_REGISTERS_H
2433d6423SLionel Sambuc #define _OMAP_TIMER_REGISTERS_H
3433d6423SLionel Sambuc 
4433d6423SLionel Sambuc 
5433d6423SLionel Sambuc /* General-purpose timer register map */
6433d6423SLionel Sambuc #define OMAP3_GPTIMER1_BASE  0x48318000 /* GPTIMER1 physical address */
7433d6423SLionel Sambuc #define OMAP3_GPTIMER2_BASE  0x49032000 /* GPTIMER2 physical address */
8433d6423SLionel Sambuc #define OMAP3_GPTIMER3_BASE  0x49034000 /* GPTIMER3 physical address */
9433d6423SLionel Sambuc #define OMAP3_GPTIMER4_BASE  0x49036000 /* GPTIMER4 physical address */
10433d6423SLionel Sambuc #define OMAP3_GPTIMER5_BASE  0x49038000 /* GPTIMER5 physical address */
11433d6423SLionel Sambuc #define OMAP3_GPTIMER6_BASE  0x4903A000 /* GPTIMER6 physical address */
12433d6423SLionel Sambuc #define OMAP3_GPTIMER7_BASE  0x4903C000 /* GPTIMER7 physical address */
13433d6423SLionel Sambuc #define OMAP3_GPTIMER8_BASE  0x4903E000 /* GPTIMER8 physical address */
14433d6423SLionel Sambuc #define OMAP3_GPTIMER9_BASE  0x49040000 /* GPTIMER9 physical address */
15433d6423SLionel Sambuc #define OMAP3_GPTIMER10_BASE 0x48086000 /* GPTIMER10 physical address */
16433d6423SLionel Sambuc #define OMAP3_GPTIMER11_BASE 0x48088000 /* GPTIMER11 physical address */
17433d6423SLionel Sambuc 
18433d6423SLionel Sambuc 
19433d6423SLionel Sambuc /* General-purpose timer registers */
20433d6423SLionel Sambuc #define OMAP3_TIMER_TIDR      0x000 /* IP revision code */
21433d6423SLionel Sambuc #define OMAP3_TIMER_TIOCP_CFG 0x010 /* Controls params for GP timer L4 interface */
22433d6423SLionel Sambuc #define OMAP3_TIMER_TISTAT    0x014 /* Status (excl. interrupt status) */
23433d6423SLionel Sambuc #define OMAP3_TIMER_TISR      0x018 /* Pending interrupt status */
24433d6423SLionel Sambuc #define OMAP3_TIMER_TIER      0x01C /* Interrupt enable */
25433d6423SLionel Sambuc #define OMAP3_TIMER_TWER      0x020 /* Wakeup enable */
26433d6423SLionel Sambuc #define OMAP3_TIMER_TCLR      0x024 /* Controls optional features */
27433d6423SLionel Sambuc #define OMAP3_TIMER_TCRR      0x028 /* Internal counter value */
28433d6423SLionel Sambuc #define OMAP3_TIMER_TLDR      0x02C /* Timer load value */
29433d6423SLionel Sambuc #define OMAP3_TIMER_TTGR      0x030 /* Triggers counter reload */
30433d6423SLionel Sambuc #define OMAP3_TIMER_TWPS      0x034 /* Indicates if Write-Posted pending */
31433d6423SLionel Sambuc #define OMAP3_TIMER_TMAR      0x038 /* Value to be compared with counter */
32433d6423SLionel Sambuc #define OMAP3_TIMER_TCAR1     0x03C /* First captured value of counter register */
33433d6423SLionel Sambuc #define OMAP3_TIMER_TSICR     0x040 /* Control posted mode and functional SW reset */
34433d6423SLionel Sambuc #define OMAP3_TIMER_TCAR2     0x044 /* Second captured value of counter register */
35433d6423SLionel Sambuc #define OMAP3_TIMER_TPIR      0x048 /* Positive increment (1 ms tick) */
36433d6423SLionel Sambuc #define OMAP3_TIMER_TNIR      0x04C /* Negative increment (1 ms tick) */
37433d6423SLionel Sambuc #define OMAP3_TIMER_TCVR      0x050 /* Defines TCRR is sub/over-period (1 ms tick) */
38433d6423SLionel Sambuc #define OMAP3_TIMER_TOCR      0x054 /* Masks tick interrupt */
39433d6423SLionel Sambuc #define OMAP3_TIMER_TOWR      0x058 /* Number of masked overflow interrupts */
40433d6423SLionel Sambuc 
41433d6423SLionel Sambuc #define AM335X_DMTIMER0_BASE      0x44E05000  /* DMTimer0 Registers */
42433d6423SLionel Sambuc #define AM335X_DMTIMER1_1MS_BASE  0x44E31000 /* DMTimer1 1ms Registers (Accurate 1ms timer) */
43433d6423SLionel Sambuc #define AM335X_DMTIMER2_BASE      0x48040000 /*  DMTimer2 Registers */
44433d6423SLionel Sambuc #define AM335X_DMTIMER3_BASE      0x48042000 /*  DMTimer3 Registers */
45433d6423SLionel Sambuc #define AM335X_DMTIMER4_BASE      0x48044000 /* DMTimer4 Registers  */
46433d6423SLionel Sambuc #define AM335X_DMTIMER5_BASE      0x48046000 /* DMTimer5 Registers  */
47433d6423SLionel Sambuc #define AM335X_DMTIMER6_BASE      0x48048000 /*  DMTimer6 Registers */
48433d6423SLionel Sambuc #define AM335X_DMTIMER7_BASE      0x4804A000 /*  DMTimer7 Registers */
49433d6423SLionel Sambuc 
50433d6423SLionel Sambuc /* General-purpose timer registers  AM335x non 1MS timers have different offsets */
51433d6423SLionel Sambuc #define AM335X_TIMER_TIDR             0x000 /* IP revision code */
52433d6423SLionel Sambuc #define AM335X_TIMER_TIOCP_CFG        0x010 /* Controls params for GP timer L4 interface */
53433d6423SLionel Sambuc #define AM335X_TIMER_IRQSTATUS_RAW    0x024 /* Timer IRQSTATUS Raw Register */
54433d6423SLionel Sambuc #define AM335X_TIMER_IRQSTATUS        0x028 /* Timer IRQSTATUS Register */
55433d6423SLionel Sambuc #define AM335X_TIMER_IRQENABLE_SET    0x02C /* Timer IRQENABLE Set Register */
56433d6423SLionel Sambuc #define AM335X_TIMER_IRQENABLE_CLR    0x030 /* Timer IRQENABLE Clear Register */
57433d6423SLionel Sambuc #define AM335X_TIMER_IRQWAKEEN        0x034 /* Timer IRQ Wakeup Enable Register */
58433d6423SLionel Sambuc #define AM335X_TIMER_TCLR      0x038 /* Controls optional features */
59433d6423SLionel Sambuc #define AM335X_TIMER_TCRR      0x03C /* Internal counter value */
60433d6423SLionel Sambuc #define AM335X_TIMER_TLDR      0x040 /* Timer load value */
61433d6423SLionel Sambuc #define AM335X_TIMER_TTGR      0x044 /* Triggers counter reload */
62433d6423SLionel Sambuc #define AM335X_TIMER_TWPS      0x048 /* Indicates if Write-Posted pending */
63433d6423SLionel Sambuc #define AM335X_TIMER_TMAR      0x04C /* Value to be compared with counter */
64433d6423SLionel Sambuc #define AM335X_TIMER_TCAR1     0x050 /* First captured value of counter register */
65433d6423SLionel Sambuc #define AM335X_TIMER_TSICR     0x054 /* Control posted mode and functional SW reset */
66433d6423SLionel Sambuc #define AM335X_TIMER_TCAR2     0x058 /* Second captured value of counter register */
67433d6423SLionel Sambuc 
68*222afb38SBen Gras #define AM335X_WDT_BASE		0x44E35000	/* watchdog timer */
69*222afb38SBen Gras #define AM335X_WDT_WWPS		0x34		/* command posted status */
70*222afb38SBen Gras #define AM335X_WDT_WSPR		0x48		/* activate/deactivate sequence */
71433d6423SLionel Sambuc 
72433d6423SLionel Sambuc /* Interrupt status register fields */
73433d6423SLionel Sambuc #define OMAP3_TISR_MAT_IT_FLAG  (1 << 0) /* Pending match interrupt status */
74433d6423SLionel Sambuc #define OMAP3_TISR_OVF_IT_FLAG  (1 << 1) /* Pending overflow interrupt status */
75433d6423SLionel Sambuc #define OMAP3_TISR_TCAR_IT_FLAG (1 << 2) /* Pending capture interrupt status */
76433d6423SLionel Sambuc 
77433d6423SLionel Sambuc /* Interrupt enable register fields */
78433d6423SLionel Sambuc #define OMAP3_TIER_MAT_IT_ENA  (1 << 0) /* Enable match interrupt */
79433d6423SLionel Sambuc #define OMAP3_TIER_OVF_IT_ENA  (1 << 1) /* Enable overflow interrupt */
80433d6423SLionel Sambuc #define OMAP3_TIER_TCAR_IT_ENA (1 << 2) /* Enable capture interrupt */
81433d6423SLionel Sambuc 
82433d6423SLionel Sambuc /* Timer control fields */
83433d6423SLionel Sambuc #define OMAP3_TCLR_ST       (1 << 0)  /* Start/stop timer */
84433d6423SLionel Sambuc #define OMAP3_TCLR_AR       (1 << 1)  /* Autoreload or one-shot mode */
85433d6423SLionel Sambuc #define OMAP3_TCLR_PRE      (1 << 5)  /* Prescaler on */
86433d6423SLionel Sambuc #define OMAP3_TCLR_PTV      2
87433d6423SLionel Sambuc #define OMAP3_TCLR_OVF_TRG  (1 << 10) /* Overflow trigger */
88433d6423SLionel Sambuc 
89433d6423SLionel Sambuc 
90433d6423SLionel Sambuc #define OMAP3_CM_CLKSEL_GFX		0x48004b40
91433d6423SLionel Sambuc #define OMAP3_CM_CLKEN_PLL		0x48004d00
92433d6423SLionel Sambuc #define OMAP3_CM_FCLKEN1_CORE	0x48004A00
93433d6423SLionel Sambuc #define OMAP3_CM_CLKSEL_CORE	0x48004A40 /* GPT10 src clock sel. */
94433d6423SLionel Sambuc #define OMAP3_CM_FCLKEN_PER		0x48005000
95433d6423SLionel Sambuc #define OMAP3_CM_CLKSEL_PER		0x48005040
96433d6423SLionel Sambuc #define OMAP3_CM_CLKSEL_WKUP    0x48004c40 /* GPT1 source clock selection */
97433d6423SLionel Sambuc 
98433d6423SLionel Sambuc 
99433d6423SLionel Sambuc #define CM_MODULEMODE_MASK (0x3 << 0)
100433d6423SLionel Sambuc #define CM_MODULEMODE_ENABLE      (0x2 << 0)
101433d6423SLionel Sambuc #define CM_MODULEMODE_DISABLED     (0x0 << 0)
102433d6423SLionel Sambuc 
103433d6423SLionel Sambuc #define CM_CLKCTRL_IDLEST         (0x3 << 16)
104433d6423SLionel Sambuc #define CM_CLKCTRL_IDLEST_FUNC    (0x0 << 16)
105433d6423SLionel Sambuc #define CM_CLKCTRL_IDLEST_TRANS   (0x1 << 16)
106433d6423SLionel Sambuc #define CM_CLKCTRL_IDLEST_IDLE    (0x2 << 16)
107433d6423SLionel Sambuc #define CM_CLKCTRL_IDLEST_DISABLE (0x3 << 16)
108433d6423SLionel Sambuc 
109433d6423SLionel Sambuc #define CM_WKUP_BASE 0x44E00400 /* Clock Module Wakeup Registers */
110433d6423SLionel Sambuc 
111433d6423SLionel Sambuc #define CM_WKUP_TIMER1_CLKCTRL	(CM_WKUP_BASE + 0xC4) /* This register manages the TIMER1 clocks. [Memory Mapped] */
112433d6423SLionel Sambuc 
113433d6423SLionel Sambuc 
114433d6423SLionel Sambuc #define CM_PER_BASE 0x44E00000 /* Clock Module Peripheral Registers */
115433d6423SLionel Sambuc #define CM_PER_TIMER7_CLKCTRL	(CM_PER_BASE + 0x7C) /* This register manages the TIMER7 clocks. [Memory Mapped] */
116433d6423SLionel Sambuc 
117433d6423SLionel Sambuc 
118433d6423SLionel Sambuc 
119433d6423SLionel Sambuc /* CM_DPLL registers */
120433d6423SLionel Sambuc 
121433d6423SLionel Sambuc 
122433d6423SLionel Sambuc #define CM_DPLL_BASE 	0x44E00500 /* Clock Module PLL Registers */
123433d6423SLionel Sambuc 
124433d6423SLionel Sambuc #define CLKSEL_TIMER1MS_CLK (CM_DPLL_BASE + 0x28)
125433d6423SLionel Sambuc 
126433d6423SLionel Sambuc 
127433d6423SLionel Sambuc #define CLKSEL_TIMER1MS_CLK_SEL_MASK (0x7 << 0)
128433d6423SLionel Sambuc #define CLKSEL_TIMER1MS_CLK_SEL_SEL1 (0x0 << 0) /* Select CLK_M_OSC clock */
129433d6423SLionel Sambuc #define CLKSEL_TIMER1MS_CLK_SEL_SEL2 (0x1 << 0) /* Select CLK_32KHZ clock */
130433d6423SLionel Sambuc #define CLKSEL_TIMER1MS_CLK_SEL_SEL3 (0x2 << 0) /* Select TCLKIN clock */
131433d6423SLionel Sambuc #define CLKSEL_TIMER1MS_CLK_SEL_SEL4 (0x3 << 0) /* Select CLK_RC32K clock */
132433d6423SLionel Sambuc #define CLKSEL_TIMER1MS_CLK_SEL_SEL5 (0x4 << 0) /* Selects the CLK_32768 from 32KHz Crystal Osc */
133433d6423SLionel Sambuc 
134433d6423SLionel Sambuc #define CLKSEL_TIMER7_CLK   (CM_DPLL_BASE + 0x04)
135433d6423SLionel Sambuc #define CLKSEL_TIMER7_CLK_SEL_MASK (0x3 << 0)
136433d6423SLionel Sambuc #define CLKSEL_TIMER7_CLK_SEL_SEL1 (0x0 << 0) /* Select TCLKIN clock */
137433d6423SLionel Sambuc #define CLKSEL_TIMER7_CLK_SEL_SEL2 (0x1 << 0) /* Select CLK_M_OSC clock */
138433d6423SLionel Sambuc #define CLKSEL_TIMER7_CLK_SEL_SEL3 (0x2 << 0) /* Select CLK_32KHZ clock */
139433d6423SLionel Sambuc #define CLKSEL_TIMER7_CLK_SEL_SEL4 (0x3 << 0) /* Reserved */
140433d6423SLionel Sambuc 
141433d6423SLionel Sambuc 
142433d6423SLionel Sambuc 
143433d6423SLionel Sambuc 
144433d6423SLionel Sambuc #define OMAP3_CLKSEL_GPT1    (1 << 0)   /* Selects GPTIMER 1 source
145433d6423SLionel Sambuc 					 * clock:
146433d6423SLionel Sambuc 					 *
147433d6423SLionel Sambuc 					 *  0: use 32KHz clock
148433d6423SLionel Sambuc 					 *  1: sys clock)
149433d6423SLionel Sambuc 					 */
150433d6423SLionel Sambuc #define OMAP3_CLKSEL_GPT10    (1 << 6)
151433d6423SLionel Sambuc #define OMAP3_CLKSEL_GPT11    (1 << 7)
152433d6423SLionel Sambuc 
153433d6423SLionel Sambuc 
154433d6423SLionel Sambuc #define TIMER_FREQ  1000    /* clock frequency for OMAP timer (1ms) */
155433d6423SLionel Sambuc #define TIMER_COUNT(freq) (TIMER_FREQ/(freq)) /* initial value for counter*/
156433d6423SLionel Sambuc 
157433d6423SLionel Sambuc #endif /* _OMAP_TIMER_REGISTERS_H */
158