From patchwork Mon Mar 21 15:25:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Chiu X-Patchwork-Id: 12787390 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 B95BCC433FE for ; Mon, 21 Mar 2022 15:27:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350177AbiCUP2j (ORCPT ); Mon, 21 Mar 2022 11:28:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241364AbiCUP2i (ORCPT ); Mon, 21 Mar 2022 11:28:38 -0400 Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C1A0160FDC for ; Mon, 21 Mar 2022 08:27:13 -0700 (PDT) Received: by mail-pg1-x52a.google.com with SMTP id 6so10547854pgg.0 for ; Mon, 21 Mar 2022 08:27:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=pYfXEHfZl09/d0W/8k6bn6GHeCrNBUTTAtovTezahB8=; b=SsAGVFcNjJmV8fMQbUyG7TiYJXK2+32iN/1XMrye7xFZFnwPrpwxT6DyJ3Y/rRRDr7 5uCZqKj+BhyDIO26VKMm/iKlT2Evf0yTKoOj5CPhLL5k2VOxlx42W/oPVzytc48Or8Qj MvDiR7ItkG9up8TfH/vHxgn5tS4tmsgk8MgrphVO1MVe5YUTOjKbEkpmvIhNUp67OlsI y3j5DkywFu6uUP2ZkhqcNAPDdk7/fphPgaY0FN2ieWv6mCE1dsvC5b/8d1CfP70J/v1/ fjI1vaH5C1cjLBtfzgRajpdkJOhiwgVZrMCmLoiKIe7z/34AeW7zxouMEyc8NfIiqU1S 5cDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=pYfXEHfZl09/d0W/8k6bn6GHeCrNBUTTAtovTezahB8=; b=O2S8co1bPX4ubU8DkfunxkOYoJMTW6XecRs/lM4MNnd01e4QcLJUoS8g5i/MR+aCq8 Mx67LBjlSqG5l4UqUDGVbvgjyAoklQ+URCajJc9Ox6ol5L9JJbdhwO9IVbfxBCZE+nCc YFcKF6qkeGV6TIE3qOVlCfHbOjQMZi4osax5RFNdQ7GlzUES67q1mZzH3lQeVYpoA3a8 PM/CA6TiHZeOyoT/+I9X9SjwxQpd7xb4lIdoDCyNcEnD3IolJrnA2Ep9kHmmKxpNAsOY EiJesUIX2nNhbsOmV0ZWjBItgqKJNYTFLvr3LZx5yNJeaDUqQV4pf/n4KVEGrecDVtjF YYtQ== X-Gm-Message-State: AOAM533QSDBpiWKBPl5Prix2TOesqVFBqZX9wkcnMa2lDWew9KatbmkC VPWJLDGeWZsd+urkghRLoYtnww== X-Google-Smtp-Source: ABdhPJwh1907hH4HbirjpJw7g0In/BLkgy+uXWdIJGQYLEHnZlrq68MS04W6NEiEWxXi8lNC6Bhkzg== X-Received: by 2002:a05:6a00:1152:b0:4be:ab79:fcfa with SMTP id b18-20020a056a00115200b004beab79fcfamr24585061pfm.3.1647876432798; Mon, 21 Mar 2022 08:27:12 -0700 (PDT) Received: from archlinux.internal.sifive.com (59-124-168-89.hinet-ip.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id i15-20020a63b30f000000b003803aee35a2sm15342644pgf.31.2022.03.21.08.27.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 08:27:12 -0700 (PDT) From: Andy Chiu To: radhey.shyam.pandey@xilinx.com, robert.hancock@calian.com, michal.simek@xilinx.com Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, robh+dt@kernel.org, linux@armlinux.org.uk, andrew@lunn.ch, netdev@vger.kernel.org, devicetree@vger.kernel.org, Andy Chiu , Greentime Hu Subject: [PATCH v4 1/4] net: axienet: setup mdio unconditionally Date: Mon, 21 Mar 2022 23:25:12 +0800 Message-Id: <20220321152515.287119-1-andy.chiu@sifive.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The call to axienet_mdio_setup should not depend on whether "phy-node" pressents on the DT. Besides, since `lp->phy_node` is used if PHY is in SGMII or 100Base-X modes, move it into the if statement. And the next patch will remove `lp->phy_node` from driver's private structure and do an of_node_put on it right away after use since it is not used elsewhere. Signed-off-by: Andy Chiu Reviewed-by: Greentime Hu Reviewed-by: Robert Hancock --- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c index 6fd5157f0a6d..5d41b8de840a 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -2064,15 +2064,14 @@ static int axienet_probe(struct platform_device *pdev) if (ret) goto cleanup_clk; - lp->phy_node = of_parse_phandle(pdev->dev.of_node, "phy-handle", 0); - if (lp->phy_node) { - ret = axienet_mdio_setup(lp); - if (ret) - dev_warn(&pdev->dev, - "error registering MDIO bus: %d\n", ret); - } + ret = axienet_mdio_setup(lp); + if (ret) + dev_warn(&pdev->dev, + "error registering MDIO bus: %d\n", ret); + if (lp->phy_mode == PHY_INTERFACE_MODE_SGMII || lp->phy_mode == PHY_INTERFACE_MODE_1000BASEX) { + lp->phy_node = of_parse_phandle(pdev->dev.of_node, "phy-handle", 0); if (!lp->phy_node) { dev_err(&pdev->dev, "phy-handle required for 1000BaseX/SGMII\n"); ret = -EINVAL; From patchwork Mon Mar 21 15:25:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Chiu X-Patchwork-Id: 12787391 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 BA730C433F5 for ; Mon, 21 Mar 2022 15:27:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350181AbiCUP2o (ORCPT ); Mon, 21 Mar 2022 11:28:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350180AbiCUP2n (ORCPT ); Mon, 21 Mar 2022 11:28:43 -0400 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C952D1667C4 for ; Mon, 21 Mar 2022 08:27:17 -0700 (PDT) Received: by mail-pj1-x1034.google.com with SMTP id o68-20020a17090a0a4a00b001c686a48263so183088pjo.1 for ; Mon, 21 Mar 2022 08:27:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WOMAaXlQRUlLiSNkBnquJYnNiE2xzRYHVaIsswt04t4=; b=Ow8PFHJOnBRVZo6R522dIh1n1CERy36l6DYFUrIenFfOKv9J6szwTNXfFZW0uoKaSJ GWzqvIcnRwErw5ePdblMZTEI/Ta10Rvx9ygiqiDYIwqPVYaFr7Lcr5TH220j/XwaPnll /zXnfl617UsemB/o2RBnGV+BFYSvo1OwGdcXv96qFJZ+SS+C27ayqWW3EAPBbUhA0Hj8 CEqEpITrw2OGezLi8MNgLvp9oMiCuEqWnnp0u/Z9hWqZq/MnYvzdjmkmZedphyAQEyAt On/p235wMu+nH2BLGkjTxwVJJr/wQBPrudXlo0BZXItPiqRGGJgAuPJd0OzXH0WfciwT I/ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WOMAaXlQRUlLiSNkBnquJYnNiE2xzRYHVaIsswt04t4=; b=Jc32dIbBY3/4r9/ZbMk0VL0HxwLHXQ6YONGpvkjmwBmnCnzdW0wqWxYE8h1g0nC84W TuutZZsvdMpUL0GihDTj0jRp5K5TRx65xTrRgdnlJWKTUiyeQSOwBp0U74Pw98V21dMd 4aaZnPn1JGaEdAikykq+XjcSwZn7Gqmj3ItpHCUBHkbg3D9JBqXFcqBZiPBZ+A9BtDv6 rB0bCoQfZwqqTXtKjC2F4ywxJ2C2CvtD9Uzz04kVYsTsKuuNcNvJ93eUVwVk2WNfXwmR Qm16F5kihOmp7OyVkunzclWQurqyv/3r2P0oPO/9LoyUVhcygPjul/bW9Xbc7selACR+ RJMg== X-Gm-Message-State: AOAM533vXPPN6m5uzj/z6i2Wcwd108zte9fnZMPDE7ImSEDWebxm94oC uYcJFzadSpWAJgKRMPsCOUELtg== X-Google-Smtp-Source: ABdhPJywiENEymUJRhKHBOhusQLS235M2useu9biRbGUM6lKPMYabnvqEdDPw3P8M2t5blbcLCqYpA== X-Received: by 2002:a17:90a:fb4e:b0:1bc:8227:edd9 with SMTP id iq14-20020a17090afb4e00b001bc8227edd9mr26549567pjb.56.1647876437340; Mon, 21 Mar 2022 08:27:17 -0700 (PDT) Received: from archlinux.internal.sifive.com (59-124-168-89.hinet-ip.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id i15-20020a63b30f000000b003803aee35a2sm15342644pgf.31.2022.03.21.08.27.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 08:27:17 -0700 (PDT) From: Andy Chiu To: radhey.shyam.pandey@xilinx.com, robert.hancock@calian.com, michal.simek@xilinx.com Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, robh+dt@kernel.org, linux@armlinux.org.uk, andrew@lunn.ch, netdev@vger.kernel.org, devicetree@vger.kernel.org, Andy Chiu , Greentime Hu Subject: [PATCH v4 2/4] net: axienet: factor out phy_node in struct axienet_local Date: Mon, 21 Mar 2022 23:25:13 +0800 Message-Id: <20220321152515.287119-2-andy.chiu@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220321152515.287119-1-andy.chiu@sifive.com> References: <20220321152515.287119-1-andy.chiu@sifive.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org the struct member `phy_node` of struct axienet_local is not used by the driver anymore after initialization. It might be a remnent of old code and could be removed. Signed-off-by: Andy Chiu Reviewed-by: Greentime Hu Reviewed-by: Robert Hancock --- drivers/net/ethernet/xilinx/xilinx_axienet.h | 2 -- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 13 +++++-------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet.h b/drivers/net/ethernet/xilinx/xilinx_axienet.h index 0f9c88dd1a4a..d5c1e5c4a508 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet.h +++ b/drivers/net/ethernet/xilinx/xilinx_axienet.h @@ -433,8 +433,6 @@ struct axienet_local { struct net_device *ndev; struct device *dev; - struct device_node *phy_node; - struct phylink *phylink; struct phylink_config phylink_config; diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c index 5d41b8de840a..496a9227e760 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -2071,19 +2071,21 @@ static int axienet_probe(struct platform_device *pdev) if (lp->phy_mode == PHY_INTERFACE_MODE_SGMII || lp->phy_mode == PHY_INTERFACE_MODE_1000BASEX) { - lp->phy_node = of_parse_phandle(pdev->dev.of_node, "phy-handle", 0); - if (!lp->phy_node) { + np = of_parse_phandle(pdev->dev.of_node, "phy-handle", 0); + if (!np) { dev_err(&pdev->dev, "phy-handle required for 1000BaseX/SGMII\n"); ret = -EINVAL; goto cleanup_mdio; } - lp->pcs_phy = of_mdio_find_device(lp->phy_node); + lp->pcs_phy = of_mdio_find_device(np); if (!lp->pcs_phy) { ret = -EPROBE_DEFER; + of_node_put(np); goto cleanup_mdio; } lp->pcs.ops = &axienet_pcs_ops; lp->pcs.poll = true; + of_node_put(np); } lp->phylink_config.dev = &ndev->dev; @@ -2124,8 +2126,6 @@ static int axienet_probe(struct platform_device *pdev) put_device(&lp->pcs_phy->dev); if (lp->mii_bus) axienet_mdio_teardown(lp); - of_node_put(lp->phy_node); - cleanup_clk: clk_bulk_disable_unprepare(XAE_NUM_MISC_CLOCKS, lp->misc_clks); clk_disable_unprepare(lp->axi_clk); @@ -2154,9 +2154,6 @@ static int axienet_remove(struct platform_device *pdev) clk_bulk_disable_unprepare(XAE_NUM_MISC_CLOCKS, lp->misc_clks); clk_disable_unprepare(lp->axi_clk); - of_node_put(lp->phy_node); - lp->phy_node = NULL; - free_netdev(ndev); return 0; From patchwork Mon Mar 21 15:25:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Chiu X-Patchwork-Id: 12787392 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 4D8DBC433EF for ; Mon, 21 Mar 2022 15:27:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350196AbiCUP2u (ORCPT ); Mon, 21 Mar 2022 11:28:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350199AbiCUP2s (ORCPT ); Mon, 21 Mar 2022 11:28:48 -0400 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1609166E3D for ; Mon, 21 Mar 2022 08:27:22 -0700 (PDT) Received: by mail-pf1-x430.google.com with SMTP id g19so15711809pfc.9 for ; Mon, 21 Mar 2022 08:27:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=aR/xL3zhW/jH9L6b+OfqzbjvxqecSpBKEGwgvd3h444=; b=lH8GJ/0ITLjgsPwiCQ6m++4BZpdTkeHbewIci+fnfUB4Ttc+XdgZyxrTWkqsc5QMeT u2vgdBL1cakiJdNplQd0Kw3YmnvNQthBpiLpVBNz4lVLMEazT1xQIRQvN2scQpiaERzr gUFoRVt3WzJROOIg/8tCF9WxXORzKEFB6AM2KC3Wmx81BDdfNWFrhVXFzKyKLsgRGtrY i528zSVfpqYB8g5SeRQKNlWdqiQlKRR9w3EzzJUD9RQgOC51NjmGZ9I/7U927eGSBAQ7 u3nbDQsjnE4MMiPFzQDEh/G/sCRRDjrMTqLc6S4c3IAhzprKemyHduben8+4dsx+Qwv+ 0wqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aR/xL3zhW/jH9L6b+OfqzbjvxqecSpBKEGwgvd3h444=; b=oaDA263I2g2k9Up54kVJCzppytU3GZnV/hWDMkQfd1gOwXcFGj0GzGGWhveh5wvtCV ppbXqIn8knXecBt8IYMZCwAM/qX9GzdPGBK1nVEZhuvND0kjSlx3s7hXdD62oPFfcT++ 1xXIYrYNoOutI+gW7h/zokaAcADOMIMMYfQyphpRFZNfPCB1eOAWcdUjeV7UyIma4KH5 tbtOkdHaZP5kUaztdfGBA9HzsErROEhiy2ovp9LiEG/h07kXFObEemISfrb9dJlPbKPd lniiOHATWbO198eg4Sd0aqtxeG4+bCmI10FLZBHX6Ht5jwn5yrBDZrOsfxzQLSk9o7y3 xhUw== X-Gm-Message-State: AOAM532UPlkFLyS1diZJAhwmyo8w34rd0Fv+s/tVIv1ManrMbFOO/tgR eJ7MTG2sjwrbUITXzqidJHuCQQ== X-Google-Smtp-Source: ABdhPJwXnpH427HdELYj+gt2y/0ZBHzRctKDjrOqm4wj5kGZ3eWi+xzr1/sD4t/JiXdq6pwymBcJWw== X-Received: by 2002:a65:5b43:0:b0:382:1f25:eaef with SMTP id y3-20020a655b43000000b003821f25eaefmr15334098pgr.590.1647876442442; Mon, 21 Mar 2022 08:27:22 -0700 (PDT) Received: from archlinux.internal.sifive.com (59-124-168-89.hinet-ip.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id i15-20020a63b30f000000b003803aee35a2sm15342644pgf.31.2022.03.21.08.27.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 08:27:22 -0700 (PDT) From: Andy Chiu To: radhey.shyam.pandey@xilinx.com, robert.hancock@calian.com, michal.simek@xilinx.com Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, robh+dt@kernel.org, linux@armlinux.org.uk, andrew@lunn.ch, netdev@vger.kernel.org, devicetree@vger.kernel.org, Andy Chiu , Greentime Hu Subject: [PATCH v4 3/4] dt-bindings: net: xilinx_axienet: add pcs-handle attribute Date: Mon, 21 Mar 2022 23:25:14 +0800 Message-Id: <20220321152515.287119-3-andy.chiu@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220321152515.287119-1-andy.chiu@sifive.com> References: <20220321152515.287119-1-andy.chiu@sifive.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Document the new pcs-handle attribute to support connecting to an external PHY in SGMII or 1000Base-X modes through the internal PCS/PMA PHY. Signed-off-by: Andy Chiu Reviewed-by: Greentime Hu --- Documentation/devicetree/bindings/net/xilinx_axienet.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/net/xilinx_axienet.txt b/Documentation/devicetree/bindings/net/xilinx_axienet.txt index b8e4894bc634..ba720a2ea5fc 100644 --- a/Documentation/devicetree/bindings/net/xilinx_axienet.txt +++ b/Documentation/devicetree/bindings/net/xilinx_axienet.txt @@ -26,7 +26,8 @@ Required properties: specified, the TX/RX DMA interrupts should be on that node instead, and only the Ethernet core interrupt is optionally specified here. -- phy-handle : Should point to the external phy device. +- phy-handle : Should point to the external phy device if exists. Pointing + this to the PCS/PMA PHY is deprecated and should be avoided. See ethernet.txt file in the same directory. - xlnx,rxmem : Set to allocated memory buffer for Rx/Tx in the hardware @@ -68,6 +69,11 @@ Optional properties: required through the core's MDIO interface (i.e. always, unless the PHY is accessed through a different bus). + - pcs-handle: Phandle to the internal PCS/PMA PHY in SGMII or 1000Base-X + modes, where "pcs-handle" should be preferably used to point + to the PCS/PMA PHY, and "phy-handle" should point to an + external PHY if exists. + Example: axi_ethernet_eth: ethernet@40c00000 { compatible = "xlnx,axi-ethernet-1.00.a"; From patchwork Mon Mar 21 15:25:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Chiu X-Patchwork-Id: 12787393 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 32228C433F5 for ; Mon, 21 Mar 2022 15:27:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350192AbiCUP27 (ORCPT ); Mon, 21 Mar 2022 11:28:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350202AbiCUP2x (ORCPT ); Mon, 21 Mar 2022 11:28:53 -0400 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0E6F160C06 for ; Mon, 21 Mar 2022 08:27:27 -0700 (PDT) Received: by mail-pl1-x62d.google.com with SMTP id i11so12369323plr.1 for ; Mon, 21 Mar 2022 08:27:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=byyRM7FRPcTp0/TWjhs6tA/Rpn9nRn9/ZHQ+fneiAdg=; b=e8A0RJMdeku8s8Xs22hqidjph/JGEqCzluM0p1RfKcm8juV1+4CrAhmNipqkXYSvaW 3Y0xqC/C1mLl+HIOlluKTJ5HB7wDykwPET4cSQVRSAsseNj+6QDw5gwy8lZl9Zi6nByR y2YNIPel0XgMJy+erR+Ni13RuFhsiyHVwi6LUzqIWDran2cES3KieXacc3r9ipSqe4qE Us4aJoFowC33UjcPmzUMeyDji6sYyrUcKq4bt9ec87y3ijrtbzhm3RN1WbJR6EM1GRsV 9GwP7y08lmrr007OyteCJUTvlDa4qP8Dmkh3UHv03QZ0PMPCw+VjS9YYQq1MnOcnjiGy yl4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=byyRM7FRPcTp0/TWjhs6tA/Rpn9nRn9/ZHQ+fneiAdg=; b=Y9WvotBw+6tYRBMRNb2FHRPtA2WkfEZR+0cyuGo7iBTcJHq/AHrd8g4CP3fcAooCqm OT8xL5kmI/W51k2bKz8/FPwkDuHIR1eBdc6iFtPhowBFhinzDrOzM8aVWeIgRFGawLv+ Pt2a3LnCnCOQsa1k/ZPXf7FgA9Pjxz6uOn32lOjRkVwfqeRTghzMM5eFX07c8VWiVtH7 8b485hHDPGaa2N5L3euxR5yWcICFT+lrIO03PoU0iW9WaVkBsSxaHt6tBCqURsb+S8Tj rqgeCAjsvOdQk5UKu53yO51HFpWct7BBwIQroJ6MlI+qaMVYS68sy9tJNHNODwJLoUo5 Wifw== X-Gm-Message-State: AOAM530t8cl/Py2u60uW5bMyIImkk/zNdp0ddPUlETHFwuiiCFhsyIOB fjuVR7nTRcshrxcgHt5Uqa3H/A== X-Google-Smtp-Source: ABdhPJznwl4ki1kBF4LNxWVBRGlWNXhrqi3Ku39jK3D4COpS1ubm0QiSPvp7jK2IbWkcGMQChutNow== X-Received: by 2002:a17:903:234c:b0:154:317:3828 with SMTP id c12-20020a170903234c00b0015403173828mr13478816plh.123.1647876447455; Mon, 21 Mar 2022 08:27:27 -0700 (PDT) Received: from archlinux.internal.sifive.com (59-124-168-89.hinet-ip.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id i15-20020a63b30f000000b003803aee35a2sm15342644pgf.31.2022.03.21.08.27.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 08:27:27 -0700 (PDT) From: Andy Chiu To: radhey.shyam.pandey@xilinx.com, robert.hancock@calian.com, michal.simek@xilinx.com Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, robh+dt@kernel.org, linux@armlinux.org.uk, andrew@lunn.ch, netdev@vger.kernel.org, devicetree@vger.kernel.org, Andy Chiu , Greentime Hu Subject: [PATCH v4 4/4] net: axiemac: use a phandle to reference pcs_phy Date: Mon, 21 Mar 2022 23:25:15 +0800 Message-Id: <20220321152515.287119-4-andy.chiu@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220321152515.287119-1-andy.chiu@sifive.com> References: <20220321152515.287119-1-andy.chiu@sifive.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org In some SGMII use cases where both a fixed link external PHY and the internal PCS/PMA PHY need to be configured, we should explicitly use a phandle "pcs-phy" to get the reference to the PCS/PMA PHY. Otherwise, the driver would use "phy-handle" in the DT as the reference to both the external and the internal PCS/PMA PHY. In other cases where the core is connected to a SFP cage, we could still point phy-handle to the intenal PCS/PMA PHY, and let the driver connect to the SFP module, if exist, via phylink. Fixes: 1a02556086fc (net: axienet: Properly handle PCS/PMA PHY for 1000BaseX mode) Signed-off-by: Andy Chiu Reviewed-by: Greentime Hu Reviewed-by: Robert Hancock --- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c index 496a9227e760..163753508464 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -2071,9 +2071,16 @@ static int axienet_probe(struct platform_device *pdev) if (lp->phy_mode == PHY_INTERFACE_MODE_SGMII || lp->phy_mode == PHY_INTERFACE_MODE_1000BASEX) { - np = of_parse_phandle(pdev->dev.of_node, "phy-handle", 0); + np = of_parse_phandle(pdev->dev.of_node, "pcs-handle", 0); if (!np) { - dev_err(&pdev->dev, "phy-handle required for 1000BaseX/SGMII\n"); + /* Deprecated: Always use "pcs-handle" for pcs_phy. + * Falling back to "phy-handle" here is only for + * backward compatibility with old device trees. + */ + np = of_parse_phandle(pdev->dev.of_node, "phy-handle", 0); + } + if (!np) { + dev_err(&pdev->dev, "pcs-handle (preferred) or phy-handle required for 1000BaseX/SGMII\n"); ret = -EINVAL; goto cleanup_mdio; }