[U-Boot] [PATCH] arm: imx7d: cl-som-imx7: migration to CONFIG_BLK
Enable driver model for USB, MMC and REGULATOR drivers. Set run-time configuration via Device Tree. Signed-off-by: Yaniv Levinsky --- configs/cl-som-imx7_defconfig | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/configs/cl-som-imx7_defconfig b/configs/cl-som-imx7_defconfig index 0eed5264f2..ea7ad5c596 100644 --- a/configs/cl-som-imx7_defconfig +++ b/configs/cl-som-imx7_defconfig @@ -43,8 +43,11 @@ CONFIG_CMD_EXT4=y CONFIG_CMD_EXT4_WRITE=y CONFIG_CMD_FAT=y CONFIG_CMD_FS_GENERIC=y +CONFIG_OF_CONTROL=y +CONFIG_DEFAULT_DEVICE_TREE="imx7d-sdb" # CONFIG_ENV_IS_IN_MMC is not set CONFIG_ENV_IS_IN_SPI_FLASH=y +CONFIG_DM_MMC=y CONFIG_FSL_ESDHC=y CONFIG_SPI_FLASH=y CONFIG_SPI_FLASH_ATMEL=y @@ -56,12 +59,13 @@ CONFIG_SPI_FLASH_STMICRO=y CONFIG_SPI_FLASH_SST=y CONFIG_SPI_FLASH_WINBOND=y CONFIG_MII=y +CONFIG_DM_REGULATOR=y CONFIG_SPI=y CONFIG_MXC_SPI=y CONFIG_USB=y +CONFIG_DM_USB=y CONFIG_USB_EHCI_HCD=y CONFIG_MXC_USB_OTG_HACTIVE=y CONFIG_USB_STORAGE=y CONFIG_USB_GADGET=y CONFIG_CI_UDC=y -CONFIG_OF_LIBFDT=y -- 2.19.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] env: common: load read-only variables after reset
On 07/27/2018 06:34 PM, Yaniv Levinsky wrote: > U-Boot fails to load read-only variables from storage after a reset. It > happens because the environment hash table prevents creating read-only > variables unless the H_FORCE flag is passed. > > In the following example, the variable "test" is set to read-only in the > board header file (#define CONFIG_ENV_FLAGS_LIST_DEFAULT "test:sr"): > > U-Boot> printenv .flags > .flags=test:sr > U-Boot> setenv -f test 1 > U-Boot> printenv test > test=1 > U-Boot> savee > Saving Environment to SPI Flash > ... > OK > U-Boot> reset > ... > Loading Environment from SPI Flash... > ## Error: Can't create "test" > himport_r: can't insert "test=1" into hash table > ... > U-Boot> printenv test > ## Error: "test" not defined > > Pass the H_FORCE flag when importing the environment from storage. > > Signed-off-by: Yaniv Levinsky > --- > env/common.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/env/common.c b/env/common.c > index 3317cef355..de8dd47e9b 100644 > --- a/env/common.c > +++ b/env/common.c > @@ -119,7 +119,7 @@ int env_import(const char *buf, int check) > } > } > > - if (himport_r(_htab, (char *)ep->data, ENV_SIZE, '\0', 0, 0, > + if (himport_r(_htab, (char *)ep->data, ENV_SIZE, '\0', H_FORCE, 0, > 0, NULL)) { > gd->flags |= GD_FLG_ENV_READY; > return 0; > Gentle ping. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] env: common: load read-only variables after reset
Hello Wolfgang, On 07/28/2018 03:56 PM, Wolfgang Denk wrote: > Dear Yaniv, > > In message <20180727153444.5602-1-yaniv.levin...@compulab.co.il> you wrote: >> U-Boot fails to load read-only variables from storage after a reset. It >> happens because the environment hash table prevents creating read-only >> variables unless the H_FORCE flag is passed. > > This is NOT a good idea. "env import" should respect read-only > settings in exactly the same way as "env set" does. Please keep in > minf that the user my set a variable to read-only exactly just to > prevent if from bein (accidentially) overwritten when importing an > (not exactly know) set of environment settings. Your patch would > kill any such protection. > > IMO the correct approach would be to add a "-f" flag to "env import" > and the, and ONLY then, also set the H_FORCE flag. > > Naked-by: Wolfgang Denk > > Best regards, > > Wolfgang Denk > Thank you for reviewing the patch. The command "env import" should of course respect access restriction flags. Confusingly, the function env_import() in env/common.c has nothing to do with the implementation of the "env import" command. This is done entirely by do_env_import() in cmd/nvedit.c. To the best of my knowledge, the function env_import() is used only by storage devices to load the environment on boot. In this scenario, I think we do need to ignore access restriction flags. Otherwise, read-only variables won't load from storage with the rest of the environment. Please correct me if I'm wrong. Thanks, Yaniv ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] env: common: load read-only variables after reset
U-Boot fails to load read-only variables from storage after a reset. It happens because the environment hash table prevents creating read-only variables unless the H_FORCE flag is passed. In the following example, the variable "test" is set to read-only in the board header file (#define CONFIG_ENV_FLAGS_LIST_DEFAULT "test:sr"): U-Boot> printenv .flags .flags=test:sr U-Boot> setenv -f test 1 U-Boot> printenv test test=1 U-Boot> savee Saving Environment to SPI Flash ... OK U-Boot> reset ... Loading Environment from SPI Flash... ## Error: Can't create "test" himport_r: can't insert "test=1" into hash table ... U-Boot> printenv test ## Error: "test" not defined Pass the H_FORCE flag when importing the environment from storage. Signed-off-by: Yaniv Levinsky --- env/common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/env/common.c b/env/common.c index 3317cef355..de8dd47e9b 100644 --- a/env/common.c +++ b/env/common.c @@ -119,7 +119,7 @@ int env_import(const char *buf, int check) } } - if (himport_r(_htab, (char *)ep->data, ENV_SIZE, '\0', 0, 0, + if (himport_r(_htab, (char *)ep->data, ENV_SIZE, '\0', H_FORCE, 0, 0, NULL)) { gd->flags |= GD_FLG_ENV_READY; return 0; -- 2.18.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2 0/2] env: Make environment loading log more clear
On 07/20/2018 06:18 PM, Sam Protsenko wrote: > This patch series intended to make boot log better. Basically here we > just remove unwanted error messages, relying on the message from most > deep API to be printed (like mmc subsystem). At the moment this looks > like most clean solution to cluttered log problem, as any other solution > will be hackish. > > With this patch set applied we will see something like this: > > Loading Environment from FAT... MMC: no card present > Loading Environment from MMC... OK > > instead of: > > Loading Environment from FAT... MMC: no card present > ** Bad device mmc 0 ** > Failed (-5) > Loading Environment from MMC... OK > > Sam Protsenko (2): > env: Don't print "Failed" error message > disk: part: Don't show redundant error message > > disk/part.c | 2 +- > env/env.c | 12 +++- > 2 files changed, 8 insertions(+), 6 deletions(-) > Hi Sam, After following the discussion from "Make U-Boot log great again" to here, it made me wonder: Does the user really need to be exposed to all the failed attempts to load the environment if it succeeded eventually? Maybe the maintainers are willing the consider a more drastic solution for clearing the console clutter when the environment loads. What if the only thing the user would see on a successful load is this: ENV: Loaded from MMC And the rest of the usual clutter would be visible only if DEBUG is set. It shouldn't be too hard to implement (Rising GD_FLG_SILENT if DEBUG not defined) and it is very consistent with the rest of the printed messages on boot. The problem is how and what to print on a failed load. I think it would be best if we could keep the above pattern like so: ENV: Failed to load from FAT - MMC: No card present (-5) ENV: Failed to load from MMC - No MMC card found (-5) ENV: Using default environment The last line would print only if (gd->flags & GD_FLG_ENV_DEFAULT) This might be harder to implement, but do you think it could work? Yaniv ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 0/4] fix propagation of flags from do_env_default()
Gentle ping. On 06/24/2018 07:16 PM, Yaniv Levinsky wrote: > The function do_env_default() doesn't propagate flags to himport_r(). It > causes > the "-f" option to have no effect on the execution of "env default" commands. > > Fix the call paths from do_env_default() to himport_r() to pass flags > correctly. > > Yaniv Levinsky (4): > cmd: nvedit: rename flags in do_env_default > cmd: nvedit: propagate envflag to set_default_vars > cmd: nvedit: set H_INTERACTIVE in do_env_default > env: common: accept flags on reset to default env > > arch/arm/mach-imx/mx6/opos6ul.c | 2 +- > cmd/nvedit.c| 11 ++- > common/board_r.c| 2 +- > common/spl/spl_dfu.c| 2 +- > env/common.c| 27 --- > env/ext4.c | 2 +- > env/fat.c | 2 +- > env/mmc.c | 12 ++-- > env/nand.c | 6 +++--- > env/sata.c | 2 +- > env/sf.c| 10 +- > env/ubi.c | 6 +++--- > include/environment.h | 4 ++-- > 13 files changed, 43 insertions(+), 45 deletions(-) > ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 3/4] cmd: nvedit: set H_INTERACTIVE in do_env_default
The function set_default_vars() in common.c adds H_INTERACTIVE to the h_import() flag, but the function has no way of telling if the command actually was user directed like this flag suggest. The flag should be set by the calling function do_env_default() in nvedit.c instead, where the command is certainty user directed. Move the H_INTERACTIVE flag from set_default_vars() to do_env_default(). Signed-off-by: Yaniv Levinsky Acked-by: Igor Grinberg --- cmd/nvedit.c | 2 +- env/common.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/nvedit.c b/cmd/nvedit.c index 1955dee0d0..8b73c606ca 100644 --- a/cmd/nvedit.c +++ b/cmd/nvedit.c @@ -780,7 +780,7 @@ int envmatch(uchar *s1, int i2) static int do_env_default(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { - int all = 0, env_flag = 0; + int all = 0, env_flag = H_INTERACTIVE; debug("Initial value for argc=%d\n", argc); while (--argc > 0 && **++argv == '-') { diff --git a/env/common.c b/env/common.c index 6cf5eddaf6..05183a4af0 100644 --- a/env/common.c +++ b/env/common.c @@ -97,7 +97,7 @@ int set_default_vars(int nvars, char * const vars[], int flags) * Special use-case: import from default environment * (and use \0 as a separator) */ - flags |= H_NOCLEAR | H_INTERACTIVE; + flags |= H_NOCLEAR; return himport_r(_htab, (const char *)default_environment, sizeof(default_environment), '\0', flags, 0, nvars, vars); -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 4/4] env: common: accept flags on reset to default env
The function set_default_env() sets the hashtable flags for import_r(). Formally set_default_env() doesn't accept flags from its callers. In practice the caller can (un)set the H_INTERACTIVE flag, but it has to be done using the first character of the function's string argument. Other flags like H_FORCE can't be set by the caller. Change the function to accept flags argument. The benefits are: 1. The caller will have to explicitly set the H_INTERACTIVE flag, instead of un-setting it using a special char in a string. 2. Add the ability to propagate flags from the caller to himport(), especially the H_FORCE flag from do_env_default() in nvedit.c that currently gets ignored for "env default -a -f" commands. 3. Flags and messages will not be coupled together. A caller will be able to set flags without passing a string and vice versa. Please note: The propagation of H_FORCE from do_env_default() does not introduce any functional changes, because currently himport_r() is set to destroy the old environment regardless if H_FORCE flag is set or not. More changes are needed to utilize the propagation of H_FORCE. Signed-off-by: Yaniv Levinsky Acked-by: Igor Grinberg --- arch/arm/mach-imx/mx6/opos6ul.c | 2 +- cmd/nvedit.c| 3 ++- common/board_r.c| 2 +- common/spl/spl_dfu.c| 2 +- env/common.c| 22 +- env/ext4.c | 2 +- env/fat.c | 2 +- env/mmc.c | 12 ++-- env/nand.c | 6 +++--- env/sata.c | 2 +- env/sf.c| 10 +- env/ubi.c | 6 +++--- include/environment.h | 2 +- 13 files changed, 35 insertions(+), 38 deletions(-) diff --git a/arch/arm/mach-imx/mx6/opos6ul.c b/arch/arm/mach-imx/mx6/opos6ul.c index af3384d10e..94a3d71201 100644 --- a/arch/arm/mach-imx/mx6/opos6ul.c +++ b/arch/arm/mach-imx/mx6/opos6ul.c @@ -127,7 +127,7 @@ int board_late_init(void) /* In bootstrap don't use the env vars */ if (((reg & 0x300) >> 24) == 0x1) { - set_default_env(NULL); + set_default_env(NULL, 0); env_set("preboot", ""); } diff --git a/cmd/nvedit.c b/cmd/nvedit.c index 8b73c606ca..796867c62c 100644 --- a/cmd/nvedit.c +++ b/cmd/nvedit.c @@ -802,7 +802,8 @@ static int do_env_default(cmd_tbl_t *cmdtp, int flag, debug("Final value for argc=%d\n", argc); if (all && (argc == 0)) { /* Reset the whole environment */ - set_default_env("## Resetting to default environment\n"); + set_default_env("## Resetting to default environment\n", + env_flag); return 0; } if (!all && (argc > 0)) { diff --git a/common/board_r.c b/common/board_r.c index 6b297068bd..8495777953 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -454,7 +454,7 @@ static int initr_env(void) if (should_load_env()) env_relocate(); else - set_default_env(NULL); + set_default_env(NULL, 0); #ifdef CONFIG_OF_CONTROL env_set_addr("fdtcontroladdr", gd->fdt_blob); #endif diff --git a/common/spl/spl_dfu.c b/common/spl/spl_dfu.c index b8e3a6c89e..01178f611f 100644 --- a/common/spl/spl_dfu.c +++ b/common/spl/spl_dfu.c @@ -38,7 +38,7 @@ int spl_dfu_cmd(int usbctrl, char *dfu_alt_info, char *interface, char *devstr) int ret; /* set default environment */ - set_default_env(0); + set_default_env(NULL, 0); str_env = env_get(dfu_alt_info); if (!str_env) { pr_err("\"dfu_alt_info\" env variable not defined!\n"); diff --git a/env/common.c b/env/common.c index 05183a4af0..1430100c85 100644 --- a/env/common.c +++ b/env/common.c @@ -58,22 +58,18 @@ char *env_get_default(const char *name) return ret_val; } -void set_default_env(const char *s) +void set_default_env(const char *s, int flags) { - int flags = 0; - if (sizeof(default_environment) > ENV_SIZE) { puts("*** Error - default environment is too large\n\n"); return; } if (s) { - if (*s == '!') { + if ((flags & H_INTERACTIVE) == 0) { printf("*** Warning - %s, " - "using default environment\n\n", - s + 1); + "using default environment\n\n", s); } else { - flags = H_INTERACTIVE; puts(s); } } else { @@ -117,7 +113,7 @@ int env_import(const char *bu
[U-Boot] [PATCH 2/4] cmd: nvedit: propagate envflag to set_default_vars
The env_flag in do_env_default() doesn't get propagated and therefore gets ignored by himport_r(). This breaks to ability to "forcibly" reset variables to their default values using the environment command. Scenario example of the problem: # setenv kernel uImage # setenv .flags kernel:so # env default -f kernel ## Error: Can't overwrite "kernel" himport_r: can't insert "kernel=zImage" into hash table Change the call path so it will pass the flag correctly. Signed-off-by: Yaniv Levinsky Acked-by: Igor Grinberg --- cmd/nvedit.c | 2 +- env/common.c | 5 +++-- include/environment.h | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cmd/nvedit.c b/cmd/nvedit.c index d456d2fc9b..1955dee0d0 100644 --- a/cmd/nvedit.c +++ b/cmd/nvedit.c @@ -807,7 +807,7 @@ static int do_env_default(cmd_tbl_t *cmdtp, int flag, } if (!all && (argc > 0)) { /* Reset individual variables */ - set_default_vars(argc, argv); + set_default_vars(argc, argv, env_flag); return 0; } diff --git a/env/common.c b/env/common.c index dc8a14f519..6cf5eddaf6 100644 --- a/env/common.c +++ b/env/common.c @@ -91,15 +91,16 @@ void set_default_env(const char *s) /* [re]set individual variables to their value in the default environment */ -int set_default_vars(int nvars, char * const vars[]) +int set_default_vars(int nvars, char * const vars[], int flags) { /* * Special use-case: import from default environment * (and use \0 as a separator) */ + flags |= H_NOCLEAR | H_INTERACTIVE; return himport_r(_htab, (const char *)default_environment, sizeof(default_environment), '\0', - H_NOCLEAR | H_INTERACTIVE, 0, nvars, vars); + flags, 0, nvars, vars); } /* diff --git a/include/environment.h b/include/environment.h index 70b7eda428..2fe1f3eb48 100644 --- a/include/environment.h +++ b/include/environment.h @@ -275,7 +275,7 @@ char *env_get_default(const char *name); void set_default_env(const char *s); /* [re]set individual variables to their value in the default environment */ -int set_default_vars(int nvars, char * const vars[]); +int set_default_vars(int nvars, char * const vars[], int flags); /* Import from binary representation into hash table */ int env_import(const char *buf, int check); -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 1/4] cmd: nvedit: rename flags in do_env_default
The naming convention for flags in nvedit.c is: * The hashtable flag (defined in search.h) is named "env_flag" * The command flag argument (defined in command.h) is named "flag" This convention is kept in functions like do_env_print(), do_env_set() and do_env_delete(), but not in do_env_default(). Rename the hashtable flag in do_env_default() from "flag" to "env_flag". Rename the command flag in do_env_default() from "__flag" to "flag". No functional change. Signed-off-by: Yaniv Levinsky Reviewed-by: Igor Grinberg --- cmd/nvedit.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/nvedit.c b/cmd/nvedit.c index ddc888a4fd..d456d2fc9b 100644 --- a/cmd/nvedit.c +++ b/cmd/nvedit.c @@ -777,10 +777,10 @@ int envmatch(uchar *s1, int i2) } #ifndef CONFIG_SPL_BUILD -static int do_env_default(cmd_tbl_t *cmdtp, int __flag, +static int do_env_default(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { - int all = 0, flag = 0; + int all = 0, env_flag = 0; debug("Initial value for argc=%d\n", argc); while (--argc > 0 && **++argv == '-') { @@ -792,7 +792,7 @@ static int do_env_default(cmd_tbl_t *cmdtp, int __flag, all = 1; break; case 'f': /* force */ - flag |= H_FORCE; + env_flag |= H_FORCE; break; default: return cmd_usage(cmdtp); -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 0/4] fix propagation of flags from do_env_default()
The function do_env_default() doesn't propagate flags to himport_r(). It causes the "-f" option to have no effect on the execution of "env default" commands. Fix the call paths from do_env_default() to himport_r() to pass flags correctly. Yaniv Levinsky (4): cmd: nvedit: rename flags in do_env_default cmd: nvedit: propagate envflag to set_default_vars cmd: nvedit: set H_INTERACTIVE in do_env_default env: common: accept flags on reset to default env arch/arm/mach-imx/mx6/opos6ul.c | 2 +- cmd/nvedit.c| 11 ++- common/board_r.c| 2 +- common/spl/spl_dfu.c| 2 +- env/common.c| 27 --- env/ext4.c | 2 +- env/fat.c | 2 +- env/mmc.c | 12 ++-- env/nand.c | 6 +++--- env/sata.c | 2 +- env/sf.c| 10 +- env/ubi.c | 6 +++--- include/environment.h | 4 ++-- 13 files changed, 43 insertions(+), 45 deletions(-) -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] arm: imx7d: cl-som-imx7: sf: support all SF types
From: Uri Mashiach Enable the support for all SPI flash types. Signed-off-by: Uri Mashiach Signed-off-by: Yaniv Levinsky --- configs/cl-som-imx7_defconfig | 7 +++ 1 file changed, 7 insertions(+) diff --git a/configs/cl-som-imx7_defconfig b/configs/cl-som-imx7_defconfig index 6d403eed7a..8692241029 100644 --- a/configs/cl-som-imx7_defconfig +++ b/configs/cl-som-imx7_defconfig @@ -47,7 +47,14 @@ CONFIG_CMD_FS_GENERIC=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_FSL_ESDHC=y CONFIG_SPI_FLASH=y +CONFIG_SPI_FLASH_ATMEL=y +CONFIG_SPI_FLASH_EON=y +CONFIG_SPI_FLASH_GIGADEVICE=y +CONFIG_SPI_FLASH_MACRONIX=y +CONFIG_SPI_FLASH_SPANSION=y CONFIG_SPI_FLASH_STMICRO=y +CONFIG_SPI_FLASH_SST=y +CONFIG_SPI_FLASH_WINBOND=y CONFIG_SPI=y CONFIG_MXC_SPI=y CONFIG_USB=y -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot