quirk in mii_ioctl of rtl8129.c V1.04
Rene Hogendoorn
hogend@nlr.nl
Tue Nov 24 04:14:33 1998
-----BEGIN PGP SIGNED MESSAGE-----
When using a 8139, a phy_id of 32 is used; in mdio_read/write, this is used to
access the 8139 basic mode control and subsequent registers directly.
However, in mii_ioctl, the phy_id is masked with 0x1f rather than 0x3f. Consequently,
phy_id == 32 results in e.g. mdio_write(dev, 0, value) rather than mdio_write(dev, 32, value).
A patch is attached below.
Another thing is that I want to switch between 10baseT and 100baseTx. My laptop only has
10baseT and connects to a dual-speed hub. The 8139 auto-negotiates 100baseTx with the
hub. I have to force the NIC to advertise only 10baseT. This could be done with the mii-diag
program, but it contains
if (phy_id < 32 && nway_advertise >= 0) {
^^^^^^^^^^^
printf(" Setting the media capability advertisement register of "
"PHY #%d to 0x%4.4x.\n", phy_id, nway_advertise | 1);
mdio_write(skfd, phy_id, 4, nway_advertise | 1);
mdio_write(skfd, phy_id, 0, 0x1000);
}
If I remove the phy_id < 32, I can restart the auto-negotation and advertise only 10baseT.
It works, but I just want to know why there is the test on phy_id < 32 in order not break
things unexpectedly.
Regards,
diff -c /home/nlr/hogend/MO/Debian/rtl8139.c /home/nlr/hogend/MO/Debian/rtl8139.c.orig
*** /home/nlr/hogend/MO/Debian/rtl8139.c Tue Nov 24 09:51:14 1998
- --- /home/nlr/hogend/MO/Debian/rtl8139.c.orig Tue Oct 27 11:46:59 1998
***************
*** 1291,1305 ****
switch(cmd) {
case SIOCDEVPRIVATE: /* Get the address of the PHY in use. */
! data[0] = tp->phys[0];
/* Fall Through */
case SIOCDEVPRIVATE+1: /* Read the specified MII register. */
! data[3] = mdio_read(dev, data[0] & 0x3f, data[1] & 0x1f);
return 0;
case SIOCDEVPRIVATE+2: /* Write the specified MII register */
if (!suser())
return -EPERM;
! mdio_write(dev, data[0] & 0x3f, data[1] & 0x1f, data[2]);
return 0;
default:
return -EOPNOTSUPP;
- --- 1291,1305 ----
switch(cmd) {
case SIOCDEVPRIVATE: /* Get the address of the PHY in use. */
! data[0] = tp->phys[0] & 0x3f;
/* Fall Through */
case SIOCDEVPRIVATE+1: /* Read the specified MII register. */
! data[3] = mdio_read(dev, data[0] & 0x1f, data[1] & 0x1f);
return 0;
case SIOCDEVPRIVATE+2: /* Write the specified MII register */
if (!suser())
return -EPERM;
! mdio_write(dev, data[0] & 0x1f, data[1] & 0x1f, data[2]);
return 0;
default:
return -EOPNOTSUPP;
-----BEGIN PGP SIGNATURE-----
Version: 2.6.3ia
Charset: noconv
Comment: public key at any of the www keyservers
iQCVAwUBNlp4u4KqZpeo19PBAQGLDQP+LzVVvY6Xt45n13r5scCAEVS6guQUJ514
ZRzHQvA0b90+wEWaKG9TSU9u1/4SFYXmESpI4cmxrFPfIb67+aeQoK+3PNm8kXxc
QBmfSKM0Ge1OoFiK53lXigqNlT06aixac+nkJ4+6gnyS4KgXkYc1gfPwQFzLRJ0b
Ehmerm2E97U=
=e4bf
-----END PGP SIGNATURE-----
--
R. A. Hogendoorn E-mail: hogend@nlr.nl
Informatics Division Tel. +31-527-24-8367
National Aerospace Laboratory, The Netherlands Fax. +31-527-24-8210
| To unsubscribe, send mail to Majordomo@cesdis.gsfc.nasa.gov, and within the
| body of the mail, include only the text:
| unsubscribe this-list-name youraddress@wherever.org
| You will be unsubscribed as speedily as possible.