RE: Reg: New MFD Driver for my PCIe Device

Kumaravel.Thiagarajan
2021-11-16T11:36:30Z

Dear Greg K-H & Lee Jones,

Thanks for your inputs and I need more of your help to understand things better.

I took this MFD route not just based on the recommendation from Linus Walleij but also based on the kernel documentation @ /Documentation/driver-api/driver-model/platform.rst which states as below.

"Rarely, a platform_device will be connected through a segment of some other kind of bus; but its registers will still be directly addressable."

I visualized these two (GPIO controller & OTP/EEPROM controller) devices as platform devices present on the same PCI function and these two devices are not detectable unless the base PCI function driver enumerates them and anyway their registers are directly addressable.
Hence, I thought that the platform driver architecture is inclusive of devices like this.

Please let me know your comments.

Also please let me know if I can talk to any of you over a webex call to get clarifications on my further doubts.

Thank You.

Regards,
Kumaravel Thiagarajan

-----Original Message-----
From: Greg KH <gregkh@linuxfoundation.org>
Sent: Monday, November 8, 2021 5:33 PM
To: Lee Jones <lee.jones@linaro.org>
Cc: Kumaravel Thiagarajan - I21417 <Kumaravel.Thiagarajan@microchip.com>; Pragash Mangalapandian - I21326 <Pragash.Mangalapandian@microchip.com>; Sundararaman Hariharaputran - I21286 <Sundararaman.H@microchip.com>; axboe@kernel.dk; linux-block@vger.kernel.org; miquel.raynal@bootlin.com; richard@nod.at; vigneshr@ti.com; linux-mtd@lists.infradead.org
Subject: Re: Reg: New MFD Driver for my PCIe Device

[You don't often get email from gregkh@linuxfoundation.org. Learn why this is important at http://aka.ms/LearnAboutSenderIdentification.]

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

On Mon, Nov 08, 2021 at 11:27:45AM +0000, Lee Jones wrote:
> On Mon, 08 Nov 2021, Greg KH wrote:
> > On Mon, Nov 08, 2021 at 11:04:31AM +0000, Lee Jones wrote:
> > > On Mon, 08 Nov 2021, Kumaravel.Thiagarajan@microchip.com wrote:
> > >
> > > > Dear Lee Jones,
> > > >
> > > > I am Kumaravel Thiagarajan from Microchip, India and I am new to Linux Kernel development.
> > > >
> > > > I am currently working on linux kernel driver for one of our PCIe based devices whose BAR 0 maps interface registers for a gpio controller, an OTP memory device controller and an EEPROM device controller into the host processor's memory space.
> > > >
> > > > Based on earlier inputs from Linus Walleij, I have developed this as a multi-function device driver - First MFD driver (drivers/mfd) gets loaded for the PCIe device and then it spawns two child devices for OTP/EEPROM and GPIO separately.
> > >
> > > You may wish to speak with Greg about your architectural decisions.
> > >
> > > He usually dislikes the creation of platform devices from PCI ones.
> >
> > Yes, that is NOT ok.
> >
> > Platform devices are only for devices that are actually on a
> > platform (i.e. described by DT or other firmware types).
>
> This is probably a bit of an over-simplification. Lots of legitimate
> platform devices are actually described by DT et al.

We are in violent agreement here, that is what I was trying to say :)

> However, it is true that devices which reside on definite buses; PCI,
> USB, PCMIA, SCSI, Thunderbolt, etc should not spawn their children off
> as platform devices.

Agreed, that is not ok, as those are not what the platform device code was designed for.

thanks,

greg k-h