Print this page
MFV: illumos-gate@5bb0bdfe588c5df0f63ff8ac292cd608a5f4492a
9950 Need support for Intel I219 v6-v9
Reviewed by: Jason King <jason.king@joyent.com>
Reviewed by: Garrett D'Amore <garrett@damore.org>
Approved by: Garrett D'Amore <garrett@damore.org>
Author: Robert Mustacchi <rm@joyent.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/e1000api/e1000_ich8lan.c
          +++ new/usr/src/uts/common/io/e1000api/e1000_ich8lan.c
↓ open down ↓ 235 lines elided ↑ open up ↑
 236  236                  hw->phy.ops.release(hw);
 237  237                  ret_val = e1000_set_mdio_slow_mode_hv(hw);
 238  238                  if (!ret_val)
 239  239                          ret_val = e1000_get_phy_id(hw);
 240  240                  hw->phy.ops.acquire(hw);
 241  241          }
 242  242  
 243  243          if (ret_val)
 244  244                  return FALSE;
 245  245  out:
 246      -        if ((hw->mac.type == e1000_pch_lpt) ||
 247      -            (hw->mac.type == e1000_pch_spt)) {
      246 +        if (hw->mac.type >= e1000_pch_lpt) {
 248  247                  /* Only unforce SMBus if ME is not active */
 249  248                  if (!(E1000_READ_REG(hw, E1000_FWSM) &
 250  249                      E1000_ICH_FWSM_FW_VALID)) {
 251  250                          /* Unforce SMBus mode in PHY */
 252  251                          hw->phy.ops.read_reg_locked(hw, CV_SMB_CTRL, &phy_reg);
 253  252                          phy_reg &= ~CV_SMB_CTRL_FORCE_SMBUS;
 254  253                          hw->phy.ops.write_reg_locked(hw, CV_SMB_CTRL, phy_reg);
 255  254  
 256  255                          /* Unforce SMBus mode in MAC */
 257  256                          mac_reg = E1000_READ_REG(hw, E1000_CTRL_EXT);
↓ open down ↓ 80 lines elided ↑ open up ↑
 338  337                  goto out;
 339  338          }
 340  339  
 341  340          /* The MAC-PHY interconnect may be in SMBus mode.  If the PHY is
 342  341           * inaccessible and resetting the PHY is not blocked, toggle the
 343  342           * LANPHYPC Value bit to force the interconnect to PCIe mode.
 344  343           */
 345  344          switch (hw->mac.type) {
 346  345          case e1000_pch_lpt:
 347  346          case e1000_pch_spt:
      347 +        case e1000_pch_cnp:
 348  348                  if (e1000_phy_is_accessible_pchlan(hw))
 349  349                          break;
 350  350  
 351  351                  /* Before toggling LANPHYPC, see if PHY is accessible by
 352  352                   * forcing MAC to SMBus mode first.
 353  353                   */
 354  354                  mac_reg = E1000_READ_REG(hw, E1000_CTRL_EXT);
 355  355                  mac_reg |= E1000_CTRL_EXT_FORCE_SMBUS;
 356  356                  E1000_WRITE_REG(hw, E1000_CTRL_EXT, mac_reg);
 357  357  
↓ open down ↓ 128 lines elided ↑ open up ↑
 486  486                  default:
 487  487                          ret_val = e1000_get_phy_id(hw);
 488  488                          if (ret_val)
 489  489                                  return ret_val;
 490  490                          if ((phy->id != 0) && (phy->id != PHY_REVISION_MASK))
 491  491                                  break;
 492  492                          /* fall-through */
 493  493                  case e1000_pch2lan:
 494  494                  case e1000_pch_lpt:
 495  495                  case e1000_pch_spt:
      496 +                case e1000_pch_cnp:
 496  497                          /* In case the PHY needs to be in mdio slow mode,
 497  498                           * set slow mode and try to get the PHY id again.
 498  499                           */
 499  500                          ret_val = e1000_set_mdio_slow_mode_hv(hw);
 500  501                          if (ret_val)
 501  502                                  return ret_val;
 502  503                          ret_val = e1000_get_phy_id(hw);
 503  504                          if (ret_val)
 504  505                                  return ret_val;
 505  506                          break;
↓ open down ↓ 128 lines elided ↑ open up ↑
 634  635          struct e1000_nvm_info *nvm = &hw->nvm;
 635  636          struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan;
 636  637          u32 gfpreg, sector_base_addr, sector_end_addr;
 637  638          u16 i;
 638  639          u32 nvm_size;
 639  640  
 640  641          DEBUGFUNC("e1000_init_nvm_params_ich8lan");
 641  642  
 642  643          nvm->type = e1000_nvm_flash_sw;
 643  644  
 644      -        if (hw->mac.type == e1000_pch_spt) {
      645 +        if (hw->mac.type >= e1000_pch_spt) {
 645  646                  /* in SPT, gfpreg doesn't exist. NVM size is taken from the
 646  647                   * STRAP register. This is because in SPT the GbE Flash region
 647  648                   * is no longer accessed through the flash registers. Instead,
 648  649                   * the mechanism has changed, and the Flash region access
 649  650                   * registers are now implemented in GbE memory space.
 650  651                   */
 651  652                  nvm->flash_base_addr = 0;
 652  653                  nvm_size =
 653  654                      (((E1000_READ_REG(hw, E1000_STRAP) >> 1) & 0x1F) + 1)
 654  655                      * NVM_SIZE_MULTIPLIER;
↓ open down ↓ 39 lines elided ↑ open up ↑
 694  695                  dev_spec->shadow_ram[i].modified = FALSE;
 695  696                  dev_spec->shadow_ram[i].value    = 0xFFFF;
 696  697          }
 697  698  
 698  699          E1000_MUTEX_INIT(&dev_spec->nvm_mutex);
 699  700          E1000_MUTEX_INIT(&dev_spec->swflag_mutex);
 700  701  
 701  702          /* Function Pointers */
 702  703          nvm->ops.acquire        = e1000_acquire_nvm_ich8lan;
 703  704          nvm->ops.release        = e1000_release_nvm_ich8lan;
 704      -        if (hw->mac.type == e1000_pch_spt) {
      705 +        if (hw->mac.type >= e1000_pch_spt) {
 705  706                  nvm->ops.read   = e1000_read_nvm_spt;
 706  707                  nvm->ops.update = e1000_update_nvm_checksum_spt;
 707  708          } else {
 708  709                  nvm->ops.read   = e1000_read_nvm_ich8lan;
 709  710                  nvm->ops.update = e1000_update_nvm_checksum_ich8lan;
 710  711          }
 711  712          nvm->ops.valid_led_default = e1000_valid_led_default_ich8lan;
 712  713          nvm->ops.validate       = e1000_validate_nvm_checksum_ich8lan;
 713  714          nvm->ops.write          = e1000_write_nvm_ich8lan;
 714  715  
↓ open down ↓ 72 lines elided ↑ open up ↑
 787  788                  /* turn on/off LED */
 788  789                  mac->ops.led_on = e1000_led_on_ich8lan;
 789  790                  mac->ops.led_off = e1000_led_off_ich8lan;
 790  791                  break;
 791  792          case e1000_pch2lan:
 792  793                  mac->rar_entry_count = E1000_PCH2_RAR_ENTRIES;
 793  794                  mac->ops.rar_set = e1000_rar_set_pch2lan;
 794  795                  /* fall-through */
 795  796          case e1000_pch_lpt:
 796  797          case e1000_pch_spt:
      798 +        case e1000_pch_cnp:
 797  799                  /* multicast address update for pch2 */
 798  800                  mac->ops.update_mc_addr_list =
 799  801                          e1000_update_mc_addr_list_pch2lan;
 800  802                  /* fall-through */
 801  803          case e1000_pchlan:
 802  804                  /* check management mode */
 803  805                  mac->ops.check_mng_mode = e1000_check_mng_mode_pchlan;
 804  806                  /* ID LED init */
 805  807                  mac->ops.id_led_init = e1000_id_led_init_pchlan;
 806  808                  /* setup LED */
↓ open down ↓ 1 lines elided ↑ open up ↑
 808  810                  /* cleanup LED */
 809  811                  mac->ops.cleanup_led = e1000_cleanup_led_pchlan;
 810  812                  /* turn on/off LED */
 811  813                  mac->ops.led_on = e1000_led_on_pchlan;
 812  814                  mac->ops.led_off = e1000_led_off_pchlan;
 813  815                  break;
 814  816          default:
 815  817                  break;
 816  818          }
 817  819  
 818      -        if ((mac->type == e1000_pch_lpt) ||
 819      -            (mac->type == e1000_pch_spt)) {
      820 +        if (mac->type >= e1000_pch_lpt) {
 820  821                  mac->rar_entry_count = E1000_PCH_LPT_RAR_ENTRIES;
 821  822                  mac->ops.rar_set = e1000_rar_set_pch_lpt;
 822  823                  mac->ops.setup_physical_interface = e1000_setup_copper_link_pch_lpt;
 823  824                  mac->ops.set_obff_timer = e1000_set_obff_timer_pch_lpt;
 824  825          }
 825  826  
 826  827          /* Enable PCS Lock-loss workaround for ICH8 */
 827  828          if (mac->type == e1000_ich8lan)
 828  829                  e1000_set_kmrn_lock_loss_workaround_ich8lan(hw, TRUE);
 829  830  
↓ open down ↓ 739 lines elided ↑ open up ↑
1569 1570          if (hw->mac.type == e1000_pchlan) {
1570 1571                  ret_val = e1000_k1_gig_workaround_hv(hw, link);
1571 1572                  if (ret_val)
1572 1573                          return ret_val;
1573 1574          }
1574 1575  
1575 1576          /* When connected at 10Mbps half-duplex, some parts are excessively
1576 1577           * aggressive resulting in many collisions. To avoid this, increase
1577 1578           * the IPG and reduce Rx latency in the PHY.
1578 1579           */
1579      -        if (((hw->mac.type == e1000_pch2lan) ||
1580      -             (hw->mac.type == e1000_pch_lpt) ||
1581      -             (hw->mac.type == e1000_pch_spt)) && link) {
     1580 +        if ((hw->mac.type >= e1000_pch2lan) && link) {
1582 1581                  u16 speed, duplex;
1583 1582  
1584 1583                  e1000_get_speed_and_duplex_copper_generic(hw, &speed, &duplex);
1585 1584                  tipg_reg = E1000_READ_REG(hw, E1000_TIPG);
1586 1585                  tipg_reg &= ~E1000_TIPG_IPGT_MASK;
1587 1586  
1588 1587                  if (duplex == HALF_DUPLEX && speed == SPEED_10) {
1589 1588                          tipg_reg |= 0xFF;
1590 1589                          /* Reduce Rx latency in analog PHY */
1591 1590                          emi_val = 0;
1592      -                } else if (hw->mac.type == e1000_pch_spt &&
     1591 +                } else if (hw->mac.type >= e1000_pch_spt &&
1593 1592                             duplex == FULL_DUPLEX && speed != SPEED_1000) {
1594 1593                          tipg_reg |= 0xC;
1595 1594                          emi_val = 1;
1596 1595                  } else {
1597 1596                          /* Roll back the default values */
1598 1597                          tipg_reg |= 0x08;
1599 1598                          emi_val = 1;
1600 1599                  }
1601 1600  
1602 1601                  E1000_WRITE_REG(hw, E1000_TIPG, tipg_reg);
↓ open down ↓ 1 lines elided ↑ open up ↑
1604 1603                  ret_val = hw->phy.ops.acquire(hw);
1605 1604                  if (ret_val)
1606 1605                          return ret_val;
1607 1606  
1608 1607                  if (hw->mac.type == e1000_pch2lan)
1609 1608                          emi_addr = I82579_RX_CONFIG;
1610 1609                  else
1611 1610                          emi_addr = I217_RX_CONFIG;
1612 1611                  ret_val = e1000_write_emi_reg_locked(hw, emi_addr, emi_val);
1613 1612  
1614      -                if (hw->mac.type == e1000_pch_lpt ||
1615      -                    hw->mac.type == e1000_pch_spt) {
     1613 +                if (hw->mac.type >= e1000_pch_lpt) {
1616 1614                          u16 phy_reg;
1617 1615  
1618 1616                          hw->phy.ops.read_reg_locked(hw, I217_PLL_CLOCK_GATE_REG,
1619 1617                                                      &phy_reg);
1620 1618                          phy_reg &= ~I217_PLL_CLOCK_GATE_MASK;
1621 1619                          if (speed == SPEED_100 || speed == SPEED_10)
1622 1620                                  phy_reg |= 0x3E8;
1623 1621                          else
1624 1622                                  phy_reg |= 0xFA;
1625 1623                          hw->phy.ops.write_reg_locked(hw,
↓ open down ↓ 8 lines elided ↑ open up ↑
1634 1632  
1635 1633                                  hw->phy.ops.write_reg_locked(hw, HV_PM_CTRL,
1636 1634                                                               phy_reg);
1637 1635                                  }
1638 1636                   }
1639 1637                  hw->phy.ops.release(hw);
1640 1638  
1641 1639                  if (ret_val)
1642 1640                          return ret_val;
1643 1641  
1644      -                if (hw->mac.type == e1000_pch_spt) {
     1642 +                if (hw->mac.type >= e1000_pch_spt) {
1645 1643                          u16 data;
1646 1644                          u16 ptr_gap;
1647 1645  
1648 1646                          if (speed == SPEED_1000) {
1649 1647                                  ret_val = hw->phy.ops.acquire(hw);
1650 1648                                  if (ret_val)
1651 1649                                          return ret_val;
1652 1650  
1653 1651                                  ret_val = hw->phy.ops.read_reg_locked(hw,
1654 1652                                                                PHY_REG(776, 20),
↓ open down ↓ 28 lines elided ↑ open up ↑
1683 1681  
1684 1682                          }
1685 1683                  }
1686 1684          }
1687 1685  
1688 1686          /* I217 Packet Loss issue:
1689 1687           * ensure that FEXTNVM4 Beacon Duration is set correctly
1690 1688           * on power up.
1691 1689           * Set the Beacon Duration for I217 to 8 usec
1692 1690           */
1693      -        if ((hw->mac.type == e1000_pch_lpt) ||
1694      -            (hw->mac.type == e1000_pch_spt)) {
     1691 +        if (hw->mac.type >= e1000_pch_lpt) {
1695 1692                  u32 mac_reg;
1696 1693  
1697 1694                  mac_reg = E1000_READ_REG(hw, E1000_FEXTNVM4);
1698 1695                  mac_reg &= ~E1000_FEXTNVM4_BEACON_DURATION_MASK;
1699 1696                  mac_reg |= E1000_FEXTNVM4_BEACON_DURATION_8USEC;
1700 1697                  E1000_WRITE_REG(hw, E1000_FEXTNVM4, mac_reg);
1701 1698          }
1702 1699  
1703 1700          /* Work-around I218 hang issue */
1704 1701          if ((hw->device_id == E1000_DEV_ID_PCH_LPTLP_I218_LM) ||
1705 1702              (hw->device_id == E1000_DEV_ID_PCH_LPTLP_I218_V) ||
1706 1703              (hw->device_id == E1000_DEV_ID_PCH_I218_LM3) ||
1707 1704              (hw->device_id == E1000_DEV_ID_PCH_I218_V3)) {
1708 1705                  ret_val = e1000_k1_workaround_lpt_lp(hw, link);
1709 1706                  if (ret_val)
1710 1707                          return ret_val;
1711 1708          }
1712      -        if ((hw->mac.type == e1000_pch_lpt) ||
1713      -            (hw->mac.type == e1000_pch_spt)) {
     1709 +        if (hw->mac.type >= e1000_pch_lpt) {
1714 1710                  /* Set platform power management values for
1715 1711                   * Latency Tolerance Reporting (LTR)
1716 1712                   * Optimized Buffer Flush/Fill (OBFF)
1717 1713                   */
1718 1714                  ret_val = e1000_platform_pm_pch_lpt(hw, link);
1719 1715                  if (ret_val)
1720 1716                          return ret_val;
1721 1717          }
1722 1718  
1723 1719          /* Clear link partner's EEE ability */
1724 1720          hw->dev_spec.ich8lan.eee_lp_ability = 0;
1725 1721  
1726      -        /* FEXTNVM6 K1-off workaround */
     1722 +        /* FEXTNVM6 K1-off workaround - for SPT only */
1727 1723          if (hw->mac.type == e1000_pch_spt) {
1728 1724                  u32 pcieanacfg = E1000_READ_REG(hw, E1000_PCIEANACFG);
1729 1725                  u32 fextnvm6 = E1000_READ_REG(hw, E1000_FEXTNVM6);
1730 1726  
1731 1727                  if ((pcieanacfg & E1000_FEXTNVM6_K1_OFF_ENABLE) &&
1732 1728                          (hw->dev_spec.ich8lan.disable_k1_off == FALSE))
1733 1729                          fextnvm6 |= E1000_FEXTNVM6_K1_OFF_ENABLE;
1734 1730                  else
1735 1731                          fextnvm6 &= ~E1000_FEXTNVM6_K1_OFF_ENABLE;
1736 1732  
↓ open down ↓ 87 lines elided ↑ open up ↑
1824 1820          switch (hw->mac.type) {
1825 1821          case e1000_ich8lan:
1826 1822          case e1000_ich9lan:
1827 1823          case e1000_ich10lan:
1828 1824                  hw->phy.ops.init_params = e1000_init_phy_params_ich8lan;
1829 1825                  break;
1830 1826          case e1000_pchlan:
1831 1827          case e1000_pch2lan:
1832 1828          case e1000_pch_lpt:
1833 1829          case e1000_pch_spt:
     1830 +        case e1000_pch_cnp:
1834 1831                  hw->phy.ops.init_params = e1000_init_phy_params_pchlan;
1835 1832                  break;
1836 1833          default:
1837 1834                  break;
1838 1835          }
1839 1836  }
1840 1837  
1841 1838  /**
1842 1839   *  e1000_acquire_nvm_ich8lan - Acquire NVM mutex
1843 1840   *  @hw: pointer to the HW structure
↓ open down ↓ 444 lines elided ↑ open up ↑
2288 2285                  if ((hw->device_id == E1000_DEV_ID_ICH8_IGP_AMT) ||
2289 2286                      (hw->device_id == E1000_DEV_ID_ICH8_IGP_C)) {
2290 2287                          sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG;
2291 2288                          break;
2292 2289                  }
2293 2290                  /* Fall-thru */
2294 2291          case e1000_pchlan:
2295 2292          case e1000_pch2lan:
2296 2293          case e1000_pch_lpt:
2297 2294          case e1000_pch_spt:
     2295 +        case e1000_pch_cnp:
2298 2296                  sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG_ICH8M;
2299 2297                  break;
2300 2298          default:
2301 2299                  return ret_val;
2302 2300          }
2303 2301  
2304 2302          ret_val = hw->phy.ops.acquire(hw);
2305 2303          if (ret_val)
2306 2304                  return ret_val;
2307 2305  
↓ open down ↓ 1097 lines elided ↑ open up ↑
3405 3403          u32 bank1_offset = nvm->flash_bank_size * sizeof(u16);
3406 3404          u32 act_offset = E1000_ICH_NVM_SIG_WORD * 2 + 1;
3407 3405          u32 nvm_dword = 0;
3408 3406          u8 sig_byte = 0;
3409 3407          s32 ret_val;
3410 3408  
3411 3409          DEBUGFUNC("e1000_valid_nvm_bank_detect_ich8lan");
3412 3410  
3413 3411          switch (hw->mac.type) {
3414 3412          case e1000_pch_spt:
     3413 +        case e1000_pch_cnp:
3415 3414                  bank1_offset = nvm->flash_bank_size;
3416 3415                  act_offset = E1000_ICH_NVM_SIG_WORD;
3417 3416  
3418 3417                  /* set bank to 0 in case flash read fails */
3419 3418                  *bank = 0;
3420 3419  
3421 3420                  /* Check bank 0 */
3422 3421                  ret_val = e1000_read_flash_dword_ich8lan(hw, act_offset,
3423 3422                                                           &nvm_dword);
3424 3423                  if (ret_val)
↓ open down ↓ 239 lines elided ↑ open up ↑
3664 3663  
3665 3664          /* Check if the flash descriptor is valid */
3666 3665          if (!hsfsts.hsf_status.fldesvalid) {
3667 3666                  DEBUGOUT("Flash descriptor invalid.  SW Sequencing must be used.\n");
3668 3667                  return -E1000_ERR_NVM;
3669 3668          }
3670 3669  
3671 3670          /* Clear FCERR and DAEL in hw status by writing 1 */
3672 3671          hsfsts.hsf_status.flcerr = 1;
3673 3672          hsfsts.hsf_status.dael = 1;
3674      -        if (hw->mac.type == e1000_pch_spt)
     3673 +        if (hw->mac.type >= e1000_pch_spt)
3675 3674                  E1000_WRITE_FLASH_REG(hw, ICH_FLASH_HSFSTS,
3676 3675                                        hsfsts.regval & 0xFFFF);
3677 3676          else
3678 3677                  E1000_WRITE_FLASH_REG16(hw, ICH_FLASH_HSFSTS, hsfsts.regval);
3679 3678  
3680 3679          /* Either we should have a hardware SPI cycle in progress
3681 3680           * bit to check against, in order to start a new cycle or
3682 3681           * FDONE bit should be changed in the hardware so that it
3683 3682           * is 1 after hardware reset, which can then be used as an
3684 3683           * indication whether a cycle is in progress or has been
3685 3684           * completed.
3686 3685           */
3687 3686  
3688 3687          if (!hsfsts.hsf_status.flcinprog) {
3689 3688                  /* There is no cycle running at present,
3690 3689                   * so we can start a cycle.
3691 3690                   * Begin by setting Flash Cycle Done.
3692 3691                   */
3693 3692                  hsfsts.hsf_status.flcdone = 1;
3694      -                if (hw->mac.type == e1000_pch_spt)
     3693 +                if (hw->mac.type >= e1000_pch_spt)
3695 3694                          E1000_WRITE_FLASH_REG(hw, ICH_FLASH_HSFSTS,
3696 3695                                                hsfsts.regval & 0xFFFF);
3697 3696                  else
3698 3697                          E1000_WRITE_FLASH_REG16(hw, ICH_FLASH_HSFSTS,
3699 3698                                                  hsfsts.regval);
3700 3699                  ret_val = E1000_SUCCESS;
3701 3700          } else {
3702 3701                  s32 i;
3703 3702  
3704 3703                  /* Otherwise poll for sometime so the current
↓ open down ↓ 6 lines elided ↑ open up ↑
3711 3710                                  ret_val = E1000_SUCCESS;
3712 3711                                  break;
3713 3712                          }
3714 3713                          usec_delay(1);
3715 3714                  }
3716 3715                  if (ret_val == E1000_SUCCESS) {
3717 3716                          /* Successful in waiting for previous cycle to timeout,
3718 3717                           * now set the Flash Cycle Done.
3719 3718                           */
3720 3719                          hsfsts.hsf_status.flcdone = 1;
3721      -                        if (hw->mac.type == e1000_pch_spt)
     3720 +                        if (hw->mac.type >= e1000_pch_spt)
3722 3721                                  E1000_WRITE_FLASH_REG(hw, ICH_FLASH_HSFSTS,
3723 3722                                                        hsfsts.regval & 0xFFFF);
3724 3723                          else
3725 3724                                  E1000_WRITE_FLASH_REG16(hw, ICH_FLASH_HSFSTS,
3726 3725                                                          hsfsts.regval);
3727 3726                  } else {
3728 3727                          DEBUGOUT("Flash controller busy, cannot get access\n");
3729 3728                  }
3730 3729          }
3731 3730  
↓ open down ↓ 9 lines elided ↑ open up ↑
3741 3740   **/
3742 3741  static s32 e1000_flash_cycle_ich8lan(struct e1000_hw *hw, u32 timeout)
3743 3742  {
3744 3743          union ich8_hws_flash_ctrl hsflctl;
3745 3744          union ich8_hws_flash_status hsfsts;
3746 3745          u32 i = 0;
3747 3746  
3748 3747          DEBUGFUNC("e1000_flash_cycle_ich8lan");
3749 3748  
3750 3749          /* Start a cycle by writing 1 in Flash Cycle Go in Hw Flash Control */
3751      -        if (hw->mac.type == e1000_pch_spt)
     3750 +        if (hw->mac.type >= e1000_pch_spt)
3752 3751                  hsflctl.regval = E1000_READ_FLASH_REG(hw, ICH_FLASH_HSFSTS)>>16;
3753 3752          else
3754 3753                  hsflctl.regval = E1000_READ_FLASH_REG16(hw, ICH_FLASH_HSFCTL);
3755 3754          hsflctl.hsf_ctrl.flcgo = 1;
3756 3755  
3757      -        if (hw->mac.type == e1000_pch_spt)
     3756 +        if (hw->mac.type >= e1000_pch_spt)
3758 3757                  E1000_WRITE_FLASH_REG(hw, ICH_FLASH_HSFSTS,
3759 3758                                        hsflctl.regval << 16);
3760 3759          else
3761 3760                  E1000_WRITE_FLASH_REG16(hw, ICH_FLASH_HSFCTL, hsflctl.regval);
3762 3761  
3763 3762          /* wait till FDONE bit is set to 1 */
3764 3763          do {
3765 3764                  hsfsts.regval = E1000_READ_FLASH_REG16(hw, ICH_FLASH_HSFSTS);
3766 3765                  if (hsfsts.hsf_status.flcdone)
3767 3766                          break;
↓ open down ↓ 62 lines elided ↑ open up ↑
3830 3829   **/
3831 3830  static s32 e1000_read_flash_byte_ich8lan(struct e1000_hw *hw, u32 offset,
3832 3831                                           u8 *data)
3833 3832  {
3834 3833          s32 ret_val;
3835 3834          u16 word = 0;
3836 3835  
3837 3836          /* In SPT, only 32 bits access is supported,
3838 3837           * so this function should not be called.
3839 3838           */
3840      -        if (hw->mac.type == e1000_pch_spt)
     3839 +        if (hw->mac.type >= e1000_pch_spt)
3841 3840                  return -E1000_ERR_NVM;
3842 3841          else
3843 3842                  ret_val = e1000_read_flash_data_ich8lan(hw, offset, 1, &word);
3844 3843  
3845 3844          if (ret_val)
3846 3845                  return ret_val;
3847 3846  
3848 3847          *data = (u8)word;
3849 3848  
3850 3849          return E1000_SUCCESS;
↓ open down ↓ 87 lines elided ↑ open up ↑
3938 3937                                             u32 *data)
3939 3938  {
3940 3939          union ich8_hws_flash_status hsfsts;
3941 3940          union ich8_hws_flash_ctrl hsflctl;
3942 3941          u32 flash_linear_addr;
3943 3942          s32 ret_val = -E1000_ERR_NVM;
3944 3943          u8 count = 0;
3945 3944  
3946 3945          DEBUGFUNC("e1000_read_flash_data_ich8lan");
3947 3946  
3948      -                if (offset > ICH_FLASH_LINEAR_ADDR_MASK ||
3949      -                    hw->mac.type != e1000_pch_spt)
3950      -                        return -E1000_ERR_NVM;
     3947 +        if (offset > ICH_FLASH_LINEAR_ADDR_MASK && hw->mac.type < e1000_pch_spt)
     3948 +                return -E1000_ERR_NVM;
3951 3949          flash_linear_addr = ((ICH_FLASH_LINEAR_ADDR_MASK & offset) +
3952 3950                               hw->nvm.flash_base_addr);
3953 3951  
3954 3952          do {
3955 3953                  usec_delay(1);
3956 3954                  /* Steps */
3957 3955                  ret_val = e1000_flash_cycle_init_ich8lan(hw);
3958 3956                  if (ret_val != E1000_SUCCESS)
3959 3957                          break;
3960 3958                  /* In SPT, This register is in Lan memory space, not flash.
↓ open down ↓ 419 lines elided ↑ open up ↑
4380 4378          DEBUGFUNC("e1000_validate_nvm_checksum_ich8lan");
4381 4379  
4382 4380          /* Read NVM and check Invalid Image CSUM bit.  If this bit is 0,
4383 4381           * the checksum needs to be fixed.  This bit is an indication that
4384 4382           * the NVM was prepared by OEM software and did not calculate
4385 4383           * the checksum...a likely scenario.
4386 4384           */
4387 4385          switch (hw->mac.type) {
4388 4386          case e1000_pch_lpt:
4389 4387          case e1000_pch_spt:
     4388 +        case e1000_pch_cnp:
4390 4389                  word = NVM_COMPAT;
4391 4390                  valid_csum_mask = NVM_COMPAT_VALID_CSUM;
4392 4391                  break;
4393 4392          default:
4394 4393                  word = NVM_FUTURE_INIT_WORD1;
4395 4394                  valid_csum_mask = NVM_FUTURE_INIT_WORD1_VALID_CSUM;
4396 4395                  break;
4397 4396          }
4398 4397  
4399 4398          ret_val = hw->nvm.ops.read(hw, word, 1, &data);
↓ open down ↓ 27 lines elided ↑ open up ↑
4427 4426  {
4428 4427          union ich8_hws_flash_status hsfsts;
4429 4428          union ich8_hws_flash_ctrl hsflctl;
4430 4429          u32 flash_linear_addr;
4431 4430          u32 flash_data = 0;
4432 4431          s32 ret_val;
4433 4432          u8 count = 0;
4434 4433  
4435 4434          DEBUGFUNC("e1000_write_ich8_data");
4436 4435  
4437      -        if (hw->mac.type == e1000_pch_spt) {
     4436 +        if (hw->mac.type >= e1000_pch_spt) {
4438 4437                  if (size != 4 || offset > ICH_FLASH_LINEAR_ADDR_MASK)
4439 4438                          return -E1000_ERR_NVM;
4440 4439          } else {
4441 4440                  if (size < 1 || size > 2 || offset > ICH_FLASH_LINEAR_ADDR_MASK)
4442 4441                          return -E1000_ERR_NVM;
4443 4442          }
4444 4443  
4445 4444          flash_linear_addr = ((ICH_FLASH_LINEAR_ADDR_MASK & offset) +
4446 4445                               hw->nvm.flash_base_addr);
4447 4446  
4448 4447          do {
4449 4448                  usec_delay(1);
4450 4449                  /* Steps */
4451 4450                  ret_val = e1000_flash_cycle_init_ich8lan(hw);
4452 4451                  if (ret_val != E1000_SUCCESS)
4453 4452                          break;
4454 4453                  /* In SPT, This register is in Lan memory space, not
4455 4454                   * flash.  Therefore, only 32 bit access is supported
4456 4455                   */
4457      -                if (hw->mac.type == e1000_pch_spt)
     4456 +                if (hw->mac.type >= e1000_pch_spt)
4458 4457                          hsflctl.regval =
4459      -                            E1000_READ_FLASH_REG(hw, ICH_FLASH_HSFSTS)>>16;
     4458 +                            E1000_READ_FLASH_REG(hw, ICH_FLASH_HSFSTS) >> 16;
4460 4459                  else
4461 4460                          hsflctl.regval =
4462 4461                              E1000_READ_FLASH_REG16(hw, ICH_FLASH_HSFCTL);
4463 4462  
4464 4463                  /* 0b/1b corresponds to 1 or 2 byte size, respectively. */
4465 4464                  hsflctl.hsf_ctrl.fldbcount = size - 1;
4466 4465                  hsflctl.hsf_ctrl.flcycle = ICH_CYCLE_WRITE;
4467 4466                  /* In SPT, This register is in Lan memory space,
4468 4467                   * not flash.  Therefore, only 32 bit access is
4469 4468                   * supported
4470 4469                   */
4471      -                if (hw->mac.type == e1000_pch_spt)
     4470 +                if (hw->mac.type >= e1000_pch_spt)
4472 4471                          E1000_WRITE_FLASH_REG(hw, ICH_FLASH_HSFSTS,
4473 4472                                                hsflctl.regval << 16);
4474 4473                  else
4475 4474                          E1000_WRITE_FLASH_REG16(hw, ICH_FLASH_HSFCTL,
4476 4475                                                  hsflctl.regval);
4477 4476  
4478 4477                  E1000_WRITE_FLASH_REG(hw, ICH_FLASH_FADDR, flash_linear_addr);
4479 4478  
4480 4479                  if (size == 1)
4481 4480                          flash_data = (u32)data & 0x00FF;
↓ open down ↓ 41 lines elided ↑ open up ↑
4523 4522                                              u32 data)
4524 4523  {
4525 4524          union ich8_hws_flash_status hsfsts;
4526 4525          union ich8_hws_flash_ctrl hsflctl;
4527 4526          u32 flash_linear_addr;
4528 4527          s32 ret_val;
4529 4528          u8 count = 0;
4530 4529  
4531 4530          DEBUGFUNC("e1000_write_flash_data32_ich8lan");
4532 4531  
4533      -        if (hw->mac.type == e1000_pch_spt) {
     4532 +        if (hw->mac.type >= e1000_pch_spt) {
4534 4533                  if (offset > ICH_FLASH_LINEAR_ADDR_MASK)
4535 4534                          return -E1000_ERR_NVM;
4536 4535          }
4537 4536          flash_linear_addr = ((ICH_FLASH_LINEAR_ADDR_MASK & offset) +
4538 4537                               hw->nvm.flash_base_addr);
4539 4538          do {
4540 4539                  usec_delay(1);
4541 4540                  /* Steps */
4542 4541                  ret_val = e1000_flash_cycle_init_ich8lan(hw);
4543 4542                  if (ret_val != E1000_SUCCESS)
4544 4543                          break;
4545 4544  
4546 4545                  /* In SPT, This register is in Lan memory space, not
4547 4546                   * flash.  Therefore, only 32 bit access is supported
4548 4547                   */
4549      -                if (hw->mac.type == e1000_pch_spt)
     4548 +                if (hw->mac.type >= e1000_pch_spt)
4550 4549                          hsflctl.regval = E1000_READ_FLASH_REG(hw,
4551 4550                                                                ICH_FLASH_HSFSTS)
4552 4551                                           >> 16;
4553 4552                  else
4554 4553                          hsflctl.regval = E1000_READ_FLASH_REG16(hw,
4555 4554                                                                ICH_FLASH_HSFCTL);
4556 4555  
4557 4556                  hsflctl.hsf_ctrl.fldbcount = sizeof(u32) - 1;
4558 4557                  hsflctl.hsf_ctrl.flcycle = ICH_CYCLE_WRITE;
4559 4558  
4560 4559                  /* In SPT, This register is in Lan memory space,
4561 4560                   * not flash.  Therefore, only 32 bit access is
4562 4561                   * supported
4563 4562                   */
4564      -                if (hw->mac.type == e1000_pch_spt)
     4563 +                if (hw->mac.type >= e1000_pch_spt)
4565 4564                          E1000_WRITE_FLASH_REG(hw, ICH_FLASH_HSFSTS,
4566 4565                                                hsflctl.regval << 16);
4567 4566                  else
4568 4567                          E1000_WRITE_FLASH_REG16(hw, ICH_FLASH_HSFCTL,
4569 4568                                                  hsflctl.regval);
4570 4569  
4571 4570                  E1000_WRITE_FLASH_REG(hw, ICH_FLASH_FADDR, flash_linear_addr);
4572 4571  
4573 4572                  E1000_WRITE_FLASH_REG(hw, ICH_FLASH_FDATA0, data);
4574 4573  
↓ open down ↓ 181 lines elided ↑ open up ↑
4756 4755                          u32 timeout = ICH_FLASH_ERASE_COMMAND_TIMEOUT;
4757 4756  
4758 4757                          /* Steps */
4759 4758                          ret_val = e1000_flash_cycle_init_ich8lan(hw);
4760 4759                          if (ret_val)
4761 4760                                  return ret_val;
4762 4761  
4763 4762                          /* Write a value 11 (block Erase) in Flash
4764 4763                           * Cycle field in hw flash control
4765 4764                           */
4766      -                        if (hw->mac.type == e1000_pch_spt)
     4765 +                        if (hw->mac.type >= e1000_pch_spt)
4767 4766                                  hsflctl.regval =
4768 4767                                      E1000_READ_FLASH_REG(hw,
4769 4768                                                           ICH_FLASH_HSFSTS)>>16;
4770 4769                          else
4771 4770                                  hsflctl.regval =
4772 4771                                      E1000_READ_FLASH_REG16(hw,
4773 4772                                                             ICH_FLASH_HSFCTL);
4774 4773  
4775 4774                          hsflctl.hsf_ctrl.flcycle = ICH_CYCLE_ERASE;
4776      -                        if (hw->mac.type == e1000_pch_spt)
     4775 +                        if (hw->mac.type >= e1000_pch_spt)
4777 4776                                  E1000_WRITE_FLASH_REG(hw, ICH_FLASH_HSFSTS,
4778 4777                                                        hsflctl.regval << 16);
4779 4778                          else
4780 4779                                  E1000_WRITE_FLASH_REG16(hw, ICH_FLASH_HSFCTL,
4781 4780                                                          hsflctl.regval);
4782 4781  
4783 4782                          /* Write the last 24 bits of an index within the
4784 4783                           * block into Flash Linear address field in Flash
4785 4784                           * Address.
4786 4785                           */
↓ open down ↓ 417 lines elided ↑ open up ↑
5204 5203          reg |= (E1000_RFCTL_NFSW_DIS | E1000_RFCTL_NFSR_DIS);
5205 5204  
5206 5205          /* Disable IPv6 extension header parsing because some malformed
5207 5206           * IPv6 headers can hang the Rx.
5208 5207           */
5209 5208          if (hw->mac.type == e1000_ich8lan)
5210 5209                  reg |= (E1000_RFCTL_IPV6_EX_DIS | E1000_RFCTL_NEW_IPV6_EXT_DIS);
5211 5210          E1000_WRITE_REG(hw, E1000_RFCTL, reg);
5212 5211  
5213 5212          /* Enable ECC on Lynxpoint */
5214      -        if ((hw->mac.type == e1000_pch_lpt) ||
5215      -            (hw->mac.type == e1000_pch_spt)) {
     5213 +        if (hw->mac.type >= e1000_pch_lpt) {
5216 5214                  reg = E1000_READ_REG(hw, E1000_PBECCSTS);
5217 5215                  reg |= E1000_PBECCSTS_ECC_ENABLE;
5218 5216                  E1000_WRITE_REG(hw, E1000_PBECCSTS, reg);
5219 5217  
5220 5218                  reg = E1000_READ_REG(hw, E1000_CTRL);
5221 5219                  reg |= E1000_CTRL_MEHE;
5222 5220                  E1000_WRITE_REG(hw, E1000_CTRL, reg);
5223 5221          }
5224 5222  
5225 5223          return;
↓ open down ↓ 412 lines elided ↑ open up ↑
5638 5636          phy_ctrl = E1000_READ_REG(hw, E1000_PHY_CTRL);
5639 5637          phy_ctrl |= E1000_PHY_CTRL_GBE_DISABLE;
5640 5638  
5641 5639          if (hw->phy.type == e1000_phy_i217) {
5642 5640                  u16 phy_reg, device_id = hw->device_id;
5643 5641  
5644 5642                  if ((device_id == E1000_DEV_ID_PCH_LPTLP_I218_LM) ||
5645 5643                      (device_id == E1000_DEV_ID_PCH_LPTLP_I218_V) ||
5646 5644                      (device_id == E1000_DEV_ID_PCH_I218_LM3) ||
5647 5645                      (device_id == E1000_DEV_ID_PCH_I218_V3) ||
5648      -                    (hw->mac.type == e1000_pch_spt)) {
     5646 +                    (hw->mac.type >= e1000_pch_spt)) {
5649 5647                          u32 fextnvm6 = E1000_READ_REG(hw, E1000_FEXTNVM6);
5650 5648  
5651 5649                          E1000_WRITE_REG(hw, E1000_FEXTNVM6,
5652 5650                                          fextnvm6 & ~E1000_FEXTNVM6_REQ_PLL_CLK);
5653 5651                  }
5654 5652  
5655 5653                  ret_val = hw->phy.ops.acquire(hw);
5656 5654                  if (ret_val)
5657 5655                          goto out;
5658 5656  
↓ open down ↓ 454 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX