From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (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 C13553358A8 for ; Tue, 16 Dec 2025 07:56:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765871784; cv=none; b=nkS6OpVjbKIsXbOMdGQ/6msir8d1IP7pnSEm5N1T6sTVp+nIhg9kNBZlZx73T6sz3POwf+1msNolHc4oFAnkjFgxxlw4z4+lspmEduftJglRCVl06yhEU08663/6zWApmqLt7orfdo/CQn3AKbiCW8a67hmf90Bh8XiwOgbIVZA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765871784; c=relaxed/simple; bh=UvaxdPuzE9cHgjQPNN5Yc11mBV2d86BG3I765ToiYLQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=kMtYubN3nl7jxL1mQ2qK+lK+nV7UH5DkFc3tXz/Y2JmbVDEOZanxVJ6uyvzHr1qo1rY9JZnssbEPEBhsDrDPgCVeW9sGC5RfsYJqLpCguDpzyixKWD3zsSl9+DiVt5PgMlmvEpci9vC7TPO3vXlLJ528lm3j5LLe9jHZbQ8omNw= 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=kKL4AC78; arc=none smtp.client-ip=209.85.128.45 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="kKL4AC78" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-477b5e0323bso18605865e9.0 for ; Mon, 15 Dec 2025 23:56:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1765871767; x=1766476567; 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=dgLiR9L5wEhCMccIYV392PBhORkDXeC6wYlSh2crOgg=; b=kKL4AC788ZGK7hbbd+EIUBXOOeZA3iigMdC1aw6LkK+PSmvbQIwrR87cyEwETDgDSH hKbJI4VrZnCpnroLWGyHQe2iT5i8IjXwG4CigDh4c7PG5UsoKDWvPdyM27Q6eIXpcNAg YUaVS6J0O3LY3xuU6PU4fqg/9NFffcntId8Aj09azJ3Zce3uVKeU4dJ7Bls1L8w1hXH8 br0i69YJ/GNnZJaYIgBU6mr38Hp9CJUIrqr7RCp3mIC7nRK7h7jxbFEV9lYuWPTuMgK/ KKTYatLaS/hZF5weJQeohBEtOlE8zymH/uaoDxui0T81ZjhISFVXBHZGrbSrYnKrSV88 H69Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765871767; x=1766476567; 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=dgLiR9L5wEhCMccIYV392PBhORkDXeC6wYlSh2crOgg=; b=UKux/queyBcMQ/pVzdBSDX9hp4HhwBt2X3OfggNbTEYcz+TLZII2cbe0xOBSofhD0l ZOOIGaS8SAeU+nG3N3SdNY6lelZotavoimUOYDUWf7DIB4PZ8G33DA8wtfNT+biBQ7HD o4I0o406qOawHD5FvuYIqcMWkxY9CbQ7TMUZMjYDD5T1sTWBx21HyoH//qcUEeo0+mvs uTpmXEz/HWDx3vc7yg4tsCU8+++X5A4GKa1eecfh5zZpu5eL0Cl4WmVUajV35aoKun9q y11Chwgp3e5WeBEDrJ5JfIpHSjLzU+pjUnT5yQgnhpjhgybE5Oo0mnLOfKJWVeoH0kr/ L9QA== X-Forwarded-Encrypted: i=1; AJvYcCWXnZEQ/lqRcSdNoFw28eJAHM2HInOiNOGJN2bhf5uJJl/1jn09IR+7Sa5lnXR0tDG3ZJnEUoIxzG5Q@vger.kernel.org X-Gm-Message-State: AOJu0Yz9gep30Y1dQBEXWGrpC471Ix3FNfe1jLWepZmDykbUGppgCD/S tqT2+531XvDEksKVuGYj9IL5FidOqhDNzJkdjnVLUZiQvve9TQ7XINuAayZJMk7ezGs= X-Gm-Gg: AY/fxX6KWCVbdvu8rO2ikvR86Q2aIkaaa5KKnCuJkAzqxEvprvmRyY6JNuuYq2MZlSY e5W68VJbFAFQ8ywus9Yc4h7bG5BNBOEPVWJRNx62UJONSVFVYkili8evk8chtlhfQak4nhKnFbh jKgt5IPBVP48CMraWuHuFg7UGq+bEyVBnv7Uf/3nIVnHJ2MWhlfbg7njuFeycs8isUOYVU6RH6l bfX6FCZTubYm5EgKTUtj0Z2qN2gwAb812CO+pdgd5M3MUQHTiW+tKu/IdCTJbI2/zLeJj3cFG1+ zApozEQgx2hdEafJOcMgGyfl0s153I+aO+RoEweKT1l1SuhKjD3hp8zSwLX8TNqQS4hAgZp51Re fom+ER5nV/5IodJTHJ+I2ysn5jbSPDeyYGXu0a2Q1W0vzROO04+6/8THAkHWmViF35cTRzk6jGl J+QiDFDFdaWJs8SEp5 X-Google-Smtp-Source: AGHT+IG+piBYJp8yRE0JaiL0XBKJcrLuB82TEEFiVQtz41FJiO/E2QY1ciGNs20Cvz2Woq6tSTEwTw== X-Received: by 2002:a05:6000:26d0:b0:430:f74d:6e9f with SMTP id ffacd0b85a97d-430f74d6ef6mr8155517f8f.14.1765871766545; Mon, 15 Dec 2025 23:56:06 -0800 (PST) Received: from localhost ([196.207.164.177]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-430f1fa232csm19824386f8f.6.2025.12.15.23.56.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Dec 2025 23:56:06 -0800 (PST) Date: Tue, 16 Dec 2025 10:56:02 +0300 From: Dan Carpenter To: Frank Li Cc: Chester Lin , Alexandre Torgue , Andrew Lunn , Conor Dooley , "David S. Miller" , devicetree@vger.kernel.org, Eric Dumazet , Fabio Estevam , Ghennadi Procopciuc , imx@lists.linux.dev, Jakub Kicinski , Jan Petrous , Krzysztof Kozlowski , Lee Jones , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, Matthias Brugger , Maxime Coquelin , netdev@vger.kernel.org, NXP S32 Linux Team , Paolo Abeni , Pengutronix Kernel Team , Rob Herring , Sascha Hauer , Shawn Guo , linaro-s32@linaro.org Subject: Re: [PATCH v2 0/4] s32g: Use a syscon for GPR Message-ID: References: Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Mon, Dec 15, 2025 at 04:07:48PM -0500, Frank Li wrote: > On Mon, Dec 15, 2025 at 11:11:03PM +0300, Dan Carpenter wrote: > > On Mon, Dec 15, 2025 at 02:28:43PM -0500, Frank Li wrote: > > > On Mon, Dec 15, 2025 at 09:33:54PM +0300, Dan Carpenter wrote: > > > > On Mon, Dec 15, 2025 at 10:56:49AM -0500, Frank Li wrote: > > > > > On Mon, Dec 15, 2025 at 05:41:43PM +0300, Dan Carpenter wrote: > > > > > > The s32g devices have a GPR register region which holds a number of > > > > > > miscellaneous registers. Currently only the stmmac/dwmac-s32.c uses > > > > > > anything from there and we just add a line to the device tree to > > > > > > access that GMAC_0_CTRL_STS register: > > > > > > > > > > > > reg = <0x4033c000 0x2000>, /* gmac IP */ > > > > > > <0x4007c004 0x4>; /* GMAC_0_CTRL_STS */ > > > > > > > > > > > > We still have to maintain backwards compatibility to this format, > > > > > > of course, but it would be better to access these through a syscon. > > > > > > First of all, putting all the registers together is more organized > > > > > > and shows how the hardware actually is implemented. Secondly, in > > > > > > some versions of this chipset those registers can only be accessed > > > > > > via SCMI, if the registers aren't grouped together each driver will > > > > > > have to create a whole lot of if then statements to access it via > > > > > > IOMEM or via SCMI, > > > > > > > > > > Does SCMI work as regmap? syscon look likes simple, but missed abstract > > > > > in overall. > > > > > > > > > > > > > The SCMI part of this is pretty complicated and needs discussion. It > > > > might be that it requires a vendor extension. Right now, the out of > > > > tree code uses a nvmem vendor extension but that probably won't get > > > > merged upstream. > > > > > > > > But in theory, it's fairly simple, you can write a regmap driver and > > > > register it as a syscon and everything that was accessing nxp,phy-sel > > > > accesses the same register but over SCMI. > > > > > > nxp,phy-sel is not standard API. Driver access raw register value. such > > > as write 1 to offset 0x100. > > > > > > After change to SCMI, which may mapped to difference command. Even change > > > to other SOC, value and offset also need be changed. It is not standilzed > > > as what you expected. > > > > We're writing to an offset in a syscon. Right now the device tree > > says that the syscon is an MMIO syscon. But for SCMI devices we > > would point the phandle to a custom syscon. The phandle and the offset > > would stay the same, but how the syscon is implemented would change. > > Your SCMI syscon driver will convert some private hard code to some > function, such previous example's '1' as SEL_RGMII. It is hard maintained > in long term. > No, there isn't any conversion needed. It's exactly the same as writing to the register except it goes through SCMI. > > > > > > > > > > > > > > You still use regmap by use MMIO. /* GMAC_0_CTRL_STS */ > > > > > > > > > > regmap = devm_regmap_init_mmio(dev, sts_offset, ®map_config); > > > > > > > > > > > > > You can use have an MMIO syscon, or you can create a custom driver > > > > and register it as a syscon using of_syscon_register_regmap(). > > > > > > My means is that it is not necessary to create nxp,phy-sel, especially > > > there already have <0x4007c004 0x4>; /* GMAC_0_CTRL_STS */ > > > > > > > Right now the out of tree dwmac-s32cc.c driver does something like > > this: > > > > 89 if (gmac->use_nvmem) { > > 90 ret = write_nvmem_cell(gmac->dev, "gmac_phy_intf_sel", intf_sel); > > 91 if (ret) > > 92 return ret; > > 93 } else { > > 94 writel(intf_sel, gmac->ctrl_sts); > > 95 } > > > > Which is quite complicated, but with a syscon, then it's just: > > > > regmap_write(gmac->sts_regmap, gmac->sts_offset, S32_PHY_INTF_SEL_RGMII); > > > > Even without SCMI, the hardware has all these registers grouped together > > it just feels cleaner to group them together in the device tree as well. > > Why not implement standard phy interface, > phy_set_mode_ext(PHY_MODE_ETHERNET, RGMII); > > For example: drivers/pci/controller/dwc/pci-imx6.c > > In legency platform, it use syscon to set some registers. It becomes mess > when more platform added. And it becomes hard to convert because avoid > break compatibltiy now. > > It doesn't become worse since new platforms switched to use standard > inteface, (phy, reset ...). > This happens below that layer, this is just saying where the registers are found. The GMAC_0_CTRL_STS is just one register in the GPR region, most of the others are unrelated to PHY. regards, dan carpenter