From patchwork Tue Sep 6 06:20:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tao Ren X-Patchwork-Id: 12966911 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 4555DC38145 for ; Tue, 6 Sep 2022 06:21:46 +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=icb/YYkqtPcUn+7MTolb0bQKdRODxzhVoeig2BmOIVI=; b=AH4cv4ilYopx/L 1x+1B/CDbJcOQE9aHFUkeRPvkcDVo6NBSly/LBUjBMRBaSqTN6s5rejpuoii/Vg17ed7ri9ViJPdW ctdrHXlUFRnMWpGDkkGTQb+1TQMCuvZZqyxfmK0eqX6meY3ciALBowUzu67nkbEib/y2ui0gmwLBA wJMs6RlobV0LKBTfCzpePwOG9fGUplJZWOiM2+FCbhA0OjtwlQ2lrd9WGxtEudYH6AuI6w0dlna8z jsSCtKw407ginypLB0Q+jw13zvu2F28S2ifM1OnlfxB8Njy7Efs65pku0RGmiOwzW5GLfCWSKwnhi MKeN9e68u+ynX3WQ94aQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVRx2-00ALtZ-FJ; Tue, 06 Sep 2022 06:20:48 +0000 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVRwt-00ALr6-Ka for linux-arm-kernel@lists.infradead.org; Tue, 06 Sep 2022 06:20:40 +0000 Received: by mail-pj1-x102a.google.com with SMTP id q3so10229392pjg.3 for ; Mon, 05 Sep 2022 23:20:37 -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=nGBVFgXS0eqoiY86MSD6T7/S6VN4vNYiYOjgs/oE4mY=; b=KyXRFDauk1axtxubltzu8BL+9pcdtxnAvJKf+Xw9R/aDIRKMEHXxUXHNyFcdP60sIO +3AtxKFVqBcoQH27ignZ39T5f7Y9tT3ze/AAQ/thdm0vLFaNBnNxQEaX78lCtjCGwwaz 4BmDjwFL8PNJn8vW/YpYg0s+kmvpEiLMslNQgk5G8amP8+R7qzmXF/WBkx0xpIlrWJ/c xID8JpzAwaYSUgFc+RYodWx8A4EBque0dhLl/U1vmCKz0OIVNWArVOW2u7PYwana5ntt Pc0h2VD1ncsV7y+n273AlV0CieRr8fyqOCTynk9uzk+TquvyQDwMDLb6reEGou32+UxD hX/g== 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=nGBVFgXS0eqoiY86MSD6T7/S6VN4vNYiYOjgs/oE4mY=; b=101AfLTaOAUhle/Q0me659WQDpo9yIn3LnNT2ZS5oDxM+OOZUA77m9gDV8kVP6T3eS VSACJ6M2OsvZpmuVARVGQz7dR3qHdWSqu+AiTDsWpLvJomaHvOrIXn9cy/4n1P3R2RNq TPLIragelkAfnON4iXgIImguY8cJXQKWV7rseRUPxKsPlcKtddgWDnFGHhAA8acmOcSl VJxfgpEJ22arcXoBMIc0ldRyXwW4f7J1zDx8Rk9+ILGxEEHym1w8j6tuOE+orhjQNNpL zsisJc6d3hVn9H/M/Q9aPyf21/Lc7l1ntnSjmeOK+9RcDT614+10Gk1Quy56R7RiI+44 ttbQ== X-Gm-Message-State: ACgBeo2Kt6T1O3bzswoafgQrEHR0aWMS/OexzMc/ZORX1SGZyTx6NkPy h0zEdu9BX4GpnUlZX1n0zkY= X-Google-Smtp-Source: AA6agR53PUca4ir2leHPUVovDvemsSXgnFsYiOcmz3zQdzyDkaeSkXfx+UaVJ9p02CUgb1p2FUTNjA== X-Received: by 2002:a17:902:7845:b0:16e:d647:a66c with SMTP id e5-20020a170902784500b0016ed647a66cmr50876749pln.64.1662445236481; Mon, 05 Sep 2022 23:20:36 -0700 (PDT) Received: from localhost.localdomain ([76.132.249.1]) by smtp.gmail.com with ESMTPSA id m16-20020a170902db1000b00172dd10f64fsm8877798plx.263.2022.09.05.23.20.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Sep 2022 23:20:35 -0700 (PDT) From: rentao.bupt@gmail.com To: Andrew Lunn , "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 v2 1/2] net: ftgmac100: support fixed link Date: Mon, 5 Sep 2022 23:20:25 -0700 Message-Id: <20220906062026.57169-2-rentao.bupt@gmail.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220906062026.57169-1-rentao.bupt@gmail.com> References: <20220906062026.57169-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_232039_702984_0AAAAE27 X-CRM114-Status: GOOD ( 15.41 ) 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 --- Changes in v2: None 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;