Re: [PATCH v9 2/5] dt-bindings: clock: sophgo: add RP gate clocks for SG2042

From: Rob Herring
Date: Mon Feb 12 2024 - 10:15:01 EST


On Tue, Feb 06, 2024 at 08:57:27PM +0800, Chen Wang wrote:
>
> On 2024/2/6 1:24, Rob Herring wrote:
> > On Fri, Feb 02, 2024 at 02:42:02PM +0800, Chen Wang wrote:
> > > From: Chen Wang <unicorn_wang@xxxxxxxxxxx>
> > >
> > > Add bindings for the gate clocks of RP subsystem for Sophgo SG2042.
> > >
> > > Signed-off-by: Chen Wang <unicorn_wang@xxxxxxxxxxx>
> > > ---
> > > .../bindings/clock/sophgo,sg2042-rpgate.yaml | 37 ++++++++++++
> > > .../dt-bindings/clock/sophgo,sg2042-rpgate.h | 58 +++++++++++++++++++
> > > 2 files changed, 95 insertions(+)
> > > create mode 100644 Documentation/devicetree/bindings/clock/sophgo,sg2042-rpgate.yaml
> > > create mode 100644 include/dt-bindings/clock/sophgo,sg2042-rpgate.h
> > >
> > > diff --git a/Documentation/devicetree/bindings/clock/sophgo,sg2042-rpgate.yaml b/Documentation/devicetree/bindings/clock/sophgo,sg2042-rpgate.yaml
> > > new file mode 100644
> > > index 000000000000..69ce3a64f66c
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/clock/sophgo,sg2042-rpgate.yaml
> > > @@ -0,0 +1,37 @@
> > > +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> > > +%YAML 1.2
> > > +---
> > > +$id: http://devicetree.org/schemas/clock/sophgo,sg2042-rpgate.yaml#
> > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > +
> > > +title: Sophgo SG2042 Gate Clock Generator for RP(riscv processors) subsystem
> > > +
> > > +maintainers:
> > > + - Chen Wang <unicorn_wang@xxxxxxxxxxx>
> > > +
> > > +properties:
> > > + compatible:
> > > + const: sophgo,sg2042-rpgate
> > > +
> > > + reg:
> > > + maxItems: 1
> > > +
> > > + '#clock-cells':
> > > + const: 1
> > > + description:
> > > + See <dt-bindings/clock/sophgo,sg2042-rpgate.h> for valid indices.
> > > +
> > > +required:
> > > + - compatible
> > > + - reg
> > > + - '#clock-cells'
> > > +
> > > +additionalProperties: false
> > > +
> > > +examples:
> > > + - |
> > > + clock-controller@10000000 {
> > > + compatible = "sophgo,sg2042-rpgate";
> > > + reg = <0x10000000 0x10000>;
> > > + #clock-cells = <1>;
> > No input clocks?
>
> I think it should have some input, I will add it, thanks.
>
> BTW,  can we ignore this property if driver doesn't use it? In other words,
> do we have to add this clocks property just to indicate that this node
> requires some clocks as input from a hardware perspective?

Yes and no. The kernel will see the dependency and track that. But your
driver doesn't have to get the clock or anything. Though presumably the
source is a fixed-clock and you need its frequency to calculate child
clock rates.

Rob