Merge branch '2020-05-25-misc-fixes'

- A few minor Kconfig migrations / corrections
- DFU doc fixes/improvements
- Bugfix for ARMv8, env userspace building, more NULL checks in generic
  PHY code
This commit is contained in:
Tom Rini 2020-05-25 11:56:57 -04:00
commit 71f70cfcf4
32 changed files with 254 additions and 60 deletions

View file

@ -600,13 +600,16 @@ F: cmd/usb_*.c
F: common/dfu.c
F: common/update.c
F: common/usb_storage.c
F: doc/api/dfu.rst
F: drivers/dfu/
F: drivers/usb/gadget/
F: include/dfu.h
DRIVER MODEL
M: Simon Glass <sjg@chromium.org>
S: Maintained
T: git https://gitlab.denx.de/u-boot/custodians/u-boot-dm.git
F: doc/driver-model/
F: drivers/core/
F: include/dm/
F: test/dm/

4
README
View file

@ -2729,10 +2729,6 @@ Configuration Settings:
regular expression. This allows multiple variables to define the same
flags without explicitly listing them for each variable.
- CONFIG_ENV_ACCESS_IGNORE_FORCE
If defined, don't allow the -f switch to env set override variable
access flags.
The following definitions that deal with the placement and management
of environment data (variable area); in general, we support the
following configurations:

View file

@ -86,6 +86,7 @@ config RISCV
config SANDBOX
bool "Sandbox"
select BOARD_LATE_INIT
select BZIP2
select DM
select DM_GPIO
select DM_I2C
@ -94,6 +95,7 @@ config SANDBOX
select DM_SERIAL
select DM_SPI
select DM_SPI_FLASH
select GZIP_COMPRESSED
select HAVE_BLOCK_DEVICE
select LZO
select OF_BOARD_SETUP

View file

@ -557,7 +557,7 @@ static u64 set_one_region(u64 start, u64 size, u64 attrs, bool flag, int level)
void mmu_set_region_dcache_behaviour(phys_addr_t start, size_t size,
enum dcache_option option)
{
u64 attrs = PMD_ATTRINDX(option);
u64 attrs = PMD_ATTRINDX(option >> 2);
u64 real_start = start;
u64 real_size = size;

View file

@ -810,11 +810,13 @@ config CMD_UNLZ4
config CMD_UNZIP
bool "unzip"
default y if CMD_BOOTI
select GZIP
help
Uncompress a zip-compressed memory region.
config CMD_ZIP
bool "zip"
select GZIP_COMPRESSED
help
Compress a memory region with zlib deflate method.

View file

@ -7,6 +7,7 @@
#include <common.h>
#include <command.h>
#include <env.h>
#include <gzip.h>
static int do_zip(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
{

View file

@ -13,6 +13,7 @@ CONFIG_USE_PREBOOT=y
CONFIG_PREBOOT="fdt addr ${fdtcontroladdr};fdt move ${fdtcontroladdr} ${fdtsaveaddr};fdt addr ${fdtsaveaddr};"
CONFIG_HUSH_PARSER=y
CONFIG_SYS_PROMPT="U-Boot>"
CONFIG_CMD_MMC=y
CONFIG_EFI_PARTITION=y
CONFIG_OF_PRIOR_STAGE=y
CONFIG_ENV_IS_IN_MMC=y

View file

@ -14,6 +14,7 @@ CONFIG_USE_PREBOOT=y
CONFIG_PREBOOT="fdt addr ${fdtcontroladdr};fdt move ${fdtcontroladdr} ${fdtsaveaddr};fdt addr ${fdtsaveaddr};"
CONFIG_HUSH_PARSER=y
CONFIG_SYS_PROMPT="U-Boot>"
CONFIG_CMD_MMC=y
CONFIG_CMD_SF_TEST=y
CONFIG_CMD_SPI=y
CONFIG_OF_PRIOR_STAGE=y

View file

@ -16,6 +16,7 @@ CONFIG_HUSH_PARSER=y
# CONFIG_CMD_FLASH is not set
CONFIG_CMD_GPIO=y
# CONFIG_CMD_LOADS is not set
CONFIG_CMD_MMC=y
CONFIG_CMD_NAND=y
CONFIG_CMD_PART=y
CONFIG_CMD_USB=y

View file

@ -19,6 +19,7 @@ CONFIG_HUSH_PARSER=y
# CONFIG_BOOTM_NETBSD is not set
CONFIG_CMD_GPIO=y
CONFIG_CMD_I2C=y
CONFIG_CMD_MMC=y
CONFIG_CMD_CACHE=y
CONFIG_CMD_REGULATOR=y
CONFIG_CMD_EXT2=y

View file

@ -21,6 +21,7 @@ CONFIG_HUSH_PARSER=y
# CONFIG_BOOTM_NETBSD is not set
CONFIG_CMD_GPIO=y
CONFIG_CMD_I2C=y
CONFIG_CMD_MMC=y
CONFIG_CMD_CACHE=y
CONFIG_CMD_REGULATOR=y
CONFIG_CMD_EXT2=y

View file

@ -12,6 +12,7 @@ CONFIG_MISC_INIT_R=y
CONFIG_BOARD_EARLY_INIT_F=y
CONFIG_CMD_BOOTZ=y
CONFIG_CMD_GPT=y
CONFIG_CMD_MMC=y
CONFIG_CMD_DHCP=y
CONFIG_CMD_PING=y
CONFIG_CMD_EXT2=y

View file

@ -17,6 +17,7 @@ CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0xe8
CONFIG_CMD_BOOTZ=y
CONFIG_CMD_GPT=y
CONFIG_CMD_MMC=y
CONFIG_CMD_DHCP=y
CONFIG_CMD_PING=y
CONFIG_CMD_EXT2=y

View file

@ -19,6 +19,7 @@ CONFIG_HUSH_PARSER=y
# CONFIG_BOOTM_NETBSD is not set
CONFIG_CMD_GPIO=y
CONFIG_CMD_I2C=y
CONFIG_CMD_MMC=y
CONFIG_CMD_CACHE=y
CONFIG_CMD_REGULATOR=y
CONFIG_CMD_EXT2=y

View file

@ -13,6 +13,7 @@ CONFIG_CMD_BOOTZ=y
CONFIG_CMD_MEMTEST=y
CONFIG_SYS_MEMTEST_START=0xc0000000
CONFIG_SYS_MEMTEST_END=0xc7c00000
CONFIG_CMD_MMC=y
CONFIG_ENV_IS_IN_MMC=y
CONFIG_SYS_RELOC_GD_ENV_ADDR=y
CONFIG_DM=y

View file

@ -48,12 +48,12 @@ Configuration Options:
CONFIG_CMD_DFU
Environment variables:
the dfu command use 3 environments variables:
"dfu_alt_info" : the DFU setting for the USB download gadget with a comma
the dfu command uses 3 environments variables:
"dfu_alt_info" : the DFU setting for the USB download gadget with a semicolon
separated string of information on each alternate:
dfu_alt_info="<alt1>;<alt2>;....;<altN>"
when only several device are used, the format is:
when several devices are used, the format is:
- <interface> <dev>'='alternate list (';' separated)
- each interface is separated by '&'
dfu_alt_info=\
@ -63,7 +63,7 @@ Environment variables:
"<interfaceI> <devI>=<altY+1>;....;<altZ>&"
"dfu_bufsiz" : size of the DFU buffer, when absent, use
CONFIG_SYS_DFU_DATA_BUF_SIZE (8MiB by default)
CONFIG_SYS_DFU_DATA_BUF_SIZE (8 MiB by default)
"dfu_hash_algo" : name of the hash algorithm to use
@ -87,12 +87,21 @@ Commands:
"mmc" (for eMMC and SD card)
cmd: dfu 0 mmc <dev>
each element in "dfu_alt_info" =
<name> raw <offset> <size> raw access to mmc device
<name> part <dev> <part_id> raw acces to partition
<name> fat <dev> <part_id> file in FAT partition
<name> ext4 <dev> <part_id> file in EXT4 partition
<name> raw <offset> <size> [mmcpart <num>] raw access to mmc device
<name> part <dev> <part_id> [mmcpart <num>] raw access to partition
<name> fat <dev> <part_id> [mmcpart <num>] file in FAT partition
<name> ext4 <dev> <part_id> [mmcpart <num>] file in EXT4 partition
with <partid> is the GPT or DOS partition index
with <partid> being the GPT or DOS partition index,
with <num> being the eMMC hardware partition number.
A value of environment variable dfu_alt_info for eMMC could be:
"u-boot raw 0x3e 0x800 mmcpart 1;bl2 raw 0x1e 0x1d mmcpart 1"
A value of environment variable dfu_alt_info for SD card could be:
"u-boot raw 0x80 0x800;uImage ext4 0 2"
"nand" (raw slc nand device)
cmd: dfu 0 nand <dev>

7
doc/api/dfu.rst Normal file
View file

@ -0,0 +1,7 @@
.. SPDX-License-Identifier: GPL-2.0+
Device firmware update
======================
.. kernel-doc:: include/dfu.h
:internal:

View file

@ -6,6 +6,7 @@ U-Boot API documentation
.. toctree::
:maxdepth: 2
dfu
efi
linker_lists
serial

View file

@ -118,7 +118,7 @@ int generic_phy_init(struct phy *phy)
{
struct phy_ops const *ops;
if (!phy)
if (!generic_phy_valid(phy))
return 0;
ops = phy_dev_ops(phy->dev);
@ -129,7 +129,7 @@ int generic_phy_reset(struct phy *phy)
{
struct phy_ops const *ops;
if (!phy)
if (!generic_phy_valid(phy))
return 0;
ops = phy_dev_ops(phy->dev);
@ -140,7 +140,7 @@ int generic_phy_exit(struct phy *phy)
{
struct phy_ops const *ops;
if (!phy)
if (!generic_phy_valid(phy))
return 0;
ops = phy_dev_ops(phy->dev);
@ -151,7 +151,7 @@ int generic_phy_power_on(struct phy *phy)
{
struct phy_ops const *ops;
if (!phy)
if (!generic_phy_valid(phy))
return 0;
ops = phy_dev_ops(phy->dev);
@ -162,7 +162,7 @@ int generic_phy_power_off(struct phy *phy)
{
struct phy_ops const *ops;
if (!phy)
if (!generic_phy_valid(phy))
return 0;
ops = phy_dev_ops(phy->dev);

7
env/Kconfig vendored
View file

@ -604,6 +604,13 @@ config DELAY_ENVIRONMENT
later by U-Boot code. With CONFIG_OF_CONTROL this is instead
controlled by the value of /config/load-environment.
config ENV_ACCESS_IGNORE_FORCE
bool "Block forced environment operations"
default n
help
If defined, don't allow the -f switch to env set override variable
access flags.
if SPL_ENV_SUPPORT
config SPL_ENV_IS_NOWHERE
bool "SPL Environment is not stored"

View file

@ -130,7 +130,6 @@ extern phys_addr_t prior_stage_fdt_address;
#define CONFIG_CMD_ASKENV
#define CONFIG_CMD_CACHE
#define CONFIG_CMD_EXT2
#define CONFIG_CMD_MMC
/*
* Flash configuration.

View file

@ -202,8 +202,6 @@
#define CONFIG_IMX_BOOTAUX
#define CONFIG_CMD_MMC
#define CONFIG_SYS_FSL_USDHC_NUM 2
#define CONFIG_SYS_FSL_ESDHC_ADDR 0

View file

@ -193,8 +193,6 @@
#define CONFIG_IMX_BOOTAUX
#define CONFIG_CMD_MMC
#define CONFIG_SYS_FSL_USDHC_NUM 2
#define CONFIG_SYS_FSL_ESDHC_ADDR 0

View file

@ -120,7 +120,6 @@
/*
* MMC
*/
#define CONFIG_CMD_MMC
/* SATA */
#define CONFIG_SCSI_AHCI_PLAT

View file

@ -174,8 +174,6 @@
#define CONFIG_IMX_BOOTAUX
#define CONFIG_CMD_MMC
#define CONFIG_SYS_FSL_USDHC_NUM 2
#define CONFIG_SYS_FSL_ESDHC_ADDR 0

View file

@ -68,7 +68,6 @@
#define CONFIG_SYS_FSL_ESDHC_ADDR USDHC_BASE_ADDR
#define CONFIG_SYS_FSL_ESDHC_NUM 1
#define CONFIG_CMD_MMC
/* #define CONFIG_CMD_EXT2 EXT2 Support */
#if 0

View file

@ -114,9 +114,6 @@
BOOTENV \
MEM_LAYOUT_ENV_SETTINGS
#define CONFIG_GZIP_COMPRESSED
#define CONFIG_BZIP2
#ifndef CONFIG_SPL_BUILD
#define CONFIG_SYS_IDE_MAXBUS 1
#define CONFIG_SYS_ATA_IDE0_OFFSET 0

View file

@ -101,7 +101,6 @@
/* Command line configuration */
#define CONFIG_CMD_MII
#define CONFIG_CMD_MMC
#define CONFIG_CMD_CACHE
#endif /* __CONFIG_H */

View file

@ -159,20 +159,139 @@ struct dfu_entity {
};
#ifdef CONFIG_SET_DFU_ALT_INFO
/**
* set_dfu_alt_info() - set dfu_alt_info environment variable
*
* If CONFIG_SET_DFU_ALT_INFO=y, this board specific function is called to set
* environment variable dfu_alt_info.
*
* @interface: dfu interface, e.g. "mmc" or "nand"
* @devstr: device number as string
*/
void set_dfu_alt_info(char *interface, char *devstr);
#endif
/**
* dfu_alt_init() - initialize buffer for dfu entities
*
* @num: number of entities
* @dfu: on return allocated buffer
* Return: 0 on success
*/
int dfu_alt_init(int num, struct dfu_entity **dfu);
/**
* dfu_alt_add() - add alternate to dfu entity buffer
*
* @dfu: dfu entity
* @interface: dfu interface, e.g. "mmc" or "nand"
* @devstr: device number as string
* @s: string description of alternate
* Return: 0 on success
*/
int dfu_alt_add(struct dfu_entity *dfu, char *interface, char *devstr, char *s);
/**
* dfu_config_entities() - initialize dfu entitities from envirionment
*
* Initialize the list of dfu entities from environment variable dfu_alt_info.
* The list must be freed by calling dfu_free_entities(). This function bypasses
* set_dfu_alt_info(). So typically you should use dfu_init_env_entities()
* instead.
*
* See function :c:func:`dfu_free_entities`
* See function :c:func:`dfu_init_env_entities`
*
* @s: string with alternates
* @interface: interface, e.g. "mmc" or "nand"
* @devstr: device number as string
* Return: 0 on success, a negative error code otherwise
*/
int dfu_config_entities(char *s, char *interface, char *devstr);
/**
* dfu_free_entities() - free the list of dfu entities
*
* Free the internal list of dfu entities.
*
* See function :c:func:`dfu_init_env_entities`
*/
void dfu_free_entities(void);
/**
* dfu_show_entities() - print DFU alt settings list
*/
void dfu_show_entities(void);
/**
* dfu_get_alt_number() - get number of alternates
*
* Return: number of alternates in the dfu entities list
*/
int dfu_get_alt_number(void);
const char *dfu_get_dev_type(enum dfu_device_type t);
const char *dfu_get_layout(enum dfu_layout l);
/**
* dfu_get_dev_type() - get string representation for dfu device type
*
* @type: device type
* Return: string representation for device type
*/
const char *dfu_get_dev_type(enum dfu_device_type type);
/**
* dfu_get_layout() - get string describing layout
*
* Internally layouts are represented by enum dfu_device_type values. This
* function translates an enum value to a human readable string, e.g. DFU_FS_FAT
* is translated to "FAT".
*
* @layout: layout
* Result: string representation for the layout
*/
const char *dfu_get_layout(enum dfu_layout layout);
/**
* dfu_get_entity() - get dfu entity for an alternate id
*
* @alt: alternate id
* Return: dfu entity
*/
struct dfu_entity *dfu_get_entity(int alt);
char *dfu_extract_token(char** e, int *n);
/**
* dfu_get_alt() - get alternate id for filename
*
* Environment variable dfu_alt_info defines the write destinations (alternates)
* for different filenames. This function get the index of the alternate for
* a filename. If an absolute filename is provided (starting with '/'), the
* directory path is ignored.
*
* @name: filename
* Return: id of the alternate or negative error number (-ENODEV)
*/
int dfu_get_alt(char *name);
/**
* dfu_init_env_entities() - initialize dfu entitities from envirionment
*
* Initialize the list of dfu entities from environment variable dfu_alt_info.
* The list must be freed by calling dfu_free_entities().
* @interface and @devstr are used to select the relevant set of alternates
* from environment variable dfu_alt_info.
*
* If environment variable dfu_alt_info specifies the interface and the device,
* use NULL for @interface and @devstr.
*
* See function :c:func:`dfu_free_entities`
*
* @interface: interface, e.g. "mmc" or "nand"
* @devstr: device number as string
* Return: 0 on success, a negative error code otherwise
*/
int dfu_init_env_entities(char *interface, char *devstr);
unsigned char *dfu_get_buf(struct dfu_entity *dfu);
unsigned char *dfu_free_buf(void);
unsigned long dfu_get_buf_size(void);
@ -183,29 +302,79 @@ unsigned long dfu_get_timeout(void);
void dfu_set_timeout(unsigned long);
#endif
/**
* dfu_read() - read from dfu entity
*
* The block sequence number @blk_seq_num is a 16 bit counter that must be
* incremented with each call for the same dfu entity @de.
*
* @de: dfu entity
* @buf: buffer
* @size: size of buffer
* @blk_seq_num: block sequence number
* Return: 0 for success, -1 for error
*/
int dfu_read(struct dfu_entity *de, void *buf, int size, int blk_seq_num);
/**
* dfu_write() - write to dfu entity
*
* Write the contents of a buffer @buf to the dfu entity @de. After writing
* the last block call dfu_flush(). If a file is already loaded completely
* into memory it is preferable to use dfu_write_from_mem_addr() which takes
* care of blockwise transfer and flushing.
*
* The block sequence number @blk_seq_num is a 16 bit counter that must be
* incremented with each call for the same dfu entity @de.
*
* See function :c:func:`dfu_flush`
* See function :c:func:`dfu_write_from_mem_addr`
*
* @de: dfu entity
* @buf: buffer
* @size: size of buffer
* @blk_seq_num: block sequence number
* Return: 0 for success, -1 for error
*/
int dfu_write(struct dfu_entity *de, void *buf, int size, int blk_seq_num);
/**
* dfu_flush() - flush to dfu entity
*
* This function has to be called after writing the last block to the dfu
* entity @de.
*
* The block sequence number @blk_seq_num is a 16 bit counter that must be
* incremented with each call for the same dfu entity @de.
*
* See function :c:func:`dfu_write`
*
* @de: dfu entity
* @buf: ignored
* @size: ignored
* @blk_seq_num: block sequence number of last write - ignored
* Return: 0 for success, -1 for error
*/
int dfu_flush(struct dfu_entity *de, void *buf, int size, int blk_seq_num);
/**
* dfu_initiated_callback - weak callback called on DFU transaction start
* dfu_initiated_callback() - weak callback called on DFU transaction start
*
* It is a callback function called by DFU stack when a DFU transaction is
* initiated. This function allows to manage some board specific behavior on
* DFU targets.
*
* @param dfu - pointer to the dfu_entity, which should be initialized
*
* @dfu: pointer to the dfu_entity, which should be initialized
*/
void dfu_initiated_callback(struct dfu_entity *dfu);
/**
* dfu_flush_callback - weak callback called at the end of the DFU write
* dfu_flush_callback() - weak callback called at the end of the DFU write
*
* It is a callback function called by DFU stack after DFU manifestation.
* This function allows to manage some board specific behavior on DFU targets
*
* @param dfu - pointer to the dfu_entity, which should be flushed
*
* @dfu: pointer to the dfu_entity, which should be flushed
*/
void dfu_flush_callback(struct dfu_entity *dfu);
@ -217,10 +386,11 @@ void dfu_transaction_cleanup(struct dfu_entity *dfu);
* It should be NULL when not used.
*/
extern struct dfu_entity *dfu_defer_flush;
/**
* dfu_get_defer_flush - get current value of dfu_defer_flush pointer
* dfu_get_defer_flush() - get current value of dfu_defer_flush pointer
*
* @return - value of the dfu_defer_flush pointer
* Return: value of the dfu_defer_flush pointer
*/
static inline struct dfu_entity *dfu_get_defer_flush(void)
{
@ -228,9 +398,9 @@ static inline struct dfu_entity *dfu_get_defer_flush(void)
}
/**
* dfu_set_defer_flush - set the dfu_defer_flush pointer
* dfu_set_defer_flush() - set the dfu_defer_flush pointer
*
* @param dfu - pointer to the dfu_entity, which should be written
* @dfu: pointer to the dfu_entity, which should be written
*/
static inline void dfu_set_defer_flush(struct dfu_entity *dfu)
{
@ -238,16 +408,16 @@ static inline void dfu_set_defer_flush(struct dfu_entity *dfu)
}
/**
* dfu_write_from_mem_addr - write data from memory to DFU managed medium
* dfu_write_from_mem_addr() - write data from memory to DFU managed medium
*
* This function adds support for writing data starting from fixed memory
* address (like $loadaddr) to dfu managed medium (e.g. NAND, MMC, file system)
*
* @param dfu - dfu entity to which we want to store data
* @param buf - fixed memory addres from where data starts
* @param size - number of bytes to write
* @dfu: dfu entity to which we want to store data
* @buf: fixed memory address from where data starts
* @size: number of bytes to write
*
* @return - 0 on success, other value on failure
* Return: 0 on success, other value on failure
*/
int dfu_write_from_mem_addr(struct dfu_entity *dfu, void *buf, int size);
@ -324,17 +494,17 @@ static inline int dfu_fill_entity_virt(struct dfu_entity *dfu, char *devstr,
#endif
/**
* dfu_tftp_write - Write TFTP data to DFU medium
* dfu_tftp_write() - write TFTP data to DFU medium
*
* This function is storing data received via TFTP on DFU supported medium.
*
* @param dfu_entity_name - name of DFU entity to write
* @param addr - address of data buffer to write
* @param len - number of bytes
* @param interface - destination DFU medium (e.g. "mmc")
* @param devstring - instance number of destination DFU medium (e.g. "1")
* @dfu_entity_name: name of DFU entity to write
* @addr: address of data buffer to write
* @len: number of bytes
* @interface: destination DFU medium (e.g. "mmc")
* @devstring: instance number of destination DFU medium (e.g. "1")
*
* @return 0 on success, otherwise error code
* Return: 0 on success, otherwise error code
*/
#if CONFIG_IS_ENABLED(DFU_TFTP)
int dfu_tftp_write(char *dfu_entity_name, unsigned int addr, unsigned int len,

View file

@ -424,6 +424,10 @@ config GZIP
help
This enables support for GZIP compression algorithm.
config GZIP_COMPRESSED
bool
select ZLIB
config BZIP2
bool "Enable bzip2 decompression support"
help

View file

@ -415,7 +415,6 @@ CONFIG_ENABLE_36BIT_PHYS
CONFIG_ENABLE_MMU
CONFIG_ENABLE_MUST_CHECK
CONFIG_ENABLE_WARN_DEPRECATED
CONFIG_ENV_ACCESS_IGNORE_FORCE
CONFIG_ENV_ADDR_FLEX
CONFIG_ENV_CALLBACK_LIST_DEFAULT
CONFIG_ENV_CALLBACK_LIST_STATIC
@ -644,8 +643,6 @@ CONFIG_GPIO_LED_STUBS
CONFIG_GREEN_LED
CONFIG_GURNARD_FPGA
CONFIG_GURNARD_SPLASH
CONFIG_GZIP_COMPRESSED
CONFIG_GZIP_COMPRESS_DEF_SZ
CONFIG_G_DNL_THOR_PRODUCT_NUM
CONFIG_G_DNL_THOR_VENDOR_NUM
CONFIG_G_DNL_UMS_PRODUCT_NUM

1
tools/env/fw_env.h vendored
View file

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