summaryrefslogtreecommitdiff
path: root/drivers/net/mxc_fec.c
diff options
context:
space:
mode:
authorTerry Lv <r65388@freescale.com>2010-03-08 17:12:51 +0800
committerTerry Lv <r65388@freescale.com>2010-03-12 11:07:40 +0800
commitaca6f560d03a0780d4713e1f458e132bec28f37b (patch)
tree7556ea9a2ec59871d8947e273437c5066bcd13ea /drivers/net/mxc_fec.c
parentf4c2bfd8fbed1fcf8d33abf54f614594779f57e8 (diff)
downloadu-boot-imx-aca6f560d03a0780d4713e1f458e132bec28f37b.zip
u-boot-imx-aca6f560d03a0780d4713e1f458e132bec28f37b.tar.gz
u-boot-imx-aca6f560d03a0780d4713e1f458e132bec28f37b.tar.bz2
ENGR00121379: MX28 U-BOOT enhancements
MX28 U-BOOT enhancements. Signed-off-by: Terry Lv <r65388@freescale.com>
Diffstat (limited to 'drivers/net/mxc_fec.c')
-rw-r--r--drivers/net/mxc_fec.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/net/mxc_fec.c b/drivers/net/mxc_fec.c
index ba60d03..1a9f53f 100644
--- a/drivers/net/mxc_fec.c
+++ b/drivers/net/mxc_fec.c
@@ -285,6 +285,17 @@ static void setFecDuplexSpeed(volatile fec_t *fecp, unsigned char addr,
unsigned short val = 0;
int ret;
+#ifdef CONFIG_MX28
+ /* Dummy read with delay to get phy start working */
+ do {
+ __fec_mii_read(fecp, CONFIG_FEC0_PHY_ADDR, PHY_PHYIDR1, &val);
+ udelay(10000);
+#ifdef MII_DEBUG
+ printf("Dummy read on phy\n");
+#endif
+ } while (val == 0 || val == 0xffff);
+#endif
+
ret = __fec_mii_read(fecp, addr, PHY_BMCR, &val);
switch (dup_spd >> 16) {
case HALF:
@@ -343,6 +354,17 @@ static void setFecDuplexSpeed(volatile fec_t *fecp, unsigned char addr,
#endif
}
+#ifdef CONFIG_MX28
+static void swap_packet(void *packet, int length)
+{
+ int i;
+ unsigned int *buf = packet;
+
+ for (i = 0; i < (length + 3) / 4; i++, buf++)
+ *buf = __swab32(*buf);
+}
+#endif
+
int fec_send(struct eth_device *dev, volatile void *packet, int length)
{
struct fec_info_s *info = dev->priv;
@@ -369,6 +391,10 @@ int fec_send(struct eth_device *dev, volatile void *packet, int length)
if (j >= FEC_MAX_TIMEOUT)
printf("TX not ready\n");
+#ifdef CONFIG_MX28
+ swap_packet((void *)packet, length);
+#endif
+
#ifdef CONFIG_ARCH_MMU
memcpy(ioremap_nocache(info->txbd[info->txIdx].cbd_bufaddr, length),
packet, length);
@@ -440,6 +466,9 @@ int fec_recv(struct eth_device *dev)
#endif
} else {
length -= 4;
+#ifdef CONFIG_MX28
+ swap_packet((void *)NetRxPackets[info->rxIdx], length);
+#endif
/* Pass the packet up to the protocol layers. */
#ifdef CONFIG_ARCH_MMU
memcpy(NetRxPackets[info->rxIdx],