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 1617FEB64D8 for ; Wed, 14 Jun 2023 16:32:52 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 722E986187; Wed, 14 Jun 2023 18:32:50 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=mailbox.org 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; secure) header.d=mailbox.org header.i=@mailbox.org header.b="pA9ZFJTw"; dkim=pass (2048-bit key) header.d=mailbox.org header.i=@mailbox.org header.b="RrKGs7cz"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6D201861B0; Wed, 14 Jun 2023 18:32:48 +0200 (CEST) Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [IPv6:2001:67c:2050:0:465::201]) (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 7E88986131 for ; Wed, 14 Jun 2023 18:32:45 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=mailbox.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=marek.vasut@mailbox.org Received: from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4Qh9vK2JnHz9sRJ; Wed, 14 Jun 2023 18:32:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1686760365; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GLWCfsecN5SeklSNY6mH2zTvRWxf2rufwQf9h1Jq2pQ=; b=pA9ZFJTwimVXzJTrLWLmT2IZPRezitI93vlD74WIK0hvrFueEoZ9uXoLkxc+KVP2+4aGSv 03rXYtyJ+ldYX7BXrTRLMA29qZMs4AI22061NY8pyRpdje0hsi4+crrnB6VKXIBoyWO3Fx kycYhrhnprZtUDe8s+3mlTSah73gcV0Vl3Wz6j51zcH7tApLYG6bEPHXd/OCYV/gmrS0tK 543AP7hmWu6NNgspCg7lMj0yhCfS9M85UT3YoxMjg7BQeNb+uthyoWen1Nuab3TCrDltel 2qpFo8bJrj6ZQkSZRt0DEyW7PoC2YydLx2Zh4bQEiVJShaVywTvo9qc3C327Xw== Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1686760363; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GLWCfsecN5SeklSNY6mH2zTvRWxf2rufwQf9h1Jq2pQ=; b=RrKGs7czBv7LO1Tn50AKzCE1PPeo4QdvOcBHYCZE5o4a3gCgULyuVGTX6BzxQAxk8v/aCa ZzV40WMX4gTPON/M251tFP5RK2w+Z69akkuh0J3S99M1+2mOYtw+cAryHlOwHBUtlC9KPq s7zemlEb0YOfntX3qBvDYbLpFzYg3eUOavpq+dVTNa29ArgSeRT7UVo24G5i5AnchsYjzB C/3ueiU4BbCybY7hImeQwpkHvzr3auu4doZ9vefxFfm+6rSieZwTQTaVOIjOYyp9qWH4gl Nla0fFTHATATO7sXLqQ5X34TNIaIQNc8X8rv1AXwttZMgCKFrpretH7nDz8MHA== Date: Wed, 14 Jun 2023 18:32:41 +0200 MIME-Version: 1.0 Subject: Re: [PATCH v2 3/3] renesas: rcar3: Load the correct device tree Content-Language: en-US To: Detlev Casanova , u-boot@lists.denx.de Cc: Marek Vasut , Hai Pham , Tam Nguyen References: <20230612195107.171748-1-detlev.casanova@collabora.com> <5942794.lOV4Wx5bFT@arisu> <300e3a86-345e-a82f-d40c-557517063255@mailbox.org> <2286001.ElGaqSPkdT@arisu> From: Marek Vasut In-Reply-To: <2286001.ElGaqSPkdT@arisu> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-MBO-RS-ID: 3a08272a1f211d69164 X-MBO-RS-META: 4643g8rubfxkxbhkm84e1r6e83ummgjo 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 6/14/23 17:40, Detlev Casanova wrote: > On Wednesday, June 14, 2023 11:32:31 A.M. EDT Marek Vasut wrote: >> On 6/14/23 17:10, Detlev Casanova wrote: >>> On Wednesday, June 14, 2023 9:53:14 A.M. EDT Marek Vasut wrote: >>>> On 6/12/23 21:51, Detlev Casanova wrote: >>>>> The Renesas R-Car Gen3 boards use different device trees than >>>>> the default one. >>>>> >>>>> This commit uses the sysinfo's board id and revision >>>>> >>>>> to determine which linux device tree to load: >>>>> * H3 (Starter Kit Premier v2.0): renesas/r8a77951-ulcb.dtb >>>>> * H3e (Starter Kit Premier v2.1): renesas/r8a779m1-ulcb.dtb >>>> >>>> This is not about loading DTs (as the subject would suggest), this is >>>> about setting the correct default DT name in environment. >>>> >>>>> Signed-off-by: Detlev Casanova >>>>> --- >>>>> >>>>> board/renesas/ulcb/ulcb.c | 59 >>>>> ++++++++++++++++++++++++++++++++++++ >>>>> configs/rcar3_ulcb_defconfig | 1 + >>>>> 2 files changed, 60 insertions(+) >>>>> >>>>> diff --git a/board/renesas/ulcb/ulcb.c b/board/renesas/ulcb/ulcb.c >>>>> index 1477750f921..cc78e0952b6 100644 >>>>> --- a/board/renesas/ulcb/ulcb.c >>>>> +++ b/board/renesas/ulcb/ulcb.c >>>>> @@ -27,6 +27,7 @@ >>>>> >>>>> #include >>>>> #include >>>>> #include >>>>> >>>>> +#include >>>>> >>>>> DECLARE_GLOBAL_DATA_PTR; >>>>> >>>>> @@ -65,6 +66,64 @@ int board_init(void) >>>>> >>>>> return 0; >>>>> >>>>> } >>>>> >>>>> +int misc_init_r(void) >>>>> +{ >>>>> + struct udevice *dev; >>>>> + int board_id; >>>>> + int rev_major, rev_minor; >>>>> + int ret = sysinfo_get(&dev); >>>>> + >>>>> + if (ret) { >>>>> + debug("Cannot get sysinfo: %d\n", ret); >>>>> + return 0; >>>> >>>> Why do we ignore errors here ? >>>> >>>>> + } >>>>> + >>>>> + ret = sysinfo_detect(dev); >>>>> + if (ret) { >>>>> + debug("Cannot detect sysinfo: %d\n", ret); >>>>> + return 0; >>>>> + } >>>> >>>> Looking at all this, I really have to wonder, wouldn't it be nicer to >>>> introduce a 'sysinfo' command which provides interface to obtain the >>>> different properties (like board name, id, revision ...) from U-Boot >>>> command line, and then script the DT selection in U-Boot shell ? >>> >>> Yes, that could be a good option. This is more based on how raspberry pis >>> are selecting the correct devicetree in `board/raspberrypi/rpi/rpi.c`. It >>> is either about having simple shell scripts that are similar between >>> devices and the implementation is "hidden" in C for each platform (maybe >>> easier to use but less flexible). Or more complex shell scripts with >>> simpler C implementation (more flexible but having to modify a boot >>> script can become complicated for users) >>> >>> Has this direction choice been discussed in the past already ? >> >> The less hard-coded board code (which cannot be updated by the user >> easily), the better. Scripts can be updated in deployment far easier >> than the bootloader itself. Hence the push for scripts over custom C code. > > That makes sense. I'll create a new command for this then and use it to select > the dtb in the ulcb boards script. Thanks !