After going through all the discussions here, I have a few questions:
- Is the old `*_register_device(controller, board_info)` style discouraged
in favor of using device tree, at least for drivers using multiple fundamental buses (i2c, spi, etc)?
Historically, they were used in board files, where you needed to write C code for every single board. That did not scale, which is why we swapped to DT.
board_info is still useful, e.g. for platforms which don't have DT. I support a few amd64 boards where i need to use a platform driver to instantiate some I2C and MDIO devices. But in general DT is much easier to use.
- Is the preferred way to handle virtual devices (like those created by
greybus subsystem) now device tree? Is that one of the blockers for greybus i2c, spi etc to still be in staging?
I would not say they are virtual. They do exist. They are just not memory mapped like most devices, but in another address space, one which you access via RPCs.
- How are virtual devices created in device tree? If I register an i2c
adapter using `i2c_add_adapter`, is the device tree entry is dynamically created, which can then be used by a device tree overlay?
As far as i'm aware, there are no examples today. You are doing something different, something new. Adding these dynamic devices to DT is just a suggestion from me, as a good way to solve your problem. You will need to look into the DT core and figure out how to do it.
Andrew