Re: [RFC PATCH v4 net-next 00/23] add support for VSC75XX control over SPI

From: Vladimir Oltean
Date: Tue Nov 16 2021 - 12:41:22 EST


On Tue, Nov 16, 2021 at 07:32:08AM -0800, Colin Foster wrote:
> > > One thing to note: I've been following a pattern of adding "offset"
> > > variables to these drivers. I'm looking for feedback here, because I
> > > don't like it - however I feel like it is the "least bad" interface I
> > > could come up with.
> > >
> > > Specifically, ocelot has a regmap for GCB. ocelot-pinctrl would create a
> > > smaller regmap at an address of "GCB + 0x34".
> > >
> > > There are three options I saw here:
> > > 1. Have vsc7512_spi create a new regmap at GCB + 0x34 and pass that to
> > > ocelot-pinctrl
> > > 2. Give ocelot-pinctrl the concept of a "parent bus" by which it could
> > > request a regmap.
> > > 3. Keep the same GCB regmap, but pass in 0x34 as an offset.
> > >
> > >
> > > I will admit that option 2 sounds very enticing, but I don't know if
> > > that type of interaction exists. If not, implementing it is probably
> > > outside the scope of a first patch set. As such, I opted for option 3.
> >
> > I think that type of interaction is called "mfd", potentially even "syscon".
>
> Before diving in, I'd come across mfd and thought that might be the
> answer. I'll reconsider it now that I have several months of staring at
> kernel code under my belt. Maybe an mfd that does SPI setup and chip
> resetting. Then I could remove all SPI code from ocelot_vsc7512_spi.

That sounds acceptable to me.