From 91ff6865629c81b8643b4ef6130e3e2130c60400 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Wed, 5 Dec 2018 08:23:38 -0500 Subject: [PATCH] blk: Rework guard around part_init call MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The function part_init() will only be built when we have both CONFIG_PARTITIONS and CONFIG_HAVE_BLOCK_DEVICE set. Protect the call to this function with both of these tests now. Cc: Simon Glass Cc: Philipp Tomsich Cc: Michal Simek Cc: York Sun Cc: Prabhakar Kushwaha Cc: Mingkai Hu Cc: Stefan Roese Cc: Marek Behún Cc: Vanessa Maegima Cc: Eugen Hristev Cc: Adam Ford Cc: Jagan Teki Cc: Tom Warren Cc: Stephen Warren Cc: Vitaly Andrianov Signed-off-by: Tom Rini Reviewed-by: Simon Glass --- common/spl/Kconfig | 3 +++ configs/evb-rk3036_defconfig | 1 + configs/kylin-rk3036_defconfig | 1 + doc/driver-model/MIGRATION.txt | 4 +++- drivers/Makefile | 3 +-- drivers/block/Makefile | 2 ++ drivers/block/blk-uclass.c | 2 +- scripts/Makefile.spl | 4 +++- 8 files changed, 15 insertions(+), 5 deletions(-) diff --git a/common/spl/Kconfig b/common/spl/Kconfig index 0ddbffc7d1..cab7220c9a 100644 --- a/common/spl/Kconfig +++ b/common/spl/Kconfig @@ -449,6 +449,7 @@ config SPL_LIBCOMMON_SUPPORT config SPL_LIBDISK_SUPPORT bool "Support disk partitions" + select PARTITIONS help Enable support for disk partitions within SPL. 'Disk' is something of a misnomer as it includes non-spinning media such as flash (as @@ -480,6 +481,7 @@ config SPL_DM_MAILBOX config SPL_MMC_SUPPORT bool "Support MMC" depends on MMC + select HAVE_BLOCK_DEVICE help Enable support for MMC (Multimedia Card) within SPL. This enables the MMC protocol implementation and allows any enabled drivers to @@ -754,6 +756,7 @@ config SPL_THERMAL config SPL_USB_HOST_SUPPORT bool "Support USB host drivers" + select HAVE_BLOCK_DEVICE help Enable access to USB (Universal Serial Bus) host devices so that SPL can load U-Boot from a connected USB peripheral, such as a USB diff --git a/configs/evb-rk3036_defconfig b/configs/evb-rk3036_defconfig index 787d6f95c1..439e691386 100644 --- a/configs/evb-rk3036_defconfig +++ b/configs/evb-rk3036_defconfig @@ -32,6 +32,7 @@ CONFIG_SPL_PARTITION_UUIDS=y CONFIG_DEFAULT_DEVICE_TREE="rk3036-sdk" CONFIG_REGMAP=y CONFIG_SYSCON=y +# CONFIG_SPL_BLK is not set CONFIG_CLK=y CONFIG_FASTBOOT_FLASH=y CONFIG_FASTBOOT_FLASH_MMC_DEV=0 diff --git a/configs/kylin-rk3036_defconfig b/configs/kylin-rk3036_defconfig index eb305e02aa..765003095c 100644 --- a/configs/kylin-rk3036_defconfig +++ b/configs/kylin-rk3036_defconfig @@ -30,6 +30,7 @@ CONFIG_DEFAULT_DEVICE_TREE="rk3036-sdk" CONFIG_ENV_IS_IN_MMC=y CONFIG_REGMAP=y CONFIG_SYSCON=y +# CONFIG_SPL_BLK is not set CONFIG_CLK=y CONFIG_FASTBOOT_FLASH=y CONFIG_FASTBOOT_FLASH_MMC_DEV=0 diff --git a/doc/driver-model/MIGRATION.txt b/doc/driver-model/MIGRATION.txt index 6b691338b4..dce4aa3e1d 100644 --- a/doc/driver-model/MIGRATION.txt +++ b/doc/driver-model/MIGRATION.txt @@ -44,7 +44,9 @@ Deadline: 2019.07 In concert with maintainers migrating their block device usage to the appropriate DM driver, CONFIG_BLK needs to be set as well. The final deadline here coincides with the final deadline for migration of the various block -subsystems. +subsystems. At this point we will be able to audit and correct the logic in +Kconfig around using CONFIG_PARTITIONS and CONFIG_HAVE_BLOCK_DEVICE and make +use of CONFIG_BLK / CONFIG_SPL_BLK as needed. CONFIG_DM_SPI CONFIG_DM_SPI_FLASH diff --git a/drivers/Makefile b/drivers/Makefile index c425831b58..0538b50d01 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -53,8 +53,7 @@ obj-$(CONFIG_SPL_WATCHDOG_SUPPORT) += watchdog/ obj-$(CONFIG_SPL_USB_HOST_SUPPORT) += usb/host/ obj-$(CONFIG_OMAP_USB_PHY) += usb/phy/ obj-$(CONFIG_SPL_SATA_SUPPORT) += ata/ scsi/ -obj-$(CONFIG_SPL_USB_HOST_SUPPORT) += block/ -obj-$(CONFIG_SPL_MMC_SUPPORT) += block/ +obj-$(CONFIG_HAVE_BLOCK_DEVICE) += block/ obj-$(CONFIG_SPL_FPGA_SUPPORT) += fpga/ obj-$(CONFIG_SPL_THERMAL) += thermal/ diff --git a/drivers/block/Makefile b/drivers/block/Makefile index 055d42f7d4..3feb0aa997 100644 --- a/drivers/block/Makefile +++ b/drivers/block/Makefile @@ -9,6 +9,8 @@ ifndef CONFIG_$(SPL_)BLK obj-y += blk_legacy.o endif +ifndef CONFIG_SPL_BUILD obj-$(CONFIG_IDE) += ide.o +endif obj-$(CONFIG_SANDBOX) += sandbox.o obj-$(CONFIG_$(SPL_TPL_)BLOCK_CACHE) += blkcache.o diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c index 65a766e586..baaf431e5e 100644 --- a/drivers/block/blk-uclass.c +++ b/drivers/block/blk-uclass.c @@ -639,7 +639,7 @@ int blk_unbind_all(int if_type) static int blk_post_probe(struct udevice *dev) { -#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBDISK_SUPPORT) +#if defined(CONFIG_PARTITIONS) && defined(CONFIG_HAVE_BLOCK_DEVICE) struct blk_desc *desc = dev_get_uclass_platdata(dev); part_init(desc); diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl index 22bd8f7c27..2ef19bf005 100644 --- a/scripts/Makefile.spl +++ b/scripts/Makefile.spl @@ -81,9 +81,11 @@ libs-$(CONFIG_TPL_LIBGENERIC_SUPPORT) += lib/ else libs-$(CONFIG_SPL_LIBCOMMON_SUPPORT) += common/ cmd/ env/ libs-$(CONFIG_SPL_LIBGENERIC_SUPPORT) += lib/ +ifdef CONFIG_SPL_FRAMEWORK +libs-$(CONFIG_PARTITIONS) += disk/ +endif endif -libs-$(CONFIG_SPL_LIBDISK_SUPPORT) += disk/ libs-y += drivers/ libs-$(CONFIG_SPL_USB_GADGET_SUPPORT) += drivers/usb/dwc3/ libs-y += dts/ -- 2.25.1