€•Œsphinx.addnodes”Œdocument”“”)�”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)�”}”(hhh]”(hŒ pending_xref”“”)�”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…”�”}”Œparent”hsbaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ*/translations/zh_CN/networking/sfp-phylink”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)�”}”(hhh]”hŒChinese (Traditional)”…”�”}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ*/translations/zh_TW/networking/sfp-phylink”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒItalian”…”�”}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ*/translations/it_IT/networking/sfp-phylink”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒJapanese”…”�”}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ*/translations/ja_JP/networking/sfp-phylink”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒKorean”…”�”}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ*/translations/ko_KR/networking/sfp-phylink”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒPortuguese (Brazilian)”…”�”}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ*/translations/pt_BR/networking/sfp-phylink”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒSpanish”…”�”}”hh–sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ*/translations/sp_SP/networking/sfp-phylink”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒcomment”“”)�”}”(hŒ SPDX-License-Identifier: GPL-2.0”h]”hŒ SPDX-License-Identifier: GPL-2.0”…”�”}”hh·sbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1hµhhh²hh³ŒD/var/lib/git/docbuild/linux/Documentation/networking/sfp-phylink.rst”h´KubhŒsection”“”)�”}”(hhh]”(hŒtitle”“”)�”}”(hŒphylink”h]”hŒphylink”…”�”}”(hhÏh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhhÊh²hh³hÇh´KubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒOverview”h]”hŒOverview”…”�”}”(hhàh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhhÝh²hh³hÇh´KubhŒ paragraph”“”)�”}”(hŒŸphylink is a mechanism to support hot-pluggable networking modules directly connected to a MAC without needing to re-initialise the adapter on hot-plug events.”h]”hŒŸphylink is a mechanism to support hot-pluggable networking modules directly connected to a MAC without needing to re-initialise the adapter on hot-plug events.”…”�”}”(hhðh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K hhÝh²hubhï)�”}”(hŒ}phylink supports conventional phylib-based setups, fixed link setups and SFP (Small Formfactor Pluggable) modules at present.”h]”hŒ}phylink supports conventional phylib-based setups, fixed link setups and SFP (Small Formfactor Pluggable) modules at present.”…”�”}”(hhþh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KhhÝh²hubeh}”(h]”Œoverview”ah ]”h"]”Œoverview”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´KubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒModes of operation”h]”hŒModes of operation”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjh²hh³hÇh´Kubhï)�”}”(hŒNphylink has several modes of operation, which depend on the firmware settings.”h]”hŒNphylink has several modes of operation, which depend on the firmware settings.”…”�”}”(hj%h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Khjh²hubhŒenumerated_list”“”)�”}”(hhh]”(hŒ list_item”“”)�”}”(hŒõPHY mode In PHY mode, we use phylib to read the current link settings from the PHY, and pass them to the MAC driver. We expect the MAC driver to configure exactly the modes that are specified without any negotiation being enabled on the link. ”h]”(hï)�”}”(hŒPHY mode”h]”hŒPHY mode”…”�”}”(hj>h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Khj:ubhï)�”}”(hŒêIn PHY mode, we use phylib to read the current link settings from the PHY, and pass them to the MAC driver. We expect the MAC driver to configure exactly the modes that are specified without any negotiation being enabled on the link.”h]”hŒêIn PHY mode, we use phylib to read the current link settings from the PHY, and pass them to the MAC driver. We expect the MAC driver to configure exactly the modes that are specified without any negotiation being enabled on the link.”…”�”}”(hjLh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Khj:ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j8hj5h²hh³hÇh´Nubj9)�”}”(hŒVFixed mode Fixed mode is the same as PHY mode as far as the MAC driver is concerned. ”h]”(hï)�”}”(hŒ Fixed mode”h]”hŒ Fixed mode”…”�”}”(hjdh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Khj`ubhï)�”}”(hŒIFixed mode is the same as PHY mode as far as the MAC driver is concerned.”h]”hŒIFixed mode is the same as PHY mode as far as the MAC driver is concerned.”…”�”}”(hjrh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K hj`ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j8hj5h²hh³hÇh´Nubj9)�”}”(hŒÁIn-band mode In-band mode is used with 802.3z, SGMII and similar interface modes, and we are expecting to use and honor the in-band negotiation or control word sent across the serdes channel. ”h]”(hï)�”}”(hŒ In-band mode”h]”hŒ In-band mode”…”�”}”(hjŠh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K#hj†ubhï)�”}”(hŒ²In-band mode is used with 802.3z, SGMII and similar interface modes, and we are expecting to use and honor the in-band negotiation or control word sent across the serdes channel.”h]”hŒ²In-band mode is used with 802.3z, SGMII and similar interface modes, and we are expecting to use and honor the in-band negotiation or control word sent across the serdes channel.”…”�”}”(hj˜h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K%hj†ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j8hj5h²hh³hÇh´Nubeh}”(h]”h ]”h"]”h$]”h&]”Œenumtype”Œarabic”Œprefix”hŒsuffix”Œ.”uh1j3hjh²hh³hÇh´Kubhï)�”}”(hŒ$By example, what this means is that:”h]”hŒ$By example, what this means is that:”…”�”}”(hj·h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K)hjh²hubhŒ literal_block”“”)�”}”(hŒ/ð { phy = <&phy>; phy-mode = "sgmii"; };”h]”hŒ/ð { phy = <&phy>; phy-mode = "sgmii"; };”…”�”}”hjÇsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆŒforce”‰Œlanguage”Œnone”Œhighlight_args”}”uh1jÅh³hÇh´K+hjh²hubhï)�”}”(hXdoes not use in-band SGMII signalling. The PHY is expected to follow exactly the settings given to it in its :c:func:`mac_config` function. The link should be forced up or down appropriately in the :c:func:`mac_link_up` and :c:func:`mac_link_down` functions.”h]”(hŒndoes not use in-band SGMII signalling. The PHY is expected to follow exactly the settings given to it in its ”…”�”}”(hjÚh²hh³Nh´Nubh)�”}”(hŒ:c:func:`mac_config`”h]”hŒliteral”“”)�”}”(hjäh]”hŒ mac_config()”…”�”}”(hjèh²hh³Nh´Nubah}”(h]”h ]”(Œxref”Œc”Œc-func”eh"]”h$]”h&]”uh1jæhjâubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”Œnetworking/sfp-phylink”Œ refdomain”jóŒreftype”Œfunc”Œ refexplicit”‰Œrefwarn”‰Œ reftarget”Œ mac_config”uh1hh³hÇh´K2hjÚubhŒE function. The link should be forced up or down appropriately in the ”…”�”}”(hjÚh²hh³Nh´Nubh)�”}”(hŒ:c:func:`mac_link_up`”h]”jç)�”}”(hj h]”hŒ mac_link_up()”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”(jòjóŒc-func”eh"]”h$]”h&]”uh1jæhj ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”jÿŒ refdomain”jóŒreftype”Œfunc”Œ refexplicit”‰Œrefwarn”‰jŒ mac_link_up”uh1hh³hÇh´K2hjÚubhŒ and ”…”�”}”(hjÚh²hh³Nh´Nubh)�”}”(hŒ:c:func:`mac_link_down`”h]”jç)�”}”(hj0h]”hŒmac_link_down()”…”�”}”(hj2h²hh³Nh´Nubah}”(h]”h ]”(jòjóŒc-func”eh"]”h$]”h&]”uh1jæhj.ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”jÿŒ refdomain”jóŒreftype”Œfunc”Œ refexplicit”‰Œrefwarn”‰jŒ mac_link_down”uh1hh³hÇh´K2hjÚubhŒ functions.”…”�”}”(hjÚh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K2hjh²hubjÆ)�”}”(hŒMð { managed = "in-band-status"; phy = <&phy>; phy-mode = "sgmii"; };”h]”hŒMð { managed = "in-band-status"; phy = <&phy>; phy-mode = "sgmii"; };”…”�”}”hjWsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆjÕ‰jÖŒnone”jØ}”uh1jÅh³hÇh´K7hjh²hubhï)�”}”(hXuses in-band mode, where results from the PHY's negotiation are passed to the MAC through the SGMII control word, and the MAC is expected to acknowledge the control word. The :c:func:`mac_link_up` and :c:func:`mac_link_down` functions must not force the MAC side link up and down.”h]”(hŒ²uses in-band mode, where results from the PHY’s negotiation are passed to the MAC through the SGMII control word, and the MAC is expected to acknowledge the control word. The ”…”�”}”(hjgh²hh³Nh´Nubh)�”}”(hŒ:c:func:`mac_link_up`”h]”jç)�”}”(hjqh]”hŒ mac_link_up()”…”�”}”(hjsh²hh³Nh´Nubah}”(h]”h ]”(jòjóŒc-func”eh"]”h$]”h&]”uh1jæhjoubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”jÿŒ refdomain”jóŒreftype”Œfunc”Œ refexplicit”‰Œrefwarn”‰jŒ mac_link_up”uh1hh³hÇh´K?hjgubhŒ and ”…”�”}”(hjgh²hh³Nh´Nubh)�”}”(hŒ:c:func:`mac_link_down`”h]”jç)�”}”(hj”h]”hŒmac_link_down()”…”�”}”(hj–h²hh³Nh´Nubah}”(h]”h ]”(jòjóŒc-func”eh"]”h$]”h&]”uh1jæhj’ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”jÿŒ refdomain”jóŒreftype”Œfunc”Œ refexplicit”‰Œrefwarn”‰jŒ mac_link_down”uh1hh³hÇh´K?hjgubhŒ8 functions must not force the MAC side link up and down.”…”�”}”(hjgh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K?hjh²hubeh}”(h]”Œmodes-of-operation”ah ]”h"]”Œmodes of operation”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´KubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒ9Rough guide to converting a network driver to sfp/phylink”h]”hŒ9Rough guide to converting a network driver to sfp/phylink”…”�”}”(hjÆh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjÃh²hh³hÇh´KFubhï)�”}”(hŒ˜This guide briefly describes how to convert a network driver from phylib to the sfp/phylink support. Please send patches to improve this documentation.”h]”hŒ˜This guide briefly describes how to convert a network driver from phylib to the sfp/phylink support. Please send patches to improve this documentation.”…”�”}”(hjÔh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KHhjÃh²hubj4)�”}”(hhh]”(j9)�”}”(hX¨Optionally split the network driver's phylib update function into two parts dealing with link-down and link-up. This can be done as a separate preparation commit. An older example of this preparation can be found in git commit fc548b991fb0, although this was splitting into three parts; the link-up part now includes configuring the MAC for the link settings. Please see :c:func:`mac_link_up` for more information on this. ”h]”(hï)�”}”(hŒ¢Optionally split the network driver's phylib update function into two parts dealing with link-down and link-up. This can be done as a separate preparation commit.”h]”hŒ¤Optionally split the network driver’s phylib update function into two parts dealing with link-down and link-up. This can be done as a separate preparation commit.”…”�”}”(hjéh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KLhjåubhï)�”}”(hXAn older example of this preparation can be found in git commit fc548b991fb0, although this was splitting into three parts; the link-up part now includes configuring the MAC for the link settings. Please see :c:func:`mac_link_up` for more information on this.”h]”(hŒÐAn older example of this preparation can be found in git commit fc548b991fb0, although this was splitting into three parts; the link-up part now includes configuring the MAC for the link settings. Please see ”…”�”}”(hj÷h²hh³Nh´Nubh)�”}”(hŒ:c:func:`mac_link_up`”h]”jç)�”}”(hjh]”hŒ mac_link_up()”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”(jòjóŒc-func”eh"]”h$]”h&]”uh1jæhjÿubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”jÿŒ refdomain”jóŒreftype”Œfunc”Œ refexplicit”‰Œrefwarn”‰jŒ mac_link_up”uh1hh³hÇh´KPhj÷ubhŒ for more information on this.”…”�”}”(hj÷h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KPhjåubeh}”(h]”h ]”h"]”h$]”h&]”uh1j8hjâh²hh³hÇh´Nubj9)�”}”(hŒrReplace:: select FIXED_PHY select PHYLIB with:: select PHYLINK in the driver's Kconfig stanza. ”h]”(hï)�”}”(hŒ Replace::”h]”hŒReplace:”…”�”}”(hj2h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KUhj.ubjÆ)�”}”(hŒselect FIXED_PHY select PHYLIB”h]”hŒselect FIXED_PHY select PHYLIB”…”�”}”hj@sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jÅh³hÇh´KWhj.ubhï)�”}”(hŒwith::”h]”hŒwith:”…”�”}”(hjNh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KZhj.ubjÆ)�”}”(hŒselect PHYLINK”h]”hŒselect PHYLINK”…”�”}”hj\sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jÅh³hÇh´K\hj.ubhï)�”}”(hŒin the driver's Kconfig stanza.”h]”hŒ!in the driver’s Kconfig stanza.”…”�”}”(hjjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K^hj.ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j8hjâh²hh³hÇh´Nubj9)�”}”(hŒNAdd:: #include to the driver's list of header files. ”h]”(hï)�”}”(hŒAdd::”h]”hŒAdd:”…”�”}”(hj‚h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K`hj~ubjÆ)�”}”(hŒ#include ”h]”hŒ#include ”…”�”}”hj�sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jÅh³hÇh´Kbhj~ubhï)�”}”(hŒ%to the driver's list of header files.”h]”hŒ'to the driver’s list of header files.”…”�”}”(hjžh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Kdhj~ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j8hjâh²hh³hÇh´Nubj9)�”}”(hXAdd:: struct phylink *phylink; struct phylink_config phylink_config; to the driver's private data structure. We shall refer to the driver's private data pointer as ``priv`` below, and the driver's private data structure as ``struct foo_priv``. ”h]”(hï)�”}”(hŒAdd::”h]”hŒAdd:”…”�”}”(hj¶h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Kfhj²ubjÆ)�”}”(hŒ>struct phylink *phylink; struct phylink_config phylink_config;”h]”hŒ>struct phylink *phylink; struct phylink_config phylink_config;”…”�”}”hjÄsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jÅh³hÇh´Khhj²ubhï)�”}”(hŒ¯to the driver's private data structure. We shall refer to the driver's private data pointer as ``priv`` below, and the driver's private data structure as ``struct foo_priv``.”h]”(hŒdto the driver’s private data structure. We shall refer to the driver’s private data pointer as ”…”�”}”(hjÒh²hh³Nh´Nubjç)�”}”(hŒ``priv``”h]”hŒpriv”…”�”}”(hjÚh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jæhjÒubhŒ5 below, and the driver’s private data structure as ”…”�”}”(hjÒh²hh³Nh´Nubjç)�”}”(hŒ``struct foo_priv``”h]”hŒstruct foo_priv”…”�”}”(hjìh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jæhjÒubhŒ.”…”�”}”(hjÒh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Kkhj²ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j8hjâh²hh³hÇh´Nubj9)�”}”(hXReplace the following functions: .. flat-table:: :header-rows: 1 :widths: 1 1 :stub-columns: 0 * - Original function - Replacement function * - phy_start(phydev) - phylink_start(priv->phylink) * - phy_stop(phydev) - phylink_stop(priv->phylink) * - phy_mii_ioctl(phydev, ifr, cmd) - phylink_mii_ioctl(priv->phylink, ifr, cmd) * - phy_ethtool_get_wol(phydev, wol) - phylink_ethtool_get_wol(priv->phylink, wol) * - phy_ethtool_set_wol(phydev, wol) - phylink_ethtool_set_wol(priv->phylink, wol) * - phy_disconnect(phydev) - phylink_disconnect_phy(priv->phylink) Please note that some of these functions must be called under the rtnl lock, and will warn if not. This will normally be the case, except if these are called from the driver suspend/resume paths. ”h]”(hï)�”}”(hŒ Replace the following functions:”h]”hŒ Replace the following functions:”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Kohj ubhŒtable”“”)�”}”(hhh]”hŒtgroup”“”)�”}”(hhh]”(hŒcolspec”“”)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”Kuh1j&hj#ubj')�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”Kuh1j&hj#ubhŒthead”“”)�”}”(hhh]”hŒrow”“”)�”}”(hhh]”(hŒentry”“”)�”}”(hhh]”hï)�”}”(hŒOriginal function”h]”hŒOriginal function”…”�”}”(hjKh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KvhjHubah}”(h]”h ]”h"]”h$]”h&]”uh1jFhjCubjG)�”}”(hhh]”hï)�”}”(hŒReplacement function”h]”hŒReplacement function”…”�”}”(hjbh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Kwhj_ubah}”(h]”h ]”h"]”h$]”h&]”uh1jFhjCubeh}”(h]”h ]”h"]”h$]”h&]”uh1jAhj>ubah}”(h]”h ]”h"]”h$]”h&]”uh1j<hj#ubhŒtbody”“”)�”}”(hhh]”(jB)�”}”(hhh]”(jG)�”}”(hhh]”hï)�”}”(hŒphy_start(phydev)”h]”hŒphy_start(phydev)”…”�”}”(hj�h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KxhjŠubah}”(h]”h ]”h"]”h$]”h&]”uh1jFhj‡ubjG)�”}”(hhh]”hï)�”}”(hŒphylink_start(priv->phylink)”h]”hŒphylink_start(priv->phylink)”…”�”}”(hj¤h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Kyhj¡ubah}”(h]”h ]”h"]”h$]”h&]”uh1jFhj‡ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jAhj„ubjB)�”}”(hhh]”(jG)�”}”(hhh]”hï)�”}”(hŒphy_stop(phydev)”h]”hŒphy_stop(phydev)”…”�”}”(hjÄh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KzhjÁubah}”(h]”h ]”h"]”h$]”h&]”uh1jFhj¾ubjG)�”}”(hhh]”hï)�”}”(hŒphylink_stop(priv->phylink)”h]”hŒphylink_stop(priv->phylink)”…”�”}”(hjÛh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K{hjØubah}”(h]”h ]”h"]”h$]”h&]”uh1jFhj¾ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jAhj„ubjB)�”}”(hhh]”(jG)�”}”(hhh]”hï)�”}”(hŒphy_mii_ioctl(phydev, ifr, cmd)”h]”hŒphy_mii_ioctl(phydev, ifr, cmd)”…”�”}”(hjûh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K|hjøubah}”(h]”h ]”h"]”h$]”h&]”uh1jFhjõubjG)�”}”(hhh]”hï)�”}”(hŒ*phylink_mii_ioctl(priv->phylink, ifr, cmd)”h]”hŒ*phylink_mii_ioctl(priv->phylink, ifr, cmd)”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K}hjubah}”(h]”h ]”h"]”h$]”h&]”uh1jFhjõubeh}”(h]”h ]”h"]”h$]”h&]”uh1jAhj„ubjB)�”}”(hhh]”(jG)�”}”(hhh]”hï)�”}”(hŒ phy_ethtool_get_wol(phydev, wol)”h]”hŒ phy_ethtool_get_wol(phydev, wol)”…”�”}”(hj2h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K~hj/ubah}”(h]”h ]”h"]”h$]”h&]”uh1jFhj,ubjG)�”}”(hhh]”hï)�”}”(hŒ+phylink_ethtool_get_wol(priv->phylink, wol)”h]”hŒ+phylink_ethtool_get_wol(priv->phylink, wol)”…”�”}”(hjIh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KhjFubah}”(h]”h ]”h"]”h$]”h&]”uh1jFhj,ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jAhj„ubjB)�”}”(hhh]”(jG)�”}”(hhh]”hï)�”}”(hŒ phy_ethtool_set_wol(phydev, wol)”h]”hŒ phy_ethtool_set_wol(phydev, wol)”…”�”}”(hjih²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K€hjfubah}”(h]”h ]”h"]”h$]”h&]”uh1jFhjcubjG)�”}”(hhh]”hï)�”}”(hŒ+phylink_ethtool_set_wol(priv->phylink, wol)”h]”hŒ+phylink_ethtool_set_wol(priv->phylink, wol)”…”�”}”(hj€h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K�hj}ubah}”(h]”h ]”h"]”h$]”h&]”uh1jFhjcubeh}”(h]”h ]”h"]”h$]”h&]”uh1jAhj„ubjB)�”}”(hhh]”(jG)�”}”(hhh]”hï)�”}”(hŒphy_disconnect(phydev)”h]”hŒphy_disconnect(phydev)”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K‚hj�ubah}”(h]”h ]”h"]”h$]”h&]”uh1jFhjšubjG)�”}”(hhh]”hï)�”}”(hŒ%phylink_disconnect_phy(priv->phylink)”h]”hŒ%phylink_disconnect_phy(priv->phylink)”…”�”}”(hj·h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Kƒhj´ubah}”(h]”h ]”h"]”h$]”h&]”uh1jFhjšubeh}”(h]”h ]”h"]”h$]”h&]”uh1jAhj„ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j‚hj#ubeh}”(h]”h ]”h"]”h$]”h&]”Œcols”Kuh1j!hjubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj ubhï)�”}”(hŒÃPlease note that some of these functions must be called under the rtnl lock, and will warn if not. This will normally be the case, except if these are called from the driver suspend/resume paths.”h]”hŒÃPlease note that some of these functions must be called under the rtnl lock, and will warn if not. This will normally be the case, except if these are called from the driver suspend/resume paths.”…”�”}”(hjäh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K…hj ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j8hjâh²hh³hÇh´Nubj9)�”}”(hX•Add/replace ksettings get/set methods with: .. code-block:: c static int foo_ethtool_set_link_ksettings(struct net_device *dev, const struct ethtool_link_ksettings *cmd) { struct foo_priv *priv = netdev_priv(dev); return phylink_ethtool_ksettings_set(priv->phylink, cmd); } static int foo_ethtool_get_link_ksettings(struct net_device *dev, struct ethtool_link_ksettings *cmd) { struct foo_priv *priv = netdev_priv(dev); return phylink_ethtool_ksettings_get(priv->phylink, cmd); } ”h]”(hï)�”}”(hŒ+Add/replace ksettings get/set methods with:”h]”hŒ+Add/replace ksettings get/set methods with:”…”�”}”(hjüh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K‰hjøubjÆ)�”}”(hXstatic int foo_ethtool_set_link_ksettings(struct net_device *dev, const struct ethtool_link_ksettings *cmd) { struct foo_priv *priv = netdev_priv(dev); return phylink_ethtool_ksettings_set(priv->phylink, cmd); } static int foo_ethtool_get_link_ksettings(struct net_device *dev, struct ethtool_link_ksettings *cmd) { struct foo_priv *priv = netdev_priv(dev); return phylink_ethtool_ksettings_get(priv->phylink, cmd); }”h]”hXstatic int foo_ethtool_set_link_ksettings(struct net_device *dev, const struct ethtool_link_ksettings *cmd) { struct foo_priv *priv = netdev_priv(dev); return phylink_ethtool_ksettings_set(priv->phylink, cmd); } static int foo_ethtool_get_link_ksettings(struct net_device *dev, struct ethtool_link_ksettings *cmd) { struct foo_priv *priv = netdev_priv(dev); return phylink_ethtool_ksettings_get(priv->phylink, cmd); }”…”�”}”hj sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆjÕ‰jÖjójØ}”uh1jÅh³hÇh´K‹hjøubeh}”(h]”h ]”h"]”h$]”h&]”uh1j8hjâh²hh³Nh´Nubj9)�”}”(hX¢Replace the call to:: phy_dev = of_phy_connect(dev, node, link_func, flags, phy_interface); and associated code with a call to:: err = phylink_of_phy_connect(priv->phylink, node, flags); For the most part, ``flags`` can be zero; these flags are passed to the phy_attach_direct() inside this function call if a PHY is specified in the DT node ``node``. ``node`` should be the DT node which contains the network phy property, fixed link properties, and will also contain the sfp property. The setup of fixed links should also be removed; these are handled internally by phylink. of_phy_connect() was also passed a function pointer for link updates. This function is replaced by a different form of MAC updates described below in (8). Manipulation of the PHY's supported/advertised happens within phylink based on the validate callback, see below in (8). Note that the driver no longer needs to store the ``phy_interface``, and also note that ``phy_interface`` becomes a dynamic property, just like the speed, duplex etc. settings. Finally, note that the MAC driver has no direct access to the PHY anymore; that is because in the phylink model, the PHY can be dynamic. ”h]”(hï)�”}”(hŒReplace the call to::”h]”hŒReplace the call to:”…”�”}”(hj#h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K�hjubjÆ)�”}”(hŒEphy_dev = of_phy_connect(dev, node, link_func, flags, phy_interface);”h]”hŒEphy_dev = of_phy_connect(dev, node, link_func, flags, phy_interface);”…”�”}”hj1sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jÅh³hÇh´KŸhjubhï)�”}”(hŒ$and associated code with a call to::”h]”hŒ#and associated code with a call to:”…”�”}”(hj?h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K¡hjubjÆ)�”}”(hŒ9err = phylink_of_phy_connect(priv->phylink, node, flags);”h]”hŒ9err = phylink_of_phy_connect(priv->phylink, node, flags);”…”�”}”hjMsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jÅh³hÇh´K£hjubhï)�”}”(hŒ¤For the most part, ``flags`` can be zero; these flags are passed to the phy_attach_direct() inside this function call if a PHY is specified in the DT node ``node``.”h]”(hŒFor the most part, ”…”�”}”(hj[h²hh³Nh´Nubjç)�”}”(hŒ ``flags``”h]”hŒflags”…”�”}”(hjch²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jæhj[ubhŒ can be zero; these flags are passed to the phy_attach_direct() inside this function call if a PHY is specified in the DT node ”…”�”}”(hj[h²hh³Nh´Nubjç)�”}”(hŒ``node``”h]”hŒnode”…”�”}”(hjuh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jæhj[ubhŒ.”…”�”}”(hj[h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K¥hjubhï)�”}”(hŒ†``node`` should be the DT node which contains the network phy property, fixed link properties, and will also contain the sfp property.”h]”(jç)�”}”(hŒ``node``”h]”hŒnode”…”�”}”(hj‘h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jæhj�ubhŒ~ should be the DT node which contains the network phy property, fixed link properties, and will also contain the sfp property.”…”�”}”(hj�h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K©hjubhï)�”}”(hŒYThe setup of fixed links should also be removed; these are handled internally by phylink.”h]”hŒYThe setup of fixed links should also be removed; these are handled internally by phylink.”…”�”}”(hj©h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K¬hjubhï)�”}”(hŒšof_phy_connect() was also passed a function pointer for link updates. This function is replaced by a different form of MAC updates described below in (8).”h]”hŒšof_phy_connect() was also passed a function pointer for link updates. This function is replaced by a different form of MAC updates described below in (8).”…”�”}”(hj·h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K¯hjubhï)�”}”(hŒwManipulation of the PHY's supported/advertised happens within phylink based on the validate callback, see below in (8).”h]”hŒyManipulation of the PHY’s supported/advertised happens within phylink based on the validate callback, see below in (8).”…”�”}”(hjÅh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K³hjubhï)�”}”(hŒ°Note that the driver no longer needs to store the ``phy_interface``, and also note that ``phy_interface`` becomes a dynamic property, just like the speed, duplex etc. settings.”h]”(hŒ2Note that the driver no longer needs to store the ”…”�”}”(hjÓh²hh³Nh´Nubjç)�”}”(hŒ``phy_interface``”h]”hŒ phy_interface”…”�”}”(hjÛh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jæhjÓubhŒ, and also note that ”…”�”}”(hjÓh²hh³Nh´Nubjç)�”}”(hŒ``phy_interface``”h]”hŒ phy_interface”…”�”}”(hjíh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jæhjÓubhŒG becomes a dynamic property, just like the speed, duplex etc. settings.”…”�”}”(hjÓh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K¶hjubhï)�”}”(hŒˆFinally, note that the MAC driver has no direct access to the PHY anymore; that is because in the phylink model, the PHY can be dynamic.”h]”hŒˆFinally, note that the MAC driver has no direct access to the PHY anymore; that is because in the phylink model, the PHY can be dynamic.”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Kºhjubeh}”(h]”h ]”h"]”h$]”h&]”uh1j8hjâh²hh³hÇh´Nubj9)�”}”(hXÂAdd a :c:type:`struct phylink_mac_ops ` instance to the driver, which is a table of function pointers, and implement these functions. The old link update function for :c:func:`of_phy_connect` becomes three methods: :c:func:`mac_link_up`, :c:func:`mac_link_down`, and :c:func:`mac_config`. If step 1 was performed, then the functionality will have been split there. It is important that if in-band negotiation is used, :c:func:`mac_link_up` and :c:func:`mac_link_down` do not prevent the in-band negotiation from completing, since these functions are called when the in-band link state changes - otherwise the link will never come up. The :c:func:`mac_get_caps` method is optional, and if provided should return the phylink MAC capabilities that are supported for the passed ``interface`` mode. In general, there is no need to implement this method. Phylink will use these capabilities in combination with permissible capabilities for ``interface`` to determine the allowable ethtool link modes. The :c:func:`mac_link_state` method is used to read the link state from the MAC, and report back the settings that the MAC is currently using. This is particularly important for in-band negotiation methods such as 1000base-X and SGMII. The :c:func:`mac_link_up` method is used to inform the MAC that the link has come up. The call includes the negotiation mode and interface for reference only. The finalised link parameters are also supplied (speed, duplex and flow control/pause enablement settings) which should be used to configure the MAC when the MAC and PCS are not tightly integrated, or when the settings are not coming from in-band negotiation. The :c:func:`mac_config` method is used to update the MAC with the requested state, and must avoid unnecessarily taking the link down when making changes to the MAC configuration. This means the function should modify the state and only take the link down when absolutely necessary to change the MAC configuration. An example of how to do this can be found in :c:func:`mvneta_mac_config` in ``drivers/net/ethernet/marvell/mvneta.c``. For further information on these methods, please see the inline documentation in :c:type:`struct phylink_mac_ops `. ”h]”(hï)�”}”(hX}Add a :c:type:`struct phylink_mac_ops ` instance to the driver, which is a table of function pointers, and implement these functions. The old link update function for :c:func:`of_phy_connect` becomes three methods: :c:func:`mac_link_up`, :c:func:`mac_link_down`, and :c:func:`mac_config`. If step 1 was performed, then the functionality will have been split there.”h]”(hŒAdd a ”…”�”}”(hjh²hh³Nh´Nubh)�”}”(hŒ2:c:type:`struct phylink_mac_ops `”h]”jç)�”}”(hj'h]”hŒstruct phylink_mac_ops”…”�”}”(hj)h²hh³Nh´Nubah}”(h]”h ]”(jòjóŒc-type”eh"]”h$]”h&]”uh1jæhj%ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”jÿŒ refdomain”jóŒreftype”Œtype”Œ refexplicit”ˆŒrefwarn”‰jŒphylink_mac_ops”uh1hh³hÇh´K¾hjubhŒ€ instance to the driver, which is a table of function pointers, and implement these functions. The old link update function for ”…”�”}”(hjh²hh³Nh´Nubh)�”}”(hŒ:c:func:`of_phy_connect`”h]”jç)�”}”(hjJh]”hŒof_phy_connect()”…”�”}”(hjLh²hh³Nh´Nubah}”(h]”h ]”(jòjóŒc-func”eh"]”h$]”h&]”uh1jæhjHubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”jÿŒ refdomain”jóŒreftype”Œfunc”Œ refexplicit”‰Œrefwarn”‰jŒof_phy_connect”uh1hh³hÇh´K¾hjubhŒ becomes three methods: ”…”�”}”(hjh²hh³Nh´Nubh)�”}”(hŒ:c:func:`mac_link_up`”h]”jç)�”}”(hjmh]”hŒ mac_link_up()”…”�”}”(hjoh²hh³Nh´Nubah}”(h]”h ]”(jòjóŒc-func”eh"]”h$]”h&]”uh1jæhjkubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”jÿŒ refdomain”jóŒreftype”Œfunc”Œ refexplicit”‰Œrefwarn”‰jŒ mac_link_up”uh1hh³hÇh´K¾hjubhŒ, ”…”�”}”(hjh²hh³Nh´Nubh)�”}”(hŒ:c:func:`mac_link_down`”h]”jç)�”}”(hj�h]”hŒmac_link_down()”…”�”}”(hj’h²hh³Nh´Nubah}”(h]”h ]”(jòjóŒc-func”eh"]”h$]”h&]”uh1jæhjŽubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”jÿŒ refdomain”jóŒreftype”Œfunc”Œ refexplicit”‰Œrefwarn”‰jŒ mac_link_down”uh1hh³hÇh´K¾hjubhŒ, and ”…”�”}”(hjh²hh³Nh´Nubh)�”}”(hŒ:c:func:`mac_config`”h]”jç)�”}”(hj³h]”hŒ mac_config()”…”�”}”(hjµh²hh³Nh´Nubah}”(h]”h ]”(jòjóŒc-func”eh"]”h$]”h&]”uh1jæhj±ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”jÿŒ refdomain”jóŒreftype”Œfunc”Œ refexplicit”‰Œrefwarn”‰jŒ mac_config”uh1hh³hÇh´K¾hjubhŒM. If step 1 was performed, then the functionality will have been split there.”…”�”}”(hjh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K¾hjubhï)�”}”(hX It is important that if in-band negotiation is used, :c:func:`mac_link_up` and :c:func:`mac_link_down` do not prevent the in-band negotiation from completing, since these functions are called when the in-band link state changes - otherwise the link will never come up.”h]”(hŒ5It is important that if in-band negotiation is used, ”…”�”}”(hjÚh²hh³Nh´Nubh)�”}”(hŒ:c:func:`mac_link_up`”h]”jç)�”}”(hjäh]”hŒ mac_link_up()”…”�”}”(hjæh²hh³Nh´Nubah}”(h]”h ]”(jòjóŒc-func”eh"]”h$]”h&]”uh1jæhjâubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”jÿŒ refdomain”jóŒreftype”Œfunc”Œ refexplicit”‰Œrefwarn”‰jŒ mac_link_up”uh1hh³hÇh´KÅhjÚubhŒ and ”…”�”}”(hjÚh²hh³Nh´Nubh)�”}”(hŒ:c:func:`mac_link_down`”h]”jç)�”}”(hjh]”hŒmac_link_down()”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”(jòjóŒc-func”eh"]”h$]”h&]”uh1jæhjubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”jÿŒ refdomain”jóŒreftype”Œfunc”Œ refexplicit”‰Œrefwarn”‰jŒ mac_link_down”uh1hh³hÇh´KÅhjÚubhŒ¦ do not prevent the in-band negotiation from completing, since these functions are called when the in-band link state changes - otherwise the link will never come up.”…”�”}”(hjÚh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KÅhjubhï)�”}”(hXhThe :c:func:`mac_get_caps` method is optional, and if provided should return the phylink MAC capabilities that are supported for the passed ``interface`` mode. In general, there is no need to implement this method. Phylink will use these capabilities in combination with permissible capabilities for ``interface`` to determine the allowable ethtool link modes.”h]”(hŒThe ”…”�”}”(hj.h²hh³Nh´Nubh)�”}”(hŒ:c:func:`mac_get_caps`”h]”jç)�”}”(hj8h]”hŒmac_get_caps()”…”�”}”(hj:h²hh³Nh´Nubah}”(h]”h ]”(jòjóŒc-func”eh"]”h$]”h&]”uh1jæhj6ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”jÿŒ refdomain”jóŒreftype”Œfunc”Œ refexplicit”‰Œrefwarn”‰jŒ mac_get_caps”uh1hh³hÇh´KËhj.ubhŒr method is optional, and if provided should return the phylink MAC capabilities that are supported for the passed ”…”�”}”(hj.h²hh³Nh´Nubjç)�”}”(hŒ ``interface``”h]”hŒ interface”…”�”}”(hjYh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jæhj.ubhŒ“ mode. In general, there is no need to implement this method. Phylink will use these capabilities in combination with permissible capabilities for ”…”�”}”(hj.h²hh³Nh´Nubjç)�”}”(hŒ ``interface``”h]”hŒ interface”…”�”}”(hjkh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jæhj.ubhŒ/ to determine the allowable ethtool link modes.”…”�”}”(hj.h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KËhjubhï)�”}”(hŒëThe :c:func:`mac_link_state` method is used to read the link state from the MAC, and report back the settings that the MAC is currently using. This is particularly important for in-band negotiation methods such as 1000base-X and SGMII.”h]”(hŒThe ”…”�”}”(hjƒh²hh³Nh´Nubh)�”}”(hŒ:c:func:`mac_link_state`”h]”jç)�”}”(hj�h]”hŒmac_link_state()”…”�”}”(hj�h²hh³Nh´Nubah}”(h]”h ]”(jòjóŒc-func”eh"]”h$]”h&]”uh1jæhj‹ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”jÿŒ refdomain”jóŒreftype”Œfunc”Œ refexplicit”‰Œrefwarn”‰jŒmac_link_state”uh1hh³hÇh´KÒhjƒubhŒÏ method is used to read the link state from the MAC, and report back the settings that the MAC is currently using. This is particularly important for in-band negotiation methods such as 1000base-X and SGMII.”…”�”}”(hjƒh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KÒhjubhï)�”}”(hX¢The :c:func:`mac_link_up` method is used to inform the MAC that the link has come up. The call includes the negotiation mode and interface for reference only. The finalised link parameters are also supplied (speed, duplex and flow control/pause enablement settings) which should be used to configure the MAC when the MAC and PCS are not tightly integrated, or when the settings are not coming from in-band negotiation.”h]”(hŒThe ”…”�”}”(hj´h²hh³Nh´Nubh)�”}”(hŒ:c:func:`mac_link_up`”h]”jç)�”}”(hj¾h]”hŒ mac_link_up()”…”�”}”(hjÀh²hh³Nh´Nubah}”(h]”h ]”(jòjóŒc-func”eh"]”h$]”h&]”uh1jæhj¼ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”jÿŒ refdomain”jóŒreftype”Œfunc”Œ refexplicit”‰Œrefwarn”‰jŒ mac_link_up”uh1hh³hÇh´K×hj´ubhX‰ method is used to inform the MAC that the link has come up. The call includes the negotiation mode and interface for reference only. The finalised link parameters are also supplied (speed, duplex and flow control/pause enablement settings) which should be used to configure the MAC when the MAC and PCS are not tightly integrated, or when the settings are not coming from in-band negotiation.”…”�”}”(hj´h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K×hjubhï)�”}”(hX³The :c:func:`mac_config` method is used to update the MAC with the requested state, and must avoid unnecessarily taking the link down when making changes to the MAC configuration. This means the function should modify the state and only take the link down when absolutely necessary to change the MAC configuration. An example of how to do this can be found in :c:func:`mvneta_mac_config` in ``drivers/net/ethernet/marvell/mvneta.c``.”h]”(hŒThe ”…”�”}”(hjåh²hh³Nh´Nubh)�”}”(hŒ:c:func:`mac_config`”h]”jç)�”}”(hjïh]”hŒ mac_config()”…”�”}”(hjñh²hh³Nh´Nubah}”(h]”h ]”(jòjóŒc-func”eh"]”h$]”h&]”uh1jæhjíubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”jÿŒ refdomain”jóŒreftype”Œfunc”Œ refexplicit”‰Œrefwarn”‰jŒ mac_config”uh1hh³hÇh´KßhjåubhXR method is used to update the MAC with the requested state, and must avoid unnecessarily taking the link down when making changes to the MAC configuration. This means the function should modify the state and only take the link down when absolutely necessary to change the MAC configuration. An example of how to do this can be found in ”…”�”}”(hjåh²hh³Nh´Nubh)�”}”(hŒ:c:func:`mvneta_mac_config`”h]”jç)�”}”(hj h]”hŒmvneta_mac_config()”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”(jòjóŒc-func”eh"]”h$]”h&]”uh1jæhj ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”jÿŒ refdomain”jóŒreftype”Œfunc”Œ refexplicit”‰Œrefwarn”‰jŒmvneta_mac_config”uh1hh³hÇh´KßhjåubhŒ in ”…”�”}”(hjåh²hh³Nh´Nubjç)�”}”(hŒ)``drivers/net/ethernet/marvell/mvneta.c``”h]”hŒ%drivers/net/ethernet/marvell/mvneta.c”…”�”}”(hj3 h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jæhjåubhŒ.”…”�”}”(hjåh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Kßhjubhï)�”}”(hŒ„For further information on these methods, please see the inline documentation in :c:type:`struct phylink_mac_ops `.”h]”(hŒQFor further information on these methods, please see the inline documentation in ”…”�”}”(hjK h²hh³Nh´Nubh)�”}”(hŒ2:c:type:`struct phylink_mac_ops `”h]”jç)�”}”(hjU h]”hŒstruct phylink_mac_ops”…”�”}”(hjW h²hh³Nh´Nubah}”(h]”h ]”(jòjóŒc-type”eh"]”h$]”h&]”uh1jæhjS ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”jÿŒ refdomain”jóŒreftype”Œtype”Œ refexplicit”ˆŒrefwarn”‰jŒphylink_mac_ops”uh1hh³hÇh´KçhjK ubhŒ.”…”�”}”(hjK h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Kçhjubeh}”(h]”h ]”h"]”h$]”h&]”uh1j8hjâh²hh³hÇh´Nubj9)�”}”(hXâFill-in the :c:type:`struct phylink_config ` fields with a reference to the :c:type:`struct device ` associated to your :c:type:`struct net_device `: .. code-block:: c priv->phylink_config.dev = &dev.dev; priv->phylink_config.type = PHYLINK_NETDEV; Fill-in the various speeds, pause and duplex modes your MAC can handle: .. code-block:: c priv->phylink_config.mac_capabilities = MAC_SYM_PAUSE | MAC_10 | MAC_100 | MAC_1000FD; ”h]”(hï)�”}”(hŒ¹Fill-in the :c:type:`struct phylink_config ` fields with a reference to the :c:type:`struct device ` associated to your :c:type:`struct net_device `:”h]”(hŒ Fill-in the ”…”�”}”(hj† h²hh³Nh´Nubh)�”}”(hŒ0:c:type:`struct phylink_config `”h]”jç)�”}”(hj� h]”hŒstruct phylink_config”…”�”}”(hj’ h²hh³Nh´Nubah}”(h]”h ]”(jòjóŒc-type”eh"]”h$]”h&]”uh1jæhjŽ ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”jÿŒ refdomain”jóŒreftype”Œtype”Œ refexplicit”ˆŒrefwarn”‰jŒphylink_config”uh1hh³hÇh´Kêhj† ubhŒ fields with a reference to the ”…”�”}”(hj† h²hh³Nh´Nubh)�”}”(hŒ :c:type:`struct device `”h]”jç)�”}”(hj³ h]”hŒ struct device”…”�”}”(hjµ h²hh³Nh´Nubah}”(h]”h ]”(jòjóŒc-type”eh"]”h$]”h&]”uh1jæhj± ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”jÿŒ refdomain”jóŒreftype”Œtype”Œ refexplicit”ˆŒrefwarn”‰jŒdevice”uh1hh³hÇh´Kêhj† ubhŒ associated to your ”…”�”}”(hj† h²hh³Nh´Nubh)�”}”(hŒ(:c:type:`struct net_device `”h]”jç)�”}”(hjÖ h]”hŒstruct net_device”…”�”}”(hjØ h²hh³Nh´Nubah}”(h]”h ]”(jòjóŒc-type”eh"]”h$]”h&]”uh1jæhjÔ ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”jÿŒ refdomain”jóŒreftype”Œtype”Œ refexplicit”ˆŒrefwarn”‰jŒ net_device”uh1hh³hÇh´Kêhj† ubhŒ:”…”�”}”(hj† h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Kêhj‚ ubjÆ)�”}”(hŒPpriv->phylink_config.dev = &dev.dev; priv->phylink_config.type = PHYLINK_NETDEV;”h]”hŒPpriv->phylink_config.dev = &dev.dev; priv->phylink_config.type = PHYLINK_NETDEV;”…”�”}”hjý sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆjÕ‰jÖjójØ}”uh1jÅh³hÇh´Kîhj‚ ubhï)�”}”(hŒGFill-in the various speeds, pause and duplex modes your MAC can handle:”h]”hŒGFill-in the various speeds, pause and duplex modes your MAC can handle:”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Kóhj‚ ubjÆ)�”}”(hŒVpriv->phylink_config.mac_capabilities = MAC_SYM_PAUSE | MAC_10 | MAC_100 | MAC_1000FD;”h]”hŒVpriv->phylink_config.mac_capabilities = MAC_SYM_PAUSE | MAC_10 | MAC_100 | MAC_1000FD;”…”�”}”hj sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆjÕ‰jÖjójØ}”uh1jÅh³hÇh´Kõhj‚ ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j8hjâh²hh³Nh´Nubj9)�”}”(hX2Some Ethernet controllers work in pair with a PCS (Physical Coding Sublayer) block, that can handle among other things the encoding/decoding, link establishment detection and autonegotiation. While some MACs have internal PCS whose operation is transparent, some other require dedicated PCS configuration for the link to become functional. In that case, phylink provides a PCS abstraction through :c:type:`struct phylink_pcs `. Identify if your driver has one or more internal PCS blocks, and/or if your controller can use an external PCS block that might be internally connected to your controller. If your controller doesn't have any internal PCS, you can go to step 11. If your Ethernet controller contains one or several PCS blocks, create one :c:type:`struct phylink_pcs ` instance per PCS block within your driver's private data structure: .. code-block:: c struct phylink_pcs pcs; Populate the relevant :c:type:`struct phylink_pcs_ops ` to configure your PCS. Create a :c:func:`pcs_get_state` function that reports the inband link state, a :c:func:`pcs_config` function to configure your PCS according to phylink-provided parameters, and a :c:func:`pcs_validate` function that report to phylink all accepted configuration parameters for your PCS: .. code-block:: c struct phylink_pcs_ops foo_pcs_ops = { .pcs_validate = foo_pcs_validate, .pcs_get_state = foo_pcs_get_state, .pcs_config = foo_pcs_config, }; Arrange for PCS link state interrupts to be forwarded into phylink, via: .. code-block:: c phylink_pcs_change(pcs, link_is_up); where ``link_is_up`` is true if the link is currently up or false otherwise. If a PCS is unable to provide these interrupts, then it should set ``pcs->pcs_poll = true;`` when creating the PCS. ”h]”(hï)�”}”(hX¸Some Ethernet controllers work in pair with a PCS (Physical Coding Sublayer) block, that can handle among other things the encoding/decoding, link establishment detection and autonegotiation. While some MACs have internal PCS whose operation is transparent, some other require dedicated PCS configuration for the link to become functional. In that case, phylink provides a PCS abstraction through :c:type:`struct phylink_pcs `.”h]”(hX�Some Ethernet controllers work in pair with a PCS (Physical Coding Sublayer) block, that can handle among other things the encoding/decoding, link establishment detection and autonegotiation. While some MACs have internal PCS whose operation is transparent, some other require dedicated PCS configuration for the link to become functional. In that case, phylink provides a PCS abstraction through ”…”�”}”(hj3 h²hh³Nh´Nubh)�”}”(hŒ*:c:type:`struct phylink_pcs `”h]”jç)�”}”(hj= h]”hŒstruct phylink_pcs”…”�”}”(hj? h²hh³Nh´Nubah}”(h]”h ]”(jòjóŒc-type”eh"]”h$]”h&]”uh1jæhj; ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”jÿŒ refdomain”jóŒreftype”Œtype”Œ refexplicit”ˆŒrefwarn”‰jŒ phylink_pcs”uh1hh³hÇh´Kùhj3 ubhŒ.”…”�”}”(hj3 h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Kùhj/ ubhï)�”}”(hŒ«Identify if your driver has one or more internal PCS blocks, and/or if your controller can use an external PCS block that might be internally connected to your controller.”h]”hŒ«Identify if your driver has one or more internal PCS blocks, and/or if your controller can use an external PCS block that might be internally connected to your controller.”…”�”}”(hjd h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mhj/ ubhï)�”}”(hŒHIf your controller doesn't have any internal PCS, you can go to step 11.”h]”hŒJIf your controller doesn’t have any internal PCS, you can go to step 11.”…”�”}”(hjr h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mhj/ ubhï)�”}”(hŒ¹If your Ethernet controller contains one or several PCS blocks, create one :c:type:`struct phylink_pcs ` instance per PCS block within your driver's private data structure:”h]”(hŒKIf your Ethernet controller contains one or several PCS blocks, create one ”…”�”}”(hj€ h²hh³Nh´Nubh)�”}”(hŒ*:c:type:`struct phylink_pcs `”h]”jç)�”}”(hjŠ h]”hŒstruct phylink_pcs”…”�”}”(hjŒ h²hh³Nh´Nubah}”(h]”h ]”(jòjóŒc-type”eh"]”h$]”h&]”uh1jæhjˆ ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”jÿŒ refdomain”jóŒreftype”Œtype”Œ refexplicit”ˆŒrefwarn”‰jŒ phylink_pcs”uh1hh³hÇh´Mhj€ ubhŒF instance per PCS block within your driver’s private data structure:”…”�”}”(hj€ h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mhj/ ubjÆ)�”}”(hŒstruct phylink_pcs pcs;”h]”hŒstruct phylink_pcs pcs;”…”�”}”hj± sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆjÕ‰jÖjójØ}”uh1jÅh³hÇh´M hj/ ubhï)�”}”(hX~Populate the relevant :c:type:`struct phylink_pcs_ops ` to configure your PCS. Create a :c:func:`pcs_get_state` function that reports the inband link state, a :c:func:`pcs_config` function to configure your PCS according to phylink-provided parameters, and a :c:func:`pcs_validate` function that report to phylink all accepted configuration parameters for your PCS:”h]”(hŒPopulate the relevant ”…”�”}”(hjÀ h²hh³Nh´Nubh)�”}”(hŒ2:c:type:`struct phylink_pcs_ops `”h]”jç)�”}”(hjÊ h]”hŒstruct phylink_pcs_ops”…”�”}”(hjÌ h²hh³Nh´Nubah}”(h]”h ]”(jòjóŒc-type”eh"]”h$]”h&]”uh1jæhjÈ ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”jÿŒ refdomain”jóŒreftype”Œtype”Œ refexplicit”ˆŒrefwarn”‰jŒphylink_pcs_ops”uh1hh³hÇh´MhjÀ ubhŒ! to configure your PCS. Create a ”…”�”}”(hjÀ h²hh³Nh´Nubh)�”}”(hŒ:c:func:`pcs_get_state`”h]”jç)�”}”(hjí h]”hŒpcs_get_state()”…”�”}”(hjï h²hh³Nh´Nubah}”(h]”h ]”(jòjóŒc-func”eh"]”h$]”h&]”uh1jæhjë ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”jÿŒ refdomain”jóŒreftype”Œfunc”Œ refexplicit”‰Œrefwarn”‰jŒ pcs_get_state”uh1hh³hÇh´MhjÀ ubhŒ0 function that reports the inband link state, a ”…”�”}”(hjÀ h²hh³Nh´Nubh)�”}”(hŒ:c:func:`pcs_config`”h]”jç)�”}”(hj h]”hŒ pcs_config()”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”(jòjóŒc-func”eh"]”h$]”h&]”uh1jæhj ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”jÿŒ refdomain”jóŒreftype”Œfunc”Œ refexplicit”‰Œrefwarn”‰jŒ pcs_config”uh1hh³hÇh´MhjÀ ubhŒP function to configure your PCS according to phylink-provided parameters, and a ”…”�”}”(hjÀ h²hh³Nh´Nubh)�”}”(hŒ:c:func:`pcs_validate`”h]”jç)�”}”(hj3 h]”hŒpcs_validate()”…”�”}”(hj5 h²hh³Nh´Nubah}”(h]”h ]”(jòjóŒc-func”eh"]”h$]”h&]”uh1jæhj1 ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”jÿŒ refdomain”jóŒreftype”Œfunc”Œ refexplicit”‰Œrefwarn”‰jŒ pcs_validate”uh1hh³hÇh´MhjÀ ubhŒT function that report to phylink all accepted configuration parameters for your PCS:”…”�”}”(hjÀ h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mhj/ ubjÆ)�”}”(hŒ¥struct phylink_pcs_ops foo_pcs_ops = { .pcs_validate = foo_pcs_validate, .pcs_get_state = foo_pcs_get_state, .pcs_config = foo_pcs_config, };”h]”hŒ¥struct phylink_pcs_ops foo_pcs_ops = { .pcs_validate = foo_pcs_validate, .pcs_get_state = foo_pcs_get_state, .pcs_config = foo_pcs_config, };”…”�”}”hjZ sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆjÕ‰jÖjójØ}”uh1jÅh³hÇh´Mhj/ ubhï)�”}”(hŒHArrange for PCS link state interrupts to be forwarded into phylink, via:”h]”hŒHArrange for PCS link state interrupts to be forwarded into phylink, via:”…”�”}”(hji h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mhj/ ubjÆ)�”}”(hŒ$phylink_pcs_change(pcs, link_is_up);”h]”hŒ$phylink_pcs_change(pcs, link_is_up);”…”�”}”hjw sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆjÕ‰jÖjójØ}”uh1jÅh³hÇh´M hj/ ubhï)�”}”(hŒÀwhere ``link_is_up`` is true if the link is currently up or false otherwise. If a PCS is unable to provide these interrupts, then it should set ``pcs->pcs_poll = true;`` when creating the PCS.”h]”(hŒwhere ”…”�”}”(hj† h²hh³Nh´Nubjç)�”}”(hŒ``link_is_up``”h]”hŒ link_is_up”…”�”}”(hjŽ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jæhj† ubhŒ| is true if the link is currently up or false otherwise. If a PCS is unable to provide these interrupts, then it should set ”…”�”}”(hj† h²hh³Nh´Nubjç)�”}”(hŒ``pcs->pcs_poll = true;``”h]”hŒpcs->pcs_poll = true;”…”�”}”(hj  h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jæhj† ubhŒ when creating the PCS.”…”�”}”(hj† h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M$hj/ ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j8hjâh²hh³hÇh´Nubj9)�”}”(hXñIf your controller relies on, or accepts the presence of an external PCS controlled through its own driver, add a pointer to a phylink_pcs instance in your driver private data structure: .. code-block:: c struct phylink_pcs *pcs; The way of getting an instance of the actual PCS depends on the platform, some PCS sit on an MDIO bus and are grabbed by passing a pointer to the corresponding :c:type:`struct mii_bus ` and the PCS's address on that bus. In this example, we assume the controller attaches to a Lynx PCS instance: .. code-block:: c priv->pcs = lynx_pcs_create_mdiodev(bus, 0); Some PCS can be recovered based on firmware information: .. code-block:: c priv->pcs = lynx_pcs_create_fwnode(of_fwnode_handle(node)); ”h]”(hï)�”}”(hŒºIf your controller relies on, or accepts the presence of an external PCS controlled through its own driver, add a pointer to a phylink_pcs instance in your driver private data structure:”h]”hŒºIf your controller relies on, or accepts the presence of an external PCS controlled through its own driver, add a pointer to a phylink_pcs instance in your driver private data structure:”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M(hj¾ ubjÆ)�”}”(hŒstruct phylink_pcs *pcs;”h]”hŒstruct phylink_pcs *pcs;”…”�”}”hjÐ sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆjÕ‰jÖjójØ}”uh1jÅh³hÇh´M,hj¾ ubhï)�”}”(hX0The way of getting an instance of the actual PCS depends on the platform, some PCS sit on an MDIO bus and are grabbed by passing a pointer to the corresponding :c:type:`struct mii_bus ` and the PCS's address on that bus. In this example, we assume the controller attaches to a Lynx PCS instance:”h]”(hŒ The way of getting an instance of the actual PCS depends on the platform, some PCS sit on an MDIO bus and are grabbed by passing a pointer to the corresponding ”…”�”}”(hjß h²hh³Nh´Nubh)�”}”(hŒ":c:type:`struct mii_bus `”h]”jç)�”}”(hjé h]”hŒstruct mii_bus”…”�”}”(hjë h²hh³Nh´Nubah}”(h]”h ]”(jòjóŒc-type”eh"]”h$]”h&]”uh1jæhjç ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”jÿŒ refdomain”jóŒreftype”Œtype”Œ refexplicit”ˆŒrefwarn”‰jŒmii_bus”uh1hh³hÇh´M0hjß ubhŒp and the PCS’s address on that bus. In this example, we assume the controller attaches to a Lynx PCS instance:”…”�”}”(hjß h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M0hj¾ ubjÆ)�”}”(hŒ,priv->pcs = lynx_pcs_create_mdiodev(bus, 0);”h]”hŒ,priv->pcs = lynx_pcs_create_mdiodev(bus, 0);”…”�”}”hj sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆjÕ‰jÖjójØ}”uh1jÅh³hÇh´M6hj¾ ubhï)�”}”(hŒ8Some PCS can be recovered based on firmware information:”h]”hŒ8Some PCS can be recovered based on firmware information:”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M:hj¾ ubjÆ)�”}”(hŒ;priv->pcs = lynx_pcs_create_fwnode(of_fwnode_handle(node));”h]”hŒ;priv->pcs = lynx_pcs_create_fwnode(of_fwnode_handle(node));”…”�”}”hj- sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆjÕ‰jÖjójØ}”uh1jÅh³hÇh´M<hj¾ ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j8hjâh²hh³Nh´Nubj9)�”}”(hX3Populate the :c:func:`mac_select_pcs` callback and add it to your :c:type:`struct phylink_mac_ops ` set of ops. This function must return a pointer to the relevant :c:type:`struct phylink_pcs ` that will be used for the requested link configuration: .. code-block:: c static struct phylink_pcs *foo_select_pcs(struct phylink_config *config, phy_interface_t interface) { struct foo_priv *priv = container_of(config, struct foo_priv, phylink_config); if ( /* 'interface' needs a PCS to function */ ) return priv->pcs; return NULL; } See :c:func:`mvpp2_select_pcs` for an example of a driver that has multiple internal PCS. ”h]”(hï)�”}”(hXPopulate the :c:func:`mac_select_pcs` callback and add it to your :c:type:`struct phylink_mac_ops ` set of ops. This function must return a pointer to the relevant :c:type:`struct phylink_pcs ` that will be used for the requested link configuration:”h]”(hŒ Populate the ”…”�”}”(hjF h²hh³Nh´Nubh)�”}”(hŒ:c:func:`mac_select_pcs`”h]”jç)�”}”(hjP h]”hŒmac_select_pcs()”…”�”}”(hjR h²hh³Nh´Nubah}”(h]”h ]”(jòjóŒc-func”eh"]”h$]”h&]”uh1jæhjN ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”jÿŒ refdomain”jóŒreftype”Œfunc”Œ refexplicit”‰Œrefwarn”‰jŒmac_select_pcs”uh1hh³hÇh´M@hjF ubhŒ callback and add it to your ”…”�”}”(hjF h²hh³Nh´Nubh)�”}”(hŒ2:c:type:`struct phylink_mac_ops `”h]”jç)�”}”(hjs h]”hŒstruct phylink_mac_ops”…”�”}”(hju h²hh³Nh´Nubah}”(h]”h ]”(jòjóŒc-type”eh"]”h$]”h&]”uh1jæhjq ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”jÿŒ refdomain”jóŒreftype”Œtype”Œ refexplicit”ˆŒrefwarn”‰jŒphylink_mac_ops”uh1hh³hÇh´M@hjF ubhŒA set of ops. This function must return a pointer to the relevant ”…”�”}”(hjF h²hh³Nh´Nubh)�”}”(hŒ*:c:type:`struct phylink_pcs `”h]”jç)�”}”(hj– h]”hŒstruct phylink_pcs”…”�”}”(hj˜ h²hh³Nh´Nubah}”(h]”h ]”(jòjóŒc-type”eh"]”h$]”h&]”uh1jæhj” ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”jÿŒ refdomain”jóŒreftype”Œtype”Œ refexplicit”ˆŒrefwarn”‰jŒ phylink_pcs”uh1hh³hÇh´M@hjF ubhŒ8 that will be used for the requested link configuration:”…”�”}”(hjF h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M@hjB ubjÆ)�”}”(hX‡static struct phylink_pcs *foo_select_pcs(struct phylink_config *config, phy_interface_t interface) { struct foo_priv *priv = container_of(config, struct foo_priv, phylink_config); if ( /* 'interface' needs a PCS to function */ ) return priv->pcs; return NULL; }”h]”hX‡static struct phylink_pcs *foo_select_pcs(struct phylink_config *config, phy_interface_t interface) { struct foo_priv *priv = container_of(config, struct foo_priv, phylink_config); if ( /* 'interface' needs a PCS to function */ ) return priv->pcs; return NULL; }”…”�”}”hj½ sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆjÕ‰jÖjójØ}”uh1jÅh³hÇh´MEhjB ubhï)�”}”(hŒYSee :c:func:`mvpp2_select_pcs` for an example of a driver that has multiple internal PCS.”h]”(hŒSee ”…”�”}”(hjÌ h²hh³Nh´Nubh)�”}”(hŒ:c:func:`mvpp2_select_pcs`”h]”jç)�”}”(hjÖ h]”hŒmvpp2_select_pcs()”…”�”}”(hjØ h²hh³Nh´Nubah}”(h]”h ]”(jòjóŒc-func”eh"]”h$]”h&]”uh1jæhjÔ ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”jÿŒ refdomain”jóŒreftype”Œfunc”Œ refexplicit”‰Œrefwarn”‰jŒmvpp2_select_pcs”uh1hh³hÇh´MShjÌ ubhŒ; for an example of a driver that has multiple internal PCS.”…”�”}”(hjÌ h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MShjB ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j8hjâh²hh³hÇh´Nubj9)�”}”(hX˜Fill-in all the :c:type:`phy_interface_t ` (i.e. all MAC to PHY link modes) that your MAC can output. The following example shows a configuration for a MAC that can handle all RGMII modes, SGMII and 1000BaseX. You must adjust these according to what your MAC and all PCS associated with this MAC are capable of, and not just the interface you wish to use: .. code-block:: c phy_interface_set_rgmii(priv->phylink_config.supported_interfaces); __set_bit(PHY_INTERFACE_MODE_SGMII, priv->phylink_config.supported_interfaces); __set_bit(PHY_INTERFACE_MODE_1000BASEX, priv->phylink_config.supported_interfaces); ”h]”(hï)�”}”(hXtFill-in all the :c:type:`phy_interface_t ` (i.e. all MAC to PHY link modes) that your MAC can output. The following example shows a configuration for a MAC that can handle all RGMII modes, SGMII and 1000BaseX. You must adjust these according to what your MAC and all PCS associated with this MAC are capable of, and not just the interface you wish to use:”h]”(hŒFill-in all the ”…”�”}”(hj h²hh³Nh´Nubh)�”}”(hŒ+:c:type:`phy_interface_t `”h]”jç)�”}”(hj h]”hŒphy_interface_t”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”(jòjóŒc-type”eh"]”h$]”h&]”uh1jæhj ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”jÿŒ refdomain”jóŒreftype”Œtype”Œ refexplicit”ˆŒrefwarn”‰jŒphy_interface_t”uh1hh³hÇh´MVhj ubhX9 (i.e. all MAC to PHY link modes) that your MAC can output. The following example shows a configuration for a MAC that can handle all RGMII modes, SGMII and 1000BaseX. You must adjust these according to what your MAC and all PCS associated with this MAC are capable of, and not just the interface you wish to use:”…”�”}”(hj h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MVhj ubjÆ)�”}”(hŒÿphy_interface_set_rgmii(priv->phylink_config.supported_interfaces); __set_bit(PHY_INTERFACE_MODE_SGMII, priv->phylink_config.supported_interfaces); __set_bit(PHY_INTERFACE_MODE_1000BASEX, priv->phylink_config.supported_interfaces);”h]”hŒÿphy_interface_set_rgmii(priv->phylink_config.supported_interfaces); __set_bit(PHY_INTERFACE_MODE_SGMII, priv->phylink_config.supported_interfaces); __set_bit(PHY_INTERFACE_MODE_1000BASEX, priv->phylink_config.supported_interfaces);”…”�”}”hj8 sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆjÕ‰jÖjójØ}”uh1jÅh³hÇh´M\hj ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j8hjâh²hh³Nh´Nubj9)�”}”(hX7Remove calls to of_parse_phandle() for the PHY, of_phy_register_fixed_link() for fixed links etc. from the probe function, and replace with: .. code-block:: c struct phylink *phylink; phylink = phylink_create(&priv->phylink_config, node, phy_mode, &phylink_ops); if (IS_ERR(phylink)) { err = PTR_ERR(phylink); fail probe; } priv->phylink = phylink; and arrange to destroy the phylink in the probe failure path as appropriate and the removal path too by calling: .. code-block:: c phylink_destroy(priv->phylink); ”h]”(hï)�”}”(hŒŒRemove calls to of_parse_phandle() for the PHY, of_phy_register_fixed_link() for fixed links etc. from the probe function, and replace with:”h]”hŒŒRemove calls to of_parse_phandle() for the PHY, of_phy_register_fixed_link() for fixed links etc. from the probe function, and replace with:”…”�”}”(hjQ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MdhjM ubjÆ)�”}”(hŒÏstruct phylink *phylink; phylink = phylink_create(&priv->phylink_config, node, phy_mode, &phylink_ops); if (IS_ERR(phylink)) { err = PTR_ERR(phylink); fail probe; } priv->phylink = phylink;”h]”hŒÏstruct phylink *phylink; phylink = phylink_create(&priv->phylink_config, node, phy_mode, &phylink_ops); if (IS_ERR(phylink)) { err = PTR_ERR(phylink); fail probe; } priv->phylink = phylink;”…”�”}”hj_ sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆjÕ‰jÖjójØ}”uh1jÅh³hÇh´MhhjM ubhï)�”}”(hŒpand arrange to destroy the phylink in the probe failure path as appropriate and the removal path too by calling:”h]”hŒpand arrange to destroy the phylink in the probe failure path as appropriate and the removal path too by calling:”…”�”}”(hjn h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MthjM ubjÆ)�”}”(hŒphylink_destroy(priv->phylink);”h]”hŒphylink_destroy(priv->phylink);”…”�”}”hj| sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆjÕ‰jÖjójØ}”uh1jÅh³hÇh´MwhjM ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j8hjâh²hh³Nh´Nubj9)�”}”(hŒÞArrange for MAC link state interrupts to be forwarded into phylink, via: .. code-block:: c phylink_mac_change(priv->phylink, link_is_up); where ``link_is_up`` is true if the link is currently up or false otherwise. ”h]”(hï)�”}”(hŒHArrange for MAC link state interrupts to be forwarded into phylink, via:”h]”hŒHArrange for MAC link state interrupts to be forwarded into phylink, via:”…”�”}”(hj• h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M{hj‘ ubjÆ)�”}”(hŒ.phylink_mac_change(priv->phylink, link_is_up);”h]”hŒ.phylink_mac_change(priv->phylink, link_is_up);”…”�”}”hj£ sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆjÕ‰jÖjójØ}”uh1jÅh³hÇh´M~hj‘ ubhï)�”}”(hŒLwhere ``link_is_up`` is true if the link is currently up or false otherwise.”h]”(hŒwhere ”…”�”}”(hj² h²hh³Nh´Nubjç)�”}”(hŒ``link_is_up``”h]”hŒ link_is_up”…”�”}”(hjº h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jæhj² ubhŒ8 is true if the link is currently up or false otherwise.”…”�”}”(hj² h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M‚hj‘ ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j8hjâh²hh³hÇh´Nubj9)�”}”(hŒþVerify that the driver does not call:: netif_carrier_on() netif_carrier_off() as these will interfere with phylink's tracking of the link state, and cause phylink to omit calls via the :c:func:`mac_link_up` and :c:func:`mac_link_down` methods. ”h]”(hï)�”}”(hŒ&Verify that the driver does not call::”h]”hŒ%Verify that the driver does not call:”…”�”}”(hjÜ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M…hjØ ubjÆ)�”}”(hŒ&netif_carrier_on() netif_carrier_off()”h]”hŒ&netif_carrier_on() netif_carrier_off()”…”�”}”hjê sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jÅh³hÇh´M‡hjØ ubhï)�”}”(hŒ¥as these will interfere with phylink's tracking of the link state, and cause phylink to omit calls via the :c:func:`mac_link_up` and :c:func:`mac_link_down` methods.”h]”(hŒmas these will interfere with phylink’s tracking of the link state, and cause phylink to omit calls via the ”…”�”}”(hjø h²hh³Nh´Nubh)�”}”(hŒ:c:func:`mac_link_up`”h]”jç)�”}”(hjh]”hŒ mac_link_up()”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”(jòjóŒc-func”eh"]”h$]”h&]”uh1jæhjubah}”(h]”•qh ]”h"]”h$]”h&]”Œrefdoc”jÿŒ refdomain”jóŒreftype”Œfunc”Œ refexplicit”‰Œrefwarn”‰jŒ mac_link_up”uh1hh³hÇh´MŠhjø ubhŒ and ”…”�”}”(hjø h²hh³Nh´Nubh)�”}”(hŒ:c:func:`mac_link_down`”h]”jç)�”}”(hj%h]”hŒmac_link_down()”…”�”}”(hj'h²hh³Nh´Nubah}”(h]”h ]”(jòjóŒc-func”eh"]”h$]”h&]”uh1jæhj#ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”jÿŒ refdomain”jóŒreftype”Œfunc”Œ refexplicit”‰Œrefwarn”‰jŒ mac_link_down”uh1hh³hÇh´MŠhjø ubhŒ methods.”…”�”}”(hjø h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MŠhjØ ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j8hjâh²hh³hÇh´Nubeh}”(h]”h ]”h"]”h$]”h&]”j²j³j´hjµj¶uh1j3hjÃh²hh³hÇh´KLubhï)�”}”(hŒÕNetwork drivers should call phylink_stop() and phylink_start() via their suspend/resume paths, which ensures that the appropriate :c:type:`struct phylink_mac_ops ` methods are called as necessary.”h]”(hŒ‚Network drivers should call phylink_stop() and phylink_start() via their suspend/resume paths, which ensures that the appropriate ”…”�”}”(hjXh²hh³Nh´Nubh)�”}”(hŒ2:c:type:`struct phylink_mac_ops `”h]”jç)�”}”(hjbh]”hŒstruct phylink_mac_ops”…”�”}”(hjdh²hh³Nh´Nubah}”(h]”h ]”(jòjóŒc-type”eh"]”h$]”h&]”uh1jæhj`ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”jÿŒ refdomain”jóŒreftype”Œtype”Œ refexplicit”ˆŒrefwarn”‰jŒphylink_mac_ops”uh1hh³hÇh´MŽhjXubhŒ! methods are called as necessary.”…”�”}”(hjXh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MŽhjÃh²hubhï)�”}”(hŒ¥For information describing the SFP cage in DT, please see the binding documentation in the kernel source tree ``Documentation/devicetree/bindings/net/sff,sfp.yaml``.”h]”(hŒnFor information describing the SFP cage in DT, please see the binding documentation in the kernel source tree ”…”�”}”(hj‰h²hh³Nh´Nubjç)�”}”(hŒ6``Documentation/devicetree/bindings/net/sff,sfp.yaml``”h]”hŒ2Documentation/devicetree/bindings/net/sff,sfp.yaml”…”�”}”(hj‘h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jæhj‰ubhŒ.”…”�”}”(hj‰h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M“hjÃh²hubeh}”(h]”Œ9rough-guide-to-converting-a-network-driver-to-sfp-phylink”ah ]”h"]”Œ9rough guide to converting a network driver to sfp/phylink”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´KFubeh}”(h]”Œphylink”ah ]”h"]”Œphylink”ah$]”h&]”uh1hÈhhh²hh³hÇh´Kubeh}”(h]”h ]”h"]”h$]”h&]”Œsource”hÇuh1hŒcurrent_source”NŒ current_line”NŒsettings”Œdocutils.frontend”ŒValues”“”)�”}”(hÍNŒ generator”NŒ datestamp”NŒ source_link”NŒ source_url”NŒ toc_backlinks”jFŒfootnote_backlinks”KŒ sectnum_xform”KŒstrip_comments”NŒstrip_elements_with_classes”NŒ strip_classes”NŒ report_level”KŒ halt_level”KŒexit_status_level”KŒdebug”NŒwarning_stream”NŒ traceback”ˆŒinput_encoding”Œ utf-8-sig”Œinput_encoding_error_handler”Œstrict”Œoutput_encoding”Œutf-8”Œoutput_encoding_error_handler”jÛŒerror_encoding”Œutf-8”Œerror_encoding_error_handler”Œbackslashreplace”Œ language_code”Œen”Œrecord_dependencies”NŒconfig”NŒ id_prefix”hŒauto_id_prefix”Œid”Œ dump_settings”NŒdump_internals”NŒdump_transforms”NŒdump_pseudo_xml”NŒexpose_internals”NŒstrict_visitor”NŒ_disable_config”NŒ_source”hÇŒ _destination”NŒ _config_files”]”Œ7/var/lib/git/docbuild/linux/Documentation/docutils.conf”aŒfile_insertion_enabled”ˆŒ raw_enabled”KŒline_length_limit”M'Œpep_references”NŒ pep_base_url”Œhttps://peps.python.org/”Œpep_file_url_template”Œpep-%04d”Œrfc_references”NŒ rfc_base_url”Œ&https://datatracker.ietf.org/doc/html/”Œ tab_width”KŒtrim_footnote_reference_space”‰Œsyntax_highlight”Œlong”Œ smart_quotes”ˆŒsmartquotes_locales”]”Œcharacter_level_inline_markup”‰Œdoctitle_xform”‰Œ docinfo_xform”KŒsectsubtitle_xform”‰Œ image_loading”Œlink”Œembed_stylesheet”‰Œcloak_email_addresses”ˆŒsection_self_link”‰Œenv”NubŒreporter”NŒindirect_targets”]”Œsubstitution_defs”}”Œsubstitution_names”}”Œrefnames”}”Œrefids”}”Œnameids”}”(j¶j³jjjÀj½j®j«uŒ nametypes”}”(j¶‰j‰jÀ‰j®‰uh}”(j³hÊjhÝj½jj«jÃuŒ footnote_refs”}”Œ citation_refs”}”Œ autofootnotes”]”Œautofootnote_refs”]”Œsymbol_footnotes”]”Œsymbol_footnote_refs”]”Œ footnotes”]”Œ citations”]”Œautofootnote_start”KŒsymbol_footnote_start”KŒ id_counter”Œ collections”ŒCounter”“”}”…”R”Œparse_messages”]”Œtransform_messages”]”Œ transformer”NŒ include_log”]”Œ decoration”Nh²hub.