public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Felipe W Damasio <felipewd@terra.com.br>
To: Jeff Garzik <jgarzik@mandrakesoft.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH] 8139cp: SIOCGMIIPHY and SIOCGMIIREG
Date: 20 Sep 2002 01:49:12 +0000	[thread overview]
Message-ID: <1032486552.206.3.camel@tank> (raw)

	Hi,

	This patch adds support to the GMIIPHY and GMIIREG ioctls to the 2.4
version of the 8139cp ethernet driver.

	This is required so we don't break apps (eg mii-diag, mii-tools) who
rely on these ioctls to get the NIC's settings.

	Patch against 2.4.20-pre7.

	Please consider pulling it from:

http://cscience.org/~felipewd/linux/patches-fwd/2.4/8139cp-gmii.patch

Felipe

--- ./8139cp.c.orig	Fri Sep 20 00:20:19 2002
+++ ./8139cp.c	Fri Sep 20 00:29:01 2002
@@ -1641,14 +1641,29 @@
 static int cp_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
 {
 	struct cp_private *cp = dev->priv;
+	struct mii_ioctl_data *mii;
 	int rc = 0;
 
+	mii = (struct mii_ioctl_data *) &rq->ifr_data;
 	if (!netif_running(dev))
 		return -EINVAL;
 
+	if (cmd != SIOCETHTOOL) 
+		mii->reg_num &= 0x1f;
+	
 	switch (cmd) {
 	case SIOCETHTOOL:
 		return cp_ethtool_ioctl(cp, (void *) rq->ifr_data);
+		
+ 	case SIOCGMIIPHY:	/* Get the address of the PHY in use. */
+	case SIOCDEVPRIVATE:	/* binary compat, remove in 2.5 */
+		mii->phy_id = CP_INTERNAL_PHY;
+		/* Fall Through */
+
+	case SIOCGMIIREG:	/* Read the specified MII register. */
+	case SIOCDEVPRIVATE+1:	/* binary compat, remove in 2.5 */
+		mii->val_out = mdio_read (dev, CP_INTERNAL_PHY, mii->reg_num);
+		break;
 
 	default:
 		rc = -EOPNOTSUPP;


                 reply	other threads:[~2002-09-20  4:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1032486552.206.3.camel@tank \
    --to=felipewd@terra.com.br \
    --cc=jgarzik@mandrakesoft.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox