From patchwork Mon Mar 28 12:32:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Chiu X-Patchwork-Id: 12793494 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 F02ABC433EF for ; Mon, 28 Mar 2022 12:35:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242527AbiC1Mgx (ORCPT ); Mon, 28 Mar 2022 08:36:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232505AbiC1Mgu (ORCPT ); Mon, 28 Mar 2022 08:36:50 -0400 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1600F64E4 for ; Mon, 28 Mar 2022 05:35:10 -0700 (PDT) Received: by mail-pf1-x42d.google.com with SMTP id s8so12464546pfk.12 for ; Mon, 28 Mar 2022 05:35:10 -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=VVp3L17Ge6XD9nWnUnODq51rprCkbWHLs5OggBtgrVRqeJJOqPzQjysXpjqGdBSCiw 7LYmn03vj1h9ThVWJ/11ybkVfqHFAfWwbA/hECa4N70M6rnsyjhH4xYsnV+9RAajOw1l vOHI8XazCc9CJg1T4R4nGD6g4tSR2DjDkzp6j5bZYMHjvSO6tn+G3gQuJJHLJLyqp+tV Qn2T5S4nirwOQPUL/X932DYbj3P//wek6FZD58TC6iIsaWfZdMylqHKyYRlCeZ+tmP5P YyWVmY3r+OKF46FqJL/nDi9bWDhE2sms6Q88kEOEj+7uX6iTcWUSm/W1dnHidIU7DfTG ox8g== 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=q5VB2YpBW9dw2ac/3AbD95f/KKfA9eAonZKq31/0rAldONJ9KrUbemvRs8QGyGSknv XqAalNNqMr/9cXWtwypeA03upbqJfFAM8jVIGTZgmjzpe79JsUOj09RMqKRbIVhAQs8q vmvNeBQ+VDmq/UzQU5p3LIPcwxol4J4FQPpqurx23MQ3It7dptA+EwX7GrCWxvXRkqOC wAWxqfML8lQBhRuExDb4yVAii05gXSKk/fZ0Hj4g2hkuKtwgV6ieutl5P5zrcU6qPkdE du5eBboSf5Bv1YYTDje1CuejSmDtxsGLLgDgKbmhLtlI3yP1cVS4P22OhpeJmbDiirek xTIw== X-Gm-Message-State: AOAM531110KDr26+bYsWUdKo2dAm/DEXvFKqBwbFpPGNX15Khgbb2Ued NXebrWOtTRmvFTYRuIZ2I/gN8g== X-Google-Smtp-Source: ABdhPJw9B9JCzNYnhoNHh9uuHG2lGBfW7hDnJ9YCpKo0j0gxnWAZ8pTpTI9P7BNexSAyA8g95OBNPQ== X-Received: by 2002:a63:f0d:0:b0:381:ee45:f557 with SMTP id e13-20020a630f0d000000b00381ee45f557mr10214201pgl.436.1648470909602; Mon, 28 Mar 2022 05:35:09 -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 h12-20020a056a00170c00b004fab8f3244esm16314597pfc.28.2022.03.28.05.35.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Mar 2022 05:35:09 -0700 (PDT) From: Andy Chiu To: radhey.shyam.pandey@xilinx.com, robert.hancock@calian.com, michal.simek@xilinx.com, andrew@lunn.ch Cc: davem@davemloft.net, kuba@kernel.org, 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 v6 net 1/4] net: axienet: setup mdio unconditionally Date: Mon, 28 Mar 2022 20:32:35 +0800 Message-Id: <20220328123238.2569322-2-andy.chiu@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220328123238.2569322-1-andy.chiu@sifive.com> References: <20220328123238.2569322-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 Mon Mar 28 12:32:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Chiu X-Patchwork-Id: 12793495 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 D551EC433F5 for ; Mon, 28 Mar 2022 12:35:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242533AbiC1Mgz (ORCPT ); Mon, 28 Mar 2022 08:36:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242528AbiC1Mgy (ORCPT ); Mon, 28 Mar 2022 08:36:54 -0400 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37E0964EE for ; Mon, 28 Mar 2022 05:35:13 -0700 (PDT) Received: by mail-pj1-x102b.google.com with SMTP id jx9so13885258pjb.5 for ; Mon, 28 Mar 2022 05:35: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:in-reply-to:references :mime-version:content-transfer-encoding; bh=gNEGSlS2mPCYLZrFQejehM36cdi8B+KPhgqHYrJkMJk=; b=FyU5sCo5mxZ3UFic39LK8jEJ9Bh8PoSUKz7inSAfXOlbow/PjyrNR1+E/LGDNzI3W0 mt2lzTTJAq9sPrhPexGJP7yh9l58pzZyP3qk7k02p7fYDj8VM7l0bvD47rgHT6Iwlr4q C0YtArzCjtpTakKDrGU9wzCZyFdLalw4A7uUgqG69GywMd9WFkE8fWqAmBxexLCEBQl+ qx602btCgCO4G5pFFK5swvs+oJjhk1jFpi9zgDtQrEntyiEopgUB5UhM1CNq7Nj5m4Zn FCHzEDCEhyt7h/BlXZMn7HMFXJq+hYSDQL7vGnDNZz8a6XZs0rruKzCHcfdUA3pt2VFd Gu0g== 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=oIblBYp4xg1ZjUXCP+D968pWaPC0JE2foxbWReWR0lT6ZNH/WSG9vq+yPrOKuzMhpK 1tP3Dro3qQOy42en3pFmzGx5coLaCxmTA2AaMIM+u1np7SzIKqqmAj8zVyAXVFEqfAaU 1AZ+jTaqNO2QyXOv4fIN0JFyB/VSKLbftivi2Rt59H8CK3QdtX8Ppbjo8Akda4t0tmoG JKNVh1YQnsqU5sMTaYpWpOv2vqn8KsxDprWptwXEpfQ39Z3PWJA3GN2Payroh5nTTkqy A5nqK6Z8xjB+LBX7x+v2QWKwneC3UL5ovtJTNstBJgMQDNH9w0lIhv+v/VLkvGdL+OQ1 QO/Q== X-Gm-Message-State: AOAM533psf3VL0qTnxnzabT+C15Fdfyd0Jzc8BQaHtFbHDUZI7bnCuD9 P1NOO+No035K/7jON0/yWuqVMg== X-Google-Smtp-Source: ABdhPJwKdPAjQn7L1oiuywiQ6AizFLKfHKnwlV/yjzbHkP4FbjN4RPEvcM3mm95e9GyEVMjDvWi2eA== X-Received: by 2002:a17:903:32c7:b0:154:4156:f384 with SMTP id i7-20020a17090332c700b001544156f384mr25980340plr.34.1648470912760; Mon, 28 Mar 2022 05:35: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 h12-20020a056a00170c00b004fab8f3244esm16314597pfc.28.2022.03.28.05.35.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Mar 2022 05:35:12 -0700 (PDT) From: Andy Chiu To: radhey.shyam.pandey@xilinx.com, robert.hancock@calian.com, michal.simek@xilinx.com, andrew@lunn.ch Cc: davem@davemloft.net, kuba@kernel.org, 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 v6 net 2/4] net: axienet: factor out phy_node in struct axienet_local Date: Mon, 28 Mar 2022 20:32:36 +0800 Message-Id: <20220328123238.2569322-3-andy.chiu@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220328123238.2569322-1-andy.chiu@sifive.com> References: <20220328123238.2569322-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 Mon Mar 28 12:32:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Chiu X-Patchwork-Id: 12793496 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 50138C433EF for ; Mon, 28 Mar 2022 12:35:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242563AbiC1MhC (ORCPT ); Mon, 28 Mar 2022 08:37:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242545AbiC1Mg7 (ORCPT ); Mon, 28 Mar 2022 08:36:59 -0400 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA63F4E391 for ; Mon, 28 Mar 2022 05:35:16 -0700 (PDT) Received: by mail-pl1-x636.google.com with SMTP id p17so14661740plo.9 for ; Mon, 28 Mar 2022 05:35:16 -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=wxuPG5Xa7iJ0fmOshTOWXqRXvkduIvgaK+wC6AjWHwY=; b=lCRtdJh7dtozIL02xyp32AvAUCaF0IynNKkSPx54A9PtSa40J2uK/i2UyzW5l16Sy0 PgQi8OpCBgD4nyxSFC62dbBDwSog2ZdCZyhjFGH9iBtTIg6B61daa9RmS0FrS4NCfjPE 0ah+t6na76DWOgm+1q5ILK98qCKbOsexX6pj4MfwZ1SIWylUDUhon3mhohFUNJBf/cm7 YvpIm7PbTnKhIg+tgw48CBPSN4U/azKGU3+cusg1dS1wV3AFNvE/gYJztgytE9A7Adrp W1EzVttL5ukvTZq2p6SyTTg1959MMKc3gvZRIsPCSC0Wxru/OlSUW68o6QRAdTzBkR9l n3Xw== 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=wxuPG5Xa7iJ0fmOshTOWXqRXvkduIvgaK+wC6AjWHwY=; b=YWddPCXl4HRqdngJWLfpTHAbH+ZnGX5hYeMsMKsTZ5Mr2oGMlD7Tmw7zitEWPBY21L qfdDARdmLrq8f/WJqrpQ4LV/vxg7K/Z5tIcUjGj/6xIVvT96jk9TG0/e9LrJvjJy+Vit W0koNKGCwu9YfFg4My9MPH8T20yI/P1T0TEfZrkifu8gziSqyVhPatCXiSdgpqIn8k4K g06NzBPUiiLcyCHgR6fWz5jhjSIvdyn2V0+TEZ78PRm2tmmzBvAmYBVdWgAIJoD60ZY1 Zvp+R8o76pXTBGVslH4uhnZ/NcfnyrasmcZ9bI3EtlbkH4kHx5xM3JUO5dTNlhIuGbKJ TdEw== X-Gm-Message-State: AOAM533+JiznsGOSFzPoNOdSNPpTWbWBqcOtStNotniOVz/zsckGlYa0 tVxVs1yUOF2YCc82xlzD1NJXpg== X-Google-Smtp-Source: ABdhPJzPRecPZj5bWfKLTfbnr5VDlE1oEFjvl15YfkJqmnX+FzftMW+RAgSWqlF76CJ2bq+6jdR9lg== X-Received: by 2002:a17:902:f682:b0:154:8500:80bf with SMTP id l2-20020a170902f68200b00154850080bfmr25963461plg.112.1648470916213; Mon, 28 Mar 2022 05:35:16 -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 h12-20020a056a00170c00b004fab8f3244esm16314597pfc.28.2022.03.28.05.35.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Mar 2022 05:35:15 -0700 (PDT) From: Andy Chiu To: radhey.shyam.pandey@xilinx.com, robert.hancock@calian.com, michal.simek@xilinx.com, andrew@lunn.ch Cc: davem@davemloft.net, kuba@kernel.org, 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 v6 net 3/4] dt-bindings: net: add pcs-handle attribute Date: Mon, 28 Mar 2022 20:32:37 +0800 Message-Id: <20220328123238.2569322-4-andy.chiu@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220328123238.2569322-1-andy.chiu@sifive.com> References: <20220328123238.2569322-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..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 Mon Mar 28 12:32:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Chiu X-Patchwork-Id: 12793497 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 8D064C433F5 for ; Mon, 28 Mar 2022 12:35:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242548AbiC1MhG (ORCPT ); Mon, 28 Mar 2022 08:37:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242541AbiC1MhA (ORCPT ); Mon, 28 Mar 2022 08:37:00 -0400 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D14864D621 for ; Mon, 28 Mar 2022 05:35:19 -0700 (PDT) Received: by mail-pl1-x62e.google.com with SMTP id e5so14662001pls.4 for ; Mon, 28 Mar 2022 05:35:19 -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=NwzcJhDM/I0kCSs0hELt6K++w6ieVIwXZqKcJtDbxBpfpA5yc6WPPUeeYM8y//4SYm hCHWj4r/FPqKwXt8XLoi1+ZmDQYE1sKar1ijnDn98I6kVKc7gEUEVuo7ACek518FJxsf 1Vr6BfyoOOH/BO554wT5Qe9TKH+gmTDuhtEj1/OjtNdfPpC7gJdp7G5csYmhMMUBxgGa o/dntzX49cPuTDAzKS7rCUzKd22OOIlaMKtFjvDeTvzbOShjCemb47Ph/gVU9v8Gw5cJ 2SHIySYvfEd31owc702Bz0irCcelVFA65eExIUjBJY6pCrfpfhYIdkz2oTT1OB5dAMvD K0XQ== 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=l7J8CHQnEGDpYlrjmN6Ky00gIS5SsfoNpO2brWxO6Ytwe6HIO/tQys2dq3AsXlDUuJ q1aWyts36ds5m9N/BzEPVcuSamHvpDX4Tsbj/PzydpvwKOUP8Ss5LwgbiOEjBmNnV+Lc Ur2MeBrrEBBlKBlEYoHqJ/o127Y18L5+bwZOIjRkLzCQUjLwTWRSly+wMW9OVprUY8XW uWrU0RbghWTCOyjKczy+jCj/zN7IPLpnrV4DJhhuxoy0YlKTYLvX1iXA+Q7TmyrfACDx jNl+DmkfUA41maDAOKYPfnIIsTc6XW9nPjDIzA0TfX1KzX1ex/QFtoREzsDp/KUUoZvm DDrw== X-Gm-Message-State: AOAM531OOhRPz8OKJth5GUYXameTSauK1+N/OHmnf4xyAhszGWnQcXAF sFqx1MWkukbPf0uSi1FT/A8a5Q== X-Google-Smtp-Source: ABdhPJzQaDIuZvGVl4nLRN3j8QOeP3DvFmVsae2HgKMZLsLGelAgpGf/c2uxbq4oqEV5tIsnDMqQUA== X-Received: by 2002:a17:902:f544:b0:153:bb8a:9374 with SMTP id h4-20020a170902f54400b00153bb8a9374mr26450419plf.154.1648470919407; Mon, 28 Mar 2022 05:35:19 -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 h12-20020a056a00170c00b004fab8f3244esm16314597pfc.28.2022.03.28.05.35.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Mar 2022 05:35:19 -0700 (PDT) From: Andy Chiu To: radhey.shyam.pandey@xilinx.com, robert.hancock@calian.com, michal.simek@xilinx.com, andrew@lunn.ch Cc: davem@davemloft.net, kuba@kernel.org, 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 v6 net 4/4] net: axiemac: use a phandle to reference pcs_phy Date: Mon, 28 Mar 2022 20:32:38 +0800 Message-Id: <20220328123238.2569322-5-andy.chiu@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220328123238.2569322-1-andy.chiu@sifive.com> References: <20220328123238.2569322-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; }