From patchwork Wed Feb 8 12:40:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wentao Guan X-Patchwork-Id: 13133027 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0EF5C05027 for ; Wed, 8 Feb 2023 12:42:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229712AbjBHMmd (ORCPT ); Wed, 8 Feb 2023 07:42:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229648AbjBHMmc (ORCPT ); Wed, 8 Feb 2023 07:42:32 -0500 Received: from smtpbguseast1.qq.com (smtpbguseast1.qq.com [54.204.34.129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D2102729 for ; Wed, 8 Feb 2023 04:42:27 -0800 (PST) X-QQ-mid: bizesmtp77t1675860056tso805bk Received: from localhost.localdomain ( [113.57.152.160]) by bizesmtp.qq.com (ESMTP) with id ; Wed, 08 Feb 2023 20:40:54 +0800 (CST) X-QQ-SSF: 01400000002000C0E000B00A0000000 X-QQ-FEAT: 3M0okmaRx3jmgcz4hYfpmUXK8ue06MHIp1jsI+1nr/Jbd8I+sZC8SmjemoglJ guBpXt5vqyZ51KN7TPkY1Br65zF7JIPHR4KZ13uJ+h/sCDb0ePOFjPVtxV6evJV8Kgah0B4 ieSOyzEg+BStW0Cm+xgto/MywWcdt8S8lxg9IN7QddyipwxSwVZE4gLAp7ODRBe5fLgv3WV hRQpqOQu/xpKfK97fDiq5lZnlCZ05GcxuDAtZGQtjnTpg+7hMBbrYgCaXQOPhTki1vTwVBI VCxc6Kcpsu+gHc7LVbmIDe6x/zq5bZ10kosEE3qrAAx6GFXFML/y/Ikg4FnvBpy5RlIwMyv r7AVOxvgJkI/tw2V+dqaPA1DsMxNRNTUkwh4pk3jYTqHPfWLtSyAxqvWElPknDu9AX2BSGf IMAtvlweaBs= X-QQ-GoodBg: 2 From: Guan Wentao To: peppe.cavallaro@st.com, alexandre.torgue@foss.st.com, joabreu@synopsys.com Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, mcoquelin.stm32@gmail.com, netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Guan Wentao Subject: [PATCH] net: stmmac: get phydev->interface from mac for mdio phy init Date: Wed, 8 Feb 2023 20:40:25 +0800 Message-Id: <20230208124025.5828-1-guanwentao@uniontech.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:uniontech.com:qybglogicsvr:qybglogicsvr4 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The phy->interface from mdiobus_get_phy is default from phy_device_create. In some phy devices like at803x, use phy->interface to init rgmii delay. Use plat->phy_interface to init if know from stmmac_probe_config_dt. Fixes: 74371272f97f ("net: stmmac: Convert to phylink and remove phylib logic") Signed-off-by: Guan Wentao --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 1a5b8dab5e9b..debfcb045c22 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -1162,6 +1162,12 @@ static int stmmac_init_phy(struct net_device *dev) return -ENODEV; } + /* If we know the interface, it defines which PHY interface */ + if (priv->plat->phy_interface > 0) { + phydev->interface = priv->plat->phy_interface; + netdev_dbg(priv->dev, "Override default phy interface\n"); + } + ret = phylink_connect_phy(priv->phylink, phydev); }