]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
MPC5XXX, Motion-PRO: Fix PHY initialization problem.
authorBartlomiej Sieka <tur@semihalf.com>
Sun, 27 May 2007 14:58:45 +0000 (16:58 +0200)
committerBartlomiej Sieka <tur@semihalf.com>
Sun, 27 May 2007 14:58:45 +0000 (16:58 +0200)
After being reset in mpc5xxx_fec_init_phy(), PHY goes into FX mode, in which
networking does not function. This commit switches PHY to TX mode by clearing
the FX_SEL bit of Mode Control Register. It also reverses commit
008861a2f3ef2c062744d733787c7e530a1b8761, i.e., a temporary workaround.

Signed-off-by: Grzegorz Bernacki <gjb@semihalf.com>
Acked-by: Bartlomiej Sieka <tur@semihalf.com>
board/motionpro/motionpro.c
cpu/mpc5xxx/fec.c
include/configs/motionpro.h

index 1729ae74166f0478e796d36cf4cfa7cd58b1928f..b05e2ab1cdb851d75a20396d50feb8824f7fa148 100644 (file)
@@ -28,7 +28,7 @@
 
 #include <common.h>
 #include <mpc5xxx.h>
-
+#include <miiphy.h>
 #if defined(CONFIG_OF_FLAT_TREE)
 #include <ft_build.h>
 #endif
@@ -82,6 +82,22 @@ int board_early_init_r(void)
 }
 
 
+/*
+ * Additional PHY intialization. After being reset in mpc5xxx_fec_init_phy(),
+ * PHY goes into FX mode.  To take it out of the FX mode and switch into
+ * desired TX operation, one needs to clear the FX_SEL bit of Mode Control
+ * Register.
+ */
+void reset_phy(void)
+{
+       unsigned short mode_control;
+
+       miiphy_read("FEC ETHERNET", CONFIG_PHY_ADDR, 0x15, &mode_control);
+       miiphy_write("FEC ETHERNET", CONFIG_PHY_ADDR, 0x15,
+                       mode_control & 0xfffe);
+       return;
+}
+
 #ifndef CFG_RAMBOOT
 /*
  * Helper function to initialize SDRAM controller.
index 0b8f24d18a77f09808133eb8e237aa5e4119df50..62b5f4efdca09880bea6c9bce9efe31b6b1ed40c 100644 (file)
@@ -395,9 +395,7 @@ static int mpc5xxx_fec_init(struct eth_device *dev, bd_t * bis)
 static int mpc5xxx_fec_init_phy(struct eth_device *dev, bd_t * bis)
 {
        mpc5xxx_fec_priv *fec = (mpc5xxx_fec_priv *)dev->priv;
-#ifndef CONFIG_MOTIONPRO
        const uint8 phyAddr = CONFIG_PHY_ADDR;  /* Only one PHY */
-#endif /* !CONFIG_MOTIONPRO */
 
 #if (DEBUG & 0x1)
        printf ("mpc5xxx_fec_init_phy... Begin\n");
@@ -437,7 +435,6 @@ static int mpc5xxx_fec_init_phy(struct eth_device *dev, bd_t * bis)
  * PHY initialization for the Motion-PRO board, until a proper fix is found.
  */
 
-#ifndef CONFIG_MOTIONPRO
        if (fec->xcv_type != SEVENWIRE) {
                /*
                 * Set MII_SPEED = (1/(mii_speed * 2)) * System Clock
@@ -560,7 +557,6 @@ static int mpc5xxx_fec_init_phy(struct eth_device *dev, bd_t * bis)
                }
 
        }
-#endif /* !CONFIG_MOTIONPRO */
 
 #if (DEBUG & 0x2)
        if (fec->xcv_type != SEVENWIRE)
index a4df64a75dff0a6a2affea23417ccc56b605fda0..a7021b0719b1aaca92a2fb68afd80b928b3b00ac 100644 (file)
@@ -76,7 +76,7 @@
 #define CONFIG_MPC5xxx_FEC     1
 #define CONFIG_PHY_ADDR                0x2
 #define CONFIG_PHY_TYPE                0x79c874
-
+#define CONFIG_RESET_PHY_R     1
 
 /*
  * Autobooting