Skip to contentSkip to conversation

e1000e: check_polarity function pointers not set for 8257x

PATCH In review Jeff Kirsher 2 participants 4 messages Dec 3, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 e1000e: check_polarity function pointers not set for 8257x

From: Bruce Allan <[email protected]>

The function pointers for 8257x devices are not set. This is not really a problem now because there is nothing in the driver that references the pointers for this particular MAC-family (the appropriate functions are called directly), but the pointers should be set in case they are used in the future.

---

 drivers/net/e1000e/82571.c  |    3 +++
 drivers/net/e1000e/es2lan.c |    1 +
 2 files changed, 4 insertions(+), 0 deletions(-)
drivers/net/e1000e/82571.c +3 -0
index f6f3a22..c1a42cf 100644
@@ -1714,6 +1714,7 @@ static struct e1000_mac_operations e82571_mac_ops = {
 
 static struct e1000_phy_operations e82_phy_ops_igp = {
 	.acquire		= e1000_get_hw_semaphore_82571,
+	.check_polarity		= e1000_check_polarity_igp,
 	.check_reset_block	= e1000e_check_reset_block_generic,
 	.commit			= NULL,
 	.force_speed_duplex	= e1000e_phy_force_speed_duplex_igp,
@@ -1731,6 +1732,7 @@ static struct e1000_phy_operations e82_phy_ops_igp = {
 
 static struct e1000_phy_operations e82_phy_ops_m88 = {
 	.acquire		= e1000_get_hw_semaphore_82571,
+	.check_polarity		= e1000_check_polarity_m88,
 	.check_reset_block	= e1000e_check_reset_block_generic,
 	.commit			= e1000e_phy_sw_reset,
 	.force_speed_duplex	= e1000e_phy_force_speed_duplex_m88,
@@ -1748,6 +1750,7 @@ static struct e1000_phy_operations e82_phy_ops_m88 = {
 
 static struct e1000_phy_operations e82_phy_ops_bm = {
 	.acquire		= e1000_get_hw_semaphore_82571,
+	.check_polarity		= e1000_check_polarity_m88,
 	.check_reset_block	= e1000e_check_reset_block_generic,
 	.commit			= e1000e_phy_sw_reset,
 	.force_speed_duplex	= e1000e_phy_force_speed_duplex_m88,
drivers/net/e1000e/es2lan.c +1 -0
index c7bc657..d2a1047 100644
@@ -1391,6 +1391,7 @@ static struct e1000_mac_operations es2_mac_ops = {
 
 static struct e1000_phy_operations es2_phy_ops = {
 	.acquire		= e1000_acquire_phy_80003es2lan,
+	.check_polarity		= e1000_check_polarity_m88,
 	.check_reset_block	= e1000e_check_reset_block_generic,
 	.commit		 	= e1000e_phy_sw_reset,
 	.force_speed_duplex 	= e1000_phy_force_speed_duplex_80003es2lan,
#1 lore raw

PATCH 2/3 e1000e: refactor PHY ID detection workaround

From: Bruce Allan <[email protected]>

The workaround that detects the correct PHY ID when an initial read of the PHY ID registers returns an invalid one should retry up to ten times with a small delay between attempts using a single PHY address and then repeat using the remaining possible PHY addresses. Do this instead of trying each possible PHY address repeating that up to 100 times.

---

 drivers/net/e1000e/hw.h  |    2 +-
 drivers/net/e1000e/phy.c |   26 ++++++++++++++++----------
 2 files changed, 17 insertions(+), 11 deletions(-)
drivers/net/e1000e/hw.h +1 -1
index 41609d5..a7d08da 100644
@@ -219,7 +219,7 @@ enum e1e_registers {
 	E1000_HICR      = 0x08F00, /* Host Interface Control */
 };
 
-/* RSS registers */
+#define E1000_MAX_PHY_ADDR		4
 
 /* IGP01E1000 Specific Registers */
 #define IGP01E1000_PHY_PORT_CONFIG	0x10 /* Port Config */
drivers/net/e1000e/phy.c +16 -10
index 0c69649..67a7188 100644
@@ -2197,28 +2197,34 @@ enum e1000_phy_type e1000e_get_phy_type_from_id(u32 phy_id)
 s32 e1000e_determine_phy_address(struct e1000_hw *hw)
 {
 	s32 ret_val = -E1000_ERR_PHY_TYPE;
-	u32 phy_addr= 0;
-	u32 i = 0;
+	u32 phy_addr = 0;
+	u32 i;
 	enum e1000_phy_type phy_type = e1000_phy_unknown;
 
-	do {
-		for (phy_addr = 0; phy_addr < 4; phy_addr++) {
-			hw->phy.addr = phy_addr;
+	hw->phy.id = phy_type;
+
+	for (phy_addr = 0; phy_addr < E1000_MAX_PHY_ADDR; phy_addr++) {
+		hw->phy.addr = phy_addr;
+		i = 0;
+
+		do {
 			e1000e_get_phy_id(hw);
 			phy_type = e1000e_get_phy_type_from_id(hw->phy.id);
 
-			/* 
+			/*
 			 * If phy_type is valid, break - we found our
 			 * PHY address
 			 */
 			if (phy_type  != e1000_phy_unknown) {
 				ret_val = 0;
-				break;
+				goto out;
 			}
-		}
-		i++;
-	} while ((ret_val != 0) && (i < 100));
+			msleep(1);
+			i++;
+		} while (i < 10);
+	}
 
+out:
 	return ret_val;
 }
 
#2 lore raw

PATCH 3/3 e1000e: correct ICH/PCH PHY operations function pointers

In reply to Jeff Kirsher

From: Bruce Allan <[email protected]>

Some function pointers for a few PHY operations (for 82578 and 82567) and were set incorrectly causing functions to be executed that were accessing incorrect PHY register offsets for that particular device. This patch also moves a few PHY-specific functions from ich8lan.c to the more appropriate phy.c.

---

 drivers/net/e1000e/e1000.h   |    6 +
 drivers/net/e1000e/ich8lan.c |  216 ++++--------------------------------------
 drivers/net/e1000e/phy.c     |  191 ++++++++++++++++++++++++++++++++++---
 3 files changed, 204 insertions(+), 209 deletions(-)
drivers/net/e1000e/e1000.h +6 -0
index b9f9e78..cebbd90 100644
@@ -590,6 +590,12 @@ extern s32 e1000_get_phy_info_82577(struct e1000_hw *hw);
 extern s32 e1000_phy_force_speed_duplex_82577(struct e1000_hw *hw);
 extern s32 e1000_get_cable_length_82577(struct e1000_hw *hw);
 
+extern s32 e1000_check_polarity_m88(struct e1000_hw *hw);
+extern s32 e1000_get_phy_info_ife(struct e1000_hw *hw);
+extern s32 e1000_check_polarity_ife(struct e1000_hw *hw);
+extern s32 e1000_phy_force_speed_duplex_ife(struct e1000_hw *hw);
+extern s32 e1000_check_polarity_igp(struct e1000_hw *hw);
+
 static inline s32 e1000_phy_hw_reset(struct e1000_hw *hw)
 {
 	return hw->phy.ops.reset(hw);
drivers/net/e1000e/ich8lan.c +21 -195

283 lines not on this page · raw message

drivers/net/e1000e/phy.c +177 -14

239 lines not on this page · raw message