From patchwork Wed Mar 23 18:00: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: 12790023 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 E3F2EC433EF for ; Wed, 23 Mar 2022 18:02:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343919AbiCWSEF (ORCPT ); Wed, 23 Mar 2022 14:04:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343917AbiCWSEE (ORCPT ); Wed, 23 Mar 2022 14:04:04 -0400 Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3089887B7 for ; Wed, 23 Mar 2022 11:02:33 -0700 (PDT) Received: by mail-pg1-x530.google.com with SMTP id w21so1768196pgm.7 for ; Wed, 23 Mar 2022 11:02:33 -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=qQ1E9vaYcbwB4kkyy3glJ3m1Y05xvh8o6YtkdTT7sgU=; b=ADCQYwnsYTuQVfKVb77+jTY66sthiMnCvTTBS5pnIc53UJayaHRJ2rzjk9CnwEF5bj 3LRQBHLloVGcwOo+3c/HrgTNLhJm6nZXITHmB2HdMtSc63lVtui/qbAfhB0Zzm72VUHB 347FFEiQvA/qIMxvtjh2V4EMo2joacOJuWiVrr21jhzc6kTu1d5lSKXlePrhJb+3t+ha k4xX0ai7epdaRv8lBQtWXOUI/aoBZ1nrDxBjF57P+L+3vlk8gKm9OOkpXJ6vTgPCCPWt LuwmKw6s8Qx6PsfejfF3qX+zWgtUyswyGEZO65nbMs6hd322vcRjP87bkTHpIREtjq4+ WWpg== 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=qQ1E9vaYcbwB4kkyy3glJ3m1Y05xvh8o6YtkdTT7sgU=; b=IZ0KXEGL2O3mzxkwuBbL7CBjpRJfmgA8FMyG2u/tmi/phLZUzN2Ulo09Q0/qxZ2emC rFSbCFgczGB3E6eN4V1UcA1kg/YzT1VbIwmnvWNL6/zwJ7WCB5icdqzXLrs+KyuXjyzp hronR6fnaVjSCjo/Qdtzx8zUD4r+bB1fmDe1lEvWSKWdBgn8eAU3t5FNVoBcLwLzwiC1 OR9EbubJJNVhetXlzAy+CGd5yrjsWkcem8prVX4qyeLkE46J1NErqxOaAUxsGwtOnvZk 2DDEn6j6tz+qMS388U92cwfgUgW70omLa7RZKaOkUcedOJeZaAWsfyxCMAbw73QZd6rh Ni5g== X-Gm-Message-State: AOAM533A3+SoGGxcmNOuP2U2be31NEgfcdfaHw0CrCXFzJNfUIy7TLat q48zkKfR7p6ejx2ZKRnjR5G7+w== X-Google-Smtp-Source: ABdhPJxDO8NG2fc7zGONtuqoTiifZZtH3+1350O31j7lSlMYvAv4BMIz1arfl3lcKRJzm9x/hWkPkw== X-Received: by 2002:aa7:8d54:0:b0:4e0:bd6:cfb9 with SMTP id s20-20020aa78d54000000b004e00bd6cfb9mr1152383pfe.60.1648058553255; Wed, 23 Mar 2022 11:02:33 -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 l19-20020a17090aec1300b001c7a31ba88csm1265870pjy.1.2022.03.23.11.02.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Mar 2022 11:02:32 -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, robh@kernel.org, Andy Chiu , Greentime Hu Subject: [PATCH v5 net 1/4] net: axienet: setup mdio unconditionally Date: Thu, 24 Mar 2022 02:00:19 +0800 Message-Id: <20220323180022.864567-2-andy.chiu@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220323180022.864567-1-andy.chiu@sifive.com> References: <20220323180022.864567-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 377c94ec2486..93be1adc303f 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -2060,15 +2060,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 Wed Mar 23 18:00: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: 12790024 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 3D9A4C433FE for ; Wed, 23 Mar 2022 18:02:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343926AbiCWSEJ (ORCPT ); Wed, 23 Mar 2022 14:04:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343923AbiCWSEI (ORCPT ); Wed, 23 Mar 2022 14:04:08 -0400 Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12FC4888D1 for ; Wed, 23 Mar 2022 11:02:36 -0700 (PDT) Received: by mail-pg1-x52f.google.com with SMTP id q19so1771146pgm.6 for ; Wed, 23 Mar 2022 11:02: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=gNEGSlS2mPCYLZrFQejehM36cdi8B+KPhgqHYrJkMJk=; b=U+FC0zvEMskeJPO6QafbDtyAkMA40WHTepQKPxaUHxq6GWxi8+VaKwMIO0YhMmownc Y2BO7w9D+7LkM23KMhAdAjTZozsf6iWea/g8PTshI4Almyv/+Bcr8S22AA3CKvpqr0vT TOsm6e5koKGGabEXziNF0hbOgJPz4aMuUvovvMoBP68YjPOolwBky100vvztJMr0M29G b9iRUyon8M+5x2IQCfFbNu238/CiG94NIXWqgCxxHMGaV4zXNzNL6cx4m6Fhih/qUmrI Y2PL8MjjCZQT8t+izQTvZr7LMh59Xbhq1CVUbNlI2SfpZMNrDllxR5W2rb1gToqnSTxC X/tg== 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=gNEGSlS2mPCYLZrFQejehM36cdi8B+KPhgqHYrJkMJk=; b=2HUM+GvERAJUpxcmlXhiXb2j+joCS4Tfkv7pm3OCsznL2dwQpaZYZdJAxv78CDyrdj Txvy4I9XA4p1YgSyZRj7112oJeo1PrFmHnq97S02HyVH0NIEWvRC/2klWSKRJYGlsfrW lyB5B8fdmuKNfg+uvZtCXnA4wr2qTeQCWFCSNNV5v/2d3zXnsu4yFKOOLGAP98R4Kala nHgFg01E+VOm2+7o2JT0T8Btn/l8blBf8Bcwz5Z9Y2I7TZp1CAmsz7sCCxWi//lIG6+7 9VqJgO9MlFmaMs6j9rhS/nzFkjUXori+bPtpBC/HKncGexFadLGZc4DVKfBPPAyWH6pV HqzA== X-Gm-Message-State: AOAM533BRvVHtsVnKb7rhY6slvyD29W+s12sj46bh/twn9iQHMeLxijG un1w/Q5SChS4DN2uws0A+d+u/A== X-Google-Smtp-Source: ABdhPJyrXAem/49LdGoF6jLSNndXSt4r+mvKChNrDteg/iCxp5KVfvKgpbwZokPKRJrLFaJqz1pnoA== X-Received: by 2002:a63:e201:0:b0:382:6afe:f0ec with SMTP id q1-20020a63e201000000b003826afef0ecmr819472pgh.339.1648058556422; Wed, 23 Mar 2022 11:02: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 l19-20020a17090aec1300b001c7a31ba88csm1265870pjy.1.2022.03.23.11.02.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Mar 2022 11:02:36 -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, robh@kernel.org, Andy Chiu , Greentime Hu Subject: [PATCH v5 net 2/4] net: axienet: factor out phy_node in struct axienet_local Date: Thu, 24 Mar 2022 02:00:20 +0800 Message-Id: <20220323180022.864567-3-andy.chiu@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220323180022.864567-1-andy.chiu@sifive.com> References: <20220323180022.864567-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 5b4d153b1492..6a0b7ad958cd 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet.h +++ b/drivers/net/ethernet/xilinx/xilinx_axienet.h @@ -428,8 +428,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 93be1adc303f..a4783f95b979 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -2067,18 +2067,20 @@ 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->phylink_config.pcs_poll = true; + of_node_put(np); } lp->phylink_config.dev = &ndev->dev; @@ -2120,8 +2122,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); @@ -2150,9 +2150,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 Wed Mar 23 18:00: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: 12790028 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 1810DC433FE for ; Wed, 23 Mar 2022 18:02:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343930AbiCWSEP (ORCPT ); Wed, 23 Mar 2022 14:04:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343927AbiCWSEK (ORCPT ); Wed, 23 Mar 2022 14:04:10 -0400 Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CBEF887A2 for ; Wed, 23 Mar 2022 11:02:40 -0700 (PDT) Received: by mail-pg1-x529.google.com with SMTP id s72so1772145pgc.5 for ; Wed, 23 Mar 2022 11:02:40 -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=bwIjazYGh/13rqi29xt94fh6HfpqlQOG+ZItpj9cq4E=; b=Cwd3KFSI/agyKxOiSZRaQgHH5s9cCIxb9ZH26XhlJyM5Ee2d6GUDYDjDZs0PO2rLTH gJUzkgwY9zJA+fmln+Ws0oFxAN9BOZUQUzAnQalMQjyWV8VKY7rEk4sIozlEhASvEw+Z l+O76FfmHFmhBZkq6TzwHSapiTXB42l1Q216GY7pimeqSrhBKBAY6W4cpGsohddmy9O1 cQXw5CJAcX5nyCoUJx5oFWtwvKWj4p91nZKwgg/RnOfjzumXNnpN6hFcVh+lyadz0spw yde3nVP2eSdVPJr49xlXbo0AGV1yKIbW55Snrw2AC14xx21YbamBCNDYMISeP3fCxTlG HdlA== 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=bwIjazYGh/13rqi29xt94fh6HfpqlQOG+ZItpj9cq4E=; b=dAFLZ9dzWLh+1UXj9sUmhflLpFN2a3qB0ChUwuBMqtjDDAv3DtCS4c2TdSRUVT/KKs fYVkaQPIzdV395Wf3dIS3odFQjJ+IYIF1KpAwhyzIdxfoOl1ELeqOUHFlbKmapds2Me0 i8kK3/MyH0ozTS4AUOhwss4MDFbg0OMjQMFvPhNIq9kxWUKmcc3UzUaKmJipodfv48qc SlI7VSLtzU2HS/YfVdSuwnQTaT1ijln5bHiSYEpKpFS/JGzk25kO3YoVB/ffGD0aCpE4 pkDP6NqFiNWTXF8tcOrwdbKkSLv2XF9CWk8qrAYpmEaKP9nj5Y9DzvurYR90Ek2X+iRb pRsg== X-Gm-Message-State: AOAM533/QsXcDvezFFhL70pYebbSp89rj8qkFwhlHupxEZNdpDVL0ev/ MZ3wHb9zI6TJsG/BRPE3XkpKNg== X-Google-Smtp-Source: ABdhPJwrJ1/ea3VN6pmR/JRCmTVCgRNMBCnuSQS8Q8pTlW8Ye6OQR0MPoEtF95QiHxTVvxg6Oq7Zog== X-Received: by 2002:a63:6809:0:b0:37c:68d3:1224 with SMTP id d9-20020a636809000000b0037c68d31224mr815631pgc.287.1648058559570; Wed, 23 Mar 2022 11:02: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 l19-20020a17090aec1300b001c7a31ba88csm1265870pjy.1.2022.03.23.11.02.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Mar 2022 11:02:39 -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, robh@kernel.org, Andy Chiu , Greentime Hu Subject: [PATCH v5 net 3/4] dt-bindings: net: add pcs-handle attribute Date: Thu, 24 Mar 2022 02:00:21 +0800 Message-Id: <20220323180022.864567-4-andy.chiu@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220323180022.864567-1-andy.chiu@sifive.com> References: <20220323180022.864567-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 --- .../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 34c5463abcec..978772c04e1c 100644 --- a/Documentation/devicetree/bindings/net/ethernet-controller.yaml +++ b/Documentation/devicetree/bindings/net/ethernet-controller.yaml @@ -102,6 +102,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..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 Wed Mar 23 18:00:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Chiu X-Patchwork-Id: 12790027 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 90F47C4332F for ; Wed, 23 Mar 2022 18:02:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343931AbiCWSEQ (ORCPT ); Wed, 23 Mar 2022 14:04:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343943AbiCWSEN (ORCPT ); Wed, 23 Mar 2022 14:04:13 -0400 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67779888F1 for ; Wed, 23 Mar 2022 11:02:43 -0700 (PDT) Received: by mail-pj1-x102c.google.com with SMTP id o3-20020a17090a3d4300b001c6bc749227so2617071pjf.1 for ; Wed, 23 Mar 2022 11:02:43 -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=orl2DqP7YtUtU1F53uUuvJSoGofFC8TzKIF9FwAKJ10=; b=kWDLbEhWVULPKdQdIk5ef3SAbPmlhN8ZuF5/xMSMXITbMq+U6hdRBoRwiHqUjvzkGv ieN7g+gdE+0/BN8NlMV4Ud61oXfK1pEJPLQGG0ELZaeOKeOPUJfouRIQrOyny3e5HYBZ RM5/b2VZZyFrk8zUO4LCevFjmQRMgvTIMOxR2cn+nfDJ969L86STNg5kkrWE4W6dbXv+ KIn72EmGqF8BdASAOeaqWICi8jRK4vLPMW+jPscF5vaXdxbUxEtWCJ/sPc6OqnLo0h64 IXF9AJwWjgBuTMtzdsuUPPb/Mf7MbacrxiQjUh5zCc192fsuHk0ufabdUCEsaaKVjWM5 CYWg== 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=orl2DqP7YtUtU1F53uUuvJSoGofFC8TzKIF9FwAKJ10=; b=aNayfQJ9rw+fsobYZJm7O3zQ6rWqMxAU152lvTGQ5Zw024zotkOweOwTb0EgQOINam QaD9+uq5y5hVPyVIfHc2J3oxKYzOzCHbgwXF3bOQXAq/ZfI4yCH9H6LJtxRsAZU46l6v ZFVeA6s6Gmpr126varVwnKLQFaws3sGIOe0ZAFIZjkxMkqD0ec/XOeo9RT8RRPfWMnQD 8+KFfTlrM+fiD7+E/7+lqo8eJsKAAodPm4o2Fp6pOeZuucn0HB+SQPWZPWR/wjwkW8NM k5Yhvy5xV7I8gMbhQddgqlNTSIuoMabIH8z10IWEjgeZCR8ZhCatU7lKIcGBLI0GnDcM 8Sbg== X-Gm-Message-State: AOAM531JTgsolFLFYpSdGlp8MMK53v16yvqQo7LfZWbMUVBqMCW97WZB 5mazvrwuryKv2ZuB/7dbBcK9pQ== X-Google-Smtp-Source: ABdhPJyBxJsYn93AHwvkMAs4VeT7lQvIzVS/H5iMNRXoLppcZ+AZCPHumZn57ug/x0xj8nCxaHNn+A== X-Received: by 2002:a17:90b:3904:b0:1c6:c1f8:cbd8 with SMTP id ob4-20020a17090b390400b001c6c1f8cbd8mr1013884pjb.53.1648058562916; Wed, 23 Mar 2022 11:02:42 -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 l19-20020a17090aec1300b001c7a31ba88csm1265870pjy.1.2022.03.23.11.02.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Mar 2022 11:02:42 -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, robh@kernel.org, Andy Chiu , Greentime Hu Subject: [PATCH v5 net 4/4] net: axiemac: use a phandle to reference pcs_phy Date: Thu, 24 Mar 2022 02:00:22 +0800 Message-Id: <20220323180022.864567-5-andy.chiu@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220323180022.864567-1-andy.chiu@sifive.com> References: <20220323180022.864567-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 a4783f95b979..6749d0eebc13 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -2067,9 +2067,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; }