Merge branch '2021-02-24-assorted-fixes'

- squashfs, btrfs fixes
- Kconfig CONFIG logic fixes
- hikey DM migration
- Some portability fixes for the build system
- Assorted code cleanups
This commit is contained in:
Tom Rini 2021-02-25 08:20:54 -05:00
commit 53e0fef5a7
27 changed files with 98 additions and 67 deletions

View file

@ -1386,6 +1386,7 @@ MKIMAGEFLAGS_u-boot.img = -f auto -A $(ARCH) -T firmware -C none -O u-boot \
-a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \
-p $(CONFIG_FIT_EXTERNAL_OFFSET) \
-n "U-Boot $(UBOOTRELEASE) for $(BOARD) board" -E \
$(patsubst %,-b arch/$(ARCH)/dts/%.dtb,$(subst ",,$(DEVICE_TREE))) \
$(patsubst %,-b arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) \
$(patsubst %,-b arch/$(ARCH)/dts/%.dtbo,$(subst ",,$(CONFIG_OF_OVERLAY_LIST)))
else

View file

@ -7,6 +7,8 @@
#ifndef __ASM_GBL_DATA_H
#define __ASM_GBL_DATA_H
#ifndef __ASSEMBLY__
#include <asm/types.h>
#include <linux/types.h>
@ -125,4 +127,6 @@ static inline void set_gd(volatile gd_t *gd_ptr)
#endif
}
#endif /* __ASSEMBLY__ */
#endif /* __ASM_GBL_DATA_H */

View file

@ -1188,6 +1188,7 @@ config CMD_PCI
config CMD_PINMUX
bool "pinmux - show pins muxing"
depends on PINCTRL
default y if PINCTRL
help
Parse all available pin-controllers and show pins muxing. This

View file

@ -34,11 +34,9 @@ static int do_pwm(struct cmd_tbl *cmdtp, int flag, int argc,
argc -= 2;
argv += 2;
if (argc > 0) {
str_pwm = *argv;
argc--;
argv++;
}
str_pwm = *argv;
argc--;
argv++;
if (!str_pwm)
return CMD_RET_USAGE;
@ -46,15 +44,23 @@ static int do_pwm(struct cmd_tbl *cmdtp, int flag, int argc,
switch (*str_cmd) {
case 'i':
sub_cmd = PWM_SET_INVERT;
if (argc != 2)
return CMD_RET_USAGE;
break;
case 'c':
sub_cmd = PWM_SET_CONFIG;
if (argc != 3)
return CMD_RET_USAGE;
break;
case 'e':
sub_cmd = PWM_SET_ENABLE;
if (argc != 1)
return CMD_RET_USAGE;
break;
case 'd':
sub_cmd = PWM_SET_DISABLE;
if (argc != 1)
return CMD_RET_USAGE;
break;
default:
return CMD_RET_USAGE;
@ -67,38 +73,29 @@ static int do_pwm(struct cmd_tbl *cmdtp, int flag, int argc,
return cmd_process_error(cmdtp, ret);
}
if (argc > 0) {
str_channel = *argv;
channel = simple_strtoul(str_channel, NULL, 10);
argc--;
argv++;
} else {
return CMD_RET_USAGE;
}
str_channel = *argv;
channel = simple_strtoul(str_channel, NULL, 10);
argc--;
argv++;
if (sub_cmd == PWM_SET_INVERT && argc > 0) {
if (sub_cmd == PWM_SET_INVERT) {
str_enable = *argv;
pwm_enable = simple_strtoul(str_enable, NULL, 10);
ret = pwm_set_invert(dev, channel, pwm_enable);
} else if (sub_cmd == PWM_SET_CONFIG && argc == 2) {
} else if (sub_cmd == PWM_SET_CONFIG) {
str_period = *argv;
argc--;
argv++;
period_ns = simple_strtoul(str_period, NULL, 10);
if (argc > 0) {
str_duty = *argv;
duty_ns = simple_strtoul(str_duty, NULL, 10);
}
str_duty = *argv;
duty_ns = simple_strtoul(str_duty, NULL, 10);
ret = pwm_set_config(dev, channel, period_ns, duty_ns);
} else if (sub_cmd == PWM_SET_ENABLE) {
ret = pwm_set_enable(dev, channel, 1);
} else if (sub_cmd == PWM_SET_DISABLE) {
ret = pwm_set_enable(dev, channel, 0);
} else {
printf("PWM arguments missing\n");
return CMD_RET_FAILURE;
}
if (ret) {

View file

@ -181,6 +181,8 @@ config SPL_FIT_FULL_CHECK
config SPL_FIT_SIGNATURE
bool "Enable signature verification of FIT firmware within SPL"
depends on SPL_DM
depends on SPL_LOAD_FIT || SPL_LOAD_FIT_FULL
select FIT_SIGNATURE
select SPL_FIT
select SPL_CRYPTO_SUPPORT
select SPL_HASH_SUPPORT

View file

@ -576,11 +576,18 @@ int image_setup_libfdt(bootm_headers_t *images, void *blob,
fdt_fixup_pstore(blob);
#endif
if (IMAGE_OF_BOARD_SETUP) {
fdt_ret = ft_board_setup(blob, gd->bd);
if (fdt_ret) {
printf("ERROR: board-specific fdt fixup failed: %s\n",
fdt_strerror(fdt_ret));
goto err;
const char *skip_board_fixup;
skip_board_fixup = env_get("skip_board_fixup");
if (skip_board_fixup && ((int)simple_strtol(skip_board_fixup, NULL, 10) == 1)) {
printf("skip board fdt fixup\n");
} else {
fdt_ret = ft_board_setup(blob, gd->bd);
if (fdt_ret) {
printf("ERROR: board-specific fdt fixup failed: %s\n",
fdt_strerror(fdt_ret));
goto err;
}
}
}
if (IMAGE_OF_SYSTEM_SETUP) {

View file

@ -25,7 +25,9 @@ CONFIG_DM_MMC=y
CONFIG_MMC_DW=y
CONFIG_MMC_DW_K3=y
CONFIG_CONS_INDEX=4
CONFIG_DM_ETH=y
CONFIG_USB=y
CONFIG_DM_USB=y
CONFIG_USB_DWC2=y
CONFIG_USB_HOST_ETHER=y
CONFIG_USB_ETHER_ASIX=y

View file

@ -53,3 +53,4 @@ CONFIG_TIMER=y
CONFIG_MTK_TIMER=y
CONFIG_WDT_MTK=y
CONFIG_LZMA=y
# CONFIG_EFI_GRUB_ARM32_WORKAROUND is not set

View file

@ -2,7 +2,7 @@ CONFIG_ARM=y
CONFIG_TARGET_VEXPRESS64_BASE_FVP=y
CONFIG_SYS_TEXT_BASE=0x88000000
CONFIG_SYS_MALLOC_F_LEN=0x2000
CONFIG_NR_DRAM_BANKS=1
CONFIG_NR_DRAM_BANKS=2
CONFIG_SYS_MEMTEST_START=0x80000000
CONFIG_SYS_MEMTEST_END=0xff000000
CONFIG_ENV_SIZE=0x40000

View file

@ -3202,13 +3202,6 @@ rw_mgr_mem_calibrate_writes_center(struct socfpga_sdrseq *seq,
/* Centre DM */
debug_cond(DLEVEL >= 2, "%s:%d write_center: DM\n", __func__, __LINE__);
/*
* Set the left and right edge of each bit to an illegal value.
* Use (seq->iocfg->io_out1_delay_max + 1) as an illegal value.
*/
left_edge[0] = seq->iocfg->io_out1_delay_max + 1;
right_edge[0] = seq->iocfg->io_out1_delay_max + 1;
/* Search for the/part of the window with DM shift. */
search_window(seq, 1, rank_bgn, write_group, &bgn_curr, &end_curr,
&bgn_best, &end_best, &win_best, 0);

View file

@ -546,7 +546,7 @@ static int ca_do_bch_correction(struct nand_chip *chip,
struct nand_drv *info =
(struct nand_drv *)nand_get_controller_data(chip);
unsigned int reg_v, err_loc0, err_loc1;
int k, max_bitflips;
int k, max_bitflips = 0;
for (k = 0; k < (err_num + 1) / 2; k++) {
reg_v = readl(&info->reg->flash_nf_bch_error_loc01 + k);

View file

@ -713,7 +713,7 @@ static int cortina_eth_recv(struct udevice *dev, int flags, uchar **packetp)
priv->rx_xram_end_adr);
memcpy(&packet_status, rx_xram_ptr,
sizeof(rx_xram_ptr));
sizeof(*rx_xram_ptr));
if (packet_status.valid == 0) {
debug("%s: Invalid Packet !!, ", __func__);
debug("next_link=%d\n", next_link);

View file

@ -33,11 +33,11 @@
#define RNG_FIFO_COUNT_OFFSET 0x24
#define RNG_FIFO_COUNT_RNG_FIFO_COUNT_MASK 0x000000FF
struct iproc_rng200_platdata {
struct iproc_rng200_plat {
fdt_addr_t base;
};
static void iproc_rng200_enable(struct iproc_rng200_platdata *pdata, bool enable)
static void iproc_rng200_enable(struct iproc_rng200_plat *pdata, bool enable)
{
fdt_addr_t rng_base = pdata->base;
u32 val;
@ -52,7 +52,7 @@ static void iproc_rng200_enable(struct iproc_rng200_platdata *pdata, bool enable
writel(val, rng_base + RNG_CTRL_OFFSET);
}
static void iproc_rng200_restart(struct iproc_rng200_platdata *pdata)
static void iproc_rng200_restart(struct iproc_rng200_plat *pdata)
{
fdt_addr_t rng_base = pdata->base;
u32 val;
@ -84,7 +84,7 @@ static void iproc_rng200_restart(struct iproc_rng200_platdata *pdata)
static int iproc_rng200_read(struct udevice *dev, void *data, size_t len)
{
struct iproc_rng200_platdata *priv = dev_get_plat(dev);
struct iproc_rng200_plat *priv = dev_get_plat(dev);
char *buf = (char *)data;
u32 num_remaining = len;
u32 status;
@ -136,7 +136,7 @@ static int iproc_rng200_read(struct udevice *dev, void *data, size_t len)
static int iproc_rng200_probe(struct udevice *dev)
{
struct iproc_rng200_platdata *priv = dev_get_plat(dev);
struct iproc_rng200_plat *priv = dev_get_plat(dev);
iproc_rng200_enable(priv, true);
@ -145,16 +145,16 @@ static int iproc_rng200_probe(struct udevice *dev)
static int iproc_rng200_remove(struct udevice *dev)
{
struct iproc_rng200_platdata *priv = dev_get_plat(dev);
struct iproc_rng200_plat *priv = dev_get_plat(dev);
iproc_rng200_enable(priv, false);
return 0;
}
static int iproc_rng200_ofdata_to_platdata(struct udevice *dev)
static int iproc_rng200_of_to_plat(struct udevice *dev)
{
struct iproc_rng200_platdata *pdata = dev_get_plat(dev);
struct iproc_rng200_plat *pdata = dev_get_plat(dev);
pdata->base = dev_read_addr(dev);
if (!pdata->base)
@ -180,6 +180,6 @@ U_BOOT_DRIVER(iproc_rng200_rng) = {
.ops = &iproc_rng200_ops,
.probe = iproc_rng200_probe,
.remove = iproc_rng200_remove,
.plat_auto = sizeof(struct iproc_rng200_platdata),
.of_to_plat = iproc_rng200_ofdata_to_platdata,
.priv_auto = sizeof(struct iproc_rng200_plat),
.of_to_plat = iproc_rng200_of_to_plat,
};

View file

@ -227,7 +227,7 @@ static int virtio_uclass_post_probe(struct udevice *udev)
struct udevice *vdev;
int ret;
if (uc_priv->device > VIRTIO_ID_MAX_NUM) {
if (uc_priv->device >= VIRTIO_ID_MAX_NUM) {
debug("(%s): virtio device ID %d exceeds maximum num\n",
udev->name, uc_priv->device);
return 0;

View file

@ -22,14 +22,13 @@ static int show_dir(struct btrfs_root *root, struct extent_buffer *eb,
struct btrfs_inode_item ii;
struct btrfs_key key;
static const char* dir_item_str[] = {
[BTRFS_FT_REG_FILE] = "FILE",
[BTRFS_FT_REG_FILE] = " ",
[BTRFS_FT_DIR] = "DIR",
[BTRFS_FT_CHRDEV] = "CHRDEV",
[BTRFS_FT_BLKDEV] = "BLKDEV",
[BTRFS_FT_FIFO] = "FIFO",
[BTRFS_FT_SOCK] = "SOCK",
[BTRFS_FT_SYMLINK] = "SYMLINK",
[BTRFS_FT_XATTR] = "XATTR"
[BTRFS_FT_CHRDEV] = "CHR",
[BTRFS_FT_BLKDEV] = "BLK",
[BTRFS_FT_FIFO] = "FIF",
[BTRFS_FT_SOCK] = "SCK",
[BTRFS_FT_SYMLINK] = "SYM",
};
u8 type = btrfs_dir_type(eb, di);
char namebuf[BTRFS_NAME_LEN];
@ -38,6 +37,10 @@ static int show_dir(struct btrfs_root *root, struct extent_buffer *eb,
time_t mtime;
int ret = 0;
/* skip XATTRs in directory listing */
if (type == BTRFS_FT_XATTR)
return 0;
btrfs_dir_item_key_to_cpu(eb, di, &key);
if (key.type == BTRFS_ROOT_ITEM_KEY) {
@ -90,7 +93,7 @@ static int show_dir(struct btrfs_root *root, struct extent_buffer *eb,
if (type < ARRAY_SIZE(dir_item_str) && dir_item_str[type])
printf("<%s> ", dir_item_str[type]);
else
printf("DIR_ITEM.%u", type);
printf("?%3u? ", type);
if (type == BTRFS_FT_CHRDEV || type == BTRFS_FT_BLKDEV) {
ASSERT(key.type == BTRFS_INODE_ITEM_KEY);
printf("%4llu,%5llu ", btrfs_stack_inode_rdev(&ii) >> 20,

View file

@ -1716,6 +1716,9 @@ void sqfs_closedir(struct fs_dir_stream *dirs)
{
struct squashfs_dir_stream *sqfs_dirs;
if (!dirs)
return;
sqfs_dirs = (struct squashfs_dir_stream *)dirs;
free(sqfs_dirs->inode_table);
free(sqfs_dirs->dir_table);

View file

@ -47,9 +47,7 @@
/* Size of malloc() pool */
#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + SZ_8M)
#ifdef CONFIG_CMD_USB
#define CONFIG_USB_DWC2_REG_ADDR 0xF72C0000
/*#define CONFIG_DWC2_DFLT_SPEED_FULL*/
#ifdef CONFIG_USB_DWC2
#define CONFIG_DWC2_ENABLE_DYNAMIC_FIFO
#endif

View file

@ -117,6 +117,9 @@
#ifdef CONFIG_TARGET_VEXPRESS64_JUNO
#define PHYS_SDRAM_2 (0x880000000)
#define PHYS_SDRAM_2_SIZE 0x180000000
#elif CONFIG_TARGET_VEXPRESS64_BASE_FVP && CONFIG_NR_DRAM_BANKS == 2
#define PHYS_SDRAM_2 (0x880000000)
#define PHYS_SDRAM_2_SIZE 0x80000000
#endif
/* Enable memtest */

View file

@ -361,8 +361,11 @@ extern "C" {
#if (__STD_C || defined(HAVE_MEMCPY))
#if __STD_C
/* U-Boot defines memset() and memcpy in /include/linux/string.h
void* memset(void*, int, size_t);
void* memcpy(void*, const void*, size_t);
*/
#include <linux/string.h>
#else
#ifdef WIN32
/* On Win32 platforms, 'memset()' and 'memcpy()' are already declared in */

View file

@ -9,6 +9,8 @@
#include <errno.h>
#include <image.h>
struct udevice;
/**
* struct key_prop - holder for a public key properties
*

View file

@ -447,8 +447,11 @@ static int rsa_verify_with_keynode(struct image_sign_info *info,
}
algo = fdt_getprop(blob, node, "algo", NULL);
if (strcmp(info->name, algo))
if (strcmp(info->name, algo)) {
debug("%s: Wrong algo: have %s, expected %s", __func__,
info->name, algo);
return -EFAULT;
}
prop.num_bits = fdtdec_get_int(blob, node, "rsa,num-bits", 0);

View file

@ -16,6 +16,7 @@
#else
#include <string.h>
#endif /* USE_HOSTCC */
#include <compiler.h>
#include <watchdog.h>
#include <u-boot/sha512.h>

View file

@ -326,8 +326,7 @@ cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
-d $(depfile).dtc.tmp $(dtc-tmp) || \
(echo "Check $(shell pwd)/$(pre-tmp) for errors" && false) \
; \
cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile) ; \
sed -i "s:$(pre-tmp):$(<):" $(depfile)
sed "s:$(pre-tmp):$(<):" $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile)
$(obj)/%.dtb: $(src)/%.dts FORCE
$(call if_changed_dep,dtc)

View file

@ -39,14 +39,14 @@ new_adhoc="${path}.adhoc"
export LC_ALL=C
export LC_COLLATE=C
cat ${path} |sed -n 's/^#define \(CONFIG_[A-Za-z0-9_]*\).*/\1/p' |sort |uniq \
cat ${path} |sed -nr 's/^#define (CONFIG_[A-Za-z0-9_]*).*/\1/p' |sort |uniq \
>${configs}
comm -23 ${configs} ${whitelist} > ${suspects}
cat `find ${srctree} -name "Kconfig*"` |sed -n \
-e 's/^\s*config *\([A-Za-z0-9_]*\).*$/CONFIG_\1/p' \
-e 's/^\s*menuconfig \([A-Za-z0-9_]*\).*$/CONFIG_\1/p' \
cat `find ${srctree} -name "Kconfig*"` |sed -nr \
-e 's/^[[:blank:]]*config *([A-Za-z0-9_]*).*$/CONFIG_\1/p' \
-e 's/^[[:blank:]]*menuconfig ([A-Za-z0-9_]*).*$/CONFIG_\1/p' \
|sort |uniq > ${ok}
comm -23 ${suspects} ${ok} >${new_adhoc}
if [ -s ${new_adhoc} ]; then

View file

@ -2383,6 +2383,12 @@ sub u_boot_line {
"fdt or initrd relocation disabled at boot time\n" . $herecurr);
}
# make sure 'skip_board_fixup' is not
if ($rawline =~ /.*skip_board_fixup.*/) {
ERROR("SKIP_BOARD_FIXUP",
"Avoid setting skip_board_fixup env variable\n" . $herecurr);
}
# Do not use CONFIG_ prefix in CONFIG_IS_ENABLED() calls
if ($line =~ /^\+.*CONFIG_IS_ENABLED\(CONFIG_\w*\).*/) {
ERROR("CONFIG_IS_ENABLED_CONFIG",

View file

@ -8,4 +8,4 @@ endif
obj-y += mem.o
obj-$(CONFIG_CMD_MEM_SEARCH) += mem_search.o
obj-$(CONFIG_CMD_PWM) += pwm.o
obj-y += setexpr.o
obj-$(CONFIG_CMD_SETEXPR) += setexpr.o

View file

@ -75,8 +75,10 @@ static struct cmd_tbl cmd_ut_sub[] = {
U_BOOT_CMD_MKENT(log, CONFIG_SYS_MAXARGS, 1, do_ut_log, "", ""),
#endif
U_BOOT_CMD_MKENT(mem, CONFIG_SYS_MAXARGS, 1, do_ut_mem, "", ""),
#ifdef CONFIG_CMD_SETEXPR
U_BOOT_CMD_MKENT(setexpr, CONFIG_SYS_MAXARGS, 1, do_ut_setexpr, "",
""),
#endif
#ifdef CONFIG_UT_TIME
U_BOOT_CMD_MKENT(time, CONFIG_SYS_MAXARGS, 1, do_ut_time, "", ""),
#endif