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 5697AC3F6B0 for ; Thu, 4 Aug 2022 17:58:05 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9F477845E3; Thu, 4 Aug 2022 19:58:02 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.b="MJWyoi9d"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="p3GDyVYW"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C4D86845E3; Thu, 4 Aug 2022 19:58:00 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) (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 358C0839F6 for ; Thu, 4 Aug 2022 19:57:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=msuchanek@suse.de Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id EB12E4E048; Thu, 4 Aug 2022 17:57:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1659635876; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=jY9Tr+CgkpvFiIJdA/bu8GteDNNcrnonhwXzevTvpbY=; b=MJWyoi9dA4k4VN+DlqSqq509bna+hbN1AulROIYsClhQQgtYVyUDoa3YfEGi9TNZVbCx4C 9IyVurtlpKBcZwPiilTsblBarB9auRRpF0xVWr+uLPjJfZpnnjBKLWm+8RMxMEbryM5pJ5 7ZD+uuiMnVUMwqCDeq74U1xujmvHSJg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1659635876; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=jY9Tr+CgkpvFiIJdA/bu8GteDNNcrnonhwXzevTvpbY=; b=p3GDyVYWyzLtDwS8YS98rkj8X1X32T0z2s4iwPAWIkofU9Fn9N5yynFc/wLsXBAtNK6MEc WpEcpI0ib2+mF9Cg== Received: from naga.suse.cz (unknown [10.100.224.114]) by relay2.suse.de (Postfix) with ESMTP id C256E2C141; Thu, 4 Aug 2022 17:57:56 +0000 (UTC) From: Michal Suchanek To: u-boot@lists.denx.de Cc: Michal Suchanek , Marek Vasut , Simon Glass , AKASHI Takahiro Subject: [PATCH] doc: dm: clarify activation. Date: Thu, 4 Aug 2022 19:57:45 +0200 Message-Id: <20220804175746.3746-1-msuchanek@suse.de> X-Mailer: git-send-email 2.37.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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.6 at phobos.denx.de X-Virus-Status: Clean Explain when devices should get activated. Signed-off-by: Michal Suchanek --- doc/develop/driver-model/design.rst | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/doc/develop/driver-model/design.rst b/doc/develop/driver-model/design.rst index 5f33f9fbb3..c925d21b24 100644 --- a/doc/develop/driver-model/design.rst +++ b/doc/develop/driver-model/design.rst @@ -794,8 +794,26 @@ fall afoul of this rule. Activation/probe ^^^^^^^^^^^^^^^^ -When a device needs to be used, U-Boot activates it, by first reading ofdata -as above and then following these steps (see device_probe()): +To save resources devices in U-Boot are probed lazily. U-Boot is a bootloader, +not an operating system. Many devices are never used during an U-Boot run, and +probing them takes time, requires memory, may add delays to the main loop, etc. + +The device should be probed by the uclass code. Different uclasses are +different but two common use cases can be seen: + + 1. The uclass is asked to look up a specific device, such as SPI bus 0, + first chip select - in this case the returned device should be + activated. + + 2. The uclass is asked to perform a specific function on any device that + supports it, eg. reset the board using any sysreset that can be found - + for this case the core uclass code provides iterators that activate + each device before returning it, and the uclass typically implements a + walk function that iterates over all devices of the uclass and tries + to perform the requested function on each in turn until succesful. + +To activate a device U-Boot first reads ofdata as above and then follows these +steps (see device_probe()): 1. All parent devices are probed. It is not possible to activate a device unless its predecessors (all the way up to the root device) are activated. -- 2.37.1