From dec64d55afca17bfc48366a48a0d5894b8a3bdd2 Mon Sep 17 00:00:00 2001 From: Paul Barker Date: Mon, 14 Nov 2022 12:42:35 +0000 Subject: dm: core: Fix iteration over driver_info records We should only perform additional iteration steps when needed to initialize the parent of a device. Other binding errors (such as a missing driver) should not lead to additional iteration steps. Unnecessary iteration steps can cause issues when memory is tightly constrained (such as in the TPL/SPL) since device_bind_by_name() unconditionally allocates memory for a struct udevice. On the SanCloud BBE this led to boot failure caused by memory exhaustion in the SPL when booting from SPI flash. Signed-off-by: Paul Barker --- drivers/core/lists.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers') diff --git a/drivers/core/lists.c b/drivers/core/lists.c index 3878957c9ef..8034a8f48d9 100644 --- a/drivers/core/lists.c +++ b/drivers/core/lists.c @@ -120,10 +120,10 @@ int lists_bind_drivers(struct udevice *parent, bool pre_reloc_only) int ret; ret = bind_drivers_pass(parent, pre_reloc_only); - if (!ret) - break; - if (ret != -EAGAIN && !result) + if (!result || result == -EAGAIN) result = ret; + if (ret != -EAGAIN) + break; } return result; -- cgit v1.3.1 From e92f47c06a1492859768ffc43bb2a4e16c2f0e42 Mon Sep 17 00:00:00 2001 From: Paul Barker Date: Mon, 14 Nov 2022 12:42:36 +0000 Subject: bus: TI sysc driver requires DM This driver does not build if CONFIG_DM is disabled as it uses the function `dev_get_priv`. Signed-off-by: Paul Barker --- drivers/bus/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/bus/Kconfig b/drivers/bus/Kconfig index d742ed333b1..c607d24ecf6 100644 --- a/drivers/bus/Kconfig +++ b/drivers/bus/Kconfig @@ -13,7 +13,7 @@ config TI_PWMSS config TI_SYSC bool "TI sysc interconnect target module driver" - depends on ARCH_OMAP2PLUS + depends on DM && ARCH_OMAP2PLUS help Generic driver for Texas Instruments interconnect target module found on many TI SoCs. -- cgit v1.3.1 From 07744f2ac03c06f0a41aaecccb9a413d38e6c369 Mon Sep 17 00:00:00 2001 From: Paul Barker Date: Mon, 14 Nov 2022 12:42:37 +0000 Subject: bus: Optionally include TI sysc driver in SPL/TPL The TI sysc bus driver is required to allow access to the SPI bus on am335x platforms. To support SPI boot this driver needs to be enabled in the SPL/TPL as appropriate. Signed-off-by: Paul Barker --- drivers/Makefile | 2 +- drivers/bus/Kconfig | 7 +++++++ drivers/bus/Makefile | 5 ++++- 3 files changed, 12 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/Makefile b/drivers/Makefile index ac2d83af4e3..6f1de58e003 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -37,6 +37,7 @@ obj-$(CONFIG_$(SPL_)SYSINFO) += sysinfo/ obj-$(CONFIG_$(SPL_TPL_)TPM) += tpm/ obj-$(CONFIG_XEN) += xen/ obj-$(CONFIG_$(SPL_)FPGA) += fpga/ +obj-y += bus/ ifndef CONFIG_TPL_BUILD ifndef CONFIG_VPL_BUILD @@ -77,7 +78,6 @@ ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),) obj-y += adc/ obj-y += ata/ -obj-y += bus/ obj-$(CONFIG_DM_DEMO) += demo/ obj-$(CONFIG_BIOSEMU) += bios_emulator/ obj-y += block/ diff --git a/drivers/bus/Kconfig b/drivers/bus/Kconfig index c607d24ecf6..e60aa722b97 100644 --- a/drivers/bus/Kconfig +++ b/drivers/bus/Kconfig @@ -18,6 +18,13 @@ config TI_SYSC Generic driver for Texas Instruments interconnect target module found on many TI SoCs. +config SPL_TI_SYSC + bool "Support TI sysc interconnect in SPL" + depends on SPL_DM && TI_SYSC + help + Generic driver for Texas Instruments interconnect target module + found on many TI SoCs. + config UNIPHIER_SYSTEM_BUS bool "UniPhier System Bus driver" depends on ARCH_UNIPHIER diff --git a/drivers/bus/Makefile b/drivers/bus/Makefile index a2e71c7b3b5..0802b9666bf 100644 --- a/drivers/bus/Makefile +++ b/drivers/bus/Makefile @@ -3,6 +3,9 @@ # Makefile for the bus drivers. # +ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),) obj-$(CONFIG_TI_PWMSS) += ti-pwmss.o -obj-$(CONFIG_TI_SYSC) += ti-sysc.o obj-$(CONFIG_UNIPHIER_SYSTEM_BUS) += uniphier-system-bus.o +endif + +obj-$(CONFIG_$(SPL_)TI_SYSC) += ti-sysc.o -- cgit v1.3.1