Merge branch '2023-11-16-assorted-updates' into next

- squashfs improvements, remove common.h in some places, assorted code
  fixes, fix a few CONFIG symbol names in Kconfig files, bring in
  linux's <linux/time.h> conversion functions, poplar updates, bcb
  improvements.
This commit is contained in:
Tom Rini 2023-11-17 08:38:05 -05:00
commit ae7ec8b0be
71 changed files with 336 additions and 263 deletions

View file

@ -4,7 +4,6 @@
* Christophe Leroy, CS Systemes d'Information, christophe.leroy@c-s.fr
*/
#include <common.h>
#include <cpu_func.h>
#include <asm/processor.h>
#include <asm/ppc.h>

View file

@ -16,7 +16,6 @@
* Wolfgang Denk <wd@denx.de>
*/
#include <common.h>
#include <cpu_func.h>
#include <display_options.h>
#include <net.h>

View file

@ -4,7 +4,6 @@
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*/
#include <common.h>
#include <init.h>
#include <watchdog.h>

View file

@ -5,7 +5,6 @@
* Code copied & edited from Freescale mpc85xx stuff.
*/
#include <common.h>
#include <time.h>
#include <asm/global_data.h>
#include <linux/libfdt.h>

View file

@ -8,7 +8,6 @@
* MPC8xx Internal Memory Map Functions
*/
#include <common.h>
#include <command.h>
#include <asm/global_data.h>
@ -16,6 +15,7 @@
#include <asm/cpm_8xx.h>
#include <asm/iopin_8xx.h>
#include <asm/io.h>
#include <asm/ppc.h>
DECLARE_GLOBAL_DATA_PTR;

View file

@ -4,7 +4,7 @@
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*/
#include <common.h>
#include <stdio.h>
#include <irq_func.h>
#include <mpc8xx.h>
#include <mpc8xx_irq.h>

View file

@ -4,12 +4,12 @@
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*/
#include <common.h>
#include <clock_legacy.h>
#include <mpc8xx.h>
#include <asm/global_data.h>
#include <asm/processor.h>
#include <asm/io.h>
#include <asm/immap_8xx.h>
DECLARE_GLOBAL_DATA_PTR;

View file

@ -15,7 +15,7 @@
* This file handles the architecture-dependent parts of hardware exceptions
*/
#include <common.h>
#include <vsprintf.h>
#include <asm/ptrace.h>
#include <command.h>
#include <asm/processor.h>

View file

@ -9,7 +9,6 @@
*/
#include <env.h>
#include <common.h>
#include <mpc8xx.h>
#include <asm/cpm_8xx.h>
#include <asm/io.h>

View file

@ -7,7 +7,6 @@
*/
#include <config.h>
#include <common.h>
#include <nand.h>
#include <linux/bitops.h>
#include <linux/mtd/rawnand.h>

View file

@ -4,13 +4,14 @@
* Charles Frey <charles.frey@c-s.fr>
*/
#include <common.h>
#include <linux/sizes.h>
#include <linux/delay.h>
#include <init.h>
#include <asm/io.h>
#include <mpc8xx.h>
#include <watchdog.h>
#include <asm/ppc.h>
#include <asm/immap_8xx.h>
DECLARE_GLOBAL_DATA_PTR;

View file

@ -4,7 +4,6 @@
*/
#include <command.h>
#include <common.h>
#include <dm.h>
#include <env.h>
#include <env_internal.h>

View file

@ -7,7 +7,6 @@
* Board specific routines for the MCR3000 board
*/
#include <common.h>
#include <env.h>
#include <hwconfig.h>
#include <init.h>

View file

@ -6,7 +6,6 @@
*/
#include <config.h>
#include <common.h>
#include <nand.h>
#include <linux/mtd/rawnand.h>
#include <asm/io.h>

View file

@ -11,16 +11,13 @@
#include <asm/arch/clk.h>
#include <asm/arch/pwm.h>
#include <i2c.h>
#include <linux/time.h>
#include <irq_func.h>
#include <asm/arch/nexell.h>
#include <asm/arch/nx_gpio.h>
#ifndef NSEC_PER_SEC
#define NSEC_PER_SEC 1000000000L
#endif
#define SAMPLE_BPS 9600
#define SAMPLE_IN_US 101 /* (1000000 / BPS) */

View file

@ -317,13 +317,6 @@ static int do_bootm_vxworks_legacy(int flag, int argc, char *const argv[],
if (flag != BOOTM_STATE_OS_GO)
return 0;
#if defined(CONFIG_FIT)
if (!images->legacy_hdr_valid) {
fit_unsupported_reset("VxWorks");
return 1;
}
#endif
do_bootvx_fdt(images);
return 1;

View file

@ -960,7 +960,6 @@ config CMD_ADC
config CMD_BCB
bool "bcb"
depends on MMC
depends on PARTITIONS
help
Read/modify/write the fields of Bootloader Control Block, usually

205
cmd/bcb.c
View file

@ -25,9 +25,18 @@ enum bcb_cmd {
BCB_CMD_STORE,
};
static int bcb_dev = -1;
static int bcb_part = -1;
static const char * const fields[] = {
"command",
"status",
"recovery",
"stage"
};
static struct bootloader_message bcb __aligned(ARCH_DMA_MINALIGN) = { { 0 } };
static struct disk_partition partition_data;
static struct blk_desc *block;
static struct disk_partition *partition = &partition_data;
static int bcb_cmd_get(char *cmd)
{
@ -53,6 +62,9 @@ static int bcb_is_misused(int argc, char *const argv[])
switch (cmd) {
case BCB_CMD_LOAD:
if (argc != 3 && argc != 4)
goto err;
break;
case BCB_CMD_FIELD_SET:
if (argc != 3)
goto err;
@ -78,7 +90,7 @@ static int bcb_is_misused(int argc, char *const argv[])
return -1;
}
if (cmd != BCB_CMD_LOAD && (bcb_dev < 0 || bcb_part < 0)) {
if (cmd != BCB_CMD_LOAD && !block) {
printf("Error: Please, load BCB first!\n");
return -1;
}
@ -90,7 +102,7 @@ err:
return -1;
}
static int bcb_field_get(char *name, char **fieldp, int *sizep)
static int bcb_field_get(const char *name, char **fieldp, int *sizep)
{
if (!strcmp(name, "command")) {
*fieldp = bcb.command;
@ -115,25 +127,30 @@ static int bcb_field_get(char *name, char **fieldp, int *sizep)
return 0;
}
static int __bcb_load(int devnum, const char *partp)
static void __bcb_reset(void)
{
block = NULL;
partition = &partition_data;
memset(&partition_data, 0, sizeof(struct disk_partition));
memset(&bcb, 0, sizeof(struct bootloader_message));
}
static int __bcb_initialize(const char *iface, int devnum, const char *partp)
{
struct blk_desc *desc;
struct disk_partition info;
u64 cnt;
char *endp;
int part, ret;
desc = blk_get_devnum_by_uclass_id(UCLASS_MMC, devnum);
if (!desc) {
block = blk_get_dev(iface, devnum);
if (!block) {
ret = -ENODEV;
goto err_read_fail;
}
/*
* always select the USER mmc hwpart in case another
* always select the first hwpart in case another
* blk operation selected a different hwpart
*/
ret = blk_dselect_hwpart(desc, 0);
ret = blk_dselect_hwpart(block, 0);
if (IS_ERR_VALUE(ret)) {
ret = -ENODEV;
goto err_read_fail;
@ -141,59 +158,84 @@ static int __bcb_load(int devnum, const char *partp)
part = simple_strtoul(partp, &endp, 0);
if (*endp == '\0') {
ret = part_get_info(desc, part, &info);
ret = part_get_info(block, part, partition);
if (ret)
goto err_read_fail;
} else {
part = part_get_info_by_name(desc, partp, &info);
part = part_get_info_by_name(block, partp, partition);
if (part < 0) {
ret = part;
goto err_read_fail;
}
}
cnt = DIV_ROUND_UP(sizeof(struct bootloader_message), info.blksz);
if (cnt > info.size)
return CMD_RET_SUCCESS;
err_read_fail:
printf("Error: %d %d:%s read failed (%d)\n", block->uclass_id,
block->devnum, partition->name, ret);
__bcb_reset();
return CMD_RET_FAILURE;
}
static int __bcb_load(void)
{
u64 cnt;
int ret;
cnt = DIV_ROUND_UP(sizeof(struct bootloader_message), partition->blksz);
if (cnt > partition->size)
goto err_too_small;
if (blk_dread(desc, info.start, cnt, &bcb) != cnt) {
if (blk_dread(block, partition->start, cnt, &bcb) != cnt) {
ret = -EIO;
goto err_read_fail;
}
bcb_dev = desc->devnum;
bcb_part = part;
debug("%s: Loaded from mmc %d:%d\n", __func__, bcb_dev, bcb_part);
debug("%s: Loaded from %d %d:%s\n", __func__, block->uclass_id,
block->devnum, partition->name);
return CMD_RET_SUCCESS;
err_read_fail:
printf("Error: mmc %d:%s read failed (%d)\n", devnum, partp, ret);
printf("Error: %d %d:%s read failed (%d)\n", block->uclass_id,
block->devnum, partition->name, ret);
goto err;
err_too_small:
printf("Error: mmc %d:%s too small!", devnum, partp);
goto err;
printf("Error: %d %d:%s too small!", block->uclass_id,
block->devnum, partition->name);
err:
bcb_dev = -1;
bcb_part = -1;
__bcb_reset();
return CMD_RET_FAILURE;
}
static int do_bcb_load(struct cmd_tbl *cmdtp, int flag, int argc,
char * const argv[])
{
int ret;
int devnum;
char *endp;
int devnum = simple_strtoul(argv[1], &endp, 0);
char *iface = "mmc";
if (argc == 4) {
iface = argv[1];
argc--;
argv++;
}
devnum = simple_strtoul(argv[1], &endp, 0);
if (*endp != '\0') {
printf("Error: Device id '%s' not a number\n", argv[1]);
return CMD_RET_FAILURE;
}
return __bcb_load(devnum, argv[2]);
ret = __bcb_initialize(iface, devnum, argv[2]);
if (ret != CMD_RET_SUCCESS)
return ret;
return __bcb_load();
}
static int __bcb_set(char *fieldp, const char *valp)
static int __bcb_set(const char *fieldp, const char *valp)
{
int size, len;
char *field, *str, *found, *tmp;
@ -293,31 +335,20 @@ static int do_bcb_dump(struct cmd_tbl *cmdtp, int flag, int argc,
static int __bcb_store(void)
{
struct blk_desc *desc;
struct disk_partition info;
u64 cnt;
int ret;
desc = blk_get_devnum_by_uclass_id(UCLASS_MMC, bcb_dev);
if (!desc) {
ret = -ENODEV;
goto err;
}
cnt = DIV_ROUND_UP(sizeof(struct bootloader_message), partition->blksz);
ret = part_get_info(desc, bcb_part, &info);
if (ret)
goto err;
cnt = DIV_ROUND_UP(sizeof(struct bootloader_message), info.blksz);
if (blk_dwrite(desc, info.start, cnt, &bcb) != cnt) {
if (blk_dwrite(block, partition->start, cnt, &bcb) != cnt) {
ret = -EIO;
goto err;
}
return CMD_RET_SUCCESS;
err:
printf("Error: mmc %d:%d write failed (%d)\n", bcb_dev, bcb_part, ret);
printf("Error: %d %d:%s write failed (%d)\n", block->uclass_id,
block->devnum, partition->name, ret);
return CMD_RET_FAILURE;
}
@ -328,23 +359,59 @@ static int do_bcb_store(struct cmd_tbl *cmdtp, int flag, int argc,
return __bcb_store();
}
int bcb_write_reboot_reason(int devnum, char *partp, const char *reasonp)
int bcb_find_partition_and_load(const char *iface, int devnum, char *partp)
{
int ret;
ret = __bcb_load(devnum, partp);
__bcb_reset();
ret = __bcb_initialize(iface, devnum, partp);
if (ret != CMD_RET_SUCCESS)
return ret;
ret = __bcb_set("command", reasonp);
if (ret != CMD_RET_SUCCESS)
return ret;
return __bcb_load();
}
ret = __bcb_store();
if (ret != CMD_RET_SUCCESS)
return ret;
int bcb_load(struct blk_desc *block_description, struct disk_partition *disk_partition)
{
__bcb_reset();
return 0;
block = block_description;
partition = disk_partition;
return __bcb_load();
}
int bcb_set(enum bcb_field field, const char *value)
{
if (field > BCB_FIELD_STAGE)
return CMD_RET_FAILURE;
return __bcb_set(fields[field], value);
}
int bcb_get(enum bcb_field field, char *value_out, size_t value_size)
{
int size;
char *field_value;
if (field > BCB_FIELD_STAGE)
return CMD_RET_FAILURE;
if (bcb_field_get(fields[field], &field_value, &size))
return CMD_RET_FAILURE;
strlcpy(value_out, field_value, value_size);
return CMD_RET_SUCCESS;
}
int bcb_store(void)
{
return __bcb_store();
}
void bcb_reset(void)
{
__bcb_reset();
}
static struct cmd_tbl cmd_bcb_sub[] = {
@ -385,21 +452,23 @@ static int do_bcb(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
U_BOOT_CMD(
bcb, CONFIG_SYS_MAXARGS, 1, do_bcb,
"Load/set/clear/test/dump/store Android BCB fields",
"load <dev> <part> - load BCB from mmc <dev>:<part>\n"
"bcb set <field> <val> - set BCB <field> to <val>\n"
"bcb clear [<field>] - clear BCB <field> or all fields\n"
"bcb test <field> <op> <val> - test BCB <field> against <val>\n"
"bcb dump <field> - dump BCB <field>\n"
"bcb store - store BCB back to mmc\n"
"load <interface> <dev> <part> - load BCB from <interface> <dev>:<part>\n"
"load <dev> <part> - load BCB from mmc <dev>:<part>\n"
"bcb set <field> <val> - set BCB <field> to <val>\n"
"bcb clear [<field>] - clear BCB <field> or all fields\n"
"bcb test <field> <op> <val> - test BCB <field> against <val>\n"
"bcb dump <field> - dump BCB <field>\n"
"bcb store - store BCB back to <interface>\n"
"\n"
"Legend:\n"
"<dev> - MMC device index containing the BCB partition\n"
"<part> - MMC partition index or name containing the BCB\n"
"<field> - one of {command,status,recovery,stage,reserved}\n"
"<op> - the binary operator used in 'bcb test':\n"
" '=' returns true if <val> matches the string stored in <field>\n"
" '~' returns true if <val> matches a subset of <field>'s string\n"
"<val> - string/text provided as input to bcb {set,test}\n"
" NOTE: any ':' character in <val> will be replaced by line feed\n"
" during 'bcb set' and used as separator by upper layers\n"
"<interface> - storage device interface (virtio, mmc, etc)\n"
"<dev> - storage device index containing the BCB partition\n"
"<part> - partition index or name containing the BCB\n"
"<field> - one of {command,status,recovery,stage,reserved}\n"
"<op> - the binary operator used in 'bcb test':\n"
" '=' returns true if <val> matches the string stored in <field>\n"
" '~' returns true if <val> matches a subset of <field>'s string\n"
"<val> - string/text provided as input to bcb {set,test}\n"
" NOTE: any ':' character in <val> will be replaced by line feed\n"
" during 'bcb set' and used as separator by upper layers\n"
);

View file

@ -39,7 +39,7 @@ int spl_load_image_ext(struct spl_image_info *spl_image,
ext4fs_set_blk_dev(block_dev, &part_info);
err = ext4fs_mount(part_info.size);
err = ext4fs_mount();
if (!err) {
#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
printf("%s: ext4fs mount err - %d\n", __func__, err);
@ -84,7 +84,7 @@ int spl_load_image_ext_os(struct spl_image_info *spl_image,
ext4fs_set_blk_dev(block_dev, &part_info);
err = ext4fs_mount(part_info.size);
err = ext4fs_mount();
if (!err) {
#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
printf("%s: ext4fs mount err - %d\n", __func__, err);

View file

@ -22,6 +22,7 @@ CONFIG_CMD_USB=y
# CONFIG_ISO_PARTITION is not set
CONFIG_ENV_IS_IN_MMC=y
CONFIG_SYS_RELOC_GD_ENV_ADDR=y
CONFIG_NET_RANDOM_ETHADDR=y
CONFIG_USB_FUNCTION_FASTBOOT=y
CONFIG_FASTBOOT_BUF_ADDR=0x20000000
CONFIG_FASTBOOT_BUF_SIZE=0x10000000

View file

@ -41,23 +41,25 @@ requirements enumerated above. Below is the command's help message::
bcb - Load/set/clear/test/dump/store Android BCB fields
Usage:
bcb load <dev> <part> - load BCB from mmc <dev>:<part>
bcb set <field> <val> - set BCB <field> to <val>
bcb clear [<field>] - clear BCB <field> or all fields
bcb test <field> <op> <val> - test BCB <field> against <val>
bcb dump <field> - dump BCB <field>
bcb store - store BCB back to mmc
bcb load <interface> <dev> <part> - load BCB from <interface> <dev>:<part>
load <dev> <part> - load BCB from mmc <dev>:<part>
bcb set <field> <val> - set BCB <field> to <val>
bcb clear [<field>] - clear BCB <field> or all fields
bcb test <field> <op> <val> - test BCB <field> against <val>
bcb dump <field> - dump BCB <field>
bcb store - store BCB back to <interface>
Legend:
<dev> - MMC device index containing the BCB partition
<part> - MMC partition index or name containing the BCB
<field> - one of {command,status,recovery,stage,reserved}
<op> - the binary operator used in 'bcb test':
'=' returns true if <val> matches the string stored in <field>
'~' returns true if <val> matches a subset of <field>'s string
<val> - string/text provided as input to bcb {set,test}
NOTE: any ':' character in <val> will be replaced by line feed
during 'bcb set' and used as separator by upper layers
<interface> - storage device interface (virtio, mmc, etc)
<dev> - storage device index containing the BCB partition
<part> - partition index or name containing the BCB
<field> - one of {command,status,recovery,stage,reserved}
<op> - the binary operator used in 'bcb test':
'=' returns true if <val> matches the string stored in <field>
'~' returns true if <val> matches a subset of <field>'s string
<val> - string/text provided as input to bcb {set,test}
NOTE: any ':' character in <val> will be replaced by line feed
during 'bcb set' and used as separator by upper layers
'bcb'. Example of getting reboot reason
@ -91,7 +93,7 @@ The following Kconfig options must be enabled::
CONFIG_PARTITIONS=y
CONFIG_MMC=y
CONFIG_BCB=y
CONFIG_CMD_BCB=y
.. [1] https://android.googlesource.com/platform/bootable/recovery
.. [2] https://source.android.com/devices/bootloader

View file

@ -13,7 +13,7 @@ config BLK
config SPL_LEGACY_BLOCK
bool # "Enable Legacy Block Device"
depends on SPL && !DM_SPL
depends on SPL
default y if SPL_MMC || SPL_USB_STORAGE || SCSI || NVME || IDE
default y if SPL_AHCI_PCI
help

View file

@ -17,6 +17,7 @@
#include <linux/clk/at91_pmc.h>
#include <linux/delay.h>
#include <linux/io.h>
#include <linux/time.h>
#include "pmc.h"
#define UBOOT_DM_CLK_AT91_MAIN_RC "at91-main-rc-clk"
@ -25,7 +26,6 @@
#define UBOOT_DM_CLK_AT91_SAM9X5_MAIN "at91-sam9x5-main-clk"
#define MOR_KEY_MASK GENMASK(23, 16)
#define USEC_PER_SEC 1000000UL
#define SLOW_CLOCK_FREQ 32768
#define clk_main_parent_select(s) (((s) & \

View file

@ -88,7 +88,7 @@ config DM_STATS
config SPL_DM_STATS
bool "Collect and show driver model stats in SPL"
depends on DM_SPL
depends on SPL_DM
help
Enable this to collect and display memory statistics about driver
model. This can help to figure out where all the memory is going and

View file

@ -91,6 +91,7 @@ void fastboot_okay(const char *reason, char *response)
*/
int __weak fastboot_set_reboot_flag(enum fastboot_reboot_reason reason)
{
int ret;
static const char * const boot_cmds[] = {
[FASTBOOT_REBOOT_REASON_BOOTLOADER] = "bootonce-bootloader",
[FASTBOOT_REBOOT_REASON_FASTBOOTD] = "boot-fastboot",
@ -105,7 +106,18 @@ int __weak fastboot_set_reboot_flag(enum fastboot_reboot_reason reason)
if (reason >= FASTBOOT_REBOOT_REASONS_COUNT)
return -EINVAL;
return bcb_write_reboot_reason(mmc_dev, "misc", boot_cmds[reason]);
ret = bcb_find_partition_and_load("mmc", mmc_dev, "misc");
if (ret)
goto out;
ret = bcb_set(BCB_FIELD_COMMAND, boot_cmds[reason]);
if (ret)
goto out;
ret = bcb_store();
out:
bcb_reset();
return ret;
}
/**

View file

@ -20,6 +20,7 @@
#include <linux/err.h>
#include <linux/io.h>
#include <linux/printk.h>
#include <linux/time.h>
/* STM32 I2C registers */
struct stm32_i2c_regs {
@ -121,8 +122,6 @@ struct stm32_i2c_regs {
#define STM32_SCLH_MAX BIT(8)
#define STM32_SCLL_MAX BIT(8)
#define STM32_NSEC_PER_SEC 1000000000L
/**
* struct stm32_i2c_spec - private i2c specification timing
* @rate: I2C bus speed (Hz)
@ -591,7 +590,7 @@ static int stm32_i2c_choose_solution(u32 i2cclk,
struct stm32_i2c_timings *s)
{
struct stm32_i2c_timings *v;
u32 i2cbus = DIV_ROUND_CLOSEST(STM32_NSEC_PER_SEC,
u32 i2cbus = DIV_ROUND_CLOSEST(NSEC_PER_SEC,
setup->speed_freq);
u32 clk_error_prev = i2cbus;
u32 clk_min, clk_max;
@ -607,8 +606,8 @@ static int stm32_i2c_choose_solution(u32 i2cclk,
dnf_delay = setup->dnf * i2cclk;
tsync = af_delay_min + dnf_delay + (2 * i2cclk);
clk_max = STM32_NSEC_PER_SEC / specs->rate_min;
clk_min = STM32_NSEC_PER_SEC / specs->rate_max;
clk_max = NSEC_PER_SEC / specs->rate_min;
clk_min = NSEC_PER_SEC / specs->rate_max;
/*
* Among Prescaler possibilities discovered above figures out SCL Low
@ -686,7 +685,7 @@ static int stm32_i2c_compute_timing(struct stm32_i2c_priv *i2c_priv,
const struct stm32_i2c_spec *specs;
struct stm32_i2c_timings *v, *_v;
struct list_head solutions;
u32 i2cclk = DIV_ROUND_CLOSEST(STM32_NSEC_PER_SEC, setup->clock_src);
u32 i2cclk = DIV_ROUND_CLOSEST(NSEC_PER_SEC, setup->clock_src);
int ret;
specs = get_specs(setup->speed_freq);

View file

@ -14,6 +14,7 @@
#include <linux/err.h>
#include <linux/iopoll.h>
#include <linux/ioport.h>
#include <linux/time.h>
/* FMC2 Controller Registers */
#define FMC2_BCR1 0x0
@ -90,8 +91,6 @@
#define FMC2_BTR_DATLAT_MAX 0xf
#define FMC2_PCSCNTR_CSCOUNT_MAX 0xff
#define FMC2_NSEC_PER_SEC 1000000000L
enum stm32_fmc2_ebi_bank {
FMC2_EBI1 = 0,
FMC2_EBI2,
@ -279,7 +278,7 @@ static u32 stm32_fmc2_ebi_ns_to_clock_cycles(struct stm32_fmc2_ebi *ebi,
int cs, u32 setup)
{
unsigned long hclk = clk_get_rate(&ebi->clk);
unsigned long hclkp = FMC2_NSEC_PER_SEC / (hclk / 1000);
unsigned long hclkp = NSEC_PER_SEC / (hclk / 1000);
return DIV_ROUND_UP(setup * 1000, hclkp);
}

View file

@ -32,8 +32,6 @@
*/
#define MMC_TIMEOUT_SHORT 20
#define NSEC_PER_SEC 1000000000L
#define MAX_NO_OF_TAPS 64
#define EXT_CSD_POWER_CLASS 187 /* R/W */

View file

@ -64,6 +64,7 @@
#include <linux/mfd/syscon/atmel-smc.h>
#include <linux/mtd/rawnand.h>
#include <linux/mtd/mtd.h>
#include <linux/time.h>
#include <mach/at91_sfr.h>
#include <nand.h>
#include <regmap.h>
@ -71,8 +72,6 @@
#include "pmecc.h"
#define NSEC_PER_SEC 1000000000L
#define ATMEL_HSMC_NFC_CFG 0x0
#define ATMEL_HSMC_NFC_CFG_SPARESIZE(x) (((x) / 4) << 24)
#define ATMEL_HSMC_NFC_CFG_SPARESIZE_MASK GENMASK(30, 24)

View file

@ -31,6 +31,7 @@
#include <linux/errno.h>
#include <linux/mtd/rawnand.h>
#include <linux/sizes.h>
#include <linux/time.h>
#include <linux/types.h>
#include <linux/math64.h>
@ -52,8 +53,6 @@
#endif
#define MXS_NAND_BCH_TIMEOUT 10000
#define USEC_PER_SEC 1000000
#define NSEC_PER_SEC 1000000000L
#define TO_CYCLES(duration, period) DIV_ROUND_UP_ULL(duration, period)

View file

@ -24,6 +24,7 @@
#include <linux/mtd/nand_bch.h>
#include <linux/mtd/nand_ecc.h>
#include <linux/mtd/rawnand.h>
#include <linux/time.h>
#include <asm/global_data.h>
#include <asm/io.h>
#include <asm/types.h>
@ -291,7 +292,6 @@ union ndf_cmd {
#define OCTEONTX_NAND_DRIVER_NAME "octeontx_nand"
#define NDF_TIMEOUT 1000 /** Timeout in ms */
#define USEC_PER_SEC 1000000 /** Linux compatibility */
#ifndef NAND_MAX_CHIPS
# define NAND_MAX_CHIPS 8 /** Linux compatibility */
#endif

View file

@ -22,6 +22,7 @@
#include <linux/ioport.h>
#include <linux/mtd/rawnand.h>
#include <linux/printk.h>
#include <linux/time.h>
/* Bad block marker length */
#define FMC2_BBM_LEN 2
@ -127,8 +128,6 @@
#define FMC2_BCHDSR4_EBP7 GENMASK(12, 0)
#define FMC2_BCHDSR4_EBP8 GENMASK(28, 16)
#define FMC2_NSEC_PER_SEC 1000000000L
#define FMC2_TIMEOUT_5S 5000000
enum stm32_fmc2_ecc {
@ -603,7 +602,7 @@ static void stm32_fmc2_nfc_calc_timings(struct nand_chip *chip,
struct stm32_fmc2_nand *nand = to_fmc2_nand(chip);
struct stm32_fmc2_timings *tims = &nand->timings;
unsigned long hclk = clk_get_rate(&nfc->clk);
unsigned long hclkp = FMC2_NSEC_PER_SEC / (hclk / 1000);
unsigned long hclkp = NSEC_PER_SEC / (hclk / 1000);
unsigned long timing, tar, tclr, thiz, twait;
unsigned long tset_mem, tset_att, thold_mem, thold_att;

View file

@ -25,6 +25,7 @@
#include <linux/bitops.h>
#include <linux/compat.h>
#include <linux/bitfield.h>
#include <linux/time.h>
/* [31] soft reset for the phy.
* 1: reset. 0: dessert the reset.
@ -170,8 +171,6 @@
#define MIPI_DSI_TEST_CTRL0 0x3c
#define MIPI_DSI_TEST_CTRL1 0x40
#define NSEC_PER_MSEC 1000000L
struct phy_meson_axg_mipi_dphy_priv {
struct regmap *regmap;
#if CONFIG_IS_ENABLED(CLK)

View file

@ -6,11 +6,10 @@
#include <common.h>
#include <div64.h>
#include <linux/time.h>
#include <phy-mipi-dphy.h>
#define PSEC_PER_SEC 1000000000000LL
/*
* Minimum D-PHY timings based on MIPI D-PHY specification. Derived
* from the valid ranges specified in Section 6.9, Table 14, Page 41

View file

@ -15,6 +15,7 @@
#include <linux/clk-provider.h>
#include <linux/delay.h>
#include <linux/math64.h>
#include <linux/time.h>
#include <phy-mipi-dphy.h>
#include <reset.h>
@ -186,8 +187,6 @@
#define DSI_PHY_STATUS 0xb0
#define PHY_LOCK BIT(0)
#define PSEC_PER_SEC 1000000000000LL
#define msleep(a) udelay(a * 1000)
enum phy_max_rate {

View file

@ -49,6 +49,7 @@
#include <dm/device_compat.h>
#include <linux/math64.h>
#include <linux/bitfield.h>
#include <linux/time.h>
#include <asm/io.h>
/* The channel number of Aspeed pwm controller */
@ -77,8 +78,6 @@
/* PWM fixed value */
#define PWM_ASPEED_FIXED_PERIOD 0xff
#define NSEC_PER_SEC 1000000000L
struct aspeed_pwm_priv {
struct clk clk;
struct regmap *regmap;

View file

@ -14,11 +14,11 @@
#include <dm.h>
#include <linux/bitops.h>
#include <linux/io.h>
#include <linux/time.h>
#include <pwm.h>
#define PERIOD_BITS 16
#define PWM_MAX_PRES 10
#define NSEC_PER_SEC 1000000000L
#define PWM_ENA 0x04
#define PWM_CHANNEL_OFFSET 0x20

View file

@ -17,6 +17,7 @@
#include <linux/bitfield.h>
#include <linux/math64.h>
#include <linux/log2.h>
#include <linux/time.h>
#include <dm/device_compat.h>
#define CLOCK_CONTROL 0
@ -37,8 +38,6 @@
#define COUNTER_INTERVAL_ENABLE BIT(1)
#define COUNTER_COUNTING_DISABLE BIT(0)
#define NSEC_PER_SEC 1000000000L
#define TTC_REG(reg, channel) ((reg) + (channel) * sizeof(u32))
#define TTC_CLOCK_CONTROL(reg, channel) \
TTC_REG((reg) + CLOCK_CONTROL, (channel))

View file

@ -26,8 +26,7 @@
#include <linux/math64.h>
#include <linux/bitfield.h>
#include <linux/clk-provider.h>
#define NSEC_PER_SEC 1000000000L
#include <linux/time.h>
#define REG_PWM_A 0x0
#define REG_PWM_B 0x4

View file

@ -12,6 +12,7 @@
#include <div64.h>
#include <linux/bitops.h>
#include <linux/io.h>
#include <linux/time.h>
/* PWM registers and bits definitions */
#define PWMCON 0x00
@ -27,8 +28,6 @@
#define PWM_CLK_DIV_MAX 7
#define MAX_PWM_NUM 8
#define NSEC_PER_SEC 1000000000L
enum mtk_pwm_reg_ver {
PWM_REG_V1,
PWM_REG_V2,

View file

@ -14,8 +14,7 @@
#include <dm/device_compat.h>
#include <pwm.h>
#include <asm/io.h>
#define NSEC_PER_SEC 1000000000L
#include <linux/time.h>
/* Time base module registers */
#define TI_EHRPWM_TBCTL 0x00

View file

@ -13,14 +13,13 @@
#include <dm.h>
#include <errno.h>
#include <linux/delay.h>
#include <linux/time.h>
#include <misc.h>
#include <serial.h>
#define UART_OVERSAMPLING 32
#define STALE_TIMEOUT 160
#define USEC_PER_SEC 1000000L
/* Registers*/
#define GENI_FORCE_DEFAULT_REG 0x20
#define GENI_SER_M_CLK_CFG 0x48

View file

@ -18,12 +18,11 @@
#include <linux/err.h>
#include <linux/errno.h>
#include <linux/sizes.h>
#include <linux/time.h>
#include <zynqmp_firmware.h>
#include "cadence_qspi.h"
#include <dt-bindings/power/xlnx-versal-power.h>
#define NSEC_PER_SEC 1000000000L
#define CQSPI_STIG_READ 0
#define CQSPI_STIG_WRITE 1
#define CQSPI_READ 2

View file

@ -27,9 +27,7 @@
#include <linux/bitops.h>
#include <linux/delay.h>
#include <linux/printk.h>
/* linux/include/time.h */
#define NSEC_PER_SEC 1000000000L
#include <linux/time.h>
DECLARE_GLOBAL_DATA_PTR;

View file

@ -16,6 +16,7 @@
#include <spi-mem.h>
#include <asm/io.h>
#include <linux/log2.h>
#include <linux/time.h>
#include <linux/iopoll.h>
#include <linux/bitfield.h>
@ -117,7 +118,7 @@ static int amlogic_spifc_a1_request(struct amlogic_spifc_a1 *spifc, bool read)
return readl_poll_timeout(spifc->base + SPIFC_A1_USER_CTRL0_REG,
val, (val & mask) == mask,
200 * 1000);
200 * USEC_PER_MSEC);
}
static void amlogic_spifc_a1_drain_buffer(struct amlogic_spifc_a1 *spifc,

View file

@ -33,7 +33,7 @@ static int poweroff_gpio_request(struct udevice *dev, enum sysreset_t type)
int r;
if (type != SYSRESET_POWER_OFF)
return -ENOSYS;
return -EPROTONOSUPPORT;
debug("GPIO poweroff\n");

View file

@ -25,7 +25,7 @@ static int psci_sysreset_request(struct udevice *dev, enum sysreset_t type)
psci_sys_poweroff();
break;
default:
return -ENOSYS;
return -EPROTONOSUPPORT;
}
return -EINPROGRESS;

View file

@ -21,7 +21,7 @@ static int sandbox_warm_sysreset_request(struct udevice *dev,
state->last_sysreset = type;
break;
default:
return -ENOSYS;
return -EPROTONOSUPPORT;
}
if (!state->sysreset_allowed[type])
return -EACCES;
@ -70,7 +70,7 @@ static int sandbox_sysreset_request(struct udevice *dev, enum sysreset_t type)
return -EACCES;
sandbox_exit();
default:
return -ENOSYS;
return -EPROTONOSUPPORT;
}
if (!state->sysreset_allowed[type])
return -EACCES;

View file

@ -29,7 +29,7 @@ static int wdt_reboot_request(struct udevice *dev, enum sysreset_t type)
return ret;
break;
default:
return -ENOSYS;
return -EPROTONOSUPPORT;
}
return -EINPROGRESS;

View file

@ -87,7 +87,7 @@ static int x86_sysreset_request(struct udevice *dev, enum sysreset_t type)
return ret;
return -EINPROGRESS;
default:
return -ENOSYS;
return -EPROTONOSUPPORT;
}
outb(value, IO_PORT_RESET);

View file

@ -13,11 +13,10 @@
#include <dm/device_compat.h>
#include <linux/bitops.h>
#include <linux/err.h>
#include <linux/time.h>
#include "ufs.h"
#define USEC_PER_SEC 1000000L
#define CDNS_UFS_REG_HCLKDIV 0xFC
#define CDNS_UFS_REG_PHY_XCFGD1 0x113C

View file

@ -31,6 +31,7 @@
#include <linux/usb/gadget.h>
#include <linux/bitfield.h>
#include <linux/math64.h>
#include <linux/time.h>
#include "core.h"
#include "gadget.h"
@ -38,8 +39,6 @@
#include "linux-compat.h"
#define NSEC_PER_SEC 1000000000L
static LIST_HEAD(dwc3_list);
/* -------------------------------------------------------------------------- */

View file

@ -22,6 +22,7 @@
#include <linux/bitops.h>
#include <linux/delay.h>
#include <linux/iopoll.h>
#include <linux/time.h>
#include <video_bridge.h>
#define HWVER_131 0x31333100 /* IP version 1.31 */
@ -214,8 +215,6 @@
#define PHY_STATUS_TIMEOUT_US 10000
#define CMD_PKT_STATUS_TIMEOUT_US 20000
#define MSEC_PER_SEC 1000
struct dw_mipi_dsi {
struct mipi_dsi_host dsi_host;
struct mipi_dsi_device *device;

View file

@ -30,12 +30,11 @@
#include <asm/io.h>
#include <dm/device-internal.h>
#include <linux/bitops.h>
#include <linux/time.h>
#include <asm/arch-rockchip/clock.h>
#include <asm/arch-rockchip/hardware.h>
#define USEC_PER_SEC 1000000L
/*
* DSI wrapper registers & bit definitions
* Note: registers are named as in the Reference Manual

View file

@ -14,6 +14,7 @@
#include <panel.h>
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/time.h>
#include <power/regulator.h>
#include <asm/gpio.h>
@ -24,9 +25,6 @@
#include "mipi-phy.h"
#define USEC_PER_SEC 1000000L
#define NSEC_PER_SEC 1000000000L
struct tegra_dsi_priv {
struct mipi_dsi_host host;
struct mipi_dsi_device device;

View file

@ -9,8 +9,7 @@
#include <wdt.h>
#include <asm/io.h>
#include <linux/delay.h>
#define MSEC_PER_SEC 1000
#include <linux/time.h>
#define WDT_MAX_TIMEOUT 16
#define WDT_TIMEOUT_MASK 0xf

4
env/ext4.c vendored
View file

@ -77,7 +77,7 @@ static int env_ext4_save_buffer(env_t *env_new)
dev = dev_desc->devnum;
ext4fs_set_blk_dev(dev_desc, &info);
if (!ext4fs_mount(info.size)) {
if (!ext4fs_mount()) {
printf("\n** Unable to use %s %s for saveenv **\n",
ifname, dev_and_part);
return 1;
@ -160,7 +160,7 @@ static int env_ext4_load(void)
dev = dev_desc->devnum;
ext4fs_set_blk_dev(dev_desc, &info);
if (!ext4fs_mount(info.size)) {
if (!ext4fs_mount()) {
printf("\n** Unable to use %s %s for loading the env **\n",
ifname, dev_and_part);
goto err_env_relocate;

View file

@ -228,7 +228,7 @@ int btrfs_read(const char *file, void *buf, loff_t offset, loff_t len,
{
struct btrfs_fs_info *fs_info = current_fs_info;
struct btrfs_root *root;
loff_t real_size = 0;
loff_t real_size;
u64 ino;
u8 type;
int ret;
@ -246,16 +246,13 @@ int btrfs_read(const char *file, void *buf, loff_t offset, loff_t len,
return -EINVAL;
}
if (!len) {
ret = btrfs_size(file, &real_size);
if (ret < 0) {
error("Failed to get inode size: %s", file);
return ret;
}
len = real_size;
ret = btrfs_size(file, &real_size);
if (ret < 0) {
error("Failed to get inode size: %s", file);
return ret;
}
if (len > real_size - offset)
if (!len || len > real_size - offset)
len = real_size - offset;
ret = btrfs_file_read(root, ino, offset, len, buf);

View file

@ -2368,7 +2368,7 @@ fail:
return -1;
}
int ext4fs_mount(unsigned part_length)
int ext4fs_mount(void)
{
struct ext2_data *data;
int status;

View file

@ -233,7 +233,7 @@ int ext4fs_probe(struct blk_desc *fs_dev_desc,
{
ext4fs_set_blk_dev(fs_dev_desc, fs_partition);
if (!ext4fs_mount(fs_partition->size)) {
if (!ext4fs_mount()) {
ext4fs_close();
return -1;
}

View file

@ -18,6 +18,10 @@
#include <u-boot/zlib.h>
#endif
#if IS_ENABLED(CONFIG_LZ4)
#include <u-boot/lz4.h>
#endif
#if IS_ENABLED(CONFIG_ZSTD)
#include <linux/zstd.h>
#endif
@ -38,6 +42,10 @@ int sqfs_decompressor_init(struct squashfs_ctxt *ctxt)
case SQFS_COMP_ZLIB:
break;
#endif
#if IS_ENABLED(CONFIG_LZ4)
case SQFS_COMP_LZ4:
break;
#endif
#if IS_ENABLED(CONFIG_ZSTD)
case SQFS_COMP_ZSTD:
ctxt->zstd_workspace = malloc(zstd_dctx_workspace_bound());
@ -66,6 +74,10 @@ void sqfs_decompressor_cleanup(struct squashfs_ctxt *ctxt)
case SQFS_COMP_ZLIB:
break;
#endif
#if IS_ENABLED(CONFIG_LZ4)
case SQFS_COMP_LZ4:
break;
#endif
#if IS_ENABLED(CONFIG_ZSTD)
case SQFS_COMP_ZSTD:
free(ctxt->zstd_workspace);
@ -139,6 +151,17 @@ int sqfs_decompress(struct squashfs_ctxt *ctxt, void *dest,
break;
#endif
#if IS_ENABLED(CONFIG_LZ4)
case SQFS_COMP_LZ4:
ret = LZ4_decompress_safe(source, dest, src_len, *dest_len);
if (ret < 0) {
printf("LZ4 decompression failed.\n");
return -EINVAL;
}
ret = 0;
break;
#endif
#if IS_ENABLED(CONFIG_ZSTD)
case SQFS_COMP_ZSTD:
ret = sqfs_zstd_decompress(ctxt, dest, *dest_len, source, src_len);

View file

@ -18,41 +18,6 @@
#define SQFS_COMP_LZ4 5
#define SQFS_COMP_ZSTD 6
/* LZMA does not support any compression options */
struct squashfs_gzip_opts {
u32 compression_level;
u16 window_size;
u16 strategies;
};
struct squashfs_xz_opts {
u32 dictionary_size;
u32 executable_filters;
};
struct squashfs_lz4_opts {
u32 version;
u32 flags;
};
struct squashfs_zstd_opts {
u32 compression_level;
};
struct squashfs_lzo_opts {
u32 algorithm;
u32 level;
};
union squashfs_compression_opts {
struct squashfs_gzip_opts *gzip;
struct squashfs_xz_opts *xz;
struct squashfs_lz4_opts *lz4;
struct squashfs_zstd_opts *zstd;
struct squashfs_lzo_opts *lzo;
};
int sqfs_decompress(struct squashfs_ctxt *ctxt, void *dest,
unsigned long *dest_len, void *source, u32 src_len);
int sqfs_decompressor_init(struct squashfs_ctxt *ctxt);

View file

@ -13,7 +13,6 @@
#include <part.h>
#include <stdint.h>
#define SQFS_UNCOMPRESSED_DATA 0x0002
#define SQFS_MAGIC_NUMBER 0x73717368
/* The three first members of squashfs_dir_index make a total of 12 bytes */
#define SQFS_DIR_INDEX_BASE_LENGTH 12
@ -23,7 +22,6 @@
#define SQFS_MAX_ENTRIES 512
/* Metadata blocks start by a 2-byte length header */
#define SQFS_HEADER_SIZE 2
#define SQFS_LREG_INODE_MIN_SIZE 56
#define SQFS_DIR_HEADER_SIZE 12
#define SQFS_MISC_ENTRY_TYPE -1
#define SQFS_EMPTY_FILE_SIZE 3

View file

@ -15,11 +15,8 @@
#define SQFS_FRAGMENT_INDEX_OFFSET(A) ((A) % SQFS_MAX_ENTRIES)
#define SQFS_FRAGMENT_INDEX(A) ((A) / SQFS_MAX_ENTRIES)
#define SQFS_BLOCK_SIZE(A) ((A) & GENMASK(23, 0))
#define SQFS_CHECK_FLAG(flag, bit) (((flag) >> (bit)) & 1)
/* Useful for both fragment and data blocks */
#define SQFS_COMPRESSED_BLOCK(A) (!((A) & BIT(24)))
/* SQFS_COMPRESSED_DATA strictly used with super block's 'flags' member */
#define SQFS_COMPRESSED_DATA(A) (!((A) & 0x0002))
#define SQFS_IS_FRAGMENTED(A) ((A) != 0xFFFFFFFF)
/*
* These two macros work as getters for a metada block header, retrieving the
@ -28,22 +25,4 @@
#define SQFS_COMPRESSED_METADATA(A) (!((A) & BIT(15)))
#define SQFS_METADATA_SIZE(A) ((A) & GENMASK(14, 0))
struct squashfs_super_block_flags {
/* check: unused
* uncompressed_ids: not supported
*/
bool uncompressed_inodes;
bool uncompressed_data;
bool check;
bool uncompressed_frags;
bool no_frags;
bool always_frags;
bool duplicates;
bool exportable;
bool uncompressed_xattrs;
bool no_xattrs;
bool compressor_options;
bool uncompressed_ids;
};
#endif /* SQFS_UTILS_H */

View file

@ -68,7 +68,6 @@ struct page {
void iput(struct inode *inode);
/* linux/include/time.h */
#define NSEC_PER_SEC 1000000000L
#define get_seconds() 0
#define CURRENT_TIME_SEC ((struct timespec) { get_seconds(), 0 })

View file

@ -8,14 +8,69 @@
#ifndef __BCB_H__
#define __BCB_H__
#include <part.h>
enum bcb_field {
BCB_FIELD_COMMAND,
BCB_FIELD_STATUS,
BCB_FIELD_RECOVERY,
BCB_FIELD_STAGE
};
#if IS_ENABLED(CONFIG_CMD_BCB)
int bcb_write_reboot_reason(int devnum, char *partp, const char *reasonp);
int bcb_find_partition_and_load(const char *iface,
int devnum, char *partp);
int bcb_load(struct blk_desc *block_description,
struct disk_partition *disk_partition);
int bcb_set(enum bcb_field field, const char *value);
/**
* bcb_get() - get the field value.
* @field: field to get
* @value_out: buffer to copy bcb field value to
* @value_size: buffer size to avoid overflow in case
* value_out is smaller then the field value
*/
int bcb_get(enum bcb_field field, char *value_out, size_t value_size);
int bcb_store(void);
void bcb_reset(void);
#else
#include <linux/errno.h>
static inline int bcb_write_reboot_reason(int devnum, char *partp, const char *reasonp)
static inline int bcb_load(struct blk_desc *block_description,
struct disk_partition *disk_partition)
{
return -EOPNOTSUPP;
}
static inline int bcb_find_partition_and_load(const char *iface,
int devnum, char *partp)
{
return -EOPNOTSUPP;
}
static inline int bcb_set(enum bcb_field field, const char *value)
{
return -EOPNOTSUPP;
}
static inline int bcb_get(enum bcb_field field, char *value_out)
{
return -EOPNOTSUPP;
}
static inline int bcb_store(void)
{
return -EOPNOTSUPP;
}
static inline void bcb_reset(void)
{
}
#endif
#endif /* __BCB_H__ */

View file

@ -37,11 +37,11 @@
"env_mmc_blknum=0xf80\0" \
"env_mmc_nblks=0x80\0" \
"kernel_addr_r=0x30000000\0" \
"pxefile_addr_r=0x32000000\0" \
"scriptaddr=0x32000000\0" \
"fdt_addr_r=0x32200000\0" \
"pxefile_addr_r=0x33000000\0" \
"scriptaddr=0x33000000\0" \
"fdt_addr_r=0x33200000\0" \
"fdtfile=hisilicon/hi3798cv200-poplar.dtb\0" \
"ramdisk_addr_r=0x32400000\0" \
"ramdisk_addr_r=0x33400000\0" \
BOOTENV
#endif /* _POPLAR_H_ */

View file

@ -147,7 +147,7 @@ int ext4fs_create_link(const char *target, const char *fname);
struct ext_filesystem *get_fs(void);
int ext4fs_open(const char *filename, loff_t *len);
int ext4fs_read(char *buf, loff_t offset, loff_t len, loff_t *actread);
int ext4fs_mount(unsigned part_length);
int ext4fs_mount(void);
void ext4fs_close(void);
void ext4fs_reinit_global(void);
int ext4fs_ls(const char *dirname);

View file

@ -11,6 +11,15 @@
#define _REENT_ONLY
#define MSEC_PER_SEC 1000L
#define USEC_PER_MSEC 1000L
#define NSEC_PER_USEC 1000L
#define NSEC_PER_MSEC 1000000L
#define USEC_PER_SEC 1000000L
#define NSEC_PER_SEC 1000000000L
#define PSEC_PER_SEC 1000000000000LL
#define FSEC_PER_SEC 1000000000000000LL
#define SECSPERMIN 60L
#define MINSPERHOUR 60L
#define HOURSPERDAY 24L

View file

@ -263,12 +263,16 @@ static int dm_test_eth_act(struct unit_test_state *uts)
/* Prepare the test scenario */
for (i = 0; i < DM_TEST_ETH_NUM; i++) {
char *addr;
ut_assertok(uclass_find_device_by_name(UCLASS_ETH,
ethname[i], &dev[i]));
ut_assertok(device_remove(dev[i], DM_REMOVE_NORMAL));
/* Invalidate MAC address */
strncpy(ethaddr[i], env_get(addrname[i]), 17);
addr = env_get(addrname[i]);
ut_assertnonnull(addr);
strncpy(ethaddr[i], addr, 17);
/* Must disable access protection for ethaddr before clearing */
env_set(".flags", addrname[i]);
env_set(addrname[i], NULL);
@ -312,12 +316,16 @@ static int dm_test_ethaddr(struct unit_test_state *uts)
for (i = 0; i < ARRAY_SIZE(addr); i++) {
char addrname[10];
char *env_addr;
if (i)
snprintf(addrname, sizeof(addrname), "eth%daddr", i + 1);
else
strcpy(addrname, "ethaddr");
ut_asserteq_str(addr[i], env_get(addrname));
env_addr = env_get(addrname);
ut_assertnonnull(env_addr);
ut_asserteq_str(addr[i], env_addr);
}
return 0;

View file

@ -27,8 +27,8 @@ static int dm_test_sysreset_base(struct unit_test_state *uts)
/* Device 1 is the warm sysreset device */
ut_assertok(uclass_get_device(UCLASS_SYSRESET, 1, &dev));
ut_asserteq(-EACCES, sysreset_request(dev, SYSRESET_WARM));
ut_asserteq(-ENOSYS, sysreset_request(dev, SYSRESET_COLD));
ut_asserteq(-ENOSYS, sysreset_request(dev, SYSRESET_POWER));
ut_asserteq(-EPROTONOSUPPORT, sysreset_request(dev, SYSRESET_COLD));
ut_asserteq(-EPROTONOSUPPORT, sysreset_request(dev, SYSRESET_POWER));
state->sysreset_allowed[SYSRESET_WARM] = true;
ut_asserteq(-EINPROGRESS, sysreset_request(dev, SYSRESET_WARM));
@ -36,7 +36,7 @@ static int dm_test_sysreset_base(struct unit_test_state *uts)
/* Device 2 is the cold sysreset device */
ut_assertok(uclass_get_device(UCLASS_SYSRESET, 2, &dev));
ut_asserteq(-ENOSYS, sysreset_request(dev, SYSRESET_WARM));
ut_asserteq(-EPROTONOSUPPORT, sysreset_request(dev, SYSRESET_WARM));
state->sysreset_allowed[SYSRESET_COLD] = false;
ut_asserteq(-EACCES, sysreset_request(dev, SYSRESET_COLD));
state->sysreset_allowed[SYSRESET_COLD] = true;