From 98f181be8e400434698fd89b13e04dbda9e8935d Mon Sep 17 00:00:00 2001 From: Jason Jin Date: Thu, 26 Jul 2012 15:16:42 +0800 Subject: Add Vybrid ENET support Signed-off-by: TsiChung Liew --- drivers/net/mcffec.c | 18 ++++++++++++++---- drivers/net/mcfmii.c | 4 +++- 2 files changed, 17 insertions(+), 5 deletions(-) (limited to 'drivers') diff --git a/drivers/net/mcffec.c b/drivers/net/mcffec.c index a08ff278bf..1f59794102 100644 --- a/drivers/net/mcffec.c +++ b/drivers/net/mcffec.c @@ -33,7 +33,11 @@ #include #include +#ifdef CONFIG_COLDFIRE #include +#endif +#ifdef CONFIG_VYBRID +#endif #undef ET_DEBUG #undef MII_DEBUG @@ -116,7 +120,7 @@ void setFecDuplexSpeed(volatile fec_t * fecp, bd_t * bd, int dup_spd) } if ((dup_spd & 0xFFFF) == _100BASET) { -#ifdef CONFIG_MCF5445x +#if defined(CONFIG_MCF5445x) || defined(CONFIG_VYBRID) fecp->rcr &= ~0x200; /* disabled 10T base */ #endif #ifdef MII_DEBUG @@ -124,7 +128,7 @@ void setFecDuplexSpeed(volatile fec_t * fecp, bd_t * bd, int dup_spd) #endif bd->bi_ethspeed = 100; } else { -#ifdef CONFIG_MCF5445x +#if defined(CONFIG_MCF5445x) || defined(CONFIG_VYBRID) fecp->rcr |= 0x200; /* enabled 10T base */ #endif #ifdef MII_DEBUG @@ -182,7 +186,7 @@ int fec_send(struct eth_device *dev, volatile void *packet, int length) j = 0; while ((info->txbd[info->txIdx].cbd_sc & BD_ENET_TX_READY) && (j < MCFFEC_TOUT_LOOP)) { - udelay(1); + udelay(10); j++; } if (j >= MCFFEC_TOUT_LOOP) { @@ -515,7 +519,12 @@ int fec_init(struct eth_device *dev, bd_t * bd) fecp->etdsr = (unsigned int)(&info->txbd[0]); /* Now enable the transmit and receive processing */ +#ifdef CONFIG_VYBRID + /*Big Endian*/ + fecp->ecr |= FEC_ECR_ETHER_EN | 0x100; +#else fecp->ecr |= FEC_ECR_ETHER_EN; +#endif /* And last, try to fill Rx Buffer Descriptors */ fecp->rdar = 0x01000000; /* Descriptor polling active */ @@ -621,6 +630,7 @@ int mcffec_initialize(bd_t * bis) /* default speed */ bis->bi_ethspeed = 10; - + /*Ugly workaround for FEC to work in kernel, TODO Jason*/ + mii_init(); return 0; } diff --git a/drivers/net/mcfmii.c b/drivers/net/mcfmii.c index 471c5efea1..63f1fd98ad 100644 --- a/drivers/net/mcfmii.c +++ b/drivers/net/mcfmii.c @@ -31,7 +31,9 @@ #else #include #endif +#ifdef CONFIG_COLDFIRE #include +#endif DECLARE_GLOBAL_DATA_PTR; @@ -83,6 +85,7 @@ phy_info_t phyinfo[] = { {0x20005CE1, "N83640"}, /* National 83640 */ {0x20005C90, "N83848"}, /* National 83848 */ {0x20005CA2, "N83849"}, /* National 83849 */ + {0x0007C0F1, "SMSC8720A"}, /* SMSC 8720a */ {0x01814400, "QS6612"}, /* QS6612 */ #if defined(CONFIG_SYS_UNSPEC_PHYID) && defined(CONFIG_SYS_UNSPEC_STRID) {CONFIG_SYS_UNSPEC_PHYID, CONFIG_SYS_UNSPEC_STRID}, @@ -122,7 +125,6 @@ uint mii_send(uint mii_cmd) info = dev->priv; ep = (FEC_T *) info->miibase; - ep->mmfr = mii_cmd; /* command to phy */ /* wait for mii complete */ -- cgit v1.2.3