diff options
| author | Brandon Bergren <bdragon@FreeBSD.org> | 2020-06-14 16:47:16 +0000 |
|---|---|---|
| committer | Brandon Bergren <bdragon@FreeBSD.org> | 2020-06-14 16:47:16 +0000 |
| commit | a4ec123c569adc860c69827bc54c306b333c924b (patch) | |
| tree | fc4051a3b089119af8f0ae19db0403625b009a84 /sys/dev/scc | |
| parent | b231bff8b263f40dee4018677afdd4c766a8e0aa (diff) | |
Notes
Diffstat (limited to 'sys/dev/scc')
| -rw-r--r-- | sys/dev/scc/scc_bfe.h | 3 | ||||
| -rw-r--r-- | sys/dev/scc/scc_bfe_macio.c | 3 | ||||
| -rw-r--r-- | sys/dev/scc/scc_dev_z8530.c | 28 |
3 files changed, 29 insertions, 5 deletions
diff --git a/sys/dev/scc/scc_bfe.h b/sys/dev/scc/scc_bfe.h index d6ddd6775a3c..0b7f91f83f99 100644 --- a/sys/dev/scc/scc_bfe.h +++ b/sys/dev/scc/scc_bfe.h @@ -114,7 +114,8 @@ struct scc_class { extern struct scc_class scc_quicc_class; extern struct scc_class scc_sab82532_class; -extern struct scc_class scc_z8530_class; +extern struct scc_class scc_z8530_escc_class; +extern struct scc_class scc_z8530_legacy_class; struct scc_softc { KOBJ_FIELDS; diff --git a/sys/dev/scc/scc_bfe_macio.c b/sys/dev/scc/scc_bfe_macio.c index 51a8ed61f0f5..241f6c072a2c 100644 --- a/sys/dev/scc/scc_bfe_macio.c +++ b/sys/dev/scc/scc_bfe_macio.c @@ -55,9 +55,10 @@ scc_macio_probe(device_t dev) sc = device_get_softc(dev); nm = ofw_bus_get_name(dev); + /* Attach to modern escc (channel shift 4 bits) */ if (!strcmp(nm, "escc")) { device_set_desc(dev, "Zilog Z8530 dual channel SCC"); - sc->sc_class = &scc_z8530_class; + sc->sc_class = &scc_z8530_escc_class; return (scc_bfe_probe(dev, MACIO_REGSHFT, MACIO_RCLK, 0)); } return (ENXIO); diff --git a/sys/dev/scc/scc_dev_z8530.c b/sys/dev/scc/scc_dev_z8530.c index 193ed7184e86..6255ebd06c7c 100644 --- a/sys/dev/scc/scc_dev_z8530.c +++ b/sys/dev/scc/scc_dev_z8530.c @@ -51,6 +51,10 @@ static int z8530_bfe_iclear(struct scc_softc *, struct scc_chan *); static int z8530_bfe_ipend(struct scc_softc *); static int z8530_bfe_probe(struct scc_softc *); +/* Channel B is always at 0 offset. */ +#define CHAN_A (-(sc->sc_class->cl_range)) +#define CHAN_B 0 + static kobj_method_t z8530_methods[] = { KOBJMETHOD(scc_attach, z8530_bfe_attach), KOBJMETHOD(scc_iclear, z8530_bfe_iclear), @@ -59,14 +63,32 @@ static kobj_method_t z8530_methods[] = { KOBJMETHOD_END }; -struct scc_class scc_z8530_class = { - "z8530 class", +/* + * escc (macio) spacing. + */ +struct scc_class scc_z8530_escc_class = { + "z8530 escc class", + z8530_methods, + sizeof(struct scc_softc), + .cl_channels = 2, + .cl_class = SCC_CLASS_Z8530, + .cl_modes = SCC_MODE_ASYNC | SCC_MODE_BISYNC | SCC_MODE_HDLC, + /* Negative .cl_range signifies this is channel spacing. */ + .cl_range = (CHAN_B - 16), +}; + +/* + * SUN compatible channel spacing. + */ +struct scc_class scc_z8530_legacy_class = { + "z8530 legacy class", z8530_methods, sizeof(struct scc_softc), .cl_channels = 2, .cl_class = SCC_CLASS_Z8530, .cl_modes = SCC_MODE_ASYNC | SCC_MODE_BISYNC | SCC_MODE_HDLC, - .cl_range = CHAN_B - CHAN_A, + /* Negative .cl_range signifies this is channel spacing. */ + .cl_range = (CHAN_B - 2), }; /* Multiplexed I/O. */ |
