From patchwork Tue Mar 29 02:49:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Chiu X-Patchwork-Id: 12794404 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 692C1C433F5 for ; Tue, 29 Mar 2022 02:51:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231269AbiC2CxV (ORCPT ); Mon, 28 Mar 2022 22:53:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230033AbiC2CxS (ORCPT ); Mon, 28 Mar 2022 22:53:18 -0400 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C59891B370B for ; Mon, 28 Mar 2022 19:51:36 -0700 (PDT) Received: by mail-pf1-x42f.google.com with SMTP id f3so13395769pfe.2 for ; Mon, 28 Mar 2022 19:51:36 -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=18aEhZqxqni23oeSOiNVFxkklmTsPbag40eOHFXJhw4=; b=kKdY1AZb7fKL9iY/FdwTBa37vrBkrrH30evEfYQ01+MS4yIuYBeQs0cLp/L1+edmuu hezLQAReiit3wsioUujFm/yjMc+PUl5toX9YEvhfplEav42cz5QrRsHhZHHlnlA9RS0J utmoHYjgEgMpiFxRuGMdxEtFPCSrZfa9wE25Usifjj6Skp6Qtc0LNOC5M0i/2hBIUkVX ZRJfGx+70V8hm2T6eEodsucp9xPuMROOoIMMRUrAIVzG69+wpdcC2AhiUsLltIYG5hNn h1xLuE3KR7ISDObCtlaYTWGUzpC5QvxKjiJ2fcHg6DgOm76yx4QZVDlBu8UgxlsXkzxs kSXg== 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=18aEhZqxqni23oeSOiNVFxkklmTsPbag40eOHFXJhw4=; b=U3fb/Dd0LdklClfPQdTjgts94+Lf7oD9ptQbZUmFjSKOkECLERgIU8gwEEXyoPjyas liKiwAskOnBZfRIWrbxRuYCLD4Gs2nau6+dFUF+qKAB9pWaIlTq6Hrm+F2r1BUfU+Ss7 ytaWNzyuIuHqnTafg0Ah7M/wugwOHxZLTTYrzOrML95jyTxRGVb/RJZrtBqr5mdAZOhu aGXQDy3bVJ/PsHw+DClPo/Nk0hG1n20Rd8Y22tTvtUT/D0+FX/WmGTr5XuSjg3ckTICy G5dm/bdh2u6H/57oQG0XBVMdad1g7D52Is0Ywhtqt3kP53zqOE91eaL4lBMs2m3Y5rJw tu8g== X-Gm-Message-State: AOAM532y3RjQSCtk2+ZSyX5ZCqAGLX6vWPI1cUyLiSQ5e2XDLprVol3E fbuBXCx4wsNcKbOJ5xoFMl4lY6j7Jn2m5GP3 X-Google-Smtp-Source: ABdhPJz7aObK2yWpJIgjdfrEy6zk/GWdVoGyZl/AA5FMJxv7fHBbQHiTIZVWOhST53EL0Ja52wlVxg== X-Received: by 2002:a63:6f4c:0:b0:386:4801:a83e with SMTP id k73-20020a636f4c000000b003864801a83emr400506pgc.184.1648522296296; Mon, 28 Mar 2022 19:51:36 -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 f14-20020a63380e000000b0038253c4d5casm14136053pga.36.2022.03.28.19.51.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Mar 2022 19:51:36 -0700 (PDT) From: Andy Chiu To: kuba@kernel.org, radhey.shyam.pandey@xilinx.com, robert.hancock@calian.com, michal.simek@xilinx.com, andrew@lunn.ch Cc: davem@davemloft.net, pabeni@redhat.com, robh+dt@kernel.org, linux@armlinux.org.uk, netdev@vger.kernel.org, devicetree@vger.kernel.org, robh@kernel.org, Andy Chiu , Greentime Hu Subject: [PATCH v7 net 1/4] net: axienet: setup mdio unconditionally Date: Tue, 29 Mar 2022 10:49:18 +0800 Message-Id: <20220329024921.2739338-2-andy.chiu@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220329024921.2739338-1-andy.chiu@sifive.com> References: <20220329024921.2739338-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 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 c7eb05e4a6bf..78a991bbbcf9 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 Tue Mar 29 02:49:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Chiu X-Patchwork-Id: 12794405 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 139CDC433EF for ; Tue, 29 Mar 2022 02:51:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231280AbiC2CxX (ORCPT ); Mon, 28 Mar 2022 22:53:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230033AbiC2CxV (ORCPT ); Mon, 28 Mar 2022 22:53:21 -0400 Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAC5824372C for ; Mon, 28 Mar 2022 19:51:39 -0700 (PDT) Received: by mail-pg1-x52d.google.com with SMTP id w21so13673864pgm.7 for ; Mon, 28 Mar 2022 19:51:39 -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=nNjhO6BEVVf5H+Lq2VF12bIUVFosCZXx6WDl+lEmwP0=; b=ZJXdKbFlcuEZt6eWZymxRstoyL2Smo1Zb7CgKI8b7Rjym/mqhigLwIegoeXPBmzgcZ CX4XDqPmULfCBrDGYUCiP4x7B8W8LdXX7CFSpKQuPADIq2f0ljdeniWWB/06Oxfz0JAj /8324ubqMW/+N9QKVaPYnkV/Vmd2crn3bFRSQSzqHhRW9LxpuW8sH/iGc/T3MNuA6/ER uRQ2UYFetLINyFJwRtHSUF/hzM1H5YwZWMcQbMiamMkw2Li2bCa1/7FEwnpyei0A8VSp alKKQPEzTsIx8J4ES0FNaLzyjX7cYvRilMuaejO1keDuFnWfQDHZCHStyIyymCUgC7T0 ysUQ== 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=nNjhO6BEVVf5H+Lq2VF12bIUVFosCZXx6WDl+lEmwP0=; b=GpAMBQn18uSPnbp6qEf4L7eEiw9Ld+4j2F1vl+Wtkg+f64FvxHs15QYthbD+s6GDze RAErcZWs4PPNgCDis+UIFUOnGLGzKZuz5mfWyVIR8hPtZw1Hvi+cCTjb28git3i/pfYR BfT5JVv0DsgLAVHPKicGFqsY7tYc9ek/BR8/zI0DZotKikbIPqV8nv40d2Fh7VNUFvsR HVwq75oAjWOdocERXIhnPV6LzECWr3De4zaj/rMIvp/IoZxVRGSc41+2yJh7wSyshVlU za1LDU85zvdvYz5R1rEH+aoINnHc0vNqE1KccLKIHEZzVnzZsxbngtTI1vLA4S+JAHGp /0zQ== X-Gm-Message-State: AOAM530ENPx53QO+XQJo/IRsPZt9Oqqmf1qTPHRi4EsI/BgKX6Wo/bVf 7zPEP2JkfPTE39rmhDC25fXZ6A== X-Google-Smtp-Source: ABdhPJxU1VmpKNtEuphzkcFx5zwYh4SI/Tg6irTKvLhhy5Ka+KZ+IpL/40UUgX0tlQCNesOGzskgzQ== X-Received: by 2002:a05:6a00:1395:b0:4fa:e546:39c3 with SMTP id t21-20020a056a00139500b004fae54639c3mr26060496pfg.33.1648522299155; Mon, 28 Mar 2022 19:51:39 -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 f14-20020a63380e000000b0038253c4d5casm14136053pga.36.2022.03.28.19.51.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Mar 2022 19:51:38 -0700 (PDT) From: Andy Chiu To: kuba@kernel.org, radhey.shyam.pandey@xilinx.com, robert.hancock@calian.com, michal.simek@xilinx.com, andrew@lunn.ch Cc: davem@davemloft.net, pabeni@redhat.com, robh+dt@kernel.org, linux@armlinux.org.uk, netdev@vger.kernel.org, devicetree@vger.kernel.org, robh@kernel.org, Andy Chiu , Greentime Hu Subject: [PATCH v7 net 2/4] net: axienet: factor out phy_node in struct axienet_local Date: Tue, 29 Mar 2022 10:49:19 +0800 Message-Id: <20220329024921.2739338-3-andy.chiu@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220329024921.2739338-1-andy.chiu@sifive.com> References: <20220329024921.2739338-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 78a991bbbcf9..3daef64a85bd 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -2071,17 +2071,19 @@ 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; } + of_node_put(np); lp->pcs.ops = &axienet_pcs_ops; lp->pcs.poll = true; } @@ -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 Tue Mar 29 02:49:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Chiu X-Patchwork-Id: 12794406 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 AAE5FC433F5 for ; Tue, 29 Mar 2022 02:51:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231286AbiC2Cx2 (ORCPT ); Mon, 28 Mar 2022 22:53:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231282AbiC2CxY (ORCPT ); Mon, 28 Mar 2022 22:53:24 -0400 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78DBB1B30BD for ; Mon, 28 Mar 2022 19:51:42 -0700 (PDT) Received: by mail-pl1-x62b.google.com with SMTP id i11so5109662plg.12 for ; Mon, 28 Mar 2022 19:51:42 -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=pp0QDLmVJXQogXrqKnxYnigTDfjr4o8XzBN1Mq4j/TQ=; b=BxYROShJo7y5nzQyhJV7J578y5kVFOGTYOK+3CC5PbEh5cH8e8jFtFs2GXQSpKNRLG 7fYdTBAEEF1g5e4rpP8vc+o13LO/st0vC3u7FpefwaZ2KKVj8MFv9GFq+0m7KxFoeXnC Gutf7+2JxCo+sAzxCbqPereILnxs9Qg8HBpHZKKTZjMNbAsGqqlKDr8iPLilOCF8PJzI z0KQJgK3OF0IKde8Ixn/KckAuV5YKPlYAW2DQYrlMqeCfiXbHRXETVnxSbNe4akA+KlP jMLYGCGAIJNgPN1GIcbzzdywuRHusHxgjlc4qmHRGc/aK75j+rtB4JTRDpkMMnIZeqK9 oKxA== 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=pp0QDLmVJXQogXrqKnxYnigTDfjr4o8XzBN1Mq4j/TQ=; b=wxktdfxbd8JG6Clm6OxL6LdFWxYDEAgXxumLiyraN6hHL61x5/RBJ8kPhOSkgF4z9I T5n9G4NAdPbBFUnKW13+6Ty6mhTUogQm+Cb/QWWE4djAATkfmRt6GdnHmbqlH7N3m332 7/lRQcYz4aRk7Oy+T61bt9QL+uECM9YcG8AGVTxah9lf8vFTsYe6yEjd/gtBVOFVXmos x+XywNaS8CKsX2LDk97AGv01dg0AqncTfRp8AK5DF60naXFQ7EwMvSwL1qO86uWREDHn XNvVokYWcdwoujGzBRlBf3Cs+a92M1KEI2b0FBWIU5hY6YyYx8rj4P6f0GsQX3OXH5y6 yhlg== X-Gm-Message-State: AOAM531RU4MADQSddcZ824IcKGny0D66/YyxKXzDn8798Vg+39DkRfNo Vq0Rts/LdZ8k4D3rsWJjJAUT0g== X-Google-Smtp-Source: ABdhPJw8ezd01KwgiMsaVFyMC8hb83WSHujUbnbJ6ija7W0AmR/80TSYfsjBsyL2HcbfjmdnYDOsQA== X-Received: by 2002:a17:90a:889:b0:1c9:8baa:3eeb with SMTP id v9-20020a17090a088900b001c98baa3eebmr2223151pjc.44.1648522301892; Mon, 28 Mar 2022 19:51:41 -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 f14-20020a63380e000000b0038253c4d5casm14136053pga.36.2022.03.28.19.51.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Mar 2022 19:51:41 -0700 (PDT) From: Andy Chiu To: kuba@kernel.org, radhey.shyam.pandey@xilinx.com, robert.hancock@calian.com, michal.simek@xilinx.com, andrew@lunn.ch Cc: davem@davemloft.net, pabeni@redhat.com, robh+dt@kernel.org, linux@armlinux.org.uk, netdev@vger.kernel.org, devicetree@vger.kernel.org, robh@kernel.org, Andy Chiu , Greentime Hu Subject: [PATCH v7 net 3/4] dt-bindings: net: add pcs-handle attribute Date: Tue, 29 Mar 2022 10:49:20 +0800 Message-Id: <20220329024921.2739338-4-andy.chiu@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220329024921.2739338-1-andy.chiu@sifive.com> References: <20220329024921.2739338-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. For Xilinx's AXI Ethernet, this is used when the core operates in SGMII or 1000Base-X modes and links through the internal PCS/PMA PHY. Signed-off-by: Andy Chiu Reviewed-by: Greentime Hu Reviewed-by: Rob Herring --- .../devicetree/bindings/net/ethernet-controller.yaml | 6 ++++++ Documentation/devicetree/bindings/net/xilinx_axienet.txt | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/net/ethernet-controller.yaml b/Documentation/devicetree/bindings/net/ethernet-controller.yaml index 817794e56227..4f15463611f8 100644 --- a/Documentation/devicetree/bindings/net/ethernet-controller.yaml +++ b/Documentation/devicetree/bindings/net/ethernet-controller.yaml @@ -106,6 +106,12 @@ properties: phy-mode: $ref: "#/properties/phy-connection-type" + pcs-handle: + $ref: /schemas/types.yaml#/definitions/phandle + description: + Specifies a reference to a node representing a PCS PHY device on a MDIO + bus to link with an external PHY (phy-handle) if exists. + phy-handle: $ref: /schemas/types.yaml#/definitions/phandle description: diff --git a/Documentation/devicetree/bindings/net/xilinx_axienet.txt b/Documentation/devicetree/bindings/net/xilinx_axienet.txt index b8e4894bc634..1aa4c6006cd0 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 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 Tue Mar 29 02:49:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Chiu X-Patchwork-Id: 12794407 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 230A3C4332F for ; Tue, 29 Mar 2022 02:51:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231288AbiC2Cx3 (ORCPT ); Mon, 28 Mar 2022 22:53:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231311AbiC2Cx2 (ORCPT ); Mon, 28 Mar 2022 22:53:28 -0400 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9AC5F24782B for ; Mon, 28 Mar 2022 19:51:45 -0700 (PDT) Received: by mail-pj1-x1032.google.com with SMTP id mr5-20020a17090b238500b001c67366ae93so916829pjb.4 for ; Mon, 28 Mar 2022 19:51:45 -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=69KBe+ckBD8jzX5UKW/PqVU7EuYsFz2uovCcu+cTKLQ=; b=kefFOh7P2gvOu1Hknqi60XLM22tTiqKntQAZMGwbSVccbY+/JMQhxjTXt0dS+k8f5G XgnKi0+sGKU7d6LiwtAZSFn9f5Yy6tGzqtlN3YYTaNQ3xCfS2aAuojKMdVE3WrUpU1qc hq2vJrhyw80omKJNWk5DzHnyfhToZ3jusD3YJjF0nXxT/JFEanwpgnSXzKi5DWOm/SjL Dduqwo5CmFJ4K1U+DZk6xrj1gcZb9+YB/gWowo+KiGZ4LlDiPQ73d1q7G21G+B+1CeZt kSkWb2mExAIrbO2CDChjwFjdkbhzPL6y6LroFnHBiOc7p4NfvZ86vs3UbOOlPK4P/5YJ FQSQ== 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=69KBe+ckBD8jzX5UKW/PqVU7EuYsFz2uovCcu+cTKLQ=; b=tB0nslV1kNiIIdVC3WXMbt7Aixm0ygb8pxcgEwWDRT9EleVeYFv2fsVjUS4YsVk2JQ v+aJL3n7kJv/lPTw6ahlCq6nbwq6ShduRgJXzf60syQHf0f/ThyPPuhOJUlyw1V6KxOt UN9rSS0BqYqOrdv9jYIt3pXIlJXc/y+4/B5Fq53Wpch0Zl7zMzuYy5//6+Ok2N4uRXPe G7na0cj2ITYjGO5PAv2Y9Chg1hhYgNeefFrU1Oc+wdtDgsji2aIT2J8anCYUiyk5GVO6 XXLwkADF9NEBI3vhW5hG3S38xtRsnveLTKvFuR/24a1/cvSFfpI2A9wS6zfpJplBR2UC ekYQ== X-Gm-Message-State: AOAM531TVrH5B70oa08WD+ChnDrQQFyVa224TRpkbEKznAciAQFGzJTs WFos8+IpEwPkzobbr7zBf6X1Ng== X-Google-Smtp-Source: ABdhPJxKYVF9pOi6zG7mM9lIOS9OdD6Ieu8NhEvre5v6UxqyqgYS1pXmw3L8Aa2GzGAtWDrRhLI2Yg== X-Received: by 2002:a17:90b:224e:b0:1c6:d9ed:576b with SMTP id hk14-20020a17090b224e00b001c6d9ed576bmr2214565pjb.26.1648522304656; Mon, 28 Mar 2022 19:51:44 -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 f14-20020a63380e000000b0038253c4d5casm14136053pga.36.2022.03.28.19.51.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Mar 2022 19:51:44 -0700 (PDT) From: Andy Chiu To: kuba@kernel.org, radhey.shyam.pandey@xilinx.com, robert.hancock@calian.com, michal.simek@xilinx.com, andrew@lunn.ch Cc: davem@davemloft.net, pabeni@redhat.com, robh+dt@kernel.org, linux@armlinux.org.uk, netdev@vger.kernel.org, devicetree@vger.kernel.org, robh@kernel.org, Andy Chiu , Greentime Hu Subject: [PATCH v7 net 4/4] net: axiemac: use a phandle to reference pcs_phy Date: Tue, 29 Mar 2022 10:49:21 +0800 Message-Id: <20220329024921.2739338-5-andy.chiu@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220329024921.2739338-1-andy.chiu@sifive.com> References: <20220329024921.2739338-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 3daef64a85bd..d6fc3f7acdf0 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; }