mbox series

[V4,0/7] imx: support i.MX93 SRC and mediamix blk ctrl

Message ID 20220609125100.3496633-1-peng.fan@oss.nxp.com
Headers show
Series imx: support i.MX93 SRC and mediamix blk ctrl | expand

Message

Peng Fan (OSS) June 9, 2022, 12:50 p.m. UTC
From: Peng Fan <peng.fan@nxp.com>

V4:
 Correct including fsl,imx93-power.h, not imx93-power.h in driver

V3:
  Move src yaml to power directory.
  Update slice name to slices

V2:
  yaml fix

This patchset is to support i.MX93 SRC and mediamix blk ctrl.
SRC functions as power domain provider as i.MX8M GPC.
mediamix blk ctrl is similar with i.MX8M blk ctrl, but much simplier from
software view.

Export of_clk_bulk_get_all for driver usage.

Add bindings and dts node

Based on:
https://patchwork.kernel.org/project/linux-arm-kernel/cover/20220510124050.398891-1-peng.fan@oss.nxp.com/

Peng Fan (7):
  dt-bindings: soc: add i.MX93 SRC
  dt-bindings: soc: add i.MX93 mediamix blk ctrl
  clk: export of_clk_bulk_get_all
  soc: imx: add i.MX93 SRC power domain driver
  soc: imx: add i.MX93 media blk ctrl driver
  arm64: dts: imx93: add src node
  arm64: dts: imx93: add mediamix blk ctrl node

 .../bindings/power/fsl,imx93-src.yaml         |  96 +++++
 .../soc/imx/fsl,imx93-media-blk-ctrl.yaml     |  80 +++++
 arch/arm64/boot/dts/freescale/imx93.dtsi      |  38 ++
 drivers/clk/clk-bulk.c                        |   3 +-
 drivers/soc/imx/Kconfig                       |  10 +
 drivers/soc/imx/Makefile                      |   1 +
 drivers/soc/imx/imx93-blk-ctrl.c              | 333 ++++++++++++++++++
 drivers/soc/imx/imx93-pd.c                    | 271 ++++++++++++++
 include/dt-bindings/power/fsl,imx93-power.h   |  17 +
 include/linux/clk.h                           |   2 +
 10 files changed, 850 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/power/fsl,imx93-src.yaml
 create mode 100644 Documentation/devicetree/bindings/soc/imx/fsl,imx93-media-blk-ctrl.yaml
 create mode 100644 drivers/soc/imx/imx93-blk-ctrl.c
 create mode 100644 drivers/soc/imx/imx93-pd.c
 create mode 100644 include/dt-bindings/power/fsl,imx93-power.h

Comments

Rob Herring June 14, 2022, 9:39 p.m. UTC | #1
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
> 
>
Peng Fan (OSS) July 4, 2022, 1:05 a.m. UTC | #2
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