Subject: port-i386/4127: the de driver doesn't work with the ACCTON EN1207 BNC port
To: None <gnats-bugs@gnats.netbsd.org>
From: None <spz@sagitta.swb.de>
List: netbsd-bugs
Date: 09/20/1997 21:52:22
>Number:         4127
>Category:       port-i386
>Synopsis:       the de driver doesn't work with the ACCTON EN1207 BNC port
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat Sep 20 13:05:02 1997
>Last-Modified:
>Originator:     S.P.Zeidler
>Organization:
	dis-
>Release:        NetBSD-current 28/8/97
>Environment:
	
System: NetBSD sagitta.swb.de 1.2G NetBSD 1.2G (SAGITTA) #7: Sat Sep 20 20:51:17 MEST 1997 spz@sagitta.swb.de:/data/syssrc/sys/arch/i386/compile/SAGITTA i386


>Description:
	The if_de ethernet driver doesn't allow switching to BNC port
        for the ACCTON EN1207 ethernet card.
>How-To-Repeat:
	ifconfig -m de0
>Fix:
	The following fix makes the card work on BNC. I have not tested it
        on UTP or 100baseTX. Also the usage of gpdata might be somewhat
        fishy, it does get the neccessary data into the neccessary registers
        though. The values to tell the card have been taken from 
        http://cesdis.gsfc.nasa.gov/linux/drivers/tulip.html.
        
        The entry for the other ACCTON card is guesswork, I've not
        even found out yet if it uses tulip chips at all. If it does
        the 1203 is most probably a 2104x. 

*** if_devar.h	Sat Sep 20 19:45:25 1997
--- if_devar.h.orig	Sun Sep 14 14:55:01 1997
***************
*** 334,340 ****
      TULIP_21140_COGENT_EM100,		/* Cogent EM100 100 only */
      TULIP_21140_ZNYX_ZX34X,		/* ZNYX ZX342 10/100 */
      TULIP_21140_ASANTE,			/* AsanteFast 10/100 */
-     TULIP_21140_EN1207,			/* ACCTON EN1207 10/100/BNC */
      TULIP_21041_GENERIC			/* Generic 21041 card */
  } tulip_board_t;
  
--- 334,339 ----
*** dc21040reg.h	Sat Sep 20 19:45:16 1997
--- dc21040reg.h.orig	Sun Sep 14 15:11:46 1997
***************
*** 435,457 ****
  #define TULIP_GP_ASANTE_PHYRESET	0x00000008	/* Reset PHY */
  
  /*
-  * ACCTON EN1207 specialties
-  */
- 
- #define TULIP_OUI_EN1207_0		0x00
- #define TULIP_OUI_EN1207_1		0x00
- #define TULIP_OUI_EN1207_2		0xE8
- 
- #define TULIP_CSR8_EN1207		0x08
- #define TULIP_CSR9_EN1207		0x00
- #define TULIP_CSR10_EN1207		0x03
- #define TULIP_CSR11_EN1207		0x1F
- 
- #define TULIP_GP_EN1207_BNC_INIT        0x0000011B
- #define TULIP_GP_EN1207_UTP_INIT        0x9E00000B
- #define TULIP_GP_EN1207_100_INIT        0x6D00031B
- 
- /*
   * SROM definitions for the 21140 and 21041.
   */
  #define	SROMXREG	0x0400
--- 435,440 ----
*** if_de.c	Sat Sep 20 21:03:56 1997
--- if_de.c.orig	Sat Sep 20 11:11:37 1997
***************
*** 1616,1675 ****
  };
  
  static void
- tulip_21140_accton_media_probe(
-     tulip_softc_t * const sc)
- {
-     tulip_media_info_t *mip = sc->tulip_mediainfo;
-     unsigned gpdata;
- 
-     sc->tulip_gpinit = TULIP_GP_EB_PINS;
-     sc->tulip_gpdata = TULIP_GP_EB_INIT;
-     TULIP_CSR_WRITE(sc, csr_gp, TULIP_GP_EB_PINS);
-     TULIP_CSR_WRITE(sc, csr_gp, TULIP_GP_EB_INIT);
-     TULIP_CSR_WRITE(sc, csr_command,
- 	TULIP_CSR_READ(sc, csr_command) | TULIP_CMD_PORTSELECT |
- 	TULIP_CMD_PCSFUNCTION | TULIP_CMD_SCRAMBLER | TULIP_CMD_MUSTBEONE);
-     TULIP_CSR_WRITE(sc, csr_command,
- 	TULIP_CSR_READ(sc, csr_command) & ~TULIP_CMD_TXTHRSHLDCTL);
-     DELAY(1000000);
-     gpdata = TULIP_CSR_READ(sc, csr_gp);
-     if ((gpdata & TULIP_GP_EN1207_UTP_INIT) == 0) {
- 	sc->tulip_media = TULIP_MEDIA_10BASET;
-     } else {
- 	if ((gpdata & TULIP_GP_EN1207_BNC_INIT) == 0) {
- 		sc->tulip_media = TULIP_MEDIA_BNC;
-         } else {
- 		sc->tulip_media = TULIP_MEDIA_100BASETX;
-         }
-     }
-     tulip_21140_mediainit(sc, mip++, TULIP_MEDIA_BNC,
- 			  TULIP_GP_EN1207_BNC_INIT,
- 			  TULIP_CMD_TXTHRSHLDCTL);
-     tulip_21140_mediainit(sc, mip++, TULIP_MEDIA_10BASET,
- 			  TULIP_GP_EN1207_UTP_INIT,
- 			  TULIP_CMD_TXTHRSHLDCTL);
-     tulip_21140_mediainit(sc, mip++, TULIP_MEDIA_10BASET_FD,
- 			  TULIP_GP_EN1207_UTP_INIT,
- 			  TULIP_CMD_TXTHRSHLDCTL|TULIP_CMD_FULLDUPLEX);
-     tulip_21140_mediainit(sc, mip++, TULIP_MEDIA_100BASETX,
- 			  TULIP_GP_EN1207_100_INIT,
- 			  TULIP_CMD_PORTSELECT|TULIP_CMD_PCSFUNCTION
- 			      |TULIP_CMD_SCRAMBLER);
-     tulip_21140_mediainit(sc, mip++, TULIP_MEDIA_100BASETX_FD,
- 			  TULIP_GP_EN1207_100_INIT,
- 			  TULIP_CMD_PORTSELECT|TULIP_CMD_PCSFUNCTION
- 			      |TULIP_CMD_SCRAMBLER|TULIP_CMD_FULLDUPLEX);
- }
- 
- static const tulip_boardsw_t tulip_21140_accton_boardsw = {
-     TULIP_21140_EN1207,
-     tulip_21140_accton_media_probe,
-     tulip_media_select,
-     tulip_null_media_poll,
-     tulip_2114x_media_preset,
- };
- 
- static void
  tulip_21140_smc9332_media_probe(
      tulip_softc_t * const sc)
  {
--- 1616,1621 ----
***************
*** 2251,2284 ****
  }
  
  static void
- tulip_identify_accton_nic(
-     tulip_softc_t * const sc)
- {
-     strcpy(sc->tulip_boardid, "ACCTON ");
-     switch (sc->tulip_chipid) {
- 	case TULIP_21140A:
- 	    strcat(sc->tulip_boardid, "EN1207 ");
- 	    sc->tulip_boardsw = &tulip_21140_accton_boardsw;
- 	    break;
- 	case TULIP_21140:
- 	    strcat(sc->tulip_boardid, "EN1207TX ");
- 	    sc->tulip_boardsw = &tulip_21140_eb_boardsw;
-             break;
-         case TULIP_21040:
- 	    strcat(sc->tulip_boardid, "EN1203 ");
-             sc->tulip_boardsw = &tulip_21040_boardsw;
-             break;
-         case TULIP_21041:
- 	    strcat(sc->tulip_boardid, "EN1203 ");
-             sc->tulip_boardsw = &tulip_21041_boardsw;
-             break;
- 	default:
-             sc->tulip_boardsw = &tulip_2114x_isv_boardsw;
-             break;
-     }
- }
- 
- static void
  tulip_identify_asante_nic(
      tulip_softc_t * const sc)
  {
--- 2197,2202 ----
***************
*** 2700,2706 ****
      { tulip_identify_znyx_nic,		{ 0x00, 0xC0, 0x95 } },
      { tulip_identify_cogent_nic,	{ 0x00, 0x00, 0x92 } },
      { tulip_identify_asante_nic,	{ 0x00, 0x00, 0x94 } },
-     { tulip_identify_accton_nic,	{ 0x00, 0x00, 0xE8 } },
      { NULL }
  };
  
--- 2617,2622 ----

>Audit-Trail:
>Unformatted: