Re:Re: [PATCH v4 2/4] dt-bindings: mfd: sprd: Add bindings for ums512 global registers

From: Stephen Boyd
Date: Thu Oct 14 2021 - 19:09:16 EST


Quoting ChunyanZhang (2021-10-14 01:18:15)
>
> Resend this since I forgot to switch to plain text mode :(
>
> At 2021-10-14 14:38:42, "Stephen Boyd" <sboyd@xxxxxxxxxx> wrote:
> >Quoting ChunyanZhang (2021-10-13 19:02:44)
> >> At 2021-10-14 09:51:25, "Stephen Boyd" <sboyd@xxxxxxxxxx> wrote:
> >> >Quoting ChunyanZhang (2021-10-13 16:49:40)
> >> >> At 2021-10-14 06:04:32, "Stephen Boyd" <sboyd@xxxxxxxxxx> wrote:
> >> >> >Quoting Chunyan Zhang (2021-09-22 23:41:35)
> >> >> >> diff --git a/Documentation/devicetree/bindings/mfd/sprd,ums512-glbreg.yaml b/Documentation/devicetree/bindings/mfd/sprd,ums512-glbreg.yaml
> >> >> >> +
> >> >> >> +examples:
> >> >> >> + - |
> >> >> >> + ap_apb_regs: syscon@71000000 {
> >> >> >> + compatible = "sprd,ums512-glbregs", "syscon", "simple-mfd";
> >> >> >> + reg = <0x71000000 0x3000>;
> >> >> >> + #address-cells = <1>;
> >> >> >> + #size-cells = <1>;
> >> >> >> + ranges = <0 0x71000000 0x3000>;
> >> >> >> +
> >> >> >> + clock-controller@0 {
> >> >> >> + compatible = "sprd,ums512-apahb-gate";
> >> >> >
> >> >> >Why is this a subnode of a syscon and simple-mfd? Why not put the>clock-controller@71000000 directly onto the bus? Does making it a child
> >> >> >node help somehow?
> >> >>
> >> >> These clocks are at the same register range with global registers. I originally put them directly onto the bus indeed when submitting the patches for SC9863A clocks last year, and it had a private property named 'sprd,syscon' which could provide regmap for these clocks.
> >> >>
> >> >> Rob suggested [1] us to make them a child of the syscon, and would not need the private property 'sprd, syscon' then.
> >> >
> >> >Why do you need to use a syscon? Are the registers shared with some
> >> >other driver?
> >>
> >> Yes, shared with more than one devices which basically are multimedia devices. You may noticed that these are all gate clocks which are in the global registers ranges and are used to controll the enable status of some devices or some part of devices.
> >>
> >
>
> >Where does the multimedia device address space start? I see 0x71000000
>
> It doesn't mean that multimedia device address is in this space, multidedia devices have their own address space actually.

Ok got it.

> All the registers in this space (started from 0x71000000) are more like controll registers for device power, and they were designed as "global registers".
> Some gate clocks are also in global register space, so we make this kind of clocks a subnode of syscon, and clock driver can use regmap which mapped by syscon to avoid remapping the same address space to more than one virtual addresses.

So it looks like we're making the "power controller" device into a
syscon and then adding nodes in DT to describe the various pieces that
some registers inside that correspond to, like clks, power domains, etc.
I wonder why the ap_apb_regs device can't be a single node covering the
entire register space and then use the auxiliary bus in the kernel to
carve that device up into various kernel subsytems so that the
appropriate maintainers can review it.

>
> Hope I've made that clear, I'd like to give you an example, but I'm on a long leave and cannot look up the specification right now :(
> This is not a new issue, we discussed this when the first time I submitted the patches for sprd clocks IIRC.

Yes, I know it's not a new issue. Take care! We can pick this discussion
back up when you get back from leave.