This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

SMSC LAN91C111 PHY setup


Need to seem to reset it in the first place in order to work really.
The procedure is mentioned in even data sheet.

diff -u if_lan91cxx.c~ if_lan91cxx.c
--- if_lan91cxx.c~	23 Nov 2004 13:59:12 -0000
+++ if_lan91cxx.c	12 May 2005 07:59:57 -0000
@@ -454,7 +454,6 @@
 {
     cyg_uint16 intr;
 #ifdef LAN91CXX_IS_LAN91C111
-    cyg_uint16 phy_ctl;
     int delay;
 #endif
 #ifdef CYGPKG_NET
@@ -463,12 +462,11 @@
     DEBUG_FUNCTION();
 
 #ifdef LAN91CXX_IS_LAN91C111
-    HAL_DELAY_US(100000);
-
     // 91C111 Errata. Internal PHY comes up disabled. Must enable here.
-    phy_ctl = lan91cxx_read_phy(sc, 0, LAN91CXX_PHY_CTRL);
-    phy_ctl &= ~LAN91CXX_PHY_CTRL_MII_DIS;
-    lan91cxx_write_phy(sc, 0, LAN91CXX_PHY_CTRL, phy_ctl);
+    lan91cxx_write_phy(sc, 0, LAN91CXX_PHY_CTRL, LAN91CXX_PHY_CTRL_RST);
+    HAL_DELAY_US(500000);
+    lan91cxx_write_phy(sc, 0, LAN91CXX_PHY_CTRL, LAN91CXX_PHY_CTRL_ANEG_EN |
+		                                 LAN91CXX_PHY_CTRL_SPEED);
 
     // Start auto-negotiation
     put_reg(sc, LAN91CXX_RPCR,
@@ -482,6 +480,10 @@
 	    break;
 	HAL_DELAY_US(100000);
     }
+#if DEBUG & 1
+    if (delay <= 0)
+	    diag_printf("auto-negotiation failed.\n");
+#endif
 #endif
 
     put_reg(sc, LAN91CXX_MMU_COMMAND, LAN91CXX_MMU_reset_mmu);

-- 
Yoshinori Sato
<ysato@users.sourceforge.jp>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]