diff --git a/sys/dev/scc/scc_dev_quicc.c b/sys/dev/scc/scc_dev_quicc.c index 6f337b8c453e..e2fdb628b633 100644 --- a/sys/dev/scc/scc_dev_quicc.c +++ b/sys/dev/scc/scc_dev_quicc.c @@ -27,13 +27,10 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); -#define __RMAN_RESOURCE_VISIBLE - #include <sys/param.h> #include <sys/systm.h> #include <sys/bus.h> #include <sys/conf.h> -#include <sys/endian.h> #include <machine/bus.h> #include <sys/rman.h> #include <sys/serial.h> @@ -63,7 +60,7 @@ static kobj_method_t quicc_methods[] = { KOBJMETHOD(scc_iclear, quicc_bfe_iclear), KOBJMETHOD(scc_ipend, quicc_bfe_ipend), KOBJMETHOD(scc_probe, quicc_bfe_probe), - { 0, 0 } + KOBJMETHOD_END }; struct scc_class scc_quicc_class = { @@ -77,11 +74,9 @@ struct scc_class scc_quicc_class = { }; static int -quicc_bfe_attach(struct scc_softc *sc, int reset) +quicc_bfe_attach(struct scc_softc *sc __unused, int reset __unused) { - struct scc_bas *bas; - bas = &sc->sc_bas; return (0); } @@ -104,7 +99,18 @@ quicc_bfe_enabled(struct scc_softc *sc, struct scc_chan *ch) static int quicc_bfe_iclear(struct scc_softc *sc, struct scc_chan *ch) { + struct scc_bas *bas; + uint16_t rb, st; + bas = &sc->sc_bas; + mtx_lock_spin(&sc->sc_hwmtx); + if (ch->ch_ipend & SER_INT_RXREADY) { + rb = quicc_read2(bas, QUICC_PRAM_SCC_RBASE(ch->ch_nr - 1)); + st = quicc_read2(bas, rb); + (void)quicc_read4(bas, rb + 4); + quicc_write2(bas, rb, st | 0x9000); + } + mtx_unlock_spin(&sc->sc_hwmtx); return (0); } @@ -142,10 +148,8 @@ quicc_bfe_ipend(struct scc_softc *sc) } static int -quicc_bfe_probe(struct scc_softc *sc) +quicc_bfe_probe(struct scc_softc *sc __unused) { - struct scc_bas *bas; - bas = &sc->sc_bas; return (0); } diff --git a/sys/dev/scc/scc_dev_sab82532.c b/sys/dev/scc/scc_dev_sab82532.c index f8845c517cf3..bbc8bd4b9812 100644 --- a/sys/dev/scc/scc_dev_sab82532.c +++ b/sys/dev/scc/scc_dev_sab82532.c @@ -52,7 +52,7 @@ static kobj_method_t sab82532_methods[] = { KOBJMETHOD(scc_iclear, sab82532_bfe_iclear), KOBJMETHOD(scc_ipend, sab82532_bfe_ipend), KOBJMETHOD(scc_probe, sab82532_bfe_probe), - { 0, 0 } + KOBJMETHOD_END }; struct scc_class scc_sab82532_class = { @@ -66,18 +66,37 @@ struct scc_class scc_sab82532_class = { }; static int -sab82532_bfe_attach(struct scc_softc *sc, int reset) +sab82532_bfe_attach(struct scc_softc *sc __unused, int reset __unused) { - struct scc_bas *bas; - bas = &sc->sc_bas; return (0); } static int sab82532_bfe_iclear(struct scc_softc *sc, struct scc_chan *ch) { + struct scc_bas *bas; + int i, ofs, rbcl; + bas = &sc->sc_bas; + ofs = (ch->ch_nr - 1) * SAB_CHANLEN; + mtx_lock_spin(&sc->sc_hwmtx); + if (ch->ch_ipend & SER_INT_RXREADY) { + if (scc_getreg(bas, ofs + SAB_STAR) & SAB_STAR_RFNE) { + rbcl = scc_getreg(bas, ofs + SAB_RBCL) & 31; + if (rbcl == 0) + rbcl = 32; + for (i = 0; i < rbcl; i += 2) { + (void)scc_getreg(bas, ofs + SAB_RFIFO); + (void)scc_getreg(bas, ofs + SAB_RFIFO + 1); + } + } + while (scc_getreg(bas, ofs + SAB_STAR) & SAB_STAR_CEC) + ; + scc_setreg(bas, ofs + SAB_CMDR, SAB_CMDR_RMC); + scc_barrier(bas); + } + mtx_unlock_spin(&sc->sc_hwmtx); return (0); } @@ -124,10 +143,8 @@ sab82532_bfe_ipend(struct scc_softc *sc) } static int -sab82532_bfe_probe(struct scc_softc *sc) +sab82532_bfe_probe(struct scc_softc *sc __unused) { - struct scc_bas *bas; - bas = &sc->sc_bas; return (0); } diff --git a/sys/dev/scc/scc_dev_z8530.c b/sys/dev/scc/scc_dev_z8530.c index 3d63c227b248..0920d45bec45 100644 --- a/sys/dev/scc/scc_dev_z8530.c +++ b/sys/dev/scc/scc_dev_z8530.c @@ -52,7 +52,7 @@ static kobj_method_t z8530_methods[] = { KOBJMETHOD(scc_iclear, z8530_bfe_iclear), KOBJMETHOD(scc_ipend, z8530_bfe_ipend), KOBJMETHOD(scc_probe, z8530_bfe_probe), - { 0, 0 } + KOBJMETHOD_END }; struct scc_class scc_z8530_class = { @@ -85,11 +85,9 @@ scc_getmreg(struct scc_bas *bas, int ch, int reg) } static int -z8530_bfe_attach(struct scc_softc *sc, int reset) +z8530_bfe_attach(struct scc_softc *sc __unused, int reset __unused) { - struct scc_bas *bas; - bas = &sc->sc_bas; return (0); } @@ -189,10 +187,8 @@ z8530_bfe_ipend(struct scc_softc *sc) } static int -z8530_bfe_probe(struct scc_softc *sc) +z8530_bfe_probe(struct scc_softc *sc __unused) { - struct scc_bas *bas; - bas = &sc->sc_bas; return (0); }