diff options
Diffstat (limited to 'drivers/net/sky2.c')
-rw-r--r-- | drivers/net/sky2.c | 57 |
1 files changed, 31 insertions, 26 deletions
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index eafb6327d68f..c941195f0f4b 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
@@ -195,7 +195,6 @@ static u16 gm_phy_read(struct sky2_hw *hw, unsigned port, u16 reg) | |||
195 | static void sky2_set_power_state(struct sky2_hw *hw, pci_power_t state) | 195 | static void sky2_set_power_state(struct sky2_hw *hw, pci_power_t state) |
196 | { | 196 | { |
197 | u16 power_control; | 197 | u16 power_control; |
198 | u32 reg1; | ||
199 | int vaux; | 198 | int vaux; |
200 | 199 | ||
201 | pr_debug("sky2_set_power_state %d\n", state); | 200 | pr_debug("sky2_set_power_state %d\n", state); |
@@ -228,20 +227,9 @@ static void sky2_set_power_state(struct sky2_hw *hw, pci_power_t state) | |||
228 | else | 227 | else |
229 | sky2_write8(hw, B2_Y2_CLK_GATE, 0); | 228 | sky2_write8(hw, B2_Y2_CLK_GATE, 0); |
230 | 229 | ||
231 | /* Turn off phy power saving */ | ||
232 | reg1 = sky2_pci_read32(hw, PCI_DEV_REG1); | ||
233 | reg1 &= ~(PCI_Y2_PHY1_POWD | PCI_Y2_PHY2_POWD); | ||
234 | |||
235 | /* looks like this XL is back asswards .. */ | ||
236 | if (hw->chip_id == CHIP_ID_YUKON_XL && hw->chip_rev > 1) { | ||
237 | reg1 |= PCI_Y2_PHY1_COMA; | ||
238 | if (hw->ports > 1) | ||
239 | reg1 |= PCI_Y2_PHY2_COMA; | ||
240 | } | ||
241 | sky2_pci_write32(hw, PCI_DEV_REG1, reg1); | ||
242 | udelay(100); | ||
243 | |||
244 | if (hw->chip_id == CHIP_ID_YUKON_EC_U) { | 230 | if (hw->chip_id == CHIP_ID_YUKON_EC_U) { |
231 | u32 reg1; | ||
232 | |||
245 | sky2_pci_write32(hw, PCI_DEV_REG3, 0); | 233 | sky2_pci_write32(hw, PCI_DEV_REG3, 0); |
246 | reg1 = sky2_pci_read32(hw, PCI_DEV_REG4); | 234 | reg1 = sky2_pci_read32(hw, PCI_DEV_REG4); |
247 | reg1 &= P_ASPM_CONTROL_MSK; | 235 | reg1 &= P_ASPM_CONTROL_MSK; |
@@ -253,15 +241,6 @@ static void sky2_set_power_state(struct sky2_hw *hw, pci_power_t state) | |||
253 | 241 | ||
254 | case PCI_D3hot: | 242 | case PCI_D3hot: |
255 | case PCI_D3cold: | 243 | case PCI_D3cold: |
256 | /* Turn on phy power saving */ | ||
257 | reg1 = sky2_pci_read32(hw, PCI_DEV_REG1); | ||
258 | if (hw->chip_id == CHIP_ID_YUKON_XL && hw->chip_rev > 1) | ||
259 | reg1 &= ~(PCI_Y2_PHY1_POWD | PCI_Y2_PHY2_POWD); | ||
260 | else | ||
261 | reg1 |= (PCI_Y2_PHY1_POWD | PCI_Y2_PHY2_POWD); | ||
262 | sky2_pci_write32(hw, PCI_DEV_REG1, reg1); | ||
263 | udelay(100); | ||
264 | |||
265 | if (hw->chip_id == CHIP_ID_YUKON_XL && hw->chip_rev > 1) | 244 | if (hw->chip_id == CHIP_ID_YUKON_XL && hw->chip_rev > 1) |
266 | sky2_write8(hw, B2_Y2_CLK_GATE, 0); | 245 | sky2_write8(hw, B2_Y2_CLK_GATE, 0); |
267 | else | 246 | else |
@@ -285,7 +264,7 @@ static void sky2_set_power_state(struct sky2_hw *hw, pci_power_t state) | |||
285 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF); | 264 | sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF); |
286 | } | 265 | } |
287 | 266 | ||
288 | static void sky2_phy_reset(struct sky2_hw *hw, unsigned port) | 267 | static void sky2_gmac_reset(struct sky2_hw *hw, unsigned port) |
289 | { | 268 | { |
290 | u16 reg; | 269 | u16 reg; |
291 | 270 | ||
@@ -533,6 +512,28 @@ static void sky2_phy_init(struct sky2_hw *hw, unsigned port) | |||
533 | gm_phy_write(hw, port, PHY_MARV_INT_MASK, PHY_M_DEF_MSK); | 512 | gm_phy_write(hw, port, PHY_MARV_INT_MASK, PHY_M_DEF_MSK); |
534 | } | 513 | } |
535 | 514 | ||
515 | static void sky2_phy_power(struct sky2_hw *hw, unsigned port, int onoff) | ||
516 | { | ||
517 | u32 reg1; | ||
518 | static const u32 phy_power[] | ||
519 | = { PCI_Y2_PHY1_POWD, PCI_Y2_PHY2_POWD }; | ||
520 | |||
521 | /* looks like this XL is back asswards .. */ | ||
522 | if (hw->chip_id == CHIP_ID_YUKON_XL && hw->chip_rev > 1) | ||
523 | onoff = !onoff; | ||
524 | |||
525 | reg1 = sky2_pci_read32(hw, PCI_DEV_REG1); | ||
526 | |||
527 | if (onoff) | ||
528 | /* Turn off phy power saving */ | ||
529 | reg1 &= ~phy_power[port]; | ||
530 | else | ||
531 | reg1 |= phy_power[port]; | ||
532 | |||
533 | sky2_pci_write32(hw, PCI_DEV_REG1, reg1); | ||
534 | udelay(100); | ||
535 | } | ||
536 | |||
536 | /* Force a renegotiation */ | 537 | /* Force a renegotiation */ |
537 | static void sky2_phy_reinit(struct sky2_port *sky2) | 538 | static void sky2_phy_reinit(struct sky2_port *sky2) |
538 | { | 539 | { |
@@ -1088,6 +1089,8 @@ static int sky2_up(struct net_device *dev) | |||
1088 | if (!sky2->rx_ring) | 1089 | if (!sky2->rx_ring) |
1089 | goto err_out; | 1090 | goto err_out; |
1090 | 1091 | ||
1092 | sky2_phy_power(hw, port, 1); | ||
1093 | |||
1091 | sky2_mac_init(hw, port); | 1094 | sky2_mac_init(hw, port); |
1092 | 1095 | ||
1093 | /* Determine available ram buffer space (in 4K blocks). | 1096 | /* Determine available ram buffer space (in 4K blocks). |
@@ -1421,7 +1424,7 @@ static int sky2_down(struct net_device *dev) | |||
1421 | /* Stop more packets from being queued */ | 1424 | /* Stop more packets from being queued */ |
1422 | netif_stop_queue(dev); | 1425 | netif_stop_queue(dev); |
1423 | 1426 | ||
1424 | sky2_phy_reset(hw, port); | 1427 | sky2_gmac_reset(hw, port); |
1425 | 1428 | ||
1426 | /* Stop transmitter */ | 1429 | /* Stop transmitter */ |
1427 | sky2_write32(hw, Q_ADDR(txqaddr[port], Q_CSR), BMU_STOP); | 1430 | sky2_write32(hw, Q_ADDR(txqaddr[port], Q_CSR), BMU_STOP); |
@@ -1469,6 +1472,8 @@ static int sky2_down(struct net_device *dev) | |||
1469 | imask &= ~portirq_msk[port]; | 1472 | imask &= ~portirq_msk[port]; |
1470 | sky2_write32(hw, B0_IMSK, imask); | 1473 | sky2_write32(hw, B0_IMSK, imask); |
1471 | 1474 | ||
1475 | sky2_phy_power(hw, port, 0); | ||
1476 | |||
1472 | /* turn off LED's */ | 1477 | /* turn off LED's */ |
1473 | sky2_write16(hw, B0_Y2LED, LED_STAT_OFF); | 1478 | sky2_write16(hw, B0_Y2LED, LED_STAT_OFF); |
1474 | 1479 | ||
@@ -2403,7 +2408,7 @@ static int sky2_reset(struct sky2_hw *hw) | |||
2403 | sky2_write32(hw, B0_HWE_IMSK, Y2_HWE_ALL_MASK); | 2408 | sky2_write32(hw, B0_HWE_IMSK, Y2_HWE_ALL_MASK); |
2404 | 2409 | ||
2405 | for (i = 0; i < hw->ports; i++) | 2410 | for (i = 0; i < hw->ports; i++) |
2406 | sky2_phy_reset(hw, i); | 2411 | sky2_gmac_reset(hw, i); |
2407 | 2412 | ||
2408 | memset(hw->st_le, 0, STATUS_LE_BYTES); | 2413 | memset(hw->st_le, 0, STATUS_LE_BYTES); |
2409 | hw->st_idx = 0; | 2414 | hw->st_idx = 0; |