mirror of
https://github.com/smaeul/u-boot.git
synced 2025-10-13 20:36:02 +01:00
Merge branch '2022-07-08-assorted-updates' into next
- Assorted bugfixes and improvements
This commit is contained in:
commit
7bc0be96f7
6
Makefile
6
Makefile
@ -673,6 +673,12 @@ else
|
|||||||
include/config/auto.conf: ;
|
include/config/auto.conf: ;
|
||||||
endif # $(dot-config)
|
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
|
# Xtensa linker script cannot be preprocessed with -ansi because of
|
||||||
# preprocessor operations on strings that don't make C identifiers.
|
# preprocessor operations on strings that don't make C identifiers.
|
||||||
|
@ -78,8 +78,10 @@ __weak void board_init_f_init_stack_protection(void)
|
|||||||
ulong board_init_f_alloc_reserve(ulong top)
|
ulong board_init_f_alloc_reserve(ulong top)
|
||||||
{
|
{
|
||||||
/* Reserve early malloc arena */
|
/* Reserve early malloc arena */
|
||||||
|
#ifndef CONFIG_MALLOC_F_ADDR
|
||||||
#if CONFIG_VAL(SYS_MALLOC_F_LEN)
|
#if CONFIG_VAL(SYS_MALLOC_F_LEN)
|
||||||
top -= CONFIG_VAL(SYS_MALLOC_F_LEN);
|
top -= CONFIG_VAL(SYS_MALLOC_F_LEN);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
/* LAST : reserve GD (rounded up to a multiple of 16 bytes) */
|
/* LAST : reserve GD (rounded up to a multiple of 16 bytes) */
|
||||||
top = rounddown(top-sizeof(struct global_data), 16);
|
top = rounddown(top-sizeof(struct global_data), 16);
|
||||||
|
@ -95,27 +95,17 @@ static enum led_state_t led_pwm_get_state(struct udevice *dev)
|
|||||||
static int led_pwm_probe(struct udevice *dev)
|
static int led_pwm_probe(struct udevice *dev)
|
||||||
{
|
{
|
||||||
struct led_pwm_priv *priv = dev_get_priv(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);
|
return led_pwm_set_state(dev, (priv->enabled) ? LEDST_ON : LEDST_OFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int led_pwm_of_to_plat(struct udevice *dev)
|
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 led_pwm_priv *priv = dev_get_priv(dev);
|
||||||
struct ofnode_phandle_args args;
|
struct ofnode_phandle_args args;
|
||||||
uint def_brightness, max_brightness;
|
uint def_brightness, max_brightness;
|
||||||
int ret;
|
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);
|
ret = dev_read_phandle_with_args(dev, "pwms", "#pwm-cells", 0, 0, &args);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
@ -173,10 +163,15 @@ static const struct udevice_id led_pwm_ids[] = {
|
|||||||
U_BOOT_DRIVER(led_pwm) = {
|
U_BOOT_DRIVER(led_pwm) = {
|
||||||
.name = LEDS_PWM_DRIVER_NAME,
|
.name = LEDS_PWM_DRIVER_NAME,
|
||||||
.id = UCLASS_LED,
|
.id = UCLASS_LED,
|
||||||
.of_match = led_pwm_ids,
|
|
||||||
.ops = &led_pwm_ops,
|
.ops = &led_pwm_ops,
|
||||||
.priv_auto = sizeof(struct led_pwm_priv),
|
.priv_auto = sizeof(struct led_pwm_priv),
|
||||||
.bind = led_pwm_bind,
|
|
||||||
.probe = led_pwm_probe,
|
.probe = led_pwm_probe,
|
||||||
.of_to_plat = led_pwm_of_to_plat,
|
.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,
|
||||||
|
};
|
||||||
|
@ -974,6 +974,22 @@ static int nand_reset_data_interface(struct nand_chip *chip, int chipnr)
|
|||||||
return ret;
|
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
|
* nand_setup_data_interface - Setup the best data interface and timings
|
||||||
* @chip: The NAND chip
|
* @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
|
* Ensure the timing mode has been changed on the chip side
|
||||||
* before changing timings on the controller side.
|
* before changing timings on the controller side.
|
||||||
*/
|
*/
|
||||||
if (chip->onfi_version) {
|
ret = nand_onfi_set_timings(mtd, chip);
|
||||||
u8 tmode_param[ONFI_SUBFEATURE_PARAM_LEN] = {
|
if (ret)
|
||||||
chip->onfi_timing_mode_default,
|
goto err;
|
||||||
};
|
|
||||||
|
|
||||||
ret = chip->onfi_set_features(mtd, chip,
|
|
||||||
ONFI_FEATURE_ADDR_TIMING_MODE,
|
|
||||||
tmode_param);
|
|
||||||
if (ret)
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = chip->setup_data_interface(mtd, chipnr, chip->data_interface);
|
ret = chip->setup_data_interface(mtd, chipnr, chip->data_interface);
|
||||||
err:
|
err:
|
||||||
|
@ -328,6 +328,10 @@ static inline void _debug_uart_init(void)
|
|||||||
struct ns16550 *com_port = (struct ns16550 *)CONFIG_VAL(DEBUG_UART_BASE);
|
struct ns16550 *com_port = (struct ns16550 *)CONFIG_VAL(DEBUG_UART_BASE);
|
||||||
int baud_divisor;
|
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.
|
* We copy the code from above because it is already horribly messy.
|
||||||
* Trying to refactor to nicely remove the duplication doesn't seem
|
* Trying to refactor to nicely remove the duplication doesn't seem
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#define DA7219_ACPI_HID "DLGS7219"
|
#define DA7219_ACPI_HID "DLGS7219"
|
||||||
|
|
||||||
|
__maybe_unused
|
||||||
static int da7219_acpi_fill_ssdt(const struct udevice *dev,
|
static int da7219_acpi_fill_ssdt(const struct udevice *dev,
|
||||||
struct acpi_ctx *ctx)
|
struct acpi_ctx *ctx)
|
||||||
{
|
{
|
||||||
@ -171,10 +172,12 @@ static int da7219_acpi_setup_nhlt(const struct udevice *dev,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct acpi_ops da7219_acpi_ops = {
|
struct acpi_ops da7219_acpi_ops = {
|
||||||
|
#ifdef CONFIG_ACPIGEN
|
||||||
.fill_ssdt = da7219_acpi_fill_ssdt,
|
.fill_ssdt = da7219_acpi_fill_ssdt,
|
||||||
#ifdef CONFIG_X86
|
#ifdef CONFIG_X86
|
||||||
.setup_nhlt = da7219_acpi_setup_nhlt,
|
.setup_nhlt = da7219_acpi_setup_nhlt,
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct udevice_id da7219_ids[] = {
|
static const struct udevice_id da7219_ids[] = {
|
||||||
|
@ -38,6 +38,7 @@ static int max98357a_of_to_plat(struct udevice *dev)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__maybe_unused
|
||||||
static int max98357a_acpi_fill_ssdt(const struct udevice *dev,
|
static int max98357a_acpi_fill_ssdt(const struct udevice *dev,
|
||||||
struct acpi_ctx *ctx)
|
struct acpi_ctx *ctx)
|
||||||
{
|
{
|
||||||
@ -137,10 +138,12 @@ static int max98357a_acpi_setup_nhlt(const struct udevice *dev,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct acpi_ops max98357a_acpi_ops = {
|
struct acpi_ops max98357a_acpi_ops = {
|
||||||
|
#ifdef CONFIG_ACPIGEN
|
||||||
.fill_ssdt = max98357a_acpi_fill_ssdt,
|
.fill_ssdt = max98357a_acpi_fill_ssdt,
|
||||||
#ifdef CONFIG_X86
|
#ifdef CONFIG_X86
|
||||||
.setup_nhlt = max98357a_acpi_setup_nhlt,
|
.setup_nhlt = max98357a_acpi_setup_nhlt,
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct audio_codec_ops max98357a_ops = {
|
static const struct audio_codec_ops max98357a_ops = {
|
||||||
|
5
env/ext4.c
vendored
5
env/ext4.c
vendored
@ -31,6 +31,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <ext4fs.h>
|
#include <ext4fs.h>
|
||||||
#include <mmc.h>
|
#include <mmc.h>
|
||||||
|
#include <scsi.h>
|
||||||
#include <asm/global_data.h>
|
#include <asm/global_data.h>
|
||||||
|
|
||||||
DECLARE_GLOBAL_DATA_PTR;
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
@ -146,6 +147,10 @@ static int env_ext4_load(void)
|
|||||||
if (!strcmp(ifname, "mmc"))
|
if (!strcmp(ifname, "mmc"))
|
||||||
mmc_initialize(NULL);
|
mmc_initialize(NULL);
|
||||||
#endif
|
#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,
|
part = blk_get_device_part_str(ifname, dev_and_part,
|
||||||
&dev_desc, &info, 1);
|
&dev_desc, &info, 1);
|
||||||
|
8
env/fat.c
vendored
8
env/fat.c
vendored
@ -17,6 +17,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fat.h>
|
#include <fat.h>
|
||||||
#include <mmc.h>
|
#include <mmc.h>
|
||||||
|
#include <scsi.h>
|
||||||
#include <asm/cache.h>
|
#include <asm/cache.h>
|
||||||
#include <asm/global_data.h>
|
#include <asm/global_data.h>
|
||||||
#include <linux/stddef.h>
|
#include <linux/stddef.h>
|
||||||
@ -128,7 +129,12 @@ static int env_fat_load(void)
|
|||||||
if (!strcmp(ifname, "mmc"))
|
if (!strcmp(ifname, "mmc"))
|
||||||
mmc_initialize(NULL);
|
mmc_initialize(NULL);
|
||||||
#endif
|
#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,
|
part = blk_get_device_part_str(ifname, dev_and_part,
|
||||||
&dev_desc, &info, 1);
|
&dev_desc, &info, 1);
|
||||||
if (part < 0)
|
if (part < 0)
|
||||||
|
@ -1757,6 +1757,8 @@ void ubifs_umount(struct ubifs_info *c)
|
|||||||
kfree(c->bottom_up_buf);
|
kfree(c->bottom_up_buf);
|
||||||
ubifs_debugging_exit(c);
|
ubifs_debugging_exit(c);
|
||||||
#ifdef __UBOOT__
|
#ifdef __UBOOT__
|
||||||
|
ubi_close_volume(c->ubi);
|
||||||
|
mutex_unlock(&c->umount_mutex);
|
||||||
/* Finally free U-Boot's global copy of superblock */
|
/* Finally free U-Boot's global copy of superblock */
|
||||||
if (ubifs_sb != NULL) {
|
if (ubifs_sb != NULL) {
|
||||||
free(ubifs_sb->s_fs_info);
|
free(ubifs_sb->s_fs_info);
|
||||||
@ -2058,9 +2060,9 @@ static void ubifs_put_super(struct super_block *sb)
|
|||||||
ubifs_umount(c);
|
ubifs_umount(c);
|
||||||
#ifndef __UBOOT__
|
#ifndef __UBOOT__
|
||||||
bdi_destroy(&c->bdi);
|
bdi_destroy(&c->bdi);
|
||||||
#endif
|
|
||||||
ubi_close_volume(c->ubi);
|
ubi_close_volume(c->ubi);
|
||||||
mutex_unlock(&c->umount_mutex);
|
mutex_unlock(&c->umount_mutex);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -2327,6 +2329,9 @@ static int ubifs_fill_super(struct super_block *sb, void *data, int silent)
|
|||||||
|
|
||||||
out_umount:
|
out_umount:
|
||||||
ubifs_umount(c);
|
ubifs_umount(c);
|
||||||
|
#ifdef __UBOOT__
|
||||||
|
goto out;
|
||||||
|
#endif
|
||||||
out_unlock:
|
out_unlock:
|
||||||
mutex_unlock(&c->umount_mutex);
|
mutex_unlock(&c->umount_mutex);
|
||||||
#ifndef __UBOOT__
|
#ifndef __UBOOT__
|
||||||
|
@ -70,18 +70,23 @@
|
|||||||
#ifdef CONFIG_CMD_UBIFS
|
#ifdef CONFIG_CMD_UBIFS
|
||||||
#define BOOTENV_SHARED_UBIFS \
|
#define BOOTENV_SHARED_UBIFS \
|
||||||
"ubifs_boot=" \
|
"ubifs_boot=" \
|
||||||
"env exists bootubipart || " \
|
|
||||||
"env set bootubipart UBI; " \
|
|
||||||
"env exists bootubivol || " \
|
|
||||||
"env set bootubivol boot; " \
|
|
||||||
"if ubi part ${bootubipart} && " \
|
"if ubi part ${bootubipart} && " \
|
||||||
"ubifsmount ubi${devnum}:${bootubivol}; " \
|
"ubifsmount ubi0:${bootubivol}; " \
|
||||||
"then " \
|
"then " \
|
||||||
"devtype=ubi; " \
|
"devtype=ubi; " \
|
||||||
|
"devnum=ubi0; " \
|
||||||
|
"bootfstype=ubifs; " \
|
||||||
|
"distro_bootpart=${bootubivol}; " \
|
||||||
"run scan_dev_for_boot; " \
|
"run scan_dev_for_boot; " \
|
||||||
|
"ubifsumount; " \
|
||||||
"fi\0"
|
"fi\0"
|
||||||
#define BOOTENV_DEV_UBIFS BOOTENV_DEV_BLKDEV
|
#define BOOTENV_DEV_UBIFS(devtypeu, devtypel, instance, bootubipart, bootubivol) \
|
||||||
#define BOOTENV_DEV_NAME_UBIFS BOOTENV_DEV_NAME_BLKDEV
|
"bootcmd_ubifs" #instance "=" \
|
||||||
|
"bootubipart=" #bootubipart "; " \
|
||||||
|
"bootubivol=" #bootubivol "; " \
|
||||||
|
"run ubifs_boot\0"
|
||||||
|
#define BOOTENV_DEV_NAME_UBIFS(devtypeu, devtypel, instance, bootubipart, bootubivol) \
|
||||||
|
#devtypel #instance " "
|
||||||
#else
|
#else
|
||||||
#define BOOTENV_SHARED_UBIFS
|
#define BOOTENV_SHARED_UBIFS
|
||||||
#define BOOTENV_DEV_UBIFS \
|
#define BOOTENV_DEV_UBIFS \
|
||||||
@ -411,13 +416,13 @@
|
|||||||
BOOT_TARGET_DEVICES_references_PXE_without_CONFIG_CMD_DHCP_or_PXE
|
BOOT_TARGET_DEVICES_references_PXE_without_CONFIG_CMD_DHCP_or_PXE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define BOOTENV_DEV_NAME(devtypeu, devtypel, instance) \
|
#define BOOTENV_DEV_NAME(devtypeu, devtypel, instance, ...) \
|
||||||
BOOTENV_DEV_NAME_##devtypeu(devtypeu, devtypel, instance)
|
BOOTENV_DEV_NAME_##devtypeu(devtypeu, devtypel, instance, ## __VA_ARGS__)
|
||||||
#define BOOTENV_BOOT_TARGETS \
|
#define BOOTENV_BOOT_TARGETS \
|
||||||
"boot_targets=" BOOT_TARGET_DEVICES(BOOTENV_DEV_NAME) "\0"
|
"boot_targets=" BOOT_TARGET_DEVICES(BOOTENV_DEV_NAME) "\0"
|
||||||
|
|
||||||
#define BOOTENV_DEV(devtypeu, devtypel, instance) \
|
#define BOOTENV_DEV(devtypeu, devtypel, instance, ...) \
|
||||||
BOOTENV_DEV_##devtypeu(devtypeu, devtypel, instance)
|
BOOTENV_DEV_##devtypeu(devtypeu, devtypel, instance, ## __VA_ARGS__)
|
||||||
#define BOOTENV \
|
#define BOOTENV \
|
||||||
BOOTENV_SHARED_HOST \
|
BOOTENV_SHARED_HOST \
|
||||||
BOOTENV_SHARED_MMC \
|
BOOTENV_SHARED_MMC \
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
"ramdisk_addr_r=0x88080000\0" \
|
"ramdisk_addr_r=0x88080000\0" \
|
||||||
|
|
||||||
#define BOOT_TARGET_DEVICES(func) \
|
#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"
|
#define AM335XX_BOARD_FDTFILE "fdtfile=" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0"
|
||||||
|
|
||||||
@ -51,7 +51,6 @@
|
|||||||
BOOTENV \
|
BOOTENV \
|
||||||
GUARDIAN_DEFAULT_PROD_ENV \
|
GUARDIAN_DEFAULT_PROD_ENV \
|
||||||
"backlight_brightness=50\0" \
|
"backlight_brightness=50\0" \
|
||||||
"bootubivol=rootfs\0" \
|
|
||||||
"distro_bootcmd=" \
|
"distro_bootcmd=" \
|
||||||
"setenv rootflags \"bulk_read,chk_data_crc\"; " \
|
"setenv rootflags \"bulk_read,chk_data_crc\"; " \
|
||||||
"setenv ethact usb_ether; " \
|
"setenv ethact usb_ether; " \
|
||||||
|
@ -90,7 +90,6 @@
|
|||||||
UBI_BOOTCMD \
|
UBI_BOOTCMD \
|
||||||
UBOOT_UPDATE \
|
UBOOT_UPDATE \
|
||||||
"boot_script_dhcp=boot.scr\0" \
|
"boot_script_dhcp=boot.scr\0" \
|
||||||
"bootubipart=ubi\0" \
|
|
||||||
"console=ttymxc0\0" \
|
"console=ttymxc0\0" \
|
||||||
"defargs=user_debug=30\0" \
|
"defargs=user_debug=30\0" \
|
||||||
"fdt_board=eval-v3\0" \
|
"fdt_board=eval-v3\0" \
|
||||||
|
@ -130,7 +130,6 @@
|
|||||||
UBOOT_UPDATE \
|
UBOOT_UPDATE \
|
||||||
"boot_file=zImage\0" \
|
"boot_file=zImage\0" \
|
||||||
"boot_script_dhcp=boot.scr\0" \
|
"boot_script_dhcp=boot.scr\0" \
|
||||||
"bootubipart=ubi\0" \
|
|
||||||
"console=ttymxc0\0" \
|
"console=ttymxc0\0" \
|
||||||
"defargs=\0" \
|
"defargs=\0" \
|
||||||
"fdt_board=eval-v3\0" \
|
"fdt_board=eval-v3\0" \
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
#define BOOT_TARGET_DEVICES(func) \
|
#define BOOT_TARGET_DEVICES(func) \
|
||||||
func(MMC, mmc, 1) \
|
func(MMC, mmc, 1) \
|
||||||
func(MMC, mmc, 0) \
|
func(MMC, mmc, 0) \
|
||||||
func(UBIFS, ubifs, 0) \
|
func(UBIFS, ubifs, 0, UBI, boot) \
|
||||||
func(USB, usb, 0) \
|
func(USB, usb, 0) \
|
||||||
func(PXE, pxe, na) \
|
func(PXE, pxe, na) \
|
||||||
func(DHCP, dhcp, na)
|
func(DHCP, dhcp, na)
|
||||||
|
@ -50,7 +50,7 @@
|
|||||||
|
|
||||||
#define BOOT_TARGET_DEVICES(func) \
|
#define BOOT_TARGET_DEVICES(func) \
|
||||||
func(MMC, mmc, 0) \
|
func(MMC, mmc, 0) \
|
||||||
func(UBIFS, ubifs, 0) \
|
func(UBIFS, ubifs, 0, UBI, boot) \
|
||||||
func(PXE, pxe, na) \
|
func(PXE, pxe, na) \
|
||||||
func(DHCP, dhcp, na)
|
func(DHCP, dhcp, na)
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@
|
|||||||
|
|
||||||
#define BOOT_TARGET_DEVICES(func) \
|
#define BOOT_TARGET_DEVICES(func) \
|
||||||
func(MMC, mmc, 0) \
|
func(MMC, mmc, 0) \
|
||||||
func(UBIFS, ubifs, 0) \
|
func(UBIFS, ubifs, 0, UBI, boot) \
|
||||||
func(PXE, pxe, na) \
|
func(PXE, pxe, na) \
|
||||||
func(DHCP, dhcp, na)
|
func(DHCP, dhcp, na)
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@
|
|||||||
#define BOOT_TARGET_DEVICES(func) \
|
#define BOOT_TARGET_DEVICES(func) \
|
||||||
func(MMC, mmc, 0) \
|
func(MMC, mmc, 0) \
|
||||||
func(LEGACY_MMC, legacy_mmc, 0) \
|
func(LEGACY_MMC, legacy_mmc, 0) \
|
||||||
func(UBIFS, ubifs, 0) \
|
func(UBIFS, ubifs, 0, rootfs, rootfs) \
|
||||||
func(NAND, nand, 0)
|
func(NAND, nand, 0)
|
||||||
|
|
||||||
#else /* !CONFIG_MTD_RAW_NAND */
|
#else /* !CONFIG_MTD_RAW_NAND */
|
||||||
@ -84,8 +84,6 @@
|
|||||||
"bootenv=uEnv.txt\0" \
|
"bootenv=uEnv.txt\0" \
|
||||||
"bootfile=zImage\0" \
|
"bootfile=zImage\0" \
|
||||||
"bootpart=0:2\0" \
|
"bootpart=0:2\0" \
|
||||||
"bootubivol=rootfs\0" \
|
|
||||||
"bootubipart=rootfs\0" \
|
|
||||||
"usbtty=cdc_acm\0" \
|
"usbtty=cdc_acm\0" \
|
||||||
"mpurate=auto\0" \
|
"mpurate=auto\0" \
|
||||||
"buddy=none\0" \
|
"buddy=none\0" \
|
||||||
|
@ -56,7 +56,7 @@
|
|||||||
#define BOOT_TARGET_DEVICES(func) \
|
#define BOOT_TARGET_DEVICES(func) \
|
||||||
func(MMC, mmc, 0) \
|
func(MMC, mmc, 0) \
|
||||||
func(LEGACY_MMC, legacy_mmc, 0) \
|
func(LEGACY_MMC, legacy_mmc, 0) \
|
||||||
func(UBIFS, ubifs, 0) \
|
func(UBIFS, ubifs, 0, rootfs, rootfs) \
|
||||||
func(NAND, nand, 0)
|
func(NAND, nand, 0)
|
||||||
|
|
||||||
#else /* !CONFIG_MTD_RAW_NAND */
|
#else /* !CONFIG_MTD_RAW_NAND */
|
||||||
@ -82,8 +82,6 @@
|
|||||||
"bootenv=uEnv.txt\0" \
|
"bootenv=uEnv.txt\0" \
|
||||||
"bootfile=zImage\0" \
|
"bootfile=zImage\0" \
|
||||||
"bootpart=0:2\0" \
|
"bootpart=0:2\0" \
|
||||||
"bootubivol=rootfs\0" \
|
|
||||||
"bootubipart=rootfs\0" \
|
|
||||||
"optargs=\0" \
|
"optargs=\0" \
|
||||||
"nandroot=ubi0:rootfs ubi.mtd=rootfs rw noinitrd\0" \
|
"nandroot=ubi0:rootfs ubi.mtd=rootfs rw noinitrd\0" \
|
||||||
"nandrootfstype=ubifs rootwait\0" \
|
"nandrootfstype=ubifs rootwait\0" \
|
||||||
|
@ -62,7 +62,7 @@
|
|||||||
|
|
||||||
#define BOOT_TARGET_DEVICES(func) \
|
#define BOOT_TARGET_DEVICES(func) \
|
||||||
func(MMC, mmc, 0) \
|
func(MMC, mmc, 0) \
|
||||||
func(UBIFS, ubifs, 0) \
|
func(UBIFS, ubifs, 0, UBI, boot) \
|
||||||
func(PXE, pxe, na) \
|
func(PXE, pxe, na) \
|
||||||
func(DHCP, dhcp, na)
|
func(DHCP, dhcp, na)
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_CMD_UBIFS
|
#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
|
#else
|
||||||
#define BOOT_TARGET_UBIFS(func)
|
#define BOOT_TARGET_UBIFS(func)
|
||||||
#endif
|
#endif
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_CMD_UBIFS
|
#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
|
#else
|
||||||
#define BOOT_TARGET_DEVICE_UBIFS(func)
|
#define BOOT_TARGET_DEVICE_UBIFS(func)
|
||||||
#endif
|
#endif
|
||||||
|
@ -460,7 +460,7 @@ struct reg_field {
|
|||||||
struct regmap_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
|
* @_reg: Offset of the register within the regmap bank
|
||||||
* @_lsb: lsb of the register field.
|
* @_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);
|
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
|
* @valp: Pointer to the buffer to receive the data read from the regmap
|
||||||
* field
|
* field
|
||||||
*
|
*
|
||||||
|
@ -18,9 +18,13 @@ obj-$(CONFIG_UT_DM) += core.o
|
|||||||
obj-$(CONFIG_UT_DM) += read.o
|
obj-$(CONFIG_UT_DM) += read.o
|
||||||
obj-$(CONFIG_UT_DM) += phys2bus.o
|
obj-$(CONFIG_UT_DM) += phys2bus.o
|
||||||
ifneq ($(CONFIG_SANDBOX),)
|
ifneq ($(CONFIG_SANDBOX),)
|
||||||
obj-$(CONFIG_ACPIGEN) += acpi.o
|
ifeq ($(CONFIG_ACPIGEN),y)
|
||||||
obj-$(CONFIG_ACPIGEN) += acpigen.o
|
obj-y += acpi.o
|
||||||
obj-$(CONFIG_ACPIGEN) += acpi_dp.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_ADC) += adc.o
|
||||||
obj-$(CONFIG_SOUND) += audio.o
|
obj-$(CONFIG_SOUND) += audio.o
|
||||||
obj-$(CONFIG_AXI) += axi.o
|
obj-$(CONFIG_AXI) += axi.o
|
||||||
@ -43,11 +47,9 @@ ifneq ($(CONFIG_EFI_PARTITION),)
|
|||||||
obj-$(CONFIG_FASTBOOT_FLASH_MMC) += fastboot.o
|
obj-$(CONFIG_FASTBOOT_FLASH_MMC) += fastboot.o
|
||||||
endif
|
endif
|
||||||
obj-$(CONFIG_FIRMWARE) += firmware.o
|
obj-$(CONFIG_FIRMWARE) += firmware.o
|
||||||
obj-$(CONFIG_DM_GPIO) += gpio.o
|
|
||||||
obj-$(CONFIG_DM_HWSPINLOCK) += hwspinlock.o
|
obj-$(CONFIG_DM_HWSPINLOCK) += hwspinlock.o
|
||||||
obj-$(CONFIG_DM_I2C) += i2c.o
|
obj-$(CONFIG_DM_I2C) += i2c.o
|
||||||
obj-$(CONFIG_SOUND) += i2s.o
|
obj-$(CONFIG_SOUND) += i2s.o
|
||||||
obj-y += irq.o
|
|
||||||
obj-$(CONFIG_CLK_K210_SET_RATE) += k210_pll.o
|
obj-$(CONFIG_CLK_K210_SET_RATE) += k210_pll.o
|
||||||
obj-$(CONFIG_IOMMU) += iommu.o
|
obj-$(CONFIG_IOMMU) += iommu.o
|
||||||
obj-$(CONFIG_LED) += led.o
|
obj-$(CONFIG_LED) += led.o
|
||||||
|
70
tools/env/fw_env.c
vendored
70
tools/env/fw_env.c
vendored
@ -1713,6 +1713,67 @@ static int check_device_config(int dev)
|
|||||||
return rc;
|
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)
|
static int parse_config(struct env_opts *opts)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
@ -1723,9 +1784,12 @@ static int parse_config(struct env_opts *opts)
|
|||||||
#if defined(CONFIG_FILE)
|
#if defined(CONFIG_FILE)
|
||||||
/* Fills in DEVNAME(), ENVSIZE(), DEVESIZE(). Or don't. */
|
/* Fills in DEVNAME(), ENVSIZE(), DEVESIZE(). Or don't. */
|
||||||
if (get_config(opts->config_file)) {
|
if (get_config(opts->config_file)) {
|
||||||
fprintf(stderr, "Cannot parse config file '%s': %m\n",
|
if (find_nvmem_device()) {
|
||||||
opts->config_file);
|
fprintf(stderr, "Cannot parse config file '%s': %m\n",
|
||||||
return -1;
|
opts->config_file);
|
||||||
|
fprintf(stderr, "Failed to find NVMEM device\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
DEVNAME(0) = DEVICE1_NAME;
|
DEVNAME(0) = DEVICE1_NAME;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user