LinuxのイーサネットPHYドライバ

ここでのコードのMAC / PHYを検証するFPGA、ベースのLinux 3.6.4、要約とICのこちら側に。

PHY初期化シーケンス
の最初のステップの
phy_initの
  mdio_bus_initの
    bus_register(&mdio_bus_type); //のAutoProbeの
  phy_driver_register(&genphy_driver)。

(実施例icplusにおける)第二工程、特定のPHY駆動初期
icplus_initの
  phy_drivers_register(icplus_driver、ARRAY_SIZE(icplus_driver));
    phy_driver_register
      new_driver-> driver.bus =&mdio_bus_type; //またmdio_bus_type
      new_driver-> driver.probe = phy_probe。
      new_driver-> driver.remove = phy_remove;
      driver_register
        bus_add_driver
          driver_attach //ドライバの最初の登録ではなく、デバイスの一致として次のように実行されなかった、単なる例
            __driver_attach
              driver_match_device
                mdio_bus_match内部DRV-> BUS-> //マッチはmdio_bus_type

第3のステップと、ネットワークカードドライバ
mt_eth_initの
  platform_driver_register(&mt_eth_driver);
    mt_eth_drv_probe
      mt_eth_mii_init
        mdiobus_register
          device_register
            device_add
              bus_add_device
              bus_probe_device
                device_attach
                  __device_attach
                    driver_match_device
                      DRV-> BUS-> //一致がmdio_bus_match内部mdio_bus_typeある
                    driver_probe_device
                      really_probe
                        DEV-> BUS-> //プローブすなわちphy_probe、この時点での状態はPHY_READYです
                          そのようなmdiobus_scanのicplusとしてphydev-> DRV->プローブ//もしそうであれば、プローブのPHY特定呼び出し、
            get_phy_device
              get_phy_id
              phy_device_create // PHY_DOWN状態
          mdiobus_scan
            phy_device_registerの
              device_register //し、次いで上記のようにプロセス
        mt_eth_mii_probe //同じレベルとmdiobus_register 、コールmt_eth_mii_init
          phy_connect
            bus_find_device_by_name
            phy_connect_direct
              phy_attach_direct //この時の状態であるPHY_READY
                phy_init_hw
                  phydev-> DRV-> config_init(phydev); // ICPLUSはで具現
            phy_start_machine
              スケジューリングdelayed_work、実際には、phy_state_machineの
                mt_eth_adjust_link

見つけるでしょう、mdio_bus_matchを追加します(==(phydrv-> PHY_ID&phydrv-> phy_id_mask)(phydev-> PHY_ID&phydrv-> phy_id_mask))を見たりしないことです。

公開された407元の記事 ウォンの賞賛150 ビュー380 000 +

おすすめ

転載: blog.csdn.net/ds1130071727/article/details/102626067