rk_cru.c revision 1.2.2.2 1 1.2.2.2 pgoyette /* $NetBSD: rk_cru.c,v 1.2.2.2 2018/06/25 07:25:39 pgoyette Exp $ */
2 1.2.2.2 pgoyette
3 1.2.2.2 pgoyette /*-
4 1.2.2.2 pgoyette * Copyright (c) 2018 Jared McNeill <jmcneill (at) invisible.ca>
5 1.2.2.2 pgoyette * All rights reserved.
6 1.2.2.2 pgoyette *
7 1.2.2.2 pgoyette * Redistribution and use in source and binary forms, with or without
8 1.2.2.2 pgoyette * modification, are permitted provided that the following conditions
9 1.2.2.2 pgoyette * are met:
10 1.2.2.2 pgoyette * 1. Redistributions of source code must retain the above copyright
11 1.2.2.2 pgoyette * notice, this list of conditions and the following disclaimer.
12 1.2.2.2 pgoyette * 2. Redistributions in binary form must reproduce the above copyright
13 1.2.2.2 pgoyette * notice, this list of conditions and the following disclaimer in the
14 1.2.2.2 pgoyette * documentation and/or other materials provided with the distribution.
15 1.2.2.2 pgoyette *
16 1.2.2.2 pgoyette * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 1.2.2.2 pgoyette * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 1.2.2.2 pgoyette * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 1.2.2.2 pgoyette * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 1.2.2.2 pgoyette * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 1.2.2.2 pgoyette * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 1.2.2.2 pgoyette * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 1.2.2.2 pgoyette * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 1.2.2.2 pgoyette * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 1.2.2.2 pgoyette * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 1.2.2.2 pgoyette * SUCH DAMAGE.
27 1.2.2.2 pgoyette */
28 1.2.2.2 pgoyette
29 1.2.2.2 pgoyette #include "opt_soc.h"
30 1.2.2.2 pgoyette #include "opt_fdt_arm.h"
31 1.2.2.2 pgoyette
32 1.2.2.2 pgoyette #include <sys/cdefs.h>
33 1.2.2.2 pgoyette __KERNEL_RCSID(0, "$NetBSD: rk_cru.c,v 1.2.2.2 2018/06/25 07:25:39 pgoyette Exp $");
34 1.2.2.2 pgoyette
35 1.2.2.2 pgoyette #include <sys/param.h>
36 1.2.2.2 pgoyette #include <sys/bus.h>
37 1.2.2.2 pgoyette #include <sys/cpu.h>
38 1.2.2.2 pgoyette #include <sys/device.h>
39 1.2.2.2 pgoyette
40 1.2.2.2 pgoyette #include <dev/fdt/fdtvar.h>
41 1.2.2.2 pgoyette
42 1.2.2.2 pgoyette #include <dev/clk/clk_backend.h>
43 1.2.2.2 pgoyette
44 1.2.2.2 pgoyette #include <arm/rockchip/rk_cru.h>
45 1.2.2.2 pgoyette
46 1.2.2.2 pgoyette #define CRU_SOFTRST_CON0 0x0300
47 1.2.2.2 pgoyette
48 1.2.2.2 pgoyette static void *
49 1.2.2.2 pgoyette rk_cru_reset_acquire(device_t dev, const void *data, size_t len)
50 1.2.2.2 pgoyette {
51 1.2.2.2 pgoyette if (len != 4)
52 1.2.2.2 pgoyette return NULL;
53 1.2.2.2 pgoyette
54 1.2.2.2 pgoyette return (void *)(uintptr_t)be32dec(data);
55 1.2.2.2 pgoyette }
56 1.2.2.2 pgoyette
57 1.2.2.2 pgoyette static void
58 1.2.2.2 pgoyette rk_cru_reset_release(device_t dev, void *priv)
59 1.2.2.2 pgoyette {
60 1.2.2.2 pgoyette }
61 1.2.2.2 pgoyette
62 1.2.2.2 pgoyette static int
63 1.2.2.2 pgoyette rk_cru_reset_assert(device_t dev, void *priv)
64 1.2.2.2 pgoyette {
65 1.2.2.2 pgoyette struct rk_cru_softc * const sc = device_private(dev);
66 1.2.2.2 pgoyette const uintptr_t reset_id = (uintptr_t)priv;
67 1.2.2.2 pgoyette const bus_size_t reg = CRU_SOFTRST_CON0 + (reset_id / 16) * 4;
68 1.2.2.2 pgoyette const u_int shift = reset_id % 16;
69 1.2.2.2 pgoyette
70 1.2.2.2 pgoyette CRU_WRITE(sc, reg, (1 << (shift + 16)) | (1 << shift));
71 1.2.2.2 pgoyette
72 1.2.2.2 pgoyette return 0;
73 1.2.2.2 pgoyette }
74 1.2.2.2 pgoyette
75 1.2.2.2 pgoyette static int
76 1.2.2.2 pgoyette rk_cru_reset_deassert(device_t dev, void *priv)
77 1.2.2.2 pgoyette {
78 1.2.2.2 pgoyette struct rk_cru_softc * const sc = device_private(dev);
79 1.2.2.2 pgoyette const uintptr_t reset_id = (uintptr_t)priv;
80 1.2.2.2 pgoyette const bus_size_t reg = CRU_SOFTRST_CON0 + (reset_id / 16) * 4;
81 1.2.2.2 pgoyette const u_int shift = reset_id % 16;
82 1.2.2.2 pgoyette
83 1.2.2.2 pgoyette CRU_WRITE(sc, reg, (1 << (shift + 16)) | (0 << shift));
84 1.2.2.2 pgoyette
85 1.2.2.2 pgoyette return 0;
86 1.2.2.2 pgoyette }
87 1.2.2.2 pgoyette
88 1.2.2.2 pgoyette static const struct fdtbus_reset_controller_func rk_cru_fdtreset_funcs = {
89 1.2.2.2 pgoyette .acquire = rk_cru_reset_acquire,
90 1.2.2.2 pgoyette .release = rk_cru_reset_release,
91 1.2.2.2 pgoyette .reset_assert = rk_cru_reset_assert,
92 1.2.2.2 pgoyette .reset_deassert = rk_cru_reset_deassert,
93 1.2.2.2 pgoyette };
94 1.2.2.2 pgoyette
95 1.2.2.2 pgoyette static struct clk *
96 1.2.2.2 pgoyette rk_cru_clock_decode(device_t dev, const void *data, size_t len)
97 1.2.2.2 pgoyette {
98 1.2.2.2 pgoyette struct rk_cru_softc * const sc = device_private(dev);
99 1.2.2.2 pgoyette struct rk_cru_clk *clk;
100 1.2.2.2 pgoyette
101 1.2.2.2 pgoyette if (len != 4)
102 1.2.2.2 pgoyette return NULL;
103 1.2.2.2 pgoyette
104 1.2.2.2 pgoyette const u_int clock_id = be32dec(data);
105 1.2.2.2 pgoyette
106 1.2.2.2 pgoyette for (int i = 0; i < sc->sc_nclks; i++) {
107 1.2.2.2 pgoyette clk = &sc->sc_clks[i];
108 1.2.2.2 pgoyette if (clk->id == clock_id)
109 1.2.2.2 pgoyette return &clk->base;
110 1.2.2.2 pgoyette }
111 1.2.2.2 pgoyette
112 1.2.2.2 pgoyette return NULL;
113 1.2.2.2 pgoyette }
114 1.2.2.2 pgoyette
115 1.2.2.2 pgoyette static const struct fdtbus_clock_controller_func rk_cru_fdtclock_funcs = {
116 1.2.2.2 pgoyette .decode = rk_cru_clock_decode,
117 1.2.2.2 pgoyette };
118 1.2.2.2 pgoyette
119 1.2.2.2 pgoyette static struct clk *
120 1.2.2.2 pgoyette rk_cru_clock_get(void *priv, const char *name)
121 1.2.2.2 pgoyette {
122 1.2.2.2 pgoyette struct rk_cru_softc * const sc = priv;
123 1.2.2.2 pgoyette struct rk_cru_clk *clk;
124 1.2.2.2 pgoyette
125 1.2.2.2 pgoyette clk = rk_cru_clock_find(sc, name);
126 1.2.2.2 pgoyette if (clk == NULL)
127 1.2.2.2 pgoyette return NULL;
128 1.2.2.2 pgoyette
129 1.2.2.2 pgoyette return &clk->base;
130 1.2.2.2 pgoyette }
131 1.2.2.2 pgoyette
132 1.2.2.2 pgoyette static void
133 1.2.2.2 pgoyette rk_cru_clock_put(void *priv, struct clk *clk)
134 1.2.2.2 pgoyette {
135 1.2.2.2 pgoyette }
136 1.2.2.2 pgoyette
137 1.2.2.2 pgoyette static u_int
138 1.2.2.2 pgoyette rk_cru_clock_get_rate(void *priv, struct clk *clkp)
139 1.2.2.2 pgoyette {
140 1.2.2.2 pgoyette struct rk_cru_softc * const sc = priv;
141 1.2.2.2 pgoyette struct rk_cru_clk *clk = (struct rk_cru_clk *)clkp;
142 1.2.2.2 pgoyette struct clk *clkp_parent;
143 1.2.2.2 pgoyette
144 1.2.2.2 pgoyette if (clk->get_rate)
145 1.2.2.2 pgoyette return clk->get_rate(sc, clk);
146 1.2.2.2 pgoyette
147 1.2.2.2 pgoyette clkp_parent = clk_get_parent(clkp);
148 1.2.2.2 pgoyette if (clkp_parent == NULL) {
149 1.2.2.2 pgoyette aprint_error("%s: no parent for %s\n", __func__, clk->base.name);
150 1.2.2.2 pgoyette return 0;
151 1.2.2.2 pgoyette }
152 1.2.2.2 pgoyette
153 1.2.2.2 pgoyette return clk_get_rate(clkp_parent);
154 1.2.2.2 pgoyette }
155 1.2.2.2 pgoyette
156 1.2.2.2 pgoyette static int
157 1.2.2.2 pgoyette rk_cru_clock_set_rate(void *priv, struct clk *clkp, u_int rate)
158 1.2.2.2 pgoyette {
159 1.2.2.2 pgoyette struct rk_cru_softc * const sc = priv;
160 1.2.2.2 pgoyette struct rk_cru_clk *clk = (struct rk_cru_clk *)clkp;
161 1.2.2.2 pgoyette struct clk *clkp_parent;
162 1.2.2.2 pgoyette
163 1.2.2.2 pgoyette if (clkp->flags & CLK_SET_RATE_PARENT) {
164 1.2.2.2 pgoyette clkp_parent = clk_get_parent(clkp);
165 1.2.2.2 pgoyette if (clkp_parent == NULL) {
166 1.2.2.2 pgoyette aprint_error("%s: no parent for %s\n", __func__, clk->base.name);
167 1.2.2.2 pgoyette return ENXIO;
168 1.2.2.2 pgoyette }
169 1.2.2.2 pgoyette return clk_set_rate(clkp_parent, rate);
170 1.2.2.2 pgoyette }
171 1.2.2.2 pgoyette
172 1.2.2.2 pgoyette if (clk->set_rate)
173 1.2.2.2 pgoyette return clk->set_rate(sc, clk, rate);
174 1.2.2.2 pgoyette
175 1.2.2.2 pgoyette return ENXIO;
176 1.2.2.2 pgoyette }
177 1.2.2.2 pgoyette
178 1.2.2.2 pgoyette static u_int
179 1.2.2.2 pgoyette rk_cru_clock_round_rate(void *priv, struct clk *clkp, u_int rate)
180 1.2.2.2 pgoyette {
181 1.2.2.2 pgoyette struct rk_cru_softc * const sc = priv;
182 1.2.2.2 pgoyette struct rk_cru_clk *clk = (struct rk_cru_clk *)clkp;
183 1.2.2.2 pgoyette struct clk *clkp_parent;
184 1.2.2.2 pgoyette
185 1.2.2.2 pgoyette if (clkp->flags & CLK_SET_RATE_PARENT) {
186 1.2.2.2 pgoyette clkp_parent = clk_get_parent(clkp);
187 1.2.2.2 pgoyette if (clkp_parent == NULL) {
188 1.2.2.2 pgoyette aprint_error("%s: no parent for %s\n", __func__, clk->base.name);
189 1.2.2.2 pgoyette return 0;
190 1.2.2.2 pgoyette }
191 1.2.2.2 pgoyette return clk_round_rate(clkp_parent, rate);
192 1.2.2.2 pgoyette }
193 1.2.2.2 pgoyette
194 1.2.2.2 pgoyette if (clk->round_rate)
195 1.2.2.2 pgoyette return clk->round_rate(sc, clk, rate);
196 1.2.2.2 pgoyette
197 1.2.2.2 pgoyette return 0;
198 1.2.2.2 pgoyette }
199 1.2.2.2 pgoyette
200 1.2.2.2 pgoyette static int
201 1.2.2.2 pgoyette rk_cru_clock_enable(void *priv, struct clk *clkp)
202 1.2.2.2 pgoyette {
203 1.2.2.2 pgoyette struct rk_cru_softc * const sc = priv;
204 1.2.2.2 pgoyette struct rk_cru_clk *clk = (struct rk_cru_clk *)clkp;
205 1.2.2.2 pgoyette struct clk *clkp_parent;
206 1.2.2.2 pgoyette int error = 0;
207 1.2.2.2 pgoyette
208 1.2.2.2 pgoyette clkp_parent = clk_get_parent(clkp);
209 1.2.2.2 pgoyette if (clkp_parent != NULL) {
210 1.2.2.2 pgoyette error = clk_enable(clkp_parent);
211 1.2.2.2 pgoyette if (error != 0)
212 1.2.2.2 pgoyette return error;
213 1.2.2.2 pgoyette }
214 1.2.2.2 pgoyette
215 1.2.2.2 pgoyette if (clk->enable)
216 1.2.2.2 pgoyette error = clk->enable(sc, clk, 1);
217 1.2.2.2 pgoyette
218 1.2.2.2 pgoyette return error;
219 1.2.2.2 pgoyette }
220 1.2.2.2 pgoyette
221 1.2.2.2 pgoyette static int
222 1.2.2.2 pgoyette rk_cru_clock_disable(void *priv, struct clk *clkp)
223 1.2.2.2 pgoyette {
224 1.2.2.2 pgoyette struct rk_cru_softc * const sc = priv;
225 1.2.2.2 pgoyette struct rk_cru_clk *clk = (struct rk_cru_clk *)clkp;
226 1.2.2.2 pgoyette int error = EINVAL;
227 1.2.2.2 pgoyette
228 1.2.2.2 pgoyette if (clk->enable)
229 1.2.2.2 pgoyette error = clk->enable(sc, clk, 0);
230 1.2.2.2 pgoyette
231 1.2.2.2 pgoyette return error;
232 1.2.2.2 pgoyette }
233 1.2.2.2 pgoyette
234 1.2.2.2 pgoyette static int
235 1.2.2.2 pgoyette rk_cru_clock_set_parent(void *priv, struct clk *clkp,
236 1.2.2.2 pgoyette struct clk *clkp_parent)
237 1.2.2.2 pgoyette {
238 1.2.2.2 pgoyette struct rk_cru_softc * const sc = priv;
239 1.2.2.2 pgoyette struct rk_cru_clk *clk = (struct rk_cru_clk *)clkp;
240 1.2.2.2 pgoyette
241 1.2.2.2 pgoyette if (clk->set_parent == NULL)
242 1.2.2.2 pgoyette return EINVAL;
243 1.2.2.2 pgoyette
244 1.2.2.2 pgoyette return clk->set_parent(sc, clk, clkp_parent->name);
245 1.2.2.2 pgoyette }
246 1.2.2.2 pgoyette
247 1.2.2.2 pgoyette static struct clk *
248 1.2.2.2 pgoyette rk_cru_clock_get_parent(void *priv, struct clk *clkp)
249 1.2.2.2 pgoyette {
250 1.2.2.2 pgoyette struct rk_cru_softc * const sc = priv;
251 1.2.2.2 pgoyette struct rk_cru_clk *clk = (struct rk_cru_clk *)clkp;
252 1.2.2.2 pgoyette struct rk_cru_clk *clk_parent;
253 1.2.2.2 pgoyette const char *parent;
254 1.2.2.2 pgoyette
255 1.2.2.2 pgoyette if (clk->get_parent == NULL)
256 1.2.2.2 pgoyette return NULL;
257 1.2.2.2 pgoyette
258 1.2.2.2 pgoyette parent = clk->get_parent(sc, clk);
259 1.2.2.2 pgoyette if (parent == NULL)
260 1.2.2.2 pgoyette return NULL;
261 1.2.2.2 pgoyette
262 1.2.2.2 pgoyette clk_parent = rk_cru_clock_find(sc, parent);
263 1.2.2.2 pgoyette if (clk_parent != NULL)
264 1.2.2.2 pgoyette return &clk_parent->base;
265 1.2.2.2 pgoyette
266 1.2.2.2 pgoyette /* No parent in this domain, try FDT */
267 1.2.2.2 pgoyette return fdtbus_clock_byname(parent);
268 1.2.2.2 pgoyette }
269 1.2.2.2 pgoyette
270 1.2.2.2 pgoyette static const struct clk_funcs rk_cru_clock_funcs = {
271 1.2.2.2 pgoyette .get = rk_cru_clock_get,
272 1.2.2.2 pgoyette .put = rk_cru_clock_put,
273 1.2.2.2 pgoyette .get_rate = rk_cru_clock_get_rate,
274 1.2.2.2 pgoyette .set_rate = rk_cru_clock_set_rate,
275 1.2.2.2 pgoyette .round_rate = rk_cru_clock_round_rate,
276 1.2.2.2 pgoyette .enable = rk_cru_clock_enable,
277 1.2.2.2 pgoyette .disable = rk_cru_clock_disable,
278 1.2.2.2 pgoyette .set_parent = rk_cru_clock_set_parent,
279 1.2.2.2 pgoyette .get_parent = rk_cru_clock_get_parent,
280 1.2.2.2 pgoyette };
281 1.2.2.2 pgoyette
282 1.2.2.2 pgoyette struct rk_cru_clk *
283 1.2.2.2 pgoyette rk_cru_clock_find(struct rk_cru_softc *sc, const char *name)
284 1.2.2.2 pgoyette {
285 1.2.2.2 pgoyette for (int i = 0; i < sc->sc_nclks; i++) {
286 1.2.2.2 pgoyette if (sc->sc_clks[i].base.name == NULL)
287 1.2.2.2 pgoyette continue;
288 1.2.2.2 pgoyette if (strcmp(sc->sc_clks[i].base.name, name) == 0)
289 1.2.2.2 pgoyette return &sc->sc_clks[i];
290 1.2.2.2 pgoyette }
291 1.2.2.2 pgoyette
292 1.2.2.2 pgoyette return NULL;
293 1.2.2.2 pgoyette }
294 1.2.2.2 pgoyette
295 1.2.2.2 pgoyette int
296 1.2.2.2 pgoyette rk_cru_attach(struct rk_cru_softc *sc)
297 1.2.2.2 pgoyette {
298 1.2.2.2 pgoyette bus_addr_t addr;
299 1.2.2.2 pgoyette bus_size_t size;
300 1.2.2.2 pgoyette int i;
301 1.2.2.2 pgoyette
302 1.2.2.2 pgoyette if (of_hasprop(sc->sc_phandle, "rockchip,grf")) {
303 1.2.2.2 pgoyette const int grf_phandle = fdtbus_get_phandle(sc->sc_phandle, "rockchip,grf");
304 1.2.2.2 pgoyette if (grf_phandle == -1) {
305 1.2.2.2 pgoyette aprint_error(": couldn't get grf phandle\n");
306 1.2.2.2 pgoyette return ENXIO;
307 1.2.2.2 pgoyette }
308 1.2.2.2 pgoyette
309 1.2.2.2 pgoyette if (fdtbus_get_reg(grf_phandle, 0, &addr, &size) != 0) {
310 1.2.2.2 pgoyette aprint_error(": couldn't get grf registers\n");
311 1.2.2.2 pgoyette return ENXIO;
312 1.2.2.2 pgoyette }
313 1.2.2.2 pgoyette
314 1.2.2.2 pgoyette if (bus_space_map(sc->sc_bst, addr, size, 0, &sc->sc_bsh_grf) != 0) {
315 1.2.2.2 pgoyette aprint_error(": couldn't map registers\n");
316 1.2.2.2 pgoyette return ENXIO;
317 1.2.2.2 pgoyette }
318 1.2.2.2 pgoyette }
319 1.2.2.2 pgoyette
320 1.2.2.2 pgoyette if (fdtbus_get_reg(sc->sc_phandle, 0, &addr, &size) != 0) {
321 1.2.2.2 pgoyette aprint_error(": couldn't get registers\n");
322 1.2.2.2 pgoyette return ENXIO;
323 1.2.2.2 pgoyette }
324 1.2.2.2 pgoyette if (bus_space_map(sc->sc_bst, addr, size, 0, &sc->sc_bsh) != 0) {
325 1.2.2.2 pgoyette aprint_error(": couldn't map registers\n");
326 1.2.2.2 pgoyette return ENXIO;
327 1.2.2.2 pgoyette }
328 1.2.2.2 pgoyette
329 1.2.2.2 pgoyette sc->sc_clkdom.name = device_xname(sc->sc_dev);
330 1.2.2.2 pgoyette sc->sc_clkdom.funcs = &rk_cru_clock_funcs;
331 1.2.2.2 pgoyette sc->sc_clkdom.priv = sc;
332 1.2.2.2 pgoyette for (i = 0; i < sc->sc_nclks; i++) {
333 1.2.2.2 pgoyette sc->sc_clks[i].base.domain = &sc->sc_clkdom;
334 1.2.2.2 pgoyette clk_attach(&sc->sc_clks[i].base);
335 1.2.2.2 pgoyette }
336 1.2.2.2 pgoyette
337 1.2.2.2 pgoyette fdtbus_register_clock_controller(sc->sc_dev, sc->sc_phandle,
338 1.2.2.2 pgoyette &rk_cru_fdtclock_funcs);
339 1.2.2.2 pgoyette
340 1.2.2.2 pgoyette fdtbus_register_reset_controller(sc->sc_dev, sc->sc_phandle,
341 1.2.2.2 pgoyette &rk_cru_fdtreset_funcs);
342 1.2.2.2 pgoyette
343 1.2.2.2 pgoyette return 0;
344 1.2.2.2 pgoyette }
345 1.2.2.2 pgoyette
346 1.2.2.2 pgoyette void
347 1.2.2.2 pgoyette rk_cru_print(struct rk_cru_softc *sc)
348 1.2.2.2 pgoyette {
349 1.2.2.2 pgoyette struct rk_cru_clk *clk;
350 1.2.2.2 pgoyette struct clk *clkp_parent;
351 1.2.2.2 pgoyette const char *type;
352 1.2.2.2 pgoyette int i;
353 1.2.2.2 pgoyette
354 1.2.2.2 pgoyette for (i = 0; i < sc->sc_nclks; i++) {
355 1.2.2.2 pgoyette clk = &sc->sc_clks[i];
356 1.2.2.2 pgoyette if (clk->type == RK_CRU_UNKNOWN)
357 1.2.2.2 pgoyette continue;
358 1.2.2.2 pgoyette
359 1.2.2.2 pgoyette clkp_parent = clk_get_parent(&clk->base);
360 1.2.2.2 pgoyette
361 1.2.2.2 pgoyette switch (clk->type) {
362 1.2.2.2 pgoyette case RK_CRU_PLL: type = "pll"; break;
363 1.2.2.2 pgoyette case RK_CRU_ARM: type = "arm"; break;
364 1.2.2.2 pgoyette case RK_CRU_COMPOSITE: type = "comp"; break;
365 1.2.2.2 pgoyette case RK_CRU_GATE: type = "gate"; break;
366 1.2.2.2 pgoyette case RK_CRU_MUX: type = "mux"; break;
367 1.2.2.2 pgoyette default: type = "???"; break;
368 1.2.2.2 pgoyette }
369 1.2.2.2 pgoyette
370 1.2.2.2 pgoyette device_printf(sc->sc_dev,
371 1.2.2.2 pgoyette "%3d %-14s %2s %-14s %-7s ",
372 1.2.2.2 pgoyette clk->id,
373 1.2.2.2 pgoyette clk->base.name,
374 1.2.2.2 pgoyette clkp_parent ? "<-" : "",
375 1.2.2.2 pgoyette clkp_parent ? clkp_parent->name : "",
376 1.2.2.2 pgoyette type);
377 1.2.2.2 pgoyette printf("%10d Hz\n", clk_get_rate(&clk->base));
378 1.2.2.2 pgoyette }
379 1.2.2.2 pgoyette }
380