Commit ab6973ae authored by Arjan van de Ven's avatar Arjan van de Ven Committed by Jeff Kirsher
Browse files

e1000e: Reduce boot time by tightening sleep ranges



The e1000e driver is a great user of the usleep_range() API,
and has nice ranges that in principle help power management.

However the ranges that are used only during system startup are
very long (and can add easily 100 msec to the boot time) while
the power savings of such long ranges is irrelevant due to the
one-off, boot only, nature of these functions.

This patch shrinks some of the longest ranges to be shorter
(while still using a power friendly 1 msec range); this saves
100msec+ of boot time on my BDW NUCs

Signed-off-by: default avatarArjan van de Ven <arjan@linux.intel.com>
Signed-off-by: default avatarPaul Menzel <pmenzel@molgen.mpg.de>
Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent af07adbb
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -680,7 +680,7 @@ static s32 e1000_reset_hw_80003es2lan(struct e1000_hw *hw)
	ew32(TCTL, E1000_TCTL_PSP);
	e1e_flush();

	usleep_range(10000, 20000);
	usleep_range(10000, 11000);

	ctrl = er32(CTRL);

+1 −1
Original line number Diff line number Diff line
@@ -959,7 +959,7 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw)
	ew32(TCTL, tctl);
	e1e_flush();

	usleep_range(10000, 20000);
	usleep_range(10000, 11000);

	/* Must acquire the MDIO ownership before MAC reset.
	 * Ownership defaults to firmware after a reset.
+7 −7
Original line number Diff line number Diff line
@@ -1014,7 +1014,7 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data)
	/* Disable all the interrupts */
	ew32(IMC, 0xFFFFFFFF);
	e1e_flush();
	usleep_range(10000, 20000);
	usleep_range(10000, 11000);

	/* Test each interrupt */
	for (i = 0; i < 10; i++) {
@@ -1046,7 +1046,7 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data)
			ew32(IMC, mask);
			ew32(ICS, mask);
			e1e_flush();
			usleep_range(10000, 20000);
			usleep_range(10000, 11000);

			if (adapter->test_icr & mask) {
				*data = 3;
@@ -1064,7 +1064,7 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data)
		ew32(IMS, mask);
		ew32(ICS, mask);
		e1e_flush();
		usleep_range(10000, 20000);
		usleep_range(10000, 11000);

		if (!(adapter->test_icr & mask)) {
			*data = 4;
@@ -1082,7 +1082,7 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data)
			ew32(IMC, ~mask & 0x00007FFF);
			ew32(ICS, ~mask & 0x00007FFF);
			e1e_flush();
			usleep_range(10000, 20000);
			usleep_range(10000, 11000);

			if (adapter->test_icr) {
				*data = 5;
@@ -1094,7 +1094,7 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data)
	/* Disable all the interrupts */
	ew32(IMC, 0xFFFFFFFF);
	e1e_flush();
	usleep_range(10000, 20000);
	usleep_range(10000, 11000);

	/* Unhook test interrupt handler */
	free_irq(irq, netdev);
@@ -1470,7 +1470,7 @@ static int e1000_set_82571_fiber_loopback(struct e1000_adapter *adapter)
	 */
	ew32(SCTL, E1000_SCTL_ENABLE_SERDES_LOOPBACK);
	e1e_flush();
	usleep_range(10000, 20000);
	usleep_range(10000, 11000);

	return 0;
}
@@ -1584,7 +1584,7 @@ static void e1000_loopback_cleanup(struct e1000_adapter *adapter)
		    hw->phy.media_type == e1000_media_type_internal_serdes) {
			ew32(SCTL, E1000_SCTL_DISABLE_SERDES_LOOPBACK);
			e1e_flush();
			usleep_range(10000, 20000);
			usleep_range(10000, 11000);
			break;
		}
		/* Fall Through */
+10 −10
Original line number Diff line number Diff line
@@ -271,7 +271,7 @@ static void e1000_toggle_lanphypc_pch_lpt(struct e1000_hw *hw)
		u16 count = 20;

		do {
			usleep_range(5000, 10000);
			usleep_range(5000, 6000);
		} while (!(er32(CTRL_EXT) & E1000_CTRL_EXT_LPCD) && count--);

		msleep(30);
@@ -405,7 +405,7 @@ out:
	/* Ungate automatic PHY configuration on non-managed 82579 */
	if ((hw->mac.type == e1000_pch2lan) &&
	    !(fwsm & E1000_ICH_FWSM_FW_VALID)) {
		usleep_range(10000, 20000);
		usleep_range(10000, 11000);
		e1000_gate_hw_phy_config_ich8lan(hw, false);
	}

@@ -531,7 +531,7 @@ static s32 e1000_init_phy_params_ich8lan(struct e1000_hw *hw)
	phy->id = 0;
	while ((e1000_phy_unknown == e1000e_get_phy_type_from_id(phy->id)) &&
	       (i++ < 100)) {
		usleep_range(1000, 2000);
		usleep_range(1000, 1100);
		ret_val = e1000e_get_phy_id(hw);
		if (ret_val)
			return ret_val;
@@ -1244,7 +1244,7 @@ static s32 e1000_disable_ulp_lpt_lp(struct e1000_hw *hw, bool force)
				goto out;
			}

			usleep_range(10000, 20000);
			usleep_range(10000, 11000);
		}
		e_dbg("ULP_CONFIG_DONE cleared after %dmsec\n", i * 10);

@@ -1999,7 +1999,7 @@ static s32 e1000_check_reset_block_ich8lan(struct e1000_hw *hw)

	while ((blocked = !(er32(FWSM) & E1000_ICH_FWSM_RSPCIPHY)) &&
	       (i++ < 30))
		usleep_range(10000, 20000);
		usleep_range(10000, 11000);
	return blocked ? E1000_BLK_PHY_RESET : 0;
}

@@ -2818,7 +2818,7 @@ static s32 e1000_post_phy_reset_ich8lan(struct e1000_hw *hw)
		return 0;

	/* Allow time for h/w to get to quiescent state after reset */
	usleep_range(10000, 20000);
	usleep_range(10000, 11000);

	/* Perform any necessary post-reset workarounds */
	switch (hw->mac.type) {
@@ -2854,7 +2854,7 @@ static s32 e1000_post_phy_reset_ich8lan(struct e1000_hw *hw)
	if (hw->mac.type == e1000_pch2lan) {
		/* Ungate automatic PHY configuration on non-managed 82579 */
		if (!(er32(FWSM) & E1000_ICH_FWSM_FW_VALID)) {
			usleep_range(10000, 20000);
			usleep_range(10000, 11000);
			e1000_gate_hw_phy_config_ich8lan(hw, false);
		}

@@ -3875,7 +3875,7 @@ release:
	 */
	if (!ret_val) {
		nvm->ops.reload(hw);
		usleep_range(10000, 20000);
		usleep_range(10000, 11000);
	}

out:
@@ -4026,7 +4026,7 @@ release:
	 */
	if (!ret_val) {
		nvm->ops.reload(hw);
		usleep_range(10000, 20000);
		usleep_range(10000, 11000);
	}

out:
@@ -4650,7 +4650,7 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw)
	ew32(TCTL, E1000_TCTL_PSP);
	e1e_flush();

	usleep_range(10000, 20000);
	usleep_range(10000, 11000);

	/* Workaround for ICH8 bit corruption issue in FIFO memory */
	if (hw->mac.type == e1000_ich8lan) {
+1 −1
Original line number Diff line number Diff line
@@ -797,7 +797,7 @@ static s32 e1000_poll_fiber_serdes_link_generic(struct e1000_hw *hw)
	 * milliseconds even if the other end is doing it in SW).
	 */
	for (i = 0; i < FIBER_LINK_UP_LIMIT; i++) {
		usleep_range(10000, 20000);
		usleep_range(10000, 11000);
		status = er32(STATUS);
		if (status & E1000_STATUS_LU)
			break;
Loading