Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Apr 2006 01:27:22 GMT
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 96178 for review
Message-ID:  <200604270127.k3R1RMbA095467@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=96178

Change 96178 by marcel@marcel_nfs on 2006/04/27 01:27:20

	Setup the Winbond W83877TFs on Syba Techs Multi-I/O card.

Affected files ...

.. //depot/projects/uart/dev/puc/pucdata.c#31 edit

Differences ...

==== //depot/projects/uart/dev/puc/pucdata.c#31 (text+ko) ====

@@ -820,23 +820,67 @@
 puc_config_syba(struct puc_softc *sc, enum puc_cfg_cmd cmd, int port,
     intptr_t *res)
 {
+	static int base[] = { 0x251, 0x3f0, 0 };
+	const struct puc_cfg *cfg = sc->sc_cfg;
+	struct puc_bar *bar;
+	int efir, idx, ofs;
+	uint8_t v;
+
 	switch (cmd) {
+	case PUC_CFG_SETUP:
+		bar = puc_get_bar(sc, cfg->rid);
+		if (bar == NULL)
+			return (ENXIO);
+
+		/* configure both W83877TFs */
+		bus_write_1(bar->b_res, 0x250, 0x89);
+		bus_write_1(bar->b_res, 0x3f0, 0x87);
+		bus_write_1(bar->b_res, 0x3f0, 0x87);
+		idx = 0;
+		while (base[idx] != 0) {
+			efir = base[idx];
+			bus_write_1(bar->b_res, efir, 0x09);
+			v = bus_read_1(bar->b_res, efir + 1);
+			if ((v & 0x0f) != 0x0c)
+				return (ENXIO);
+			bus_write_1(bar->b_res, efir, 0x16);
+			v = bus_read_1(bar->b_res, efir + 1);
+			bus_write_1(bar->b_res, efir, 0x16);
+			bus_write_1(bar->b_res, efir + 1, v | 0x04);
+			bus_write_1(bar->b_res, efir, 0x16);
+			bus_write_1(bar->b_res, efir + 1, v & ~0x04);
+			ofs = base[idx] & 0x300;
+			bus_write_1(bar->b_res, efir, 0x23);
+			bus_write_1(bar->b_res, efir + 1, (ofs + 0x78) >> 2);
+			bus_write_1(bar->b_res, efir, 0x24);
+			bus_write_1(bar->b_res, efir + 1, (ofs + 0xf8) >> 2);
+			bus_write_1(bar->b_res, efir, 0x25);
+			bus_write_1(bar->b_res, efir + 1, (ofs + 0xe8) >> 2);
+			bus_write_1(bar->b_res, efir, 0x17);
+			bus_write_1(bar->b_res, efir + 1, 0x03);
+			bus_write_1(bar->b_res, efir, 0x28);
+			bus_write_1(bar->b_res, efir + 1, 0x43);
+			idx++;
+		}
+		bus_write_1(bar->b_res, 0x250, 0xaa);
+		bus_write_1(bar->b_res, 0x3f0, 0xaa);
+		return (0);
 	case PUC_CFG_GET_OFS:
 		switch (port) {
 		case 0:
-			*res = 0x3f8;
+			*res = 0x2f8;
 			return (0);
 		case 1:
-			*res = 0x2f8;
+			*res = 0x2e8;
 			return (0);
 		case 2:
-			*res = 0x3e8;
+			*res = 0x3f8;
 			return (0);
 		case 3:
-			*res = 0x2e8;
+			*res = 0x3e8;
 			return (0);
 		case 4:
-			*res = 0;
+			*res = 0x278;
 			return (0);
 		}
 		break;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200604270127.k3R1RMbA095467>