On Wed, Feb 07, 2024 at 05:32:38PM +0100, Bartosz Golaszewski wrote: > On Fri, Feb 2, 2024 at 11:02 AM Bartosz Golaszewski <brgl@xxxxxxxx> wrote: > > > > On Fri, Feb 2, 2024 at 1:03 AM Bjorn Andersson <andersson@xxxxxxxxxx> wrote: > > > > > > > [snip] > > > > > > > > > > > > I believe I missed this part of the discussion, why does this need to be > > > > > a platform_device? What does the platform_bus bring that can't be > > > > > provided by some other bus? > > > > > > > > > > > > > Does it need to be a platform_device? No, of course not. Does it make > > > > sense for it to be one? Yes, for two reasons: > > > > > > > > 1. The ATH11K WLAN module is represented on the device tree like a > > > > platform device, we know it's always there and it consumes regulators > > > > from another platform device. The fact it uses PCIe doesn't change the > > > > fact that it is logically a platform device. > > > > > > Are you referring to the ath11k SNOC (firmware running on co-processor > > > in the SoC) variant? > > > > > > Afaict the PCIe-attached ath11k is not represented as a platform_device > > > in DeviceTree. > > > > > > > My bad. In RB5 it isn't (yet - I want to add it in the power > > sequencing series). It is in X13s though[1]. > > > > > Said platform_device is also not a child under the PCIe bus, so this > > > would be a different platform_device... > > > > > > > It's the child of the PCIe port node but there's a reason for it to > > have the `compatible` property. It's because it's an entity of whose > > existence we are aware before the system boots. > > > > > > 2. The platform bus already provides us with the entire infrastructure > > > > that we'd now need to duplicate (possibly adding bugs) in order to > > > > introduce a "power sequencing bus". > > > > > > > > > > This is a perfectly reasonable desire. Look at our PMICs, they are full > > > of platform_devices. But through the years it's been said many times, > > > that this is not a valid or good reason for using platform_devices, and > > > as a result we have e.g. auxiliary bus. > > > > > > > Ok, so I cannot find this information anywhere (nor any example). Do > > you happen to know if the auxiliary bus offers any software node > > integration so that the `compatible` property from DT can get > > seamlessly mapped to auxiliary device IDs? > > > > So I was just trying to port this to using the auxiliary bus, only to > find myself literally reimplementing functions from > drivers/of/device.c. I have a feeling that this is simply wrong. If > we're instantiating devices well defined on the device-tree then IMO > we *should* make them platform devices. Anything else and we'll be > reimplementing drivers/of/ because we will need to parse the device > nodes, check the compatible, match it against drivers etc. Things that > are already implemented for the platform bus and of_* APIs. > > Greg: Could you chime in and confirm that it's alright to use the > platform bus here? Or maybe there is some infrastructure to create > auxiliary devices from software nodes? Note, I HATE the use of the platform bus here, but I don't have a better suggestion. I'd love for the auxbus to work, and if you can create that from software nodes, all the better! But I don't think that's possible just yet, and you would end up implementing all the same stuff that the platform bus has today for this functionality, so I doubt it would be worth it. thanks, greg k-h