Lines Matching defs:sca
84 struct sca_softc sc_sca; /* the SCA itself */
113 * functions that read and write to the sca registers
149 ntwoc_isa_set_page(struct sca_softc *sca, bus_addr_t addr)
154 psr = bus_space_read_1(sca->sc_iot, sca->sc_ioh, NTWOC_PSR);
156 psr |= ((addr >> sca->scu_pageshift) & NTWOC_PG_MSK);
157 bus_space_write_1(sca->sc_iot, sca->sc_ioh, NTWOC_PSR, psr);
164 ntwoc_isa_set_on(struct sca_softc *sca)
169 pcr = bus_space_read_1(sca->sc_iot, sca->sc_ioh, NTWOC_PCR);
171 bus_space_write_1(sca->sc_iot, sca->sc_ioh, NTWOC_PCR, pcr);
178 ntwoc_isa_set_off(struct sca_softc *sca)
183 pcr = bus_space_read_1(sca->sc_iot, sca->sc_ioh, NTWOC_PCR);
185 bus_space_write_1(sca->sc_iot, sca->sc_ioh, NTWOC_PCR, pcr);
250 "ntwoc_isa_probe: mapping sca 0x%x sz %d failed: %d\n",
286 * Now see if we can see the SCA.
298 printf("ntwoc_isa_probe: Error reading SCA (TMC0 0, %x)\n",
308 printf("ntwoc_isa_probe: Error reading SCA (TMC0 5A, %x)\n",
317 printf("ntwoc_isa_probe: Error reading SCA (CDAL0 0, %x)\n",
326 printf("ntwoc_isa_probe: Error reading SCA (CDAL0 55AA, %x)\n",
340 printf("ntwoc_isa_probe: Error reading SCA (TCNTL0 0, %x)\n",
349 printf("ntwoc_isa_probe: Error reading SCA (TCNTL0 55AA, %x)\n",
387 struct sca_softc *sca;
397 sca = &sc->sc_sca;
403 sca->sc_parent = sc->sc_dev;
404 sca->sc_numports = (flags & NTWOC_FLAGS_NPORT_MASK) + 1;
405 sca->sc_usedma = 0;
406 sca->sc_aux = sc;
407 sca->sc_dtr_callback = ntwoc_isa_dtr_callback;
408 sca->sc_clock_callback = ntwoc_isa_clock_callback;
409 sca->sc_read_1 = ntwoc_isa_sca_read_1;
410 sca->sc_read_2 = ntwoc_isa_sca_read_2;
411 sca->sc_write_1 = ntwoc_isa_sca_write_1;
412 sca->sc_write_2 = ntwoc_isa_sca_write_2;
413 sca->scu_set_page = ntwoc_isa_set_page;
414 sca->scu_page_on = ntwoc_isa_set_on;
415 sca->scu_page_off = ntwoc_isa_set_off;
418 sca->sc_iot = ia->ia_iot;
420 NTWOC_SRC_IOPORT_SIZE, 0, &sca->sc_ioh))) {
431 &sca->scu_sca_ioh[i]))) {
433 "mapping sca 0x%x sz %d failed: %d\n",
440 sca->scu_memt = ia->ia_memt;
441 sca->scu_pagesize = 0x4000; /* force 16k for now */
442 if (sca->scu_pagesize < 0x8000) {
444 sca->scu_pagesize = 0x4000;
445 sca->scu_pageshift = 14;
447 } else if (sca->scu_pagesize < 0x10000) {
449 sca->scu_pagesize = 0x8000;
450 sca->scu_pageshift = 15;
452 } else if (sca->scu_pagesize < 0x20000) {
454 sca->scu_pagesize = 0x10000;
455 sca->scu_pageshift = 16;
458 sca->scu_pagesize = 0x20000;
459 sca->scu_pageshift = 17;
462 sca->scu_pagemask = sca->scu_pagesize - 1;
464 sca->scu_pagesize, 0, &sca->scu_memh))) {
467 (u_long)sca->scu_pagesize, rv);
472 bus_space_write_1(sca->sc_iot, sca->sc_ioh, NTWOC_PCR,
473 bus_space_read_1(sca->sc_iot, sca->sc_ioh, NTWOC_PCR)
477 bus_space_write_1(sca->sc_iot, sca->sc_ioh, NTWOC_PSR, tmp);
480 bus_space_write_1(sca->sc_iot, sca->sc_ioh, NTWOC_MCR,
486 bus_space_write_1(sca->sc_iot, sca->sc_ioh, NTWOC_PCR,
487 bus_space_read_1(sca->sc_iot, sca->sc_ioh, NTWOC_PCR)
490 bus_space_write_1(sca->sc_iot, sca->sc_ioh, NTWOC_PCR,
491 bus_space_read_1(sca->sc_iot, sca->sc_ioh, NTWOC_PCR)
495 bus_space_write_1(sca->sc_iot, sca->sc_ioh, NTWOC_PCR,
498 (bus_space_read_1(sca->sc_iot, sca->sc_ioh, NTWOC_PCR)
500 bus_space_write_1(sca->sc_iot, sca->sc_ioh, NTWOC_BAR,
504 ntwoc_isa_set_on(sca);
511 for (i = 0; i <= NTWOC_PSR_PG_SEL; addr += sca->scu_pagesize, i++) {
513 ntwoc_isa_set_page(sca, addr);
514 bus_space_write_2(sca->scu_memt, sca->scu_memh, 0, 0xAA55);
522 for (i = 0; i <= NTWOC_PSR_PG_SEL; addr += sca->scu_pagesize, i++) {
523 ntwoc_isa_set_page(sca, addr);
525 tmp = bus_space_read_2(sca->scu_memt, sca->scu_memh, 0);
530 bus_space_write_2(sca->scu_memt, sca->scu_memh, 0, i);
532 sca->scu_npages = pgs = i; /* final count of 16K pages */
536 for (i = 0; i <= pgs; addr += sca->scu_pagesize, i++) {
537 ntwoc_isa_set_page(sca, addr);
538 bus_space_set_region_1(sca->scu_memt, sca->scu_memh, 0, 0,
539 sca->scu_pagesize);
543 printf("%s: sca port 0x%x-0x%x dpram %ldk %d serial port%s\n",
546 pgs * (sca->scu_pagesize / 1024), sca->sc_numports,
547 (sca->sc_numports > 1 ? "s" : ""));
550 device_xname(sc->sc_dev), (u_long)pgs * (sca->scu_pagesize / 1024),
551 sca->sc_numports, (sca->sc_numports > 1 ? "s" : ""));
555 ntwoc_isa_set_off(sca);
557 /* enabled sca DMA */
558 bus_space_write_1(sca->sc_iot, sca->sc_ioh, NTWOC_PSR,
559 bus_space_read_1(sca->sc_iot, sca->sc_ioh, NTWOC_PSR)
571 if (pgs < 2 * sca->sc_numports) {
574 pgs, 2 * sca->sc_numports);
578 /* sca_get_base_clock(sca); */
592 ntwoc_isa_get_clock(&sca->sc_ports[0],
594 if (sca->sc_numports > 1)
595 ntwoc_isa_get_clock(&sca->sc_ports[1],
599 ntwoc_isa_setup_memory(sca);
601 sca_init(sca);
604 sca_port_attach(sca, 0);
605 if (sca->sc_numports == 2)
606 sca_port_attach(sca, 1);
623 sca->sc_baseclock = SCA_BASECLOCK;
698 * shut down the SCA ports