
Am 4. März 2021 20:26:49 MEZ schrieb Simon Glass sjg@chromium.org:
Hi Heinrich,
On Thu, 4 Mar 2021 at 08:01, Heinrich Schuchardt xypron.glpk@gmx.de wrote:
Hello Simon,
in U-Boot we can define drivers via U_BOOT_DRVINFO and U_BOOT_DRIVER.
My current use case is SBI system reset extension. A driver would not reasonably depend on the device-tree because if the RISC-V cpu is in S-mode we know that there must be an SBI implementation. If the extension is available, has to be determined in the probe() function
of
the driver.
My current solution is to use U_BOOT_DRIVER and to call device_bind_driver(gd->dm_root,...) in board_init(). But that results
in
code duplication in the board files.
What do think about adding the usual driver functions to struct
driver_info:
int (*bind)(struct udevice *dev); int (*probe)(struct udevice *dev); int (*remove)(struct udevice *dev); int (*unbind)(struct udevice *dev);
Alternatively one could add a flag DM_FLAG_AUTO_PROBE to the struct driver flags field which would lead to probing irrespective of the device-tree.
I would prefer the latter solution.
Surely this should be in the devicetree. Why would it not be?
Here is the background to my question:
http://lists.infradead.org/pipermail/opensbi/2021-March/000691.html
The OpenSBI maintainers did not see any need for a device tree node for calling the system reset extension.
Best regards
Heinrich
Regards, Simon