Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp411982rwl; Wed, 5 Apr 2023 02:29:30 -0700 (PDT) X-Google-Smtp-Source: AKy350Z+eRM54y2BLeFADHHRxjO3J2xi70e2KGs7+P5Fi/KCL9J1rSPre2VeRippyU9bn69XKEFJ X-Received: by 2002:a05:6a20:3542:b0:d9:43a5:8cd0 with SMTP id f2-20020a056a20354200b000d943a58cd0mr3783806pze.14.1680686970404; Wed, 05 Apr 2023 02:29:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680686970; cv=none; d=google.com; s=arc-20160816; b=bWoY5qtsJAWUJGDqHK2p7hZ73qB4VWsZHHHbw47dCLVoagrUjjB8jKy9g87o4YaK7F cO98y3a7qyOmNtH+VXEv38EJUbqmmNLbxVuYAXF+B/R+oSacwcygA3cC17AWxAzUdAXW vHt2GUVUSJKnwsZaD9munsWaiM9vSJtrHWpu+LJ2eRp7rOtNmZzvvcZt+vZRu8UVMDQX XStBaZjPhb2cgvIaZaoDXyHce3bn5fx6geFVe5YhGrCXaaJIp7orCsyATwBVX8k0WYCd WxXFm5zhP7Wwi21XSec/Ggn7rMwAk1PN7yJesUdFzLbH/yn5zVWD3Q7qMRlvm8WX0AuZ faig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from; bh=2Y97dAKZ6jsxpvDgseF62ItvB+IesdBb2uOvfw0Qrm0=; b=MeSMZssGtYwhTd6foA+15fVovBbnsbb7nT6gWcz44TSNjN0LocS6VGA7pHD2Jnigsm 0aM6QlRxmnDjkZQ1JAYoHNCS4Q6wCKUl6JO1cJiQsfImOH0mgMjQlvtmN15j9qmbmGx1 eLYDJxxwVYfEzt6vwtLomcclOjLIqITX1ArwRgAiyAHtwFA5Rd4IZNtLa6XGKUhXAAw5 PVFSKVBfzoYomCeJ2KgyDvgYlNr/htaV6nrZ2UeHW9VZXh34U2qNByelXnAfpMWBvSoa OuQsMb3MCYZEhigxee9HocwExOFIAhD+eTIHmVrlEn5nVfLyVDM/dU7zmHfWtbN6v49W jNiw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r11-20020a63514b000000b0050726756edesi11484961pgl.76.2023.04.05.02.29.18; Wed, 05 Apr 2023 02:29:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237646AbjDEJ2z (ORCPT + 99 others); Wed, 5 Apr 2023 05:28:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237517AbjDEJ2b (ORCPT ); Wed, 5 Apr 2023 05:28:31 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59D294C17 for ; Wed, 5 Apr 2023 02:28:04 -0700 (PDT) Received: from dude02.red.stw.pengutronix.de ([2a0a:edc0:0:1101:1d::28]) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1pjzQ6-0004pA-Oy; Wed, 05 Apr 2023 11:27:10 +0200 From: Marco Felsch Date: Wed, 05 Apr 2023 11:26:59 +0200 Subject: [PATCH 08/12] net: phy: add possibility to specify mdio device parent MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230405-net-next-topic-net-phy-reset-v1-8-7e5329f08002@pengutronix.de> References: <20230405-net-next-topic-net-phy-reset-v1-0-7e5329f08002@pengutronix.de> In-Reply-To: <20230405-net-next-topic-net-phy-reset-v1-0-7e5329f08002@pengutronix.de> To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Florian Fainelli , Broadcom internal kernel review list , Richard Cochran , Radu Pirea , Shyam Sundar S K , Yisen Zhuang , Salil Mehta , Jassi Brar , Ilias Apalodimas , Iyappan Subramanian , Keyur Chudgar , Quan Nguyen , "Rafael J. Wysocki" , Len Brown , Rob Herring , Frank Rowand Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, devicetree@vger.kernel.org, kernel@pengutronix.de X-Mailer: b4 0.12.1 X-SA-Exim-Connect-IP: 2a0a:edc0:0:1101:1d::28 X-SA-Exim-Mail-From: m.felsch@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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