mct_reg.h revision 1.1 1 1.1 matt /* $NetBSD */
2 1.1 matt /*-
3 1.1 matt * Copyright (c) 2014 The NetBSD Foundation, Inc.
4 1.1 matt * All rights reserved.
5 1.1 matt *
6 1.1 matt * This code is derived from software contributed to The NetBSD Foundation
7 1.1 matt * by Reinoud Zandijk.
8 1.1 matt *
9 1.1 matt * Redistribution and use in source and binary forms, with or without
10 1.1 matt * modification, are permitted provided that the following conditions
11 1.1 matt * are met:
12 1.1 matt * 1. Redistributions of source code must retain the above copyright
13 1.1 matt * notice, this list of conditions and the following disclaimer.
14 1.1 matt * 2. Redistributions in binary form must reproduce the above copyright
15 1.1 matt * notice, this list of conditions and the following disclaimer in the
16 1.1 matt * documentation and/or other materials provided with the distribution.
17 1.1 matt *
18 1.1 matt * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 1.1 matt * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 1.1 matt * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 1.1 matt * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 1.1 matt * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 1.1 matt * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 1.1 matt * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 1.1 matt * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 1.1 matt * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 1.1 matt * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 1.1 matt * POSSIBILITY OF SUCH DAMAGE.
29 1.1 matt */
30 1.1 matt
31 1.1 matt #ifndef _ARM_SAMSUNG_MCT_REG_H_
32 1.1 matt #define _ARM_SAMSUNG_MCT_REG_H_
33 1.1 matt
34 1.1 matt /* global timer register offsets */
35 1.1 matt #define MCT_G_CNT_L 0x100 /* lower bits */
36 1.1 matt #define MCT_G_CNT_U 0x104 /* higher bits */
37 1.1 matt #define MCT_G_CNT_WSTAT 0x110 /* wait for write OK cntr */
38 1.1 matt #define G_CNT_WSTAT_L __BIT(0)
39 1.1 matt #define G_CNT_WSTAT_U __BIT(1)
40 1.1 matt
41 1.1 matt #define MCT_G_COMP0_L 0x200 /* compare0 lower bits */
42 1.1 matt #define MCT_G_COMP0_U 0x204 /* compare0 higher bits */
43 1.1 matt #define MCT_G_COMP0_ADD_INCR 0x208 /* compare0 auto add value */
44 1.1 matt #define MCT_G_TCON 0x240 /* configuration register */
45 1.1 matt #define G_TCON_COMP0_ENABLE __BIT(0)
46 1.1 matt #define G_TCON_COMP0_AUTOINC __BIT(1)
47 1.1 matt #define G_TCON_START __BIT(8)
48 1.1 matt #define MCT_G_INT_CSTAT 0x244 /* clear interrupt */
49 1.1 matt #define G_INT_CSTAT_CLEAR __BIT(0)
50 1.1 matt #define MCT_G_INT_ENB 0x248 /* enable interrupts */
51 1.1 matt #define G_INT_ENB_ENABLE __BIT(0)
52 1.1 matt #define MCT_G_WSTAT 0x24C /* wait for write OK */
53 1.1 matt #define G_WSTAT_COMP0_L __BIT(0)
54 1.1 matt #define G_WSTAT_COMP0_U __BIT(1)
55 1.1 matt #define G_WSTAT_ADD_INCR __BIT(2)
56 1.1 matt #define G_WSTAT_TCON __BIT(16)
57 1.1 matt
58 1.1 matt /* local cpu-bound timers */
59 1.1 matt #define MCT_L_OFFSET(x) (0x300 + (0x100 * x))
60 1.1 matt #define MCT_L_MASK 0xffffff00
61 1.1 matt
62 1.1 matt #define MCT_L_TCNTB 0x00 /* TODO: what */
63 1.1 matt #define MCT_L_ICNTB 0x08 /* interrupt count buffer */
64 1.1 matt #define L_INCTB_UPDATE(x) (__BIT(31) | (x))
65 1.1 matt #define MCT_L_TCON 0x20 /* configuration register */
66 1.1 matt #define L_TCON_TIMER_START __BIT(0)
67 1.1 matt #define L_TCON_INT_START __BIT(1)
68 1.1 matt #define L_TCON_INTERVAL_MODE __BIT(2)
69 1.1 matt #define MCT_L_INC_CSTAT 0x30
70 1.1 matt #define L_INC_CSTAT_CLEAR __BIT(0)
71 1.1 matt #define MCT_L_INT_ENB 0x34
72 1.1 matt #define L_INT_ENB_ENABLE __BIT(0)
73 1.1 matt #define MCT_L_WSTAT 0x40
74 1.1 matt #define L_WSTAT_L_TCNTB __BIT(0)
75 1.1 matt #define L_WSTAT_L_ICNTB __BIT(1)
76 1.1 matt #define L_WSTAT_L_TCON __BIT(3)
77 1.1 matt
78 1.1 matt #endif /* _ARM_SAMSUNG_MCT_REG_H_ */
79 1.1 matt
80