if_ntwoc_isa.c revision 1.16 1 1.16 ad /* $NetBSD: if_ntwoc_isa.c,v 1.16 2007/10/19 12:00:18 ad Exp $ */
2 1.10 perry /*
3 1.1 chopps * Copyright (c) 1999 Christian E. Hopps
4 1.1 chopps * Copyright (c) 1996 John Hay.
5 1.1 chopps * Copyright (c) 1996 SDL Communications, Inc.
6 1.1 chopps * All rights reserved.
7 1.10 perry *
8 1.1 chopps * Redistribution and use in source and binary forms, with or without
9 1.1 chopps * modification, are permitted provided that the following conditions
10 1.1 chopps * are met:
11 1.1 chopps * 1. Redistributions of source code must retain the above copyright
12 1.1 chopps * notice, this list of conditions and the following disclaimer.
13 1.1 chopps * 2. Redistributions in binary form must reproduce the above copyright
14 1.1 chopps * notice, this list of conditions and the following disclaimer in the
15 1.1 chopps * documentation and/or other materials provided with the distribution.
16 1.1 chopps * 3. Neither the name of the author nor the names of any co-contributors
17 1.1 chopps * may be used to endorse or promote products derived from this software
18 1.1 chopps * without specific prior written permission.
19 1.1 chopps *
20 1.1 chopps * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
21 1.1 chopps * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 1.1 chopps * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 1.1 chopps * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
24 1.1 chopps * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 1.1 chopps * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 1.1 chopps * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 1.1 chopps * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 1.1 chopps * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 1.1 chopps * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 1.1 chopps * SUCH DAMAGE.
31 1.1 chopps *
32 1.16 ad * $Id: if_ntwoc_isa.c,v 1.16 2007/10/19 12:00:18 ad Exp $
33 1.1 chopps */
34 1.1 chopps
35 1.2 lukem #include <sys/cdefs.h>
36 1.16 ad __KERNEL_RCSID(0, "$NetBSD: if_ntwoc_isa.c,v 1.16 2007/10/19 12:00:18 ad Exp $");
37 1.1 chopps
38 1.1 chopps #include <sys/param.h>
39 1.1 chopps #include <sys/systm.h>
40 1.1 chopps #include <sys/device.h>
41 1.1 chopps #include <sys/mbuf.h>
42 1.1 chopps #include <sys/socket.h>
43 1.1 chopps
44 1.1 chopps #include <net/if.h>
45 1.1 chopps
46 1.16 ad #include <sys/cpu.h>
47 1.16 ad #include <sys/bus.h>
48 1.16 ad #include <sys/intr.h>
49 1.1 chopps
50 1.1 chopps #include <dev/isa/isavar.h>
51 1.1 chopps
52 1.1 chopps #include <dev/ic/hd64570reg.h>
53 1.1 chopps #include <dev/ic/hd64570var.h>
54 1.1 chopps
55 1.1 chopps #include <dev/isa/if_ntwoc_isareg.h>
56 1.1 chopps
57 1.1 chopps #if 1
58 1.1 chopps #define NTWO_DEBUG
59 1.1 chopps #endif
60 1.1 chopps
61 1.1 chopps #ifdef NTWO_DEBUG
62 1.1 chopps #define NTWO_DPRINTF(x) printf x
63 1.1 chopps #else
64 1.1 chopps #define NTWO_DPRINTF(x)
65 1.1 chopps #endif
66 1.1 chopps
67 1.1 chopps #if __NetBSD_Version__ >= 104160000
68 1.9 perry static void ntwoc_isa_config_interrupts(struct device *);
69 1.1 chopps #else
70 1.1 chopps #define SCA_BASECLOCK 9830400
71 1.1 chopps #endif
72 1.1 chopps
73 1.1 chopps /* hard core 16k for now */
74 1.1 chopps #define NTWOC_WIN_SIZE 0x4000
75 1.1 chopps
76 1.1 chopps struct ntwoc_isa_softc {
77 1.1 chopps /* Generic device stuff */
78 1.1 chopps struct device sc_dev; /* Common to all devices */
79 1.1 chopps
80 1.1 chopps /* PCI chipset glue */
81 1.1 chopps void *sc_ih; /* Interrupt handler */
82 1.1 chopps isa_chipset_tag_t sc_ic; /* ISA chipset handle */
83 1.1 chopps
84 1.1 chopps struct sca_softc sc_sca; /* the SCA itself */
85 1.1 chopps };
86 1.1 chopps
87 1.9 perry static int ntwoc_isa_probe(struct device *, struct cfdata *, void *);
88 1.9 perry static void ntwoc_isa_attach(struct device *, struct device *, void *);
89 1.1 chopps
90 1.9 perry static void ntwoc_isa_clock_callback(void *, int, int);
91 1.9 perry static void ntwoc_isa_dtr_callback(void *, int, int);
92 1.9 perry static int ntwoc_isa_intr(void *);
93 1.9 perry static void ntwoc_isa_get_clock(struct sca_port *, u_int8_t, u_int8_t,
94 1.9 perry u_int8_t, u_int8_t);
95 1.1 chopps static void ntwoc_isa_setup_memory(struct sca_softc *sc);
96 1.9 perry static void ntwoc_isa_shutdown(void *sc);
97 1.1 chopps
98 1.5 thorpej CFATTACH_DECL(ntwoc_isa, sizeof(struct ntwoc_isa_softc),
99 1.6 thorpej ntwoc_isa_probe, ntwoc_isa_attach, NULL, NULL);
100 1.1 chopps
101 1.1 chopps /*
102 1.1 chopps * Names for daughter card types. These match the NTWOC_DB_* defines.
103 1.1 chopps */
104 1.13 christos const char *ntwoc_db_names[] = {
105 1.1 chopps "V.35", "Unknown 0x01", "Test", "Unknown 0x03",
106 1.1 chopps "RS232", "Unknown 0x05", "RS422", "None"
107 1.1 chopps };
108 1.1 chopps
109 1.1 chopps /* some weird offset XXX */
110 1.1 chopps #define SCA_REG(r) (((r) & 0xf) + (((r) & 0xf0) << 6))
111 1.1 chopps
112 1.1 chopps /*
113 1.1 chopps * functions that read and write to the sca registers
114 1.1 chopps */
115 1.1 chopps static void
116 1.1 chopps ntwoc_isa_sca_write_1(struct sca_softc *sc, u_int reg, u_int8_t val)
117 1.1 chopps {
118 1.1 chopps bus_space_write_1(sc->sc_iot, sc->scu_sca_ioh[(reg & 0xf0) >> 4],
119 1.1 chopps (reg & 0xf), val);
120 1.1 chopps }
121 1.1 chopps
122 1.1 chopps static void
123 1.1 chopps ntwoc_isa_sca_write_2(struct sca_softc *sc, u_int reg, u_int16_t val)
124 1.1 chopps {
125 1.1 chopps bus_space_write_2(sc->sc_iot, sc->scu_sca_ioh[(reg & 0xf0) >> 4],
126 1.1 chopps (reg & 0xf), val);
127 1.1 chopps }
128 1.1 chopps
129 1.1 chopps static u_int8_t
130 1.1 chopps ntwoc_isa_sca_read_1(struct sca_softc *sc, u_int reg)
131 1.1 chopps {
132 1.1 chopps return
133 1.1 chopps bus_space_read_1(sc->sc_iot, sc->scu_sca_ioh[(reg & 0xf0) >> 4],
134 1.1 chopps (reg & 0xf));
135 1.1 chopps }
136 1.1 chopps
137 1.1 chopps static u_int16_t
138 1.1 chopps ntwoc_isa_sca_read_2(struct sca_softc *sc, u_int reg)
139 1.1 chopps {
140 1.1 chopps return
141 1.1 chopps bus_space_read_2(sc->sc_iot, sc->scu_sca_ioh[(reg & 0xf0) >> 4],
142 1.1 chopps (reg & 0xf));
143 1.1 chopps }
144 1.1 chopps
145 1.1 chopps /*
146 1.1 chopps * set the correct window/page
147 1.1 chopps */
148 1.1 chopps static void
149 1.1 chopps ntwoc_isa_set_page(struct sca_softc *sca, bus_addr_t addr)
150 1.1 chopps {
151 1.1 chopps u_int8_t psr;
152 1.1 chopps
153 1.1 chopps /* get old psr value replace old window with new */
154 1.1 chopps psr = bus_space_read_1(sca->sc_iot, sca->sc_ioh, NTWOC_PSR);
155 1.1 chopps psr &= ~NTWOC_PG_MSK;
156 1.1 chopps psr |= ((addr >> sca->scu_pageshift) & NTWOC_PG_MSK);
157 1.1 chopps bus_space_write_1(sca->sc_iot, sca->sc_ioh, NTWOC_PSR, psr);
158 1.1 chopps }
159 1.1 chopps
160 1.1 chopps /*
161 1.1 chopps * enable the memory window
162 1.1 chopps */
163 1.1 chopps static void
164 1.1 chopps ntwoc_isa_set_on(struct sca_softc *sca)
165 1.1 chopps {
166 1.1 chopps u_int8_t pcr;
167 1.1 chopps
168 1.1 chopps /* get old value and add window enable */
169 1.1 chopps pcr = bus_space_read_1(sca->sc_iot, sca->sc_ioh, NTWOC_PCR);
170 1.1 chopps pcr |= NTWOC_PCR_MEM_WIN;
171 1.1 chopps bus_space_write_1(sca->sc_iot, sca->sc_ioh, NTWOC_PCR, pcr);
172 1.1 chopps }
173 1.1 chopps
174 1.1 chopps /*
175 1.1 chopps * turn off memory window
176 1.1 chopps */
177 1.1 chopps static void
178 1.1 chopps ntwoc_isa_set_off(struct sca_softc *sca)
179 1.1 chopps {
180 1.1 chopps u_int8_t pcr;
181 1.1 chopps
182 1.1 chopps /* get old value and remove window enable */
183 1.1 chopps pcr = bus_space_read_1(sca->sc_iot, sca->sc_ioh, NTWOC_PCR);
184 1.1 chopps pcr &= ~NTWOC_PCR_MEM_WIN;
185 1.1 chopps bus_space_write_1(sca->sc_iot, sca->sc_ioh, NTWOC_PCR, pcr);
186 1.1 chopps }
187 1.1 chopps
188 1.1 chopps static int
189 1.15 christos ntwoc_isa_probe(struct device *parent, struct cfdata *match, void *aux)
190 1.1 chopps {
191 1.1 chopps struct isa_attach_args *ia;
192 1.1 chopps bus_space_tag_t iot, memt;
193 1.1 chopps bus_space_handle_t ioh, memh, sca_ioh[16];
194 1.1 chopps int i, tmp, dbg, rv;
195 1.1 chopps int gotmem, gotsca[16];
196 1.1 chopps u_int32_t ioport;
197 1.1 chopps
198 1.1 chopps ia = (struct isa_attach_args *)aux;
199 1.1 chopps iot = ia->ia_iot;
200 1.1 chopps memt = ia->ia_memt;
201 1.1 chopps
202 1.3 thorpej if (ia->ia_nio < 1)
203 1.3 thorpej return (0);
204 1.3 thorpej if (ia->ia_niomem < 1)
205 1.3 thorpej return (0);
206 1.3 thorpej if (ia->ia_nirq < 1)
207 1.3 thorpej return (0);
208 1.3 thorpej
209 1.3 thorpej if (ISA_DIRECT_CONFIG(ia))
210 1.3 thorpej return (0);
211 1.3 thorpej
212 1.1 chopps memset(gotsca, 0, sizeof(gotsca));
213 1.1 chopps gotmem = rv = 0;
214 1.1 chopps dbg = 0;
215 1.1 chopps
216 1.1 chopps /* disallow wildcarded I/O base */
217 1.8 drochner if (ia->ia_io[0].ir_addr == ISA_UNKNOWN_PORT) {
218 1.1 chopps printf("ntwoc_isa_probe: must specify port address\n");
219 1.1 chopps return (0);
220 1.1 chopps }
221 1.1 chopps
222 1.8 drochner if (ia->ia_irq[0].ir_irq == ISA_UNKNOWN_IRQ) {
223 1.1 chopps printf("ntwoc_isa_probe: must specify irq\n");
224 1.1 chopps return (0);
225 1.1 chopps }
226 1.1 chopps
227 1.8 drochner if (ia->ia_iomem[0].ir_addr == ISA_UNKNOWN_IOMEM) {
228 1.1 chopps printf("ntwoc_isa_probe: must specify iomem\n");
229 1.1 chopps return (0);
230 1.1 chopps }
231 1.1 chopps
232 1.1 chopps tmp = (match->cf_flags & NTWOC_FLAGS_NPORT_MASK) + 1;
233 1.1 chopps if (tmp < 1 || tmp > 2) {
234 1.1 chopps printf("ntwoc_isa_probe: only 1 or 2 ports allowed\n");
235 1.1 chopps return (0);
236 1.1 chopps }
237 1.1 chopps
238 1.1 chopps /* map the isa io addresses */
239 1.3 thorpej if ((tmp = bus_space_map(iot, ia->ia_io[0].ir_addr,
240 1.3 thorpej NTWOC_SRC_IOPORT_SIZE, 0, &ioh))) {
241 1.1 chopps printf("ntwoc_isa_probe: mapping port 0x%x sz %d failed: %d\n",
242 1.3 thorpej ia->ia_io[0].ir_addr, NTWOC_SRC_IOPORT_SIZE, tmp);
243 1.1 chopps return (0);
244 1.1 chopps }
245 1.1 chopps
246 1.3 thorpej ioport = ia->ia_io[0].ir_addr + 0x8000;
247 1.1 chopps for (i = 0; i < 16; ioport += (0x10 << 6), i++) {
248 1.1 chopps /* map the isa io addresses */
249 1.1 chopps if ((tmp = bus_space_map(iot, ioport, 16, 0, &sca_ioh[i]))) {
250 1.1 chopps printf(
251 1.1 chopps "ntwoc_isa_probe: mapping sca 0x%x sz %d failed: %d\n",
252 1.1 chopps ioport, 16, tmp);
253 1.1 chopps goto out;
254 1.1 chopps }
255 1.1 chopps gotsca[i] = 1;
256 1.1 chopps }
257 1.1 chopps
258 1.1 chopps /* map the isa memory addresses */
259 1.1 chopps /* XXX we really want the user to select this */
260 1.3 thorpej if ((tmp = bus_space_map(ia->ia_memt, ia->ia_iomem[0].ir_addr,
261 1.3 thorpej NTWOC_WIN_SIZE, 0, &memh))) {
262 1.1 chopps printf("ntwoc_isa_probe: mapping mem 0x%x sz %d failed: %d\n",
263 1.3 thorpej ia->ia_iomem[0].ir_addr, NTWOC_WIN_SIZE, tmp);
264 1.1 chopps goto out;
265 1.1 chopps }
266 1.1 chopps gotmem = 1;
267 1.1 chopps
268 1.1 chopps /* turn off the card */
269 1.1 chopps bus_space_write_1(iot, ioh, NTWOC_PCR, 0);
270 1.1 chopps
271 1.1 chopps /*
272 1.1 chopps * Next, we'll test the Base Address Register to retension of
273 1.1 chopps * data... ... seeing if we're *really* talking to an N2.
274 1.1 chopps */
275 1.1 chopps for (i = 0; i < 0x100; i++) {
276 1.1 chopps bus_space_write_1(iot, ioh, NTWOC_BAR, i);
277 1.1 chopps (void)bus_space_read_1(iot, ioh, NTWOC_PCR);
278 1.1 chopps if (bus_space_read_1(iot, ioh, NTWOC_BAR) != i) {
279 1.1 chopps printf("ntwoc_isa_probe failed (BAR %x, %x)\n", i, tmp);
280 1.1 chopps goto out;
281 1.1 chopps }
282 1.1 chopps }
283 1.1 chopps
284 1.1 chopps /* XXX XXX update the calls to SCA_REG to use our mapping */
285 1.1 chopps
286 1.1 chopps /*
287 1.1 chopps * Now see if we can see the SCA.
288 1.1 chopps */
289 1.1 chopps bus_space_write_1(iot, ioh, NTWOC_PCR,
290 1.1 chopps NTWOC_PCR_SCARUN | bus_space_read_1(iot, ioh, NTWOC_PCR));
291 1.1 chopps bus_space_write_1(iot, sca_ioh[0], SCA_REG(SCA_WCRL), 0);
292 1.1 chopps bus_space_write_1(iot, sca_ioh[0], SCA_REG(SCA_WCRM), 0);
293 1.1 chopps bus_space_write_1(iot, sca_ioh[0], SCA_REG(SCA_WCRH), 0);
294 1.1 chopps bus_space_write_1(iot, sca_ioh[0], SCA_REG(SCA_PCR), 0);
295 1.1 chopps
296 1.1 chopps bus_space_write_1(iot, sca_ioh[0], SCA_REG(SCA_TMC0), 0);
297 1.1 chopps (void)bus_space_read_1(iot, ioh, 0);
298 1.1 chopps if ((tmp = bus_space_read_1(iot, sca_ioh[0], SCA_REG(SCA_TMC0))) != 0) {
299 1.1 chopps printf("ntwoc_isa_probe: Error reading SCA (TMC0 0, %x)\n",
300 1.1 chopps tmp);
301 1.1 chopps goto out;
302 1.1 chopps }
303 1.1 chopps
304 1.1 chopps bus_space_write_1(iot, sca_ioh[0], SCA_REG(SCA_TMC0), 0x5A);
305 1.1 chopps (void)bus_space_read_1(iot, ioh, 0);
306 1.1 chopps
307 1.1 chopps tmp = bus_space_read_1(iot, sca_ioh[0], SCA_REG(SCA_TMC0));
308 1.1 chopps if (tmp != 0x5A) {
309 1.1 chopps printf("ntwoc_isa_probe: Error reading SCA (TMC0 5A, %x)\n",
310 1.1 chopps tmp);
311 1.1 chopps goto out;
312 1.1 chopps }
313 1.1 chopps
314 1.1 chopps bus_space_write_2(iot, sca_ioh[0], SCA_REG(SCA_CDAL0), 0);
315 1.1 chopps (void)bus_space_read_1(iot, ioh, 0);
316 1.1 chopps tmp = bus_space_read_2(iot, sca_ioh[0], SCA_REG(SCA_CDAL0));
317 1.1 chopps if (tmp != 0) {
318 1.1 chopps printf("ntwoc_isa_probe: Error reading SCA (CDAL0 0, %x)\n",
319 1.1 chopps tmp);
320 1.1 chopps goto out;
321 1.1 chopps }
322 1.1 chopps
323 1.1 chopps bus_space_write_2(iot, sca_ioh[0], SCA_REG(SCA_CDAL0), 0x55AA);
324 1.1 chopps (void)bus_space_read_1(iot, ioh, 0);
325 1.1 chopps tmp = bus_space_read_2(iot, sca_ioh[0], SCA_REG(SCA_CDAL0));
326 1.1 chopps if (tmp != 0x55AA) {
327 1.1 chopps printf("ntwoc_isa_probe: Error reading SCA (CDAL0 55AA, %x)\n",
328 1.1 chopps tmp);
329 1.1 chopps goto out;
330 1.1 chopps }
331 1.1 chopps
332 1.1 chopps /*
333 1.1 chopps * I had a weird card that didn't function correctly on a certain
334 1.1 chopps * newer MB. I suspect it was the whacky port addresses.
335 1.1 chopps * The following correctly failed it.
336 1.1 chopps */
337 1.1 chopps bus_space_write_2(iot, sca_ioh[0], SCA_REG(SCA_TCNTL0), 0x0);
338 1.1 chopps (void)bus_space_read_1(iot, ioh, 0);
339 1.1 chopps tmp = bus_space_read_2(iot, sca_ioh[0], SCA_REG(SCA_TCNTL0));
340 1.1 chopps if (tmp != 0) {
341 1.1 chopps printf("ntwoc_isa_probe: Error reading SCA (TCNTL0 0, %x)\n",
342 1.1 chopps tmp);
343 1.1 chopps goto out;
344 1.1 chopps }
345 1.1 chopps
346 1.1 chopps bus_space_write_2(iot, sca_ioh[0], SCA_REG(SCA_TCNTL0), 0x55AA);
347 1.1 chopps (void)bus_space_read_1(iot, ioh, 0);
348 1.1 chopps tmp = bus_space_read_2(iot, sca_ioh[0], SCA_REG(SCA_TCNTL0));
349 1.1 chopps if (tmp != 0x55AA) {
350 1.1 chopps printf("ntwoc_isa_probe: Error reading SCA (TCNTL0 55AA, %x)\n",
351 1.1 chopps tmp);
352 1.1 chopps goto out;
353 1.1 chopps }
354 1.1 chopps
355 1.3 thorpej ia->ia_nio = 1;
356 1.3 thorpej ia->ia_io[0].ir_size = NTWOC_SRC_IOPORT_SIZE;
357 1.3 thorpej
358 1.3 thorpej ia->ia_niomem = 1;
359 1.3 thorpej ia->ia_iomem[0].ir_size = NTWOC_WIN_SIZE;
360 1.3 thorpej
361 1.3 thorpej ia->ia_nirq = 1;
362 1.3 thorpej
363 1.3 thorpej ia->ia_ndrq = 0;
364 1.3 thorpej
365 1.1 chopps rv = 1;
366 1.1 chopps out:
367 1.1 chopps /* turn off the card */
368 1.1 chopps bus_space_write_1(iot, ioh, NTWOC_PCR, 0);
369 1.1 chopps
370 1.1 chopps if (gotmem)
371 1.1 chopps bus_space_unmap(memt, memh, NTWOC_WIN_SIZE);
372 1.1 chopps for (i = 0; i < 16; i++) {
373 1.1 chopps if (gotsca[i])
374 1.1 chopps bus_space_unmap(iot, sca_ioh[i], 16);
375 1.1 chopps }
376 1.1 chopps bus_space_unmap(iot, ioh, NTWOC_SRC_IOPORT_SIZE);
377 1.1 chopps return (rv);
378 1.1 chopps }
379 1.1 chopps
380 1.1 chopps /*
381 1.1 chopps * we win! attach the card
382 1.1 chopps */
383 1.1 chopps static void
384 1.15 christos ntwoc_isa_attach(struct device *parent, struct device *self, void *aux)
385 1.1 chopps {
386 1.1 chopps struct ntwoc_isa_softc *sc;
387 1.1 chopps struct isa_attach_args *ia;
388 1.1 chopps struct sca_softc *sca;
389 1.1 chopps bus_addr_t addr;
390 1.1 chopps u_int8_t rdiv, tdiv, tmc;
391 1.1 chopps u_int32_t flags, ioport;
392 1.1 chopps u_int16_t tmp;
393 1.1 chopps int i, dbg, pgs, rv;
394 1.1 chopps
395 1.1 chopps ia = (struct isa_attach_args *)aux;
396 1.1 chopps sc = (struct ntwoc_isa_softc *)self;
397 1.1 chopps sca = &sc->sc_sca;
398 1.1 chopps dbg = 0;
399 1.1 chopps
400 1.1 chopps printf(": N2 Serial Interface\n");
401 1.12 thorpej flags = device_cfdata(&sc->sc_dev)->cf_flags;
402 1.1 chopps
403 1.1 chopps sc->sc_ic = ia->ia_ic;
404 1.1 chopps sca->sc_parent = &sc->sc_dev;
405 1.1 chopps sca->sc_numports = (flags & NTWOC_FLAGS_NPORT_MASK) + 1;
406 1.1 chopps sca->sc_usedma = 0;
407 1.1 chopps sca->sc_aux = sc;
408 1.1 chopps sca->sc_dtr_callback = ntwoc_isa_dtr_callback;
409 1.1 chopps sca->sc_clock_callback = ntwoc_isa_clock_callback;
410 1.1 chopps sca->sc_read_1 = ntwoc_isa_sca_read_1;
411 1.1 chopps sca->sc_read_2 = ntwoc_isa_sca_read_2;
412 1.1 chopps sca->sc_write_1 = ntwoc_isa_sca_write_1;
413 1.1 chopps sca->sc_write_2 = ntwoc_isa_sca_write_2;
414 1.1 chopps sca->scu_set_page = ntwoc_isa_set_page;
415 1.1 chopps sca->scu_page_on = ntwoc_isa_set_on;
416 1.1 chopps sca->scu_page_off = ntwoc_isa_set_off;
417 1.1 chopps
418 1.1 chopps /* map the io */
419 1.1 chopps sca->sc_iot = ia->ia_iot;
420 1.3 thorpej if ((rv = bus_space_map(ia->ia_iot, ia->ia_io[0].ir_addr,
421 1.1 chopps NTWOC_SRC_IOPORT_SIZE, 0, &sca->sc_ioh))) {
422 1.1 chopps printf("%s: can't map io 0x%x sz %d, %d\n",
423 1.3 thorpej sc->sc_dev.dv_xname, ia->ia_io[0].ir_addr,
424 1.3 thorpej NTWOC_SRC_IOPORT_SIZE, rv);
425 1.1 chopps return;
426 1.1 chopps }
427 1.1 chopps
428 1.1 chopps /* support weird mapping (they used this to avoid 10-bit aliasing) */
429 1.3 thorpej ioport = ia->ia_io[0].ir_addr + 0x8000;
430 1.1 chopps for (i = 0; i < 16; ioport += (0x10 << 6), i++) {
431 1.1 chopps /* map the isa io addresses */
432 1.1 chopps if ((tmp = bus_space_map(ia->ia_iot, ioport, 16, 0,
433 1.1 chopps &sca->scu_sca_ioh[i]))) {
434 1.1 chopps printf("%s: mapping sca 0x%x sz %d failed: %d\n",
435 1.1 chopps sc->sc_dev.dv_xname, ioport, 16, tmp);
436 1.1 chopps return;
437 1.1 chopps }
438 1.1 chopps }
439 1.1 chopps
440 1.1 chopps /* map the isa memory */
441 1.1 chopps sca->scu_memt = ia->ia_memt;
442 1.1 chopps sca->scu_pagesize = 0x4000; /* force 16k for now */
443 1.1 chopps if (sca->scu_pagesize < 0x8000) {
444 1.1 chopps /* round down to 16k */
445 1.1 chopps sca->scu_pagesize = 0x4000;
446 1.1 chopps sca->scu_pageshift = 14;
447 1.1 chopps tmp = NTWOC_PSR_WIN_16K;
448 1.1 chopps } else if (sca->scu_pagesize < 0x10000) {
449 1.1 chopps /* round down to 32k */
450 1.1 chopps sca->scu_pagesize = 0x8000;
451 1.1 chopps sca->scu_pageshift = 15;
452 1.1 chopps tmp = NTWOC_PSR_WIN_32K;
453 1.1 chopps } else if (sca->scu_pagesize < 0x20000) {
454 1.1 chopps /* round down to 64k */
455 1.1 chopps sca->scu_pagesize = 0x10000;
456 1.1 chopps sca->scu_pageshift = 16;
457 1.1 chopps tmp = NTWOC_PSR_WIN_64K;
458 1.1 chopps } else {
459 1.1 chopps sca->scu_pagesize = 0x20000;
460 1.1 chopps sca->scu_pageshift = 17;
461 1.1 chopps tmp = NTWOC_PSR_WIN_128K;
462 1.1 chopps }
463 1.1 chopps sca->scu_pagemask = sca->scu_pagesize - 1;
464 1.3 thorpej if ((rv = bus_space_map(ia->ia_memt, ia->ia_iomem[0].ir_addr,
465 1.3 thorpej sca->scu_pagesize, 0, &sca->scu_memh))) {
466 1.1 chopps printf("%s: can't map mem 0x%x sz %ld, %d\n",
467 1.3 thorpej sc->sc_dev.dv_xname, ia->ia_iomem[0].ir_addr,
468 1.3 thorpej sca->scu_pagesize, rv);
469 1.1 chopps return;
470 1.1 chopps }
471 1.1 chopps
472 1.1 chopps /* turn the card on!! */
473 1.1 chopps bus_space_write_1(sca->sc_iot, sca->sc_ioh, NTWOC_PCR,
474 1.1 chopps bus_space_read_1(sca->sc_iot, sca->sc_ioh, NTWOC_PCR)
475 1.1 chopps | NTWOC_PCR_SCARUN);
476 1.1 chopps
477 1.1 chopps /* set the window size to 16k */
478 1.1 chopps bus_space_write_1(sca->sc_iot, sca->sc_ioh, NTWOC_PSR, tmp);
479 1.1 chopps
480 1.1 chopps /* reset mcr */
481 1.1 chopps bus_space_write_1(sca->sc_iot, sca->sc_ioh, NTWOC_MCR,
482 1.1 chopps NTWOC_MCR_DTR0 | NTWOC_MCR_DTR1 | NTWOC_MCR_TE0 | NTWOC_MCR_TE1);
483 1.10 perry
484 1.1 chopps
485 1.1 chopps /* allow for address above 1M and 16 bit i/o */
486 1.1 chopps #if 0
487 1.1 chopps bus_space_write_1(sca->sc_iot, sca->sc_ioh, NTWOC_PCR,
488 1.1 chopps bus_space_read_1(sca->sc_iot, sca->sc_ioh, NTWOC_PCR)
489 1.1 chopps | NTWOC_PCR_EN_VPM | NTWOC_PCR_ISA16);
490 1.1 chopps #endif
491 1.1 chopps bus_space_write_1(sca->sc_iot, sca->sc_ioh, NTWOC_PCR,
492 1.1 chopps bus_space_read_1(sca->sc_iot, sca->sc_ioh, NTWOC_PCR)
493 1.1 chopps | NTWOC_PCR_ISA16);
494 1.1 chopps
495 1.1 chopps /* program the card with the io address */
496 1.1 chopps bus_space_write_1(sca->sc_iot, sca->sc_ioh, NTWOC_PCR,
497 1.3 thorpej ((ia->ia_iomem[0].ir_addr >> 16) & NTWOC_PCR_16M_SEL)
498 1.1 chopps |
499 1.1 chopps (bus_space_read_1(sca->sc_iot, sca->sc_ioh, NTWOC_PCR)
500 1.1 chopps & ~NTWOC_PCR_16M_SEL));
501 1.1 chopps bus_space_write_1(sca->sc_iot, sca->sc_ioh, NTWOC_BAR,
502 1.3 thorpej (ia->ia_iomem[0].ir_addr >> 12));
503 1.1 chopps
504 1.1 chopps /* enable the memory window */
505 1.1 chopps ntwoc_isa_set_on(sca);
506 1.1 chopps
507 1.1 chopps /*
508 1.1 chopps * write a magic value into each possible page of memory
509 1.10 perry * incrementing by our window size
510 1.1 chopps */
511 1.1 chopps addr = 0;
512 1.1 chopps for (i = 0; i <= NTWOC_PSR_PG_SEL; addr += sca->scu_pagesize, i++) {
513 1.1 chopps /* select the page */
514 1.1 chopps ntwoc_isa_set_page(sca, addr);
515 1.1 chopps bus_space_write_2(sca->scu_memt, sca->scu_memh, 0, 0xAA55);
516 1.1 chopps }
517 1.1 chopps
518 1.1 chopps /*
519 1.1 chopps * go back through pages and verify that value is different
520 1.1 chopps * after writing to previous page
521 1.1 chopps */
522 1.1 chopps addr = 0;
523 1.1 chopps for (i = 0; i <= NTWOC_PSR_PG_SEL; addr += sca->scu_pagesize, i++) {
524 1.1 chopps ntwoc_isa_set_page(sca, addr);
525 1.1 chopps
526 1.1 chopps tmp = bus_space_read_2(sca->scu_memt, sca->scu_memh, 0);
527 1.1 chopps if (tmp != 0xAA55)
528 1.1 chopps break;
529 1.1 chopps
530 1.1 chopps /* write a different value into this page now */
531 1.1 chopps bus_space_write_2(sca->scu_memt, sca->scu_memh, 0, i);
532 1.1 chopps }
533 1.1 chopps sca->scu_npages = pgs = i; /* final count of 16K pages */
534 1.1 chopps
535 1.1 chopps /* erase the pages */
536 1.1 chopps addr = 0;
537 1.1 chopps for (i = 0; i <= pgs; addr += sca->scu_pagesize, i++) {
538 1.1 chopps ntwoc_isa_set_page(sca, addr);
539 1.1 chopps bus_space_set_region_1(sca->scu_memt, sca->scu_memh, 0, 0,
540 1.1 chopps sca->scu_pagesize);
541 1.1 chopps }
542 1.1 chopps
543 1.1 chopps #if 0
544 1.1 chopps printf("%s: sca port 0x%x-0x%x dpram %ldk %d serial port%s\n",
545 1.3 thorpej sc->sc_dev.dv_xname, ia->ia_io[0].ir_addr | 0x8000,
546 1.3 thorpej (ia->ia_io[0].ir_addr | 0x8000) + NTWOC_SRC_ASIC_SIZE - 1,
547 1.1 chopps pgs * (sca->scu_pagesize / 1024), sca->sc_numports,
548 1.1 chopps (sca->sc_numports > 1 ? "s" : ""));
549 1.1 chopps #else
550 1.1 chopps printf("%s: dpram %ldk %d serial port%s\n",
551 1.1 chopps sc->sc_dev.dv_xname, pgs * (sca->scu_pagesize / 1024),
552 1.1 chopps sca->sc_numports, (sca->sc_numports > 1 ? "s" : ""));
553 1.1 chopps #endif
554 1.1 chopps
555 1.1 chopps /* disable the memory window */
556 1.1 chopps ntwoc_isa_set_off(sca);
557 1.1 chopps
558 1.7 wiz /* enabled sca DMA */
559 1.1 chopps bus_space_write_1(sca->sc_iot, sca->sc_ioh, NTWOC_PSR,
560 1.1 chopps bus_space_read_1(sca->sc_iot, sca->sc_ioh, NTWOC_PSR)
561 1.1 chopps | NTWOC_PSR_EN_SCA_DMA);
562 1.1 chopps
563 1.1 chopps /* now establish our irq -- perhaps sanity check the value */
564 1.3 thorpej sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq,
565 1.3 thorpej IST_EDGE, IPL_NET, ntwoc_isa_intr, sc);
566 1.1 chopps if (sc->sc_ih == NULL) {
567 1.1 chopps printf("%s: can't establish interrupt\n",
568 1.1 chopps sc->sc_dev.dv_xname);
569 1.1 chopps return;
570 1.1 chopps }
571 1.1 chopps
572 1.1 chopps /* make sure we have 2 pages for each port */
573 1.1 chopps if (pgs < 2 * sca->sc_numports) {
574 1.1 chopps printf("%s: %d less than required pages of memory of %d\n",
575 1.1 chopps sc->sc_dev.dv_xname, pgs, 2 * sca->sc_numports);
576 1.1 chopps return;
577 1.1 chopps }
578 1.1 chopps
579 1.1 chopps /* sca_get_base_clock(sca); */
580 1.1 chopps
581 1.1 chopps /*
582 1.1 chopps * get clock information from user
583 1.1 chopps */
584 1.1 chopps rdiv = (flags & NTWOC_FLAGS_RXDIV_MASK) >> NTWOC_FLAGS_RXDIV_SHIFT;
585 1.1 chopps if (rdiv > 9)
586 1.1 chopps panic("bad rx divisor in flags");
587 1.1 chopps
588 1.1 chopps tdiv = (flags & NTWOC_FLAGS_TXDIV_MASK) >> NTWOC_FLAGS_TXDIV_SHIFT;
589 1.1 chopps if (tdiv > 9)
590 1.1 chopps panic("bad tx divisor in flags");
591 1.1 chopps tmc = (flags & NTWOC_FLAGS_TMC_MASK) >> NTWOC_FLAGS_TMC_SHIFT;
592 1.1 chopps
593 1.1 chopps ntwoc_isa_get_clock(&sca->sc_ports[0],
594 1.1 chopps flags & NTWOC_FLAGS_CLK0_MASK, tmc, rdiv, tdiv);
595 1.1 chopps if (sca->sc_numports > 1)
596 1.1 chopps ntwoc_isa_get_clock(&sca->sc_ports[1],
597 1.1 chopps (flags & NTWOC_FLAGS_CLK1_MASK) >> NTWOC_FLAGS_CLK1_SHIFT,
598 1.1 chopps tmc, rdiv, tdiv);
599 1.1 chopps
600 1.1 chopps ntwoc_isa_setup_memory(sca);
601 1.1 chopps
602 1.1 chopps sca_init(sca);
603 1.1 chopps
604 1.1 chopps /* attach configured ports */
605 1.1 chopps sca_port_attach(sca, 0);
606 1.1 chopps if (sca->sc_numports == 2)
607 1.1 chopps sca_port_attach(sca, 1);
608 1.1 chopps
609 1.1 chopps /*
610 1.1 chopps * Add shutdown hook so that DMA is disabled prior to reboot. Not
611 1.1 chopps * doing do could allow DMA to corrupt kernel memory during the
612 1.1 chopps * reboot before the driver initializes.
613 1.1 chopps */
614 1.1 chopps shutdownhook_establish(ntwoc_isa_shutdown, sc);
615 1.1 chopps
616 1.1 chopps #if __NetBSD_Version__ >= 104160000
617 1.1 chopps /*
618 1.1 chopps * defer getting the base clock until interrupts are enabled
619 1.1 chopps * (and thus we have microtime())
620 1.1 chopps */
621 1.1 chopps config_interrupts(self, ntwoc_isa_config_interrupts);
622 1.1 chopps #else
623 1.1 chopps /* no callback pre 1.4-mumble */
624 1.1 chopps sca->sc_baseclock = SCA_BASECLOCK;
625 1.1 chopps sca_print_clock_info(&sc->sc_sca);
626 1.1 chopps #endif
627 1.1 chopps }
628 1.1 chopps
629 1.1 chopps /*
630 1.1 chopps * extract the clock information for a port from the flags field
631 1.1 chopps */
632 1.1 chopps static void
633 1.1 chopps ntwoc_isa_get_clock(struct sca_port *scp, u_int8_t flags, u_int8_t tmc,
634 1.1 chopps u_int8_t rdiv, u_int8_t tdiv)
635 1.1 chopps {
636 1.1 chopps scp->sp_eclock =
637 1.1 chopps (flags & NTWOC_FLAGS_ECLOCK_MASK) >> NTWOC_FLAGS_ECLOCK_SHIFT;
638 1.1 chopps scp->sp_rxs = rdiv;
639 1.1 chopps scp->sp_txs = tdiv;
640 1.1 chopps scp->sp_tmc = tmc;
641 1.1 chopps
642 1.1 chopps /* get rx source */
643 1.1 chopps switch ((flags & NTWOC_FLAGS_RXS_MASK) >> NTWOC_FLAGS_RXS_SHIFT) {
644 1.1 chopps case NTWOC_FLAGS_RXS_LINE:
645 1.1 chopps scp->sp_rxs = 0;
646 1.1 chopps break;
647 1.1 chopps case NTWOC_FLAGS_RXS_LINE_SN:
648 1.1 chopps scp->sp_rxs |= SCA_RXS_CLK_LINE_SN;
649 1.1 chopps break;
650 1.1 chopps case NTWOC_FLAGS_RXS_INTERNAL:
651 1.1 chopps scp->sp_rxs |= SCA_RXS_CLK_INTERNAL;
652 1.1 chopps break;
653 1.1 chopps case NTWOC_FLAGS_RXS_ADPLL_OUT:
654 1.1 chopps scp->sp_rxs |= SCA_RXS_CLK_ADPLL_OUT;
655 1.1 chopps break;
656 1.1 chopps case NTWOC_FLAGS_RXS_ADPLL_IN:
657 1.1 chopps scp->sp_rxs |= SCA_RXS_CLK_ADPLL_IN;
658 1.1 chopps break;
659 1.1 chopps default:
660 1.1 chopps panic("bad rx source in flags");
661 1.1 chopps }
662 1.1 chopps
663 1.1 chopps /* get tx source */
664 1.1 chopps switch ((flags & NTWOC_FLAGS_TXS_MASK) >> NTWOC_FLAGS_TXS_SHIFT) {
665 1.1 chopps case NTWOC_FLAGS_TXS_LINE:
666 1.1 chopps scp->sp_txs = 0;
667 1.1 chopps break;
668 1.1 chopps case NTWOC_FLAGS_TXS_INTERNAL:
669 1.1 chopps scp->sp_txs |= SCA_TXS_CLK_INTERNAL;
670 1.1 chopps break;
671 1.1 chopps case NTWOC_FLAGS_TXS_RXCLOCK:
672 1.1 chopps scp->sp_txs |= SCA_TXS_CLK_RXCLK;
673 1.1 chopps break;
674 1.1 chopps default:
675 1.1 chopps panic("bad rx source in flags");
676 1.1 chopps }
677 1.1 chopps }
678 1.1 chopps
679 1.1 chopps
680 1.1 chopps static int
681 1.1 chopps ntwoc_isa_intr(void *arg)
682 1.1 chopps {
683 1.1 chopps struct ntwoc_isa_softc *sc = (struct ntwoc_isa_softc *)arg;
684 1.1 chopps
685 1.1 chopps return sca_hardintr(&sc->sc_sca);
686 1.1 chopps }
687 1.1 chopps
688 1.1 chopps /*
689 1.1 chopps * shut down interrupts and DMA, so we don't trash the kernel on warm
690 1.1 chopps * boot. Also, lower DTR on each port and disable card interrupts.
691 1.1 chopps */
692 1.1 chopps static void
693 1.1 chopps ntwoc_isa_shutdown(void *aux)
694 1.1 chopps {
695 1.1 chopps struct ntwoc_isa_softc *sc = aux;
696 1.1 chopps u_int16_t mcr;
697 1.1 chopps
698 1.1 chopps /*
699 1.1 chopps * shut down the SCA ports
700 1.1 chopps */
701 1.1 chopps sca_shutdown(&sc->sc_sca);
702 1.1 chopps
703 1.1 chopps /*
704 1.1 chopps * lower DTR on both ports
705 1.1 chopps */
706 1.1 chopps mcr = bus_space_read_1(sc->sc_sca.sc_iot, sc->sc_sca.sc_ioh, NTWOC_MCR);
707 1.1 chopps mcr |= (NTWOC_MCR_DTR0 | NTWOC_MCR_DTR1);
708 1.1 chopps bus_space_write_1(sc->sc_sca.sc_iot, sc->sc_sca.sc_ioh, NTWOC_MCR, mcr);
709 1.1 chopps }
710 1.1 chopps
711 1.1 chopps static void
712 1.1 chopps ntwoc_isa_dtr_callback(void *aux, int port, int state)
713 1.1 chopps {
714 1.1 chopps struct ntwoc_isa_softc *sc = aux;
715 1.1 chopps u_int8_t mcr;
716 1.1 chopps
717 1.1 chopps mcr = bus_space_read_1(sc->sc_sca.sc_iot, sc->sc_sca.sc_ioh, NTWOC_MCR);
718 1.1 chopps
719 1.1 chopps NTWO_DPRINTF(("port == %d, state == %d, old mcr: 0x%02x\n",
720 1.1 chopps port, state, mcr));
721 1.1 chopps
722 1.1 chopps if (port == 0) {
723 1.1 chopps if (state == 0)
724 1.1 chopps mcr |= NTWOC_MCR_DTR0;
725 1.1 chopps else
726 1.1 chopps mcr &= ~NTWOC_MCR_DTR0;
727 1.1 chopps } else {
728 1.1 chopps if (state == 0)
729 1.1 chopps mcr |= NTWOC_MCR_DTR1;
730 1.1 chopps else
731 1.1 chopps mcr &= ~NTWOC_MCR_DTR1;
732 1.1 chopps }
733 1.1 chopps
734 1.1 chopps NTWO_DPRINTF(("new mcr: 0x%02x\n", mcr));
735 1.1 chopps
736 1.1 chopps bus_space_write_1(sc->sc_sca.sc_iot, sc->sc_sca.sc_ioh, NTWOC_MCR, mcr);
737 1.1 chopps }
738 1.1 chopps
739 1.1 chopps static void
740 1.1 chopps ntwoc_isa_clock_callback(void *aux, int port, int enable)
741 1.1 chopps {
742 1.1 chopps struct ntwoc_isa_softc *sc = aux;
743 1.1 chopps u_int8_t mcr;
744 1.1 chopps
745 1.1 chopps mcr = bus_space_read_1(sc->sc_sca.sc_iot, sc->sc_sca.sc_ioh, NTWOC_MCR);
746 1.1 chopps
747 1.1 chopps NTWO_DPRINTF(("clock: port == %d, enable == %d, old mcr: 0x%02x\n",
748 1.1 chopps port, enable, mcr));
749 1.1 chopps
750 1.1 chopps if (port == 0) {
751 1.1 chopps if (enable == 0)
752 1.1 chopps mcr &= ~NTWOC_MCR_ETC0;
753 1.1 chopps else
754 1.1 chopps mcr |= NTWOC_MCR_ETC0;
755 1.1 chopps } else {
756 1.1 chopps if (enable == 0)
757 1.1 chopps mcr &= ~NTWOC_MCR_ETC1;
758 1.1 chopps else
759 1.1 chopps mcr |= NTWOC_MCR_ETC1;
760 1.1 chopps }
761 1.1 chopps
762 1.1 chopps NTWO_DPRINTF(("clock: new mcr: 0x%02x\n", mcr));
763 1.1 chopps
764 1.1 chopps bus_space_write_1(sc->sc_sca.sc_iot, sc->sc_sca.sc_ioh, NTWOC_MCR, mcr);
765 1.1 chopps }
766 1.1 chopps
767 1.1 chopps static void
768 1.1 chopps ntwoc_isa_setup_memory(struct sca_softc *sc)
769 1.1 chopps {
770 1.1 chopps struct sca_port *scp;
771 1.1 chopps u_int i, j;
772 1.1 chopps
773 1.1 chopps /* allocate enough descriptors for a full page */
774 1.1 chopps
775 1.1 chopps sc->sc_ports[0].sp_ntxdesc = (sc->scu_pagesize / SCA_BSIZE) - 1;
776 1.1 chopps sc->sc_ports[0].sp_nrxdesc = (sc->scu_pagesize / SCA_BSIZE) - 1;
777 1.1 chopps if (sc->sc_numports == 2) {
778 1.1 chopps sc->sc_ports[1].sp_ntxdesc = sc->sc_ports[0].sp_ntxdesc;
779 1.1 chopps sc->sc_ports[1].sp_nrxdesc = sc->sc_ports[0].sp_nrxdesc;
780 1.1 chopps }
781 1.1 chopps
782 1.1 chopps j = 0;
783 1.1 chopps for (i = 0; i < sc->sc_numports; i++) {
784 1.1 chopps scp = &sc->sc_ports[i];
785 1.1 chopps scp->sp_txdesc_p = (bus_addr_t)(j * sc->scu_pagesize);
786 1.1 chopps scp->sp_txdesc = (void *)scp->sp_txdesc_p;
787 1.1 chopps scp->sp_txbuf_p = scp->sp_txdesc_p;
788 1.1 chopps scp->sp_txbuf_p += SCA_BSIZE;
789 1.1 chopps scp->sp_txbuf = (void *)scp->sp_txbuf_p;
790 1.1 chopps j++;
791 1.1 chopps
792 1.1 chopps scp->sp_rxdesc_p = (bus_addr_t)(j * sc->scu_pagesize);
793 1.1 chopps scp->sp_rxdesc = (void *)scp->sp_txdesc_p;
794 1.1 chopps scp->sp_rxbuf_p = scp->sp_rxdesc_p;
795 1.1 chopps scp->sp_rxbuf_p += SCA_BSIZE;
796 1.1 chopps scp->sp_rxbuf = (void *)scp->sp_rxbuf_p;
797 1.1 chopps j++;
798 1.1 chopps }
799 1.1 chopps }
800 1.1 chopps
801 1.1 chopps #if __NetBSD_Version__ >= 104160000
802 1.1 chopps /*
803 1.1 chopps * get the base clock frequency
804 1.1 chopps */
805 1.1 chopps static void
806 1.1 chopps ntwoc_isa_config_interrupts(self)
807 1.1 chopps struct device *self;
808 1.1 chopps {
809 1.1 chopps struct ntwoc_isa_softc *sc;
810 1.1 chopps
811 1.1 chopps sc = (void *)self;
812 1.1 chopps sca_get_base_clock(&sc->sc_sca);
813 1.1 chopps sca_print_clock_info(&sc->sc_sca);
814 1.1 chopps }
815 1.1 chopps #endif
816