From patchwork Mon Sep 5 23:56:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tao Ren X-Patchwork-Id: 12966631 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 26C2BECAAA1 for ; Mon, 5 Sep 2022 23:58:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/IwU6kbLx07tZ6hxjgAoYPrUxtXjFRXy2pBzOvbJwv8=; b=mnGuiMnW6aZnuF 4s3osAZqf2VZZt/b6t7crf0tG1YJk9DUou8BGe/2Dy6+fEkqHDOZyWLFh8d5Z0iIH98/1tEzS9DIK fq+FKJYXLB6elKjFqi0ittvQZUMKQnLvY8WCRDqBE0Vb8yoYb1094CQJZSE/uKEY7A9XseYyRxHTk WKGYWsW20a1Z37iQ97tsi+zgg28I/7hGWtJoWIh4XHdPGo2q3QLUeTHcwg0XVU6pne91bc/TOxshX 6XQ0pVDWttpr2tktMFuz2Au8QfB/GgK4xRdXgdPVtVPAr7kY20QRnytkxByzXtwZM+DbdAcITL1He jfsrwXWfKQEZnC5aem0A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVLxe-000TTM-B2; Mon, 05 Sep 2022 23:57:02 +0000 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVLxY-000TRU-Of for linux-arm-kernel@lists.infradead.org; Mon, 05 Sep 2022 23:56:58 +0000 Received: by mail-pg1-x531.google.com with SMTP id 202so9127286pgc.8 for ; Mon, 05 Sep 2022 16:56:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=HxSa1nifl/BjX4IHSZwDFpkRT1uZIgkAl2NNuJKauFc=; b=igHu4PgNQHWwp544lo/os2ZQ09E310HyxSJoqP/7Oo8TMGEf6ZlVucL7lBaJpcT0Yd EpZZUZubSRzixOsaWplXxMB9pxcJeD5cf6KOqO8FREFIGdDLaPzlQDnj9Y4yDvunkv98 62ZZ8WmcVC44VFm3ayQxZOj0dcMzU4a2ijXT20A/OreUOFgCLzkyQqGFQhJuw24RIdTF y5hrVuJ/byp5Uw1pf3Ouhqx2t6vE6DzliOdrlTeIpPKlMBVSiI/4lfQ6GuJvytBf/NIo YcrgvnJpT7j9Xmzo6eoE2Se9U6vqmbwzjBO10AEq/lwxcq5Tu2JscuYck6CG5wqEgm4h Q5DQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=HxSa1nifl/BjX4IHSZwDFpkRT1uZIgkAl2NNuJKauFc=; b=L505onUJG/J6cb8J1Wvk49qutKOujmu/tdxRrqiLLgUisPfhMWQyEiH3V/xfbWW2me eBBIU6egmtb9xYYrin8Hp2zZGFbrB7UKIDcIA2nPQlvZ+mtWFQdaFH99urv44RAUwHVB Yr/UV4+KL7esPFGpz9Cm4lQS7zsO/lqXmopLUpGL5hZ1Bs7ZbyDjAL7X1cSIUYnc78v3 ip8982JK+GdLIAjuOyK8Qh/So6LZWUM0onzi+gQw7ooRt3qYK0/ylQYz50z7gV365FEo oM4SgsEZp1DT/g75DT3g1ofTYa4UNK4fU16eYNOI+AZdGy/nsop2hWnQTQ5V3UY22JDr nMJw== X-Gm-Message-State: ACgBeo0buzqbZTgYVhGkNBUzeQJdShoiSqmI3B3ut+5xUHtY+lLTtEi8 mnNpU+vzKEHkAODzXLeWSRA9M7coQxnryg== X-Google-Smtp-Source: AA6agR6AalO/X1wxUzxRBt1wOQhvPR3J3uYbqv142JppgLbGvt7zZWNTHzEuMhAdTbmTglc7fVcY4Q== X-Received: by 2002:aa7:9e12:0:b0:53e:27d8:b71b with SMTP id y18-20020aa79e12000000b0053e27d8b71bmr238339pfq.46.1662422213841; Mon, 05 Sep 2022 16:56:53 -0700 (PDT) Received: from localhost.localdomain ([76.132.249.1]) by smtp.gmail.com with ESMTPSA id g26-20020aa79dda000000b00537f13d217bsm8405530pfq.76.2022.09.05.16.56.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Sep 2022 16:56:53 -0700 (PDT) From: rentao.bupt@gmail.com To: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Heyi Guo , Dylan Hung , Guangbin Huang , Liang He , Hao Chen , Rob Herring , Krzysztof Kozlowski , Joel Stanley , Andrew Jeffery , Tao Ren , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org Cc: Tao Ren Subject: [PATCH net-next 1/2] net: ftgmac100: support fixed link Date: Mon, 5 Sep 2022 16:56:33 -0700 Message-Id: <20220905235634.20957-2-rentao.bupt@gmail.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220905235634.20957-1-rentao.bupt@gmail.com> References: <20220905235634.20957-1-rentao.bupt@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220905_165656_823386_DE252F0A X-CRM114-Status: GOOD ( 15.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Tao Ren Support fixed link in ftgmac100 driver. Fixed link is used on several Meta OpenBMC platforms, such as Elbert (AST2620) and Wedge400 (AST2520). Signed-off-by: Tao Ren Reviewed-by: Andrew Lunn --- drivers/net/ethernet/faraday/ftgmac100.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c index 9277d5fb5052..da04beee5865 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -1701,10 +1701,14 @@ static int ftgmac100_setup_mdio(struct net_device *netdev) static void ftgmac100_phy_disconnect(struct net_device *netdev) { + struct ftgmac100 *priv = netdev_priv(netdev); + if (!netdev->phydev) return; phy_disconnect(netdev->phydev); + if (of_phy_is_fixed_link(priv->dev->of_node)) + of_phy_deregister_fixed_link(priv->dev->of_node); } static void ftgmac100_destroy_mdio(struct net_device *netdev) @@ -1867,6 +1871,26 @@ static int ftgmac100_probe(struct platform_device *pdev) err = -EINVAL; goto err_phy_connect; } + } else if (np && of_phy_is_fixed_link(np)) { + struct phy_device *phy; + + err = of_phy_register_fixed_link(np); + if (err) { + dev_err(&pdev->dev, "Failed to register fixed PHY\n"); + goto err_phy_connect; + } + + phy = of_phy_get_and_connect(priv->netdev, np, + &ftgmac100_adjust_link); + if (!phy) { + dev_err(&pdev->dev, "Failed to connect to fixed PHY\n"); + of_phy_deregister_fixed_link(np); + err = -EINVAL; + goto err_phy_connect; + } + + /* Display what we found */ + phy_attached_info(phy); } else if (np && of_get_property(np, "phy-handle", NULL)) { struct phy_device *phy;