Subject: kern/21965: AM79c978 (PCnet-Home) HomePna card does not work with 1.6.1/if_pcn
To: None <gnats-bugs@gnats.netbsd.org>
From: None <kurahone@ncsa.uiuc.edu>
List: netbsd-bugs
Date: 06/23/2003 04:49:12
>Number: 21965
>Category: kern
>Synopsis: AM79c978 (PCnet-Home) HomePna card does not work with 1.6.1/if_pcn
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Jun 23 04:50:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: Austin K. Kurahone
>Release: 1.6.1
>Organization:
>Environment:
NetBSD thoth.private.sigusr1.org 1.6.1 NetBSD 1.6.1 (THOTH) #8: Sun Jun 22 20:27:17 PDT 2003 root@thoth.private.sigusr1.org:/usr/src/sys/arch/i386/compile/THOTH i386
>Description:
PCI NICS based around the AMD AM79c978 (PCnet-Home) chip are not currently supported under NetBSD 1.6.1.
The AM79c978 supports 10BaseT Ethernet and HomePNA 1.0 (Ethernet over RJ-11), several cards use this chipset including the Linksys HPN100, and the Diamond Multimedia HomeFree.
>How-To-Repeat:
Install NetBSD 1.6.1 and a kernel with if_pcn and pnaphy compiled in. The card will come up as unsupported.
>Fix:
The following patch adds support for the chip. Currently due to a caveat with how the pnaphy MII implementation works, only the HomePNA PHY is supported.
Bugs: Under heavy load the card sees CRC errors and watchdog timeouts. The system recovers properly however. I'm not sure if this is a problem with the card, or HomePNA in general. (The card also experiences this issue under FreeBSD-4.8, but worse, and "seems" to work properly in windows.)
--- if_pcn.c.org Sat Jun 21 17:12:10 2003
+++ if_pcn.c Sat Jun 21 20:09:26 2003
@@ -36,6 +36,18 @@
*/
/*
+ * AMD AM79c978 Support: Austin K. Kurahone <kurahone@sigusr1.org>
+ * Copyright (c) 2003 All Rights Reserved.
+ *
+ * This code is hereby placed in the public domain.
+ *
+ * Please note that even if you have a AM79c978 with an integrated
+ * Ethernet PHY, due to the way that pnaphy works, only the HomePNA
+ * media option will be accesible.
+ *
+ */
+
+/*
* Device driver for the AMD PCnet-PCI series of Ethernet
* chips:
*
@@ -54,6 +66,8 @@
* * Am79c973/Am79c975 PCnet-FAST III Single-Chip 10/100Mbps PCI
* Ethernet Controller with Integrated PHY
*
+ * * AM79c978 PCnet-Home PCI Ethernet Controller with HomePNA 1.0 PHY
+ *
* This also supports the virtual PCnet-PCI Ethernet interface found
* in VMware.
*
@@ -416,6 +430,8 @@
int pcn_79c971_mediachange(struct ifnet *);
void pcn_79c971_mediastatus(struct ifnet *, struct ifmediareq *);
+void pcn_79c978_mediainit(struct pcn_softc *);
+
/*
* Description of a PCnet-PCI variant. Used to select media access
* method, mostly, and to print a nice description of the chip.
@@ -449,6 +465,10 @@
pcn_79c971_mediainit,
PARTID_Am79c975 },
+ { "Am79c978 PCnet-Home",
+ pcn_79c978_mediainit,
+ PARTID_Am79c978 },
+
{ "Unknown PCnet-PCI variant",
pcn_79c971_mediainit,
0 },
@@ -526,6 +546,7 @@
switch (PCI_PRODUCT(pa->pa_id)) {
case PCI_PRODUCT_AMD_PCNET_PCI:
+ case PCI_PRODUCT_AMD_PCNET_HOME:
/* Beat if_le_pci.c */
return (10);
}
@@ -2104,6 +2125,44 @@
if (ifp->if_flags & IFF_UP)
mii_mediachg(&sc->sc_mii);
return (0);
+}
+
+/*
+ * pcn_79c978_mediainit:
+ *
+ * Initialize media for Am79c978.
+ *
+ */
+void
+pcn_79c978_mediainit(struct pcn_softc *sc)
+{
+ struct ifnet *ifp = &sc->sc_ethercom.ec_if;
+
+ /* We have MII. */
+ sc->sc_flags |= PCN_F_HAS_MII;
+
+ /*
+ * The built-in HomePNA interface is mapped to the MII
+ * on the PCNet-Home.
+ */
+ sc->sc_phyaddr = -1;
+
+ /* Initialize our media structures and probe the MII. */
+ sc->sc_mii.mii_ifp = ifp;
+ sc->sc_mii.mii_readreg = pcn_mii_readreg;
+ sc->sc_mii.mii_writereg = pcn_mii_writereg;
+ sc->sc_mii.mii_statchg = pcn_mii_statchg;
+ ifmedia_init(&sc->sc_mii.mii_media, 0, pcn_79c971_mediachange,
+ pcn_79c971_mediastatus);
+
+ mii_attach(&sc->sc_dev, &sc->sc_mii, 0xffffffff, MII_PHY_ANY,
+ MII_OFFSET_ANY, 0);
+ if (LIST_FIRST(&sc->sc_mii.mii_phys) == NULL) {
+ ifmedia_add(&sc->sc_mii.mii_media, IFM_ETHER|IFM_HPNA_1,
+ 0, NULL);
+ ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER|IFM_NONE);
+ } else
+ ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER|IFM_HPNA_1);
}
/*
>Release-Note:
>Audit-Trail:
>Unformatted: