linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Jens Schmalzing <jens.schmalzing@physik.uni-muenchen.de>
To: benh@kernel.crashing.org
Cc: <linuxppc-dev@lists.linuxppc.org>
Subject: Re: SUNGEM config
Date: 14 Feb 2002 01:52:46 +0900	[thread overview]
Message-ID: <87k7th2ujl.fsf@theorie.physik.uni-muenchen.de> (raw)
In-Reply-To: 20020213105951.10807@mailhost.mipsys.com

[-- Attachment #1: Type: text/plain, Size: 706 bytes --]

Hi,

> I know there are some laptop specific tools that monitor the link
> and do the shutdown of the interface when there is no link but I
> don't have any precise pointer at hand.

On Debian systems, this is done by a small daemon named ifd in the
laptop-net package.

Unfortunately, it uses the SIOCGMIIPHY and SIOCGMIIREG ioctls for link
detection, which on my Pismo reproducibly lead to machine check
oopses.  I've managed to track down the problem, a patch is included
below.  Basically, instead of really reading the registers it fakes
and returns a register setting from the cached status of the device.
Right now, it is fairly ugly, since it only works for that relevant
one bit.

Regards, Jens.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Patch to SUNGEM driver for GMAC --]
[-- Type: text/x-patch, Size: 662 bytes --]

--- linux-benh/drivers/net/sungem.c	Wed Feb  6 20:01:22 2002
+++ linux/drivers/net/sungem.c	Thu Feb 14 01:37:41 2002
@@ -2553,11 +2540,16 @@
 		break;

 	case SIOCGMIIPHY:		/* Get address of MII PHY in use. */
+	case SIOCDEVPRIVATE:		/* for binary compat, remove in 2.5 */
 		data->phy_id = gp->mii_phy_addr;
 		/* Fallthrough... */

 	case SIOCGMIIREG:		/* Read MII PHY register. */
-		data->val_out = __phy_read(gp, data->reg_num & 0x1f, data->phy_id & 0x1f);
+	case SIOCDEVPRIVATE+1:		/* for binary compat, remove in 2.5 */
+		if(data->reg_num==1 && gp->lstate==link_up)
+			data->val_out = PCS_MIISTAT_LS;
+		else
+			data->val_out = 0;
 		rc = 0;
 		break;

[-- Attachment #3: Type: text/plain, Size: 196 bytes --]


P.S.: I forget whether to include or to attach patches.  My apologies
if I have done it incorrectly.

--
J'qbpbe, le m'en fquz pe j'qbpbe!
Le veux aimeb et mqubib panz je pézqbpbe je djuz tqtaj!

  reply	other threads:[~2002-02-13 16:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-12 19:15 SUNGEM config Christopher Murtagh
2002-02-13 10:59 ` benh
2002-02-13 16:52   ` Jens Schmalzing [this message]
2002-02-13 17:28     ` benh
2002-02-13 21:06       ` Jens Schmalzing
2002-02-13 21:12         ` Benjamin Herrenschmidt
2002-02-13 21:42           ` Jens Schmalzing
2002-02-13 22:19             ` Benjamin Herrenschmidt

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=87k7th2ujl.fsf@theorie.physik.uni-muenchen.de \
    --to=jens.schmalzing@physik.uni-muenchen.de \
    --cc=benh@kernel.crashing.org \
    --cc=linuxppc-dev@lists.linuxppc.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;
as well as URLs for NNTP newsgroup(s).