From ff062765c2eb192f099355a22d9d0727ac74160b Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Mon, 8 Nov 2021 10:21:21 +0100 Subject: [PATCH 1/5] scripts: remove CONFIG_IS_ENABLED and CONFIG_VAL in generated u_boot.cfg The two helpers macros CONFIG_IS_ENABLED and CONFIG_VAL are defined in include/linux/kconfig.h but they are not real configurations; they can be safely removed in the generated configuration file "u-boot.cfg". This patch simplifies the comparison of this U-Boot configuration file. Signed-off-by: Patrick Delaunay Acked-by: Simon Glass --- scripts/Makefile.autoconf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/Makefile.autoconf b/scripts/Makefile.autoconf index 8a3efdb2db0..5ed9abc8e14 100644 --- a/scripts/Makefile.autoconf +++ b/scripts/Makefile.autoconf @@ -67,7 +67,8 @@ quiet_cmd_autoconf = GEN $@ quiet_cmd_u_boot_cfg = CFG $@ cmd_u_boot_cfg = \ $(CPP) $(c_flags) $2 -DDO_DEPS_ONLY -dM $(srctree)/include/common.h > $@.tmp && { \ - grep 'define CONFIG_' $@.tmp > $@; \ + grep 'define CONFIG_' $@.tmp | \ + sed '/define CONFIG_IS_ENABLED(/d;/define CONFIG_VAL(/d;' > $@; \ rm $@.tmp; \ } || { \ rm $@.tmp; false; \ From 2bd8830dfb882c9878dc77bd9ba56b73ea6c323a Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Mon, 8 Nov 2021 10:21:22 +0100 Subject: [PATCH 2/5] scripts: remove CONFIG_IS_ENABLED and CONFIG_VAL in config_whitelist.txt The helper macro CONFIG_IS_ENABLED and CONFIG_VAL are not real configurations and they are no more present in u-boot.cfg so they can be removed in config_whitelist.txt. Signed-off-by: Patrick Delaunay Acked-by: Simon Glass --- scripts/config_whitelist.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt index 50dd3f92e78..e2cf73cc053 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -633,7 +633,6 @@ CONFIG_IRAM_SIZE CONFIG_IRAM_STACK CONFIG_IRAM_TOP CONFIG_IRDA_BASE -CONFIG_IS_ENABLED CONFIG_JFFS2_DEV CONFIG_JFFS2_LZO CONFIG_JFFS2_NAND @@ -3042,7 +3041,6 @@ CONFIG_USE_ONENAND_BOARD_INIT CONFIG_UTBIPAR_INIT_TBIPA CONFIG_U_BOOT_HDR_ADDR CONFIG_U_BOOT_HDR_SIZE -CONFIG_VAL CONFIG_VAR_SIZE_SPL CONFIG_VERY_BIG_RAM CONFIG_VIDEO_BCM2835 From 1c01712ac409b06feb36dcac13285e621a700c4e Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Fri, 19 Nov 2021 10:02:26 +0100 Subject: [PATCH 3/5] pinctrl: change result for unsupported API Use the return value ENOSYS for unsupported API - pinctrl_generic_set_state - pinctrl_select_state Signed-off-by: Patrick Delaunay Reviewed-by: Simon Glass --- include/dm/pinctrl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/dm/pinctrl.h b/include/dm/pinctrl.h index 695e78ad0de..8b869c4fbfb 100644 --- a/include/dm/pinctrl.h +++ b/include/dm/pinctrl.h @@ -495,7 +495,7 @@ int pinctrl_generic_set_state(struct udevice *pctldev, struct udevice *config); static inline int pinctrl_generic_set_state(struct udevice *pctldev, struct udevice *config) { - return -EINVAL; + return -ENOSYS; } #endif @@ -512,7 +512,7 @@ int pinctrl_select_state(struct udevice *dev, const char *statename); static inline int pinctrl_select_state(struct udevice *dev, const char *statename) { - return -EINVAL; + return -ENOSYS; } #endif From af13df7014d7dc78b5461b65de78ca5096e5701c Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Fri, 19 Nov 2021 10:02:27 +0100 Subject: [PATCH 4/5] dm: add debug message when failed to select the default pinctrl Add a message on probe in driver model core when the default pinctrl selection failed. This message is displayed only when the pinctrl API is implemented, i.e. when result is not ENOSYS. Signed-off-by: Patrick Delaunay Reviewed-by: Simon Glass --- drivers/core/device.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/core/device.c b/drivers/core/device.c index aed093c2af1..74374ff881c 100644 --- a/drivers/core/device.c +++ b/drivers/core/device.c @@ -533,8 +533,12 @@ int device_probe(struct udevice *dev) * is set just above. However, the PCI bus' probe() method and * associated uclass methods have not yet been called. */ - if (dev->parent && device_get_uclass_id(dev) != UCLASS_PINCTRL) - pinctrl_select_state(dev, "default"); + if (dev->parent && device_get_uclass_id(dev) != UCLASS_PINCTRL) { + ret = pinctrl_select_state(dev, "default"); + if (ret && ret != -ENOSYS) + log_debug("Device '%s' failed to configure default pinctrl: %d (%s)\n", + dev->name, ret, errno_str(ret)); + } if (CONFIG_IS_ENABLED(POWER_DOMAIN) && dev->parent && (device_get_uclass_id(dev) != UCLASS_POWER_DOMAIN) && @@ -586,8 +590,12 @@ int device_probe(struct udevice *dev) if (ret) goto fail_uclass; - if (dev->parent && device_get_uclass_id(dev) == UCLASS_PINCTRL) - pinctrl_select_state(dev, "default"); + if (dev->parent && device_get_uclass_id(dev) == UCLASS_PINCTRL) { + ret = pinctrl_select_state(dev, "default"); + if (ret && ret != -ENOSYS) + log_debug("Device '%s' failed to configure default pinctrl: %d (%s)\n", + dev->name, ret, errno_str(ret)); + } return 0; fail_uclass: From 6d99f866952bb5df7fe699b3db29a97d75e5c445 Mon Sep 17 00:00:00 2001 From: Nishanth Menon Date: Tue, 19 Oct 2021 12:32:29 -0500 Subject: [PATCH 5/5] spl: fit: Skip attempting to load 0 length image When, for various reasons, a bad FIT image is used where a loadable image is marked as 0 length, attempt is made for a 0 length allocation and read of 0 byte read operation. Instead provide warning in log and skip attempting to do such a load. Signed-off-by: Nishanth Menon Reviewed-by: Aswath Govindraju --- common/spl/spl_fit.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index 5fe0273d66d..774072b85c5 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -286,6 +286,13 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector, if (fit_image_get_data_size(fit, node, &len)) return -ENOENT; + /* Dont bother to copy 0 byte data, but warn, though */ + if (!len) { + log_warning("%s: Skip load '%s': image size is 0!\n", + __func__, fit_get_name(fit, node, NULL)); + return 0; + } + src_ptr = map_sysmem(ALIGN(load_addr, ARCH_DMA_MINALIGN), len); length = len;