On Thu, Feb 19, 2026 at 06:09:31AM -0700, Simon Glass wrote: > On Mon, 16 Feb 2026 at 14:24, Daniel Golle <[email protected]> wrote: > > [...] > > +/** > > + * ubi_bootdev_hunt() - attach UBI and bind a bootdev for it > > + * > > + * Walk the DT for the first partition with compatible = "linux,ubi", > > + * find its MTD device, attach UBI via ubi_part_from_mtd(), then bind > > + * a ubi_bootdev as a child of the top-level MTD DM device. > > + */ > > +static int ubi_bootdev_hunt(struct bootdev_hunter *info, bool show) > > +{ > > + struct udevice *bdev; > > + struct mtd_info *mtd; > > + ofnode node; > > + int ret; > > + > > + mtd_probe_devices(); > > + > > + if (!ubi_devices[0]) { > > + ofnode_for_each_compatible_node(node, "linux,ubi") { > > + mtd_for_each_device(mtd) { > > + if (ofnode_equal(mtd->flash_node, node)) > > + goto found; > > + } > > + } > > + return -ENOENT; > > Eek no we need to find the device, not the node. There must surely be > a link between the UBI and MTD in the data structures somewhere.
Yes, but only once UBI is already attached. We can move the responsibiltiy to auto-attach the first suitable UBI volume having the 'linux, ubi' compatible to the moment the MTD partition devices are created, so UBI will always already be attached. However, that will then waste time to do the UBI scanning even on devices not using UBI to boot from (but eg. only as auxilary storage while booting from NOR flash). Hence I kinda liked taking care of the UBI attachment in the hunter...

