From: Frank Li <Frank.li@nxp.com>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: Chester Lin <chester62515@gmail.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
Conor Dooley <conor+dt@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
devicetree@vger.kernel.org, Eric Dumazet <edumazet@google.com>,
Fabio Estevam <festevam@gmail.com>,
Ghennadi Procopciuc <ghennadi.procopciuc@oss.nxp.com>,
imx@lists.linux.dev, Jakub Kicinski <kuba@kernel.org>,
Jan Petrous <jan.petrous@oss.nxp.com>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Lee Jones <lee@kernel.org>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
linux-stm32@st-md-mailman.stormreply.com,
Matthias Brugger <mbrugger@suse.com>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
netdev@vger.kernel.org, NXP S32 Linux Team <s32@nxp.com>,
Paolo Abeni <pabeni@redhat.com>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Rob Herring <robh@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Shawn Guo <shawnguo@kernel.org>,
linaro-s32@linaro.org
Subject: Re: [PATCH v2 0/4] s32g: Use a syscon for GPR
Date: Mon, 15 Dec 2025 10:56:49 -0500 [thread overview]
Message-ID: <aUAvwRmIZBC0W6ql@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <cover.1765806521.git.dan.carpenter@linaro.org>
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.
You still use regmap by use MMIO. /* GMAC_0_CTRL_STS */
regmap = devm_regmap_init_mmio(dev, sts_offset, ®map_config);
So all code can use regmap function without if-then statements if SCMI work
as regmap.
Frank
>where if we use a syscon interface we can write
> a driver to handle that quite transparently without modifying each
> individual driver which reads or writes to one of these registers.
> That code is out of tree for now, but eventually we'll want to
> support this.
>
> Changed since v1:
> * Add imx@lists.linux.dev to the CC list.
> * Fix forward porting bug. s/PHY_INTF_SEL_RGMII/S32_PHY_INTF_SEL_RGMII/
> * Use the correct SoC names nxp,s32g2-gpr and nxp,s32g3-gpr instead of
> nxp,s32g-gpr which is the SoC family.
> * Fix the phandle name by adding the vendor prefix
> * Fix the documentation for the phandle
> * Remove #address-cells and #size-cells from the syscon block
>
> Here is the whole list of registers in the GPR region
>
> Starting from 0x4007C000
>
> 0 Software-Triggered Faults (SW_NCF)
> 4 GMAC Control (GMAC_0_CTRL_STS)
> 28 CMU Status 1 (CMU_STATUS_REG1)
> 2C CMUs Status 2 (CMU_STATUS_REG2)
> 30 FCCU EOUT Override Clear (FCCU_EOUT_OVERRIDE_CLEAR_REG)
> 38 SRC POR Control (SRC_POR_CTRL_REG)
> 54 GPR21 (GPR21)
> 5C GPR23 (GPR23)
> 60 GPR24 Register (GPR24)
> CC Debug Control (DEBUG_CONTROL)
> F0 Timestamp Control (TIMESTAMP_CONTROL_REGISTER)
> F4 FlexRay OS Tick Input Select (FLEXRAY_OS_TICK_INPUT_SELECT_REG)
> FC GPR63 Register (GPR63)
>
> Starting from 0x4007CA00
>
> 0 Coherency Enable for PFE Ports (PFE_COH_EN)
> 4 PFE EMAC Interface Mode (PFE_EMACX_INTF_SEL)
> 20 PFE EMACX Power Control (PFE_PWR_CTRL)
> 28 Error Injection on Cortex-M7 AHB and AXI Pipe (CM7_TCM_AHB_SLICE)
> 2C Error Injection AHBP Gasket Cortex-M7 (ERROR_INJECTION_AHBP_GASKET_CM7)
> 40 LLCE Subsystem Status (LLCE_STAT)
> 44 LLCE Power Control (LLCE_CTRL)
> 48 DDR Urgent Control (DDR_URGENT_CTRL)
> 4C FTM Global Load Control (FLXTIM_CTRL)
> 50 FTM LDOK Status (FLXTIM_STAT)
> 54 Top CMU Status (CMU_STAT)
> 58 Accelerator NoC No Pending Trans Status (NOC_NOPEND_TRANS)
> 90 SerDes RD/WD Toggle Control (PCIE_TOGGLE)
> 94 SerDes Toggle Done Status (PCIE_TOGGLEDONE_STAT)
> E0 Generic Control 0 (GENCTRL0)
> E4 Generic Control 1 (GENCTRL1)
> F0 Generic Status 0 (GENSTAT0)
> FC Cortex-M7 AXI Parity Error and AHBP Gasket Error Alarm (CM7_AXI_AHBP_GASKET_ERROR_ALARM)
>
> Starting from 4007C800
>
> 4 GPR01 Register (GPR01)
> 30 GPR12 Register (GPR12)
> 58 GPR22 Register (GPR22)
> 70 GPR28 Register (GPR28)
> 74 GPR29 Register (GPR29)
>
> Starting from 4007CB00
>
> 4 WKUP Pad Pullup/Pulldown Select (WKUP_PUS)
>
> Dan Carpenter (4):
> net: stmmac: s32: use a syscon for S32_PHY_INTF_SEL_RGMII
> dt-bindings: mfd: syscon: Document the GPR syscon for the NXP S32 SoCs
> dt-bindings: net: nxp,s32-dwmac: Use the GPR syscon
> dts: s32g: Add GPR syscon region
>
> .../devicetree/bindings/mfd/syscon.yaml | 4 ++++
> .../bindings/net/nxp,s32-dwmac.yaml | 10 ++++++++
> arch/arm64/boot/dts/freescale/s32g2.dtsi | 6 +++++
> arch/arm64/boot/dts/freescale/s32g3.dtsi | 6 +++++
> .../net/ethernet/stmicro/stmmac/dwmac-s32.c | 23 +++++++++++++++----
> 5 files changed, 44 insertions(+), 5 deletions(-)
>
> --
> 2.51.0
>
next prev parent reply other threads:[~2025-12-15 15:57 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-15 14:41 [PATCH v2 0/4] s32g: Use a syscon for GPR Dan Carpenter
2025-12-15 14:41 ` [PATCH v2 1/4] net: stmmac: s32: use a syscon for S32_PHY_INTF_SEL_RGMII Dan Carpenter
2025-12-15 14:42 ` [PATCH v2 4/4] dts: s32g: Add GPR syscon region Dan Carpenter
2025-12-15 15:56 ` Frank Li [this message]
2025-12-15 18:33 ` [PATCH v2 0/4] s32g: Use a syscon for GPR Dan Carpenter
2025-12-15 19:28 ` Frank Li
2025-12-15 20:11 ` Dan Carpenter
2025-12-15 21:07 ` Frank Li
2025-12-16 7:56 ` Dan Carpenter
2025-12-16 14:42 ` Frank Li
2025-12-16 18:30 ` Dan Carpenter
2025-12-17 19:19 ` Frank Li
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aUAvwRmIZBC0W6ql@lizhi-Precision-Tower-5810 \
--to=frank.li@nxp.com \
--cc=alexandre.torgue@foss.st.com \
--cc=andrew+netdev@lunn.ch \
--cc=chester62515@gmail.com \
--cc=conor+dt@kernel.org \
--cc=dan.carpenter@linaro.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=festevam@gmail.com \
--cc=ghennadi.procopciuc@oss.nxp.com \
--cc=imx@lists.linux.dev \
--cc=jan.petrous@oss.nxp.com \
--cc=kernel@pengutronix.de \
--cc=krzk+dt@kernel.org \
--cc=kuba@kernel.org \
--cc=lee@kernel.org \
--cc=linaro-s32@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mbrugger@suse.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=robh@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=s32@nxp.com \
--cc=shawnguo@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox