diff options
-rw-r--r-- | drivers/net/tg3.c | 56 |
1 files changed, 39 insertions, 17 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index f22f19bbf11a..dd036c011c14 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -7542,21 +7542,27 @@ static inline struct subsys_tbl_ent *lookup_by_subsys(struct tg3 *tp) | |||
7542 | return NULL; | 7542 | return NULL; |
7543 | } | 7543 | } |
7544 | 7544 | ||
7545 | static int __devinit tg3_phy_probe(struct tg3 *tp) | 7545 | /* Since this function may be called in D3-hot power state during |
7546 | * tg3_init_one(), only config cycles are allowed. | ||
7547 | */ | ||
7548 | static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp) | ||
7546 | { | 7549 | { |
7547 | u32 eeprom_phy_id, hw_phy_id_1, hw_phy_id_2; | ||
7548 | u32 hw_phy_id, hw_phy_id_masked; | ||
7549 | u32 val; | 7550 | u32 val; |
7550 | int eeprom_signature_found, eeprom_phy_serdes, err; | 7551 | |
7552 | /* Make sure register accesses (indirect or otherwise) | ||
7553 | * will function correctly. | ||
7554 | */ | ||
7555 | pci_write_config_dword(tp->pdev, TG3PCI_MISC_HOST_CTRL, | ||
7556 | tp->misc_host_ctrl); | ||
7551 | 7557 | ||
7552 | tp->phy_id = PHY_ID_INVALID; | 7558 | tp->phy_id = PHY_ID_INVALID; |
7553 | eeprom_phy_id = PHY_ID_INVALID; | 7559 | tp->led_ctrl = LED_CTRL_MODE_PHY_1; |
7554 | eeprom_phy_serdes = 0; | 7560 | |
7555 | eeprom_signature_found = 0; | ||
7556 | tg3_read_mem(tp, NIC_SRAM_DATA_SIG, &val); | 7561 | tg3_read_mem(tp, NIC_SRAM_DATA_SIG, &val); |
7557 | if (val == NIC_SRAM_DATA_SIG_MAGIC) { | 7562 | if (val == NIC_SRAM_DATA_SIG_MAGIC) { |
7558 | u32 nic_cfg, led_cfg; | 7563 | u32 nic_cfg, led_cfg; |
7559 | u32 nic_phy_id, ver, cfg2 = 0; | 7564 | u32 nic_phy_id, ver, cfg2 = 0, eeprom_phy_id; |
7565 | int eeprom_phy_serdes = 0; | ||
7560 | 7566 | ||
7561 | tg3_read_mem(tp, NIC_SRAM_DATA_CFG, &nic_cfg); | 7567 | tg3_read_mem(tp, NIC_SRAM_DATA_CFG, &nic_cfg); |
7562 | tp->nic_sram_data_cfg = nic_cfg; | 7568 | tp->nic_sram_data_cfg = nic_cfg; |
@@ -7569,8 +7575,6 @@ static int __devinit tg3_phy_probe(struct tg3 *tp) | |||
7569 | (ver > 0) && (ver < 0x100)) | 7575 | (ver > 0) && (ver < 0x100)) |
7570 | tg3_read_mem(tp, NIC_SRAM_DATA_CFG_2, &cfg2); | 7576 | tg3_read_mem(tp, NIC_SRAM_DATA_CFG_2, &cfg2); |
7571 | 7577 | ||
7572 | eeprom_signature_found = 1; | ||
7573 | |||
7574 | if ((nic_cfg & NIC_SRAM_DATA_CFG_PHY_TYPE_MASK) == | 7578 | if ((nic_cfg & NIC_SRAM_DATA_CFG_PHY_TYPE_MASK) == |
7575 | NIC_SRAM_DATA_CFG_PHY_TYPE_FIBER) | 7579 | NIC_SRAM_DATA_CFG_PHY_TYPE_FIBER) |
7576 | eeprom_phy_serdes = 1; | 7580 | eeprom_phy_serdes = 1; |
@@ -7586,6 +7590,10 @@ static int __devinit tg3_phy_probe(struct tg3 *tp) | |||
7586 | } else | 7590 | } else |
7587 | eeprom_phy_id = 0; | 7591 | eeprom_phy_id = 0; |
7588 | 7592 | ||
7593 | tp->phy_id = eeprom_phy_id; | ||
7594 | if (eeprom_phy_serdes) | ||
7595 | tp->tg3_flags2 |= TG3_FLG2_PHY_SERDES; | ||
7596 | |||
7589 | if (tp->tg3_flags2 & TG3_FLG2_5750_PLUS) | 7597 | if (tp->tg3_flags2 & TG3_FLG2_5750_PLUS) |
7590 | led_cfg = cfg2 & (NIC_SRAM_DATA_CFG_LED_MODE_MASK | | 7598 | led_cfg = cfg2 & (NIC_SRAM_DATA_CFG_LED_MODE_MASK | |
7591 | SHASTA_EXT_LED_MODE_MASK); | 7599 | SHASTA_EXT_LED_MODE_MASK); |
@@ -7653,6 +7661,13 @@ static int __devinit tg3_phy_probe(struct tg3 *tp) | |||
7653 | if (cfg2 & (1 << 18)) | 7661 | if (cfg2 & (1 << 18)) |
7654 | tp->tg3_flags2 |= TG3_FLG2_SERDES_PREEMPHASIS; | 7662 | tp->tg3_flags2 |= TG3_FLG2_SERDES_PREEMPHASIS; |
7655 | } | 7663 | } |
7664 | } | ||
7665 | |||
7666 | static int __devinit tg3_phy_probe(struct tg3 *tp) | ||
7667 | { | ||
7668 | u32 hw_phy_id_1, hw_phy_id_2; | ||
7669 | u32 hw_phy_id, hw_phy_id_masked; | ||
7670 | int err; | ||
7656 | 7671 | ||
7657 | /* Reading the PHY ID register can conflict with ASF | 7672 | /* Reading the PHY ID register can conflict with ASF |
7658 | * firwmare access to the PHY hardware. | 7673 | * firwmare access to the PHY hardware. |
@@ -7681,10 +7696,10 @@ static int __devinit tg3_phy_probe(struct tg3 *tp) | |||
7681 | if (hw_phy_id_masked == PHY_ID_BCM8002) | 7696 | if (hw_phy_id_masked == PHY_ID_BCM8002) |
7682 | tp->tg3_flags2 |= TG3_FLG2_PHY_SERDES; | 7697 | tp->tg3_flags2 |= TG3_FLG2_PHY_SERDES; |
7683 | } else { | 7698 | } else { |
7684 | if (eeprom_signature_found) { | 7699 | if (tp->phy_id != PHY_ID_INVALID) { |
7685 | tp->phy_id = eeprom_phy_id; | 7700 | /* Do nothing, phy ID already set up in |
7686 | if (eeprom_phy_serdes) | 7701 | * tg3_get_eeprom_hw_cfg(). |
7687 | tp->tg3_flags2 |= TG3_FLG2_PHY_SERDES; | 7702 | */ |
7688 | } else { | 7703 | } else { |
7689 | struct subsys_tbl_ent *p; | 7704 | struct subsys_tbl_ent *p; |
7690 | 7705 | ||
@@ -7755,9 +7770,6 @@ skip_phy_reset: | |||
7755 | err = tg3_init_5401phy_dsp(tp); | 7770 | err = tg3_init_5401phy_dsp(tp); |
7756 | } | 7771 | } |
7757 | 7772 | ||
7758 | if (!eeprom_signature_found) | ||
7759 | tp->led_ctrl = LED_CTRL_MODE_PHY_1; | ||
7760 | |||
7761 | if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) | 7773 | if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) |
7762 | tp->link_config.advertising = | 7774 | tp->link_config.advertising = |
7763 | (ADVERTISED_1000baseT_Half | | 7775 | (ADVERTISED_1000baseT_Half | |
@@ -8023,6 +8035,16 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
8023 | pci_write_config_dword(tp->pdev, TG3PCI_PCISTATE, pci_state_reg); | 8035 | pci_write_config_dword(tp->pdev, TG3PCI_PCISTATE, pci_state_reg); |
8024 | } | 8036 | } |
8025 | 8037 | ||
8038 | /* Get eeprom hw config before calling tg3_set_power_state(). | ||
8039 | * In particular, the TG3_FLAG_EEPROM_WRITE_PROT flag must be | ||
8040 | * determined before calling tg3_set_power_state() so that | ||
8041 | * we know whether or not to switch out of Vaux power. | ||
8042 | * When the flag is set, it means that GPIO1 is used for eeprom | ||
8043 | * write protect and also implies that it is a LOM where GPIOs | ||
8044 | * are not used to switch power. | ||
8045 | */ | ||
8046 | tg3_get_eeprom_hw_cfg(tp); | ||
8047 | |||
8026 | /* Force the chip into D0. */ | 8048 | /* Force the chip into D0. */ |
8027 | err = tg3_set_power_state(tp, 0); | 8049 | err = tg3_set_power_state(tp, 0); |
8028 | if (err) { | 8050 | if (err) { |