From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Kiernan Date: Sun, 10 Jun 2018 11:13:46 +0100 Subject: [U-Boot] [PATCH] block: Add SPL_BLOCK_CACHE and default n In-Reply-To: <20180609225511.24890-1-aford173@gmail.com> References: <20180609225511.24890-1-aford173@gmail.com> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Sat, Jun 9, 2018 at 11:55 PM Adam Ford 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 dependent on BLOCK_CACHE > and SPL_BLK > > Fixes: 46960ad6d09b ("block: Have BLOCK_CACHE default to y in some cases") > > Signed-off-by: Adam Ford > -- > > V2: Clean up macros and ifdefs > > 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 Seems like an odd dependency - to use the block cache in SPL, you also have to have block cache in full U-Boot? I'm guessing `depends on SPL_BLK` would be sufficient > + 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..0e80ce9405 100644 > --- a/drivers/block/Makefile > +++ b/drivers/block/Makefile > @@ -11,4 +11,4 @@ endif > > obj-$(CONFIG_IDE) += ide.o > obj-$(CONFIG_SANDBOX) += sandbox.o > -obj-$(CONFIG_BLOCK_CACHE) += blkcache.o > +obj-$(CONFIG_$(SPL_)BLOCK_CACHE) += blkcache.o > diff --git a/include/blk.h b/include/blk.h > index fc0c239e46..bd90e39932 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 (CONFIG_IS_ENABLED(BLOCK_CACHE) && !CONFIG_IS_ENABLED(SPL_BUILD)) || \ > + (CONFIG_IS_ENABLED(SPL_BLOCK_CACHE) && CONFIG_IS_ENABLED(SPL_BUILD)) Assuming I read it right, you shouldn't need all the &&/|| gyrations, just: #if CONFIG_IS_ENABLED(BLOCK_CACHE) Should get you what you want. > /** > * blkcache_read() - attempt to read a set of blocks from cache > * > -- > 2.17.1 > -- Alex Kiernan