From: Vladimir Oltean <olteanv@gmail.com> To: Jakub Kicinski <kuba@kernel.org>, "David S. Miller" <davem@davemloft.net>, netdev@vger.kernel.org Cc: Wong Vee Khee <vee.khee.wong@linux.intel.com>, Ong Boon Leong <boon.leong.ong@intel.com>, Michael Sit Wei Hong <michael.wei.hong.sit@intel.com>, Giuseppe Cavallaro <peppe.cavallaro@st.com>, Alexandre Torgue <alexandre.torgue@foss.st.com>, Jose Abreu <joabreu@synopsys.com>, Jose Abreu <Jose.Abreu@synopsys.com>, Maxime Coquelin <mcoquelin.stm32@gmail.com>, Heiner Kallweit <hkallweit1@gmail.com>, Russell King - ARM Linux admin <linux@armlinux.org.uk>, Florian Fainelli <f.fainelli@gmail.com>, Andrew Lunn <andrew@lunn.ch>, Vivien Didelot <vivien.didelot@gmail.com>, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Vladimir Oltean <vladimir.oltean@nxp.com> Subject: [PATCH v3 net-next 06/13] net: pcs: xpcs: also ignore phy id if it's all ones Date: Fri, 11 Jun 2021 23:05:24 +0300 [thread overview] Message-ID: <20210611200531.2384819-7-olteanv@gmail.com> (raw) In-Reply-To: <20210611200531.2384819-1-olteanv@gmail.com> From: Vladimir Oltean <vladimir.oltean@nxp.com> xpcs_get_id() searches multiple MMDs for a known PHY ID, starting with MDIO_MMD_PCS (3). However not all integrators might have implemented that MMD on their MDIO bus. For example, the NXP SJA1105 and SJA1110 switches only implement vendor-specific MMD 1 and 2. When there is nothing on an MDIO bus at a certain address, traditionally the bus returns 0xffff, which means that the bus remained in its default pull-up state for the duration of the MDIO transaction. The 0xffff value is widely used in drivers/net/phy/phy_device.c (see get_phy_c22_id for example) to denote a missing device. So it makes sense for the xpcs to ignore this value as well, and continue its search, eventually finding the proper PHY ID in the vendor-specific MMDs. Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> --- v2->v3: none v1->v2: none drivers/net/pcs/pcs-xpcs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c index 743b53734eeb..ecf5011977d3 100644 --- a/drivers/net/pcs/pcs-xpcs.c +++ b/drivers/net/pcs/pcs-xpcs.c @@ -965,8 +965,10 @@ static u32 xpcs_get_id(struct dw_xpcs *xpcs) if (ret < 0) return 0xffffffff; - /* If Device IDs are not all zeros, we found C73 AN-type device */ - if (id | ret) + /* If Device IDs are not all zeros or all ones, + * we found C73 AN-type device + */ + if ((id | ret) && (id | ret) != 0xffffffff) return id | ret; /* Next, search C37 PCS using Vendor-Specific MII MMD */ -- 2.25.1
WARNING: multiple messages have this Message-ID (diff)
From: Vladimir Oltean <olteanv@gmail.com> To: Jakub Kicinski <kuba@kernel.org>, "David S. Miller" <davem@davemloft.net>, netdev@vger.kernel.org Cc: Wong Vee Khee <vee.khee.wong@linux.intel.com>, Ong Boon Leong <boon.leong.ong@intel.com>, Michael Sit Wei Hong <michael.wei.hong.sit@intel.com>, Giuseppe Cavallaro <peppe.cavallaro@st.com>, Alexandre Torgue <alexandre.torgue@foss.st.com>, Jose Abreu <joabreu@synopsys.com>, Jose Abreu <Jose.Abreu@synopsys.com>, Maxime Coquelin <mcoquelin.stm32@gmail.com>, Heiner Kallweit <hkallweit1@gmail.com>, Russell King - ARM Linux admin <linux@armlinux.org.uk>, Florian Fainelli <f.fainelli@gmail.com>, Andrew Lunn <andrew@lunn.ch>, Vivien Didelot <vivien.didelot@gmail.com>, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Vladimir Oltean <vladimir.oltean@nxp.com> Subject: [PATCH v3 net-next 06/13] net: pcs: xpcs: also ignore phy id if it's all ones Date: Fri, 11 Jun 2021 23:05:24 +0300 [thread overview] Message-ID: <20210611200531.2384819-7-olteanv@gmail.com> (raw) In-Reply-To: <20210611200531.2384819-1-olteanv@gmail.com> From: Vladimir Oltean <vladimir.oltean@nxp.com> xpcs_get_id() searches multiple MMDs for a known PHY ID, starting with MDIO_MMD_PCS (3). However not all integrators might have implemented that MMD on their MDIO bus. For example, the NXP SJA1105 and SJA1110 switches only implement vendor-specific MMD 1 and 2. When there is nothing on an MDIO bus at a certain address, traditionally the bus returns 0xffff, which means that the bus remained in its default pull-up state for the duration of the MDIO transaction. The 0xffff value is widely used in drivers/net/phy/phy_device.c (see get_phy_c22_id for example) to denote a missing device. So it makes sense for the xpcs to ignore this value as well, and continue its search, eventually finding the proper PHY ID in the vendor-specific MMDs. Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> --- v2->v3: none v1->v2: none drivers/net/pcs/pcs-xpcs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c index 743b53734eeb..ecf5011977d3 100644 --- a/drivers/net/pcs/pcs-xpcs.c +++ b/drivers/net/pcs/pcs-xpcs.c @@ -965,8 +965,10 @@ static u32 xpcs_get_id(struct dw_xpcs *xpcs) if (ret < 0) return 0xffffffff; - /* If Device IDs are not all zeros, we found C73 AN-type device */ - if (id | ret) + /* If Device IDs are not all zeros or all ones, + * we found C73 AN-type device + */ + if ((id | ret) && (id | ret) != 0xffffffff) return id | ret; /* Next, search C37 PCS using Vendor-Specific MII MMD */ -- 2.25.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2021-06-11 20:05 UTC|newest] Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-06-11 20:05 [PATCH v3 net-next 00/13] Port the SJA1105 DSA driver to XPCS Vladimir Oltean 2021-06-11 20:05 ` Vladimir Oltean 2021-06-11 20:05 ` [PATCH v3 net-next 01/13] net: pcs: xpcs: rename mdio_xpcs_args to dw_xpcs Vladimir Oltean 2021-06-11 20:05 ` Vladimir Oltean 2021-06-11 20:05 ` [PATCH v3 net-next 02/13] net: stmmac: reverse Christmas tree notation in stmmac_xpcs_setup Vladimir Oltean 2021-06-11 20:05 ` Vladimir Oltean 2021-06-11 20:05 ` [PATCH v3 net-next 03/13] net: stmmac: reduce indentation when calling stmmac_xpcs_setup Vladimir Oltean 2021-06-11 20:05 ` Vladimir Oltean 2021-06-11 20:05 ` [PATCH v3 net-next 04/13] net: pcs: xpcs: move register bit descriptions to a header file Vladimir Oltean 2021-06-11 20:05 ` Vladimir Oltean 2021-06-11 20:05 ` [PATCH v3 net-next 05/13] net: pcs: xpcs: add support for sgmii with no inband AN Vladimir Oltean 2021-06-11 20:05 ` Vladimir Oltean 2021-06-11 20:05 ` Vladimir Oltean [this message] 2021-06-11 20:05 ` [PATCH v3 net-next 06/13] net: pcs: xpcs: also ignore phy id if it's all ones Vladimir Oltean 2021-06-11 20:05 ` [PATCH v3 net-next 07/13] net: pcs: xpcs: add support for NXP SJA1105 Vladimir Oltean 2021-06-11 20:05 ` Vladimir Oltean 2021-06-11 20:05 ` [PATCH v3 net-next 08/13] net: pcs: xpcs: add support for NXP SJA1110 Vladimir Oltean 2021-06-11 20:05 ` Vladimir Oltean 2021-06-11 20:05 ` [PATCH v3 net-next 09/13] net: pcs: xpcs: export xpcs_do_config and xpcs_link_up Vladimir Oltean 2021-06-11 20:05 ` Vladimir Oltean 2021-06-11 20:05 ` [PATCH v3 net-next 10/13] net: dsa: sja1105: migrate to xpcs for SGMII Vladimir Oltean 2021-06-11 20:05 ` Vladimir Oltean 2021-06-11 20:05 ` [PATCH v3 net-next 11/13] net: dsa: sja1105: register the PCS MDIO bus for SJA1110 Vladimir Oltean 2021-06-11 20:05 ` Vladimir Oltean 2021-06-11 20:05 ` [PATCH v3 net-next 12/13] net: dsa: sja1105: SGMII and 2500base-x on the SJA1110 are 'special' Vladimir Oltean 2021-06-11 20:05 ` Vladimir Oltean 2021-06-11 20:05 ` [PATCH v3 net-next 13/13] net: dsa: sja1105: plug in support for 2500base-x Vladimir Oltean 2021-06-11 20:05 ` Vladimir Oltean 2021-06-11 21:00 ` [PATCH v3 net-next 00/13] Port the SJA1105 DSA driver to XPCS patchwork-bot+netdevbpf 2021-06-11 21:00 ` patchwork-bot+netdevbpf
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=20210611200531.2384819-7-olteanv@gmail.com \ --to=olteanv@gmail.com \ --cc=Jose.Abreu@synopsys.com \ --cc=alexandre.torgue@foss.st.com \ --cc=andrew@lunn.ch \ --cc=boon.leong.ong@intel.com \ --cc=davem@davemloft.net \ --cc=f.fainelli@gmail.com \ --cc=hkallweit1@gmail.com \ --cc=joabreu@synopsys.com \ --cc=kuba@kernel.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-stm32@st-md-mailman.stormreply.com \ --cc=linux@armlinux.org.uk \ --cc=mcoquelin.stm32@gmail.com \ --cc=michael.wei.hong.sit@intel.com \ --cc=netdev@vger.kernel.org \ --cc=peppe.cavallaro@st.com \ --cc=vee.khee.wong@linux.intel.com \ --cc=vivien.didelot@gmail.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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.