Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bb034512 authored by Bruce Allan's avatar Bruce Allan Committed by Jeff Kirsher
Browse files

e1000e: additional error handling on PHY register accesses



PHY reads/writes via the MDIC register could potentially return results
from a previous PHY register access.  If that happens, the offset in the
returned results will be that of the previous access and if that is
different from the expected offset, log a debug message and error out.

Signed-off-by: default avatarBruce Allan <bruce.w.allan@intel.com>
Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 8b49a4c7
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -788,6 +788,7 @@
	GG82563_REG(194, 18) /* Inband Control */
	GG82563_REG(194, 18) /* Inband Control */


/* MDI Control */
/* MDI Control */
#define E1000_MDIC_REG_MASK	0x001F0000
#define E1000_MDIC_REG_SHIFT 16
#define E1000_MDIC_REG_SHIFT 16
#define E1000_MDIC_PHY_SHIFT 21
#define E1000_MDIC_PHY_SHIFT 21
#define E1000_MDIC_OP_WRITE  0x04000000
#define E1000_MDIC_OP_WRITE  0x04000000
+12 −0
Original line number Original line Diff line number Diff line
@@ -178,6 +178,12 @@ s32 e1000e_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data)
		e_dbg("MDI Error\n");
		e_dbg("MDI Error\n");
		return -E1000_ERR_PHY;
		return -E1000_ERR_PHY;
	}
	}
	if (((mdic & E1000_MDIC_REG_MASK) >> E1000_MDIC_REG_SHIFT) != offset) {
		e_dbg("MDI Read offset error - requested %d, returned %d\n",
		      offset,
		      (mdic & E1000_MDIC_REG_MASK) >> E1000_MDIC_REG_SHIFT);
		return -E1000_ERR_PHY;
	}
	*data = (u16)mdic;
	*data = (u16)mdic;


	/* Allow some time after each MDIC transaction to avoid
	/* Allow some time after each MDIC transaction to avoid
@@ -236,6 +242,12 @@ s32 e1000e_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data)
		e_dbg("MDI Error\n");
		e_dbg("MDI Error\n");
		return -E1000_ERR_PHY;
		return -E1000_ERR_PHY;
	}
	}
	if (((mdic & E1000_MDIC_REG_MASK) >> E1000_MDIC_REG_SHIFT) != offset) {
		e_dbg("MDI Write offset error - requested %d, returned %d\n",
		      offset,
		      (mdic & E1000_MDIC_REG_MASK) >> E1000_MDIC_REG_SHIFT);
		return -E1000_ERR_PHY;
	}


	/* Allow some time after each MDIC transaction to avoid
	/* Allow some time after each MDIC transaction to avoid
	 * reading duplicate data in the next MDIC transaction.
	 * reading duplicate data in the next MDIC transaction.