[PATCH 2/2] distro_bootcmd: add sf SPI flash boot support

Tom Rini trini at konsulko.com
Fri Apr 24 17:26:31 CEST 2020


On Tue, Apr 21, 2020 at 09:26:35PM +0200, Tobias Schramm wrote:

> This commit adds generic boot support for SPI flash.
> Adding SPI flash support to a device can be achieved by adding
> following declaration to the BOOT_TARGET_DEVICES
> 
> 	func(SF, sf, <spibus>[:<cs>], <mtd partition>)
> 
> Signed-off-by: Tobias Schramm <t.schramm at manjaro.org>
> Cc: Patrick Wildt <patrick at blueri.se>
> Cc: AKASHI Takahiro <takahiro.akashi at linaro.org>
> ---
>  include/config_distro_bootcmd.h | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
> 
> diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h
> index aacfb309da..02b70dd271 100644
> --- a/include/config_distro_bootcmd.h
> +++ b/include/config_distro_bootcmd.h
> @@ -67,6 +67,27 @@
>  	BOOT_TARGET_DEVICES_references_MMC_without_CONFIG_CMD_MMC
>  #endif
>  
> +#ifdef CONFIG_CMD_SF
> +#define BOOTENV_SHARED_SF \
> +		"sf_boot=if sf probe ${devnum}; then " \
> +			"sf read ${scriptaddr} ${distro_bootpart} && "\
> +			"source ${scriptaddr}; " \
> +		"fi\0"
> +#define BOOTENV_DEV_SF(devtypeu, devtypel, instance, bootpart) \
> +	"bootcmd_" #devtypel #instance "=" \
> +		"devnum=" #instance "; " \
> +		"distro_bootpart=" #bootpart "; " \
> +		"run " #devtypel "_boot\0"
> +#define BOOTENV_DEV_NAME_SF(devtypeu, devtypel, instance, bootpart) \
> +	#devtypel #instance " "
> +#else
> +#define BOOTENV_SHARED_MMC
> +#define BOOTENV_DEV_SF \
> +	BOOT_TARGET_DEVICES_references_SF_without_CONFIG_CMD_SF
> +#define BOOTENV_DEV_NAME_SF \
> +	BOOT_TARGET_DEVICES_references_SF_without_CONFIG_CMD_SF
> +#endif
> +
>  #ifdef CONFIG_CMD_UBIFS
>  #define BOOTENV_SHARED_UBIFS \
>  	"ubifs_boot=" \
> @@ -408,6 +429,7 @@
>  #define BOOTENV \
>  	BOOTENV_SHARED_HOST \
>  	BOOTENV_SHARED_MMC \
> +	BOOTENV_SHARED_SF \
>  	BOOTENV_SHARED_PCI \
>  	BOOTENV_SHARED_USB \
>  	BOOTENV_SHARED_SATA \

I'm adding Jagan here as he's been working on something similar and
includes moving the new logic to a new include file.  Thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200424/bf3b55af/attachment.sig>


More information about the U-Boot mailing list