aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG5
-rw-r--r--cpu/mpc5xxx/fec.c86
2 files changed, 69 insertions, 22 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 5e9c5e508d..a3280e964e 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2,6 +2,11 @@
Changes since U-Boot 1.1.1:
======================================================================
+* Fix minor network problem on MPC5200: need some delay between
+ resetting the PHY and sending the first packet. Implemented in a
+ "natural" way by invoking the PHY reset and initialization code
+ only once after power on vs. each time the interface is brought up.
+
* Add some limited support for low-speed devices to SL811 USB controller
(at least "usb reset" now passes successfully and "usb info" displays
correct information)
diff --git a/cpu/mpc5xxx/fec.c b/cpu/mpc5xxx/fec.c
index 1df394aaf5..5355a8131b 100644
--- a/cpu/mpc5xxx/fec.c
+++ b/cpu/mpc5xxx/fec.c
@@ -238,7 +238,6 @@ static int mpc5xxx_fec_init(struct eth_device *dev, bd_t * bis)
DECLARE_GLOBAL_DATA_PTR;
mpc5xxx_fec_priv *fec = (mpc5xxx_fec_priv *)dev->priv;
struct mpc5xxx_sdma *sdma = (struct mpc5xxx_sdma *)MPC5XXX_SDMA;
- const uint8 phyAddr = CONFIG_PHY_ADDR; /* Only one PHY */
#if (DEBUG & 0x1)
printf ("mpc5xxx_fec_init... Begin\n");
@@ -251,17 +250,6 @@ static int mpc5xxx_fec_init(struct eth_device *dev, bd_t * bis)
mpc5xxx_fec_tbd_init(fec);
/*
- * Initialize GPIO pins
- */
- if (fec->xcv_type == SEVENWIRE) {
- /* 10MBit with 7-wire operation */
- *(vu_long *)MPC5XXX_GPS_PORT_CONFIG |= 0x00020000;
- } else {
- /* 100MBit with MD operation */
- *(vu_long *)MPC5XXX_GPS_PORT_CONFIG |= 0x00050000;
- }
-
- /*
* Clear FEC-Lite interrupt event register(IEVENT)
*/
fec->eth->ievent = 0xffffffff;
@@ -371,6 +359,68 @@ static int mpc5xxx_fec_init(struct eth_device *dev, bd_t * bis)
*(int *)FEC_TBD_NEXT = (int)fec->tbdBase;
*(int *)FEC_RBD_NEXT = (int)fec->rbdBase;
+ /*
+ * Enable FEC-Lite controller
+ */
+ fec->eth->ecntrl |= 0x00000006;
+
+#if (DEBUG & 0x2)
+ if (fec->xcv_type != SEVENWIRE)
+ mpc5xxx_fec_phydump ();
+#endif
+
+ /*
+ * Enable SmartDMA receive task
+ */
+ SDMA_TASK_ENABLE(FEC_RECV_TASK_NO);
+
+#if (DEBUG & 0x1)
+ printf("mpc5xxx_fec_init... Done \n");
+#endif
+
+ return 1;
+}
+
+/********************************************************************/
+static int mpc5xxx_fec_init_phy(struct eth_device *dev, bd_t * bis)
+{
+ DECLARE_GLOBAL_DATA_PTR;
+ mpc5xxx_fec_priv *fec = (mpc5xxx_fec_priv *)dev->priv;
+ const uint8 phyAddr = CONFIG_PHY_ADDR; /* Only one PHY */
+
+#if (DEBUG & 0x1)
+ printf ("mpc5xxx_fec_init_phy... Begin\n");
+#endif
+
+ /*
+ * Initialize GPIO pins
+ */
+ if (fec->xcv_type == SEVENWIRE) {
+ /* 10MBit with 7-wire operation */
+ *(vu_long *)MPC5XXX_GPS_PORT_CONFIG |= 0x00020000;
+ } else {
+ /* 100MBit with MD operation */
+ *(vu_long *)MPC5XXX_GPS_PORT_CONFIG |= 0x00050000;
+ }
+
+ /*
+ * Clear FEC-Lite interrupt event register(IEVENT)
+ */
+ fec->eth->ievent = 0xffffffff;
+
+ /*
+ * Set interrupt mask register
+ */
+ fec->eth->imask = 0x00000000;
+
+ if (fec->xcv_type != SEVENWIRE) {
+ /*
+ * Set MII_SPEED = (1/(mii_speed * 2)) * System Clock
+ * and do not drop the Preamble.
+ */
+ fec->eth->mii_speed = (((gd->ipb_clk >> 20) / 5) << 1); /* No MII for 7-wire mode */
+ }
+
if (fec->xcv_type != SEVENWIRE) {
/*
* Initialize PHY(LXT971A):
@@ -486,23 +536,14 @@ static int mpc5xxx_fec_init(struct eth_device *dev, bd_t * bis)
}
- /*
- * Enable FEC-Lite controller
- */
- fec->eth->ecntrl |= 0x00000006;
-
#if (DEBUG & 0x2)
if (fec->xcv_type != SEVENWIRE)
mpc5xxx_fec_phydump ();
#endif
- /*
- * Enable SmartDMA receive task
- */
- SDMA_TASK_ENABLE(FEC_RECV_TASK_NO);
#if (DEBUG & 0x1)
- printf("mpc5xxx_fec_init... Done \n");
+ printf("mpc5xxx_fec_init_phy... Done \n");
#endif
return 1;
@@ -859,6 +900,7 @@ int mpc5xxx_fec_initialize(bd_t * bis)
mpc5xxx_fec_set_hwaddr(fec, env_enetaddr);
}
+ mpc5xxx_fec_init_phy(dev, bis);
return 1;
}