devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v8 0/3] Register the STM32MP25 RCC driver as an access controller.
@ 2025-09-24  9:44 Clément Le Goffic
  2025-09-24  9:44 ` [PATCH v8 1/3] dt-bindings: stm32: stm32mp25: add `#access-controller-cells` property Clément Le Goffic
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Clément Le Goffic @ 2025-09-24  9:44 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Maxime Coquelin, Alexandre Torgue,
	Gabriel Fernandez
  Cc: linux-clk, devicetree, linux-stm32, linux-arm-kernel,
	linux-kernel, Clément Le Goffic, Clément Le Goffic

The STM32MP25 RCC peripheral as an access controller is allowed to know
whether the clocks are secured or not.
The STM32MP25 RCC peripheral knows about the clock secure configuration
of all non RIF-aware peripheral.
In parallel all the RIF-aware peripheral configuration information
are known by the RIFSC peripheral which is already an access
controller.

Changes in v8:
- Use uppercase for peripheral name in commit message
- Add the '#access-controller-cells' property to the RCC in
  stm32mp231.dtsi
- Link to v7: https://lore.kernel.org/r/20250922-b4-rcc-upstream-v7-0-2dfc4e018f40@gmail.com

The v7 is a subset of the v6 and other prior versions, split to simplify
the review and merging process.

Changes in v7:
- None
- Link to v6: https://lore.kernel.org/all/20250909-b4-ddrperfm-upstream-v6-2-ce082cc801b5@gmail.com/

Signed-off-by: Clément Le Goffic <legoffic.clement@gmail.com>
---
Clément Le Goffic (3):
      dt-bindings: stm32: stm32mp25: add `#access-controller-cells` property
      clk: stm32mp25: add firewall grant_access ops
      arm64: dts: st: set RCC as an access-controller

 .../bindings/clock/st,stm32mp25-rcc.yaml           |  7 ++++
 arch/arm64/boot/dts/st/stm32mp231.dtsi             |  1 +
 arch/arm64/boot/dts/st/stm32mp251.dtsi             |  1 +
 drivers/clk/stm32/clk-stm32mp25.c                  | 40 +++++++++++++++++++++-
 4 files changed, 48 insertions(+), 1 deletion(-)
---
base-commit: 07e27ad16399afcd693be20211b0dfae63e0615f
change-id: 20250916-b4-rcc-upstream-8a8ea3af6a0d
prerequisite-change-id: 20250916-b4-firewall-upstream-dfe8588a21f8:v7
prerequisite-patch-id: 1ead960f405c7a2dcc9111acd0bb4c95ed33954f

Best regards,
--  
Clément Le Goffic <legoffic.clement@gmail.com>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v8 1/3] dt-bindings: stm32: stm32mp25: add `#access-controller-cells` property
  2025-09-24  9:44 [PATCH v8 0/3] Register the STM32MP25 RCC driver as an access controller Clément Le Goffic
@ 2025-09-24  9:44 ` Clément Le Goffic
  2025-09-24  9:44 ` [PATCH v8 2/3] clk: stm32mp25: add firewall grant_access ops Clément Le Goffic
  2025-09-24  9:44 ` [PATCH v8 3/3] arm64: dts: st: set RCC as an access-controller Clément Le Goffic
  2 siblings, 0 replies; 5+ messages in thread
From: Clément Le Goffic @ 2025-09-24  9:44 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Maxime Coquelin, Alexandre Torgue,
	Gabriel Fernandez
  Cc: linux-clk, devicetree, linux-stm32, linux-arm-kernel,
	linux-kernel, Clément Le Goffic, Clément Le Goffic

From: Clément Le Goffic <clement.legoffic@foss.st.com>

RCC is able to check the availability of a clock.
Allow to query the RCC with a firewall ID.

Signed-off-by: Clément Le Goffic <clement.legoffic@foss.st.com>
Acked-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Clément Le Goffic <legoffic.clement@gmail.com>
---
 Documentation/devicetree/bindings/clock/st,stm32mp25-rcc.yaml | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/Documentation/devicetree/bindings/clock/st,stm32mp25-rcc.yaml b/Documentation/devicetree/bindings/clock/st,stm32mp25-rcc.yaml
index 88e52f10d1ec..4d471e3d89bc 100644
--- a/Documentation/devicetree/bindings/clock/st,stm32mp25-rcc.yaml
+++ b/Documentation/devicetree/bindings/clock/st,stm32mp25-rcc.yaml
@@ -31,6 +31,11 @@ properties:
   '#reset-cells':
     const: 1
 
+  '#access-controller-cells':
+    const: 1
+    description:
+      Contains the firewall ID associated to the peripheral.
+
   clocks:
     items:
       - description: CK_SCMI_HSE High Speed External oscillator (8 to 48 MHz)
@@ -123,6 +128,7 @@ required:
   - reg
   - '#clock-cells'
   - '#reset-cells'
+  - '#access-controller-cells'
   - clocks
 
 additionalProperties: false
@@ -136,6 +142,7 @@ examples:
         reg = <0x44200000 0x10000>;
         #clock-cells = <1>;
         #reset-cells = <1>;
+        #access-controller-cells = <1>;
         clocks =  <&scmi_clk CK_SCMI_HSE>,
                   <&scmi_clk CK_SCMI_HSI>,
                   <&scmi_clk CK_SCMI_MSI>,

-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v8 2/3] clk: stm32mp25: add firewall grant_access ops
  2025-09-24  9:44 [PATCH v8 0/3] Register the STM32MP25 RCC driver as an access controller Clément Le Goffic
  2025-09-24  9:44 ` [PATCH v8 1/3] dt-bindings: stm32: stm32mp25: add `#access-controller-cells` property Clément Le Goffic
@ 2025-09-24  9:44 ` Clément Le Goffic
  2025-09-30  9:54   ` Gabriel FERNANDEZ
  2025-09-24  9:44 ` [PATCH v8 3/3] arm64: dts: st: set RCC as an access-controller Clément Le Goffic
  2 siblings, 1 reply; 5+ messages in thread
From: Clément Le Goffic @ 2025-09-24  9:44 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Maxime Coquelin, Alexandre Torgue,
	Gabriel Fernandez
  Cc: linux-clk, devicetree, linux-stm32, linux-arm-kernel,
	linux-kernel, Clément Le Goffic, Clément Le Goffic

From: Clément Le Goffic <clement.legoffic@foss.st.com>

On STM32MP25, the RCC peripheral manages the secure level of resources
that are used by other devices such as clocks.
Declare this peripheral as a firewall controller.

Signed-off-by: Clément Le Goffic <clement.legoffic@foss.st.com>
Signed-off-by: Clément Le Goffic <legoffic.clement@gmail.com>
---
 drivers/clk/stm32/clk-stm32mp25.c | 40 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 39 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/stm32/clk-stm32mp25.c b/drivers/clk/stm32/clk-stm32mp25.c
index 52f0e8a12926..af4bc06d703a 100644
--- a/drivers/clk/stm32/clk-stm32mp25.c
+++ b/drivers/clk/stm32/clk-stm32mp25.c
@@ -4,8 +4,10 @@
  * Author: Gabriel Fernandez <gabriel.fernandez@foss.st.com> for STMicroelectronics.
  */
 
+#include <linux/bus/stm32_firewall.h>
 #include <linux/bus/stm32_firewall_device.h>
 #include <linux/clk-provider.h>
+#include <linux/device.h>
 #include <linux/io.h>
 #include <linux/platform_device.h>
 
@@ -1602,6 +1604,11 @@ static int stm32_rcc_get_access(void __iomem *base, u32 index)
 	return 0;
 }
 
+static int stm32mp25_rcc_grant_access(struct stm32_firewall_controller *ctrl, u32 firewall_id)
+{
+	return stm32_rcc_get_access(ctrl->mmio, firewall_id);
+}
+
 static int stm32mp25_check_security(struct device_node *np, void __iomem *base,
 				    const struct clock_config *cfg)
 {
@@ -1970,6 +1977,7 @@ MODULE_DEVICE_TABLE(of, stm32mp25_match_data);
 
 static int stm32mp25_rcc_clocks_probe(struct platform_device *pdev)
 {
+	struct stm32_firewall_controller *rcc_controller;
 	struct device *dev = &pdev->dev;
 	void __iomem *base;
 	int ret;
@@ -1982,7 +1990,36 @@ static int stm32mp25_rcc_clocks_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	return stm32_rcc_init(dev, stm32mp25_match_data, base);
+	ret = stm32_rcc_init(dev, stm32mp25_match_data, base);
+	if (ret)
+		return ret;
+
+	rcc_controller = devm_kzalloc(&pdev->dev, sizeof(*rcc_controller), GFP_KERNEL);
+	if (!rcc_controller)
+		return -ENOMEM;
+
+	rcc_controller->dev = dev;
+	rcc_controller->mmio = base;
+	rcc_controller->name = dev_driver_string(dev);
+	rcc_controller->type = STM32_PERIPHERAL_FIREWALL;
+	rcc_controller->grant_access = stm32mp25_rcc_grant_access;
+
+	platform_set_drvdata(pdev, rcc_controller);
+
+	ret = stm32_firewall_controller_register(rcc_controller);
+	if (ret) {
+		dev_err(dev, "Couldn't register as a firewall controller: %d\n", ret);
+		return ret;
+	}
+
+	return 0;
+}
+
+static void stm32mp25_rcc_clocks_remove(struct platform_device *pdev)
+{
+	struct stm32_firewall_controller *rcc_controller = platform_get_drvdata(pdev);
+
+	stm32_firewall_controller_unregister(rcc_controller);
 }
 
 static struct platform_driver stm32mp25_rcc_clocks_driver = {
@@ -1991,6 +2028,7 @@ static struct platform_driver stm32mp25_rcc_clocks_driver = {
 		.of_match_table = stm32mp25_match_data,
 	},
 	.probe = stm32mp25_rcc_clocks_probe,
+	.remove = stm32mp25_rcc_clocks_remove,
 };
 
 static int __init stm32mp25_clocks_init(void)

-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v8 3/3] arm64: dts: st: set RCC as an access-controller
  2025-09-24  9:44 [PATCH v8 0/3] Register the STM32MP25 RCC driver as an access controller Clément Le Goffic
  2025-09-24  9:44 ` [PATCH v8 1/3] dt-bindings: stm32: stm32mp25: add `#access-controller-cells` property Clément Le Goffic
  2025-09-24  9:44 ` [PATCH v8 2/3] clk: stm32mp25: add firewall grant_access ops Clément Le Goffic
@ 2025-09-24  9:44 ` Clément Le Goffic
  2 siblings, 0 replies; 5+ messages in thread
From: Clément Le Goffic @ 2025-09-24  9:44 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Maxime Coquelin, Alexandre Torgue,
	Gabriel Fernandez
  Cc: linux-clk, devicetree, linux-stm32, linux-arm-kernel,
	linux-kernel, Clément Le Goffic, Clément Le Goffic

From: Clément Le Goffic <clement.legoffic@foss.st.com>

RCC now implements firewall access ops to check the access to
resources. Allow client nodes to query the RCC with one firewall ID.

Signed-off-by: Clément Le Goffic <clement.legoffic@foss.st.com>
Signed-off-by: Clément Le Goffic <legoffic.clement@gmail.com>
---
 arch/arm64/boot/dts/st/stm32mp231.dtsi | 1 +
 arch/arm64/boot/dts/st/stm32mp251.dtsi | 1 +
 2 files changed, 2 insertions(+)

diff --git a/arch/arm64/boot/dts/st/stm32mp231.dtsi b/arch/arm64/boot/dts/st/stm32mp231.dtsi
index 75697acd1345..8c0dea2796a4 100644
--- a/arch/arm64/boot/dts/st/stm32mp231.dtsi
+++ b/arch/arm64/boot/dts/st/stm32mp231.dtsi
@@ -776,6 +776,7 @@ rcc: clock-controller@44200000 {
 			reg = <0x44200000 0x10000>;
 			#clock-cells = <1>;
 			#reset-cells = <1>;
+			#access-controller-cells = <1>;
 			clocks = <&scmi_clk CK_SCMI_HSE>,
 				<&scmi_clk CK_SCMI_HSI>,
 				<&scmi_clk CK_SCMI_MSI>,
diff --git a/arch/arm64/boot/dts/st/stm32mp251.dtsi b/arch/arm64/boot/dts/st/stm32mp251.dtsi
index 303abf915b8e..fbedf23def52 100644
--- a/arch/arm64/boot/dts/st/stm32mp251.dtsi
+++ b/arch/arm64/boot/dts/st/stm32mp251.dtsi
@@ -1677,6 +1677,7 @@ rcc: clock-controller@44200000 {
 			reg = <0x44200000 0x10000>;
 			#clock-cells = <1>;
 			#reset-cells = <1>;
+			#access-controller-cells = <1>;
 			clocks = <&scmi_clk CK_SCMI_HSE>,
 				<&scmi_clk CK_SCMI_HSI>,
 				<&scmi_clk CK_SCMI_MSI>,

-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v8 2/3] clk: stm32mp25: add firewall grant_access ops
  2025-09-24  9:44 ` [PATCH v8 2/3] clk: stm32mp25: add firewall grant_access ops Clément Le Goffic
@ 2025-09-30  9:54   ` Gabriel FERNANDEZ
  0 siblings, 0 replies; 5+ messages in thread
From: Gabriel FERNANDEZ @ 2025-09-30  9:54 UTC (permalink / raw)
  To: Clément Le Goffic, Michael Turquette, Stephen Boyd,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Maxime Coquelin,
	Alexandre Torgue
  Cc: linux-clk, devicetree, linux-stm32, linux-arm-kernel,
	linux-kernel, Clément Le Goffic


On 9/24/25 11:44, Clément Le Goffic wrote:
> From: Clément Le Goffic <clement.legoffic@foss.st.com>
>
> On STM32MP25, the RCC peripheral manages the secure level of resources
> that are used by other devices such as clocks.
> Declare this peripheral as a firewall controller.
>
> Signed-off-by: Clément Le Goffic <clement.legoffic@foss.st.com>
> Signed-off-by: Clément Le Goffic <legoffic.clement@gmail.com>
> ---

Hi Clément,

You can add

Reviewed-by: Gabriel Fernandez <gabriel.fernandez@foss.st.com>

Many Thanks!


>   drivers/clk/stm32/clk-stm32mp25.c | 40 ++++++++++++++++++++++++++++++++++++++-
>   1 file changed, 39 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/clk/stm32/clk-stm32mp25.c b/drivers/clk/stm32/clk-stm32mp25.c
> index 52f0e8a12926..af4bc06d703a 100644
> --- a/drivers/clk/stm32/clk-stm32mp25.c
> +++ b/drivers/clk/stm32/clk-stm32mp25.c
> @@ -4,8 +4,10 @@
>    * Author: Gabriel Fernandez <gabriel.fernandez@foss.st.com> for STMicroelectronics.
>    */
>   
> +#include <linux/bus/stm32_firewall.h>
>   #include <linux/bus/stm32_firewall_device.h>
>   #include <linux/clk-provider.h>
> +#include <linux/device.h>
>   #include <linux/io.h>
>   #include <linux/platform_device.h>
>   
> @@ -1602,6 +1604,11 @@ static int stm32_rcc_get_access(void __iomem *base, u32 index)
>   	return 0;
>   }
>   
> +static int stm32mp25_rcc_grant_access(struct stm32_firewall_controller *ctrl, u32 firewall_id)
> +{
> +	return stm32_rcc_get_access(ctrl->mmio, firewall_id);
> +}
> +
>   static int stm32mp25_check_security(struct device_node *np, void __iomem *base,
>   				    const struct clock_config *cfg)
>   {
> @@ -1970,6 +1977,7 @@ MODULE_DEVICE_TABLE(of, stm32mp25_match_data);
>   
>   static int stm32mp25_rcc_clocks_probe(struct platform_device *pdev)
>   {
> +	struct stm32_firewall_controller *rcc_controller;
>   	struct device *dev = &pdev->dev;
>   	void __iomem *base;
>   	int ret;
> @@ -1982,7 +1990,36 @@ static int stm32mp25_rcc_clocks_probe(struct platform_device *pdev)
>   	if (ret)
>   		return ret;
>   
> -	return stm32_rcc_init(dev, stm32mp25_match_data, base);
> +	ret = stm32_rcc_init(dev, stm32mp25_match_data, base);
> +	if (ret)
> +		return ret;
> +
> +	rcc_controller = devm_kzalloc(&pdev->dev, sizeof(*rcc_controller), GFP_KERNEL);
> +	if (!rcc_controller)
> +		return -ENOMEM;
> +
> +	rcc_controller->dev = dev;
> +	rcc_controller->mmio = base;
> +	rcc_controller->name = dev_driver_string(dev);
> +	rcc_controller->type = STM32_PERIPHERAL_FIREWALL;
> +	rcc_controller->grant_access = stm32mp25_rcc_grant_access;
> +
> +	platform_set_drvdata(pdev, rcc_controller);
> +
> +	ret = stm32_firewall_controller_register(rcc_controller);
> +	if (ret) {
> +		dev_err(dev, "Couldn't register as a firewall controller: %d\n", ret);
> +		return ret;
> +	}
> +
> +	return 0;
> +}
> +
> +static void stm32mp25_rcc_clocks_remove(struct platform_device *pdev)
> +{
> +	struct stm32_firewall_controller *rcc_controller = platform_get_drvdata(pdev);
> +
> +	stm32_firewall_controller_unregister(rcc_controller);
>   }
>   
>   static struct platform_driver stm32mp25_rcc_clocks_driver = {
> @@ -1991,6 +2028,7 @@ static struct platform_driver stm32mp25_rcc_clocks_driver = {
>   		.of_match_table = stm32mp25_match_data,
>   	},
>   	.probe = stm32mp25_rcc_clocks_probe,
> +	.remove = stm32mp25_rcc_clocks_remove,
>   };
>   
>   static int __init stm32mp25_clocks_init(void)
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-09-30  9:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-24  9:44 [PATCH v8 0/3] Register the STM32MP25 RCC driver as an access controller Clément Le Goffic
2025-09-24  9:44 ` [PATCH v8 1/3] dt-bindings: stm32: stm32mp25: add `#access-controller-cells` property Clément Le Goffic
2025-09-24  9:44 ` [PATCH v8 2/3] clk: stm32mp25: add firewall grant_access ops Clément Le Goffic
2025-09-30  9:54   ` Gabriel FERNANDEZ
2025-09-24  9:44 ` [PATCH v8 3/3] arm64: dts: st: set RCC as an access-controller Clément Le Goffic

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).