R-Car X5H Ironhide SCMI CPG/MDLC remapping
Subsystems (9)
Geert Uytterhoeven
maintainercover R-Car X5H Ironhide SCMI CPG/MDLC remapping
Hi all,
TL;DR:
Describe hardware in DT, and perform the mapping to SCMI in Linux.
The Renesas R-Car X5H-based Ironhide board is the first Renesas SoC/board combination that implements the ARM System Control and Management Interface (SCMI).
This means Linux can no longer perform various system operations (e.g. clock, power domain, and reset control) by accessing the hardware directly. Instead, these operations are abstracted according to various SCMI sub-protocols, and Linux has to send messages to an SCMI-compliant firmware running on a System Control Processor (SCP).
More specifically, the R-Car X5H SCP FW SCMI controls access to:
1. Core clocks and module clocks,
2. Module resets,
3. Power domains,
4. System power.
The latter is not relevant for this discussion.
Using SCMI also has an impact on the board DTS: besides the addition of a firmware/scmi node with protocol-specific subnodes, devices using SCMI-abstracted system resources now have to refer to these resources using resource specifiers containing phandles to the SCMI protocol subnodes, and firmware-specific object IDs[1].
Unfortunately we encountered several issues with this:
- The clock, reset, and power domain IDs are not stable, and may change from one SCP firmware release to another, causing DTB incompatibilities,
- There may be different SCP firmware lineages, e.g. proprietary and certified variants, and FLOSS variants,
- SCMI features and quirks may differ across firmware versions,
- Not all quirks can be handled as SCMI quirks,
- Some core clocks do not support the CLOCK_ATTRIBUTES command, and thus are not accessible to Linux, while Linux may need them, requiring dummy clocks,
- Some module clocks are not accessible to Linux, or report a zero clock rate and have no parent, while several existing drivers need to know their clock rates,
- SCMI does not support the concept of a clock domain, so existing drivers can no longer rely on Runtime PM, but need to be changed to explicit management of functional clocks,
- Some clocks and power domains are critical and must not be disabled, or even touched,
- Some module resets are reserved, and operating them returns an error,
- U-Boot IPL (Initial Program Loader) needs a proper hardware description in DT, not using SCMI.
During last OSSJ/LPC, Marek Vasut pondered if we could keep our own ID lists stable, and perform a mapping to the IDs used by the actual SCMI implementation running on the system. This was also briefly discussed at LPC[2]. After some refining of the initial idea, this series takes a slightly different approach, by:
1. Describing the actual hardware components in DT, plus a minimum SCMI glue,
2. Mapping DT hardware descriptions to SCMI-backed objects (or replacements in case they are unusable), in Linux drivers, based on the detected firmware version.
This has the following advantages:
1. The DT ABI is stable,
2. Current and future firmware quirks can be handled in driver code,
3. If ever needed, the Clock Pulse Generator (CPG) and Module Controller (MDLC) drivers can be extended to program the hardware directly if SCMI is not present,
4. U-Boot IPL can use almost the same DTS; it just needs stripping of SCMI-related nodes and properties.
This series is based on renesas-drivers-2026-04-14-v7.0, which includes a.o. the scmi/for-linux-next branch. It consists of multiple parts:
1. Patches 1-3 add various quirks to the SCMI driver code,
2. Patch 4 enables more SCMI protocols on R-Car X5H Ironhide,
3. Patches 5-8 add new interfaces needed by the remapping drivers,
4. Patches 9-10 add DT bindings for the R-Car X5H Clock Pulse Generator (CPG) and Module Controller (MDLC) blocks,
5. Patches 11-12 add remapping drivers for the R-Car X5H Clock Pulse Generator (CPG) and Module Controller (MDLC) blocks,
6. Patches 13-14 add DTS description for R-Car X5H Ironhide.
Dependencies:
- Lifting "#define SCMI_MAX_NUM_RATES 16" (e.g. scmi/for-linux-next),
- "[PATCH v4 0/3] soc: renesas: add MFIS driver"[3],
- R-Car X5H MFIS and Ironhide SCMI DTS enablement (not yet posted).
For testing, I have pushed this series and its dependencies to the topic/rcar-x5h-ironhide-scmi-cpg-mdlc-remapping-v1 branch of
https://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git.
With this, Ironhide can boot into a serial console shell from a ramdisk, without needing any of "clk_ignore_unused" and "pd_ignore_unused".
FTR, alternative locations to do remapping that we considered:
- Inside the SCMI clock, reset, and power-domain drivers,
- Inside the subsystem driver core (e.g. of_parse_clkspec()),
- Inside the OF driver core,
- Inside the DTB.
Remapping inside DT is usually done through a nexus node (see Devicetree Specification, Section 2.5 Nexus Nodes and Specifier Mapping), using "<specifier>-map", "<specifier>-map-mask", and "<specifier>-map-pass-thru" properties. Linux has support for e.g. remapping interrupts (open-coded in drivers/of/irq.c), and gpios or pwms (using the of_parse_phandle_with_args_map()) helper. So far there is no support for remapping clocks or power domains, but at least for clocks patches have been posted[4]. Then the remapping can be done by adding e.g. "clocks-map{,-mask,-pass-thru}" properties with translation data to the CPG/MDLC DT node, using a DT overlay. The DT overlay could be applied by the firmware or bootloader (e.g. in in fitImage script), or even by the CPG/MDLC Linux driver at runtime (based on detected SCP firmware version). Consumer nodes do not need to be modified. Note that such translations can only support simple cases. If e.g. a workaround is needed to map a single DT clock to multiple SCMI clocks, this cannot be done using a simple translation table.
While a DT overlay is quite flexible and can also do other fixup, it is less user-friendly than doing the remapping in a Linux driver.
Thanks for your comments!
[1] Documentation/devicetree/bindings/firmware/arm,scmi.yaml
[2] "Firmware ABI stability" at Linux Plumbers Conference 2025
https://lpc.events/event/19/contributions/2153/ [3] "[PATCH v4 0/3] soc: renesas: add MFIS driver" https://lore.kernel.org/[email protected]/ [4] "[PATCH] clk: Add support for clock nexus dt bindings" https://lore.kernel.org/[email protected]/
Geert Uytterhoeven (14):
firmware: arm_scmi: quirk: Handle bad power domains on R-Car X5H
firmware: arm_scmi: quirk: Handle bad clocks on R-Car X5H
firmware: arm_scmi: quirk: Handle critical clocks on R-Car X5H
arm64: dts: renesas: ironhide: Enable SCMI devpd, sys, and reset
firmware: arm_scmi: Add scmi_get_base_info()
of: property: fw_devlink: Add support for firmware
pmdomain: Make genpd_get_from_provider() public
reset: Add reset_controller_get_provider()
dt-bindings: clock: Document Renesas R-Car X5H Clock Pulse Generator
dt-bindings: power: Document Renesas R-Car X5H Module Controller
clk: renesas: Add R-Car X5H CPG SCMI remapping driver
pmdomain: renesas: Add R-Car X5H MDLC SCMI remapping driver
arm64: dts: renesas: r8a78000: Add CPG/MDLC nodes
arm64: dts: renesas: ironhide: Add CPG/MDLC firmware properties
.../bindings/clock/renesas,r8a78000-cpg.yaml | 62 + .../bindings/power/renesas,r8a78000-mdlc.yaml | 63 + .../boot/dts/renesas/r8a78000-ironhide.dts | 130 +++ arch/arm64/boot/dts/renesas/r8a78000.dtsi | 300 ++++- drivers/clk/renesas/Kconfig | 4 + drivers/clk/renesas/Makefile | 1 + drivers/clk/renesas/r8a78000-cpg.c | 335 ++++++ drivers/firmware/arm_scmi/clock.c | 37 + drivers/firmware/arm_scmi/driver.c | 31 + drivers/firmware/arm_scmi/power.c | 20 + drivers/firmware/arm_scmi/quirks.c | 12 + drivers/firmware/arm_scmi/quirks.h | 4 + drivers/of/property.c | 2 + drivers/pmdomain/core.c | 4 +- drivers/pmdomain/renesas/Kconfig | 4 + drivers/pmdomain/renesas/Makefile | 1 + drivers/pmdomain/renesas/r8a78000-mdlc.c | 1021 +++++++++++++++++ drivers/reset/core.c | 11 + drivers/soc/renesas/Kconfig | 1 + .../dt-bindings/clock/renesas,r8a78000-cpg.h | 15 + .../dt-bindings/power/renesas,r8a78000-mdlc.h | 16 + include/linux/pm_domain.h | 7 + include/linux/reset-controller.h | 6 + include/linux/scmi_protocol.h | 8 + 24 files changed, 2068 insertions(+), 27 deletions(-) create mode 100644 Documentation/devicetree/bindings/clock/renesas,r8a78000-cpg.yaml create mode 100644 Documentation/devicetree/bindings/power/renesas,r8a78000-mdlc.yaml create mode 100644 drivers/clk/renesas/r8a78000-cpg.c create mode 100644 drivers/pmdomain/renesas/r8a78000-mdlc.c create mode 100644 include/dt-bindings/clock/renesas,r8a78000-cpg.h create mode 100644 include/dt-bindings/power/renesas,r8a78000-mdlc.h
Signature · 12 lines
2.43.0
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus TorvaldsGeert Uytterhoeven
maintainerPATCH 1/14 firmware: arm_scmi: quirk: Handle bad power domains on R-Car X5H
Renesas R-Car X5H SCP FW SDKv4.28.0, v4.31.0, and v4.32.0 advertise a few power domains that crash the system when touched or powered off. Add a quirk to prevent such crashes.
As the SCMI power domain IDs are identical for all three versions, the quirk can be shared.
---
Preventing power off could be handled in the MDLC driver, but no-touch cannot.
--- drivers/firmware/arm_scmi/power.c | 20 ++++++++++++++++++++ drivers/firmware/arm_scmi/quirks.c | 3 +++ drivers/firmware/arm_scmi/quirks.h | 1 + 3 files changed, 24 insertions(+)
drivers/firmware/arm_scmi/power.c +20 -0
@@ -12,6 +12,7 @@#include "protocols.h" #include "notify.h" +#include "quirks.h" /* Updated only after ALL the mandatory features for that version are merged */ #define SCMI_PROTOCOL_SUPPORTED_VERSION 0x30001
@@ -150,6 +151,23 @@ scmi_power_domain_attributes_get(const struct scmi_protocol_handle *ph,return ret; } +#define QUIRK_RCAR_X5H_4_28_BAD_DOMAINS \ + ({ \ + switch (domain) { \ +/* Do not touch */ \ +case 29 :/* PD_RC08 */ \ +case 92 :/* PD_ACL0 */ \ +case 116 :/* PD_CMN */ \ +return -EPERM ; \ + \ +/* Do not power off */ \ +case 76 :/* PD_AC00 */ \ +if (state ==SCMI_POWER_STATE_GENERIC_OFF ) \ +return -EPERM ; \ +break ; \ + } \ + }) +static int scmi_power_state_set (const struct scmi_protocol_handle *ph,u32 domain,u32 state) {
@@ -157,6 +175,8 @@ static int scmi_power_state_set(const struct scmi_protocol_handle *ph,struct scmi_xfer *t;struct scmi_power_set_state *st; +SCMI_QUIRK (power_rcar_x5h_4_28_bad_domains,QUIRK_RCAR_X5H_4_28_BAD_DOMAINS ); + ret = ph->xops->xfer_get_init (ph,POWER_STATE_SET ,sizeof (*st),0 , &t);if (ret)return ret;
drivers/firmware/arm_scmi/quirks.c +3 -0
@@ -172,6 +172,8 @@ struct scmi_quirk {/* Global Quirks Definitions */ DEFINE_SCMI_QUIRK (clock_rates_triplet_out_of_spec,NULL ,NULL ,NULL );DEFINE_SCMI_QUIRK (perf_level_get_fc_force,"Qualcomm" ,NULL ,"0x20000-" ); +DEFINE_SCMI_QUIRK (power_rcar_x5h_4_28_bad_domains,"Renesas" ,NULL , +"0x10a0000-0x10e0000" ,"renesas,r8a78000" );/* * Quirks Pointers Array
@@ -182,6 +184,7 @@ DEFINE_SCMI_QUIRK(perf_level_get_fc_force, "Qualcomm", NULL, "0x20000-");static struct scmi_quirk *scmi_quirks_table[] = {__DECLARE_SCMI_QUIRK_ENTRY (clock_rates_triplet_out_of_spec),__DECLARE_SCMI_QUIRK_ENTRY (perf_level_get_fc_force), +__DECLARE_SCMI_QUIRK_ENTRY (power_rcar_x5h_4_28_bad_domains),NULL };
drivers/firmware/arm_scmi/quirks.h +1 -0
@@ -48,5 +48,6 @@ static inline void scmi_quirks_enable(struct device *dev, const char *vend,/* Quirk delarations */ DECLARE_SCMI_QUIRK (clock_rates_triplet_out_of_spec);DECLARE_SCMI_QUIRK (perf_level_get_fc_force); +DECLARE_SCMI_QUIRK (power_rcar_x5h_4_28_bad_domains);#endif /* _SCMI_QUIRKS_H */
Signature · 1 line
2.43.0
Geert Uytterhoeven
maintainerPATCH 2/14 firmware: arm_scmi: quirk: Handle bad clocks on R-Car X5H
In reply to Geert UytterhoevenRenesas R-Car X5H SCP FW SDKv4.28.0, v4.31.0, and v4.32.0 expose a few clocks that do not support the CLOCK_ATTRIBUTES or CLOCK_DESCRIBE_RATES command. Since commit 0d8b0c8068a8ff5f ("firmware: arm_scmi: Harden clock protocol initialization") in scmi/for-linux-next (next-20260319 and later), scmi_clock_attributes_get() or scmi_clock_describe_rates_get() failures are no longer ignored, but prevent the SCMI clock driver from initializing.
Hence add a quirk to ignore such failures, like before. As the quirk handling is harmless for unaffected systems, make it generic for all R-Car X5H systems using SCP FW SDKv4.28.0 or later.
--- drivers/firmware/arm_scmi/clock.c | 14 ++++++++++++++ drivers/firmware/arm_scmi/quirks.c | 3 +++ drivers/firmware/arm_scmi/quirks.h | 1 + 3 files changed, 18 insertions(+)
drivers/firmware/arm_scmi/clock.c +14 -0
@@ -1232,6 +1232,18 @@ static const struct scmi_protocol_events clk_protocol_events = { .num_events = ARRAY_SIZE(clk_events), }; +#define QUIRK_RCAR_X5H_NO_ATTRIBUTES \ + ({ \ + if (ret == -EREMOTEIO || ret == -EOPNOTSUPP) \ + continue; \ + }) + +#define QUIRK_RCAR_X5H_NO_RATES \ + ({ \ + if (ret == -EOPNOTSUPP) \ + ret = 0; \ + }) +static int scmi_clock_protocol_init (const struct scmi_protocol_handle *ph) {int clkid, ret;
@@ -1256,10 +1268,12 @@ static int scmi_clock_protocol_init(const struct scmi_protocol_handle *ph)for (clkid =0 ; clkid < cinfo->num_clocks; clkid++) { cinfo->clkds[clkid].id = clkid; ret =scmi_clock_attributes_get (ph, clkid, cinfo); +SCMI_QUIRK (clock_rcar_x5h_no_attributes,QUIRK_RCAR_X5H_NO_ATTRIBUTES );if (ret)return ret; ret =scmi_clock_describe_rates_get (ph, clkid, cinfo); +SCMI_QUIRK (clock_rcar_x5h_no_attributes,QUIRK_RCAR_X5H_NO_RATES );if (ret)return ret; }
drivers/firmware/arm_scmi/quirks.c +3 -0
@@ -171,6 +171,8 @@ struct scmi_quirk {/* Global Quirks Definitions */ DEFINE_SCMI_QUIRK (clock_rates_triplet_out_of_spec,NULL ,NULL ,NULL ); +DEFINE_SCMI_QUIRK (clock_rcar_x5h_no_attributes,"Renesas" ,NULL ,"0x10a0000-" , +"renesas,r8a78000" );DEFINE_SCMI_QUIRK (perf_level_get_fc_force,"Qualcomm" ,NULL ,"0x20000-" );DEFINE_SCMI_QUIRK (power_rcar_x5h_4_28_bad_domains,"Renesas" ,NULL ,"0x10a0000-0x10e0000" ,"renesas,r8a78000" );
@@ -183,6 +185,7 @@ DEFINE_SCMI_QUIRK(power_rcar_x5h_4_28_bad_domains, "Renesas", NULL,*/ static struct scmi_quirk *scmi_quirks_table[] = {__DECLARE_SCMI_QUIRK_ENTRY (clock_rates_triplet_out_of_spec), +__DECLARE_SCMI_QUIRK_ENTRY (clock_rcar_x5h_no_attributes),__DECLARE_SCMI_QUIRK_ENTRY (perf_level_get_fc_force),__DECLARE_SCMI_QUIRK_ENTRY (power_rcar_x5h_4_28_bad_domains),NULL
drivers/firmware/arm_scmi/quirks.h +1 -0
@@ -47,6 +47,7 @@ static inline void scmi_quirks_enable(struct device *dev, const char *vend,/* Quirk delarations */ DECLARE_SCMI_QUIRK (clock_rates_triplet_out_of_spec); +DECLARE_SCMI_QUIRK (clock_rcar_x5h_no_attributes);DECLARE_SCMI_QUIRK (perf_level_get_fc_force);DECLARE_SCMI_QUIRK (power_rcar_x5h_4_28_bad_domains);
Signature · 1 line
2.43.0
Geert Uytterhoeven
maintainerPATCH 3/14 firmware: arm_scmi: quirk: Handle critical clocks on R-Car X5H
In reply to Geert UytterhoevenRenesas R-Car X5H SCP FW SDKv4.28.0, v4.31.0, and v4.32.0 advertise a few clocks that crash the system when disabled. Add quirks to prevent such crashes.
As SCMI clock IDs are identical for SDKv4.31.0 and v4.32.0, the quirk for these two versions can be shared.
---
Some of these could be handled by improving hardware descriptions in DT, or by the CPG and MDLC drivers.
--- drivers/firmware/arm_scmi/clock.c | 23 +++++++++++++++++++++++ drivers/firmware/arm_scmi/quirks.c | 6 ++++++ drivers/firmware/arm_scmi/quirks.h | 2 ++ 3 files changed, 31 insertions(+)
drivers/firmware/arm_scmi/clock.c +23 -0
@@ -920,6 +920,26 @@ scmi_clock_config_set_v2(const struct scmi_protocol_handle *ph, u32 clk_id,return ret; } +#define QUIRK_RCAR_X5H_4_28_CRIT_CLOCKS \ + ({ \ + switch (clk_id) { \ + case 468:/* MDLC_INTAP0 */ \ +case 498 :/* MDLC_APRTMGINT0 */ \ +case 840 :/* CLK_ZD_APU0 */ \ +return -EPERM ; \ + } \ + }) + +#define QUIRK_RCAR_X5H_4_31_CRIT_CLOCKS \ + ({ \ + switch (clk_id) { \ + case 464:/* MDLC_INTAP0 */ \ +case 494 :/* MDLC_APRTMGINT0 */ \ +case 836 :/* CLK_ZD_APU0 */ \ +return -EPERM ; \ + } \ + }) + static int scmi_clock_enable(const struct scmi_protocol_handle *ph, u32 clk_id, bool atomic) {
@@ -950,6 +970,9 @@ static int scmi_clock_disable(const struct scmi_protocol_handle *ph, u32 clk_id,if (clk->state_ctrl_forbidden)return -EACCES ; +SCMI_QUIRK (clock_rcar_x5h_4_28_crit_clocks,QUIRK_RCAR_X5H_4_28_CRIT_CLOCKS ); +SCMI_QUIRK (clock_rcar_x5h_4_31_crit_clocks,QUIRK_RCAR_X5H_4_31_CRIT_CLOCKS ); +return ci->clock_config_set (ph, clk_id,CLK_STATE_DISABLE ,NULL_OEM_TYPE ,0 , atomic); }
drivers/firmware/arm_scmi/quirks.c +6 -0
@@ -173,6 +173,10 @@ struct scmi_quirk {DEFINE_SCMI_QUIRK (clock_rates_triplet_out_of_spec,NULL ,NULL ,NULL );DEFINE_SCMI_QUIRK (clock_rcar_x5h_no_attributes,"Renesas" ,NULL ,"0x10a0000-" ,"renesas,r8a78000" ); +DEFINE_SCMI_QUIRK (clock_rcar_x5h_4_28_crit_clocks,"Renesas" ,NULL ,"0x10a0000" , +"renesas,r8a78000" ); +DEFINE_SCMI_QUIRK (clock_rcar_x5h_4_31_crit_clocks,"Renesas" ,NULL , +"0x10d0000-0x10e0000" ,"renesas,r8a78000" );DEFINE_SCMI_QUIRK (perf_level_get_fc_force,"Qualcomm" ,NULL ,"0x20000-" );DEFINE_SCMI_QUIRK (power_rcar_x5h_4_28_bad_domains,"Renesas" ,NULL ,"0x10a0000-0x10e0000" ,"renesas,r8a78000" );
@@ -186,6 +190,8 @@ DEFINE_SCMI_QUIRK(power_rcar_x5h_4_28_bad_domains, "Renesas", NULL,static struct scmi_quirk *scmi_quirks_table[] = {__DECLARE_SCMI_QUIRK_ENTRY (clock_rates_triplet_out_of_spec),__DECLARE_SCMI_QUIRK_ENTRY (clock_rcar_x5h_no_attributes), +__DECLARE_SCMI_QUIRK_ENTRY (clock_rcar_x5h_4_28_crit_clocks), +__DECLARE_SCMI_QUIRK_ENTRY (clock_rcar_x5h_4_31_crit_clocks),__DECLARE_SCMI_QUIRK_ENTRY (perf_level_get_fc_force),__DECLARE_SCMI_QUIRK_ENTRY (power_rcar_x5h_4_28_bad_domains),NULL
drivers/firmware/arm_scmi/quirks.h +2 -0
@@ -48,6 +48,8 @@ static inline void scmi_quirks_enable(struct device *dev, const char *vend,/* Quirk delarations */ DECLARE_SCMI_QUIRK (clock_rates_triplet_out_of_spec);DECLARE_SCMI_QUIRK (clock_rcar_x5h_no_attributes); +DECLARE_SCMI_QUIRK (clock_rcar_x5h_4_28_crit_clocks); +DECLARE_SCMI_QUIRK (clock_rcar_x5h_4_31_crit_clocks);DECLARE_SCMI_QUIRK (perf_level_get_fc_force);DECLARE_SCMI_QUIRK (power_rcar_x5h_4_28_bad_domains);
Signature · 1 line
2.43.0
Geert Uytterhoeven
maintainerPATCH 4/14 arm64: dts: renesas: ironhide: Enable SCMI devpd, sys, and reset
In reply to Geert UytterhoevenSCP FW SDKv4.28.0 and later for Renesas R-Car X5H Ironhide not only implements the SCMI base and clock management protocols, but also the SCMI power domain, system power, and reset domain management protocols.
Enable support for the latter by adding the corresponding SCMI protocol subnodes.
--- arch/arm64/boot/dts/renesas/r8a78000-ironhide.dts | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
arch/arm64/boot/dts/renesas/r8a78000-ironhide.dts +14 -0
@@ -31,10 +31,24 @@ scmi: scmi { #address-cells = <1>; #size-cells = <0>; + scmi_devpd: protocol@11 { + reg = <0x11>; + #power-domain-cells = <1>; + }; + + scmi_sys: protocol@12 { + reg = <0x12>; + }; + scmi_clk: protocol@14 { reg = <0x14>; #clock-cells = <1>; }; + + scmi_reset: protocol@16 { + reg = <0x16>; + #reset-cells = <1>; + }; }; };
Signature · 1 line
2.43.0
Geert Uytterhoeven
maintainerPATCH 5/14 firmware: arm_scmi: Add scmi_get_base_info()
In reply to Geert UytterhoevenCurrently non-SCMI drivers cannot find out what the specific versions of each SCMI provider implementation on the running system are.
However, different versions may use different ABIs (e.g. different clock IDs), or behave different, requiring remapping or workarounds in other drivers.
Add a public function to obtain base protocol information for the selected SCMI provider. This will be used by the R-Car X5H Clock Pulse Generator and Module Controller drivers.
--- drivers/firmware/arm_scmi/driver.c | 31 ++++++++++++++++++++++++++++++ include/linux/scmi_protocol.h | 8 ++++++++ 2 files changed, 39 insertions(+)
drivers/firmware/arm_scmi/driver.c +31 -0
@@ -3504,6 +3504,37 @@ int scmi_inflight_count(const struct scmi_handle *handle) } } +/** +* scmi_get_base_info() - Get SCMI base protocol information +* +* @of_node: pointer to a device node for an SCMI provider +* @version: pointer to write base protocol information +* +* Check if an SCMI device has been instantiated for the passed device node +* pointer, and, if found, return its base info. + +* Return: 0 on Success or -ENOENT. +*/ +int scmi_get_base_info (struct device_node *of_node, +struct scmi_base_info *version) +{ +struct scmi_info *info; +int ret = -ENOENT ; + +mutex_lock (&scmi_list_mutex); +list_for_each_entry (info, &scmi_list, node) { +if (info->dev->of_node == of_node) { + *version = info->version; + ret =0 ; +break ; + } + } +mutex_unlock (&scmi_list_mutex); + +return ret; +} +EXPORT_SYMBOL_GPL (scmi_get_base_info); +static int __init scmi_driver_init (void ) {scmi_quirks_initialize ();
include/linux/scmi_protocol.h +8 -0
@@ -972,6 +972,8 @@ struct scmi_driver {int scmi_driver_register (struct scmi_driver *driver,struct module *owner,const char *mod_name);void scmi_driver_unregister (struct scmi_driver *driver); +int scmi_get_base_info (struct device_node *of_node, +struct scmi_base_info *version);#else static inline int scmi_driver_register(struct scmi_driver *driver, struct module *owner,
@@ -981,6 +983,12 @@ scmi_driver_register(struct scmi_driver *driver, struct module *owner, }static inline void scmi_driver_unregister (struct scmi_driver *driver) {} + +static inline int scmi_get_base_info (struct device_node *of_node, +struct scmi_base_info *version) +{ +return -ENOENT ; +}#endif /* CONFIG_ARM_SCMI_PROTOCOL */ #define scmi_register (driver) \
Signature · 1 line
2.43.0
Geert Uytterhoeven
maintainerPATCH 6/14 of: property: fw_devlink: Add support for firmware
In reply to Geert UytterhoevenLet fw_devlink create device links between consumers and suppliers of firmware, and enforce these dependencies.
This prevents probing of drivers before the firmware they depend on becomes available, thus avoiding unneeded probe deferrals.
---
Written for the upcoming R-Car X5H Clock Pulse Generator and Module Controller drivers and their dependency on SCMI, but the existing Raspberry Pi power domain driver should benefit from this, too.
--- drivers/of/property.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/of/property.c +2 -0
@@ -1378,6 +1378,7 @@ DEFINE_SIMPLE_PROP(dmas, "dmas", "#dma-cells") DEFINE_SIMPLE_PROP(power_domains, "power-domains", "#power-domain-cells") DEFINE_SIMPLE_PROP(hwlocks, "hwlocks", "#hwlock-cells") DEFINE_SIMPLE_PROP(extcon, "extcon", NULL) +DEFINE_SIMPLE_PROP(firmware, "firmware", NULL) DEFINE_SIMPLE_PROP(nvmem_cells, "nvmem-cells", "#nvmem-cell-cells") DEFINE_SIMPLE_PROP(phys, "phys", "#phy-cells")DEFINE_SIMPLE_PROP (wakeup_parent,"wakeup-parent" ,NULL )
@@ -1527,6 +1528,7 @@ static const struct supplier_bindings of_supplier_bindings[] = { { .parse_prop = parse_power_domains, }, { .parse_prop = parse_hwlocks, }, { .parse_prop = parse_extcon, }, + { .parse_prop = parse_firmware, }, { .parse_prop = parse_nvmem_cells, }, { .parse_prop = parse_phys, }, { .parse_prop = parse_wakeup_parent, },
Signature · 1 line
2.43.0
Geert Uytterhoeven
maintainerPATCH 7/14 pmdomain: Make genpd_get_from_provider() public
In reply to Geert UytterhoevenUnlike the corresponding function in the clock subsystem (of_clk_get_from_provider()), genpd_get_from_provider() is private, and thus cannot be used by PM Domain drivers.
Make it public, so it be used by the R-Car X5H Module Controller driver.
--- drivers/pmdomain/core.c | 4 ++-- include/linux/pm_domain.h | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-)
drivers/pmdomain/core.c +2 -2
@@ -2900,8 +2900,7 @@ EXPORT_SYMBOL_GPL(of_genpd_del_provider);* Returns a valid pointer to struct generic_pm_domain on success or ERR_PTR() * on failure. */ -static struct generic_pm_domain *genpd_get_from_provider ( -const struct of_phandle_args *genpdspec) +struct generic_pm_domain *genpd_get_from_provider (const struct of_phandle_args *genpdspec) {struct generic_pm_domain *genpd =ERR_PTR (-ENOENT );struct of_genpd_provider *provider;
@@ -2923,6 +2922,7 @@ static struct generic_pm_domain *genpd_get_from_provider(return genpd; } +EXPORT_SYMBOL_GPL (genpd_get_from_provider);/** * of_genpd_add_device() - Add a device to an I/O PM domain
include/linux/pm_domain.h +7 -0
@@ -458,6 +458,7 @@ int of_genpd_add_provider_simple(struct device_node *np,int of_genpd_add_provider_onecell (struct device_node *np,struct genpd_onecell_data *data);void of_genpd_del_provider (struct device_node *np); +struct generic_pm_domain *genpd_get_from_provider (const struct of_phandle_args *genpdspec);int of_genpd_add_device (const struct of_phandle_args *args,struct device *dev);int of_genpd_add_subdomain (const struct of_phandle_args *parent_spec,const struct of_phandle_args *subdomain_spec);
@@ -488,6 +489,12 @@ static inline int of_genpd_add_provider_onecell(struct device_node *np,static inline void of_genpd_del_provider (struct device_node *np) {} +static inline struct generic_pm_domain *genpd_get_from_provider ( +const struct of_phandle_args *genpdspec) +{ +return ERR_PTR (-ENODEV ); +} +static inline int of_genpd_add_device (const struct of_phandle_args *args,struct device *dev) {
Signature · 1 line
2.43.0
Geert Uytterhoeven
maintainerPATCH 8/14 reset: Add reset_controller_get_provider()
In reply to Geert UytterhoevenThe reset subsystem differs from the clock subsystem in multiple ways:
1. It does not provide a public way to lookup resets from a reset provider (clock has of_clk_get_from_provider()),
2. The xlate callback does not return a reset object, but merely an index, which is converted to a reset object by the reset core.
Hence add a public helper reset_controller_get_provider(), which just returns the provider, and will be used by the R-Car X5H Module Controller driver.
--- drivers/reset/core.c | 11 +++++++++++ include/linux/reset-controller.h | 6 ++++++ 2 files changed, 17 insertions(+)
drivers/reset/core.c +11 -0
@@ -1135,6 +1135,17 @@ __reset_find_rcdev(const struct fwnode_reference_args *args, bool gpio_fallback)return NULL ; } +struct reset_controller_dev * +reset_controller_get_provider (struct fwnode_handle *fwnode) +{ +struct fwnode_reference_args args = { .fwnode = fwnode }; + +guard (mutex)(&reset_list_mutex); + +return __reset_find_rcdev (&args, false); +} +EXPORT_SYMBOL_GPL (reset_controller_get_provider); +struct reset_control *__fwnode_reset_control_get (struct fwnode_handle *fwnode,const char *id,int index,enum reset_control_flags flags)
include/linux/reset-controller.h +6 -0
@@ -74,6 +74,7 @@ void reset_controller_unregister(struct reset_controller_dev *rcdev);struct device ;int devm_reset_controller_register (struct device *dev,struct reset_controller_dev *rcdev); +struct reset_controller_dev *reset_controller_get_provider (struct fwnode_handle *fwnode);#else static inline int reset_controller_register (struct reset_controller_dev *rcdev) {
@@ -89,6 +90,11 @@ static inline int devm_reset_controller_register(struct device *dev, {return 0 ; } + +static inline struct reset_controller_dev *reset_controller_get_provider (struct fwnode_handle *fwnode) +{ +return NULL ; +}#endif #endif
Signature · 1 line
2.43.0
Geert Uytterhoeven
maintainerPATCH 9/14 dt-bindings: clock: Document Renesas R-Car X5H Clock Pulse Generator
In reply to Geert UytterhoevenDocument support for the Renesas R-Car X5H Clock Pulse Generator, and add definitions for a very limited and preliminary set of clocks.
--- .../bindings/clock/renesas,r8a78000-cpg.yaml | 62 +++++++++++++++++++ .../dt-bindings/clock/renesas,r8a78000-cpg.h | 15 +++++ 2 files changed, 77 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/renesas,r8a78000-cpg.yaml create mode 100644 include/dt-bindings/clock/renesas,r8a78000-cpg.h
Documentation/devicetree/bindings/clock/renesas,r8a78000-cpg.yaml new file +62 -0
@@ -0,0 +1,62 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/renesas,r8a78000-cpg.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Renesas R-Car X5H Clock Pulse Generator + +maintainers: + - Geert Uytterhoeven <[email protected]> + +description: + The R-Car X5H Clock Pulse Generator (CLK CONTROL) consists of oscillators, + PLL circuits, clock dividers and clock control circuits. It provides various + clocks for other modules. + +properties: + compatible: + const: renesas,r8a78000-cpg + + reg: + maxItems: 1 + + clocks: + maxItems: 2 + + clock-names: + items: + - const: extal + - const: extalr + + '#clock-cells': + description: + The single clock specifier cell must be the clock number, as defined in + <dt-bindings/clock/renesas,r8a78000-cpg.h>. + const: 1 + + firmware: + $ref: /schemas/types.yaml#/definitions/phandle + description: + Reference to the SCMI firmware device node on systems where SCMI must be + used instead of direct hardware access. + +required: + - compatible + - reg + - clocks + - clock-names + - '#clock-cells' + +additionalProperties: false + +examples: + - | + clock-controller@c1320000 { + compatible = "renesas,r8a78000-cpg"; + reg = <0xc1320000 0x10000>; + clocks = <&extal_clk>, <&extalr_clk>; + clock-names = "extal", "extalr"; + #clock-cells = <1>; + firmware = <&scmi>; + };
include/dt-bindings/clock/renesas,r8a78000-cpg.h new file +15 -0
@@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ +/* +* Copyright (C) 2026 Glider bv +*/ +#ifndef __DT_BINDINGS_CLOCK_RENESAS_R8A78000_CPG_H__ +#define __DT_BINDINGS_CLOCK_RENESAS_R8A78000_CPG_H__ + +/* R-Car X5H CPG Clocks */ + +// FIXME Preliminary +#define R8A78000_CPG_SGASYNCD4_PERW_BUS 0 +#define R8A78000_CPG_SGASYNCD16_PERW_BUS 1 +#define R8A78000_CPG_MSOCK_PERW_BUS 2 + +#endif /* __DT_BINDINGS_CLOCK_RENESAS_R8A78000_CPG_H__ */
Signature · 1 line
2.43.0
Geert Uytterhoeven
maintainerPATCH 10/14 dt-bindings: power: Document Renesas R-Car X5H Module Controller
In reply to Geert UytterhoevenDocument support for Renesas R-Car X5H Module Controllers, and add definitions for power domains not backed by registers.
--- .../bindings/power/renesas,r8a78000-mdlc.yaml | 63 +++++++++++++++++++ .../dt-bindings/power/renesas,r8a78000-mdlc.h | 16 +++++ 2 files changed, 79 insertions(+) create mode 100644 Documentation/devicetree/bindings/power/renesas,r8a78000-mdlc.yaml create mode 100644 include/dt-bindings/power/renesas,r8a78000-mdlc.h
Documentation/devicetree/bindings/power/renesas,r8a78000-mdlc.yaml new file +63 -0
@@ -0,0 +1,63 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/power/renesas,r8a78000-mdlc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Renesas R-Car X5H Module Controller + +maintainers: + - Geert Uytterhoeven <[email protected]> + +description: + Each instance of the R-Car X5H Module Controller (MODULE CONTROL) provides + Power Gating for up to 64 Power Domains, and Module Standby and Reset for up + to 256 modules in the Power Domain of each Module hierarchy. + +properties: + compatible: + const: renesas,r8a78000-mdlc + + reg: + maxItems: 1 + + '#power-domain-cells': + description: | + - The first power domain specifier cell must be either the Module + Power Domain Gating (MPDG) register index (0x00-0x3f) from the + datasheet, or a Power Domain number, as defined in + <dt-bindings/power/renesas,r8a78000-mdlc.h>, + - The second power domain specifier cell must be the module number + (0x00-0xff), composed of the Module System Reset (MSRES) register index + in the high nibble, and the Module Reset Destination bitfield index in + the low nibble. + const: 2 + + '#reset-cells': + description: + The single reset specifier cell must be the module number (0x00-0xff). + const: 1 + + firmware: + $ref: /schemas/types.yaml#/definitions/phandle + description: + Reference to the SCMI firmware device node on systems where SCMI must be + used instead of direct hardware access. + +required: + - compatible + - reg + - '#power-domain-cells' + - '#reset-cells' + +additionalProperties: false + +examples: + - | + system-controller@c3060000 { + compatible = "renesas,r8a78000-mdlc"; + reg = <0xc3060000 0x1000>; + #power-domain-cells = <2>; + #reset-cells = <1>; + firmware = <&scmi>; + };
include/dt-bindings/power/renesas,r8a78000-mdlc.h new file +16 -0
@@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ +/* +* Copyright (C) 2026 Glider bv +*/ +#ifndef __DT_BINDINGS_POWER_RENESAS_R8A78000_MDLC_H__ +#define __DT_BINDINGS_POWER_RENESAS_R8A78000_MDLC_H__ + +/* R-Car X5H MDLC Power Domains */ + +#define R8A78000_MDLC_PD_AON 0x40 +#define R8A78000_MDLC_PD_SCP 0x41 +#define R8A78000_MDLC_PD_APL 0x42 +#define R8A78000_MDLC_PD_CMN 0x43 +#define R8A78000_MDLC_PD_ACL 0x44 + +#endif /* __DT_BINDINGS_POWER_RENESAS_R8A78000_MDLC_H__ */
Signature · 1 line
2.43.0
Geert Uytterhoeven
maintainerPATCH 11/14 clk: renesas: Add R-Car X5H CPG SCMI remapping driver
In reply to Geert UytterhoevenAdd a proof-of-concept Clock Pulse Generator driver for the R-Car X5H (R8A78000) SoC, using tables to remap from hardware clock IDs to SCMI clock IDs.
Some SCMI clocks do not support the SCMI CLOCK_ATTRIBUTES command, and are thus not usable from Linux. Register a bunch of fixed-rate clocks, and use them as replacements for SCMI clocks that are known to be unusable.
For now this contains preliminary support for SCP FW SDKv4.28.0, v4.31.0, and v4.32.0. As SCMI clock IDs are identical for SDKv4.31.0 and v4.32.0, r8a78000_cpg_fw_4_31_0[] applies to both of them.
--- drivers/clk/renesas/Kconfig | 4 + drivers/clk/renesas/Makefile | 1 + drivers/clk/renesas/r8a78000-cpg.c | 335 +++++++++++++++++++++++++++++ 3 files changed, 340 insertions(+) create mode 100644 drivers/clk/renesas/r8a78000-cpg.c
drivers/clk/renesas/Kconfig +4 -0
@@ -34,6 +34,7 @@ config CLK_RENESAS select CLK_R8A779F0 if ARCH_R8A779F0 select CLK_R8A779G0 if ARCH_R8A779G0 select CLK_R8A779H0 if ARCH_R8A779H0 + select CLK_R8A78000 if ARCH_R8A78000 select CLK_R9A06G032 if ARCH_R9A06G032 select CLK_R9A07G043 if ARCH_R9A07G043 select CLK_R9A07G044 if ARCH_R9A07G044
@@ -176,6 +177,9 @@ config CLK_R8A779H0 bool "R-Car V4M clock support" if COMPILE_TEST select CLK_RCAR_GEN4_CPG +config CLK_R8A78000 + bool "R-Car X5H clock support" if COMPILE_TEST + config CLK_R9A06G032 bool "RZ/N1D clock support" if COMPILE_TEST
drivers/clk/renesas/Makefile +1 -0
@@ -31,6 +31,7 @@ obj-$(CONFIG_CLK_R8A779A0) += r8a779a0-cpg-mssr.o obj-$(CONFIG_CLK_R8A779F0) += r8a779f0-cpg-mssr.o obj-$(CONFIG_CLK_R8A779G0) += r8a779g0-cpg-mssr.o obj-$(CONFIG_CLK_R8A779H0) += r8a779h0-cpg-mssr.o +obj-$(CONFIG_CLK_R8A78000) += r8a78000-cpg.o obj-$(CONFIG_CLK_R9A06G032) += r9a06g032-clocks.o obj-$(CONFIG_CLK_R9A07G043) += r9a07g043-cpg.o obj-$(CONFIG_CLK_R9A07G044) += r9a07g044-cpg.o
drivers/clk/renesas/r8a78000-cpg.c new file +335 -0
335 lines not on this page · raw message
Signature · 1 line
2.43.0
Geert Uytterhoeven
maintainerPATCH 12/14 pmdomain: renesas: Add R-Car X5H MDLC SCMI remapping driver
In reply to Geert UytterhoevenAdd a proof-of-concept Module Controller driver for the R-Car X5H (R8A78000) SoC, using tables to remap from hardware power domain, module, and reset IDs to SCMI power domains, clocks, and resets.
Note that SCMI clocks representing hardware modules are fake clocks, with a zero clock rate, that can just be enabled and disabled. Hence these are controlled from the clock domain's start/stop callbacks.
For now this contains preliminary support for SCP FW SDKv4.28.0, v4.31.0, and v4.32.0:
- As the SCMI power domain IDs are idential for all three versions,
r8a78000_mdlc_*_power_fw_4_28_0[] apply to all of them,
- As the SCMI clock and reset IDs are identical for the last two versions (except for the addition of two reset IDs in v4.32.0), r8a78000_mdlc_fw_4_31_0[] applies to both of them.
Note that v4.32 has two new reset IDs without corresponding clock IDs, so "/* SCMI clock and reset IDs are identical */" is no longer 100% true. However, these new resets seem to be meant for board control, not SoC control.
--- drivers/pmdomain/renesas/Kconfig | 4 + drivers/pmdomain/renesas/Makefile | 1 + drivers/pmdomain/renesas/r8a78000-mdlc.c | 1021 ++++++++++++++++++++++ drivers/soc/renesas/Kconfig | 1 + 4 files changed, 1027 insertions(+) create mode 100644 drivers/pmdomain/renesas/r8a78000-mdlc.c
drivers/pmdomain/renesas/Kconfig +4 -0
@@ -13,6 +13,10 @@ config SYSC_RMOBILE bool "System Controller support for R-Mobile" if COMPILE_TEST # SoC +config MDLC_R8A78000 + bool "Module Controller support for R8A78000 (R-Car X5H)" if COMPILE_TEST + select RESET_CONTROLLER + config SYSC_R8A7742 bool "System Controller support for R8A7742 (RZ/G1H)" if COMPILE_TEST select SYSC_RCAR
drivers/pmdomain/renesas/Makefile +1 -0
@@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 # SoC +obj-$(CONFIG_MDLC_R8A78000) += r8a78000-mdlc.o obj-$(CONFIG_SYSC_R8A7742) += r8a7742-sysc.o obj-$(CONFIG_SYSC_R8A7743) += r8a7743-sysc.o obj-$(CONFIG_SYSC_R8A7745) += r8a7745-sysc.o
drivers/pmdomain/renesas/r8a78000-mdlc.c new file +1021 -0
1,021 lines not on this page · raw message
drivers/soc/renesas/Kconfig +1 -0
@@ -358,6 +358,7 @@ config ARCH_R8A78000 default y if ARCH_RENESAS default ARCH_RENESAS select ARCH_RCAR_GEN5 + select MDLC_R8A78000 help This enables support for the Renesas R-Car X5H SoC.
Signature · 1 line
2.43.0
Geert Uytterhoeven
maintainerPATCH 13/14 arm64: dts: renesas: r8a78000: Add CPG/MDLC nodes
In reply to Geert UytterhoevenAdd device nodes for the Clock Pulse Generator (CPG) and Module Control (MDLC) blocks on the R-Car X5H (R8A78000) SoC.
Convert all (H)SCIF serial ports from dummy to CPG clocks, and link them to an MDLC for power domains and resets.
---
Add all MDLC nodes from the start, or only when used/tested?
--- arch/arm64/boot/dts/renesas/r8a78000.dtsi | 300 ++++++++++++++++++++-- 1 file changed, 275 insertions(+), 25 deletions(-)
arch/arm64/boot/dts/renesas/r8a78000.dtsi +275 -25
@@ -5,6 +5,8 @@ * Copyright (C) 2025 Renesas Electronics Corp. */ +#include <dt-bindings/clock/renesas,r8a78000-cpg.h> +#include <dt-bindings/power/renesas,r8a78000-mdlc.h> #include <dt-bindings/interrupt-controller/arm-gic.h> / {
@@ -636,23 +638,6 @@ L3_CA720_7: cache-controller-37 { }; }; - /* - * In the early phase, there is no clock control support, - * so assume that the clocks are enabled by default. - * Therefore, dummy clocks are used. - */ - dummy_clk_sgasyncd16: dummy-clk-sgasyncd16 { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-frequency = <66666000>; - }; - - dummy_clk_sgasyncd4: dummy-clk-sgasyncd4 { - compatible = "fixed-clock"; - #clock-cells = <0>; - clock-frequency = <266660000>; - }; - extal_clk: extal-clk { compatible = "fixed-clock"; #clock-cells = <0>;
@@ -813,8 +798,12 @@ scif0: serial@c0700000 { "renesas,rcar-gen5-scif", "renesas,scif"; reg = <0 0xc0700000 0 0x40>; interrupts = <GIC_ESPI 10 IRQ_TYPE_LEVEL_HIGH>; - clocks = <&dummy_clk_sgasyncd16>, <&dummy_clk_sgasyncd4>, <&scif_clk>; + clocks = <&cpg R8A78000_CPG_SGASYNCD16_PERW_BUS>, + <&cpg R8A78000_CPG_SGASYNCD4_PERW_BUS>, + <&scif_clk>; clock-names = "fck", "brg_int", "scif_clk"; + power-domains = <&mdlc_perw R8A78000_MDLC_PD_APL 0x40>; + resets = <&mdlc_perw 0x40>; status = "disabled"; };
@@ -823,8 +812,12 @@ scif1: serial@c0704000 { "renesas,rcar-gen5-scif", "renesas,scif"; reg = <0 0xc0704000 0 0x40>; interrupts = <GIC_ESPI 11 IRQ_TYPE_LEVEL_HIGH>; - clocks = <&dummy_clk_sgasyncd16>, <&dummy_clk_sgasyncd4>, <&scif_clk>; + clocks = <&cpg R8A78000_CPG_SGASYNCD16_PERW_BUS>, + <&cpg R8A78000_CPG_SGASYNCD4_PERW_BUS>, + <&scif_clk>; clock-names = "fck", "brg_int", "scif_clk"; + power-domains = <&mdlc_perw R8A78000_MDLC_PD_APL 0x41>; + resets = <&mdlc_perw 0x41>; status = "disabled"; };
@@ -833,8 +826,12 @@ scif3: serial@c0708000 { "renesas,rcar-gen5-scif", "renesas,scif"; reg = <0 0xc0708000 0 0x40>; interrupts = <GIC_ESPI 12 IRQ_TYPE_LEVEL_HIGH>; - clocks = <&dummy_clk_sgasyncd16>, <&dummy_clk_sgasyncd4>, <&scif_clk>; + clocks = <&cpg R8A78000_CPG_SGASYNCD16_PERW_BUS>, + <&cpg R8A78000_CPG_SGASYNCD4_PERW_BUS>, + <&scif_clk>; clock-names = "fck", "brg_int", "scif_clk"; + power-domains = <&mdlc_perw R8A78000_MDLC_PD_APL 0x42>; + resets = <&mdlc_perw 0x42>; status = "disabled"; };
@@ -843,8 +840,12 @@ scif4: serial@c070c000 { "renesas,rcar-gen5-scif", "renesas,scif"; reg = <0 0xc070c000 0 0x40>; interrupts = <GIC_ESPI 13 IRQ_TYPE_LEVEL_HIGH>; - clocks = <&dummy_clk_sgasyncd16>, <&dummy_clk_sgasyncd4>, <&scif_clk>; + clocks = <&cpg R8A78000_CPG_SGASYNCD16_PERW_BUS>, + <&cpg R8A78000_CPG_SGASYNCD4_PERW_BUS>, + <&scif_clk>; clock-names = "fck", "brg_int", "scif_clk"; + power-domains = <&mdlc_perw R8A78000_MDLC_PD_APL 0x43>; + resets = <&mdlc_perw 0x43>; status = "disabled"; };
@@ -853,8 +854,12 @@ hscif0: serial@c0710000 { "renesas,rcar-gen5-hscif", "renesas,hscif"; reg = <0 0xc0710000 0 0x60>; interrupts = <GIC_ESPI 14 IRQ_TYPE_LEVEL_HIGH>; - clocks = <&dummy_clk_sgasyncd4>, <&dummy_clk_sgasyncd4>, <&scif_clk>; + clocks = <&cpg R8A78000_CPG_SGASYNCD4_PERW_BUS>, + <&cpg R8A78000_CPG_SGASYNCD4_PERW_BUS>, + <&scif_clk>; clock-names = "fck", "brg_int", "scif_clk"; + power-domains = <&mdlc_perw R8A78000_MDLC_PD_APL 0x54>; + resets = <&mdlc_perw 0x54>; status = "disabled"; };
@@ -863,8 +868,12 @@ hscif1: serial@c0714000 { "renesas,rcar-gen5-hscif", "renesas,hscif"; reg = <0 0xc0714000 0 0x60>; interrupts = <GIC_ESPI 15 IRQ_TYPE_LEVEL_HIGH>; - clocks = <&dummy_clk_sgasyncd4>, <&dummy_clk_sgasyncd4>, <&scif_clk>; + clocks = <&cpg R8A78000_CPG_SGASYNCD4_PERW_BUS>, + <&cpg R8A78000_CPG_SGASYNCD4_PERW_BUS>, + <&scif_clk>; clock-names = "fck", "brg_int", "scif_clk"; + power-domains = <&mdlc_perw R8A78000_MDLC_PD_APL 0x55>; + resets = <&mdlc_perw 0x55>; status = "disabled"; };
@@ -873,8 +882,12 @@ hscif2: serial@c0718000 { "renesas,rcar-gen5-hscif", "renesas,hscif"; reg = <0 0xc0718000 0 0x60>; interrupts = <GIC_ESPI 16 IRQ_TYPE_LEVEL_HIGH>; - clocks = <&dummy_clk_sgasyncd4>, <&dummy_clk_sgasyncd4>, <&scif_clk>; + clocks = <&cpg R8A78000_CPG_SGASYNCD4_PERW_BUS>, + <&cpg R8A78000_CPG_SGASYNCD4_PERW_BUS>, + <&scif_clk>; clock-names = "fck", "brg_int", "scif_clk"; + power-domains = <&mdlc_perw R8A78000_MDLC_PD_APL 0x56>; + resets = <&mdlc_perw 0x56>; status = "disabled"; };
@@ -883,8 +896,12 @@ hscif3: serial@c071c000 { "renesas,rcar-gen5-hscif", "renesas,hscif"; reg = <0 0xc071c000 0 0x60>; interrupts = <GIC_ESPI 17 IRQ_TYPE_LEVEL_HIGH>; - clocks = <&dummy_clk_sgasyncd4>, <&dummy_clk_sgasyncd4>, <&scif_clk>; + clocks = <&cpg R8A78000_CPG_SGASYNCD4_PERW_BUS>, + <&cpg R8A78000_CPG_SGASYNCD4_PERW_BUS>, + <&scif_clk>; clock-names = "fck", "brg_int", "scif_clk"; + power-domains = <&mdlc_perw R8A78000_MDLC_PD_APL 0x57>; + resets = <&mdlc_perw 0x57>; status = "disabled"; };
@@ -897,6 +914,239 @@ scp_sram: sram@c1000000 { /* scp-sram node must be set per board file */ }; + + cpg: clock-controller@c1320000 { + compatible = "renesas,r8a78000-cpg"; + reg = <0 0xc1320000 0 0x10000>; + clocks = <&extal_clk>, <&extalr_clk>; + clock-names = "extal", "extalr"; + #clock-cells = <1>; + bootph-all; + }; + + mdlc_vipn: system-controller@c3060000 { + compatible = "renesas,r8a78000-mdlc"; + reg = <0 0xc3060000 0 0x1000>; + #power-domain-cells = <2>; + #reset-cells = <1>; + bootph-all; + }; + + mdlc_vips: system-controller@c3460000 { + compatible = "renesas,r8a78000-mdlc"; + reg = <0 0xc3460000 0 0x1000>; + #power-domain-cells = <2>; + #reset-cells = <1>; + bootph-all; + }; + + mdlc_vio: system-controller@c5000000 { + compatible = "renesas,r8a78000-mdlc"; + reg = <0 0xc5000000 0 0x1000>; + #power-domain-cells = <2>; + #reset-cells = <1>; + bootph-all; + }; + + mdlc_pere: system-controller@c08f0000 { + compatible = "renesas,r8a78000-mdlc"; + reg = <0 0xc08f0000 0 0x1000>; + #power-domain-cells = <2>; + #reset-cells = <1>; + bootph-all; + }; + + mdlc_perw: system-controller@c05d0000 { + compatible = "renesas,r8a78000-mdlc"; + reg = <0 0xc05d0000 0 0x1000>; + #power-domain-cells = <2>; + #reset-cells = <1>; + bootph-all; + }; + + mdlc_ddr0: system-controller@e8000000 { + compatible = "renesas,r8a78000-mdlc"; + reg = <0 0xe8000000 0 0x1000>; + #power-domain-cells = <2>; + #reset-cells = <1>; + bootph-all; + }; + + mdlc_ddr1: system-controller@e8080000 { + compatible = "renesas,r8a78000-mdlc"; + reg = <0 0xe8080000 0 0x1000>; + #power-domain-cells = <2>; + #reset-cells = <1>; + bootph-all; + }; + + mdlc_ddr2: system-controller@e8100000 { + compatible = "renesas,r8a78000-mdlc"; + reg = <0 0xe8100000 0 0x1000>; + #power-domain-cells = <2>; + #reset-cells = <1>; + bootph-all; + }; + + mdlc_ddr3: system-controller@e8180000 { + compatible = "renesas,r8a78000-mdlc"; + reg = <0 0xe8180000 0 0x1000>; + #power-domain-cells = <2>; + #reset-cells = <1>; + bootph-all; + }; + + mdlc_ddr4: system-controller@e8200000 { + compatible = "renesas,r8a78000-mdlc"; + reg = <0 0xe8200000 0 0x1000>; + #power-domain-cells = <2>; + #reset-cells = <1>; + bootph-all; + }; + + mdlc_ddr5: system-controller@e8280000 { + compatible = "renesas,r8a78000-mdlc"; + reg = <0 0xe8280000 0 0x1000>; + #power-domain-cells = <2>; + #reset-cells = <1>; + bootph-all; + }; + + mdlc_ddr6: system-controller@e8300000 { + compatible = "renesas,r8a78000-mdlc"; + reg = <0 0xe8300000 0 0x1000>; + #power-domain-cells = <2>; + #reset-cells = <1>; + bootph-all; + }; + + mdlc_ddr7: system-controller@e8380000 { + compatible = "renesas,r8a78000-mdlc"; + reg = <0 0xe8380000 0 0x1000>; + #power-domain-cells = <2>; + #reset-cells = <1>; + bootph-all; + }; + + mdlc_hscn: system-controller@c9c90000 { + compatible = "renesas,r8a78000-mdlc"; + reg = <0 0xc9c90000 0 0x1000>; + #power-domain-cells = <2>; + #reset-cells = <1>; + bootph-all; + }; + + mdlc_rt: system-controller@19440000 { + compatible = "renesas,r8a78000-mdlc"; + reg = <0 0x19440000 0 0x1000>; + #power-domain-cells = <2>; + #reset-cells = <1>; + bootph-all; + }; + + mdlc_top: system-controller@c6480000 { + compatible = "renesas,r8a78000-mdlc"; + reg = <0 0xc6480000 0 0x1000>; + #power-domain-cells = <2>; + #reset-cells = <1>; + bootph-all; + }; + + mdlc_hscs: system-controller@de200000 { + compatible = "renesas,r8a78000-mdlc"; + reg = <0 0xde200000 0 0x1000>; + #power-domain-cells = <2>; + #reset-cells = <1>; + bootph-all; + }; + + mdlc_imn: system-controller@c1990000 { + compatible = "renesas,r8a78000-mdlc"; + reg = <0 0xc1990000 0 0x1000>; + #power-domain-cells = <2>; + #reset-cells = <1>; + bootph-all; + }; + + mdlc_ims: system-controller@c1d90000 { + compatible = "renesas,r8a78000-mdlc"; + reg = <0 0xc1d90000 0 0x1000>; + #power-domain-cells = <2>; + #reset-cells = <1>; + bootph-all; + }; + + mdlc_gpc: system-controller@cb510000 { + compatible = "renesas,r8a78000-mdlc"; + reg = <0 0xcb510000 0 0x1000>; + #power-domain-cells = <2>; + #reset-cells = <1>; + bootph-all; + }; + + mdlc_dsp: system-controller@cbe90000 { + compatible = "renesas,r8a78000-mdlc"; + reg = <0 0xcbe90000 0 0x1000>; + #power-domain-cells = <2>; + #reset-cells = <1>; + bootph-all; + }; + + mdlc_mm: system-controller@e9980000 { + compatible = "renesas,r8a78000-mdlc"; + reg = <0 0xe9980000 0 0x1000>; + #power-domain-cells = <2>; + #reset-cells = <1>; + bootph-all; + }; + + mdlc_npu0: system-controller@d2c30000 { + compatible = "renesas,r8a78000-mdlc"; + reg = <0 0xd2c30000 0 0x1000>; + #power-domain-cells = <2>; + #reset-cells = <1>; + bootph-all; + }; + + mdlc_npu1: system-controller@d6c30000 { + compatible = "renesas,r8a78000-mdlc"; + reg = <0 0xd6c30000 0 0x1000>; + #power-domain-cells = <2>; + #reset-cells = <1>; + bootph-all; + }; + + mdlc_cmnn: system-controller@ca410000 { + compatible = "renesas,r8a78000-mdlc"; + reg = <0 0xca410000 0 0x1000>; + #power-domain-cells = <2>; + #reset-cells = <1>; + bootph-all; + }; + + mdlc_cmns: system-controller@ca510000 { + compatible = "renesas,r8a78000-mdlc"; + reg = <0 0xca510000 0 0x1000>; + #power-domain-cells = <2>; + #reset-cells = <1>; + bootph-all; + }; + + mdlc_scp: system-controller@c1330000 { + compatible = "renesas,r8a78000-mdlc"; + reg = <0 0xc1330000 0 0x1000>; + #power-domain-cells = <2>; + #reset-cells = <1>; + bootph-all; + }; + + mdlc_aon: system-controller@c1338000 { + compatible = "renesas,r8a78000-mdlc"; + reg = <0 0xc1338000 0 0x1000>; + #power-domain-cells = <2>; + #reset-cells = <1>; + bootph-all; + }; }; timer {
Signature · 1 line
2.43.0
Geert Uytterhoeven
maintainerPATCH 14/14 arm64: dts: renesas: ironhide: Add CPG/MDLC firmware properties
In reply to Geert UytterhoevenLink the various Clock Pulse Generator (CPG) and Module Controller (MDLC) device nodes to their SCMI provider.
--- .../boot/dts/renesas/r8a78000-ironhide.dts | 116 ++++++++++++++++++ 1 file changed, 116 insertions(+)
arch/arm64/boot/dts/renesas/r8a78000-ironhide.dts +116 -0
@@ -99,6 +99,10 @@ memory@1e00000000 { }; }; +&cpg { + firmware = <&scmi>; +}; + &extal_clk { clock-frequency = <16666600>; };
@@ -112,6 +116,118 @@ &hscif0 { status = "okay"; }; +&mdlc_aon { + firmware = <&scmi>; +}; + +&mdlc_cmnn { + firmware = <&scmi>; +}; + +&mdlc_cmns { + firmware = <&scmi>; +}; + +&mdlc_ddr0 { + firmware = <&scmi>; +}; + +&mdlc_ddr1 { + firmware = <&scmi>; +}; + +&mdlc_ddr2 { + firmware = <&scmi>; +}; + +&mdlc_ddr3 { + firmware = <&scmi>; +}; + +&mdlc_ddr4 { + firmware = <&scmi>; +}; + +&mdlc_ddr5 { + firmware = <&scmi>; +}; + +&mdlc_ddr6 { + firmware = <&scmi>; +}; + +&mdlc_ddr7 { + firmware = <&scmi>; +}; + +&mdlc_dsp { + firmware = <&scmi>; +}; + +&mdlc_gpc { + firmware = <&scmi>; +}; + +&mdlc_hscn { + firmware = <&scmi>; +}; + +&mdlc_hscs { + firmware = <&scmi>; +}; + +&mdlc_imn { + firmware = <&scmi>; +}; + +&mdlc_ims { + firmware = <&scmi>; +}; + +&mdlc_mm { + firmware = <&scmi>; +}; + +&mdlc_npu0 { + firmware = <&scmi>; +}; + +&mdlc_npu1 { + firmware = <&scmi>; +}; + +&mdlc_pere { + firmware = <&scmi>; +}; + +&mdlc_perw { + firmware = <&scmi>; +}; + +&mdlc_rt { + firmware = <&scmi>; +}; + +&mdlc_scp { + firmware = <&scmi>; +}; + +&mdlc_top { + firmware = <&scmi>; +}; + +&mdlc_vio { + firmware = <&scmi>; +}; + +&mdlc_vipn { + firmware = <&scmi>; +}; + +&mdlc_vips { + firmware = <&scmi>; +}; + &mfis_scp { status = "okay"; };
Signature · 1 line
2.43.0
Re: [PATCH/RFC 05/14] firmware: arm_scmi: Add scmi_get_base_info()
In reply to Geert UytterhoevenQuoted 18 lines · Geert Uytterhoeven
Currently non-SCMI drivers cannot find out what the specific versions of each SCMI provider implementation on the running system are.
However, different versions may use different ABIs (e.g. different clock IDs), or behave different, requiring remapping or workarounds in other drivers.
Add a public function to obtain base protocol information for the selected SCMI provider. This will be used by the R-Car X5H Clock Pulse Generator and Module Controller drivers.
Signed-off-by Geert Uytterhoeven <[email protected]>drivers/firmware/arm_scmi/driver.c +0
-0@@ -3504,6 +3504,37 @@ int scmi_inflight_count(const struct scmi_handle *handle) } }
drivers/firmware/arm_scmi/driver.c int scmi_inflight_count(const struct scmi_handle *handle) · line 3515
Quoted 10 lines
drivers/firmware/arm_scmi/driver.c +9
-0+/** +* scmi_get_base_info() - Get SCMI base protocol information +* +* @of_node: pointer to a device node for an SCMI provider +* @version: pointer to write base protocol information +* +* Check if an SCMI device has been instantiated for the passed device node +* pointer, and, if found, return its base info. +
Missing asterisk, reported by the kernel test robot.
drivers/firmware/arm_scmi/driver.c int scmi_inflight_count(const struct scmi_handle *handle) · line 3517
Quoted 2 lines
drivers/firmware/arm_scmi/driver.c +2
-0+* Return: 0 on Success or -ENOENT. +*/
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Cristian Marussi
reviewerRe: [PATCH/RFC 05/14] firmware: arm_scmi: Add scmi_get_base_info()
In reply to Geert UytterhoevenQuoted 2 lines · Geert Uytterhoeven
Currently non-SCMI drivers cannot find out what the specific versions of each SCMI provider implementation on the running system are.
Hi Geert,
Thanks for your patches....this is not a proper full review of the series, BUT this patch catched my eye..
Indeed, yes, it is deliberate that the SCMI version information is NOT exposed out of the SCMI world, since being the SCMI an attempt to standardize a common FW interface (as in [1] of course), you should not know what runs inside the black-box, it should be irrelevant...
...indeed the versioning is used inside the SCMI stack to deal properly with different protocol versions implemented by the server OR to apply proper quirks when needed, but all the rest should be standard....
...you should NOT really behave differently based on the underneath protocol or firmare implementation version...it is the SCMI stack that should behave properly, transparently...
Having said that...I understand that at least it could be useful to be able to query the SCMI stack to know, even from non-SCMI drivers, WHICH quirks have been applied/activated at run time...but anything more than that it seems to me dangerous and prone to a number of abuses of the SCMI stack itself...
(Also...exposing the versions itself means also tracking that bit of info in more than one place: the quirk framework and your drivers.)
Quoted 4 lines
However, different versions may use different ABIs (e.g. different clock IDs), or behave different, requiring remapping or workarounds in other drivers.
...abuse like this indeed :P ... the SCMI server is supposed to be that one entity remapping the IDs in the background if the same IDs happen to be representing different physical resources across a number of distinct platforms all supported by the same firmware blob...so as to present a consistent set of contiguos IDs...
Also because this should be one of the selling point of the SCMI stack in a virtualized environment: you can ship the same kernel drivers with the same DT and you know that ID=<N> will always identify the specific resource that is needed by your driver without worrying about the fact that in reality in the backstage the effectively managed physical resource could be different across different platforms, because that does not matter if the SCMI platform server had properly remapped (at build time/run-time ?) the resources to your expected ID...alternatively of course you can ship with different DTs to describe different hardware...BUT remmapping stuff in the drivers themselves guessing on the vendor/subvendor/impl_vers seems a dangerous abuse...
I watched a bit of the LPC discussions around this (from Marek I think) but sincerely most of those problems had one (not necessarily simple)
solution: fix your firmwares AND/OR apply quirks in the meantime...
Sorry, I am sure this not a welcomed answer :P ...thoughts ?
Thanks,
Cristian
Quoted 10 lines · Geert Uytterhoeven
Hi all,
TL;DR:
Describe hardware in DT, and perform the mapping to SCMI in Linux.
The Renesas R-Car X5H-based Ironhide board is the first Renesas SoC/board combination that implements the ARM System Control and Management Interface (SCMI).
Quoted 9 lines
This means Linux can no longer perform various system operations (e.g. clock, power domain, and reset control) by accessing the hardware directly. Instead, these operations are abstracted according to various SCMI sub-protocols, and Linux has to send messages to an SCMI-compliant firmware running on a System Control Processor (SCP).
More specifically, the R-Car X5H SCP FW SCMI controls access to:
1. Core clocks and module clocks,
2. Module resets,
3. Power domains,
I'm very curious how power domain hierarchy is described on this SoC, because one more issue to add to your list is that hierarchy cannot be described for power domains in SCMI.
I know you're aware of it already, but just FYI for anyone else exploring this space, I have a series[1] in-flight right now to address this limitation of SCMI so that we can at least describe this hierarchy in DT and the pmdomain framework.
Kevin
Hi Kevin,
Quoted 19 lines · Kevin Hilman
Quoted 8 lines · Geert Uytterhoeven
TL;DR:
Describe hardware in DT, and perform the mapping to SCMI in Linux.
The Renesas R-Car X5H-based Ironhide board is the first Renesas SoC/board combination that implements the ARM System Control and Management Interface (SCMI).
Quoted 9 lines
This means Linux can no longer perform various system operations (e.g. clock, power domain, and reset control) by accessing the hardware directly. Instead, these operations are abstracted according to various SCMI sub-protocols, and Linux has to send messages to an SCMI-compliant firmware running on a System Control Processor (SCP).
More specifically, the R-Car X5H SCP FW SCMI controls access to:
1. Core clocks and module clocks,
2. Module resets,
3. Power domains,
Quoted 3 lines
I'm very curious how power domain hierarchy is described on this SoC, because one more issue to add to your list is that hierarchy cannot be described for power domains in SCMI.
So far I had no need for such a description. AFAIK, this is handled inside the SCMI firmware, which does know the hierarchy. Hence the firmware can power up a domain when any of its children is powered up, and power it down when the last of its children is powered down?
I think the clue lies in having a PSCI top-level domain, cfr. what you wrote in [1]:
"But... how do I describe the relationship of this hierarchy? In
particular, when the SCMI-controlled PDs are actually subdomains of a top-level, non-SCMI PD."
Or am I missing something?
So far I have used only a few devices on R-Car X5H, and e.g. the serial ports are in the always-on domain. I did experiment with a dummy UFS driver, as UFS is inside a real power domain, and that seemed to work fine.
[1] https://lore.kernel.org/arm-scmi/[email protected]/
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Re: [PATCH/RFC 05/14] firmware: arm_scmi: Add scmi_get_base_info()
In reply to Cristian MarussiHi Cristian,
Quoted 12 lines · Cristian Marussi
Quoted 2 lines · Geert Uytterhoeven
Currently non-SCMI drivers cannot find out what the specific versions of each SCMI provider implementation on the running system are.
Thanks for your patches....this is not a proper full review of the series, BUT this patch catched my eye..
Indeed, yes, it is deliberate that the SCMI version information is NOT exposed out of the SCMI world, since being the SCMI an attempt to standardize a common FW interface (as in [1] of course), you should not know what runs inside the black-box, it should be irrelevant...
Quoted 7 lines
...indeed the versioning is used inside the SCMI stack to deal properly with different protocol versions implemented by the server OR to apply proper quirks when needed, but all the rest should be standard....
...you should NOT really behave differently based on the underneath protocol or firmare implementation version...it is the SCMI stack that should behave properly, transparently...
Oh well...
Quoted 3 lines
Having said that...I understand that at least it could be useful to be able to query the SCMI stack to know, even from non-SCMI drivers, WHICH quirks have been applied/activated at run time...but anything more than that it
I see no need for that, but we can discover which quirks have been applied from the kernel log ;-)
Quoted 5 lines
seems to me dangerous and prone to a number of abuses of the SCMI stack itself...
(Also...exposing the versions itself means also tracking that bit of info in more than one place: the quirk framework and your drivers.)
I'll see if I can get everything handled as quirks instead...
Quoted 9 lines
Quoted 3 lines
However, different versions may use different ABIs (e.g. different clock IDs), or behave different, requiring remapping or workarounds in other drivers.
...abuse like this indeed :P ... the SCMI server is supposed to be that one entity remapping the IDs in the background if the same IDs happen to be representing different physical resources across a number of distinct platforms all supported by the same firmware blob...so as to present a consistent set of contiguos IDs...
In our case it is just a single platform, with different ID number spaces for different firmware versions.
Quoted 6 lines
Also because this should be one of the selling point of the SCMI stack in a virtualized environment: you can ship the same kernel drivers with the same DT and you know that ID=<N> will always identify the specific resource that is needed by your driver without worrying about the fact that in reality in the backstage the effectively managed physical resource could be different across different platforms, because that does not matter
This sounds strange to me, do I understand it correctly?
So the ID should (1) be tied to the use-case, and not to the underlying hardware, and (2) be the same for different platforms?
For (1): Then we must not put these IDs in DT at all, as DT is supposed
to describe the hardware (and firmware IDs in DT were IMHO already a stretch before).
For (2): How can there be a contiguous list of IDs, as not all platforms
may have the same underlying hardware?
Quoted 3 lines
if the SCMI platform server had properly remapped (at build time/run-time ?) the resources to your expected ID...alternatively of course you can ship with different DTs to describe different hardware...BUT remmapping stuff
That is a different issue: as SCMI covers the full platform, not just the SoC, the IDs can be board-specific, and thus should be specified in the board .dts, not in the SoC .dtsi?
Then the SoC .dtsi should describe the hardware, and we end up with things like arch/arm/boot/dts/st/stm32mp157a-dk1-scmi.dts?
Quoted 2 lines
in the drivers themselves guessing on the vendor/subvendor/impl_vers seems a dangerous abuse...
There is no guessing.
Quoted 3 lines
I watched a bit of the LPC discussions around this (from Marek I think) but sincerely most of those problems had one (not necessarily simple)
solution: fix your firmwares AND/OR apply quirks in the meantime...
Unfortunately (at this point) we have to work with the firmware that exists.
From that LPC discussion, we learned that we are actually the lucky
guys: some other vendors tend to change the IDs and/or behavior without bumping the version, so Linux cannot even act upon that...
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Cristian Marussi
reviewerRe: [PATCH/RFC 05/14] firmware: arm_scmi: Add scmi_get_base_info()
Quoted 1 line · Geert Uytterhoeven
Hi Cristian,
Hi Geert,
Quoted 22 lines · Cristian Marussi
Quoted 12 lines · Geert Uytterhoeven
Quoted 2 lines
Currently non-SCMI drivers cannot find out what the specific versions of each SCMI provider implementation on the running system are.
Thanks for your patches....this is not a proper full review of the series, BUT this patch catched my eye..
Indeed, yes, it is deliberate that the SCMI version information is NOT exposed out of the SCMI world, since being the SCMI an attempt to standardize a common FW interface (as in [1] of course), you should not know what runs inside the black-box, it should be irrelevant...
Quoted 7 lines
...indeed the versioning is used inside the SCMI stack to deal properly with different protocol versions implemented by the server OR to apply proper quirks when needed, but all the rest should be standard....
...you should NOT really behave differently based on the underneath protocol or firmare implementation version...it is the SCMI stack that should behave properly, transparently...
Quoted 8 lines
Oh well...
Quoted 3 lines
Having said that...I understand that at least it could be useful to be able to query the SCMI stack to know, even from non-SCMI drivers, WHICH quirks have been applied/activated at run time...but anything more than that it
I see no need for that, but we can discover which quirks have been applied from the kernel log ;-)
Ok so I may have misunderstood...it seemed to me, glancing through the series that you wanted sort of reconfigure other non-SCMI drivers based on the SCMI FW version assuming that some quirks were applied BUT also that some sort of corrective workaround was needed additionally...so what I was saying was that: is not more straightforward to be possibly able to check if a quirk has been applied instead of querying the version from outside ?
Quoted 13 lines
Quoted 6 lines
seems to me dangerous and prone to a number of abuses of the SCMI stack itself...
(Also...exposing the versions itself means also tracking that bit of info in more than one place: the quirk framework and your drivers.)
I'll see if I can get everything handled as quirks instead...
Quoted 4 lines
Quoted 3 lines
However, different versions may use different ABIs (e.g. different clock IDs), or behave different, requiring remapping or workarounds in other drivers.
Quoted 8 lines
Quoted 5 lines
...abuse like this indeed :P ... the SCMI server is supposed to be that one entity remapping the IDs in the background if the same IDs happen to be representing different physical resources across a number of distinct platforms all supported by the same firmware blob...so as to present a consistent set of contiguos IDs...
In our case it is just a single platform, with different ID number spaces for different firmware versions.
Yes understood.
Quoted 12 lines
Quoted 7 lines
Also because this should be one of the selling point of the SCMI stack in a virtualized environment: you can ship the same kernel drivers with the same DT and you know that ID=<N> will always identify the specific resource that is needed by your driver without worrying about the fact that in reality in the backstage the effectively managed physical resource could be different across different platforms, because that does not matter
This sounds strange to me, do I understand it correctly?
So the ID should (1) be tied to the use-case, and not to the underlying hardware, and (2) be the same for different platforms?
Quoted 6 lines
For (1): Then we must not put these IDs in DT at all, as DT is supposed
to describe the hardware (and firmware IDs in DT were IMHO already a stretch before).
For (2): How can there be a contiguous list of IDs, as not all platforms
may have the same underlying hardware?
I would NOT say that an SCMI FW must behave like this regarding IDs, but it is a possible SCMI deployed setup that can be useful in virtualized setups
I mean, the DT describes the hardware of course BUT when you refer to some of this hardware DT bits from some other subsystem by referencing a phandle, even in the non-SCMI world, you are in fact selecting a specific resource that fit you use case, right ? Can we say this ?
I mean you needed that specific clock or regulator that you described previously so as to be able to enable some other piece of HW...
Now, the SCMI provides an abstraction on top of this, since you really discover domain IDs of a specific class (clocks/regulators etc) you are in fact describing an HW abstraction that you then refer with the usual phandle...also because there is NOT so much SCMI hardware to describe, given that the HW is handled transparently (opaquely really :P) by the driver on the FW side...
...you basically obtain such domain ID, usable as phandles through dynamic SCMI enumeration so that you can use it all over your DT to make use of such resources...
...on top of this, consider that the SCMI server CAN provide to its agents a per-agent-view of the world, IOW it can (and should) expose to a specific agent ONLY the resources needed by that agent, i.e. it can expose the set of resources 1-N to two distinct agents and that does NOT mean that the underlying physical resource mapped by ID=3 in both agents has to be effectively the same piece of hardware: it could be the case, and this would be useful to exposed and managed properly a shared resource, or it could also be that the same ID=3 could refer to completely distinct pieces of the same class of hardware...(same protocol same class of resource...)
In fact the SCMI server provides an abstraction, sometime a mere illusion to the agents...
So in a virtualized ennvironment you could expose the same ID to a pair of distinct agents on distinct VMs, so that you can use the same driver and same DT despite the fact that maybe the underlying resources are distinct pieces of hardware ...
...OR on the other side you could decide to share the same resource with different agents (say a clock) and take care, as a server, of armonizing conflicting requests from different agents (e.g. by refcounting enable/disable across all agents), WITHOUT necessarily need to expose that same resource with the same ID to both agents...
...and you can easily draw a parallel from this virtualization dynamic scenario to a more static usecase where you have a FW shipped on multiple boards and so capable of serving, in fact, multiple distinct agents, but this time, just NOT all together like the VM, but one at time depending on which board configuration is booted...
....all of this madness of course has a chance to work ONLY if the SCMI server takes care to remap such resources properly at build-time or run-time as a contiguos set of IDs, based on the expected agents that it has to serve
I am, of course, disillusioned enough NOT to believe that many FW were shipped around trying to fit this ideal SCMI deployment scenario BUT at least we try, kernel side, NOT to ease these kind of design that goes pretty much against the SCMI ideas of a system (and the spec to some extent if you punch holes in the IDs sets), and even more we try NOT to legalize/normalize out-of-spec FW behaviours by fixing the driver, where required, and deploying needed quirks to let existing boards survive (..and that becomes quickly much more a pain in the ass for us then for the FW guys :P)
Quoted 19 lines
Quoted 3 lines
if the SCMI platform server had properly remapped (at build time/run-time ?) the resources to your expected ID...alternatively of course you can ship with different DTs to describe different hardware...BUT remmapping stuff
That is a different issue: as SCMI covers the full platform, not just the SoC, the IDs can be board-specific, and thus should be specified in the board .dts, not in the SoC .dtsi?
Then the SoC .dtsi should describe the hardware, and we end up with things likearch/arm/boot/dts/st/stm32mp157a-dk1-scmi.dts?Quoted 2 lines
in the drivers themselves guessing on the vendor/subvendor/impl_vers seems a dangerous abuse...
There is no guessing.
Quoted 3 lines
I watched a bit of the LPC discussions around this (from Marek I think) but sincerely most of those problems had one (not necessarily simple)
solution: fix your firmwares AND/OR apply quirks in the meantime...
Quoted 6 lines
Unfortunately (at this point) we have to work with the firmware that exists.
From that LPC discussion, we learned that we are actually the lucky
guys: some other vendors tend to change the IDs and/or behavior without bumping the version, so Linux cannot even act upon that...
Oh I know that :P ... the whole SCMI quirk framework has been introduced to cope with FW issue from one vendor that afterwards fixed their FW issue BUT did NOT take care to update properly their FW versions upon each release...so their quirks will be like diamonds, forever ! ... no matter how many fixed-FW they will deploy :P
Thanks,
Cristian
Quoted 22 lines · Geert Uytterhoeven
Hi Kevin,
Quoted 19 lines · Kevin Hilman
Quoted 17 lines · Geert Uytterhoeven
TL;DR:
Describe hardware in DT, and perform the mapping to SCMI in Linux.
The Renesas R-Car X5H-based Ironhide board is the first Renesas SoC/board combination that implements the ARM System Control and Management Interface (SCMI).
This means Linux can no longer perform various system operations (e.g. clock, power domain, and reset control) by accessing the hardware directly. Instead, these operations are abstracted according to various SCMI sub-protocols, and Linux has to send messages to an SCMI-compliant firmware running on a System Control Processor (SCP).
More specifically, the R-Car X5H SCP FW SCMI controls access to:
1. Core clocks and module clocks,
2. Module resets,
3. Power domains,
Quoted 8 lines
Quoted 3 lines
I'm very curious how power domain hierarchy is described on this SoC, because one more issue to add to your list is that hierarchy cannot be described for power domains in SCMI.
So far I had no need for such a description. AFAIK, this is handled inside the SCMI firmware, which does know the hierarchy. Hence the firmware can power up a domain when any of its children is powered up, and power it down when the last of its children is powered down?
Yes, but this firwmare behavior is subject to the normal list of limitations/quirks/lack-of-bugs/etc. that we usually run into with firmware. So if there's ever a need for linux to understand hierarchy for those reasons, you may find yourself stuck. :)
Quoted 8 lines
I think the clue lies in having a PSCI top-level domain, cfr. what you wrote in [1]:
"But... how do I describe the relationship of this hierarchy? In
particular, when the SCMI-controlled PDs are actually subdomains of a top-level, non-SCMI PD."Or am I missing something?
Indeed, the tricky part is when the domains may have CPUs/clusters in them, and in my case with the TI SoCs, the top-level domain with CPU clusters is PSCI controlled.
It wouldn't suprise me that other SoCs have similar features where some domains are children or siblings of domains with CPUs in them. This kind of dependency is pretty complex to manage in just SCP firmware, because it involves TF-A/PSCI as well, so it's a likely spot for firmware "quirks".
Kevin
Re: [PATCH/RFC 09/14] dt-bindings: clock: Document Renesas R-Car X5H Clock Pulse Generator
In reply to Geert UytterhoevenQuoted 4 lines · Geert Uytterhoeven
Document support for the Renesas R-Car X5H Clock Pulse Generator, and add definitions for a very limited and preliminary set of clocks.
Signed-off-by Geert Uytterhoeven <[email protected]>
I managed to implement U-Boot CPG remap driver based on these bindings, and the bindings also fit for U-Boot on RSIP direct hardware access CPG driver.
Re: [PATCH/RFC 10/14] dt-bindings: power: Document Renesas R-Car X5H Module Controller
In reply to Geert UytterhoevenOn 4/21/26 8:11 PM, Geert Uytterhoeven wrote:
Hello Geert,
Documentation/devicetree/bindings/power/renesas,r8a78000-mdlc.yaml
Quoted 5 lines
Documentation/devicetree/bindings/power/renesas,r8a78000-mdlc.yaml new file +5
-0+ '#power-domain-cells': + description: | + - The first power domain specifier cell must be either the Module + Power Domain Gating (MPDG) register index (0x00-0x3f) from the + datasheet,
I agree with this part.
Quoted 2 lines
or a Power Domain number, as defined in
+ <dt-bindings/power/renesas,r8a78000-mdlc.h>,
I do not understand this part, please see end of this email ...
Documentation/devicetree/bindings/power/renesas,r8a78000-mdlc.yaml line 34
Quoted 5 lines
Documentation/devicetree/bindings/power/renesas,r8a78000-mdlc.yaml new file +5
-0+ - The second power domain specifier cell must be the module number + (0x00-0xff), composed of the Module System Reset (MSRES) register index + in the high nibble, and the Module Reset Destination bitfield index in + the low nibble. + const: 2
I am unsure about this part.
There are multiple MDLC blocks, AON, SCP, HSCN, and so on. Each MDLC block contains multiple Module Power Domain Gating registers (MPDGn) and multiple Module System RESet register (MSRES) .
I do understand and agree that the first power-domains-cells cell must be the identifier of power domain within the MDLC block.
However, I do not understand the second cell. The MDLC bindings already contain reset-cells, which should be used to refer to a reset within the MDLC block. Resets within the MDLC block are operated using the MSRES registers. Why are resets conflated into power-domain-cells ?
Quoted 4 lines
Documentation/devicetree/bindings/power/renesas,r8a78000-mdlc.yaml new file +4
-0+ '#reset-cells': + description: + The single reset specifier cell must be the module number (0x00-0xff). + const: 1
[...]
include/dt-bindings/power/renesas,r8a78000-mdlc.h line 14
Quoted 10 lines
include/dt-bindings/power/renesas,r8a78000-mdlc.h new file +10
-0+#ifndef __DT_BINDINGS_POWER_RENESAS_R8A78000_MDLC_H__ +#define __DT_BINDINGS_POWER_RENESAS_R8A78000_MDLC_H__ + +/* R-Car X5H MDLC Power Domains */ + +#define R8A78000_MDLC_PD_AON 0x40 +#define R8A78000_MDLC_PD_SCP 0x41 +#define R8A78000_MDLC_PD_APL 0x42 +#define R8A78000_MDLC_PD_CMN 0x43 +#define R8A78000_MDLC_PD_ACL 0x44
... what do these numbers represent ? Shouldn't those be register offsets from MDLC MPDG00 according to power-domain-cells ?
If those are power domain IDs, then I am unsure why e.g. for SCIF the domain ID is R8A78000_MDLC_PD_APL in [PATCH/RFC 13/14] arm64: dts: renesas: r8a78000: Add CPG/MDLC nodes . Could you please expand on that ?
Thank you !
Re: [PATCH/RFC 10/14] dt-bindings: power: Document Renesas R-Car X5H Module Controller
Hi Marek,
Quoted 26 lines · Marek Vasut
Documentation/devicetree/bindings/power/renesas,r8a78000-mdlc.yaml
Quoted 5 lines · Geert Uytterhoeven
Documentation/devicetree/bindings/power/renesas,r8a78000-mdlc.yaml new file +5
-0+ '#power-domain-cells': + description: | + - The first power domain specifier cell must be either the Module + Power Domain Gating (MPDG) register index (0x00-0x3f) from the + datasheet,I agree with this part.
Quoted 2 lines
or a Power Domain number, as defined in
+ <dt-bindings/power/renesas,r8a78000-mdlc.h>,I do not understand this part, please see end of this email ...
Documentation/devicetree/bindings/power/renesas,r8a78000-mdlc.yaml line 34
Quoted 5 lines
Documentation/devicetree/bindings/power/renesas,r8a78000-mdlc.yaml new file +5
-0+ - The second power domain specifier cell must be the module number + (0x00-0xff), composed of the Module System Reset (MSRES) register index + in the high nibble, and the Module Reset Destination bitfield index in + the low nibble. + const: 2I am unsure about this part.
There are multiple MDLC blocks, AON, SCP, HSCN, and so on. Each MDLC block contains multiple Module Power Domain Gating registers (MPDGn) and multiple Module System RESet register (MSRES) .
Quoted 7 lines
I do understand and agree that the first power-domains-cells cell must be the identifier of power domain within the MDLC block.
However, I do not understand the second cell. The MDLC bindings already contain reset-cells, which should be used to refer to a reset within the MDLC block. Resets within the MDLC block are operated using the MSRES registers. Why are resets conflated into power-domain-cells ?
The Module Reset Destination bitfields in the MSRES registers are 2-bit wide, and control both Reset and Module Standby. Hence the same register bitfields are referred to in the power-domains and resets properties, through the module number.
Module Standby controls the clock(s) going into the module, and is modelled as an SCMI clock (SCP_CLOCK_ID_MDLC_*) by the SCP firmware. This is very similar to how MSTP (Module Stop) clocks are handled on earlier R-Car SoCs (except that the SCP_CLOCK_ID_MDLC_* clocks have a zero rate :-(.
Summarized, the first cell is the power domain part, and the second cell is the clock domain part.
So perhaps I will clarify like this:
- The first power domain specifier cell is the power domain part, and must be either the Module Power Domain Gating (MPDG) register index (0x00-0x3f) from the datasheet, or a Power Domain number, as defined in <dt-bindings/power/renesas,r8a78000-mdlc.h>,
- The second power domain specifier cell is the clock domain part, and must be the module number (0x00-0xff), composed of the Module System Reset (MSRES) register index in the high nibble, and the Module Reset Destination bitfield index in the low nibble.
Quoted 7 lines
Quoted 4 lines
Documentation/devicetree/bindings/power/renesas,r8a78000-mdlc.yaml new file +4
-0+ '#reset-cells': + description: + The single reset specifier cell must be the module number (0x00-0xff). + const: 1[...]
Quoted 12 lines
include/dt-bindings/power/renesas,r8a78000-mdlc.h line 14
Quoted 10 lines
include/dt-bindings/power/renesas,r8a78000-mdlc.h new file +10
-0+#ifndef __DT_BINDINGS_POWER_RENESAS_R8A78000_MDLC_H__ +#define __DT_BINDINGS_POWER_RENESAS_R8A78000_MDLC_H__ + +/* R-Car X5H MDLC Power Domains */ + +#define R8A78000_MDLC_PD_AON 0x40 +#define R8A78000_MDLC_PD_SCP 0x41 +#define R8A78000_MDLC_PD_APL 0x42 +#define R8A78000_MDLC_PD_CMN 0x43 +#define R8A78000_MDLC_PD_ACL 0x44... what do these numbers represent ? Shouldn't those be register offsets from MDLC MPDG00 according to power-domain-cells ?
These are Power Domains that are not backed by any of the 64 Module Power Domain Gating (MPDG) registers in MDLC blocks.
It is not clear to me if they can be controlled manually, probably they are just always sequenced automatically on power-up. As the documentation does treat them as separate domains (see e.g. Table 14.1 Power Supply Voltage Monitor Functions), I figured they would better be exposed as separate domains, instead of as a single always-on domain, like on earlier R-Car SoCs (cfr. R8A779*_PD_ALWAYS_ON domains number 32 or 64).
See also the X5H_Power_domain_structure.xlsx attachment in the R-Car X5H documentation.
Quoted 3 lines
If those are power domain IDs, then I am unsure why e.g. for SCIF the domain ID is
R8A78000_MDLC_PD_APLin [PATCH/RFC 13/14] arm64: dts:
renesas: r8a78000: Add CPG/MDLC nodes . Could you please expand on that ?
See the "Module Standby" attachment X5H_MS.xlsx in the R-Car X5H documentation. The "PERW" tab shows that all PERW devices are located in the PD_APL power domain, which is always-on.
This is different from e.g. the UFS controllers: they are located in their own PD_UFS0 and PD_UFS1 power domains, which are controlled through the Module Power Domain Gating registers (MPDGn) (cfr. the "PERE" tab).
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Re: [PATCH/RFC 05/14] firmware: arm_scmi: Add scmi_get_base_info()
In reply to Cristian MarussiHi Cristian,
Quoted 31 lines · Cristian Marussi
Quoted 21 lines · Geert Uytterhoeven
Quoted 12 lines · Cristian Marussi
Quoted 2 lines · Geert Uytterhoeven
Currently non-SCMI drivers cannot find out what the specific versions of each SCMI provider implementation on the running system are.
Thanks for your patches....this is not a proper full review of the series, BUT this patch catched my eye..
Indeed, yes, it is deliberate that the SCMI version information is NOT exposed out of the SCMI world, since being the SCMI an attempt to standardize a common FW interface (as in [1] of course), you should not know what runs inside the black-box, it should be irrelevant...
Quoted 7 lines
...indeed the versioning is used inside the SCMI stack to deal properly with different protocol versions implemented by the server OR to apply proper quirks when needed, but all the rest should be standard....
...you should NOT really behave differently based on the underneath protocol or firmare implementation version...it is the SCMI stack that should behave properly, transparently...
Quoted 8 lines
Oh well...
Quoted 3 lines
Having said that...I understand that at least it could be useful to be able to query the SCMI stack to know, even from non-SCMI drivers, WHICH quirks have been applied/activated at run time...but anything more than that it
I see no need for that, but we can discover which quirks have been applied from the kernel log ;-)
Quoted 7 lines
Ok so I may have misunderstood...it seemed to me, glancing through the series that you wanted sort of reconfigure other non-SCMI drivers based on the SCMI FW version assuming that some quirks were applied BUT also that some sort of corrective workaround was needed additionally...so what I was saying was that: is not more straightforward to be possibly able to check if a quirk has been applied instead of querying the version from outside ?
I am not sure I can implement everything as quirks... Also, as quirks.h lives under drivers/firmware/arm_scmi/, accessing quirks.h elsewhere requires a relative include path.
Quoted 20 lines
Quoted 11 lines
Quoted 6 lines
Also because this should be one of the selling point of the SCMI stack in a virtualized environment: you can ship the same kernel drivers with the same DT and you know that ID=<N> will always identify the specific resource that is needed by your driver without worrying about the fact that in reality in the backstage the effectively managed physical resource could be different across different platforms, because that does not matter
This sounds strange to me, do I understand it correctly?
So the ID should (1) be tied to the use-case, and not to the underlying hardware, and (2) be the same for different platforms?Quoted 5 lines
For (1): Then we must not put these IDs in DT at all, as DT is supposed
to describe the hardware (and firmware IDs in DT were IMHO already a stretch before).
For (2): How can there be a contiguous list of IDs, as not all platforms
may have the same underlying hardware?I would NOT say that an SCMI FW must behave like this regarding IDs, but it is a possible SCMI deployed setup that can be useful in virtualized setups
Quoted 6 lines
I mean, the DT describes the hardware of course BUT when you refer to some of this hardware DT bits from some other subsystem by referencing a phandle, even in the non-SCMI world, you are in fact selecting a specific resource that fit you use case, right ? Can we say this ?
I mean you needed that specific clock or regulator that you described previously so as to be able to enable some other piece of HW...
OK.
Quoted 22 lines
Now, the SCMI provides an abstraction on top of this, since you really discover domain IDs of a specific class (clocks/regulators etc) you are in fact describing an HW abstraction that you then refer with the usual phandle...also because there is NOT so much SCMI hardware to describe, given that the HW is handled transparently (opaquely really :P) by the driver on the FW side...
...you basically obtain such domain ID, usable as phandles through dynamic SCMI enumeration so that you can use it all over your DT to make use of such resources...
...on top of this, consider that the SCMI server CAN provide to its agents a per-agent-view of the world, IOW it can (and should) expose to a specific agent ONLY the resources needed by that agent, i.e. it can expose the set of resources 1-N to two distinct agents and that does NOT mean that the underlying physical resource mapped by ID=3 in both agents has to be effectively the same piece of hardware: it could be the case, and this would be useful to exposed and managed properly a shared resource, or it could also be that the same ID=3 could refer to completely distinct pieces of the same class of hardware...(same protocol same class of resource...)
Quoted 7 lines
In fact the SCMI server provides an abstraction, sometime a mere illusion to the agents...
So in a virtualized ennvironment you could expose the same ID to a pair of distinct agents on distinct VMs, so that you can use the same driver and same DT despite the fact that maybe the underlying resources are distinct pieces of hardware ...
I am not sure how this can actually work. Many clock, reset, and power domain resources cannot just be remapped to different hardware, as they are related to other hardware resources described in DT, which are not handled by SCMI.
Take for example a serial port:
serial@c0714000 {
compatible = "vendor,serial"'
reg = <0 0xc0714000 0 0x60>;
interrupts = <GIC_ESPI 15 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&scmi_clk 42>, <&scmi_clk 43>, <&scif_clk>;
clock-names = "fck", "brg_int", "scif_clk";
dmas = <&dmac1 0x33>, <&dmac1 0x32>;
dma-names = "tx", "rx";
power-domains = <&scmi_pd 44>;
resets = <&scmi_reset 45>;
status = "disabled";
};The clock, power-domain, and reset cannot be remapped to a different serial port instance, as they are tied intimately to this specific instance at MMIO address 0xc0714000, which is wired to a specific ESPI interrupt and to specific DMA controller channels.
Quoted 5 lines
...OR on the other side you could decide to share the same resource with different agents (say a clock) and take care, as a server, of armonizing conflicting requests from different agents (e.g. by refcounting enable/disable across all agents), WITHOUT necessarily need to expose that same resource with the same ID to both agents...
E.g. preventing the inadvertent disabling of shared resources like shared parent clocks I can agree with.
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Re: [PATCH/RFC 10/14] dt-bindings: power: Document Renesas R-Car X5H Module Controller
In reply to Geert UytterhoevenOn 5/7/26 9:37 AM, Geert Uytterhoeven wrote:
Hello Geert,
Quoted 40 lines · Marek Vasut
Quoted 26 lines · Geert Uytterhoeven
Documentation/devicetree/bindings/power/renesas,r8a78000-mdlc.yaml
Quoted 5 lines
Documentation/devicetree/bindings/power/renesas,r8a78000-mdlc.yaml new file +5
-0+ '#power-domain-cells': + description: | + - The first power domain specifier cell must be either the Module + Power Domain Gating (MPDG) register index (0x00-0x3f) from the + datasheet,I agree with this part.
Quoted 2 lines
or a Power Domain number, as defined in
+ <dt-bindings/power/renesas,r8a78000-mdlc.h>,I do not understand this part, please see end of this email ...
Documentation/devicetree/bindings/power/renesas,r8a78000-mdlc.yaml line 34
Quoted 5 lines
Documentation/devicetree/bindings/power/renesas,r8a78000-mdlc.yaml new file +5
-0+ - The second power domain specifier cell must be the module number + (0x00-0xff), composed of the Module System Reset (MSRES) register index + in the high nibble, and the Module Reset Destination bitfield index in + the low nibble. + const: 2I am unsure about this part.
There are multiple MDLC blocks, AON, SCP, HSCN, and so on. Each MDLC block contains multiple Module Power Domain Gating registers (MPDGn) and multiple Module System RESet register (MSRES) .
Quoted 7 lines
I do understand and agree that the first power-domains-cells cell must be the identifier of power domain within the MDLC block.
However, I do not understand the second cell. The MDLC bindings already contain reset-cells, which should be used to refer to a reset within the MDLC block. Resets within the MDLC block are operated using the MSRES registers. Why are resets conflated into power-domain-cells ?
The Module Reset Destination bitfields in the MSRES registers are 2-bit wide, and control both Reset and Module Standby. Hence the same register bitfields are referred to in the power-domains and resets properties, through the module number.
Quoted 8 lines
Module Standby controls the clock(s) going into the module, and is modelled as an SCMI clock (SCP_CLOCK_ID_MDLC_*) by the SCP firmware. This is very similar to how MSTP (Module Stop) clocks are handled on earlier R-Car SoCs (except that the SCP_CLOCK_ID_MDLC_* clocks have a zero rate :-(.
Summarized, the first cell is the power domain part, and the second cell is the clock domain part.
Thank you for the clarification.
Since there are up to 32 MPDG registers, and 256 resets, can we encode both into a single cell ?
(mpdg_register_offset << 16) | (reset_bit_offset << 0)
I cannot tell whether this is much better, but it at least ties the PD components (power domain and clock domain) into a single value, which matches reality a bit better. The current split power domain and clock domain description in two cells gives me the illusion that it is possible to mix and match power domains and clock domains in DT description, but in fact the two cells are strongly tied together.
If we cannot encode the two into a single cell, maybe we can at least have some sort of macro for this, e.g. this (0xff as no MPDG register bits for this block):
#define R8A78000_MDLC_PD_HSCIF0 (0xff << 16) ((0x5 << 4) | (0x3 << 0))
What do you think ?
Quoted 4 lines
So perhaps I will clarify like this:
- The first power domain specifier cell is the power domain part, and must be either the Module Power Domain Gating (MPDG) register index
... for power domains which are backed by MDPG bits, and which can be controlled in that manner ...
Quoted 2 lines
(0x00-0x3f) from the datasheet, or a Power Domain number, as defined in
<dt-bindings/power/renesas,r8a78000-mdlc.h>,... for power domains which are always on, and for which there are no MPDG bits which can be used to control them ...
Quoted 4 lines
- The second power domain specifier cell is the clock domain part, and must be the module number (0x00-0xff), composed of the Module System Reset (MSRES) register index in the high nibble, and the Module Reset Destination bitfield index in the low nibble.
I can understand this.
Quoted 20 lines
Quoted 7 lines
Quoted 4 lines
Documentation/devicetree/bindings/power/renesas,r8a78000-mdlc.yaml new file +4
-0+ '#reset-cells': + description: + The single reset specifier cell must be the module number (0x00-0xff). + const: 1[...]
Quoted 12 lines
include/dt-bindings/power/renesas,r8a78000-mdlc.h line 14
Quoted 10 lines
include/dt-bindings/power/renesas,r8a78000-mdlc.h new file +10
-0+#ifndef __DT_BINDINGS_POWER_RENESAS_R8A78000_MDLC_H__ +#define __DT_BINDINGS_POWER_RENESAS_R8A78000_MDLC_H__ + +/* R-Car X5H MDLC Power Domains */ + +#define R8A78000_MDLC_PD_AON 0x40 +#define R8A78000_MDLC_PD_SCP 0x41 +#define R8A78000_MDLC_PD_APL 0x42 +#define R8A78000_MDLC_PD_CMN 0x43 +#define R8A78000_MDLC_PD_ACL 0x44... what do these numbers represent ? Shouldn't those be register offsets from MDLC MPDG00 according to power-domain-cells ?
Quoted 2 lines
These are Power Domains that are not backed by any of the 64 Module Power Domain Gating (MPDG) registers in MDLC blocks.
I suspect that might not be entirely correct for all of them, please read on and see CMN below.
Quoted 10 lines
It is not clear to me if they can be controlled manually, probably they are just always sequenced automatically on power-up. As the documentation does treat them as separate domains (see e.g. Table 14.1 Power Supply Voltage Monitor Functions), I figured they would better be exposed as separate domains, instead of as a single always-on domain, like on earlier R-Car SoCs (cfr. R8A779*_PD_ALWAYS_ON domains number 32 or 64).
See also the X5H_Power_domain_structure.xlsx attachment in the R-Car X5H documentation.
This is indeed helpful piece of documentation, together with X5H_MS, but I think the later is still being updated.
Let's take PD_AC00 , AP core 0 , as a domain of interest. My understanding is, that the domain structure for PD_AC00 looks as follows:
PD_AON {
PD_SCP { };
PD_APL {
hierarchy is SYSSS
always-power-on
PD_CMN {
hierarchy is CMNN
power-gating-bit is MDLC_CMNN 20
PD_APU0 {
hierarchy is SYSSS
power-gating is done by APMU
PD_ACL0 {
hierarchy is CMNN
power-gating-bit is MDLC_CMNN 16
PD_AC00 {
hierarchy is CMNN
power-gating-bit is MDLC_CMNN 0
};
...
};
...
};
...
};
...
PD_HSCIF0 {
hierarchy is PERW
power-gating-bit is MDLC_PERW 23
}; };
...
};
With this in mind, I think CPU 0 DT node should refer to the PD_AC00 power domain this way:
cpu@0 {
...
power-domains = <&mdlc_cmnn R8A78000_MDLC_PD_AC00>;
...
};
The MDLC driver would pass the PD_AC00 domain ID to matching SCMI power domain management protocol call, or, for bare-metal MDLC driver, would have to internally encode PD hierarchy, walk it, and apply PD operations in each step.
I think even for SCIF/HSCIF, the power domain reference should be something along the lines of the following description. The MDLC driver should internally encode that R8A78000_MLDC_PD_HSCIF0 is a sub-domain of R8A78000_MDLC_PD_APL .
serial@c0710000 {
...
power-domains = <&mdlc_perw R8A78000_MDLC_PD_HSCIF0>;
...
};
Quoted 11 lines
Quoted 3 lines
If those are power domain IDs, then I am unsure why e.g. for SCIF the domain ID is
R8A78000_MDLC_PD_APLin [PATCH/RFC 13/14] arm64: dts:
renesas: r8a78000: Add CPG/MDLC nodes . Could you please expand on that ?See the "Module Standby" attachment X5H_MS.xlsx in the R-Car X5H documentation. The "PERW" tab shows that all PERW devices are located in the
PD_APLpower domain, which is always-on.
This is different from e.g. the UFS controllers: they are located in their ownPD_UFS0andPD_UFS1power domains, which are controlled through the Module Power Domain Gating registers (MPDGn) (cfr. the "PERE" tab).
Thank you for this clarification !
Re: [PATCH/RFC 10/14] dt-bindings: power: Document Renesas R-Car X5H Module Controller
In reply to Geert UytterhoevenOn 4/21/26 8:11 PM, Geert Uytterhoeven wrote:
[...]
Quoted 6 lines
Documentation/devicetree/bindings/power/renesas,r8a78000-mdlc.yaml new file +6
-0+ '#power-domain-cells': + description: | + - The first power domain specifier cell must be either the Module + Power Domain Gating (MPDG) register index (0x00-0x3f) from the + datasheet, or a Power Domain number, as defined in + <dt-bindings/power/renesas,r8a78000-mdlc.h>,
Documentation/devicetree/bindings/power/renesas,r8a78000-mdlc.yaml line 39
Quoted 10 lines
Documentation/devicetree/bindings/power/renesas,r8a78000-mdlc.yaml new file +10
-0+ - The second power domain specifier cell must be the module number + (0x00-0xff), composed of the Module System Reset (MSRES) register index + in the high nibble, and the Module Reset Destination bitfield index in + the low nibble. + const: 2 + + '#reset-cells': + description: + The single reset specifier cell must be the module number (0x00-0xff). + const: 1
Just one more question -- the power-domain-cells second cell and reset-cells are always going to be identical values, correct ? If so, it would be nice to keep the description: aligned, and maybe even indicate in the description that those two values have to be the same.
Re: [PATCH/RFC 10/14] dt-bindings: power: Document Renesas R-Car X5H Module Controller
Hi Marek,
Quoted 17 lines · Marek Vasut
Quoted 6 lines · Geert Uytterhoeven
Documentation/devicetree/bindings/power/renesas,r8a78000-mdlc.yaml new file +6
-0+ '#power-domain-cells': + description: | + - The first power domain specifier cell must be either the Module + Power Domain Gating (MPDG) register index (0x00-0x3f) from the + datasheet, or a Power Domain number, as defined in + <dt-bindings/power/renesas,r8a78000-mdlc.h>,Documentation/devicetree/bindings/power/renesas,r8a78000-mdlc.yaml line 39
Quoted 10 lines
Documentation/devicetree/bindings/power/renesas,r8a78000-mdlc.yaml new file +10
-0+ - The second power domain specifier cell must be the module number + (0x00-0xff), composed of the Module System Reset (MSRES) register index + in the high nibble, and the Module Reset Destination bitfield index in + the low nibble. + const: 2 + + '#reset-cells': + description: + The single reset specifier cell must be the module number (0x00-0xff). + const: 1
Quoted 2 lines
Just one more question -- the power-domain-cells second cell and reset-cells are always going to be identical values, correct ? If so, it
Yes they are.
Quoted 2 lines
would be nice to keep the description: aligned, and maybe even indicate in the description that those two values have to be the same.
I thought that was obvious (but apparently it is not)? The descriptions are identical, except for the latter not explaining again what a module number is composed of...
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Re: [PATCH/RFC 10/14] dt-bindings: power: Document Renesas R-Car X5H Module Controller
In reply to Marek VasutHi Marek,
Quoted 50 lines · Marek Vasut
Quoted 40 lines · Geert Uytterhoeven
Quoted 26 lines · Marek Vasut
Documentation/devicetree/bindings/power/renesas,r8a78000-mdlc.yaml
Quoted 5 lines · Geert Uytterhoeven
Documentation/devicetree/bindings/power/renesas,r8a78000-mdlc.yaml new file +5
-0+ '#power-domain-cells': + description: | + - The first power domain specifier cell must be either the Module + Power Domain Gating (MPDG) register index (0x00-0x3f) from the + datasheet,I agree with this part.
Quoted 2 lines
or a Power Domain number, as defined in
+ <dt-bindings/power/renesas,r8a78000-mdlc.h>,I do not understand this part, please see end of this email ...
Documentation/devicetree/bindings/power/renesas,r8a78000-mdlc.yaml line 34
Quoted 5 lines
Documentation/devicetree/bindings/power/renesas,r8a78000-mdlc.yaml new file +5
-0+ - The second power domain specifier cell must be the module number + (0x00-0xff), composed of the Module System Reset (MSRES) register index + in the high nibble, and the Module Reset Destination bitfield index in + the low nibble. + const: 2I am unsure about this part.
There are multiple MDLC blocks, AON, SCP, HSCN, and so on. Each MDLC block contains multiple Module Power Domain Gating registers (MPDGn) and multiple Module System RESet register (MSRES) .
Quoted 7 lines
I do understand and agree that the first power-domains-cells cell must be the identifier of power domain within the MDLC block.
However, I do not understand the second cell. The MDLC bindings already contain reset-cells, which should be used to refer to a reset within the MDLC block. Resets within the MDLC block are operated using the MSRES registers. Why are resets conflated into power-domain-cells ?
The Module Reset Destination bitfields in the MSRES registers are 2-bit wide, and control both Reset and Module Standby. Hence the same register bitfields are referred to in the power-domains and resets properties, through the module number.
Quoted 8 lines
Module Standby controls the clock(s) going into the module, and is modelled as an SCMI clock (SCP_CLOCK_ID_MDLC_*) by the SCP firmware. This is very similar to how MSTP (Module Stop) clocks are handled on earlier R-Car SoCs (except that the SCP_CLOCK_ID_MDLC_* clocks have a zero rate :-(.
Summarized, the first cell is the power domain part, and the second cell is the clock domain part.
Quoted 6 lines
Thank you for the clarification.
Since there are up to 32 MPDG registers, and 256 resets, can we encode both into a single cell ?
(
mpdg_register_offset<< 16) | (reset_bit_offset<< 0)
We could. I did consider it (with a shift of 8 cfr. 256 modules), but see below...
Quoted 6 lines
I cannot tell whether this is much better, but it at least ties the PD components (power domain and clock domain) into a single value, which matches reality a bit better. The current split power domain and clock domain description in two cells gives me the illusion that it is possible to mix and match power domains and clock domains in DT description, but in fact the two cells are strongly tied together.
They are only tied together in the sense that a module (hardware block) is part of a power domain, and has module standby (clock) control. Some power domains are backed by MDLC hardware registers, others are not, hence the need for the additional definitions in <dt-bindings/power/renesas,r8a78000-mdlc.h>.
I am not aware (yet) of modules that are part of a power domain, but do not have module standby control. If these exist, we need an additional definition (R8A78000_MDLC_MODULE_NONE?) in <dt-bindings/power/renesas,r8a78000-mdlc.h>.
Due to this separation, and due to a possible future need for expansion (R8A78000_MDLC_MODULE_NONE, MDLCs with more than 256 modules, ...), I went for two cells.
Quoted 6 lines
If we cannot encode the two into a single cell, maybe we can at least have some sort of macro for this, e.g. this (
0xffas no MPDG register bits for this block):
#defineR8A78000_MDLC_PD_HSCIF0(0xff<< 16) ((0x5<< 4) | (0x3<< 0))What do you think ?
I (and I believe the DT maintainers) are not so fond of defines for numbers that can be (more or less) just read from the documentation. (and 0xff should be R8A78000_MDLC_PD_APL?)
Quoted 7 lines
Quoted 4 lines
So perhaps I will clarify like this:
- The first power domain specifier cell is the power domain part, and must be either the Module Power Domain Gating (MPDG) register index
... for power domains which are backed by MDPG bits, and which can be controlled in that manner ...
OK.
Quoted 5 lines
Quoted 2 lines
(0x00-0x3f) from the datasheet, or a Power Domain number, as defined in <dt-bindings/power/renesas,r8a78000-mdlc.h>,... for power domains which are always on, and for which there are no MPDG bits which can be used to control them ...
OK,
Quoted 2 lines
Quoted 2 lines
- The second power domain specifier cell is the clock domain part, and
Upon second thought: s/clock domain/module standby/
Quoted 26 lines
Quoted 3 lines
must be the module number (0x00-0xff), composed of the Module System Reset (MSRES) register index in the high nibble, and the Module Reset Destination bitfield index in the low nibble.
I can understand this.
Quoted 20 lines
Quoted 19 lines
Quoted 4 lines
Documentation/devicetree/bindings/power/renesas,r8a78000-mdlc.yaml new file +4
-0+ '#reset-cells': + description: + The single reset specifier cell must be the module number (0x00-0xff). + const: 1[...]
include/dt-bindings/power/renesas,r8a78000-mdlc.h line 14
Quoted 10 lines
include/dt-bindings/power/renesas,r8a78000-mdlc.h new file +10
-0+#ifndef __DT_BINDINGS_POWER_RENESAS_R8A78000_MDLC_H__ +#define __DT_BINDINGS_POWER_RENESAS_R8A78000_MDLC_H__ + +/* R-Car X5H MDLC Power Domains */ + +#define R8A78000_MDLC_PD_AON 0x40 +#define R8A78000_MDLC_PD_SCP 0x41 +#define R8A78000_MDLC_PD_APL 0x42 +#define R8A78000_MDLC_PD_CMN 0x43 +#define R8A78000_MDLC_PD_ACL 0x44... what do these numbers represent ? Shouldn't those be register offsets from MDLC MPDG00 according to power-domain-cells ?
Quoted 5 lines
Quoted 2 lines
These are Power Domains that are not backed by any of the 64 Module Power Domain Gating (MPDG) registers in MDLC blocks.
I suspect that might not be entirely correct for all of them, please read on and see CMN below.
Thanks, looks like R8A78000_MDLC_PD_CMN should be dropped.
Quoted 36 lines
Let's take
PD_AC00, AP core 0 , as a domain of interest. My understanding is, that the domain structure forPD_AC00looks as follows:PD_AON { PD_SCP { }; PD_APL { hierarchy is SYSSS always-power-on PD_CMN { hierarchy is CMNN power-gating-bit is MDLC_CMNN 20 PD_APU0 { hierarchy is SYSSS power-gating is done by APMU PD_ACL0 { hierarchy is CMNN power-gating-bit is MDLC_CMNN 16 PD_AC00 { hierarchy is CMNN power-gating-bit is MDLC_CMNN 0 }; ... }; ... }; ... }; ... PD_HSCIF0 { hierarchy is PERW power-gating-bit is MDLC_PERW 23 }; }; ... };
Quoted 8 lines
With this in mind, I think CPU 0 DT node should refer to the
PD_AC00power domain this way:cpu@0 { ... power-domains = <&mdlc_cmnn R8A78000_MDLC_PD_AC00>; ... };
So we do have a few modules (I found a few more) that are part of power domains, but do no support module standby. One more reason to decouple them in power-domains.
However, CPU cores are controlled through PSCI (the slightly less evil brother of SCMI? ;-), so Documentation/devicetree/bindings/arm/psci.yaml applies, too?
Quoted 11 lines
The MDLC driver would pass the
PD_AC00domain ID to matching SCMI power domain management protocol call, or, for bare-metal MDLC driver, would have to internally encode PD hierarchy, walk it, and apply PD operations in each step.I think even for SCIF/HSCIF, the power domain reference should be something along the lines of the following description. The MDLC driver should internally encode that
R8A78000_MLDC_PD_HSCIF0is a sub-domain ofR8A78000_MDLC_PD_APL.
Quoted 5 lines
serial@c0710000 {
...
power-domains = <&mdlc_perw R8A78000_MDLC_PD_HSCIF0>;
...
};R8A78000_MLDC_PD_HSCIF0 is a not a full sub-domain, but merely standby (clock) control inside the PD_APL clock domain?
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Re: [PATCH/RFC 05/14] firmware: arm_scmi: Add scmi_get_base_info()
In reply to Cristian MarussiHi Cristian,
Quoted 40 lines · Cristian Marussi
Quoted 12 lines · Geert Uytterhoeven
Quoted 6 lines · Cristian Marussi
Also because this should be one of the selling point of the SCMI stack in a virtualized environment: you can ship the same kernel drivers with the same DT and you know that ID=<N> will always identify the specific resource that is needed by your driver without worrying about the fact that in reality in the backstage the effectively managed physical resource could be different across different platforms, because that does not matter
This sounds strange to me, do I understand it correctly?
So the ID should (1) be tied to the use-case, and not to the underlying hardware, and (2) be the same for different platforms?Quoted 5 lines
For (1): Then we must not put these IDs in DT at all, as DT is supposed
to describe the hardware (and firmware IDs in DT were IMHO already a stretch before).
For (2): How can there be a contiguous list of IDs, as not all platforms
may have the same underlying hardware?I would NOT say that an SCMI FW must behave like this regarding IDs, but it is a possible SCMI deployed setup that can be useful in virtualized setups
I mean, the DT describes the hardware of course BUT when you refer to some of this hardware DT bits from some other subsystem by referencing a phandle, even in the non-SCMI world, you are in fact selecting a specific resource that fit you use case, right ? Can we say this ?
I mean you needed that specific clock or regulator that you described previously so as to be able to enable some other piece of HW...Now, the SCMI provides an abstraction on top of this, since you really discover domain IDs of a specific class (clocks/regulators etc) you are in fact describing an HW abstraction that you then refer with the usual phandle...also because there is NOT so much SCMI hardware to describe, given that the HW is handled transparently (opaquely really :P) by the driver on the FW side...
...you basically obtain such domain ID, usable as phandles through dynamic SCMI enumeration so that you can use it all over your DT to make use of such resources...
Quoted 10 lines
...on top of this, consider that the SCMI server CAN provide to its agents a per-agent-view of the world, IOW it can (and should) expose to a specific agent ONLY the resources needed by that agent, i.e. it can expose the set of resources 1-N to two distinct agents and that does NOT mean that the underlying physical resource mapped by ID=3 in both agents has to be effectively the same piece of hardware: it could be the case, and this would be useful to exposed and managed properly a shared resource, or it could also be that the same ID=3 could refer to completely distinct pieces of the same class of hardware...(same protocol same class of resource...)
Exposing only the clocks/reset/power domains the agent can use, in a contiguous list of IDS, means that the number space changes, depending on which resources are exposed.
Suppose you have a system where you want to assign a specific hardware block in the SoC to the realtime CPU core instead of the application CPU core running Linux.
That means all resources used by that block must no longer be exposed to the Linux agent, and the corresponding IDs must be removed from the ID space exposed to Linux. As the ID space must be sequential and contiguous, the IDs must be renumbered, impacting resources that are exposed to Linux. As these IDs are used in the SoC .dtsi, they must be changed there, too, However, these IDs have become part of the stable DT ABI, and thus cannot be changed.
This patch series fixes that issue, too, by describing the actual hardware in DT, and doing the mapping to exposed SCMI features in the kernel, based on which firmware version is running on the SCP.
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Re: [PATCH/RFC 10/14] dt-bindings: power: Document Renesas R-Car X5H Module Controller
In reply to Geert UytterhoevenOn 5/8/26 9:47 AM, Geert Uytterhoeven wrote:
Hello Geert,
Quoted 21 lines · Marek Vasut
Quoted 17 lines · Geert Uytterhoeven
Quoted 6 lines
Documentation/devicetree/bindings/power/renesas,r8a78000-mdlc.yaml new file +6
-0+ '#power-domain-cells': + description: | + - The first power domain specifier cell must be either the Module + Power Domain Gating (MPDG) register index (0x00-0x3f) from the + datasheet, or a Power Domain number, as defined in + <dt-bindings/power/renesas,r8a78000-mdlc.h>,Documentation/devicetree/bindings/power/renesas,r8a78000-mdlc.yaml line 39
Quoted 10 lines
Documentation/devicetree/bindings/power/renesas,r8a78000-mdlc.yaml new file +10
-0+ - The second power domain specifier cell must be the module number + (0x00-0xff), composed of the Module System Reset (MSRES) register index + in the high nibble, and the Module Reset Destination bitfield index in + the low nibble. + const: 2 + + '#reset-cells': + description: + The single reset specifier cell must be the module number (0x00-0xff). + const: 1Quoted 2 lines
Just one more question -- the power-domain-cells second cell and reset-cells are always going to be identical values, correct ? If so, it
Quoted 8 lines
Yes they are.
Quoted 2 lines
would be nice to keep the description: aligned, and maybe even indicate in the description that those two values have to be the same.
I thought that was obvious (but apparently it is not)? The descriptions are identical, except for the latter not explaining again what a module number is composed of...
Please do spell it out in the document, this is a complicated topic and every little bit of extra clarity helps.
Thank you !
Signature · 2 lines
Best regards, Marek Vasut
Re: [PATCH/RFC 10/14] dt-bindings: power: Document Renesas R-Car X5H Module Controller
In reply to Geert UytterhoevenOn 5/8/26 10:26 AM, Geert Uytterhoeven wrote:
Hello Geert,
Quoted 15 lines
Quoted 4 lines
Since there are up to 32 MPDG registers, and 256 resets, can we encode both into a single cell ?
(
mpdg_register_offset<< 16) | (reset_bit_offset<< 0)We could. I did consider it (with a shift of 8 cfr. 256 modules), but see below...
Quoted 6 lines
I cannot tell whether this is much better, but it at least ties the PD components (power domain and clock domain) into a single value, which matches reality a bit better. The current split power domain and clock domain description in two cells gives me the illusion that it is possible to mix and match power domains and clock domains in DT description, but in fact the two cells are strongly tied together.
Quoted 9 lines
They are only tied together in the sense that a module (hardware block) is part of a power domain, and has module standby (clock) control. Some power domains are backed by MDLC hardware registers, others are not, hence the need for the additional definitions in <
dt-bindings/power/renesas,r8a78000-mdlc.h>.
I am not aware (yet) of modules that are part of a power domain, but do not have module standby control. If these exist, we need an additional definition (R8A78000_MDLC_MODULE_NONE?) in <dt-bindings/power/renesas,r8a78000-mdlc.h>.
Maybe TAUJ3 in AON domain? I think HSCN also has abundance of examples.
Quoted 3 lines
Due to this separation, and due to a possible future need for expansion (
R8A78000_MDLC_MODULE_NONE, MDLCs with more than 256 modules, ...), I went for two cells.
I think I won't push for a single cell either, two cells are OK with me too.
Quoted 9 lines
Quoted 6 lines
If we cannot encode the two into a single cell, maybe we can at least have some sort of macro for this, e.g. this (
0xffas no MPDG register bits for this block):
#defineR8A78000_MDLC_PD_HSCIF0(0xff<< 16) ((0x5<< 4) | (0x3<< 0))What do you think ?
I (and I believe the DT maintainers) are not so fond of defines for numbers that can be (more or less) just read from the documentation.
OK
Quoted 1 line
(and
0xffshould beR8A78000_MDLC_PD_APL?)
I think AON would have to be 0xff , since it is superdomain of APL ?
Quoted 16 lines
Quoted 7 lines
Quoted 4 lines
So perhaps I will clarify like this:
- The first power domain specifier cell is the power domain part, and must be either the Module Power Domain Gating (MPDG) register index
... for power domains which are backed by MDPG bits, and which can be controlled in that manner ...
OK.
Quoted 5 lines
Quoted 2 lines
(0x00-0x3f) from the datasheet, or a Power Domain number, as defined in <dt-bindings/power/renesas,r8a78000-mdlc.h>,... for power domains which are always on, and for which there are no MPDG bits which can be used to control them ...
Quoted 6 lines
OK,
Quoted 2 lines
Quoted 2 lines
- The second power domain specifier cell is the clock domain part, and
Upon second thought: s/clock domain/module standby/
If you could even mention that this refers to "Module STOP" column bit, that would even clearer.
Quoted 79 lines
Quoted 26 lines
Quoted 3 lines
must be the module number (0x00-0xff), composed of the Module System Reset (MSRES) register index in the high nibble, and the Module Reset Destination bitfield index in the low nibble.
I can understand this.
Quoted 20 lines
Quoted 19 lines
Quoted 4 lines
Documentation/devicetree/bindings/power/renesas,r8a78000-mdlc.yaml new file +4
-0+ '#reset-cells': + description: + The single reset specifier cell must be the module number (0x00-0xff). + const: 1[...]
include/dt-bindings/power/renesas,r8a78000-mdlc.h line 14
Quoted 10 lines
include/dt-bindings/power/renesas,r8a78000-mdlc.h new file +10
-0+#ifndef __DT_BINDINGS_POWER_RENESAS_R8A78000_MDLC_H__ +#define __DT_BINDINGS_POWER_RENESAS_R8A78000_MDLC_H__ + +/* R-Car X5H MDLC Power Domains */ + +#define R8A78000_MDLC_PD_AON 0x40 +#define R8A78000_MDLC_PD_SCP 0x41 +#define R8A78000_MDLC_PD_APL 0x42 +#define R8A78000_MDLC_PD_CMN 0x43 +#define R8A78000_MDLC_PD_ACL 0x44... what do these numbers represent ? Shouldn't those be register offsets from MDLC MPDG00 according to power-domain-cells ?
Quoted 5 lines
Quoted 2 lines
These are Power Domains that are not backed by any of the 64 Module Power Domain Gating (MPDG) registers in MDLC blocks.
I suspect that might not be entirely correct for all of them, please read on and see CMN below.
Thanks, looks like
R8A78000_MDLC_PD_CMNshould be dropped.Quoted 36 lines
Let's take
PD_AC00, AP core 0 , as a domain of interest. My understanding is, that the domain structure forPD_AC00looks as follows:PD_AON { PD_SCP { }; PD_APL { hierarchy is SYSSS always-power-on PD_CMN { hierarchy is CMNN power-gating-bit is MDLC_CMNN 20 PD_APU0 { hierarchy is SYSSS power-gating is done by APMU PD_ACL0 { hierarchy is CMNN power-gating-bit is MDLC_CMNN 16 PD_AC00 { hierarchy is CMNN power-gating-bit is MDLC_CMNN 0 }; ... }; ... }; ... }; ... PD_HSCIF0 { hierarchy is PERW power-gating-bit is MDLC_PERW 23 }; }; ... };Quoted 8 lines
With this in mind, I think CPU 0 DT node should refer to the
PD_AC00power domain this way:cpu@0 { ... power-domains = <&mdlc_cmnn R8A78000_MDLC_PD_AC00>; ... };
Quoted 3 lines
So we do have a few modules (I found a few more) that are part of power domains, but do no support module standby. One more reason to decouple them in power-domains.
I think HSCN is a really good example ?
Quoted 3 lines
However, CPU cores are controlled through PSCI (the slightly less evil brother of SCMI? ;-), so
Documentation/devicetree/bindings/arm/psci.yamlapplies, too?
We can indeed control cores purely via PSCI , yes.
(Upstream TFA needs one more platform patch to make this operable)
Quoted 10 lines
Quoted 10 lines
The MDLC driver would pass the
PD_AC00domain ID to matching SCMI power domain management protocol call, or, for bare-metal MDLC driver, would have to internally encode PD hierarchy, walk it, and apply PD operations in each step.I think even for SCIF/HSCIF, the power domain reference should be something along the lines of the following description. The MDLC driver should internally encode that
R8A78000_MLDC_PD_HSCIF0is a sub-domain ofR8A78000_MDLC_PD_APL.
Quoted 8 lines
Quoted 5 lines
serial@c0710000 { ... power-domains = <&mdlc_perw R8A78000_MDLC_PD_HSCIF0>; ... };
R8A78000_MLDC_PD_HSCIF0is a not a full sub-domain, but merely standby (clock) control inside thePD_APLclock domain?
Do you consider R8A78000_MDLC_PD_AC00 a full sub-domain ? Because that one looks very similar to R8A78000_MDLC_PD_HSCIF0 , except the former controls a core, the later an UART IP.
Re: [PATCH/RFC 04/14] arm64: dts: renesas: ironhide: Enable SCMI devpd, sys, and reset
In reply to Geert UytterhoevenOn 4/21/26 8:11 PM, Geert Uytterhoeven wrote:
Hello Geert,
Quoted 17 lines
SCP FW SDKv4.28.0 and later for Renesas R-Car X5H Ironhide not only implements the SCMI base and clock management protocols, but also the SCMI power domain, system power, and reset domain management protocols.
Enable support for the latter by adding the corresponding SCMI protocol subnodes.
Signed-off-by Geert Uytterhoeven <[email protected]>--- arch/arm64/boot/dts/renesas/r8a78000-ironhide.dts | 14 ++++++++++++++ 1 file changed, 14 insertions(+)arch/arm64/boot/dts/renesas/r8a78000-ironhide.dts +0
-0
arch/arm64/boot/dts/renesas/r8a78000-ironhide.dts scmi: scmi { · line 36
Quoted 6 lines
arch/arm64/boot/dts/renesas/r8a78000-ironhide.dts +3
-0@@ -31,10 +31,24 @@ scmi: scmi { #address-cells = <1>; #size-cells = <0>; + scmi_devpd: protocol@11 { + reg = <0x11>; + #power-domain-cells = <1>;
Please indent with tabs.
arch/arm64/boot/dts/renesas/r8a78000-ironhide.dts scmi: scmi { · line 40
Quoted 4 lines
arch/arm64/boot/dts/renesas/r8a78000-ironhide.dts +4
-0+ }; + + scmi_sys: protocol@12 { + reg = <0x12>;
Please indent with tabs.
arch/arm64/boot/dts/renesas/r8a78000-ironhide.dts scmi: scmi { · line 45
Quoted 5 lines
arch/arm64/boot/dts/renesas/r8a78000-ironhide.dts +2
-0+ }; + scmi_clk: protocol@14 { reg = <0x14>; #clock-cells = <1>;
Here it is OK.
arch/arm64/boot/dts/renesas/r8a78000-ironhide.dts scmi: scmi { · line 50
Quoted 5 lines
arch/arm64/boot/dts/renesas/r8a78000-ironhide.dts +4
-0}; + + scmi_reset: protocol@16 { + reg = <0x16>; + #reset-cells = <1>;
Please indent with tabs.
I hope it helps!
Re: [PATCH/RFC 05/14] firmware: arm_scmi: Add scmi_get_base_info()
In reply to Cristian MarussiHi Christian,
Quoted 15 lines · Cristian Marussi
Quoted 2 lines · Geert Uytterhoeven
Currently non-SCMI drivers cannot find out what the specific versions of each SCMI provider implementation on the running system are.
Thanks for your patches....this is not a proper full review of the series, BUT this patch catched my eye..
Indeed, yes, it is deliberate that the SCMI version information is NOT exposed out of the SCMI world, since being the SCMI an attempt to standardize a common FW interface (as in [1] of course), you should not know what runs inside the black-box, it should be irrelevant...
...indeed the versioning is used inside the SCMI stack to deal properly with different protocol versions implemented by the server OR to apply proper quirks when needed, but all the rest should be standard....
[...]
Quoted 3 lines
I watched a bit of the LPC discussions around this (from Marek I think) but sincerely most of those problems had one (not necessarily simple)
solution: fix your firmwares AND/OR apply quirks in the meantime...
So let's forward to the future, where the firmware is fixed, is fully compliant with the SCMI spec, and all IDs are stable, so no quirks are needed.
Where do we specify the SCMI IDs to use? Unless when using the remapping driver proposed in this patch series, they must end up in the DTB. Existing upstream users put them either in the SoC-specific .dtsi, or in board-specific .dts.
The SCMI server is supposed to expose to an agent (e.g. Linux) a sequential and contiguous list of IDs that represent only resources that the agent is allowed to use.
- We cannot put the SCMI IDs in the SoC-specific .dtsi, as that describes all hardware in the SoC, which is typically much more than Linux can or even wants to use when running on a specific board.
- You would think we could put the SCMI IDs in the board-specific .dts. However, that would limit actual use cases later, which do not necessarily depend on the board solely.
- E.g. when moving control of the CAN-FD controller from Linux to the Realtime OS, the CAN-FD node must be disabled in the DTB (by overriding status to "reserved", or by just deleting the CAN-FD node, both of which can be done by the boot loader). However, with SCMI, the IDs corresponding to CAN-FD resources must be removed from the ID space, causing a full renumbering. Who is supposed to update the IDs in the DTB?
- E.g. when partitioning a single Linux system in multiple VMs, and distributing hardware across these VMs, all VMs need different DTBs, each describing a subset of the hardware. With SCMI, each VM needs different SCMI ID spaces, causing not a simple partitioning of the devices in the DTB, but also a renumbering of all IDs.
Hence there are no stable SCMI IDs in DT, by design!
And what do we describe in the SoC-specific .dtsi? E.g. U-Boot IPL still needs real hardware description.
What is the stance on this from the DT maintainers? Thanks a lot for your answers!
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Cristian Marussi
reviewerRe: [PATCH/RFC 05/14] firmware: arm_scmi: Add scmi_get_base_info()
In reply to Geert UytterhoevenQuoted 2 lines · Geert Uytterhoeven
Hi Cristian,
Hi,
Quoted 52 lines · Cristian Marussi
Quoted 40 lines · Geert Uytterhoeven
Quoted 12 lines · Cristian Marussi
Quoted 6 lines
Also because this should be one of the selling point of the SCMI stack in a virtualized environment: you can ship the same kernel drivers with the same DT and you know that ID=<N> will always identify the specific resource that is needed by your driver without worrying about the fact that in reality in the backstage the effectively managed physical resource could be different across different platforms, because that does not matter
This sounds strange to me, do I understand it correctly?
So the ID should (1) be tied to the use-case, and not to the underlying hardware, and (2) be the same for different platforms?Quoted 5 lines
For (1): Then we must not put these IDs in DT at all, as DT is supposed
to describe the hardware (and firmware IDs in DT were IMHO already a stretch before).
For (2): How can there be a contiguous list of IDs, as not all platforms
may have the same underlying hardware?I would NOT say that an SCMI FW must behave like this regarding IDs, but it is a possible SCMI deployed setup that can be useful in virtualized setups
I mean, the DT describes the hardware of course BUT when you refer to some of this hardware DT bits from some other subsystem by referencing a phandle, even in the non-SCMI world, you are in fact selecting a specific resource that fit you use case, right ? Can we say this ?
I mean you needed that specific clock or regulator that you described previously so as to be able to enable some other piece of HW...Now, the SCMI provides an abstraction on top of this, since you really discover domain IDs of a specific class (clocks/regulators etc) you are in fact describing an HW abstraction that you then refer with the usual phandle...also because there is NOT so much SCMI hardware to describe, given that the HW is handled transparently (opaquely really :P) by the driver on the FW side...
...you basically obtain such domain ID, usable as phandles through dynamic SCMI enumeration so that you can use it all over your DT to make use of such resources...
Quoted 10 lines
...on top of this, consider that the SCMI server CAN provide to its agents a per-agent-view of the world, IOW it can (and should) expose to a specific agent ONLY the resources needed by that agent, i.e. it can expose the set of resources 1-N to two distinct agents and that does NOT mean that the underlying physical resource mapped by ID=3 in both agents has to be effectively the same piece of hardware: it could be the case, and this would be useful to exposed and managed properly a shared resource, or it could also be that the same ID=3 could refer to completely distinct pieces of the same class of hardware...(same protocol same class of resource...)
Quoted 4 lines
Exposing only the clocks/reset/power domains the agent can use, in a contiguous list of IDS, means that the number space changes, depending on which resources are exposed.
Yes, potentially, it depedns on how the HW/FW stack was designed I suppose...
Quoted 3 lines
Suppose you have a system where you want to assign a specific hardware block in the SoC to the realtime CPU core instead of the application CPU core running Linux.
Ok, so this is definitely a considerable change.
Quoted 7 lines
That means all resources used by that block must no longer be exposed to the Linux agent, and the corresponding IDs must be removed from the ID space exposed to Linux. As the ID space must be sequential and contiguous, the IDs must be renumbered, impacting resources that are exposed to Linux. As these IDs are used in the SoC .dtsi, they must be changed there, too, However, these IDs have become part of the stable DT ABI, and thus cannot be changed.
Well, you have to ship a final DTB blob that is crafted to describe the actual HW at the end, right ?
I mean, in your example, it seems to me that you have changed considerably the HW surface by moving a clock (and its related resources) away from the reach of Linux as a whole, so should not be expected to have an updated DTB shipped ?
And I am NOT saying to do this by changing the base SoC dtsi, but via build time overrides and/or runtime overlays so as to derive from that same SoC base dtsi a properly reviewed final DTB that describes how the HW has actually changed, becasue beside the renumbering that you mention there will be also a bunch of HW pieces that were relying on that clock that now will have to be removed from the DTB if no more usable (or remapped to use a different, maybe non SCMI resource)
I maybe too naive and not used to very complex DTBs, but why all of the above cannot be done along the lines of how is done as an example in JUNO [1], where some initial base dtsi was overriden by virtue of includes and overrides to properly describe the board at hand (r0/r1/r2), even going to the extreme, funny enough, to move from the old SCPI to SCMI.
[1]: https://elixir.bootlin.com/linux/v7.0.8/source/arch/arm64/boot/dts/arm/juno-scmi.dts
Quoted 5 lines
This patch series fixes that issue, too, by describing the actual hardware in DT, and doing the mapping to exposed SCMI features in the kernel, based on which firmware version is running on the SCP.
Which seems to me to go in the opposite direction to what SCMI expects:
but I understand that we have to deal and cope with the existing already shipped FW, so my concern is not really around enabling this in particular, is much more the fact that we open the door and normalize this kind of design even with future, still to be developed, SCMI FWs.
...otherwise...have the spec changed/clarified to allow for such non-contiguos IDs...
...anyway let's hear Sudeep opinion on this general issue of contiguos remapped IDs and being able to peek into SCMI version from outside the SCMI world...
Thanks,
Cristian
Cristian Marussi
reviewerRe: [PATCH/RFC 05/14] firmware: arm_scmi: Add scmi_get_base_info()
In reply to Geert UytterhoevenQuoted 34 lines · Geert Uytterhoeven
Hi Christian,
Quoted 15 lines · Cristian Marussi
Quoted 2 lines · Geert Uytterhoeven
Currently non-SCMI drivers cannot find out what the specific versions of each SCMI provider implementation on the running system are.
Thanks for your patches....this is not a proper full review of the series, BUT this patch catched my eye..
Indeed, yes, it is deliberate that the SCMI version information is NOT exposed out of the SCMI world, since being the SCMI an attempt to standardize a common FW interface (as in [1] of course), you should not know what runs inside the black-box, it should be irrelevant...
...indeed the versioning is used inside the SCMI stack to deal properly with different protocol versions implemented by the server OR to apply proper quirks when needed, but all the rest should be standard....
[...]
Quoted 3 lines
I watched a bit of the LPC discussions around this (from Marek I think) but sincerely most of those problems had one (not necessarily simple)
solution: fix your firmwares AND/OR apply quirks in the meantime...So let's forward to the future, where the firmware is fixed, is fully compliant with the SCMI spec, and all IDs are stable, so no quirks are needed.
Where do we specify the SCMI IDs to use? Unless when using the remapping driver proposed in this patch series, they must end up in the DTB. Existing upstream users put them either in the SoC-specific .dtsi, or in board-specific .dts.
Quoted 16 lines
The SCMI server is supposed to expose to an agent (e.g. Linux) a sequential and contiguous list of IDs that represent only resources that the agent is allowed to use.
- We cannot put the SCMI IDs in the SoC-specific .dtsi, as that describes all hardware in the SoC, which is typically much more than Linux can or even wants to use when running on a specific board.
- You would think we could put the SCMI IDs in the board-specific .dts. However, that would limit actual use cases later, which do not necessarily depend on the board solely.
- E.g. when moving control of the CAN-FD controller from Linux to the Realtime OS, the CAN-FD node must be disabled in the DTB (by overriding status to "reserved", or by just deleting the CAN-FD node, both of which can be done by the boot loader). However, with SCMI, the IDs corresponding to CAN-FD resources must be removed from the ID space, causing a full renumbering. Who is supposed to update the IDs in the DTB?
As per my previous email, after such a breaking change I would expect a new DTB describing the new HW to be needed anyway.
Quoted 6 lines
- E.g. when partitioning a single Linux system in multiple VMs, and distributing hardware across these VMs, all VMs need different DTBs, each describing a subset of the hardware. With SCMI, each VM needs different SCMI ID spaces, causing not a simple partitioning of the devices in the DTB, but also a renumbering of all IDs.
Ok now I am lost..why do you need a distinct IDs space for each VM ?
In a virtualized env, I would expect to leverage the SCMI stack to realize the exact opposite: same set of IDs advertised to each VM (and so same DTB potentially) by the server which in turn can decide to assign the same device (and handle the sharing) to some ID or assign different devices to the same or different IDs on each VM: i.e. you have a set of virtual_IDs that is what the server exposes to each VM SCMI agent, and then a bunch of real physical IDs, without any contraint on their numbering, that the server uses in the backstage to refer to the real resources and that it properly remaps to each per-VM set of exposed virtual_IDs during the build and/or boot board configuration phase....i.e. when the FW adapts and reconfigures to the specific board that is finally running on.
Thanks,
Cristian
Re: [PATCH/RFC 05/14] firmware: arm_scmi: Add scmi_get_base_info()
In reply to Cristian MarussiHi Cristian,
Quoted 74 lines · Cristian Marussi
Quoted 52 lines · Geert Uytterhoeven
Quoted 40 lines · Cristian Marussi
Quoted 12 lines · Geert Uytterhoeven
Quoted 6 lines · Cristian Marussi
Also because this should be one of the selling point of the SCMI stack in a virtualized environment: you can ship the same kernel drivers with the same DT and you know that ID=<N> will always identify the specific resource that is needed by your driver without worrying about the fact that in reality in the backstage the effectively managed physical resource could be different across different platforms, because that does not matter
This sounds strange to me, do I understand it correctly?
So the ID should (1) be tied to the use-case, and not to the underlying hardware, and (2) be the same for different platforms?Quoted 5 lines
For (1): Then we must not put these IDs in DT at all, as DT is supposed
to describe the hardware (and firmware IDs in DT were IMHO already a stretch before).
For (2): How can there be a contiguous list of IDs, as not all platforms
may have the same underlying hardware?I would NOT say that an SCMI FW must behave like this regarding IDs, but it is a possible SCMI deployed setup that can be useful in virtualized setups
I mean, the DT describes the hardware of course BUT when you refer to some of this hardware DT bits from some other subsystem by referencing a phandle, even in the non-SCMI world, you are in fact selecting a specific resource that fit you use case, right ? Can we say this ?
I mean you needed that specific clock or regulator that you described previously so as to be able to enable some other piece of HW...Now, the SCMI provides an abstraction on top of this, since you really discover domain IDs of a specific class (clocks/regulators etc) you are in fact describing an HW abstraction that you then refer with the usual phandle...also because there is NOT so much SCMI hardware to describe, given that the HW is handled transparently (opaquely really :P) by the driver on the FW side...
...you basically obtain such domain ID, usable as phandles through dynamic SCMI enumeration so that you can use it all over your DT to make use of such resources...
Quoted 10 lines
...on top of this, consider that the SCMI server CAN provide to its agents a per-agent-view of the world, IOW it can (and should) expose to a specific agent ONLY the resources needed by that agent, i.e. it can expose the set of resources 1-N to two distinct agents and that does NOT mean that the underlying physical resource mapped by ID=3 in both agents has to be effectively the same piece of hardware: it could be the case, and this would be useful to exposed and managed properly a shared resource, or it could also be that the same ID=3 could refer to completely distinct pieces of the same class of hardware...(same protocol same class of resource...)
Quoted 3 lines
Exposing only the clocks/reset/power domains the agent can use, in a contiguous list of IDS, means that the number space changes, depending on which resources are exposed.
Yes, potentially, it depedns on how the HW/FW stack was designed I suppose...
Quoted 3 lines
Suppose you have a system where you want to assign a specific hardware block in the SoC to the realtime CPU core instead of the application CPU core running Linux.
Ok, so this is definitely a considerable change.
Quoted 7 lines
That means all resources used by that block must no longer be exposed to the Linux agent, and the corresponding IDs must be removed from the ID space exposed to Linux. As the ID space must be sequential and contiguous, the IDs must be renumbered, impacting resources that are exposed to Linux. As these IDs are used in the SoC .dtsi, they must be changed there, too, However, these IDs have become part of the stable DT ABI, and thus cannot be changed.
Quoted 7 lines
Well, you have to ship a final DTB blob that is crafted to describe the actual HW at the end, right ?
I mean, in your example, it seems to me that you have changed considerably the HW surface by moving a clock (and its related resources) away from the reach of Linux as a whole, so should not be expected to have an updated DTB shipped ?
It is not necessary to ship an updated DTB.
The bootloader stack can just change the "status" properties of devices nodes that are be taken away from Linux from "okay" to "reserved":
Devicetree Specification, Release v0.4, Table 2.4: Values for statu property states:
Value: "reserved"
Description:
Indicates that the device is operational, but should not be used. Typically this is used for devices that are controlled by another software component, such as platform firmware.
When all SCMI IDs change, too, much more work needs to be done.
The remap driver could also help here: it could scan for device nodes that are marked "reserved", remove SCMI IDs used in these nodes from its internal tables, and adjust all later (higher) IDs.
E.g. the existing drivers/clk/renesas/renesas-cpg-mssr.c already handles (ignores) clocks used by reserved nodes.
Quoted 8 lines
And I am NOT saying to do this by changing the base SoC dtsi, but via build time overrides and/or runtime overlays so as to derive from that same SoC base dtsi a properly reviewed final DTB that describes how the HW has actually changed, becasue beside the renumbering that you mention there will be also a bunch of HW pieces that were relying on that clock that now will have to be removed from the DTB if no more usable (or remapped to use a different, maybe non SCMI resource)
Quoted 7 lines
I maybe too naive and not used to very complex DTBs, but why all of the above cannot be done along the lines of how is done as an example in JUNO [1], where some initial base dtsi was overriden by virtue of includes and overrides to properly describe the board at hand (r0/r1/r2), even going to the extreme, funny enough, to move from the old SCPI to SCMI.
[1]: https://elixir.bootlin.com/linux/v7.0.8/source/arch/arm64/boot/dts/arm/juno-scmi.dts
As long as the IDs in arch/arm64/boot/dts/arm/juno-scmi.dtsi match the actual SCMI implementation, that works...
Quoted 10 lines
Quoted 3 lines
This patch series fixes that issue, too, by describing the actual hardware in DT, and doing the mapping to exposed SCMI features in the kernel, based on which firmware version is running on the SCP.
Which seems to me to go in the opposite direction to what SCMI expects:
but I understand that we have to deal and cope with the existing already shipped FW, so my concern is not really around enabling this in particular, is much more the fact that we open the door and normalize this kind of design even with future, still to be developed, SCMI FWs.
Quoted 6 lines
...otherwise...have the spec changed/clarified to allow for such non-contiguos IDs...
...anyway let's hear Sudeep opinion on this general issue of contiguos remapped IDs and being able to peek into SCMI version from outside the SCMI world...
As long as the ID space becomes stable.
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Re: [PATCH/RFC 05/14] firmware: arm_scmi: Add scmi_get_base_info()
In reply to Cristian MarussiHi Cristian,
Quoted 50 lines · Cristian Marussi
Quoted 32 lines · Geert Uytterhoeven
Quoted 15 lines · Cristian Marussi
Quoted 2 lines · Geert Uytterhoeven
Currently non-SCMI drivers cannot find out what the specific versions of each SCMI provider implementation on the running system are.
Thanks for your patches....this is not a proper full review of the series, BUT this patch catched my eye..
Indeed, yes, it is deliberate that the SCMI version information is NOT exposed out of the SCMI world, since being the SCMI an attempt to standardize a common FW interface (as in [1] of course), you should not know what runs inside the black-box, it should be irrelevant...
...indeed the versioning is used inside the SCMI stack to deal properly with different protocol versions implemented by the server OR to apply proper quirks when needed, but all the rest should be standard....
[...]
Quoted 3 lines
I watched a bit of the LPC discussions around this (from Marek I think) but sincerely most of those problems had one (not necessarily simple)
solution: fix your firmwares AND/OR apply quirks in the meantime...So let's forward to the future, where the firmware is fixed, is fully compliant with the SCMI spec, and all IDs are stable, so no quirks are needed.
Where do we specify the SCMI IDs to use? Unless when using the remapping driver proposed in this patch series, they must end up in the DTB. Existing upstream users put them either in the SoC-specific .dtsi, or in board-specific .dts.
Quoted 16 lines
The SCMI server is supposed to expose to an agent (e.g. Linux) a sequential and contiguous list of IDs that represent only resources that the agent is allowed to use.
- We cannot put the SCMI IDs in the SoC-specific .dtsi, as that describes all hardware in the SoC, which is typically much more than Linux can or even wants to use when running on a specific board.
- You would think we could put the SCMI IDs in the board-specific .dts. However, that would limit actual use cases later, which do not necessarily depend on the board solely.
- E.g. when moving control of the CAN-FD controller from Linux to the Realtime OS, the CAN-FD node must be disabled in the DTB (by overriding status to "reserved", or by just deleting the CAN-FD node, both of which can be done by the boot loader). However, with SCMI, the IDs corresponding to CAN-FD resources must be removed from the ID space, causing a full renumbering. Who is supposed to update the IDs in the DTB?
Quoted 2 lines
As per my previous email, after such a breaking change I would expect a new DTB describing the new HW to be needed anyway.
The underlying hardware would still be the same...
Quoted 8 lines
Quoted 6 lines
- E.g. when partitioning a single Linux system in multiple VMs, and distributing hardware across these VMs, all VMs need different DTBs, each describing a subset of the hardware. With SCMI, each VM needs different SCMI ID spaces, causing not a simple partitioning of the devices in the DTB, but also a renumbering of all IDs.
Ok now I am lost..why do you need a distinct IDs space for each VM ?
Aren't the different VMs different SCMI agents? If not, how do you prevent them from stepping on each other's resources?
Quoted 4 lines
In a virtualized env, I would expect to leverage the SCMI stack to realize the exact opposite: same set of IDs advertised to each VM (and so same DTB potentially) by the server which in turn can decide to assign the same device (and handle the sharing) to some ID or assign
Quoted 8 lines
different devices to the same or different IDs on each VM: i.e. you have a set of
virtual_IDsthat is what the server exposes to each VM SCMI agent, and then a bunch of real physical IDs, without any contraint on their numbering, that the server uses in the backstage to refer to the real resources and that it properly remaps to each per-VM set of exposedvirtual_IDsduring the build and/or boot board configuration phase....i.e. when the FW adapts and reconfigures to the specific board that is finally running on.
Again[1], how would that work? Clock, resets, and power domains are not the final resources that are used by the OS. They are merely resources for devices that are described in DTB with other resources (MMIO register ranges, interrupt numbers, ...) which are not handled by SCMI. If the server remaps e.g. a clock to a different clock, it will no longer work with the corresponding device described in DT.
[1] https://lore.kernel.org/all/CAMuHMdVunEehM01pLa3t5a6o0NmMOCQRwh7n5J+OkDk2YR9kUA@mail.gmail.com
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Re: [PATCH/RFC 05/14] firmware: arm_scmi: Add scmi_get_base_info()
In reply to Geert UytterhoevenQuoted 90 lines · Geert Uytterhoeven
Quoted 74 lines · Cristian Marussi
Quoted 52 lines · Geert Uytterhoeven
Quoted 40 lines · Cristian Marussi
Quoted 12 lines · Geert Uytterhoeven
Quoted 6 lines · Cristian Marussi
Also because this should be one of the selling point of the SCMI stack in a virtualized environment: you can ship the same kernel drivers with the same DT and you know that ID=<N> will always identify the specific resource that is needed by your driver without worrying about the fact that in reality in the backstage the effectively managed physical resource could be different across different platforms, because that does not matter
This sounds strange to me, do I understand it correctly?
So the ID should (1) be tied to the use-case, and not to the underlying hardware, and (2) be the same for different platforms?Quoted 5 lines
For (1): Then we must not put these IDs in DT at all, as DT is supposed
to describe the hardware (and firmware IDs in DT were IMHO already a stretch before).
For (2): How can there be a contiguous list of IDs, as not all platforms
may have the same underlying hardware?I would NOT say that an SCMI FW must behave like this regarding IDs, but it is a possible SCMI deployed setup that can be useful in virtualized setups
I mean, the DT describes the hardware of course BUT when you refer to some of this hardware DT bits from some other subsystem by referencing a phandle, even in the non-SCMI world, you are in fact selecting a specific resource that fit you use case, right ? Can we say this ?
I mean you needed that specific clock or regulator that you described previously so as to be able to enable some other piece of HW...Now, the SCMI provides an abstraction on top of this, since you really discover domain IDs of a specific class (clocks/regulators etc) you are in fact describing an HW abstraction that you then refer with the usual phandle...also because there is NOT so much SCMI hardware to describe, given that the HW is handled transparently (opaquely really :P) by the driver on the FW side...
...you basically obtain such domain ID, usable as phandles through dynamic SCMI enumeration so that you can use it all over your DT to make use of such resources...
Quoted 10 lines
...on top of this, consider that the SCMI server CAN provide to its agents a per-agent-view of the world, IOW it can (and should) expose to a specific agent ONLY the resources needed by that agent, i.e. it can expose the set of resources 1-N to two distinct agents and that does NOT mean that the underlying physical resource mapped by ID=3 in both agents has to be effectively the same piece of hardware: it could be the case, and this would be useful to exposed and managed properly a shared resource, or it could also be that the same ID=3 could refer to completely distinct pieces of the same class of hardware...(same protocol same class of resource...)
Quoted 3 lines
Exposing only the clocks/reset/power domains the agent can use, in a contiguous list of IDS, means that the number space changes, depending on which resources are exposed.
Yes, potentially, it depedns on how the HW/FW stack was designed I suppose...
Quoted 3 lines
Suppose you have a system where you want to assign a specific hardware block in the SoC to the realtime CPU core instead of the application CPU core running Linux.
Ok, so this is definitely a considerable change.
Quoted 7 lines
That means all resources used by that block must no longer be exposed to the Linux agent, and the corresponding IDs must be removed from the ID space exposed to Linux. As the ID space must be sequential and contiguous, the IDs must be renumbered, impacting resources that are exposed to Linux. As these IDs are used in the SoC .dtsi, they must be changed there, too, However, these IDs have become part of the stable DT ABI, and thus cannot be changed.
Quoted 7 lines
Well, you have to ship a final DTB blob that is crafted to describe the actual HW at the end, right ?
I mean, in your example, it seems to me that you have changed considerably the HW surface by moving a clock (and its related resources) away from the reach of Linux as a whole, so should not be expected to have an updated DTB shipped ?
It is not necessary to ship an updated DTB.
The bootloader stack can just change the "status" properties of devices nodes that are be taken away from Linux from "okay" to "reserved":Devicetree Specification, Release v0.4, Table 2.4: Values for statu property states:
Quoted 7 lines
Value: "reserved"
Description:
Indicates that the device is operational, but should not be used. Typically this is used for devices that are controlled by another software component, such as platform firmware.When all SCMI IDs change, too, much more work needs to be done.
It's a pity we cannot use strings in e.g. clock specifiers. Then we could look them up by name (which would hopefully be more stable) instead of by ID...
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds