add support for enabling the GPUdiff -r1.26 -r1.27 src/sys/arch/arm/nvidia/tegra_car.c
(jmcneill)
--- src/sys/arch/arm/nvidia/Attic/tegra_car.c 2015/08/01 21:20:11 1.26
+++ src/sys/arch/arm/nvidia/Attic/tegra_car.c 2015/10/17 21:16:09 1.27
@@ -1,833 +1,862 @@ | @@ -1,833 +1,862 @@ | |||
1 | /* $NetBSD: tegra_car.c,v 1.26 2015/08/01 21:20:11 jmcneill Exp $ */ | 1 | /* $NetBSD: tegra_car.c,v 1.27 2015/10/17 21:16:09 jmcneill Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca> | 4 | * Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca> | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
15 | * | 15 | * | |
16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | |
21 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | |
23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | 23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
26 | * SUCH DAMAGE. | 26 | * SUCH DAMAGE. | |
27 | */ | 27 | */ | |
28 | 28 | |||
29 | #include "locators.h" | 29 | #include "locators.h" | |
30 | 30 | |||
31 | #include <sys/cdefs.h> | 31 | #include <sys/cdefs.h> | |
32 | __KERNEL_RCSID(0, "$NetBSD: tegra_car.c,v 1.26 2015/08/01 21:20:11 jmcneill Exp $"); | 32 | __KERNEL_RCSID(0, "$NetBSD: tegra_car.c,v 1.27 2015/10/17 21:16:09 jmcneill Exp $"); | |
33 | 33 | |||
34 | #include <sys/param.h> | 34 | #include <sys/param.h> | |
35 | #include <sys/bus.h> | 35 | #include <sys/bus.h> | |
36 | #include <sys/device.h> | 36 | #include <sys/device.h> | |
37 | #include <sys/intr.h> | 37 | #include <sys/intr.h> | |
38 | #include <sys/systm.h> | 38 | #include <sys/systm.h> | |
39 | #include <sys/kernel.h> | 39 | #include <sys/kernel.h> | |
40 | #include <sys/rndpool.h> | 40 | #include <sys/rndpool.h> | |
41 | #include <sys/rndsource.h> | 41 | #include <sys/rndsource.h> | |
42 | 42 | |||
43 | #include <arm/nvidia/tegra_reg.h> | 43 | #include <arm/nvidia/tegra_reg.h> | |
44 | #include <arm/nvidia/tegra_carreg.h> | 44 | #include <arm/nvidia/tegra_carreg.h> | |
45 | #include <arm/nvidia/tegra_pmcreg.h> | 45 | #include <arm/nvidia/tegra_pmcreg.h> | |
46 | #include <arm/nvidia/tegra_var.h> | 46 | #include <arm/nvidia/tegra_var.h> | |
47 | 47 | |||
48 | static int tegra_car_match(device_t, cfdata_t, void *); | 48 | static int tegra_car_match(device_t, cfdata_t, void *); | |
49 | static void tegra_car_attach(device_t, device_t, void *); | 49 | static void tegra_car_attach(device_t, device_t, void *); | |
50 | 50 | |||
51 | struct tegra_car_softc { | 51 | struct tegra_car_softc { | |
52 | device_t sc_dev; | 52 | device_t sc_dev; | |
53 | bus_space_tag_t sc_bst; | 53 | bus_space_tag_t sc_bst; | |
54 | bus_space_handle_t sc_bsh; | 54 | bus_space_handle_t sc_bsh; | |
55 | 55 | |||
56 | kmutex_t sc_intr_lock; | 56 | kmutex_t sc_intr_lock; | |
57 | kmutex_t sc_rnd_lock; | 57 | kmutex_t sc_rnd_lock; | |
58 | u_int sc_bytes_wanted; | 58 | u_int sc_bytes_wanted; | |
59 | void *sc_sih; | 59 | void *sc_sih; | |
60 | krndsource_t sc_rndsource; | 60 | krndsource_t sc_rndsource; | |
61 | }; | 61 | }; | |
62 | 62 | |||
63 | static void tegra_car_init(struct tegra_car_softc *); | 63 | static void tegra_car_init(struct tegra_car_softc *); | |
64 | static void tegra_car_rnd_attach(device_t); | 64 | static void tegra_car_rnd_attach(device_t); | |
65 | static void tegra_car_rnd_intr(void *); | 65 | static void tegra_car_rnd_intr(void *); | |
66 | static void tegra_car_rnd_callback(size_t, void *); | 66 | static void tegra_car_rnd_callback(size_t, void *); | |
67 | 67 | |||
68 | static struct tegra_car_softc *pmc_softc = NULL; | 68 | static struct tegra_car_softc *pmc_softc = NULL; | |
69 | 69 | |||
70 | CFATTACH_DECL_NEW(tegra_car, sizeof(struct tegra_car_softc), | 70 | CFATTACH_DECL_NEW(tegra_car, sizeof(struct tegra_car_softc), | |
71 | tegra_car_match, tegra_car_attach, NULL, NULL); | 71 | tegra_car_match, tegra_car_attach, NULL, NULL); | |
72 | 72 | |||
73 | static int | 73 | static int | |
74 | tegra_car_match(device_t parent, cfdata_t cf, void *aux) | 74 | tegra_car_match(device_t parent, cfdata_t cf, void *aux) | |
75 | { | 75 | { | |
76 | return 1; | 76 | return 1; | |
77 | } | 77 | } | |
78 | 78 | |||
79 | static void | 79 | static void | |
80 | tegra_car_attach(device_t parent, device_t self, void *aux) | 80 | tegra_car_attach(device_t parent, device_t self, void *aux) | |
81 | { | 81 | { | |
82 | struct tegra_car_softc * const sc = device_private(self); | 82 | struct tegra_car_softc * const sc = device_private(self); | |
83 | struct tegraio_attach_args * const tio = aux; | 83 | struct tegraio_attach_args * const tio = aux; | |
84 | const struct tegra_locators * const loc = &tio->tio_loc; | 84 | const struct tegra_locators * const loc = &tio->tio_loc; | |
85 | 85 | |||
86 | sc->sc_dev = self; | 86 | sc->sc_dev = self; | |
87 | sc->sc_bst = tio->tio_bst; | 87 | sc->sc_bst = tio->tio_bst; | |
88 | bus_space_subregion(tio->tio_bst, tio->tio_bsh, | 88 | bus_space_subregion(tio->tio_bst, tio->tio_bsh, | |
89 | loc->loc_offset, loc->loc_size, &sc->sc_bsh); | 89 | loc->loc_offset, loc->loc_size, &sc->sc_bsh); | |
90 | 90 | |||
91 | KASSERT(pmc_softc == NULL); | 91 | KASSERT(pmc_softc == NULL); | |
92 | pmc_softc = sc; | 92 | pmc_softc = sc; | |
93 | 93 | |||
94 | aprint_naive("\n"); | 94 | aprint_naive("\n"); | |
95 | aprint_normal(": CAR\n"); | 95 | aprint_normal(": CAR\n"); | |
96 | 96 | |||
97 | tegra_car_init(sc); | 97 | tegra_car_init(sc); | |
98 | 98 | |||
99 | aprint_verbose_dev(self, "PLLX = %u Hz\n", tegra_car_pllx_rate()); | 99 | aprint_verbose_dev(self, "PLLX = %u Hz\n", tegra_car_pllx_rate()); | |
100 | aprint_verbose_dev(self, "PLLC = %u Hz\n", tegra_car_pllc_rate()); | 100 | aprint_verbose_dev(self, "PLLC = %u Hz\n", tegra_car_pllc_rate()); | |
101 | aprint_verbose_dev(self, "PLLE = %u Hz\n", tegra_car_plle_rate()); | 101 | aprint_verbose_dev(self, "PLLE = %u Hz\n", tegra_car_plle_rate()); | |
102 | aprint_verbose_dev(self, "PLLU = %u Hz\n", tegra_car_pllu_rate()); | 102 | aprint_verbose_dev(self, "PLLU = %u Hz\n", tegra_car_pllu_rate()); | |
103 | aprint_verbose_dev(self, "PLLP0 = %u Hz\n", tegra_car_pllp0_rate()); | 103 | aprint_verbose_dev(self, "PLLP0 = %u Hz\n", tegra_car_pllp0_rate()); | |
104 | aprint_verbose_dev(self, "PLLD2 = %u Hz\n", tegra_car_plld2_rate()); | 104 | aprint_verbose_dev(self, "PLLD2 = %u Hz\n", tegra_car_plld2_rate()); | |
105 | 105 | |||
106 | config_interrupts(self, tegra_car_rnd_attach); | 106 | config_interrupts(self, tegra_car_rnd_attach); | |
107 | } | 107 | } | |
108 | 108 | |||
109 | static void | 109 | static void | |
110 | tegra_car_init(struct tegra_car_softc *sc) | 110 | tegra_car_init(struct tegra_car_softc *sc) | |
111 | { | 111 | { | |
112 | bus_space_tag_t bst = sc->sc_bst; | 112 | bus_space_tag_t bst = sc->sc_bst; | |
113 | bus_space_handle_t bsh = sc->sc_bsh; | 113 | bus_space_handle_t bsh = sc->sc_bsh; | |
114 | 114 | |||
115 | tegra_reg_set_clear(bst, bsh, CAR_PLLD2_BASE_REG, | 115 | tegra_reg_set_clear(bst, bsh, CAR_PLLD2_BASE_REG, | |
116 | __SHIFTIN(1, CAR_PLLD2_BASE_MDIV) | | 116 | __SHIFTIN(1, CAR_PLLD2_BASE_MDIV) | | |
117 | __SHIFTIN(99, CAR_PLLD2_BASE_NDIV) | | 117 | __SHIFTIN(99, CAR_PLLD2_BASE_NDIV) | | |
118 | __SHIFTIN(1, CAR_PLLD2_BASE_PLDIV), | 118 | __SHIFTIN(1, CAR_PLLD2_BASE_PLDIV), | |
119 | CAR_PLLD2_BASE_REF_SRC_SEL | | 119 | CAR_PLLD2_BASE_REF_SRC_SEL | | |
120 | CAR_PLLD2_BASE_PLDIV | CAR_PLLD2_BASE_NDIV | CAR_PLLD2_BASE_MDIV); | 120 | CAR_PLLD2_BASE_PLDIV | CAR_PLLD2_BASE_NDIV | CAR_PLLD2_BASE_MDIV); | |
121 | } | 121 | } | |
122 | 122 | |||
123 | static void | 123 | static void | |
124 | tegra_car_rnd_attach(device_t self) | 124 | tegra_car_rnd_attach(device_t self) | |
125 | { | 125 | { | |
126 | struct tegra_car_softc * const sc = device_private(self); | 126 | struct tegra_car_softc * const sc = device_private(self); | |
127 | 127 | |||
128 | mutex_init(&sc->sc_intr_lock, MUTEX_DEFAULT, IPL_SERIAL); | 128 | mutex_init(&sc->sc_intr_lock, MUTEX_DEFAULT, IPL_SERIAL); | |
129 | mutex_init(&sc->sc_rnd_lock, MUTEX_DEFAULT, IPL_SERIAL); | 129 | mutex_init(&sc->sc_rnd_lock, MUTEX_DEFAULT, IPL_SERIAL); | |
130 | sc->sc_bytes_wanted = 0; | 130 | sc->sc_bytes_wanted = 0; | |
131 | sc->sc_sih = softint_establish(SOFTINT_SERIAL|SOFTINT_MPSAFE, | 131 | sc->sc_sih = softint_establish(SOFTINT_SERIAL|SOFTINT_MPSAFE, | |
132 | tegra_car_rnd_intr, sc); | 132 | tegra_car_rnd_intr, sc); | |
133 | if (sc->sc_sih == NULL) { | 133 | if (sc->sc_sih == NULL) { | |
134 | aprint_error_dev(sc->sc_dev, "couldn't establish softint\n"); | 134 | aprint_error_dev(sc->sc_dev, "couldn't establish softint\n"); | |
135 | return; | 135 | return; | |
136 | } | 136 | } | |
137 | 137 | |||
138 | rndsource_setcb(&sc->sc_rndsource, tegra_car_rnd_callback, sc); | 138 | rndsource_setcb(&sc->sc_rndsource, tegra_car_rnd_callback, sc); | |
139 | rnd_attach_source(&sc->sc_rndsource, device_xname(sc->sc_dev), | 139 | rnd_attach_source(&sc->sc_rndsource, device_xname(sc->sc_dev), | |
140 | RND_TYPE_RNG, RND_FLAG_COLLECT_VALUE|RND_FLAG_HASCB); | 140 | RND_TYPE_RNG, RND_FLAG_COLLECT_VALUE|RND_FLAG_HASCB); | |
141 | } | 141 | } | |
142 | 142 | |||
143 | static void | 143 | static void | |
144 | tegra_car_rnd_intr(void *priv) | 144 | tegra_car_rnd_intr(void *priv) | |
145 | { | 145 | { | |
146 | struct tegra_car_softc * const sc = priv; | 146 | struct tegra_car_softc * const sc = priv; | |
147 | uint16_t buf[512]; | 147 | uint16_t buf[512]; | |
148 | uint32_t cnt; | 148 | uint32_t cnt; | |
149 | 149 | |||
150 | mutex_enter(&sc->sc_intr_lock); | 150 | mutex_enter(&sc->sc_intr_lock); | |
151 | while (sc->sc_bytes_wanted) { | 151 | while (sc->sc_bytes_wanted) { | |
152 | const u_int nbytes = MIN(sc->sc_bytes_wanted, 1024); | 152 | const u_int nbytes = MIN(sc->sc_bytes_wanted, 1024); | |
153 | for (cnt = 0; cnt < sc->sc_bytes_wanted / 2; cnt++) { | 153 | for (cnt = 0; cnt < sc->sc_bytes_wanted / 2; cnt++) { | |
154 | buf[cnt] = bus_space_read_4(sc->sc_bst, sc->sc_bsh, | 154 | buf[cnt] = bus_space_read_4(sc->sc_bst, sc->sc_bsh, | |
155 | CAR_PLL_LFSR_REG) & 0xffff; | 155 | CAR_PLL_LFSR_REG) & 0xffff; | |
156 | } | 156 | } | |
157 | mutex_exit(&sc->sc_intr_lock); | 157 | mutex_exit(&sc->sc_intr_lock); | |
158 | mutex_enter(&sc->sc_rnd_lock); | 158 | mutex_enter(&sc->sc_rnd_lock); | |
159 | rnd_add_data(&sc->sc_rndsource, buf, nbytes, nbytes * NBBY); | 159 | rnd_add_data(&sc->sc_rndsource, buf, nbytes, nbytes * NBBY); | |
160 | mutex_exit(&sc->sc_rnd_lock); | 160 | mutex_exit(&sc->sc_rnd_lock); | |
161 | mutex_enter(&sc->sc_intr_lock); | 161 | mutex_enter(&sc->sc_intr_lock); | |
162 | sc->sc_bytes_wanted -= MIN(sc->sc_bytes_wanted, nbytes); | 162 | sc->sc_bytes_wanted -= MIN(sc->sc_bytes_wanted, nbytes); | |
163 | } | 163 | } | |
164 | explicit_memset(buf, 0, sizeof(buf)); | 164 | explicit_memset(buf, 0, sizeof(buf)); | |
165 | mutex_exit(&sc->sc_intr_lock); | 165 | mutex_exit(&sc->sc_intr_lock); | |
166 | } | 166 | } | |
167 | 167 | |||
168 | static void | 168 | static void | |
169 | tegra_car_rnd_callback(size_t bytes_wanted, void *priv) | 169 | tegra_car_rnd_callback(size_t bytes_wanted, void *priv) | |
170 | { | 170 | { | |
171 | struct tegra_car_softc * const sc = priv; | 171 | struct tegra_car_softc * const sc = priv; | |
172 | 172 | |||
173 | mutex_enter(&sc->sc_intr_lock); | 173 | mutex_enter(&sc->sc_intr_lock); | |
174 | if (sc->sc_bytes_wanted == 0) { | 174 | if (sc->sc_bytes_wanted == 0) { | |
175 | softint_schedule(sc->sc_sih); | 175 | softint_schedule(sc->sc_sih); | |
176 | } | 176 | } | |
177 | if (bytes_wanted > (UINT_MAX - sc->sc_bytes_wanted)) { | 177 | if (bytes_wanted > (UINT_MAX - sc->sc_bytes_wanted)) { | |
178 | sc->sc_bytes_wanted = UINT_MAX; | 178 | sc->sc_bytes_wanted = UINT_MAX; | |
179 | } else { | 179 | } else { | |
180 | sc->sc_bytes_wanted += bytes_wanted; | 180 | sc->sc_bytes_wanted += bytes_wanted; | |
181 | } | 181 | } | |
182 | mutex_exit(&sc->sc_intr_lock); | 182 | mutex_exit(&sc->sc_intr_lock); | |
183 | } | 183 | } | |
184 | 184 | |||
185 | static void | 185 | static void | |
186 | tegra_car_get_bs(bus_space_tag_t *pbst, bus_space_handle_t *pbsh) | 186 | tegra_car_get_bs(bus_space_tag_t *pbst, bus_space_handle_t *pbsh) | |
187 | { | 187 | { | |
188 | if (pmc_softc) { | 188 | if (pmc_softc) { | |
189 | *pbst = pmc_softc->sc_bst; | 189 | *pbst = pmc_softc->sc_bst; | |
190 | *pbsh = pmc_softc->sc_bsh; | 190 | *pbsh = pmc_softc->sc_bsh; | |
191 | } else { | 191 | } else { | |
192 | *pbst = &armv7_generic_bs_tag; | 192 | *pbst = &armv7_generic_bs_tag; | |
193 | bus_space_subregion(*pbst, tegra_ppsb_bsh, | 193 | bus_space_subregion(*pbst, tegra_ppsb_bsh, | |
194 | TEGRA_CAR_OFFSET, TEGRA_CAR_SIZE, pbsh); | 194 | TEGRA_CAR_OFFSET, TEGRA_CAR_SIZE, pbsh); | |
195 | } | 195 | } | |
196 | } | 196 | } | |
197 | 197 | |||
198 | u_int | 198 | u_int | |
199 | tegra_car_osc_rate(void) | 199 | tegra_car_osc_rate(void) | |
200 | { | 200 | { | |
201 | return TEGRA_REF_FREQ; | 201 | return TEGRA_REF_FREQ; | |
202 | } | 202 | } | |
203 | 203 | |||
204 | static u_int | 204 | static u_int | |
205 | tegra_car_pll_rate(u_int base_reg, u_int divm_mask, u_int divn_mask, | 205 | tegra_car_pll_rate(u_int base_reg, u_int divm_mask, u_int divn_mask, | |
206 | u_int divp_mask) | 206 | u_int divp_mask) | |
207 | { | 207 | { | |
208 | bus_space_tag_t bst; | 208 | bus_space_tag_t bst; | |
209 | bus_space_handle_t bsh; | 209 | bus_space_handle_t bsh; | |
210 | uint64_t rate; | 210 | uint64_t rate; | |
211 | 211 | |||
212 | tegra_car_get_bs(&bst, &bsh); | 212 | tegra_car_get_bs(&bst, &bsh); | |
213 | 213 | |||
214 | const uint32_t base = bus_space_read_4(bst, bsh, base_reg); | 214 | const uint32_t base = bus_space_read_4(bst, bsh, base_reg); | |
215 | const u_int divm = __SHIFTOUT(base, divm_mask); | 215 | const u_int divm = __SHIFTOUT(base, divm_mask); | |
216 | const u_int divn = __SHIFTOUT(base, divn_mask); | 216 | const u_int divn = __SHIFTOUT(base, divn_mask); | |
217 | const u_int divp = __SHIFTOUT(base, divp_mask); | 217 | const u_int divp = __SHIFTOUT(base, divp_mask); | |
218 | 218 | |||
219 | rate = (uint64_t)tegra_car_osc_rate() * divn; | 219 | rate = (uint64_t)tegra_car_osc_rate() * divn; | |
220 | 220 | |||
221 | return rate / (divm << divp); | 221 | return rate / (divm << divp); | |
222 | } | 222 | } | |
223 | 223 | |||
224 | void | 224 | void | |
225 | tegra_car_pllx_set_rate(u_int divm, u_int divn, u_int divp) | 225 | tegra_car_pllx_set_rate(u_int divm, u_int divn, u_int divp) | |
226 | { | 226 | { | |
227 | bus_space_tag_t bst; | 227 | bus_space_tag_t bst; | |
228 | bus_space_handle_t bsh; | 228 | bus_space_handle_t bsh; | |
229 | uint32_t base, bp; | 229 | uint32_t base, bp; | |
230 | 230 | |||
231 | tegra_car_get_bs(&bst, &bsh); | 231 | tegra_car_get_bs(&bst, &bsh); | |
232 | 232 | |||
233 | bp = bus_space_read_4(bst, bsh, CAR_CCLKG_BURST_POLICY_REG); | 233 | bp = bus_space_read_4(bst, bsh, CAR_CCLKG_BURST_POLICY_REG); | |
234 | bp &= ~CAR_CCLKG_BURST_POLICY_CPU_STATE; | 234 | bp &= ~CAR_CCLKG_BURST_POLICY_CPU_STATE; | |
235 | bp |= __SHIFTIN(CAR_CCLKG_BURST_POLICY_CPU_STATE_IDLE, | 235 | bp |= __SHIFTIN(CAR_CCLKG_BURST_POLICY_CPU_STATE_IDLE, | |
236 | CAR_CCLKG_BURST_POLICY_CPU_STATE); | 236 | CAR_CCLKG_BURST_POLICY_CPU_STATE); | |
237 | bp &= ~CAR_CCLKG_BURST_POLICY_CWAKEUP_IDLE_SOURCE; | 237 | bp &= ~CAR_CCLKG_BURST_POLICY_CWAKEUP_IDLE_SOURCE; | |
238 | bp |= __SHIFTIN(CAR_CCLKG_BURST_POLICY_CWAKEUP_SOURCE_CLKM, | 238 | bp |= __SHIFTIN(CAR_CCLKG_BURST_POLICY_CWAKEUP_SOURCE_CLKM, | |
239 | CAR_CCLKG_BURST_POLICY_CWAKEUP_IDLE_SOURCE); | 239 | CAR_CCLKG_BURST_POLICY_CWAKEUP_IDLE_SOURCE); | |
240 | bus_space_write_4(bst, bsh, CAR_CCLKG_BURST_POLICY_REG, bp); | 240 | bus_space_write_4(bst, bsh, CAR_CCLKG_BURST_POLICY_REG, bp); | |
241 | 241 | |||
242 | base = bus_space_read_4(bst, bsh, CAR_PLLX_BASE_REG); | 242 | base = bus_space_read_4(bst, bsh, CAR_PLLX_BASE_REG); | |
243 | base &= ~CAR_PLLX_BASE_DIVM; | 243 | base &= ~CAR_PLLX_BASE_DIVM; | |
244 | base &= ~CAR_PLLX_BASE_DIVN; | 244 | base &= ~CAR_PLLX_BASE_DIVN; | |
245 | base &= ~CAR_PLLX_BASE_DIVP; | 245 | base &= ~CAR_PLLX_BASE_DIVP; | |
246 | base |= __SHIFTIN(divm, CAR_PLLX_BASE_DIVM); | 246 | base |= __SHIFTIN(divm, CAR_PLLX_BASE_DIVM); | |
247 | base |= __SHIFTIN(divn, CAR_PLLX_BASE_DIVN); | 247 | base |= __SHIFTIN(divn, CAR_PLLX_BASE_DIVN); | |
248 | base |= __SHIFTIN(divp, CAR_PLLX_BASE_DIVP); | 248 | base |= __SHIFTIN(divp, CAR_PLLX_BASE_DIVP); | |
249 | bus_space_write_4(bst, bsh, CAR_PLLX_BASE_REG, base); | 249 | bus_space_write_4(bst, bsh, CAR_PLLX_BASE_REG, base); | |
250 | 250 | |||
251 | tegra_reg_set_clear(bst, bsh, CAR_PLLX_MISC_REG, | 251 | tegra_reg_set_clear(bst, bsh, CAR_PLLX_MISC_REG, | |
252 | CAR_PLLX_MISC_LOCK_ENABLE, 0); | 252 | CAR_PLLX_MISC_LOCK_ENABLE, 0); | |
253 | do { | 253 | do { | |
254 | delay(2); | 254 | delay(2); | |
255 | base = bus_space_read_4(bst, bsh, CAR_PLLX_BASE_REG); | 255 | base = bus_space_read_4(bst, bsh, CAR_PLLX_BASE_REG); | |
256 | } while ((base & CAR_PLLX_BASE_LOCK) == 0); | 256 | } while ((base & CAR_PLLX_BASE_LOCK) == 0); | |
257 | delay(100); | 257 | delay(100); | |
258 | 258 | |||
259 | bp &= ~CAR_CCLKG_BURST_POLICY_CPU_STATE; | 259 | bp &= ~CAR_CCLKG_BURST_POLICY_CPU_STATE; | |
260 | bp |= __SHIFTIN(CAR_CCLKG_BURST_POLICY_CPU_STATE_RUN, | 260 | bp |= __SHIFTIN(CAR_CCLKG_BURST_POLICY_CPU_STATE_RUN, | |
261 | CAR_CCLKG_BURST_POLICY_CPU_STATE); | 261 | CAR_CCLKG_BURST_POLICY_CPU_STATE); | |
262 | bp &= ~CAR_CCLKG_BURST_POLICY_CWAKEUP_IDLE_SOURCE; | 262 | bp &= ~CAR_CCLKG_BURST_POLICY_CWAKEUP_IDLE_SOURCE; | |
263 | bp |= __SHIFTIN(CAR_CCLKG_BURST_POLICY_CWAKEUP_SOURCE_PLLX_OUT0_LJ, | 263 | bp |= __SHIFTIN(CAR_CCLKG_BURST_POLICY_CWAKEUP_SOURCE_PLLX_OUT0_LJ, | |
264 | CAR_CCLKG_BURST_POLICY_CWAKEUP_IDLE_SOURCE); | 264 | CAR_CCLKG_BURST_POLICY_CWAKEUP_IDLE_SOURCE); | |
265 | bus_space_write_4(bst, bsh, CAR_CCLKG_BURST_POLICY_REG, bp); | 265 | bus_space_write_4(bst, bsh, CAR_CCLKG_BURST_POLICY_REG, bp); | |
266 | } | 266 | } | |
267 | 267 | |||
268 | u_int | 268 | u_int | |
269 | tegra_car_pllx_rate(void) | 269 | tegra_car_pllx_rate(void) | |
270 | { | 270 | { | |
271 | return tegra_car_pll_rate(CAR_PLLX_BASE_REG, CAR_PLLX_BASE_DIVM, | 271 | return tegra_car_pll_rate(CAR_PLLX_BASE_REG, CAR_PLLX_BASE_DIVM, | |
272 | CAR_PLLX_BASE_DIVN, CAR_PLLX_BASE_DIVP); | 272 | CAR_PLLX_BASE_DIVN, CAR_PLLX_BASE_DIVP); | |
273 | } | 273 | } | |
274 | 274 | |||
275 | u_int | 275 | u_int | |
276 | tegra_car_pllc_rate(void) | 276 | tegra_car_pllc_rate(void) | |
277 | { | 277 | { | |
278 | return tegra_car_pll_rate(CAR_PLLC_BASE_REG, CAR_PLLC_BASE_DIVM, | 278 | return tegra_car_pll_rate(CAR_PLLC_BASE_REG, CAR_PLLC_BASE_DIVM, | |
279 | CAR_PLLC_BASE_DIVN, CAR_PLLC_BASE_DIVP); | 279 | CAR_PLLC_BASE_DIVN, CAR_PLLC_BASE_DIVP); | |
280 | } | 280 | } | |
281 | 281 | |||
282 | u_int | 282 | u_int | |
283 | tegra_car_plle_rate(void) | 283 | tegra_car_plle_rate(void) | |
284 | { | 284 | { | |
285 | return tegra_car_pll_rate(CAR_PLLE_BASE_REG, CAR_PLLE_BASE_DIVM, | 285 | return tegra_car_pll_rate(CAR_PLLE_BASE_REG, CAR_PLLE_BASE_DIVM, | |
286 | CAR_PLLE_BASE_DIVN, CAR_PLLE_BASE_DIVP_CML); | 286 | CAR_PLLE_BASE_DIVN, CAR_PLLE_BASE_DIVP_CML); | |
287 | } | 287 | } | |
288 | 288 | |||
289 | u_int | 289 | u_int | |
290 | tegra_car_pllu_rate(void) | 290 | tegra_car_pllu_rate(void) | |
291 | { | 291 | { | |
292 | bus_space_tag_t bst; | 292 | bus_space_tag_t bst; | |
293 | bus_space_handle_t bsh; | 293 | bus_space_handle_t bsh; | |
294 | uint64_t rate; | 294 | uint64_t rate; | |
295 | 295 | |||
296 | tegra_car_get_bs(&bst, &bsh); | 296 | tegra_car_get_bs(&bst, &bsh); | |
297 | 297 | |||
298 | rate = tegra_car_osc_rate(); | 298 | rate = tegra_car_osc_rate(); | |
299 | const uint32_t base = bus_space_read_4(bst, bsh, CAR_PLLU_BASE_REG); | 299 | const uint32_t base = bus_space_read_4(bst, bsh, CAR_PLLU_BASE_REG); | |
300 | const u_int divm = __SHIFTOUT(base, CAR_PLLU_BASE_DIVM); | 300 | const u_int divm = __SHIFTOUT(base, CAR_PLLU_BASE_DIVM); | |
301 | const u_int divn = __SHIFTOUT(base, CAR_PLLU_BASE_DIVN); | 301 | const u_int divn = __SHIFTOUT(base, CAR_PLLU_BASE_DIVN); | |
302 | const u_int divp = __SHIFTOUT(base, CAR_PLLU_BASE_VCO_FREQ) ? 0 : 1; | 302 | const u_int divp = __SHIFTOUT(base, CAR_PLLU_BASE_VCO_FREQ) ? 0 : 1; | |
303 | 303 | |||
304 | rate = (uint64_t)tegra_car_osc_rate() * divn; | 304 | rate = (uint64_t)tegra_car_osc_rate() * divn; | |
305 | 305 | |||
306 | return rate / (divm << divp); | 306 | return rate / (divm << divp); | |
307 | } | 307 | } | |
308 | 308 | |||
309 | u_int | 309 | u_int | |
310 | tegra_car_pllp0_rate(void) | 310 | tegra_car_pllp0_rate(void) | |
311 | { | 311 | { | |
312 | return tegra_car_pll_rate(CAR_PLLP_BASE_REG, CAR_PLLP_BASE_DIVM, | 312 | return tegra_car_pll_rate(CAR_PLLP_BASE_REG, CAR_PLLP_BASE_DIVM, | |
313 | CAR_PLLP_BASE_DIVN, CAR_PLLP_BASE_DIVP); | 313 | CAR_PLLP_BASE_DIVN, CAR_PLLP_BASE_DIVP); | |
314 | } | 314 | } | |
315 | 315 | |||
316 | u_int | 316 | u_int | |
317 | tegra_car_plld2_rate(void) | 317 | tegra_car_plld2_rate(void) | |
318 | { | 318 | { | |
319 | return tegra_car_pll_rate(CAR_PLLD2_BASE_REG, CAR_PLLD2_BASE_MDIV, | 319 | return tegra_car_pll_rate(CAR_PLLD2_BASE_REG, CAR_PLLD2_BASE_MDIV, | |
320 | CAR_PLLD2_BASE_NDIV, CAR_PLLD2_BASE_PLDIV); | 320 | CAR_PLLD2_BASE_NDIV, CAR_PLLD2_BASE_PLDIV); | |
321 | } | 321 | } | |
322 | 322 | |||
323 | u_int | 323 | u_int | |
324 | tegra_car_uart_rate(u_int port) | 324 | tegra_car_uart_rate(u_int port) | |
325 | { | 325 | { | |
326 | bus_space_tag_t bst; | 326 | bus_space_tag_t bst; | |
327 | bus_space_handle_t bsh; | 327 | bus_space_handle_t bsh; | |
328 | bus_size_t src_reg; | 328 | bus_size_t src_reg; | |
329 | u_int src_rate; | 329 | u_int src_rate; | |
330 | 330 | |||
331 | tegra_car_get_bs(&bst, &bsh); | 331 | tegra_car_get_bs(&bst, &bsh); | |
332 | 332 | |||
333 | switch (port) { | 333 | switch (port) { | |
334 | case 0: src_reg = CAR_CLKSRC_UARTA_REG; break; | 334 | case 0: src_reg = CAR_CLKSRC_UARTA_REG; break; | |
335 | case 1: src_reg = CAR_CLKSRC_UARTB_REG; break; | 335 | case 1: src_reg = CAR_CLKSRC_UARTB_REG; break; | |
336 | case 2: src_reg = CAR_CLKSRC_UARTC_REG; break; | 336 | case 2: src_reg = CAR_CLKSRC_UARTC_REG; break; | |
337 | case 3: src_reg = CAR_CLKSRC_UARTD_REG; break; | 337 | case 3: src_reg = CAR_CLKSRC_UARTD_REG; break; | |
338 | default: return 0; | 338 | default: return 0; | |
339 | } | 339 | } | |
340 | 340 | |||
341 | const uint32_t src = bus_space_read_4(bst, bsh, src_reg); | 341 | const uint32_t src = bus_space_read_4(bst, bsh, src_reg); | |
342 | switch (__SHIFTOUT(src, CAR_CLKSRC_UART_SRC)) { | 342 | switch (__SHIFTOUT(src, CAR_CLKSRC_UART_SRC)) { | |
343 | case 0: | 343 | case 0: | |
344 | src_rate = tegra_car_pllp0_rate(); | 344 | src_rate = tegra_car_pllp0_rate(); | |
345 | break; | 345 | break; | |
346 | default: | 346 | default: | |
347 | panic("%s: unsupported src %#x", __func__, src); | 347 | panic("%s: unsupported src %#x", __func__, src); | |
348 | } | 348 | } | |
349 | 349 | |||
350 | if (__SHIFTOUT(src, CAR_CLKSRC_UART_DIV_ENB)) { | 350 | if (__SHIFTOUT(src, CAR_CLKSRC_UART_DIV_ENB)) { | |
351 | const u_int div = (__SHIFTOUT(src, CAR_CLKSRC_UART_DIV) / 2) + 1; | 351 | const u_int div = (__SHIFTOUT(src, CAR_CLKSRC_UART_DIV) / 2) + 1; | |
352 | return src_rate / div; | 352 | return src_rate / div; | |
353 | } else { | 353 | } else { | |
354 | return src_rate; | 354 | return src_rate; | |
355 | } | 355 | } | |
356 | } | 356 | } | |
357 | 357 | |||
358 | u_int | 358 | u_int | |
359 | tegra_car_periph_sdmmc_rate(u_int port) | 359 | tegra_car_periph_sdmmc_rate(u_int port) | |
360 | { | 360 | { | |
361 | bus_space_tag_t bst; | 361 | bus_space_tag_t bst; | |
362 | bus_space_handle_t bsh; | 362 | bus_space_handle_t bsh; | |
363 | bus_size_t src_reg; | 363 | bus_size_t src_reg; | |
364 | 364 | |||
365 | tegra_car_get_bs(&bst, &bsh); | 365 | tegra_car_get_bs(&bst, &bsh); | |
366 | 366 | |||
367 | switch (port) { | 367 | switch (port) { | |
368 | case 0: src_reg = CAR_CLKSRC_SDMMC1_REG; break; | 368 | case 0: src_reg = CAR_CLKSRC_SDMMC1_REG; break; | |
369 | case 1: src_reg = CAR_CLKSRC_SDMMC2_REG; break; | 369 | case 1: src_reg = CAR_CLKSRC_SDMMC2_REG; break; | |
370 | case 2: src_reg = CAR_CLKSRC_SDMMC3_REG; break; | 370 | case 2: src_reg = CAR_CLKSRC_SDMMC3_REG; break; | |
371 | case 3: src_reg = CAR_CLKSRC_SDMMC4_REG; break; | 371 | case 3: src_reg = CAR_CLKSRC_SDMMC4_REG; break; | |
372 | default: return 0; | 372 | default: return 0; | |
373 | } | 373 | } | |
374 | 374 | |||
375 | const uint32_t src = bus_space_read_4(bst, bsh, src_reg); | 375 | const uint32_t src = bus_space_read_4(bst, bsh, src_reg); | |
376 | 376 | |||
377 | const u_int div = __SHIFTOUT(src, CAR_CLKSRC_SDMMC_DIV) + 2; | 377 | const u_int div = __SHIFTOUT(src, CAR_CLKSRC_SDMMC_DIV) + 2; | |
378 | 378 | |||
379 | return (tegra_car_pllp0_rate() * 2) / div; | 379 | return (tegra_car_pllp0_rate() * 2) / div; | |
380 | } | 380 | } | |
381 | 381 | |||
382 | int | 382 | int | |
383 | tegra_car_periph_sdmmc_set_rate(u_int port, u_int rate) | 383 | tegra_car_periph_sdmmc_set_rate(u_int port, u_int rate) | |
384 | { | 384 | { | |
385 | bus_space_tag_t bst; | 385 | bus_space_tag_t bst; | |
386 | bus_space_handle_t bsh; | 386 | bus_space_handle_t bsh; | |
387 | bus_size_t src_reg, rst_reg, enb_reg; | 387 | bus_size_t src_reg, rst_reg, enb_reg; | |
388 | u_int dev_bit; | 388 | u_int dev_bit; | |
389 | uint32_t src; | 389 | uint32_t src; | |
390 | 390 | |||
391 | KASSERT(rate > 0); | 391 | KASSERT(rate > 0); | |
392 | 392 | |||
393 | tegra_car_get_bs(&bst, &bsh); | 393 | tegra_car_get_bs(&bst, &bsh); | |
394 | 394 | |||
395 | switch (port) { | 395 | switch (port) { | |
396 | case 0: | 396 | case 0: | |
397 | src_reg = CAR_CLKSRC_SDMMC1_REG; | 397 | src_reg = CAR_CLKSRC_SDMMC1_REG; | |
398 | rst_reg = CAR_RST_DEV_L_SET_REG; | 398 | rst_reg = CAR_RST_DEV_L_SET_REG; | |
399 | enb_reg = CAR_CLK_ENB_L_SET_REG; | 399 | enb_reg = CAR_CLK_ENB_L_SET_REG; | |
400 | dev_bit = CAR_DEV_L_SDMMC1; | 400 | dev_bit = CAR_DEV_L_SDMMC1; | |
401 | break; | 401 | break; | |
402 | case 1: | 402 | case 1: | |
403 | src_reg = CAR_CLKSRC_SDMMC2_REG; | 403 | src_reg = CAR_CLKSRC_SDMMC2_REG; | |
404 | rst_reg = CAR_RST_DEV_L_SET_REG; | 404 | rst_reg = CAR_RST_DEV_L_SET_REG; | |
405 | enb_reg = CAR_CLK_ENB_L_SET_REG; | 405 | enb_reg = CAR_CLK_ENB_L_SET_REG; | |
406 | dev_bit = CAR_DEV_L_SDMMC2; | 406 | dev_bit = CAR_DEV_L_SDMMC2; | |
407 | break; | 407 | break; | |
408 | case 2: | 408 | case 2: | |
409 | src_reg = CAR_CLKSRC_SDMMC3_REG; | 409 | src_reg = CAR_CLKSRC_SDMMC3_REG; | |
410 | rst_reg = CAR_RST_DEV_U_SET_REG; | 410 | rst_reg = CAR_RST_DEV_U_SET_REG; | |
411 | enb_reg = CAR_CLK_ENB_U_SET_REG; | 411 | enb_reg = CAR_CLK_ENB_U_SET_REG; | |
412 | dev_bit = CAR_DEV_U_SDMMC3; | 412 | dev_bit = CAR_DEV_U_SDMMC3; | |
413 | break; | 413 | break; | |
414 | case 3: | 414 | case 3: | |
415 | src_reg = CAR_CLKSRC_SDMMC4_REG; | 415 | src_reg = CAR_CLKSRC_SDMMC4_REG; | |
416 | rst_reg = CAR_RST_DEV_L_SET_REG; | 416 | rst_reg = CAR_RST_DEV_L_SET_REG; | |
417 | enb_reg = CAR_CLK_ENB_L_SET_REG; | 417 | enb_reg = CAR_CLK_ENB_L_SET_REG; | |
418 | dev_bit = CAR_DEV_L_SDMMC4; | 418 | dev_bit = CAR_DEV_L_SDMMC4; | |
419 | break; | 419 | break; | |
420 | default: return EINVAL; | 420 | default: return EINVAL; | |
421 | } | 421 | } | |
422 | 422 | |||
423 | /* enter reset */ | 423 | /* enter reset */ | |
424 | bus_space_write_4(bst, bsh, rst_reg, dev_bit); | 424 | bus_space_write_4(bst, bsh, rst_reg, dev_bit); | |
425 | /* enable clk */ | 425 | /* enable clk */ | |
426 | bus_space_write_4(bst, bsh, enb_reg, dev_bit); | 426 | bus_space_write_4(bst, bsh, enb_reg, dev_bit); | |
427 | 427 | |||
428 | const u_int div = howmany(tegra_car_pllp0_rate() * 2, rate) - 2; | 428 | const u_int div = howmany(tegra_car_pllp0_rate() * 2, rate) - 2; | |
429 | 429 | |||
430 | /* update clk div */ | 430 | /* update clk div */ | |
431 | src = __SHIFTIN(CAR_CLKSRC_SDMMC_SRC_PLLP_OUT0, | 431 | src = __SHIFTIN(CAR_CLKSRC_SDMMC_SRC_PLLP_OUT0, | |
432 | CAR_CLKSRC_SDMMC_SRC); | 432 | CAR_CLKSRC_SDMMC_SRC); | |
433 | src |= __SHIFTIN(div, CAR_CLKSRC_SDMMC_DIV); | 433 | src |= __SHIFTIN(div, CAR_CLKSRC_SDMMC_DIV); | |
434 | bus_space_write_4(bst, bsh, src_reg, src); | 434 | bus_space_write_4(bst, bsh, src_reg, src); | |
435 | 435 | |||
436 | /* leave reset */ | 436 | /* leave reset */ | |
437 | bus_space_write_4(bst, bsh, rst_reg+4, dev_bit); | 437 | bus_space_write_4(bst, bsh, rst_reg+4, dev_bit); | |
438 | 438 | |||
439 | return 0; | 439 | return 0; | |
440 | } | 440 | } | |
441 | 441 | |||
442 | int | 442 | int | |
443 | tegra_car_periph_usb_enable(u_int port) | 443 | tegra_car_periph_usb_enable(u_int port) | |
444 | { | 444 | { | |
445 | bus_space_tag_t bst; | 445 | bus_space_tag_t bst; | |
446 | bus_space_handle_t bsh; | 446 | bus_space_handle_t bsh; | |
447 | bus_size_t rst_reg, enb_reg; | 447 | bus_size_t rst_reg, enb_reg; | |
448 | uint32_t dev_bit; | 448 | uint32_t dev_bit; | |
449 | 449 | |||
450 | tegra_car_get_bs(&bst, &bsh); | 450 | tegra_car_get_bs(&bst, &bsh); | |
451 | switch (port) { | 451 | switch (port) { | |
452 | case 0: | 452 | case 0: | |
453 | rst_reg = CAR_RST_DEV_L_SET_REG; | 453 | rst_reg = CAR_RST_DEV_L_SET_REG; | |
454 | enb_reg = CAR_CLK_ENB_L_SET_REG; | 454 | enb_reg = CAR_CLK_ENB_L_SET_REG; | |
455 | dev_bit = CAR_DEV_L_USBD; | 455 | dev_bit = CAR_DEV_L_USBD; | |
456 | break; | 456 | break; | |
457 | case 1: | 457 | case 1: | |
458 | rst_reg = CAR_RST_DEV_H_SET_REG; | 458 | rst_reg = CAR_RST_DEV_H_SET_REG; | |
459 | enb_reg = CAR_CLK_ENB_H_SET_REG; | 459 | enb_reg = CAR_CLK_ENB_H_SET_REG; | |
460 | dev_bit = CAR_DEV_H_USB2; | 460 | dev_bit = CAR_DEV_H_USB2; | |
461 | break; | 461 | break; | |
462 | case 2: | 462 | case 2: | |
463 | rst_reg = CAR_RST_DEV_H_SET_REG; | 463 | rst_reg = CAR_RST_DEV_H_SET_REG; | |
464 | enb_reg = CAR_CLK_ENB_H_SET_REG; | 464 | enb_reg = CAR_CLK_ENB_H_SET_REG; | |
465 | dev_bit = CAR_DEV_H_USB3; | 465 | dev_bit = CAR_DEV_H_USB3; | |
466 | break; | 466 | break; | |
467 | default: | 467 | default: | |
468 | return EINVAL; | 468 | return EINVAL; | |
469 | } | 469 | } | |
470 | 470 | |||
471 | /* enter reset */ | 471 | /* enter reset */ | |
472 | bus_space_write_4(bst, bsh, rst_reg, dev_bit); | 472 | bus_space_write_4(bst, bsh, rst_reg, dev_bit); | |
473 | /* enable clk */ | 473 | /* enable clk */ | |
474 | bus_space_write_4(bst, bsh, enb_reg, dev_bit); | 474 | bus_space_write_4(bst, bsh, enb_reg, dev_bit); | |
475 | 475 | |||
476 | /* leave reset */ | 476 | /* leave reset */ | |
477 | bus_space_write_4(bst, bsh, rst_reg+4, dev_bit); | 477 | bus_space_write_4(bst, bsh, rst_reg+4, dev_bit); | |
478 | 478 | |||
479 | return 0; | 479 | return 0; | |
480 | } | 480 | } | |
481 | 481 | |||
482 | void | 482 | void | |
483 | tegra_car_utmip_init(void) | 483 | tegra_car_utmip_init(void) | |
484 | { | 484 | { | |
485 | const u_int enable_dly_count = 0x02; | 485 | const u_int enable_dly_count = 0x02; | |
486 | const u_int stable_count = 0x2f; | 486 | const u_int stable_count = 0x2f; | |
487 | const u_int active_dly_count = 0x04; | 487 | const u_int active_dly_count = 0x04; | |
488 | const u_int xtal_freq_count = 0x76; | 488 | const u_int xtal_freq_count = 0x76; | |
489 | bus_space_tag_t bst; | 489 | bus_space_tag_t bst; | |
490 | bus_space_handle_t bsh; | 490 | bus_space_handle_t bsh; | |
491 | 491 | |||
492 | tegra_car_get_bs(&bst, &bsh); | 492 | tegra_car_get_bs(&bst, &bsh); | |
493 | 493 | |||
494 | tegra_reg_set_clear(bst, bsh, CAR_UTMIP_PLL_CFG2_REG, | 494 | tegra_reg_set_clear(bst, bsh, CAR_UTMIP_PLL_CFG2_REG, | |
495 | __SHIFTIN(stable_count, CAR_UTMIP_PLL_CFG2_STABLE_COUNT) | | 495 | __SHIFTIN(stable_count, CAR_UTMIP_PLL_CFG2_STABLE_COUNT) | | |
496 | __SHIFTIN(active_dly_count, CAR_UTMIP_PLL_CFG2_ACTIVE_DLY_COUNT), | 496 | __SHIFTIN(active_dly_count, CAR_UTMIP_PLL_CFG2_ACTIVE_DLY_COUNT), | |
497 | CAR_UTMIP_PLL_CFG2_STABLE_COUNT | | 497 | CAR_UTMIP_PLL_CFG2_STABLE_COUNT | | |
498 | CAR_UTMIP_PLL_CFG2_ACTIVE_DLY_COUNT); | 498 | CAR_UTMIP_PLL_CFG2_ACTIVE_DLY_COUNT); | |
499 | 499 | |||
500 | tegra_reg_set_clear(bst, bsh, CAR_UTMIP_PLL_CFG1_REG, | 500 | tegra_reg_set_clear(bst, bsh, CAR_UTMIP_PLL_CFG1_REG, | |
501 | __SHIFTIN(enable_dly_count, CAR_UTMIP_PLL_CFG1_ENABLE_DLY_COUNT) | | 501 | __SHIFTIN(enable_dly_count, CAR_UTMIP_PLL_CFG1_ENABLE_DLY_COUNT) | | |
502 | __SHIFTIN(xtal_freq_count, CAR_UTMIP_PLL_CFG1_XTAL_FREQ_COUNT), | 502 | __SHIFTIN(xtal_freq_count, CAR_UTMIP_PLL_CFG1_XTAL_FREQ_COUNT), | |
503 | CAR_UTMIP_PLL_CFG1_ENABLE_DLY_COUNT | | 503 | CAR_UTMIP_PLL_CFG1_ENABLE_DLY_COUNT | | |
504 | CAR_UTMIP_PLL_CFG1_XTAL_FREQ_COUNT); | 504 | CAR_UTMIP_PLL_CFG1_XTAL_FREQ_COUNT); | |
505 | 505 | |||
506 | tegra_reg_set_clear(bst, bsh, CAR_UTMIP_PLL_CFG1_REG, | 506 | tegra_reg_set_clear(bst, bsh, CAR_UTMIP_PLL_CFG1_REG, | |
507 | 0, | 507 | 0, | |
508 | CAR_UTMIP_PLL_CFG1_PLLU_POWERDOWN | | 508 | CAR_UTMIP_PLL_CFG1_PLLU_POWERDOWN | | |
509 | CAR_UTMIP_PLL_CFG1_PLL_ENABLE_POWERDOWN); | 509 | CAR_UTMIP_PLL_CFG1_PLL_ENABLE_POWERDOWN); | |
510 | } | 510 | } | |
511 | 511 | |||
512 | void | 512 | void | |
513 | tegra_car_utmip_enable(u_int port) | 513 | tegra_car_utmip_enable(u_int port) | |
514 | { | 514 | { | |
515 | bus_space_tag_t bst; | 515 | bus_space_tag_t bst; | |
516 | bus_space_handle_t bsh; | 516 | bus_space_handle_t bsh; | |
517 | uint32_t bit = 0; | 517 | uint32_t bit = 0; | |
518 | 518 | |||
519 | tegra_car_get_bs(&bst, &bsh); | 519 | tegra_car_get_bs(&bst, &bsh); | |
520 | 520 | |||
521 | switch (port) { | 521 | switch (port) { | |
522 | case 0: bit = CAR_UTMIP_PLL_CFG2_PD_SAMP_A_POWERDOWN; break; | 522 | case 0: bit = CAR_UTMIP_PLL_CFG2_PD_SAMP_A_POWERDOWN; break; | |
523 | case 1: bit = CAR_UTMIP_PLL_CFG2_PD_SAMP_B_POWERDOWN; break; | 523 | case 1: bit = CAR_UTMIP_PLL_CFG2_PD_SAMP_B_POWERDOWN; break; | |
524 | case 2: bit = CAR_UTMIP_PLL_CFG2_PD_SAMP_C_POWERDOWN; break; | 524 | case 2: bit = CAR_UTMIP_PLL_CFG2_PD_SAMP_C_POWERDOWN; break; | |
525 | } | 525 | } | |
526 | 526 | |||
527 | tegra_reg_set_clear(bst, bsh, CAR_UTMIP_PLL_CFG2_REG, 0, bit); | 527 | tegra_reg_set_clear(bst, bsh, CAR_UTMIP_PLL_CFG2_REG, 0, bit); | |
528 | } | 528 | } | |
529 | 529 | |||
530 | void | 530 | void | |
531 | tegra_car_periph_hda_enable(void) | 531 | tegra_car_periph_hda_enable(void) | |
532 | { | 532 | { | |
533 | bus_space_tag_t bst; | 533 | bus_space_tag_t bst; | |
534 | bus_space_handle_t bsh; | 534 | bus_space_handle_t bsh; | |
535 | 535 | |||
536 | tegra_car_get_bs(&bst, &bsh); | 536 | tegra_car_get_bs(&bst, &bsh); | |
537 | 537 | |||
538 | bus_space_write_4(bst, bsh, CAR_RST_DEV_V_SET_REG, CAR_DEV_V_HDA); | 538 | bus_space_write_4(bst, bsh, CAR_RST_DEV_V_SET_REG, CAR_DEV_V_HDA); | |
539 | bus_space_write_4(bst, bsh, CAR_CLK_ENB_V_SET_REG, CAR_DEV_V_HDA); | 539 | bus_space_write_4(bst, bsh, CAR_CLK_ENB_V_SET_REG, CAR_DEV_V_HDA); | |
540 | bus_space_write_4(bst, bsh, CAR_RST_DEV_V_SET_REG, | 540 | bus_space_write_4(bst, bsh, CAR_RST_DEV_V_SET_REG, | |
541 | CAR_DEV_V_HDA2CODEC_2X); | 541 | CAR_DEV_V_HDA2CODEC_2X); | |
542 | bus_space_write_4(bst, bsh, CAR_CLK_ENB_V_SET_REG, | 542 | bus_space_write_4(bst, bsh, CAR_CLK_ENB_V_SET_REG, | |
543 | CAR_DEV_V_HDA2CODEC_2X); | 543 | CAR_DEV_V_HDA2CODEC_2X); | |
544 | bus_space_write_4(bst, bsh, CAR_RST_DEV_W_SET_REG, | 544 | bus_space_write_4(bst, bsh, CAR_RST_DEV_W_SET_REG, | |
545 | CAR_DEV_W_HDA2HDMICODEC); | 545 | CAR_DEV_W_HDA2HDMICODEC); | |
546 | bus_space_write_4(bst, bsh, CAR_CLK_ENB_W_SET_REG, | 546 | bus_space_write_4(bst, bsh, CAR_CLK_ENB_W_SET_REG, | |
547 | CAR_DEV_W_HDA2HDMICODEC); | 547 | CAR_DEV_W_HDA2HDMICODEC); | |
548 | 548 | |||
549 | /* configure HDA2CODEC_2X for 48 MHz */ | 549 | /* configure HDA2CODEC_2X for 48 MHz */ | |
550 | const u_int div = howmany(tegra_car_pllp0_rate() * 2, 48000000) - 2; | 550 | const u_int div = howmany(tegra_car_pllp0_rate() * 2, 48000000) - 2; | |
551 | bus_space_write_4(bst, bsh, CAR_CLKSRC_HDA2CODEC_2X_REG, | 551 | bus_space_write_4(bst, bsh, CAR_CLKSRC_HDA2CODEC_2X_REG, | |
552 | __SHIFTIN(CAR_CLKSRC_HDA2CODEC_2X_SRC_PLLP_OUT0, | 552 | __SHIFTIN(CAR_CLKSRC_HDA2CODEC_2X_SRC_PLLP_OUT0, | |
553 | CAR_CLKSRC_HDA2CODEC_2X_SRC) | | 553 | CAR_CLKSRC_HDA2CODEC_2X_SRC) | | |
554 | __SHIFTIN(div, CAR_CLKSRC_HDA2CODEC_2X_DIV)); | 554 | __SHIFTIN(div, CAR_CLKSRC_HDA2CODEC_2X_DIV)); | |
555 | 555 | |||
556 | bus_space_write_4(bst, bsh, CAR_RST_DEV_V_CLR_REG, CAR_DEV_V_HDA); | 556 | bus_space_write_4(bst, bsh, CAR_RST_DEV_V_CLR_REG, CAR_DEV_V_HDA); | |
557 | bus_space_write_4(bst, bsh, CAR_RST_DEV_V_CLR_REG, | 557 | bus_space_write_4(bst, bsh, CAR_RST_DEV_V_CLR_REG, | |
558 | CAR_DEV_V_HDA2CODEC_2X); | 558 | CAR_DEV_V_HDA2CODEC_2X); | |
559 | bus_space_write_4(bst, bsh, CAR_RST_DEV_W_CLR_REG, | 559 | bus_space_write_4(bst, bsh, CAR_RST_DEV_W_CLR_REG, | |
560 | CAR_DEV_W_HDA2HDMICODEC); | 560 | CAR_DEV_W_HDA2HDMICODEC); | |
561 | } | 561 | } | |
562 | 562 | |||
563 | void | 563 | void | |
564 | tegra_car_periph_sata_enable(void) | 564 | tegra_car_periph_sata_enable(void) | |
565 | { | 565 | { | |
566 | bus_space_tag_t bst; | 566 | bus_space_tag_t bst; | |
567 | bus_space_handle_t bsh; | 567 | bus_space_handle_t bsh; | |
568 | 568 | |||
569 | tegra_car_get_bs(&bst, &bsh); | 569 | tegra_car_get_bs(&bst, &bsh); | |
570 | 570 | |||
571 | /* Assert resets */ | 571 | /* Assert resets */ | |
572 | bus_space_write_4(bst, bsh, CAR_RST_DEV_V_SET_REG, CAR_DEV_V_SATA); | 572 | bus_space_write_4(bst, bsh, CAR_RST_DEV_V_SET_REG, CAR_DEV_V_SATA); | |
573 | bus_space_write_4(bst, bsh, CAR_RST_DEV_W_SET_REG, CAR_DEV_W_SATACOLD); | 573 | bus_space_write_4(bst, bsh, CAR_RST_DEV_W_SET_REG, CAR_DEV_W_SATACOLD); | |
574 | 574 | |||
575 | /* Disable software control of SATA PLL */ | 575 | /* Disable software control of SATA PLL */ | |
576 | tegra_reg_set_clear(bst, bsh, CAR_SATA_PLL_CFG0_REG, | 576 | tegra_reg_set_clear(bst, bsh, CAR_SATA_PLL_CFG0_REG, | |
577 | 0, CAR_SATA_PLL_CFG0_PADPLL_RESET_SWCTL); | 577 | 0, CAR_SATA_PLL_CFG0_PADPLL_RESET_SWCTL); | |
578 | 578 | |||
579 | /* Set SATA_OOB clock source to PLLP, 204MHz */ | 579 | /* Set SATA_OOB clock source to PLLP, 204MHz */ | |
580 | const u_int sataoob_div = 2; | 580 | const u_int sataoob_div = 2; | |
581 | bus_space_write_4(bst, bsh, CAR_CLKSRC_SATA_OOB_REG, | 581 | bus_space_write_4(bst, bsh, CAR_CLKSRC_SATA_OOB_REG, | |
582 | __SHIFTIN(CAR_CLKSRC_SATA_OOB_SRC_PLLP_OUT0, | 582 | __SHIFTIN(CAR_CLKSRC_SATA_OOB_SRC_PLLP_OUT0, | |
583 | CAR_CLKSRC_SATA_OOB_SRC) | | 583 | CAR_CLKSRC_SATA_OOB_SRC) | | |
584 | __SHIFTIN((sataoob_div - 1) * 2, CAR_CLKSRC_SATA_OOB_DIV)); | 584 | __SHIFTIN((sataoob_div - 1) * 2, CAR_CLKSRC_SATA_OOB_DIV)); | |
585 | 585 | |||
586 | /* Set SATA clock source to PLLP, 102MHz */ | 586 | /* Set SATA clock source to PLLP, 102MHz */ | |
587 | const u_int sata_div = 4; | 587 | const u_int sata_div = 4; | |
588 | bus_space_write_4(bst, bsh, CAR_CLKSRC_SATA_REG, | 588 | bus_space_write_4(bst, bsh, CAR_CLKSRC_SATA_REG, | |
589 | CAR_CLKSRC_SATA_AUX_CLK_ENB | | 589 | CAR_CLKSRC_SATA_AUX_CLK_ENB | | |
590 | __SHIFTIN(CAR_CLKSRC_SATA_SRC_PLLP_OUT0, | 590 | __SHIFTIN(CAR_CLKSRC_SATA_SRC_PLLP_OUT0, | |
591 | CAR_CLKSRC_SATA_SRC) | | 591 | CAR_CLKSRC_SATA_SRC) | | |
592 | __SHIFTIN((sata_div - 1) * 2, CAR_CLKSRC_SATA_DIV)); | 592 | __SHIFTIN((sata_div - 1) * 2, CAR_CLKSRC_SATA_DIV)); | |
593 | 593 | |||
594 | /* Ungate SAX partition in the PMC */ | 594 | /* Ungate SAX partition in the PMC */ | |
595 | tegra_pmc_power(PMC_PARTID_SAX, true); | 595 | tegra_pmc_power(PMC_PARTID_SAX, true); | |
596 | delay(20); | 596 | delay(20); | |
597 | 597 | |||
598 | /* Remove clamping from SAX partition in the PMC */ | 598 | /* Remove clamping from SAX partition in the PMC */ | |
599 | tegra_pmc_remove_clamping(PMC_PARTID_SAX); | 599 | tegra_pmc_remove_clamping(PMC_PARTID_SAX); | |
600 | delay(20); | 600 | delay(20); | |
601 | 601 | |||
602 | /* De-assert reset to SATA PADPLL */ | 602 | /* De-assert reset to SATA PADPLL */ | |
603 | tegra_reg_set_clear(bst, bsh, CAR_SATA_PLL_CFG0_REG, | 603 | tegra_reg_set_clear(bst, bsh, CAR_SATA_PLL_CFG0_REG, | |
604 | 0, CAR_SATA_PLL_CFG0_PADPLL_RESET_OVERRIDE_VALUE); | 604 | 0, CAR_SATA_PLL_CFG0_PADPLL_RESET_OVERRIDE_VALUE); | |
605 | delay(15); | 605 | delay(15); | |
606 | 606 | |||
607 | /* Enable CML clock for SATA */ | 607 | /* Enable CML clock for SATA */ | |
608 | tegra_reg_set_clear(bst, bsh, CAR_PLLE_AUX_REG, | 608 | tegra_reg_set_clear(bst, bsh, CAR_PLLE_AUX_REG, | |
609 | CAR_PLLE_AUX_CML1_OEN, 0); | 609 | CAR_PLLE_AUX_CML1_OEN, 0); | |
610 | 610 | |||
611 | /* Turn on the clocks to SATA and de-assert resets */ | 611 | /* Turn on the clocks to SATA and de-assert resets */ | |
612 | bus_space_write_4(bst, bsh, CAR_CLK_ENB_W_SET_REG, CAR_DEV_W_SATACOLD); | 612 | bus_space_write_4(bst, bsh, CAR_CLK_ENB_W_SET_REG, CAR_DEV_W_SATACOLD); | |
613 | bus_space_write_4(bst, bsh, CAR_CLK_ENB_V_SET_REG, CAR_DEV_V_SATA); | 613 | bus_space_write_4(bst, bsh, CAR_CLK_ENB_V_SET_REG, CAR_DEV_V_SATA); | |
614 | bus_space_write_4(bst, bsh, CAR_CLK_ENB_V_SET_REG, CAR_DEV_V_SATA_OOB); | 614 | bus_space_write_4(bst, bsh, CAR_CLK_ENB_V_SET_REG, CAR_DEV_V_SATA_OOB); | |
615 | 615 | |||
616 | bus_space_write_4(bst, bsh, CAR_RST_DEV_W_CLR_REG, CAR_DEV_W_SATACOLD); | 616 | bus_space_write_4(bst, bsh, CAR_RST_DEV_W_CLR_REG, CAR_DEV_W_SATACOLD); | |
617 | bus_space_write_4(bst, bsh, CAR_RST_DEV_V_CLR_REG, CAR_DEV_V_SATA); | 617 | bus_space_write_4(bst, bsh, CAR_RST_DEV_V_CLR_REG, CAR_DEV_V_SATA); | |
618 | } | 618 | } | |
619 | 619 | |||
620 | int | 620 | int | |
621 | tegra_car_periph_i2c_enable(u_int port, u_int rate) | 621 | tegra_car_periph_i2c_enable(u_int port, u_int rate) | |
622 | { | 622 | { | |
623 | bus_space_tag_t bst; | 623 | bus_space_tag_t bst; | |
624 | bus_space_handle_t bsh; | 624 | bus_space_handle_t bsh; | |
625 | bus_size_t rst_reg, enb_reg, clksrc_reg; | 625 | bus_size_t rst_reg, enb_reg, clksrc_reg; | |
626 | uint32_t dev_bit; | 626 | uint32_t dev_bit; | |
627 | 627 | |||
628 | tegra_car_get_bs(&bst, &bsh); | 628 | tegra_car_get_bs(&bst, &bsh); | |
629 | 629 | |||
630 | switch (port) { | 630 | switch (port) { | |
631 | case 0: | 631 | case 0: | |
632 | rst_reg = CAR_RST_DEV_L_SET_REG; | 632 | rst_reg = CAR_RST_DEV_L_SET_REG; | |
633 | enb_reg = CAR_CLK_ENB_L_SET_REG; | 633 | enb_reg = CAR_CLK_ENB_L_SET_REG; | |
634 | dev_bit = CAR_DEV_L_I2C1; | 634 | dev_bit = CAR_DEV_L_I2C1; | |
635 | clksrc_reg = CAR_CLKSRC_I2C1_REG; | 635 | clksrc_reg = CAR_CLKSRC_I2C1_REG; | |
636 | break; | 636 | break; | |
637 | case 1: | 637 | case 1: | |
638 | rst_reg = CAR_RST_DEV_H_SET_REG; | 638 | rst_reg = CAR_RST_DEV_H_SET_REG; | |
639 | enb_reg = CAR_CLK_ENB_H_SET_REG; | 639 | enb_reg = CAR_CLK_ENB_H_SET_REG; | |
640 | dev_bit = CAR_DEV_H_I2C2; | 640 | dev_bit = CAR_DEV_H_I2C2; | |
641 | clksrc_reg = CAR_CLKSRC_I2C2_REG; | 641 | clksrc_reg = CAR_CLKSRC_I2C2_REG; | |
642 | break; | 642 | break; | |
643 | case 2: | 643 | case 2: | |
644 | rst_reg = CAR_RST_DEV_U_SET_REG; | 644 | rst_reg = CAR_RST_DEV_U_SET_REG; | |
645 | enb_reg = CAR_CLK_ENB_U_SET_REG; | 645 | enb_reg = CAR_CLK_ENB_U_SET_REG; | |
646 | dev_bit = CAR_DEV_U_I2C3; | 646 | dev_bit = CAR_DEV_U_I2C3; | |
647 | clksrc_reg = CAR_CLKSRC_I2C3_REG; | 647 | clksrc_reg = CAR_CLKSRC_I2C3_REG; | |
648 | break; | 648 | break; | |
649 | case 3: | 649 | case 3: | |
650 | rst_reg = CAR_RST_DEV_V_SET_REG; | 650 | rst_reg = CAR_RST_DEV_V_SET_REG; | |
651 | enb_reg = CAR_CLK_ENB_V_SET_REG; | 651 | enb_reg = CAR_CLK_ENB_V_SET_REG; | |
652 | dev_bit = CAR_DEV_V_I2C4; | 652 | dev_bit = CAR_DEV_V_I2C4; | |
653 | clksrc_reg = CAR_CLKSRC_I2C4_REG; | 653 | clksrc_reg = CAR_CLKSRC_I2C4_REG; | |
654 | break; | 654 | break; | |
655 | case 4: | 655 | case 4: | |
656 | rst_reg = CAR_RST_DEV_H_SET_REG; | 656 | rst_reg = CAR_RST_DEV_H_SET_REG; | |
657 | enb_reg = CAR_CLK_ENB_H_SET_REG; | 657 | enb_reg = CAR_CLK_ENB_H_SET_REG; | |
658 | dev_bit = CAR_DEV_H_I2C5; | 658 | dev_bit = CAR_DEV_H_I2C5; | |
659 | clksrc_reg = CAR_CLKSRC_I2C5_REG; | 659 | clksrc_reg = CAR_CLKSRC_I2C5_REG; | |
660 | break; | 660 | break; | |
661 | case 5: | 661 | case 5: | |
662 | rst_reg = CAR_RST_DEV_X_SET_REG; | 662 | rst_reg = CAR_RST_DEV_X_SET_REG; | |
663 | enb_reg = CAR_CLK_ENB_X_SET_REG; | 663 | enb_reg = CAR_CLK_ENB_X_SET_REG; | |
664 | dev_bit = CAR_DEV_X_I2C6; | 664 | dev_bit = CAR_DEV_X_I2C6; | |
665 | clksrc_reg = CAR_CLKSRC_I2C6_REG; | 665 | clksrc_reg = CAR_CLKSRC_I2C6_REG; | |
666 | break; | 666 | break; | |
667 | default: | 667 | default: | |
668 | return EINVAL; | 668 | return EINVAL; | |
669 | } | 669 | } | |
670 | 670 | |||
671 | /* Enter reset, enable clock */ | 671 | /* Enter reset, enable clock */ | |
672 | bus_space_write_4(bst, bsh, rst_reg, dev_bit); | 672 | bus_space_write_4(bst, bsh, rst_reg, dev_bit); | |
673 | bus_space_write_4(bst, bsh, enb_reg, dev_bit); | 673 | bus_space_write_4(bst, bsh, enb_reg, dev_bit); | |
674 | 674 | |||
675 | /* Set clock source to PLLP */ | 675 | /* Set clock source to PLLP */ | |
676 | const u_int div = howmany(tegra_car_pllp0_rate() / 1000, rate / 1000); | 676 | const u_int div = howmany(tegra_car_pllp0_rate() / 1000, rate / 1000); | |
677 | bus_space_write_4(bst, bsh, clksrc_reg, | 677 | bus_space_write_4(bst, bsh, clksrc_reg, | |
678 | __SHIFTIN(CAR_CLKSRC_I2C_SRC_PLLP_OUT0, CAR_CLKSRC_I2C_SRC) | | 678 | __SHIFTIN(CAR_CLKSRC_I2C_SRC_PLLP_OUT0, CAR_CLKSRC_I2C_SRC) | | |
679 | __SHIFTIN(div - 1, CAR_CLKSRC_I2C_DIV)); | 679 | __SHIFTIN(div - 1, CAR_CLKSRC_I2C_DIV)); | |
680 | 680 | |||
681 | /* Leave reset */ | 681 | /* Leave reset */ | |
682 | bus_space_write_4(bst, bsh, rst_reg+4, dev_bit); | 682 | bus_space_write_4(bst, bsh, rst_reg+4, dev_bit); | |
683 | 683 | |||
684 | return 0; | 684 | return 0; | |
685 | } | 685 | } | |
686 | 686 | |||
687 | void | 687 | void | |
688 | tegra_car_periph_cec_enable(void) | 688 | tegra_car_periph_cec_enable(void) | |
689 | { | 689 | { | |
690 | bus_space_tag_t bst; | 690 | bus_space_tag_t bst; | |
691 | bus_space_handle_t bsh; | 691 | bus_space_handle_t bsh; | |
692 | 692 | |||
693 | tegra_car_get_bs(&bst, &bsh); | 693 | tegra_car_get_bs(&bst, &bsh); | |
694 | 694 | |||
695 | bus_space_write_4(bst, bsh, CAR_CLK_ENB_W_SET_REG, CAR_DEV_W_CEC); | 695 | bus_space_write_4(bst, bsh, CAR_CLK_ENB_W_SET_REG, CAR_DEV_W_CEC); | |
696 | bus_space_write_4(bst, bsh, CAR_RST_DEV_W_CLR_REG, CAR_DEV_W_CEC); | 696 | bus_space_write_4(bst, bsh, CAR_RST_DEV_W_CLR_REG, CAR_DEV_W_CEC); | |
697 | } | 697 | } | |
698 | 698 | |||
699 | void | 699 | void | |
700 | tegra_car_hdmi_enable(u_int rate) | 700 | tegra_car_hdmi_enable(u_int rate) | |
701 | { | 701 | { | |
702 | bus_space_tag_t bst; | 702 | bus_space_tag_t bst; | |
703 | bus_space_handle_t bsh; | 703 | bus_space_handle_t bsh; | |
704 | uint32_t base; | 704 | uint32_t base; | |
705 | int retry = 10000; | 705 | int retry = 10000; | |
706 | 706 | |||
707 | tegra_car_get_bs(&bst, &bsh); | 707 | tegra_car_get_bs(&bst, &bsh); | |
708 | 708 | |||
709 | /* Enter reset, enable clock */ | 709 | /* Enter reset, enable clock */ | |
710 | bus_space_write_4(bst, bsh, CAR_RST_DEV_H_SET_REG, CAR_DEV_H_HDMI); | 710 | bus_space_write_4(bst, bsh, CAR_RST_DEV_H_SET_REG, CAR_DEV_H_HDMI); | |
711 | bus_space_write_4(bst, bsh, CAR_CLK_ENB_H_SET_REG, CAR_DEV_H_HDMI); | 711 | bus_space_write_4(bst, bsh, CAR_CLK_ENB_H_SET_REG, CAR_DEV_H_HDMI); | |
712 | 712 | |||
713 | /* Change IDDQ from 1 to 0 */ | 713 | /* Change IDDQ from 1 to 0 */ | |
714 | tegra_reg_set_clear(bst, bsh, CAR_PLLD2_BASE_REG, | 714 | tegra_reg_set_clear(bst, bsh, CAR_PLLD2_BASE_REG, | |
715 | 0, CAR_PLLD2_BASE_IDDQ); | 715 | 0, CAR_PLLD2_BASE_IDDQ); | |
716 | delay(2); | 716 | delay(2); | |
717 | /* Enable lock */ | 717 | /* Enable lock */ | |
718 | tegra_reg_set_clear(bst, bsh, CAR_PLLD2_MISC_REG, | 718 | tegra_reg_set_clear(bst, bsh, CAR_PLLD2_MISC_REG, | |
719 | CAR_PLLD2_MISC_LOCK_ENABLE, 0); | 719 | CAR_PLLD2_MISC_LOCK_ENABLE, 0); | |
720 | /* Enable PLLD2 */ | 720 | /* Enable PLLD2 */ | |
721 | tegra_reg_set_clear(bst, bsh, CAR_PLLD2_BASE_REG, | 721 | tegra_reg_set_clear(bst, bsh, CAR_PLLD2_BASE_REG, | |
722 | CAR_PLLD2_BASE_ENABLE, 0); | 722 | CAR_PLLD2_BASE_ENABLE, 0); | |
723 | 723 | |||
724 | /* Wait for lock */ | 724 | /* Wait for lock */ | |
725 | do { | 725 | do { | |
726 | delay(2); | 726 | delay(2); | |
727 | base = bus_space_read_4(bst, bsh, CAR_PLLD2_BASE_REG); | 727 | base = bus_space_read_4(bst, bsh, CAR_PLLD2_BASE_REG); | |
728 | } while ((base & CAR_PLLD2_BASE_LOCK) == 0 && --retry > 0); | 728 | } while ((base & CAR_PLLD2_BASE_LOCK) == 0 && --retry > 0); | |
729 | delay(100); | 729 | delay(100); | |
730 | if (retry == 0) { | 730 | if (retry == 0) { | |
731 | printf("WARNING: timeout waiting for PLLD2 lock\n"); | 731 | printf("WARNING: timeout waiting for PLLD2 lock\n"); | |
732 | } | 732 | } | |
733 | 733 | |||
734 | /* Set clock source to PLLD2 */ | 734 | /* Set clock source to PLLD2 */ | |
735 | const u_int div = (tegra_car_plld2_rate() * 2) / rate - 2; | 735 | const u_int div = (tegra_car_plld2_rate() * 2) / rate - 2; | |
736 | bus_space_write_4(bst, bsh, CAR_CLKSRC_HDMI_REG, | 736 | bus_space_write_4(bst, bsh, CAR_CLKSRC_HDMI_REG, | |
737 | __SHIFTIN(CAR_CLKSRC_HDMI_SRC_PLLD2_OUT0, CAR_CLKSRC_HDMI_SRC) | | 737 | __SHIFTIN(CAR_CLKSRC_HDMI_SRC_PLLD2_OUT0, CAR_CLKSRC_HDMI_SRC) | | |
738 | __SHIFTIN(div, CAR_CLKSRC_HDMI_DIV)); | 738 | __SHIFTIN(div, CAR_CLKSRC_HDMI_DIV)); | |
739 | 739 | |||
740 | /* Leave reset */ | 740 | /* Leave reset */ | |
741 | bus_space_write_4(bst, bsh, CAR_RST_DEV_H_CLR_REG, CAR_DEV_H_HDMI); | 741 | bus_space_write_4(bst, bsh, CAR_RST_DEV_H_CLR_REG, CAR_DEV_H_HDMI); | |
742 | } | 742 | } | |
743 | 743 | |||
744 | int | 744 | int | |
745 | tegra_car_dc_enable(u_int port) | 745 | tegra_car_dc_enable(u_int port) | |
746 | { | 746 | { | |
747 | bus_space_tag_t bst; | 747 | bus_space_tag_t bst; | |
748 | bus_space_handle_t bsh; | 748 | bus_space_handle_t bsh; | |
749 | bus_size_t src_reg; | 749 | bus_size_t src_reg; | |
750 | uint32_t dev_bit; | 750 | uint32_t dev_bit; | |
751 | u_int partid; | 751 | u_int partid; | |
752 | 752 | |||
753 | tegra_car_get_bs(&bst, &bsh); | 753 | tegra_car_get_bs(&bst, &bsh); | |
754 | 754 | |||
755 | switch (port) { | 755 | switch (port) { | |
756 | case 0: | 756 | case 0: | |
757 | dev_bit = CAR_DEV_L_DISP1; | 757 | dev_bit = CAR_DEV_L_DISP1; | |
758 | src_reg = CAR_CLKSRC_DISP1_REG; | 758 | src_reg = CAR_CLKSRC_DISP1_REG; | |
759 | partid = PMC_PARTID_DIS; | 759 | partid = PMC_PARTID_DIS; | |
760 | break; | 760 | break; | |
761 | case 1: | 761 | case 1: | |
762 | dev_bit = CAR_DEV_L_DISP2; | 762 | dev_bit = CAR_DEV_L_DISP2; | |
763 | src_reg = CAR_CLKSRC_DISP2_REG; | 763 | src_reg = CAR_CLKSRC_DISP2_REG; | |
764 | partid = PMC_PARTID_DISB; | 764 | partid = PMC_PARTID_DISB; | |
765 | break; | 765 | break; | |
766 | default: | 766 | default: | |
767 | return EINVAL; | 767 | return EINVAL; | |
768 | } | 768 | } | |
769 | 769 | |||
770 | /* Enter reset, enable clock */ | 770 | /* Enter reset, enable clock */ | |
771 | bus_space_write_4(bst, bsh, CAR_RST_DEV_L_SET_REG, dev_bit); | 771 | bus_space_write_4(bst, bsh, CAR_RST_DEV_L_SET_REG, dev_bit); | |
772 | bus_space_write_4(bst, bsh, CAR_CLK_ENB_L_SET_REG, dev_bit); | 772 | bus_space_write_4(bst, bsh, CAR_CLK_ENB_L_SET_REG, dev_bit); | |
773 | 773 | |||
774 | /* Turn on power to display partition */ | 774 | /* Turn on power to display partition */ | |
775 | tegra_pmc_power(partid, true); | 775 | tegra_pmc_power(partid, true); | |
776 | tegra_pmc_remove_clamping(partid); | 776 | tegra_pmc_remove_clamping(partid); | |
777 | 777 | |||
778 | /* Select PLLD2 for clock source */ | 778 | /* Select PLLD2 for clock source */ | |
779 | bus_space_write_4(bst, bsh, src_reg, | 779 | bus_space_write_4(bst, bsh, src_reg, | |
780 | __SHIFTIN(CAR_CLKSRC_DISP_SRC_PLLD2_OUT0, | 780 | __SHIFTIN(CAR_CLKSRC_DISP_SRC_PLLD2_OUT0, | |
781 | CAR_CLKSRC_DISP_SRC)); | 781 | CAR_CLKSRC_DISP_SRC)); | |
782 | 782 | |||
783 | /* Leave reset */ | 783 | /* Leave reset */ | |
784 | bus_space_write_4(bst, bsh, CAR_RST_DEV_L_CLR_REG, dev_bit); | 784 | bus_space_write_4(bst, bsh, CAR_RST_DEV_L_CLR_REG, dev_bit); | |
785 | 785 | |||
786 | return 0; | 786 | return 0; | |
787 | } | 787 | } | |
788 | 788 | |||
789 | void | 789 | void | |
790 | tegra_car_host1x_enable(void) | 790 | tegra_car_host1x_enable(void) | |
791 | { | 791 | { | |
792 | bus_space_tag_t bst; | 792 | bus_space_tag_t bst; | |
793 | bus_space_handle_t bsh; | 793 | bus_space_handle_t bsh; | |
794 | 794 | |||
795 | tegra_car_get_bs(&bst, &bsh); | 795 | tegra_car_get_bs(&bst, &bsh); | |
796 | 796 | |||
797 | /* Enter reset, enable clock */ | 797 | /* Enter reset, enable clock */ | |
798 | bus_space_write_4(bst, bsh, CAR_RST_DEV_L_SET_REG, CAR_DEV_L_HOST1X); | 798 | bus_space_write_4(bst, bsh, CAR_RST_DEV_L_SET_REG, CAR_DEV_L_HOST1X); | |
799 | bus_space_write_4(bst, bsh, CAR_CLK_ENB_L_SET_REG, CAR_DEV_L_HOST1X); | 799 | bus_space_write_4(bst, bsh, CAR_CLK_ENB_L_SET_REG, CAR_DEV_L_HOST1X); | |
800 | 800 | |||
801 | /* Select PLLP for clock source, 408 MHz */ | 801 | /* Select PLLP for clock source, 408 MHz */ | |
802 | bus_space_write_4(bst, bsh, CAR_CLKSRC_HOST1X_REG, | 802 | bus_space_write_4(bst, bsh, CAR_CLKSRC_HOST1X_REG, | |
803 | __SHIFTIN(CAR_CLKSRC_HOST1X_SRC_PLLP_OUT0, | 803 | __SHIFTIN(CAR_CLKSRC_HOST1X_SRC_PLLP_OUT0, | |
804 | CAR_CLKSRC_HOST1X_SRC) | | 804 | CAR_CLKSRC_HOST1X_SRC) | | |
805 | __SHIFTIN(0, CAR_CLKSRC_HOST1X_CLK_DIVISOR)); | 805 | __SHIFTIN(0, CAR_CLKSRC_HOST1X_CLK_DIVISOR)); | |
806 | 806 | |||
807 | delay(2); | 807 | delay(2); | |
808 | 808 | |||
809 | /* Leave reset */ | 809 | /* Leave reset */ | |
810 | bus_space_write_4(bst, bsh, CAR_RST_DEV_L_CLR_REG, CAR_DEV_L_HOST1X); | 810 | bus_space_write_4(bst, bsh, CAR_RST_DEV_L_CLR_REG, CAR_DEV_L_HOST1X); | |
811 | } | 811 | } | |
812 | 812 | |||
813 | void | 813 | void | |
814 | tegra_car_wdt_enable(u_int timer, bool enable) | 814 | tegra_car_wdt_enable(u_int timer, bool enable) | |
815 | { | 815 | { | |
816 | bus_space_tag_t bst; | 816 | bus_space_tag_t bst; | |
817 | bus_space_handle_t bsh; | 817 | bus_space_handle_t bsh; | |
818 | uint32_t enable_bits; | 818 | uint32_t enable_bits; | |
819 | 819 | |||
820 | KASSERT(timer == 1 || timer == 2); | 820 | KASSERT(timer == 1 || timer == 2); | |
821 | 821 | |||
822 | tegra_car_get_bs(&bst, &bsh); | 822 | tegra_car_get_bs(&bst, &bsh); | |
823 | 823 | |||
824 | enable_bits = enable ? | 824 | enable_bits = enable ? | |
825 | (CAR_RST_SOURCE_WDT_EN|CAR_RST_SOURCE_WDT_SYS_RST_EN) : 0; | 825 | (CAR_RST_SOURCE_WDT_EN|CAR_RST_SOURCE_WDT_SYS_RST_EN) : 0; | |
826 | 826 | |||
827 | tegra_reg_set_clear(bst, bsh, CAR_RST_SOURCE_REG, | 827 | tegra_reg_set_clear(bst, bsh, CAR_RST_SOURCE_REG, | |
828 | __SHIFTIN(timer - 1, CAR_RST_SOURCE_WDT_SEL) | | 828 | __SHIFTIN(timer - 1, CAR_RST_SOURCE_WDT_SEL) | | |
829 | enable_bits, | 829 | enable_bits, | |
830 | CAR_RST_SOURCE_WDT_SYS_RST_EN | | 830 | CAR_RST_SOURCE_WDT_SYS_RST_EN | | |
831 | CAR_RST_SOURCE_WDT_SEL | | 831 | CAR_RST_SOURCE_WDT_SEL | | |
832 | CAR_RST_SOURCE_WDT_EN); | 832 | CAR_RST_SOURCE_WDT_EN); | |
833 | } | 833 | } | |
834 | ||||
835 | void | |||
836 | tegra_car_gpu_enable(void) | |||
837 | { | |||
838 | bus_space_tag_t bst; | |||
839 | bus_space_handle_t bsh; | |||
840 | ||||
841 | tegra_car_get_bs(&bst, &bsh); | |||
842 | ||||
843 | /* Enter reset, enable clock */ | |||
844 | bus_space_write_4(bst, bsh, CAR_RST_DEV_X_SET_REG, CAR_DEV_X_GPU); | |||
845 | bus_space_write_4(bst, bsh, CAR_CLK_ENB_X_SET_REG, CAR_DEV_X_GPU); | |||
846 | ||||
847 | /* Set PLLP_OUT5 to 204MHz */ | |||
848 | const u_int rate = 204000000; | |||
849 | const u_int div = howmany(tegra_car_pllp0_rate() * 2, rate) - 2; | |||
850 | tegra_reg_set_clear(bst, bsh, CAR_PLLP_OUTC_REG, | |||
851 | __SHIFTIN(div, CAR_PLLP_OUTC_OUT5_RATIO) | | |||
852 | CAR_PLLP_OUTC_OUT5_CLKEN, | |||
853 | CAR_PLLP_OUTC_OUT5_RATIO); | |||
854 | delay(20); | |||
855 | ||||
856 | /* Remove clamping from 3D partition in the PMC */ | |||
857 | tegra_pmc_remove_clamping(PMC_PARTID_TD); | |||
858 | delay(20); | |||
859 | ||||
860 | /* Leave reset */ | |||
861 | bus_space_write_4(bst, bsh, CAR_RST_DEV_X_CLR_REG, CAR_DEV_X_GPU); | |||
862 | } |
--- src/sys/arch/arm/nvidia/Attic/tegra_carreg.h 2015/07/25 15:50:42 1.20
+++ src/sys/arch/arm/nvidia/Attic/tegra_carreg.h 2015/10/17 21:16:09 1.21
@@ -1,483 +1,488 @@ | @@ -1,483 +1,488 @@ | |||
1 | /* $NetBSD: tegra_carreg.h,v 1.20 2015/07/25 15:50:42 jmcneill Exp $ */ | 1 | /* $NetBSD: tegra_carreg.h,v 1.21 2015/10/17 21:16:09 jmcneill Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca> | 4 | * Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca> | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
15 | * | 15 | * | |
16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | |
21 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | |
23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | 23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
26 | * SUCH DAMAGE. | 26 | * SUCH DAMAGE. | |
27 | */ | 27 | */ | |
28 | 28 | |||
29 | #ifndef _ARM_TEGRA_CARREG_H | 29 | #ifndef _ARM_TEGRA_CARREG_H | |
30 | #define _ARM_TEGRA_CARREG_H | 30 | #define _ARM_TEGRA_CARREG_H | |
31 | 31 | |||
32 | #define CAR_RST_SOURCE_REG 0x00 | 32 | #define CAR_RST_SOURCE_REG 0x00 | |
33 | #define CAR_RST_SOURCE_WDT_EN __BIT(5) | 33 | #define CAR_RST_SOURCE_WDT_EN __BIT(5) | |
34 | #define CAR_RST_SOURCE_WDT_SEL __BIT(4) | 34 | #define CAR_RST_SOURCE_WDT_SEL __BIT(4) | |
35 | #define CAR_RST_SOURCE_WDT_SYS_RST_EN __BIT(2) | 35 | #define CAR_RST_SOURCE_WDT_SYS_RST_EN __BIT(2) | |
36 | #define CAR_RST_SOURCE_WDT_COP_RST_EN __BIT(1) | 36 | #define CAR_RST_SOURCE_WDT_COP_RST_EN __BIT(1) | |
37 | #define CAR_RST_SOURCE_WDT_CPU_RST_EN __BIT(0) | 37 | #define CAR_RST_SOURCE_WDT_CPU_RST_EN __BIT(0) | |
38 | 38 | |||
39 | #define CAR_CLK_OUT_ENB_L_REG 0x10 | 39 | #define CAR_CLK_OUT_ENB_L_REG 0x10 | |
40 | #define CAR_CLK_OUT_ENB_H_REG 0x14 | 40 | #define CAR_CLK_OUT_ENB_H_REG 0x14 | |
41 | #define CAR_CLK_OUT_ENB_U_REG 0x18 | 41 | #define CAR_CLK_OUT_ENB_U_REG 0x18 | |
42 | 42 | |||
43 | #define CAR_PLL_LFSR_REG 0x54 | 43 | #define CAR_PLL_LFSR_REG 0x54 | |
44 | #define CAR_PLL_LFSR_RND __BITS(15,0) | 44 | #define CAR_PLL_LFSR_RND __BITS(15,0) | |
45 | 45 | |||
46 | #define CAR_PLLP_BASE_REG 0xa0 | 46 | #define CAR_PLLP_BASE_REG 0xa0 | |
47 | #define CAR_PLLP_BASE_BYPASS __BIT(31) | 47 | #define CAR_PLLP_BASE_BYPASS __BIT(31) | |
48 | #define CAR_PLLP_BASE_ENABLE __BIT(30) | 48 | #define CAR_PLLP_BASE_ENABLE __BIT(30) | |
49 | #define CAR_PLLP_BASE_REF_DIS __BIT(29) | 49 | #define CAR_PLLP_BASE_REF_DIS __BIT(29) | |
50 | #define CAR_PLLP_BASE_OVERRIDE __BIT(28) | 50 | #define CAR_PLLP_BASE_OVERRIDE __BIT(28) | |
51 | #define CAR_PLLP_BASE_LOCK __BIT(27) | 51 | #define CAR_PLLP_BASE_LOCK __BIT(27) | |
52 | #define CAR_PLLP_BASE_DIVP __BITS(22,20) | 52 | #define CAR_PLLP_BASE_DIVP __BITS(22,20) | |
53 | #define CAR_PLLP_BASE_DIVN __BITS(17,8) | 53 | #define CAR_PLLP_BASE_DIVN __BITS(17,8) | |
54 | #define CAR_PLLP_BASE_DIVM __BITS(4,0) | 54 | #define CAR_PLLP_BASE_DIVM __BITS(4,0) | |
55 | 55 | |||
56 | #define CAR_PLLP_OUTA_REG 0xa4 | 56 | #define CAR_PLLP_OUTA_REG 0xa4 | |
57 | #define CAR_PLLP_OUTB_REG 0xa8 | 57 | #define CAR_PLLP_OUTB_REG 0xa8 | |
58 | #define CAR_PLLP_OUTB_OUT4_RATIO __BITS(31,24) | 58 | #define CAR_PLLP_OUTB_OUT4_RATIO __BITS(31,24) | |
59 | #define CAR_PLLP_OUTB_OUT4_OVRRIDE __BIT(18) | 59 | #define CAR_PLLP_OUTB_OUT4_OVRRIDE __BIT(18) | |
60 | #define CAR_PLLP_OUTB_OUT4_CLKEN __BIT(17) | 60 | #define CAR_PLLP_OUTB_OUT4_CLKEN __BIT(17) | |
61 | #define CAR_PLLP_OUTB_OUT4_RSTN __BIT(16) | 61 | #define CAR_PLLP_OUTB_OUT4_RSTN __BIT(16) | |
62 | #define CAR_PLLP_OUTB_OUT3_RATIO __BITS(15,8) | 62 | #define CAR_PLLP_OUTB_OUT3_RATIO __BITS(15,8) | |
63 | #define CAR_PLLP_OUTB_OUT3_OVRRIDE __BIT(2) | 63 | #define CAR_PLLP_OUTB_OUT3_OVRRIDE __BIT(2) | |
64 | #define CAR_PLLP_OUTB_OUT3_CLKEN __BIT(1) | 64 | #define CAR_PLLP_OUTB_OUT3_CLKEN __BIT(1) | |
65 | #define CAR_PLLP_OUTB_OUT3_RSTN __BIT(0) | 65 | #define CAR_PLLP_OUTB_OUT3_RSTN __BIT(0) | |
66 | #define CAR_PLLP_OUTC_REG 0x67c | |||
67 | #define CAR_PLLP_OUTC_OUT5_RATIO __BITS(31,24) | |||
68 | #define CAR_PLLP_OUTC_OUT5_OVERRIDE __BIT(18) | |||
69 | #define CAR_PLLP_OUTC_OUT5_CLKEN __BIT(17) | |||
70 | #define CAR_PLLP_OUTC_OUT5_RSTN __BIT(16) | |||
66 | #define CAR_PLLP_MISC_REG 0xac | 71 | #define CAR_PLLP_MISC_REG 0xac | |
67 | 72 | |||
68 | #define CAR_PLLC_BASE_REG 0x80 | 73 | #define CAR_PLLC_BASE_REG 0x80 | |
69 | #define CAR_PLLC_BASE_ENABLE __BIT(30) | 74 | #define CAR_PLLC_BASE_ENABLE __BIT(30) | |
70 | #define CAR_PLLC_BASE_REF_DIS __BIT(29) | 75 | #define CAR_PLLC_BASE_REF_DIS __BIT(29) | |
71 | #define CAR_PLLC_BASE_LOCK_OVERRIDE __BIT(28) | 76 | #define CAR_PLLC_BASE_LOCK_OVERRIDE __BIT(28) | |
72 | #define CAR_PLLC_BASE_LOCK __BIT(27) | 77 | #define CAR_PLLC_BASE_LOCK __BIT(27) | |
73 | #define CAR_PLLC_BASE_DIVP __BITS(23,20) | 78 | #define CAR_PLLC_BASE_DIVP __BITS(23,20) | |
74 | #define CAR_PLLC_BASE_DIVN __BITS(15,8) | 79 | #define CAR_PLLC_BASE_DIVN __BITS(15,8) | |
75 | #define CAR_PLLC_BASE_DIVM __BITS(7,0) | 80 | #define CAR_PLLC_BASE_DIVM __BITS(7,0) | |
76 | 81 | |||
77 | #define CAR_PLLU_BASE_REG 0xc0 | 82 | #define CAR_PLLU_BASE_REG 0xc0 | |
78 | #define CAR_PLLU_BASE_BYPASS __BIT(31) | 83 | #define CAR_PLLU_BASE_BYPASS __BIT(31) | |
79 | #define CAR_PLLU_BASE_ENABLE __BIT(30) | 84 | #define CAR_PLLU_BASE_ENABLE __BIT(30) | |
80 | #define CAR_PLLU_BASE_REF_DIS __BIT(29) | 85 | #define CAR_PLLU_BASE_REF_DIS __BIT(29) | |
81 | #define CAR_PLLU_BASE_LOCK __BIT(27) | 86 | #define CAR_PLLU_BASE_LOCK __BIT(27) | |
82 | #define CAR_PLLU_BASE_CLKENABLE_48M __BIT(25) | 87 | #define CAR_PLLU_BASE_CLKENABLE_48M __BIT(25) | |
83 | #define CAR_PLLU_BASE_OVERRIDE __BIT(24) | 88 | #define CAR_PLLU_BASE_OVERRIDE __BIT(24) | |
84 | #define CAR_PLLU_BASE_CLKENABLE_ICUSB __BIT(23) | 89 | #define CAR_PLLU_BASE_CLKENABLE_ICUSB __BIT(23) | |
85 | #define CAR_PLLU_BASE_CLKENABLE_HSIC __BIT(22) | 90 | #define CAR_PLLU_BASE_CLKENABLE_HSIC __BIT(22) | |
86 | #define CAR_PLLU_BASE_CLKENABLE_USB __BIT(21) | 91 | #define CAR_PLLU_BASE_CLKENABLE_USB __BIT(21) | |
87 | #define CAR_PLLU_BASE_VCO_FREQ __BIT(20) | 92 | #define CAR_PLLU_BASE_VCO_FREQ __BIT(20) | |
88 | #define CAR_PLLU_BASE_DIVN __BITS(17,8) | 93 | #define CAR_PLLU_BASE_DIVN __BITS(17,8) | |
89 | #define CAR_PLLU_BASE_DIVM __BITS(4,0) | 94 | #define CAR_PLLU_BASE_DIVM __BITS(4,0) | |
90 | 95 | |||
91 | #define CAR_PLLD_BASE_REG 0xd0 | 96 | #define CAR_PLLD_BASE_REG 0xd0 | |
92 | #define CAR_PLLD_BASE_BYPASS __BIT(31) | 97 | #define CAR_PLLD_BASE_BYPASS __BIT(31) | |
93 | #define CAR_PLLD_BASE_ENABLE __BIT(30) | 98 | #define CAR_PLLD_BASE_ENABLE __BIT(30) | |
94 | #define CAR_PLLD_BASE_REF_DIS __BIT(29) | 99 | #define CAR_PLLD_BASE_REF_DIS __BIT(29) | |
95 | #define CAR_PLLD_BASE_LOCK __BIT(27) | 100 | #define CAR_PLLD_BASE_LOCK __BIT(27) | |
96 | #define CAR_PLLD_BASE_CLKENABLE_CSI __BIT(26) | 101 | #define CAR_PLLD_BASE_CLKENABLE_CSI __BIT(26) | |
97 | #define CAR_PLLD_BASE_DSIA_CLK_SRC __BIT(25) | 102 | #define CAR_PLLD_BASE_DSIA_CLK_SRC __BIT(25) | |
98 | #define CAR_PLLD_BASE_CSI_CLK_SRC __BIT(23) | 103 | #define CAR_PLLD_BASE_CSI_CLK_SRC __BIT(23) | |
99 | #define CAR_PLLD_BASE_DIVP __BITS(22,20) | 104 | #define CAR_PLLD_BASE_DIVP __BITS(22,20) | |
100 | #define CAR_PLLD_BASE_DIVN __BITS(18,8) | 105 | #define CAR_PLLD_BASE_DIVN __BITS(18,8) | |
101 | #define CAR_PLLD_BASE_DIVM __BITS(4,0) | 106 | #define CAR_PLLD_BASE_DIVM __BITS(4,0) | |
102 | 107 | |||
103 | #define CAR_PLLD_MISC_REG 0xdc | 108 | #define CAR_PLLD_MISC_REG 0xdc | |
104 | 109 | |||
105 | #define CAR_PLLX_BASE_REG 0xe0 | 110 | #define CAR_PLLX_BASE_REG 0xe0 | |
106 | #define CAR_PLLX_BASE_BYPASS __BIT(31) | 111 | #define CAR_PLLX_BASE_BYPASS __BIT(31) | |
107 | #define CAR_PLLX_BASE_ENABLE __BIT(30) | 112 | #define CAR_PLLX_BASE_ENABLE __BIT(30) | |
108 | #define CAR_PLLX_BASE_REF_DIS __BIT(29) | 113 | #define CAR_PLLX_BASE_REF_DIS __BIT(29) | |
109 | #define CAR_PLLX_BASE_LOCK __BIT(27) | 114 | #define CAR_PLLX_BASE_LOCK __BIT(27) | |
110 | #define CAR_PLLX_BASE_DIVP __BITS(23,20) | 115 | #define CAR_PLLX_BASE_DIVP __BITS(23,20) | |
111 | #define CAR_PLLX_BASE_DIVN __BITS(15,8) | 116 | #define CAR_PLLX_BASE_DIVN __BITS(15,8) | |
112 | #define CAR_PLLX_BASE_DIVM __BITS(7,0) | 117 | #define CAR_PLLX_BASE_DIVM __BITS(7,0) | |
113 | 118 | |||
114 | #define CAR_PLLX_MISC_REG 0xe4 | 119 | #define CAR_PLLX_MISC_REG 0xe4 | |
115 | #define CAR_PLLX_MISC_FO_LP_DISABLE __BIT(29) | 120 | #define CAR_PLLX_MISC_FO_LP_DISABLE __BIT(29) | |
116 | #define CAR_PLLX_MISC_FO_G_DISABLE __BIT(28) | 121 | #define CAR_PLLX_MISC_FO_G_DISABLE __BIT(28) | |
117 | #define CAR_PLLX_MISC_PTS __BITS(23,22) | 122 | #define CAR_PLLX_MISC_PTS __BITS(23,22) | |
118 | #define CAR_PLLX_MISC_LOCK_ENABLE __BIT(18) | 123 | #define CAR_PLLX_MISC_LOCK_ENABLE __BIT(18) | |
119 | 124 | |||
120 | #define CAR_PLLE_BASE_REG 0xe8 | 125 | #define CAR_PLLE_BASE_REG 0xe8 | |
121 | #define CAR_PLLE_BASE_ENABLE __BIT(30) | 126 | #define CAR_PLLE_BASE_ENABLE __BIT(30) | |
122 | #define CAR_PLLE_BASE_LOCK_OVERRIDE __BIT(29) | 127 | #define CAR_PLLE_BASE_LOCK_OVERRIDE __BIT(29) | |
123 | #define CAR_PLLE_BASE_FDIV48 __BIT(28) | 128 | #define CAR_PLLE_BASE_FDIV48 __BIT(28) | |
124 | #define CAR_PLLE_BASE_DIVP_CML __BITS(27,24) | 129 | #define CAR_PLLE_BASE_DIVP_CML __BITS(27,24) | |
125 | #define CAR_PLLE_BASE_EXT_SETUP_23_16 __BITS(23,16) | 130 | #define CAR_PLLE_BASE_EXT_SETUP_23_16 __BITS(23,16) | |
126 | #define CAR_PLLE_BASE_DIVN __BITS(15,8) | 131 | #define CAR_PLLE_BASE_DIVN __BITS(15,8) | |
127 | #define CAR_PLLE_BASE_DIVM __BITS(7,0) | 132 | #define CAR_PLLE_BASE_DIVM __BITS(7,0) | |
128 | 133 | |||
129 | #define CAR_PLLE_MISC_REG 0xec | 134 | #define CAR_PLLE_MISC_REG 0xec | |
130 | 135 | |||
131 | #define CAR_PLLD2_BASE_REG 0x4b8 | 136 | #define CAR_PLLD2_BASE_REG 0x4b8 | |
132 | #define CAR_PLLD2_BASE_BYPASS __BIT(31) | 137 | #define CAR_PLLD2_BASE_BYPASS __BIT(31) | |
133 | #define CAR_PLLD2_BASE_ENABLE __BIT(30) | 138 | #define CAR_PLLD2_BASE_ENABLE __BIT(30) | |
134 | #define CAR_PLLD2_BASE_REF_DIS __BIT(29) | 139 | #define CAR_PLLD2_BASE_REF_DIS __BIT(29) | |
135 | #define CAR_PLLD2_BASE_FREQLOCK __BIT(28) | 140 | #define CAR_PLLD2_BASE_FREQLOCK __BIT(28) | |
136 | #define CAR_PLLD2_BASE_LOCK __BIT(27) | 141 | #define CAR_PLLD2_BASE_LOCK __BIT(27) | |
137 | #define CAR_PLLD2_BASE_REF_SRC_SEL __BITS(26,25) | 142 | #define CAR_PLLD2_BASE_REF_SRC_SEL __BITS(26,25) | |
138 | #define CAR_PLLD2_BASE_REF_SRC_SEL_PLL_D 0 | 143 | #define CAR_PLLD2_BASE_REF_SRC_SEL_PLL_D 0 | |
139 | #define CAR_PLLD2_BASE_REF_SRC_SEL_PLL_D2 1 | 144 | #define CAR_PLLD2_BASE_REF_SRC_SEL_PLL_D2 1 | |
140 | #define CAR_PLLD2_BASE_LOCK_OVERRIDE __BIT(24) | 145 | #define CAR_PLLD2_BASE_LOCK_OVERRIDE __BIT(24) | |
141 | #define CAR_PLLD2_BASE_PLDIV __BITS(23,20) | 146 | #define CAR_PLLD2_BASE_PLDIV __BITS(23,20) | |
142 | #define CAR_PLLD2_BASE_IDDQ __BIT(19) | 147 | #define CAR_PLLD2_BASE_IDDQ __BIT(19) | |
143 | #define CAR_PLLD2_BASE_PTS __BIT(16) | 148 | #define CAR_PLLD2_BASE_PTS __BIT(16) | |
144 | #define CAR_PLLD2_BASE_NDIV __BITS(15,8) | 149 | #define CAR_PLLD2_BASE_NDIV __BITS(15,8) | |
145 | #define CAR_PLLD2_BASE_MDIV __BITS(7,0) | 150 | #define CAR_PLLD2_BASE_MDIV __BITS(7,0) | |
146 | 151 | |||
147 | #define CAR_PLLD2_MISC_REG 0x4bc | 152 | #define CAR_PLLD2_MISC_REG 0x4bc | |
148 | #define CAR_PLLD2_MISC_EN_FSTLCK __BIT(31) | 153 | #define CAR_PLLD2_MISC_EN_FSTLCK __BIT(31) | |
149 | #define CAR_PLLD2_MISC_LOCK_ENABLE __BIT(30) | 154 | #define CAR_PLLD2_MISC_LOCK_ENABLE __BIT(30) | |
150 | #define CAR_PLLD2_MISC_MON_TEST_OUT __BITS(29,27) | 155 | #define CAR_PLLD2_MISC_MON_TEST_OUT __BITS(29,27) | |
151 | #define CAR_PLLD2_MISC_KCP __BITS(26,25) | 156 | #define CAR_PLLD2_MISC_KCP __BITS(26,25) | |
152 | #define CAR_PLLD2_MISC_KVCO __BIT(24) | 157 | #define CAR_PLLD2_MISC_KVCO __BIT(24) | |
153 | #define CAR_PLLD2_MISC_SETUP __BITS(23,0) | 158 | #define CAR_PLLD2_MISC_SETUP __BITS(23,0) | |
154 | 159 | |||
155 | #define CAR_CLKSRC_I2C1_REG 0x124 | 160 | #define CAR_CLKSRC_I2C1_REG 0x124 | |
156 | #define CAR_CLKSRC_I2C2_REG 0x198 | 161 | #define CAR_CLKSRC_I2C2_REG 0x198 | |
157 | #define CAR_CLKSRC_I2C3_REG 0x1b8 | 162 | #define CAR_CLKSRC_I2C3_REG 0x1b8 | |
158 | #define CAR_CLKSRC_I2C4_REG 0x3c4 | 163 | #define CAR_CLKSRC_I2C4_REG 0x3c4 | |
159 | #define CAR_CLKSRC_I2C5_REG 0x128 | 164 | #define CAR_CLKSRC_I2C5_REG 0x128 | |
160 | #define CAR_CLKSRC_I2C6_REG 0x65c | 165 | #define CAR_CLKSRC_I2C6_REG 0x65c | |
161 | 166 | |||
162 | #define CAR_CLKSRC_I2C_SRC __BITS(31,29) | 167 | #define CAR_CLKSRC_I2C_SRC __BITS(31,29) | |
163 | #define CAR_CLKSRC_I2C_SRC_PLLP_OUT0 0 | 168 | #define CAR_CLKSRC_I2C_SRC_PLLP_OUT0 0 | |
164 | #define CAR_CLKSRC_I2C_SRC_PLLC2_OUT0 1 | 169 | #define CAR_CLKSRC_I2C_SRC_PLLC2_OUT0 1 | |
165 | #define CAR_CLKSRC_I2C_SRC_PLLC_OUT0 2 | 170 | #define CAR_CLKSRC_I2C_SRC_PLLC_OUT0 2 | |
166 | #define CAR_CLKSRC_I2C_SRC_PLLC3_OUT0 3 | 171 | #define CAR_CLKSRC_I2C_SRC_PLLC3_OUT0 3 | |
167 | #define CAR_CLKSRC_I2C_SRC_PLLM_OUT0 4 | 172 | #define CAR_CLKSRC_I2C_SRC_PLLM_OUT0 4 | |
168 | #define CAR_CLKSRC_I2C_SRC_CLK_M 6 | 173 | #define CAR_CLKSRC_I2C_SRC_CLK_M 6 | |
169 | #define CAR_CLKSRC_I2C_DIV __BITS(15,0) | 174 | #define CAR_CLKSRC_I2C_DIV __BITS(15,0) | |
170 | 175 | |||
171 | #define CAR_CLKSRC_UARTA_REG 0x178 | 176 | #define CAR_CLKSRC_UARTA_REG 0x178 | |
172 | #define CAR_CLKSRC_UARTB_REG 0x17c | 177 | #define CAR_CLKSRC_UARTB_REG 0x17c | |
173 | #define CAR_CLKSRC_UARTC_REG 0x1a0 | 178 | #define CAR_CLKSRC_UARTC_REG 0x1a0 | |
174 | #define CAR_CLKSRC_UARTD_REG 0x1c0 | 179 | #define CAR_CLKSRC_UARTD_REG 0x1c0 | |
175 | 180 | |||
176 | #define CAR_CLKSRC_UART_SRC __BITS(31,29) | 181 | #define CAR_CLKSRC_UART_SRC __BITS(31,29) | |
177 | #define CAR_CLKSRC_UART_SRC_PLLP_OUT0 0 | 182 | #define CAR_CLKSRC_UART_SRC_PLLP_OUT0 0 | |
178 | #define CAR_CLKSRC_UART_SRC_PLLC2_OUT0 1 | 183 | #define CAR_CLKSRC_UART_SRC_PLLC2_OUT0 1 | |
179 | #define CAR_CLKSRC_UART_SRC_PLLC_OUT0 2 | 184 | #define CAR_CLKSRC_UART_SRC_PLLC_OUT0 2 | |
180 | #define CAR_CLKSRC_UART_SRC_PLLC3_OUT0 3 | 185 | #define CAR_CLKSRC_UART_SRC_PLLC3_OUT0 3 | |
181 | #define CAR_CLKSRC_UART_SRC_PLLM_OUT0 4 | 186 | #define CAR_CLKSRC_UART_SRC_PLLM_OUT0 4 | |
182 | #define CAR_CLKSRC_UART_SRC_CLK_M 6 | 187 | #define CAR_CLKSRC_UART_SRC_CLK_M 6 | |
183 | #define CAR_CLKSRC_UART_DIV_ENB __BIT(24) | 188 | #define CAR_CLKSRC_UART_DIV_ENB __BIT(24) | |
184 | #define CAR_CLKSRC_UART_DIV __BITS(15,0) | 189 | #define CAR_CLKSRC_UART_DIV __BITS(15,0) | |
185 | 190 | |||
186 | #define CAR_CLKSRC_SDMMC1_REG 0x150 | 191 | #define CAR_CLKSRC_SDMMC1_REG 0x150 | |
187 | #define CAR_CLKSRC_SDMMC2_REG 0x154 | 192 | #define CAR_CLKSRC_SDMMC2_REG 0x154 | |
188 | #define CAR_CLKSRC_SDMMC4_REG 0x164 | 193 | #define CAR_CLKSRC_SDMMC4_REG 0x164 | |
189 | #define CAR_CLKSRC_SDMMC3_REG 0x1bc | 194 | #define CAR_CLKSRC_SDMMC3_REG 0x1bc | |
190 | 195 | |||
191 | #define CAR_CLKSRC_SDMMC_SRC __BITS(31,29) | 196 | #define CAR_CLKSRC_SDMMC_SRC __BITS(31,29) | |
192 | #define CAR_CLKSRC_SDMMC_SRC_PLLP_OUT0 0 | 197 | #define CAR_CLKSRC_SDMMC_SRC_PLLP_OUT0 0 | |
193 | #define CAR_CLKSRC_SDMMC_SRC_PLLC2_OUT0 1 | 198 | #define CAR_CLKSRC_SDMMC_SRC_PLLC2_OUT0 1 | |
194 | #define CAR_CLKSRC_SDMMC_SRC_PLLC_OUT0 2 | 199 | #define CAR_CLKSRC_SDMMC_SRC_PLLC_OUT0 2 | |
195 | #define CAR_CLKSRC_SDMMC_SRC_PLLC3_OUT0 3 | 200 | #define CAR_CLKSRC_SDMMC_SRC_PLLC3_OUT0 3 | |
196 | #define CAR_CLKSRC_SDMMC_SRC_PLLM_OUT0 4 | 201 | #define CAR_CLKSRC_SDMMC_SRC_PLLM_OUT0 4 | |
197 | #define CAR_CLKSRC_SDMMC_SRC_PLLE_OUT0 5 | 202 | #define CAR_CLKSRC_SDMMC_SRC_PLLE_OUT0 5 | |
198 | #define CAR_CLKSRC_SDMMC_SRC_CLK_M 6 | 203 | #define CAR_CLKSRC_SDMMC_SRC_CLK_M 6 | |
199 | #define CAR_CLKSRC_SDMMC_DIV __BITS(7,0) | 204 | #define CAR_CLKSRC_SDMMC_DIV __BITS(7,0) | |
200 | 205 | |||
201 | #define CAR_CLKSRC_HDMI_REG 0x18c | 206 | #define CAR_CLKSRC_HDMI_REG 0x18c | |
202 | #define CAR_CLKSRC_HDMI_SRC __BITS(31,29) | 207 | #define CAR_CLKSRC_HDMI_SRC __BITS(31,29) | |
203 | #define CAR_CLKSRC_HDMI_SRC_PLLP_OUT0 0 | 208 | #define CAR_CLKSRC_HDMI_SRC_PLLP_OUT0 0 | |
204 | #define CAR_CLKSRC_HDMI_SRC_PLLM_OUT0 1 | 209 | #define CAR_CLKSRC_HDMI_SRC_PLLM_OUT0 1 | |
205 | #define CAR_CLKSRC_HDMI_SRC_PLLD_OUT0 2 | 210 | #define CAR_CLKSRC_HDMI_SRC_PLLD_OUT0 2 | |
206 | #define CAR_CLKSRC_HDMI_SRC_PLLA_OUT0 3 | 211 | #define CAR_CLKSRC_HDMI_SRC_PLLA_OUT0 3 | |
207 | #define CAR_CLKSRC_HDMI_SRC_PLLC_OUT0 4 | 212 | #define CAR_CLKSRC_HDMI_SRC_PLLC_OUT0 4 | |
208 | #define CAR_CLKSRC_HDMI_SRC_PLLD2_OUT0 5 | 213 | #define CAR_CLKSRC_HDMI_SRC_PLLD2_OUT0 5 | |
209 | #define CAR_CLKSRC_HDMI_SRC_CLK_M 6 | 214 | #define CAR_CLKSRC_HDMI_SRC_CLK_M 6 | |
210 | #define CAR_CLKSRC_HDMI_DIV __BITS(7,0) | 215 | #define CAR_CLKSRC_HDMI_DIV __BITS(7,0) | |
211 | 216 | |||
212 | #define CAR_CLKSRC_DISP1_REG 0x138 | 217 | #define CAR_CLKSRC_DISP1_REG 0x138 | |
213 | #define CAR_CLKSRC_DISP2_REG 0x13c | 218 | #define CAR_CLKSRC_DISP2_REG 0x13c | |
214 | #define CAR_CLKSRC_DISP_SRC __BITS(31,29) | 219 | #define CAR_CLKSRC_DISP_SRC __BITS(31,29) | |
215 | #define CAR_CLKSRC_DISP_SRC_PLLP_OUT0 0 | 220 | #define CAR_CLKSRC_DISP_SRC_PLLP_OUT0 0 | |
216 | #define CAR_CLKSRC_DISP_SRC_PLLM_OUT0 1 | 221 | #define CAR_CLKSRC_DISP_SRC_PLLM_OUT0 1 | |
217 | #define CAR_CLKSRC_DISP_SRC_PLLD_OUT0 2 | 222 | #define CAR_CLKSRC_DISP_SRC_PLLD_OUT0 2 | |
218 | #define CAR_CLKSRC_DISP_SRC_PLLA_OUT0 3 | 223 | #define CAR_CLKSRC_DISP_SRC_PLLA_OUT0 3 | |
219 | #define CAR_CLKSRC_DISP_SRC_PLLC_OUT0 4 | 224 | #define CAR_CLKSRC_DISP_SRC_PLLC_OUT0 4 | |
220 | #define CAR_CLKSRC_DISP_SRC_PLLD2_OUT0 5 | 225 | #define CAR_CLKSRC_DISP_SRC_PLLD2_OUT0 5 | |
221 | #define CAR_CLKSRC_DISP_SRC_CLK_M 6 | 226 | #define CAR_CLKSRC_DISP_SRC_CLK_M 6 | |
222 | 227 | |||
223 | #define CAR_CLKSRC_HOST1X_REG 0x180 | 228 | #define CAR_CLKSRC_HOST1X_REG 0x180 | |
224 | #define CAR_CLKSRC_HOST1X_SRC __BITS(31,29) | 229 | #define CAR_CLKSRC_HOST1X_SRC __BITS(31,29) | |
225 | #define CAR_CLKSRC_HOST1X_SRC_PLLM_OUT0 0 | 230 | #define CAR_CLKSRC_HOST1X_SRC_PLLM_OUT0 0 | |
226 | #define CAR_CLKSRC_HOST1X_SRC_PLLC2_OUT0 1 | 231 | #define CAR_CLKSRC_HOST1X_SRC_PLLC2_OUT0 1 | |
227 | #define CAR_CLKSRC_HOST1X_SRC_PLLC_OUT0 2 | 232 | #define CAR_CLKSRC_HOST1X_SRC_PLLC_OUT0 2 | |
228 | #define CAR_CLKSRC_HOST1X_SRC_PLLC3_OUT0 3 | 233 | #define CAR_CLKSRC_HOST1X_SRC_PLLC3_OUT0 3 | |
229 | #define CAR_CLKSRC_HOST1X_SRC_PLLP_OUT0 4 | 234 | #define CAR_CLKSRC_HOST1X_SRC_PLLP_OUT0 4 | |
230 | #define CAR_CLKSRC_HOST1X_SRC_PLLA_OUT0 6 | 235 | #define CAR_CLKSRC_HOST1X_SRC_PLLA_OUT0 6 | |
231 | #define CAR_CLKSRC_HOST1X_IDLE_DIVISOR __BITS(15,8) | 236 | #define CAR_CLKSRC_HOST1X_IDLE_DIVISOR __BITS(15,8) | |
232 | #define CAR_CLKSRC_HOST1X_CLK_DIVISOR __BITS(7,0) | 237 | #define CAR_CLKSRC_HOST1X_CLK_DIVISOR __BITS(7,0) | |
233 | 238 | |||
234 | #define CAR_RST_DEV_L_SET_REG 0x300 | 239 | #define CAR_RST_DEV_L_SET_REG 0x300 | |
235 | #define CAR_RST_DEV_L_CLR_REG 0x304 | 240 | #define CAR_RST_DEV_L_CLR_REG 0x304 | |
236 | #define CAR_RST_DEV_H_SET_REG 0x308 | 241 | #define CAR_RST_DEV_H_SET_REG 0x308 | |
237 | #define CAR_RST_DEV_H_CLR_REG 0x30c | 242 | #define CAR_RST_DEV_H_CLR_REG 0x30c | |
238 | #define CAR_RST_DEV_U_SET_REG 0x310 | 243 | #define CAR_RST_DEV_U_SET_REG 0x310 | |
239 | #define CAR_RST_DEV_U_CLR_REG 0x314 | 244 | #define CAR_RST_DEV_U_CLR_REG 0x314 | |
240 | #define CAR_RST_DEV_V_SET_REG 0x430 | 245 | #define CAR_RST_DEV_V_SET_REG 0x430 | |
241 | #define CAR_RST_DEV_V_CLR_REG 0x434 | 246 | #define CAR_RST_DEV_V_CLR_REG 0x434 | |
242 | #define CAR_RST_DEV_W_SET_REG 0x438 | 247 | #define CAR_RST_DEV_W_SET_REG 0x438 | |
243 | #define CAR_RST_DEV_W_CLR_REG 0x43c | 248 | #define CAR_RST_DEV_W_CLR_REG 0x43c | |
244 | #define CAR_RST_DEV_X_SET_REG 0x290 | 249 | #define CAR_RST_DEV_X_SET_REG 0x290 | |
245 | #define CAR_RST_DEV_X_CLR_REG 0x294 | 250 | #define CAR_RST_DEV_X_CLR_REG 0x294 | |
246 | 251 | |||
247 | #define CAR_CLK_ENB_L_SET_REG 0x320 | 252 | #define CAR_CLK_ENB_L_SET_REG 0x320 | |
248 | #define CAR_CLK_ENB_L_CLR_REG 0x324 | 253 | #define CAR_CLK_ENB_L_CLR_REG 0x324 | |
249 | #define CAR_CLK_ENB_H_SET_REG 0x328 | 254 | #define CAR_CLK_ENB_H_SET_REG 0x328 | |
250 | #define CAR_CLK_ENB_H_CLR_REG 0x32c | 255 | #define CAR_CLK_ENB_H_CLR_REG 0x32c | |
251 | #define CAR_CLK_ENB_U_SET_REG 0x330 | 256 | #define CAR_CLK_ENB_U_SET_REG 0x330 | |
252 | #define CAR_CLK_ENB_U_CLR_REG 0x334 | 257 | #define CAR_CLK_ENB_U_CLR_REG 0x334 | |
253 | #define CAR_CLK_ENB_V_SET_REG 0x440 | 258 | #define CAR_CLK_ENB_V_SET_REG 0x440 | |
254 | #define CAR_CLK_ENB_V_CLR_REG 0x444 | 259 | #define CAR_CLK_ENB_V_CLR_REG 0x444 | |
255 | #define CAR_CLK_ENB_W_SET_REG 0x448 | 260 | #define CAR_CLK_ENB_W_SET_REG 0x448 | |
256 | #define CAR_CLK_ENB_W_CLR_REG 0x44c | 261 | #define CAR_CLK_ENB_W_CLR_REG 0x44c | |
257 | #define CAR_CLK_ENB_X_SET_REG 0x284 | 262 | #define CAR_CLK_ENB_X_SET_REG 0x284 | |
258 | #define CAR_CLK_ENB_X_CLR_REG 0x288 | 263 | #define CAR_CLK_ENB_X_CLR_REG 0x288 | |
259 | 264 | |||
260 | #define CAR_DEV_L_CACHE2 __BIT(31) | 265 | #define CAR_DEV_L_CACHE2 __BIT(31) | |
261 | #define CAR_DEV_L_I2S0 __BIT(30) | 266 | #define CAR_DEV_L_I2S0 __BIT(30) | |
262 | #define CAR_DEV_L_VCP __BIT(29) | 267 | #define CAR_DEV_L_VCP __BIT(29) | |
263 | #define CAR_DEV_L_HOST1X __BIT(28) | 268 | #define CAR_DEV_L_HOST1X __BIT(28) | |
264 | #define CAR_DEV_L_DISP1 __BIT(27) | 269 | #define CAR_DEV_L_DISP1 __BIT(27) | |
265 | #define CAR_DEV_L_DISP2 __BIT(26) | 270 | #define CAR_DEV_L_DISP2 __BIT(26) | |
266 | #define CAR_DEV_L_ISP __BIT(23) | 271 | #define CAR_DEV_L_ISP __BIT(23) | |
267 | #define CAR_DEV_L_USBD __BIT(22) | 272 | #define CAR_DEV_L_USBD __BIT(22) | |
268 | #define CAR_DEV_L_VI __BIT(20) | 273 | #define CAR_DEV_L_VI __BIT(20) | |
269 | #define CAR_DEV_L_I2S2 __BIT(18) | 274 | #define CAR_DEV_L_I2S2 __BIT(18) | |
270 | #define CAR_DEV_L_PWM __BIT(17) | 275 | #define CAR_DEV_L_PWM __BIT(17) | |
271 | #define CAR_DEV_L_SDMMC4 __BIT(15) | 276 | #define CAR_DEV_L_SDMMC4 __BIT(15) | |
272 | #define CAR_DEV_L_SDMMC1 __BIT(14) | 277 | #define CAR_DEV_L_SDMMC1 __BIT(14) | |
273 | #define CAR_DEV_L_I2C1 __BIT(12) | 278 | #define CAR_DEV_L_I2C1 __BIT(12) | |
274 | #define CAR_DEV_L_I2S1 __BIT(11) | 279 | #define CAR_DEV_L_I2S1 __BIT(11) | |
275 | #define CAR_DEV_L_SPDIF __BIT(10) | 280 | #define CAR_DEV_L_SPDIF __BIT(10) | |
276 | #define CAR_DEV_L_SDMMC2 __BIT(9) | 281 | #define CAR_DEV_L_SDMMC2 __BIT(9) | |
277 | #define CAR_DEV_L_GPIO __BIT(8) | 282 | #define CAR_DEV_L_GPIO __BIT(8) | |
278 | #define CAR_DEV_L_UARTB __BIT(7) | 283 | #define CAR_DEV_L_UARTB __BIT(7) | |
279 | #define CAR_DEV_L_UARTA __BIT(6) | 284 | #define CAR_DEV_L_UARTA __BIT(6) | |
280 | #define CAR_DEV_L_TMR __BIT(5 | 285 | #define CAR_DEV_L_TMR __BIT(5 | |
281 | #define CAR_DEV_L_RTC __BIT(4) | 286 | #define CAR_DEV_L_RTC __BIT(4) | |
282 | #define CAR_DEV_L_ISPB __BIT(3) | 287 | #define CAR_DEV_L_ISPB __BIT(3) | |
283 | #define CAR_DEV_L_CPU __BIT(0) | 288 | #define CAR_DEV_L_CPU __BIT(0) | |
284 | 289 | |||
285 | #define CAR_DEV_U_XUSB_DEV __BIT(31) | 290 | #define CAR_DEV_U_XUSB_DEV __BIT(31) | |
286 | #define CAR_DEV_U_DEV1_OUT __BIT(30) | 291 | #define CAR_DEV_U_DEV1_OUT __BIT(30) | |
287 | #define CAR_DEV_U_DEV2_OUT __BIT(29) | 292 | #define CAR_DEV_U_DEV2_OUT __BIT(29) | |
288 | #define CAR_DEV_U_SUS_OUT __BIT(28) | 293 | #define CAR_DEV_U_SUS_OUT __BIT(28) | |
289 | #define CAR_DEV_U_MSENC __BIT(27) | 294 | #define CAR_DEV_U_MSENC __BIT(27) | |
290 | #define CAR_DEV_U_XUSB_HOST __BIT(25) | 295 | #define CAR_DEV_U_XUSB_HOST __BIT(25) | |
291 | #define CAR_DEV_U_CRAM2 __BIT(24) | 296 | #define CAR_DEV_U_CRAM2 __BIT(24) | |
292 | #define CAR_DEV_U_IRAMD __BIT(23) | 297 | #define CAR_DEV_U_IRAMD __BIT(23) | |
293 | #define CAR_DEV_U_IRAMC __BIT(22) | 298 | #define CAR_DEV_U_IRAMC __BIT(22) | |
294 | #define CAR_DEV_U_IRAMB __BIT(21) | 299 | #define CAR_DEV_U_IRAMB __BIT(21) | |
295 | #define CAR_DEV_U_IRAMA __BIT(20) | 300 | #define CAR_DEV_U_IRAMA __BIT(20) | |
296 | #define CAR_DEV_U_TSEC __BIT(19) | 301 | #define CAR_DEV_U_TSEC __BIT(19) | |
297 | #define CAR_DEV_U_DSIB __BIT(18) | 302 | #define CAR_DEV_U_DSIB __BIT(18) | |
298 | #define CAR_DEV_U_I2C_SLOW __BIT(17) | 303 | #define CAR_DEV_U_I2C_SLOW __BIT(17) | |
299 | #define CAR_DEV_U_DTV __BIT(15) | 304 | #define CAR_DEV_U_DTV __BIT(15) | |
300 | #define CAR_DEV_U_SOC_THERM __BIT(14) | 305 | #define CAR_DEV_U_SOC_THERM __BIT(14) | |
301 | #define CAR_DEV_U_TRACECLKIN __BIT(13) | 306 | #define CAR_DEV_U_TRACECLKIN __BIT(13) | |
302 | #define CAR_DEV_U_AVPUCQ __BIT(11) | 307 | #define CAR_DEV_U_AVPUCQ __BIT(11) | |
303 | #define CAR_DEV_U_CSITE __BIT(9) | 308 | #define CAR_DEV_U_CSITE __BIT(9) | |
304 | #define CAR_DEV_U_AFI __BIT(8) | 309 | #define CAR_DEV_U_AFI __BIT(8) | |
305 | #define CAR_DEV_U_OWR __BIT(7) | 310 | #define CAR_DEV_U_OWR __BIT(7) | |
306 | #define CAR_DEV_U_PCIE __BIT(6) | 311 | #define CAR_DEV_U_PCIE __BIT(6) | |
307 | #define CAR_DEV_U_SDMMC3 __BIT(5) | 312 | #define CAR_DEV_U_SDMMC3 __BIT(5) | |
308 | #define CAR_DEV_U_SPI4 __BIT(4) | 313 | #define CAR_DEV_U_SPI4 __BIT(4) | |
309 | #define CAR_DEV_U_I2C3 __BIT(3) | 314 | #define CAR_DEV_U_I2C3 __BIT(3) | |
310 | #define CAR_DEV_U_UARTD __BIT(1) | 315 | #define CAR_DEV_U_UARTD __BIT(1) | |
311 | 316 | |||
312 | #define CAR_DEV_H_BSEV __BIT(31) | 317 | #define CAR_DEV_H_BSEV __BIT(31) | |
313 | #define CAR_DEV_H_BSEA __BIT(30) | 318 | #define CAR_DEV_H_BSEA __BIT(30) | |
314 | #define CAR_DEV_H_VDE __BIT(29) | 319 | #define CAR_DEV_H_VDE __BIT(29) | |
315 | #define CAR_DEV_H_USB3 __BIT(27) | 320 | #define CAR_DEV_H_USB3 __BIT(27) | |
316 | #define CAR_DEV_H_USB2 __BIT(26) | 321 | #define CAR_DEV_H_USB2 __BIT(26) | |
317 | #define CAR_DEV_H_EMC __BIT(25) | 322 | #define CAR_DEV_H_EMC __BIT(25) | |
318 | #define CAR_DEV_H_MIPI_CAL __BIT(24) | 323 | #define CAR_DEV_H_MIPI_CAL __BIT(24) | |
319 | #define CAR_DEV_H_UARTC __BIT(23) | 324 | #define CAR_DEV_H_UARTC __BIT(23) | |
320 | #define CAR_DEV_H_I2C2 __BIT(22) | 325 | #define CAR_DEV_H_I2C2 __BIT(22) | |
321 | #define CAR_DEV_H_CSI __BIT(20) | 326 | #define CAR_DEV_H_CSI __BIT(20) | |
322 | #define CAR_DEV_H_HDMI __BIT(19) | 327 | #define CAR_DEV_H_HDMI __BIT(19) | |
323 | #define CAR_DEV_H_HSI __BIT(18) | 328 | #define CAR_DEV_H_HSI __BIT(18) | |
324 | #define CAR_DEV_H_DSI __BIT(16) | 329 | #define CAR_DEV_H_DSI __BIT(16) | |
325 | #define CAR_DEV_H_I2C5 __BIT(15) | 330 | #define CAR_DEV_H_I2C5 __BIT(15) | |
326 | #define CAR_DEV_H_SPI3 __BIT(14) | 331 | #define CAR_DEV_H_SPI3 __BIT(14) | |
327 | #define CAR_DEV_H_SPI2 __BIT(12) | 332 | #define CAR_DEV_H_SPI2 __BIT(12) | |
328 | #define CAR_DEV_H_JTAG2TBC __BIT(11) | 333 | #define CAR_DEV_H_JTAG2TBC __BIT(11) | |
329 | #define CAR_DEV_H_SNOR __BIT(10) | 334 | #define CAR_DEV_H_SNOR __BIT(10) | |
330 | #define CAR_DEV_H_SPI1 __BIT(9) | 335 | #define CAR_DEV_H_SPI1 __BIT(9) | |
331 | #define CAR_DEV_H_KFUSE __BIT(8) | 336 | #define CAR_DEV_H_KFUSE __BIT(8) | |
332 | #define CAR_DEV_H_FUSE __BIT(7) | 337 | #define CAR_DEV_H_FUSE __BIT(7) | |
333 | #define CAR_DEV_H_PMC __BIT(6) | 338 | #define CAR_DEV_H_PMC __BIT(6) | |
334 | #define CAR_DEV_H_STAT_MON __BIT(5) | 339 | #define CAR_DEV_H_STAT_MON __BIT(5) | |
335 | #define CAR_DEV_H_KBC __BIT(4) | 340 | #define CAR_DEV_H_KBC __BIT(4) | |
336 | #define CAR_DEV_H_APBDMA __BIT(2) | 341 | #define CAR_DEV_H_APBDMA __BIT(2) | |
337 | #define CAR_DEV_H_AHBDMA __BIT(1) | 342 | #define CAR_DEV_H_AHBDMA __BIT(1) | |
338 | #define CAR_DEV_H_MEM __BIT(0) | 343 | #define CAR_DEV_H_MEM __BIT(0) | |
339 | 344 | |||
340 | #define CAR_DEV_V_HDA __BIT(29) | 345 | #define CAR_DEV_V_HDA __BIT(29) | |
341 | #define CAR_DEV_V_SATA __BIT(28) | 346 | #define CAR_DEV_V_SATA __BIT(28) | |
342 | #define CAR_DEV_V_SATA_OOB __BIT(27) | 347 | #define CAR_DEV_V_SATA_OOB __BIT(27) | |
343 | #define CAR_DEV_V_ACTMON __BIT(23) | 348 | #define CAR_DEV_V_ACTMON __BIT(23) | |
344 | #define CAR_DEV_V_ATOMICS __BIT(16) | 349 | #define CAR_DEV_V_ATOMICS __BIT(16) | |
345 | #define CAR_DEV_V_HDA2CODEC_2X __BIT(15) | 350 | #define CAR_DEV_V_HDA2CODEC_2X __BIT(15) | |
346 | #define CAR_DEV_V_DAM2 __BIT(14) | 351 | #define CAR_DEV_V_DAM2 __BIT(14) | |
347 | #define CAR_DEV_V_DAM1 __BIT(13) | 352 | #define CAR_DEV_V_DAM1 __BIT(13) | |
348 | #define CAR_DEV_V_DAM0 __BIT(12) | 353 | #define CAR_DEV_V_DAM0 __BIT(12) | |
349 | #define CAR_DEV_V_APBIF __BIT(11) | 354 | #define CAR_DEV_V_APBIF __BIT(11) | |
350 | #define CAR_DEV_V_AUDIO __BIT(10) | 355 | #define CAR_DEV_V_AUDIO __BIT(10) | |
351 | #define CAR_DEV_V_SPI6 __BIT(9) | 356 | #define CAR_DEV_V_SPI6 __BIT(9) | |
352 | #define CAR_DEV_V_SPI5 __BIT(8) | 357 | #define CAR_DEV_V_SPI5 __BIT(8) | |
353 | #define CAR_DEV_V_I2C4 __BIT(7) | 358 | #define CAR_DEV_V_I2C4 __BIT(7) | |
354 | #define CAR_DEV_V_I2S4 __BIT(6) | 359 | #define CAR_DEV_V_I2S4 __BIT(6) | |
355 | #define CAR_DEV_V_I2S3 __BIT(5) | 360 | #define CAR_DEV_V_I2S3 __BIT(5) | |
356 | #define CAR_DEV_V_MSELECT __BIT(3) | 361 | #define CAR_DEV_V_MSELECT __BIT(3) | |
357 | #define CAR_DEV_V_CPULP __BIT(1) | 362 | #define CAR_DEV_V_CPULP __BIT(1) | |
358 | #define CAR_DEV_V_CPUG __BIT(0) | 363 | #define CAR_DEV_V_CPUG __BIT(0) | |
359 | 364 | |||
360 | #define CAR_DEV_W_XUSB_SS __BIT(28) | 365 | #define CAR_DEV_W_XUSB_SS __BIT(28) | |
361 | #define CAR_DEV_W_DVFS __BIT(27) | 366 | #define CAR_DEV_W_DVFS __BIT(27) | |
362 | #define CAR_DEV_W_ADX0 __BIT(26) | 367 | #define CAR_DEV_W_ADX0 __BIT(26) | |
363 | #define CAR_DEV_W_AMX0 __BIT(25) | 368 | #define CAR_DEV_W_AMX0 __BIT(25) | |
364 | #define CAR_DEV_W_ENTROPY __BIT(21) | 369 | #define CAR_DEV_W_ENTROPY __BIT(21) | |
365 | #define CAR_DEV_W_XUSB_PADCTL __BIT(14) | 370 | #define CAR_DEV_W_XUSB_PADCTL __BIT(14) | |
366 | #define CAR_DEV_W_CEC __BIT(8) | 371 | #define CAR_DEV_W_CEC __BIT(8) | |
367 | #define CAR_DEV_W_SATACOLD __BIT(1) | 372 | #define CAR_DEV_W_SATACOLD __BIT(1) | |
368 | #define CAR_DEV_W_HDA2HDMICODEC __BIT(0) | 373 | #define CAR_DEV_W_HDA2HDMICODEC __BIT(0) | |
369 | 374 | |||
370 | #define CAR_DEV_X_AMX1 __BIT(25) | 375 | #define CAR_DEV_X_AMX1 __BIT(25) | |
371 | #define CAR_DEV_X_GPU __BIT(24) | 376 | #define CAR_DEV_X_GPU __BIT(24) | |
372 | #define CAR_DEV_X_SOR0 __BIT(22) | 377 | #define CAR_DEV_X_SOR0 __BIT(22) | |
373 | #define CAR_DEV_X_DPAUX __BIT(21) | 378 | #define CAR_DEV_X_DPAUX __BIT(21) | |
374 | #define CAR_DEV_X_ADX1 __BIT(20) | 379 | #define CAR_DEV_X_ADX1 __BIT(20) | |
375 | #define CAR_DEV_X_VIC __BIT(18) | 380 | #define CAR_DEV_X_VIC __BIT(18) | |
376 | #define CAR_DEV_X_CLK72MHZ __BIT(17) | 381 | #define CAR_DEV_X_CLK72MHZ __BIT(17) | |
377 | #define CAR_DEV_X_HDMI_AUDIO __BIT(16) | 382 | #define CAR_DEV_X_HDMI_AUDIO __BIT(16) | |
378 | #define CAR_DEV_X_EMC_DLL __BIT(14) | 383 | #define CAR_DEV_X_EMC_DLL __BIT(14) | |
379 | #define CAR_DEV_X_VIM2_CLK __BIT(11) | 384 | #define CAR_DEV_X_VIM2_CLK __BIT(11) | |
380 | #define CAR_DEV_X_I2C6 __BIT(6) | 385 | #define CAR_DEV_X_I2C6 __BIT(6) | |
381 | #define CAR_DEV_X_CAM_MCLK2 __BIT(5) | 386 | #define CAR_DEV_X_CAM_MCLK2 __BIT(5) | |
382 | #define CAR_DEV_X_CAM_MCLK __BIT(4) | 387 | #define CAR_DEV_X_CAM_MCLK __BIT(4) | |
383 | #define CAR_DEV_X_SPARE __BIT(0) | 388 | #define CAR_DEV_X_SPARE __BIT(0) | |
384 | 389 | |||
385 | #define CAR_CCLKG_BURST_POLICY_REG 0x368 | 390 | #define CAR_CCLKG_BURST_POLICY_REG 0x368 | |
386 | #define CAR_CCLKG_BURST_POLICY_CPU_STATE __BITS(31,28) | 391 | #define CAR_CCLKG_BURST_POLICY_CPU_STATE __BITS(31,28) | |
387 | #define CAR_CCLKG_BURST_POLICY_CPU_STATE_IDLE 1 | 392 | #define CAR_CCLKG_BURST_POLICY_CPU_STATE_IDLE 1 | |
388 | #define CAR_CCLKG_BURST_POLICY_CPU_STATE_RUN 2 | 393 | #define CAR_CCLKG_BURST_POLICY_CPU_STATE_RUN 2 | |
389 | #define CAR_CCLKG_BURST_POLICY_CWAKEUP_IDLE_SOURCE __BITS(3,0) | 394 | #define CAR_CCLKG_BURST_POLICY_CWAKEUP_IDLE_SOURCE __BITS(3,0) | |
390 | #define CAR_CCLKG_BURST_POLICY_CWAKEUP_SOURCE_CLKM 0 | 395 | #define CAR_CCLKG_BURST_POLICY_CWAKEUP_SOURCE_CLKM 0 | |
391 | #define CAR_CCLKG_BURST_POLICY_CWAKEUP_SOURCE_PLLX_OUT0_LJ 8 | 396 | #define CAR_CCLKG_BURST_POLICY_CWAKEUP_SOURCE_PLLX_OUT0_LJ 8 | |
392 | 397 | |||
393 | #define CAR_CLKSRC_HDA2CODEC_2X_REG 0x3e4 | 398 | #define CAR_CLKSRC_HDA2CODEC_2X_REG 0x3e4 | |
394 | #define CAR_CLKSRC_HDA2CODEC_2X_SRC __BITS(31,29) | 399 | #define CAR_CLKSRC_HDA2CODEC_2X_SRC __BITS(31,29) | |
395 | #define CAR_CLKSRC_HDA2CODEC_2X_SRC_PLLP_OUT0 0 | 400 | #define CAR_CLKSRC_HDA2CODEC_2X_SRC_PLLP_OUT0 0 | |
396 | #define CAR_CLKSRC_HDA2CODEC_2X_SRC_PLLC2_OUT0 1 | 401 | #define CAR_CLKSRC_HDA2CODEC_2X_SRC_PLLC2_OUT0 1 | |
397 | #define CAR_CLKSRC_HDA2CODEC_2X_SRC_PLLC_OUT0 2 | 402 | #define CAR_CLKSRC_HDA2CODEC_2X_SRC_PLLC_OUT0 2 | |
398 | #define CAR_CLKSRC_HDA2CODEC_2X_SRC_PLLC3_OUT0 3 | 403 | #define CAR_CLKSRC_HDA2CODEC_2X_SRC_PLLC3_OUT0 3 | |
399 | #define CAR_CLKSRC_HDA2CODEC_2X_SRC_PLLM_OUT0 4 | 404 | #define CAR_CLKSRC_HDA2CODEC_2X_SRC_PLLM_OUT0 4 | |
400 | #define CAR_CLKSRC_HDA2CODEC_2X_SRC_CLKM 6 | 405 | #define CAR_CLKSRC_HDA2CODEC_2X_SRC_CLKM 6 | |
401 | #define CAR_CLKSRC_HDA2CODEC_2X_DIV __BITS(7,0) | 406 | #define CAR_CLKSRC_HDA2CODEC_2X_DIV __BITS(7,0) | |
402 | 407 | |||
403 | #define CAR_CLKSRC_SATA_OOB_REG 0x420 | 408 | #define CAR_CLKSRC_SATA_OOB_REG 0x420 | |
404 | #define CAR_CLKSRC_SATA_OOB_SRC __BITS(31,29) | 409 | #define CAR_CLKSRC_SATA_OOB_SRC __BITS(31,29) | |
405 | #define CAR_CLKSRC_SATA_OOB_SRC_PLLP_OUT0 0 | 410 | #define CAR_CLKSRC_SATA_OOB_SRC_PLLP_OUT0 0 | |
406 | #define CAR_CLKSRC_SATA_OOB_SRC_PLLC_OUT0 2 | 411 | #define CAR_CLKSRC_SATA_OOB_SRC_PLLC_OUT0 2 | |
407 | #define CAR_CLKSRC_SATA_OOB_SRC_PLLM_OUT0 4 | 412 | #define CAR_CLKSRC_SATA_OOB_SRC_PLLM_OUT0 4 | |
408 | #define CAR_CLKSRC_SATA_OOB_SRC_CLKM 6 | 413 | #define CAR_CLKSRC_SATA_OOB_SRC_CLKM 6 | |
409 | #define CAR_CLKSRC_SATA_OOB_DIV __BITS(7,0) | 414 | #define CAR_CLKSRC_SATA_OOB_DIV __BITS(7,0) | |
410 | 415 | |||
411 | #define CAR_CLKSRC_SATA_REG 0x424 | 416 | #define CAR_CLKSRC_SATA_REG 0x424 | |
412 | #define CAR_CLKSRC_SATA_SRC __BITS(31,29) | 417 | #define CAR_CLKSRC_SATA_SRC __BITS(31,29) | |
413 | #define CAR_CLKSRC_SATA_SRC_PLLP_OUT0 0 | 418 | #define CAR_CLKSRC_SATA_SRC_PLLP_OUT0 0 | |
414 | #define CAR_CLKSRC_SATA_SRC_PLLC_OUT0 2 | 419 | #define CAR_CLKSRC_SATA_SRC_PLLC_OUT0 2 | |
415 | #define CAR_CLKSRC_SATA_SRC_PLLM_OUT0 4 | 420 | #define CAR_CLKSRC_SATA_SRC_PLLM_OUT0 4 | |
416 | #define CAR_CLKSRC_SATA_SRC_CLKM 6 | 421 | #define CAR_CLKSRC_SATA_SRC_CLKM 6 | |
417 | #define CAR_CLKSRC_SATA_AUX_CLK_ENB __BIT(24) | 422 | #define CAR_CLKSRC_SATA_AUX_CLK_ENB __BIT(24) | |
418 | #define CAR_CLKSRC_SATA_DIV __BITS(7,0) | 423 | #define CAR_CLKSRC_SATA_DIV __BITS(7,0) | |
419 | 424 | |||
420 | #define CAR_UTMIP_PLL_CFG0_REG 0x480 | 425 | #define CAR_UTMIP_PLL_CFG0_REG 0x480 | |
421 | 426 | |||
422 | #define CAR_UTMIP_PLL_CFG1_REG 0x484 | 427 | #define CAR_UTMIP_PLL_CFG1_REG 0x484 | |
423 | #define CAR_UTMIP_PLL_CFG1_ENABLE_DLY_COUNT __BITS(31,27) | 428 | #define CAR_UTMIP_PLL_CFG1_ENABLE_DLY_COUNT __BITS(31,27) | |
424 | #define CAR_UTMIP_PLL_CFG1_PLLU_POWERUP __BIT(17) | 429 | #define CAR_UTMIP_PLL_CFG1_PLLU_POWERUP __BIT(17) | |
425 | #define CAR_UTMIP_PLL_CFG1_PLLU_POWERDOWN __BIT(16) | 430 | #define CAR_UTMIP_PLL_CFG1_PLLU_POWERDOWN __BIT(16) | |
426 | #define CAR_UTMIP_PLL_CFG1_PLL_ENABLE_POWERUP __BIT(15) | 431 | #define CAR_UTMIP_PLL_CFG1_PLL_ENABLE_POWERUP __BIT(15) | |
427 | #define CAR_UTMIP_PLL_CFG1_PLL_ENABLE_POWERDOWN __BIT(14) | 432 | #define CAR_UTMIP_PLL_CFG1_PLL_ENABLE_POWERDOWN __BIT(14) | |
428 | #define CAR_UTMIP_PLL_CFG1_XTAL_FREQ_COUNT __BITS(11,0) | 433 | #define CAR_UTMIP_PLL_CFG1_XTAL_FREQ_COUNT __BITS(11,0) | |
429 | 434 | |||
430 | #define CAR_UTMIP_PLL_CFG2_REG 0x488 | 435 | #define CAR_UTMIP_PLL_CFG2_REG 0x488 | |
431 | #define CAR_UTMIP_PLL_CFG2_ACTIVE_DLY_COUNT __BITS(23,18) | 436 | #define CAR_UTMIP_PLL_CFG2_ACTIVE_DLY_COUNT __BITS(23,18) | |
432 | #define CAR_UTMIP_PLL_CFG2_STABLE_COUNT __BITS(17,6) | 437 | #define CAR_UTMIP_PLL_CFG2_STABLE_COUNT __BITS(17,6) | |
433 | #define CAR_UTMIP_PLL_CFG2_PD_SAMP_C_POWERUP __BIT(5) | 438 | #define CAR_UTMIP_PLL_CFG2_PD_SAMP_C_POWERUP __BIT(5) | |
434 | #define CAR_UTMIP_PLL_CFG2_PD_SAMP_C_POWERDOWN __BIT(4) | 439 | #define CAR_UTMIP_PLL_CFG2_PD_SAMP_C_POWERDOWN __BIT(4) | |
435 | #define CAR_UTMIP_PLL_CFG2_PD_SAMP_B_POWERUP __BIT(3) | 440 | #define CAR_UTMIP_PLL_CFG2_PD_SAMP_B_POWERUP __BIT(3) | |
436 | #define CAR_UTMIP_PLL_CFG2_PD_SAMP_B_POWERDOWN __BIT(2) | 441 | #define CAR_UTMIP_PLL_CFG2_PD_SAMP_B_POWERDOWN __BIT(2) | |
437 | #define CAR_UTMIP_PLL_CFG2_PD_SAMP_A_POWERUP __BIT(1) | 442 | #define CAR_UTMIP_PLL_CFG2_PD_SAMP_A_POWERUP __BIT(1) | |
438 | #define CAR_UTMIP_PLL_CFG2_PD_SAMP_A_POWERDOWN __BIT(0) | 443 | #define CAR_UTMIP_PLL_CFG2_PD_SAMP_A_POWERDOWN __BIT(0) | |
439 | 444 | |||
440 | #define CAR_PLLE_AUX_REG 0x48c | 445 | #define CAR_PLLE_AUX_REG 0x48c | |
441 | #define CAR_PLLE_AUX_SS_SEQ_INCLUDE __BIT(31) | 446 | #define CAR_PLLE_AUX_SS_SEQ_INCLUDE __BIT(31) | |
442 | #define CAR_PLLE_AUX_REF_SEL_PLLREFE __BIT(28) | 447 | #define CAR_PLLE_AUX_REF_SEL_PLLREFE __BIT(28) | |
443 | #define CAR_PLLE_AUX_SEQ_STATE __BITS(27,26) | 448 | #define CAR_PLLE_AUX_SEQ_STATE __BITS(27,26) | |
444 | #define CAR_PLLE_AUX_SEQ_START_STATE __BIT(25) | 449 | #define CAR_PLLE_AUX_SEQ_START_STATE __BIT(25) | |
445 | #define CAR_PLLE_AUX_SEQ_ENABLE __BIT(24) | 450 | #define CAR_PLLE_AUX_SEQ_ENABLE __BIT(24) | |
446 | #define CAR_PLLE_AUX_SS_DLY __BITS(23,16) | 451 | #define CAR_PLLE_AUX_SS_DLY __BITS(23,16) | |
447 | #define CAR_PLLE_AUX_LOCK_DLY __BITS(15,8) | 452 | #define CAR_PLLE_AUX_LOCK_DLY __BITS(15,8) | |
448 | #define CAR_PLLE_AUX_FAST_PT __BIT(7) | 453 | #define CAR_PLLE_AUX_FAST_PT __BIT(7) | |
449 | #define CAR_PLLE_AUX_SS_SWCTL __BIT(6) | 454 | #define CAR_PLLE_AUX_SS_SWCTL __BIT(6) | |
450 | #define CAR_PLLE_AUX_CONFIG_SWCTL __BIT(5) | 455 | #define CAR_PLLE_AUX_CONFIG_SWCTL __BIT(5) | |
451 | #define CAR_PLLE_AUX_ENABLE_SWCTL __BIT(4) | 456 | #define CAR_PLLE_AUX_ENABLE_SWCTL __BIT(4) | |
452 | #define CAR_PLLE_AUX_USE_LOCKDET __BIT(3) | 457 | #define CAR_PLLE_AUX_USE_LOCKDET __BIT(3) | |
453 | #define CAR_PLLE_AUX_REF_SRC __BIT(2) | 458 | #define CAR_PLLE_AUX_REF_SRC __BIT(2) | |
454 | #define CAR_PLLE_AUX_CML1_OEN __BIT(1) | 459 | #define CAR_PLLE_AUX_CML1_OEN __BIT(1) | |
455 | #define CAR_PLLE_AUX_CML0_OEN __BIT(0) | 460 | #define CAR_PLLE_AUX_CML0_OEN __BIT(0) | |
456 | 461 | |||
457 | #define CAR_SATA_PLL_CFG0_REG 0x490 | 462 | #define CAR_SATA_PLL_CFG0_REG 0x490 | |
458 | #define CAR_SATA_PLL_CFG0_SEQ_STATE __BITS(27,26) | 463 | #define CAR_SATA_PLL_CFG0_SEQ_STATE __BITS(27,26) | |
459 | #define CAR_SATA_PLL_CFG0_SEQ_START_STATE __BIT(25) | 464 | #define CAR_SATA_PLL_CFG0_SEQ_START_STATE __BIT(25) | |
460 | #define CAR_SATA_PLL_CFG0_SEQ_ENABLE __BIT(24) | 465 | #define CAR_SATA_PLL_CFG0_SEQ_ENABLE __BIT(24) | |
461 | #define CAR_SATA_PLL_CFG0_SEQ_PADPLL_PD_INPUT_VALUE __BIT(7) | 466 | #define CAR_SATA_PLL_CFG0_SEQ_PADPLL_PD_INPUT_VALUE __BIT(7) | |
462 | #define CAR_SATA_PLL_CFG0_SEQ_LANE_PD_INPUT_VALUE __BIT(6) | 467 | #define CAR_SATA_PLL_CFG0_SEQ_LANE_PD_INPUT_VALUE __BIT(6) | |
463 | #define CAR_SATA_PLL_CFG0_SEQ_RESET_INPUT_VALUE __BIT(5) | 468 | #define CAR_SATA_PLL_CFG0_SEQ_RESET_INPUT_VALUE __BIT(5) | |
464 | #define CAR_SATA_PLL_CFG0_SEQ_IN_SWCTL __BIT(4) | 469 | #define CAR_SATA_PLL_CFG0_SEQ_IN_SWCTL __BIT(4) | |
465 | #define CAR_SATA_PLL_CFG0_PADPLL_USE_LOCKDET __BIT(2) | 470 | #define CAR_SATA_PLL_CFG0_PADPLL_USE_LOCKDET __BIT(2) | |
466 | #define CAR_SATA_PLL_CFG0_PADPLL_RESET_OVERRIDE_VALUE __BIT(1) | 471 | #define CAR_SATA_PLL_CFG0_PADPLL_RESET_OVERRIDE_VALUE __BIT(1) | |
467 | #define CAR_SATA_PLL_CFG0_PADPLL_RESET_SWCTL __BIT(0) | 472 | #define CAR_SATA_PLL_CFG0_PADPLL_RESET_SWCTL __BIT(0) | |
468 | 473 | |||
469 | #define CAR_SATA_PLL_CFG1_REG 0x494 | 474 | #define CAR_SATA_PLL_CFG1_REG 0x494 | |
470 | #define CAR_SATA_PLL_CFG1_LANE_IDDQ2_PADPLL_RESET_DLY __BITS(31,24) | 475 | #define CAR_SATA_PLL_CFG1_LANE_IDDQ2_PADPLL_RESET_DLY __BITS(31,24) | |
471 | #define CAR_SATA_PLL_CFG1_PADPLL_IDDQ2LANE_SLUMBER_DLY __BITS(23,16) | 476 | #define CAR_SATA_PLL_CFG1_PADPLL_IDDQ2LANE_SLUMBER_DLY __BITS(23,16) | |
472 | #define CAR_SATA_PLL_CFG1_PADPLL_PU_POST_DLY __BITS(15,8) | 477 | #define CAR_SATA_PLL_CFG1_PADPLL_PU_POST_DLY __BITS(15,8) | |
473 | #define CAR_SATA_PLL_CFG1_LANE_IDDQ2_PADPLL_IDDQ_DLY __BITS(7,0) | 478 | #define CAR_SATA_PLL_CFG1_LANE_IDDQ2_PADPLL_IDDQ_DLY __BITS(7,0) | |
474 | 479 | |||
475 | #define CAR_CLKSRC_HDMI_AUDIO_REG 0x668 | 480 | #define CAR_CLKSRC_HDMI_AUDIO_REG 0x668 | |
476 | #define CAR_CLKSRC_HDMI_AUDIO_SRC __BITS(31,29) | 481 | #define CAR_CLKSRC_HDMI_AUDIO_SRC __BITS(31,29) | |
477 | #define CAR_CLKSRC_HDMI_AUDIO_SRC_PLLP_OUT0 0 | 482 | #define CAR_CLKSRC_HDMI_AUDIO_SRC_PLLP_OUT0 0 | |
478 | #define CAR_CLKSRC_HDMI_AUDIO_SRC_PLLC_OUT0 1 | 483 | #define CAR_CLKSRC_HDMI_AUDIO_SRC_PLLC_OUT0 1 | |
479 | #define CAR_CLKSRC_HDMI_AUDIO_SRC_PLLC2_OUT0 2 | 484 | #define CAR_CLKSRC_HDMI_AUDIO_SRC_PLLC2_OUT0 2 | |
480 | #define CAR_CLKSRC_HDMI_AUDIO_SRC_CLKM 3 | 485 | #define CAR_CLKSRC_HDMI_AUDIO_SRC_CLKM 3 | |
481 | #define CAR_CLKSRC_HDMI_AUDIO_DIV __BITS(7,0) | 486 | #define CAR_CLKSRC_HDMI_AUDIO_DIV __BITS(7,0) | |
482 | 487 | |||
483 | #endif /* _ARM_TEGRA_CARREG_H */ | 488 | #endif /* _ARM_TEGRA_CARREG_H */ |
--- src/sys/arch/arm/nvidia/tegra_var.h 2015/08/01 21:20:11 1.24
+++ src/sys/arch/arm/nvidia/tegra_var.h 2015/10/17 21:16:09 1.25
@@ -1,181 +1,182 @@ | @@ -1,181 +1,182 @@ | |||
1 | /* $NetBSD: tegra_var.h,v 1.24 2015/08/01 21:20:11 jmcneill Exp $ */ | 1 | /* $NetBSD: tegra_var.h,v 1.25 2015/10/17 21:16:09 jmcneill Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca> | 4 | * Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca> | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
15 | * | 15 | * | |
16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | |
21 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 21 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | |
23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | 23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
26 | * SUCH DAMAGE. | 26 | * SUCH DAMAGE. | |
27 | */ | 27 | */ | |
28 | 28 | |||
29 | #ifndef _ARM_TEGRA_VAR_H | 29 | #ifndef _ARM_TEGRA_VAR_H | |
30 | #define _ARM_TEGRA_VAR_H | 30 | #define _ARM_TEGRA_VAR_H | |
31 | 31 | |||
32 | #include <sys/types.h> | 32 | #include <sys/types.h> | |
33 | #include <sys/bus.h> | 33 | #include <sys/bus.h> | |
34 | #include <sys/gpio.h> | 34 | #include <sys/gpio.h> | |
35 | 35 | |||
36 | #include "opt_tegra.h" | 36 | #include "opt_tegra.h" | |
37 | 37 | |||
38 | struct tegra_locators { | 38 | struct tegra_locators { | |
39 | const char *loc_name; | 39 | const char *loc_name; | |
40 | bus_addr_t loc_offset; | 40 | bus_addr_t loc_offset; | |
41 | bus_size_t loc_size; | 41 | bus_size_t loc_size; | |
42 | int loc_port; | 42 | int loc_port; | |
43 | int loc_intr; | 43 | int loc_intr; | |
44 | #define TEGRAIO_INTR_DEFAULT 0 | 44 | #define TEGRAIO_INTR_DEFAULT 0 | |
45 | }; | 45 | }; | |
46 | 46 | |||
47 | struct tegraio_attach_args { | 47 | struct tegraio_attach_args { | |
48 | struct tegra_locators tio_loc; | 48 | struct tegra_locators tio_loc; | |
49 | bus_space_tag_t tio_bst; | 49 | bus_space_tag_t tio_bst; | |
50 | bus_space_tag_t tio_a4x_bst; | 50 | bus_space_tag_t tio_a4x_bst; | |
51 | bus_space_handle_t tio_bsh; | 51 | bus_space_handle_t tio_bsh; | |
52 | bus_dma_tag_t tio_dmat; | 52 | bus_dma_tag_t tio_dmat; | |
53 | bus_dma_tag_t tio_coherent_dmat; | 53 | bus_dma_tag_t tio_coherent_dmat; | |
54 | }; | 54 | }; | |
55 | 55 | |||
56 | struct tegrafb_attach_args { | 56 | struct tegrafb_attach_args { | |
57 | bool tfb_console; | 57 | bool tfb_console; | |
58 | bus_dma_tag_t tfb_dmat; | 58 | bus_dma_tag_t tfb_dmat; | |
59 | bus_dmamap_t tfb_dmamap; | 59 | bus_dmamap_t tfb_dmamap; | |
60 | void *tfb_dmap; | 60 | void *tfb_dmap; | |
61 | u_int tfb_width; | 61 | u_int tfb_width; | |
62 | u_int tfb_height; | 62 | u_int tfb_height; | |
63 | u_int tfb_depth; | 63 | u_int tfb_depth; | |
64 | u_int tfb_stride; | 64 | u_int tfb_stride; | |
65 | device_t tfb_outputdev; | 65 | device_t tfb_outputdev; | |
66 | }; | 66 | }; | |
67 | 67 | |||
68 | extern struct bus_space armv7_generic_bs_tag; | 68 | extern struct bus_space armv7_generic_bs_tag; | |
69 | extern struct bus_space armv7_generic_a4x_bs_tag; | 69 | extern struct bus_space armv7_generic_a4x_bs_tag; | |
70 | extern bus_space_handle_t tegra_host1x_bsh; | 70 | extern bus_space_handle_t tegra_host1x_bsh; | |
71 | extern bus_space_handle_t tegra_ppsb_bsh; | 71 | extern bus_space_handle_t tegra_ppsb_bsh; | |
72 | extern bus_space_handle_t tegra_apb_bsh; | 72 | extern bus_space_handle_t tegra_apb_bsh; | |
73 | extern bus_space_handle_t tegra_ahb_a2_bsh; | 73 | extern bus_space_handle_t tegra_ahb_a2_bsh; | |
74 | extern struct arm32_bus_dma_tag tegra_dma_tag; | 74 | extern struct arm32_bus_dma_tag tegra_dma_tag; | |
75 | extern struct arm32_bus_dma_tag tegra_coherent_dma_tag; | 75 | extern struct arm32_bus_dma_tag tegra_coherent_dma_tag; | |
76 | 76 | |||
77 | #define CHIP_ID_TEGRA20 0x20 | 77 | #define CHIP_ID_TEGRA20 0x20 | |
78 | #define CHIP_ID_TEGRA30 0x30 | 78 | #define CHIP_ID_TEGRA30 0x30 | |
79 | #define CHIP_ID_TEGRA114 0x35 | 79 | #define CHIP_ID_TEGRA114 0x35 | |
80 | #define CHIP_ID_TEGRA124 0x40 | 80 | #define CHIP_ID_TEGRA124 0x40 | |
81 | #define CHIP_ID_TEGRA132 0x13 | 81 | #define CHIP_ID_TEGRA132 0x13 | |
82 | 82 | |||
83 | u_int tegra_chip_id(void); | 83 | u_int tegra_chip_id(void); | |
84 | const char *tegra_chip_name(void); | 84 | const char *tegra_chip_name(void); | |
85 | void tegra_bootstrap(void); | 85 | void tegra_bootstrap(void); | |
86 | void tegra_dma_bootstrap(psize_t); | 86 | void tegra_dma_bootstrap(psize_t); | |
87 | void tegra_cpuinit(void); | 87 | void tegra_cpuinit(void); | |
88 | 88 | |||
89 | u_int tegra_car_osc_rate(void); | 89 | u_int tegra_car_osc_rate(void); | |
90 | u_int tegra_car_pllc_rate(void); | 90 | u_int tegra_car_pllc_rate(void); | |
91 | u_int tegra_car_plle_rate(void); | 91 | u_int tegra_car_plle_rate(void); | |
92 | u_int tegra_car_pllx_rate(void); | 92 | u_int tegra_car_pllx_rate(void); | |
93 | void tegra_car_pllx_set_rate(u_int, u_int, u_int); | 93 | void tegra_car_pllx_set_rate(u_int, u_int, u_int); | |
94 | u_int tegra_car_pllu_rate(void); | 94 | u_int tegra_car_pllu_rate(void); | |
95 | u_int tegra_car_pllp0_rate(void); | 95 | u_int tegra_car_pllp0_rate(void); | |
96 | u_int tegra_car_plld2_rate(void); | 96 | u_int tegra_car_plld2_rate(void); | |
97 | u_int tegra_car_uart_rate(u_int); | 97 | u_int tegra_car_uart_rate(u_int); | |
98 | u_int tegra_car_periph_sdmmc_rate(u_int); | 98 | u_int tegra_car_periph_sdmmc_rate(u_int); | |
99 | int tegra_car_periph_sdmmc_set_rate(u_int, u_int); | 99 | int tegra_car_periph_sdmmc_set_rate(u_int, u_int); | |
100 | int tegra_car_periph_usb_enable(u_int); | 100 | int tegra_car_periph_usb_enable(u_int); | |
101 | void tegra_car_periph_hda_enable(void); | 101 | void tegra_car_periph_hda_enable(void); | |
102 | void tegra_car_periph_sata_enable(void); | 102 | void tegra_car_periph_sata_enable(void); | |
103 | int tegra_car_periph_i2c_enable(u_int, u_int); | 103 | int tegra_car_periph_i2c_enable(u_int, u_int); | |
104 | void tegra_car_periph_cec_enable(void); | 104 | void tegra_car_periph_cec_enable(void); | |
105 | void tegra_car_utmip_init(void); | 105 | void tegra_car_utmip_init(void); | |
106 | void tegra_car_utmip_enable(u_int); | 106 | void tegra_car_utmip_enable(u_int); | |
107 | void tegra_car_hdmi_enable(u_int); | 107 | void tegra_car_hdmi_enable(u_int); | |
108 | int tegra_car_dc_enable(u_int); | 108 | int tegra_car_dc_enable(u_int); | |
109 | void tegra_car_host1x_enable(void); | 109 | void tegra_car_host1x_enable(void); | |
110 | void tegra_car_wdt_enable(u_int, bool); | 110 | void tegra_car_wdt_enable(u_int, bool); | |
111 | void tegra_car_gpu_enable(void); | |||
111 | 112 | |||
112 | struct tegra_gpio_pin; | 113 | struct tegra_gpio_pin; | |
113 | struct tegra_gpio_pin *tegra_gpio_acquire(const char *, u_int); | 114 | struct tegra_gpio_pin *tegra_gpio_acquire(const char *, u_int); | |
114 | void tegra_gpio_release(struct tegra_gpio_pin *); | 115 | void tegra_gpio_release(struct tegra_gpio_pin *); | |
115 | int tegra_gpio_read(struct tegra_gpio_pin *); | 116 | int tegra_gpio_read(struct tegra_gpio_pin *); | |
116 | void tegra_gpio_write(struct tegra_gpio_pin *, int); | 117 | void tegra_gpio_write(struct tegra_gpio_pin *, int); | |
117 | 118 | |||
118 | struct tegra_mpio_padctlgrp { | 119 | struct tegra_mpio_padctlgrp { | |
119 | int preemp; | 120 | int preemp; | |
120 | int hsm; | 121 | int hsm; | |
121 | int schmt; | 122 | int schmt; | |
122 | int drv_type; | 123 | int drv_type; | |
123 | int drvdn; | 124 | int drvdn; | |
124 | int drvup; | 125 | int drvup; | |
125 | int slwr; | 126 | int slwr; | |
126 | int slwf; | 127 | int slwf; | |
127 | }; | 128 | }; | |
128 | void tegra_mpio_padctlgrp_read(u_int, struct tegra_mpio_padctlgrp *); | 129 | void tegra_mpio_padctlgrp_read(u_int, struct tegra_mpio_padctlgrp *); | |
129 | void tegra_mpio_padctlgrp_write(u_int, const struct tegra_mpio_padctlgrp *); | 130 | void tegra_mpio_padctlgrp_write(u_int, const struct tegra_mpio_padctlgrp *); | |
130 | 131 | |||
131 | void tegra_mpio_pinmux_set_config(u_int, int, const char *); | 132 | void tegra_mpio_pinmux_set_config(u_int, int, const char *); | |
132 | void tegra_mpio_pinmux_set_io_reset(u_int, bool); | 133 | void tegra_mpio_pinmux_set_io_reset(u_int, bool); | |
133 | void tegra_mpio_pinmux_set_rcv_sel(u_int, bool); | 134 | void tegra_mpio_pinmux_set_rcv_sel(u_int, bool); | |
134 | void tegra_mpio_pinmux_get_config(u_int, int *, const char **); | 135 | void tegra_mpio_pinmux_get_config(u_int, int *, const char **); | |
135 | const char *tegra_mpio_pinmux_get_pm(u_int); | 136 | const char *tegra_mpio_pinmux_get_pm(u_int); | |
136 | bool tegra_mpio_pinmux_get_io_reset(u_int); | 137 | bool tegra_mpio_pinmux_get_io_reset(u_int); | |
137 | bool tegra_mpio_pinmux_get_rcv_sel(u_int); | 138 | bool tegra_mpio_pinmux_get_rcv_sel(u_int); | |
138 | 139 | |||
139 | void tegra_pmc_reset(void); | 140 | void tegra_pmc_reset(void); | |
140 | void tegra_pmc_power(u_int, bool); | 141 | void tegra_pmc_power(u_int, bool); | |
141 | void tegra_pmc_remove_clamping(u_int); | 142 | void tegra_pmc_remove_clamping(u_int); | |
142 | void tegra_pmc_hdmi_enable(void); | 143 | void tegra_pmc_hdmi_enable(void); | |
143 | 144 | |||
144 | void tegra_i2c_dvc_write(uint8_t, uint32_t, size_t); | 145 | void tegra_i2c_dvc_write(uint8_t, uint32_t, size_t); | |
145 | 146 | |||
146 | psize_t tegra_mc_memsize(void); | 147 | psize_t tegra_mc_memsize(void); | |
147 | 148 | |||
148 | void tegra_xusbpad_sata_enable(void); | 149 | void tegra_xusbpad_sata_enable(void); | |
149 | 150 | |||
150 | struct videomode; | 151 | struct videomode; | |
151 | int tegra_dc_port(device_t); | 152 | int tegra_dc_port(device_t); | |
152 | int tegra_dc_enable(device_t, device_t, const struct videomode *, | 153 | int tegra_dc_enable(device_t, device_t, const struct videomode *, | |
153 | const uint8_t *); | 154 | const uint8_t *); | |
154 | void tegra_dc_hdmi_start(device_t); | 155 | void tegra_dc_hdmi_start(device_t); | |
155 | 156 | |||
156 | #define TEGRA_CPUFREQ_MAX 16 | 157 | #define TEGRA_CPUFREQ_MAX 16 | |
157 | struct tegra_cpufreq_func { | 158 | struct tegra_cpufreq_func { | |
158 | u_int (*set_rate)(u_int); | 159 | u_int (*set_rate)(u_int); | |
159 | u_int (*get_rate)(void); | 160 | u_int (*get_rate)(void); | |
160 | size_t (*get_available)(u_int *, size_t); | 161 | size_t (*get_available)(u_int *, size_t); | |
161 | }; | 162 | }; | |
162 | void tegra_cpufreq_register(const struct tegra_cpufreq_func *); | 163 | void tegra_cpufreq_register(const struct tegra_cpufreq_func *); | |
163 | void tegra_cpufreq_init(void); | 164 | void tegra_cpufreq_init(void); | |
164 | 165 | |||
165 | #if defined(SOC_TEGRA124) | 166 | #if defined(SOC_TEGRA124) | |
166 | void tegra124_cpuinit(void); | 167 | void tegra124_cpuinit(void); | |
167 | void tegra124_mpinit(void); | 168 | void tegra124_mpinit(void); | |
168 | #endif | 169 | #endif | |
169 | 170 | |||
170 | static void inline | 171 | static void inline | |
171 | tegra_reg_set_clear(bus_space_tag_t bst, bus_space_handle_t bsh, | 172 | tegra_reg_set_clear(bus_space_tag_t bst, bus_space_handle_t bsh, | |
172 | bus_size_t o, uint32_t set_mask, uint32_t clr_mask) | 173 | bus_size_t o, uint32_t set_mask, uint32_t clr_mask) | |
173 | { | 174 | { | |
174 | const uint32_t old = bus_space_read_4(bst, bsh, o); | 175 | const uint32_t old = bus_space_read_4(bst, bsh, o); | |
175 | const uint32_t new = set_mask | (old & ~clr_mask); | 176 | const uint32_t new = set_mask | (old & ~clr_mask); | |
176 | if (old != new) { | 177 | if (old != new) { | |
177 | bus_space_write_4(bst, bsh, o, new); | 178 | bus_space_write_4(bst, bsh, o, new); | |
178 | } | 179 | } | |
179 | } | 180 | } | |
180 | 181 | |||
181 | #endif /* _ARM_TEGRA_VAR_H */ | 182 | #endif /* _ARM_TEGRA_VAR_H */ |