aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/niu.c
diff options
context:
space:
mode:
authorMirko Lindner <mlindner@marvell.com>2007-12-06 00:10:02 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2007-12-07 04:05:47 -0500
commit0c3b091b9a7a5184011e75afa7f0206d288ddb06 (patch)
treeab8d8c09c338bd4449a61e70e1e61e29df15aae3 /drivers/net/niu.c
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/net/niu.c')
-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)
1045} 1045}
1046 1046
1047static void niu_init_xif(struct niu *); 1047static void niu_init_xif(struct niu *);
1048static void niu_handle_led(struct niu *, int status);
1048 1049
1049static int niu_link_status_common(struct niu *np, int link_up) 1050static int niu_link_status_common(struct niu *np, int link_up)
1050{ 1051{
@@ -1066,11 +1067,15 @@ static int niu_link_status_common(struct niu *np, int link_up)
1066 1067
1067 spin_lock_irqsave(&np->lock, flags); 1068 spin_lock_irqsave(&np->lock, flags);
1068 niu_init_xif(np); 1069 niu_init_xif(np);
1070 niu_handle_led(np, 1);
1069 spin_unlock_irqrestore(&np->lock, flags); 1071 spin_unlock_irqrestore(&np->lock, flags);
1070 1072
1071 netif_carrier_on(dev); 1073 netif_carrier_on(dev);
1072 } else if (netif_carrier_ok(dev) && !link_up) { 1074 } else if (netif_carrier_ok(dev) && !link_up) {
1073 niuwarn(LINK, "%s: Link is down\n", dev->name); 1075 niuwarn(LINK, "%s: Link is down\n", dev->name);
1076 spin_lock_irqsave(&np->lock, flags);
1077 niu_handle_led(np, 0);
1078 spin_unlock_irqrestore(&np->lock, flags);
1074 netif_carrier_off(dev); 1079 netif_carrier_off(dev);
1075 } 1080 }
1076 1081
@@ -3915,16 +3920,14 @@ static int niu_init_ipp(struct niu *np)
3915 return 0; 3920 return 0;
3916} 3921}
3917 3922
3918static void niu_init_xif_xmac(struct niu *np) 3923static void niu_handle_led(struct niu *np, int status)
3919{ 3924{
3920 struct niu_link_config *lp = &np->link_config;
3921 u64 val; 3925 u64 val;
3922
3923 val = nr64_mac(XMAC_CONFIG); 3926 val = nr64_mac(XMAC_CONFIG);
3924 3927
3925 if ((np->flags & NIU_FLAGS_10G) != 0 && 3928 if ((np->flags & NIU_FLAGS_10G) != 0 &&
3926 (np->flags & NIU_FLAGS_FIBER) != 0) { 3929 (np->flags & NIU_FLAGS_FIBER) != 0) {
3927 if (netif_carrier_ok(np->dev)) { 3930 if (status) {
3928 val |= XMAC_CONFIG_LED_POLARITY; 3931 val |= XMAC_CONFIG_LED_POLARITY;
3929 val &= ~XMAC_CONFIG_FORCE_LED_ON; 3932 val &= ~XMAC_CONFIG_FORCE_LED_ON;
3930 } else { 3933 } else {
@@ -3933,6 +3936,15 @@ static void niu_init_xif_xmac(struct niu *np)
3933 } 3936 }
3934 } 3937 }
3935 3938
3939 nw64_mac(XMAC_CONFIG, val);
3940}
3941
3942static void niu_init_xif_xmac(struct niu *np)
3943{
3944 struct niu_link_config *lp = &np->link_config;
3945 u64 val;
3946
3947 val = nr64_mac(XMAC_CONFIG);
3936 val &= ~XMAC_CONFIG_SEL_POR_CLK_SRC; 3948 val &= ~XMAC_CONFIG_SEL_POR_CLK_SRC;
3937 3949
3938 val |= XMAC_CONFIG_TX_OUTPUT_EN; 3950 val |= XMAC_CONFIG_TX_OUTPUT_EN;
@@ -4776,6 +4788,8 @@ static int niu_close(struct net_device *dev)
4776 4788
4777 niu_free_channels(np); 4789 niu_free_channels(np);
4778 4790
4791 niu_handle_led(np, 0);
4792
4779 return 0; 4793 return 0;
4780} 4794}
4781 4795