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-8-7e5329f08002@pengutronix.de>
Date:   Wed, 05 Apr 2023 11:26:59 +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 08/12] net: phy: add possibility to specify mdio device
 parent

Add the possibility to override the mdiodev parent device. This is
required for the TJA1102 dual-port phy where the 2nd port uses the first
port device.

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

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index a784ac06e6a9..30b3ac9818b1 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -642,7 +642,7 @@ static struct phy_device *phy_device_alloc(struct phy_device_config *config)
 		return ERR_PTR(-ENOMEM);
 
 	mdiodev = &dev->mdio;
-	mdiodev->dev.parent = &bus->dev;
+	mdiodev->dev.parent = config->parent_mdiodev ? : &bus->dev;
 	mdiodev->dev.bus = &mdio_bus_type;
 	mdiodev->dev.type = &mdio_bus_phy_type;
 	mdiodev->bus = bus;
diff --git a/include/linux/phy.h b/include/linux/phy.h
index bdf6d27faefb..d7aea8622a95 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -760,6 +760,8 @@ static inline struct phy_device *to_phy_device(const struct device *dev)
  * struct phy_device_config - Configuration of a PHY
  *
  * @mii_bus: The target MII bus the PHY is connected to
+ * @parent_mdiodev: Set the MDIO device parent if specified else mii_bus->dev is
+ *                  used as parent.
  * @phy_addr: PHY address on the MII bus
  * @fwnode: The PHY firmware handle
  * @phy_id: UID for this device found during discovery
@@ -774,6 +776,7 @@ static inline struct phy_device *to_phy_device(const struct device *dev)
 
 struct phy_device_config {
 	struct mii_bus *mii_bus;
+	struct device *parent_mdiodev;
 	int phy_addr;
 	struct fwnode_handle *fwnode;
 	u32 phy_id;

-- 
2.39.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ