Lines Matching +full:c +full:- +full:phy
1 .. SPDX-License-Identifier: GPL-2.0
10 phylink is a mechanism to support hot-pluggable networking modules
11 directly connected to a MAC without needing to re-initialise the
12 adapter on hot-plug events.
14 phylink supports conventional phylib-based setups, fixed link setups
23 1. PHY mode
25 In PHY mode, we use phylib to read the current link settings from
26 the PHY, and pass them to the MAC driver. We expect the MAC driver
32 Fixed mode is the same as PHY mode as far as the MAC driver is
35 3. In-band mode
37 In-band mode is used with 802.3z, SGMII and similar interface modes,
38 and we are expecting to use and honor the in-band negotiation or
43 .. code-block:: none
46 phy = <&phy>;
47 phy-mode = "sgmii";
50 does not use in-band SGMII signalling. The PHY is expected to follow
51 exactly the settings given to it in its :c:func:`mac_config` function.
53 :c:func:`mac_link_up` and :c:func:`mac_link_down` functions.
55 .. code-block:: none
58 managed = "in-band-status";
59 phy = <&phy>;
60 phy-mode = "sgmii";
63 uses in-band mode, where results from the PHY's negotiation are passed
65 acknowledge the control word. The :c:func:`mac_link_up` and
66 :c:func:`mac_link_down` functions must not force the MAC side link
77 two parts dealing with link-down and link-up. This can be done as
82 link-up part now includes configuring the MAC for the link settings.
83 Please see :c:func:`mac_link_up` for more information on this.
113 .. flat-table::
114 :header-rows: 1
116 :stub-columns: 0
118 * - Original function
119 - Replacement function
120 * - phy_start(phydev)
121 - phylink_start(priv->phylink)
122 * - phy_stop(phydev)
123 - phylink_stop(priv->phylink)
124 * - phy_mii_ioctl(phydev, ifr, cmd)
125 - phylink_mii_ioctl(priv->phylink, ifr, cmd)
126 * - phy_ethtool_get_wol(phydev, wol)
127 - phylink_ethtool_get_wol(priv->phylink, wol)
128 * - phy_ethtool_set_wol(phydev, wol)
129 - phylink_ethtool_set_wol(priv->phylink, wol)
130 * - phy_disconnect(phydev)
131 - phylink_disconnect_phy(priv->phylink)
139 .. code-block:: c
146 return phylink_ethtool_ksettings_set(priv->phylink, cmd);
154 return phylink_ethtool_ksettings_get(priv->phylink, cmd);
163 err = phylink_of_phy_connect(priv->phylink, node, flags);
166 the phy_attach_direct() inside this function call if a PHY is specified
169 ``node`` should be the DT node which contains the network phy property,
179 Manipulation of the PHY's supported/advertised happens within phylink
186 Finally, note that the MAC driver has no direct access to the PHY
187 anymore; that is because in the phylink model, the PHY can be
190 8. Add a :c:type:`struct phylink_mac_ops <phylink_mac_ops>` instance to
193 :c:func:`of_phy_connect` becomes three methods: :c:func:`mac_link_up`,
194 :c:func:`mac_link_down`, and :c:func:`mac_config`. If step 1 was
197 It is important that if in-band negotiation is used,
198 :c:func:`mac_link_up` and :c:func:`mac_link_down` do not prevent the
199 in-band negotiation from completing, since these functions are called
200 when the in-band link state changes - otherwise the link will never
203 The :c:func:`validate` method should mask the supplied supported mask,
204 and ``state->advertising`` with the supported ethtool link modes.
206 used. For an example, see ``drivers/net/ethernet/marvell/mvneta.c``.
208 The :c:func:`mac_link_state` method is used to read the link state
210 using. This is particularly important for in-band negotiation
211 methods such as 1000base-X and SGMII.
213 The :c:func:`mac_link_up` method is used to inform the MAC that the
218 tightly integrated, or when the settings are not coming from in-band
221 The :c:func:`mac_config` method is used to update the MAC with the
226 of how to do this can be found in :c:func:`mvneta_mac_config` in
227 ``drivers/net/ethernet/marvell/mvneta.c``.
230 documentation in :c:type:`struct phylink_mac_ops <phylink_mac_ops>`.
232 9. Remove calls to of_parse_phandle() for the PHY,
236 .. code-block:: c
239 priv->phylink_config.dev = &dev.dev;
240 priv->phylink_config.type = PHYLINK_NETDEV;
242 phylink = phylink_create(&priv->phylink_config, node, phy_mode, &phylink_ops);
248 priv->phylink = phylink;
253 .. code-block:: c
255 phylink_destroy(priv->phylink);
260 .. code-block:: c
262 phylink_mac_change(priv->phylink, link_is_up);
266 it should set ``priv->phylink_config.pcs_poll = true;`` in step 9.
274 and cause phylink to omit calls via the :c:func:`mac_link_up` and
275 :c:func:`mac_link_down` methods.
279 :c:type:`struct phylink_mac_ops <phylink_mac_ops>` methods are called