Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp6960141pxb; Wed, 17 Feb 2021 19:43:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJzUqO4vAd8d2HYrCplH/1aEpw7Z8oDnAAC7/PTAYXBzn8jlpodPRvCkzOzw03twYiipmynV X-Received: by 2002:aa7:d442:: with SMTP id q2mr1933311edr.276.1613619791951; Wed, 17 Feb 2021 19:43:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613619791; cv=none; d=google.com; s=arc-20160816; b=Of01axESJMXVtyiwz4dY9/y5k60A5Bb9G0gkYUXY/XWeUo5QfdkbYg2oCQQ9zElRnN Y//G9VzEQYgUfCRCNvrjGAztAGYepkl9naHKlS0n1CTUKdCVa8dQU8/CW5g6FdmdcnZ6 3FJ5nldopD8ILm6LyF50nveilVZfFjoNeGuGdC9VKQxoPPeHk4w06KAXZ6h7TkfxDS+k 1Uni59njOXMUS9z//vdFiHrdXo1IlrekrrIYriGbLdzPzcRiGEBeEUqE01dYfTVfsp8w xxtiL0rMzvwYnkStQ9JPD3nZ+70tSg+6oth6RQLcTsXGC0IYpfk/UdvtWtdIrG6lngOm dO0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:mime-version:message-id:date :sender:dkim-signature; bh=cJg53Dje1zJHUGVNSMHfeUh3OpPCOvr7+/hJB7zf2NU=; b=vFK8DeUPL3rQS/E4Ib2daiSj8/kreKHtgm0vxv9tlPTtclc8MBhrS65UnsRp7xcmG1 z7+dYHzhsLiE9QjZoSTghWAArsfLCYj2GAHzLkTEbnN8WE2JAXaP5Qm4fmjjoLKFbSM8 eWNxT8uq9zuiBPAoC1jhF3ZHh1qOowuYkQEQUkpfwnqPFVKAbjK40E+Ob9/gahuw/1oz 2l5/aCetbBxEEl4s7hfHRh+0OTpoQ6yzeTJ7ftsQDbo08yn4ucp/dNwbf5hG4OSm9ijT ipIKL82gVZTPCgNgomYDAlSvHx4ISGoehhKF37NNnROTTRuK2IWvRd01wzFMQIrwYDq/ AyFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Xc55D4oy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q19si2921242edv.67.2021.02.17.19.42.46; Wed, 17 Feb 2021 19:43:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Xc55D4oy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229989AbhBRDl0 (ORCPT + 99 others); Wed, 17 Feb 2021 22:41:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229752AbhBRDlY (ORCPT ); Wed, 17 Feb 2021 22:41:24 -0500 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB258C061756 for ; Wed, 17 Feb 2021 19:40:44 -0800 (PST) Received: by mail-yb1-xb4a.google.com with SMTP id y7so1107305ybh.20 for ; Wed, 17 Feb 2021 19:40:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:message-id:mime-version:subject:from:to:cc; bh=cJg53Dje1zJHUGVNSMHfeUh3OpPCOvr7+/hJB7zf2NU=; b=Xc55D4oyibYHJrF9xxK5ty4qZV5WPl/oyMOo1NIeaW4rzKh2l8T0flog4OHsGT9TkN a6BjFqUMJPcs9oUyXIyZkeFs+6ostr2RLzKjEmJG7P1VRkzC5+h+ZDLBGfAfEqZ3gH+F GNNcRAAC9X8K8uyk5EDzec+7gcNow32K96WyeJHK6yhnjNFAdjZOC6QlXOa2sxHwJOur ECKu1843Tuz2Lj0x+TIwopuBE5n3ZJSnWWokhXox2eZln4EXe2IGz+3nWE9iEfUrTqQQ dv3NwEDazI4LOFkJwSIbMVq7X7iomclZKiA3tbeVdYjK+8gLeXGEiDXdgiJ+JBb41NUF TBBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:message-id:mime-version:subject:from :to:cc; bh=cJg53Dje1zJHUGVNSMHfeUh3OpPCOvr7+/hJB7zf2NU=; b=hPP9o7/ml5GnP2qIJbYvsqdThKWVTE+qDXiaVPxq/W0fcqvLOwJfS9zih3tZRrb/5p mcKxTAc1DOLhN4yuqQgutFlYEH4ynXlgdF5nywStsq1j0v9XW7HJ2XU7xoY4rVyilFTG 9Yar9iDGYiV2wXQ8q+tJntQS5aE8fNO3rbx78xggSSRSK6WVsrD8cf+hnliT9/5qvGdG tMR4NmDetRkGKxJXMg7ppsasfo81hlYtdW5QWmhD1yZ3ThOIBeMxEj/hIBcpk6AMhxTb K21uVINRPvXJW9YNxd3vNNvbnXodYCxGoS3BwYqI42cBTPDLkxBoTk8LAIxeb9Dj1oEk tRMw== X-Gm-Message-State: AOAM5305NHW4/n8Rl4PbWGyLlQbof6Wm+IBA6MCzv7ugqAY39z539Yy0 koo2rxzFSoictJb4NoxMwsr55bg= Sender: "wak via sendgmr" X-Received: from wak-linux.svl.corp.google.com ([2620:15c:2c5:3:b5f3:dab1:c8f5:62df]) (user=wak job=sendgmr) by 2002:a25:23c6:: with SMTP id j189mr3854740ybj.211.1613619643954; Wed, 17 Feb 2021 19:40:43 -0800 (PST) Date: Wed, 17 Feb 2021 19:40:40 -0800 Message-Id: <20210218034040.296869-1-wak@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.30.0.478.g8a0d178c01-goog Subject: [PATCH] net: ftgmac100: Support phyless operation From: "William A. Kennington III" To: Jakub Kicinski , "David S. Miller" Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Joel Stanley , "William A. Kennington III" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We have BMC to BMC connections that lack a PHY in between but don't want to use the NC-SI state machinery of the kernel. Instead, allow for an option to disable the phy detection and mdio logic. Signed-off-by: William A. Kennington III --- .../devicetree/bindings/net/ftgmac100.txt | 2 ++ drivers/net/ethernet/faraday/ftgmac100.c | 30 +++++++++++-------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/Documentation/devicetree/bindings/net/ftgmac100.txt b/Documentation/devicetree/bindings/net/ftgmac100.txt index 29234021f601..22c729c5fd3e 100644 --- a/Documentation/devicetree/bindings/net/ftgmac100.txt +++ b/Documentation/devicetree/bindings/net/ftgmac100.txt @@ -19,6 +19,8 @@ Optional properties: - phy-mode: See ethernet.txt file in the same directory. If the property is absent, "rgmii" is assumed. Supported values are "rgmii*" and "rmii" for aspeed parts. Other (unknown) parts will accept any value. +- no-phy: Disable any MDIO or PHY connection logic and assume the interface + is always up. - use-ncsi: Use the NC-SI stack instead of an MDIO PHY. Currently assumes rmii (100bT) but kept as a separate property in case NC-SI grows support for a gigabit link. diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c index 88bfe2107938..f2cf190654c8 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -1467,18 +1467,18 @@ static int ftgmac100_open(struct net_device *netdev) return err; } - /* When using NC-SI we force the speed to 100Mbit/s full duplex, + /* When PHYless we force the speed to 100Mbit/s full duplex, * * Otherwise we leave it set to 0 (no link), the link * message from the PHY layer will handle setting it up to * something else if needed. */ - if (priv->use_ncsi) { - priv->cur_duplex = DUPLEX_FULL; - priv->cur_speed = SPEED_100; - } else { + if (netdev->phydev) { priv->cur_duplex = 0; priv->cur_speed = 0; + } else { + priv->cur_duplex = DUPLEX_FULL; + priv->cur_speed = SPEED_100; } /* Reset the hardware */ @@ -1506,14 +1506,16 @@ static int ftgmac100_open(struct net_device *netdev) if (netdev->phydev) { /* If we have a PHY, start polling */ phy_start(netdev->phydev); - } else if (priv->use_ncsi) { - /* If using NC-SI, set our carrier on and start the stack */ + } else { + /* If PHYless, set our carrier on and start the stack */ netif_carrier_on(netdev); - /* Start the NCSI device */ - err = ncsi_start_dev(priv->ndev); - if (err) - goto err_ncsi; + if (priv->use_ncsi) { + /* Start the NCSI device */ + err = ncsi_start_dev(priv->ndev); + if (err) + goto err_ncsi; + } } return 0; @@ -1725,8 +1727,8 @@ static int ftgmac100_setup_clk(struct ftgmac100 *priv) * 1000Mbit link speeds. As NCSI is limited to 100Mbit, 25MHz * is sufficient */ - rc = clk_set_rate(priv->clk, priv->use_ncsi ? FTGMAC_25MHZ : - FTGMAC_100MHZ); + rc = clk_set_rate(priv->clk, priv->netdev->phydev ? FTGMAC_100MHZ : + FTGMAC_25MHZ); if (rc) goto cleanup_clk; @@ -1837,6 +1839,8 @@ static int ftgmac100_probe(struct platform_device *pdev) priv->ndev = ncsi_register_dev(netdev, ftgmac100_ncsi_handler); if (!priv->ndev) goto err_phy_connect; + } else if (np && of_get_property(np, "no-phy", NULL)) { + dev_info(&pdev->dev, "Using PHYless interface\n"); } else if (np && of_get_property(np, "phy-handle", NULL)) { struct phy_device *phy; -- 2.30.0.478.g8a0d178c01-goog