source: mainline/kernel/genarch/include/drivers/am335x/timer_regs.h@ 42f2a45

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 42f2a45 was 42f2a45, checked in by Maurizio Lombardi <m.lombardi85@…>, 13 years ago

am335x: Add the timer driver implementation

  • Property mode set to 100644
File size: 5.4 KB
Line 
1/*
2 * Copyright (c) 2012 Maurizio Lombardi
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28/** @addtogroup genarch
29 * @{
30 */
31/**
32 * @file
33 * @brief Texas Instruments AM335x DMTIMER memory mapped registers.
34 */
35
36#include <typedefs.h>
37
38typedef struct am335x_timer_regs {
39
40 /* This read only register contains the
41 * revision number of the module
42 */
43 ioport32_t const tidr;
44#define AM335x_TIMER_TIDR_MINOR_MASK 0x3F
45#define AM335x_TIMER_TIDR_MINOR_SHIFT 0
46#define AM335x_TIMER_TIDR_CUSTOM_MASK 0x03
47#define AM335x_TIMER_TIDR_CUSTOM_SHIFT 6
48#define AM335x_TIMER_TIDR_MAJOR_MASK 0x07
49#define AM335x_TIMER_TIDR_MAJOR_SHIFT 8
50#define AM335x_TIMER_TIDR_RTL_MASK 0x1F
51#define AM335x_TIMER_TIDR_RTL_SHIFT 11
52#define AM335x_TIMER_TIDR_FUNC_MASK 0xFFF
53#define AM335x_TIMER_TIDR_FUNC_SHIFT 16
54#define AM335x_TIMER_TIDR_SCHEME_MASK 0x03
55#define AM335x_TIMER_TIDR_SCHEME_SHIFT 30
56
57 ioport32_t const pad1[3];
58
59 /* This register allows controlling various
60 * parameters of the OCP interface.
61 */
62 ioport32_t tiocp_cfg;
63#define AM335x_TIMER_TIOCPCFG_SOFTRESET_FLAG (1 << 0)
64#define AM335x_TIMER_TIOCPCFG_EMUFREE_FLAG (1 << 1)
65
66#define AM335x_TIMER_TIOCPCFG_IDLEMODE_MASK 0x02
67#define AM335x_TIMER_TIOCPCFG_IDLEMODE_SHIFT 2
68# define AM335x_TIMER_TIOCCPCFG_IDLEMODE_FORCE 0x00
69# define AM335x_TIMER_TIOCCPCFG_IDLEMODE_DISABLED 0x01
70# define AM335x_TIMER_TIOCCPCFG_IDLEMODE_SMART 0x02
71# define AM335x_TIMER_TIOCCPCFG_IDLEMODE_SMART_WAKEUP 0x03
72
73 ioport32_t const pad2[4];
74
75 ioport32_t irqstatus_raw;
76#define AM335x_TIMER_IRQSTATUS_RAW_MAT_FLAG (1 << 0)
77#define AM335x_TIMER_IRQSTATUS_RAW_OVF_FLAG (1 << 1)
78#define AM335x_TIMER_IRQSTATUS_RAW_TCAR_FLAG (1 << 2)
79
80 ioport32_t irqstatus;
81#define AM335x_TIMER_IRQSTATUS_MAT_FLAG (1 << 0)
82#define AM335x_TIMER_IRQSTATUS_OVF_FLAG (1 << 1)
83#define AM335x_TIMER_IRQSTATUS_TCAR_FLAG (1 << 2)
84
85 ioport32_t irqenable_set;
86#define AM335x_TIMER_IRQENABLE_SET_MAT_FLAG (1 << 0)
87#define AM335x_TIMER_IRQENABLE_SET_OVF_FLAG (1 << 1)
88#define AM335x_TIMER_IRQENABLE_SET_TCAR_FLAG (1 << 2)
89
90 ioport32_t irqenable_clr;
91#define AM335x_TIMER_IRQENABLE_CLR_MAT_FLAG (1 << 0)
92#define AM335x_TIMER_IRQENABLE_CLR_OVF_FLAG (1 << 1)
93#define AM335x_TIMER_IRQENABLE_CLR_TCAR_FLAG (1 << 2)
94
95 /* Timer IRQ wakeup enable register */
96 ioport32_t irqwakeen;
97#define AM335x_TIMER_IRQWAKEEN_MAT_FLAG (1 << 0)
98#define AM335x_TIMER_IRQWAKEEN_PVF_FLAG (1 << 1)
99#define AM335x_TIMER_IRQWAKEEN_TCAR_FLAG (1 << 2)
100
101 /* Timer control register */
102 ioport32_t tclr;
103#define AM335x_TIMER_TCLR_ST_FLAG (1 << 0)
104#define AM335x_TIMER_TCLR_AR_FLAG (1 << 1)
105#define AM335x_TIMER_TCLR_PTV_MASK 0x07
106#define AM335x_TIMER_TCLR_PTV_SHIFT 2
107#define AM335x_TIMER_TCLR_PRE_FLAG (1 << 5)
108#define AM335x_TIMER_TCLR_CE_FLAG (1 << 6)
109#define AM335x_TIMER_TCLR_SCPWM_FLAG (1 << 7)
110#define AM335x_TIMER_TCLR_TCM_MASK 0x03
111#define AM335x_TIMER_TCLR_TCM_SHIFT 8
112#define AM335x_TIMER_TCLR_TGR_MASK 0x03
113#define AM335x_TIMER_TCLR_TGR_SHIFT 10
114#define AM335x_TIMER_TCLR_PT_FLAG (1 << 12)
115#define AM335x_TIMER_TCLR_CAPT_MODE_FLAG (1 << 13)
116#define AM335x_TIMER_TCLR_GPO_CFG_FLAG (1 << 14)
117
118 /* Timer counter register */
119 ioport32_t tcrr;
120
121 /* Timer load register */
122 ioport32_t tldr;
123
124 /* Timer trigger register */
125 ioport32_t const ttgr;
126
127 /* Timer write posted status register */
128 ioport32_t twps;
129#define AM335x_TIMER_TWPS_PEND_TCLR (1 << 0)
130#define AM335x_TIMER_TWPS_PEND_TCRR (1 << 1)
131#define AM335x_TIMER_TWPS_PEND_TLDR (1 << 2)
132#define AM335x_TIMER_TWPS_PEND_TTGR (1 << 3)
133#define AM335x_TIMER_TWPS_PEND_TMAR (1 << 4)
134
135 /* Timer match register */
136 ioport32_t tmar;
137
138 /* Timer capture register */
139 ioport32_t tcar1;
140
141 /* Timer synchronous interface control register */
142 ioport32_t tsicr;
143#define AM335x_TIMER_TSICR_SFT_FLAG (1 << 1)
144#define AM335x_TIMER_TSICR_POSTED_FLAG (1 << 2)
145
146 /* Timer capture register */
147 ioport32_t tcar2;
148
149} am335x_timer_regs_t;
150
151/**
152 * @}
153 */
154
Note: See TracBrowser for help on using the repository browser.