Re: [PATCH] mfd: cpcap: Add minimal support

From: Tony Lindgren
Date: Wed Nov 23 2016 - 10:03:11 EST


* Rob Herring <robh@xxxxxxxxxx> [161121 08:34]:
> On Mon, Nov 21, 2016 at 11:45:58AM +0000, Lee Jones wrote:
> > On Fri, 18 Nov 2016, Tony Lindgren wrote:
> > > +Example:
> > > +
> > > +&mcspi1 {
> > > + #address-cells = <1>;
> > > + #size-cells = <1>;
> > > + ranges;
> > > + cpcap: pmic@0 {
> > > + compatible = "motorola,cpcap", "st,6556002";
> > > + reg = <0 0>; /* cs0, size 0 */
> >
> > Is this really correct?
>
> No, SPI devices are 1 cell and there shouldn't be a ranges prop.
>
> >
> > How can ranges have a size of 0x8000 and this 0?
>
> reg here doesn't affect ranges and address translation.
>
> Perhaps this is trying to make address translation work, but if that
> does, it is by chance. Children of pmic addresses in the range of
> 0-0x8000 would get translated to "cpu address" 0-0x8000 as long as the
> DT has empty ranges up to the root. If the parent bus (i.e. SoC bus) has
> any base address, then that is going to get added which would not be
> good.

Yes I was thinking we can just get the register offset from the
cpcap base from dts for children. So a range from 0-0x8000.

Rob, do you have any better suggestions for doing that?

Anyways, the children can just rely on regmap too, so I'll just
drop the ranges here. If we ever come up with suitable ranges for
cases like this we can change it later.

Regards,

Tony