Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 24 Jul 1999 07:52:42 +0900 (JST)
From:      hosokawa@itc.keio.ac.jp (HOSOKAWA Tatsumi)
To:        hosokawa@itc.keio.ac.jp
Cc:        mihara@prd.fc.nec.co.jp, mobile@freebsd.org, hosokawa@itc.keio.ac.jp
Subject:   Re: 3C574TX for -current (Re: 3COM Megahertz 10/100 LAN+56K Modem (3CCFEM556BI))
Message-ID:  <199907232252.HAA05999@afs.ntc.mita.keio.ac.jp>
In-Reply-To: Your message of "Sat, 24 Jul 1999 00:21:52 JST". <199907231521.AAA02396@afs.ntc.mita.keio.ac.jp>

next in thread | previous in thread | raw e-mail | index | archive | help
In article <199907231521.AAA02396@afs.ntc.mita.keio.ac.jp>
hosokawa@itc.keio.ac.jp writes:

>> I merged it into if_ep driver and it worked on 3C574TX (I think my
>> patch does not break anything for other ep cards), but it did not work
>> when I added offset 0x10 to the I/O address when accessing window 1
>> like your code does.

Oops, sorry, my last patch always try to enable MII transciever.
Following new patch does not.  I tested it also with 3C589B.

Index: if_ep.c
===================================================================
RCS file: /home/ncvs/src/sys/i386/isa/if_ep.c,v
retrieving revision 1.80
diff -u -r1.80 if_ep.c
--- if_ep.c	1999/07/06 19:22:46	1.80
+++ if_ep.c	1999/07/23 22:48:03
@@ -193,13 +193,24 @@
     /* get_e() requires these. */
     sc->ep_io_addr = is->id_iobase;
     sc->unit = is->id_unit;
+    epb->cmd_off = 0;
+    if (is->id_flags & EP_FLAGS_100TX) 
+	epb->cmd_off = 2;
 
     epb->epb_addr = is->id_iobase;
     epb->epb_used = 1;
     epb->prod_id = get_e(sc, EEPROM_PROD_ID);
+    epb->mii_trans = 0;
 
-    /* 3C589's product id? */
-    if (epb->prod_id != 0x9058) {
+    /* product id */
+    switch (epb->prod_id) {
+      case 0x6055: /* 3C556 */
+      case 0x4057: /* 3C574 */
+	epb->mii_trans = 1;
+	break;
+      case 0x9058: /* 3C589 */
+	break;
+      default:
 	printf("ep%d: failed to come ready.\n", is->id_unit);
 	return (ENXIO);
     }
@@ -232,7 +243,7 @@
 	sc->ep_connectors |= UTP;
     }
     if (!(sc->ep_connectors & 7))
-	printf("no connectors!");
+	printf("ep%d: No connectors or MII.\n", is->id_unit);
     sc->ep_connector = inw(BASE + EP_W0_ADDRESS_CFG) >> ACF_CONNECTOR_BITS;
 
     /* ROM size = 0, ROM base = 0 */
@@ -244,6 +255,21 @@
 
     outw(BASE + EP_W0_PRODUCT_ID, sc->epb->prod_id);
 
+    if (sc->epb->mii_trans) {
+	/*
+	 * turn on the MII tranceiver
+	 */
+	GO_WINDOW(3);
+	outw(BASE + EP_W3_OPTIONS, 0x8040);
+	DELAY(1000);
+	outw(BASE + EP_W3_OPTIONS, 0xc040);
+	outw(BASE + EP_COMMAND, RX_RESET);
+	outw(BASE + EP_COMMAND, TX_RESET);
+	while (inw(BASE + EP_STATUS) & S_COMMAND_IN_PROGRESS);
+	DELAY(1000);
+	outw(BASE + EP_W3_OPTIONS, 0x8040);
+    }
+
     ep_attach(sc);
 
     return 1;
@@ -417,7 +443,7 @@
 {
     if (!eeprom_rdy(sc))
 	return (0xffff);
-    outw(BASE + EP_W0_EEPROM_COMMAND, EEPROM_CMD_RD | offset);
+    outw(BASE + EP_W0_EEPROM_COMMAND, (EEPROM_CMD_RD << sc->epb->cmd_off) | offset);
     if (!eeprom_rdy(sc))
 	return (0xffff);
     return (inw(BASE + EP_W0_EEPROM_DATA));
Index: if_epreg.h
===================================================================
RCS file: /home/ncvs/src/sys/i386/isa/if_epreg.h,v
retrieving revision 1.23
diff -u -r1.23 if_epreg.h
--- if_epreg.h	1998/04/17 22:36:35	1.23
+++ if_epreg.h	1999/07/23 22:48:04
@@ -86,6 +86,8 @@
 				/* data from EEPROM for later use */
 	u_short eth_addr[3];	/* Ethernet address */
 	u_short prod_id;	/* product ID */
+	int	cmd_off;	/* command offset (bit shift) */
+	int	mii_trans;	/* activate MII transiever */
 	u_short res_cfg;	/* resource configuration */
 };
 
@@ -221,6 +223,7 @@
 /* Read */
 #define EP_W3_FREE_TX		0x0c
 #define EP_W3_FREE_RX		0x0a
+#define EP_W3_OPTIONS		0x08
 
 /*
  * Window 4 registers. Diagnostics.
@@ -461,3 +464,8 @@
 extern 	int ep_attach __P((struct ep_softc *sc));
 
 extern	u_int16_t get_e __P((struct ep_softc *sc, int offset));
+
+/*
+ * Config flags
+ */
+#define EP_FLAGS_100TX			0x1
--
HOSOKAWA, Tatsumi
Assistant Manager
Information Technology Center, Keio University
<hosokawa@itc.keio.ac.jp>


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-mobile" in the body of the message




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