Subject: Re: if_pcn enhancement thoughts
To: None <tech-net@netbsd.org>
From: Ignatios Souvatzis <is@netbsd.org>
List: tech-net
Date: 05/04/2005 14:33:19
--LpQ9ahxlCli8rRTG
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Hello,
I wrote:
> I have the AT2700FTX, which is a pcn with two acphy connected - one to=20
> a fiber port, one to RJ45.
>=20
> Now, the pcn driver does try to avoid the internal 10 Mbit phy of the chip
> if an external phy is available; unfortunately, it doesn't try to find mo=
re
> than one external phy.
>=20
> Wouldn't not testing at all, thus showing all two or three PHYs be
> very bad?
OTOH, modifying the previous behaviour to allow for more than one=20
external PHY, but still disabling the internal one if any externals
are there, is easy (see below). Should I go this way, or remove the
test completely?
Index: sys/dev/pci/if_pcn.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/src/sys/dev/pci/if_pcn.c,v
retrieving revision 1.25
diff -u -r1.25 if_pcn.c
--- sys/dev/pci/if_pcn.c 27 Feb 2005 00:27:33 -0000 1.25
+++ sys/dev/pci/if_pcn.c 4 May 2005 12:32:23 -0000
@@ -318,7 +318,7 @@
=20
uint32_t sc_csr5; /* prototype CSR5 register */
uint32_t sc_mode; /* prototype MODE register */
- int sc_phyaddr; /* PHY address */
+ int sc_ignorephy; /* ignore internal phy */
=20
#if NRND > 0
rndsource_element_t rnd_source; /* random source */
@@ -2095,10 +2095,11 @@
* on the PCNet-FAST. Unfortunately, there's no EEPROM
* word that tells us which PHY to use. Since the 10BASE-T
* interface is always at PHY 31, we make a note of the
- * first PHY that responds, and disallow any PHYs after
- * it. This is all handled in the MII read routine.
+ * first PHY that responds, and disallow PHY 31 if it has
+ * a different number.
+ * This is all handled in the MII read routine.
*/
- sc->sc_phyaddr =3D -1;
+ sc->sc_ignorephy =3D -1;
=20
/* Initialize our media structures and probe the MII. */
sc->sc_mii.mii_ifp =3D ifp;
@@ -2158,16 +2159,18 @@
struct pcn_softc *sc =3D (void *) self;
uint32_t rv;
=20
- if (sc->sc_phyaddr !=3D -1 && phy !=3D sc->sc_phyaddr)
+ if (phy =3D=3D sc->sc_ignorephy) {
return (0);
+ }
=20
pcn_bcr_write(sc, LE_BCR33, reg | (phy << PHYAD_SHIFT));
rv =3D pcn_bcr_read(sc, LE_BCR34) & LE_B34_MIIMD;
if (rv =3D=3D 0xffff)
return (0);
=20
- if (sc->sc_phyaddr =3D=3D -1)
- sc->sc_phyaddr =3D phy;
+ if (phy !=3D 31 && sc->sc_ignorephy =3D=3D -1) {
+ sc->sc_ignorephy =3D 31;
+ }
=20
return (rv);
}
--=20
seal your e-mail: http://www.gnupg.org/
--LpQ9ahxlCli8rRTG
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (NetBSD)
iD8DBQFCeMEON4tiz3B8hB0RAgo0AJ0c4FlHrpq/tMs8xSJxo4FAoa3vjgCfctPU
WxMNNA3Qtti8qYytpaM1LqA=
=W3Ae
-----END PGP SIGNATURE-----
--LpQ9ahxlCli8rRTG--