Re: [PATCH 1/2] dt-bindings: Add syscon-names support

From: Orson Zhai
Date: Wed Nov 20 2019 - 10:53:31 EST


Hi Arnd,

On Tue, Nov 19, 2019 at 03:46:09PM +0100, Arnd Bergmann wrote:
> On Mon, Nov 18, 2019 at 9:42 AM Orson Zhai <orson.zhai@xxxxxxxxxxxxxx> wrote:
> >
> > Hi Arnd,
> >
> > On Fri, Nov 15, 2019 at 10:33:30AM +0100, Arnd Bergmann wrote:
> > > On Thu, Nov 14, 2019 at 12:48 PM Orson Zhai <orson.zhai@xxxxxxxxxx> wrote:
> > > >
> > > >
> > > > Make life easier when syscon consumer want to access multiple syscon
> > > > nodes.
> > > > Add syscon-names and relative properties to help manage complicated
> > > > cases when accessing more one syscon node.
> > > >
> > > > Signed-off-by: Orson Zhai <orson.zhai@xxxxxxxxxx>
> > >
> > > Hi Orson,
> > >
> > > Can you explain why the number of cells in this binding is specific
> > > to the syscon node rather than the node referencing it?
> >
> > The story is like this. I found there are too many global registers in
> > Unisoc(former Spreadtrum) chips. Dozens of offset with dozens of modules
> > were needed to be specified. So I thought the dts files would seem "horrible"
> > with a big chunk of syscon-xxx (say more than 20 lines)
> >
> > I learned from reg-names way which might look clean to hold all these mess things.
> > But to implement this, the users need to konw the cell-size if we add arguments to syscon node.
> > I thought to add cell-size into every syscon consumer node is a duplicated work and
> > I wanted to take advantage of of_parse_phandle_with_args.
> > So the bindings were created then.
>
> Ok, that makes sense.
>
> > > The way would otherwise handle the example from your binding
> > > would be with two separate properties in the display node, like
> > >
> > > syscon-enable = <&ap_apb_regs 0x4 0xf00>;
> > > syscon-power = <&aon_regs 0x8>;
> >
> > This is an option for consumers all the time.
> > Acturally my patches are not going to replace this.
> > I'd like to provide another option to save people like desperate engineers in Spreadtrum :)
> >
> > >
> > > in which case, the syscon driver does not need to know anything
> >
> > Whould it be better if I add syscon-cells into consumer's node?
>
> As I see it, there is no reason to put the syscon-cells property into any node,
> as this is implied by the driver binding using the syscon reference. I would
> only use the #xyz-cells style property if there are multiple interpretations
> that all make sense for the same binding.
>
> > Then I could read the cell size and use "of_parse_phandle_with_fixed_args()" instead.
> > This will not involve syscon node itself at all.
>
> This sounds better to me, yes. I had not even remembered this function
> exists, but I think this is a good idea.
>
> I can also see a point in favor of adding more infrastructure around this,
> possibly naming the entries in a syscon-names property as you suggested,
> combining of_parse_phandle_with_fixed_args() with a name, or
> combining with syscon_regmap_lookup_by_phandle() for convenience.
>
> This should all be possible without adding complexity to the syscon
> DT binding itself, and it would give more structure to the way it
> is used by drivers.

V2 has been sent out per as you suggested.

Free free to review please.

Best Regards,
-Orson
>
> Arnd
________________________________
This email (including its attachments) is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. Unauthorized use, dissemination, distribution or copying of this email or the information herein or taking any action in reliance on the contents of this email or the information herein, by anyone other than the intended recipient, or an employee or agent responsible for delivering the message to the intended recipient, is strictly prohibited. If you are not the intended recipient, please do not read, copy, use or disclose any part of this e-mail to others. Please notify the sender immediately and permanently delete this e-mail and any attachments if you received it in error. Internet communications cannot be guaranteed to be timely, secure, error-free or virus-free. The sender does not accept liability for any errors or omissions.
æéäååéäåæäåæèïåæåäæäåæéïäåéçæéäææçåæääãäçéçææäçãåäãååæååæéäæåååãèéèçåæääïèåéèãååã äçææéæéäçääååãèèææéäïèäççäæäæåéæéäåææéäïåäååéäçæååååçåääãææäèäèçéäåæãååãæèæéæãåääåääéæåäææèäã