aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorMirko Lindner2007-12-05 21:10:02 -0800
committerDavid S. Miller2007-12-07 01:05:47 -0800
commit0c3b091b9a7a5184011e75afa7f0206d288ddb06 (patch)
treeab8d8c09c338bd4449a61e70e1e61e29df15aae3 /drivers
parentf194d132e4971111f85c18c96067acffb13cee6d (diff)
[NIU]: Fix link LED handling.
The LED in the current driver will not be controlled correctly. During a link change the carrier of the link is not available and the LED will never turn on. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/niu.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/drivers/net/niu.c b/drivers/net/niu.c
index 112ab079ce7d..abfc61c3a38c 100644
--- a/drivers/net/niu.c
+++ b/drivers/net/niu.c
@@ -1045,6 +1045,7 @@ static int niu_serdes_init(struct niu *np)
}
static void niu_init_xif(struct niu *);
+static void niu_handle_led(struct niu *, int status);
static int niu_link_status_common(struct niu *np, int link_up)
{
@@ -1066,11 +1067,15 @@ static int niu_link_status_common(struct niu *np, int link_up)
spin_lock_irqsave(&np->lock, flags);
niu_init_xif(np);
+ niu_handle_led(np, 1);
spin_unlock_irqrestore(&np->lock, flags);
netif_carrier_on(dev);
} else if (netif_carrier_ok(dev) && !link_up) {
niuwarn(LINK, "%s: Link is down\n", dev->name);
+ spin_lock_irqsave(&np->lock, flags);
+ niu_handle_led(np, 0);
+ spin_unlock_irqrestore(&np->lock, flags);
netif_carrier_off(dev);
}
@@ -3915,16 +3920,14 @@ static int niu_init_ipp(struct niu *np)
return 0;
}
-static void niu_init_xif_xmac(struct niu *np)
+static void niu_handle_led(struct niu *np, int status)
{
- struct niu_link_config *lp = &np->link_config;
u64 val;
-
val = nr64_mac(XMAC_CONFIG);
if ((np->flags & NIU_FLAGS_10G) != 0 &&
(np->flags & NIU_FLAGS_FIBER) != 0) {
- if (netif_carrier_ok(np->dev)) {
+ if (status) {
val |= XMAC_CONFIG_LED_POLARITY;
val &= ~XMAC_CONFIG_FORCE_LED_ON;
} else {
@@ -3933,6 +3936,15 @@ static void niu_init_xif_xmac(struct niu *np)
}
}
+ nw64_mac(XMAC_CONFIG, val);
+}
+
+static void niu_init_xif_xmac(struct niu *np)
+{
+ struct niu_link_config *lp = &np->link_config;
+ u64 val;
+
+ val = nr64_mac(XMAC_CONFIG);
val &= ~XMAC_CONFIG_SEL_POR_CLK_SRC;
val |= XMAC_CONFIG_TX_OUTPUT_EN;
@@ -4776,6 +4788,8 @@ static int niu_close(struct net_device *dev)
niu_free_channels(np);
+ niu_handle_led(np, 0);
+
return 0;
}