public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Rafał Miłecki" <zajec5@gmail.com>
To: Michal Simek <michal.simek@xilinx.com>,
	Ricardo Salveti <ricardo@foundries.io>,
	u-boot@lists.denx.de, Jorge Ramirez <jorge@foundries.io>,
	Igor Opaniuk <igor.opaniuk@foundries.io>,
	Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Subject: Re: Unable to select a different ENV location due env_get_location on zynqmp
Date: Tue, 15 Feb 2022 08:51:46 +0100	[thread overview]
Message-ID: <0bd92ecc-ce5f-da29-1636-d8e18aec6e81@gmail.com> (raw)
In-Reply-To: <d2169669-8c37-5650-f162-62e3cb73a0d4@xilinx.com>

Hi,

On 15.02.2022 08:41, Michal Simek wrote:
> On 2/14/22 21:10, Ricardo Salveti wrote:
>> This is a bit similar to the issue raised on iMX8-based targets a few
>> days ago, which is forcing the environment location based on the boot
>> mode and not allowing the user to use a different option via other
>> CONFIG options.
>>
>> Should we really force the env location based on boot mode? Currently
>> there is no way to boot out of QSPI and save the environment on
>> emmc/fat/ext4, and removing CONFIG_ENV_IS_IN_SPI_FLASH causes the env
>> location to be set as ENVL_NOWHERE, which is not ideal, especially
>> when other env target locations are available at build time.
>>
>> diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
>> index f0be9c022a7..08afb49570a 100644
>> --- a/board/xilinx/zynqmp/zynqmp.c
>> +++ b/board/xilinx/zynqmp/zynqmp.c
>> @@ -969,6 +969,10 @@ enum env_location env_get_location(enum
>> env_operation op, int prio)
>>          case QSPI_MODE_32BIT:
>>                  if (IS_ENABLED(CONFIG_ENV_IS_IN_SPI_FLASH))
>>                          return ENVL_SPI_FLASH;
>> +               if (IS_ENABLED(CONFIG_ENV_IS_IN_FAT))
>> +                       return ENVL_FAT;
>> +               if (IS_ENABLED(CONFIG_ENV_IS_IN_EXT4))
>> +                       return ENVL_EXT4;
>>                  return ENVL_NOWHERE;
>>          case JTAG_MODE:
>>          default:
>>
>> A change like this one would allow other locations to be set, and just
>> use the boot mode to assign the priority instead.
>>
>> Since I couldn't really find out what is the expected behavior on
>> functions defined at soc/board level (env.c sets based on priority,
>> depending on what is enabled at build time), I was wondering if we
>> shouldn't just drop this function entirely.
>>
>> While I agree the board should have a set of defaults, not allowing
>> the user to change something like env location via CONFIGs seems wrong
>> to me.
>>
>> Let me know what you think.
> 
> Default location is setup based on how Xilinx sees where that variables should be saved for the most cases that's why that function was done like this.
> That's why I think that it is very reasonable default setup.
> And as is hopefully known we are using pretty generic u-boot which should work on all configurations it means default defconfig have all options enabled.
> 
> Does it make sense to have an option to change it to any configuration?
> Definitely.
> 
> How to do it?
> DT is for us source of truth that's why I prefer to have DT description which is providing all information. It means say where variables should be stored, where redundant variables should be stored. IIRC as of today I think they have to be on the same device which can be also more flexible. You can specify different start/end in qspis, etc.
> 
> What has to happen?
> Someone has to take a lead and come up with generic universal DT binding to be able describe it. Some days ago linaro had similar issue with DT in connection to A/B update via GPT partition. And description for it should be pretty much the same as is for variables.

I'm not very familiar with U-Boot & iMX but I actually started working
on DT binding for U-Boot env.

Please check:
[PATCH V2 2/3] dt-bindings: nvmem: add U-Boot environment variables binding
https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20211230090449.11808-2-zajec5@gmail.com/

I received feedback from Rob on January and I'm working on next version
of my patch this very moment. I'll cc U-Boot this time obviously.

  reply	other threads:[~2022-02-15  7:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-14 20:10 Unable to select a different ENV location due env_get_location on zynqmp Ricardo Salveti
2022-02-15  7:41 ` Michal Simek
2022-02-15  7:51   ` Rafał Miłecki [this message]
2022-02-15 13:27   ` Jorge Ramirez-Ortiz, Foundries
2022-02-15 13:54     ` Michal Simek
2022-02-15 15:02       ` Sean Anderson
2022-02-15 15:39         ` Michal Simek
2022-02-17  0:43           ` Ricardo Salveti
2022-02-17  7:51             ` Michal Simek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0bd92ecc-ce5f-da29-1636-d8e18aec6e81@gmail.com \
    --to=zajec5@gmail.com \
    --cc=igor.opaniuk@foundries.io \
    --cc=jorge@foundries.io \
    --cc=michal.simek@xilinx.com \
    --cc=oleksandr.suvorov@foundries.io \
    --cc=ricardo@foundries.io \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox