changeset 2003:7725d216c7bc

* src/if_lan91cxx.c: Reset the physical layer before configuring it, otherwise it might not work.
author asl
date Mon, 27 Jun 2005 19:59:38 +0000
parents 20fee0cef763
children d3a8cc4f7931
files packages/devs/eth/smsc/lan91cxx/current/ChangeLog packages/devs/eth/smsc/lan91cxx/current/src/if_lan91cxx.c
diffstat 2 files changed, 13 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/packages/devs/eth/smsc/lan91cxx/current/ChangeLog
+++ b/packages/devs/eth/smsc/lan91cxx/current/ChangeLog
@@ -1,3 +1,8 @@
+2005-06-12  Yoshinori Sato <ysato@users.sourceforge.jp>
+
+	* src/if_lan91cxx.c: Reset the physical layer before configuring
+	it, otherwise it might not work.
+
 2004-05-22  Andrew Dyer  <adyer@righthandtech.com>
 
 	* src/if_lan91cxx.c: Fail initialization if no device found.
--- a/packages/devs/eth/smsc/lan91cxx/current/src/if_lan91cxx.c
+++ b/packages/devs/eth/smsc/lan91cxx/current/src/if_lan91cxx.c
@@ -454,7 +454,6 @@ lan91cxx_start(struct eth_drv_sc *sc, un
 {
     cyg_uint16 intr;
 #ifdef LAN91CXX_IS_LAN91C111
-    cyg_uint16 phy_ctl;
     int delay;
 #endif
 #ifdef CYGPKG_NET
@@ -463,12 +462,11 @@ lan91cxx_start(struct eth_drv_sc *sc, un
     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 @@ lan91cxx_start(struct eth_drv_sc *sc, un
 	    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);