Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp3688123rwb; Mon, 5 Sep 2022 16:59:34 -0700 (PDT) X-Google-Smtp-Source: AA6agR52D0ydmOFaWs+U7rfmhTiL1IiUE7sW2qa7Z1ggUNVoBkwwkeJP53FIgNG6aCgJl/2T/eSd X-Received: by 2002:aa7:d990:0:b0:447:8c86:a8ab with SMTP id u16-20020aa7d990000000b004478c86a8abmr43994572eds.157.1662422374121; Mon, 05 Sep 2022 16:59:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662422374; cv=none; d=google.com; s=arc-20160816; b=quBHjjc/fCOLLo0Q5Cm0E30h5TMbqXN4Bvo/onaUJLBLKir2Hh5TWsj7JgKzOBjGAF gW2AbmABue3U/udm59NT4y7fHMbLHiNO3Ay5TQC1ObYOVTXmBKS/utFQgBcUX8pAK9vk 7M7y82ENUQmJQXkWxk8b4Kujn4LL/4BMx3V+CRtK/vkZ7iWTKscwRJOuTMAdiMlTXr8i AqgYjIoZKAhiiJyENIuDOLKMSkAbFB0yBO29tyapgLEXR1giLxX9ATeohIHYjeeZNjTZ Rq/FFCwQPTKUzV6D6bdzgAiOutBhJlPU5cSwFF2O4Zvynv2Ay65Y9KDw6HnmjD/yruOW je0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=HxSa1nifl/BjX4IHSZwDFpkRT1uZIgkAl2NNuJKauFc=; b=ldOASW5PKaGeqcRxICa7ByOxpVKgaNL+Pc0MlkNyeLHT//cXrHsXAkbyo3Avd+bkCK Gml/Fzr0Kb3qsokfS2+Z9wBrw8KQtkT9w49LgZOrwAAXzMCP2LKAWv2+pE5RrI8H2xeV 6SuBUk3cixr7HnOdOY0jAsNbsbpLShS+mpfqrcO1M6XXoa8B9X2izOTwkamrC9qtsM6o uX1EKNVV0VwRm6TK5UkDRglw8xxtpLcUHuvU3wjBEGsviLn8dWEcHul714pwHBYT2G82 Px+bMNkthEEQjJMu7YCGmcqf3uamJQIYRhvn1CSLhUW0HCTPY9srlCcVmAE050KLHDUW IQYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=igHu4PgN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sg31-20020a170907a41f00b0072af8809a85si8745892ejc.332.2022.09.05.16.59.09; Mon, 05 Sep 2022 16:59:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=igHu4PgN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230139AbiIEX5A (ORCPT + 99 others); Mon, 5 Sep 2022 19:57:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232775AbiIEX45 (ORCPT ); Mon, 5 Sep 2022 19:56:57 -0400 Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33ED167156; Mon, 5 Sep 2022 16:56:55 -0700 (PDT) Received: by mail-pg1-x52d.google.com with SMTP id c24so9119500pgg.11; 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=st2KTSH2PxKHJUcBhvqFNS+lmWLBAqYX7B17jTjGZ8fu4U5xfRgzrBjWA/cODPIZ11 TR2XZkIyEy/VmLtxu1ENLgNzDw2Fj1BPH/N+W6H3uqHUcmE8khx+sB8T9XFJQpMCQ4xT mWw//d9O0B6+M5OzVff7BelaYssW2NuX15TFZbM4VjhTu0IIJwz+QHJe12b8SSyYdIRM /9eP9DHNDkakwjdGilbNvpCh7Kdp4SCmhhx5LAgUfEFTLsYG7BotEAfzcCAKFy3+sgjV yrlh/IzssngCFGN6O2SH0cN73qHix417JwrzS7Afaxsh7d+sSlga8Y/FpKLWcT3tKxZC iZWQ== X-Gm-Message-State: ACgBeo1q1CaMWtcgOi5enHQif4UhEG1gw/S9XfIOjsnMdna0WVdqFJsZ R94YdB/ILC3za4wnmfjaqi0= 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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 --- 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; -- 2.30.2