On Fri, Jun 8, 2018 at 9:48 PM Adam Ford <aford...@gmail.com> wrote:
>
> When enabling BLOCK_CACHE on devices with limited RAM during SPL,
> some devices may not boot.  This creates an option to enable
> block caching in SPL by defaults off.  It is dependant on BLOCK_CACHE
> and SPL_BLK
>
> Fixes: 46960ad6d09b ("block: Have BLOCK_CACHE default to y in some cases")
>
> Signed-off-by: Adam Ford <aford...@gmail.com>
>
> diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
> index 0792373cfc..8ef363b3d4 100644
> --- a/drivers/block/Kconfig
> +++ b/drivers/block/Kconfig
> @@ -37,6 +37,13 @@ config BLOCK_CACHE
>           it will prevent repeated reads from directory structures and other
>           filesystem data structures.
>
> +config SPL_BLOCK_CACHE
> +       bool "Use block device cache in SPL"
> +       depends on BLOCK_CACHE && SPL_BLK
> +       default n
> +       help
> +         This option enables the disk-block cache in SPL
> +
>  config IDE
>         bool "Support IDE controllers"
>         select HAVE_BLOCK_DEVICE
> diff --git a/drivers/block/Makefile b/drivers/block/Makefile
> index 5fcafb193e..a9af28a552 100644
> --- a/drivers/block/Makefile
> +++ b/drivers/block/Makefile
> @@ -11,4 +11,9 @@ endif
>
>  obj-$(CONFIG_IDE) += ide.o
>  obj-$(CONFIG_SANDBOX) += sandbox.o
> +ifdef CONFIG_SPL_BUILD
> +obj-$(SPL_BLOCK_CACHE) += blkcache.o

CONFIG_SPL_BLOCK_CACHE?

> +endif
> +ifndef CONFIG_SPL_BUILD
>  obj-$(CONFIG_BLOCK_CACHE) += blkcache.o
> +endif

Could this all get replaced by:

obj-$(CONFIG_$(SPL_)BLOCK_CACHE) += blkcache.o

> diff --git a/include/blk.h b/include/blk.h
> index fc0c239e46..c17c5eb047 100644
> --- a/include/blk.h
> +++ b/include/blk.h
> @@ -111,7 +111,8 @@ struct blk_desc {
>  #define PAD_TO_BLOCKSIZE(size, blk_desc) \
>         (PAD_SIZE(size, blk_desc->blksz))
>
> -#ifdef CONFIG_BLOCK_CACHE
> +#if (defined(CONFIG_BLOCK_CACHE) && !defined(CONFIG_SPL_BUILD)) || \
> +        (defined(CONFIG_SPL_BLOCK_CACHE) && defined(CONFIG_SPL_BUILD))
>  /**

Replace with CONFIG_IS_ENABLED?

>   * blkcache_read() - attempt to read a set of blocks from cache
>   *
> --
> 2.17.1
>
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot



-- 
Alex Kiernan
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to