上面phy_device_create()函数中创建了一个重要的 workphy_state_machine(),这个就是phy_device查询任务的主体,用来查询 phy 芯片的状态维护 phy 状态机。 在网口驱动启动时会启动这个 work: net_device_ops->ndo_open() `-| stmmac_open() `-| phylink_start() `-| phy_start() `-| phydev->state ...
挂起phy PHY_RESUMING: 网卡启用phy_start 恢复phy phy_state_machine是PHY的状态机函数 /** * phy_state_machine - Handle the state machine * @work: work_struct that describes the work to be done */voidphy_state_machine(structwork_struct *work){structdelayed_work*dwork=to_delayed_work(work);...
1.当phy_device处于PHY_UP状态时,则phy_device状态机处理接口,设置needs_aneg为1,调用phy_start_ange接口,进入PHY_AN状态或PHY_FORCING状态,进行phy_device的状态的协商; 2.在PHY_AN状态时,则phy_state_machine判断是否需要将状态跳转至PHY_RUNNING或PHY_NOLINK; 3.在PHY_RUNNING状态时,若phy_device不支持中断,...
PHY_INTERFACE_MODE_RMII); phy_connect_direct phy_prepare_link phydev->adjust_link = handler; //handler = adjust_link phy_start_machine phydev->adjust_state = handler; //handler = NULL schedule_delayed_work(&phydev->state_queue, HZ); //启动上面注册的延时工作队列状态机 phy_state_machine...
phy_start_machine phydev->adjust_state=handler;//handler = NULL schedule_delayed_work(&phydev->state_queue,HZ);//启动上面注册的延时工作队列状态机 phy_state_machine 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. ...
phy_state_machine() `-| phy_start_aneg() `-| phy_config_aneg() `-| genphy_config_aneg() `-| __genphy_config_aneg() `-| genphy_setup_master_slave() // (1) 如果是千兆网口,配置其 master/slave `-| { | phy_modify_changed(phydev, MII_CTRL1000, // 配置 mdio 0x09 寄存器 |...
每个phy 芯片会创建一个 struct phy_device 类型的设备,对应的有 struct phy_driver 类型的驱动,这两者实际上是挂载在 mdio_bus_type 总线上的,mac 会被注册成 struct net_device。 phy_device struct phy_device{struct phy_driver*drv;// PHY设备驱动struct mii_bus*bus;// 对应的MII总线struct device dev...
--> phy_init_hw(硬件级的初始化,最后会调用genphy_config_init)-->phy_prepare_link(赋值cpsw_adjust_link为adjust_link)-->phy_start_machine(启动PHY状态机 ***)-->phy_start_interrupts (经测了,但好像没调用到这里) --> phy_start(PHY_READY变成PHY_UP) ...
|---snprintf(bus->id,MII_BUS_ID_SIZE,"%x",res.start)//把资源的起始地址设置为bus->id | |---of_mdiobus_register(new_bus,np)//注册mii_bus设备,并通过设备树中控制器的子节点创建PHY设备,这一点与模拟方式流程相同 of_mdiobus_register的流程与第四小节一致,这里就不再列出。
| | | |--- INIT_DELAYED_WORK(&dev->state_queue, phy_state_machine)//PHY的状态机(核心WORK) | | | |--- INIT_WORK(&dev->phy_queue, phy_change)//由phy_interrupt / timer调度以处理PHY状态的更改 | | | |--- request_module(MDIO_MODULE_PREFIX MDIO_ID_FMT, MDIO_ID_ARGS(phy_id))...