From 62599d592a17ec61767bcef4f0c20ef4b53613fa Mon Sep 17 00:00:00 2001 From: Anirudha Sarangi Date: Mon, 9 Feb 2015 17:11:44 +0530 Subject: [PATCH] lwip: Add warning message for non-Marvell PHY handling This patch informs users if the PHY present is not from Marvell. It adds a warning message for non-Marvell PHY cases to notify users to cross-check the initialization sequence. Signed-off-by: Anirudha Sarangi --- .../ports/xilinx/netif/xaxiemacif_physpeed.c | 16 ++++++++++++---- .../ports/xilinx/netif/xemacpsif_physpeed.c | 12 ++++++++++-- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/ThirdParty/sw_services/lwip141/src/contrib/ports/xilinx/netif/xaxiemacif_physpeed.c b/ThirdParty/sw_services/lwip141/src/contrib/ports/xilinx/netif/xaxiemacif_physpeed.c index e0a40ddd..12e30768 100755 --- a/ThirdParty/sw_services/lwip141/src/contrib/ports/xilinx/netif/xaxiemacif_physpeed.c +++ b/ThirdParty/sw_services/lwip141/src/contrib/ports/xilinx/netif/xaxiemacif_physpeed.c @@ -106,10 +106,13 @@ #define IEEE_PAUSE_MASK 0x0400 #define IEEE_AUTONEG_ERROR_MASK 0x8000 -#define PHY_DETECT_REG 1 -#define PHY_DETECT_MASK 0x1808 -#define PHY_R0_ISOLATE 0x0400 -#define PHY_MODEL_NUM_MASK 0x3F0 +#define PHY_R0_ISOLATE 0x0400 +#define PHY_MODEL_NUM_MASK 0x3F0 +#define PHY_DETECT_REG 1 +#define PHY_IDENTIFIER_1_REG 2 +#define PHY_DETECT_MASK 0x1808 +#define PHY_MARVELL_IDENTIFIER 0x0141 + /* Marvel PHY flags */ #define MARVEL_PHY_IDENTIFIER 0x141 @@ -151,6 +154,11 @@ static int detect_phy(XAxiEthernet *xaxiemacp) /* Found a valid PHY address */ LWIP_DEBUGF(NETIF_DEBUG, ("XAxiEthernet detect_phy: PHY detected at address %d.\r\n", phy_addr)); LWIP_DEBUGF(NETIF_DEBUG, ("XAxiEthernet detect_phy: PHY detected.\r\n")); + XAxiEthernet_PhyRead(xaxiemacp, phy_addr, PHY_IDENTIFIER_1_REG, + &phy_reg); + if (phy_reg != PHY_MARVELL_IDENTIFIER) { + xil_printf("WARNING: Not a Marvell Ethernet PHY. Please verify the initialization sequence\r\n"); + } return phy_addr; } } diff --git a/ThirdParty/sw_services/lwip141/src/contrib/ports/xilinx/netif/xemacpsif_physpeed.c b/ThirdParty/sw_services/lwip141/src/contrib/ports/xilinx/netif/xemacpsif_physpeed.c index 5ab4facd..82c63428 100755 --- a/ThirdParty/sw_services/lwip141/src/contrib/ports/xilinx/netif/xemacpsif_physpeed.c +++ b/ThirdParty/sw_services/lwip141/src/contrib/ports/xilinx/netif/xemacpsif_physpeed.c @@ -147,8 +147,10 @@ #define IEEE_PAUSE_MASK 0x0400 #define IEEE_AUTONEG_ERROR_MASK 0x8000 -#define PHY_DETECT_REG 1 -#define PHY_DETECT_MASK 0x1808 +#define PHY_DETECT_REG 1 +#define PHY_IDENTIFIER_1_REG 2 +#define PHY_DETECT_MASK 0x1808 +#define PHY_MARVELL_IDENTIFIER 0x0141 #define XEMACPS_GMII2RGMII_SPEED1000_FD 0x140 #define XEMACPS_GMII2RGMII_SPEED100_FD 0x2100 @@ -287,6 +289,12 @@ void detect_phy(XEmacPs *xemacpsp) phymapemac0[phy_addr] = TRUE; else phymapemac1[phy_addr] = TRUE; + + XEmacPs_PhyRead(xemacpsp, phy_addr, PHY_IDENTIFIER_1_REG, + &phy_reg); + if (phy_reg != PHY_MARVELL_IDENTIFIER) { + xil_printf("WARNING: Not a Marvell Ethernet PHY. Please verify the initialization sequence\r\n"); + } } } }