From patchwork Fri Apr 22 07:35:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ong Boon Leong X-Patchwork-Id: 12822985 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 EE919C433EF for ; Fri, 22 Apr 2022 07:48:50 +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=douUtrH2hRc3CAFi5I5QX1IJ7IG+sLAQUzDK0RrSEKk=; b=VBqwTXM0qO8i/g 8nM+CVoLLsJ4E298FTau7grgABU5qpuTdDUwAzTuZUH4w2o6tieuNqdDhZ/hWH6qWfik/nOvBZkOr tgeJYHhmOR6fqoGx8B4a+RQTuzr3S6GJbRxgUn/vezOR2gV4lCmK5pjCXFKPN8AeIGqV9oOlWPtnS daR6YUpCr0yTWP80X4mEmjw2GNzTAtKOxlkxCgWFO1YXwTo3HMqyp5zl3CQ0pbS3Vzod6eVUtkFPJ ljauwvDcKNjPUzvmq3BDdX9lPpFbzTdTBE4P03nDlPLzsm7jlku5bP3KkkOCc67nfrcGY3WZcrT8X ngwmESYzTUxU2ji1Te8w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nho0t-00GxtC-CQ; Fri, 22 Apr 2022 07:47:35 +0000 Received: from mga12.intel.com ([192.55.52.136]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nhntR-00Gu8U-Q1 for linux-arm-kernel@lists.infradead.org; Fri, 22 Apr 2022 07:39:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1650613193; x=1682149193; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6GcMHH6yUqex4pWxo8BLj/3zpi1O7XDEvvpDjCDkD0s=; b=lBQOc97wkEekbxpXH61ycyBLzbTAU9rWgxFLTbIIesVri0qrVXSG2KR4 yoCro7ht0FAlrqfZpOM/V5vKABNqGEO8Xp9vE4eR+dzk0dNtKNRMJR0wR JQgrunV6NwlFhmMK38Y4dNI8IQrUDzCHG4AmGwpAR/49JDZhpOKLAT6bO c2vLIpHo84Q8LGrdDWORXFN09fdfGCi93uDK70ZoktsLCjyllI8eAZPjq VTOS1IJZQ6ALSWulb4dSewThniYKhXLn/Xj7SgaqdVUhO/SqfEpBEx6FB pZnPQY8FLK4CINb3uhHGyWZwAaSImTqslFL1E2Qhzu3TUKV1mOkAPcUOO w==; X-IronPort-AV: E=McAfee;i="6400,9594,10324"; a="244534070" X-IronPort-AV: E=Sophos;i="5.90,281,1643702400"; d="scan'208";a="244534070" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Apr 2022 00:39:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,281,1643702400"; d="scan'208";a="648516336" Received: from p12hl98bong5.png.intel.com ([10.158.65.178]) by FMSMGA003.fm.intel.com with ESMTP; 22 Apr 2022 00:39:32 -0700 From: Ong Boon Leong To: Alexandre Torgue , Jose Abreu , Andrew Lunn , Heiner Kallweit , Russell King , Paolo Abeni , "David S . Miller" , Jakub Kicinski , Maxime Coquelin , Alexandre Torgue , Giuseppe Cavallaro Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Ong Boon Leong Subject: [PATCH net-next 2/4] net: stmmac: introduce PHY-less setup support Date: Fri, 22 Apr 2022 15:35:03 +0800 Message-Id: <20220422073505.810084-3-boon.leong.ong@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422073505.810084-1-boon.leong.ong@intel.com> References: <20220422073505.810084-1-boon.leong.ong@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220422_003953_988396_EC221420 X-CRM114-Status: GOOD ( 16.79 ) 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 Certain platform uses PHY-less configuration whereby the MAC controller is connected to network switch chip directly over SGMII or 1000BASE-X. This patch prepares the stmmac driver to support PHY-less configuration described above. Tested-by: Emilio Riva Signed-off-by: Ong Boon Leong --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 10 +++++++++- drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 2 +- include/linux/stmmac.h | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 57cb11abec8..4d39387bc48 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -1142,11 +1142,18 @@ static void stmmac_check_pcs_mode(struct stmmac_priv *priv) static int stmmac_init_phy(struct net_device *dev) { struct stmmac_priv *priv = netdev_priv(dev); + struct stmmac_mdio_bus_data *mdio_bus_data; struct device_node *node; - int ret; + int ret = 0; + mdio_bus_data = priv->plat->mdio_bus_data; node = priv->plat->phylink_node; + if (mdio_bus_data->phyless) { + netdev_info(priv->dev, "using PHY-less setup\n"); + goto phyless_setup; + } + if (node) ret = phylink_of_phy_connect(priv->phylink, node, 0); @@ -1166,6 +1173,7 @@ static int stmmac_init_phy(struct net_device *dev) ret = phylink_connect_phy(priv->phylink, phydev); } +phyless_setup: if (!priv->plat->pmt) { struct ethtool_wolinfo wol = { .cmd = ETHTOOL_GWOL }; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c index 9bc625fccca..16ce188697e 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c @@ -490,7 +490,7 @@ int stmmac_mdio_register(struct net_device *ndev) if (priv->plat->has_xgmac) stmmac_xgmac2_mdio_read(new_bus, 0, MII_ADDR_C45); - if (priv->plat->phy_node || mdio_node) + if (priv->plat->phy_node || mdio_node || mdio_bus_data->phyless) goto bus_register_done; found = 0; diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index f8e8df25098..238d452ef43 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -82,6 +82,7 @@ struct stmmac_mdio_bus_data { unsigned int phy_mask; unsigned int has_xpcs; unsigned int xpcs_an_inband; + unsigned int phyless; int *irqs; int probed_phy_irq; bool needs_reset;