
Hi Jean-Jacques,
On 6 July 2017 at 08:55, Jean-Jacques Hiblot jjhiblot@ti.com wrote:
Hi Simon,
On 04/07/2017 21:31, Simon Glass wrote:
At present if U-Boot proper uses driver model for MMC, then SPL has to also. While this is desirable, it places a significant barrier to moving to driver model in some cases. For example, with a space-constrained SPL it may be necessary to enable CONFIG_SPL_OF_PLATDATA which involves adjusting some drivers.
Add new SPL versions of the options for DM_MMC, DM_MMC_OPS and BLK. By default these follow their non-SPL versions, but this can be changed by boards which need it.
Signed-off-by: Simon Glass sjg@chromium.org
Changes in v2: None
common/spl/spl_mmc.c | 4 ++-- drivers/block/Kconfig | 12 ++++++++++++ drivers/block/Makefile | 4 ++-- drivers/mmc/Kconfig | 21 +++++++++++++++++++++ drivers/mmc/Makefile | 4 ++-- drivers/mmc/mmc-uclass.c | 6 +++--- drivers/mmc/mmc.c | 28 ++++++++++++++-------------- drivers/mmc/mmc_legacy.c | 2 +- drivers/mmc/mmc_private.h | 6 +++--- drivers/mmc/omap_hsmmc.c | 20 ++++++++++---------- drivers/scsi/scsi.c | 2 +- include/blk.h | 4 ++-- include/mmc.h | 12 ++++++------ 13 files changed, 79 insertions(+), 46 deletions(-)
diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c index 18c1b59b22..953e484e27 100644 --- a/common/spl/spl_mmc.c +++ b/common/spl/spl_mmc.c @@ -115,7 +115,7 @@ int spl_mmc_get_device_index(u32 boot_device) static int spl_mmc_find_device(struct mmc **mmcp, u32 boot_device) { -#ifdef CONFIG_DM_MMC +#if CONFIG_IS_ENABLED(DM_MMC) struct udevice *dev; #endif int err, mmc_dev; @@ -132,7 +132,7 @@ static int spl_mmc_find_device(struct mmc **mmcp, u32 boot_device) return err; } -#ifdef CONFIG_DM_MMC +#if CONFIG_IS_ENABLED(DM_MMC) err = uclass_get_device(UCLASS_MMC, mmc_dev, &dev); if (!err) *mmcp = mmc_get_mmc_dev(dev); diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig index ca7692d8a5..26760895f9 100644 --- a/drivers/block/Kconfig +++ b/drivers/block/Kconfig @@ -10,6 +10,18 @@ config BLK be partitioned into several areas, called 'partitions' in U-Boot. A filesystem can be placed in each partition. +config SPL_BLK
bool "Support block devices in SPL"
depends on SPL_DM && BLK
default y
help
Enable support for block devices, such as SCSI, MMC and USB
flash sticks. These provide a block-level interface which
permits
reading, writing and (in some cases) erasing blocks. Block
devices often have a partition table which allows the device to
be partitioned into several areas, called 'partitions' in
U-Boot.
A filesystem can be placed in each partition.
config BLOCK_CACHE bool "Use block device cache" default n diff --git a/drivers/block/Makefile b/drivers/block/Makefile index a5e7307c97..dea2c15c14 100644 --- a/drivers/block/Makefile +++ b/drivers/block/Makefile @@ -5,9 +5,9 @@ # SPDX-License-Identifier: GPL-2.0+ # -obj-$(CONFIG_BLK) += blk-uclass.o +obj-$(CONFIG_$(SPL_)BLK) += blk-uclass.o -ifndef CONFIG_BLK +ifndef CONFIG_$(SPL_)BLK obj-y += blk_legacy.o endif diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig index 82b8d75686..51a87cdd77 100644 --- a/drivers/mmc/Kconfig +++ b/drivers/mmc/Kconfig @@ -30,6 +30,27 @@ config DM_MMC_OPS option will be removed as soon as all DM_MMC drivers use it, as it will the only supported behaviour. +config SPL_DM_MMC
bool "Enable MMC controllers using Driver Model in SPL"
depends on SPL_DM && DM_MMC
default y
help
This enables the MultiMediaCard (MMC) uclass which supports MMC
and
Secure Digital I/O (SDIO) cards. Both removable (SD, micro-SD,
etc.)
and non-removable (e.g. eMMC chip) devices are supported. These
appear as block devices in U-Boot and can support filesystems
such
as EXT4 and FAT.
+config SPL_DM_MMC_OPS
bool "Support MMC controller operations using Driver Model in SPL"
depends on SPL_DM && DM_MMC_OPS
default y
help
Driver model provides a means of supporting device operations.
This
option moves MMC operations under the control of driver model.
The
option will be removed as soon as all DM_MMC drivers use it, as
it
will the only supported behaviour.
- if MMC config SPL_MMC_TINY
diff --git a/drivers/mmc/Makefile b/drivers/mmc/Makefile index 2d781c38a6..a6becb2309 100644 --- a/drivers/mmc/Makefile +++ b/drivers/mmc/Makefile @@ -6,9 +6,9 @@ # obj-y += mmc.o -obj-$(CONFIG_DM_MMC) += mmc-uclass.o +obj-$(CONFIG_$(SPL_)DM_MMC) += mmc-uclass.o -ifndef CONFIG_BLK +ifndef CONFIG_$(SPL_)BLK obj-y += mmc_legacy.o endif
There are numerous places where #if(n)defCONFIG_BLK is used, should they not all be replaced with #if CONFIG_IS_ENABLED(BLK) ? In my case common/env_mmc.c won't compile because of this.
I don't see a build error, but I'll rebase to master and see if I can.
My approach was to change the common uses and ones I had to change, but not going an change all boards to do this. I suspect it is the right thing to do ultimately, but for many boards it doesn't matter.
Other than this problem with common/env_mmc.c and a few other adjustments not related to the mmc that unselecting DM_SPL required, this has been tested OK on a TI DRA72 evm.
Jean-Jacques
[...]
Regards, Simon