diff mbox series

[v5,4/4] dt-bindings: dsp: fsl: update binding document for remote proc driver

Message ID 1632625630-784-5-git-send-email-shengjiu.wang@nxp.com (mailing list archive)
State New, archived
Headers show
Series Add remoteproc driver for DSP on i.MX | expand

Commit Message

Shengjiu Wang Sept. 26, 2021, 3:07 a.m. UTC
As there are two drivers for DSP on i.MX, one is for sound open
firmware, another is for remote processor framework. In order to
distinguish two kinds of driver, defining different compatible strings.

For remote proc driver, the properties firmware-name and fsl,dsp-ctrl
are needed and the mailbox channel is different with SOF.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Acked-by: Daniel Baluta <daniel.baluta@nxp.com>
---
 .../devicetree/bindings/dsp/fsl,dsp.yaml      | 81 +++++++++++++++++--
 1 file changed, 75 insertions(+), 6 deletions(-)

Comments

Rob Herring Sept. 29, 2021, 10:40 p.m. UTC | #1
On Sun, Sep 26, 2021 at 11:07:10AM +0800, Shengjiu Wang wrote:
> As there are two drivers for DSP on i.MX, one is for sound open
> firmware, another is for remote processor framework. In order to
> distinguish two kinds of driver, defining different compatible strings.
> 
> For remote proc driver, the properties firmware-name and fsl,dsp-ctrl
> are needed and the mailbox channel is different with SOF.
> 
> Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
> Acked-by: Daniel Baluta <daniel.baluta@nxp.com>
> ---
>  .../devicetree/bindings/dsp/fsl,dsp.yaml      | 81 +++++++++++++++++--
>  1 file changed, 75 insertions(+), 6 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml b/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml
> index 7afc9f2be13a..51ea657f6d42 100644
> --- a/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml
> +++ b/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml
> @@ -8,6 +8,7 @@ title: NXP i.MX8 DSP core
>  
>  maintainers:
>    - Daniel Baluta <daniel.baluta@nxp.com>
> +  - Shengjiu Wang <shengjiu.wang@nxp.com>
>  
>  description: |
>    Some boards from i.MX8 family contain a DSP core used for
> @@ -19,6 +20,10 @@ properties:
>        - fsl,imx8qxp-dsp
>        - fsl,imx8qm-dsp
>        - fsl,imx8mp-dsp
> +      - fsl,imx8qxp-hifi4
> +      - fsl,imx8qm-hifi4
> +      - fsl,imx8mp-hifi4
> +      - fsl,imx8ulp-hifi4
>  
>    reg:
>      maxItems: 1
> @@ -28,37 +33,63 @@ properties:
>        - description: ipg clock
>        - description: ocram clock
>        - description: core clock
> +      - description: debug interface clock
> +      - description: message unit clock
> +    minItems: 3
> +    maxItems: 5

Don't need maxItems.

>  
>    clock-names:
>      items:
>        - const: ipg
>        - const: ocram
>        - const: core
> +      - const: debug
> +      - const: mu
> +    minItems: 3
> +    maxItems: 5

ditto

>  
>    power-domains:
>      description:
>        List of phandle and PM domain specifier as documented in
>        Documentation/devicetree/bindings/power/power_domain.txt
> +    minItems: 1

This is curious. The h/w sometimes has fewer power domains?

>      maxItems: 4
>  
>    mboxes:
>      description:
>        List of <&phandle type channel> - 2 channels for TXDB, 2 channels for RXDB
> +      or - 1 channel for TX, 1 channel for RX, 1 channel for RXDB
>        (see mailbox/fsl,mu.txt)
> +    minItems: 3
>      maxItems: 4
>  
>    mbox-names:
> -    items:
> -      - const: txdb0
> -      - const: txdb1
> -      - const: rxdb0
> -      - const: rxdb1
> +    oneOf:
> +      - items:
> +          - const: txdb0
> +          - const: txdb1
> +          - const: rxdb0
> +          - const: rxdb1
> +      - items:
> +          - const: tx
> +          - const: rx
> +          - const: rxdb
>  
>    memory-region:
>      description:
>        phandle to a node describing reserved memory (System RAM memory)
>        used by DSP (see bindings/reserved-memory/reserved-memory.txt)
> -    maxItems: 1
> +    minItems: 1
> +    maxItems: 4
> +
> +  firmware-name:
> +    description: |
> +      Default name of the firmware to load to the remote processor.
> +
> +  fsl,dsp-ctrl:
> +    $ref: /schemas/types.yaml#/definitions/phandle
> +    description:
> +      Phandle to syscon block which provide access for processor enablement
>  
>  required:
>    - compatible
> @@ -91,3 +122,41 @@ examples:
>          mboxes = <&lsio_mu13 2 0>, <&lsio_mu13 2 1>, <&lsio_mu13 3 0>, <&lsio_mu13 3 1>;
>          memory-region = <&dsp_reserved>;
>      };
> +  - |
> +    #include <dt-bindings/clock/imx8mp-clock.h>
> +    dsp_reserved: dsp@92400000 {
> +      reg = <0x92400000 0x1000000>;
> +      no-map;
> +    };
> +    dsp_vdev0vring0: vdev0vring0@942f0000 {
> +      reg = <0x942f0000 0x8000>;
> +      no-map;
> +    };
> +    dsp_vdev0vring1: vdev0vring1@942f8000 {
> +      reg = <0x942f8000 0x8000>;
> +      no-map;
> +    };
> +    dsp_vdev0buffer: vdev0buffer@94300000 {
> +      compatible = "shared-dma-pool";
> +      reg = <0x94300000 0x100000>;
> +      no-map;
> +    };
> +
> +    dsp: dsp@3b6e8000 {
> +      compatible = "fsl,imx8mp-hifi4";
> +      reg = <0x3B6E8000 0x88000>;
> +      clocks = <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_DSP_ROOT>,
> +               <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_OCRAMA_IPG>,
> +               <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_DSP_ROOT>,
> +               <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_DSPDBG_ROOT>;
> +      clock-names = "ipg", "ocram", "core", "debug";
> +      firmware-name = "imx/dsp/hifi4.bin";
> +      power-domains = <&audiomix_pd>;
> +      mbox-names = "tx", "rx", "rxdb";
> +      mboxes = <&mu2 0 0>,
> +               <&mu2 1 0>,
> +               <&mu2 3 0>;
> +      memory-region = <&dsp_vdev0buffer>, <&dsp_vdev0vring0>,
> +                      <&dsp_vdev0vring1>, <&dsp_reserved>;
> +      fsl,dsp-ctrl = <&audio_blk_ctrl>;
> +    };
> -- 
> 2.17.1
> 
>
Shengjiu Wang Sept. 30, 2021, 2:34 a.m. UTC | #2
Hi Rob

On Thu, Sep 30, 2021 at 6:40 AM Rob Herring <robh@kernel.org> wrote:
>
> On Sun, Sep 26, 2021 at 11:07:10AM +0800, Shengjiu Wang wrote:
> > As there are two drivers for DSP on i.MX, one is for sound open
> > firmware, another is for remote processor framework. In order to
> > distinguish two kinds of driver, defining different compatible strings.
> >
> > For remote proc driver, the properties firmware-name and fsl,dsp-ctrl
> > are needed and the mailbox channel is different with SOF.
> >
> > Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
> > Acked-by: Daniel Baluta <daniel.baluta@nxp.com>
> > ---
> >  .../devicetree/bindings/dsp/fsl,dsp.yaml      | 81 +++++++++++++++++--
> >  1 file changed, 75 insertions(+), 6 deletions(-)
> >
> > diff --git a/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml b/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml
> > index 7afc9f2be13a..51ea657f6d42 100644
> > --- a/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml
> > +++ b/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml
> > @@ -8,6 +8,7 @@ title: NXP i.MX8 DSP core
> >
> >  maintainers:
> >    - Daniel Baluta <daniel.baluta@nxp.com>
> > +  - Shengjiu Wang <shengjiu.wang@nxp.com>
> >
> >  description: |
> >    Some boards from i.MX8 family contain a DSP core used for
> > @@ -19,6 +20,10 @@ properties:
> >        - fsl,imx8qxp-dsp
> >        - fsl,imx8qm-dsp
> >        - fsl,imx8mp-dsp
> > +      - fsl,imx8qxp-hifi4
> > +      - fsl,imx8qm-hifi4
> > +      - fsl,imx8mp-hifi4
> > +      - fsl,imx8ulp-hifi4
> >
> >    reg:
> >      maxItems: 1
> > @@ -28,37 +33,63 @@ properties:
> >        - description: ipg clock
> >        - description: ocram clock
> >        - description: core clock
> > +      - description: debug interface clock
> > +      - description: message unit clock
> > +    minItems: 3
> > +    maxItems: 5
>
> Don't need maxItems.

Ok, I will update it.

>
> >
> >    clock-names:
> >      items:
> >        - const: ipg
> >        - const: ocram
> >        - const: core
> > +      - const: debug
> > +      - const: mu
> > +    minItems: 3
> > +    maxItems: 5
>
> ditto

Ok, I will update it.

>
> >
> >    power-domains:
> >      description:
> >        List of phandle and PM domain specifier as documented in
> >        Documentation/devicetree/bindings/power/power_domain.txt
> > +    minItems: 1
>
> This is curious. The h/w sometimes has fewer power domains?

On i.MX8QM/8QXP,  there are independent power domains for DSP core,
DSP's RAM and DSP's MU.
But on i.MX8MP, all these DSP components are in same audio subsystem
There is only one power domain for whole audio subsystem,  when
power on audio subsystem, the DSP's components are powered on also.

So the number of power domain depends on how the DSP component
integrated in SoC.

Best regards
Wang Shengjiu
Rob Herring Oct. 1, 2021, 4:40 p.m. UTC | #3
On Wed, Sep 29, 2021 at 9:34 PM Shengjiu Wang <shengjiu.wang@gmail.com> wrote:
>
> Hi Rob
>
> On Thu, Sep 30, 2021 at 6:40 AM Rob Herring <robh@kernel.org> wrote:
> >
> > On Sun, Sep 26, 2021 at 11:07:10AM +0800, Shengjiu Wang wrote:
> > > As there are two drivers for DSP on i.MX, one is for sound open
> > > firmware, another is for remote processor framework. In order to
> > > distinguish two kinds of driver, defining different compatible strings.
> > >
> > > For remote proc driver, the properties firmware-name and fsl,dsp-ctrl
> > > are needed and the mailbox channel is different with SOF.
> > >
> > > Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
> > > Acked-by: Daniel Baluta <daniel.baluta@nxp.com>
> > > ---
> > >  .../devicetree/bindings/dsp/fsl,dsp.yaml      | 81 +++++++++++++++++--
> > >  1 file changed, 75 insertions(+), 6 deletions(-)
> > >
> > > diff --git a/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml b/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml
> > > index 7afc9f2be13a..51ea657f6d42 100644
> > > --- a/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml
> > > +++ b/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml
> > > @@ -8,6 +8,7 @@ title: NXP i.MX8 DSP core
> > >
> > >  maintainers:
> > >    - Daniel Baluta <daniel.baluta@nxp.com>
> > > +  - Shengjiu Wang <shengjiu.wang@nxp.com>
> > >
> > >  description: |
> > >    Some boards from i.MX8 family contain a DSP core used for
> > > @@ -19,6 +20,10 @@ properties:
> > >        - fsl,imx8qxp-dsp
> > >        - fsl,imx8qm-dsp
> > >        - fsl,imx8mp-dsp
> > > +      - fsl,imx8qxp-hifi4
> > > +      - fsl,imx8qm-hifi4
> > > +      - fsl,imx8mp-hifi4
> > > +      - fsl,imx8ulp-hifi4
> > >
> > >    reg:
> > >      maxItems: 1
> > > @@ -28,37 +33,63 @@ properties:
> > >        - description: ipg clock
> > >        - description: ocram clock
> > >        - description: core clock
> > > +      - description: debug interface clock
> > > +      - description: message unit clock
> > > +    minItems: 3
> > > +    maxItems: 5
> >
> > Don't need maxItems.
>
> Ok, I will update it.
>
> >
> > >
> > >    clock-names:
> > >      items:
> > >        - const: ipg
> > >        - const: ocram
> > >        - const: core
> > > +      - const: debug
> > > +      - const: mu
> > > +    minItems: 3
> > > +    maxItems: 5
> >
> > ditto
>
> Ok, I will update it.
>
> >
> > >
> > >    power-domains:
> > >      description:
> > >        List of phandle and PM domain specifier as documented in
> > >        Documentation/devicetree/bindings/power/power_domain.txt
> > > +    minItems: 1
> >
> > This is curious. The h/w sometimes has fewer power domains?
>
> On i.MX8QM/8QXP,  there are independent power domains for DSP core,
> DSP's RAM and DSP's MU.
> But on i.MX8MP, all these DSP components are in same audio subsystem
> There is only one power domain for whole audio subsystem,  when
> power on audio subsystem, the DSP's components are powered on also.
>
> So the number of power domain depends on how the DSP component
> integrated in SoC.

Sounds like you can write an if/then schema for this difference.

Rob
Shengjiu Wang Oct. 8, 2021, 4:12 a.m. UTC | #4
Hi Rob

On Sat, Oct 2, 2021 at 12:40 AM Rob Herring <robh@kernel.org> wrote:
>
> On Wed, Sep 29, 2021 at 9:34 PM Shengjiu Wang <shengjiu.wang@gmail.com> wrote:
> >
> > Hi Rob
> >
> > On Thu, Sep 30, 2021 at 6:40 AM Rob Herring <robh@kernel.org> wrote:
> > >
> > > On Sun, Sep 26, 2021 at 11:07:10AM +0800, Shengjiu Wang wrote:
> > > > As there are two drivers for DSP on i.MX, one is for sound open
> > > > firmware, another is for remote processor framework. In order to
> > > > distinguish two kinds of driver, defining different compatible strings.
> > > >
> > > > For remote proc driver, the properties firmware-name and fsl,dsp-ctrl
> > > > are needed and the mailbox channel is different with SOF.
> > > >
> > > > Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
> > > > Acked-by: Daniel Baluta <daniel.baluta@nxp.com>
> > > > ---
> > > >  .../devicetree/bindings/dsp/fsl,dsp.yaml      | 81 +++++++++++++++++--
> > > >  1 file changed, 75 insertions(+), 6 deletions(-)
> > > >
> > > > diff --git a/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml b/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml
> > > > index 7afc9f2be13a..51ea657f6d42 100644
> > > > --- a/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml
> > > > +++ b/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml
> > > > @@ -8,6 +8,7 @@ title: NXP i.MX8 DSP core
> > > >
> > > >  maintainers:
> > > >    - Daniel Baluta <daniel.baluta@nxp.com>
> > > > +  - Shengjiu Wang <shengjiu.wang@nxp.com>
> > > >
> > > >  description: |
> > > >    Some boards from i.MX8 family contain a DSP core used for
> > > > @@ -19,6 +20,10 @@ properties:
> > > >        - fsl,imx8qxp-dsp
> > > >        - fsl,imx8qm-dsp
> > > >        - fsl,imx8mp-dsp
> > > > +      - fsl,imx8qxp-hifi4
> > > > +      - fsl,imx8qm-hifi4
> > > > +      - fsl,imx8mp-hifi4
> > > > +      - fsl,imx8ulp-hifi4
> > > >
> > > >    reg:
> > > >      maxItems: 1
> > > > @@ -28,37 +33,63 @@ properties:
> > > >        - description: ipg clock
> > > >        - description: ocram clock
> > > >        - description: core clock
> > > > +      - description: debug interface clock
> > > > +      - description: message unit clock
> > > > +    minItems: 3
> > > > +    maxItems: 5
> > >
> > > Don't need maxItems.
> >
> > Ok, I will update it.
> >
> > >
> > > >
> > > >    clock-names:
> > > >      items:
> > > >        - const: ipg
> > > >        - const: ocram
> > > >        - const: core
> > > > +      - const: debug
> > > > +      - const: mu
> > > > +    minItems: 3
> > > > +    maxItems: 5
> > >
> > > ditto
> >
> > Ok, I will update it.
> >
> > >
> > > >
> > > >    power-domains:
> > > >      description:
> > > >        List of phandle and PM domain specifier as documented in
> > > >        Documentation/devicetree/bindings/power/power_domain.txt
> > > > +    minItems: 1
> > >
> > > This is curious. The h/w sometimes has fewer power domains?
> >
> > On i.MX8QM/8QXP,  there are independent power domains for DSP core,
> > DSP's RAM and DSP's MU.
> > But on i.MX8MP, all these DSP components are in same audio subsystem
> > There is only one power domain for whole audio subsystem,  when
> > power on audio subsystem, the DSP's components are powered on also.
> >
> > So the number of power domain depends on how the DSP component
> > integrated in SoC.
>
> Sounds like you can write an if/then schema for this difference.
>

I try this:

allOf:
  - if:
      properties:
        compatible:
          contains:
            enum:
              - fsl,imx8mp-hifi4
              - fsl,imx8mp-dsp

    then:
      properties:
        power-domains:
          maxItems: 1

    else:
      properties:
        power-domains:
          maxItems: 4


But the dt_binding_check report error:
  DTEX    Documentation/devicetree/bindings/dsp/fsl,dsp.example.dts
  DTC     Documentation/devicetree/bindings/dsp/fsl,dsp.example.dt.yaml
  CHECK   Documentation/devicetree/bindings/dsp/fsl,dsp.example.dt.yaml
/opt/alsa/sound/Documentation/devicetree/bindings/dsp/fsl,dsp.example.dt.yaml:
dsp@3b6e8000: power-domains: [[4294967295]] is too short
        From schema:
/opt/alsa/sound/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml

I don't know the reason, could you please help to have a look what
is wrong?

Best regards
Wang Shengjiu
Shengjiu Wang Oct. 8, 2021, 7:19 a.m. UTC | #5
On Fri, Oct 8, 2021 at 12:12 PM Shengjiu Wang <shengjiu.wang@gmail.com> wrote:
>
> Hi Rob
>
> On Sat, Oct 2, 2021 at 12:40 AM Rob Herring <robh@kernel.org> wrote:
> >
> > On Wed, Sep 29, 2021 at 9:34 PM Shengjiu Wang <shengjiu.wang@gmail.com> wrote:
> > >
> > > Hi Rob
> > >
> > > On Thu, Sep 30, 2021 at 6:40 AM Rob Herring <robh@kernel.org> wrote:
> > > >
> > > > On Sun, Sep 26, 2021 at 11:07:10AM +0800, Shengjiu Wang wrote:
> > > > > As there are two drivers for DSP on i.MX, one is for sound open
> > > > > firmware, another is for remote processor framework. In order to
> > > > > distinguish two kinds of driver, defining different compatible strings.
> > > > >
> > > > > For remote proc driver, the properties firmware-name and fsl,dsp-ctrl
> > > > > are needed and the mailbox channel is different with SOF.
> > > > >
> > > > > Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
> > > > > Acked-by: Daniel Baluta <daniel.baluta@nxp.com>
> > > > > ---
> > > > >  .../devicetree/bindings/dsp/fsl,dsp.yaml      | 81 +++++++++++++++++--
> > > > >  1 file changed, 75 insertions(+), 6 deletions(-)
> > > > >
> > > > > diff --git a/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml b/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml
> > > > > index 7afc9f2be13a..51ea657f6d42 100644
> > > > > --- a/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml
> > > > > +++ b/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml
> > > > > @@ -8,6 +8,7 @@ title: NXP i.MX8 DSP core
> > > > >
> > > > >  maintainers:
> > > > >    - Daniel Baluta <daniel.baluta@nxp.com>
> > > > > +  - Shengjiu Wang <shengjiu.wang@nxp.com>
> > > > >
> > > > >  description: |
> > > > >    Some boards from i.MX8 family contain a DSP core used for
> > > > > @@ -19,6 +20,10 @@ properties:
> > > > >        - fsl,imx8qxp-dsp
> > > > >        - fsl,imx8qm-dsp
> > > > >        - fsl,imx8mp-dsp
> > > > > +      - fsl,imx8qxp-hifi4
> > > > > +      - fsl,imx8qm-hifi4
> > > > > +      - fsl,imx8mp-hifi4
> > > > > +      - fsl,imx8ulp-hifi4
> > > > >
> > > > >    reg:
> > > > >      maxItems: 1
> > > > > @@ -28,37 +33,63 @@ properties:
> > > > >        - description: ipg clock
> > > > >        - description: ocram clock
> > > > >        - description: core clock
> > > > > +      - description: debug interface clock
> > > > > +      - description: message unit clock
> > > > > +    minItems: 3
> > > > > +    maxItems: 5
> > > >
> > > > Don't need maxItems.
> > >
> > > Ok, I will update it.
> > >
> > > >
> > > > >
> > > > >    clock-names:
> > > > >      items:
> > > > >        - const: ipg
> > > > >        - const: ocram
> > > > >        - const: core
> > > > > +      - const: debug
> > > > > +      - const: mu
> > > > > +    minItems: 3
> > > > > +    maxItems: 5
> > > >
> > > > ditto
> > >
> > > Ok, I will update it.
> > >
> > > >
> > > > >
> > > > >    power-domains:
> > > > >      description:
> > > > >        List of phandle and PM domain specifier as documented in
> > > > >        Documentation/devicetree/bindings/power/power_domain.txt
> > > > > +    minItems: 1
> > > >
> > > > This is curious. The h/w sometimes has fewer power domains?
> > >
> > > On i.MX8QM/8QXP,  there are independent power domains for DSP core,
> > > DSP's RAM and DSP's MU.
> > > But on i.MX8MP, all these DSP components are in same audio subsystem
> > > There is only one power domain for whole audio subsystem,  when
> > > power on audio subsystem, the DSP's components are powered on also.
> > >
> > > So the number of power domain depends on how the DSP component
> > > integrated in SoC.
> >
> > Sounds like you can write an if/then schema for this difference.
> >
>
> I try this:
>
> allOf:
>   - if:
>       properties:
>         compatible:
>           contains:
>             enum:
>               - fsl,imx8mp-hifi4
>               - fsl,imx8mp-dsp
>
>     then:
>       properties:
>         power-domains:
>           maxItems: 1
>
>     else:
>       properties:
>         power-domains:
>           maxItems: 4
>
>
> But the dt_binding_check report error:
>   DTEX    Documentation/devicetree/bindings/dsp/fsl,dsp.example.dts
>   DTC     Documentation/devicetree/bindings/dsp/fsl,dsp.example.dt.yaml
>   CHECK   Documentation/devicetree/bindings/dsp/fsl,dsp.example.dt.yaml
> /opt/alsa/sound/Documentation/devicetree/bindings/dsp/fsl,dsp.example.dt.yaml:
> dsp@3b6e8000: power-domains: [[4294967295]] is too short
>         From schema:
> /opt/alsa/sound/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml
>
> I don't know the reason, could you please help to have a look what
> is wrong?

Seems still need to add "minItems" in original power-domains besides
if/then schema. otherwise the dt_binding_check report above
error.

Best Regards
Wang Shengjiu
Rob Herring Oct. 8, 2021, 7:26 p.m. UTC | #6
On Fri, Oct 8, 2021 at 2:19 AM Shengjiu Wang <shengjiu.wang@gmail.com> wrote:
>
> On Fri, Oct 8, 2021 at 12:12 PM Shengjiu Wang <shengjiu.wang@gmail.com> wrote:
> >
> > Hi Rob
> >
> > On Sat, Oct 2, 2021 at 12:40 AM Rob Herring <robh@kernel.org> wrote:
> > >
> > > On Wed, Sep 29, 2021 at 9:34 PM Shengjiu Wang <shengjiu.wang@gmail.com> wrote:
> > > >
> > > > Hi Rob
> > > >
> > > > On Thu, Sep 30, 2021 at 6:40 AM Rob Herring <robh@kernel.org> wrote:
> > > > >
> > > > > On Sun, Sep 26, 2021 at 11:07:10AM +0800, Shengjiu Wang wrote:
> > > > > > As there are two drivers for DSP on i.MX, one is for sound open
> > > > > > firmware, another is for remote processor framework. In order to
> > > > > > distinguish two kinds of driver, defining different compatible strings.
> > > > > >
> > > > > > For remote proc driver, the properties firmware-name and fsl,dsp-ctrl
> > > > > > are needed and the mailbox channel is different with SOF.
> > > > > >
> > > > > > Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
> > > > > > Acked-by: Daniel Baluta <daniel.baluta@nxp.com>
> > > > > > ---
> > > > > >  .../devicetree/bindings/dsp/fsl,dsp.yaml      | 81 +++++++++++++++++--
> > > > > >  1 file changed, 75 insertions(+), 6 deletions(-)
> > > > > >
> > > > > > diff --git a/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml b/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml
> > > > > > index 7afc9f2be13a..51ea657f6d42 100644
> > > > > > --- a/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml
> > > > > > +++ b/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml
> > > > > > @@ -8,6 +8,7 @@ title: NXP i.MX8 DSP core
> > > > > >
> > > > > >  maintainers:
> > > > > >    - Daniel Baluta <daniel.baluta@nxp.com>
> > > > > > +  - Shengjiu Wang <shengjiu.wang@nxp.com>
> > > > > >
> > > > > >  description: |
> > > > > >    Some boards from i.MX8 family contain a DSP core used for
> > > > > > @@ -19,6 +20,10 @@ properties:
> > > > > >        - fsl,imx8qxp-dsp
> > > > > >        - fsl,imx8qm-dsp
> > > > > >        - fsl,imx8mp-dsp
> > > > > > +      - fsl,imx8qxp-hifi4
> > > > > > +      - fsl,imx8qm-hifi4
> > > > > > +      - fsl,imx8mp-hifi4
> > > > > > +      - fsl,imx8ulp-hifi4
> > > > > >
> > > > > >    reg:
> > > > > >      maxItems: 1
> > > > > > @@ -28,37 +33,63 @@ properties:
> > > > > >        - description: ipg clock
> > > > > >        - description: ocram clock
> > > > > >        - description: core clock
> > > > > > +      - description: debug interface clock
> > > > > > +      - description: message unit clock
> > > > > > +    minItems: 3
> > > > > > +    maxItems: 5
> > > > >
> > > > > Don't need maxItems.
> > > >
> > > > Ok, I will update it.
> > > >
> > > > >
> > > > > >
> > > > > >    clock-names:
> > > > > >      items:
> > > > > >        - const: ipg
> > > > > >        - const: ocram
> > > > > >        - const: core
> > > > > > +      - const: debug
> > > > > > +      - const: mu
> > > > > > +    minItems: 3
> > > > > > +    maxItems: 5
> > > > >
> > > > > ditto
> > > >
> > > > Ok, I will update it.
> > > >
> > > > >
> > > > > >
> > > > > >    power-domains:
> > > > > >      description:
> > > > > >        List of phandle and PM domain specifier as documented in
> > > > > >        Documentation/devicetree/bindings/power/power_domain.txt
> > > > > > +    minItems: 1
> > > > >
> > > > > This is curious. The h/w sometimes has fewer power domains?
> > > >
> > > > On i.MX8QM/8QXP,  there are independent power domains for DSP core,
> > > > DSP's RAM and DSP's MU.
> > > > But on i.MX8MP, all these DSP components are in same audio subsystem
> > > > There is only one power domain for whole audio subsystem,  when
> > > > power on audio subsystem, the DSP's components are powered on also.
> > > >
> > > > So the number of power domain depends on how the DSP component
> > > > integrated in SoC.
> > >
> > > Sounds like you can write an if/then schema for this difference.
> > >
> >
> > I try this:
> >
> > allOf:
> >   - if:
> >       properties:
> >         compatible:
> >           contains:
> >             enum:
> >               - fsl,imx8mp-hifi4
> >               - fsl,imx8mp-dsp
> >
> >     then:
> >       properties:
> >         power-domains:
> >           maxItems: 1
> >
> >     else:
> >       properties:
> >         power-domains:
> >           maxItems: 4
> >
> >
> > But the dt_binding_check report error:
> >   DTEX    Documentation/devicetree/bindings/dsp/fsl,dsp.example.dts
> >   DTC     Documentation/devicetree/bindings/dsp/fsl,dsp.example.dt.yaml
> >   CHECK   Documentation/devicetree/bindings/dsp/fsl,dsp.example.dt.yaml
> > /opt/alsa/sound/Documentation/devicetree/bindings/dsp/fsl,dsp.example.dt.yaml:
> > dsp@3b6e8000: power-domains: [[4294967295]] is too short
> >         From schema:
> > /opt/alsa/sound/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml
> >
> > I don't know the reason, could you please help to have a look what
> > is wrong?
>
> Seems still need to add "minItems" in original power-domains besides
> if/then schema. otherwise the dt_binding_check report above
> error.

Yes, that's right. The main section has to pass for all cases, so you
need the maximum range (1-4 items).

Rob
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml b/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml
index 7afc9f2be13a..51ea657f6d42 100644
--- a/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml
+++ b/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml
@@ -8,6 +8,7 @@  title: NXP i.MX8 DSP core
 
 maintainers:
   - Daniel Baluta <daniel.baluta@nxp.com>
+  - Shengjiu Wang <shengjiu.wang@nxp.com>
 
 description: |
   Some boards from i.MX8 family contain a DSP core used for
@@ -19,6 +20,10 @@  properties:
       - fsl,imx8qxp-dsp
       - fsl,imx8qm-dsp
       - fsl,imx8mp-dsp
+      - fsl,imx8qxp-hifi4
+      - fsl,imx8qm-hifi4
+      - fsl,imx8mp-hifi4
+      - fsl,imx8ulp-hifi4
 
   reg:
     maxItems: 1
@@ -28,37 +33,63 @@  properties:
       - description: ipg clock
       - description: ocram clock
       - description: core clock
+      - description: debug interface clock
+      - description: message unit clock
+    minItems: 3
+    maxItems: 5
 
   clock-names:
     items:
       - const: ipg
       - const: ocram
       - const: core
+      - const: debug
+      - const: mu
+    minItems: 3
+    maxItems: 5
 
   power-domains:
     description:
       List of phandle and PM domain specifier as documented in
       Documentation/devicetree/bindings/power/power_domain.txt
+    minItems: 1
     maxItems: 4
 
   mboxes:
     description:
       List of <&phandle type channel> - 2 channels for TXDB, 2 channels for RXDB
+      or - 1 channel for TX, 1 channel for RX, 1 channel for RXDB
       (see mailbox/fsl,mu.txt)
+    minItems: 3
     maxItems: 4
 
   mbox-names:
-    items:
-      - const: txdb0
-      - const: txdb1
-      - const: rxdb0
-      - const: rxdb1
+    oneOf:
+      - items:
+          - const: txdb0
+          - const: txdb1
+          - const: rxdb0
+          - const: rxdb1
+      - items:
+          - const: tx
+          - const: rx
+          - const: rxdb
 
   memory-region:
     description:
       phandle to a node describing reserved memory (System RAM memory)
       used by DSP (see bindings/reserved-memory/reserved-memory.txt)
-    maxItems: 1
+    minItems: 1
+    maxItems: 4
+
+  firmware-name:
+    description: |
+      Default name of the firmware to load to the remote processor.
+
+  fsl,dsp-ctrl:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description:
+      Phandle to syscon block which provide access for processor enablement
 
 required:
   - compatible
@@ -91,3 +122,41 @@  examples:
         mboxes = <&lsio_mu13 2 0>, <&lsio_mu13 2 1>, <&lsio_mu13 3 0>, <&lsio_mu13 3 1>;
         memory-region = <&dsp_reserved>;
     };
+  - |
+    #include <dt-bindings/clock/imx8mp-clock.h>
+    dsp_reserved: dsp@92400000 {
+      reg = <0x92400000 0x1000000>;
+      no-map;
+    };
+    dsp_vdev0vring0: vdev0vring0@942f0000 {
+      reg = <0x942f0000 0x8000>;
+      no-map;
+    };
+    dsp_vdev0vring1: vdev0vring1@942f8000 {
+      reg = <0x942f8000 0x8000>;
+      no-map;
+    };
+    dsp_vdev0buffer: vdev0buffer@94300000 {
+      compatible = "shared-dma-pool";
+      reg = <0x94300000 0x100000>;
+      no-map;
+    };
+
+    dsp: dsp@3b6e8000 {
+      compatible = "fsl,imx8mp-hifi4";
+      reg = <0x3B6E8000 0x88000>;
+      clocks = <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_DSP_ROOT>,
+               <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_OCRAMA_IPG>,
+               <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_DSP_ROOT>,
+               <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_DSPDBG_ROOT>;
+      clock-names = "ipg", "ocram", "core", "debug";
+      firmware-name = "imx/dsp/hifi4.bin";
+      power-domains = <&audiomix_pd>;
+      mbox-names = "tx", "rx", "rxdb";
+      mboxes = <&mu2 0 0>,
+               <&mu2 1 0>,
+               <&mu2 3 0>;
+      memory-region = <&dsp_vdev0buffer>, <&dsp_vdev0vring0>,
+                      <&dsp_vdev0vring1>, <&dsp_reserved>;
+      fsl,dsp-ctrl = <&audio_blk_ctrl>;
+    };