Index: sys/dev/ic/z8530.h =================================================================== --- sys/dev/ic/z8530.h +++ sys/dev/ic/z8530.h @@ -32,16 +32,15 @@ #define _DEV_IC_Z8530_H_ /* - * Channel B control: 0 - * Channel B data: 1 - * Channel A control: 2 - * Channel A data: 3 + * legacy: SUN compatible + * escc: Macintosh + * legacy escc + * Channel B control: 0 0 + * Channel B data: 1 1 + * Channel A control: 2 16 + * Channel A data: 3 17 */ -/* The following apply when using a device-scoped bus handle */ -#define CHAN_A 2 -#define CHAN_B 0 - #define REG_CTRL 0 #define REG_DATA 1 Index: sys/dev/scc/scc_bfe.h =================================================================== --- sys/dev/scc/scc_bfe.h +++ sys/dev/scc/scc_bfe.h @@ -114,7 +114,8 @@ 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; Index: sys/dev/scc/scc_bfe_macio.c =================================================================== --- sys/dev/scc/scc_bfe_macio.c +++ sys/dev/scc/scc_bfe_macio.c @@ -55,9 +55,10 @@ 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); Index: sys/dev/scc/scc_dev_z8530.c =================================================================== --- sys/dev/scc/scc_dev_z8530.c +++ sys/dev/scc/scc_dev_z8530.c @@ -51,6 +51,10 @@ 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,16 +63,34 @@ 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, - .cl_range = CHAN_B - CHAN_A, + /* 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, + /* Negative .cl_range signifies this is channel spacing. */ + .cl_range = (CHAN_B - 2), +}; + /* Multiplexed I/O. */ static __inline uint8_t scc_getmreg(struct scc_bas *bas, int ch, int reg)