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 34A2FC433EF for ; Sat, 1 Jan 2022 23:23:01 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1F85B8111F; Sun, 2 Jan 2022 00:22:59 +0100 (CET) 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="gxff7E9L"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E52C88111F; Sun, 2 Jan 2022 00:22:56 +0100 (CET) Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) (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 A0C4680378 for ; Sun, 2 Jan 2022 00:22:53 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=tomm.merciai@gmail.com Received: by mail-ed1-x52d.google.com with SMTP id n30so9422307eda.13 for ; Sat, 01 Jan 2022 15:22:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=yG/HcCrUbtPzVLZY87ao6Tuzxr6TU9rM3cDTEztfDoo=; b=gxff7E9L9ytmeI/QzOq3tdiODgaDKWnXHpRZ/ASTsipR9EqHjCIwep9z8cQa1Svque 6X0GKScQHFj2ZMM9guvjUzKbEOno1AGwKjlghxXaKI0u1E0UHgx6919sz6+xNaOH1wM+ 1B8whtXxPDdcPJAQHuBeCEL9+wFT1+8lA4ll7FPoW4bpzYFZlSMYnP0IWJqlAHnwuYbn NOGO2RGjFk3cpZyOE/XjnaSU56O3ghi6bdniCZNxf2Z1WeyRWKAKbYLMh+5tREKnv5Hz oucfPnl0A4sbbXBgEmou7LS/gaOMKWQH+sL7Pr9Q4S73bzsFd8f+ENUklTkpSBHHrIS0 hBaA== 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=yG/HcCrUbtPzVLZY87ao6Tuzxr6TU9rM3cDTEztfDoo=; b=JsYOtfFv/cGQe7aXVbRzXi05CSn2FrtpacMb5olkDJUIbmlDDixRk65m52/Ajr1NnR Utv6yXxhb5v4zOnCEVm95ZQkefNbXXPYgarbYKgSHYUFkaLFsEdogpZ31jlfC1pBh+Kj F0bATxTn3UgQF/iP/MlViPWxs3VqJc9kHWNkAT647sD2tD8Cg6zWpWOQ+OI1qNfw/lv1 wTUZZOhM7B5fIO7bA7sadWJ48Wv56miHf39Z803rDZeSd1Cj9nhcHdHjEo+yxG1sbAGu DU2nBTk1lYaO/wPMWqk7591jJLc73edI3ZYlZhafY4Miu3LyPnkKhQPZ+ikaZuR14TCn oNnQ== X-Gm-Message-State: AOAM5326UebeiH9Ecb4EpE91rC3N3lWoYMeAKTH/4whhh4Ai4FfqZIxZ 4D5VUc3WCVNVxPyadMO+TsI4FqJr8FY= X-Google-Smtp-Source: ABdhPJzn8VZm2eu9rgz8oEBm1KuDWszzBoNFzbx1QC73XhjjW5TQWlb3FAEzrpo5NiOj/wzC/9at2g== X-Received: by 2002:aa7:d749:: with SMTP id a9mr38569711eds.232.1641079373252; Sat, 01 Jan 2022 15:22:53 -0800 (PST) Received: from tom-desktop (net-93-71-218-227.cust.vodafonedsl.it. [93.71.218.227]) by smtp.gmail.com with ESMTPSA id k25sm9643635ejk.179.2022.01.01.15.22.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Jan 2022 15:22:52 -0800 (PST) Date: Sun, 2 Jan 2022 00:22:50 +0100 From: Tommaso Merciai To: Peter Robinson Cc: Fabio Estevam , Tom Rini , Stefano Babic , Simon Glass , Breno Lima , Francesco Montefoschi , U-Boot-Denx , linux-fancy Subject: Re: help on udoo_neo power up on mainline uboot Message-ID: <20220101232250.GA14454@tom-desktop> References: <20211228165221.GA127430@tom-desktop> <20211229203305.GA6524@tom-desktop> <20211229220824.GA15234@tom-desktop> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.38 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 On Thu, Dec 30, 2021 at 02:20:07PM +0000, Peter Robinson wrote: > On Thu, Dec 30, 2021 at 2:12 PM Fabio Estevam wrote: > > > > Hi Peter, > > > > On Thu, Dec 30, 2021 at 11:08 AM Peter Robinson wrote: > > > > > That works for my Full board. Interestingly in my playing I had got to > > > similar and had wondered about whether the checkboard function was > > > needed. > > > > > > One minor query on the above is it worth assigning the board_string > > > return to a local variable rather than called the function twice? > > > Either way feel free to add my RB/TB or let me know if you want me to > > > send a patch. > > > Reviewed-by: Peter Robinson > > > Tested-by: Peter Robinson > > > > Thanks for testing. I can send a formal patch after your series gets applied. > > Actually, doing a full boot I get > ERROR: invalid device tree > Found EFI removable media binary efi/boot/bootarm.efi > 1929216 bytes read in 92 ms (20 MiB/s) > libfdt fdt_check_header(): FDT_ERR_BADMAGIC > > And if I interrupt boot and do printenv I get fdtfile=undefined so > while it fixes the detection and printing of the actual model it seems > it's too load for the device tree file logic, which now why I remember > I was looking at the show_board_info function above, the > board_late_init seems to late for the DT logic. > > P Hi Peter, Fabio, What do you think about this solution: First create new static entry in gd: +++ b/include/asm-generic/global_data.h @@ -459,6 +459,7 @@ struct global_data { */ char *smbios_version; #endif + int board_cfg; }; #ifndef DO_DEPS_ONLY static_assert(sizeof(struct global_data) == GD_SIZE); I know maybe is not a clean solution but we can work on it. After, I store inside this variable the configuration calling get_board_value() function from spl: static void spl_dram_init(void) { - int board = get_board_value(); + gd->board_cfg = get_board_value(); struct mx6_ddr_sysinfo sysinfo = { .dsize = 1, /* width of data bus: 1 = 32 bits */ @@ -471,7 +400,7 @@ static void spl_dram_init(void) }; mx6sx_dram_iocfg(32, &mx6_ddr_ioregs, &mx6_grp_ioregs); - if (board == UDOO_NEO_TYPE_BASIC || board == UDOO_NEO_TYPE_BASIC_KS) + if (gd->board_cfg == UDOO_NEO_TYPE_BASIC || gd->board_cfg == UDOO_NEO_TYPE_BASIC_KS) mx6_dram_cfg(&sysinfo, &neo_basic_mmcd_calib, &neo_basic_mem_ddr); Then I use gd->board_cfg in board_string function: static char *board_string(void) { - switch (get_board_value()) { + switch (gd->board_cfg) { case UDOO_NEO_TYPE_BASIC: return "BASIC"; case UDOO_NEO_TYPE_BASIC_KS: On full boot I get the right environment variable for fdtfile, and the right strings on Model and Board print: fdtfile=imx6sx-udoo-neo-basic.dtb Environment size: 4338/8188 bytes => U-Boot SPL 2022.01-rc4-00030-gb3f84a939f-dirty (Jan 02 2022 - 00:01:42 +0100) DEBUG FUNC = get_board_value, LINE = 274, r184 = 0 DEBUG FUNC = get_board_value, LINE = 275, r184 = 0 Trying to boot from MMC1 U-Boot 2022.01-rc4-00030-gb3f84a939f-dirty (Jan 02 2022 - 00:01:42 +0100) CPU: Freescale i.MX6SX rev1.2 996 MHz (running at 792 MHz) CPU: Extended Commercial temperature grade (-20C to 105C) at 44C Reset cause: POR Model: UDOO Neo Basic Board: UDOO Neo BASIC DRAM: 512 MiB MMC: FSL_SDHC: 1, FSL_SDHC: 2 Loading Environment from MMC... OK In: serial Out: serial Err: serial Net: eth0: ethernet@2188000 [PRIME] Hit any key to stop autoboot: 0 What do you think about this solution? Let me know. Thanks, Tommaso