diff mbox series

[v2,2/2] dt-bindings: dsp: fsl: Add DSP optional clocks documentation

Message ID 20210903145340.225511-3-daniel.baluta@oss.nxp.com
State New
Headers show
Series Add code to manage DSP related clocks | expand

Commit Message

Daniel Baluta Sept. 3, 2021, 2:53 p.m. UTC
From: Daniel Baluta <daniel.baluta@nxp.com>


DSP node on the Linux kernel side must also take care of enabling
DAI/DMA related clocks.

By design we choose to manage DAI/DMA clocks from the kernel side because of
the architecture of some i.MX8 boards.

Clocks are handled by a special M4 core which runs a special firmware
called SCFW (System Controler firmware).

This communicates with A cores running Linux via a special Messaging
Unit and implements a custom API which is already implemented by the
Linux kernel i.MX clocks implementation.

Note that these clocks are optional. We can use the DSP without them.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>

---
 .../devicetree/bindings/dsp/fsl,dsp.yaml      | 33 +++++++++++++++++++
 1 file changed, 33 insertions(+)

-- 
2.27.0

Comments

Rob Herring Sept. 3, 2021, 4:53 p.m. UTC | #1
On Fri, Sep 03, 2021 at 05:53:40PM +0300, Daniel Baluta wrote:
> From: Daniel Baluta <daniel.baluta@nxp.com>

> 

> DSP node on the Linux kernel side must also take care of enabling

> DAI/DMA related clocks.

> 

> By design we choose to manage DAI/DMA clocks from the kernel side because of

> the architecture of some i.MX8 boards.

> 

> Clocks are handled by a special M4 core which runs a special firmware

> called SCFW (System Controler firmware).

> 

> This communicates with A cores running Linux via a special Messaging

> Unit and implements a custom API which is already implemented by the

> Linux kernel i.MX clocks implementation.

> 

> Note that these clocks are optional. We can use the DSP without them.

> 

> Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>

> ---

>  .../devicetree/bindings/dsp/fsl,dsp.yaml      | 33 +++++++++++++++++++

>  1 file changed, 33 insertions(+)

> 

> diff --git a/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml b/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml

> index 7afc9f2be13a..1453668c0194 100644

> --- a/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml

> +++ b/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml

> @@ -24,16 +24,49 @@ properties:

>      maxItems: 1

>  

>    clocks:

> +    minItems: 3

>      items:

>        - description: ipg clock

>        - description: ocram clock

>        - description: core clock

> +      - description: esai0 core clock for accessing registers

> +      - description: esai0 baud clock

> +      - description: esai0 system clock

> +      - description: esai0 spba clock required when ESAI is placed in slave mode

> +      - description: SAI1 bus clock

> +      - description: SAI1 master clock 0

> +      - description: SAI1 master clock 1

> +      - description: SAI1 master clock 2

> +      - description: SAI1 master clock 3

> +      - description: SAI3 bus clock

> +      - description: SAI3 master clock 0

> +      - description: SAI3 master clock 1

> +      - description: SAI3 master clock 2

> +      - description: SAI3 master clock 3

> +      - description: SDMA3 root clock used for accessing registers


Sigh, I just rejected this kind of thing for the other i.MX8 DSP 
binding[1].

Add a reference to the h/w block and then get the clocks (and other 
resources) from there.

Rob

[1] https://lore.kernel.org/linux-devicetree/YTDq%2FkWFPLHUnHMN@robh.at.kernel.org/
Daniel Baluta Sept. 4, 2021, 2:50 p.m. UTC | #2
On Fri, Sep 3, 2021 at 8:11 PM Rob Herring <robh@kernel.org> wrote:
>

> On Fri, Sep 03, 2021 at 05:53:40PM +0300, Daniel Baluta wrote:

> > From: Daniel Baluta <daniel.baluta@nxp.com>

> >

> > DSP node on the Linux kernel side must also take care of enabling

> > DAI/DMA related clocks.

> >

> > By design we choose to manage DAI/DMA clocks from the kernel side because of

> > the architecture of some i.MX8 boards.

> >

> > Clocks are handled by a special M4 core which runs a special firmware

> > called SCFW (System Controler firmware).

> >

> > This communicates with A cores running Linux via a special Messaging

> > Unit and implements a custom API which is already implemented by the

> > Linux kernel i.MX clocks implementation.

> >

> > Note that these clocks are optional. We can use the DSP without them.

> >

> > Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>

> > ---

> >  .../devicetree/bindings/dsp/fsl,dsp.yaml      | 33 +++++++++++++++++++

> >  1 file changed, 33 insertions(+)

> >

> > diff --git a/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml b/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml

> > index 7afc9f2be13a..1453668c0194 100644

> > --- a/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml

> > +++ b/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml

> > @@ -24,16 +24,49 @@ properties:

> >      maxItems: 1

> >

> >    clocks:

> > +    minItems: 3

> >      items:

> >        - description: ipg clock

> >        - description: ocram clock

> >        - description: core clock

> > +      - description: esai0 core clock for accessing registers

> > +      - description: esai0 baud clock

> > +      - description: esai0 system clock

> > +      - description: esai0 spba clock required when ESAI is placed in slave mode

> > +      - description: SAI1 bus clock

> > +      - description: SAI1 master clock 0

> > +      - description: SAI1 master clock 1

> > +      - description: SAI1 master clock 2

> > +      - description: SAI1 master clock 3

> > +      - description: SAI3 bus clock

> > +      - description: SAI3 master clock 0

> > +      - description: SAI3 master clock 1

> > +      - description: SAI3 master clock 2

> > +      - description: SAI3 master clock 3

> > +      - description: SDMA3 root clock used for accessing registers

>

> Sigh, I just rejected this kind of thing for the other i.MX8 DSP

> binding[1].

>

> Add a reference to the h/w block and then get the clocks (and other

> resources) from there.


The H/W block is controlled by the DSP firmware. So, we don't want
to use the Linux kernel driver (thus the H/W block device tree node).

The only thing that we cannot control from the DSP firmware are the clocks
hence we handle them in the DSP node.

We moved the DAI clocks under the DSP node as I think you suggested here:

https://www.lkml.org/lkml/2020/3/12/969
Rob Herring Sept. 7, 2021, 1:09 p.m. UTC | #3
On Sat, Sep 4, 2021 at 9:51 AM Daniel Baluta <daniel.baluta@gmail.com> wrote:
>

> On Fri, Sep 3, 2021 at 8:11 PM Rob Herring <robh@kernel.org> wrote:

> >

> > On Fri, Sep 03, 2021 at 05:53:40PM +0300, Daniel Baluta wrote:

> > > From: Daniel Baluta <daniel.baluta@nxp.com>

> > >

> > > DSP node on the Linux kernel side must also take care of enabling

> > > DAI/DMA related clocks.

> > >

> > > By design we choose to manage DAI/DMA clocks from the kernel side because of

> > > the architecture of some i.MX8 boards.

> > >

> > > Clocks are handled by a special M4 core which runs a special firmware

> > > called SCFW (System Controler firmware).

> > >

> > > This communicates with A cores running Linux via a special Messaging

> > > Unit and implements a custom API which is already implemented by the

> > > Linux kernel i.MX clocks implementation.

> > >

> > > Note that these clocks are optional. We can use the DSP without them.

> > >

> > > Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>

> > > ---

> > >  .../devicetree/bindings/dsp/fsl,dsp.yaml      | 33 +++++++++++++++++++

> > >  1 file changed, 33 insertions(+)

> > >

> > > diff --git a/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml b/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml

> > > index 7afc9f2be13a..1453668c0194 100644

> > > --- a/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml

> > > +++ b/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml

> > > @@ -24,16 +24,49 @@ properties:

> > >      maxItems: 1

> > >

> > >    clocks:

> > > +    minItems: 3

> > >      items:

> > >        - description: ipg clock

> > >        - description: ocram clock

> > >        - description: core clock

> > > +      - description: esai0 core clock for accessing registers

> > > +      - description: esai0 baud clock

> > > +      - description: esai0 system clock

> > > +      - description: esai0 spba clock required when ESAI is placed in slave mode

> > > +      - description: SAI1 bus clock

> > > +      - description: SAI1 master clock 0

> > > +      - description: SAI1 master clock 1

> > > +      - description: SAI1 master clock 2

> > > +      - description: SAI1 master clock 3

> > > +      - description: SAI3 bus clock

> > > +      - description: SAI3 master clock 0

> > > +      - description: SAI3 master clock 1

> > > +      - description: SAI3 master clock 2

> > > +      - description: SAI3 master clock 3

> > > +      - description: SDMA3 root clock used for accessing registers

> >

> > Sigh, I just rejected this kind of thing for the other i.MX8 DSP

> > binding[1].

> >

> > Add a reference to the h/w block and then get the clocks (and other

> > resources) from there.

>

> The H/W block is controlled by the DSP firmware. So, we don't want

> to use the Linux kernel driver (thus the H/W block device tree node).


'status' is how you disable a device to not be used by the OS.

The information about that device's resources are already in DT, we
don't need to duplicate that here. If you want a list of devices
assigned to the DSP here, that would be okay.

> The only thing that we cannot control from the DSP firmware are the clocks

> hence we handle them in the DSP node.

>

> We moved the DAI clocks under the DSP node as I think you suggested here:

>

> https://www.lkml.org/lkml/2020/3/12/969


No, that's certainly not what I was suggesting. The resources in the
DSP node should be the h/w resources of the DSP itself.

Rob
Daniel Baluta Sept. 9, 2021, 11:20 a.m. UTC | #4
> > The H/W block is controlled by the DSP firmware. So, we don't want

> > to use the Linux kernel driver (thus the H/W block device tree node).

>

> 'status' is how you disable a device to not be used by the OS.

>

> The information about that device's resources are already in DT, we

> don't need to duplicate that here. If you want a list of devices

> assigned to the DSP here, that would be okay.


Thanks! This is a very good idea. I was thinking at a totally different thing.

So having something like this:

dsp {


hw-block-list = <&sai1>, <&sai2>;

}

And then inside the DSP driver we can get access to sai1 clocks. Do
you know of any standard property name?


>

> > The only thing that we cannot control from the DSP firmware are the clocks

> > hence we handle them in the DSP node.

> >

> > We moved the DAI clocks under the DSP node as I think you suggested here:

> >

> > https://www.lkml.org/lkml/2020/3/12/969

>

> No, that's certainly not what I was suggesting. The resources in the

> DSP node should be the h/w resources of the DSP itself.


I see thanks!
Rob Herring Sept. 9, 2021, 5:15 p.m. UTC | #5
On Thu, Sep 9, 2021 at 6:21 AM Daniel Baluta <daniel.baluta@gmail.com> wrote:
>

> > > The H/W block is controlled by the DSP firmware. So, we don't want

> > > to use the Linux kernel driver (thus the H/W block device tree node).

> >

> > 'status' is how you disable a device to not be used by the OS.

> >

> > The information about that device's resources are already in DT, we

> > don't need to duplicate that here. If you want a list of devices

> > assigned to the DSP here, that would be okay.

>

> Thanks! This is a very good idea. I was thinking at a totally different thing.

>

> So having something like this:

>

> dsp {

>

>

> hw-block-list = <&sai1>, <&sai2>;

>

> }


Yes.

> And then inside the DSP driver we can get access to sai1 clocks. Do

> you know of any standard property name?


There isn't. So it needs a vendor prefix.

There's been some discussions around 'system devicetree' where all
processors (like the DSP) view of the system get represented. Device
assignment is one of the issues to solve with that, but it's not
anywhere close to having something to help here.

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..1453668c0194 100644
--- a/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml
+++ b/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml
@@ -24,16 +24,49 @@  properties:
     maxItems: 1
 
   clocks:
+    minItems: 3
     items:
       - description: ipg clock
       - description: ocram clock
       - description: core clock
+      - description: esai0 core clock for accessing registers
+      - description: esai0 baud clock
+      - description: esai0 system clock
+      - description: esai0 spba clock required when ESAI is placed in slave mode
+      - description: SAI1 bus clock
+      - description: SAI1 master clock 0
+      - description: SAI1 master clock 1
+      - description: SAI1 master clock 2
+      - description: SAI1 master clock 3
+      - description: SAI3 bus clock
+      - description: SAI3 master clock 0
+      - description: SAI3 master clock 1
+      - description: SAI3 master clock 2
+      - description: SAI3 master clock 3
+      - description: SDMA3 root clock used for accessing registers
+
 
   clock-names:
+    minItems: 3
     items:
       - const: ipg
       - const: ocram
       - const: core
+      - const: esai0_core
+      - const: esai0_extal
+      - const: esai0_fsys
+      - const: esai0_spba
+      - const: sai1_bus
+      - const: sai1_mclk0
+      - const: sai1_mclk1
+      - const: sai1_mclk2
+      - const: sai1_mclk3
+      - const: sai3_bus
+      - const: sai3_mclk0
+      - const: sai3_mclk1
+      - const: sai3_mclk2
+      - const: sai3_mclk3
+      - const: smda3_root
 
   power-domains:
     description: