diff options
| author | Mike McCormack <mikem@ring3k.org> | 2010-01-23 05:09:26 -0500 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2010-01-23 05:09:26 -0500 |
| commit | 2ca4231de7f7a5fd7137bac152030ba71f15e8c3 (patch) | |
| tree | 681b53327e45e3843b9aaa4e049ff9400f19c781 | |
| parent | 8e1e8a4779cb23c1d9f51e9223795e07ec54d77a (diff) | |
sky2: Enable/disable WOL per hardware device
Y2_HW_WOL_ON/Y2_HW_WOL_OFF should be set and cleared per chip,
not per port. On dual port cards, Y2_HW_WOL_ON should be
enabled if either sky2 port has WOL enabled.
Found while reviewing code for a WOL regression, though this is
probably not the cause of the regression.
Signed-off-by: Mike McCormack <mikem@ring3k.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
| -rw-r--r-- | drivers/net/sky2.c | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index 37f486b65f63..02d0b42e436c 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
| @@ -3228,6 +3228,27 @@ static inline u8 sky2_wol_supported(const struct sky2_hw *hw) | |||
| 3228 | return sky2_is_copper(hw) ? (WAKE_PHY | WAKE_MAGIC) : 0; | 3228 | return sky2_is_copper(hw) ? (WAKE_PHY | WAKE_MAGIC) : 0; |
| 3229 | } | 3229 | } |
| 3230 | 3230 | ||
| 3231 | static void sky2_hw_set_wol(struct sky2_hw *hw) | ||
| 3232 | { | ||
| 3233 | int wol = 0; | ||
| 3234 | int i; | ||
| 3235 | |||
| 3236 | for (i = 0; i < hw->ports; i++) { | ||
| 3237 | struct net_device *dev = hw->dev[i]; | ||
| 3238 | struct sky2_port *sky2 = netdev_priv(dev); | ||
| 3239 | |||
| 3240 | if (sky2->wol) | ||
| 3241 | wol = 1; | ||
| 3242 | } | ||
| 3243 | |||
| 3244 | if (hw->chip_id == CHIP_ID_YUKON_EC_U || | ||
| 3245 | hw->chip_id == CHIP_ID_YUKON_EX || | ||
| 3246 | hw->chip_id == CHIP_ID_YUKON_FE_P) | ||
| 3247 | sky2_write32(hw, B0_CTST, wol ? Y2_HW_WOL_ON : Y2_HW_WOL_OFF); | ||
| 3248 | |||
| 3249 | device_set_wakeup_enable(&hw->pdev->dev, wol); | ||
| 3250 | } | ||
| 3251 | |||
| 3231 | static void sky2_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | 3252 | static void sky2_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) |
| 3232 | { | 3253 | { |
| 3233 | const struct sky2_port *sky2 = netdev_priv(dev); | 3254 | const struct sky2_port *sky2 = netdev_priv(dev); |
| @@ -3247,13 +3268,7 @@ static int sky2_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | |||
| 3247 | 3268 | ||
| 3248 | sky2->wol = wol->wolopts; | 3269 | sky2->wol = wol->wolopts; |
| 3249 | 3270 | ||
| 3250 | if (hw->chip_id == CHIP_ID_YUKON_EC_U || | 3271 | sky2_hw_set_wol(hw); |
| 3251 | hw->chip_id == CHIP_ID_YUKON_EX || | ||
| 3252 | hw->chip_id == CHIP_ID_YUKON_FE_P) | ||
| 3253 | sky2_write32(hw, B0_CTST, sky2->wol | ||
| 3254 | ? Y2_HW_WOL_ON : Y2_HW_WOL_OFF); | ||
| 3255 | |||
| 3256 | device_set_wakeup_enable(&hw->pdev->dev, sky2->wol); | ||
| 3257 | 3272 | ||
| 3258 | if (!netif_running(dev)) | 3273 | if (!netif_running(dev)) |
| 3259 | sky2_wol_init(sky2); | 3274 | sky2_wol_init(sky2); |
