* [PATCH V4 1/7] dt-bindings: soc: add i.MX93 SRC
2022-06-09 12:50 [PATCH V4 0/7] imx: support i.MX93 SRC and mediamix blk ctrl Peng Fan (OSS)
@ 2022-06-09 12:50 ` Peng Fan (OSS)
2022-06-14 21:39 ` Rob Herring
2022-06-09 12:50 ` [PATCH V4 2/7] dt-bindings: soc: add i.MX93 mediamix blk ctrl Peng Fan (OSS)
` (5 subsequent siblings)
6 siblings, 1 reply; 16+ messages in thread
From: Peng Fan (OSS) @ 2022-06-09 12:50 UTC (permalink / raw)
To: robh+dt, krzysztof.kozlowski+dt, sboyd, mturquette, shawnguo,
s.hauer
Cc: aisheng.dong, l.stach, kernel, festevam, linux-imx, devicetree,
linux-kernel, linux-arm-kernel, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
Add bindings for i.MX93 System Reset Controller(SRC). SRC supports
resets and power gating for mixes.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
.../bindings/power/fsl,imx93-src.yaml | 96 +++++++++++++++++++
include/dt-bindings/power/fsl,imx93-power.h | 11 +++
2 files changed, 107 insertions(+)
create mode 100644 Documentation/devicetree/bindings/power/fsl,imx93-src.yaml
create mode 100644 include/dt-bindings/power/fsl,imx93-power.h
diff --git a/Documentation/devicetree/bindings/power/fsl,imx93-src.yaml b/Documentation/devicetree/bindings/power/fsl,imx93-src.yaml
new file mode 100644
index 000000000000..880500a841f7
--- /dev/null
+++ b/Documentation/devicetree/bindings/power/fsl,imx93-src.yaml
@@ -0,0 +1,96 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/power/fsl,imx93-src.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NXP i.MX93 System Reset Controller
+
+maintainers:
+ - Peng Fan <peng.fan@nxp.com>
+
+description: |
+ The System Reset Controller (SRC) is responsible for the generation of
+ all the system reset signals and boot argument latching.
+
+ Its main functions are as follows,
+ - Deals with all global system reset sources from other modules,
+ and generates global system reset.
+ - Responsible for power gating of MIXs (Slices) and their memory
+ low power control.
+
+properties:
+ compatible:
+ items:
+ - const: fsl,imx93-src
+ - const: syscon
+
+ reg:
+ maxItems: 1
+
+ slices:
+ type: object
+ description: list of power domains provided by this controller.
+
+ properties:
+ '#address-cells':
+ const: 1
+
+ '#size-cells':
+ const: 0
+
+ patternProperties:
+ "power-domain@[0-9]$":
+ $ref: /schemas/power/power-domain.yaml#
+
+ type: object
+ properties:
+ '#power-domain-cells':
+ const: 0
+
+ reg:
+ description: |
+ Power domain index. Valid values are defined in
+ include/dt-bindings/power/imx93-power.h for fsl,imx93-src
+ maxItems: 1
+
+ clocks:
+ description: |
+ A number of phandles to clocks that need to be enabled
+ during domain power-up sequencing to ensure reset
+ propagation into devices located inside this power domain.
+ minItems: 1
+ maxItems: 5
+
+ required:
+ - '#power-domain-cells'
+ - reg
+
+required:
+ - compatible
+ - reg
+ - slices
+
+additionalProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/clock/imx93-clock.h>
+ #include <dt-bindings/power/fsl,imx93-power.h>
+
+ system-controller@44460000 {
+ compatible = "fsl,imx93-src", "syscon";
+ reg = <0x44460000 0x10000>;
+
+ slices {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ mediamix: power-domain@0 {
+ reg = <IMX93_POWER_DOMAIN_MEDIAMIX>;
+ #power-domain-cells = <0>;
+ clocks = <&clk IMX93_CLK_MEDIA_AXI>,
+ <&clk IMX93_CLK_MEDIA_APB>;
+ };
+ };
+ };
diff --git a/include/dt-bindings/power/fsl,imx93-power.h b/include/dt-bindings/power/fsl,imx93-power.h
new file mode 100644
index 000000000000..27fb7df80f93
--- /dev/null
+++ b/include/dt-bindings/power/fsl,imx93-power.h
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: (GPL-2.0 OR MIT) */
+/*
+ * Copyright 2022 NXP
+ */
+
+#ifndef __DT_BINDINGS_IMX93_POWER_H__
+#define __DT_BINDINGS_IMX93_POWER_H__
+
+#define IMX93_POWER_DOMAIN_MEDIAMIX 0
+
+#endif
--
2.25.1
^ permalink raw reply related [flat|nested] 16+ messages in thread* Re: [PATCH V4 1/7] dt-bindings: soc: add i.MX93 SRC
2022-06-09 12:50 ` [PATCH V4 1/7] dt-bindings: soc: add i.MX93 SRC Peng Fan (OSS)
@ 2022-06-14 21:39 ` Rob Herring
2022-06-14 23:22 ` Peng Fan
0 siblings, 1 reply; 16+ messages in thread
From: Rob Herring @ 2022-06-14 21:39 UTC (permalink / raw)
To: Peng Fan (OSS)
Cc: krzysztof.kozlowski+dt, sboyd, mturquette, shawnguo, s.hauer,
aisheng.dong, l.stach, kernel, festevam, linux-imx, devicetree,
linux-kernel, linux-arm-kernel, Peng Fan
On Thu, Jun 09, 2022 at 08:50:54PM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@nxp.com>
>
> Add bindings for i.MX93 System Reset Controller(SRC). SRC supports
> resets and power gating for mixes.
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
> .../bindings/power/fsl,imx93-src.yaml | 96 +++++++++++++++++++
> include/dt-bindings/power/fsl,imx93-power.h | 11 +++
> 2 files changed, 107 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/power/fsl,imx93-src.yaml
> create mode 100644 include/dt-bindings/power/fsl,imx93-power.h
>
> diff --git a/Documentation/devicetree/bindings/power/fsl,imx93-src.yaml b/Documentation/devicetree/bindings/power/fsl,imx93-src.yaml
> new file mode 100644
> index 000000000000..880500a841f7
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/power/fsl,imx93-src.yaml
> @@ -0,0 +1,96 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/power/fsl,imx93-src.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: NXP i.MX93 System Reset Controller
> +
> +maintainers:
> + - Peng Fan <peng.fan@nxp.com>
> +
> +description: |
> + The System Reset Controller (SRC) is responsible for the generation of
> + all the system reset signals and boot argument latching.
> +
> + Its main functions are as follows,
> + - Deals with all global system reset sources from other modules,
> + and generates global system reset.
> + - Responsible for power gating of MIXs (Slices) and their memory
> + low power control.
> +
> +properties:
> + compatible:
> + items:
> + - const: fsl,imx93-src
> + - const: syscon
> +
> + reg:
> + maxItems: 1
> +
> + slices:
power-controller
But if there aren't any other child nodes for the SRC, then why do you
need this level at all? If there are others, then your binding is
incomplete.
> + type: object
> + description: list of power domains provided by this controller.
> +
> + properties:
> + '#address-cells':
> + const: 1
> +
> + '#size-cells':
> + const: 0
> +
> + patternProperties:
> + "power-domain@[0-9]$":
> + $ref: /schemas/power/power-domain.yaml#
> +
> + type: object
> + properties:
> + '#power-domain-cells':
> + const: 0
> +
> + reg:
> + description: |
> + Power domain index. Valid values are defined in
> + include/dt-bindings/power/imx93-power.h for fsl,imx93-src
> + maxItems: 1
> +
> + clocks:
> + description: |
> + A number of phandles to clocks that need to be enabled
> + during domain power-up sequencing to ensure reset
> + propagation into devices located inside this power domain.
> + minItems: 1
> + maxItems: 5
> +
> + required:
> + - '#power-domain-cells'
> + - reg
> +
> +required:
> + - compatible
> + - reg
> + - slices
> +
> +additionalProperties: false
> +
> +examples:
> + - |
> + #include <dt-bindings/clock/imx93-clock.h>
> + #include <dt-bindings/power/fsl,imx93-power.h>
> +
> + system-controller@44460000 {
> + compatible = "fsl,imx93-src", "syscon";
> + reg = <0x44460000 0x10000>;
> +
> + slices {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + mediamix: power-domain@0 {
> + reg = <IMX93_POWER_DOMAIN_MEDIAMIX>;
> + #power-domain-cells = <0>;
> + clocks = <&clk IMX93_CLK_MEDIA_AXI>,
> + <&clk IMX93_CLK_MEDIA_APB>;
> + };
> + };
> + };
> diff --git a/include/dt-bindings/power/fsl,imx93-power.h b/include/dt-bindings/power/fsl,imx93-power.h
> new file mode 100644
> index 000000000000..27fb7df80f93
> --- /dev/null
> +++ b/include/dt-bindings/power/fsl,imx93-power.h
> @@ -0,0 +1,11 @@
> +/* SPDX-License-Identifier: (GPL-2.0 OR MIT) */
> +/*
> + * Copyright 2022 NXP
> + */
> +
> +#ifndef __DT_BINDINGS_IMX93_POWER_H__
> +#define __DT_BINDINGS_IMX93_POWER_H__
> +
> +#define IMX93_POWER_DOMAIN_MEDIAMIX 0
> +
> +#endif
> --
> 2.25.1
>
>
^ permalink raw reply [flat|nested] 16+ messages in thread* RE: [PATCH V4 1/7] dt-bindings: soc: add i.MX93 SRC
2022-06-14 21:39 ` Rob Herring
@ 2022-06-14 23:22 ` Peng Fan
2022-06-15 1:37 ` Rob Herring
0 siblings, 1 reply; 16+ messages in thread
From: Peng Fan @ 2022-06-14 23:22 UTC (permalink / raw)
To: Rob Herring, Peng Fan (OSS)
Cc: krzysztof.kozlowski+dt@linaro.org, sboyd@kernel.org,
mturquette@baylibre.com, shawnguo@kernel.org,
s.hauer@pengutronix.de, Aisheng Dong, l.stach@pengutronix.de,
kernel@pengutronix.de, festevam@gmail.com, dl-linux-imx,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
> Subject: Re: [PATCH V4 1/7] dt-bindings: soc: add i.MX93 SRC
>
> On Thu, Jun 09, 2022 at 08:50:54PM +0800, Peng Fan (OSS) wrote:
> > From: Peng Fan <peng.fan@nxp.com>
> >
> > Add bindings for i.MX93 System Reset Controller(SRC). SRC supports
> > resets and power gating for mixes.
> >
> > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > ---
> > .../bindings/power/fsl,imx93-src.yaml | 96
> +++++++++++++++++++
> > include/dt-bindings/power/fsl,imx93-power.h | 11 +++
> > 2 files changed, 107 insertions(+)
> > create mode 100644
> > Documentation/devicetree/bindings/power/fsl,imx93-src.yaml
> > create mode 100644 include/dt-bindings/power/fsl,imx93-power.h
> >
> > diff --git
> > a/Documentation/devicetree/bindings/power/fsl,imx93-src.yaml
> > b/Documentation/devicetree/bindings/power/fsl,imx93-src.yaml
> > new file mode 100644
> > index 000000000000..880500a841f7
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/power/fsl,imx93-src.yaml
> > @@ -0,0 +1,96 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) %YAML 1.2
> > +---
> > +$id:
> > +https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fdevi
> >
> +cetree.org%2Fschemas%2Fpower%2Ffsl%2Cimx93-src.yaml%23&data=0
> 5%7C
> >
> +01%7Cpeng.fan%40nxp.com%7Cbce11534c1f9456c1a4108da4e4e6d4d%7C6
> 86ea1d3
> >
> +bc2b4c6fa92cd99c5c301635%7C0%7C0%7C637908395997226535%7CUnkn
> own%7CTWF
> >
> +pbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVC
> I6
> >
> +Mn0%3D%7C3000%7C%7C%7C&sdata=sTDHZ9BVww%2FFe2pwS%2Fjoz
> HPwWRmkU1hi
> > +966eGXzjFSk%3D&reserved=0
> > +$schema:
> > +https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fdevi
> >
> +cetree.org%2Fmeta-schemas%2Fcore.yaml%23&data=05%7C01%7Cpeng
> .fan%
> >
> +40nxp.com%7Cbce11534c1f9456c1a4108da4e4e6d4d%7C686ea1d3bc2b4c6
> fa92cd9
> >
> +9c5c301635%7C0%7C0%7C637908395997226535%7CUnknown%7CTWFpbG
> Zsb3d8eyJWI
> >
> +joiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3
> 000%
> >
> +7C%7C%7C&sdata=xAU2zmsZDWOtCndpmKvMScG1XqjytSUnXLvzxR40p
> HY%3D&
> > +;reserved=0
> > +
> > +title: NXP i.MX93 System Reset Controller
> > +
> > +maintainers:
> > + - Peng Fan <peng.fan@nxp.com>
> > +
> > +description: |
> > + The System Reset Controller (SRC) is responsible for the generation
> > +of
> > + all the system reset signals and boot argument latching.
> > +
> > + Its main functions are as follows,
> > + - Deals with all global system reset sources from other modules,
> > + and generates global system reset.
> > + - Responsible for power gating of MIXs (Slices) and their memory
> > + low power control.
> > +
> > +properties:
> > + compatible:
> > + items:
> > + - const: fsl,imx93-src
> > + - const: syscon
> > +
> > + reg:
> > + maxItems: 1
> > +
> > + slices:
>
> power-controller
>
> But if there aren't any other child nodes for the SRC, then why do you need this
> level at all? If there are others, then your binding is incomplete.
Currently we not need other parts from driver, so I not add them. I just add mix
slices with name "slices". For U-Boot, we are not using DTB for mem slices,
so I not add mem slices.
It has following mix slices.
0 EdgeLock Enclave
1 AONMIX
2 WAKEUPMIX
3 DDRMIX
4 DDRPHY
5 MLMIX
6 NICMIX
7 HSIOMIX
8 MEDIAMIX
9 CM33MIX
10 CA55 core 0
11 CA55 core 1
12 CA55 cluster
It has following mem slices:
0 AONMIX memory
1 WAKEUPMIX memory
2 DDRMIX memory
3 DDRPHY memory
4 MLMIX memory
5 NICMIX memory
6 OCRAM
7 HSIOMIX memory
8 MEDIA memory
9 CA55 core 0 memory
10 CA55 core 1 memory
11 CA55 cluster memory
12 L3 cache
It has some general purpose functions that could
be covered by SRC node itself.
Thanks,
Peng.
>
> > + type: object
> > + description: list of power domains provided by this controller.
> > +
> > + properties:
> > + '#address-cells':
> > + const: 1
> > +
> > + '#size-cells':
> > + const: 0
> > +
> > + patternProperties:
> > + "power-domain@[0-9]$":
> > + $ref: /schemas/power/power-domain.yaml#
> > +
> > + type: object
> > + properties:
> > + '#power-domain-cells':
> > + const: 0
> > +
> > + reg:
> > + description: |
> > + Power domain index. Valid values are defined in
> > + include/dt-bindings/power/imx93-power.h for fsl,imx93-src
> > + maxItems: 1
> > +
> > + clocks:
> > + description: |
> > + A number of phandles to clocks that need to be enabled
> > + during domain power-up sequencing to ensure reset
> > + propagation into devices located inside this power domain.
> > + minItems: 1
> > + maxItems: 5
> > +
> > + required:
> > + - '#power-domain-cells'
> > + - reg
> > +
> > +required:
> > + - compatible
> > + - reg
> > + - slices
> > +
> > +additionalProperties: false
> > +
> > +examples:
> > + - |
> > + #include <dt-bindings/clock/imx93-clock.h>
> > + #include <dt-bindings/power/fsl,imx93-power.h>
> > +
> > + system-controller@44460000 {
> > + compatible = "fsl,imx93-src", "syscon";
> > + reg = <0x44460000 0x10000>;
> > +
> > + slices {
> > + #address-cells = <1>;
> > + #size-cells = <0>;
> > +
> > + mediamix: power-domain@0 {
> > + reg = <IMX93_POWER_DOMAIN_MEDIAMIX>;
> > + #power-domain-cells = <0>;
> > + clocks = <&clk IMX93_CLK_MEDIA_AXI>,
> > + <&clk IMX93_CLK_MEDIA_APB>;
> > + };
> > + };
> > + };
> > diff --git a/include/dt-bindings/power/fsl,imx93-power.h
> > b/include/dt-bindings/power/fsl,imx93-power.h
> > new file mode 100644
> > index 000000000000..27fb7df80f93
> > --- /dev/null
> > +++ b/include/dt-bindings/power/fsl,imx93-power.h
> > @@ -0,0 +1,11 @@
> > +/* SPDX-License-Identifier: (GPL-2.0 OR MIT) */
> > +/*
> > + * Copyright 2022 NXP
> > + */
> > +
> > +#ifndef __DT_BINDINGS_IMX93_POWER_H__ #define
> > +__DT_BINDINGS_IMX93_POWER_H__
> > +
> > +#define IMX93_POWER_DOMAIN_MEDIAMIX 0
> > +
> > +#endif
> > --
> > 2.25.1
> >
> >
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [PATCH V4 1/7] dt-bindings: soc: add i.MX93 SRC
2022-06-14 23:22 ` Peng Fan
@ 2022-06-15 1:37 ` Rob Herring
2022-06-15 3:51 ` Peng Fan
0 siblings, 1 reply; 16+ messages in thread
From: Rob Herring @ 2022-06-15 1:37 UTC (permalink / raw)
To: Peng Fan
Cc: Peng Fan (OSS), krzysztof.kozlowski+dt@linaro.org,
sboyd@kernel.org, mturquette@baylibre.com, shawnguo@kernel.org,
s.hauer@pengutronix.de, Aisheng Dong, l.stach@pengutronix.de,
kernel@pengutronix.de, festevam@gmail.com, dl-linux-imx,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
On Tue, Jun 14, 2022 at 11:22:43PM +0000, Peng Fan wrote:
> > Subject: Re: [PATCH V4 1/7] dt-bindings: soc: add i.MX93 SRC
> >
> > On Thu, Jun 09, 2022 at 08:50:54PM +0800, Peng Fan (OSS) wrote:
> > > From: Peng Fan <peng.fan@nxp.com>
> > >
> > > Add bindings for i.MX93 System Reset Controller(SRC). SRC supports
> > > resets and power gating for mixes.
> > >
> > > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > > ---
> > > .../bindings/power/fsl,imx93-src.yaml | 96
> > +++++++++++++++++++
> > > include/dt-bindings/power/fsl,imx93-power.h | 11 +++
> > > 2 files changed, 107 insertions(+)
> > > create mode 100644
> > > Documentation/devicetree/bindings/power/fsl,imx93-src.yaml
> > > create mode 100644 include/dt-bindings/power/fsl,imx93-power.h
> > >
> > > diff --git
> > > a/Documentation/devicetree/bindings/power/fsl,imx93-src.yaml
> > > b/Documentation/devicetree/bindings/power/fsl,imx93-src.yaml
> > > new file mode 100644
> > > index 000000000000..880500a841f7
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/power/fsl,imx93-src.yaml
> > > @@ -0,0 +1,96 @@
> > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) %YAML 1.2
> > > +---
> > > +$id:
> > > +https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fdevi
> > >
> > +cetree.org%2Fschemas%2Fpower%2Ffsl%2Cimx93-src.yaml%23&data=0
> > 5%7C
> > >
> > +01%7Cpeng.fan%40nxp.com%7Cbce11534c1f9456c1a4108da4e4e6d4d%7C6
> > 86ea1d3
> > >
> > +bc2b4c6fa92cd99c5c301635%7C0%7C0%7C637908395997226535%7CUnkn
> > own%7CTWF
> > >
> > +pbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVC
> > I6
> > >
> > +Mn0%3D%7C3000%7C%7C%7C&sdata=sTDHZ9BVww%2FFe2pwS%2Fjoz
> > HPwWRmkU1hi
> > > +966eGXzjFSk%3D&reserved=0
> > > +$schema:
> > > +https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fdevi
> > >
> > +cetree.org%2Fmeta-schemas%2Fcore.yaml%23&data=05%7C01%7Cpeng
> > .fan%
> > >
> > +40nxp.com%7Cbce11534c1f9456c1a4108da4e4e6d4d%7C686ea1d3bc2b4c6
> > fa92cd9
> > >
> > +9c5c301635%7C0%7C0%7C637908395997226535%7CUnknown%7CTWFpbG
> > Zsb3d8eyJWI
> > >
> > +joiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3
> > 000%
> > >
> > +7C%7C%7C&sdata=xAU2zmsZDWOtCndpmKvMScG1XqjytSUnXLvzxR40p
> > HY%3D&
> > > +;reserved=0
> > > +
> > > +title: NXP i.MX93 System Reset Controller
> > > +
> > > +maintainers:
> > > + - Peng Fan <peng.fan@nxp.com>
> > > +
> > > +description: |
> > > + The System Reset Controller (SRC) is responsible for the generation
> > > +of
> > > + all the system reset signals and boot argument latching.
> > > +
> > > + Its main functions are as follows,
> > > + - Deals with all global system reset sources from other modules,
> > > + and generates global system reset.
> > > + - Responsible for power gating of MIXs (Slices) and their memory
> > > + low power control.
> > > +
> > > +properties:
> > > + compatible:
> > > + items:
> > > + - const: fsl,imx93-src
> > > + - const: syscon
> > > +
> > > + reg:
> > > + maxItems: 1
> > > +
> > > + slices:
> >
> > power-controller
> >
> > But if there aren't any other child nodes for the SRC, then why do you need this
> > level at all? If there are others, then your binding is incomplete.
>
> Currently we not need other parts from driver, so I not add them. I just add mix
> slices with name "slices". For U-Boot, we are not using DTB for mem slices,
> so I not add mem slices.
>
> It has following mix slices.
What's a mix slice?
> 0 EdgeLock Enclave
> 1 AONMIX
> 2 WAKEUPMIX
> 3 DDRMIX
> 4 DDRPHY
> 5 MLMIX
> 6 NICMIX
> 7 HSIOMIX
> 8 MEDIAMIX
> 9 CM33MIX
> 10 CA55 core 0
> 11 CA55 core 1
> 12 CA55 cluster
>
> It has following mem slices:
What's a mem slice?
> 0 AONMIX memory
> 1 WAKEUPMIX memory
> 2 DDRMIX memory
> 3 DDRPHY memory
> 4 MLMIX memory
> 5 NICMIX memory
> 6 OCRAM
> 7 HSIOMIX memory
> 8 MEDIA memory
> 9 CA55 core 0 memory
> 10 CA55 core 1 memory
> 11 CA55 cluster memory
> 12 L3 cache
>
> It has some general purpose functions that could
> be covered by SRC node itself.
Please make bindings as complete as possible, not what some u-boot or
linux currently uses or not.
Rob
^ permalink raw reply [flat|nested] 16+ messages in thread
* RE: [PATCH V4 1/7] dt-bindings: soc: add i.MX93 SRC
2022-06-15 1:37 ` Rob Herring
@ 2022-06-15 3:51 ` Peng Fan
0 siblings, 0 replies; 16+ messages in thread
From: Peng Fan @ 2022-06-15 3:51 UTC (permalink / raw)
To: Rob Herring
Cc: Peng Fan (OSS), krzysztof.kozlowski+dt@linaro.org,
sboyd@kernel.org, mturquette@baylibre.com, shawnguo@kernel.org,
s.hauer@pengutronix.de, Aisheng Dong, l.stach@pengutronix.de,
kernel@pengutronix.de, festevam@gmail.com, dl-linux-imx,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
> Subject: Re: [PATCH V4 1/7] dt-bindings: soc: add i.MX93 SRC
>
> On Tue, Jun 14, 2022 at 11:22:43PM +0000, Peng Fan wrote:
> > > Subject: Re: [PATCH V4 1/7] dt-bindings: soc: add i.MX93 SRC
> > >
> > > On Thu, Jun 09, 2022 at 08:50:54PM +0800, Peng Fan (OSS) wrote:
> > > > From: Peng Fan <peng.fan@nxp.com>
> > > >
> > > > Add bindings for i.MX93 System Reset Controller(SRC). SRC supports
> > > > resets and power gating for mixes.
> > > >
> > > > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > > > ---
> > > > .../bindings/power/fsl,imx93-src.yaml | 96
> > > +++++++++++++++++++
> > > > include/dt-bindings/power/fsl,imx93-power.h | 11 +++
> > > > 2 files changed, 107 insertions(+) create mode 100644
> > > > Documentation/devicetree/bindings/power/fsl,imx93-src.yaml
> > > > create mode 100644 include/dt-bindings/power/fsl,imx93-power.h
> > > >
> > > > diff --git
> > > > a/Documentation/devicetree/bindings/power/fsl,imx93-src.yaml
> > > > b/Documentation/devicetree/bindings/power/fsl,imx93-src.yaml
> > > > new file mode 100644
> > > > index 000000000000..880500a841f7
> > > > --- /dev/null
> > > > +++ b/Documentation/devicetree/bindings/power/fsl,imx93-src.yaml
> > > > @@ -0,0 +1,96 @@
> > > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) %YAML
> > > > +1.2
> > > > +---
> > > > +$id:
> > > > +https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2F
> > > > +devi
> > > >
> > >
> +cetree.org%2Fschemas%2Fpower%2Ffsl%2Cimx93-src.yaml%23&data=0
> > > 5%7C
> > > >
> > >
> +01%7Cpeng.fan%40nxp.com%7Cbce11534c1f9456c1a4108da4e4e6d4d%7C6
> > > 86ea1d3
> > > >
> > >
> +bc2b4c6fa92cd99c5c301635%7C0%7C0%7C637908395997226535%7CUnkn
> > > own%7CTWF
> > > >
> > >
> +pbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVC
> > > I6
> > > >
> > >
> +Mn0%3D%7C3000%7C%7C%7C&sdata=sTDHZ9BVww%2FFe2pwS%2Fjoz
> > > HPwWRmkU1hi
> > > > +966eGXzjFSk%3D&reserved=0
> > > > +$schema:
> > > > +https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2F
> > > > +devi
> > > >
> > >
> +cetree.org%2Fmeta-schemas%2Fcore.yaml%23&data=05%7C01%7Cpeng
> > > .fan%
> > > >
> > >
> +40nxp.com%7Cbce11534c1f9456c1a4108da4e4e6d4d%7C686ea1d3bc2b4c6
> > > fa92cd9
> > > >
> > >
> +9c5c301635%7C0%7C0%7C637908395997226535%7CUnknown%7CTWFpbG
> > > Zsb3d8eyJWI
> > > >
> > >
> +joiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3
> > > 000%
> > > >
> > >
> +7C%7C%7C&sdata=xAU2zmsZDWOtCndpmKvMScG1XqjytSUnXLvzxR40p
> > > HY%3D&
> > > > +;reserved=0
> > > > +
> > > > +title: NXP i.MX93 System Reset Controller
> > > > +
> > > > +maintainers:
> > > > + - Peng Fan <peng.fan@nxp.com>
> > > > +
> > > > +description: |
> > > > + The System Reset Controller (SRC) is responsible for the
> > > > +generation of
> > > > + all the system reset signals and boot argument latching.
> > > > +
> > > > + Its main functions are as follows,
> > > > + - Deals with all global system reset sources from other modules,
> > > > + and generates global system reset.
> > > > + - Responsible for power gating of MIXs (Slices) and their memory
> > > > + low power control.
> > > > +
> > > > +properties:
> > > > + compatible:
> > > > + items:
> > > > + - const: fsl,imx93-src
> > > > + - const: syscon
> > > > +
> > > > + reg:
> > > > + maxItems: 1
> > > > +
> > > > + slices:
> > >
> > > power-controller
> > >
> > > But if there aren't any other child nodes for the SRC, then why do
> > > you need this level at all? If there are others, then your binding is
> incomplete.
> >
> > Currently we not need other parts from driver, so I not add them. I
> > just add mix slices with name "slices". For U-Boot, we are not using
> > DTB for mem slices, so I not add mem slices.
> >
> > It has following mix slices.
>
> What's a mix slice?
i.MX9 has many logic block named [x]mix, such as wakeupmix,
mediamix. One mix slice is for one mix block logic.
>
> > 0 EdgeLock Enclave
> > 1 AONMIX
> > 2 WAKEUPMIX
> > 3 DDRMIX
> > 4 DDRPHY
> > 5 MLMIX
> > 6 NICMIX
> > 7 HSIOMIX
> > 8 MEDIAMIX
> > 9 CM33MIX
> > 10 CA55 core 0
> > 11 CA55 core 1
> > 12 CA55 cluster
> >
> > It has following mem slices:
>
> What's a mem slice?
From HW perspective, registers are actually memory.
So saying mem slice is for memory related stuff for
a mix.
>
> > 0 AONMIX memory
> > 1 WAKEUPMIX memory
> > 2 DDRMIX memory
> > 3 DDRPHY memory
> > 4 MLMIX memory
> > 5 NICMIX memory
> > 6 OCRAM
> > 7 HSIOMIX memory
> > 8 MEDIA memory
> > 9 CA55 core 0 memory
> > 10 CA55 core 1 memory
> > 11 CA55 cluster memory
> > 12 L3 cache
> >
> > It has some general purpose functions that could be covered by SRC
> > node itself.
>
> Please make bindings as complete as possible, not what some u-boot or linux
> currently uses or not.
ok, got it. Then do you think following is ok?
mix-slices:
type: object
description: list of power domains provided by this controller.
properties:
'#address-cells':
const: 1
'#size-cells':
const: 0
patternProperties:
"power-domain@[0-9]$":
$ref: /schemas/power/power-domain.yaml#
type: object
properties:
'#power-domain-cells':
const: 0
reg:
description: |
Power domain index. Valid values are defined in
include/dt-bindings/power/imx93-power.h for fsl,imx93-src
maxItems: 1
clocks:
description: |
A number of phandles to clocks that need to be enabled
during domain power-up sequencing to ensure reset
propagation into devices located inside this power domain.
minItems: 1
maxItems: 5
required:
- '#power-domain-cells'
- reg
mem-slices:
type: object
description: list of power domains provided by this controller.
properties:
'#address-cells':
const: 1
'#size-cells':
const: 0
patternProperties:
"power-domain@[0-9]$":
$ref: /schemas/power/power-domain.yaml#
type: object
properties:
'#power-domain-cells':
const: 0
reg:
description: |
Power domain index. Valid values are defined in
include/dt-bindings/power/imx93-power.h for fsl,imx93-src
maxItems: 1
clocks:
description: |
A number of phandles to clocks that need to be enabled
during domain power-up sequencing to ensure reset
propagation into devices located inside this power domain.
minItems: 1
maxItems: 5
required:
- '#power-domain-cells'
- reg
Thanks,
Peng.
>
> Rob
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH V4 2/7] dt-bindings: soc: add i.MX93 mediamix blk ctrl
2022-06-09 12:50 [PATCH V4 0/7] imx: support i.MX93 SRC and mediamix blk ctrl Peng Fan (OSS)
2022-06-09 12:50 ` [PATCH V4 1/7] dt-bindings: soc: add i.MX93 SRC Peng Fan (OSS)
@ 2022-06-09 12:50 ` Peng Fan (OSS)
2022-06-09 12:50 ` [PATCH V4 3/7] clk: export of_clk_bulk_get_all Peng Fan (OSS)
` (4 subsequent siblings)
6 siblings, 0 replies; 16+ messages in thread
From: Peng Fan (OSS) @ 2022-06-09 12:50 UTC (permalink / raw)
To: robh+dt, krzysztof.kozlowski+dt, sboyd, mturquette, shawnguo,
s.hauer
Cc: aisheng.dong, l.stach, kernel, festevam, linux-imx, devicetree,
linux-kernel, linux-arm-kernel, Peng Fan, Krzysztof Kozlowski
From: Peng Fan <peng.fan@nxp.com>
Add DT bindings for i.MX93 MEDIAMIX BLK CTRL.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
.../soc/imx/fsl,imx93-media-blk-ctrl.yaml | 80 +++++++++++++++++++
include/dt-bindings/power/fsl,imx93-power.h | 6 ++
2 files changed, 86 insertions(+)
create mode 100644 Documentation/devicetree/bindings/soc/imx/fsl,imx93-media-blk-ctrl.yaml
diff --git a/Documentation/devicetree/bindings/soc/imx/fsl,imx93-media-blk-ctrl.yaml b/Documentation/devicetree/bindings/soc/imx/fsl,imx93-media-blk-ctrl.yaml
new file mode 100644
index 000000000000..792ebecec22d
--- /dev/null
+++ b/Documentation/devicetree/bindings/soc/imx/fsl,imx93-media-blk-ctrl.yaml
@@ -0,0 +1,80 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/soc/imx/fsl,imx93-media-blk-ctrl.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NXP i.MX93 Media blk-ctrl
+
+maintainers:
+ - Peng Fan <peng.fan@nxp.com>
+
+description:
+ The i.MX93 MEDIAMIX domain contains control and status registers known
+ as MEDIAMIX Block Control (MEDIAMIX BLK_CTRL). These registers include
+ clocking, reset, and miscellaneous top-level controls for peripherals
+ within the MEDIAMIX domain
+
+properties:
+ compatible:
+ items:
+ - const: fsl,imx93-media-blk-ctrl
+ - const: syscon
+
+ reg:
+ maxItems: 1
+
+ '#power-domain-cells':
+ const: 1
+
+ power-domains:
+ maxItems: 1
+
+ clocks:
+ maxItems: 10
+
+ clock-names:
+ items:
+ - const: apb
+ - const: axi
+ - const: nic
+ - const: disp
+ - const: cam
+ - const: pxp
+ - const: lcdif
+ - const: isi
+ - const: csi
+ - const: dsi
+
+required:
+ - compatible
+ - reg
+ - power-domains
+ - clocks
+ - clock-names
+
+additionalProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/clock/imx93-clock.h>
+ #include <dt-bindings/power/fsl,imx93-power.h>
+
+ media_blk_ctrl: system-controller@4ac10000 {
+ compatible = "fsl,imx93-media-blk-ctrl", "syscon";
+ reg = <0x4ac10000 0x10000>;
+ power-domains = <&mediamix>;
+ clocks = <&clk IMX93_CLK_MEDIA_APB>,
+ <&clk IMX93_CLK_MEDIA_AXI>,
+ <&clk IMX93_CLK_NIC_MEDIA_GATE>,
+ <&clk IMX93_CLK_MEDIA_DISP_PIX>,
+ <&clk IMX93_CLK_CAM_PIX>,
+ <&clk IMX93_CLK_PXP_GATE>,
+ <&clk IMX93_CLK_LCDIF_GATE>,
+ <&clk IMX93_CLK_ISI_GATE>,
+ <&clk IMX93_CLK_MIPI_CSI_GATE>,
+ <&clk IMX93_CLK_MIPI_DSI_GATE>;
+ clock-names = "apb", "axi", "nic", "disp", "cam",
+ "pxp", "lcdif", "isi", "csi", "dsi";
+ #power-domain-cells = <1>;
+ };
diff --git a/include/dt-bindings/power/fsl,imx93-power.h b/include/dt-bindings/power/fsl,imx93-power.h
index 27fb7df80f93..b3d2d9619d3a 100644
--- a/include/dt-bindings/power/fsl,imx93-power.h
+++ b/include/dt-bindings/power/fsl,imx93-power.h
@@ -8,4 +8,10 @@
#define IMX93_POWER_DOMAIN_MEDIAMIX 0
+#define IMX93_MEDIABLK_PD_MIPI_DSI 0
+#define IMX93_MEDIABLK_PD_MIPI_CSI 1
+#define IMX93_MEDIABLK_PD_PXP 2
+#define IMX93_MEDIABLK_PD_LCDIF 3
+#define IMX93_MEDIABLK_PD_ISI 4
+
#endif
--
2.25.1
^ permalink raw reply related [flat|nested] 16+ messages in thread* [PATCH V4 3/7] clk: export of_clk_bulk_get_all
2022-06-09 12:50 [PATCH V4 0/7] imx: support i.MX93 SRC and mediamix blk ctrl Peng Fan (OSS)
2022-06-09 12:50 ` [PATCH V4 1/7] dt-bindings: soc: add i.MX93 SRC Peng Fan (OSS)
2022-06-09 12:50 ` [PATCH V4 2/7] dt-bindings: soc: add i.MX93 mediamix blk ctrl Peng Fan (OSS)
@ 2022-06-09 12:50 ` Peng Fan (OSS)
2022-06-10 9:02 ` Peng Fan (OSS)
2022-06-09 12:50 ` [PATCH V4 4/7] soc: imx: add i.MX93 SRC power domain driver Peng Fan (OSS)
` (3 subsequent siblings)
6 siblings, 1 reply; 16+ messages in thread
From: Peng Fan (OSS) @ 2022-06-09 12:50 UTC (permalink / raw)
To: robh+dt, krzysztof.kozlowski+dt, sboyd, mturquette, shawnguo,
s.hauer
Cc: aisheng.dong, l.stach, kernel, festevam, linux-imx, devicetree,
linux-kernel, linux-arm-kernel, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
Export of_clk_bulk_get_all, so drivers could use this API.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/clk/clk-bulk.c | 3 ++-
include/linux/clk.h | 2 ++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/clk/clk-bulk.c b/drivers/clk/clk-bulk.c
index e9e16425c739..470155856b02 100644
--- a/drivers/clk/clk-bulk.c
+++ b/drivers/clk/clk-bulk.c
@@ -43,7 +43,7 @@ static int __must_check of_clk_bulk_get(struct device_node *np, int num_clks,
return ret;
}
-static int __must_check of_clk_bulk_get_all(struct device_node *np,
+int __must_check of_clk_bulk_get_all(struct device_node *np,
struct clk_bulk_data **clks)
{
struct clk_bulk_data *clk_bulk;
@@ -68,6 +68,7 @@ static int __must_check of_clk_bulk_get_all(struct device_node *np,
return num_clks;
}
+EXPORT_SYMBOL_GPL(of_clk_bulk_get_all);
void clk_bulk_put(int num_clks, struct clk_bulk_data *clks)
{
diff --git a/include/linux/clk.h b/include/linux/clk.h
index 39faa54efe88..ca74f4e83d25 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -372,6 +372,8 @@ int __must_check clk_bulk_get(struct device *dev, int num_clks,
int __must_check clk_bulk_get_all(struct device *dev,
struct clk_bulk_data **clks);
+int __must_check of_clk_bulk_get_all(struct device_node *np,
+ struct clk_bulk_data **clks);
/**
* clk_bulk_get_optional - lookup and obtain a number of references to clock producer
* @dev: device for clock "consumer"
--
2.25.1
^ permalink raw reply related [flat|nested] 16+ messages in thread* RE: [PATCH V4 3/7] clk: export of_clk_bulk_get_all
2022-06-09 12:50 ` [PATCH V4 3/7] clk: export of_clk_bulk_get_all Peng Fan (OSS)
@ 2022-06-10 9:02 ` Peng Fan (OSS)
2022-07-04 1:05 ` Peng Fan (OSS)
0 siblings, 1 reply; 16+ messages in thread
From: Peng Fan (OSS) @ 2022-06-10 9:02 UTC (permalink / raw)
To: Peng Fan (OSS), robh+dt@kernel.org,
krzysztof.kozlowski+dt@linaro.org, sboyd@kernel.org,
mturquette@baylibre.com, shawnguo@kernel.org,
s.hauer@pengutronix.de
Cc: Aisheng Dong, l.stach@pengutronix.de, kernel@pengutronix.de,
festevam@gmail.com, dl-linux-imx, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Stephen,
> Subject: [PATCH V4 3/7] clk: export of_clk_bulk_get_all
Are you fine with this patch?
Patch 4 "soc: imx: add i.MX93 SRC power domain driver"
depends on this patch, if you are not happy with patch 3,
I still have time to rework patch 4.
Thanks,
Peng.
>
> From: Peng Fan <peng.fan@nxp.com>
>
> Export of_clk_bulk_get_all, so drivers could use this API.
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
> drivers/clk/clk-bulk.c | 3 ++-
> include/linux/clk.h | 2 ++
> 2 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/clk/clk-bulk.c b/drivers/clk/clk-bulk.c index
> e9e16425c739..470155856b02 100644
> --- a/drivers/clk/clk-bulk.c
> +++ b/drivers/clk/clk-bulk.c
> @@ -43,7 +43,7 @@ static int __must_check of_clk_bulk_get(struct
> device_node *np, int num_clks,
> return ret;
> }
>
> -static int __must_check of_clk_bulk_get_all(struct device_node *np,
> +int __must_check of_clk_bulk_get_all(struct device_node *np,
> struct clk_bulk_data **clks)
> {
> struct clk_bulk_data *clk_bulk;
> @@ -68,6 +68,7 @@ static int __must_check of_clk_bulk_get_all(struct
> device_node *np,
>
> return num_clks;
> }
> +EXPORT_SYMBOL_GPL(of_clk_bulk_get_all);
>
> void clk_bulk_put(int num_clks, struct clk_bulk_data *clks) { diff --git
> a/include/linux/clk.h b/include/linux/clk.h index 39faa54efe88..ca74f4e83d25
> 100644
> --- a/include/linux/clk.h
> +++ b/include/linux/clk.h
> @@ -372,6 +372,8 @@ int __must_check clk_bulk_get(struct device *dev, int
> num_clks, int __must_check clk_bulk_get_all(struct device *dev,
> struct clk_bulk_data **clks);
>
> +int __must_check of_clk_bulk_get_all(struct device_node *np,
> + struct clk_bulk_data **clks);
> /**
> * clk_bulk_get_optional - lookup and obtain a number of references to clock
> producer
> * @dev: device for clock "consumer"
> --
> 2.25.1
^ permalink raw reply [flat|nested] 16+ messages in thread* RE: [PATCH V4 3/7] clk: export of_clk_bulk_get_all
2022-06-10 9:02 ` Peng Fan (OSS)
@ 2022-07-04 1:05 ` Peng Fan (OSS)
0 siblings, 0 replies; 16+ messages in thread
From: Peng Fan (OSS) @ 2022-07-04 1:05 UTC (permalink / raw)
To: Peng Fan (OSS), robh+dt@kernel.org,
krzysztof.kozlowski+dt@linaro.org, sboyd@kernel.org,
mturquette@baylibre.com, shawnguo@kernel.org,
s.hauer@pengutronix.de
Cc: Aisheng Dong, l.stach@pengutronix.de, kernel@pengutronix.de,
festevam@gmail.com, dl-linux-imx, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Hi Stephen,
> Subject: RE: [PATCH V4 3/7] clk: export of_clk_bulk_get_all
[Peng Fan]
I am going to make a new version of this patchset. Please kindly
a Yes or No with this patch.
Thanks,
Peng.
>
> Stephen,
>
> > Subject: [PATCH V4 3/7] clk: export of_clk_bulk_get_all
>
> Are you fine with this patch?
> Patch 4 "soc: imx: add i.MX93 SRC power domain driver"
> depends on this patch, if you are not happy with patch 3, I still have time to
> rework patch 4.
>
> Thanks,
> Peng.
>
> >
> > From: Peng Fan <peng.fan@nxp.com>
> >
> > Export of_clk_bulk_get_all, so drivers could use this API.
> >
> > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > ---
> > drivers/clk/clk-bulk.c | 3 ++-
> > include/linux/clk.h | 2 ++
> > 2 files changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/clk/clk-bulk.c b/drivers/clk/clk-bulk.c index
> > e9e16425c739..470155856b02 100644
> > --- a/drivers/clk/clk-bulk.c
> > +++ b/drivers/clk/clk-bulk.c
> > @@ -43,7 +43,7 @@ static int __must_check of_clk_bulk_get(struct
> > device_node *np, int num_clks,
> > return ret;
> > }
> >
> > -static int __must_check of_clk_bulk_get_all(struct device_node *np,
> > +int __must_check of_clk_bulk_get_all(struct device_node *np,
> > struct clk_bulk_data **clks) {
> > struct clk_bulk_data *clk_bulk;
> > @@ -68,6 +68,7 @@ static int __must_check of_clk_bulk_get_all(struct
> > device_node *np,
> >
> > return num_clks;
> > }
> > +EXPORT_SYMBOL_GPL(of_clk_bulk_get_all);
> >
> > void clk_bulk_put(int num_clks, struct clk_bulk_data *clks) { diff
> > --git a/include/linux/clk.h b/include/linux/clk.h index
> > 39faa54efe88..ca74f4e83d25
> > 100644
> > --- a/include/linux/clk.h
> > +++ b/include/linux/clk.h
> > @@ -372,6 +372,8 @@ int __must_check clk_bulk_get(struct device *dev,
> > int num_clks, int __must_check clk_bulk_get_all(struct device *dev,
> > struct clk_bulk_data **clks);
> >
> > +int __must_check of_clk_bulk_get_all(struct device_node *np,
> > + struct clk_bulk_data **clks);
> > /**
> > * clk_bulk_get_optional - lookup and obtain a number of references
> > to clock producer
> > * @dev: device for clock "consumer"
> > --
> > 2.25.1
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH V4 4/7] soc: imx: add i.MX93 SRC power domain driver
2022-06-09 12:50 [PATCH V4 0/7] imx: support i.MX93 SRC and mediamix blk ctrl Peng Fan (OSS)
` (2 preceding siblings ...)
2022-06-09 12:50 ` [PATCH V4 3/7] clk: export of_clk_bulk_get_all Peng Fan (OSS)
@ 2022-06-09 12:50 ` Peng Fan (OSS)
2022-06-09 14:06 ` Randy Dunlap
2022-06-09 12:50 ` [PATCH V4 5/7] soc: imx: add i.MX93 media blk ctrl driver Peng Fan (OSS)
` (2 subsequent siblings)
6 siblings, 1 reply; 16+ messages in thread
From: Peng Fan (OSS) @ 2022-06-09 12:50 UTC (permalink / raw)
To: robh+dt, krzysztof.kozlowski+dt, sboyd, mturquette, shawnguo,
s.hauer
Cc: aisheng.dong, l.stach, kernel, festevam, linux-imx, devicetree,
linux-kernel, linux-arm-kernel, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
Support controlling power domain managed by System Reset
Controller(SRC). Current supported power domain is mediamix power
domain.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/soc/imx/Kconfig | 10 ++
drivers/soc/imx/Makefile | 1 +
drivers/soc/imx/imx93-pd.c | 271 +++++++++++++++++++++++++++++++++++++
3 files changed, 282 insertions(+)
create mode 100644 drivers/soc/imx/imx93-pd.c
diff --git a/drivers/soc/imx/Kconfig b/drivers/soc/imx/Kconfig
index a840494e849a..5bfc1dfea28b 100644
--- a/drivers/soc/imx/Kconfig
+++ b/drivers/soc/imx/Kconfig
@@ -20,4 +20,14 @@ config SOC_IMX8M
support, it will provide the SoC info like SoC family,
ID and revision etc.
+config SOC_IMX9
+ tristate "i.MX9 SoC family support"
+ depends on ARCH_MXC || COMPILE_TEST
+ default ARCH_MXC && ARM64
+ select SOC_BUS
+ select PM_GENERIC_DOMAINS
+ help
+ If you say yes here you get support for the NXP i.MX9 family
+ support.
+
endmenu
diff --git a/drivers/soc/imx/Makefile b/drivers/soc/imx/Makefile
index 63cd29f6d4d2..e3ed07a6bcf9 100644
--- a/drivers/soc/imx/Makefile
+++ b/drivers/soc/imx/Makefile
@@ -7,3 +7,4 @@ obj-$(CONFIG_IMX_GPCV2_PM_DOMAINS) += gpcv2.o
obj-$(CONFIG_SOC_IMX8M) += soc-imx8m.o
obj-$(CONFIG_SOC_IMX8M) += imx8m-blk-ctrl.o
obj-$(CONFIG_SOC_IMX8M) += imx8mp-blk-ctrl.o
+obj-$(CONFIG_SOC_IMX9) += imx93-pd.o
diff --git a/drivers/soc/imx/imx93-pd.c b/drivers/soc/imx/imx93-pd.c
new file mode 100644
index 000000000000..d4f8a8941759
--- /dev/null
+++ b/drivers/soc/imx/imx93-pd.c
@@ -0,0 +1,271 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright 2022 NXP.
+ */
+
+#include <linux/clk.h>
+#include <linux/of_device.h>
+#include <linux/delay.h>
+#include <linux/iopoll.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/pm_domain.h>
+#include <dt-bindings/power/fsl,imx93-power.h>
+
+#define IMX93_SRC_MEDIAMIX_OFF 0x2400
+
+#define MIX_SLICE_SW_CTRL_OFF 0x20
+#define SLICE_SW_CTRL_PSW_CTRL_OFF_MASK BIT(4)
+#define SLICE_SW_CTRL_PDN_SOFT_MASK BIT(31)
+
+#define MIX_FUNC_STAT_OFF 0xB4
+
+#define FUNC_STAT_PSW_STAT_MASK BIT(0)
+#define FUNC_STAT_RST_STAT_MASK BIT(2)
+#define FUNC_STAT_ISO_STAT_MASK BIT(4)
+
+struct imx93_slice_info {
+ char *name;
+ u32 mix_off;
+};
+
+struct imx93_plat_data {
+ u32 num_slice;
+ struct imx93_slice_info *slices;
+};
+
+struct imx93_power_domain {
+ struct generic_pm_domain genpd;
+ struct device *dev;
+ void * __iomem base;
+ const struct imx93_slice_info *slice_info;
+ struct clk_bulk_data *clks;
+ int num_clks;
+};
+
+#define to_imx93_pd(_genpd) container_of(_genpd, struct imx93_power_domain, genpd)
+
+struct imx93_slice_info imx93_slice_infos[] = {
+ [IMX93_POWER_DOMAIN_MEDIAMIX] = {
+ .name = "mediamix",
+ .mix_off = IMX93_SRC_MEDIAMIX_OFF,
+ }
+};
+
+struct imx93_plat_data imx93_plat_data = {
+ .num_slice = ARRAY_SIZE(imx93_slice_infos),
+ .slices = imx93_slice_infos,
+};
+
+static int imx93_pd_on(struct generic_pm_domain *genpd)
+{
+ struct imx93_power_domain *domain = to_imx93_pd(genpd);
+ const struct imx93_slice_info *slice_info = domain->slice_info;
+ void * __iomem addr = domain->base + slice_info->mix_off;
+ u32 val;
+ int ret;
+
+ ret = clk_bulk_prepare_enable(domain->num_clks, domain->clks);
+ if (ret) {
+ dev_err(domain->dev, "failed to enable clocks for domain: %s\n", genpd->name);
+ return ret;
+ }
+
+ val = readl(addr + MIX_SLICE_SW_CTRL_OFF);
+ val &= ~SLICE_SW_CTRL_PDN_SOFT_MASK;
+ writel(val, addr + MIX_SLICE_SW_CTRL_OFF);
+
+ ret = readl_poll_timeout(addr + MIX_FUNC_STAT_OFF, val,
+ !(val & FUNC_STAT_ISO_STAT_MASK), 1, 10000);
+ if (ret) {
+ dev_err(domain->dev, "pd_on timeout: name: %s, stat: %x\n", genpd->name, val);
+ return ret;
+ }
+
+ return 0;
+}
+
+static int imx93_pd_off(struct generic_pm_domain *genpd)
+{
+ struct imx93_power_domain *domain = to_imx93_pd(genpd);
+ const struct imx93_slice_info *slice_info = domain->slice_info;
+ void * __iomem addr = domain->base + slice_info->mix_off;
+ int ret;
+ u32 val;
+
+ /* Power off MIX */
+ val = readl(addr + MIX_SLICE_SW_CTRL_OFF);
+ val |= SLICE_SW_CTRL_PDN_SOFT_MASK;
+ writel(val, addr + MIX_SLICE_SW_CTRL_OFF);
+
+ ret = readl_poll_timeout(addr + MIX_FUNC_STAT_OFF, val,
+ val & FUNC_STAT_PSW_STAT_MASK, 1, 1000);
+ if (ret) {
+ dev_err(domain->dev, "pd_off timeout: name: %s, stat: %x\n", genpd->name, val);
+ return ret;
+ }
+
+ clk_bulk_disable_unprepare(domain->num_clks, domain->clks);
+
+ return 0;
+};
+
+static const struct of_device_id imx93_power_domain_ids[] = {
+ { .compatible = "fsl,imx93-src", .data = &imx93_plat_data, },
+ {},
+};
+
+static int imx93_pd_remove(struct platform_device *pdev)
+{
+ struct imx93_power_domain *pd = platform_get_drvdata(pdev);
+ struct device *dev = &pdev->dev;
+ const struct imx93_plat_data *data = of_device_get_match_data(dev);
+ u32 num_domains = data->num_slice;
+ struct device_node *slice_np, *np;
+ int ret;
+
+ slice_np = of_get_child_by_name(pdev->dev.of_node, "slice");
+
+ for_each_child_of_node(slice_np, np) {
+ struct imx93_power_domain *domain;
+ u32 index;
+
+ if (!of_device_is_available(np))
+ continue;
+
+ ret = of_property_read_u32(np, "reg", &index);
+ if (ret) {
+ dev_err(dev, "Failed to read 'reg' property\n");
+ of_node_put(np);
+ return ret;
+ }
+
+ if (index >= num_domains) {
+ dev_warn(dev, "Domain index %d is out of bounds\n", index);
+ continue;
+ }
+
+ domain = &pd[index];
+
+ of_genpd_del_provider(np);
+
+ pm_genpd_remove(&domain->genpd);
+ clk_bulk_put_all(domain->num_clks, domain->clks);
+ };
+
+ return 0;
+}
+
+static int imx93_pd_probe(struct platform_device *pdev)
+{
+ struct device *dev = &pdev->dev;
+ const struct imx93_plat_data *data = of_device_get_match_data(dev);
+ const struct imx93_slice_info *slice_info = data->slices;
+ struct imx93_power_domain *pd;
+ u32 num_domains = data->num_slice;
+ struct device_node *slice_np, *np;
+ void __iomem *base;
+ bool is_off;
+ int ret;
+
+ slice_np = of_get_child_by_name(dev->of_node, "slice");
+ if (!slice_np) {
+ dev_err(dev, "No slices specified in DT\n");
+ return -EINVAL;
+ }
+
+ base = devm_platform_ioremap_resource(pdev, 0);
+ if (IS_ERR(base))
+ return PTR_ERR(base);
+
+ pd = devm_kcalloc(dev, num_domains, sizeof(*pd), GFP_KERNEL);
+ if (!pd)
+ return -ENOMEM;
+
+ platform_set_drvdata(pdev, pd);
+
+ for_each_child_of_node(slice_np, np) {
+ struct imx93_power_domain *domain;
+ u32 index;
+
+ if (!of_device_is_available(np))
+ continue;
+
+ ret = of_property_read_u32(np, "reg", &index);
+ if (ret) {
+ dev_err(dev, "Failed to read 'reg' property\n");
+ of_node_put(np);
+ return ret;
+ }
+
+ if (index >= num_domains) {
+ dev_warn(dev, "Domain index %d is out of bounds\n", index);
+ continue;
+ }
+
+ domain = &pd[index];
+
+ domain->num_clks = of_clk_bulk_get_all(np, &domain->clks);
+ if (domain->num_clks < 0) {
+ return dev_err_probe(domain->dev, domain->num_clks,
+ "Failed to get %s's clocks\n",
+ slice_info[index].name);
+ }
+
+ domain->genpd.name = slice_info[index].name;
+ domain->genpd.power_off = imx93_pd_off;
+ domain->genpd.power_on = imx93_pd_on;
+ domain->slice_info = &slice_info[index];
+ domain->base = base;
+
+ is_off = readl(domain->base + slice_info->mix_off + MIX_FUNC_STAT_OFF) &
+ FUNC_STAT_ISO_STAT_MASK;
+ /* Just to sync the status of hardware */
+ if (!is_off) {
+ ret = clk_bulk_prepare_enable(domain->num_clks, domain->clks);
+ if (ret) {
+ dev_err(domain->dev, "failed to enable clocks for domain: %s\n",
+ domain->genpd.name);
+ clk_bulk_put_all(domain->num_clks, domain->clks);
+ return 0;
+ }
+ }
+
+ dev_info(dev, "%s: state: %x\n", domain->genpd.name,
+ readl(domain->base + MIX_FUNC_STAT_OFF));
+ ret = pm_genpd_init(&domain->genpd, NULL, is_off);
+ if (ret) {
+ dev_err(dev, "failed to init genpd\n");
+ clk_bulk_put_all(domain->num_clks, domain->clks);
+ return ret;
+ }
+
+ ret = of_genpd_add_provider_simple(np, &domain->genpd);
+ if (ret) {
+ clk_bulk_put_all(domain->num_clks, domain->clks);
+ return ret;
+ }
+ }
+
+ return 0;
+}
+
+static const struct of_device_id imx93_dt_ids[] = {
+ { .compatible = "fsl,imx93-src", .data = &imx93_plat_data, },
+ { }
+};
+
+static struct platform_driver imx93_power_domain_driver = {
+ .driver = {
+ .name = "imx93_power_domain",
+ .owner = THIS_MODULE,
+ .of_match_table = imx93_dt_ids,
+ },
+ .probe = imx93_pd_probe,
+ .remove = imx93_pd_remove,
+};
+module_platform_driver(imx93_power_domain_driver);
+
+MODULE_AUTHOR("Peng Fan <peng.fan@nxp.com>");
+MODULE_DESCRIPTION("NXP i.MX93 power domain driver");
+MODULE_LICENSE("GPL v2");
--
2.25.1
^ permalink raw reply related [flat|nested] 16+ messages in thread* Re: [PATCH V4 4/7] soc: imx: add i.MX93 SRC power domain driver
2022-06-09 12:50 ` [PATCH V4 4/7] soc: imx: add i.MX93 SRC power domain driver Peng Fan (OSS)
@ 2022-06-09 14:06 ` Randy Dunlap
2022-06-10 2:11 ` Peng Fan
0 siblings, 1 reply; 16+ messages in thread
From: Randy Dunlap @ 2022-06-09 14:06 UTC (permalink / raw)
To: Peng Fan (OSS), robh+dt, krzysztof.kozlowski+dt, sboyd,
mturquette, shawnguo, s.hauer
Cc: aisheng.dong, l.stach, kernel, festevam, linux-imx, devicetree,
linux-kernel, linux-arm-kernel, Peng Fan
On 6/9/22 05:50, Peng Fan (OSS) wrote:
> diff --git a/drivers/soc/imx/Kconfig b/drivers/soc/imx/Kconfig
> index a840494e849a..5bfc1dfea28b 100644
> --- a/drivers/soc/imx/Kconfig
> +++ b/drivers/soc/imx/Kconfig
> @@ -20,4 +20,14 @@ config SOC_IMX8M
> support, it will provide the SoC info like SoC family,
> ID and revision etc.
>
> +config SOC_IMX9
> + tristate "i.MX9 SoC family support"
> + depends on ARCH_MXC || COMPILE_TEST
> + default ARCH_MXC && ARM64
> + select SOC_BUS
> + select PM_GENERIC_DOMAINS
> + help
> + If you say yes here you get support for the NXP i.MX9 family
> + support.
One too many "support". Maybe:
> + help
> + If you say yes here you get support for the NXP i.MX9 SoC family.
--
~Randy
^ permalink raw reply [flat|nested] 16+ messages in thread
* RE: [PATCH V4 4/7] soc: imx: add i.MX93 SRC power domain driver
2022-06-09 14:06 ` Randy Dunlap
@ 2022-06-10 2:11 ` Peng Fan
0 siblings, 0 replies; 16+ messages in thread
From: Peng Fan @ 2022-06-10 2:11 UTC (permalink / raw)
To: Randy Dunlap, Peng Fan (OSS), robh+dt@kernel.org,
krzysztof.kozlowski+dt@linaro.org, sboyd@kernel.org,
mturquette@baylibre.com, shawnguo@kernel.org,
s.hauer@pengutronix.de
Cc: Aisheng Dong, l.stach@pengutronix.de, kernel@pengutronix.de,
festevam@gmail.com, dl-linux-imx, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
> Subject: Re: [PATCH V4 4/7] soc: imx: add i.MX93 SRC power domain driver
>
>
>
> On 6/9/22 05:50, Peng Fan (OSS) wrote:
> > diff --git a/drivers/soc/imx/Kconfig b/drivers/soc/imx/Kconfig index
> > a840494e849a..5bfc1dfea28b 100644
> > --- a/drivers/soc/imx/Kconfig
> > +++ b/drivers/soc/imx/Kconfig
> > @@ -20,4 +20,14 @@ config SOC_IMX8M
> > support, it will provide the SoC info like SoC family,
> > ID and revision etc.
> >
> > +config SOC_IMX9
> > + tristate "i.MX9 SoC family support"
> > + depends on ARCH_MXC || COMPILE_TEST
> > + default ARCH_MXC && ARM64
> > + select SOC_BUS
> > + select PM_GENERIC_DOMAINS
> > + help
> > + If you say yes here you get support for the NXP i.MX9 family
> > + support.
>
> One too many "support". Maybe:
>
> > + help
> > + If you say yes here you get support for the NXP i.MX9 SoC family.
Sure, update in V5 after collect more comments on this patchset.
Thanks,
Peng.
>
>
>
> --
> ~Randy
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH V4 5/7] soc: imx: add i.MX93 media blk ctrl driver
2022-06-09 12:50 [PATCH V4 0/7] imx: support i.MX93 SRC and mediamix blk ctrl Peng Fan (OSS)
` (3 preceding siblings ...)
2022-06-09 12:50 ` [PATCH V4 4/7] soc: imx: add i.MX93 SRC power domain driver Peng Fan (OSS)
@ 2022-06-09 12:50 ` Peng Fan (OSS)
2022-06-09 12:50 ` [PATCH V4 6/7] arm64: dts: imx93: add src node Peng Fan (OSS)
2022-06-09 12:51 ` [PATCH V4 7/7] arm64: dts: imx93: add mediamix blk ctrl node Peng Fan (OSS)
6 siblings, 0 replies; 16+ messages in thread
From: Peng Fan (OSS) @ 2022-06-09 12:50 UTC (permalink / raw)
To: robh+dt, krzysztof.kozlowski+dt, sboyd, mturquette, shawnguo,
s.hauer
Cc: aisheng.dong, l.stach, kernel, festevam, linux-imx, devicetree,
linux-kernel, linux-arm-kernel, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
Add i.MX93 mediamix blk ctrl support.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/soc/imx/Makefile | 2 +-
drivers/soc/imx/imx93-blk-ctrl.c | 333 +++++++++++++++++++++++++++++++
2 files changed, 334 insertions(+), 1 deletion(-)
create mode 100644 drivers/soc/imx/imx93-blk-ctrl.c
diff --git a/drivers/soc/imx/Makefile b/drivers/soc/imx/Makefile
index e3ed07a6bcf9..c532aa179f4d 100644
--- a/drivers/soc/imx/Makefile
+++ b/drivers/soc/imx/Makefile
@@ -7,4 +7,4 @@ obj-$(CONFIG_IMX_GPCV2_PM_DOMAINS) += gpcv2.o
obj-$(CONFIG_SOC_IMX8M) += soc-imx8m.o
obj-$(CONFIG_SOC_IMX8M) += imx8m-blk-ctrl.o
obj-$(CONFIG_SOC_IMX8M) += imx8mp-blk-ctrl.o
-obj-$(CONFIG_SOC_IMX9) += imx93-pd.o
+obj-$(CONFIG_SOC_IMX9) += imx93-pd.o imx93-blk-ctrl.o
diff --git a/drivers/soc/imx/imx93-blk-ctrl.c b/drivers/soc/imx/imx93-blk-ctrl.c
new file mode 100644
index 000000000000..42be09688cf1
--- /dev/null
+++ b/drivers/soc/imx/imx93-blk-ctrl.c
@@ -0,0 +1,333 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/*
+ * Copyright 2022 NXP, Peng Fan <peng.fan@nxp.com>
+ */
+
+#include <linux/device.h>
+#include <linux/module.h>
+#include <linux/of_device.h>
+#include <linux/platform_device.h>
+#include <linux/pm_domain.h>
+#include <linux/pm_runtime.h>
+#include <linux/regmap.h>
+#include <linux/clk.h>
+
+#include <dt-bindings/power/fsl,imx93-power.h>
+
+#define BLK_SFT_RSTN 0x0
+#define BLK_CLK_EN 0x4
+
+#define BLK_MAX_CLKS 4
+
+struct imx93_blk_ctrl_domain;
+
+struct imx93_blk_ctrl {
+ struct device *dev;
+ struct regmap *regmap;
+ int num_clks;
+ struct clk_bulk_data clks[BLK_MAX_CLKS];
+ struct imx93_blk_ctrl_domain *domains;
+ struct genpd_onecell_data onecell_data;
+};
+
+struct imx93_blk_ctrl_domain_data {
+ const char *name;
+ const char * const *clk_names;
+ int num_clks;
+ u32 rst_mask;
+ u32 clk_mask;
+
+};
+
+#define DOMAIN_MAX_CLKS 4
+
+struct imx93_blk_ctrl_domain {
+ struct generic_pm_domain genpd;
+ const struct imx93_blk_ctrl_domain_data *data;
+ struct clk_bulk_data clks[DOMAIN_MAX_CLKS];
+ struct imx93_blk_ctrl *bc;
+};
+
+struct imx93_blk_ctrl_data {
+ int max_reg;
+ const struct imx93_blk_ctrl_domain_data *domains;
+ const struct imx93_blk_ctrl_domain_data *bus;
+ int num_domains;
+};
+
+static const struct imx93_blk_ctrl_domain_data imx93_media_blk_ctl_bus_data = {
+ .clk_names = (const char *[]){ "axi", "apb", "nic", },
+ .num_clks = 3,
+};
+
+static inline struct imx93_blk_ctrl_domain *
+to_imx93_blk_ctrl_domain(struct generic_pm_domain *genpd)
+{
+ return container_of(genpd, struct imx93_blk_ctrl_domain, genpd);
+}
+
+static int imx93_blk_ctrl_power_on(struct generic_pm_domain *genpd)
+{
+ struct imx93_blk_ctrl_domain *domain = to_imx93_blk_ctrl_domain(genpd);
+ const struct imx93_blk_ctrl_domain_data *data = domain->data;
+ struct imx93_blk_ctrl *bc = domain->bc;
+ int ret;
+
+ ret = clk_bulk_prepare_enable(bc->num_clks, bc->clks);
+ if (ret) {
+ dev_err(bc->dev, "failed to enable bus clocks\n");
+ return ret;
+ }
+
+ ret = clk_bulk_prepare_enable(data->num_clks, domain->clks);
+ if (ret) {
+ dev_err(bc->dev, "failed to enable clocks\n");
+ return ret;
+ }
+
+ ret = pm_runtime_get_sync(bc->dev);
+ if (ret < 0) {
+ pm_runtime_put_noidle(bc->dev);
+ dev_err(bc->dev, "failed to power up domain\n");
+ goto disable_clk;
+ }
+
+ /* ungate clk */
+ regmap_clear_bits(bc->regmap, BLK_CLK_EN, data->clk_mask);
+
+ /* release reset */
+ regmap_set_bits(bc->regmap, BLK_SFT_RSTN, data->rst_mask);
+
+ dev_info(bc->dev, "pd_on: name: %s\n", genpd->name);
+
+ return 0;
+
+disable_clk:
+ clk_bulk_disable_unprepare(data->num_clks, domain->clks);
+
+ return ret;
+}
+
+static int imx93_blk_ctrl_power_off(struct generic_pm_domain *genpd)
+{
+ struct imx93_blk_ctrl_domain *domain = to_imx93_blk_ctrl_domain(genpd);
+ const struct imx93_blk_ctrl_domain_data *data = domain->data;
+ struct imx93_blk_ctrl *bc = domain->bc;
+
+ dev_info(bc->dev, "pd_off: name: %s\n", genpd->name);
+
+ regmap_clear_bits(bc->regmap, BLK_SFT_RSTN, data->rst_mask);
+ regmap_set_bits(bc->regmap, BLK_CLK_EN, data->clk_mask);
+
+ pm_runtime_put(bc->dev);
+
+ clk_bulk_disable_unprepare(data->num_clks, domain->clks);
+
+ clk_bulk_disable_unprepare(bc->num_clks, bc->clks);
+
+ return 0;
+}
+
+static struct generic_pm_domain *
+imx93_blk_ctrl_xlate(struct of_phandle_args *args, void *data)
+{
+ struct genpd_onecell_data *onecell_data = data;
+ unsigned int index = args->args[0];
+
+ if (args->args_count != 1 ||
+ index >= onecell_data->num_domains)
+ return ERR_PTR(-EINVAL);
+
+ return onecell_data->domains[index];
+}
+
+static int imx93_blk_ctrl_probe(struct platform_device *pdev)
+{
+ const struct imx93_blk_ctrl_data *bc_data;
+ struct device *dev = &pdev->dev;
+ struct imx93_blk_ctrl *bc;
+ void __iomem *base;
+ int i, ret;
+ const struct imx93_blk_ctrl_domain_data *bus;
+
+ struct regmap_config regmap_config = {
+ .reg_bits = 32,
+ .val_bits = 32,
+ .reg_stride = 4,
+ };
+
+ bc = devm_kzalloc(dev, sizeof(*bc), GFP_KERNEL);
+ if (!bc)
+ return -ENOMEM;
+
+ bc->dev = dev;
+
+ bc_data = of_device_get_match_data(dev);
+
+ base = devm_platform_ioremap_resource(pdev, 0);
+ if (IS_ERR(base))
+ return PTR_ERR(base);
+
+ regmap_config.max_register = bc_data->max_reg;
+ bc->regmap = devm_regmap_init_mmio(dev, base, ®map_config);
+ if (IS_ERR(bc->regmap))
+ return dev_err_probe(dev, PTR_ERR(bc->regmap),
+ "failed to init regmap\n");
+
+ bc->domains = devm_kcalloc(dev, bc_data->num_domains + 1,
+ sizeof(struct imx93_blk_ctrl_domain),
+ GFP_KERNEL);
+ if (!bc->domains)
+ return -ENOMEM;
+
+ bus = bc_data->bus;
+
+ bc->onecell_data.num_domains = bc_data->num_domains;
+ bc->onecell_data.xlate = imx93_blk_ctrl_xlate;
+ bc->onecell_data.domains =
+ devm_kcalloc(dev, bc_data->num_domains,
+ sizeof(struct generic_pm_domain *), GFP_KERNEL);
+ if (!bc->onecell_data.domains)
+ return -ENOMEM;
+
+ for (i = 0; i < bus->num_clks; i++)
+ bc->clks[i].id = bus->clk_names[i];
+ bc->num_clks = bus->num_clks;
+
+ ret = devm_clk_bulk_get(dev, bc->num_clks, bc->clks);
+ if (ret) {
+ dev_err_probe(dev, ret, "failed to get bus clock\n");
+ return ret;
+ }
+
+ for (i = 0; i < bc_data->num_domains; i++) {
+ const struct imx93_blk_ctrl_domain_data *data = &bc_data->domains[i];
+ struct imx93_blk_ctrl_domain *domain = &bc->domains[i];
+ int j;
+
+ domain->data = data;
+
+ for (j = 0; j < data->num_clks; j++)
+ domain->clks[j].id = data->clk_names[j];
+
+ ret = devm_clk_bulk_get(dev, data->num_clks, domain->clks);
+ if (ret) {
+ dev_err_probe(dev, ret, "failed to get clock\n");
+ goto cleanup_pds;
+ }
+
+ domain->genpd.name = data->name;
+ domain->genpd.power_on = imx93_blk_ctrl_power_on;
+ domain->genpd.power_off = imx93_blk_ctrl_power_off;
+ domain->bc = bc;
+
+ ret = pm_genpd_init(&domain->genpd, NULL, true);
+ if (ret) {
+ dev_err_probe(dev, ret, "failed to init power domain\n");
+ goto cleanup_pds;
+ }
+
+ bc->onecell_data.domains[i] = &domain->genpd;
+ }
+
+ pm_runtime_enable(dev);
+
+ ret = of_genpd_add_provider_onecell(dev->of_node, &bc->onecell_data);
+ if (ret) {
+ dev_err_probe(dev, ret, "failed to add power domain provider\n");
+ goto cleanup_pds;
+ }
+
+
+ dev_set_drvdata(dev, bc);
+
+ return 0;
+
+cleanup_pds:
+ for (i--; i >= 0; i--)
+ pm_genpd_remove(&bc->domains[i].genpd);
+
+ return ret;
+}
+
+static int imx93_blk_ctrl_remove(struct platform_device *pdev)
+{
+ struct imx93_blk_ctrl *bc = dev_get_drvdata(&pdev->dev);
+ int i;
+
+ of_genpd_del_provider(pdev->dev.of_node);
+
+ for (i = 0; bc->onecell_data.num_domains; i++) {
+ struct imx93_blk_ctrl_domain *domain = &bc->domains[i];
+
+ pm_genpd_remove(&domain->genpd);
+ }
+
+ return 0;
+}
+
+static const struct imx93_blk_ctrl_domain_data imx93_media_blk_ctl_domain_data[] = {
+ [IMX93_MEDIABLK_PD_MIPI_DSI] = {
+ .name = "mediablk-mipi-dsi",
+ .clk_names = (const char *[]){ "dsi" },
+ .num_clks = 1,
+ .rst_mask = BIT(11) | BIT(12),
+ .clk_mask = BIT(11) | BIT(12),
+ },
+ [IMX93_MEDIABLK_PD_MIPI_CSI] = {
+ .name = "mediablk-mipi-csi",
+ .clk_names = (const char *[]){ "cam", "csi" },
+ .num_clks = 2,
+ .rst_mask = BIT(9) | BIT(10),
+ .clk_mask = BIT(9) | BIT(10),
+ },
+ [IMX93_MEDIABLK_PD_PXP] = {
+ .name = "mediablk-pxp",
+ .clk_names = (const char *[]){ "pxp" },
+ .num_clks = 1,
+ .rst_mask = BIT(7) | BIT(8),
+ .clk_mask = BIT(7) | BIT(8),
+ },
+ [IMX93_MEDIABLK_PD_LCDIF] = {
+ .name = "mediablk-lcdif",
+ .clk_names = (const char *[]){ "disp", "lcdif" },
+ .num_clks = 2,
+ .rst_mask = BIT(4) | BIT(5) | BIT(6),
+ .clk_mask = BIT(4) | BIT(5) | BIT(6),
+ },
+ [IMX93_MEDIABLK_PD_ISI] = {
+ .name = "mediablk-isi",
+ .clk_names = (const char *[]){ "isi" },
+ .num_clks = 1,
+ .rst_mask = BIT(2) | BIT(3),
+ .clk_mask = BIT(2) | BIT(3),
+ },
+};
+
+static const struct imx93_blk_ctrl_data imx93_media_blk_ctl_dev_data = {
+ .max_reg = 0x90,
+ .domains = imx93_media_blk_ctl_domain_data,
+ .bus = &imx93_media_blk_ctl_bus_data,
+ .num_domains = ARRAY_SIZE(imx93_media_blk_ctl_domain_data),
+};
+
+static const struct of_device_id imx93_blk_ctrl_of_match[] = {
+ {
+ .compatible = "fsl,imx93-media-blk-ctrl",
+ .data = &imx93_media_blk_ctl_dev_data
+ }, {
+ /* Sentinel */
+ }
+};
+MODULE_DEVICE_TABLE(of, imx93_blk_ctrl_of_match);
+
+static struct platform_driver imx93_blk_ctrl_driver = {
+ .probe = imx93_blk_ctrl_probe,
+ .remove = imx93_blk_ctrl_remove,
+ .driver = {
+ .name = "imx93-blk-ctrl",
+ .of_match_table = imx93_blk_ctrl_of_match,
+ },
+};
+module_platform_driver(imx93_blk_ctrl_driver);
--
2.25.1
^ permalink raw reply related [flat|nested] 16+ messages in thread* [PATCH V4 6/7] arm64: dts: imx93: add src node
2022-06-09 12:50 [PATCH V4 0/7] imx: support i.MX93 SRC and mediamix blk ctrl Peng Fan (OSS)
` (4 preceding siblings ...)
2022-06-09 12:50 ` [PATCH V4 5/7] soc: imx: add i.MX93 media blk ctrl driver Peng Fan (OSS)
@ 2022-06-09 12:50 ` Peng Fan (OSS)
2022-06-09 12:51 ` [PATCH V4 7/7] arm64: dts: imx93: add mediamix blk ctrl node Peng Fan (OSS)
6 siblings, 0 replies; 16+ messages in thread
From: Peng Fan (OSS) @ 2022-06-09 12:50 UTC (permalink / raw)
To: robh+dt, krzysztof.kozlowski+dt, sboyd, mturquette, shawnguo,
s.hauer
Cc: aisheng.dong, l.stach, kernel, festevam, linux-imx, devicetree,
linux-kernel, linux-arm-kernel, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
Add i.MX93 SRC node
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
arch/arm64/boot/dts/freescale/imx93.dtsi | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/arch/arm64/boot/dts/freescale/imx93.dtsi b/arch/arm64/boot/dts/freescale/imx93.dtsi
index f83a07c7c9b1..8f0658e95e0d 100644
--- a/arch/arm64/boot/dts/freescale/imx93.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx93.dtsi
@@ -7,6 +7,7 @@
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/power/fsl,imx93-power.h>
#include "imx93-pinfunc.h"
@@ -161,6 +162,23 @@ clk: clock-controller@44450000 {
status = "okay";
};
+ src: system-controller@44460000 {
+ compatible = "fsl,imx93-src", "syscon";
+ reg = <0x44460000 0x10000>;
+
+ slices {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ mediamix: power-domain@0 {
+ reg = <IMX93_POWER_DOMAIN_MEDIAMIX>;
+ #power-domain-cells = <0>;
+ clocks = <&clk IMX93_CLK_MEDIA_AXI>,
+ <&clk IMX93_CLK_MEDIA_APB>;
+ };
+ };
+ };
+
anatop: anatop@44480000 {
compatible = "fsl,imx93-anatop", "syscon";
reg = <0x44480000 0x10000>;
--
2.25.1
^ permalink raw reply related [flat|nested] 16+ messages in thread* [PATCH V4 7/7] arm64: dts: imx93: add mediamix blk ctrl node
2022-06-09 12:50 [PATCH V4 0/7] imx: support i.MX93 SRC and mediamix blk ctrl Peng Fan (OSS)
` (5 preceding siblings ...)
2022-06-09 12:50 ` [PATCH V4 6/7] arm64: dts: imx93: add src node Peng Fan (OSS)
@ 2022-06-09 12:51 ` Peng Fan (OSS)
6 siblings, 0 replies; 16+ messages in thread
From: Peng Fan (OSS) @ 2022-06-09 12:51 UTC (permalink / raw)
To: robh+dt, krzysztof.kozlowski+dt, sboyd, mturquette, shawnguo,
s.hauer
Cc: aisheng.dong, l.stach, kernel, festevam, linux-imx, devicetree,
linux-kernel, linux-arm-kernel, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
Add i.MX93 mediamix blk ctrl node
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
arch/arm64/boot/dts/freescale/imx93.dtsi | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/arch/arm64/boot/dts/freescale/imx93.dtsi b/arch/arm64/boot/dts/freescale/imx93.dtsi
index 8f0658e95e0d..bcc8fd296bb9 100644
--- a/arch/arm64/boot/dts/freescale/imx93.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx93.dtsi
@@ -348,5 +348,25 @@ gpio1: gpio@47400080 {
#interrupt-cells = <2>;
gpio-ranges = <&iomuxc 0 0 32>;
};
+
+ media_blk_ctrl: power-controller@4ac10000 {
+ compatible = "fsl,imx93-media-blk-ctrl", "syscon";
+ reg = <0x4ac10000 0x10000>;
+ power-domains = <&mediamix>;
+ clocks = <&clk IMX93_CLK_MEDIA_APB>,
+ <&clk IMX93_CLK_MEDIA_AXI>,
+ <&clk IMX93_CLK_NIC_MEDIA_GATE>,
+ <&clk IMX93_CLK_MEDIA_DISP_PIX>,
+ <&clk IMX93_CLK_CAM_PIX>,
+ <&clk IMX93_CLK_PXP_GATE>,
+ <&clk IMX93_CLK_LCDIF_GATE>,
+ <&clk IMX93_CLK_ISI_GATE>,
+ <&clk IMX93_CLK_MIPI_CSI_GATE>,
+ <&clk IMX93_CLK_MIPI_DSI_GATE>;
+ clock-names = "apb", "axi", "nic", "disp", "cam",
+ "pxp", "lcdif", "isi", "csi", "dsi";
+ #power-domain-cells = <1>;
+ status = "disabled";
+ };
};
};
--
2.25.1
^ permalink raw reply related [flat|nested] 16+ messages in thread