From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 059E5E9A048 for ; Thu, 19 Feb 2026 16:57:30 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4F43C83CF2; Thu, 19 Feb 2026 17:57:29 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 18AE983D17; Thu, 19 Feb 2026 17:57:28 +0100 (CET) Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [IPv6:2a07:2ec0:3002::65]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 34D9783946 for ; Thu, 19 Feb 2026 17:57:25 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=daniel@makrotopia.org Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.99) (envelope-from ) id 1vt7Ko-000000002Q2-00g2; Thu, 19 Feb 2026 16:57:02 +0000 Date: Thu, 19 Feb 2026 16:56:58 +0000 From: Daniel Golle To: Simon Glass Cc: Tom Rini , Quentin Schulz , Kory Maincent , Mattijs Korpershoek , Martin Schwan , Anshul Dalal , Ilias Apalodimas , Sughosh Ganu , Aristo Chen , =?utf-8?B?54mbIOW/l+Wujw==?= , Marek Vasut , Heinrich Schuchardt , Wolfgang Wallner , Frank Wunderlich , David Lechner , Osama Abdelkader , Mikhail Kshevetskiy , Michael Trimarchi , Miquel Raynal , Andrew Goodbody , Yegor Yefremov , Mike Looijmans , Weijie Gao , Alexander Stein , Neil Armstrong , Mayuresh Chitale , Paul HENRYS , u-boot@lists.denx.de, John Crispin , Paul Spooren Subject: Re: [RFC PATCH 17/20] boot: bootdev: add UBI boot device Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean On Thu, Feb 19, 2026 at 06:09:31AM -0700, Simon Glass wrote: > On Mon, 16 Feb 2026 at 14:24, Daniel Golle 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...