aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile6
-rw-r--r--common/init/board_init.c2
-rw-r--r--drivers/led/led_pwm.c19
-rw-r--r--drivers/mtd/nand/raw/nand_base.c30
-rw-r--r--drivers/serial/ns16550.c4
-rw-r--r--drivers/sound/da7219.c3
-rw-r--r--drivers/sound/max98357a.c3
-rw-r--r--env/ext4.c5
-rw-r--r--env/fat.c8
-rw-r--r--fs/ubifs/super.c7
-rw-r--r--include/config_distro_bootcmd.h27
-rw-r--r--include/configs/am335x_guardian.h3
-rw-r--r--include/configs/colibri-imx6ull.h1
-rw-r--r--include/configs/colibri_imx7.h1
-rw-r--r--include/configs/kontron-sl-mx6ul.h2
-rw-r--r--include/configs/mys_6ulx.h2
-rw-r--r--include/configs/npi_imx6ull.h2
-rw-r--r--include/configs/omap3_beagle.h4
-rw-r--r--include/configs/omap3_evm.h4
-rw-r--r--include/configs/pcl063.h2
-rw-r--r--include/configs/stm32mp15_common.h2
-rw-r--r--include/configs/uniphier.h2
-rw-r--r--include/regmap.h6
-rw-r--r--test/dm/Makefile12
-rw-r--r--tools/env/fw_env.c70
25 files changed, 164 insertions, 63 deletions
diff --git a/Makefile b/Makefile
index 93571d37d9..7f7dd81b02 100644
--- a/Makefile
+++ b/Makefile
@@ -673,6 +673,12 @@ else
include/config/auto.conf: ;
endif # $(dot-config)
+ifdef CONFIG_CC_OPTIMIZE_FOR_DEBUG
+KBUILD_HOSTCFLAGS := -Wall -Wstrict-prototypes -Og -g -fomit-frame-pointer \
+ $(HOST_LFS_CFLAGS) $(HOSTCFLAGS)
+KBUILD_HOSTCXXFLAGS := -Og -g $(HOST_LFS_CFLAGS) $(HOSTCXXFLAGS)
+endif
+
#
# Xtensa linker script cannot be preprocessed with -ansi because of
# preprocessor operations on strings that don't make C identifiers.
diff --git a/common/init/board_init.c b/common/init/board_init.c
index eab5ee1395..6a55026177 100644
--- a/common/init/board_init.c
+++ b/common/init/board_init.c
@@ -78,9 +78,11 @@ __weak void board_init_f_init_stack_protection(void)
ulong board_init_f_alloc_reserve(ulong top)
{
/* Reserve early malloc arena */
+#ifndef CONFIG_MALLOC_F_ADDR
#if CONFIG_VAL(SYS_MALLOC_F_LEN)
top -= CONFIG_VAL(SYS_MALLOC_F_LEN);
#endif
+#endif
/* LAST : reserve GD (rounded up to a multiple of 16 bytes) */
top = rounddown(top-sizeof(struct global_data), 16);
diff --git a/drivers/led/led_pwm.c b/drivers/led/led_pwm.c
index 10bd1636c3..0ebae358eb 100644
--- a/drivers/led/led_pwm.c
+++ b/drivers/led/led_pwm.c
@@ -95,27 +95,17 @@ static enum led_state_t led_pwm_get_state(struct udevice *dev)
static int led_pwm_probe(struct udevice *dev)
{
struct led_pwm_priv *priv = dev_get_priv(dev);
- struct led_uc_plat *uc_plat = dev_get_uclass_plat(dev);
-
- /* Ignore the top-level LED node */
- if (!uc_plat->label)
- return 0;
return led_pwm_set_state(dev, (priv->enabled) ? LEDST_ON : LEDST_OFF);
}
static int led_pwm_of_to_plat(struct udevice *dev)
{
- struct led_uc_plat *uc_plat = dev_get_uclass_plat(dev);
struct led_pwm_priv *priv = dev_get_priv(dev);
struct ofnode_phandle_args args;
uint def_brightness, max_brightness;
int ret;
- /* Ignore the top-level LED node */
- if (!uc_plat->label)
- return 0;
-
ret = dev_read_phandle_with_args(dev, "pwms", "#pwm-cells", 0, 0, &args);
if (ret)
return ret;
@@ -173,10 +163,15 @@ static const struct udevice_id led_pwm_ids[] = {
U_BOOT_DRIVER(led_pwm) = {
.name = LEDS_PWM_DRIVER_NAME,
.id = UCLASS_LED,
- .of_match = led_pwm_ids,
.ops = &led_pwm_ops,
.priv_auto = sizeof(struct led_pwm_priv),
- .bind = led_pwm_bind,
.probe = led_pwm_probe,
.of_to_plat = led_pwm_of_to_plat,
};
+
+U_BOOT_DRIVER(led_pwm_wrap) = {
+ .name = LEDS_PWM_DRIVER_NAME "_wrap",
+ .id = UCLASS_NOP,
+ .of_match = led_pwm_ids,
+ .bind = led_pwm_bind,
+};
diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
index 6f81257cf1..e8ece0a4a0 100644
--- a/drivers/mtd/nand/raw/nand_base.c
+++ b/drivers/mtd/nand/raw/nand_base.c
@@ -974,6 +974,22 @@ static int nand_reset_data_interface(struct nand_chip *chip, int chipnr)
return ret;
}
+static int nand_onfi_set_timings(struct mtd_info *mtd, struct nand_chip *chip)
+{
+ if (!chip->onfi_version ||
+ !(le16_to_cpu(chip->onfi_params.opt_cmd)
+ & ONFI_OPT_CMD_SET_GET_FEATURES))
+ return 0;
+
+ u8 tmode_param[ONFI_SUBFEATURE_PARAM_LEN] = {
+ chip->onfi_timing_mode_default,
+ };
+
+ return chip->onfi_set_features(mtd, chip,
+ ONFI_FEATURE_ADDR_TIMING_MODE,
+ tmode_param);
+}
+
/**
* nand_setup_data_interface - Setup the best data interface and timings
* @chip: The NAND chip
@@ -999,17 +1015,9 @@ static int nand_setup_data_interface(struct nand_chip *chip, int chipnr)
* Ensure the timing mode has been changed on the chip side
* before changing timings on the controller side.
*/
- if (chip->onfi_version) {
- u8 tmode_param[ONFI_SUBFEATURE_PARAM_LEN] = {
- chip->onfi_timing_mode_default,
- };
-
- ret = chip->onfi_set_features(mtd, chip,
- ONFI_FEATURE_ADDR_TIMING_MODE,
- tmode_param);
- if (ret)
- goto err;
- }
+ ret = nand_onfi_set_timings(mtd, chip);
+ if (ret)
+ goto err;
ret = chip->setup_data_interface(mtd, chipnr, chip->data_interface);
err:
diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
index 78bfe6281c..47bad6f8e2 100644
--- a/drivers/serial/ns16550.c
+++ b/drivers/serial/ns16550.c
@@ -328,6 +328,10 @@ static inline void _debug_uart_init(void)
struct ns16550 *com_port = (struct ns16550 *)CONFIG_VAL(DEBUG_UART_BASE);
int baud_divisor;
+ /* Wait until tx buffer is empty */
+ while (!(serial_din(&com_port->lsr) & UART_LSR_TEMT))
+ ;
+
/*
* We copy the code from above because it is already horribly messy.
* Trying to refactor to nicely remove the duplication doesn't seem
diff --git a/drivers/sound/da7219.c b/drivers/sound/da7219.c
index 8d674bcb4f..c1edef4436 100644
--- a/drivers/sound/da7219.c
+++ b/drivers/sound/da7219.c
@@ -23,6 +23,7 @@
#define DA7219_ACPI_HID "DLGS7219"
+__maybe_unused
static int da7219_acpi_fill_ssdt(const struct udevice *dev,
struct acpi_ctx *ctx)
{
@@ -171,10 +172,12 @@ static int da7219_acpi_setup_nhlt(const struct udevice *dev,
#endif
struct acpi_ops da7219_acpi_ops = {
+#ifdef CONFIG_ACPIGEN
.fill_ssdt = da7219_acpi_fill_ssdt,
#ifdef CONFIG_X86
.setup_nhlt = da7219_acpi_setup_nhlt,
#endif
+#endif
};
static const struct udevice_id da7219_ids[] = {
diff --git a/drivers/sound/max98357a.c b/drivers/sound/max98357a.c
index a2088f0301..bdf6dc236e 100644
--- a/drivers/sound/max98357a.c
+++ b/drivers/sound/max98357a.c
@@ -38,6 +38,7 @@ static int max98357a_of_to_plat(struct udevice *dev)
return 0;
}
+__maybe_unused
static int max98357a_acpi_fill_ssdt(const struct udevice *dev,
struct acpi_ctx *ctx)
{
@@ -137,10 +138,12 @@ static int max98357a_acpi_setup_nhlt(const struct udevice *dev,
#endif
struct acpi_ops max98357a_acpi_ops = {
+#ifdef CONFIG_ACPIGEN
.fill_ssdt = max98357a_acpi_fill_ssdt,
#ifdef CONFIG_X86
.setup_nhlt = max98357a_acpi_setup_nhlt,
#endif
+#endif
};
static const struct audio_codec_ops max98357a_ops = {
diff --git a/env/ext4.c b/env/ext4.c
index 9f65afb8a4..47e05a4891 100644
--- a/env/ext4.c
+++ b/env/ext4.c
@@ -31,6 +31,7 @@
#include <errno.h>
#include <ext4fs.h>
#include <mmc.h>
+#include <scsi.h>
#include <asm/global_data.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -146,6 +147,10 @@ static int env_ext4_load(void)
if (!strcmp(ifname, "mmc"))
mmc_initialize(NULL);
#endif
+#if defined(CONFIG_AHCI) || defined(CONFIG_SCSI)
+ if (!strcmp(ifname, "scsi"))
+ scsi_scan(true);
+#endif
part = blk_get_device_part_str(ifname, dev_and_part,
&dev_desc, &info, 1);
diff --git a/env/fat.c b/env/fat.c
index 6251d9649b..3172130d75 100644
--- a/env/fat.c
+++ b/env/fat.c
@@ -17,6 +17,7 @@
#include <errno.h>
#include <fat.h>
#include <mmc.h>
+#include <scsi.h>
#include <asm/cache.h>
#include <asm/global_data.h>
#include <linux/stddef.h>
@@ -128,7 +129,12 @@ static int env_fat_load(void)
if (!strcmp(ifname, "mmc"))
mmc_initialize(NULL);
#endif
-
+#ifndef CONFIG_SPL_BUILD
+#if defined(CONFIG_AHCI) || defined(CONFIG_SCSI)
+ if (!strcmp(CONFIG_ENV_FAT_INTERFACE, "scsi"))
+ scsi_scan(true);
+#endif
+#endif
part = blk_get_device_part_str(ifname, dev_and_part,
&dev_desc, &info, 1);
if (part < 0)
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index e3a4c0bca2..034c41a703 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -1757,6 +1757,8 @@ void ubifs_umount(struct ubifs_info *c)
kfree(c->bottom_up_buf);
ubifs_debugging_exit(c);
#ifdef __UBOOT__
+ ubi_close_volume(c->ubi);
+ mutex_unlock(&c->umount_mutex);
/* Finally free U-Boot's global copy of superblock */
if (ubifs_sb != NULL) {
free(ubifs_sb->s_fs_info);
@@ -2058,9 +2060,9 @@ static void ubifs_put_super(struct super_block *sb)
ubifs_umount(c);
#ifndef __UBOOT__
bdi_destroy(&c->bdi);
-#endif
ubi_close_volume(c->ubi);
mutex_unlock(&c->umount_mutex);
+#endif
}
#endif
@@ -2327,6 +2329,9 @@ static int ubifs_fill_super(struct super_block *sb, void *data, int silent)
out_umount:
ubifs_umount(c);
+#ifdef __UBOOT__
+ goto out;
+#endif
out_unlock:
mutex_unlock(&c->umount_mutex);
#ifndef __UBOOT__
diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h
index c55023889c..c6e9c49741 100644
--- a/include/config_distro_bootcmd.h
+++ b/include/config_distro_bootcmd.h
@@ -70,18 +70,23 @@
#ifdef CONFIG_CMD_UBIFS
#define BOOTENV_SHARED_UBIFS \
"ubifs_boot=" \
- "env exists bootubipart || " \
- "env set bootubipart UBI; " \
- "env exists bootubivol || " \
- "env set bootubivol boot; " \
"if ubi part ${bootubipart} && " \
- "ubifsmount ubi${devnum}:${bootubivol}; " \
+ "ubifsmount ubi0:${bootubivol}; " \
"then " \
"devtype=ubi; " \
+ "devnum=ubi0; " \
+ "bootfstype=ubifs; " \
+ "distro_bootpart=${bootubivol}; " \
"run scan_dev_for_boot; " \
+ "ubifsumount; " \
"fi\0"
-#define BOOTENV_DEV_UBIFS BOOTENV_DEV_BLKDEV
-#define BOOTENV_DEV_NAME_UBIFS BOOTENV_DEV_NAME_BLKDEV
+#define BOOTENV_DEV_UBIFS(devtypeu, devtypel, instance, bootubipart, bootubivol) \
+ "bootcmd_ubifs" #instance "=" \
+ "bootubipart=" #bootubipart "; " \
+ "bootubivol=" #bootubivol "; " \
+ "run ubifs_boot\0"
+#define BOOTENV_DEV_NAME_UBIFS(devtypeu, devtypel, instance, bootubipart, bootubivol) \
+ #devtypel #instance " "
#else
#define BOOTENV_SHARED_UBIFS
#define BOOTENV_DEV_UBIFS \
@@ -411,13 +416,13 @@
BOOT_TARGET_DEVICES_references_PXE_without_CONFIG_CMD_DHCP_or_PXE
#endif
-#define BOOTENV_DEV_NAME(devtypeu, devtypel, instance) \
- BOOTENV_DEV_NAME_##devtypeu(devtypeu, devtypel, instance)
+#define BOOTENV_DEV_NAME(devtypeu, devtypel, instance, ...) \
+ BOOTENV_DEV_NAME_##devtypeu(devtypeu, devtypel, instance, ## __VA_ARGS__)
#define BOOTENV_BOOT_TARGETS \
"boot_targets=" BOOT_TARGET_DEVICES(BOOTENV_DEV_NAME) "\0"
-#define BOOTENV_DEV(devtypeu, devtypel, instance) \
- BOOTENV_DEV_##devtypeu(devtypeu, devtypel, instance)
+#define BOOTENV_DEV(devtypeu, devtypel, instance, ...) \
+ BOOTENV_DEV_##devtypeu(devtypeu, devtypel, instance, ## __VA_ARGS__)
#define BOOTENV \
BOOTENV_SHARED_HOST \
BOOTENV_SHARED_MMC \
diff --git a/include/configs/am335x_guardian.h b/include/configs/am335x_guardian.h
index 7a9928fba7..7fa1847c1f 100644
--- a/include/configs/am335x_guardian.h
+++ b/include/configs/am335x_guardian.h
@@ -27,7 +27,7 @@
"ramdisk_addr_r=0x88080000\0" \
#define BOOT_TARGET_DEVICES(func) \
- func(UBIFS, ubifs, 0)
+ func(UBIFS, ubifs, 0, UBI, rootfs)
#define AM335XX_BOARD_FDTFILE "fdtfile=" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0"
@@ -51,7 +51,6 @@
BOOTENV \
GUARDIAN_DEFAULT_PROD_ENV \
"backlight_brightness=50\0" \
- "bootubivol=rootfs\0" \
"distro_bootcmd=" \
"setenv rootflags \"bulk_read,chk_data_crc\"; " \
"setenv ethact usb_ether; " \
diff --git a/include/configs/colibri-imx6ull.h b/include/configs/colibri-imx6ull.h
index 528c7c98d2..04cde9530a 100644
--- a/include/configs/colibri-imx6ull.h
+++ b/include/configs/colibri-imx6ull.h
@@ -90,7 +90,6 @@
UBI_BOOTCMD \
UBOOT_UPDATE \
"boot_script_dhcp=boot.scr\0" \
- "bootubipart=ubi\0" \
"console=ttymxc0\0" \
"defargs=user_debug=30\0" \
"fdt_board=eval-v3\0" \
diff --git a/include/configs/colibri_imx7.h b/include/configs/colibri_imx7.h
index 8a6536eec8..9543e0233e 100644
--- a/include/configs/colibri_imx7.h
+++ b/include/configs/colibri_imx7.h
@@ -130,7 +130,6 @@
UBOOT_UPDATE \
"boot_file=zImage\0" \
"boot_script_dhcp=boot.scr\0" \
- "bootubipart=ubi\0" \
"console=ttymxc0\0" \
"defargs=\0" \
"fdt_board=eval-v3\0" \
diff --git a/include/configs/kontron-sl-mx6ul.h b/include/configs/kontron-sl-mx6ul.h
index 512cef09f8..7aac5d3f5a 100644
--- a/include/configs/kontron-sl-mx6ul.h
+++ b/include/configs/kontron-sl-mx6ul.h
@@ -37,7 +37,7 @@
#define BOOT_TARGET_DEVICES(func) \
func(MMC, mmc, 1) \
func(MMC, mmc, 0) \
- func(UBIFS, ubifs, 0) \
+ func(UBIFS, ubifs, 0, UBI, boot) \
func(USB, usb, 0) \
func(PXE, pxe, na) \
func(DHCP, dhcp, na)
diff --git a/include/configs/mys_6ulx.h b/include/configs/mys_6ulx.h
index b968923819..4162ee8caa 100644
--- a/include/configs/mys_6ulx.h
+++ b/include/configs/mys_6ulx.h
@@ -50,7 +50,7 @@
#define BOOT_TARGET_DEVICES(func) \
func(MMC, mmc, 0) \
- func(UBIFS, ubifs, 0) \
+ func(UBIFS, ubifs, 0, UBI, boot) \
func(PXE, pxe, na) \
func(DHCP, dhcp, na)
diff --git a/include/configs/npi_imx6ull.h b/include/configs/npi_imx6ull.h
index 6cdb1afcd9..217427a302 100644
--- a/include/configs/npi_imx6ull.h
+++ b/include/configs/npi_imx6ull.h
@@ -58,7 +58,7 @@
#define BOOT_TARGET_DEVICES(func) \
func(MMC, mmc, 0) \
- func(UBIFS, ubifs, 0) \
+ func(UBIFS, ubifs, 0, UBI, boot) \
func(PXE, pxe, na) \
func(DHCP, dhcp, na)
diff --git a/include/configs/omap3_beagle.h b/include/configs/omap3_beagle.h
index ab742798b9..2cd42e5a1d 100644
--- a/include/configs/omap3_beagle.h
+++ b/include/configs/omap3_beagle.h
@@ -62,7 +62,7 @@
#define BOOT_TARGET_DEVICES(func) \
func(MMC, mmc, 0) \
func(LEGACY_MMC, legacy_mmc, 0) \
- func(UBIFS, ubifs, 0) \
+ func(UBIFS, ubifs, 0, rootfs, rootfs) \
func(NAND, nand, 0)
#else /* !CONFIG_MTD_RAW_NAND */
@@ -84,8 +84,6 @@
"bootenv=uEnv.txt\0" \
"bootfile=zImage\0" \
"bootpart=0:2\0" \
- "bootubivol=rootfs\0" \
- "bootubipart=rootfs\0" \
"usbtty=cdc_acm\0" \
"mpurate=auto\0" \
"buddy=none\0" \
diff --git a/include/configs/omap3_evm.h b/include/configs/omap3_evm.h
index 1b94f8efa2..2683d4c7ea 100644
--- a/include/configs/omap3_evm.h
+++ b/include/configs/omap3_evm.h
@@ -56,7 +56,7 @@
#define BOOT_TARGET_DEVICES(func) \
func(MMC, mmc, 0) \
func(LEGACY_MMC, legacy_mmc, 0) \
- func(UBIFS, ubifs, 0) \
+ func(UBIFS, ubifs, 0, rootfs, rootfs) \
func(NAND, nand, 0)
#else /* !CONFIG_MTD_RAW_NAND */
@@ -82,8 +82,6 @@
"bootenv=uEnv.txt\0" \
"bootfile=zImage\0" \
"bootpart=0:2\0" \
- "bootubivol=rootfs\0" \
- "bootubipart=rootfs\0" \
"optargs=\0" \
"nandroot=ubi0:rootfs ubi.mtd=rootfs rw noinitrd\0" \
"nandrootfstype=ubifs rootwait\0" \
diff --git a/include/configs/pcl063.h b/include/configs/pcl063.h
index 6683f21d15..6e593da936 100644
--- a/include/configs/pcl063.h
+++ b/include/configs/pcl063.h
@@ -62,7 +62,7 @@
#define BOOT_TARGET_DEVICES(func) \
func(MMC, mmc, 0) \
- func(UBIFS, ubifs, 0) \
+ func(UBIFS, ubifs, 0, UBI, boot) \
func(PXE, pxe, na) \
func(DHCP, dhcp, na)
diff --git a/include/configs/stm32mp15_common.h b/include/configs/stm32mp15_common.h
index 56fb4d38e4..c5412ffeb3 100644
--- a/include/configs/stm32mp15_common.h
+++ b/include/configs/stm32mp15_common.h
@@ -57,7 +57,7 @@
#endif
#ifdef CONFIG_CMD_UBIFS
-#define BOOT_TARGET_UBIFS(func) func(UBIFS, ubifs, 0)
+#define BOOT_TARGET_UBIFS(func) func(UBIFS, ubifs, 0, UBI, boot)
#else
#define BOOT_TARGET_UBIFS(func)
#endif
diff --git a/include/configs/uniphier.h b/include/configs/uniphier.h
index 15d41fba95..15ae0844c1 100644
--- a/include/configs/uniphier.h
+++ b/include/configs/uniphier.h
@@ -19,7 +19,7 @@
#endif
#ifdef CONFIG_CMD_UBIFS
-#define BOOT_TARGET_DEVICE_UBIFS(func) func(UBIFS, ubifs, 0)
+#define BOOT_TARGET_DEVICE_UBIFS(func) func(UBIFS, ubifs, 0, UBI, boot)
#else
#define BOOT_TARGET_DEVICE_UBIFS(func)
#endif
diff --git a/include/regmap.h b/include/regmap.h
index 8216de015d..e81a3602ae 100644
--- a/include/regmap.h
+++ b/include/regmap.h
@@ -460,7 +460,7 @@ struct reg_field {
struct regmap_field;
/**
- * REG_FIELD() - A convenient way to initialize a 'struct reg_feild'.
+ * REG_FIELD() - A convenient way to initialize a 'struct reg_field'.
*
* @_reg: Offset of the register within the regmap bank
* @_lsb: lsb of the register field.
@@ -519,9 +519,9 @@ void devm_regmap_field_free(struct udevice *dev, struct regmap_field *field);
int regmap_field_write(struct regmap_field *field, unsigned int val);
/**
- * regmap_read() - Read a 32-bit value from a regmap
+ * regmap_field_read() - Read a 32-bit value from a regmap
*
- * @field: Regmap field to write to
+ * @field: Regmap field to read from
* @valp: Pointer to the buffer to receive the data read from the regmap
* field
*
diff --git a/test/dm/Makefile b/test/dm/Makefile
index caea52f4e2..52fe178a82 100644
--- a/test/dm/Makefile
+++ b/test/dm/Makefile
@@ -18,9 +18,13 @@ obj-$(CONFIG_UT_DM) += core.o
obj-$(CONFIG_UT_DM) += read.o
obj-$(CONFIG_UT_DM) += phys2bus.o
ifneq ($(CONFIG_SANDBOX),)
-obj-$(CONFIG_ACPIGEN) += acpi.o
-obj-$(CONFIG_ACPIGEN) += acpigen.o
-obj-$(CONFIG_ACPIGEN) += acpi_dp.o
+ifeq ($(CONFIG_ACPIGEN),y)
+obj-y += acpi.o
+obj-y += acpigen.o
+obj-y += acpi_dp.o
+obj-(CONFIG_DM_GPIO) += gpio.o
+obj-y += irq.o
+endif
obj-$(CONFIG_ADC) += adc.o
obj-$(CONFIG_SOUND) += audio.o
obj-$(CONFIG_AXI) += axi.o
@@ -43,11 +47,9 @@ ifneq ($(CONFIG_EFI_PARTITION),)
obj-$(CONFIG_FASTBOOT_FLASH_MMC) += fastboot.o
endif
obj-$(CONFIG_FIRMWARE) += firmware.o
-obj-$(CONFIG_DM_GPIO) += gpio.o
obj-$(CONFIG_DM_HWSPINLOCK) += hwspinlock.o
obj-$(CONFIG_DM_I2C) += i2c.o
obj-$(CONFIG_SOUND) += i2s.o
-obj-y += irq.o
obj-$(CONFIG_CLK_K210_SET_RATE) += k210_pll.o
obj-$(CONFIG_IOMMU) += iommu.o
obj-$(CONFIG_LED) += led.o
diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
index 31afef6f3b..908a162202 100644
--- a/tools/env/fw_env.c
+++ b/tools/env/fw_env.c
@@ -1713,6 +1713,67 @@ static int check_device_config(int dev)
return rc;
}
+static int find_nvmem_device(void)
+{
+ const char *path = "/sys/bus/nvmem/devices";
+ struct dirent *dent;
+ char *nvmem = NULL;
+ char comp[256];
+ char buf[32];
+ int bytes;
+ DIR *dir;
+
+ dir = opendir(path);
+ if (!dir) {
+ return -EIO;
+ }
+
+ while (!nvmem && (dent = readdir(dir))) {
+ FILE *fp;
+
+ if (!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, "..")) {
+ continue;
+ }
+
+ bytes = snprintf(comp, sizeof(comp), "%s/%s/of_node/compatible", path, dent->d_name);
+ if (bytes < 0 || bytes == sizeof(comp)) {
+ continue;
+ }
+
+ fp = fopen(comp, "r");
+ if (!fp) {
+ continue;
+ }
+
+ fread(buf, sizeof(buf), 1, fp);
+
+ if (!strcmp(buf, "u-boot,env")) {
+ bytes = asprintf(&nvmem, "%s/%s/nvmem", path, dent->d_name);
+ if (bytes < 0) {
+ nvmem = NULL;
+ }
+ }
+
+ fclose(fp);
+ }
+
+ closedir(dir);
+
+ if (nvmem) {
+ struct stat s;
+
+ stat(nvmem, &s);
+
+ DEVNAME(0) = nvmem;
+ DEVOFFSET(0) = 0;
+ ENVSIZE(0) = s.st_size;
+
+ return 0;
+ }
+
+ return -ENOENT;
+}
+
static int parse_config(struct env_opts *opts)
{
int rc;
@@ -1723,9 +1784,12 @@ static int parse_config(struct env_opts *opts)
#if defined(CONFIG_FILE)
/* Fills in DEVNAME(), ENVSIZE(), DEVESIZE(). Or don't. */
if (get_config(opts->config_file)) {
- fprintf(stderr, "Cannot parse config file '%s': %m\n",
- opts->config_file);
- return -1;
+ if (find_nvmem_device()) {
+ fprintf(stderr, "Cannot parse config file '%s': %m\n",
+ opts->config_file);
+ fprintf(stderr, "Failed to find NVMEM device\n");
+ return -1;
+ }
}
#else
DEVNAME(0) = DEVICE1_NAME;