From nobody Sun Feb 8 06:49:43 2026 Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF66122D7B9 for ; Fri, 23 Jan 2026 19:51:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769197877; cv=none; b=h4upbGVUUV6Al+pSB/6gGHmlwWCcE+RwAMvRjafaq26LXl8obgSe3nggYVILZMCZINS7RVFmigaZc2wWMyuVp7zpwlGDoyF2UDvW7edkbMurd9C1ypmIfcUIz9LK3F/So2p5uPJYSKDlooZB/wkUw6pEN2a2y2PVRdJMdStp4To= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769197877; c=relaxed/simple; bh=4cqSz3lY0LahuG/j0CMYaZzp90KYqJNiS3dbc0Xv/6w=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Acny3rirpdL2mVUIz9cqAAu/rV+Sk4UzLe3sBAdWWQpIx7tPV99BhIbF6hLRIMAzS4X17qyUnlx74Z/L5e6PY5P6NazhGkBZxQg1V6XVfdNRrk7hhYOklgAU1C20tuJlEqsa0aJxWhAI4L9riSvDKA0mNi/LUqajVlN+3A5g6H8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=bnvrNziP; arc=none smtp.client-ip=209.85.221.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="bnvrNziP" Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-432d2c7a8b9so2491753f8f.2 for ; Fri, 23 Jan 2026 11:51:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1769197874; x=1769802674; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=UmphJA0oiA6TDyGHVSdklpPRPAEFYSyTBQggvAD3gKE=; b=bnvrNziP2vYaDnr5/xqykTR6VN32yzrpUFoomi6R1q4j033AkSw2Y+3fIQWTe/fc1D CVjkofe0Hjb0ZRj+hIJYZwAStb+99eUynQoynrjuif6Z+AmORtFTurLPIEK5OAEzOmVz oPhTeOFaElh2ZmVKuFj4kzQOFcSuEJlArKlJxL1woKQ2M3rlu4hP+yZFXhsp1CMYAM4W dvqTgPdGM1d95kq/3VzdN6OkkSp7Mdrsw8aQywf68tC05A3PONWbvSMMK5djnyH2HQM2 huNHtRSX25ol7GynbEfnQUgK2euKFmFUQnm100ogZ9Cr7/N5vctKyVai/aquSAphUBpV KPIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769197874; x=1769802674; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UmphJA0oiA6TDyGHVSdklpPRPAEFYSyTBQggvAD3gKE=; b=J0Isv7OTMeilKLNCkAR7lBDowo95Em+T1BrzzcOMw/xRdKFIcEmrUJp1SuXNsFKQgr PgN3trl9BpXvL/ak9hmo8YvcYfoj1ZokSDM+NymZtS7F8ewyQ57zlqOHhZZfqnCM8L8Y 6llpwhrMIhxKE1aO6ssgqHpSKtriFzeanE26B4W6JZLXk1pmGGePHzFCIxBx5Wc0EFsg 1Q/q9BkABQvtUyZG9fKxA9CaIHHFbU0XmaeYsmXwjh3edijaoVEXJUMX99ZdIpjlriCt MOgJeVoYqRcum4lKY+pzivrut+OkU4L2FJyyk1LER8wXhHA4sndz3BsKT7n382B2L01R trMQ== X-Forwarded-Encrypted: i=1; AJvYcCXb2RJzue3CcdrP7gJlr5uSbGMpLnphvy9q9fFWC7nTcIwhUTy3VutXVe2StVUg/+Wiq9TJAP2tm0rLTMA=@vger.kernel.org X-Gm-Message-State: AOJu0YyZrWhyj8vA/nrSnXU5RrX+B2bVzkWaCq5TUbtWvVQjnrRZnRHA bbqF+/BHOZHP+k2HdLbjsrFjDcqhRdeLqA+nDFkRNSaC9lbssvqNOshuARcZxLp/IhE= X-Gm-Gg: AZuq6aK6aSBxa0PLW27i+vAYKJmhVeY/JXokjUFB0I5UKp5TtCqZvugXpMLwFLsApQR 9sZbzNDk6zktt1UCky9eul9/otPVk7MRc2vhkr9QGf7NjqBISvBJ6kL9r7lZGmtmxotaFi11XVD IL2Lw8Mp+ebNrIucu4FM1mx/XUhnXVQjD+ia9d59E6sa2bJW8YH5hlxowdA0ZDbywM644ZkFguJ sBpTz3u2YVkaQoGu9CgTvRn/m2AR6x/g2E4CaSAqLUpEuEjP6SF+7s8CP27ZdFmD69trAb095UX 177qQzhsEpxogpo8LLlIFB35ZUp8yDe8166FeFGKelB+E9WYPxf4aAoRi/fUeo4MRvb9sUo4do2 DkIzzJdYY6IpO5PCbSjDDXo8E54cg4pD6CSCuaxc8k3qLxBinf1nbK+TXz1TPm3ykKFmsUirqAz qOi02kuKj88zH2i7oM X-Received: by 2002:a05:6000:22c1:b0:42f:b707:56f0 with SMTP id ffacd0b85a97d-435b1605719mr7557722f8f.37.1769197874256; Fri, 23 Jan 2026 11:51:14 -0800 (PST) Received: from localhost ([196.207.164.177]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-435b1f742d6sm8529079f8f.30.2026.01.23.11.51.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jan 2026 11:51:13 -0800 (PST) Date: Fri, 23 Jan 2026 22:51:10 +0300 From: Dan Carpenter To: Jan Petrous Cc: s32@nxp.com, Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Alexandre Torgue , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Frank Li , linaro-s32@linaro.org, imx@lists.linux.dev Subject: [PATCH v4 1/3] net: stmmac: s32: use a syscon for S32_PHY_INTF_SEL_RGMII Message-ID: <8f2139e8adf02b485a4c84d558fc23f78cf04add.1769195864.git.dan.carpenter@linaro.org> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" On the s32 chipsets the GMAC_0_CTRL_STS register is in GPR region. Originally, accessing this register was done in a sort of ad-hoc way, but we want to use the syscon interface to do it. This is a little bit ugly because we have to maintain backwards compatibility to the old device trees so we have to support both ways to access this register. Signed-off-by: Dan Carpenter --- v3: no change v2: no change v1: Fix forward porting bug. s/PHY_INTF_SEL_RGMII/S32_PHY_INTF_SEL_RGMII/ .../net/ethernet/stmicro/stmmac/dwmac-s32.c | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-s32.c b/drivers/net/= ethernet/stmicro/stmmac/dwmac-s32.c index 5a485ee98fa7..2e6bb41f49e1 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-s32.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-s32.c @@ -11,12 +11,14 @@ #include #include #include +#include #include #include #include #include #include #include +#include #include =20 #include "stmmac_platform.h" @@ -32,6 +34,8 @@ struct s32_priv_data { void __iomem *ioaddr; void __iomem *ctrl_sts; + struct regmap *sts_regmap; + unsigned int sts_offset; struct device *dev; phy_interface_t *intf_mode; struct clk *tx_clk; @@ -40,7 +44,10 @@ struct s32_priv_data { =20 static int s32_gmac_write_phy_intf_select(struct s32_priv_data *gmac) { - writel(S32_PHY_INTF_SEL_RGMII, gmac->ctrl_sts); + if (gmac->ctrl_sts) + writel(S32_PHY_INTF_SEL_RGMII, gmac->ctrl_sts); + else + regmap_write(gmac->sts_regmap, gmac->sts_offset, S32_PHY_INTF_SEL_RGMII); =20 dev_dbg(gmac->dev, "PHY mode set to %s\n", phy_modes(*gmac->intf_mode)); =20 @@ -125,10 +132,16 @@ static int s32_dwmac_probe(struct platform_device *pd= ev) "dt configuration failed\n"); =20 /* PHY interface mode control reg */ - gmac->ctrl_sts =3D devm_platform_get_and_ioremap_resource(pdev, 1, NULL); - if (IS_ERR(gmac->ctrl_sts)) - return dev_err_probe(dev, PTR_ERR(gmac->ctrl_sts), - "S32CC config region is missing\n"); + gmac->sts_regmap =3D syscon_regmap_lookup_by_phandle_args(dev->of_node, + "nxp,phy-sel", 1, &gmac->sts_offset); + if (gmac->sts_regmap =3D=3D ERR_PTR(-EPROBE_DEFER)) + return PTR_ERR(gmac->sts_regmap); + if (IS_ERR(gmac->sts_regmap)) { + gmac->ctrl_sts =3D devm_platform_get_and_ioremap_resource(pdev, 1, NULL); + if (IS_ERR(gmac->ctrl_sts)) + return dev_err_probe(dev, PTR_ERR(gmac->ctrl_sts), + "S32CC config region is missing\n"); + } =20 /* tx clock */ gmac->tx_clk =3D devm_clk_get(&pdev->dev, "tx"); --=20 2.51.0