diff options
Diffstat (limited to 'drivers/net/e1000/e1000_hw.c')
-rw-r--r-- | drivers/net/e1000/e1000_hw.c | 685 |
1 files changed, 669 insertions, 16 deletions
diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c index 5ee42c75adb1..63e237084a51 100644 --- a/drivers/net/e1000/e1000_hw.c +++ b/drivers/net/e1000/e1000_hw.c | |||
@@ -100,6 +100,8 @@ static void e1000_write_reg_io(struct e1000_hw *hw, uint32_t offset, | |||
100 | 100 | ||
101 | #define E1000_WRITE_REG_IO(a, reg, val) \ | 101 | #define E1000_WRITE_REG_IO(a, reg, val) \ |
102 | e1000_write_reg_io((a), E1000_##reg, val) | 102 | e1000_write_reg_io((a), E1000_##reg, val) |
103 | static int32_t e1000_configure_kmrn_for_10_100(struct e1000_hw *hw); | ||
104 | static int32_t e1000_configure_kmrn_for_1000(struct e1000_hw *hw); | ||
103 | 105 | ||
104 | /* IGP cable length table */ | 106 | /* IGP cable length table */ |
105 | static const | 107 | static const |
@@ -153,6 +155,11 @@ e1000_set_phy_type(struct e1000_hw *hw) | |||
153 | hw->phy_type = e1000_phy_igp; | 155 | hw->phy_type = e1000_phy_igp; |
154 | break; | 156 | break; |
155 | } | 157 | } |
158 | case GG82563_E_PHY_ID: | ||
159 | if (hw->mac_type == e1000_80003es2lan) { | ||
160 | hw->phy_type = e1000_phy_gg82563; | ||
161 | break; | ||
162 | } | ||
156 | /* Fall Through */ | 163 | /* Fall Through */ |
157 | default: | 164 | default: |
158 | /* Should never have loaded on this device */ | 165 | /* Should never have loaded on this device */ |
@@ -353,12 +360,19 @@ e1000_set_mac_type(struct e1000_hw *hw) | |||
353 | case E1000_DEV_ID_82573L: | 360 | case E1000_DEV_ID_82573L: |
354 | hw->mac_type = e1000_82573; | 361 | hw->mac_type = e1000_82573; |
355 | break; | 362 | break; |
363 | case E1000_DEV_ID_80003ES2LAN_COPPER_DPT: | ||
364 | case E1000_DEV_ID_80003ES2LAN_SERDES_DPT: | ||
365 | hw->mac_type = e1000_80003es2lan; | ||
366 | break; | ||
356 | default: | 367 | default: |
357 | /* Should never have loaded on this device */ | 368 | /* Should never have loaded on this device */ |
358 | return -E1000_ERR_MAC_TYPE; | 369 | return -E1000_ERR_MAC_TYPE; |
359 | } | 370 | } |
360 | 371 | ||
361 | switch(hw->mac_type) { | 372 | switch(hw->mac_type) { |
373 | case e1000_80003es2lan: | ||
374 | hw->swfw_sync_present = TRUE; | ||
375 | /* fall through */ | ||
362 | case e1000_82571: | 376 | case e1000_82571: |
363 | case e1000_82572: | 377 | case e1000_82572: |
364 | case e1000_82573: | 378 | case e1000_82573: |
@@ -399,6 +413,7 @@ e1000_set_media_type(struct e1000_hw *hw) | |||
399 | case E1000_DEV_ID_82546GB_SERDES: | 413 | case E1000_DEV_ID_82546GB_SERDES: |
400 | case E1000_DEV_ID_82571EB_SERDES: | 414 | case E1000_DEV_ID_82571EB_SERDES: |
401 | case E1000_DEV_ID_82572EI_SERDES: | 415 | case E1000_DEV_ID_82572EI_SERDES: |
416 | case E1000_DEV_ID_80003ES2LAN_SERDES_DPT: | ||
402 | hw->media_type = e1000_media_type_internal_serdes; | 417 | hw->media_type = e1000_media_type_internal_serdes; |
403 | break; | 418 | break; |
404 | default: | 419 | default: |
@@ -575,6 +590,7 @@ e1000_reset_hw(struct e1000_hw *hw) | |||
575 | /* fall through */ | 590 | /* fall through */ |
576 | case e1000_82571: | 591 | case e1000_82571: |
577 | case e1000_82572: | 592 | case e1000_82572: |
593 | case e1000_80003es2lan: | ||
578 | ret_val = e1000_get_auto_rd_done(hw); | 594 | ret_val = e1000_get_auto_rd_done(hw); |
579 | if(ret_val) | 595 | if(ret_val) |
580 | /* We don't want to continue accessing MAC registers. */ | 596 | /* We don't want to continue accessing MAC registers. */ |
@@ -641,6 +657,7 @@ e1000_init_hw(struct e1000_hw *hw) | |||
641 | uint16_t cmd_mmrbc; | 657 | uint16_t cmd_mmrbc; |
642 | uint16_t stat_mmrbc; | 658 | uint16_t stat_mmrbc; |
643 | uint32_t mta_size; | 659 | uint32_t mta_size; |
660 | uint32_t reg_data; | ||
644 | uint32_t ctrl_ext; | 661 | uint32_t ctrl_ext; |
645 | 662 | ||
646 | DEBUGFUNC("e1000_init_hw"); | 663 | DEBUGFUNC("e1000_init_hw"); |
@@ -739,6 +756,7 @@ e1000_init_hw(struct e1000_hw *hw) | |||
739 | case e1000_82571: | 756 | case e1000_82571: |
740 | case e1000_82572: | 757 | case e1000_82572: |
741 | case e1000_82573: | 758 | case e1000_82573: |
759 | case e1000_80003es2lan: | ||
742 | ctrl |= E1000_TXDCTL_COUNT_DESC; | 760 | ctrl |= E1000_TXDCTL_COUNT_DESC; |
743 | break; | 761 | break; |
744 | } | 762 | } |
@@ -752,12 +770,34 @@ e1000_init_hw(struct e1000_hw *hw) | |||
752 | switch (hw->mac_type) { | 770 | switch (hw->mac_type) { |
753 | default: | 771 | default: |
754 | break; | 772 | break; |
773 | case e1000_80003es2lan: | ||
774 | /* Enable retransmit on late collisions */ | ||
775 | reg_data = E1000_READ_REG(hw, TCTL); | ||
776 | reg_data |= E1000_TCTL_RTLC; | ||
777 | E1000_WRITE_REG(hw, TCTL, reg_data); | ||
778 | |||
779 | /* Configure Gigabit Carry Extend Padding */ | ||
780 | reg_data = E1000_READ_REG(hw, TCTL_EXT); | ||
781 | reg_data &= ~E1000_TCTL_EXT_GCEX_MASK; | ||
782 | reg_data |= DEFAULT_80003ES2LAN_TCTL_EXT_GCEX; | ||
783 | E1000_WRITE_REG(hw, TCTL_EXT, reg_data); | ||
784 | |||
785 | /* Configure Transmit Inter-Packet Gap */ | ||
786 | reg_data = E1000_READ_REG(hw, TIPG); | ||
787 | reg_data &= ~E1000_TIPG_IPGT_MASK; | ||
788 | reg_data |= DEFAULT_80003ES2LAN_TIPG_IPGT_1000; | ||
789 | E1000_WRITE_REG(hw, TIPG, reg_data); | ||
790 | |||
791 | reg_data = E1000_READ_REG_ARRAY(hw, FFLT, 0x0001); | ||
792 | reg_data &= ~0x00100000; | ||
793 | E1000_WRITE_REG_ARRAY(hw, FFLT, 0x0001, reg_data); | ||
794 | /* Fall through */ | ||
755 | case e1000_82571: | 795 | case e1000_82571: |
756 | case e1000_82572: | 796 | case e1000_82572: |
757 | ctrl = E1000_READ_REG(hw, TXDCTL1); | 797 | ctrl = E1000_READ_REG(hw, TXDCTL1); |
758 | ctrl &= ~E1000_TXDCTL_WTHRESH; | 798 | ctrl = (ctrl & ~E1000_TXDCTL_WTHRESH) | E1000_TXDCTL_FULL_TX_DESC_WB; |
759 | ctrl |= E1000_TXDCTL_COUNT_DESC | E1000_TXDCTL_FULL_TX_DESC_WB; | 799 | if(hw->mac_type >= e1000_82571) |
760 | ctrl |= (1 << 22); | 800 | ctrl |= E1000_TXDCTL_COUNT_DESC; |
761 | E1000_WRITE_REG(hw, TXDCTL1, ctrl); | 801 | E1000_WRITE_REG(hw, TXDCTL1, ctrl); |
762 | break; | 802 | break; |
763 | } | 803 | } |
@@ -1314,6 +1354,154 @@ e1000_copper_link_igp_setup(struct e1000_hw *hw) | |||
1314 | return E1000_SUCCESS; | 1354 | return E1000_SUCCESS; |
1315 | } | 1355 | } |
1316 | 1356 | ||
1357 | /******************************************************************** | ||
1358 | * Copper link setup for e1000_phy_gg82563 series. | ||
1359 | * | ||
1360 | * hw - Struct containing variables accessed by shared code | ||
1361 | *********************************************************************/ | ||
1362 | static int32_t | ||
1363 | e1000_copper_link_ggp_setup(struct e1000_hw *hw) | ||
1364 | { | ||
1365 | int32_t ret_val; | ||
1366 | uint16_t phy_data; | ||
1367 | uint32_t reg_data; | ||
1368 | |||
1369 | DEBUGFUNC("e1000_copper_link_ggp_setup"); | ||
1370 | |||
1371 | if(!hw->phy_reset_disable) { | ||
1372 | |||
1373 | /* Enable CRS on TX for half-duplex operation. */ | ||
1374 | ret_val = e1000_read_phy_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, | ||
1375 | &phy_data); | ||
1376 | if(ret_val) | ||
1377 | return ret_val; | ||
1378 | |||
1379 | phy_data |= GG82563_MSCR_ASSERT_CRS_ON_TX; | ||
1380 | /* Use 25MHz for both link down and 1000BASE-T for Tx clock */ | ||
1381 | phy_data |= GG82563_MSCR_TX_CLK_1000MBPS_25MHZ; | ||
1382 | |||
1383 | ret_val = e1000_write_phy_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, | ||
1384 | phy_data); | ||
1385 | if(ret_val) | ||
1386 | return ret_val; | ||
1387 | |||
1388 | /* Options: | ||
1389 | * MDI/MDI-X = 0 (default) | ||
1390 | * 0 - Auto for all speeds | ||
1391 | * 1 - MDI mode | ||
1392 | * 2 - MDI-X mode | ||
1393 | * 3 - Auto for 1000Base-T only (MDI-X for 10/100Base-T modes) | ||
1394 | */ | ||
1395 | ret_val = e1000_read_phy_reg(hw, GG82563_PHY_SPEC_CTRL, &phy_data); | ||
1396 | if(ret_val) | ||
1397 | return ret_val; | ||
1398 | |||
1399 | phy_data &= ~GG82563_PSCR_CROSSOVER_MODE_MASK; | ||
1400 | |||
1401 | switch (hw->mdix) { | ||
1402 | case 1: | ||
1403 | phy_data |= GG82563_PSCR_CROSSOVER_MODE_MDI; | ||
1404 | break; | ||
1405 | case 2: | ||
1406 | phy_data |= GG82563_PSCR_CROSSOVER_MODE_MDIX; | ||
1407 | break; | ||
1408 | case 0: | ||
1409 | default: | ||
1410 | phy_data |= GG82563_PSCR_CROSSOVER_MODE_AUTO; | ||
1411 | break; | ||
1412 | } | ||
1413 | |||
1414 | /* Options: | ||
1415 | * disable_polarity_correction = 0 (default) | ||
1416 | * Automatic Correction for Reversed Cable Polarity | ||
1417 | * 0 - Disabled | ||
1418 | * 1 - Enabled | ||
1419 | */ | ||
1420 | phy_data &= ~GG82563_PSCR_POLARITY_REVERSAL_DISABLE; | ||
1421 | if(hw->disable_polarity_correction == 1) | ||
1422 | phy_data |= GG82563_PSCR_POLARITY_REVERSAL_DISABLE; | ||
1423 | ret_val = e1000_write_phy_reg(hw, GG82563_PHY_SPEC_CTRL, phy_data); | ||
1424 | |||
1425 | if(ret_val) | ||
1426 | return ret_val; | ||
1427 | |||
1428 | /* SW Reset the PHY so all changes take effect */ | ||
1429 | ret_val = e1000_phy_reset(hw); | ||
1430 | if (ret_val) { | ||
1431 | DEBUGOUT("Error Resetting the PHY\n"); | ||
1432 | return ret_val; | ||
1433 | } | ||
1434 | } /* phy_reset_disable */ | ||
1435 | |||
1436 | if (hw->mac_type == e1000_80003es2lan) { | ||
1437 | /* Bypass RX and TX FIFO's */ | ||
1438 | ret_val = e1000_write_kmrn_reg(hw, E1000_KUMCTRLSTA_OFFSET_FIFO_CTRL, | ||
1439 | E1000_KUMCTRLSTA_FIFO_CTRL_RX_BYPASS | | ||
1440 | E1000_KUMCTRLSTA_FIFO_CTRL_TX_BYPASS); | ||
1441 | if (ret_val) | ||
1442 | return ret_val; | ||
1443 | |||
1444 | ret_val = e1000_read_phy_reg(hw, GG82563_PHY_SPEC_CTRL_2, &phy_data); | ||
1445 | if (ret_val) | ||
1446 | return ret_val; | ||
1447 | |||
1448 | phy_data &= ~GG82563_PSCR2_REVERSE_AUTO_NEG; | ||
1449 | ret_val = e1000_write_phy_reg(hw, GG82563_PHY_SPEC_CTRL_2, phy_data); | ||
1450 | |||
1451 | if (ret_val) | ||
1452 | return ret_val; | ||
1453 | |||
1454 | reg_data = E1000_READ_REG(hw, CTRL_EXT); | ||
1455 | reg_data &= ~(E1000_CTRL_EXT_LINK_MODE_MASK); | ||
1456 | E1000_WRITE_REG(hw, CTRL_EXT, reg_data); | ||
1457 | |||
1458 | ret_val = e1000_read_phy_reg(hw, GG82563_PHY_PWR_MGMT_CTRL, | ||
1459 | &phy_data); | ||
1460 | if (ret_val) | ||
1461 | return ret_val; | ||
1462 | |||
1463 | /* Do not init these registers when the HW is in IAMT mode, since the | ||
1464 | * firmware will have already initialized them. We only initialize | ||
1465 | * them if the HW is not in IAMT mode. | ||
1466 | */ | ||
1467 | if (e1000_check_mng_mode(hw) == FALSE) { | ||
1468 | /* Enable Electrical Idle on the PHY */ | ||
1469 | phy_data |= GG82563_PMCR_ENABLE_ELECTRICAL_IDLE; | ||
1470 | ret_val = e1000_write_phy_reg(hw, GG82563_PHY_PWR_MGMT_CTRL, | ||
1471 | phy_data); | ||
1472 | if (ret_val) | ||
1473 | return ret_val; | ||
1474 | |||
1475 | ret_val = e1000_read_phy_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, | ||
1476 | &phy_data); | ||
1477 | if (ret_val) | ||
1478 | return ret_val; | ||
1479 | |||
1480 | /* Enable Pass False Carrier on the PHY */ | ||
1481 | phy_data |= GG82563_KMCR_PASS_FALSE_CARRIER; | ||
1482 | |||
1483 | ret_val = e1000_write_phy_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, | ||
1484 | phy_data); | ||
1485 | if (ret_val) | ||
1486 | return ret_val; | ||
1487 | } | ||
1488 | |||
1489 | /* Workaround: Disable padding in Kumeran interface in the MAC | ||
1490 | * and in the PHY to avoid CRC errors. | ||
1491 | */ | ||
1492 | ret_val = e1000_read_phy_reg(hw, GG82563_PHY_INBAND_CTRL, | ||
1493 | &phy_data); | ||
1494 | if (ret_val) | ||
1495 | return ret_val; | ||
1496 | phy_data |= GG82563_ICR_DIS_PADDING; | ||
1497 | ret_val = e1000_write_phy_reg(hw, GG82563_PHY_INBAND_CTRL, | ||
1498 | phy_data); | ||
1499 | if (ret_val) | ||
1500 | return ret_val; | ||
1501 | } | ||
1502 | |||
1503 | return E1000_SUCCESS; | ||
1504 | } | ||
1317 | 1505 | ||
1318 | /******************************************************************** | 1506 | /******************************************************************** |
1319 | * Copper link setup for e1000_phy_m88 series. | 1507 | * Copper link setup for e1000_phy_m88 series. |
@@ -1524,6 +1712,7 @@ e1000_setup_copper_link(struct e1000_hw *hw) | |||
1524 | int32_t ret_val; | 1712 | int32_t ret_val; |
1525 | uint16_t i; | 1713 | uint16_t i; |
1526 | uint16_t phy_data; | 1714 | uint16_t phy_data; |
1715 | uint16_t reg_data; | ||
1527 | 1716 | ||
1528 | DEBUGFUNC("e1000_setup_copper_link"); | 1717 | DEBUGFUNC("e1000_setup_copper_link"); |
1529 | 1718 | ||
@@ -1532,6 +1721,22 @@ e1000_setup_copper_link(struct e1000_hw *hw) | |||
1532 | if(ret_val) | 1721 | if(ret_val) |
1533 | return ret_val; | 1722 | return ret_val; |
1534 | 1723 | ||
1724 | switch (hw->mac_type) { | ||
1725 | case e1000_80003es2lan: | ||
1726 | ret_val = e1000_read_kmrn_reg(hw, E1000_KUMCTRLSTA_OFFSET_INB_CTRL, | ||
1727 | ®_data); | ||
1728 | if (ret_val) | ||
1729 | return ret_val; | ||
1730 | reg_data |= E1000_KUMCTRLSTA_INB_CTRL_DIS_PADDING; | ||
1731 | ret_val = e1000_write_kmrn_reg(hw, E1000_KUMCTRLSTA_OFFSET_INB_CTRL, | ||
1732 | reg_data); | ||
1733 | if (ret_val) | ||
1734 | return ret_val; | ||
1735 | break; | ||
1736 | default: | ||
1737 | break; | ||
1738 | } | ||
1739 | |||
1535 | if (hw->phy_type == e1000_phy_igp || | 1740 | if (hw->phy_type == e1000_phy_igp || |
1536 | hw->phy_type == e1000_phy_igp_2) { | 1741 | hw->phy_type == e1000_phy_igp_2) { |
1537 | ret_val = e1000_copper_link_igp_setup(hw); | 1742 | ret_val = e1000_copper_link_igp_setup(hw); |
@@ -1541,6 +1746,10 @@ e1000_setup_copper_link(struct e1000_hw *hw) | |||
1541 | ret_val = e1000_copper_link_mgp_setup(hw); | 1746 | ret_val = e1000_copper_link_mgp_setup(hw); |
1542 | if(ret_val) | 1747 | if(ret_val) |
1543 | return ret_val; | 1748 | return ret_val; |
1749 | } else if (hw->phy_type == e1000_phy_gg82563) { | ||
1750 | ret_val = e1000_copper_link_ggp_setup(hw); | ||
1751 | if(ret_val) | ||
1752 | return ret_val; | ||
1544 | } | 1753 | } |
1545 | 1754 | ||
1546 | if(hw->autoneg) { | 1755 | if(hw->autoneg) { |
@@ -1588,6 +1797,59 @@ e1000_setup_copper_link(struct e1000_hw *hw) | |||
1588 | } | 1797 | } |
1589 | 1798 | ||
1590 | /****************************************************************************** | 1799 | /****************************************************************************** |
1800 | * Configure the MAC-to-PHY interface for 10/100Mbps | ||
1801 | * | ||
1802 | * hw - Struct containing variables accessed by shared code | ||
1803 | ******************************************************************************/ | ||
1804 | static int32_t | ||
1805 | e1000_configure_kmrn_for_10_100(struct e1000_hw *hw) | ||
1806 | { | ||
1807 | int32_t ret_val = E1000_SUCCESS; | ||
1808 | uint32_t tipg; | ||
1809 | uint16_t reg_data; | ||
1810 | |||
1811 | DEBUGFUNC("e1000_configure_kmrn_for_10_100"); | ||
1812 | |||
1813 | reg_data = E1000_KUMCTRLSTA_HD_CTRL_10_100_DEFAULT; | ||
1814 | ret_val = e1000_write_kmrn_reg(hw, E1000_KUMCTRLSTA_OFFSET_HD_CTRL, | ||
1815 | reg_data); | ||
1816 | if (ret_val) | ||
1817 | return ret_val; | ||
1818 | |||
1819 | /* Configure Transmit Inter-Packet Gap */ | ||
1820 | tipg = E1000_READ_REG(hw, TIPG); | ||
1821 | tipg &= ~E1000_TIPG_IPGT_MASK; | ||
1822 | tipg |= DEFAULT_80003ES2LAN_TIPG_IPGT_10_100; | ||
1823 | E1000_WRITE_REG(hw, TIPG, tipg); | ||
1824 | |||
1825 | return ret_val; | ||
1826 | } | ||
1827 | |||
1828 | static int32_t | ||
1829 | e1000_configure_kmrn_for_1000(struct e1000_hw *hw) | ||
1830 | { | ||
1831 | int32_t ret_val = E1000_SUCCESS; | ||
1832 | uint16_t reg_data; | ||
1833 | uint32_t tipg; | ||
1834 | |||
1835 | DEBUGFUNC("e1000_configure_kmrn_for_1000"); | ||
1836 | |||
1837 | reg_data = E1000_KUMCTRLSTA_HD_CTRL_1000_DEFAULT; | ||
1838 | ret_val = e1000_write_kmrn_reg(hw, E1000_KUMCTRLSTA_OFFSET_HD_CTRL, | ||
1839 | reg_data); | ||
1840 | if (ret_val) | ||
1841 | return ret_val; | ||
1842 | |||
1843 | /* Configure Transmit Inter-Packet Gap */ | ||
1844 | tipg = E1000_READ_REG(hw, TIPG); | ||
1845 | tipg &= ~E1000_TIPG_IPGT_MASK; | ||
1846 | tipg |= DEFAULT_80003ES2LAN_TIPG_IPGT_1000; | ||
1847 | E1000_WRITE_REG(hw, TIPG, tipg); | ||
1848 | |||
1849 | return ret_val; | ||
1850 | } | ||
1851 | |||
1852 | /****************************************************************************** | ||
1591 | * Configures PHY autoneg and flow control advertisement settings | 1853 | * Configures PHY autoneg and flow control advertisement settings |
1592 | * | 1854 | * |
1593 | * hw - Struct containing variables accessed by shared code | 1855 | * hw - Struct containing variables accessed by shared code |
@@ -1808,7 +2070,8 @@ e1000_phy_force_speed_duplex(struct e1000_hw *hw) | |||
1808 | /* Write the configured values back to the Device Control Reg. */ | 2070 | /* Write the configured values back to the Device Control Reg. */ |
1809 | E1000_WRITE_REG(hw, CTRL, ctrl); | 2071 | E1000_WRITE_REG(hw, CTRL, ctrl); |
1810 | 2072 | ||
1811 | if (hw->phy_type == e1000_phy_m88) { | 2073 | if ((hw->phy_type == e1000_phy_m88) || |
2074 | (hw->phy_type == e1000_phy_gg82563)) { | ||
1812 | ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); | 2075 | ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data); |
1813 | if(ret_val) | 2076 | if(ret_val) |
1814 | return ret_val; | 2077 | return ret_val; |
@@ -1877,7 +2140,8 @@ e1000_phy_force_speed_duplex(struct e1000_hw *hw) | |||
1877 | msec_delay(100); | 2140 | msec_delay(100); |
1878 | } | 2141 | } |
1879 | if((i == 0) && | 2142 | if((i == 0) && |
1880 | (hw->phy_type == e1000_phy_m88)) { | 2143 | ((hw->phy_type == e1000_phy_m88) || |
2144 | (hw->phy_type == e1000_phy_gg82563))) { | ||
1881 | /* We didn't get link. Reset the DSP and wait again for link. */ | 2145 | /* We didn't get link. Reset the DSP and wait again for link. */ |
1882 | ret_val = e1000_phy_reset_dsp(hw); | 2146 | ret_val = e1000_phy_reset_dsp(hw); |
1883 | if(ret_val) { | 2147 | if(ret_val) { |
@@ -1936,6 +2200,27 @@ e1000_phy_force_speed_duplex(struct e1000_hw *hw) | |||
1936 | if(ret_val) | 2200 | if(ret_val) |
1937 | return ret_val; | 2201 | return ret_val; |
1938 | } | 2202 | } |
2203 | } else if (hw->phy_type == e1000_phy_gg82563) { | ||
2204 | /* The TX_CLK of the Extended PHY Specific Control Register defaults | ||
2205 | * to 2.5MHz on a reset. We need to re-force it back to 25MHz, if | ||
2206 | * we're not in a forced 10/duplex configuration. */ | ||
2207 | ret_val = e1000_read_phy_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, &phy_data); | ||
2208 | if (ret_val) | ||
2209 | return ret_val; | ||
2210 | |||
2211 | phy_data &= ~GG82563_MSCR_TX_CLK_MASK; | ||
2212 | if ((hw->forced_speed_duplex == e1000_10_full) || | ||
2213 | (hw->forced_speed_duplex == e1000_10_half)) | ||
2214 | phy_data |= GG82563_MSCR_TX_CLK_10MBPS_2_5MHZ; | ||
2215 | else | ||
2216 | phy_data |= GG82563_MSCR_TX_CLK_100MBPS_25MHZ; | ||
2217 | |||
2218 | /* Also due to the reset, we need to enable CRS on Tx. */ | ||
2219 | phy_data |= GG82563_MSCR_ASSERT_CRS_ON_TX; | ||
2220 | |||
2221 | ret_val = e1000_write_phy_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, phy_data); | ||
2222 | if (ret_val) | ||
2223 | return ret_val; | ||
1939 | } | 2224 | } |
1940 | return E1000_SUCCESS; | 2225 | return E1000_SUCCESS; |
1941 | } | 2226 | } |
@@ -2598,6 +2883,16 @@ e1000_get_speed_and_duplex(struct e1000_hw *hw, | |||
2598 | } | 2883 | } |
2599 | } | 2884 | } |
2600 | 2885 | ||
2886 | if ((hw->mac_type == e1000_80003es2lan) && | ||
2887 | (hw->media_type == e1000_media_type_copper)) { | ||
2888 | if (*speed == SPEED_1000) | ||
2889 | ret_val = e1000_configure_kmrn_for_1000(hw); | ||
2890 | else | ||
2891 | ret_val = e1000_configure_kmrn_for_10_100(hw); | ||
2892 | if (ret_val) | ||
2893 | return ret_val; | ||
2894 | } | ||
2895 | |||
2601 | return E1000_SUCCESS; | 2896 | return E1000_SUCCESS; |
2602 | } | 2897 | } |
2603 | 2898 | ||
@@ -2773,6 +3068,72 @@ e1000_shift_in_mdi_bits(struct e1000_hw *hw) | |||
2773 | return data; | 3068 | return data; |
2774 | } | 3069 | } |
2775 | 3070 | ||
3071 | int32_t | ||
3072 | e1000_swfw_sync_acquire(struct e1000_hw *hw, uint16_t mask) | ||
3073 | { | ||
3074 | uint32_t swfw_sync = 0; | ||
3075 | uint32_t swmask = mask; | ||
3076 | uint32_t fwmask = mask << 16; | ||
3077 | int32_t timeout = 200; | ||
3078 | |||
3079 | DEBUGFUNC("e1000_swfw_sync_acquire"); | ||
3080 | |||
3081 | if (!hw->swfw_sync_present) | ||
3082 | return e1000_get_hw_eeprom_semaphore(hw); | ||
3083 | |||
3084 | while(timeout) { | ||
3085 | if (e1000_get_hw_eeprom_semaphore(hw)) | ||
3086 | return -E1000_ERR_SWFW_SYNC; | ||
3087 | |||
3088 | swfw_sync = E1000_READ_REG(hw, SW_FW_SYNC); | ||
3089 | if (!(swfw_sync & (fwmask | swmask))) { | ||
3090 | break; | ||
3091 | } | ||
3092 | |||
3093 | /* firmware currently using resource (fwmask) */ | ||
3094 | /* or other software thread currently using resource (swmask) */ | ||
3095 | e1000_put_hw_eeprom_semaphore(hw); | ||
3096 | msec_delay_irq(5); | ||
3097 | timeout--; | ||
3098 | } | ||
3099 | |||
3100 | if (!timeout) { | ||
3101 | DEBUGOUT("Driver can't access resource, SW_FW_SYNC timeout.\n"); | ||
3102 | return -E1000_ERR_SWFW_SYNC; | ||
3103 | } | ||
3104 | |||
3105 | swfw_sync |= swmask; | ||
3106 | E1000_WRITE_REG(hw, SW_FW_SYNC, swfw_sync); | ||
3107 | |||
3108 | e1000_put_hw_eeprom_semaphore(hw); | ||
3109 | return E1000_SUCCESS; | ||
3110 | } | ||
3111 | |||
3112 | void | ||
3113 | e1000_swfw_sync_release(struct e1000_hw *hw, uint16_t mask) | ||
3114 | { | ||
3115 | uint32_t swfw_sync; | ||
3116 | uint32_t swmask = mask; | ||
3117 | |||
3118 | DEBUGFUNC("e1000_swfw_sync_release"); | ||
3119 | |||
3120 | if (!hw->swfw_sync_present) { | ||
3121 | e1000_put_hw_eeprom_semaphore(hw); | ||
3122 | return; | ||
3123 | } | ||
3124 | |||
3125 | /* if (e1000_get_hw_eeprom_semaphore(hw)) | ||
3126 | * return -E1000_ERR_SWFW_SYNC; */ | ||
3127 | while (e1000_get_hw_eeprom_semaphore(hw) != E1000_SUCCESS); | ||
3128 | /* empty */ | ||
3129 | |||
3130 | swfw_sync = E1000_READ_REG(hw, SW_FW_SYNC); | ||
3131 | swfw_sync &= ~swmask; | ||
3132 | E1000_WRITE_REG(hw, SW_FW_SYNC, swfw_sync); | ||
3133 | |||
3134 | e1000_put_hw_eeprom_semaphore(hw); | ||
3135 | } | ||
3136 | |||
2776 | /***************************************************************************** | 3137 | /***************************************************************************** |
2777 | * Reads the value from a PHY register, if the value is on a specific non zero | 3138 | * Reads the value from a PHY register, if the value is on a specific non zero |
2778 | * page, sets the page first. | 3139 | * page, sets the page first. |
@@ -2785,22 +3146,55 @@ e1000_read_phy_reg(struct e1000_hw *hw, | |||
2785 | uint16_t *phy_data) | 3146 | uint16_t *phy_data) |
2786 | { | 3147 | { |
2787 | uint32_t ret_val; | 3148 | uint32_t ret_val; |
3149 | uint16_t swfw; | ||
2788 | 3150 | ||
2789 | DEBUGFUNC("e1000_read_phy_reg"); | 3151 | DEBUGFUNC("e1000_read_phy_reg"); |
2790 | 3152 | ||
3153 | if ((hw->mac_type == e1000_80003es2lan) && | ||
3154 | (E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1)) { | ||
3155 | swfw = E1000_SWFW_PHY1_SM; | ||
3156 | } else { | ||
3157 | swfw = E1000_SWFW_PHY0_SM; | ||
3158 | } | ||
3159 | if (e1000_swfw_sync_acquire(hw, swfw)) | ||
3160 | return -E1000_ERR_SWFW_SYNC; | ||
3161 | |||
2791 | if((hw->phy_type == e1000_phy_igp || | 3162 | if((hw->phy_type == e1000_phy_igp || |
2792 | hw->phy_type == e1000_phy_igp_2) && | 3163 | hw->phy_type == e1000_phy_igp_2) && |
2793 | (reg_addr > MAX_PHY_MULTI_PAGE_REG)) { | 3164 | (reg_addr > MAX_PHY_MULTI_PAGE_REG)) { |
2794 | ret_val = e1000_write_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT, | 3165 | ret_val = e1000_write_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT, |
2795 | (uint16_t)reg_addr); | 3166 | (uint16_t)reg_addr); |
2796 | if(ret_val) { | 3167 | if(ret_val) { |
3168 | e1000_swfw_sync_release(hw, swfw); | ||
2797 | return ret_val; | 3169 | return ret_val; |
2798 | } | 3170 | } |
3171 | } else if (hw->phy_type == e1000_phy_gg82563) { | ||
3172 | if (((reg_addr & MAX_PHY_REG_ADDRESS) > MAX_PHY_MULTI_PAGE_REG) || | ||
3173 | (hw->mac_type == e1000_80003es2lan)) { | ||
3174 | /* Select Configuration Page */ | ||
3175 | if ((reg_addr & MAX_PHY_REG_ADDRESS) < GG82563_MIN_ALT_REG) { | ||
3176 | ret_val = e1000_write_phy_reg_ex(hw, GG82563_PHY_PAGE_SELECT, | ||
3177 | (uint16_t)((uint16_t)reg_addr >> GG82563_PAGE_SHIFT)); | ||
3178 | } else { | ||
3179 | /* Use Alternative Page Select register to access | ||
3180 | * registers 30 and 31 | ||
3181 | */ | ||
3182 | ret_val = e1000_write_phy_reg_ex(hw, | ||
3183 | GG82563_PHY_PAGE_SELECT_ALT, | ||
3184 | (uint16_t)((uint16_t)reg_addr >> GG82563_PAGE_SHIFT)); | ||
3185 | } | ||
3186 | |||
3187 | if (ret_val) { | ||
3188 | e1000_swfw_sync_release(hw, swfw); | ||
3189 | return ret_val; | ||
3190 | } | ||
3191 | } | ||
2799 | } | 3192 | } |
2800 | 3193 | ||
2801 | ret_val = e1000_read_phy_reg_ex(hw, MAX_PHY_REG_ADDRESS & reg_addr, | 3194 | ret_val = e1000_read_phy_reg_ex(hw, MAX_PHY_REG_ADDRESS & reg_addr, |
2802 | phy_data); | 3195 | phy_data); |
2803 | 3196 | ||
3197 | e1000_swfw_sync_release(hw, swfw); | ||
2804 | return ret_val; | 3198 | return ret_val; |
2805 | } | 3199 | } |
2806 | 3200 | ||
@@ -2891,22 +3285,55 @@ e1000_write_phy_reg(struct e1000_hw *hw, | |||
2891 | uint16_t phy_data) | 3285 | uint16_t phy_data) |
2892 | { | 3286 | { |
2893 | uint32_t ret_val; | 3287 | uint32_t ret_val; |
3288 | uint16_t swfw; | ||
2894 | 3289 | ||
2895 | DEBUGFUNC("e1000_write_phy_reg"); | 3290 | DEBUGFUNC("e1000_write_phy_reg"); |
2896 | 3291 | ||
3292 | if ((hw->mac_type == e1000_80003es2lan) && | ||
3293 | (E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1)) { | ||
3294 | swfw = E1000_SWFW_PHY1_SM; | ||
3295 | } else { | ||
3296 | swfw = E1000_SWFW_PHY0_SM; | ||
3297 | } | ||
3298 | if (e1000_swfw_sync_acquire(hw, swfw)) | ||
3299 | return -E1000_ERR_SWFW_SYNC; | ||
3300 | |||
2897 | if((hw->phy_type == e1000_phy_igp || | 3301 | if((hw->phy_type == e1000_phy_igp || |
2898 | hw->phy_type == e1000_phy_igp_2) && | 3302 | hw->phy_type == e1000_phy_igp_2) && |
2899 | (reg_addr > MAX_PHY_MULTI_PAGE_REG)) { | 3303 | (reg_addr > MAX_PHY_MULTI_PAGE_REG)) { |
2900 | ret_val = e1000_write_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT, | 3304 | ret_val = e1000_write_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT, |
2901 | (uint16_t)reg_addr); | 3305 | (uint16_t)reg_addr); |
2902 | if(ret_val) { | 3306 | if(ret_val) { |
3307 | e1000_swfw_sync_release(hw, swfw); | ||
2903 | return ret_val; | 3308 | return ret_val; |
2904 | } | 3309 | } |
3310 | } else if (hw->phy_type == e1000_phy_gg82563) { | ||
3311 | if (((reg_addr & MAX_PHY_REG_ADDRESS) > MAX_PHY_MULTI_PAGE_REG) || | ||
3312 | (hw->mac_type == e1000_80003es2lan)) { | ||
3313 | /* Select Configuration Page */ | ||
3314 | if ((reg_addr & MAX_PHY_REG_ADDRESS) < GG82563_MIN_ALT_REG) { | ||
3315 | ret_val = e1000_write_phy_reg_ex(hw, GG82563_PHY_PAGE_SELECT, | ||
3316 | (uint16_t)((uint16_t)reg_addr >> GG82563_PAGE_SHIFT)); | ||
3317 | } else { | ||
3318 | /* Use Alternative Page Select register to access | ||
3319 | * registers 30 and 31 | ||
3320 | */ | ||
3321 | ret_val = e1000_write_phy_reg_ex(hw, | ||
3322 | GG82563_PHY_PAGE_SELECT_ALT, | ||
3323 | (uint16_t)((uint16_t)reg_addr >> GG82563_PAGE_SHIFT)); | ||
3324 | } | ||
3325 | |||
3326 | if (ret_val) { | ||
3327 | e1000_swfw_sync_release(hw, swfw); | ||
3328 | return ret_val; | ||
3329 | } | ||
3330 | } | ||
2905 | } | 3331 | } |
2906 | 3332 | ||
2907 | ret_val = e1000_write_phy_reg_ex(hw, MAX_PHY_REG_ADDRESS & reg_addr, | 3333 | ret_val = e1000_write_phy_reg_ex(hw, MAX_PHY_REG_ADDRESS & reg_addr, |
2908 | phy_data); | 3334 | phy_data); |
2909 | 3335 | ||
3336 | e1000_swfw_sync_release(hw, swfw); | ||
2910 | return ret_val; | 3337 | return ret_val; |
2911 | } | 3338 | } |
2912 | 3339 | ||
@@ -2973,6 +3400,65 @@ e1000_write_phy_reg_ex(struct e1000_hw *hw, | |||
2973 | return E1000_SUCCESS; | 3400 | return E1000_SUCCESS; |
2974 | } | 3401 | } |
2975 | 3402 | ||
3403 | int32_t | ||
3404 | e1000_read_kmrn_reg(struct e1000_hw *hw, | ||
3405 | uint32_t reg_addr, | ||
3406 | uint16_t *data) | ||
3407 | { | ||
3408 | uint32_t reg_val; | ||
3409 | uint16_t swfw; | ||
3410 | DEBUGFUNC("e1000_read_kmrn_reg"); | ||
3411 | |||
3412 | if ((hw->mac_type == e1000_80003es2lan) && | ||
3413 | (E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1)) { | ||
3414 | swfw = E1000_SWFW_PHY1_SM; | ||
3415 | } else { | ||
3416 | swfw = E1000_SWFW_PHY0_SM; | ||
3417 | } | ||
3418 | if (e1000_swfw_sync_acquire(hw, swfw)) | ||
3419 | return -E1000_ERR_SWFW_SYNC; | ||
3420 | |||
3421 | /* Write register address */ | ||
3422 | reg_val = ((reg_addr << E1000_KUMCTRLSTA_OFFSET_SHIFT) & | ||
3423 | E1000_KUMCTRLSTA_OFFSET) | | ||
3424 | E1000_KUMCTRLSTA_REN; | ||
3425 | E1000_WRITE_REG(hw, KUMCTRLSTA, reg_val); | ||
3426 | udelay(2); | ||
3427 | |||
3428 | /* Read the data returned */ | ||
3429 | reg_val = E1000_READ_REG(hw, KUMCTRLSTA); | ||
3430 | *data = (uint16_t)reg_val; | ||
3431 | |||
3432 | e1000_swfw_sync_release(hw, swfw); | ||
3433 | return E1000_SUCCESS; | ||
3434 | } | ||
3435 | |||
3436 | int32_t | ||
3437 | e1000_write_kmrn_reg(struct e1000_hw *hw, | ||
3438 | uint32_t reg_addr, | ||
3439 | uint16_t data) | ||
3440 | { | ||
3441 | uint32_t reg_val; | ||
3442 | uint16_t swfw; | ||
3443 | DEBUGFUNC("e1000_write_kmrn_reg"); | ||
3444 | |||
3445 | if ((hw->mac_type == e1000_80003es2lan) && | ||
3446 | (E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1)) { | ||
3447 | swfw = E1000_SWFW_PHY1_SM; | ||
3448 | } else { | ||
3449 | swfw = E1000_SWFW_PHY0_SM; | ||
3450 | } | ||
3451 | if (e1000_swfw_sync_acquire(hw, swfw)) | ||
3452 | return -E1000_ERR_SWFW_SYNC; | ||
3453 | |||
3454 | reg_val = ((reg_addr << E1000_KUMCTRLSTA_OFFSET_SHIFT) & | ||
3455 | E1000_KUMCTRLSTA_OFFSET) | data; | ||
3456 | E1000_WRITE_REG(hw, KUMCTRLSTA, reg_val); | ||
3457 | udelay(2); | ||
3458 | |||
3459 | e1000_swfw_sync_release(hw, swfw); | ||
3460 | return E1000_SUCCESS; | ||
3461 | } | ||
2976 | 3462 | ||
2977 | /****************************************************************************** | 3463 | /****************************************************************************** |
2978 | * Returns the PHY to the power-on reset state | 3464 | * Returns the PHY to the power-on reset state |
@@ -2985,6 +3471,7 @@ e1000_phy_hw_reset(struct e1000_hw *hw) | |||
2985 | uint32_t ctrl, ctrl_ext; | 3471 | uint32_t ctrl, ctrl_ext; |
2986 | uint32_t led_ctrl; | 3472 | uint32_t led_ctrl; |
2987 | int32_t ret_val; | 3473 | int32_t ret_val; |
3474 | uint16_t swfw; | ||
2988 | 3475 | ||
2989 | DEBUGFUNC("e1000_phy_hw_reset"); | 3476 | DEBUGFUNC("e1000_phy_hw_reset"); |
2990 | 3477 | ||
@@ -2997,6 +3484,16 @@ e1000_phy_hw_reset(struct e1000_hw *hw) | |||
2997 | DEBUGOUT("Resetting Phy...\n"); | 3484 | DEBUGOUT("Resetting Phy...\n"); |
2998 | 3485 | ||
2999 | if(hw->mac_type > e1000_82543) { | 3486 | if(hw->mac_type > e1000_82543) { |
3487 | if ((hw->mac_type == e1000_80003es2lan) && | ||
3488 | (E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1)) { | ||
3489 | swfw = E1000_SWFW_PHY1_SM; | ||
3490 | } else { | ||
3491 | swfw = E1000_SWFW_PHY0_SM; | ||
3492 | } | ||
3493 | if (e1000_swfw_sync_acquire(hw, swfw)) { | ||
3494 | e1000_release_software_semaphore(hw); | ||
3495 | return -E1000_ERR_SWFW_SYNC; | ||
3496 | } | ||
3000 | /* Read the device control register and assert the E1000_CTRL_PHY_RST | 3497 | /* Read the device control register and assert the E1000_CTRL_PHY_RST |
3001 | * bit. Then, take it out of reset. | 3498 | * bit. Then, take it out of reset. |
3002 | * For pre-e1000_82571 hardware, we delay for 10ms between the assert | 3499 | * For pre-e1000_82571 hardware, we delay for 10ms between the assert |
@@ -3017,6 +3514,7 @@ e1000_phy_hw_reset(struct e1000_hw *hw) | |||
3017 | 3514 | ||
3018 | if (hw->mac_type >= e1000_82571) | 3515 | if (hw->mac_type >= e1000_82571) |
3019 | msec_delay(10); | 3516 | msec_delay(10); |
3517 | e1000_swfw_sync_release(hw, swfw); | ||
3020 | } else { | 3518 | } else { |
3021 | /* Read the Extended Device Control Register, assert the PHY_RESET_DIR | 3519 | /* Read the Extended Device Control Register, assert the PHY_RESET_DIR |
3022 | * bit to put the PHY into reset. Then, take it out of reset. | 3520 | * bit to put the PHY into reset. Then, take it out of reset. |
@@ -3043,6 +3541,7 @@ e1000_phy_hw_reset(struct e1000_hw *hw) | |||
3043 | 3541 | ||
3044 | /* Wait for FW to finish PHY configuration. */ | 3542 | /* Wait for FW to finish PHY configuration. */ |
3045 | ret_val = e1000_get_phy_cfg_done(hw); | 3543 | ret_val = e1000_get_phy_cfg_done(hw); |
3544 | e1000_release_software_semaphore(hw); | ||
3046 | 3545 | ||
3047 | return ret_val; | 3546 | return ret_val; |
3048 | } | 3547 | } |
@@ -3120,6 +3619,15 @@ e1000_detect_gig_phy(struct e1000_hw *hw) | |||
3120 | return E1000_SUCCESS; | 3619 | return E1000_SUCCESS; |
3121 | } | 3620 | } |
3122 | 3621 | ||
3622 | /* ESB-2 PHY reads require e1000_phy_gg82563 to be set because of a work- | ||
3623 | * around that forces PHY page 0 to be set or the reads fail. The rest of | ||
3624 | * the code in this routine uses e1000_read_phy_reg to read the PHY ID. | ||
3625 | * So for ESB-2 we need to have this set so our reads won't fail. If the | ||
3626 | * attached PHY is not a e1000_phy_gg82563, the routines below will figure | ||
3627 | * this out as well. */ | ||
3628 | if (hw->mac_type == e1000_80003es2lan) | ||
3629 | hw->phy_type = e1000_phy_gg82563; | ||
3630 | |||
3123 | /* Read the PHY ID Registers to identify which PHY is onboard. */ | 3631 | /* Read the PHY ID Registers to identify which PHY is onboard. */ |
3124 | ret_val = e1000_read_phy_reg(hw, PHY_ID1, &phy_id_high); | 3632 | ret_val = e1000_read_phy_reg(hw, PHY_ID1, &phy_id_high); |
3125 | if(ret_val) | 3633 | if(ret_val) |
@@ -3157,6 +3665,9 @@ e1000_detect_gig_phy(struct e1000_hw *hw) | |||
3157 | case e1000_82573: | 3665 | case e1000_82573: |
3158 | if(hw->phy_id == M88E1111_I_PHY_ID) match = TRUE; | 3666 | if(hw->phy_id == M88E1111_I_PHY_ID) match = TRUE; |
3159 | break; | 3667 | break; |
3668 | case e1000_80003es2lan: | ||
3669 | if (hw->phy_id == GG82563_E_PHY_ID) match = TRUE; | ||
3670 | break; | ||
3160 | default: | 3671 | default: |
3161 | DEBUGOUT1("Invalid MAC type %d\n", hw->mac_type); | 3672 | DEBUGOUT1("Invalid MAC type %d\n", hw->mac_type); |
3162 | return -E1000_ERR_CONFIG; | 3673 | return -E1000_ERR_CONFIG; |
@@ -3183,8 +3694,10 @@ e1000_phy_reset_dsp(struct e1000_hw *hw) | |||
3183 | DEBUGFUNC("e1000_phy_reset_dsp"); | 3694 | DEBUGFUNC("e1000_phy_reset_dsp"); |
3184 | 3695 | ||
3185 | do { | 3696 | do { |
3186 | ret_val = e1000_write_phy_reg(hw, 29, 0x001d); | 3697 | if (hw->phy_type != e1000_phy_gg82563) { |
3187 | if(ret_val) break; | 3698 | ret_val = e1000_write_phy_reg(hw, 29, 0x001d); |
3699 | if(ret_val) break; | ||
3700 | } | ||
3188 | ret_val = e1000_write_phy_reg(hw, 30, 0x00c1); | 3701 | ret_val = e1000_write_phy_reg(hw, 30, 0x00c1); |
3189 | if(ret_val) break; | 3702 | if(ret_val) break; |
3190 | ret_val = e1000_write_phy_reg(hw, 30, 0x0000); | 3703 | ret_val = e1000_write_phy_reg(hw, 30, 0x0000); |
@@ -3316,8 +3829,17 @@ e1000_phy_m88_get_info(struct e1000_hw *hw, | |||
3316 | /* Cable Length Estimation and Local/Remote Receiver Information | 3829 | /* Cable Length Estimation and Local/Remote Receiver Information |
3317 | * are only valid at 1000 Mbps. | 3830 | * are only valid at 1000 Mbps. |
3318 | */ | 3831 | */ |
3319 | phy_info->cable_length = ((phy_data & M88E1000_PSSR_CABLE_LENGTH) >> | 3832 | if (hw->phy_type != e1000_phy_gg82563) { |
3320 | M88E1000_PSSR_CABLE_LENGTH_SHIFT); | 3833 | phy_info->cable_length = ((phy_data & M88E1000_PSSR_CABLE_LENGTH) >> |
3834 | M88E1000_PSSR_CABLE_LENGTH_SHIFT); | ||
3835 | } else { | ||
3836 | ret_val = e1000_read_phy_reg(hw, GG82563_PHY_DSP_DISTANCE, | ||
3837 | &phy_data); | ||
3838 | if (ret_val) | ||
3839 | return ret_val; | ||
3840 | |||
3841 | phy_info->cable_length = phy_data & GG82563_DSPD_CABLE_LENGTH; | ||
3842 | } | ||
3321 | 3843 | ||
3322 | ret_val = e1000_read_phy_reg(hw, PHY_1000T_STATUS, &phy_data); | 3844 | ret_val = e1000_read_phy_reg(hw, PHY_1000T_STATUS, &phy_data); |
3323 | if(ret_val) | 3845 | if(ret_val) |
@@ -3511,6 +4033,20 @@ e1000_init_eeprom_params(struct e1000_hw *hw) | |||
3511 | E1000_WRITE_REG(hw, EECD, eecd); | 4033 | E1000_WRITE_REG(hw, EECD, eecd); |
3512 | } | 4034 | } |
3513 | break; | 4035 | break; |
4036 | case e1000_80003es2lan: | ||
4037 | eeprom->type = e1000_eeprom_spi; | ||
4038 | eeprom->opcode_bits = 8; | ||
4039 | eeprom->delay_usec = 1; | ||
4040 | if (eecd & E1000_EECD_ADDR_BITS) { | ||
4041 | eeprom->page_size = 32; | ||
4042 | eeprom->address_bits = 16; | ||
4043 | } else { | ||
4044 | eeprom->page_size = 8; | ||
4045 | eeprom->address_bits = 8; | ||
4046 | } | ||
4047 | eeprom->use_eerd = TRUE; | ||
4048 | eeprom->use_eewr = FALSE; | ||
4049 | break; | ||
3514 | default: | 4050 | default: |
3515 | break; | 4051 | break; |
3516 | } | 4052 | } |
@@ -3691,9 +4227,8 @@ e1000_acquire_eeprom(struct e1000_hw *hw) | |||
3691 | 4227 | ||
3692 | DEBUGFUNC("e1000_acquire_eeprom"); | 4228 | DEBUGFUNC("e1000_acquire_eeprom"); |
3693 | 4229 | ||
3694 | if(e1000_get_hw_eeprom_semaphore(hw)) | 4230 | if (e1000_swfw_sync_acquire(hw, E1000_SWFW_EEP_SM)) |
3695 | return -E1000_ERR_EEPROM; | 4231 | return -E1000_ERR_SWFW_SYNC; |
3696 | |||
3697 | eecd = E1000_READ_REG(hw, EECD); | 4232 | eecd = E1000_READ_REG(hw, EECD); |
3698 | 4233 | ||
3699 | if (hw->mac_type != e1000_82573) { | 4234 | if (hw->mac_type != e1000_82573) { |
@@ -3712,7 +4247,7 @@ e1000_acquire_eeprom(struct e1000_hw *hw) | |||
3712 | eecd &= ~E1000_EECD_REQ; | 4247 | eecd &= ~E1000_EECD_REQ; |
3713 | E1000_WRITE_REG(hw, EECD, eecd); | 4248 | E1000_WRITE_REG(hw, EECD, eecd); |
3714 | DEBUGOUT("Could not acquire EEPROM grant\n"); | 4249 | DEBUGOUT("Could not acquire EEPROM grant\n"); |
3715 | e1000_put_hw_eeprom_semaphore(hw); | 4250 | e1000_swfw_sync_release(hw, E1000_SWFW_EEP_SM); |
3716 | return -E1000_ERR_EEPROM; | 4251 | return -E1000_ERR_EEPROM; |
3717 | } | 4252 | } |
3718 | } | 4253 | } |
@@ -3835,7 +4370,7 @@ e1000_release_eeprom(struct e1000_hw *hw) | |||
3835 | E1000_WRITE_REG(hw, EECD, eecd); | 4370 | E1000_WRITE_REG(hw, EECD, eecd); |
3836 | } | 4371 | } |
3837 | 4372 | ||
3838 | e1000_put_hw_eeprom_semaphore(hw); | 4373 | e1000_swfw_sync_release(hw, E1000_SWFW_EEP_SM); |
3839 | } | 4374 | } |
3840 | 4375 | ||
3841 | /****************************************************************************** | 4376 | /****************************************************************************** |
@@ -3914,6 +4449,8 @@ e1000_read_eeprom(struct e1000_hw *hw, | |||
3914 | if (e1000_is_onboard_nvm_eeprom(hw) == TRUE && | 4449 | if (e1000_is_onboard_nvm_eeprom(hw) == TRUE && |
3915 | hw->eeprom.use_eerd == FALSE) { | 4450 | hw->eeprom.use_eerd == FALSE) { |
3916 | switch (hw->mac_type) { | 4451 | switch (hw->mac_type) { |
4452 | case e1000_80003es2lan: | ||
4453 | break; | ||
3917 | default: | 4454 | default: |
3918 | /* Prepare the EEPROM for reading */ | 4455 | /* Prepare the EEPROM for reading */ |
3919 | if (e1000_acquire_eeprom(hw) != E1000_SUCCESS) | 4456 | if (e1000_acquire_eeprom(hw) != E1000_SUCCESS) |
@@ -4031,6 +4568,9 @@ e1000_write_eeprom_eewr(struct e1000_hw *hw, | |||
4031 | uint32_t i = 0; | 4568 | uint32_t i = 0; |
4032 | int32_t error = 0; | 4569 | int32_t error = 0; |
4033 | 4570 | ||
4571 | if (e1000_swfw_sync_acquire(hw, E1000_SWFW_EEP_SM)) | ||
4572 | return -E1000_ERR_SWFW_SYNC; | ||
4573 | |||
4034 | for (i = 0; i < words; i++) { | 4574 | for (i = 0; i < words; i++) { |
4035 | register_value = (data[i] << E1000_EEPROM_RW_REG_DATA) | | 4575 | register_value = (data[i] << E1000_EEPROM_RW_REG_DATA) | |
4036 | ((offset+i) << E1000_EEPROM_RW_ADDR_SHIFT) | | 4576 | ((offset+i) << E1000_EEPROM_RW_ADDR_SHIFT) | |
@@ -4050,6 +4590,7 @@ e1000_write_eeprom_eewr(struct e1000_hw *hw, | |||
4050 | } | 4590 | } |
4051 | } | 4591 | } |
4052 | 4592 | ||
4593 | e1000_swfw_sync_release(hw, E1000_SWFW_EEP_SM); | ||
4053 | return error; | 4594 | return error; |
4054 | } | 4595 | } |
4055 | 4596 | ||
@@ -4091,6 +4632,8 @@ e1000_is_onboard_nvm_eeprom(struct e1000_hw *hw) | |||
4091 | { | 4632 | { |
4092 | uint32_t eecd = 0; | 4633 | uint32_t eecd = 0; |
4093 | 4634 | ||
4635 | DEBUGFUNC("e1000_is_onboard_nvm_eeprom"); | ||
4636 | |||
4094 | if(hw->mac_type == e1000_82573) { | 4637 | if(hw->mac_type == e1000_82573) { |
4095 | eecd = E1000_READ_REG(hw, EECD); | 4638 | eecd = E1000_READ_REG(hw, EECD); |
4096 | 4639 | ||
@@ -4517,6 +5060,7 @@ e1000_read_mac_addr(struct e1000_hw * hw) | |||
4517 | case e1000_82546: | 5060 | case e1000_82546: |
4518 | case e1000_82546_rev_3: | 5061 | case e1000_82546_rev_3: |
4519 | case e1000_82571: | 5062 | case e1000_82571: |
5063 | case e1000_80003es2lan: | ||
4520 | if(E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1) | 5064 | if(E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1) |
4521 | hw->perm_mac_addr[5] ^= 0x01; | 5065 | hw->perm_mac_addr[5] ^= 0x01; |
4522 | break; | 5066 | break; |
@@ -4778,6 +5322,7 @@ e1000_rar_set(struct e1000_hw *hw, | |||
4778 | switch (hw->mac_type) { | 5322 | switch (hw->mac_type) { |
4779 | case e1000_82571: | 5323 | case e1000_82571: |
4780 | case e1000_82572: | 5324 | case e1000_82572: |
5325 | case e1000_80003es2lan: | ||
4781 | if (hw->leave_av_bit_off == TRUE) | 5326 | if (hw->leave_av_bit_off == TRUE) |
4782 | break; | 5327 | break; |
4783 | default: | 5328 | default: |
@@ -5364,6 +5909,7 @@ e1000_get_bus_info(struct e1000_hw *hw) | |||
5364 | hw->bus_width = e1000_bus_width_pciex_1; | 5909 | hw->bus_width = e1000_bus_width_pciex_1; |
5365 | break; | 5910 | break; |
5366 | case e1000_82571: | 5911 | case e1000_82571: |
5912 | case e1000_80003es2lan: | ||
5367 | hw->bus_type = e1000_bus_type_pci_express; | 5913 | hw->bus_type = e1000_bus_type_pci_express; |
5368 | hw->bus_speed = e1000_bus_speed_2500; | 5914 | hw->bus_speed = e1000_bus_speed_2500; |
5369 | hw->bus_width = e1000_bus_width_pciex_4; | 5915 | hw->bus_width = e1000_bus_width_pciex_4; |
@@ -5509,6 +6055,34 @@ e1000_get_cable_length(struct e1000_hw *hw, | |||
5509 | return -E1000_ERR_PHY; | 6055 | return -E1000_ERR_PHY; |
5510 | break; | 6056 | break; |
5511 | } | 6057 | } |
6058 | } else if (hw->phy_type == e1000_phy_gg82563) { | ||
6059 | ret_val = e1000_read_phy_reg(hw, GG82563_PHY_DSP_DISTANCE, | ||
6060 | &phy_data); | ||
6061 | if (ret_val) | ||
6062 | return ret_val; | ||
6063 | cable_length = phy_data & GG82563_DSPD_CABLE_LENGTH; | ||
6064 | |||
6065 | switch (cable_length) { | ||
6066 | case e1000_gg_cable_length_60: | ||
6067 | *min_length = 0; | ||
6068 | *max_length = e1000_igp_cable_length_60; | ||
6069 | break; | ||
6070 | case e1000_gg_cable_length_60_115: | ||
6071 | *min_length = e1000_igp_cable_length_60; | ||
6072 | *max_length = e1000_igp_cable_length_115; | ||
6073 | break; | ||
6074 | case e1000_gg_cable_length_115_150: | ||
6075 | *min_length = e1000_igp_cable_length_115; | ||
6076 | *max_length = e1000_igp_cable_length_150; | ||
6077 | break; | ||
6078 | case e1000_gg_cable_length_150: | ||
6079 | *min_length = e1000_igp_cable_length_150; | ||
6080 | *max_length = e1000_igp_cable_length_180; | ||
6081 | break; | ||
6082 | default: | ||
6083 | return -E1000_ERR_PHY; | ||
6084 | break; | ||
6085 | } | ||
5512 | } else if(hw->phy_type == e1000_phy_igp) { /* For IGP PHY */ | 6086 | } else if(hw->phy_type == e1000_phy_igp) { /* For IGP PHY */ |
5513 | uint16_t agc_reg_array[IGP01E1000_PHY_CHANNEL_NUM] = | 6087 | uint16_t agc_reg_array[IGP01E1000_PHY_CHANNEL_NUM] = |
5514 | {IGP01E1000_PHY_AGC_A, | 6088 | {IGP01E1000_PHY_AGC_A, |
@@ -5618,7 +6192,8 @@ e1000_check_polarity(struct e1000_hw *hw, | |||
5618 | 6192 | ||
5619 | DEBUGFUNC("e1000_check_polarity"); | 6193 | DEBUGFUNC("e1000_check_polarity"); |
5620 | 6194 | ||
5621 | if(hw->phy_type == e1000_phy_m88) { | 6195 | if ((hw->phy_type == e1000_phy_m88) || |
6196 | (hw->phy_type == e1000_phy_gg82563)) { | ||
5622 | /* return the Polarity bit in the Status register. */ | 6197 | /* return the Polarity bit in the Status register. */ |
5623 | ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, | 6198 | ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, |
5624 | &phy_data); | 6199 | &phy_data); |
@@ -5687,7 +6262,8 @@ e1000_check_downshift(struct e1000_hw *hw) | |||
5687 | return ret_val; | 6262 | return ret_val; |
5688 | 6263 | ||
5689 | hw->speed_downgraded = (phy_data & IGP01E1000_PLHR_SS_DOWNGRADE) ? 1 : 0; | 6264 | hw->speed_downgraded = (phy_data & IGP01E1000_PLHR_SS_DOWNGRADE) ? 1 : 0; |
5690 | } else if(hw->phy_type == e1000_phy_m88) { | 6265 | } else if ((hw->phy_type == e1000_phy_m88) || |
6266 | (hw->phy_type == e1000_phy_gg82563)) { | ||
5691 | ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, | 6267 | ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, |
5692 | &phy_data); | 6268 | &phy_data); |
5693 | if(ret_val) | 6269 | if(ret_val) |
@@ -6720,6 +7296,7 @@ e1000_get_auto_rd_done(struct e1000_hw *hw) | |||
6720 | case e1000_82571: | 7296 | case e1000_82571: |
6721 | case e1000_82572: | 7297 | case e1000_82572: |
6722 | case e1000_82573: | 7298 | case e1000_82573: |
7299 | case e1000_80003es2lan: | ||
6723 | while(timeout) { | 7300 | while(timeout) { |
6724 | if (E1000_READ_REG(hw, EECD) & E1000_EECD_AUTO_RD) break; | 7301 | if (E1000_READ_REG(hw, EECD) & E1000_EECD_AUTO_RD) break; |
6725 | else msec_delay(1); | 7302 | else msec_delay(1); |
@@ -6763,6 +7340,11 @@ e1000_get_phy_cfg_done(struct e1000_hw *hw) | |||
6763 | default: | 7340 | default: |
6764 | msec_delay(10); | 7341 | msec_delay(10); |
6765 | break; | 7342 | break; |
7343 | case e1000_80003es2lan: | ||
7344 | /* Separate *_CFG_DONE_* bit for each port */ | ||
7345 | if (E1000_READ_REG(hw, STATUS) & E1000_STATUS_FUNC_1) | ||
7346 | cfg_mask = E1000_EEPROM_CFG_DONE_PORT_1; | ||
7347 | /* Fall Through */ | ||
6766 | case e1000_82571: | 7348 | case e1000_82571: |
6767 | case e1000_82572: | 7349 | case e1000_82572: |
6768 | while (timeout) { | 7350 | while (timeout) { |
@@ -6805,6 +7387,11 @@ e1000_get_hw_eeprom_semaphore(struct e1000_hw *hw) | |||
6805 | if(!hw->eeprom_semaphore_present) | 7387 | if(!hw->eeprom_semaphore_present) |
6806 | return E1000_SUCCESS; | 7388 | return E1000_SUCCESS; |
6807 | 7389 | ||
7390 | if (hw->mac_type == e1000_80003es2lan) { | ||
7391 | /* Get the SW semaphore. */ | ||
7392 | if (e1000_get_software_semaphore(hw) != E1000_SUCCESS) | ||
7393 | return -E1000_ERR_EEPROM; | ||
7394 | } | ||
6808 | 7395 | ||
6809 | /* Get the FW semaphore. */ | 7396 | /* Get the FW semaphore. */ |
6810 | timeout = hw->eeprom.word_size + 1; | 7397 | timeout = hw->eeprom.word_size + 1; |
@@ -6850,10 +7437,75 @@ e1000_put_hw_eeprom_semaphore(struct e1000_hw *hw) | |||
6850 | return; | 7437 | return; |
6851 | 7438 | ||
6852 | swsm = E1000_READ_REG(hw, SWSM); | 7439 | swsm = E1000_READ_REG(hw, SWSM); |
7440 | if (hw->mac_type == e1000_80003es2lan) { | ||
7441 | /* Release both semaphores. */ | ||
7442 | swsm &= ~(E1000_SWSM_SMBI | E1000_SWSM_SWESMBI); | ||
7443 | } else | ||
6853 | swsm &= ~(E1000_SWSM_SWESMBI); | 7444 | swsm &= ~(E1000_SWSM_SWESMBI); |
6854 | E1000_WRITE_REG(hw, SWSM, swsm); | 7445 | E1000_WRITE_REG(hw, SWSM, swsm); |
6855 | } | 7446 | } |
6856 | 7447 | ||
7448 | /*************************************************************************** | ||
7449 | * | ||
7450 | * Obtaining software semaphore bit (SMBI) before resetting PHY. | ||
7451 | * | ||
7452 | * hw: Struct containing variables accessed by shared code | ||
7453 | * | ||
7454 | * returns: - E1000_ERR_RESET if fail to obtain semaphore. | ||
7455 | * E1000_SUCCESS at any other case. | ||
7456 | * | ||
7457 | ***************************************************************************/ | ||
7458 | int32_t | ||
7459 | e1000_get_software_semaphore(struct e1000_hw *hw) | ||
7460 | { | ||
7461 | int32_t timeout = hw->eeprom.word_size + 1; | ||
7462 | uint32_t swsm; | ||
7463 | |||
7464 | DEBUGFUNC("e1000_get_software_semaphore"); | ||
7465 | |||
7466 | if (hw->mac_type != e1000_80003es2lan) | ||
7467 | return E1000_SUCCESS; | ||
7468 | |||
7469 | while(timeout) { | ||
7470 | swsm = E1000_READ_REG(hw, SWSM); | ||
7471 | /* If SMBI bit cleared, it is now set and we hold the semaphore */ | ||
7472 | if(!(swsm & E1000_SWSM_SMBI)) | ||
7473 | break; | ||
7474 | msec_delay_irq(1); | ||
7475 | timeout--; | ||
7476 | } | ||
7477 | |||
7478 | if(!timeout) { | ||
7479 | DEBUGOUT("Driver can't access device - SMBI bit is set.\n"); | ||
7480 | return -E1000_ERR_RESET; | ||
7481 | } | ||
7482 | |||
7483 | return E1000_SUCCESS; | ||
7484 | } | ||
7485 | |||
7486 | /*************************************************************************** | ||
7487 | * | ||
7488 | * Release semaphore bit (SMBI). | ||
7489 | * | ||
7490 | * hw: Struct containing variables accessed by shared code | ||
7491 | * | ||
7492 | ***************************************************************************/ | ||
7493 | void | ||
7494 | e1000_release_software_semaphore(struct e1000_hw *hw) | ||
7495 | { | ||
7496 | uint32_t swsm; | ||
7497 | |||
7498 | DEBUGFUNC("e1000_release_software_semaphore"); | ||
7499 | |||
7500 | if (hw->mac_type != e1000_80003es2lan) | ||
7501 | return; | ||
7502 | |||
7503 | swsm = E1000_READ_REG(hw, SWSM); | ||
7504 | /* Release the SW semaphores.*/ | ||
7505 | swsm &= ~E1000_SWSM_SMBI; | ||
7506 | E1000_WRITE_REG(hw, SWSM, swsm); | ||
7507 | } | ||
7508 | |||
6857 | /****************************************************************************** | 7509 | /****************************************************************************** |
6858 | * Checks if PHY reset is blocked due to SOL/IDER session, for example. | 7510 | * Checks if PHY reset is blocked due to SOL/IDER session, for example. |
6859 | * Returning E1000_BLK_PHY_RESET isn't necessarily an error. But it's up to | 7511 | * Returning E1000_BLK_PHY_RESET isn't necessarily an error. But it's up to |
@@ -6890,6 +7542,7 @@ e1000_arc_subsystem_valid(struct e1000_hw *hw) | |||
6890 | case e1000_82571: | 7542 | case e1000_82571: |
6891 | case e1000_82572: | 7543 | case e1000_82572: |
6892 | case e1000_82573: | 7544 | case e1000_82573: |
7545 | case e1000_80003es2lan: | ||
6893 | fwsm = E1000_READ_REG(hw, FWSM); | 7546 | fwsm = E1000_READ_REG(hw, FWSM); |
6894 | if((fwsm & E1000_FWSM_MODE_MASK) != 0) | 7547 | if((fwsm & E1000_FWSM_MODE_MASK) != 0) |
6895 | return TRUE; | 7548 | return TRUE; |