lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230405-net-next-topic-net-phy-reset-v1-5-7e5329f08002@pengutronix.de>
Date:   Wed, 05 Apr 2023 11:26:56 +0200
From:   Marco Felsch <m.felsch@...gutronix.de>
To:     Andrew Lunn <andrew@...n.ch>,
        Heiner Kallweit <hkallweit1@...il.com>,
        Russell King <linux@...linux.org.uk>,
        "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>,
        Florian Fainelli <f.fainelli@...il.com>,
        Broadcom internal kernel review list 
        <bcm-kernel-feedback-list@...adcom.com>,
        Richard Cochran <richardcochran@...il.com>,
        Radu Pirea <radu-nicolae.pirea@....nxp.com>,
        Shyam Sundar S K <Shyam-sundar.S-k@....com>,
        Yisen Zhuang <yisen.zhuang@...wei.com>,
        Salil Mehta <salil.mehta@...wei.com>,
        Jassi Brar <jaswinder.singh@...aro.org>,
        Ilias Apalodimas <ilias.apalodimas@...aro.org>,
        Iyappan Subramanian <iyappan@...amperecomputing.com>,
        Keyur Chudgar <keyur@...amperecomputing.com>,
        Quan Nguyen <quan@...amperecomputing.com>,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        Len Brown <lenb@...nel.org>, Rob Herring <robh+dt@...nel.org>,
        Frank Rowand <frowand.list@...il.com>
Cc:     netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-acpi@...r.kernel.org, devicetree@...r.kernel.org,
        kernel@...gutronix.de
Subject: [PATCH 05/12] net: phy: add phy_id_broken support

Some phy's don't report the correct phy-id, e.g. the TJA1102 dual-port
report 0 for the 2nd port. To fix this a driver needs to supply the
phyid instead and tell the phy framework to not try to readout the
phyid. The latter case is done via the new 'phy_id_broken' flag which
tells the phy framework to skip phyid readout for the corresponding phy.

Signed-off-by: Marco Felsch <m.felsch@...gutronix.de>
---
 drivers/net/phy/nxp-tja11xx.c | 1 +
 drivers/net/phy/phy_device.c  | 3 +++
 include/linux/phy.h           | 3 +++
 3 files changed, 7 insertions(+)

diff --git a/drivers/net/phy/nxp-tja11xx.c b/drivers/net/phy/nxp-tja11xx.c
index b5e03d66b7f5..2a4c0f6d74eb 100644
--- a/drivers/net/phy/nxp-tja11xx.c
+++ b/drivers/net/phy/nxp-tja11xx.c
@@ -560,6 +560,7 @@ static void tja1102_p1_register(struct work_struct *work)
 			.mii_bus = bus,
 			/* Real PHY ID of Port 1 is 0 */
 			.phy_id = PHY_ID_TJA1102,
+			.phy_id_broken = true,
 		};
 		struct phy_device *phy;
 
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index bb465a324eef..7e4b3b3caba9 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -969,6 +969,9 @@ static int phy_device_detect(struct phy_device_config *config)
 	int addr = config->phy_addr;
 	int r;
 
+	if (config->phy_id_broken)
+		return 0;
+
 	if (is_c45)
 		r = get_phy_c45_ids(bus, addr, c45_ids);
 	else
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 498f4dc7669d..0f0cb72a08ab 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -764,6 +764,8 @@ static inline struct phy_device *to_phy_device(const struct device *dev)
  * @phy_id: UID for this device found during discovery
  * @c45_ids: 802.3-c45 Device Identifiers if is_c45.
  * @is_c45: If true the PHY uses the 802.3 clause 45 protocol
+ * @phy_id_broken: Skip the phy_id detection instead use the supplied phy_id or
+ *                 c45_ids.
  *
  * The struct contain possible configuration parameters for a PHY device which
  * are used to setup the struct phy_device.
@@ -775,6 +777,7 @@ struct phy_device_config {
 	u32 phy_id;
 	struct phy_c45_device_ids c45_ids;
 	bool is_c45;
+	bool phy_id_broken;
 };
 
 /**

-- 
2.39.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ