public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Vinod Koul <vkoul@kernel.org>
To: Vladimir Oltean <vladimir.oltean@nxp.com>
Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org,
	"Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Andrew Lunn <andrew@lunn.ch>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Madalin Bucur <madalin.bucur@nxp.com>,
	Ioana Ciornei <ioana.ciornei@nxp.com>,
	Camelia Groza <camelia.groza@nxp.com>,
	Li Yang <leoyang.li@nxp.com>, Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Conor Dooley <conor@kernel.org>,
	Sean Anderson <sean.anderson@seco.com>,
	Maxime Chevallier <maxime.chevallier@bootlin.com>,
	Kishon Vijay Abraham I <kishon@kernel.org>
Subject: Re: [RFC PATCH v2 net-next 04/15] phy: allow querying the address of protocol converters through phy_get_status()
Date: Fri, 29 Sep 2023 21:53:22 +0530	[thread overview]
Message-ID: <ZRb5+h4TnGRKl3/6@matsya> (raw)
In-Reply-To: <20230923134904.3627402-5-vladimir.oltean@nxp.com>

On 23-09-23, 16:48, Vladimir Oltean wrote:
> The bit stream handled by a SerDes lane needs protocol converters to be
> usable for Ethernet. On Freescale/NXP SoCs, those protocol converters
> are located on the internal MDIO buses of the Ethernet MACs that need
> them.
> 
> The location on that MDIO bus, on these SoCs, is not fixed, but given by
> some control registers of the SerDes block itself.
> 
> Because no one modifies those addresses from the power-on default, so
> far we've relied on hardcoding the default values in the device trees,
> resulting in something like this:
> 
> 		pcs_mdio1: mdio@8c07000 {
> 			compatible = "fsl,fman-memac-mdio";
> 
> 			pcs1: ethernet-phy@0 {
> 				reg = <0>;
> 			};
> 		};
> 
> where the "reg" of "pcs1" can actually be retrieved from "serdes_1".
> 
> That was for the PCS. For AN/LT blocks, that can also be done, but the
> MAC to PCS to AN/LT block mapping is non-trivial and extremely easy to
> get wrong, which will confuse and frustrate any device tree writers.
> 
> The proposal is to take advantage of the fact that these protocol
> converters *are* discoverable, and to side-step that entire device tree
> mapping issue by not putting them in the device tree at all. So, one of
> the consumers of the SerDes PHY uses the phy_get_status() API to figure
> out the address on the MDIO bus, it also has a reference to the MDIO bus
> => it can create the mdio_device in a non OF-based manner.
> 
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> ---
> v1->v2: patch is new
> 
>  include/linux/phy/phy.h | 29 +++++++++++++++++++++++++++++
>  1 file changed, 29 insertions(+)
> 
> diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h
> index f1f03fa66943..ee721067517b 100644
> --- a/include/linux/phy/phy.h
> +++ b/include/linux/phy/phy.h
> @@ -56,6 +56,33 @@ enum phy_media {
>  enum phy_status_type {
>  	/* Valid for PHY_MODE_ETHERNET and PHY_MODE_ETHTOOL */
>  	PHY_STATUS_CDR_LOCK,
> +	PHY_STATUS_PCVT_ADDR,
> +};
> +
> +/* enum phy_pcvt_type - PHY protocol converter type

It is not a generic protocol converter but an ethernet phy protocol
converter, so i guess we should add that here (we are generic phy and
not ethernet phy here!

> + *
> + * @PHY_PCVT_ETHERNET_PCS: Ethernet Physical Coding Sublayer, top-most layer of
> + *			   an Ethernet PHY. Connects through MII to the MAC,
> + *			   and handles link status detection and the conversion
> + *			   of MII signals to link-specific code words (8b/10b,
> + *			   64b/66b etc).
> + * @PHY_PCVT_ETHERNET_ANLT: Ethernet Auto-Negotiation and Link Training,
> + *			    bottom-most layer of an Ethernet PHY, beneath the
> + *			    PMA and PMD. Its activity is only visible on the
> + *			    physical medium, and it is responsible for
> + *			    selecting the most adequate PCS/PMA/PMD set that
> + *			    can operate on that medium.
> + */
> +enum phy_pcvt_type {
> +	PHY_PCVT_ETHERNET_PCS,
> +	PHY_PCVT_ETHERNET_ANLT,
> +};
> +
> +struct phy_status_opts_pcvt {
> +	enum phy_pcvt_type type;
> +	union {
> +		unsigned int mdio;
> +	} addr;
>  };
>  
>  /* If the CDR (Clock and Data Recovery) block is able to lock onto the RX bit
> @@ -71,9 +98,11 @@ struct phy_status_opts_cdr {
>   * union phy_status_opts - Opaque generic phy status
>   *
>   * @cdr:	Configuration set applicable for PHY_STATUS_CDR_LOCK.
> + * @pcvt:	Configuration set applicable for PHY_STATUS_PCVT_ADDR.
>   */
>  union phy_status_opts {
>  	struct phy_status_opts_cdr		cdr;
> +	struct phy_status_opts_pcvt		pcvt;
>  };
>  
>  /**
> -- 
> 2.34.1

-- 
~Vinod

  reply	other threads:[~2023-09-29 16:23 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-23 13:48 [RFC PATCH v2 net-next 00/15] Add C72/C73 copper backplane support for LX2160 Vladimir Oltean
2023-09-23 13:48 ` [RFC PATCH v2 net-next 01/15] phy: introduce phy_get_status() and use it to report CDR lock Vladimir Oltean
2023-10-02 19:16   ` Florian Fainelli
2023-09-23 13:48 ` [RFC PATCH v2 net-next 02/15] phy: introduce the PHY_MODE_ETHTOOL mode for phy_set_mode_ext() Vladimir Oltean
2023-10-02 19:19   ` Florian Fainelli
2023-10-03 16:04     ` Vladimir Oltean
2023-09-23 13:48 ` [RFC PATCH v2 net-next 03/15] phy: ethernet: add configuration interface for copper backplane Ethernet PHYs Vladimir Oltean
2023-09-28 13:36   ` Simon Horman
2023-09-28 19:05   ` Simon Horman
2023-10-02 13:11     ` Vladimir Oltean
2023-10-02 17:20       ` Simon Horman
2023-09-23 13:48 ` [RFC PATCH v2 net-next 04/15] phy: allow querying the address of protocol converters through phy_get_status() Vladimir Oltean
2023-09-29 16:23   ` Vinod Koul [this message]
2023-10-02 10:09     ` Vladimir Oltean
2023-09-23 13:48 ` [RFC PATCH v2 net-next 05/15] net: add 25GBase-KR-S and 25GBase-CR-S to ethtool link mode UAPI Vladimir Oltean
2023-10-03 11:19   ` Russell King (Oracle)
2023-09-23 13:48 ` [RFC PATCH v2 net-next 06/15] net: mii: add C73 base page helpers Vladimir Oltean
2023-09-23 13:48 ` [RFC PATCH v2 net-next 07/15] net: phylink: centralize phy_interface_mode_is_8023z() && phylink_autoneg_inband() checks Vladimir Oltean
2023-09-28 13:38   ` Simon Horman
2023-10-03 11:27   ` Russell King (Oracle)
2023-10-03 21:03     ` Vladimir Oltean
2023-09-23 13:48 ` [RFC PATCH v2 net-next 08/15] net: phylink: allow PCS to handle C73 autoneg for phy-mode = "internal" Vladimir Oltean
2023-10-02 14:17   ` Vladimir Oltean
2023-10-03 11:06     ` Russell King (Oracle)
2023-10-03 15:00       ` Vladimir Oltean
2023-09-23 13:48 ` [RFC PATCH v2 net-next 09/15] net: ethtool: introduce ethtool_link_mode_str() Vladimir Oltean
2023-10-03 11:30   ` Russell King (Oracle)
2023-10-04  0:08   ` Florian Fainelli
2023-09-23 13:48 ` [RFC PATCH v2 net-next 10/15] net: phylink: support all ethtool port modes with inband modes Vladimir Oltean
2023-09-23 13:49 ` [RFC PATCH v2 net-next 11/15] net: phylink: support the 25GBase-KR-S and 25GBase-CR-S link modes too Vladimir Oltean
2023-10-03 11:31   ` Russell King (Oracle)
2023-10-03 16:24     ` Vladimir Oltean
2023-09-23 13:49 ` [RFC PATCH v2 net-next 12/15] net: phylink: add the 25G link modes to phylink_c73_priority_resolution[] Vladimir Oltean
2023-10-03 13:16   ` Russell King (Oracle)
2023-10-03 16:33     ` Vladimir Oltean
2023-09-23 13:49 ` [RFC PATCH v2 net-next 13/15] dt-bindings: lynx-pcs: add properties for backplane mode Vladimir Oltean
2023-09-24 11:49   ` Krzysztof Kozlowski
2023-10-02 12:19     ` Vladimir Oltean
2023-09-23 13:49 ` [RFC PATCH v2 net-next 14/15] net: pcs: mtip_backplane: add driver for MoreThanIP backplane AN/LT core Vladimir Oltean
2023-09-28 19:06   ` Simon Horman
2023-09-23 13:49 ` [RFC PATCH v2 net-next 15/15] net: pcs: lynx: use MTIP AN/LT block for copper backplanes Vladimir Oltean
2023-10-03 13:14   ` Russell King (Oracle)
2023-10-03 19:00     ` Vladimir Oltean

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZRb5+h4TnGRKl3/6@matsya \
    --to=vkoul@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=camelia.groza@nxp.com \
    --cc=conor@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=f.fainelli@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=ioana.ciornei@nxp.com \
    --cc=kishon@kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=leoyang.li@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=madalin.bucur@nxp.com \
    --cc=maxime.chevallier@bootlin.com \
    --cc=netdev@vger.kernel.org \
    --cc=rmk+kernel@armlinux.org.uk \
    --cc=robh+dt@kernel.org \
    --cc=sean.anderson@seco.com \
    --cc=vladimir.oltean@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox