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 E4340C433EF for ; Thu, 27 Jan 2022 17:01:44 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1B46783039; Thu, 27 Jan 2022 18:01:43 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.b="QUA/TvT1"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 29D32832DD; Thu, 27 Jan 2022 18:01:41 +0100 (CET) Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) (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 1497281F9A for ; Thu, 27 Jan 2022 18:01:38 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=michael@amarulasolutions.com Received: by mail-pj1-x1031.google.com with SMTP id nn16-20020a17090b38d000b001b56b2bce31so3544254pjb.3 for ; Thu, 27 Jan 2022 09:01:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=HzJ59+OlSlJ43xTrLZ7NaFQypeb2m1b4zBl87M6TMYE=; b=QUA/TvT1Lth9+tfpEth3JzpMHfJ+Ykt0VvwiCyKYw0zAgK2WOgXAdnXJ4dbQirHQUW JLHNLnvnbiwQjq5ZEo+kPUOeGLrCkLpnemnn5tyluHfRa1D29XoA3Ihb8DU4mGlekEbE Wd/XhLF7Ibt1StiP0P6N4Gk1+/CkVoignm1vQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=HzJ59+OlSlJ43xTrLZ7NaFQypeb2m1b4zBl87M6TMYE=; b=GGhY0rwvppzuHoGTd2YiAb3d6qAZ0CtS9uSgyMR+AaH+oit4hY1hKLJwOFCTeAqQke l4oYEmqBYzK1EYogtqreoNc07nUPLy1cwFuM8p7eSk5RdMTuWzjZIs7HYcC82u+Amq92 8sDBgpR/cI+4U5IGNodwabRCwU5V4jarMyPmLCuxIfva48IALIGQg6od4XgWh2LGnogV exDHKnLs+T9U4ebs2XJDJCmq8r3ACCEP/0565h+3SDXr8wSwUig0EZrvNU01FFXcZjFm hUlMTsC1wBHYpU6PXl8XgJKu0nVGeSIGe5NElUXD05Z6Rv/McpCbYWbLQ87DIS7JqX8D qQjg== X-Gm-Message-State: AOAM530++D5yI8n747D8o77nhH9yLU96raU4TXkPBhI3jIAvWhHGIOo2 cvnoLG7/3a1SUGCHhkhFsCwfLxbpDZJmZHRrhGfNKA== X-Google-Smtp-Source: ABdhPJx/5PZd54KaexhR72OISaxSawL82vzyGBHm3KZ3C3X9yN4X4F3BSRCvmLVGR0f1d0mCRsmUzx+4SLN+ygV7SBE= X-Received: by 2002:a17:902:a509:: with SMTP id s9mr4665532plq.134.1643302894390; Thu, 27 Jan 2022 09:01:34 -0800 (PST) MIME-Version: 1.0 References: <20211225202554.47853-1-tomm.merciai@gmail.com> <20211225202554.47853-5-tomm.merciai@gmail.com> <20220126205849.GA3539@tom-desktop> In-Reply-To: From: Michael Nazzareno Trimarchi Date: Thu, 27 Jan 2022 18:01:22 +0100 Message-ID: Subject: Re: [RFC PATCH v3 4/5] beacon: imx8mn: override env_get_location in imx8mn_beacon.c To: Adam Ford Cc: Tommaso Merciai , Teresa Remmet , U-Boot Mailing List Content-Type: text/plain; charset="UTF-8" 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 Hi On Thu, Jan 27, 2022 at 6:00 PM Adam Ford wrote: > > On Wed, Jan 26, 2022 at 2:58 PM Tommaso Merciai wrote: > > > > On Wed, Jan 26, 2022 at 12:05:22PM -0600, Adam Ford wrote: > > > On Sat, Dec 25, 2021 at 2:26 PM Tommaso Merciai wrote: > > > > > > > > Override env_get_location function at board level, previously dropped > > > > down from arch/arm/mach-imx/imx8m/soc.c > > > > > > > > References: > > > > - commit 37d3e3bb95d7532e2503f115dd6c6762fd3b0262 > > > > > > > > Signed-off-by: Tommaso Merciai > > > > > > > Hi Adam, > > > > > I am going to re-do the patch for the beacon board, because I talked > > > it over with my colleagues, and we'd like to force the environment to > > > one location or another and not base it on whether or not it was the > > > boot device. > > > > > > I guess my questions is what's the status of the remaining patch > > > series, and how do I integrate my desired changes into it? I can send > > > you what I want for my board if you're going to resubmit the series. > > > > It's ok for me. Send me your changes. > > Thanks. > > > > > I wonder if a sub-function could be called where the existing > > > env_get_location() is renamed to something else, but declared as weak > > > can called from env_get_location. Anyone who wants a their own > > > function can write their own so we don't have two functions with the > > > same name declared as weak. > > > > > > What are your thoughts on that? > > > > Right. In this way every boards that use imx8mp/imx8mn can override this > > function according to their own needs. > > > > After trying some different options, I wonder if we can just delete > env_get_location() completely from arch/arm/mach-imx/imx8m/soc.c. > Totally agree. I sent patches to remove in the beginning. That function must be removed Michael > For my board, it does exactly what I want when I delete that function > since the default from env.c is sufficient. I think it's probably > safest to use your original approach to move them to individual board > files with the idea that some people may not need it at all. When > placed into their board files, they can choose what they want for > themselves. > > I would suggest sending a patch without the RFC and place the function > into the various imx8mn and imx8mp boards, but know that you can skip > the beacon board. I would also suggest that you add a note that > people should test this to see if it's really what they want or if > they can live without the code and fall back on the default. > > adam > > > Tommaso > > > > > > > > adam > > > > --- > > > > board/beacon/imx8mn/imx8mn_beacon.c | 35 ++++++++++++++++++++++++++++- > > > > 1 file changed, 34 insertions(+), 1 deletion(-) > > > > > > > > diff --git a/board/beacon/imx8mn/imx8mn_beacon.c b/board/beacon/imx8mn/imx8mn_beacon.c > > > > index 7fe252b262..05ab5613ee 100644 > > > > --- a/board/beacon/imx8mn/imx8mn_beacon.c > > > > +++ b/board/beacon/imx8mn/imx8mn_beacon.c > > > > @@ -6,14 +6,47 @@ > > > > #include > > > > #include > > > > #include > > > > - > > > > +#include > > > > #include > > > > #include > > > > +#include > > > > #include > > > > #include > > > > > > > > DECLARE_GLOBAL_DATA_PTR; > > > > > > > > +enum env_location env_get_location(enum env_operation op, int prio) > > > > +{ > > > > + enum boot_device dev = get_boot_device(); > > > > + enum env_location env_loc = ENVL_UNKNOWN; > > > > + > > > > + if (prio) > > > > + return env_loc; > > > > + > > > > + if (IS_ENABLED(CONFIG_ENV_IS_IN_SPI_FLASH) && dev == QSPI_BOOT) { > > > > + env_loc = ENVL_SPI_FLASH; > > > > + } else if (IS_ENABLED(CONFIG_ENV_IS_IN_NAND) && dev == NAND_BOOT) { > > > > + env_loc = ENVL_NAND; > > > > + } else if (IS_ENABLED(CONFIG_ENV_IS_IN_MMC)) { > > > > + switch (dev) { > > > > + case SD1_BOOT: > > > > + case SD2_BOOT: > > > > + case SD3_BOOT: > > > > + case MMC1_BOOT: > > > > + case MMC2_BOOT: > > > > + case MMC3_BOOT: > > > > + env_loc = ENVL_MMC; > > > > + break; > > > > + default: > > > > + break; > > > > + } > > > > + } else if (IS_ENABLED(CONFIG_ENV_IS_NOWHERE)) { > > > > + env_loc = ENVL_MMC; > > > > + } > > > > + > > > > + return env_loc; > > > > +} > > > > + > > > > #if IS_ENABLED(CONFIG_FEC_MXC) > > > > static int setup_fec(void) > > > > { > > > > -- > > > > 2.25.1 > > > > -- Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 michael@amarulasolutions.com __________________________________ Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 info@amarulasolutions.com www.amarulasolutions.com