1 1.27 msaitoh /* $NetBSD: if_ntwoc_isa.c,v 1.27 2016/07/14 10:19:06 msaitoh 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.27 msaitoh * $Id: if_ntwoc_isa.c,v 1.27 2016/07/14 10:19:06 msaitoh Exp $ 33 1.1 chopps */ 34 1.1 chopps 35 1.2 lukem #include <sys/cdefs.h> 36 1.27 msaitoh __KERNEL_RCSID(0, "$NetBSD: if_ntwoc_isa.c,v 1.27 2016/07/14 10:19:06 msaitoh 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.21 cegger static void ntwoc_isa_config_interrupts(device_t); 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.24 chs device_t 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.21 cegger static int ntwoc_isa_probe(device_t, cfdata_t, void *); 88 1.21 cegger static void ntwoc_isa_attach(device_t, device_t, 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.24 chs CFATTACH_DECL_NEW(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.21 cegger ntwoc_isa_probe(device_t parent, cfdata_t 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.25 christos int i, tmp, 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 215 1.1 chopps /* disallow wildcarded I/O base */ 216 1.8 drochner if (ia->ia_io[0].ir_addr == ISA_UNKNOWN_PORT) { 217 1.1 chopps printf("ntwoc_isa_probe: must specify port address\n"); 218 1.1 chopps return (0); 219 1.1 chopps } 220 1.1 chopps 221 1.8 drochner if (ia->ia_irq[0].ir_irq == ISA_UNKNOWN_IRQ) { 222 1.1 chopps printf("ntwoc_isa_probe: must specify irq\n"); 223 1.1 chopps return (0); 224 1.1 chopps } 225 1.1 chopps 226 1.8 drochner if (ia->ia_iomem[0].ir_addr == ISA_UNKNOWN_IOMEM) { 227 1.1 chopps printf("ntwoc_isa_probe: must specify iomem\n"); 228 1.1 chopps return (0); 229 1.1 chopps } 230 1.1 chopps 231 1.1 chopps tmp = (match->cf_flags & NTWOC_FLAGS_NPORT_MASK) + 1; 232 1.1 chopps if (tmp < 1 || tmp > 2) { 233 1.1 chopps printf("ntwoc_isa_probe: only 1 or 2 ports allowed\n"); 234 1.1 chopps return (0); 235 1.1 chopps } 236 1.1 chopps 237 1.1 chopps /* map the isa io addresses */ 238 1.3 thorpej if ((tmp = bus_space_map(iot, ia->ia_io[0].ir_addr, 239 1.3 thorpej NTWOC_SRC_IOPORT_SIZE, 0, &ioh))) { 240 1.1 chopps printf("ntwoc_isa_probe: mapping port 0x%x sz %d failed: %d\n", 241 1.3 thorpej ia->ia_io[0].ir_addr, NTWOC_SRC_IOPORT_SIZE, tmp); 242 1.1 chopps return (0); 243 1.1 chopps } 244 1.1 chopps 245 1.3 thorpej ioport = ia->ia_io[0].ir_addr + 0x8000; 246 1.1 chopps for (i = 0; i < 16; ioport += (0x10 << 6), i++) { 247 1.1 chopps /* map the isa io addresses */ 248 1.1 chopps if ((tmp = bus_space_map(iot, ioport, 16, 0, &sca_ioh[i]))) { 249 1.1 chopps printf( 250 1.1 chopps "ntwoc_isa_probe: mapping sca 0x%x sz %d failed: %d\n", 251 1.1 chopps ioport, 16, tmp); 252 1.1 chopps goto out; 253 1.1 chopps } 254 1.1 chopps gotsca[i] = 1; 255 1.1 chopps } 256 1.1 chopps 257 1.1 chopps /* map the isa memory addresses */ 258 1.1 chopps /* XXX we really want the user to select this */ 259 1.3 thorpej if ((tmp = bus_space_map(ia->ia_memt, ia->ia_iomem[0].ir_addr, 260 1.3 thorpej NTWOC_WIN_SIZE, 0, &memh))) { 261 1.1 chopps printf("ntwoc_isa_probe: mapping mem 0x%x sz %d failed: %d\n", 262 1.3 thorpej ia->ia_iomem[0].ir_addr, NTWOC_WIN_SIZE, tmp); 263 1.1 chopps goto out; 264 1.1 chopps } 265 1.1 chopps gotmem = 1; 266 1.1 chopps 267 1.1 chopps /* turn off the card */ 268 1.1 chopps bus_space_write_1(iot, ioh, NTWOC_PCR, 0); 269 1.1 chopps 270 1.1 chopps /* 271 1.1 chopps * Next, we'll test the Base Address Register to retension of 272 1.1 chopps * data... ... seeing if we're *really* talking to an N2. 273 1.1 chopps */ 274 1.1 chopps for (i = 0; i < 0x100; i++) { 275 1.1 chopps bus_space_write_1(iot, ioh, NTWOC_BAR, i); 276 1.1 chopps (void)bus_space_read_1(iot, ioh, NTWOC_PCR); 277 1.1 chopps if (bus_space_read_1(iot, ioh, NTWOC_BAR) != i) { 278 1.1 chopps printf("ntwoc_isa_probe failed (BAR %x, %x)\n", i, tmp); 279 1.1 chopps goto out; 280 1.1 chopps } 281 1.1 chopps } 282 1.1 chopps 283 1.1 chopps /* XXX XXX update the calls to SCA_REG to use our mapping */ 284 1.1 chopps 285 1.1 chopps /* 286 1.1 chopps * Now see if we can see the SCA. 287 1.1 chopps */ 288 1.1 chopps bus_space_write_1(iot, ioh, NTWOC_PCR, 289 1.1 chopps NTWOC_PCR_SCARUN | bus_space_read_1(iot, ioh, NTWOC_PCR)); 290 1.1 chopps bus_space_write_1(iot, sca_ioh[0], SCA_REG(SCA_WCRL), 0); 291 1.1 chopps bus_space_write_1(iot, sca_ioh[0], SCA_REG(SCA_WCRM), 0); 292 1.1 chopps bus_space_write_1(iot, sca_ioh[0], SCA_REG(SCA_WCRH), 0); 293 1.1 chopps bus_space_write_1(iot, sca_ioh[0], SCA_REG(SCA_PCR), 0); 294 1.1 chopps 295 1.1 chopps bus_space_write_1(iot, sca_ioh[0], SCA_REG(SCA_TMC0), 0); 296 1.1 chopps (void)bus_space_read_1(iot, ioh, 0); 297 1.1 chopps if ((tmp = bus_space_read_1(iot, sca_ioh[0], SCA_REG(SCA_TMC0))) != 0) { 298 1.1 chopps printf("ntwoc_isa_probe: Error reading SCA (TMC0 0, %x)\n", 299 1.1 chopps tmp); 300 1.1 chopps goto out; 301 1.1 chopps } 302 1.1 chopps 303 1.1 chopps bus_space_write_1(iot, sca_ioh[0], SCA_REG(SCA_TMC0), 0x5A); 304 1.1 chopps (void)bus_space_read_1(iot, ioh, 0); 305 1.1 chopps 306 1.1 chopps tmp = bus_space_read_1(iot, sca_ioh[0], SCA_REG(SCA_TMC0)); 307 1.1 chopps if (tmp != 0x5A) { 308 1.1 chopps printf("ntwoc_isa_probe: Error reading SCA (TMC0 5A, %x)\n", 309 1.1 chopps tmp); 310 1.1 chopps goto out; 311 1.1 chopps } 312 1.1 chopps 313 1.1 chopps bus_space_write_2(iot, sca_ioh[0], SCA_REG(SCA_CDAL0), 0); 314 1.1 chopps (void)bus_space_read_1(iot, ioh, 0); 315 1.1 chopps tmp = bus_space_read_2(iot, sca_ioh[0], SCA_REG(SCA_CDAL0)); 316 1.1 chopps if (tmp != 0) { 317 1.1 chopps printf("ntwoc_isa_probe: Error reading SCA (CDAL0 0, %x)\n", 318 1.1 chopps tmp); 319 1.1 chopps goto out; 320 1.1 chopps } 321 1.1 chopps 322 1.1 chopps bus_space_write_2(iot, sca_ioh[0], SCA_REG(SCA_CDAL0), 0x55AA); 323 1.1 chopps (void)bus_space_read_1(iot, ioh, 0); 324 1.1 chopps tmp = bus_space_read_2(iot, sca_ioh[0], SCA_REG(SCA_CDAL0)); 325 1.1 chopps if (tmp != 0x55AA) { 326 1.1 chopps printf("ntwoc_isa_probe: Error reading SCA (CDAL0 55AA, %x)\n", 327 1.1 chopps tmp); 328 1.1 chopps goto out; 329 1.1 chopps } 330 1.1 chopps 331 1.1 chopps /* 332 1.1 chopps * I had a weird card that didn't function correctly on a certain 333 1.1 chopps * newer MB. I suspect it was the whacky port addresses. 334 1.1 chopps * The following correctly failed it. 335 1.1 chopps */ 336 1.1 chopps bus_space_write_2(iot, sca_ioh[0], SCA_REG(SCA_TCNTL0), 0x0); 337 1.1 chopps (void)bus_space_read_1(iot, ioh, 0); 338 1.1 chopps tmp = bus_space_read_2(iot, sca_ioh[0], SCA_REG(SCA_TCNTL0)); 339 1.1 chopps if (tmp != 0) { 340 1.1 chopps printf("ntwoc_isa_probe: Error reading SCA (TCNTL0 0, %x)\n", 341 1.1 chopps tmp); 342 1.1 chopps goto out; 343 1.1 chopps } 344 1.1 chopps 345 1.1 chopps bus_space_write_2(iot, sca_ioh[0], SCA_REG(SCA_TCNTL0), 0x55AA); 346 1.1 chopps (void)bus_space_read_1(iot, ioh, 0); 347 1.1 chopps tmp = bus_space_read_2(iot, sca_ioh[0], SCA_REG(SCA_TCNTL0)); 348 1.1 chopps if (tmp != 0x55AA) { 349 1.1 chopps printf("ntwoc_isa_probe: Error reading SCA (TCNTL0 55AA, %x)\n", 350 1.1 chopps tmp); 351 1.1 chopps goto out; 352 1.1 chopps } 353 1.1 chopps 354 1.3 thorpej ia->ia_nio = 1; 355 1.3 thorpej ia->ia_io[0].ir_size = NTWOC_SRC_IOPORT_SIZE; 356 1.3 thorpej 357 1.3 thorpej ia->ia_niomem = 1; 358 1.3 thorpej ia->ia_iomem[0].ir_size = NTWOC_WIN_SIZE; 359 1.3 thorpej 360 1.3 thorpej ia->ia_nirq = 1; 361 1.3 thorpej 362 1.3 thorpej ia->ia_ndrq = 0; 363 1.3 thorpej 364 1.1 chopps rv = 1; 365 1.1 chopps out: 366 1.1 chopps /* turn off the card */ 367 1.1 chopps bus_space_write_1(iot, ioh, NTWOC_PCR, 0); 368 1.1 chopps 369 1.1 chopps if (gotmem) 370 1.1 chopps bus_space_unmap(memt, memh, NTWOC_WIN_SIZE); 371 1.1 chopps for (i = 0; i < 16; i++) { 372 1.1 chopps if (gotsca[i]) 373 1.1 chopps bus_space_unmap(iot, sca_ioh[i], 16); 374 1.1 chopps } 375 1.1 chopps bus_space_unmap(iot, ioh, NTWOC_SRC_IOPORT_SIZE); 376 1.1 chopps return (rv); 377 1.1 chopps } 378 1.1 chopps 379 1.1 chopps /* 380 1.1 chopps * we win! attach the card 381 1.1 chopps */ 382 1.1 chopps static void 383 1.21 cegger ntwoc_isa_attach(device_t parent, device_t self, void *aux) 384 1.1 chopps { 385 1.1 chopps struct ntwoc_isa_softc *sc; 386 1.1 chopps struct isa_attach_args *ia; 387 1.1 chopps struct sca_softc *sca; 388 1.1 chopps bus_addr_t addr; 389 1.1 chopps u_int8_t rdiv, tdiv, tmc; 390 1.1 chopps u_int32_t flags, ioport; 391 1.1 chopps u_int16_t tmp; 392 1.25 christos int i, pgs, rv; 393 1.1 chopps 394 1.1 chopps ia = (struct isa_attach_args *)aux; 395 1.24 chs sc = device_private(self); 396 1.24 chs sc->sc_dev = self; 397 1.1 chopps sca = &sc->sc_sca; 398 1.1 chopps 399 1.1 chopps printf(": N2 Serial Interface\n"); 400 1.24 chs flags = device_cfdata(sc->sc_dev)->cf_flags; 401 1.1 chopps 402 1.1 chopps sc->sc_ic = ia->ia_ic; 403 1.24 chs sca->sc_parent = sc->sc_dev; 404 1.1 chopps sca->sc_numports = (flags & NTWOC_FLAGS_NPORT_MASK) + 1; 405 1.1 chopps sca->sc_usedma = 0; 406 1.1 chopps sca->sc_aux = sc; 407 1.1 chopps sca->sc_dtr_callback = ntwoc_isa_dtr_callback; 408 1.1 chopps sca->sc_clock_callback = ntwoc_isa_clock_callback; 409 1.1 chopps sca->sc_read_1 = ntwoc_isa_sca_read_1; 410 1.1 chopps sca->sc_read_2 = ntwoc_isa_sca_read_2; 411 1.1 chopps sca->sc_write_1 = ntwoc_isa_sca_write_1; 412 1.1 chopps sca->sc_write_2 = ntwoc_isa_sca_write_2; 413 1.1 chopps sca->scu_set_page = ntwoc_isa_set_page; 414 1.1 chopps sca->scu_page_on = ntwoc_isa_set_on; 415 1.1 chopps sca->scu_page_off = ntwoc_isa_set_off; 416 1.1 chopps 417 1.1 chopps /* map the io */ 418 1.1 chopps sca->sc_iot = ia->ia_iot; 419 1.3 thorpej if ((rv = bus_space_map(ia->ia_iot, ia->ia_io[0].ir_addr, 420 1.1 chopps NTWOC_SRC_IOPORT_SIZE, 0, &sca->sc_ioh))) { 421 1.24 chs aprint_error_dev(sc->sc_dev, "can't map io 0x%x sz %d, %d\n", 422 1.26 msaitoh ia->ia_io[0].ir_addr, NTWOC_SRC_IOPORT_SIZE, rv); 423 1.1 chopps return; 424 1.1 chopps } 425 1.1 chopps 426 1.1 chopps /* support weird mapping (they used this to avoid 10-bit aliasing) */ 427 1.3 thorpej ioport = ia->ia_io[0].ir_addr + 0x8000; 428 1.1 chopps for (i = 0; i < 16; ioport += (0x10 << 6), i++) { 429 1.1 chopps /* map the isa io addresses */ 430 1.1 chopps if ((tmp = bus_space_map(ia->ia_iot, ioport, 16, 0, 431 1.1 chopps &sca->scu_sca_ioh[i]))) { 432 1.26 msaitoh aprint_error_dev(sc->sc_dev, 433 1.26 msaitoh "mapping sca 0x%x sz %d failed: %d\n", 434 1.17 cegger ioport, 16, tmp); 435 1.1 chopps return; 436 1.1 chopps } 437 1.1 chopps } 438 1.1 chopps 439 1.1 chopps /* map the isa memory */ 440 1.1 chopps sca->scu_memt = ia->ia_memt; 441 1.1 chopps sca->scu_pagesize = 0x4000; /* force 16k for now */ 442 1.1 chopps if (sca->scu_pagesize < 0x8000) { 443 1.1 chopps /* round down to 16k */ 444 1.1 chopps sca->scu_pagesize = 0x4000; 445 1.1 chopps sca->scu_pageshift = 14; 446 1.1 chopps tmp = NTWOC_PSR_WIN_16K; 447 1.1 chopps } else if (sca->scu_pagesize < 0x10000) { 448 1.1 chopps /* round down to 32k */ 449 1.1 chopps sca->scu_pagesize = 0x8000; 450 1.1 chopps sca->scu_pageshift = 15; 451 1.1 chopps tmp = NTWOC_PSR_WIN_32K; 452 1.1 chopps } else if (sca->scu_pagesize < 0x20000) { 453 1.1 chopps /* round down to 64k */ 454 1.1 chopps sca->scu_pagesize = 0x10000; 455 1.1 chopps sca->scu_pageshift = 16; 456 1.1 chopps tmp = NTWOC_PSR_WIN_64K; 457 1.1 chopps } else { 458 1.1 chopps sca->scu_pagesize = 0x20000; 459 1.1 chopps sca->scu_pageshift = 17; 460 1.1 chopps tmp = NTWOC_PSR_WIN_128K; 461 1.1 chopps } 462 1.1 chopps sca->scu_pagemask = sca->scu_pagesize - 1; 463 1.3 thorpej if ((rv = bus_space_map(ia->ia_memt, ia->ia_iomem[0].ir_addr, 464 1.3 thorpej sca->scu_pagesize, 0, &sca->scu_memh))) { 465 1.24 chs aprint_error_dev(sc->sc_dev, "can't map mem 0x%x sz %ld, %d\n", 466 1.17 cegger ia->ia_iomem[0].ir_addr, 467 1.18 bouyer (u_long)sca->scu_pagesize, rv); 468 1.1 chopps return; 469 1.1 chopps } 470 1.1 chopps 471 1.1 chopps /* turn the card on!! */ 472 1.1 chopps bus_space_write_1(sca->sc_iot, sca->sc_ioh, NTWOC_PCR, 473 1.1 chopps bus_space_read_1(sca->sc_iot, sca->sc_ioh, NTWOC_PCR) 474 1.1 chopps | NTWOC_PCR_SCARUN); 475 1.1 chopps 476 1.1 chopps /* set the window size to 16k */ 477 1.1 chopps bus_space_write_1(sca->sc_iot, sca->sc_ioh, NTWOC_PSR, tmp); 478 1.1 chopps 479 1.1 chopps /* reset mcr */ 480 1.1 chopps bus_space_write_1(sca->sc_iot, sca->sc_ioh, NTWOC_MCR, 481 1.1 chopps NTWOC_MCR_DTR0 | NTWOC_MCR_DTR1 | NTWOC_MCR_TE0 | NTWOC_MCR_TE1); 482 1.10 perry 483 1.1 chopps 484 1.1 chopps /* allow for address above 1M and 16 bit i/o */ 485 1.1 chopps #if 0 486 1.1 chopps bus_space_write_1(sca->sc_iot, sca->sc_ioh, NTWOC_PCR, 487 1.1 chopps bus_space_read_1(sca->sc_iot, sca->sc_ioh, NTWOC_PCR) 488 1.1 chopps | NTWOC_PCR_EN_VPM | NTWOC_PCR_ISA16); 489 1.1 chopps #endif 490 1.1 chopps bus_space_write_1(sca->sc_iot, sca->sc_ioh, NTWOC_PCR, 491 1.1 chopps bus_space_read_1(sca->sc_iot, sca->sc_ioh, NTWOC_PCR) 492 1.1 chopps | NTWOC_PCR_ISA16); 493 1.1 chopps 494 1.1 chopps /* program the card with the io address */ 495 1.1 chopps bus_space_write_1(sca->sc_iot, sca->sc_ioh, NTWOC_PCR, 496 1.3 thorpej ((ia->ia_iomem[0].ir_addr >> 16) & NTWOC_PCR_16M_SEL) 497 1.1 chopps | 498 1.1 chopps (bus_space_read_1(sca->sc_iot, sca->sc_ioh, NTWOC_PCR) 499 1.1 chopps & ~NTWOC_PCR_16M_SEL)); 500 1.1 chopps bus_space_write_1(sca->sc_iot, sca->sc_ioh, NTWOC_BAR, 501 1.3 thorpej (ia->ia_iomem[0].ir_addr >> 12)); 502 1.1 chopps 503 1.1 chopps /* enable the memory window */ 504 1.1 chopps ntwoc_isa_set_on(sca); 505 1.1 chopps 506 1.1 chopps /* 507 1.1 chopps * write a magic value into each possible page of memory 508 1.10 perry * incrementing by our window size 509 1.1 chopps */ 510 1.1 chopps addr = 0; 511 1.1 chopps for (i = 0; i <= NTWOC_PSR_PG_SEL; addr += sca->scu_pagesize, i++) { 512 1.1 chopps /* select the page */ 513 1.1 chopps ntwoc_isa_set_page(sca, addr); 514 1.1 chopps bus_space_write_2(sca->scu_memt, sca->scu_memh, 0, 0xAA55); 515 1.1 chopps } 516 1.1 chopps 517 1.1 chopps /* 518 1.1 chopps * go back through pages and verify that value is different 519 1.1 chopps * after writing to previous page 520 1.1 chopps */ 521 1.1 chopps addr = 0; 522 1.1 chopps for (i = 0; i <= NTWOC_PSR_PG_SEL; addr += sca->scu_pagesize, i++) { 523 1.1 chopps ntwoc_isa_set_page(sca, addr); 524 1.1 chopps 525 1.1 chopps tmp = bus_space_read_2(sca->scu_memt, sca->scu_memh, 0); 526 1.1 chopps if (tmp != 0xAA55) 527 1.1 chopps break; 528 1.1 chopps 529 1.1 chopps /* write a different value into this page now */ 530 1.1 chopps bus_space_write_2(sca->scu_memt, sca->scu_memh, 0, i); 531 1.1 chopps } 532 1.1 chopps sca->scu_npages = pgs = i; /* final count of 16K pages */ 533 1.1 chopps 534 1.1 chopps /* erase the pages */ 535 1.1 chopps addr = 0; 536 1.1 chopps for (i = 0; i <= pgs; addr += sca->scu_pagesize, i++) { 537 1.1 chopps ntwoc_isa_set_page(sca, addr); 538 1.1 chopps bus_space_set_region_1(sca->scu_memt, sca->scu_memh, 0, 0, 539 1.1 chopps sca->scu_pagesize); 540 1.1 chopps } 541 1.1 chopps 542 1.1 chopps #if 0 543 1.1 chopps printf("%s: sca port 0x%x-0x%x dpram %ldk %d serial port%s\n", 544 1.24 chs device_xname(sc->sc_dev), ia->ia_io[0].ir_addr | 0x8000, 545 1.3 thorpej (ia->ia_io[0].ir_addr | 0x8000) + NTWOC_SRC_ASIC_SIZE - 1, 546 1.1 chopps pgs * (sca->scu_pagesize / 1024), sca->sc_numports, 547 1.1 chopps (sca->sc_numports > 1 ? "s" : "")); 548 1.1 chopps #else 549 1.1 chopps printf("%s: dpram %ldk %d serial port%s\n", 550 1.24 chs device_xname(sc->sc_dev), (u_long)pgs * (sca->scu_pagesize / 1024), 551 1.1 chopps sca->sc_numports, (sca->sc_numports > 1 ? "s" : "")); 552 1.1 chopps #endif 553 1.1 chopps 554 1.1 chopps /* disable the memory window */ 555 1.1 chopps ntwoc_isa_set_off(sca); 556 1.1 chopps 557 1.7 wiz /* enabled sca DMA */ 558 1.1 chopps bus_space_write_1(sca->sc_iot, sca->sc_ioh, NTWOC_PSR, 559 1.1 chopps bus_space_read_1(sca->sc_iot, sca->sc_ioh, NTWOC_PSR) 560 1.1 chopps | NTWOC_PSR_EN_SCA_DMA); 561 1.1 chopps 562 1.1 chopps /* now establish our irq -- perhaps sanity check the value */ 563 1.3 thorpej sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, 564 1.3 thorpej IST_EDGE, IPL_NET, ntwoc_isa_intr, sc); 565 1.1 chopps if (sc->sc_ih == NULL) { 566 1.24 chs aprint_error_dev(sc->sc_dev, "can't establish interrupt\n"); 567 1.1 chopps return; 568 1.1 chopps } 569 1.1 chopps 570 1.1 chopps /* make sure we have 2 pages for each port */ 571 1.1 chopps if (pgs < 2 * sca->sc_numports) { 572 1.27 msaitoh aprint_error_dev(self, 573 1.27 msaitoh "%d less than required pages of memory of %d\n", 574 1.27 msaitoh pgs, 2 * sca->sc_numports); 575 1.1 chopps return; 576 1.1 chopps } 577 1.1 chopps 578 1.1 chopps /* sca_get_base_clock(sca); */ 579 1.1 chopps 580 1.1 chopps /* 581 1.1 chopps * get clock information from user 582 1.1 chopps */ 583 1.1 chopps rdiv = (flags & NTWOC_FLAGS_RXDIV_MASK) >> NTWOC_FLAGS_RXDIV_SHIFT; 584 1.1 chopps if (rdiv > 9) 585 1.1 chopps panic("bad rx divisor in flags"); 586 1.1 chopps 587 1.1 chopps tdiv = (flags & NTWOC_FLAGS_TXDIV_MASK) >> NTWOC_FLAGS_TXDIV_SHIFT; 588 1.1 chopps if (tdiv > 9) 589 1.1 chopps panic("bad tx divisor in flags"); 590 1.1 chopps tmc = (flags & NTWOC_FLAGS_TMC_MASK) >> NTWOC_FLAGS_TMC_SHIFT; 591 1.1 chopps 592 1.1 chopps ntwoc_isa_get_clock(&sca->sc_ports[0], 593 1.1 chopps flags & NTWOC_FLAGS_CLK0_MASK, tmc, rdiv, tdiv); 594 1.1 chopps if (sca->sc_numports > 1) 595 1.1 chopps ntwoc_isa_get_clock(&sca->sc_ports[1], 596 1.1 chopps (flags & NTWOC_FLAGS_CLK1_MASK) >> NTWOC_FLAGS_CLK1_SHIFT, 597 1.1 chopps tmc, rdiv, tdiv); 598 1.1 chopps 599 1.1 chopps ntwoc_isa_setup_memory(sca); 600 1.1 chopps 601 1.1 chopps sca_init(sca); 602 1.1 chopps 603 1.1 chopps /* attach configured ports */ 604 1.1 chopps sca_port_attach(sca, 0); 605 1.1 chopps if (sca->sc_numports == 2) 606 1.1 chopps sca_port_attach(sca, 1); 607 1.1 chopps 608 1.1 chopps /* 609 1.1 chopps * Add shutdown hook so that DMA is disabled prior to reboot. Not 610 1.1 chopps * doing do could allow DMA to corrupt kernel memory during the 611 1.1 chopps * reboot before the driver initializes. 612 1.1 chopps */ 613 1.1 chopps shutdownhook_establish(ntwoc_isa_shutdown, sc); 614 1.1 chopps 615 1.1 chopps #if __NetBSD_Version__ >= 104160000 616 1.1 chopps /* 617 1.1 chopps * defer getting the base clock until interrupts are enabled 618 1.1 chopps * (and thus we have microtime()) 619 1.1 chopps */ 620 1.1 chopps config_interrupts(self, ntwoc_isa_config_interrupts); 621 1.1 chopps #else 622 1.1 chopps /* no callback pre 1.4-mumble */ 623 1.1 chopps sca->sc_baseclock = SCA_BASECLOCK; 624 1.1 chopps sca_print_clock_info(&sc->sc_sca); 625 1.1 chopps #endif 626 1.1 chopps } 627 1.1 chopps 628 1.1 chopps /* 629 1.1 chopps * extract the clock information for a port from the flags field 630 1.1 chopps */ 631 1.1 chopps static void 632 1.1 chopps ntwoc_isa_get_clock(struct sca_port *scp, u_int8_t flags, u_int8_t tmc, 633 1.1 chopps u_int8_t rdiv, u_int8_t tdiv) 634 1.1 chopps { 635 1.1 chopps scp->sp_eclock = 636 1.1 chopps (flags & NTWOC_FLAGS_ECLOCK_MASK) >> NTWOC_FLAGS_ECLOCK_SHIFT; 637 1.1 chopps scp->sp_rxs = rdiv; 638 1.1 chopps scp->sp_txs = tdiv; 639 1.1 chopps scp->sp_tmc = tmc; 640 1.1 chopps 641 1.1 chopps /* get rx source */ 642 1.1 chopps switch ((flags & NTWOC_FLAGS_RXS_MASK) >> NTWOC_FLAGS_RXS_SHIFT) { 643 1.1 chopps case NTWOC_FLAGS_RXS_LINE: 644 1.1 chopps scp->sp_rxs = 0; 645 1.1 chopps break; 646 1.1 chopps case NTWOC_FLAGS_RXS_LINE_SN: 647 1.1 chopps scp->sp_rxs |= SCA_RXS_CLK_LINE_SN; 648 1.1 chopps break; 649 1.1 chopps case NTWOC_FLAGS_RXS_INTERNAL: 650 1.1 chopps scp->sp_rxs |= SCA_RXS_CLK_INTERNAL; 651 1.1 chopps break; 652 1.1 chopps case NTWOC_FLAGS_RXS_ADPLL_OUT: 653 1.1 chopps scp->sp_rxs |= SCA_RXS_CLK_ADPLL_OUT; 654 1.1 chopps break; 655 1.1 chopps case NTWOC_FLAGS_RXS_ADPLL_IN: 656 1.1 chopps scp->sp_rxs |= SCA_RXS_CLK_ADPLL_IN; 657 1.1 chopps break; 658 1.1 chopps default: 659 1.1 chopps panic("bad rx source in flags"); 660 1.1 chopps } 661 1.1 chopps 662 1.1 chopps /* get tx source */ 663 1.1 chopps switch ((flags & NTWOC_FLAGS_TXS_MASK) >> NTWOC_FLAGS_TXS_SHIFT) { 664 1.1 chopps case NTWOC_FLAGS_TXS_LINE: 665 1.1 chopps scp->sp_txs = 0; 666 1.1 chopps break; 667 1.1 chopps case NTWOC_FLAGS_TXS_INTERNAL: 668 1.1 chopps scp->sp_txs |= SCA_TXS_CLK_INTERNAL; 669 1.1 chopps break; 670 1.1 chopps case NTWOC_FLAGS_TXS_RXCLOCK: 671 1.1 chopps scp->sp_txs |= SCA_TXS_CLK_RXCLK; 672 1.1 chopps break; 673 1.1 chopps default: 674 1.1 chopps panic("bad rx source in flags"); 675 1.1 chopps } 676 1.1 chopps } 677 1.1 chopps 678 1.1 chopps 679 1.1 chopps static int 680 1.1 chopps ntwoc_isa_intr(void *arg) 681 1.1 chopps { 682 1.1 chopps struct ntwoc_isa_softc *sc = (struct ntwoc_isa_softc *)arg; 683 1.1 chopps 684 1.1 chopps return sca_hardintr(&sc->sc_sca); 685 1.1 chopps } 686 1.1 chopps 687 1.1 chopps /* 688 1.1 chopps * shut down interrupts and DMA, so we don't trash the kernel on warm 689 1.1 chopps * boot. Also, lower DTR on each port and disable card interrupts. 690 1.1 chopps */ 691 1.1 chopps static void 692 1.1 chopps ntwoc_isa_shutdown(void *aux) 693 1.1 chopps { 694 1.1 chopps struct ntwoc_isa_softc *sc = aux; 695 1.1 chopps u_int16_t mcr; 696 1.1 chopps 697 1.1 chopps /* 698 1.1 chopps * shut down the SCA ports 699 1.1 chopps */ 700 1.1 chopps sca_shutdown(&sc->sc_sca); 701 1.1 chopps 702 1.1 chopps /* 703 1.1 chopps * lower DTR on both ports 704 1.1 chopps */ 705 1.1 chopps mcr = bus_space_read_1(sc->sc_sca.sc_iot, sc->sc_sca.sc_ioh, NTWOC_MCR); 706 1.1 chopps mcr |= (NTWOC_MCR_DTR0 | NTWOC_MCR_DTR1); 707 1.1 chopps bus_space_write_1(sc->sc_sca.sc_iot, sc->sc_sca.sc_ioh, NTWOC_MCR, mcr); 708 1.22 dsl 709 1.22 dsl /* turn off the card */ 710 1.22 dsl bus_space_write_1(sc->sc_sca.sc_iot, sc->sc_sca.sc_ioh, NTWOC_PCR, 0); 711 1.1 chopps } 712 1.1 chopps 713 1.1 chopps static void 714 1.1 chopps ntwoc_isa_dtr_callback(void *aux, int port, int state) 715 1.1 chopps { 716 1.1 chopps struct ntwoc_isa_softc *sc = aux; 717 1.1 chopps u_int8_t mcr; 718 1.1 chopps 719 1.1 chopps mcr = bus_space_read_1(sc->sc_sca.sc_iot, sc->sc_sca.sc_ioh, NTWOC_MCR); 720 1.1 chopps 721 1.1 chopps NTWO_DPRINTF(("port == %d, state == %d, old mcr: 0x%02x\n", 722 1.1 chopps port, state, mcr)); 723 1.1 chopps 724 1.1 chopps if (port == 0) { 725 1.1 chopps if (state == 0) 726 1.1 chopps mcr |= NTWOC_MCR_DTR0; 727 1.1 chopps else 728 1.1 chopps mcr &= ~NTWOC_MCR_DTR0; 729 1.1 chopps } else { 730 1.1 chopps if (state == 0) 731 1.1 chopps mcr |= NTWOC_MCR_DTR1; 732 1.1 chopps else 733 1.1 chopps mcr &= ~NTWOC_MCR_DTR1; 734 1.1 chopps } 735 1.1 chopps 736 1.1 chopps NTWO_DPRINTF(("new mcr: 0x%02x\n", mcr)); 737 1.1 chopps 738 1.1 chopps bus_space_write_1(sc->sc_sca.sc_iot, sc->sc_sca.sc_ioh, NTWOC_MCR, mcr); 739 1.1 chopps } 740 1.1 chopps 741 1.1 chopps static void 742 1.1 chopps ntwoc_isa_clock_callback(void *aux, int port, int enable) 743 1.1 chopps { 744 1.1 chopps struct ntwoc_isa_softc *sc = aux; 745 1.1 chopps u_int8_t mcr; 746 1.1 chopps 747 1.1 chopps mcr = bus_space_read_1(sc->sc_sca.sc_iot, sc->sc_sca.sc_ioh, NTWOC_MCR); 748 1.1 chopps 749 1.1 chopps NTWO_DPRINTF(("clock: port == %d, enable == %d, old mcr: 0x%02x\n", 750 1.1 chopps port, enable, mcr)); 751 1.1 chopps 752 1.1 chopps if (port == 0) { 753 1.1 chopps if (enable == 0) 754 1.1 chopps mcr &= ~NTWOC_MCR_ETC0; 755 1.1 chopps else 756 1.1 chopps mcr |= NTWOC_MCR_ETC0; 757 1.1 chopps } else { 758 1.1 chopps if (enable == 0) 759 1.1 chopps mcr &= ~NTWOC_MCR_ETC1; 760 1.1 chopps else 761 1.1 chopps mcr |= NTWOC_MCR_ETC1; 762 1.1 chopps } 763 1.1 chopps 764 1.1 chopps NTWO_DPRINTF(("clock: new mcr: 0x%02x\n", mcr)); 765 1.1 chopps 766 1.1 chopps bus_space_write_1(sc->sc_sca.sc_iot, sc->sc_sca.sc_ioh, NTWOC_MCR, mcr); 767 1.1 chopps } 768 1.1 chopps 769 1.1 chopps static void 770 1.1 chopps ntwoc_isa_setup_memory(struct sca_softc *sc) 771 1.1 chopps { 772 1.1 chopps struct sca_port *scp; 773 1.1 chopps u_int i, j; 774 1.1 chopps 775 1.1 chopps /* allocate enough descriptors for a full page */ 776 1.1 chopps 777 1.1 chopps sc->sc_ports[0].sp_ntxdesc = (sc->scu_pagesize / SCA_BSIZE) - 1; 778 1.1 chopps sc->sc_ports[0].sp_nrxdesc = (sc->scu_pagesize / SCA_BSIZE) - 1; 779 1.1 chopps if (sc->sc_numports == 2) { 780 1.1 chopps sc->sc_ports[1].sp_ntxdesc = sc->sc_ports[0].sp_ntxdesc; 781 1.1 chopps sc->sc_ports[1].sp_nrxdesc = sc->sc_ports[0].sp_nrxdesc; 782 1.1 chopps } 783 1.1 chopps 784 1.1 chopps j = 0; 785 1.1 chopps for (i = 0; i < sc->sc_numports; i++) { 786 1.1 chopps scp = &sc->sc_ports[i]; 787 1.1 chopps scp->sp_txdesc_p = (bus_addr_t)(j * sc->scu_pagesize); 788 1.23 jakllsch scp->sp_txdesc = (void *)(uintptr_t)scp->sp_txdesc_p; 789 1.1 chopps scp->sp_txbuf_p = scp->sp_txdesc_p; 790 1.1 chopps scp->sp_txbuf_p += SCA_BSIZE; 791 1.23 jakllsch scp->sp_txbuf = (void *)(uintptr_t)scp->sp_txbuf_p; 792 1.1 chopps j++; 793 1.1 chopps 794 1.1 chopps scp->sp_rxdesc_p = (bus_addr_t)(j * sc->scu_pagesize); 795 1.23 jakllsch scp->sp_rxdesc = (void *)(uintptr_t)scp->sp_txdesc_p; 796 1.1 chopps scp->sp_rxbuf_p = scp->sp_rxdesc_p; 797 1.1 chopps scp->sp_rxbuf_p += SCA_BSIZE; 798 1.23 jakllsch scp->sp_rxbuf = (void *)(uintptr_t)scp->sp_rxbuf_p; 799 1.1 chopps j++; 800 1.1 chopps } 801 1.1 chopps } 802 1.1 chopps 803 1.1 chopps #if __NetBSD_Version__ >= 104160000 804 1.1 chopps /* 805 1.1 chopps * get the base clock frequency 806 1.1 chopps */ 807 1.1 chopps static void 808 1.21 cegger ntwoc_isa_config_interrupts(device_t self) 809 1.1 chopps { 810 1.1 chopps struct ntwoc_isa_softc *sc; 811 1.1 chopps 812 1.24 chs sc = device_private(self); 813 1.1 chopps sca_get_base_clock(&sc->sc_sca); 814 1.1 chopps sca_print_clock_info(&sc->sc_sca); 815 1.1 chopps } 816 1.1 chopps #endif 817