Re: [PATCH v4 02/11] mfd: Add support for Kontron sl28cpld management controller

From: Rob Herring
Date: Tue Jun 09 2020 - 13:15:28 EST


On Tue, Jun 09, 2020 at 05:01:17PM +0200, Michael Walle wrote:
> Am 2020-06-09 16:42, schrieb Mark Brown:
> > On Tue, Jun 09, 2020 at 04:38:31PM +0200, Michael Walle wrote:
> >
> > > mfd-device@10 {
> > > compatible = "simple-regmap", "simple-mfd";
> > > reg = <10>;
> > > regmap,reg-bits = <8>;
> > > regmap,val-bits = <8>;
> > > sub-device@0 {
> > > compatible = "vendor,sub-device0";
> > > reg = <0>;
> > > };
> >
> > A DT binding like this is not a good idea, encoding the details of the
> > register map into the DT binding makes it an ABI which is begging for
> > trouble. I'd also suggest that any device using a generic driver like
> > this should have a specific compatible string for the device so we can
> > go back and add quirks later if we need them.
>
> Like in the spidev case, yes. But OTOH if I _just_ encode the parameters
> for the regmap a MFD, Lee don't agree because its just a shim. So either
> way I seem to be stuck here.
>
> Where should I put the code to create an i2c driver, init a regmap and
> populate its childen?

Find another driver doing this already and rename it 'simple-mfd' (no
relation to the DT binding) and add your compatible string to it.
'Generic' or 'simple' drivers don't require generic/simple DT bindings.

Or extend the existing syscon driver to look up the bus_type and create
the regmap based on the bus type?

Rob