From patchwork Tue May 4 22:29:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 12238591 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A07AAC433ED for ; Tue, 4 May 2021 22:31:42 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 21ADA610F7 for ; Tue, 4 May 2021 22:31:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 21ADA610F7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=8Fn9264IGcMWRSIt93rTQLmxqVjlI6R12DbCLWDPzKQ=; b=mijN0Y1t5n7hqG+1ywf+fHLAO 1/e55F13tOkqjwb3eYdaO8xbeHPM9RbZCGzxT6pYrezfjLvYYA4ve9gW7p+N/odEfxurvHkbdkA0u OdFm5Z1Ov7PR9QGuUjbrPiYEoKL8GrN2vyl4B+zEmTlusUYxvr/4wm9gxeDtMoDO+EQ2ZEUnhNM1b 4XzcfuyYkN3J82Q0LtMk2sSRLHaVRUVAQ66q2A9Nba8CGfI/fCayqWBfJczm7dRYXg6tpl5DBqR/p 7NQPzDr6ZMQJ6bhFJ+XOvEhVil/T/ImYuvhZH7YvdcqRvw8MvP5uJgH+cJCz6KsEPeW4ZcQoR6Cib KHJjo9J3A==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1le3YG-00HFBW-9j; Tue, 04 May 2021 22:30:00 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1le3YD-00HFBR-R5 for linux-arm-kernel@desiato.infradead.org; Tue, 04 May 2021 22:29:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=6S33qsxdfzNRrx5uD8qxn/D0pG+Cha3VUrhtZ9or8eA=; b=gMb5AwFfqe/fbr1J7QYSsbA/gc /QhQa7ExX0tGpz1UnRKDmltmGhMOqX6HbT9585R9bJNPcAmLV/4v+gzh6OjfakQe4Wt40Oqj6+N/k gfQtDZgvf3WyIOZh5kxEAybeXP9/i5egGHGAfO3DUZ4tnP92wZb4n6rUpGvfSUC76Y6sPOqFa/++h YC4QMRWyvhE44jw6KBnDamPSzyPpn6OdG2QhwN3uqvuG39mzJ/w8ElO4X7sFlo8Yjm7AGuO1rVvUv ELVMZHf3X0c0dIMEqA6AG3bFPJNq2UpWm+1/YBqfR7wY5NbT2p4/3D2crvcE6xGZ1zZuTQXmGVN0H Fil4WPmA==; Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1le3YB-004JBg-4B for linux-arm-kernel@lists.infradead.org; Tue, 04 May 2021 22:29:56 +0000 Received: by mail-ej1-x62f.google.com with SMTP id w3so15604779ejc.4 for ; Tue, 04 May 2021 15:29:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6S33qsxdfzNRrx5uD8qxn/D0pG+Cha3VUrhtZ9or8eA=; b=ergPdIRGrf9B9JpDTdJaC+eY+7IYGzqdoaTeAIpm9a0HIKai5p6Shtx2tgV9L2IFeC LmnO0NNN2+YyE/ezRAqRcas/X6fBDoxQEiWdI9h28ZOwKyljtEENVE3dFOSd2p7ZgDkP KbGQ9FPUTIUIApVNO/GGynhMHLYPR7RxUWPzNjPQ3R5B2IVB6AEaxItlzjIzZYPRv7F0 6feNEp+cMlibnaM6/BlarXYynAEcn2oQjX98NuKZjYsNOj3MIbtfdSQ+PemUiLht8nev pxaTVTuccjCRnC79HfGumiaC0XKTij8xBJKJhHymes1qmqa8P4BRGHqSjSX/ptxbnLNb WaCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6S33qsxdfzNRrx5uD8qxn/D0pG+Cha3VUrhtZ9or8eA=; b=NR2neyBLfEJtF4N6GYEkUbn8c3J7qDga22DJhsqKFFghCBAnT8iOg8THLlkbhAJJ35 eC3L+ELI6G9V2Q/JOlrvbJWiGJyy+bydJIPMqtJrUeMUBfM0YgAHmNdKNy9PU1OYPlTi 92CVeRQKeqmLnjkXu9ExeRFNt9o/yrEBqX6neR60dnzcr3jI/bAh88ghF8TGwef1eFd1 1SmYMZjF7yPF3pzA+YuUebMJ601bHxeqPKMJAU5tZIr9jYuTbWjBRnSPkrI32vVbdtbX QZv8o7fEGLBs2leUqvb8Dmhra7s2ElxnQ51lGFRqo5LX9gvj4naqTUJMIV4+7h5bE+7I ylMQ== X-Gm-Message-State: AOAM531LGSyUlW79cV+V0uDKDfwIwfBPGqOnnSw7Tj5pHO80kgPyCIa/ IjtPKJcTAA8CfXZ52tkj/Ak= X-Google-Smtp-Source: ABdhPJzY14RFxCWkRfWoxjufaU3Vb/MDZb5AXGaItoX+yOEZfY5E8S5JuKsWwWEr7ADZAMP3kDh4Ng== X-Received: by 2002:a17:906:52d7:: with SMTP id w23mr24941244ejn.451.1620167392751; Tue, 04 May 2021 15:29:52 -0700 (PDT) Received: from Ansuel-xps.localdomain (93-35-189-2.ip56.fastwebnet.it. [93.35.189.2]) by smtp.googlemail.com with ESMTPSA id q12sm2052946ejy.91.2021.05.04.15.29.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 May 2021 15:29:52 -0700 (PDT) From: Ansuel Smith To: Florian Fainelli Subject: [RFC PATCH net-next v3 17/20] net: phy: phylink: permit to pass dev_flags to phylink_connect_phy Date: Wed, 5 May 2021 00:29:11 +0200 Message-Id: <20210504222915.17206-17-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210504222915.17206-1-ansuelsmth@gmail.com> References: <20210504222915.17206-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210504_152955_196170_32D8ECE2 X-CRM114-Status: GOOD ( 19.69 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Lunn , linux-kernel@vger.kernel.org, Alexandre Torgue , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, Vivien Didelot , Claudiu Beznea , Ansuel Smith , Jose Abreu , linux-arm-kernel@lists.infradead.org, Maxime Coquelin , Giuseppe Cavallaro , Jakub Kicinski , Vladimir Oltean , "David S. Miller" , Russell King , Heiner Kallweit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add support for phylink_connect_phy to pass dev_flags to the PHY driver. Change any user of phylink_connect_phy to pass 0 as dev_flags by default. Signed-off-by: Ansuel Smith --- drivers/net/ethernet/cadence/macb_main.c | 2 +- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +- drivers/net/phy/phylink.c | 12 +++++++----- include/linux/phylink.h | 2 +- net/dsa/slave.c | 2 +- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index 0f6a6cb7e98d..459243c08b0c 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -834,7 +834,7 @@ static int macb_phylink_connect(struct macb *bp) } /* attach the mac to the phy */ - ret = phylink_connect_phy(bp->phylink, phydev); + ret = phylink_connect_phy(bp->phylink, phydev, 0); } if (ret) { diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 4749bd0af160..ece84bb64b37 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -1099,7 +1099,7 @@ static int stmmac_init_phy(struct net_device *dev) return -ENODEV; } - ret = phylink_connect_phy(priv->phylink, phydev); + ret = phylink_connect_phy(priv->phylink, phydev, 0); } phylink_ethtool_get_wol(priv->phylink, &wol); diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index dc2800beacc3..95f6a10e90ef 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -1018,7 +1018,7 @@ static int phylink_bringup_phy(struct phylink *pl, struct phy_device *phy, } static int phylink_attach_phy(struct phylink *pl, struct phy_device *phy, - phy_interface_t interface) + phy_interface_t interface, u32 flags) { if (WARN_ON(pl->cfg_link_an_mode == MLO_AN_FIXED || (pl->cfg_link_an_mode == MLO_AN_INBAND && @@ -1028,13 +1028,14 @@ static int phylink_attach_phy(struct phylink *pl, struct phy_device *phy, if (pl->phydev) return -EBUSY; - return phy_attach_direct(pl->netdev, phy, 0, interface); + return phy_attach_direct(pl->netdev, phy, flags, interface); } /** * phylink_connect_phy() - connect a PHY to the phylink instance * @pl: a pointer to a &struct phylink returned from phylink_create() * @phy: a pointer to a &struct phy_device. + * @flags: PHY-specific flags to communicate to the PHY device driver * * Connect @phy to the phylink instance specified by @pl by calling * phy_attach_direct(). Configure the @phy according to the MAC driver's @@ -1046,7 +1047,8 @@ static int phylink_attach_phy(struct phylink *pl, struct phy_device *phy, * * Returns 0 on success or a negative errno. */ -int phylink_connect_phy(struct phylink *pl, struct phy_device *phy) +int phylink_connect_phy(struct phylink *pl, struct phy_device *phy, + u32 flags) { int ret; @@ -1056,7 +1058,7 @@ int phylink_connect_phy(struct phylink *pl, struct phy_device *phy) pl->link_config.interface = pl->link_interface; } - ret = phylink_attach_phy(pl, phy, pl->link_interface); + ret = phylink_attach_phy(pl, phy, pl->link_interface, flags); if (ret < 0) return ret; @@ -2207,7 +2209,7 @@ static int phylink_sfp_connect_phy(void *upstream, struct phy_device *phy) return ret; interface = pl->link_config.interface; - ret = phylink_attach_phy(pl, phy, interface); + ret = phylink_attach_phy(pl, phy, interface, 0); if (ret < 0) return ret; diff --git a/include/linux/phylink.h b/include/linux/phylink.h index d81a714cfbbd..cd563ba67ca0 100644 --- a/include/linux/phylink.h +++ b/include/linux/phylink.h @@ -437,7 +437,7 @@ struct phylink *phylink_create(struct phylink_config *, struct fwnode_handle *, void phylink_set_pcs(struct phylink *, struct phylink_pcs *pcs); void phylink_destroy(struct phylink *); -int phylink_connect_phy(struct phylink *, struct phy_device *); +int phylink_connect_phy(struct phylink *, struct phy_device *, u32 flags); int phylink_of_phy_connect(struct phylink *, struct device_node *, u32 flags); void phylink_disconnect_phy(struct phylink *); diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 992fcab4b552..8ecfcb553ac1 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -1718,7 +1718,7 @@ static int dsa_slave_phy_connect(struct net_device *slave_dev, int addr) return -ENODEV; } - return phylink_connect_phy(dp->pl, slave_dev->phydev); + return phylink_connect_phy(dp->pl, slave_dev->phydev, 0); } static int dsa_slave_phy_setup(struct net_device *slave_dev)