以太网从挂起恢复后无法工作(S2RAM)
Ethernet cannot work after resuming from suspending (S2RAM)
我正在研究 EthernetAVB 模块。我的板可以通过命令挂起
echo mem > /sys/power/state
但是从挂起恢复时,eth0 不起作用。现象有:
能够 ping 环回:$ ping 127.0.0.1 --> 好的
PHY电源关闭(power down)
无法 ping 邻居:$ ping 192.168.1.1 --> 失败
我假设网络层(符合OSI模型)没问题,因为我可以ping环回。我认为问题发生在物理层,相关:
PHY ic(我的电路板使用 Micrel Phys ksz9031)
MDIO总线
最后一个是phy_dev
也许这个问题可能发生在以太网控制器上(我的情况是以太网 AVB)
我试图禁用 "suspend" PHY ic(ksz9031 的电源)- 保持 PHY 唤醒。恢复后,电源指示灯亮,但仍然无法ping通其他邻居。
对了,我看到我的系统(ethernet)resume后无法跳转到运行状态。
以上是PM平台的工作方式
以及我的开发板中的 EthernetAVB 框图。
为了检测问题,我画了一部分 PHY 状态机(不完全)
更多详情:
PHY 状态机状态:
DOWN: PHY device and driver are not ready for anything. probe() should be called if and only if the PHY is in this state, given that the PHY device exists.
- PHY driver probe function will, depending on the PHY, set the state to STARTING or READY
STARTING: PHY device is coming up, and the ethernet driver is not ready. PHY drivers may set this in the probe function. If they do, they are responsible for making sure the state is eventually set to indicate whether the PHY is UP or READY, depending on the state when the PHY is done starting up.
- PHY driver will set the state to READY
- start will set the state to PENDING
READY: PHY is ready to send and receive packets, but the controller is not. By default, PHYs which do not implement probe will be set to this state by phy_probe(). If the PHY driver knows the PHY is ready, and the PHY state is STARTING, then it sets this STATE.
- start will set the state to UP
PENDING: PHY device is coming up, but the ethernet driver is ready. phy_start will set this state if the PHY state is STARTING.
- PHY driver will set the state to UP when the PHY is ready
UP: The PHY and attached device are ready to do work. Interrupts should be started here.
- timer moves to AN
AN: The PHY is currently negotiating the link state. Link is therefore down for now. phy_timer will set this state when it detects the state is UP. config_aneg will set this state whenever called with phydev->autoneg set to AUTONEG_ENABLE.
- If autonegotiation finishes, but there's no link, it sets the state to NOLINK.
- If aneg finishes with link, it sets the state to RUNNING, and calls adjust_link
- If autonegotiation did not finish after an arbitrary amount of time, autonegotiation should be tried again if the PHY supports "magic" autonegotiation (back to AN)
- If it didn't finish, and no magic_aneg, move to FORCING.
NOLINK: PHY is up, but not currently plugged in.
- If the timer notes that the link comes back, we move to RUNNING
- config_aneg moves to AN
- phy_stop moves to HALTED
FORCING: PHY is being configured with forced settings
- if link is up, move to RUNNING
- If link is down, we drop to the next highest setting, and retry (FORCING) after a timeout
- phy_stop moves to HALTED
RUNNING: PHY is currently up, running, and possibly sending and/or receiving packets
- timer will set CHANGELINK if we're polling (this ensures the link state is polled every other cycle of this state machine, which makes it every other second)
- irq will set CHANGELINK
- config_aneg will set AN
- phy_stop moves to HALTED
CHANGELINK: PHY experienced a change in link state
- timer moves to RUNNING if link
- timer moves to NOLINK if the link is down
- phy_stop moves to HALTED
HALTED: PHY is up, but no polling or interrupts are done. Or PHY is in an error state.
- phy_start moves to RESUMING
RESUMING: PHY was halted, but now wants to run again.
- If we are forcing, or aneg is done, timer moves to RUNNING
- If aneg is not done, timer moves to AN
- phy_stop moves to HALTED
我养一些assumptions/hypothesis:
暂停后,系统进入HALTED状态,但不能改变到运行状态。
由于某种原因,系统进入DOWN状态,无法再进入READY状态和UP
感谢您的帮助。
至少在从暂停状态恢复期间保持以下内容以解决问题。
o 启用 AVB-DMAC 模式寄存器与高速外设总线时钟一起工作(AVB-DMAC 模块当前使用 gPTP 时钟来 read/write 来自队列的数据(尽力而为和网络控制)。
o 恢复 URAM 中的描述符基地址 table(DBAT 寄存器)。
o 为尽力而为队列和网络控制队列启用中断
o 重新初始化 DMAC và E-MAC 设备
o初始化PTP时钟驱动为DMAC
提供时钟
o 为所有队列启用传输以允许上层传输帧但不会重新启动传输。
o 重新启动 PHY 设备
o 将设备标记为已从系统连接并在需要时重新启动。
我正在研究 EthernetAVB 模块。我的板可以通过命令挂起
echo mem > /sys/power/state
但是从挂起恢复时,eth0 不起作用。现象有:
能够 ping 环回:$ ping 127.0.0.1 --> 好的
PHY电源关闭(power down)
无法 ping 邻居:$ ping 192.168.1.1 --> 失败
我假设网络层(符合OSI模型)没问题,因为我可以ping环回。我认为问题发生在物理层,相关:
PHY ic(我的电路板使用 Micrel Phys ksz9031)
MDIO总线
最后一个是phy_dev
也许这个问题可能发生在以太网控制器上(我的情况是以太网 AVB)
我试图禁用 "suspend" PHY ic(ksz9031 的电源)- 保持 PHY 唤醒。恢复后,电源指示灯亮,但仍然无法ping通其他邻居。
对了,我看到我的系统(ethernet)resume后无法跳转到运行状态。
以上是PM平台的工作方式
以及我的开发板中的 EthernetAVB 框图。
为了检测问题,我画了一部分 PHY 状态机(不完全)
更多详情:
PHY 状态机状态:
DOWN: PHY device and driver are not ready for anything. probe() should be called if and only if the PHY is in this state, given that the PHY device exists.
- PHY driver probe function will, depending on the PHY, set the state to STARTING or READY
STARTING: PHY device is coming up, and the ethernet driver is not ready. PHY drivers may set this in the probe function. If they do, they are responsible for making sure the state is eventually set to indicate whether the PHY is UP or READY, depending on the state when the PHY is done starting up.
- PHY driver will set the state to READY
- start will set the state to PENDING
READY: PHY is ready to send and receive packets, but the controller is not. By default, PHYs which do not implement probe will be set to this state by phy_probe(). If the PHY driver knows the PHY is ready, and the PHY state is STARTING, then it sets this STATE.
- start will set the state to UP
PENDING: PHY device is coming up, but the ethernet driver is ready. phy_start will set this state if the PHY state is STARTING.
- PHY driver will set the state to UP when the PHY is ready
UP: The PHY and attached device are ready to do work. Interrupts should be started here.
- timer moves to AN
AN: The PHY is currently negotiating the link state. Link is therefore down for now. phy_timer will set this state when it detects the state is UP. config_aneg will set this state whenever called with phydev->autoneg set to AUTONEG_ENABLE.
- If autonegotiation finishes, but there's no link, it sets the state to NOLINK.
- If aneg finishes with link, it sets the state to RUNNING, and calls adjust_link
- If autonegotiation did not finish after an arbitrary amount of time, autonegotiation should be tried again if the PHY supports "magic" autonegotiation (back to AN)
- If it didn't finish, and no magic_aneg, move to FORCING.
NOLINK: PHY is up, but not currently plugged in.
- If the timer notes that the link comes back, we move to RUNNING
- config_aneg moves to AN
- phy_stop moves to HALTED
FORCING: PHY is being configured with forced settings
- if link is up, move to RUNNING
- If link is down, we drop to the next highest setting, and retry (FORCING) after a timeout
- phy_stop moves to HALTED
RUNNING: PHY is currently up, running, and possibly sending and/or receiving packets
- timer will set CHANGELINK if we're polling (this ensures the link state is polled every other cycle of this state machine, which makes it every other second)
- irq will set CHANGELINK
- config_aneg will set AN
- phy_stop moves to HALTED
CHANGELINK: PHY experienced a change in link state
- timer moves to RUNNING if link
- timer moves to NOLINK if the link is down
- phy_stop moves to HALTED
HALTED: PHY is up, but no polling or interrupts are done. Or PHY is in an error state.
- phy_start moves to RESUMING
RESUMING: PHY was halted, but now wants to run again.
- If we are forcing, or aneg is done, timer moves to RUNNING
- If aneg is not done, timer moves to AN
- phy_stop moves to HALTED
我养一些assumptions/hypothesis:
暂停后,系统进入HALTED状态,但不能改变到运行状态。
由于某种原因,系统进入DOWN状态,无法再进入READY状态和UP
感谢您的帮助。
至少在从暂停状态恢复期间保持以下内容以解决问题。
o 启用 AVB-DMAC 模式寄存器与高速外设总线时钟一起工作(AVB-DMAC 模块当前使用 gPTP 时钟来 read/write 来自队列的数据(尽力而为和网络控制)。
o 恢复 URAM 中的描述符基地址 table(DBAT 寄存器)。
o 为尽力而为队列和网络控制队列启用中断
o 重新初始化 DMAC và E-MAC 设备
o初始化PTP时钟驱动为DMAC
提供时钟o 为所有队列启用传输以允许上层传输帧但不会重新启动传输。
o 重新启动 PHY 设备
o 将设备标记为已从系统连接并在需要时重新启动。