Composite PCI devices in FreeBSD (mfd in Linux)
Anthony Jenkins
Scoobi_doo at yahoo.com
Mon Dec 10 17:00:47 UTC 2018
Hi all,
I'm trying to port an Intel PCI I2C controller from Linux to FreeBSD.
Linux represents this device as an MFD (multi-function device), meaning
it has these "sub-devices" that can be handed off to other drivers to
actually attach devices to the system. The Linux "super" PCI device is
the intel-lpss-pci.c, and the "sub" device is i2c-designware-platdrv.c,
which represents the DesignWare driver's "platform" attachment to the
Linux system. FreeBSD also has a DesignWare I2C controller driver,
ig4(4), but it only has PCI and ACPI bus attachment implementations.
I have a port of the Linux intel-lpss driver to FreeBSD, but now I'm
trying to figure out the best way to give FreeBSD's ig4(4) driver access
to my lpss(4) device. I'm thinking I could add an ig4_lpss.c describing
the "attachment" of an ig4(4) to an lpss(4). Its probe() method would
scan the "lpss" devclass for devices, and its attach() method would
attach itself as a child to the lpss device and "grab" the portion of
PCI memory and the IRQ that the lpss PCI device got.
Is this the "FreeBSD Way (TM)" of handling this type of device? If not,
can you recommend an existing FreeBSD driver I can model my code after?
If my approach is acceptable, how do I fully describe the ig4(4)
device's attachment to the system? Is simply making it a child of
lpss(4) sufficient? It's "kind of" a PCI device (it is controlled via
access to a PCI memory region and an IRQ), but it's a sub-device of an
actual PCI device (lpss(4)) attached to PCI.
How would my ig4_lpss attachment get information from the lpss(4) driver
about what it probed?
Thanks,
Anthony Jenkins
References:
- intel-lpss.c -
https://github.com/torvalds/linux/blob/master/drivers/mfd/intel-lpss.c
- intel-lpss-pci.c -
https://github.com/torvalds/linux/blob/master/drivers/mfd/intel-lpss-pci.c
- i2c-designware-platdrv.c -
https://github.com/torvalds/linux/blob/master/drivers/i2c/busses/i2c-designware-platdrv.c
- "mfd: introduce a driver for LPSS devices on SPT" -
https://lwn.net/Articles/645819/
- FreeBSD port - https://github.com/ScoobiFreeBSD/freebsd-intel-lpss
More information about the freebsd-current
mailing list