]> git.dujemihanovic.xyz Git - u-boot.git/commit
env_spi: support overriding spi dev from board code
authorVenkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Fri, 14 Jun 2024 12:48:10 +0000 (18:18 +0530)
committerMichal Simek <michal.simek@amd.com>
Mon, 5 Aug 2024 14:10:36 +0000 (16:10 +0200)
commit7d84ad1da0e32f4525cee9b35bc5a4f3b5585ed8
tree510151b9bcf2bd22bd6352bd84bc16a8ac954418
parentc43d65e2664397141834bad6f08711bdb8b2df70
env_spi: support overriding spi dev from board code

This enables boards to choose where to/from the environment
should be saved/loaded. They can then for example support using
the same device (dynamically) from which the bootloader was
launched to load and save env data and do not have to
define CONFIG_ENV_SPI_BUS statically.

In my use case, the environment needs to be on the same device I
booted from. It can be the QSPI or OSPI device.
I therefore would override spi_get_env_dev in the board code,
read the bootmode registers to determine where we booted from
and return the corresponding device index.

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Link: https://lore.kernel.org/r/20240614124811.22945-2-venkatesh.abbarapu@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com> # Move spi_get_env_dev to sf.c
env/sf.c
include/spi.h