bcm2835_cm.h revision 1.1 1 1.1 mlelstv /* $NetBSD: */
2 1.1 mlelstv
3 1.1 mlelstv /*-
4 1.1 mlelstv * Copyright (c) 2015 The NetBSD Foundation, Inc.
5 1.1 mlelstv * All rights reserved.
6 1.1 mlelstv *
7 1.1 mlelstv * Redistribution and use in source and binary forms, with or without
8 1.1 mlelstv * modification, are permitted provided that the following conditions
9 1.1 mlelstv * are met:
10 1.1 mlelstv * 1. Redistributions of source code must retain the above copyright
11 1.1 mlelstv * notice, this list of conditions and the following disclaimer.
12 1.1 mlelstv * 2. Redistributions in binary form must reproduce the above copyright
13 1.1 mlelstv * notice, this list of conditions and the following disclaimer in the
14 1.1 mlelstv * documentation and/or other materials provided with the distribution.
15 1.1 mlelstv *
16 1.1 mlelstv * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 1.1 mlelstv * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 1.1 mlelstv * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 1.1 mlelstv * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 1.1 mlelstv * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 1.1 mlelstv * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 1.1 mlelstv * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 1.1 mlelstv * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 1.1 mlelstv * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 1.1 mlelstv * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 1.1 mlelstv * SUCH DAMAGE.
27 1.1 mlelstv */
28 1.1 mlelstv
29 1.1 mlelstv #ifndef BCM2835_CMREG_H
30 1.1 mlelstv #define BCM2835_CMREG_H
31 1.1 mlelstv
32 1.1 mlelstv #define CM_GP0CTL 0x70
33 1.1 mlelstv #define CM_CTL_PASSWD __BITS(24,31)
34 1.1 mlelstv #define CM_CTL_MASH __BITS(9,10)
35 1.1 mlelstv #define CM_CTL_FLIP __BIT(8)
36 1.1 mlelstv #define CM_CTL_BUSY __BIT(7)
37 1.1 mlelstv #define CM_CTL_KILL __BIT(5)
38 1.1 mlelstv #define CM_CTL_ENAB __BIT(4)
39 1.1 mlelstv #define CM_CTL_SRC __BIT(0,3)
40 1.1 mlelstv #define CM_GP0DIV 0x74
41 1.1 mlelstv #define CM_DIV_PASSWD __BITS(24,31)
42 1.1 mlelstv #define CM_DIV_DIVI __BITS(12,23)
43 1.1 mlelstv #define CM_DIV_DIVF __BITS(0,11)
44 1.1 mlelstv #define CM_GP1CTL 0x78
45 1.1 mlelstv #define CM_GP1DIV 0x7c
46 1.1 mlelstv #define CM_GP2CTL 0x80
47 1.1 mlelstv #define CM_GP2DIV 0x84
48 1.1 mlelstv
49 1.1 mlelstv #define CM_PCMCTL 0x98 /* PCM / I2S */
50 1.1 mlelstv #define CM_PCMDIV 0x9c
51 1.1 mlelstv #define CM_PWMCTL 0xa0
52 1.1 mlelstv #define CM_PWMDIV 0xa4
53 1.1 mlelstv
54 1.1 mlelstv #define CM_PASSWD 0x5a
55 1.1 mlelstv
56 1.1 mlelstv /* clock sources (frequencies for RPI) */
57 1.1 mlelstv #define CM_CTL_SRC_GND 0
58 1.1 mlelstv #define CM_CTL_SRC_OSCILLATOR 1 /* 19.2MHz */
59 1.1 mlelstv #define CM_CTL_SRC_TESTDEBUG0 2
60 1.1 mlelstv #define CM_CTL_SRC_TESTDEBUG1 3
61 1.1 mlelstv #define CM_CTL_SRC_PLLA 4
62 1.1 mlelstv #define CM_CTL_SRC_PLLC 5 /* 1000MHz (changes with overclock) */
63 1.1 mlelstv #define CM_CTL_SRC_PLLD 6 /* 500MHz core clock */
64 1.1 mlelstv #define CM_CTL_SRC_HDMIAUX 7 /* 216MHz HDMI auxiliary */
65 1.1 mlelstv
66 1.1 mlelstv #if 0
67 1.1 mlelstv #define CM_GNRICCTL 0x00
68 1.1 mlelstv #define CM_GNRICDIV 0x04
69 1.1 mlelstv #define CM_VPUCTL 0x08
70 1.1 mlelstv #define CM_VPUDIV 0x0c
71 1.1 mlelstv #define CM_SYSCTL 0x10
72 1.1 mlelstv #define CM_SYSDIV 0x14
73 1.1 mlelstv #define CM_PERIACTL 0x18
74 1.1 mlelstv #define CM_PERIADIV 0x1c
75 1.1 mlelstv #define CM_PERIICTL 0x20
76 1.1 mlelstv #define CM_PERIIDIV 0x24
77 1.1 mlelstv #define CM_H264CTL 0x28
78 1.1 mlelstv #define CM_H264DIV 0x2c
79 1.1 mlelstv #define CM_ISPCTL 0x30
80 1.1 mlelstv #define CM_ISPDIV 0x34
81 1.1 mlelstv #define CM_V3DCTL 0x38
82 1.1 mlelstv #define CM_V3DDIV 0x3c
83 1.1 mlelstv #define CM_CAM0CTL 0x40
84 1.1 mlelstv #define CM_CAM0DIV 0x44
85 1.1 mlelstv #define CM_CAM1CTL 0x48
86 1.1 mlelstv #define CM_CAM1DIV 0x4c
87 1.1 mlelstv #define CM_CCP2CTL 0x50
88 1.1 mlelstv #define CM_CCP2DIV 0x54
89 1.1 mlelstv #define CM_DSIOECTL 0x58
90 1.1 mlelstv #define CM_DSIOEDIV 0x5c
91 1.1 mlelstv #define CM_DSIOPCTL 0x60
92 1.1 mlelstv #define CM_DSIOPDIV 0x64
93 1.1 mlelstv #define CM_DPICTL 0x68
94 1.1 mlelstv #define CM_DPIDIV 0x6c
95 1.1 mlelstv
96 1.1 mlelstv #define CM_HSMCTL 0x88
97 1.1 mlelstv #define CM_HSMDIV 0x8c
98 1.1 mlelstv #define CM_HSMCTL 0x90
99 1.1 mlelstv #define CM_HSMDIV 0x94
100 1.1 mlelstv
101 1.1 mlelstv #define CM_SLIMCTL 0xa8
102 1.1 mlelstv #define CM_SLIMDIV 0xac
103 1.1 mlelstv #define CM_SMICTL 0xb0
104 1.1 mlelstv #define CM_SMIDIV 0xb4
105 1.1 mlelstv
106 1.1 mlelstv #define CM_TCNTCTL 0xc0
107 1.1 mlelstv #define CM_TCNTDIV 0xc4
108 1.1 mlelstv #define CM_TECCTL 0xc8
109 1.1 mlelstv #define CM_TECDIV 0xcc
110 1.1 mlelstv #define CM_TD0CTL 0xd0
111 1.1 mlelstv #define CM_TD0DIV 0xd4
112 1.1 mlelstv #define CM_TD1CTL 0xd8
113 1.1 mlelstv #define CM_TD1DIV 0xdc
114 1.1 mlelstv #define CM_TSENSCTL 0xe0
115 1.1 mlelstv #define CM_TSENSDIV 0xe4
116 1.1 mlelstv #define CM_TIMERCTL 0xe8
117 1.1 mlelstv #define CM_TIMERDIV 0xec
118 1.1 mlelstv #define CM_UARTCTL 0xf0
119 1.1 mlelstv #define CM_UARTDIV 0xf4
120 1.1 mlelstv #define CM_VECCTL 0xf8
121 1.1 mlelstv #define CM_VECDIV 0xfc
122 1.1 mlelstv
123 1.1 mlelstv #define CM_DSI1ECTL 0x158
124 1.1 mlelstv #define CM_DSI1EDIV 0x15c
125 1.1 mlelstv #define CM_DSI1PCTL 0x160
126 1.1 mlelstv #define CM_DSI1PDIV 0x164
127 1.1 mlelstv #define CM_DFTCTL 0x168
128 1.1 mlelstv #define CM_DFTDIV 0x16c
129 1.1 mlelstv
130 1.1 mlelstv #define CM_PULSECTL 0x190
131 1.1 mlelstv #define CM_PULSEDIV 0x194
132 1.1 mlelstv
133 1.1 mlelstv #define CM_SDCCTL 0x1ab
134 1.1 mlelstv #define CM_SDCDIV 0x1ac
135 1.1 mlelstv #define CM_ARMCTL 0x1b0
136 1.1 mlelstv #define CM_ARMDIV 0x1b4
137 1.1 mlelstv #define CM_AVE0CTL 0x1b8
138 1.1 mlelstv #define CM_AVE0DIV 0x1bc
139 1.1 mlelstv #define CM_EMMCCTL 0x1c0
140 1.1 mlelstv #define CM_EMMCDIV 0x1c4
141 1.1 mlelstv
142 1.1 mlelstv #define CM_OSCCOUNT 0x100
143 1.1 mlelstv #define CM_PLLA 0x104
144 1.1 mlelstv #define CM_PLLB 0x170
145 1.1 mlelstv #define CM_PLLC 0x108
146 1.1 mlelstv #define CM_PLLD 0x10c
147 1.1 mlelstv #define CM_PLLH 0x110
148 1.1 mlelstv #define CM_LOCK 0x114
149 1.1 mlelstv #define CM_EVENT 0x118
150 1.1 mlelstv #define CM_INTEN CM_EVENT
151 1.1 mlelstv #define CM_DSIOHSCK 0x120
152 1.1 mlelstv #define CM_CKSM 0x124
153 1.1 mlelstv #define CM_OSCFREQI 0x128
154 1.1 mlelstv #define CM_OSCFREQF 0x12c
155 1.1 mlelstv #define CM_PLLTCTL 0x130
156 1.1 mlelstv #define CM_PLLTCNT0 0x134
157 1.1 mlelstv #define CM_PLLTCNT1 0x138
158 1.1 mlelstv #define CM_PLLTCNT2 0x13c
159 1.1 mlelstv #define CM_PLLTCNT3 0x140
160 1.1 mlelstv #define CM_TDCLKEN 0x144
161 1.1 mlelstv #define CM_BURSTCTL 0x148
162 1.1 mlelstv #define CM_BURSTCNT 0x14C
163 1.1 mlelstv
164 1.1 mlelstv #endif
165 1.1 mlelstv
166 1.1 mlelstv enum bcm_cm_clock {
167 1.1 mlelstv BCM_CM_GP0,
168 1.1 mlelstv BCM_CM_GP1,
169 1.1 mlelstv BCM_CM_GP2,
170 1.1 mlelstv BCM_CM_PCM,
171 1.1 mlelstv BCM_CM_PWM
172 1.1 mlelstv };
173 1.1 mlelstv
174 1.1 mlelstv int bcm_cm_set(enum bcm_cm_clock, uint32_t, uint32_t);
175 1.1 mlelstv int bcm_cm_get(enum bcm_cm_clock, uint32_t *, uint32_t *);
176 1.1 mlelstv
177 1.1 mlelstv #endif /* !BCM2835_CMREG_H */
178