From: Miroslaw Mieszczak <mieszcz@zabrze.zigzag.pl>
To: linux-kernel@vger.kernel.org
Subject: Patch for link detection for R8169
Date: Tue, 06 Sep 2005 16:32:39 +0200 [thread overview]
Message-ID: <431DA887.2010008@zabrze.zigzag.pl> (raw)
[-- Attachment #1: Type: text/plain, Size: 179 bytes --]
There is a patch to driver of RLT8169 network card. This match make
possible detection of the link status even if network interface is down.
This is usefull for laptop users.
[-- Attachment #2: r8169.diff --]
[-- Type: text/plain, Size: 1442 bytes --]
--- r8169.c 2005-09-02 15:34:52.000000000 +0200
+++ linux/drivers/net/r8169.c 2005-09-05 21:11:15.000000000 +0200
@@ -538,14 +538,27 @@
static unsigned int rtl8169_tbi_link_ok(void __iomem *ioaddr)
{
- return RTL_R32(TBICSR) & TBILinkOk;
+ return (RTL_R32(TBICSR) & TBILinkOk) == TBILinkOk ? 1:0;
}
static unsigned int rtl8169_xmii_link_ok(void __iomem *ioaddr)
{
- return RTL_R8(PHYstatus) & LinkStatus;
+ return (RTL_R8(PHYstatus) & LinkStatus) == LinkStatus ? 1:0;
}
+static u32 rtl8169_get_link(struct net_device *dev)
+{
+ struct rtl8169_private *np = netdev_priv(dev);
+ unsigned int result;
+ unsigned long flags;
+
+ spin_lock_irqsave(&np->lock, flags);
+ result = np->link_ok(np->mmio_addr);
+ spin_unlock_irqrestore(&np->lock, flags);
+ return result;
+}
+
+
static void rtl8169_tbi_reset_enable(void __iomem *ioaddr)
{
RTL_W32(TBICSR, RTL_R32(TBICSR) | TBIReset);
@@ -577,6 +590,8 @@
spin_unlock_irqrestore(&tp->lock, flags);
}
+
+
static void rtl8169_link_option(int idx, u8 *autoneg, u16 *speed, u8 *duplex)
{
struct {
@@ -1010,7 +1025,7 @@
static struct ethtool_ops rtl8169_ethtool_ops = {
.get_drvinfo = rtl8169_get_drvinfo,
.get_regs_len = rtl8169_get_regs_len,
- .get_link = ethtool_op_get_link,
+ .get_link = rtl8169_get_link,/* ethtool_op_get_link,*/
.get_settings = rtl8169_get_settings,
.set_settings = rtl8169_set_settings,
.get_msglevel = rtl8169_get_msglevel,
next reply other threads:[~2005-09-06 14:32 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-06 14:32 Miroslaw Mieszczak [this message]
2005-09-06 14:46 ` Patch for link detection for R8169 Matthieu CASTET
2005-09-06 19:46 ` Francois Romieu
2005-09-06 20:02 ` Valdis.Kletnieks
2005-09-06 20:42 ` Francois Romieu
2005-09-06 20:59 ` Valdis.Kletnieks
2005-09-06 21:15 ` Francois Romieu
2005-09-07 14:45 ` Miroslaw Mieszczak
2005-09-07 18:17 ` Francois Romieu
[not found] ` <43207052.3030403@zabrze.zigzag.pl>
2005-09-08 23:49 ` Francois Romieu
2005-09-07 1:56 ` Jeff Garzik
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=431DA887.2010008@zabrze.zigzag.pl \
--to=mieszcz@zabrze.zigzag.pl \
--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