From patchwork Tue Apr 5 09:19:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Chiu X-Patchwork-Id: 12801407 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 448A2C35273 for ; Tue, 5 Apr 2022 10:51:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236545AbiDEKwS (ORCPT ); Tue, 5 Apr 2022 06:52:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244578AbiDEJl2 (ORCPT ); Tue, 5 Apr 2022 05:41:28 -0400 Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F01EBBE1C for ; Tue, 5 Apr 2022 02:27:10 -0700 (PDT) Received: by mail-pl1-x62c.google.com with SMTP id n18so10407947plg.5 for ; Tue, 05 Apr 2022 02:27: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=W8IY+K7ipydB43YdWcn0LCQnxSiGzpiMtNQlPCELZV8=; b=aEJr1eKmE9GxiWjz85LefgI5tANXpA9ae7tFs29KQftpdUNi96HAtQgd2kHRQ811Hf 08TLZl/9bG8RaTgmgrDylNgd0HnVTFvmw70FKR2SkYfsPE4JAiLQLulx//AeQQNDI1Vu 8tsSEUDI3HhSUJ9Y2W1LewEM/7pipUP/5GcDjSvixtOErn3JCogg+DOUEVvtUqYJ/NRR H2wISB0bkwwRd8GziMFkNl9LNZRDXpbvRjklU6i7hGNKFMLo0hDGFupvh3lNCgMvIoAz 635updBI2ASdEZsLpPPLYXGlXIlLf8ySpyusNMwQcjrYxF/15g8dIfzZte7hgPFuH8fb b7fQ== 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=W8IY+K7ipydB43YdWcn0LCQnxSiGzpiMtNQlPCELZV8=; b=293cA27WA8SFWkHVaE0SAp9HocqX8fmiswNkkdZ3haiiDu/aKQb9KKbMs/cuE18UKy C49IzjxO7Mo+FZkZ/Vg55U3YrAWLLCh2UgeyJws04DCvPeomAksNkKVAWnvHlPOTYVGb OEF76OWQoOetnhk2lPLWdoWiC5j18iuufOcb7em5Cre3KeYbdw61LrX0BbHwO/seoWZP rjLcPIvyZiRKI7GSJS97xySmOB5CbBAL1Fa5XHSPh8D2GNd2E63Y2fGM1YpddXzhPE0Y Pk6IP26EyoS1ogA4bdlnHioxpD4IWSLhxEaB2TDQziyZDpq2M9k+tXcrG5VQKSj1bUzy J8lQ== X-Gm-Message-State: AOAM532KLXzql9hA6PN6C4ZcuS4oO0MP2iHDmynZHTygpL/2E3R8C0TY 5b8p3ZoWeTWi2lXzme31by/SlA== X-Google-Smtp-Source: ABdhPJz9w2hEdCGXtD1D3Ufpza7Spoddrs8iRimcY0bI3IJDP0pNv2VBD4Wd9iSwg1e3YFVFKQ0esw== X-Received: by 2002:a17:90a:734a:b0:1ca:8240:9e48 with SMTP id j10-20020a17090a734a00b001ca82409e48mr2957090pjs.174.1649150830085; Tue, 05 Apr 2022 02:27:10 -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 b4-20020aa78704000000b004fe0ce6d6e1sm5824291pfo.32.2022.04.05.02.27.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 02:27:09 -0700 (PDT) From: Andy Chiu To: davem@davemloft.net, michal.simek@xilinx.com, radhey.shyam.pandey@xilinx.com Cc: andrew@lunn.ch, kuba@kernel.org, pabeni@redhat.com, robh+dt@kernel.org, krzk+dt@kernel.org, linux@armlinux.org.uk, netdev@vger.kernel.org, devicetree@vger.kernel.org, Andy Chiu , Greentime Hu , Robert Hancock Subject: [PATCH v8 net-next 4/4] net: axiemac: use a phandle to reference pcs_phy Date: Tue, 5 Apr 2022 17:19:29 +0800 Message-Id: <20220405091929.670951-5-andy.chiu@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220405091929.670951-1-andy.chiu@sifive.com> References: <20220405091929.670951-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. Signed-off-by: Andy Chiu Reviewed-by: Greentime Hu Reviewed-by: Robert Hancock Reviewed-by: Andrew Lunn Reviewed-by: Radhey Shyam Pandey --- 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; }