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 X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C28EDC47082 for ; Mon, 7 Jun 2021 09:27:23 +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 533DB61159 for ; Mon, 7 Jun 2021 09:27:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 533DB61159 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=koansoftware.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7660581FB2; Mon, 7 Jun 2021 11:27:19 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=koansoftware.com 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 2F256826AA; Mon, 7 Jun 2021 11:27:18 +0200 (CEST) Received: from mail.koansoftware.com (mail.koansoftware.com [178.79.174.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id AC42A80C58 for ; Mon, 7 Jun 2021 11:27:13 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=koansoftware.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=m.salvini@koansoftware.com Received: from localhost (localhost [127.0.0.1]) by mail.koansoftware.com (Postfix) with ESMTP id 5B90A3FA3B; Mon, 7 Jun 2021 11:27:13 +0200 (CEST) Received: from mail.koansoftware.com ([127.0.0.1]) by localhost (mail.koansoftware.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fxR8yA7iMZ-P; Mon, 7 Jun 2021 11:27:11 +0200 (CEST) Subject: Re: [PATCH] rpi: always set fdt_addr with firmware-provided FDT address To: u-boot@lists.denx.de Cc: =?UTF-8?Q?C=c3=a9dric_Schieli?= , Matthias Brugger References: <20210512123945.25649-1-m.salvini@koansoftware.com> From: Mauro Salvini Message-ID: <24facaf3-f3d1-c847-85c7-97f0b3a96091@koansoftware.com> Date: Mon, 7 Jun 2021 11:27:08 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20210512123945.25649-1-m.salvini@koansoftware.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: it-IT Content-Transfer-Encoding: 8bit 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.102.4 at phobos.denx.de X-Virus-Status: Clean On 12/05/21 14:39, Mauro Salvini wrote: > Raspberry firmware prepares the FDT blob in memory at an address > that depends on both the memory size and the blob size [1]. > After commit ade243a211d6 ("rpi: passthrough of the firmware provided FDT > blob") this FDT is passed to kernel through fdt_addr environment variable, > handled in set_fdt_addr() function in board file. > > When u-boot environment is persistently saved, if a change happens > in loaded FDT (e.g. for a new overlay applied), firmware produces a FDT > address different from the saved one, but u-boot still use the saved > one because set_fdt_addr() function does not overwrite the fdt_addr > variable. So, for example, if there is a script that uses fdt commands for > e.g. manipulate the bootargs, boot hangs with error > > libfdt fdt_check_header(): FDT_ERR_BADMAGIC > > Removing the fdt_addr variable in saved environment allows to boot. > > With this patch set_fdt_addr() function always overwrite fdt_addr value. > > [1] https://www.raspberrypi.org/forums//viewtopic.php?f=107&t=134018 > > Signed-off-by: Mauro Salvini > Cc: Cédric Schieli > Cc: Matthias Brugger > --- > board/raspberrypi/rpi/rpi.c | 3 --- > 1 file changed, 3 deletions(-) > > diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c > index df52a4689f..611013471e 100644 > --- a/board/raspberrypi/rpi/rpi.c > +++ b/board/raspberrypi/rpi/rpi.c > @@ -318,9 +318,6 @@ static void set_fdtfile(void) > */ > static void set_fdt_addr(void) > { > - if (env_get("fdt_addr")) > - return; > - > if (fdt_magic(fw_dtb_pointer) != FDT_MAGIC) > return; > > Hi all, kind ping. Regards -- Mauro Salvini | KOAN sas | Bergamo - Italia embedded software engineering http://KoanSoftware.com