From patchwork Sun Jun 2 14:36:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 13682910 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 EEC2FC27C4F for ; Sun, 2 Jun 2024 14:37:18 +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=MeHD9KEApNk63hX//GrH4qdYdG0r7yBgJ7CVaw0nFqI=; b=x5ZTG9Mi3tYFR6 iQ2j+C6WOKBgWmrhSJFy1oUPCVdKwWRPh6CFeQwftnvPhRL8jzgn4PAcWAl+Ps6D2MpRr3jtKlHs/ o/8Vd2L7emInzInuL218TFnKJRgaCAg0JWXCr5E5hEGvW1z1PBXU9utRXueX8AOXKNbnew1a7cJNT 2ZIx/GfPPi5m8NYBlmk5V6cz9itBQUw3ngbsSy0j/Y6CQGEa2GGnGfB0lAkDnBpe4VJ/NFmibu7nB UgIJcMExz1cGTuwhyW2Yw1IiJSYL4FWebi9FfVcpSol8csjzwf6ZjOvuXMydALgBx01veL6XcqofM xgv02y/+8Dla6CPn1uDg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sDmKZ-0000000EQ6X-2jhM; Sun, 02 Jun 2024 14:37:07 +0000 Received: from mail-lf1-x12f.google.com ([2a00:1450:4864:20::12f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sDmKX-0000000EQ49-0WgZ for linux-arm-kernel@lists.infradead.org; Sun, 02 Jun 2024 14:37:06 +0000 Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-52b919d1fc0so780278e87.0 for ; Sun, 02 Jun 2024 07:37:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717339023; x=1717943823; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dU7sOuoCnE7DZBaFJYawXWXaLrHsBgPyxKdpukglgGI=; b=B55IQ7bQfnN3yrSpH2qgL9CfTTolNtVnpY+KwlBIx1U2liU8AkBR6TuvvfKipZE3OJ FzBoL/ljNMVybHXG5K9sAhWqzwYgyLLlcX1kq3v7jdxycNPwAf3dPGnXhtOMObcKAnmv Sc8CxdEcDfC3C/fD8HwqgUiDi5zmr3fC/qWVwoUcLE5wk/WYNeJnkLsHiVCNfkHi6Kiq SBwou/rxieNfstu3noYqk3NLEiZsk7uy+WZWxisSYlxUI/lmvC2AqLvdue/tck3RJTh7 slM+6cBa1lwEjTYVolnGp0d68lPFCL1DSPuCBlX3EmLiIuIVC4k1Q41tWNAuV7V5fkNJ pCFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717339023; x=1717943823; 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:message-id:reply-to; bh=dU7sOuoCnE7DZBaFJYawXWXaLrHsBgPyxKdpukglgGI=; b=O6/7yefsoUSOQ0aOYZksRCZ9ONI8Jv2v62ekXfUyN/Ed63akGPbM2gLbfeKeui1e+u KUGCWdCbauggDc9T19cMR6MSoElu1UZSO15m9+BPRVPNVWe3UYlmE8LcM+gx6u/bLVIk RPSZfHXEPD+VnrFW07qsMhrqb4+epl9uxOyOAi8AOl9m0vZrYr6qqxdxC1JuUche7135 B6CGwb8TvsZuyoyome+dcNsOnMirmOSgGiURSx6/ZcCj2RE0aoSO+UBCfpd+whxtEy1J KyZjEIjR03JX8SQZqoH/iW68sZuaJQRC4WwyH4KwGk5pJC1bsb1KaUpC5asqK7a1wYbs oYVA== X-Forwarded-Encrypted: i=1; AJvYcCX3vde5zgdIEMpvmgtTq8wmoRlqtdGLAonwyCVJzKCSfGc/zy8z49XEKoJgb/J04kL+aOF8w42uF1Ylm6S3X88b5WMKilNlWQhn7npAm2HCZtNiisQ= X-Gm-Message-State: AOJu0YxWxlxrcEUYNmWU8cVZGvpY7nJKL1utHosUP8Zi0Aj1ffOo4ysj 1+vgGlop+zz58XRXpCKQ6rx79IkrekZwnwMaNH4BBx7ngh2XK4UZ X-Google-Smtp-Source: AGHT+IGG30UwFOotd/0Zdrr/C30omiONtB0LV+xIFdYgqxXQLjQdJQlWg/j2uttrnvCHheKu72hvDg== X-Received: by 2002:a19:5f53:0:b0:52b:8912:2843 with SMTP id 2adb3069b0e04-52b89122a59mr1943524e87.32.1717339022871; Sun, 02 Jun 2024 07:37:02 -0700 (PDT) Received: from localhost ([178.178.142.64]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52b84d34b18sm966116e87.12.2024.06.02.07.37.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jun 2024 07:37:02 -0700 (PDT) From: Serge Semin To: Andrew Lunn , Heiner Kallweit , Russell King , Alexandre Torgue , Jose Abreu , Jose Abreu , Vladimir Oltean , Florian Fainelli , Maxime Chevallier , Rob Herring , Krzysztof Kozlowski , Conor Dooley , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin Cc: Serge Semin , Sagar Cheluvegowda , Abhishek Chauhan , Andrew Halaney , Jiawen Wu , Mengyuan Lou , Tomer Maimon , openbmc@lists.ozlabs.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH net-next v2 10/10] net: stmmac: Add DW XPCS specified via "pcs-handle" support Date: Sun, 2 Jun 2024 17:36:24 +0300 Message-ID: <20240602143636.5839-11-fancer.lancer@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240602143636.5839-1-fancer.lancer@gmail.com> References: <20240602143636.5839-1-fancer.lancer@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240602_073705_216791_1AF18D87 X-CRM114-Status: GOOD ( 15.89 ) 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 Recently the DW XPCS DT-bindings have been introduced and the DW XPCS driver has been altered to support the DW XPCS registered as a platform device. In order to have the DW XPCS DT-device accessed from the STMMAC driver let's alter the STMMAC PCS-setup procedure to support the "pcs-handle" property containing the phandle reference to the DW XPCS device DT-node. The respective fwnode will be then passed to the xpcs_create_fwnode() function which in its turn will create the DW XPCS descriptor utilized in the main driver for the PCS-related setups. Signed-off-by: Serge Semin --- drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c index 807789d7309a..dc040051aa53 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c @@ -497,15 +497,22 @@ int stmmac_mdio_reset(struct mii_bus *bus) int stmmac_pcs_setup(struct net_device *ndev) { + struct fwnode_handle *devnode, *pcsnode; struct dw_xpcs *xpcs = NULL; struct stmmac_priv *priv; int addr, mode, ret; priv = netdev_priv(ndev); mode = priv->plat->phy_interface; + devnode = priv->plat->port_node; if (priv->plat->pcs_init) { ret = priv->plat->pcs_init(priv); + } else if (fwnode_property_present(devnode, "pcs-handle")) { + pcsnode = fwnode_find_reference(devnode, "pcs-handle", 0); + xpcs = xpcs_create_fwnode(pcsnode, mode); + fwnode_handle_put(pcsnode); + ret = PTR_ERR_OR_ZERO(xpcs); } else if (priv->plat->mdio_bus_data && priv->plat->mdio_bus_data->has_xpcs) { addr = priv->plat->mdio_bus_data->xpcs_addr; @@ -515,10 +522,8 @@ int stmmac_pcs_setup(struct net_device *ndev) return 0; } - if (ret) { - dev_warn(priv->device, "No xPCS found\n"); - return ret; - } + if (ret) + return dev_err_probe(priv->device, ret, "No xPCS found\n"); priv->hw->xpcs = xpcs;