- 积分
- 5
贡献32
飞刀5 FD
注册时间2017-10-31
在线时间1 小时
|
发表于 2017-10-31 09:27:39
|
显示全部楼层
修改Mx6q_sabresd.c中:
/* ccj add for debug */
int mx6_rgmii_rework(char *devname, int phy_addr)
{
unsigned short val;
#if 1 /* ccj add for debug */
/* enable master mode, force phy to 100Mbps */
phy_write(devname, phy_addr, 0x9, 0x1c00);
#endif
phy_write(devname, phy_addr, 0xd, 0x3);
phy_write(devname, phy_addr, 0xe, 0x805d);
phy_write(devname, phy_addr, 0xd, 0x4003);
phy_read(devname, phy_addr, 0xe,&val);
val &= ~(0x1 << 8);
phy_write(devname, phy_addr, 0xe, val);
/* To enable AR8031 ouput a 125MHz clk from CLK_25M */
phy_write(devname, phy_addr, 0xd, 0x7);
phy_write(devname, phy_addr, 0xe, 0x8016);
phy_write(devname, phy_addr, 0xd, 0x4007);
phy_read(devname, phy_addr, 0xe, &val);
val &= 0xffe3;
val |= 0x18;
phy_write(devname, phy_addr, 0xe, val);
/* introduce tx clock delay */
phy_write(devname, phy_addr, 0x1d, 0x5);
phy_read(devname, phy_addr, 0x1e, &val);
val |= 0x0100;
phy_write(devname, phy_addr, 0x1e, val);
return 0;
}
修改Mxc_fec.c中:
int fec_recv(struct eth_device *dev)
{
struct fec_info_s *info = dev->priv;
volatile fec_t *fecp = (fec_t *) (info->iobase);
int length;
int i=0;
for (;;) {
#ifdef CONFIG_SYS_UNIFY_CACHE
icache_invalid();
#endif
/* section 16.9.23.2 */
if (info->rxbd[info->rxIdx].cbd_sc & BD_ENET_RX_EMPTY) {
length = -1; /* ccj add for debug */
if(i++>50)
return 0;
break; /* nothing received - leave for() loop */
}
length = info->rxbd[info->rxIdx].cbd_datlen;
if (info->rxbd[info->rxIdx].cbd_sc & 0x003f) {
#ifdef ET_DEBUG
printf("%s[%d] err: %x\n",
__func__, __LINE__,
info->rxbd[info->rxIdx].cbd_sc);
#endif
fecp->eir &= fecp->eir;
} 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((void *)NetRxPackets[info->rxIdx],
ioremap_nocache((ulong)info->rxbd[info->rxIdx].cbd_bufaddr, 0),
length);
#endif
NetReceive(NetRxPackets[info->rxIdx], length);
fecp->eir |= FEC_EIR_RXF;
}
/* Give the buffer back to the FEC. */
info->rxbd[info->rxIdx].cbd_datlen = 0;
/* wrap around buffer index when necessary */
if (info->rxIdx == LAST_PKTBUFSRX) {
info->rxbd[PKTBUFSRX - 1].cbd_sc = BD_ENET_RX_W_E;
info->rxIdx = 0;
} else {
info->rxbd[info->rxIdx].cbd_sc = BD_ENET_RX_EMPTY;
info->rxIdx++;
}
/* Try to fill Buffer Descriptors */
fecp->rdar = 0x01000000; /* Descriptor polling active */
}
return length;
} |
|