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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B743DC433F5 for ; Tue, 26 Oct 2021 13:56:12 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id D48A760D07 for ; Tue, 26 Oct 2021 13:56:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D48A760D07 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6251980F5F; Tue, 26 Oct 2021 15:56:09 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.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; unprotected) header.d=linaro.org header.i=@linaro.org header.b="zbG8iYWb"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8E2AA81F0B; Tue, 26 Oct 2021 15:56:06 +0200 (CEST) Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) (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 53E2880F1A for ; Tue, 26 Oct 2021 15:56:00 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org Received: by mail-wr1-x42e.google.com with SMTP id d3so15267113wrh.8 for ; Tue, 26 Oct 2021 06:56:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=smrqDNoxxRAGWGGK2DzZa40kjjsfQX1tX9bmBv1lUjA=; b=zbG8iYWbnu3Rx5sBiUH9guzRZuYQsbra4hX4UXA9ok9oLD0Pb9vOhBzXQlVUJqAJ0a LHpH9THsn26A9dWe/M+AWRh4JRtJJKIVTlgVMqppzTxLQSgjrsY/NiJIulEGwkQ/B4Gz AQBhpHEAaLPAhdHPF6h2XqdMhpRCTE9ee9GnIEVBwOXMa8oNkQGLZoU5jMWfu/z9qacd soYRS01g3COlhsY5nGlSVioWoGtBi58n2grsVU7DU8bVBiq7h8les52yOQwtpzSPLDkz Dj3D91W/uEHt8MiXHG8IQMXQl7eB190Te3T+hmC9Amov7CvZgC/fsIf8xaMNrTk2vMlW Uh7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=smrqDNoxxRAGWGGK2DzZa40kjjsfQX1tX9bmBv1lUjA=; b=ctOviNvlhjritoevEsgc0npYryr49DZ+Q+y9GV4xpS03RSb5ZffxtUQ+vF86D16VVv XHYv0zMAeqZOwR1dA6K4sWQ+JGl2q2ZVV0sXEynXuVDYOP7gR1wo3lPwtxWKwguYw0CJ MTth+WqZ2JfAowFJcpcEIklHEGgLkB+QcRIEK4Rm9SHIP6VV7qzwUfrnwPVA/r+oTQ9V mYXKGcKzipvVR7NO7RF0h012Ps+oqkujz7IAU5SeE8wXtqUVMZJTznj+WCBGwRfaqPfI PdCGxSQ+aIs91bxQsSus8cyHWSTAkHGat7NZJdZ9gMerl713IbGRy0cEbOc2QgV+PS0t ZJWA== X-Gm-Message-State: AOAM531aOouYBIo2YhMdBzF65CGlGlePMgaZXK0pe4BaOz/0yRiE6311 Q6uIuyIxt9LgFNGtXIaKgPT5Mw== X-Google-Smtp-Source: ABdhPJzFWooQI4RiKOAr/f8sQ6+aImbMF5dAFZLb75axDJc/Hu6ddq00/VrVHX9NdySp1RtPx3KAuQ== X-Received: by 2002:a05:6000:2a2:: with SMTP id l2mr24897686wry.109.1635256559797; Tue, 26 Oct 2021 06:55:59 -0700 (PDT) Received: from apalos.home (ppp-94-66-220-13.home.otenet.gr. [94.66.220.13]) by smtp.gmail.com with ESMTPSA id z17sm660973wml.15.2021.10.26.06.55.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Oct 2021 06:55:59 -0700 (PDT) Date: Tue, 26 Oct 2021 16:55:56 +0300 From: Ilias Apalodimas To: Simon Glass Cc: U-Boot Mailing List , Mark Kettenis , Heinrich Schuchardt , Tom Rini , Sean Anderson , Jerry Van Baren Subject: Re: [PATCH v5 26/26] fdt: Don't call board_fdt_blob_setup() without OF_BOARD Message-ID: References: <20211026002344.405160-1-sjg@chromium.org> <20211026002344.405160-27-sjg@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211026002344.405160-27-sjg@chromium.org> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean Hi Simon, As I said here [1], this is moving on an entirely different direction I had in mind. I'd much prefer starting the discussions for a solution that allows us to scale. FWIW I think the current code is still not clean for my taste. Commit 3b595da441cf ("fdtdec: allow board to provide fdt for CONFIG_OF_SEPARATE") allowed this function to be used regardless of the config options. IMHO we should have 2 clear options: - U-Boot provides the DTB - It's somehow passed over to U-Boot On Mon, Oct 25, 2021 at 06:23:44PM -0600, Simon Glass wrote: > At present this override function is called even when OF_BOARD Is not > enabled. This makes it impossible to disable this feature and in fact > makes the OF_BOARD option useless. > > Reinstate its intended purpose, so that it is possible to switch between > the appended devicetree and one provided by the board's custom function. > > Signed-off-by: Simon Glass > --- > > Changes in v5: > - Add new patches to clean up fdtdec_setup() and surrounds > > include/fdtdec.h | 7 +++++-- > lib/fdtdec.c | 17 +++++++++++------ > 2 files changed, 16 insertions(+), 8 deletions(-) > > diff --git a/include/fdtdec.h b/include/fdtdec.h > index 386f6611294..b2faa84008e 100644 > --- a/include/fdtdec.h > +++ b/include/fdtdec.h > @@ -1170,8 +1170,11 @@ int fdtdec_resetup(int *rescan); > > /** > * Board-specific FDT initialization. Returns the address to a device tree blob. > - * Called when CONFIG_OF_BOARD is defined, or if CONFIG_OF_SEPARATE is defined > - * and the board implements it. > + * Called when CONFIG_OF_BOARD is defined. > + * > + * The existing devicetree is available at gd->fdt_blob > + * > + * @returns new devicetree blob pointer > */ > void *board_fdt_blob_setup(void); > > diff --git a/lib/fdtdec.c b/lib/fdtdec.c > index 067c27d0aa3..da36dffec62 100644 > --- a/lib/fdtdec.c > +++ b/lib/fdtdec.c > @@ -1203,11 +1203,12 @@ static int uncompress_blob(const void *src, ulong sz_src, void **dstp) > return 0; > } > > -/* > - * For CONFIG_OF_SEPARATE, the board may optionally implement this to > - * provide and/or fixup the fdt. > +/** > + * fdt_find_separate() - Find a devicetree at the end of the image > + * > + * @return pointer to FDT blob > */ > -__weak void *board_fdt_blob_setup(void) > +static void *fdt_find_separate(void) > { > void *fdt_blob = NULL; > #ifdef CONFIG_SPL_BUILD > @@ -1623,11 +1624,15 @@ int fdtdec_setup(void) > int ret; > > /* The devicetree is typically appended to U-Boot */ > - if (IS_ENABLED(CONFIG_OF_SEPARATE) || IS_ENABLED(CONFIG_OF_BOARD)) > - gd->fdt_blob = board_fdt_blob_setup(); > + if (IS_ENABLED(CONFIG_OF_SEPARATE)) > + gd->fdt_blob = fdt_find_separate(); > else /* embed dtb in ELF file for testing / development */ > gd->fdt_blob = dtb_dt_embedded(); > > + /* Allow the board to override the fdt address. */ > + if (IS_ENABLED(CONFIG_OF_BOARD)) > + gd->fdt_blob = board_fdt_blob_setup(); > + > if (!IS_ENABLED(CONFIG_SPL_BUILD)) { > /* Allow the early environment to override the fdt address */ > gd->fdt_blob = map_sysmem(env_get_ulong("fdtcontroladdr", 16, > -- > 2.33.0.1079.g6e70778dc9-goog > [1] https://lore.kernel.org/u-boot/YXekTkeL73NM0UOU@apalos.home/ Regards /Ilias