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

next in thread | previous in thread | raw e-mail | index | archive | help
In article <14226.34351.40295.87915G@mosra.prd.fc.nec.co.jp>
mihara@prd.fc.nec.co.jp writes:

>> I have tried to make 3COM Megahertz 10/100 LAN+56K Modem (3CCFEM556BI) 
>> (LAN side) work with FreeBSD 3.2 with PAO3, and succeed in it.   Here
>> I attach a patch for ep driver and an entry for /etc/pccard.conf.  You
>> need to add an pccard.conf entry, apply this patch in /sys/i386/isa,
>> rebuild kernel and reboot the system.  Of course, you need PAO3 system 
>> prior to make this patch.

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.

I used only 2bit address shift in accessing EEPROM and it worked on
3C574TX.  Perhaps there can be difference between 574 and 556.  If you
can, please test following patch on -current.

I'm using this patch with following pccard.conf entry.

# 3Com Fast Etherlink 3C574TX
card "3Com" "3C574-TX Fast EtherLink PC Ca"
	config	0x1 "ep0" ? 0x1
	insert	echo 3Com Etherlink III inserted
	insert	/etc/pccard_ether ep0
	remove	echo 3Com Etherlink III removed
	remove	/sbin/ifconfig ep0 delete

Please note that this entry only works on -current pccardd with the
bug-fixes I committed today.  Please get the latest -current before
testing this code.

I want to merge it to -current soon!

Okay, the patch follows:

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 15:08:43
@@ -193,13 +193,21 @@
     /* 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);
 
-    /* 3C589's product id? */
-    if (epb->prod_id != 0x9058) {
+    /* product id */
+    switch (epb->prod_id) {
+      case 0x6055: /* 3C556 */
+      case 0x4057: /* 3C574 */
+      case 0x9058: /* 3C589 */
+	break;
+      default:
 	printf("ep%d: failed to come ready.\n", is->id_unit);
 	return (ENXIO);
     }
@@ -232,7 +240,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 +252,19 @@
 
     outw(BASE + EP_W0_PRODUCT_ID, sc->epb->prod_id);
 
+   /*
+    * 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 +438,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 15:08:44
@@ -86,6 +86,7 @@
 				/* 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) */
 	u_short res_cfg;	/* resource configuration */
 };
 
@@ -221,6 +222,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 +463,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?199907231521.AAA02396>