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 AC0F1C433F5 for ; Sat, 23 Apr 2022 00:17:11 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B785182A52; Sat, 23 Apr 2022 02:17:08 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="HuZUjIaT"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4F1F981DCD; Sat, 23 Apr 2022 02:17:06 +0200 (CEST) Received: from mail-qt1-x836.google.com (mail-qt1-x836.google.com [IPv6:2607:f8b0:4864:20::836]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A403282A52 for ; Sat, 23 Apr 2022 02:17:02 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=seanga2@gmail.com Received: by mail-qt1-x836.google.com with SMTP id d9so6629066qty.12 for ; Fri, 22 Apr 2022 17:17:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=bZQlaj+veuhqI85MA/c9q/hHq0NB7Bnqx8kcPw4ij84=; b=HuZUjIaTkse+1oiu4IFb3V3lW1o0azp1Gyyl4iYeBEvF9qoS8ywDqm6UgEE6YG2K3g h5fAnmc8BGvkavy5UJuKDUi673h2L407bmdRn7ia1Tl89l6bbjKAXb3IOxS2RR9eG4x0 7YIlaG7TcOp3pS5+ivG0OSqtLiuY26dNYmmnG+9E9RL2ajX9iqQEM+Wk8KetAN63YhjA zm7e69cqG9U5QYCdTExGxj6/cQWiueS9XPuyryTZHCHADvMHIa0GVPrd1/7lFcyy4Fy6 bpA63DFQSMxR9i+jeV+LqiDW7Wm9KXHQzcz3m4GN0nf2xOS+5JMuFXe/QVn5Js3+Mj1i GSBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=bZQlaj+veuhqI85MA/c9q/hHq0NB7Bnqx8kcPw4ij84=; b=B0iTJknj90D9I+IZwCXs4iDq/7G9yeYvjX8W09sIiZdOOTPi+AyIuumvaL7fv+Dq1/ vKmiblNHuohNYc6y9jLdzBDEu53Rtqptt1MV6hcjvGajFkYSljBVzSCufiCC+2qnZb2G Ien+5YOI+4o+IOGoRtHNs2Cpqd31QGuDSq9BVc94k8BGrPalK6EXdVCn4tewhk/Y7OC3 z24WoSQMe+n2+Ev0l4RTNRQwrTg9cHWe1qyWc4ujbPNuEj1ru9aDdKQeokXGyJoBmzOA bWERma6bb4ODeJhQT/PW0kARNyziHSxEjte4qQZ/JHCrPv/8khrpvWIXAPra2JiNMUq4 N3+A== X-Gm-Message-State: AOAM5305fmNi9xv39DYDfEFVL14x6rWeX3uTYuR+poyb/l8OeNAXolRV mtSA/wF6DIO7GRxNi1vFE5s= X-Google-Smtp-Source: ABdhPJw4xosxLTTkOJIx5X7JTFCnw5kLC0dRHbW+OShZL3fp6Rwv8Z/ZURQk/oHp3xToHSmRhQQ8fA== X-Received: by 2002:a05:622a:1c5:b0:2f1:f99f:b74b with SMTP id t5-20020a05622a01c500b002f1f99fb74bmr5271593qtw.602.1650673021329; Fri, 22 Apr 2022 17:17:01 -0700 (PDT) Received: from [192.168.1.201] (pool-108-18-137-133.washdc.fios.verizon.net. [108.18.137.133]) by smtp.googlemail.com with ESMTPSA id y15-20020a05620a09cf00b0069c80404de6sm1460611qky.31.2022.04.22.17.17.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 22 Apr 2022 17:17:00 -0700 (PDT) Subject: Re: [PATCH 1/3] dm: core: Add DM_FLAG_PROBE_AFTER_BIND flag To: Marek Vasut , u-boot@lists.denx.de Cc: Patrice Chotard , Patrick Delaunay , Simon Glass , Steven Lawrance References: <20220422131555.123598-1-marex@denx.de> <768910e4-b324-9956-4035-50798e0a3d74@denx.de> <45ab9552-34ed-6d18-c99b-6287d0c54c3a@gmail.com> From: Sean Anderson Message-ID: <464acf42-585f-56fb-f50b-01dae4dbd41e@gmail.com> Date: Fri, 22 Apr 2022 20:16:59 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit 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.5 at phobos.denx.de X-Virus-Status: Clean On 4/22/22 7:07 PM, Marek Vasut wrote: > On 4/23/22 00:45, Sean Anderson wrote: >> On 4/22/22 9:52 AM, Marek Vasut wrote: >>> On 4/22/22 15:49, Sean Anderson wrote: >>>> On 4/22/22 9:15 AM, Marek Vasut wrote: >>>>> Introduce DM_FLAG_PROBE_AFTER_BIND flag, which can be set by driver or >>>>> uclass in .bind(), to indicate such driver instance should be probe()d >>>>> once binding of all devices is complete. >>>>> >>>>> This is useful in case the driver determines that hardware initialization >>>>> is mandatory on boot, and such initialization happens only in probe(). >>>>> This also solves the inability to call device_probe() from .bind(). >>>> >>>> So why not add an init_leds function to init_sequence_r? >>> >>> Because this flag is generic solution and not hack specific to LEDs. >> >> Isn't init_sequence_r the generic solution? > > No, init_sequence_r is just a list of functions that gets called early on during boot to bring U-Boot up. One of the functions is initr_dm(), DM init, which brings up the driver model. The init_sequence_r has nothing to do with driver binding or probing though, that's the DM job. > >> Every device gets probed that way (or directly as a result of a command). > > No device probe gets triggered via init_sequence_r. > There are many ad-hoc device_probe() calls in the various init_sequence_r function implementation, Every device in U-Boot is probed in one of three ways - As a dependency of another device (clocks, pinmuxes, gpios, etc.) - Directly on the command line (most boot devices) - From an init_sequence (timers, watchdogs, serial, PCI, gpio hogs, etc.) The goal of course being to minimize the amount of probed devices. This of course requires having some things at the "root" of the tree. In Linux, everything bound is probed until nothing more can be probed. In that sense, under Linux everything is the "root" of the tree. But for U-Boot the second two options specify the "roots." Some of the things in init_sequence are ad-hoc, especially the non-DM stuff. LEDs are pretty ad-hoc, last I checked, but that's mainly because there are 2-3 separate non-DM ways to control LEDs. > but that's all there because there is no better way to implement that within the DM framework so far. Now there is, with this flag, so those workarounds can also be cleaned up. This *is* within the DM framework. Adding a flag which is set on bound devices has the same effect as dm_mux_init does when called from initr_dm_devices. The only difference is implementation. So why is this better? --Sean