diff options
Diffstat (limited to 'drivers/net/ethernet/intel/e1000e/netdev.c')
| -rw-r--r-- | drivers/net/ethernet/intel/e1000e/netdev.c | 373 | 
1 files changed, 217 insertions, 156 deletions
| diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index d150dade06cf..900b3ab998bd 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c @@ -3550,6 +3550,7 @@ s32 e1000e_get_base_timinca(struct e1000_adapter *adapter, u32 *timinca)  	case e1000_pch_tgp:  	case e1000_pch_adp:  	case e1000_pch_mtp: +	case e1000_pch_lnp:  		if (er32(TSYNCRXCTL) & E1000_TSYNCRXCTL_SYSCFI) {  			/* Stable 24MHz frequency */  			incperiod = INCPERIOD_24MHZ; @@ -4068,6 +4069,7 @@ void e1000e_reset(struct e1000_adapter *adapter)  	case e1000_pch_tgp:  	case e1000_pch_adp:  	case e1000_pch_mtp: +	case e1000_pch_lnp:  		fc->refresh_time = 0xFFFF;  		fc->pause_time = 0xFFFF; @@ -6343,42 +6345,110 @@ static void e1000e_s0ix_entry_flow(struct e1000_adapter *adapter)  	u32 mac_data;  	u16 phy_data; -	/* Disable the periodic inband message, -	 * don't request PCIe clock in K1 page770_17[10:9] = 10b -	 */ -	e1e_rphy(hw, HV_PM_CTRL, &phy_data); -	phy_data &= ~HV_PM_CTRL_K1_CLK_REQ; -	phy_data |= BIT(10); -	e1e_wphy(hw, HV_PM_CTRL, phy_data); +	if (er32(FWSM) & E1000_ICH_FWSM_FW_VALID) { +		/* Request ME configure the device for S0ix */ +		mac_data = er32(H2ME); +		mac_data |= E1000_H2ME_START_DPG; +		mac_data &= ~E1000_H2ME_EXIT_DPG; +		ew32(H2ME, mac_data); +	} else { +		/* Request driver configure the device to S0ix */ +		/* Disable the periodic inband message, +		 * don't request PCIe clock in K1 page770_17[10:9] = 10b +		 */ +		e1e_rphy(hw, HV_PM_CTRL, &phy_data); +		phy_data &= ~HV_PM_CTRL_K1_CLK_REQ; +		phy_data |= BIT(10); +		e1e_wphy(hw, HV_PM_CTRL, phy_data); -	/* Make sure we don't exit K1 every time a new packet arrives -	 * 772_29[5] = 1 CS_Mode_Stay_In_K1 -	 */ -	e1e_rphy(hw, I217_CGFREG, &phy_data); -	phy_data |= BIT(5); -	e1e_wphy(hw, I217_CGFREG, phy_data); +		/* Make sure we don't exit K1 every time a new packet arrives +		 * 772_29[5] = 1 CS_Mode_Stay_In_K1 +		 */ +		e1e_rphy(hw, I217_CGFREG, &phy_data); +		phy_data |= BIT(5); +		e1e_wphy(hw, I217_CGFREG, phy_data); -	/* Change the MAC/PHY interface to SMBus -	 * Force the SMBus in PHY page769_23[0] = 1 -	 * Force the SMBus in MAC CTRL_EXT[11] = 1 -	 */ -	e1e_rphy(hw, CV_SMB_CTRL, &phy_data); -	phy_data |= CV_SMB_CTRL_FORCE_SMBUS; -	e1e_wphy(hw, CV_SMB_CTRL, phy_data); -	mac_data = er32(CTRL_EXT); -	mac_data |= E1000_CTRL_EXT_FORCE_SMBUS; -	ew32(CTRL_EXT, mac_data); +		/* Change the MAC/PHY interface to SMBus +		 * Force the SMBus in PHY page769_23[0] = 1 +		 * Force the SMBus in MAC CTRL_EXT[11] = 1 +		 */ +		e1e_rphy(hw, CV_SMB_CTRL, &phy_data); +		phy_data |= CV_SMB_CTRL_FORCE_SMBUS; +		e1e_wphy(hw, CV_SMB_CTRL, phy_data); +		mac_data = er32(CTRL_EXT); +		mac_data |= E1000_CTRL_EXT_FORCE_SMBUS; +		ew32(CTRL_EXT, mac_data); + +		/* DFT control: PHY bit: page769_20[0] = 1 +		 * page769_20[7] - PHY PLL stop +		 * page769_20[8] - PHY go to the electrical idle +		 * page769_20[9] - PHY serdes disable +		 * Gate PPW via EXTCNF_CTRL - set 0x0F00[7] = 1 +		 */ +		e1e_rphy(hw, I82579_DFT_CTRL, &phy_data); +		phy_data |= BIT(0); +		phy_data |= BIT(7); +		phy_data |= BIT(8); +		phy_data |= BIT(9); +		e1e_wphy(hw, I82579_DFT_CTRL, phy_data); + +		mac_data = er32(EXTCNF_CTRL); +		mac_data |= E1000_EXTCNF_CTRL_GATE_PHY_CFG; +		ew32(EXTCNF_CTRL, mac_data); + +		/* Enable the Dynamic Power Gating in the MAC */ +		mac_data = er32(FEXTNVM7); +		mac_data |= BIT(22); +		ew32(FEXTNVM7, mac_data); + +		/* Disable disconnected cable conditioning for Power Gating */ +		mac_data = er32(DPGFR); +		mac_data |= BIT(2); +		ew32(DPGFR, mac_data); + +		/* Don't wake from dynamic Power Gating with clock request */ +		mac_data = er32(FEXTNVM12); +		mac_data |= BIT(12); +		ew32(FEXTNVM12, mac_data); + +		/* Ungate PGCB clock */ +		mac_data = er32(FEXTNVM9); +		mac_data &= ~BIT(28); +		ew32(FEXTNVM9, mac_data); + +		/* Enable K1 off to enable mPHY Power Gating */ +		mac_data = er32(FEXTNVM6); +		mac_data |= BIT(31); +		ew32(FEXTNVM6, mac_data); + +		/* Enable mPHY power gating for any link and speed */ +		mac_data = er32(FEXTNVM8); +		mac_data |= BIT(9); +		ew32(FEXTNVM8, mac_data); + +		/* Enable the Dynamic Clock Gating in the DMA and MAC */ +		mac_data = er32(CTRL_EXT); +		mac_data |= E1000_CTRL_EXT_DMA_DYN_CLK_EN; +		ew32(CTRL_EXT, mac_data); + +		/* No MAC DPG gating SLP_S0 in modern standby +		 * Switch the logic of the lanphypc to use PMC counter +		 */ +		mac_data = er32(FEXTNVM5); +		mac_data |= BIT(7); +		ew32(FEXTNVM5, mac_data); +	} -	/* DFT control: PHY bit: page769_20[0] = 1 -	 * Gate PPW via EXTCNF_CTRL - set 0x0F00[7] = 1 -	 */ -	e1e_rphy(hw, I82579_DFT_CTRL, &phy_data); -	phy_data |= BIT(0); -	e1e_wphy(hw, I82579_DFT_CTRL, phy_data); +	/* Disable the time synchronization clock */ +	mac_data = er32(FEXTNVM7); +	mac_data |= BIT(31); +	mac_data &= ~BIT(0); +	ew32(FEXTNVM7, mac_data); -	mac_data = er32(EXTCNF_CTRL); -	mac_data |= E1000_EXTCNF_CTRL_GATE_PHY_CFG; -	ew32(EXTCNF_CTRL, mac_data); +	/* Dynamic Power Gating Enable */ +	mac_data = er32(CTRL_EXT); +	mac_data |= BIT(3); +	ew32(CTRL_EXT, mac_data);  	/* Check MAC Tx/Rx packet buffer pointers.  	 * Reset MAC Tx/Rx packet buffer pointers to suppress any @@ -6414,148 +6484,130 @@ static void e1000e_s0ix_entry_flow(struct e1000_adapter *adapter)  	mac_data = er32(RDFPC);  	if (mac_data)  		ew32(RDFPC, 0); - -	/* Enable the Dynamic Power Gating in the MAC */ -	mac_data = er32(FEXTNVM7); -	mac_data |= BIT(22); -	ew32(FEXTNVM7, mac_data); - -	/* Disable the time synchronization clock */ -	mac_data = er32(FEXTNVM7); -	mac_data |= BIT(31); -	mac_data &= ~BIT(0); -	ew32(FEXTNVM7, mac_data); - -	/* Dynamic Power Gating Enable */ -	mac_data = er32(CTRL_EXT); -	mac_data |= BIT(3); -	ew32(CTRL_EXT, mac_data); - -	/* Disable disconnected cable conditioning for Power Gating */ -	mac_data = er32(DPGFR); -	mac_data |= BIT(2); -	ew32(DPGFR, mac_data); - -	/* Don't wake from dynamic Power Gating with clock request */ -	mac_data = er32(FEXTNVM12); -	mac_data |= BIT(12); -	ew32(FEXTNVM12, mac_data); - -	/* Ungate PGCB clock */ -	mac_data = er32(FEXTNVM9); -	mac_data &= ~BIT(28); -	ew32(FEXTNVM9, mac_data); - -	/* Enable K1 off to enable mPHY Power Gating */ -	mac_data = er32(FEXTNVM6); -	mac_data |= BIT(31); -	ew32(FEXTNVM6, mac_data); - -	/* Enable mPHY power gating for any link and speed */ -	mac_data = er32(FEXTNVM8); -	mac_data |= BIT(9); -	ew32(FEXTNVM8, mac_data); - -	/* Enable the Dynamic Clock Gating in the DMA and MAC */ -	mac_data = er32(CTRL_EXT); -	mac_data |= E1000_CTRL_EXT_DMA_DYN_CLK_EN; -	ew32(CTRL_EXT, mac_data); - -	/* No MAC DPG gating SLP_S0 in modern standby -	 * Switch the logic of the lanphypc to use PMC counter -	 */ -	mac_data = er32(FEXTNVM5); -	mac_data |= BIT(7); -	ew32(FEXTNVM5, mac_data);  }  static void e1000e_s0ix_exit_flow(struct e1000_adapter *adapter)  {  	struct e1000_hw *hw = &adapter->hw; +	bool firmware_bug = false;  	u32 mac_data;  	u16 phy_data; +	u32 i = 0; + +	if (er32(FWSM) & E1000_ICH_FWSM_FW_VALID) { +		/* Request ME unconfigure the device from S0ix */ +		mac_data = er32(H2ME); +		mac_data &= ~E1000_H2ME_START_DPG; +		mac_data |= E1000_H2ME_EXIT_DPG; +		ew32(H2ME, mac_data); + +		/* Poll up to 2.5 seconds for ME to unconfigure DPG. +		 * If this takes more than 1 second, show a warning indicating a +		 * firmware bug +		 */ +		while (!(er32(EXFWSM) & E1000_EXFWSM_DPG_EXIT_DONE)) { +			if (i > 100 && !firmware_bug) +				firmware_bug = true; -	/* Disable the Dynamic Power Gating in the MAC */ -	mac_data = er32(FEXTNVM7); -	mac_data &= 0xFFBFFFFF; -	ew32(FEXTNVM7, mac_data); +			if (i++ == 250) { +				e_dbg("Timeout (firmware bug): %d msec\n", +				      i * 10); +				break; +			} -	/* Enable the time synchronization clock */ -	mac_data = er32(FEXTNVM7); -	mac_data |= BIT(0); -	ew32(FEXTNVM7, mac_data); +			usleep_range(10000, 11000); +		} +		if (firmware_bug) +			e_warn("DPG_EXIT_DONE took %d msec. This is a firmware bug\n", +			       i * 10); +		else +			e_dbg("DPG_EXIT_DONE cleared after %d msec\n", i * 10); +	} else { +		/* Request driver unconfigure the device from S0ix */ + +		/* Disable the Dynamic Power Gating in the MAC */ +		mac_data = er32(FEXTNVM7); +		mac_data &= 0xFFBFFFFF; +		ew32(FEXTNVM7, mac_data); + +		/* Disable mPHY power gating for any link and speed */ +		mac_data = er32(FEXTNVM8); +		mac_data &= ~BIT(9); +		ew32(FEXTNVM8, mac_data); + +		/* Disable K1 off */ +		mac_data = er32(FEXTNVM6); +		mac_data &= ~BIT(31); +		ew32(FEXTNVM6, mac_data); + +		/* Disable Ungate PGCB clock */ +		mac_data = er32(FEXTNVM9); +		mac_data |= BIT(28); +		ew32(FEXTNVM9, mac_data); + +		/* Cancel not waking from dynamic +		 * Power Gating with clock request +		 */ +		mac_data = er32(FEXTNVM12); +		mac_data &= ~BIT(12); +		ew32(FEXTNVM12, mac_data); -	/* Disable mPHY power gating for any link and speed */ -	mac_data = er32(FEXTNVM8); -	mac_data &= ~BIT(9); -	ew32(FEXTNVM8, mac_data); +		/* Cancel disable disconnected cable conditioning +		 * for Power Gating +		 */ +		mac_data = er32(DPGFR); +		mac_data &= ~BIT(2); +		ew32(DPGFR, mac_data); -	/* Disable K1 off */ -	mac_data = er32(FEXTNVM6); -	mac_data &= ~BIT(31); -	ew32(FEXTNVM6, mac_data); +		/* Disable the Dynamic Clock Gating in the DMA and MAC */ +		mac_data = er32(CTRL_EXT); +		mac_data &= 0xFFF7FFFF; +		ew32(CTRL_EXT, mac_data); -	/* Disable Ungate PGCB clock */ -	mac_data = er32(FEXTNVM9); -	mac_data |= BIT(28); -	ew32(FEXTNVM9, mac_data); +		/* Revert the lanphypc logic to use the internal Gbe counter +		 * and not the PMC counter +		 */ +		mac_data = er32(FEXTNVM5); +		mac_data &= 0xFFFFFF7F; +		ew32(FEXTNVM5, mac_data); -	/* Cancel not waking from dynamic -	 * Power Gating with clock request -	 */ -	mac_data = er32(FEXTNVM12); -	mac_data &= ~BIT(12); -	ew32(FEXTNVM12, mac_data); +		/* Enable the periodic inband message, +		 * Request PCIe clock in K1 page770_17[10:9] =01b +		 */ +		e1e_rphy(hw, HV_PM_CTRL, &phy_data); +		phy_data &= 0xFBFF; +		phy_data |= HV_PM_CTRL_K1_CLK_REQ; +		e1e_wphy(hw, HV_PM_CTRL, phy_data); -	/* Cancel disable disconnected cable conditioning -	 * for Power Gating -	 */ -	mac_data = er32(DPGFR); -	mac_data &= ~BIT(2); -	ew32(DPGFR, mac_data); +		/* Return back configuration +		 * 772_29[5] = 0 CS_Mode_Stay_In_K1 +		 */ +		e1e_rphy(hw, I217_CGFREG, &phy_data); +		phy_data &= 0xFFDF; +		e1e_wphy(hw, I217_CGFREG, phy_data); + +		/* Change the MAC/PHY interface to Kumeran +		 * Unforce the SMBus in PHY page769_23[0] = 0 +		 * Unforce the SMBus in MAC CTRL_EXT[11] = 0 +		 */ +		e1e_rphy(hw, CV_SMB_CTRL, &phy_data); +		phy_data &= ~CV_SMB_CTRL_FORCE_SMBUS; +		e1e_wphy(hw, CV_SMB_CTRL, phy_data); +		mac_data = er32(CTRL_EXT); +		mac_data &= ~E1000_CTRL_EXT_FORCE_SMBUS; +		ew32(CTRL_EXT, mac_data); +	}  	/* Disable Dynamic Power Gating */  	mac_data = er32(CTRL_EXT);  	mac_data &= 0xFFFFFFF7;  	ew32(CTRL_EXT, mac_data); -	/* Disable the Dynamic Clock Gating in the DMA and MAC */ -	mac_data = er32(CTRL_EXT); -	mac_data &= 0xFFF7FFFF; -	ew32(CTRL_EXT, mac_data); - -	/* Revert the lanphypc logic to use the internal Gbe counter -	 * and not the PMC counter -	 */ -	mac_data = er32(FEXTNVM5); -	mac_data &= 0xFFFFFF7F; -	ew32(FEXTNVM5, mac_data); - -	/* Enable the periodic inband message, -	 * Request PCIe clock in K1 page770_17[10:9] =01b -	 */ -	e1e_rphy(hw, HV_PM_CTRL, &phy_data); -	phy_data &= 0xFBFF; -	phy_data |= HV_PM_CTRL_K1_CLK_REQ; -	e1e_wphy(hw, HV_PM_CTRL, phy_data); - -	/* Return back configuration -	 * 772_29[5] = 0 CS_Mode_Stay_In_K1 -	 */ -	e1e_rphy(hw, I217_CGFREG, &phy_data); -	phy_data &= 0xFFDF; -	e1e_wphy(hw, I217_CGFREG, phy_data); - -	/* Change the MAC/PHY interface to Kumeran -	 * Unforce the SMBus in PHY page769_23[0] = 0 -	 * Unforce the SMBus in MAC CTRL_EXT[11] = 0 -	 */ -	e1e_rphy(hw, CV_SMB_CTRL, &phy_data); -	phy_data &= ~CV_SMB_CTRL_FORCE_SMBUS; -	e1e_wphy(hw, CV_SMB_CTRL, phy_data); -	mac_data = er32(CTRL_EXT); -	mac_data &= ~E1000_CTRL_EXT_FORCE_SMBUS; -	ew32(CTRL_EXT, mac_data); +	/* Enable the time synchronization clock */ +	mac_data = er32(FEXTNVM7); +	mac_data &= ~BIT(31); +	mac_data |= BIT(0); +	ew32(FEXTNVM7, mac_data);  }  static int e1000e_pm_freeze(struct device *dev) @@ -7302,7 +7354,7 @@ static const struct net_device_ops e1000e_netdev_ops = {  	.ndo_set_rx_mode	= e1000e_set_rx_mode,  	.ndo_set_mac_address	= e1000_set_mac,  	.ndo_change_mtu		= e1000_change_mtu, -	.ndo_do_ioctl		= e1000_ioctl, +	.ndo_eth_ioctl		= e1000_ioctl,  	.ndo_tx_timeout		= e1000_tx_timeout,  	.ndo_validate_addr	= eth_validate_addr, @@ -7664,6 +7716,7 @@ err_flashmap:  err_ioremap:  	free_netdev(netdev);  err_alloc_etherdev: +	pci_disable_pcie_error_reporting(pdev);  	pci_release_mem_regions(pdev);  err_pci_reg:  err_dma: @@ -7676,7 +7729,7 @@ err_dma:   * @pdev: PCI device information struct   *   * e1000_remove is called by the PCI subsystem to alert the driver - * that it should release a PCI device.  The could be caused by a + * that it should release a PCI device.  This could be caused by a   * Hot-Plug event, or because the driver is going to be removed from   * memory.   **/ @@ -7849,14 +7902,22 @@ static const struct pci_device_id e1000_pci_tbl[] = {  	{ PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_TGP_I219_V14), board_pch_cnp },  	{ PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_TGP_I219_LM15), board_pch_cnp },  	{ PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_TGP_I219_V15), board_pch_cnp }, +	{ PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_LM23), board_pch_cnp }, +	{ PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_V23), board_pch_cnp },  	{ PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_LM16), board_pch_cnp },  	{ PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_V16), board_pch_cnp },  	{ PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_LM17), board_pch_cnp },  	{ PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_V17), board_pch_cnp }, +	{ PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_LM22), board_pch_cnp }, +	{ PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_V22), board_pch_cnp },  	{ PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_LM18), board_pch_cnp },  	{ PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_V18), board_pch_cnp },  	{ PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_LM19), board_pch_cnp },  	{ PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_V19), board_pch_cnp }, +	{ PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_LM20), board_pch_cnp }, +	{ PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_V20), board_pch_cnp }, +	{ PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_LM21), board_pch_cnp }, +	{ PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_V21), board_pch_cnp },  	{ 0, 0, 0, 0, 0, 0, 0 }	/* terminate list */  }; |