T2080 AR8031 RGMII to 1000Base-X(fiber)

2024-03-15 04:12

本文主要是介绍T2080 AR8031 RGMII to 1000Base-X(fiber),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

        前段时间在调试FT-M6678和C6678的板卡,结果中途来了一个T2080网络配置的更改需求,就临时处理了一下,花了一点功夫,记录下来,为大家做个参考。

        这个问题完成后,就得继续开发FT-M6678了~

  1. uboot下面phy配置更改(board/freescale/tx208xrdb/eth_t208xrdb.c)

        a. 配置芯片模式配置为BX1000_RGMII_50

miiphy_write(DEFAULT_FM_MDIO_NAME, 0x6, 0x1F, 0x106);    //mode_cfg: 0010 = BX1000_RGMII_50
printf("phy write 0x1F by 0x106!\r\n");
miiphy_write(DEFAULT_FM_MDIO_NAME, 0x6, 0x0, 0x2100);
printf("phy write 0x0 by 0x2100!\r\n");
miiphy_write(DEFAULT_FM_MDIO_NAME, 0x6, 0x0, 0x140);
printf("phy write 0x0 by 0x140!\r\n");
miiphy_write(DEFAULT_FM_MDIO_NAME, 0x6, 0x1F, 0x102);    //mode_cfg: 0010 = BX1000_RGMII_50
printf("phy write 0x1F by 0x102!\r\n");
miiphy_write(DEFAULT_FM_MDIO_NAME, 0x6, 0xD, 0x3);
miiphy_write(DEFAULT_FM_MDIO_NAME, 0x6, 0xE, 0x805D);
miiphy_write(DEFAULT_FM_MDIO_NAME, 0x6, 0xD, 0x4003);
miiphy_write(DEFAULT_FM_MDIO_NAME, 0x6, 0xE, 0x100);
miiphy_write(DEFAULT_FM_MDIO_NAME, 0x6, 0x1D, 0x0);
miiphy_write(DEFAULT_FM_MDIO_NAME, 0x6, 0x1E, 0x8000);
miiphy_write(DEFAULT_FM_MDIO_NAME, 0x6, 0x1D, 0x5);
miiphy_write(DEFAULT_FM_MDIO_NAME, 0x6, 0x1E, 0x100);
//dummy read status
miiphy_read(DEFAULT_FM_MDIO_NAME, 0x6, 0x1, &value);

2. 更改phy.c(drivers/net/phy)

/*** genphy_update_link - update link status in @phydev* @phydev: target phy_device struct** Description: Update the value in phydev->link to reflect the*   current link value.  In order to do this, we need to read*   the status register twice, keeping the second value.*/
int genphy_update_link(struct phy_device *phydev)
{unsigned int mii_reg;/** Wait if the link is up, and autonegotiation is in progress* (ie - we're capable and it's not done)*/mii_reg = phy_read(phydev, MDIO_DEVAD_NONE, MII_BMSR);/** If we already saw the link up, and it hasn't gone down, then* we don't need to wait for autoneg again*///modifyif (phydev->addr != 6){if (phydev->link && mii_reg & BMSR_LSTATUS)return 0;}else{if (mii_reg & BMSR_LSTATUS)    {phydev->link = 1;printf("%s Force Mode", phydev->dev->name);phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR, 0x140);return 0;}}if ((mii_reg & BMSR_ANEGCAPABLE) && !(mii_reg & BMSR_ANEGCOMPLETE)) {int i = 0;printf("%s Waiting for PHY auto negotiation to complete",phydev->dev->name);while (!(mii_reg & BMSR_ANEGCOMPLETE)) {/** Timeout reached ?*/if (i > PHY_ANEG_TIMEOUT) {printf(" TIMEOUT !\n");phydev->link = 0;return 0;}if (ctrlc()) {puts("user interrupt!\n");phydev->link = 0;return -EINTR;}if ((i++ % 500) == 0)printf(".");udelay(1000);    /* 1 ms */mii_reg = phy_read(phydev, MDIO_DEVAD_NONE, MII_BMSR);}printf(" done\n");phydev->link = 1;} else {/* Read the link a second time to clear the latched state */mii_reg = phy_read(phydev, MDIO_DEVAD_NONE, MII_BMSR);if (mii_reg & BMSR_LSTATUS)phydev->link = 1;elsephydev->link = 0;}return 0;
}
/** Generic function which updates the speed and duplex.  If* autonegotiation is enabled, it uses the AND of the link* partner's advertised capabilities and our advertised* capabilities.  If autonegotiation is disabled, we use the* appropriate bits in the control register.** Stolen from Linux's mii.c and phy_device.c*/
int genphy_parse_link(struct phy_device *phydev)
{int mii_reg = phy_read(phydev, MDIO_DEVAD_NONE, MII_BMSR);if (phydev->addr != 6){/* We're using autonegotiation */if (phydev->supported & SUPPORTED_Autoneg) {u32 lpa = 0;int gblpa = 0;u32 estatus = 0;/* Check for gigabit capability */if (phydev->supported & (SUPPORTED_1000baseT_Full |SUPPORTED_1000baseT_Half)) {/* We want a list of states supported by* both PHYs in the link*/gblpa = phy_read(phydev, MDIO_DEVAD_NONE, MII_STAT1000);if (gblpa < 0) {debug("Could not read MII_STAT1000. Ignoring gigabit capability\n");gblpa = 0;}gblpa &= phy_read(phydev,MDIO_DEVAD_NONE, MII_CTRL1000) << 2;}/* Set the baseline so we only have to set them* if they're different*/phydev->speed = SPEED_10;phydev->duplex = DUPLEX_HALF;/* Check the gigabit fields */if (gblpa & (PHY_1000BTSR_1000FD | PHY_1000BTSR_1000HD)) {phydev->speed = SPEED_1000;if (gblpa & PHY_1000BTSR_1000FD)phydev->duplex = DUPLEX_FULL;/* We're done! */return 0;}lpa = phy_read(phydev, MDIO_DEVAD_NONE, MII_ADVERTISE);lpa &= phy_read(phydev, MDIO_DEVAD_NONE, MII_LPA);if (lpa & (LPA_100FULL | LPA_100HALF)) {phydev->speed = SPEED_100;if (lpa & LPA_100FULL)phydev->duplex = DUPLEX_FULL;} else if (lpa & LPA_10FULL)phydev->duplex = DUPLEX_FULL;/** Extended status may indicate that the PHY supports* 1000BASE-T/X even though the 1000BASE-T registers* are missing. In this case we can't tell whether the* peer also supports it, so we only check extended* status if the 1000BASE-T registers are actually* missing.*/if ((mii_reg & BMSR_ESTATEN) && !(mii_reg & BMSR_ERCAP))estatus = phy_read(phydev, MDIO_DEVAD_NONE,MII_ESTATUS);if (estatus & (ESTATUS_1000_XFULL | ESTATUS_1000_XHALF |ESTATUS_1000_TFULL | ESTATUS_1000_THALF)) {phydev->speed = SPEED_1000;if (estatus & (ESTATUS_1000_XFULL | ESTATUS_1000_TFULL))phydev->duplex = DUPLEX_FULL;}} else {u32 bmcr = phy_read(phydev, MDIO_DEVAD_NONE, MII_BMCR);phydev->speed = SPEED_10;phydev->duplex = DUPLEX_HALF;if (bmcr & BMCR_FULLDPLX)phydev->duplex = DUPLEX_FULL;if (bmcr & BMCR_SPEED1000)phydev->speed = SPEED_1000;else if (bmcr & BMCR_SPEED100)phydev->speed = SPEED_100;}}else{u32 bmcr = phy_read(phydev, MDIO_DEVAD_NONE, MII_BMCR);phydev->speed = SPEED_10;phydev->duplex = DUPLEX_HALF;if (bmcr & BMCR_FULLDPLX)phydev->duplex = DUPLEX_FULL;if (bmcr & BMCR_SPEED1000)phydev->speed = SPEED_1000;else if (bmcr & BMCR_SPEED100)phydev->speed = SPEED_100;}return 0;
}

2. 在内核系统启动后,依次输入如下指令:

ifconfig fm1-mac1 192.168.1.130 up

ifconfig fm1-mac3 192.168.2.130 up

ethtool -s fm1-mac3 speed 1000 duplex full autoneg off

使用ethtool配置强制千兆全双工,自协商关闭,即可

这篇关于T2080 AR8031 RGMII to 1000Base-X(fiber)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/810764

相关文章

RK3288 RGMII 连接百兆PHY DP83822

RGMII 通常用于连接千兆PHY, 使用125M时钟,但公司的板子使用RGMII连接百兆PHY DP83822 ,这里记录一下调试该PHY 芯片的过程。   电路图如下: 首先,修改设备树: 重新编译内核升级boot.img到板子,发现PHY的link指示灯亮,说明MAC和PHY之间的SMI接口通信正常,但怎么都ping不同局域网内IP, ifconfig 查看网卡数据流量

超详细带你学习go高性能web框架----fiber

go-fiber-fast go-fiber 主要定位为一个轻量级、高性能的 Web 框架,但其灵活性使得它可以通过与其他库的集成,构建出强大而多功能的应用程序,满足不同的业务需求,和gin一样轻量级别的路由,但是性能特别是极端性能比gin好一些,都可以通过整合其他sdk服务来达到效果,由于使用 fasthttp 作为 HTTP 引擎,使得 Fiber 的性能非常出色。(Fasthttp是Go

【React】如何理解 React 的 Fiber?

理解 React 源码的 Fiber 需要对 React 的内部工作原理和性能优化有深入的了解。Fiber 是 React 16 及以后版本中引入的一种新的内部表示形式,用于在 React 的核心算法中更好地管理组件树的更新和渲染。以下是关于 React 源码中 Fiber 的理解: 1. 为什么需要 Fiber? 在 React 15 及之前,React 使用了一种称为“堆栈调和递归”的算法

1000Base-T协议解读

一、说明 千兆以太网家族包括1000Base-SX(短距)、1000Base-LX(长距)、1000Base-CX(铜缆短距)、1000Base-T1(车载以太网)和1000Base-T等多种标准,我们这边主要了解下1000Base-T,也就是工业千兆以太网,PC电脑的网口都是这个。 1000Base-T采用了4D-PAM5编码技术(4D代表4个发射器同时在4个通道DA~DD上发送,PAM5代

Go实战 | 使用Go-Fiber采用分层架构搭建一个简单的Web服务

前言 📢博客主页:程序源⠀-CSDN博客 📢欢迎点赞👍收藏⭐留言📝如有错误敬请指正! 一、环境准备、示例介绍 Go语言安装,GoLand编辑器  这个示例实现了一个简单的待办事项(todo)管理系统。 目录详情 新建一个fiber-todos文件夹,在目录中新建如下文件 二、代码编写 采用分层架构搭建一个简单的Web服务有助于提高代码的可维护性和可

zoj 1967 poj 2570 Fiber Network

题意:有n个站点,站点与站点之间有一些公司负责线路线路,查询所有可以提供从站点a到的站点b的线路连接的公司。 思路:用floyd的思想求解,将递推公式修改为 a[i][j] |= a[i][k] & a[k][j]。这题运用二进制表示集合可以方便的求解,因为公司只用小写字母表示,所以最多只有26个公司,用一个整数就可以表示这个集合。求解路径时,我们求得不是最短路径,而是求这条路径上集合的交

RGMII接口--->(001)FPGA实现RGMII接口(一)

(001)FPGA实现RGMII接口(一) 1 目录 (a)FPGA简介 (b)IC简介 (c)Verilog简介 (d)FPGA实现RGMII接口(一) (e)结束 1 FPGA简介 (a)FPGA(Field Programmable Gate Array)是在PAL (可编程阵列逻辑)、GAL(通用阵列逻辑)等可编程器件的基础上进一步发展的产物。它是作为专用集成电路(ASI

认识react16的fiber架构

认识react16的fiber架构 前言 React的Virtual DOM(VDOM),其核心的协调算法,即reconciliation,通过对比前后的Virtual DOM得出最小更新部分,再去渲染真实DOM,减少了频繁操作DOM的成本,使其深受大家关注。但随着前端工程化的发展,在大型的项目上reconciliation越来越不得满足,因此,React团队对reconciliation做出

React fiber框架

fiber:是一种新的框架,他的目的是实现增量式,可中断的虚拟Dom diff的过程。 作用:提高react性能优化和响应速度 出现原因:diff算法是递归出来的,一次就得全渲染完,而fiber的出现就是解决这个问题的。 解决方法:他是通过把diff拆成一个一个小任务,每个任务叫fiber节点,然后形成fiber树,这就也就意味这现在diff可以排列优先级。 优先级判断:与用户的直接交互

Optical Fiber Telecommunications V B, Fifth Edition: Systems and Networks

版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章原始出版、作者信息和本声明。否则将追究法律责任。 http://blog.csdn.net/topmvp - topmvp Optical Fiber Telecommunications V (A&B) is the fifth in a series that has chronicled the progress in t