Re: [U-Boot] [UBOOT PATCH v4 3/4] spi: xilinx_spi: Added support to read JEDEC-id twice at the boot time
On Thu, Jun 28, 2018 at 1:14 PM, Vipul Kumar wrote: > This patch is for the startup block issue in the spi controller. > SPI clock is passing through STARTUP block to FLASH. STARTUP block > don't provide clock as soon as QSPI provides command. So, first > command fails. > > This patch added support to read JEDEC id in xilinx_spi_xfer (). > > Signed-off-by: Vipul Kumar > --- > Changes in v4: > - Moved static startup variable to private data structure > - Link to AR: https://www.xilinx.com/support/answers/52626.html > --- > drivers/spi/xilinx_spi.c | 41 + > 1 file changed, 41 insertions(+) > > diff --git a/drivers/spi/xilinx_spi.c b/drivers/spi/xilinx_spi.c > index 11b7343..f66ea15 100644 > --- a/drivers/spi/xilinx_spi.c > +++ b/drivers/spi/xilinx_spi.c > @@ -105,6 +105,7 @@ struct xilinx_spi_priv { > unsigned int freq; > unsigned int mode; > unsigned int fifo_depth; > + u8 startup; > }; > > static int xilinx_spi_probe(struct udevice *bus) > @@ -205,6 +206,39 @@ static u32 xilinx_spi_read_rxfifo(struct udevice *bus, > u8 *rxp, u32 rxbytes) > return i; > } > > +static void xilinx_startup_block(struct udevice *dev, unsigned int bytes, > +const void *dout, void *din) > +{ > + struct udevice *bus = dev_get_parent(dev); > + struct xilinx_spi_priv *priv = dev_get_priv(bus); > + struct xilinx_spi_regs *regs = priv->regs; > + struct dm_spi_slave_platdata *slave_plat = > dev_get_parent_platdata(dev); > + const unsigned char *txp = dout; > + unsigned char *rxp = din; > + u32 reg, count; > + u32 txbytes = bytes; > + u32 rxbytes = bytes; > + > + /* > +* This loop runs two times. First time to send the command. > +* Second time to transfer data. After transferring data, > +* it sets txp to the initial value for the normal operation. > +*/ > + for ( ; priv->startup < 2; priv->startup++) { > + count = xilinx_spi_fill_txfifo(bus, txp, txbytes); > + reg = readl(®s->spicr) & ~SPICR_MASTER_INHIBIT; > + writel(reg, ®s->spicr); > + count = xilinx_spi_read_rxfifo(bus, rxp, rxbytes); > + txp = din; > + > + if (priv->startup) { > + spi_cs_deactivate(dev); > + spi_cs_activate(dev, slave_plat->cs); > + txp = dout; > + } > + } > +} > + > static int xilinx_spi_xfer(struct udevice *dev, unsigned int bitlen, > const void *dout, void *din, unsigned long flags) > { > @@ -237,6 +271,13 @@ static int xilinx_spi_xfer(struct udevice *dev, unsigned > int bitlen, > if (flags & SPI_XFER_BEGIN) > spi_cs_activate(dev, slave_plat->cs); > > + /* > +* This is the work around for the startup block issue in > +* the spi controller. SPI clock is passing through STARTUP > +* block to FLASH. STARTUP block don't provide clock as soon > +* as QSPI provides command. So first command fails. > +*/ > + xilinx_startup_block(dev, bytes, dout, din); Can this be xilinx_spi_startup_block? otherwise it look like generic startup function for processor or soc. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v5 1/5] env: add the same prefix to error messages to make it detectable by tests
The error message should start with `## Error: ` so that it's easily detectable by tests without needing to have a complex regexp for matching all possible error message patterns. Let's add the `## Error: ` prefix to the error messages since it's the one already in use. Suggested-by: Stephen Warren Signed-off-by: Quentin Schulz --- added in v5 cmd/nvedit.c | 12 env/common.c | 3 ++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/cmd/nvedit.c b/cmd/nvedit.c index ddc888a..70d7068 100644 --- a/cmd/nvedit.c +++ b/cmd/nvedit.c @@ -959,7 +959,8 @@ NXTARG: ; H_MATCH_KEY | H_MATCH_IDENT, &ptr, size, argc, argv); if (len < 0) { - pr_err("Cannot export environment: errno = %d\n", errno); + pr_err("## Error: Cannot export environment: errno = %d\n", + errno); return 1; } sprintf(buf, "%zX", (size_t)len); @@ -979,7 +980,8 @@ NXTARG: ; H_MATCH_KEY | H_MATCH_IDENT, &res, ENV_SIZE, argc, argv); if (len < 0) { - pr_err("Cannot export environment: errno = %d\n", errno); + pr_err("## Error: Cannot export environment: errno = %d\n", + errno); return 1; } @@ -994,7 +996,8 @@ NXTARG: ; return 0; sep_err: - printf("## %s: only one of \"-b\", \"-c\" or \"-t\" allowed\n", cmd); + printf("## Error: %s: only one of \"-b\", \"-c\" or \"-t\" allowed\n", + cmd); return 1; } #endif @@ -1114,7 +1117,8 @@ static int do_env_import(cmd_tbl_t *cmdtp, int flag, if (himport_r(&env_htab, ptr, size, sep, del ? 0 : H_NOCLEAR, crlf_is_lf, 0, NULL) == 0) { - pr_err("Environment import failed: errno = %d\n", errno); + pr_err("## Error: Environment import failed: errno = %d\n", + errno); return 1; } gd->flags |= GD_FLG_ENV_READY; diff --git a/env/common.c b/env/common.c index dc8a14f..7bd2790 100644 --- a/env/common.c +++ b/env/common.c @@ -83,7 +83,8 @@ void set_default_env(const char *s) if (himport_r(&env_htab, (char *)default_environment, sizeof(default_environment), '\0', flags, 0, 0, NULL) == 0) - pr_err("Environment import failed: errno = %d\n", errno); + pr_err("## Error: Environment import failed: errno = %d\n", + errno); gd->flags |= GD_FLG_ENV_READY; gd->flags |= GD_FLG_ENV_DEFAULT; base-commit: fb77a9e3537039664ad42992bef6688869eda7c1 -- git-series 0.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v5 3/5] test/py: remove hacks for non-zero RAM base address in tests
Some functions have different behaviour when the given address is 0 (assumed to be NULL by the function). find_ram_base() does not return 0 anymore so it's safe to remove those offsets. Suggested-by: Stephen Warren Signed-off-by: Quentin Schulz --- added in v5 test/py/tests/test_efi_loader.py | 2 +- test/py/tests/test_net.py| 4 ++-- test/py/tests/test_tpm2.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/py/tests/test_efi_loader.py b/test/py/tests/test_efi_loader.py index 35bd419..a66c6e6 100644 --- a/test/py/tests/test_efi_loader.py +++ b/test/py/tests/test_efi_loader.py @@ -118,7 +118,7 @@ def fetch_tftp_file(u_boot_console, env_conf): addr = f.get('addr', None) if not addr: -addr = u_boot_utils.find_ram_base(u_boot_console) + (1024 * 1024 * 4) +addr = u_boot_utils.find_ram_base(u_boot_console) fn = f['fn'] output = u_boot_console.run_command('tftpboot %x %s' % (addr, fn)) diff --git a/test/py/tests/test_net.py b/test/py/tests/test_net.py index f2e432b..2821ce6 100644 --- a/test/py/tests/test_net.py +++ b/test/py/tests/test_net.py @@ -146,7 +146,7 @@ def test_net_tftpboot(u_boot_console): addr = f.get('addr', None) if not addr: -addr = u_boot_utils.find_ram_base(u_boot_console) + (1024 * 1024 * 4) +addr = u_boot_utils.find_ram_base(u_boot_console) fn = f['fn'] output = u_boot_console.run_command('tftpboot %x %s' % (addr, fn)) @@ -186,7 +186,7 @@ def test_net_nfs(u_boot_console): addr = f.get('addr', None) if not addr: -addr = u_boot_utils.find_ram_base(u_boot_console) + (1024 * 1024 * 4) +addr = u_boot_utils.find_ram_base(u_boot_console) fn = f['fn'] output = u_boot_console.run_command('nfs %x %s' % (addr, fn)) diff --git a/test/py/tests/test_tpm2.py b/test/py/tests/test_tpm2.py index 01ffb31..ef7b86a 100644 --- a/test/py/tests/test_tpm2.py +++ b/test/py/tests/test_tpm2.py @@ -183,7 +183,7 @@ def test_tpm2_pcr_read(u_boot_console): """ force_init(u_boot_console) -ram = u_boot_utils.find_ram_base(u_boot_console) + 1024 +ram = u_boot_utils.find_ram_base(u_boot_console) read_pcr = u_boot_console.run_command('tpm pcr_read 0 0x%x' % ram) output = u_boot_console.run_command('echo $?') @@ -210,7 +210,7 @@ def test_tpm2_pcr_extend(u_boot_console): """ force_init(u_boot_console) -ram = u_boot_utils.find_ram_base(u_boot_console) + 1024 +ram = u_boot_utils.find_ram_base(u_boot_console) u_boot_console.run_command('tpm pcr_extend 0 0x%x' % ram) output = u_boot_console.run_command('echo $?') -- git-series 0.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v5 2/5] test/py: return a RAM address different from 0 as it can be interpreted as NULL
Some functions test that the given address is not NULL (0) and fail or have a different behaviour if that's the case (e.g. hexport_r). Let's make the RAM base address to be not zero by setting it to 2MiB if that's the case. 2MiB is chosen because it represents the size of an ARM LPAE/v8 section. Suggested-by: Stephen Warren Signed-off-by: Quentin Schulz --- added in v5 test/py/u_boot_utils.py | 6 ++ 1 file changed, 6 insertions(+) diff --git a/test/py/u_boot_utils.py b/test/py/u_boot_utils.py index bb31e57..07520ac 100644 --- a/test/py/u_boot_utils.py +++ b/test/py/u_boot_utils.py @@ -236,6 +236,12 @@ def find_ram_base(u_boot_console): ram_base = -1 raise Exception('Failed to find RAM bank start in `bdinfo`') +# We don't want ram_base to be zero as some functions test if the given +# address is NULL (0). Let's add 2MiB then (size of an ARM LPAE/v8 section). + +if ram_base == 0: +ram_base += 1024 * 1024 * 2 + return ram_base class PersistentFileHelperCtxMgr(object): -- git-series 0.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v5 4/5] cmd: nvedit: env import can now import only variables passed as parameters
While the `env export` can take as parameters variables to be exported, `env import` does not have such a mechanism of variable selection. Let's add the ability to add parameters at the end of the command for variables to be imported. Every env variable from the env to be imported passed by parameter to this command will override the value of the variable in the current env. If a variable exists in the current env but not in the imported env, if this variable is passed as a parameter to env import, the variable will be unset. If a variable exists in the imported env, the variable in the current env will be set to the value of the one from the imported env. All the remaining variables are left untouched. As the size parameter of env import is positional but optional, let's add the possibility to use the sentinel '-' for when we don't want to give the size parameter (when the env is '\0' terminated) but we pass a list of variables at the end of the command. env import addr env import addr - env import addr size env import addr - foo1 foo2 env import addr size foo1 foo2 are all valid. env import -c addr env import -c addr - env import -c addr - foo1 foo2 are all invalid because they don't pass the size parameter required for checking, while the following are valid. env import addr size env import addr size foo1 foo2 Nothing's changed for the other parameters or the overall behaviour. One of its use case could be to load a secure environment from the signed U-Boot binary and load only a handful of variables from an other, unsecure, environment without completely losing control of U-Boot. Signed-off-by: Quentin Schulz Tested-by: Alex Kiernan --- v4: - add tested-by by Alex, v3: - migrate to env import addr size var... instead of env import -w addr size so that the list of variables to load is more explicit and the behaviour of env import is closer to the one of env export, v2: - use strdup instead of malloc + strcpy, - NULL-check the result of strdup, - add common exit path for freeing memory in one unique place, - store token pointer from strtok within the char** array instead of strdup-ing token within elements of array, cmd/nvedit.c | 21 +++-- 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/cmd/nvedit.c b/cmd/nvedit.c index 70d7068..5000517 100644 --- a/cmd/nvedit.c +++ b/cmd/nvedit.c @@ -1004,7 +1004,7 @@ sep_err: #ifdef CONFIG_CMD_IMPORTENV /* - * env import [-d] [-t [-r] | -b | -c] addr [size] + * env import [-d] [-t [-r] | -b | -c] addr [size] [var ...] * -d: delete existing environment before importing; * otherwise overwrite / append to existing definitions * -t: assume text format; either "size" must be given or the @@ -1018,6 +1018,11 @@ sep_err: * addr: memory address to read from * size: length of input data; if missing, proper '\0' * termination is mandatory + * if var is set and size should be missing (i.e. '\0' + * termination), set size to '-' + * var... List of the names of the only variables that get imported from + * the environment at address 'addr'. Without arguments, the whole + * environment gets imported. */ static int do_env_import(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) @@ -1029,6 +1034,7 @@ static int do_env_import(cmd_tbl_t *cmdtp, int flag, int fmt = 0; int del = 0; int crlf_is_lf = 0; + int wl = 0; size_t size; cmd = *argv; @@ -1077,9 +1083,9 @@ static int do_env_import(cmd_tbl_t *cmdtp, int flag, addr = simple_strtoul(argv[0], NULL, 16); ptr = map_sysmem(addr, 0); - if (argc == 2) { + if (argc >= 2 && strcmp(argv[1], "-")) { size = simple_strtoul(argv[1], NULL, 16); - } else if (argc == 1 && chk) { + } else if (chk) { puts("## Error: external checksum format must pass size\n"); return CMD_RET_FAILURE; } else { @@ -1101,6 +1107,9 @@ static int do_env_import(cmd_tbl_t *cmdtp, int flag, printf("## Info: input data size = %zu = 0x%zX\n", size, size); } + if (argc > 2) + wl = 1; + if (chk) { uint32_t crc; env_t *ep = (env_t *)ptr; @@ -1115,8 +1124,8 @@ static int do_env_import(cmd_tbl_t *cmdtp, int flag, ptr = (char *)ep->data; } - if (himport_r(&env_htab, ptr, size, sep, del ? 0 : H_NOCLEAR, - crlf_is_lf, 0, NULL) == 0) { + if (!himport_r(&env_htab, ptr, size, sep, del ? 0 : H_NOCLEAR, + crlf_is_lf, wl ? argc - 2 : 0, wl ? &argv[2] : NULL)) { pr_err("## Error: Environment import failed: errno = %d\n", errno); return 1; @@ -1246,7 +1255,7 @@ static char env_help_text[] =
[U-Boot] [PATCH v5 5/5] test/py: add test for whitelist of variables while importing environment
This tests that the importing of an environment with a specified whitelist works as intended. If there are variables passed as parameter to the env import command, those only should be imported in the current environment. For each variable passed as parameter, if - foo is bar in current env and bar2 in exported env, after importing exported env, foo shall be bar2, - foo does not exist in current env and foo is bar2 in exported env, after importing exported env, foo shall be bar2, - foo is bar in current env and does not exist in exported env (but is passed as parameter), after importing exported env, foo shall be empty, Any variable not passed as parameter should be left untouched. Two other tests are made to test that size cannot be '-' if the checksum protection is enabled. Signed-off-by: Quentin Schulz Reviewed-by: Simon Glass Reviewed-by: Stephen Warren --- v5: - add reviewed-by by Stephen, v4: - add reviewed-by by Simon, - fix double quotes instead of simple ones for strings, - fix missing space after # starting a comment, v3: - update whitelist test to reflect changes made in patch 1, - add two tests for no size parameter passed but checksum protection is enabled because I added the possibility to have a sentinel in place of size parameter, - I intentionally didn't put the Reviewed and Acked-by of Simon and Stephen since the code changed since v2, added in v2 test/py/tests/test_env.py | 54 - 1 file changed, 54 insertions(+) diff --git a/test/py/tests/test_env.py b/test/py/tests/test_env.py index bfb5fc0..61b3bc9 100644 --- a/test/py/tests/test_env.py +++ b/test/py/tests/test_env.py @@ -5,6 +5,7 @@ # Test operation of shell commands relating to environment variables. import pytest +import u_boot_utils # FIXME: This might be useful for other tests; # perhaps refactor it into ConsoleBase or some other state object? @@ -239,3 +240,56 @@ def test_env_expansion_spaces(state_test_env): unset_var(state_test_env, var_space) if var_test: unset_var(state_test_env, var_test) + +@pytest.mark.buildconfigspec('cmd_importenv') +def test_env_import_checksum_no_size(state_test_env): +"""Test that omitted ('-') size parameter with checksum validation fails the + env import function. +""" +c = state_test_env.u_boot_console +ram_base = u_boot_utils.find_ram_base(state_test_env.u_boot_console) +addr = '%08x' % ram_base + +with c.disable_check('error_notification'): +response = c.run_command('env import -c %s -' % addr) +assert(response == '## Error: external checksum format must pass size') + +@pytest.mark.buildconfigspec('cmd_importenv') +def test_env_import_whitelist_checksum_no_size(state_test_env): +"""Test that omitted ('-') size parameter with checksum validation fails the + env import function when variables are passed as parameters. +""" +c = state_test_env.u_boot_console +ram_base = u_boot_utils.find_ram_base(state_test_env.u_boot_console) +addr = '%08x' % ram_base + +with c.disable_check('error_notification'): +response = c.run_command('env import -c %s - foo1 foo2 foo4' % addr) +assert(response == '## Error: external checksum format must pass size') + +@pytest.mark.buildconfigspec('cmd_exportenv') +@pytest.mark.buildconfigspec('cmd_importenv') +def test_env_import_whitelist(state_test_env): +"""Test importing only a handful of env variables from an environment.""" +c = state_test_env.u_boot_console +ram_base = u_boot_utils.find_ram_base(state_test_env.u_boot_console) +addr = '%08x' % ram_base + +set_var(state_test_env, 'foo1', 'bar1') +set_var(state_test_env, 'foo2', 'bar2') +set_var(state_test_env, 'foo3', 'bar3') + +c.run_command('env export %s' % addr) + +unset_var(state_test_env, 'foo1') +set_var(state_test_env, 'foo2', 'test2') +set_var(state_test_env, 'foo4', 'bar4') + +# no foo1 in current env, foo2 overridden, foo3 should be of the value +# before exporting and foo4 should be deleted +c.run_command('env import %s - foo1 foo2 foo4' % addr) + +validate_set(state_test_env, 'foo1', 'bar1') +validate_set(state_test_env, 'foo2', 'bar2') +validate_set(state_test_env, 'foo3', 'bar3') +validate_empty(state_test_env, 'foo4') -- git-series 0.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v2] dm: sunxi: Use DM for MMC and SATA on all A20 boards
On Thu, Jun 28, 2018 at 11:06:40PM +0100, Adam Sampson wrote: > Generalise the change in commit 3936514b82e8 ("dm: sunxi: Move > Linksprite_pcDuino3 to use DM for MMC, SATA") so it applies to all A20 > boards: use the driver model for MMC and SATA, in preparation for > CONFIG_BLK defaulting to y. > > Tested on Linksprite pcDuino3 Nano. > > Signed-off-by: Adam Sampson > --- > Changes for v2: > - at Maxime's suggestion, enabled by default at the Kconfig level for > all A20 boards (which means the one board Simon updated previously > doesn't need to specify them any more) > > arch/arm/mach-sunxi/Kconfig | 2 ++ > configs/Linksprite_pcDuino3_defconfig | 2 -- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig > index a3f7723028..78f76f52d0 100644 > --- a/arch/arm/mach-sunxi/Kconfig > +++ b/arch/arm/mach-sunxi/Kconfig > @@ -174,6 +174,8 @@ config MACH_SUN7I > select CPU_V7_HAS_NONSEC > select CPU_V7_HAS_VIRT > select ARCH_SUPPORT_PSCI > + select DM_MMC > + select DM_SCSI if SCSI I guess we would need an if MMC for DM_MMC, there's some boards without MMC support, but once that is fixed: Acked-by: Maxime Ripard Thanks! Maxime -- Maxime Ripard, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com signature.asc Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 1/2] arm: timer: factor out FSL arch timer erratum workaround
On Thu, Jun 28, 2018 at 8:07 PM, Andre Przywara wrote: > Hi, > > On 28/06/18 15:27, Jagan Teki wrote: >> On Wed, Jun 27, 2018 at 6:12 AM, Andre Przywara >> wrote: >>> At the moment we have the workaround for the Freescale arch timer >>> erratum A-008585 merged into the generic timer_read_counter() routine. >>> Split those two up, so that we can add other errata workaround more >>> easily. Also add an explaining comment on the way. >>> >>> Signed-off-by: Andre Przywara >>> --- >>> arch/arm/cpu/armv8/generic_timer.c | 31 +-- >>> 1 file changed, 25 insertions(+), 6 deletions(-) >>> >> >> Are these these two patches are for coming release? > > Yes, please. That's an issue that needs fixing now. The bug is in all > A64 silicon, but the issue popped up with the recent commit 5ff8e54888e4 > and can be triggered quite easily: > Boot mainline U-Boot on any A64 board, and do: >> ls mmc 0:1 > on any SD card (with at least one partition defined). Then hold down the > Enter key to repeat this last command over and over again. It usually > takes less than 10 seconds to crash the board. > People reported immediate crashes under certain circumstances (GPT > partitioned SD cards): > https://bugzilla.opensuse.org/show_bug.cgi?id=1098550 Yes I would able to reproduce the issue related to GPT partitions[1] with SD card on BPI-M64 and seems like issue fixed[2] after applying these two patches. I even tried another board in eMMC partition. Tested-by: Jagan Teki [1] https://paste.ubuntu.com/p/hkHrQKXRj5/ [2] https://paste.ubuntu.com/p/JKrxC7ScNX/ Jagan. -- Jagan Teki Free Software Engineer | www.openedev.com U-Boot, Linux | Upstream Maintainer Hyderabad, India. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 2/2] arm: timer: sunxi: add Allwinner timer erratum workaround
On Wed, Jun 27, 2018 at 6:12 AM, Andre Przywara wrote: > The Allwinner A64 SoCs suffers from an arch timer implementation erratum, > where sometimes the lower 11 bits of the counter value erroneously > become all 0's or all 1's [1]. This leads to sudden jumps, both forwards and > backwards, with the latter one often showing weird behaviour. > Port the workaround proposed for Linux to U-Boot and activate it for all > A64 boards. > This fixes crashes when accessing MMC devices (SD cards), caused by a > recent change to actually use the counter value for timeout checks. > > Fixes: 5ff8e54888e4d26a352453564f7f599d29696dc9 ("sunxi: improve throughput > in the sunxi_mmc driver") > > [1] http://lists.infradead.org/pipermail/linux-arm-kernel/2018-May/576886.html > > Signed-off-by: Andre Przywara > --- Tested-by: Jagan Teki ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 1/2] arm: timer: factor out FSL arch timer erratum workaround
Hi Jagan, On 29/06/18 09:41, Jagan Teki wrote: > On Thu, Jun 28, 2018 at 8:07 PM, Andre Przywara > wrote: >> Hi, >> >> On 28/06/18 15:27, Jagan Teki wrote: >>> On Wed, Jun 27, 2018 at 6:12 AM, Andre Przywara >>> wrote: At the moment we have the workaround for the Freescale arch timer erratum A-008585 merged into the generic timer_read_counter() routine. Split those two up, so that we can add other errata workaround more easily. Also add an explaining comment on the way. Signed-off-by: Andre Przywara --- arch/arm/cpu/armv8/generic_timer.c | 31 +-- 1 file changed, 25 insertions(+), 6 deletions(-) >>> >>> Are these these two patches are for coming release? >> >> Yes, please. That's an issue that needs fixing now. The bug is in all >> A64 silicon, but the issue popped up with the recent commit 5ff8e54888e4 >> and can be triggered quite easily: >> Boot mainline U-Boot on any A64 board, and do: >>> ls mmc 0:1 >> on any SD card (with at least one partition defined). Then hold down the >> Enter key to repeat this last command over and over again. It usually >> takes less than 10 seconds to crash the board. >> People reported immediate crashes under certain circumstances (GPT >> partitioned SD cards): >> https://bugzilla.opensuse.org/show_bug.cgi?id=1098550 > > Yes I would able to reproduce the issue related to GPT partitions[1] > with SD card on BPI-M64 and seems like issue fixed[2] after applying > these two patches. I even tried another board in eMMC partition. > > Tested-by: Jagan Teki Thanks! That's much appreciated. Cheers, Andre. > [1] https://paste.ubuntu.com/p/hkHrQKXRj5/ > [2] https://paste.ubuntu.com/p/JKrxC7ScNX/ > > Jagan. > ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] sf: Enable FSR polling on N25Q256(A)
On 06/28/2018 04:29 PM, Jagan Teki wrote: > On Mon, Jun 18, 2018 at 1:18 PM, Jagan Teki wrote: >> On Tue, May 29, 2018 at 2:30 PM, Marek Vasut wrote: >>> On 05/29/2018 06:52 AM, Jagan Teki wrote: + Siva On Fri, May 25, 2018 at 1:28 AM, Marek Vasut wrote: > The N25Q256(A) datasheet clearly states that this device does have > a Flag Status Register and does update FSR PEC bit 7 during Program > and Erase cycles to indicate the cycle is in progress. Enable the > FSR PEC bit polling on this device to prevent data corruption. > > Signed-off-by: Marek Vasut > Cc: Jagan Teki > Cc: Tom Rini > --- > drivers/mtd/spi/spi_flash_ids.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/mtd/spi/spi_flash_ids.c > b/drivers/mtd/spi/spi_flash_ids.c > index 3b8f254ca2..fbc1bb6a5e 100644 > --- a/drivers/mtd/spi/spi_flash_ids.c > +++ b/drivers/mtd/spi/spi_flash_ids.c > @@ -130,8 +130,8 @@ const struct spi_flash_info spi_flash_ids[] = { > {"n25q64a",INFO(0x20bb17, 0x0, 64 * 1024, 128, RD_FULL > | WR_QPP | SECT_4K) }, > {"n25q128",INFO(0x20ba18, 0x0, 64 * 1024, 256, RD_FULL > | WR_QPP) }, > {"n25q128a", INFO(0x20bb18, 0x0, 64 * 1024, 256, RD_FULL > | WR_QPP) }, > - {"n25q256",INFO(0x20ba19, 0x0, 64 * 1024, 512, RD_FULL > | WR_QPP | SECT_4K) }, > - {"n25q256a", INFO(0x20bb19, 0x0, 64 * 1024, 512, RD_FULL > | WR_QPP | SECT_4K) }, > + {"n25q256",INFO(0x20ba19, 0x0, 64 * 1024, 512, RD_FULL > | WR_QPP | E_FSR | SECT_4K) }, > + {"n25q256a", INFO(0x20bb19, 0x0, 64 * 1024, 512, RD_FULL > | WR_QPP | E_FSR | SECT_4K) }, FSR is required to poll flag status instead of read status only from Micron n25q512 because 512 is divided into two 256 dies so FSR is used for polling each die. In case of n25q256 the flash is single entity (doesn't have die concept) so there is no need to poll FSR. This is what I understood when I add initial FSR support 0f6232801cee4f45dbdb0cec45f71172c9b617ca >>> >>> The datasheet for N25Q256A (which is probably a better reference than a >>> commit in the U-Boot tree) claims the FSR is an indication of >>> PROGRAM/ERASE completion. We use SR and FSR (if it is avaiable) to check >>> whether all of the SNOR operations finished, so if FSR is available, we >>> should use it. Plus, I have an impression that the SR polling is not >>> reliable on the N25Q256A. > > Applied to u-boot-spi/master So why did you apply this patch only now, now that it missed all RCs ? Since you seem to be quite keen on lecturing other maintainers how they should do their job, I'm really curious. -- Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v3] x86: Use microcode update from device tree for all processors
On Fri, Jun 29, 2018 at 5:06 AM, Ivan Gorinov wrote: > On Tue, Jun 26, 2018 at 03:47:49PM +0800, Bin Meng wrote: >> Hi Ivan, >> >> On Fri, Jun 22, 2018 at 12:13 PM, Bin Meng wrote: >> > Hi Ivan, >> > >> > On Fri, Jun 22, 2018 at 12:16 PM, Bin Meng wrote: >> >> From: Ivan Gorinov >> >> >> >> Built without a ROM image with FSP (u-boot.rom), the U-Boot loader applies >> >> the microcode update data block encoded in Device Tree to the bootstrap >> >> processor but not passed to the other CPUs when multiprocessing is >> >> enabled. >> >> >> >> If the bootstrap processor successfully performs a microcode update >> >> from Device Tree, use the same data block for the other processors. >> >> >> >> Signed-off-by: Ivan Gorinov >> >> Reviewed-by: Bin Meng >> >> [bmeng: fixed build errors on edison and qemu-x86] >> >> Signed-off-by: Bin Meng >> >> >> >> --- >> >> >> >> Changes in v3: >> >> - don't change arch/x86/cpu/i386/cpu.c to fix build errors on edison and >> >> qemu-x86 >> >> >> > >> > I don't think the update to arch/x86/cpu/i386/cpu.c in previous >> > version is needed as mp_params.microcode_pointer is not needed during >> > the MP boot. Please test this patch to see if it works on your board. >> > >> >> arch/x86/cpu/intel_common/car.S | 2 ++ >> >> arch/x86/cpu/intel_common/microcode.c | 10 +++--- >> >> arch/x86/include/asm/microcode.h | 1 + >> >> arch/x86/lib/fsp/fsp_car.S| 4 +++- >> >> 4 files changed, 13 insertions(+), 4 deletions(-) >> >> Did you get a chance to test this? If no issue, I will take this patch >> for v2018.07. > > No issues. Thank you! > applied to u-boot-x86, thanks! ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] sf: Enable FSR polling on N25Q256(A)
On Fri, Jun 29, 2018 at 2:02 PM, Marek Vasut wrote: > On 06/28/2018 04:29 PM, Jagan Teki wrote: >> On Mon, Jun 18, 2018 at 1:18 PM, Jagan Teki wrote: >>> On Tue, May 29, 2018 at 2:30 PM, Marek Vasut wrote: On 05/29/2018 06:52 AM, Jagan Teki wrote: > + Siva > > On Fri, May 25, 2018 at 1:28 AM, Marek Vasut wrote: >> The N25Q256(A) datasheet clearly states that this device does have >> a Flag Status Register and does update FSR PEC bit 7 during Program >> and Erase cycles to indicate the cycle is in progress. Enable the >> FSR PEC bit polling on this device to prevent data corruption. >> >> Signed-off-by: Marek Vasut >> Cc: Jagan Teki >> Cc: Tom Rini >> --- >> drivers/mtd/spi/spi_flash_ids.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/mtd/spi/spi_flash_ids.c >> b/drivers/mtd/spi/spi_flash_ids.c >> index 3b8f254ca2..fbc1bb6a5e 100644 >> --- a/drivers/mtd/spi/spi_flash_ids.c >> +++ b/drivers/mtd/spi/spi_flash_ids.c >> @@ -130,8 +130,8 @@ const struct spi_flash_info spi_flash_ids[] = { >> {"n25q64a",INFO(0x20bb17, 0x0, 64 * 1024, 128, >> RD_FULL | WR_QPP | SECT_4K) }, >> {"n25q128",INFO(0x20ba18, 0x0, 64 * 1024, 256, >> RD_FULL | WR_QPP) }, >> {"n25q128a", INFO(0x20bb18, 0x0, 64 * 1024, 256, >> RD_FULL | WR_QPP) }, >> - {"n25q256",INFO(0x20ba19, 0x0, 64 * 1024, 512, >> RD_FULL | WR_QPP | SECT_4K) }, >> - {"n25q256a", INFO(0x20bb19, 0x0, 64 * 1024, 512, >> RD_FULL | WR_QPP | SECT_4K) }, >> + {"n25q256",INFO(0x20ba19, 0x0, 64 * 1024, 512, >> RD_FULL | WR_QPP | E_FSR | SECT_4K) }, >> + {"n25q256a", INFO(0x20bb19, 0x0, 64 * 1024, 512, >> RD_FULL | WR_QPP | E_FSR | SECT_4K) }, > > FSR is required to poll flag status instead of read status only from > Micron n25q512 because 512 is divided into two 256 dies so FSR is used > for polling each die. In case of n25q256 the flash is single entity > (doesn't have die concept) so there is no need to poll FSR. > > This is what I understood when I add initial FSR support > 0f6232801cee4f45dbdb0cec45f71172c9b617ca The datasheet for N25Q256A (which is probably a better reference than a commit in the U-Boot tree) claims the FSR is an indication of PROGRAM/ERASE completion. We use SR and FSR (if it is avaiable) to check whether all of the SNOR operations finished, so if FSR is available, we should use it. Plus, I have an impression that the SR polling is not reliable on the N25Q256A. >> >> Applied to u-boot-spi/master > > So why did you apply this patch only now, now that it missed all RCs ? It's because of taking time for me to verify on hardware. ie reason I asked you about how Linux deal this. > Since you seem to be quite keen on lecturing other maintainers how they > should do their job, I'm really curious. As per as I know I commented to know why the patche apply such fast, Sorry If I made any wrong words on this. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] CONFIG_BOOTDELAY and env_default.h
I've just been digging into a problem where I've got both CONFIG_ENV_IS_NOWHERE set and CONFIG_BOOTDELAY set to -2 and it turns out in env_default.h we have: #if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0) "bootdelay="__stringify(CONFIG_BOOTDELAY) "\0" #endif So the -ve values never make it into the default environment, which means I don't have it at all when CONFIG_ENV_IS_NOWHERE. The (CONFIG_BOOTDELAY >= 0) seems to have been there forever (c609719b8d1b2dca590e0ed499016d041203e403, Sun Nov 3 00:24:07 2002 + is as far back as I've gone), but we've then changed the behaviours of the bootdelay values in (the commit I was looking at was 2fbb8462b0e18893b4b739705db047ffda82d4fc from Mon Jun 27 16:23:01 2016 +0900, but I'm not sure that's really the right one) I think we should change the code to a simple #if defined(CONFIG_BOOTDELAY) ? -- Alex Kiernan ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [for v2018.07 2/2] usb: sunxi: Use proper reg_mask for clock gate, reset
On 06/28/2018 04:10 PM, Jagan Teki wrote: > Masking clock gate, reset register bits based on the > probed controller is proper only due to the assumption > that masking should start with 0 even thought the controller > has separate PHY or shared between OTG. > > unfortunately these are fixed due to lack of separate > clock, reset drivers. > > Say for example EHCI1 - EHCI3 in the datasheet (EHCI0 is for the OTG) > so we need to start reg_mask 0 - 2. > > This patch calculated the mask, based on the register base > so that we can get the proper bits to set with respect to > probed controller. > > We even do this masking by using PHY index specifier from dt, > but dev_read_addr_size is failing for 64-bit boards. > > Signed-off-by: Jagan Teki Applied both -- Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] usb: ohci: change the NUM_EDs from 8 to 32
On 06/28/2018 07:54 PM, Zeng Tao wrote: > For ohci, the maximam supported endpoint number is 32(in and out), and > now we have used (usb_pipeendpoint(pipe) << 1) to index the specified > endpoint descritor, usb_pipeendpoint(pipe) can reach 0xf, so we need > change the NUM_EDs from 8 to 32. > > Signed-off-by: Zeng Tao > --- > drivers/usb/host/ohci.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h > index 2350831..fba78dc 100644 > --- a/drivers/usb/host/ohci.h > +++ b/drivers/usb/host/ohci.h > @@ -359,7 +359,7 @@ typedef struct > } urb_priv_t; > #define URB_DEL 1 > > -#define NUM_EDS 8/* num of preallocated endpoint descriptors */ > +#define NUM_EDS 32 /* num of preallocated endpoint descriptors */ > > #define NUM_TD 64/* we need more TDs than EDs */ Is this a bugfix for some recent patch ? -- Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] usb: ohci: change the NUM_EDs from 8 to 32
On 06/29/2018 11:47 AM, Zengtao (B) wrote: > Hi Marek: > >> -Original Message- >> From: Marek Vasut [mailto:ma...@denx.de] >> Sent: Friday, June 29, 2018 4:50 PM >> To: Zengtao (B) >> Cc: u-boot@lists.denx.de >> Subject: Re: [PATCH] usb: ohci: change the NUM_EDs from 8 to 32 >> >> On 06/28/2018 07:54 PM, Zeng Tao wrote: >>> For ohci, the maximam supported endpoint number is 32(in and out), and >>> now we have used (usb_pipeendpoint(pipe) << 1) to index the specified >>> endpoint descritor, usb_pipeendpoint(pipe) can reach 0xf, so we need >>> change the NUM_EDs from 8 to 32. >>> >>> Signed-off-by: Zeng Tao >>> --- >>> drivers/usb/host/ohci.h | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h index >>> 2350831..fba78dc 100644 >>> --- a/drivers/usb/host/ohci.h >>> +++ b/drivers/usb/host/ohci.h >>> @@ -359,7 +359,7 @@ typedef struct >>> } urb_priv_t; >>> #define URB_DEL 1 >>> >>> -#define NUM_EDS 8 /* num of preallocated endpoint descriptors */ >>> +#define NUM_EDS 32 /* num of preallocated endpoint >> descriptors */ >>> >>> #define NUM_TD 64 /* we need more TDs than EDs */ >> >> Is this a bugfix for some recent patch ? > > Yes, this is a bugfix, but the issue is introduced more than 10years ago. I presume this shows up on hisilicon soc then ? Anyway, applied -- Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 1/2] arm: timer: factor out FSL arch timer erratum workaround
On Fri, Jun 29, 2018 at 2:17 PM, Andre Przywara wrote: > Hi Jagan, > > On 29/06/18 09:41, Jagan Teki wrote: >> On Thu, Jun 28, 2018 at 8:07 PM, Andre Przywara >> wrote: >>> Hi, >>> >>> On 28/06/18 15:27, Jagan Teki wrote: On Wed, Jun 27, 2018 at 6:12 AM, Andre Przywara wrote: > At the moment we have the workaround for the Freescale arch timer > erratum A-008585 merged into the generic timer_read_counter() routine. > Split those two up, so that we can add other errata workaround more > easily. Also add an explaining comment on the way. > > Signed-off-by: Andre Przywara > --- > arch/arm/cpu/armv8/generic_timer.c | 31 +-- > 1 file changed, 25 insertions(+), 6 deletions(-) > Are these these two patches are for coming release? >>> >>> Yes, please. That's an issue that needs fixing now. The bug is in all >>> A64 silicon, but the issue popped up with the recent commit 5ff8e54888e4 >>> and can be triggered quite easily: >>> Boot mainline U-Boot on any A64 board, and do: ls mmc 0:1 >>> on any SD card (with at least one partition defined). Then hold down the >>> Enter key to repeat this last command over and over again. It usually >>> takes less than 10 seconds to crash the board. >>> People reported immediate crashes under certain circumstances (GPT >>> partitioned SD cards): >>> https://bugzilla.opensuse.org/show_bug.cgi?id=1098550 >> >> Yes I would able to reproduce the issue related to GPT partitions[1] >> with SD card on BPI-M64 and seems like issue fixed[2] after applying >> these two patches. I even tried another board in eMMC partition. >> >> Tested-by: Jagan Teki > > Thanks! That's much appreciated. UW. Hi All, If anyone has any further questions on these two patches, please let me know. Would like to apply soon. Jagan. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] fw_printenv: Don't bail out directly after one env read error
Dear Adrian, In message <20180626093759.24018-1-adrian.ra...@ni.com> you wrote: > From: Joe Hershberger > > When using a redundant environment a read error should simply mean to > not use that copy instead of giving up completely. The other copy may > be just fine. While the general idea is fine, I think we should NOT automatically read data from the backup copy, at least not without clearly letting the user know about this - and such notification should also work in automated scripts or cod calling these routines, so a plain warning message is NOT sufficient. I suggest that the default remains as is: environment read errors cause an error return of this function. But it would probably nice for recovery purposes or such to add an option to switch into some "permissive" mode - here the fall-back to the redundant copy would be permitted, and the return code should indicate what happened (read of primary env copy OK; read failed, but redundant copy could ne read; all read attemtps failed). Thanks! Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de "When anyone says `theoretically,' they really mean `not really.'" - David Parnas ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] fw_printenv: Don't bail out directly after one env read error
Dear Joe, In message you wrote: > > > When using a redundant environment a read error should simply mean to > > not use that copy instead of giving up completely. The other copy may > > be just fine. > > > > Signed-off-by: Joe Hershberger > > Signed-off-by: Ioan-Adrian Ratiu > > Hey Tom, can you pull this in? NO! Please don't!! NAK!! This patch can lead to reading incorrect (old, no longer valid) values without any way for the user to see what is happening. This must not be done! Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de "There is nothing so deadly as not to hold up to people the opportunity to do great and wonderful things, if we wish to stimulate them in an active way." - Dr. Harold Urey, Nobel Laureate in chemistry ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] fw_printenv: Don't bail out directly after one env read error
Dear Tom, In message <20180628022059.gr4...@bill-the-cat.ec.rr.com> you wrote: > > > From: Joe Hershberger > >=20 > > When using a redundant environment a read error should simply mean to > > not use that copy instead of giving up completely. The other copy may > > be just fine. > >=20 > > Signed-off-by: Joe Hershberger > > Signed-off-by: Ioan-Adrian Ratiu > > Applied to u-boot/master, thanks! Please revert. This is introducing a source for nasty, almost impossible to detect bugs! Read errors must never be ignored. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de What we anticipate seldom occurs; what we least expect generally happens. - Bengamin Disraeli ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v5 4/5] cmd: nvedit: env import can now import only variables passed as parameters
Dear Quentin, In message <322e6866c43f4515240ddca9456ee390b6f334c7.1530257385.git-series.quentin.sch...@bootlin.com> you wrote: > While the `env export` can take as parameters variables to be exported, > `env import` does not have such a mechanism of variable selection. > > Let's add the ability to add parameters at the end of the command for > variables to be imported. Thanks! > If a variable exists in the current env but not in the imported env, if > this variable is passed as a parameter to env import, the variable will > be unset. I suggest that this isNOT the default behaviour. I think most peaople would expect that this command only adds/replaces environment settings, so omitting one value should not cause unexpected behaviour. But I agree that such behaviour may also be conveniend - I suggest that we use an additional option ("-d" ?) to avtiavte it explicitly. Thanks. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de We want to create puppets that pull their own strings. - Ann Marion ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] usb: ohci: change the NUM_EDs from 8 to 32
Hi Marek: >-Original Message- >From: Marek Vasut [mailto:ma...@denx.de] >Sent: Friday, June 29, 2018 4:50 PM >To: Zengtao (B) >Cc: u-boot@lists.denx.de >Subject: Re: [PATCH] usb: ohci: change the NUM_EDs from 8 to 32 > >On 06/28/2018 07:54 PM, Zeng Tao wrote: >> For ohci, the maximam supported endpoint number is 32(in and out), and >> now we have used (usb_pipeendpoint(pipe) << 1) to index the specified >> endpoint descritor, usb_pipeendpoint(pipe) can reach 0xf, so we need >> change the NUM_EDs from 8 to 32. >> >> Signed-off-by: Zeng Tao >> --- >> drivers/usb/host/ohci.h | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h index >> 2350831..fba78dc 100644 >> --- a/drivers/usb/host/ohci.h >> +++ b/drivers/usb/host/ohci.h >> @@ -359,7 +359,7 @@ typedef struct >> } urb_priv_t; >> #define URB_DEL 1 >> >> -#define NUM_EDS 8 /* num of preallocated endpoint descriptors */ >> +#define NUM_EDS 32 /* num of preallocated endpoint >descriptors */ >> >> #define NUM_TD 64 /* we need more TDs than EDs */ > >Is this a bugfix for some recent patch ? Yes, this is a bugfix, but the issue is introduced more than 10years ago. > >-- >Best regards, >Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 1/2] arm: timer: factor out FSL arch timer erratum workaround
On 2018-06-28 16:37, Andre Przywara wrote: Hi, On 28/06/18 15:27, Jagan Teki wrote: On Wed, Jun 27, 2018 at 6:12 AM, Andre Przywara wrote: At the moment we have the workaround for the Freescale arch timer erratum A-008585 merged into the generic timer_read_counter() routine. Split those two up, so that we can add other errata workaround more easily. Also add an explaining comment on the way. Signed-off-by: Andre Przywara --- arch/arm/cpu/armv8/generic_timer.c | 31 +-- 1 file changed, 25 insertions(+), 6 deletions(-) Are these these two patches are for coming release? Yes, please. That's an issue that needs fixing now. The bug is in all A64 silicon, but the issue popped up with the recent commit 5ff8e54888e4 and can be triggered quite easily: Boot mainline U-Boot on any A64 board, and do: ls mmc 0:1 on any SD card (with at least one partition defined). Then hold down the Enter key to repeat this last command over and over again. It usually takes less than 10 seconds to crash the board. People reported immediate crashes under certain circumstances (GPT partitioned SD cards): https://bugzilla.opensuse.org/show_bug.cgi?id=1098550 Cheers, Andre. For fixing the issue we also need to add the compat to the timer in the dts so kernels will also Apply the errata. Booting is cool but if you boot a kernel that will have timer issue it's not that great. -- Emmanuel Vadot ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v3 3/3] common: Generic loader for file system
Hi, please see some comments below. On Mon, 25 Jun 2018 21:28:58 +0800 tien.fong.c...@intel.com tien.fong.c...@intel.com wrote: > +/** > + * _request_firmware_prepare - Prepare firmware struct. > + * > + * @firmware_p: Pointer to pointer to firmware image. > + * @name: Name of firmware file. > + * @dbuf: Address of buffer to load firmware into. > + * @size: Size of buffer. > + * @offset: Offset of a file for start reading into buffer. > + * > + * Return: Negative value if fail, 0 for successful. > + */ > +static int _request_firmware_prepare(struct firmware **firmware_p, > + const char *name, void *dbuf, > + size_t size, u32 offset) > +{ > + struct firmware *firmware; > + struct firmware_priv *fw_priv; > + > + *firmware_p = NULL; > + > + if (!name || name[0] == '\0') > + return -EINVAL; > + > + firmware = calloc(1, sizeof(*firmware)); > + if (!firmware) > + return -ENOMEM; > + > + fw_priv = calloc(1, sizeof(*fw_priv)); > + if (!fw_priv) { > + free(firmware); > + return -ENOMEM; > + } please add a note to API description that the API user should free() *firmware_p and *firmware_p->priv structs after usage of request_firmware_into_buf(), otherwise it will always leak memory while subsequent calls of request_firmware_into_buf() with the same *firmware_p argument. Or probably we should better allow request_firmware_into_buf() to be called multiple times with prepared *firmware_p stuct for reloading the same firmware image when needed. Then request_firmware_into_buf() should check if the given *firmware_p stuct is already initialized and must not call _request_firmware_prepare() in this case. > + > + fw_priv->name = name; > + fw_priv->offset = offset; > + firmware->data = dbuf; > + firmware->size = size; > + firmware->priv = fw_priv; > + *firmware_p = firmware; > + > + return 0; > +} -- Anatolij ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v5 4/5] cmd: nvedit: env import can now import only variables passed as parameters
Hi Wolfgang, On Fri, Jun 29, 2018 at 01:03:25PM +0200, Wolfgang Denk wrote: > Dear Quentin, > > In message > <322e6866c43f4515240ddca9456ee390b6f334c7.1530257385.git-series.quentin.sch...@bootlin.com> > you wrote: > > While the `env export` can take as parameters variables to be exported, > > `env import` does not have such a mechanism of variable selection. > > > > Let's add the ability to add parameters at the end of the command for > > variables to be imported. > > Thanks! > > > If a variable exists in the current env but not in the imported env, if > > this variable is passed as a parameter to env import, the variable will > > be unset. > > I suggest that this isNOT the default behaviour. I think most > peaople would expect that this command only adds/replaces > environment settings, so omitting one value should not cause > unexpected behaviour. > It's the default behaviour of himport_r. However, there's already a flag parameter so maybe I could just add an H_KEEP_VAR flag to keep the current default behaviour of himport_r (which is in a library) but add the feature you requested in the env import cmd, that should work I guess. > But I agree that such behaviour may also be conveniend - I suggest > that we use an additional option ("-d" ?) to avtiavte it explicitly. > There's already a -d option which basically, if I understood correctly, tells himport_r to erase the current env and use only the imported env. Let's add a -k (for H_KEEP_VAR) to tell himport_r we want to keep variables that aren't in the imported env but requested to be loaded (or present in the imported env in one of the forms `var` or `var=`). Does this make sense? Is it the way you see it implemented? Quentin signature.asc Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v5 4/5] cmd: nvedit: env import can now import only variables passed as parameters
Dear Quentin, In message <20180629121942.lm4qbfmm5ya7fsx2@qschulz> you wrote: > > > I suggest that this isNOT the default behaviour. I think most > > peaople would expect that this command only adds/replaces > > environment settings, so omitting one value should not cause > > unexpected behaviour. > > It's the default behaviour of himport_r. Hm I don't see what you mean. himport_r imports a set of new name=value pairs (in different formats); however, ther eis no way to specify a name without a value, so himport_r by itself will not delete any variables - it only overrides or adds. > However, there's already a flag parameter so maybe I could just add an > H_KEEP_VAR flag to keep the current default behaviour of himport_r > (which is in a library) but add the feature you requested in the env > import cmd, that should work I guess. > > There's already a -d option which basically, if I understood correctly, > tells himport_r to erase the current env and use only the imported env. Um... right - only with the -d option h_import_r will erase any variables - without any name list, it process _all_ variables from the import, and erase _any_ other. With a list of specified names, it seems logical to me that only this list will be processed - i. e. only these will be impoted or erased. That was what I had in mind with consistent behaviour. > Let's add a -k (for H_KEEP_VAR) to tell himport_r we want to keep > variables that aren't in the imported env but requested to be loaded (or > present in the imported env in one of the forms `var` or `var=`). > > Does this make sense? Is it the way you see it implemented? No. I think it should be done as I explained before. Only with "-d" existing variables shall be deleted, if they are not in the imported blob. Then the behaviour is all the same, only the selection of the names is different: without an argument list, it's all names, and with an argument list it's only the names in the list. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de There are very few personal problems that cannot be solved through a suitable application of high explosives. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] Writes to FAT broken by bcm2835 sdhost driver
Thank you, I should have checked the master instead of relying on what's in poky. Unrelated: now I can't load FIT image, but I don't have enough data do tell what the reason is yet. Thanks, Anton On 06/28/2018 11:49 AM, Alexander Graf wrote: > On 06/28/2018 10:53 AM, Anton Gerasimov wrote: >> [resending, forgot to subscribe from this address] >> >> Hi, >> >> For some reasons I need to save environment on RaspberryPi 3 and it >> worked well for me in older versions of u-boot, but stopped working in >> newer ones. Using bisect I figured out that the commits responsible for >> that were c8a73a26d6dd9b7d489e66529fe1412425d8f2d1 and >> caf2233b281c03e3e359061a3dfa537d8a25c273, introducing sdhost and pinctrl >> drivers respectively. >> >> Versions before these two work well wrt. writing to FAT/saving the >> environment. >> >> After these patches when compiled with rpi_3_32b_defconfig, reading >> works well, but fatwrite gives >> >> wait_transfer_complete - still waiting after 10001 retries >> >> and saveenv >> >> fsm 1, hsts 0001 > > This should be fixed in 2018.07. Please try to run with latest git. > > > Alex > -- ATS Advanced Telematic Systems was acquired by HERE Technologies Anton Gerasimov Software Engineer HERE Technologies Kantstrasse 162, 10623 Berlin, Germany ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] SoCFPGA PL330 DMA driver and ECC scrubbing
Dinh, A while ago, you posted the following patchset for SoCFPGA to add the PL330 DMA driver, and updated the SoCFPGA SDRAM init to write zeros to SDRAM to initialize the ECC bits if ECC was enabled: https://lists.denx.de/pipermail/u-boot/2016-October/269643.html I know it's been a long time, so I'll summarize some of the conversation... At the time, you had a problem with the patchset causing the SPL to fail to find the MMC. You had tracked it down to an issue with the following commit "a78cd8613204 ARM: Rework and correct barrier definitions". You and Marek discussed it a bit, but I don't think there was a real conclusion. You submitted a second version of the patchset asking for advice on debugging the issue: https://lists.denx.de/pipermail/u-boot/2016-December/275822.html No real conversation came from the second patchset, and that was the end of the patch. I was hoping we could revisit adding your patchset again. I am working on a custom SoCFPGA board with a Cyclone V and ECC SDRAM. I rebased your patchset against v2018.05 and it is working on my custom board (although I don't have an MMC). I also tested it on a SoCKit booting from an MMC (I forced it to scrub the SDRAM on the SoCKit, because it doesn't have ECC RAM), and the SoCKit finds the MMC and boots. I don't have any suggestions on why it is working now on my board and not back when you first submitted the patchset. Maybe something else was fixed in the MMC? I was hoping you and Marek could test this patch again on some different SoCFPGA boards to see if you get the same results. Regards, Jason ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] SoCFPGA PL330 DMA driver and ECC scrubbing
On 06/29/2018 04:31 PM, Jason Rush wrote: > Dinh, Hi, > A while ago, you posted the following patchset for SoCFPGA to add the PL330 > DMA driver, and updated the SoCFPGA SDRAM init to write zeros to SDRAM to > initialize the ECC bits if ECC was enabled: > > https://lists.denx.de/pipermail/u-boot/2016-October/269643.html > > I know it's been a long time, so I'll summarize some of the conversation... > > At the time, you had a problem with the patchset causing the SPL to fail to > find the MMC. You had tracked it down to an issue with the following commit > "a78cd8613204 ARM: Rework and correct barrier definitions". You and Marek > discussed it a bit, but I don't think there was a real conclusion. You > submitted a second version of the patchset asking for advice on debugging > the issue: > > https://lists.denx.de/pipermail/u-boot/2016-December/275822.html > > No real conversation came from the second patchset, and that was the end of > the patch. > > I was hoping we could revisit adding your patchset again. I am working on a > custom SoCFPGA board with a Cyclone V and ECC SDRAM. I rebased your patchset > against v2018.05 and it is working on my custom board (although I don't have > an MMC). I also tested it on a SoCKit booting from an MMC (I forced it to > scrub the SDRAM on the SoCKit, because it doesn't have ECC RAM), and the > SoCKit finds the MMC and boots. > > I don't have any suggestions on why it is working now on my board and not > back when you first submitted the patchset. Maybe something else was fixed > in the MMC? I was hoping you and Marek could test this patch again on some > different SoCFPGA boards to see if you get the same results. Look at this patch http://git.denx.de/?p=u-boot/u-boot-socfpga.git;a=commit;h=9bb8a249b292d26f152c20e3641600b3d7b3924b You likely want similar approach, it's faster then the DMA and much simpler. -- Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] SoCFPGA PL330 DMA driver and ECC scrubbing
On 6/29/2018 9:34 AM, Marek Vasut wrote: > On 06/29/2018 04:31 PM, Jason Rush wrote: >> Dinh, > Hi, > >> A while ago, you posted the following patchset for SoCFPGA to add the PL330 >> DMA driver, and updated the SoCFPGA SDRAM init to write zeros to SDRAM to >> initialize the ECC bits if ECC was enabled: >> >> https://lists.denx.de/pipermail/u-boot/2016-October/269643.html >> >> I know it's been a long time, so I'll summarize some of the conversation... >> >> At the time, you had a problem with the patchset causing the SPL to fail to >> find the MMC. You had tracked it down to an issue with the following commit >> "a78cd8613204 ARM: Rework and correct barrier definitions". You and Marek >> discussed it a bit, but I don't think there was a real conclusion. You >> submitted a second version of the patchset asking for advice on debugging >> the issue: >> >> https://lists.denx.de/pipermail/u-boot/2016-December/275822.html >> >> No real conversation came from the second patchset, and that was the end of >> the patch. >> >> I was hoping we could revisit adding your patchset again. I am working on a >> custom SoCFPGA board with a Cyclone V and ECC SDRAM. I rebased your patchset >> against v2018.05 and it is working on my custom board (although I don't have >> an MMC). I also tested it on a SoCKit booting from an MMC (I forced it to >> scrub the SDRAM on the SoCKit, because it doesn't have ECC RAM), and the >> SoCKit finds the MMC and boots. >> >> I don't have any suggestions on why it is working now on my board and not >> back when you first submitted the patchset. Maybe something else was fixed >> in the MMC? I was hoping you and Marek could test this patch again on some >> different SoCFPGA boards to see if you get the same results. > Look at this patch > http://git.denx.de/?p=u-boot/u-boot-socfpga.git;a=commit;h=9bb8a249b292d26f152c20e3641600b3d7b3924b > > You likely want similar approach, it's faster then the DMA and much simpler. > Thanks Marek. I'll give it a try. Would you be interested in a similar patch for the Gen 5? Jason ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] SoCFPGA PL330 DMA driver and ECC scrubbing
On 06/29/2018 04:44 PM, Jason Rush wrote: > On 6/29/2018 9:34 AM, Marek Vasut wrote: >> On 06/29/2018 04:31 PM, Jason Rush wrote: >>> Dinh, >> Hi, >> >>> A while ago, you posted the following patchset for SoCFPGA to add the PL330 >>> DMA driver, and updated the SoCFPGA SDRAM init to write zeros to SDRAM to >>> initialize the ECC bits if ECC was enabled: >>> >>> https://lists.denx.de/pipermail/u-boot/2016-October/269643.html >>> >>> I know it's been a long time, so I'll summarize some of the conversation... >>> >>> At the time, you had a problem with the patchset causing the SPL to fail to >>> find the MMC. You had tracked it down to an issue with the following commit >>> "a78cd8613204 ARM: Rework and correct barrier definitions". You and Marek >>> discussed it a bit, but I don't think there was a real conclusion. You >>> submitted a second version of the patchset asking for advice on debugging >>> the issue: >>> >>> https://lists.denx.de/pipermail/u-boot/2016-December/275822.html >>> >>> No real conversation came from the second patchset, and that was the end of >>> the patch. >>> >>> I was hoping we could revisit adding your patchset again. I am working on a >>> custom SoCFPGA board with a Cyclone V and ECC SDRAM. I rebased your patchset >>> against v2018.05 and it is working on my custom board (although I don't have >>> an MMC). I also tested it on a SoCKit booting from an MMC (I forced it to >>> scrub the SDRAM on the SoCKit, because it doesn't have ECC RAM), and the >>> SoCKit finds the MMC and boots. >>> >>> I don't have any suggestions on why it is working now on my board and not >>> back when you first submitted the patchset. Maybe something else was fixed >>> in the MMC? I was hoping you and Marek could test this patch again on some >>> different SoCFPGA boards to see if you get the same results. >> Look at this patch >> http://git.denx.de/?p=u-boot/u-boot-socfpga.git;a=commit;h=9bb8a249b292d26f152c20e3641600b3d7b3924b >> >> You likely want similar approach, it's faster then the DMA and much simpler. >> > Thanks Marek. I'll give it a try. Would you be interested in a similar > patch for the Gen 5? I don't have any Gen5 board which uses ECC, do you ? If so, yes, prepare a patch, it should be very similar. Make sure to measure how long it takes to scrub the memory and how much memory you have, I'd be interested in the numbers. -- Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] SoCFPGA PL330 DMA driver and ECC scrubbing
On 6/29/2018 9:52 AM, Marek Vasut wrote: > On 06/29/2018 04:44 PM, Jason Rush wrote: >> On 6/29/2018 9:34 AM, Marek Vasut wrote: >>> On 06/29/2018 04:31 PM, Jason Rush wrote: Dinh, >>> Hi, >>> A while ago, you posted the following patchset for SoCFPGA to add the PL330 DMA driver, and updated the SoCFPGA SDRAM init to write zeros to SDRAM to initialize the ECC bits if ECC was enabled: https://lists.denx.de/pipermail/u-boot/2016-October/269643.html I know it's been a long time, so I'll summarize some of the conversation... At the time, you had a problem with the patchset causing the SPL to fail to find the MMC. You had tracked it down to an issue with the following commit "a78cd8613204 ARM: Rework and correct barrier definitions". You and Marek discussed it a bit, but I don't think there was a real conclusion. You submitted a second version of the patchset asking for advice on debugging the issue: https://lists.denx.de/pipermail/u-boot/2016-December/275822.html No real conversation came from the second patchset, and that was the end of the patch. I was hoping we could revisit adding your patchset again. I am working on a custom SoCFPGA board with a Cyclone V and ECC SDRAM. I rebased your patchset against v2018.05 and it is working on my custom board (although I don't have an MMC). I also tested it on a SoCKit booting from an MMC (I forced it to scrub the SDRAM on the SoCKit, because it doesn't have ECC RAM), and the SoCKit finds the MMC and boots. I don't have any suggestions on why it is working now on my board and not back when you first submitted the patchset. Maybe something else was fixed in the MMC? I was hoping you and Marek could test this patch again on some different SoCFPGA boards to see if you get the same results. >>> Look at this patch >>> http://git.denx.de/?p=u-boot/u-boot-socfpga.git;a=commit;h=9bb8a249b292d26f152c20e3641600b3d7b3924b >>> >>> You likely want similar approach, it's faster then the DMA and much simpler. >>> >> Thanks Marek. I'll give it a try. Would you be interested in a similar >> patch for the Gen 5? > I don't have any Gen5 board which uses ECC, do you ? > If so, yes, prepare a patch, it should be very similar. > > Make sure to measure how long it takes to scrub the memory and how much > memory you have, I'd be interested in the numbers. > Looking at the master branch, it doesn't look like that code is ever being called? The sdram_init_ecc_bits() function is called from the ddr_calibration_sequence function(), but I can't find where ddr_calibration_sequence is called(). Either way, I can test it. I have a custom Cyclone V board with ECC, and the Intel Arria V SoC Dev Kit I can test it on too which I think has ECC. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] SoCFPGA PL330 DMA driver and ECC scrubbing
On 06/29/2018 05:06 PM, Jason Rush wrote: > On 6/29/2018 9:52 AM, Marek Vasut wrote: >> On 06/29/2018 04:44 PM, Jason Rush wrote: >>> On 6/29/2018 9:34 AM, Marek Vasut wrote: On 06/29/2018 04:31 PM, Jason Rush wrote: > Dinh, Hi, > A while ago, you posted the following patchset for SoCFPGA to add the > PL330 > DMA driver, and updated the SoCFPGA SDRAM init to write zeros to SDRAM to > initialize the ECC bits if ECC was enabled: > > https://lists.denx.de/pipermail/u-boot/2016-October/269643.html > > I know it's been a long time, so I'll summarize some of the > conversation... > > At the time, you had a problem with the patchset causing the SPL to fail > to > find the MMC. You had tracked it down to an issue with the following > commit > "a78cd8613204 ARM: Rework and correct barrier definitions". You and Marek > discussed it a bit, but I don't think there was a real conclusion. You > submitted a second version of the patchset asking for advice on debugging > the issue: > > https://lists.denx.de/pipermail/u-boot/2016-December/275822.html > > No real conversation came from the second patchset, and that was the end > of > the patch. > > I was hoping we could revisit adding your patchset again. I am working on > a > custom SoCFPGA board with a Cyclone V and ECC SDRAM. I rebased your > patchset > against v2018.05 and it is working on my custom board (although I don't > have > an MMC). I also tested it on a SoCKit booting from an MMC (I forced it to > scrub the SDRAM on the SoCKit, because it doesn't have ECC RAM), and the > SoCKit finds the MMC and boots. > > I don't have any suggestions on why it is working now on my board and not > back when you first submitted the patchset. Maybe something else was > fixed > in the MMC? I was hoping you and Marek could test this patch again on some > different SoCFPGA boards to see if you get the same results. Look at this patch http://git.denx.de/?p=u-boot/u-boot-socfpga.git;a=commit;h=9bb8a249b292d26f152c20e3641600b3d7b3924b You likely want similar approach, it's faster then the DMA and much simpler. >>> Thanks Marek. I'll give it a try. Would you be interested in a similar >>> patch for the Gen 5? >> I don't have any Gen5 board which uses ECC, do you ? >> If so, yes, prepare a patch, it should be very similar. >> >> Make sure to measure how long it takes to scrub the memory and how much >> memory you have, I'd be interested in the numbers. >> > Looking at the master branch, it doesn't look like that code is ever being > called? > The sdram_init_ecc_bits() function is called from the > ddr_calibration_sequence function(), > but I can't find where ddr_calibration_sequence is called(). git grep for it, it's called from somewhere in the arch/arm/mach-socfpga/ > Either way, I can test it. I have a custom Cyclone V board with ECC, and the > Intel Arria V SoC > Dev Kit I can test it on too which I think has ECC. Please do. -- Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v5 3/5] test/py: remove hacks for non-zero RAM base address in tests
On 06/29/2018 01:41 AM, Quentin Schulz wrote: Some functions have different behaviour when the given address is 0 (assumed to be NULL by the function). find_ram_base() does not return 0 anymore so it's safe to remove those offsets. Patches 1-3, Reviewed-by: Stephen Warren I assume you tested this in Travis with everything enabled and it all passed? I should test it locally on Tegra too... ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] led: bcm6328: read base address in the parent node
On 28.06.2018 15:26, Philippe Reynes wrote: > In the device tree, the address for the led is located > in the parent node (for exemple leds), not in the led node > (for exemple led@0). > > The commit "led: bcm6328: convert to use live dt" > (sha1: 899455176058d673887a762aa38853188a030af4) > change this behaviour and read the address in the led node. > > We fix this by reading the base address for led > in the parent node. > > Signed-off-by: Philippe Reynes > --- > drivers/led/led_bcm6328.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > applied to u-boot-mips, thanks. -- - Daniel signature.asc Description: OpenPGP digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] cpu: bmips: fix probe to get the address
On 22.06.2018 18:52, Philippe Reynes wrote: > In the device tree, the address for cpu is located in > the node "cpus", not in the cpu node (for exemple cpu@0). > So when probing cpu, the cpu address must be read in the > cpu parent. > > The commit "cpu: bmips: convert to use live dt" > (sha1: c444afbbefa103d567f197393d39ec0fcca21a0c) > change this behaviour and read the address in the > cpu node when probing cpu. > > We fix this by reading the address in the cpu parent. > > Signed-off-by: Philippe Reynes > --- > drivers/cpu/bmips_cpu.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > applied to u-boot-mips, thanks. -- - Daniel signature.asc Description: OpenPGP digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] MIPS: add MIPS Release 6 build coverage for Boston boards
On 01.06.2018 11:57, Daniel Schwierzeck wrote: > Now that Travis CI is building with gcc-7.3.0, we can add > build coverage for all combinations of MIPS Release 6 > instruction sets (MIPS32, MIPS64, Big Endian, Little Endian). > > Add mew default configs for Boston board for all MIPS Release 6 > variants. > > Signed-off-by: Daniel Schwierzeck > > --- > > configs/boston32r6_defconfig | 41 + > configs/boston32r6el_defconfig | 42 ++ > configs/boston64r6_defconfig | 41 + > configs/boston64r6el_defconfig | 42 ++ > 4 files changed, 166 insertions(+) > create mode 100644 configs/boston32r6_defconfig > create mode 100644 configs/boston32r6el_defconfig > create mode 100644 configs/boston64r6_defconfig > create mode 100644 configs/boston64r6el_defconfig > applied to u-boot-mips, thanks. -- - Daniel signature.asc Description: OpenPGP digital signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v5 3/5] test/py: remove hacks for non-zero RAM base address in tests
On 06/29/2018 09:25 AM, Stephen Warren wrote: On 06/29/2018 01:41 AM, Quentin Schulz wrote: Some functions have different behaviour when the given address is 0 (assumed to be NULL by the function). find_ram_base() does not return 0 anymore so it's safe to remove those offsets. Patches 1-3, Reviewed-by: Stephen Warren I assume you tested this in Travis with everything enabled and it all passed? I should test it locally on Tegra too... The series, Tested-by: Stephen Warren ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3] dm: sunxi: Use DM for MMC and SATA on all A20 boards
Generalise the change in commit 3936514b82e8 ("dm: sunxi: Move Linksprite_pcDuino3 to use DM for MMC, SATA") so it applies to all A20 boards: use the driver model for MMC and SATA, in preparation for CONFIG_BLK defaulting to y. Tested on Linksprite_pcDuino3_Nano. Signed-off-by: Adam Sampson Acked-by: Maxime Ripard --- Changes for v2: - at Maxime's suggestion, enabled by default at the Kconfig level for all A20 boards (which means the one board Simon updated previously doesn't need to specify them any more) Changes for v3: - only select DM_MMC if MMC is enabled, for boards without MMC arch/arm/mach-sunxi/Kconfig | 2 ++ configs/Linksprite_pcDuino3_defconfig | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig index a3f7723028..8f70c6750e 100644 --- a/arch/arm/mach-sunxi/Kconfig +++ b/arch/arm/mach-sunxi/Kconfig @@ -174,6 +174,8 @@ config MACH_SUN7I select CPU_V7_HAS_NONSEC select CPU_V7_HAS_VIRT select ARCH_SUPPORT_PSCI + select DM_MMC if MMC + select DM_SCSI if SCSI select DRAM_SUN4I select PHY_SUN4I_USB select SUNXI_GEN_SUN4I diff --git a/configs/Linksprite_pcDuino3_defconfig b/configs/Linksprite_pcDuino3_defconfig index d7e9c26cbf..f987cef711 100644 --- a/configs/Linksprite_pcDuino3_defconfig +++ b/configs/Linksprite_pcDuino3_defconfig @@ -13,10 +13,8 @@ CONFIG_SPL_I2C_SUPPORT=y # CONFIG_SPL_DOS_PARTITION is not set # CONFIG_SPL_EFI_PARTITION is not set CONFIG_SCSI_AHCI=y -CONFIG_DM_MMC=y CONFIG_ETH_DESIGNWARE=y CONFIG_SUN7I_GMAC=y CONFIG_SCSI=y -CONFIG_DM_SCSI=y CONFIG_USB_EHCI_HCD=y CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE=y -- 2.18.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] fw_printenv: Don't bail out directly after one env read error
On Fri, Jun 29, 2018 at 12:57:45PM +0200, Wolfgang Denk wrote: > Dear Joe, > > In message > you > wrote: > > > > > When using a redundant environment a read error should simply mean to > > > not use that copy instead of giving up completely. The other copy may > > > be just fine. > > > > > > Signed-off-by: Joe Hershberger > > > Signed-off-by: Ioan-Adrian Ratiu > > > > Hey Tom, can you pull this in? > > NO! Please don't!! > > NAK!! > > This patch can lead to reading incorrect (old, no longer valid) > values without any way for the user to see what is happening. > > This must not be done! I'm not 100% sure, after reading all of the code, if there's a problem. What we indeed do not want to do is be silent in seeing that the first environment location we read from failed. But AFAICT if flash_io returns non-zero we also output something useful to stderr, so it should be visible to the user that something went wrong. The next question is, if half of the redundant environment has failed, is the other half considered valid (so long as the crc passes) or would only the built-in be valid? I would think the other half is the valid one. -- Tom signature.asc Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 02/16] pico-imx7d: Fix common distro configuration behavior
This sets DISTRO_CONFIG and BOOTCOMMAND, as well as add a `finduuid` environment helper to allow it to properly work with Yocto Project and other distributions using extlinux autogenerated configuration files. Signed-off-by: Otavio Salvador --- configs/pico-imx7d_defconfig | 13 + include/configs/pico-imx7d.h | 1 + 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/configs/pico-imx7d_defconfig b/configs/pico-imx7d_defconfig index ef52dcb2d2..7be695c0cb 100644 --- a/configs/pico-imx7d_defconfig +++ b/configs/pico-imx7d_defconfig @@ -3,26 +3,23 @@ CONFIG_ARCH_MX7=y CONFIG_SYS_TEXT_BASE=0x8780 CONFIG_TARGET_PICO_IMX7D=y CONFIG_IMX_RDC=y +CONFIG_DISTRO_DEFAULTS=y CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/technexion/pico-imx7d/imximage.cfg" -CONFIG_HUSH_PARSER=y +CONFIG_BOOTCOMMAND="run finduuid; run distro_bootcmd" # CONFIG_CMD_BOOTD is not set -CONFIG_CMD_BOOTZ=y # CONFIG_CMD_IMI is not set # CONFIG_CMD_XIMG is not set CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y -CONFIG_CMD_PART=y CONFIG_CMD_USB=y CONFIG_CMD_USB_MASS_STORAGE=y # CONFIG_CMD_SETEXPR is not set -CONFIG_CMD_DHCP=y +# CONFIG_CMD_MII is not set CONFIG_CMD_CACHE=y -CONFIG_CMD_EXT2=y -CONFIG_CMD_EXT4=y CONFIG_CMD_EXT4_WRITE=y -CONFIG_CMD_FAT=y -CONFIG_CMD_FS_GENERIC=y +# CONFIG_ISO_PARTITION is not set +# CONFIG_EFI_PARTITION is not set CONFIG_FSL_ESDHC=y CONFIG_PHYLIB=y CONFIG_USB=y diff --git a/include/configs/pico-imx7d.h b/include/configs/pico-imx7d.h index 243c12faea..d27b925110 100644 --- a/include/configs/pico-imx7d.h +++ b/include/configs/pico-imx7d.h @@ -49,6 +49,7 @@ "ramdisk_addr_r=0x8300\0" \ "ramdiskaddr=0x8300\0" \ "scriptaddr=" __stringify(CONFIG_LOADADDR) "\0" \ + "finduuid=part uuid mmc 0:1 uuid\0" \ BOOTENV #define BOOT_TARGET_DEVICES(func) \ -- 2.18.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 01/16] pico-imx7d: Convert to distro config
From: Fabio Estevam Instead of keeping a custom environment, use a more generic approach by switching to disto config. Signed-off-by: Fabio Estevam Signed-off-by: Otavio Salvador --- include/configs/pico-imx7d.h | 55 +--- 1 file changed, 14 insertions(+), 41 deletions(-) diff --git a/include/configs/pico-imx7d.h b/include/configs/pico-imx7d.h index d2ffa70fc5..243c12faea 100644 --- a/include/configs/pico-imx7d.h +++ b/include/configs/pico-imx7d.h @@ -41,48 +41,21 @@ "console=ttymxc4\0" \ "fdt_high=0x\0" \ "initrd_high=0x\0" \ - "fdt_file=imx7d-pico-pi.dtb\0" \ + "fdtfile=imx7d-pico-pi.dtb\0" \ "fdt_addr=0x8300\0" \ - "ip_dyn=yes\0" \ - "mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \ - "mmcpart=" __stringify(CONFIG_SYS_MMC_IMG_LOAD_PART) "\0" \ - "finduuid=part uuid mmc 0:2 uuid\0" \ - "mmcargs=setenv bootargs console=${console},${baudrate} " \ - "root=PARTUUID=${uuid} rootwait rw\0" \ - "loadimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \ - "loadfdt=load mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \ - "mmcboot=echo Booting from mmc ...; " \ - "run finduuid; " \ - "run mmcargs; " \ - "if run loadfdt; then " \ - "bootz ${loadaddr} - ${fdt_addr}; " \ - "else " \ - "echo WARN: Cannot load the DT; " \ - "fi;\0" \ - "netargs=setenv bootargs console=${console},${baudrate} " \ - "root=/dev/nfs " \ - "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \ - "netboot=echo Booting from net ...; " \ - "run netargs; " \ - "if test ${ip_dyn} = yes; then " \ - "setenv get_cmd dhcp; " \ - "else " \ - "setenv get_cmd tftp; " \ - "fi; " \ - "${get_cmd} ${image}; " \ - "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \ - "bootz ${loadaddr} - ${fdt_addr}; " \ - "else " \ - "echo WARN: Cannot load the DT; " \ - "fi;\0" - -#define CONFIG_BOOTCOMMAND \ - "if mmc rescan; then " \ - "if run loadimage; then " \ - "run mmcboot; " \ - "else run netboot; " \ - "fi; " \ - "else run netboot; fi" + "fdt_addr_r=0x8300\0" \ + "kernel_addr_r=" __stringify(CONFIG_LOADADDR) "\0" \ + "pxefile_addr_r=" __stringify(CONFIG_LOADADDR) "\0" \ + "ramdisk_addr_r=0x8300\0" \ + "ramdiskaddr=0x8300\0" \ + "scriptaddr=" __stringify(CONFIG_LOADADDR) "\0" \ + BOOTENV + +#define BOOT_TARGET_DEVICES(func) \ + func(MMC, mmc, 0) \ + func(DHCP, dhcp, na) + +#include #define CONFIG_SYS_MEMTEST_START 0x8000 #define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_MEMTEST_START + 0x2000) -- 2.18.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 04/16] pico-imx7d: Add default DFU targets
Signed-off-by: Otavio Salvador --- configs/pico-imx7d_defconfig | 3 ++- include/configs/pico-imx7d.h | 7 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/configs/pico-imx7d_defconfig b/configs/pico-imx7d_defconfig index e456aedb50..04823ca439 100644 --- a/configs/pico-imx7d_defconfig +++ b/configs/pico-imx7d_defconfig @@ -9,6 +9,7 @@ CONFIG_BOOTCOMMAND="run finduuid; run distro_bootcmd" # CONFIG_CMD_BOOTD is not set # CONFIG_CMD_IMI is not set # CONFIG_CMD_XIMG is not set +CONFIG_CMD_DFU=y CONFIG_CMD_GPIO=y CONFIG_CMD_GPT=y CONFIG_CMD_I2C=y @@ -19,7 +20,7 @@ CONFIG_CMD_USB_MASS_STORAGE=y # CONFIG_CMD_MII is not set CONFIG_CMD_CACHE=y CONFIG_CMD_EXT4_WRITE=y -# CONFIG_ISO_PARTITION is not set +CONFIG_DFU_MMC=y CONFIG_FSL_ESDHC=y CONFIG_PHYLIB=y CONFIG_USB=y diff --git a/include/configs/pico-imx7d.h b/include/configs/pico-imx7d.h index 9746caae91..23ac103f13 100644 --- a/include/configs/pico-imx7d.h +++ b/include/configs/pico-imx7d.h @@ -32,6 +32,12 @@ /* MMC Config */ #define CONFIG_SYS_FSL_ESDHC_ADDR 0 +#define CONFIG_DFU_ENV_SETTINGS \ + "dfu_alt_info=u-boot raw 0x2 0x400 mmcpart 1;" \ + "/boot/zImage ext4 0 1;" \ + "/boot/imx7d-pico-pi.dtb ext4 0 1;" \ + "rootfs part 0 1\0" \ + #define CONFIG_SUPPORT_EMMC_BOOT /* eMMC specific */ #define CONFIG_SYS_MMC_IMG_LOAD_PART 1 @@ -49,6 +55,7 @@ "ramdisk_addr_r=0x8300\0" \ "ramdiskaddr=0x8300\0" \ "scriptaddr=" __stringify(CONFIG_LOADADDR) "\0" \ + CONFIG_DFU_ENV_SETTINGS \ "finduuid=part uuid mmc 0:1 uuid\0" \ "partitions=" \ "uuid_disk=${uuid_gpt_disk};" \ -- 2.18.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 03/16] pico-imx7d: Add GPT partitioning support
This allow the use of: > run setup_emmc inside of the U-Boot prompt to do the partitioning of the disk. Signed-off-by: Otavio Salvador --- configs/pico-imx7d_defconfig | 2 +- include/configs/pico-imx7d.h | 4 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/configs/pico-imx7d_defconfig b/configs/pico-imx7d_defconfig index 7be695c0cb..e456aedb50 100644 --- a/configs/pico-imx7d_defconfig +++ b/configs/pico-imx7d_defconfig @@ -10,6 +10,7 @@ CONFIG_BOOTCOMMAND="run finduuid; run distro_bootcmd" # CONFIG_CMD_IMI is not set # CONFIG_CMD_XIMG is not set CONFIG_CMD_GPIO=y +CONFIG_CMD_GPT=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y CONFIG_CMD_USB=y @@ -19,7 +20,6 @@ CONFIG_CMD_USB_MASS_STORAGE=y CONFIG_CMD_CACHE=y CONFIG_CMD_EXT4_WRITE=y # CONFIG_ISO_PARTITION is not set -# CONFIG_EFI_PARTITION is not set CONFIG_FSL_ESDHC=y CONFIG_PHYLIB=y CONFIG_USB=y diff --git a/include/configs/pico-imx7d.h b/include/configs/pico-imx7d.h index d27b925110..9746caae91 100644 --- a/include/configs/pico-imx7d.h +++ b/include/configs/pico-imx7d.h @@ -50,6 +50,10 @@ "ramdiskaddr=0x8300\0" \ "scriptaddr=" __stringify(CONFIG_LOADADDR) "\0" \ "finduuid=part uuid mmc 0:1 uuid\0" \ + "partitions=" \ + "uuid_disk=${uuid_gpt_disk};" \ + "name=rootfs,size=0,uuid=${uuid_gpt_rootfs}\0" \ + "setup_emmc=mmc dev 0; gpt write mmc 0 $partitions; reset;\0" \ BOOTENV #define BOOT_TARGET_DEVICES(func) \ -- 2.18.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 07/16] pico-imx7d: Add support for update SPL using DFU
From: Fabio Berton Add spl entry on dfu_alt_info to be able to update U-Boot with SPL for pico imx7d board. Signed-off-by: Fabio Berton Signed-off-by: Otavio Salvador --- include/configs/pico-imx7d.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/configs/pico-imx7d.h b/include/configs/pico-imx7d.h index 80abcb4d7b..f974b79b3b 100644 --- a/include/configs/pico-imx7d.h +++ b/include/configs/pico-imx7d.h @@ -33,7 +33,9 @@ #define CONFIG_SYS_FSL_ESDHC_ADDR 0 #define CONFIG_DFU_ENV_SETTINGS \ - "dfu_alt_info=u-boot raw 0x2 0x400 mmcpart 1;" \ + "dfu_alt_info=" \ + "spl raw 0x2 0x400 mmcpart 1;" \ + "u-boot raw 0x8a 0x400 mmcpart 1;" \ "/boot/zImage ext4 0 1;" \ "/boot/imx7d-pico-pi.dtb ext4 0 1;" \ "rootfs part 0 1\0" \ -- 2.18.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 08/16] pico-imx7d: Add bootmenu to choose the baseboard
Currently the baseboards do not offer a way to autodetect which one is in use, so we ask the user if no value has been set. Signed-off-by: Otavio Salvador --- configs/pico-imx7d_defconfig | 3 ++- include/configs/pico-imx7d.h | 12 +++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/configs/pico-imx7d_defconfig b/configs/pico-imx7d_defconfig index 27e5ca910a..3eb26c75d6 100644 --- a/configs/pico-imx7d_defconfig +++ b/configs/pico-imx7d_defconfig @@ -12,12 +12,13 @@ CONFIG_SPL_LIBDISK_SUPPORT=y CONFIG_IMX_RDC=y CONFIG_DISTRO_DEFAULTS=y CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg" -CONFIG_BOOTCOMMAND="run finduuid; run distro_bootcmd" +CONFIG_BOOTCOMMAND="run findfdt; run finduuid; run distro_bootcmd" CONFIG_SPL_I2C_SUPPORT=y CONFIG_SPL_USB_HOST_SUPPORT=y CONFIG_SPL_USB_GADGET_SUPPORT=y CONFIG_SPL_USB_SDP_SUPPORT=y # CONFIG_CMD_BOOTD is not set +CONFIG_CMD_BOOTMENU=y # CONFIG_CMD_IMI is not set # CONFIG_CMD_XIMG is not set CONFIG_CMD_DFU=y diff --git a/include/configs/pico-imx7d.h b/include/configs/pico-imx7d.h index f974b79b3b..94c846a395 100644 --- a/include/configs/pico-imx7d.h +++ b/include/configs/pico-imx7d.h @@ -40,6 +40,10 @@ "/boot/imx7d-pico-pi.dtb ext4 0 1;" \ "rootfs part 0 1\0" \ +#define BOOTMENU_ENV \ + "bootmenu_0=Boot using PICO-PI baseboard=" \ + "setenv fdtfile imx7d-pico-pi.dtb\0" \ + #define CONFIG_SUPPORT_EMMC_BOOT /* eMMC specific */ #define CONFIG_SYS_MMC_IMG_LOAD_PART 1 @@ -49,7 +53,8 @@ "console=ttymxc4\0" \ "fdt_high=0x\0" \ "initrd_high=0x\0" \ - "fdtfile=imx7d-pico-pi.dtb\0" \ + "fdtfile=ask\0" \ + BOOTMENU_ENV \ "fdt_addr=0x8300\0" \ "fdt_addr_r=0x8300\0" \ "kernel_addr_r=" __stringify(CONFIG_LOADADDR) "\0" \ @@ -58,6 +63,11 @@ "ramdiskaddr=0x8300\0" \ "scriptaddr=" __stringify(CONFIG_LOADADDR) "\0" \ CONFIG_DFU_ENV_SETTINGS \ + "findfdt=" \ + "if test $fdtfile = ask ; then " \ + "bootmenu -1; fi;" \ + "if test $fdtfile != ask ; then " \ + "saveenv; fi;\0" \ "finduuid=part uuid mmc 0:1 uuid\0" \ "partitions=" \ "uuid_disk=${uuid_gpt_disk};" \ -- 2.18.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 14/16] pico-imx7d: README: Use dfu-util to flash U-Boot
The DFU allows a more user friendly use as the details where the bootloader is installed are abstracted. Signed-off-by: Otavio Salvador --- board/technexion/pico-imx7d/README | 13 + 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/board/technexion/pico-imx7d/README b/board/technexion/pico-imx7d/README index 8af4effa78..9e88bc2f3d 100644 --- a/board/technexion/pico-imx7d/README +++ b/board/technexion/pico-imx7d/README @@ -35,12 +35,17 @@ Use the default environment variables: => env default -f -a => saveenv -Run the UMS command: -=> ums 0 mmc 0 +Run the DFU agent so we can flash the new images using dfu-util tool: -Transfer u-boot.imx to be flashed into the eMMC: +=> dfu 0 mmc 0 -$ sudo dd if=u-boot.imx of=/dev/sdX bs=1K seek=1; sync +Flash SPL into the eMMC: + +$ sudo dfu-util -D SPL -a spl + +Flash u-boot.img into the eMMC: + +$ sudo dfu-util -D u-boot.img -a u-boot Remove power from the pico board. -- 2.18.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 10/16] pico-imx7d: Enable CONFIG_ARMV7_BOOT_SEC_DEFAULT
From: Fabio Estevam Currently the CAAM driver fails to be probed: caam 3090.caam: Entropy delay = 3200 caam 3090.caam: failed to acquire DECO 0 caam 3090.caam: failed to instantiate RNG CAAM needs to be initialized in secure world, so enable CONFIG_ARMV7_BOOT_SEC_DEFAULT to allow the driver to probe successfully. Tested with kernel mainline version 4.17.2. Signed-off-by: Fabio Estevam Signed-off-by: Otavio Salvador --- configs/pico-imx7d_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/pico-imx7d_defconfig b/configs/pico-imx7d_defconfig index 6ea49fdee2..17fe13b625 100644 --- a/configs/pico-imx7d_defconfig +++ b/configs/pico-imx7d_defconfig @@ -9,6 +9,7 @@ CONFIG_SPL_MMC_SUPPORT=y CONFIG_SPL_SERIAL_SUPPORT=y CONFIG_SPL=y CONFIG_SPL_LIBDISK_SUPPORT=y +CONFIG_ARMV7_BOOT_SEC_DEFAULT=y CONFIG_IMX_RDC=y CONFIG_DISTRO_DEFAULTS=y CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg" -- 2.18.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 05/16] pico-imx7d: Add fastboot support
From: Fabio Estevam fastboot tool is a convenient way to flash the eMMC, so add support for it. Examples of usages: On the pico-imx7d U-Boot prompt: => fastboot 0 On the Linux PC connected via USB: 1. Retrieving the U-Boot version $ sudo fastboot getvar bootloader-version -i 0x0525 bootloader-version: U-Boot 2018.07-rc1-03888-gde846f9 finished. total time: 0.000s 2. Resetting the board $ sudo fastboot reboot -i 0x0525 (this causes the pico-imx7d to reboot) Signed-off-by: Fabio Estevam Signed-off-by: Otavio Salvador --- configs/pico-imx7d_defconfig | 7 ++- include/configs/pico-imx7d.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/configs/pico-imx7d_defconfig b/configs/pico-imx7d_defconfig index 04823ca439..bff6b9ccb8 100644 --- a/configs/pico-imx7d_defconfig +++ b/configs/pico-imx7d_defconfig @@ -21,6 +21,12 @@ CONFIG_CMD_USB_MASS_STORAGE=y CONFIG_CMD_CACHE=y CONFIG_CMD_EXT4_WRITE=y CONFIG_DFU_MMC=y +CONFIG_USB_FUNCTION_FASTBOOT=y +CONFIG_FASTBOOT_BUF_ADDR=0x8200 +CONFIG_FASTBOOT_BUF_SIZE=0x1000 +CONFIG_FASTBOOT_FLASH=y +CONFIG_FASTBOOT_FLASH_MMC_DEV=0 +CONFIG_FASTBOOT_CMD_OEM_FORMAT=y CONFIG_FSL_ESDHC=y CONFIG_PHYLIB=y CONFIG_USB=y @@ -32,5 +38,4 @@ CONFIG_USB_GADGET_MANUFACTURER="FSL" CONFIG_USB_GADGET_VENDOR_NUM=0x0525 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_CI_UDC=y -CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_OF_LIBFDT=y diff --git a/include/configs/pico-imx7d.h b/include/configs/pico-imx7d.h index 23ac103f13..a6ebb04575 100644 --- a/include/configs/pico-imx7d.h +++ b/include/configs/pico-imx7d.h @@ -60,6 +60,7 @@ "partitions=" \ "uuid_disk=${uuid_gpt_disk};" \ "name=rootfs,size=0,uuid=${uuid_gpt_rootfs}\0" \ + "fastboot_partition_alias_system=rootfs\0" \ "setup_emmc=mmc dev 0; gpt write mmc 0 $partitions; reset;\0" \ BOOTENV -- 2.18.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 06/16] pico-imx7d: Add SPL support
From: Fabio Estevam Convert pico-imx7d to SPL support. There are two variants of pico-imx7d SOMs: - One with 512MB of RAM - One with 1GB of RAM The 512MB module contains two Hynix H5TC2G63GFR-PBA. The 1GB module contains two Hynix H5TC4G63GFR-PBA. The RAM size is determined in runtime by reading GPIO1_12. While at it, also add USB Serial Download mode support as it is very helpful for loading SPL and u-boot.img via imx_usb_loader. Signed-off-by: Fabio Estevam Signed-off-by: Otavio Salvador --- arch/arm/mach-imx/mx7/Kconfig| 1 + board/technexion/pico-imx7d/Makefile | 2 +- board/technexion/pico-imx7d/imximage.cfg | 97 --- board/technexion/pico-imx7d/pico-imx7d.c | 2 +- board/technexion/pico-imx7d/spl.c| 116 +++ configs/pico-imx7d_defconfig | 14 ++- include/configs/pico-imx7d.h | 2 +- 7 files changed, 133 insertions(+), 101 deletions(-) delete mode 100644 board/technexion/pico-imx7d/imximage.cfg create mode 100644 board/technexion/pico-imx7d/spl.c diff --git a/arch/arm/mach-imx/mx7/Kconfig b/arch/arm/mach-imx/mx7/Kconfig index 2a3db860bb..a7248f1c8f 100644 --- a/arch/arm/mach-imx/mx7/Kconfig +++ b/arch/arm/mach-imx/mx7/Kconfig @@ -40,6 +40,7 @@ config TARGET_PICO_IMX7D select MX7D select DM select DM_THERMAL + select SUPPORT_SPL config TARGET_WARP7 bool "warp7" diff --git a/board/technexion/pico-imx7d/Makefile b/board/technexion/pico-imx7d/Makefile index 6cfa80368d..4ae3d606b5 100644 --- a/board/technexion/pico-imx7d/Makefile +++ b/board/technexion/pico-imx7d/Makefile @@ -1,4 +1,4 @@ # SPDX-License-Identifier: GPL-2.0+ # (C) Copyright 2017 NXP Semiconductors -obj-y := pico-imx7d.o +obj-y := pico-imx7d.o spl.o diff --git a/board/technexion/pico-imx7d/imximage.cfg b/board/technexion/pico-imx7d/imximage.cfg deleted file mode 100644 index c5caff46b4..00 --- a/board/technexion/pico-imx7d/imximage.cfg +++ /dev/null @@ -1,97 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ -/* - * Copyright (C) 2017 Freescale Semiconductor, Inc. - * - * Refer docs/README.imxmage for more details about how-to configure - * and create imximage boot image - * - * The syntax is taken as close as possible with the kwbimage - */ - -#define __ASSEMBLY__ -#include - -/* image version */ - -IMAGE_VERSION 2 - -BOOT_FROM sd - -/* Secure boot support */ -#ifdef CONFIG_SECURE_BOOT -CSF CONFIG_CSF_SIZE -#endif - -/* - * Device Configuration Data (DCD) - * - * Each entry must have the format: - * Addr-type AddressValue - * - * where: - * Addr-type register length (1,2 or 4 bytes) - * Address absolute address of the register - * value value to be stored in the register - */ - -DATA 4 0x30340004 0x4F45 -/* Clear then set bit30 to ensure exit from DDR retention */ -DATA 4 0x30360388 0x4000 -DATA 4 0x30360384 0x4000 - -DATA 4 0x30391000 0x0002 -DATA 4 0x307a 0x01040001 -DATA 4 0x307a01a0 0x8043 -DATA 4 0x307a01a4 0x00100020 -DATA 4 0x307a01a8 0x8014 -DATA 4 0x307a0064 0x00400046 -DATA 4 0x307a0490 0x0001 -DATA 4 0x307a00d0 0x00020083 -DATA 4 0x307a00d4 0x0069 -DATA 4 0x307a00dc 0x0934 -DATA 4 0x307a00e0 0x0408 -DATA 4 0x307a00e4 0x0014 -DATA 4 0x307a00f4 0x033f -DATA 4 0x307a0100 0x09081109 -DATA 4 0x307a0104 0x0007020d -DATA 4 0x307a0108 0x03040407 -DATA 4 0x307a010c 0x2006 -DATA 4 0x307a0110 0x04020205 -DATA 4 0x307a0114 0x03030202 -DATA 4 0x307a0120 0x0803 -DATA 4 0x307a0180 0x00800020 -DATA 4 0x307a0184 0x02000100 -DATA 4 0x307a0190 0x02098204 -DATA 4 0x307a0194 0x00030303 -DATA 4 0x307a0200 0x0016 -DATA 4 0x307a0204 0x00080808 -DATA 4 0x307a0210 0x0f0f -DATA 4 0x307a0214 0x07070707 -DATA 4 0x307a0218 0x0f070707 -DATA 4 0x307a0240 0x06000604 -DATA 4 0x307a0244 0x0001 -DATA 4 0x30391000 0x -DATA 4 0x3079 0x17420f40 -DATA 4 0x30790004 0x10210100 -DATA 4 0x30790010 0x00060807 -DATA 4 0x307900b0 0x1010007e -DATA 4 0x3079009c 0x0b24 -DATA 4 0x30790020 0x08080808 -DATA 4 0x30790030 0x08080808 -DATA 4 0x30790050 0x0110 -DATA 4 0x30790050 0x0010 - -DATA 4 0x307900c0 0x0e407304 -DATA 4 0x307900c0 0x0e447304 -DATA 4 0x307900c0 0x0e447306 - -CHECK_BITS_SET 4 0x307900c4 0x1 - -DATA 4 0x307900c0 0x0e407304 - -DATA 4 0x30384130 0x -DATA 4 0x30340020 0x0178 -DATA 4 0x30384130 0x0002 -DATA 4 0x30790018 0x000f - -CHECK_BITS_SET 4 0x307a0004 0x1 diff --git a/board/technexion/pico-imx7d/pico-imx7d.c b/board/technexion/pico-imx7d/pico-imx7d.c index 44c81ecdb3..0767d0462f 100644 --- a/board/technexion/pico-imx7d/pico-imx7d.c +++ b/board/technexion/pico-imx7d/pico-imx7d.c @@ -58,7 +58,7 @@ static struct i2c_pads_info i2c_pad_info4 = { int dram_init(void) { - gd->ram_size = PHYS_SDRAM_SIZE; + gd->ram_size = imx_ddr_size(); return 0; } diff --git a/board/technexion/pico-imx7d/spl.c b/board/technexion/pico-imx7d/spl.c n
[U-Boot] [PATCH 15/16] pico-imx7d: README: Drop old instructions about secure mode
Our default config already has the secure mode supported, so the manual step is not required anymore. Signed-off-by: Otavio Salvador --- board/technexion/pico-imx7d/README | 17 - 1 file changed, 17 deletions(-) diff --git a/board/technexion/pico-imx7d/README b/board/technexion/pico-imx7d/README index 9e88bc2f3d..aa9d72c5d1 100644 --- a/board/technexion/pico-imx7d/README +++ b/board/technexion/pico-imx7d/README @@ -52,20 +52,3 @@ Remove power from the pico board. Put pico board into normal boot mode. Power up the board and the new updated U-Boot should boot from eMMC. - -Building U-Boot to boot with NXP 4.1 kernel: - -The NXP 4.1 kernel boots only in secure boot mode on mx7. - -Follow the next steps to enable secure boot: - -$ make mrproper -$ make pico-imx7d_defconfig -$ make menuconfig - -> ARM architecture - -> [*] Enable support for booting in non-secure mode - -> [*] Boot in secure mode by default - -> Exit -$ make - -Flash u-boot.imx using the imx_usb_loader tool. -- 2.18.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 12/16] pico-imx7d: Allow default fdtfile to be overridden by defconfig
This allow the addition of extra default configurations for each baseboard, removing the boot menu when user boots for the first time. Signed-off-by: Otavio Salvador --- configs/pico-imx7d_defconfig | 1 + include/configs/pico-imx7d.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/configs/pico-imx7d_defconfig b/configs/pico-imx7d_defconfig index 17fe13b625..af2a776005 100644 --- a/configs/pico-imx7d_defconfig +++ b/configs/pico-imx7d_defconfig @@ -14,6 +14,7 @@ CONFIG_IMX_RDC=y CONFIG_DISTRO_DEFAULTS=y CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg" CONFIG_BOOTCOMMAND="run findfdt; run finduuid; run distro_bootcmd" +CONFIG_DEFAULT_FDT_FILE="ask" CONFIG_SPL_I2C_SUPPORT=y CONFIG_SPL_USB_HOST_SUPPORT=y CONFIG_SPL_USB_GADGET_SUPPORT=y diff --git a/include/configs/pico-imx7d.h b/include/configs/pico-imx7d.h index 8f1876c8b2..13e735379e 100644 --- a/include/configs/pico-imx7d.h +++ b/include/configs/pico-imx7d.h @@ -65,7 +65,7 @@ "console=ttymxc4\0" \ "fdt_high=0x\0" \ "initrd_high=0x\0" \ - "fdtfile=ask\0" \ + "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \ BOOTMENU_ENV \ "fdt_addr=0x8300\0" \ "fdt_addr_r=0x8300\0" \ -- 2.18.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 13/16] pico-imx7d: Enable auxiliary code support
This enables the "bootaux" command so a firmware can be loaded inside the M4 MCU. Signed-off-by: Otavio Salvador --- configs/pico-imx7d_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/pico-imx7d_defconfig b/configs/pico-imx7d_defconfig index af2a776005..57312b1fcb 100644 --- a/configs/pico-imx7d_defconfig +++ b/configs/pico-imx7d_defconfig @@ -11,6 +11,7 @@ CONFIG_SPL=y CONFIG_SPL_LIBDISK_SUPPORT=y CONFIG_ARMV7_BOOT_SEC_DEFAULT=y CONFIG_IMX_RDC=y +CONFIG_IMX_BOOTAUX=y CONFIG_DISTRO_DEFAULTS=y CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg" CONFIG_BOOTCOMMAND="run findfdt; run finduuid; run distro_bootcmd" -- 2.18.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 11/16] pico-imx7d: Do not override addrmap5
From: Fabio Estevam The addrmap5 value is the same for the 512MB and 1GB variants, so there is no need to override it. Signed-off-by: Fabio Estevam Signed-off-by: Otavio Salvador --- board/technexion/pico-imx7d/spl.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/board/technexion/pico-imx7d/spl.c b/board/technexion/pico-imx7d/spl.c index a5463ee68b..8c3443875d 100644 --- a/board/technexion/pico-imx7d/spl.c +++ b/board/technexion/pico-imx7d/spl.c @@ -97,10 +97,8 @@ static bool is_1g(void) static void ddr_init(void) { - if (is_1g()) { - ddrc_regs_val.addrmap5 = 0x07070707; + if (is_1g()) ddrc_regs_val.addrmap6 = 0x0f070707; - } mx7_dram_cfg(&ddrc_regs_val, &ddrc_mp_val, &ddr_phy_regs_val, &calib_param); -- 2.18.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 09/16] pico-imx7d: Add Falcon mode support
From: Fabio Estevam Falcon mode boots the kernel directly from SPL, without loading the full U-Boot. As pico-imx7d does not have a GPIO for selecting Falcon versus normal mode, enter in Falcon mode when the customer selects the CONFIG_SPL_OS_BOOT option in menuconfig. Signed-off-by: Fabio Estevam Signed-off-by: Otavio Salvador --- board/technexion/pico-imx7d/spl.c | 8 configs/pico-imx7d_defconfig | 2 ++ include/configs/pico-imx7d.h | 12 3 files changed, 22 insertions(+) diff --git a/board/technexion/pico-imx7d/spl.c b/board/technexion/pico-imx7d/spl.c index 14d96cb0c5..a5463ee68b 100644 --- a/board/technexion/pico-imx7d/spl.c +++ b/board/technexion/pico-imx7d/spl.c @@ -13,6 +13,14 @@ #include #if defined(CONFIG_SPL_BUILD) + +#ifdef CONFIG_SPL_OS_BOOT +int spl_start_uboot(void) +{ + return 0; +} +#endif + static struct ddrc ddrc_regs_val = { .mstr = 0x01040001, .rfshtmg= 0x00400046, diff --git a/configs/pico-imx7d_defconfig b/configs/pico-imx7d_defconfig index 3eb26c75d6..6ea49fdee2 100644 --- a/configs/pico-imx7d_defconfig +++ b/configs/pico-imx7d_defconfig @@ -21,6 +21,8 @@ CONFIG_SPL_USB_SDP_SUPPORT=y CONFIG_CMD_BOOTMENU=y # CONFIG_CMD_IMI is not set # CONFIG_CMD_XIMG is not set +CONFIG_CMD_SPL=y +CONFIG_CMD_SPL_WRITE_SIZE=0x2 CONFIG_CMD_DFU=y CONFIG_CMD_GPIO=y CONFIG_CMD_GPT=y diff --git a/include/configs/pico-imx7d.h b/include/configs/pico-imx7d.h index 94c846a395..8f1876c8b2 100644 --- a/include/configs/pico-imx7d.h +++ b/include/configs/pico-imx7d.h @@ -12,6 +12,18 @@ #include "imx7_spl.h" +#ifdef CONFIG_SPL_OS_BOOT +/* Falcon Mode */ +#define CONFIG_SPL_FS_LOAD_ARGS_NAME "args" +#define CONFIG_SPL_FS_LOAD_KERNEL_NAME "uImage" +#define CONFIG_SYS_SPL_ARGS_ADDR 0x8800 + +/* Falcon Mode - MMC support: args@1MB kernel@2MB */ +#define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR 0x800 /* 1MB */ +#define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS (CONFIG_CMD_SPL_WRITE_SIZE / 512) +#define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR0x1000 /* 2MB */ +#endif + /* Size of malloc() pool */ #define CONFIG_SYS_MALLOC_LEN (32 * SZ_1M) -- 2.18.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 16/16] pico-imx7d: Add new pico-pi config
The new config skips the boot menu which asks which board is in use. This is useful to allow direct booting of image without user iteration. Signed-off-by: Otavio Salvador --- configs/pico-pi-imx7d_defconfig | 59 + 1 file changed, 59 insertions(+) create mode 100644 configs/pico-pi-imx7d_defconfig diff --git a/configs/pico-pi-imx7d_defconfig b/configs/pico-pi-imx7d_defconfig new file mode 100644 index 00..2e72572829 --- /dev/null +++ b/configs/pico-pi-imx7d_defconfig @@ -0,0 +1,59 @@ +CONFIG_ARM=y +CONFIG_ARCH_MX7=y +CONFIG_SYS_TEXT_BASE=0x8780 +CONFIG_SPL_GPIO_SUPPORT=y +CONFIG_SPL_LIBCOMMON_SUPPORT=y +CONFIG_SPL_LIBGENERIC_SUPPORT=y +CONFIG_TARGET_PICO_IMX7D=y +CONFIG_SPL_MMC_SUPPORT=y +CONFIG_SPL_SERIAL_SUPPORT=y +CONFIG_SPL=y +CONFIG_SPL_LIBDISK_SUPPORT=y +CONFIG_ARMV7_BOOT_SEC_DEFAULT=y +CONFIG_IMX_RDC=y +CONFIG_IMX_BOOTAUX=y +CONFIG_DISTRO_DEFAULTS=y +CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg" +CONFIG_BOOTCOMMAND="run findfdt; run finduuid; run distro_bootcmd" +CONFIG_DEFAULT_FDT_FILE="imx7d-pico-pi.dtb" +CONFIG_SPL_I2C_SUPPORT=y +CONFIG_SPL_USB_HOST_SUPPORT=y +CONFIG_SPL_USB_GADGET_SUPPORT=y +CONFIG_SPL_USB_SDP_SUPPORT=y +# CONFIG_CMD_BOOTD is not set +CONFIG_CMD_BOOTMENU=y +# CONFIG_CMD_IMI is not set +# CONFIG_CMD_XIMG is not set +CONFIG_CMD_SPL=y +CONFIG_CMD_SPL_WRITE_SIZE=0x2 +CONFIG_CMD_DFU=y +CONFIG_CMD_GPIO=y +CONFIG_CMD_GPT=y +CONFIG_CMD_I2C=y +CONFIG_CMD_MMC=y +CONFIG_CMD_USB=y +CONFIG_CMD_USB_SDP=y +CONFIG_CMD_USB_MASS_STORAGE=y +# CONFIG_CMD_SETEXPR is not set +# CONFIG_CMD_MII is not set +CONFIG_CMD_CACHE=y +CONFIG_CMD_EXT4_WRITE=y +CONFIG_DFU_MMC=y +CONFIG_USB_FUNCTION_FASTBOOT=y +CONFIG_FASTBOOT_BUF_ADDR=0x8200 +CONFIG_FASTBOOT_BUF_SIZE=0x1000 +CONFIG_FASTBOOT_FLASH=y +CONFIG_FASTBOOT_FLASH_MMC_DEV=0 +CONFIG_FASTBOOT_CMD_OEM_FORMAT=y +CONFIG_FSL_ESDHC=y +CONFIG_PHYLIB=y +CONFIG_USB=y +CONFIG_USB_EHCI_HCD=y +CONFIG_MXC_USB_OTG_HACTIVE=y +CONFIG_USB_STORAGE=y +CONFIG_USB_GADGET=y +CONFIG_USB_GADGET_MANUFACTURER="FSL" +CONFIG_USB_GADGET_VENDOR_NUM=0x0525 +CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 +CONFIG_CI_UDC=y +CONFIG_OF_LIBFDT=y -- 2.18.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2] cmd: fastboot: Validate user input
In case when user provides '-' as USB controller index, like this: => fastboot - data abort occurs in strcmp() function in do_fastboot(), here: if (!strcmp(argv[1], "udp")) (tested on BeagleBone Black). That's because argv[1] is NULL when user types in the '-', and null pointer dereference occurs in strcmp() (which is ok according to C standard specification). So we must validate user input to prevent such behavior. While at it, check also the result of strtoul() function and handle error cases properly. Signed-off-by: Sam Protsenko --- Changes for v2: - replace argv check with argc check - add mentioning of testing platform in commit message cmd/fastboot.c | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/cmd/fastboot.c b/cmd/fastboot.c index e6ae0570d5..ae3a5f627f 100644 --- a/cmd/fastboot.c +++ b/cmd/fastboot.c @@ -38,13 +38,18 @@ static int do_fastboot_usb(int argc, char *const argv[], #if CONFIG_IS_ENABLED(USB_FUNCTION_FASTBOOT) int controller_index; char *usb_controller; + char *endp; int ret; if (argc < 2) return CMD_RET_USAGE; usb_controller = argv[1]; - controller_index = simple_strtoul(usb_controller, NULL, 0); + controller_index = simple_strtoul(usb_controller, &endp, 0); + if (*endp != '\0') { + pr_err("Error: Wrong USB controller index format\n"); + return CMD_RET_FAILURE; + } ret = board_usb_init(controller_index, USB_INIT_DEVICE); if (ret) { @@ -120,6 +125,12 @@ NXTARG: ; } + /* Handle case when USB controller param is just '-' */ + if (argc == 1) { + pr_err("Error: Incorrect USB controller index\n"); + return CMD_RET_USAGE; + } + fastboot_init((void *)buf_addr, buf_size); if (!strcmp(argv[1], "udp")) -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] cmd: fastboot: Validate user input
Hi Simon, On 27 June 2018 at 02:18, Simon Glass wrote: > Hi Sam, > > On 26 June 2018 at 10:20, Sam Protsenko wrote: >> In case when user provides '-' as USB controller index, like this: >> >> => fastboot - >> >> data abort occurs in strcmp() function in do_fastboot(), here: >> >> if (!strcmp(argv[1], "udp")) >> >> That's because argv[1] is NULL when user types in the '-', and null >> pointer dereference occurs in strcmp() (which is ok according to C >> standard specification). So we must validate user input to prevent such >> behavior. >> >> While at it, check also the result of strtoul() function and handle >> error cases properly. >> >> Signed-off-by: Sam Protsenko >> --- >> cmd/fastboot.c | 13 - >> 1 file changed, 12 insertions(+), 1 deletion(-) > > Reviewed-by: Simon Glass > > Question below. > >> >> diff --git a/cmd/fastboot.c b/cmd/fastboot.c >> index e6ae0570d5..dab686eef4 100644 >> --- a/cmd/fastboot.c >> +++ b/cmd/fastboot.c >> @@ -38,13 +38,18 @@ static int do_fastboot_usb(int argc, char *const argv[], >> #if CONFIG_IS_ENABLED(USB_FUNCTION_FASTBOOT) >> int controller_index; >> char *usb_controller; >> + char *endp; >> int ret; >> >> if (argc < 2) >> return CMD_RET_USAGE; >> >> usb_controller = argv[1]; >> - controller_index = simple_strtoul(usb_controller, NULL, 0); >> + controller_index = simple_strtoul(usb_controller, &endp, 0); >> + if (*endp != '\0') { >> + pr_err("Error: Wrong USB controller index format\n"); >> + return CMD_RET_FAILURE; >> + } >> >> ret = board_usb_init(controller_index, USB_INIT_DEVICE); >> if (ret) { >> @@ -120,6 +125,12 @@ NXTARG: >> ; >> } >> >> + /* Handle case when USB controller param is just '-' */ >> + if (!argv[1]) { > > Can you check argc instead? I think that is nicer. > You are right. Code above my changes modifies the argc w.r.t. argv, so we can check if argc == 1, and this would be the error case. I just sent the v2. Thanks for reviewing. >> + pr_err("Error: Incorrect USB controller index\n"); >> + return CMD_RET_USAGE; >> + } >> + >> fastboot_init((void *)buf_addr, buf_size); >> >> if (!strcmp(argv[1], "udp")) >> -- >> 2.17.1 >> ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 0/2] dm: Complete CONFIG_BLK migration
On Thu, Jun 28, 2018 at 09:30:19PM -0500, Derald D. Woods wrote: > On Thu, Jun 28, 2018 at 10:47:36AM -0500, Adam Ford wrote: > > On Wed, Jun 27, 2018 at 4:41 PM Tom Rini wrote: > > > > > > On Sat, Jun 23, 2018 at 07:59:30AM -0600, Simon Glass wrote: > > > > The time has come to migrate all boards to use CONFIG_BLK. This series > > > > is just a test to see what boards would have to be removed if we > > > > required > > > > CONFIG_BLK, as we plan to after the next release. > > > > > > > > This should help maintainers see what is impacted. > > > > > > > > Hopefully maintainers will be able to convert their boards over in the > > > > next month so we we can avoid having to remove any boards. > > > > > > > > The goal is to have all boards use driver model. But so far, we do allow > > > > CONFIG_DM to not be defined. > > > > > > > > > > > > For 'Force BLK', here is the buildman output showing failed boards and > > > > the > > > > relatively small number of command errors: > > > > > > > > 03: Force BLK > > > > mips: + pic32mzdask > > > >arm: + mixtile_loftq colibri_imx6_nospl sniper omap3_zoom1 > > > > tbs2910 Mele_A1000G_quad > > > > am335x_igep003x mx6ul_14x14_evk mk802_a10s am43xx_hs_evm devkit3250 > > > > pcm051_rev3 > > > > am57xx_hs_evm Empire_electronix_m712 Auxtek-T003 pcm058 zc5202 > > > > am335x_shc > > > > am335x_shc_ict Hummingbird_A31 vining_2000 am335x_evm_usbspl ot1200_spl > > > > igep00x0 > > > > Mele_I7 Wobo_i5 r7-tv-dongle liteboard omap3_overo am335x_boneblack > > > > evb-ast2500 > > > > warp7 gwventana_gw5904 cairo A13-OLinuXinoM mccmon6_sd > > > > apalis_imx6_nospl_it > > > > wandboard birdland_bav335a colibri_imx7 colibri_imx6 inet_q972 > > > > xpress_spl > > > > stm32f429-evaluation udoo_neo igep0032 Mele_M9 A13-OLinuXino > > > > inet98v_rev2 > > > > A10s-OLinuXino-M riotboard snapper9260 am43xx_evm pfla02 mx6qsabrelite > > > > apalis_imx6_nospl_com s5p_goni colibri_pxa270 snapper9g20 > > > > Yones_Toptech_BS1078_V2 am335x_shc_sdboot_prompt k2g_hs_evm cl-som-imx7 > > > > am335x_shc_sdboot vf610twr_nand stm32f469-discovery am335x_evm_nor > > > > mx53cx9020 > > > > Empire_electronix_d709 vf610twr cm_t43 pengwyn stm32f746-disco > > > > Sinovoip_BPI_M2 > > > > Sinovoip_BPI_M3 Sinlinx_SinA31s pico-imx7d am43xx_evm_rtconly > > > > LicheePi_Zero > > > > pcm051_rev1 mccmon6_nor mx6sabreauto display5_factory am335x_shc_prompt > > > > gwventana_nand Bananapi_M2_Ultra Auxtek-T004 tbs_a711 cm_t335 > > > > h8_homlet_v2 > > > > Colombus am43xx_evm_usbhost_boot chiliboard am335x_baltos colibri_vf > > > > mx6ul_9x9_evk kp_imx6q_tpc bk4r1 udoo difrnce_dit4350 am335x_evm_norboot > > > > UTOO_P66 iNet_86VS marsboard MSI_Primo81 apalis_imx6 bananapi_m2_berry > > > > xilinx_zynqmp_r5 birdland_bav335b am43xx_evm_qspiboot CSQ_CS908 Ampe_A76 > > > > kp_imx53 am335x_evm_spiboot Cubietruck_plus k2g_evm mx6sabresd > > > > omap3_logic > > > > pepper colorfly_e708_q1 pcm052 gwventana_emmc am335x_boneblack_vboot > > > > am335x_shc_netboot xpress ot1200 cgtqmx6eval zc5601 devkit8000 dh_imx6 > > > > mx6cuboxi > > > > am57xx_evm am335x_sl50 q8_a13_tablet sksimx6 > > > > > > > > microblaze: + microblaze-generic > > > >powerpc: + P1010RDB-PA_36BIT_NOR_SECBOOT > > > > BSC9132QDS_SDCARD_DDRCLK100_SECURE > > > > P1010RDB-PB_SPIFLASH_SECBOOT T1024QDS_DDR4_SECURE_BOOT > > > > controlcenterd_36BIT_SDCARD BSC9132QDS_SDCARD_DDRCLK133_SECURE > > > > P1010RDB-PA_SPIFLASH_SECBOOT BSC9132QDS_NAND_DDRCLK133_SECURE > > > > P1010RDB-PA_36BIT_SPIFLASH_SECBOOT P2041RDB_SECURE_BOOT > > > > P5020DS_NAND_SECURE_BOOT > > > > P1010RDB-PB_36BIT_NOR_SECBOOT BSC9132QDS_NOR_DDRCLK100_SECURE > > > > P3041DS_SECURE_BOOT T1042D4RDB_SECURE_BOOT T1042RDB_SECURE_BOOT > > > > T4240QDS_SECURE_BOOT P1010RDB-PB_36BIT_SPIFLASH_SECBOOT > > > > P1010RDB-PB_NAND_SECBOOT > > > > BSC9132QDS_SPIFLASH_DDRCLK100_SECURE P3041DS_NAND_SECURE_BOOT > > > > T4160QDS_SECURE_BOOT T2080RDB_SECURE_BOOT B4860QDS_SECURE_BOOT > > > > P4080DS_SECURE_BOOT T2080QDS_SECURE_BOOT P5040DS_SECURE_BOOT > > > > P1010RDB-PB_36BIT_NAND_SECBOOT controlcenterd_36BIT_SDCARD_DEVELOP > > > > P1010RDB-PA_NAND_SECBOOT BSC9132QDS_SPIFLASH_DDRCLK133_SECURE > > > > P1010RDB-PA_NOR_SECBOOT controlcenterd_TRAILBLAZER_DEVELOP > > > > P5020DS_SECURE_BOOT > > > > T1024QDS_SECURE_BOOT T1040QDS_SECURE_BOOT > > > > BSC9132QDS_NOR_DDRCLK133_SECURE > > > > T1024RDB_SECURE_BOOT P5040DS_NAND_SECURE_BOOT > > > > P1010RDB-PA_36BIT_NAND_SECBOOT > > > > T1042RDB_PI_NAND_SECURE_BOOT T1040RDB_SECURE_BOOT T1040D4RDB_SECURE_BOOT > > > > BSC9132QDS_NAND_DDRCLK100_SECURE P1010RDB-PB_NOR_SECBOOT > > > > T1023RDB_SECURE_BOOT > > > > controlcenterd_TRAILBLAZER > > > > > > So, how are the maintainers CC'd on this feeling about the deadline? It > > > was supposed to be 2018.05, but it's looking like we would enforce it > > > for 2018.09 at this point in time. > > > > I looked at the omap3_logic board, and if I turned on the CONFIG_BLK > > option, some items in USB break. >
Re: [U-Boot] [PATCH 0/2] dm: Complete CONFIG_BLK migration
On Fri, Jun 29, 2018 at 2:09 PM Tom Rini wrote: > > On Thu, Jun 28, 2018 at 09:30:19PM -0500, Derald D. Woods wrote: > > On Thu, Jun 28, 2018 at 10:47:36AM -0500, Adam Ford wrote: > > > On Wed, Jun 27, 2018 at 4:41 PM Tom Rini wrote: > > > > > > > > On Sat, Jun 23, 2018 at 07:59:30AM -0600, Simon Glass wrote: > > > > > The time has come to migrate all boards to use CONFIG_BLK. This series > > > > > is just a test to see what boards would have to be removed if we > > > > > required > > > > > CONFIG_BLK, as we plan to after the next release. > > > > > > > > > > This should help maintainers see what is impacted. > > > > > > > > > > Hopefully maintainers will be able to convert their boards over in the > > > > > next month so we we can avoid having to remove any boards. > > > > > > > > > > The goal is to have all boards use driver model. But so far, we do > > > > > allow > > > > > CONFIG_DM to not be defined. > > > > > > > > > > > > > > > For 'Force BLK', here is the buildman output showing failed boards > > > > > and the > > > > > relatively small number of command errors: > > > > > > > > > > 03: Force BLK > > > > > mips: + pic32mzdask > > > > >arm: + mixtile_loftq colibri_imx6_nospl sniper omap3_zoom1 > > > > > tbs2910 Mele_A1000G_quad > > > > > am335x_igep003x mx6ul_14x14_evk mk802_a10s am43xx_hs_evm devkit3250 > > > > > pcm051_rev3 > > > > > am57xx_hs_evm Empire_electronix_m712 Auxtek-T003 pcm058 zc5202 > > > > > am335x_shc > > > > > am335x_shc_ict Hummingbird_A31 vining_2000 am335x_evm_usbspl > > > > > ot1200_spl igep00x0 > > > > > Mele_I7 Wobo_i5 r7-tv-dongle liteboard omap3_overo am335x_boneblack > > > > > evb-ast2500 > > > > > warp7 gwventana_gw5904 cairo A13-OLinuXinoM mccmon6_sd > > > > > apalis_imx6_nospl_it > > > > > wandboard birdland_bav335a colibri_imx7 colibri_imx6 inet_q972 > > > > > xpress_spl > > > > > stm32f429-evaluation udoo_neo igep0032 Mele_M9 A13-OLinuXino > > > > > inet98v_rev2 > > > > > A10s-OLinuXino-M riotboard snapper9260 am43xx_evm pfla02 mx6qsabrelite > > > > > apalis_imx6_nospl_com s5p_goni colibri_pxa270 snapper9g20 > > > > > Yones_Toptech_BS1078_V2 am335x_shc_sdboot_prompt k2g_hs_evm > > > > > cl-som-imx7 > > > > > am335x_shc_sdboot vf610twr_nand stm32f469-discovery am335x_evm_nor > > > > > mx53cx9020 > > > > > Empire_electronix_d709 vf610twr cm_t43 pengwyn stm32f746-disco > > > > > Sinovoip_BPI_M2 > > > > > Sinovoip_BPI_M3 Sinlinx_SinA31s pico-imx7d am43xx_evm_rtconly > > > > > LicheePi_Zero > > > > > pcm051_rev1 mccmon6_nor mx6sabreauto display5_factory > > > > > am335x_shc_prompt > > > > > gwventana_nand Bananapi_M2_Ultra Auxtek-T004 tbs_a711 cm_t335 > > > > > h8_homlet_v2 > > > > > Colombus am43xx_evm_usbhost_boot chiliboard am335x_baltos colibri_vf > > > > > mx6ul_9x9_evk kp_imx6q_tpc bk4r1 udoo difrnce_dit4350 > > > > > am335x_evm_norboot > > > > > UTOO_P66 iNet_86VS marsboard MSI_Primo81 apalis_imx6 bananapi_m2_berry > > > > > xilinx_zynqmp_r5 birdland_bav335b am43xx_evm_qspiboot CSQ_CS908 > > > > > Ampe_A76 > > > > > kp_imx53 am335x_evm_spiboot Cubietruck_plus k2g_evm mx6sabresd > > > > > omap3_logic > > > > > pepper colorfly_e708_q1 pcm052 gwventana_emmc am335x_boneblack_vboot > > > > > am335x_shc_netboot xpress ot1200 cgtqmx6eval zc5601 devkit8000 > > > > > dh_imx6 mx6cuboxi > > > > > am57xx_evm am335x_sl50 q8_a13_tablet sksimx6 > > > > > > > > > > microblaze: + microblaze-generic > > > > >powerpc: + P1010RDB-PA_36BIT_NOR_SECBOOT > > > > > BSC9132QDS_SDCARD_DDRCLK100_SECURE > > > > > P1010RDB-PB_SPIFLASH_SECBOOT T1024QDS_DDR4_SECURE_BOOT > > > > > controlcenterd_36BIT_SDCARD BSC9132QDS_SDCARD_DDRCLK133_SECURE > > > > > P1010RDB-PA_SPIFLASH_SECBOOT BSC9132QDS_NAND_DDRCLK133_SECURE > > > > > P1010RDB-PA_36BIT_SPIFLASH_SECBOOT P2041RDB_SECURE_BOOT > > > > > P5020DS_NAND_SECURE_BOOT > > > > > P1010RDB-PB_36BIT_NOR_SECBOOT BSC9132QDS_NOR_DDRCLK100_SECURE > > > > > P3041DS_SECURE_BOOT T1042D4RDB_SECURE_BOOT T1042RDB_SECURE_BOOT > > > > > T4240QDS_SECURE_BOOT P1010RDB-PB_36BIT_SPIFLASH_SECBOOT > > > > > P1010RDB-PB_NAND_SECBOOT > > > > > BSC9132QDS_SPIFLASH_DDRCLK100_SECURE P3041DS_NAND_SECURE_BOOT > > > > > T4160QDS_SECURE_BOOT T2080RDB_SECURE_BOOT B4860QDS_SECURE_BOOT > > > > > P4080DS_SECURE_BOOT T2080QDS_SECURE_BOOT P5040DS_SECURE_BOOT > > > > > P1010RDB-PB_36BIT_NAND_SECBOOT controlcenterd_36BIT_SDCARD_DEVELOP > > > > > P1010RDB-PA_NAND_SECBOOT BSC9132QDS_SPIFLASH_DDRCLK133_SECURE > > > > > P1010RDB-PA_NOR_SECBOOT controlcenterd_TRAILBLAZER_DEVELOP > > > > > P5020DS_SECURE_BOOT > > > > > T1024QDS_SECURE_BOOT T1040QDS_SECURE_BOOT > > > > > BSC9132QDS_NOR_DDRCLK133_SECURE > > > > > T1024RDB_SECURE_BOOT P5040DS_NAND_SECURE_BOOT > > > > > P1010RDB-PA_36BIT_NAND_SECBOOT > > > > > T1042RDB_PI_NAND_SECURE_BOOT T1040RDB_SECURE_BOOT > > > > > T1040D4RDB_SECURE_BOOT > > > > > BSC9132QDS_NAND_DDRCLK100_SECURE P1010RDB-PB_NOR_SECBOOT > > > > > T1023RDB_SECURE_BOOT > > > > > controlcenterd_TRAILBLAZER > > > > > > > > So,
Re: [U-Boot] [PATCH 0/2] dm: Complete CONFIG_BLK migration
Hi Tom, > On Thu, Jun 28, 2018 at 09:30:19PM -0500, Derald D. Woods wrote: > > On Thu, Jun 28, 2018 at 10:47:36AM -0500, Adam Ford wrote: > > > On Wed, Jun 27, 2018 at 4:41 PM Tom Rini > > > wrote: > > > > > > > > On Sat, Jun 23, 2018 at 07:59:30AM -0600, Simon Glass wrote: > > > > > The time has come to migrate all boards to use CONFIG_BLK. > > > > > This series is just a test to see what boards would have to > > > > > be removed if we required CONFIG_BLK, as we plan to after the > > > > > next release. > > > > > > > > > > This should help maintainers see what is impacted. > > > > > > > > > > Hopefully maintainers will be able to convert their boards > > > > > over in the next month so we we can avoid having to remove > > > > > any boards. > > > > > > > > > > The goal is to have all boards use driver model. But so far, > > > > > we do allow CONFIG_DM to not be defined. > > > > > > > > > > > > > > > For 'Force BLK', here is the buildman output showing failed > > > > > boards and the relatively small number of command errors: > > > > > > > > > > 03: Force BLK > > > > > mips: + pic32mzdask > > > > >arm: + mixtile_loftq colibri_imx6_nospl sniper > > > > > omap3_zoom1 tbs2910 Mele_A1000G_quad am335x_igep003x > > > > > mx6ul_14x14_evk mk802_a10s am43xx_hs_evm devkit3250 > > > > > pcm051_rev3 am57xx_hs_evm Empire_electronix_m712 Auxtek-T003 > > > > > pcm058 zc5202 am335x_shc am335x_shc_ict Hummingbird_A31 > > > > > vining_2000 am335x_evm_usbspl ot1200_spl igep00x0 Mele_I7 > > > > > Wobo_i5 r7-tv-dongle liteboard omap3_overo am335x_boneblack > > > > > evb-ast2500 warp7 gwventana_gw5904 cairo A13-OLinuXinoM > > > > > mccmon6_sd apalis_imx6_nospl_it wandboard birdland_bav335a > > > > > colibri_imx7 colibri_imx6 inet_q972 xpress_spl > > > > > stm32f429-evaluation udoo_neo igep0032 Mele_M9 A13-OLinuXino > > > > > inet98v_rev2 A10s-OLinuXino-M riotboard snapper9260 > > > > > am43xx_evm pfla02 mx6qsabrelite apalis_imx6_nospl_com > > > > > s5p_goni colibri_pxa270 snapper9g20 Yones_Toptech_BS1078_V2 > > > > > am335x_shc_sdboot_prompt k2g_hs_evm cl-som-imx7 > > > > > am335x_shc_sdboot vf610twr_nand stm32f469-discovery > > > > > am335x_evm_nor mx53cx9020 Empire_electronix_d709 vf610twr > > > > > cm_t43 pengwyn stm32f746-disco Sinovoip_BPI_M2 > > > > > Sinovoip_BPI_M3 Sinlinx_SinA31s pico-imx7d am43xx_evm_rtconly > > > > > LicheePi_Zero pcm051_rev1 mccmon6_nor mx6sabreauto > > > > > display5_factory am335x_shc_prompt gwventana_nand > > > > > Bananapi_M2_Ultra Auxtek-T004 tbs_a711 cm_t335 h8_homlet_v2 > > > > > Colombus am43xx_evm_usbhost_boot chiliboard am335x_baltos > > > > > colibri_vf mx6ul_9x9_evk kp_imx6q_tpc bk4r1 udoo > > > > > difrnce_dit4350 am335x_evm_norboot UTOO_P66 iNet_86VS > > > > > marsboard MSI_Primo81 apalis_imx6 bananapi_m2_berry > > > > > xilinx_zynqmp_r5 birdland_bav335b am43xx_evm_qspiboot > > > > > CSQ_CS908 Ampe_A76 kp_imx53 am335x_evm_spiboot > > > > > Cubietruck_plus k2g_evm mx6sabresd omap3_logic pepper > > > > > colorfly_e708_q1 pcm052 gwventana_emmc am335x_boneblack_vboot > > > > > am335x_shc_netboot xpress ot1200 cgtqmx6eval zc5601 > > > > > devkit8000 dh_imx6 mx6cuboxi am57xx_evm am335x_sl50 > > > > > q8_a13_tablet sksimx6 > > > > > > > > > > microblaze: + microblaze-generic > > > > >powerpc: + P1010RDB-PA_36BIT_NOR_SECBOOT > > > > > BSC9132QDS_SDCARD_DDRCLK100_SECURE > > > > > P1010RDB-PB_SPIFLASH_SECBOOT T1024QDS_DDR4_SECURE_BOOT > > > > > controlcenterd_36BIT_SDCARD > > > > > BSC9132QDS_SDCARD_DDRCLK133_SECURE > > > > > P1010RDB-PA_SPIFLASH_SECBOOT BSC9132QDS_NAND_DDRCLK133_SECURE > > > > > P1010RDB-PA_36BIT_SPIFLASH_SECBOOT P2041RDB_SECURE_BOOT > > > > > P5020DS_NAND_SECURE_BOOT P1010RDB-PB_36BIT_NOR_SECBOOT > > > > > BSC9132QDS_NOR_DDRCLK100_SECURE P3041DS_SECURE_BOOT > > > > > T1042D4RDB_SECURE_BOOT T1042RDB_SECURE_BOOT > > > > > T4240QDS_SECURE_BOOT P1010RDB-PB_36BIT_SPIFLASH_SECBOOT > > > > > P1010RDB-PB_NAND_SECBOOT BSC9132QDS_SPIFLASH_DDRCLK100_SECURE > > > > > P3041DS_NAND_SECURE_BOOT T4160QDS_SECURE_BOOT > > > > > T2080RDB_SECURE_BOOT B4860QDS_SECURE_BOOT P4080DS_SECURE_BOOT > > > > > T2080QDS_SECURE_BOOT P5040DS_SECURE_BOOT > > > > > P1010RDB-PB_36BIT_NAND_SECBOOT > > > > > controlcenterd_36BIT_SDCARD_DEVELOP P1010RDB-PA_NAND_SECBOOT > > > > > BSC9132QDS_SPIFLASH_DDRCLK133_SECURE P1010RDB-PA_NOR_SECBOOT > > > > > controlcenterd_TRAILBLAZER_DEVELOP P5020DS_SECURE_BOOT > > > > > T1024QDS_SECURE_BOOT T1040QDS_SECURE_BOOT > > > > > BSC9132QDS_NOR_DDRCLK133_SECURE T1024RDB_SECURE_BOOT > > > > > P5040DS_NAND_SECURE_BOOT P1010RDB-PA_36BIT_NAND_SECBOOT > > > > > T1042RDB_PI_NAND_SECURE_BOOT T1040RDB_SECURE_BOOT > > > > > T1040D4RDB_SECURE_BOOT BSC9132QDS_NAND_DDRCLK100_SECURE > > > > > P1010RDB-PB_NOR_SECBOOT T1023RDB_SECURE_BOOT > > > > > controlcenterd_TRAILBLAZER > > > > > > > > So, how are the maintainers CC'd on this feeling about the > > > > deadline? It was supposed to be 2018.05, but it's looking like > > > > we would enforce it for 2018.09
Re: [U-Boot] [U-Boot, 1/4] ARM: Introduce ability to enable ACR::IBE on Cortex-A8 for CVE-2017-5715
On Tue, Jun 12, 2018 at 03:24:08PM -0500, Nishanth Menon wrote: > As recommended by Arm in [1], IBE[2] has to be enabled unconditionally > for BPIALL to be functional on Cortex-A8 processors. Provide a config > option for platforms to enable this option based on impact analysis > for products. > > NOTE: This patch in itself is NOT the final solution, this requires: > a) Implementation of v7_arch_cp15_set_acr on SoCs which may not >provide direct access to ACR register. > b) Operating Systems such as Linux to provide adequate workaround in the right >locations. > c) This workaround applies to only the boot processor. It is important >to apply workaround as necessary (context-save-restore) around low >power context loss OR additional processors as necessary in either >firmware support OR elsewhere in OS. > > [1] https://developer.arm.com/support/security-update > [2] http://infocenter.arm.com/help/topic/com.arm.doc.ddi0344k/Bgbffjhh.html > > Cc: Marc Zyngier > Cc: Russell King > Cc: Tony Lindgren > Cc: Robin Murphy > Cc: Florian Fainelli > Cc: Catalin Marinas > Cc: Will Deacon > Cc: Christoffer Dall > Cc: Andre Przywara > Cc: Ard Biesheuvel > Cc: Tom Rini > Cc: Michael Nazzareno Trimarchi > > Signed-off-by: Nishanth Menon > Tested-by: Fabio Estevam Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [U-Boot, 2/4] ARM: Introduce ability to enable invalidate of BTB with ICIALLU on Cortex-A15 for CVE-2017-5715
On Tue, Jun 12, 2018 at 03:24:09PM -0500, Nishanth Menon wrote: > As recommended by Arm in [1], ACTLR[0] (Enable invalidates of BTB) > needs to be set[2] for BTB to be invalidated on ICIALLU. This needs to > be done unconditionally for Cortex-A15 processors. Provide a config > option for platforms to enable this option based on impact analysis > for products. > > NOTE: This patch in itself is NOT the final solution, this requires: > a) Implementation of v7_arch_cp15_set_acr on SoCs which may not >provide direct access to ACR register. > b) Operating Systems such as Linux to provide adequate workaround in the >right locations. > c) This workaround applies to only the boot processor. It is important >to apply workaround as necessary (context-save-restore) around low >power context loss OR additional processors as necessary in either >firmware support OR elsewhere in OS. > > [1] https://developer.arm.com/support/security-update > [2] http://infocenter.arm.com/help/topic/com.arm.doc.ddi0438c/BABGHIBG.html > > Cc: Marc Zyngier > Cc: Russell King > Cc: Tony Lindgren > Cc: Robin Murphy > Cc: Florian Fainelli > Cc: Catalin Marinas > Cc: Will Deacon > Cc: Christoffer Dall > Cc: Andre Przywara > Cc: Ard Biesheuvel > Cc: Tom Rini > Cc: Michael Nazzareno Trimarchi > > Signed-off-by: Nishanth Menon > Tested-by: Fabio Estevam Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [U-Boot, 3/4] ARM: mach-omap2: omap5/dra7: Enable ACTLR[0] (Enable invalidates of BTB) to facilitate CVE_2017-5715 WA in OS
On Tue, Jun 12, 2018 at 03:24:10PM -0500, Nishanth Menon wrote: > Enable CVE_2017_5715 and since we have our own v7_arch_cp15_set_acr > function to setup the bits, we are able to override the settings. > > Without this enabled, Linux kernel reports: > CPU0: Spectre v2: firmware did not set auxiliary control register IBE bit, > system vulnerable > > With this enabled, Linux kernel reports: > CPU0: Spectre v2: using ICIALLU workaround > > NOTE: This by itself does not enable the workaround for CPU1 (on > OMAP5 and DRA72/AM572 SoCs) and may require additional kernel patches. > > Signed-off-by: Nishanth Menon Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [U-Boot, 4/4] ARM: mach-omap2: omap3/am335x: Enable ACR::IBE on Cortex-A8 SoCs for CVE-2017-5715
On Tue, Jun 12, 2018 at 03:24:11PM -0500, Nishanth Menon wrote: > Enable CVE-2017-5715 option to set the IBE bit. This enables kernel > workarounds necessary for the said CVE. > > With this enabled, Linux reports: > CPU0: Spectre v2: using BPIALL workaround > > This workaround may need to be re-applied in OS environment around low > power transition resume states where context of ACR would be lost (off-mode > etc). > > Signed-off-by: Nishanth Menon Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [U-Boot,1/1] lib: div64: fix typeo in include/div64.h
On Thu, Jun 28, 2018 at 07:55:46PM +0200, Heinrich Schuchardt wrote: > %s/reminder/remainder/ > > Signed-off-by: Heinrich Schuchardt Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] mx5: Select ARM_CORTEX_A8_CVE_2017_5715
Hi Tom and Stefano, On Wed, Jun 20, 2018 at 3:08 PM, Fabio Estevam wrote: > From: Fabio Estevam > > On a 4.18-rc1 kernel the following warning is seen on i.MX51 and > i.MX53: > > CPU0: Spectre v2: firmware did not set auxiliary control register IBE bit, > system vulnerable > > Select the ARM_CORTEX_A8_CVE_2017_5715 workaround for i.MX51/i.MX53 > to fix the problem. > > With this patch applied the kernel reports: > > CPU0: Spectre v2: using BPIALL workaround > > Signed-off-by: Fabio Estevam > --- > This depends on Nishanth Menon's series that introduces the > ARM_CORTEX_A8_CVE_2017_5715 Spectre workaround. I saw that Tom has just applied Nishanth Menon's series. Can this one also be applied for 2018.07? Thanks ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] mx5: Select ARM_CORTEX_A8_CVE_2017_5715
On Fri, Jun 29, 2018 at 06:26:55PM -0300, Fabio Estevam wrote: > Hi Tom and Stefano, > > On Wed, Jun 20, 2018 at 3:08 PM, Fabio Estevam wrote: > > From: Fabio Estevam > > > > On a 4.18-rc1 kernel the following warning is seen on i.MX51 and > > i.MX53: > > > > CPU0: Spectre v2: firmware did not set auxiliary control register IBE bit, > > system vulnerable > > > > Select the ARM_CORTEX_A8_CVE_2017_5715 workaround for i.MX51/i.MX53 > > to fix the problem. > > > > With this patch applied the kernel reports: > > > > CPU0: Spectre v2: using BPIALL workaround > > > > Signed-off-by: Fabio Estevam > > --- > > This depends on Nishanth Menon's series that introduces the > > ARM_CORTEX_A8_CVE_2017_5715 Spectre workaround. > > I saw that Tom has just applied Nishanth Menon's series. > > Can this one also be applied for 2018.07? I can pick it up, or it can be in a PR, thanks! -- Tom signature.asc Description: PGP signature ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v1 0/6] This patch series contains the the changes related to
Xilinx Axi Watchdog driver conversion to driver model. All other changes are necessary for getting this done. [PATCH 1/6] We no more need redundant io related macros [PATCH 2/6] Guard the board specific do_reset based on configuartions [PATCH 3/6] Cosmetic changes, based on checkpatch results [PATCH 4/6] Removed a bunch of WATCHDOG related macros [PATCH 5/6] Support for watchdog_reset function for Microblaze [PATCH 6/6] Last one, contains the Xilinx Axi watchdog driver to DM Changes in v1: - Removed few macros which aren't needed anymore - Few cosmetic changes - Converted Xilinx Axi Watchdog driver to driver model Shreenidhi Shedi (6): microblaze: Use default implementation from include/linux/io.h microblaze: Guard do_reset by CONFIG_SYSRESET microblaze: Cosmetic changes in Microblaze related files microblaze: Delete Xilinx watchdog related macros microblaze: Support for watchdog_reset in Microblaze init watchdog: Convert Xilinx Axi watchdog driver to driver model arch/microblaze/include/asm/io.h | 95 +--- .../microblaze-generic/microblaze-generic.c | 53 +++-- board/xilinx/microblaze-generic/xparameters.h | 8 +- drivers/watchdog/Kconfig | 8 ++ drivers/watchdog/xilinx_tb_wdt.c | 107 ++ include/configs/microblaze-generic.h | 12 +- 6 files changed, 193 insertions(+), 90 deletions(-) -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v1 1/6] microblaze: Use default implementation from include/linux/io.h
Signed-off-by: Shreenidhi Shedi --- Changes in v1: - Removed few macros which aren't needed anymore - Few cosmetic changes - Converted Xilinx Axi Watchdog driver to driver model arch/microblaze/include/asm/io.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/arch/microblaze/include/asm/io.h b/arch/microblaze/include/asm/io.h index c7516a47e8..26a437c248 100644 --- a/arch/microblaze/include/asm/io.h +++ b/arch/microblaze/include/asm/io.h @@ -120,9 +120,6 @@ io_outsl (unsigned long port, const void *src, unsigned long count) #define insw(a,b,l) io_insw(a,b,l) #define insl(a,b,l) io_insl(a,b,l) - -#define iounmap(addr) ((void)0) -#define ioremap(physaddr, size)(physaddr) #define ioremap_nocache(physaddr, size)(physaddr) #define ioremap_writethrough(physaddr, size) (physaddr) #define ioremap_fullcache(physaddr, size) (physaddr) -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v1 5/6] microblaze: Support for watchdog_reset in Microblaze init
Signed-off-by: Shreenidhi Shedi --- Changes in v1: None .../microblaze-generic/microblaze-generic.c | 43 +-- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/board/xilinx/microblaze-generic/microblaze-generic.c b/board/xilinx/microblaze-generic/microblaze-generic.c index 7d8f247fa9..1d48bfb20e 100644 --- a/board/xilinx/microblaze-generic/microblaze-generic.c +++ b/board/xilinx/microblaze-generic/microblaze-generic.c @@ -17,6 +17,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -24,6 +25,12 @@ DECLARE_GLOBAL_DATA_PTR; static int reset_pin = -1; #endif +#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_XILINX_TB_WATCHDOG) +#include + +static struct udevice *watchdog_dev; +#endif /* !CONFIG_SPL_BUILD && CONFIG_XILINX_TB_WATCHDOG */ + ulong ram_base; int dram_init_banksize(void) @@ -68,10 +75,6 @@ int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (reset_pin != -1) gpio_direction_output(reset_pin, 1); #endif - -#ifdef CONFIG_XILINX_TB_WATCHDOG - hw_watchdog_disable(); -#endif #endif puts("Resetting board\n"); __asm__ __volatile__ (" mts rmsr, r0;" \ @@ -91,9 +94,41 @@ static int gpio_init(void) return 0; } +#ifdef CONFIG_XILINX_TB_WATCHDOG +/* Called by macro WATCHDOG_RESET */ +void watchdog_reset(void) +{ +#if !defined(CONFIG_SPL_BUILD) + ulong now; + static ulong next_reset; + + if (!watchdog_dev) + return; + + now = timer_get_us(); + + /* Do not reset the watchdog too often */ + if (now > next_reset) { + wdt_reset(watchdog_dev); + next_reset = now + 1000; + } +#endif /* !CONFIG_SPL_BUILD */ +} +#endif /* CONFIG_XILINX_TB_WATCHDOG */ + int board_late_init(void) { gpio_init(); +#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_XILINX_TB_WATCHDOG) + watchdog_dev = NULL; + if (uclass_get_device(UCLASS_WDT, 0, &watchdog_dev)) { + puts("Watchdog: Not found!\n"); + } else { + wdt_start(watchdog_dev, 0, 0); + puts("Watchdog: Started\n"); + } +#endif /* !CONFIG_SPL_BUILD && CONFIG_XILINX_TB_WATCHDOG */ + return 0; } -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v1 3/6] microblaze: Cosmetic changes in Microblaze related files
Signed-off-by: Shreenidhi Shedi --- Changes in v1: None arch/microblaze/include/asm/io.h | 92 +++ .../microblaze-generic/microblaze-generic.c | 8 +- board/xilinx/microblaze-generic/xparameters.h | 4 +- include/configs/microblaze-generic.h | 2 +- 4 files changed, 61 insertions(+), 45 deletions(-) diff --git a/arch/microblaze/include/asm/io.h b/arch/microblaze/include/asm/io.h index 26a437c248..2de3c3b6a3 100644 --- a/arch/microblaze/include/asm/io.h +++ b/arch/microblaze/include/asm/io.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* * include/asm-microblaze/io.h -- Misc I/O operations * @@ -21,39 +22,42 @@ #define IO_SPACE_LIMIT 0x #define readb(addr) \ - ({ unsigned char __v = (*(volatile unsigned char *) (addr)); __v; }) + ({ unsigned char __v = (*(volatile unsigned char *) (addr)); __v; }) + #define readw(addr) \ - ({ unsigned short __v = (*(volatile unsigned short *) (addr)); __v; }) + ({ unsigned short __v = (*(volatile unsigned short *) (addr)); __v; }) + #define readl(addr) \ ({ unsigned int __v = (*(volatile unsigned int *) (addr)); __v; }) #define writeb(b, addr) \ - (void)((*(volatile unsigned char *) (addr)) = (b)) + (void)((*(volatile unsigned char *) (addr)) = (b)) + #define writew(b, addr) \ - (void)((*(volatile unsigned short *) (addr)) = (b)) + (void)((*(volatile unsigned short *) (addr)) = (b)) + #define writel(b, addr) \ - (void)((*(volatile unsigned int *) (addr)) = (b)) + (void)((*(volatile unsigned int *) (addr)) = (b)) -#define memset_io(a,b,c)memset((void *)(a),(b),(c)) -#define memcpy_fromio(a,b,c)memcpy((a),(void *)(b),(c)) -#define memcpy_toio(a,b,c) memcpy((void *)(a),(b),(c)) +#define memset_io(a, b, c)memset((void *)(a), (b), (c)) +#define memcpy_fromio(a, b, c)memcpy((a), (void *)(b), (c)) +#define memcpy_toio(a, b, c) memcpy((void *)(a), (b), (c)) -#define inb(addr) readb (addr) -#define inw(addr) readw (addr) -#define inl(addr) readl (addr) -#define outb(x, addr) ((void) writeb (x, addr)) -#define outw(x, addr) ((void) writew (x, addr)) -#define outl(x, addr) ((void) writel (x, addr)) +#define inb(addr) readb(addr) +#define inw(addr) readw(addr) +#define inl(addr) readl(addr) +#define outb(x, addr) ((void)writeb(x, addr)) +#define outw(x, addr) ((void)writew(x, addr)) +#define outl(x, addr) ((void)writel(x, addr)) /* Some #definitions to keep strange Xilinx code happy */ -#define in_8(addr) readb (addr) -#define in_be16(addr) readw (addr) -#define in_be32(addr) readl (addr) - -#define out_8(addr,x ) outb (x,addr) -#define out_be16(addr,x ) outw (x,addr) -#define out_be32(addr,x ) outl (x,addr) +#define in_8(addr) readb(addr) +#define in_be16(addr) readw(addr) +#define in_be32(addr) readl(addr) +#define out_8(addr, x) outb(x, addr) +#define out_be16(addr, x) outw(x, addr) +#define out_be32(addr, x) outl(x, addr) #define inb_p(port)inb((port)) #define outb_p(val, port) outb((val), (port)) @@ -71,54 +75,64 @@ #define __raw_writew writew #define __raw_writel writel -static inline void io_insb (unsigned long port, void *dst, unsigned long count) +static inline void io_insb(unsigned long port, void *dst, unsigned long count) { unsigned char *p = dst; + while (count--) - *p++ = inb (port); + *p++ = inb(port); } -static inline void io_insw (unsigned long port, void *dst, unsigned long count) + +static inline void io_insw(unsigned long port, void *dst, unsigned long count) { unsigned short *p = dst; + while (count--) - *p++ = inw (port); + *p++ = inw(port); } -static inline void io_insl (unsigned long port, void *dst, unsigned long count) + +static inline void io_insl(unsigned long port, void *dst, unsigned long count) { unsigned long *p = dst; + while (count--) - *p++ = inl (port); + *p++ = inl(port); } static inline void -io_outsb (unsigned long port, const void *src, unsigned long count) +io_outsb(unsigned long port, const void *src, unsigned long count) { const unsigned char *p = src; + while (count--) - outb (*p++, port); + outb(*p++, port); } + static inline void -io_outsw (unsigned long port, const void *src, unsigned long count) +io_outsw(unsigned long port, const void *src, unsigned long count) { const unsigned short *p = src; + while (count--) - outw (*p++, port); + outw(*p++, port); } + static inline void -io_outsl (unsigned long port, const void *src, unsigned long count) +io_outsl(unsigned long port, const void *src, unsigned long count) { const unsigned long *p = src; + while (count--) - outl (*p++, port); + outl(*p++, port)
[U-Boot] [PATCH v1 2/6] microblaze: Guard do_reset by CONFIG_SYSRESET
Signed-off-by: Shreenidhi Shedi --- Changes in v1: None board/xilinx/microblaze-generic/microblaze-generic.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/board/xilinx/microblaze-generic/microblaze-generic.c b/board/xilinx/microblaze-generic/microblaze-generic.c index 58ca1d715d..fb89276c4f 100644 --- a/board/xilinx/microblaze-generic/microblaze-generic.c +++ b/board/xilinx/microblaze-generic/microblaze-generic.c @@ -58,6 +58,7 @@ int dram_init(void) return 0; }; +#if !defined(CONFIG_SYSRESET) || defined(CONFIG_SPL_BUILD) int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { #ifndef CONFIG_SPL_BUILD @@ -76,6 +77,7 @@ int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) return 0; } +#endif /* !CONFIG_SYSRESET || CONFIG_SPL_BUILD */ static int gpio_init(void) { -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v1 6/6] watchdog: Convert Xilinx Axi watchdog driver to driver model
Signed-off-by: Shreenidhi Shedi --- Changes in v1: None drivers/watchdog/Kconfig | 8 +++ drivers/watchdog/xilinx_tb_wdt.c | 107 --- 2 files changed, 91 insertions(+), 24 deletions(-) diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index 148c6a0d68..351d2af8d9 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig @@ -103,4 +103,12 @@ config WDT_CDNS Select this to enable Cadence watchdog timer, which can be found on some Xilinx Microzed Platform. +config XILINX_TB_WATCHDOG + bool "Xilinx Axi watchdog timer support" + depends on WDT + imply WATCHDOG + help + Select this to enable Xilinx Axi watchdog timer, which can be found on some + Xilinx Microblaze Platform. + endmenu diff --git a/drivers/watchdog/xilinx_tb_wdt.c b/drivers/watchdog/xilinx_tb_wdt.c index 2274123e49..7f20c2ce2f 100644 --- a/drivers/watchdog/xilinx_tb_wdt.c +++ b/drivers/watchdog/xilinx_tb_wdt.c @@ -1,13 +1,17 @@ // SPDX-License-Identifier: GPL-2.0+ /* + * Xilinx Axi platforms watchdog timer driver. + * + * Author(s): Michal Šimek + * Shreenidhi Shedi + * * Copyright (c) 2011-2013 Xilinx Inc. */ #include -#include -#include -#include -#include +#include +#include +#include #define XWT_CSR0_WRS_MASK 0x0008 /* Reset status Mask */ #define XWT_CSR0_WDS_MASK 0x0004 /* Timer state Mask */ @@ -20,49 +24,104 @@ struct watchdog_regs { u32 tbr; /* 0x8 */ }; -static struct watchdog_regs *watchdog_base = - (struct watchdog_regs *)CONFIG_WATCHDOG_BASEADDR; +struct xlnx_wdt_priv { + bool enable_once; + struct watchdog_regs *regs; +}; -void hw_watchdog_reset(void) +static int xlnx_wdt_reset(struct udevice *dev) { u32 reg; + struct xlnx_wdt_priv *priv = dev_get_priv(dev); + + debug("%s\n", __func__); /* Read the current contents of TCSR0 */ - reg = readl(&watchdog_base->twcsr0); + reg = readl(&priv->regs->twcsr0); /* Clear the watchdog WDS bit */ if (reg & (XWT_CSR0_EWDT1_MASK | XWT_CSRX_EWDT2_MASK)) - writel(reg | XWT_CSR0_WDS_MASK, &watchdog_base->twcsr0); + writel(reg | XWT_CSR0_WDS_MASK, &priv->regs->twcsr0); + + return 0; } -void hw_watchdog_disable(void) +static int xlnx_wdt_stop(struct udevice *dev) { u32 reg; + struct xlnx_wdt_priv *priv = dev_get_priv(dev); + + if (priv->enable_once) { + puts("Can't stop Xilinux Axi watchdog.\n"); + return -1; + } /* Read the current contents of TCSR0 */ - reg = readl(&watchdog_base->twcsr0); + reg = readl(&priv->regs->twcsr0); - writel(reg & ~XWT_CSR0_EWDT1_MASK, &watchdog_base->twcsr0); - writel(~XWT_CSRX_EWDT2_MASK, &watchdog_base->twcsr1); + writel(reg & ~XWT_CSR0_EWDT1_MASK, &priv->regs->twcsr0); + writel(~XWT_CSRX_EWDT2_MASK, &priv->regs->twcsr1); puts("Watchdog disabled!\n"); + + return 0; } -static void hw_watchdog_isr(void *arg) +static int xlnx_wdt_start(struct udevice *dev, u64 timeout, ulong flags) { - hw_watchdog_reset(); + struct xlnx_wdt_priv *priv = dev_get_priv(dev); + + writel((XWT_CSR0_WRS_MASK | XWT_CSR0_WDS_MASK | XWT_CSR0_EWDT1_MASK), + &priv->regs->twcsr0); + + writel(XWT_CSRX_EWDT2_MASK, &priv->regs->twcsr1); + + return 0; } -void hw_watchdog_init(void) +static int xlnx_wdt_probe(struct udevice *dev) { - int ret; + debug("%s: Probing wdt%u\n", __func__, dev->seq); - writel((XWT_CSR0_WRS_MASK | XWT_CSR0_WDS_MASK | XWT_CSR0_EWDT1_MASK), - &watchdog_base->twcsr0); - writel(XWT_CSRX_EWDT2_MASK, &watchdog_base->twcsr1); + xlnx_wdt_stop(dev); - ret = install_interrupt_handler(CONFIG_WATCHDOG_IRQ, - hw_watchdog_isr, NULL); - if (ret) - puts("Watchdog IRQ registration failed."); + return 0; } + +static int xlnx_wdt_ofdata_to_platdata(struct udevice *dev) +{ + struct xlnx_wdt_priv *priv = dev_get_priv(dev); + + priv->regs = (struct watchdog_regs *)dev_read_addr(dev); + if (IS_ERR(priv->regs)) + return PTR_ERR(priv->regs); + + priv->enable_once = dev_read_u32_default(dev, "xlnx,wdt-enable-once", +0); + + debug("%s: wdt-enable-once %d\n", __func__, priv->enable_once); + + return 0; +} + +static const struct wdt_ops xlnx_wdt_ops = { + .start = xlnx_wdt_start, + .reset = xlnx_wdt_reset, + .stop = xlnx_wdt_stop, +}; + +static const struct udevice_id xlnx_wdt_ids[] = { + { .compatible = "xlnx,xps-timebase-wdt-1.00.a", }, + { .compatible = "xlnx,xps-timebase-wdt-1.01.a", }, + {}, +}; + +U_BOOT_DRIVER(xlnx_wdt) = { + .name = "xlnx_wdt", +
[U-Boot] [PATCH v1 4/6] microblaze: Delete Xilinx watchdog related macros
Signed-off-by: Shreenidhi Shedi --- Changes in v1: None board/xilinx/microblaze-generic/xparameters.h | 4 include/configs/microblaze-generic.h | 10 -- 2 files changed, 14 deletions(-) diff --git a/board/xilinx/microblaze-generic/xparameters.h b/board/xilinx/microblaze-generic/xparameters.h index 501a23454d..ce1ec4c17a 100644 --- a/board/xilinx/microblaze-generic/xparameters.h +++ b/board/xilinx/microblaze-generic/xparameters.h @@ -21,7 +21,3 @@ /* Flash Memory is FLASH_2Mx32 */ #define XILINX_FLASH_START 0x2C00 #define XILINX_FLASH_SIZE 0x0080 - -/* Watchdog IP is wxi_timebase_wdt_0 */ -#define XILINX_WATCHDOG_BASEADDR 0x5000 -#define XILINX_WATCHDOG_IRQ1 diff --git a/include/configs/microblaze-generic.h b/include/configs/microblaze-generic.h index 7f16700d4f..6a049cf2af 100644 --- a/include/configs/microblaze-generic.h +++ b/include/configs/microblaze-generic.h @@ -43,16 +43,6 @@ # define CONFIG_SYS_GPIO_0_ADDRXILINX_GPIO_BASEADDR #endif -/* watchdog */ -#if defined(XILINX_WATCHDOG_BASEADDR) && defined(XILINX_WATCHDOG_IRQ) -# define CONFIG_WATCHDOG_BASEADDR XILINX_WATCHDOG_BASEADDR -# define CONFIG_WATCHDOG_IRQ XILINX_WATCHDOG_IRQ -# ifndef CONFIG_SPL_BUILD -# define CONFIG_HW_WATCHDOG -# define CONFIG_XILINX_TB_WATCHDOG -# endif -#endif - #define CONFIG_SYS_MALLOC_LEN 0xC /* Stack location before relocation */ -- 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH] mx5: Select ARM_CORTEX_A8_CVE_2017_5715
Hi Tom, On Fri, Jun 29, 2018 at 6:30 PM, Tom Rini wrote: >> I saw that Tom has just applied Nishanth Menon's series. >> >> Can this one also be applied for 2018.07? > > I can pick it up, or it can be in a PR, thanks! As Stefano's tree do not contain Nishanth's series, maybe it would be easier if you could pick this one directly. Thanks ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 2/2] dm: sunxi: Use DM for MMC and SATA on all A10 boards
Use the driver model for MMC and SATA, in preparation for CONFIG_BLK defaulting to y. Tested on A10 Cubieboard. Signed-off-by: Adam Sampson --- I imagine an A13 version (no DM_SCSI needed) would work as well, but I don't have an A13 machine to test with. arch/arm/mach-sunxi/Kconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig index 8f70c6750e..a77815c239 100644 --- a/arch/arm/mach-sunxi/Kconfig +++ b/arch/arm/mach-sunxi/Kconfig @@ -139,6 +139,8 @@ config MACH_SUN4I bool "sun4i (Allwinner A10)" select CPU_V7A select ARM_CORTEX_CPU_IS_UP + select DM_MMC if MMC + select DM_SCSI if SCSI select PHY_SUN4I_USB select DRAM_SUN4I select SUNXI_GEN_SUN4I -- 2.18.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 1/2] dm: mmc: sunxi: Add A10/A20 compatible strings
Commit dd27918c2252 ("dm: mmc: sunxi: Add support for driver model") only added the allwinner,sun5i-a13-mmc compatible string for this driver. The DM initialisation code here also works with (at least) A10 and A20, so add the appropriate compatible strings as per Linux 4.17's driver. Tested on A10 Cubieboard and A20 pcDuino3 Nano with CONFIG_DM_MMC. (A20 worked already, because sun7i-a20.dtsi specifies both the A13 and A20 strings.) Signed-off-by: Adam Sampson --- drivers/mmc/sunxi_mmc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c index fe6d82c7b4..7fa1ae8b16 100644 --- a/drivers/mmc/sunxi_mmc.c +++ b/drivers/mmc/sunxi_mmc.c @@ -637,7 +637,9 @@ static int sunxi_mmc_bind(struct udevice *dev) } static const struct udevice_id sunxi_mmc_ids[] = { + { .compatible = "allwinner,sun4i-a10-mmc" }, { .compatible = "allwinner,sun5i-a13-mmc" }, + { .compatible = "allwinner,sun7i-a20-mmc" }, { } }; -- 2.18.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 1/2] arm: timer: factor out FSL arch timer erratum workaround
Hi, On 06/29/2018 11:18 AM, Emmanuel Vadot wrote: > On 2018-06-28 16:37, Andre Przywara wrote: >> Hi, >> >> On 28/06/18 15:27, Jagan Teki wrote: >>> On Wed, Jun 27, 2018 at 6:12 AM, Andre Przywara >>> wrote: At the moment we have the workaround for the Freescale arch timer erratum A-008585 merged into the generic timer_read_counter() routine. Split those two up, so that we can add other errata workaround more easily. Also add an explaining comment on the way. Signed-off-by: Andre Przywara --- arch/arm/cpu/armv8/generic_timer.c | 31 +-- 1 file changed, 25 insertions(+), 6 deletions(-) >>> >>> Are these these two patches are for coming release? >> >> Yes, please. That's an issue that needs fixing now. The bug is in all >> A64 silicon, but the issue popped up with the recent commit 5ff8e54888e4 >> and can be triggered quite easily: >> Boot mainline U-Boot on any A64 board, and do: >>> ls mmc 0:1 >> on any SD card (with at least one partition defined). Then hold down the >> Enter key to repeat this last command over and over again. It usually >> takes less than 10 seconds to crash the board. >> People reported immediate crashes under certain circumstances (GPT >> partitioned SD cards): >> https://bugzilla.opensuse.org/show_bug.cgi?id=1098550 >> >> Cheers, >> Andre. > > For fixing the issue we also need to add the compat to the timer in the > dts so kernels will also Apply the errata. > Booting is cool but if you boot a kernel that will have timer issue > it's not that great. Yes, but that is a separate issue. The Linux patch [1] is on the list, but hasn't been merged yet. So the details of the DT property are not yet set. And since we need the fixup already early in the SPL, we have to use a compile time option for U-Boot anyway. So the DT property would be purely for OSes and we would get it during the normal DT sync anyway. Cheers, Andre. [1] http://lists.infradead.org/pipermail/linux-arm-kernel/2018-May/576886.html ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [UBOOT PATCH v5 3/4] spi: xilinx_spi: Added support to read JEDEC-id twice at the boot time
This patch is for the startup block issue in the spi controller. SPI clock is passing through STARTUP block to FLASH. STARTUP block don't provide clock as soon as QSPI provides command. So, first command fails. This patch added support to read JEDEC id in xilinx_spi_xfer (). Signed-off-by: Vipul Kumar --- Changes in v5: - Changed function name to xilinx_spi_startup_block() --- drivers/spi/xilinx_spi.c | 41 + 1 file changed, 41 insertions(+) diff --git a/drivers/spi/xilinx_spi.c b/drivers/spi/xilinx_spi.c index 11b7343..8621738 100644 --- a/drivers/spi/xilinx_spi.c +++ b/drivers/spi/xilinx_spi.c @@ -105,6 +105,7 @@ struct xilinx_spi_priv { unsigned int freq; unsigned int mode; unsigned int fifo_depth; + u8 startup; }; static int xilinx_spi_probe(struct udevice *bus) @@ -205,6 +206,39 @@ static u32 xilinx_spi_read_rxfifo(struct udevice *bus, u8 *rxp, u32 rxbytes) return i; } +static void xilinx_spi_startup_block(struct udevice *dev, unsigned int bytes, +const void *dout, void *din) +{ + struct udevice *bus = dev_get_parent(dev); + struct xilinx_spi_priv *priv = dev_get_priv(bus); + struct xilinx_spi_regs *regs = priv->regs; + struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev); + const unsigned char *txp = dout; + unsigned char *rxp = din; + u32 reg, count; + u32 txbytes = bytes; + u32 rxbytes = bytes; + + /* +* This loop runs two times. First time to send the command. +* Second time to transfer data. After transferring data, +* it sets txp to the initial value for the normal operation. +*/ + for ( ; priv->startup < 2; priv->startup++) { + count = xilinx_spi_fill_txfifo(bus, txp, txbytes); + reg = readl(®s->spicr) & ~SPICR_MASTER_INHIBIT; + writel(reg, ®s->spicr); + count = xilinx_spi_read_rxfifo(bus, rxp, rxbytes); + txp = din; + + if (priv->startup) { + spi_cs_deactivate(dev); + spi_cs_activate(dev, slave_plat->cs); + txp = dout; + } + } +} + static int xilinx_spi_xfer(struct udevice *dev, unsigned int bitlen, const void *dout, void *din, unsigned long flags) { @@ -237,6 +271,13 @@ static int xilinx_spi_xfer(struct udevice *dev, unsigned int bitlen, if (flags & SPI_XFER_BEGIN) spi_cs_activate(dev, slave_plat->cs); + /* +* This is the work around for the startup block issue in +* the spi controller. SPI clock is passing through STARTUP +* block to FLASH. STARTUP block don't provide clock as soon +* as QSPI provides command. So first command fails. +*/ + xilinx_spi_startup_block(dev, bytes, dout, din); while (txbytes && rxbytes) { count = xilinx_spi_fill_txfifo(bus, txp, txbytes); -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [UBOOT PATCH v5 2/4] spi: xilinx_spi: Modify transfer logic xilinx_spi_xfer() function
This patch modify xilinx_spi_xfer() function and add rxfifo() and txfifo() functions to add the modularity so that these functions can be used by other functions within the same file. This patch also added support to read fifo_size from dts. Signed-off-by: Vipul Kumar Signed-off-by: Siva Durga Prasad Paladugu --- Changes in v5: - No change --- drivers/spi/xilinx_spi.c | 103 +++ 1 file changed, 68 insertions(+), 35 deletions(-) diff --git a/drivers/spi/xilinx_spi.c b/drivers/spi/xilinx_spi.c index cc5ac51..11b7343 100644 --- a/drivers/spi/xilinx_spi.c +++ b/drivers/spi/xilinx_spi.c @@ -19,6 +19,7 @@ #include #include #include +#include /* * [0]: http://www.xilinx.com/support/documentation @@ -77,6 +78,8 @@ #define CONFIG_XILINX_SPI_IDLE_VAL GENMASK(7, 0) #endif +#define XILINX_SPISR_TIMEOUT 1 /* in milliseconds */ + /* xilinx spi register set */ struct xilinx_spi_regs { u32 __space0__[7]; @@ -101,6 +104,7 @@ struct xilinx_spi_priv { struct xilinx_spi_regs *regs; unsigned int freq; unsigned int mode; + unsigned int fifo_depth; }; static int xilinx_spi_probe(struct udevice *bus) @@ -110,6 +114,9 @@ static int xilinx_spi_probe(struct udevice *bus) priv->regs = (struct xilinx_spi_regs *)devfdt_get_addr(bus); + priv->fifo_depth = fdtdec_get_int(gd->fdt_blob, dev_of_offset(bus), + "fifo-size", 0); + writel(SPISSR_RESET_VALUE, ®s->srr); return 0; @@ -157,6 +164,47 @@ static int xilinx_spi_release_bus(struct udevice *dev) return 0; } +static u32 xilinx_spi_fill_txfifo(struct udevice *bus, const u8 *txp, + u32 txbytes) +{ + struct xilinx_spi_priv *priv = dev_get_priv(bus); + struct xilinx_spi_regs *regs = priv->regs; + unsigned char d; + u32 i = 0; + + while (txbytes && !(readl(®s->spisr) & SPISR_TX_FULL) && + i < priv->fifo_depth) { + d = txp ? *txp++ : CONFIG_XILINX_SPI_IDLE_VAL; + debug("spi_xfer: tx:%x ", d); + /* write out and wait for processing (receive data) */ + writel(d & SPIDTR_8BIT_MASK, ®s->spidtr); + txbytes--; + i++; + } + + return i; +} + +static u32 xilinx_spi_read_rxfifo(struct udevice *bus, u8 *rxp, u32 rxbytes) +{ + struct xilinx_spi_priv *priv = dev_get_priv(bus); + struct xilinx_spi_regs *regs = priv->regs; + unsigned char d; + unsigned int i = 0; + + while (rxbytes && !(readl(®s->spisr) & SPISR_RX_EMPTY)) { + d = readl(®s->spidrr) & SPIDRR_8BIT_MASK; + if (rxp) + *rxp++ = d; + debug("spi_xfer: rx:%x\n", d); + rxbytes--; + i++; + } + debug("Rx_done\n"); + + return i; +} + static int xilinx_spi_xfer(struct udevice *dev, unsigned int bitlen, const void *dout, void *din, unsigned long flags) { @@ -168,8 +216,10 @@ static int xilinx_spi_xfer(struct udevice *dev, unsigned int bitlen, unsigned int bytes = bitlen / XILSPI_MAX_XFER_BITS; const unsigned char *txp = dout; unsigned char *rxp = din; - unsigned rxecount = 17; /* max. 16 elements in FIFO, leftover 1 */ - unsigned global_timeout; + u32 txbytes = bytes; + u32 rxbytes = bytes; + u32 reg, count, timeout; + int ret; debug("spi_xfer: bus:%i cs:%i bitlen:%i bytes:%i flags:%lx\n", bus->seq, slave_plat->cs, bitlen, bytes, flags); @@ -184,48 +234,31 @@ static int xilinx_spi_xfer(struct udevice *dev, unsigned int bitlen, goto done; } - /* empty read buffer */ - while (rxecount && !(readl(®s->spisr) & SPISR_RX_EMPTY)) { - readl(®s->spidrr); - rxecount--; - } - - if (!rxecount) { - printf("XILSPI error: Rx buffer not empty\n"); - return -1; - } - if (flags & SPI_XFER_BEGIN) spi_cs_activate(dev, slave_plat->cs); - /* at least 1usec or greater, leftover 1 */ - global_timeout = priv->freq > XILSPI_MAX_XFER_BITS * 100 ? 2 : - (XILSPI_MAX_XFER_BITS * 100 / priv->freq) + 1; - while (bytes--) { - unsigned timeout = global_timeout; - /* get Tx element from data out buffer and count up */ - unsigned char d = txp ? *txp++ : CONFIG_XILINX_SPI_IDLE_VAL; - debug("spi_xfer: tx:%x ", d); + while (txbytes && rxbytes) { + count = xilinx_spi_fill_txfifo(bus, txp, txbytes); + reg = readl(®s->spicr) & ~SPICR_MASTER_INHIBIT; + writel(reg, ®s->spicr); + txbytes -= count; + if (txp) + txp += count; - /*
[U-Boot] [UBOOT PATCH v5 1/4] spi: xilinx: Read reg base address from DTS file
From: Michal Simek This patch added support to read register base address from DTS file. Signed-off-by: Michal Simek Signed-off-by: Vipul Kumar --- Changes in v5: - No change --- drivers/spi/xilinx_spi.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/spi/xilinx_spi.c b/drivers/spi/xilinx_spi.c index 8f0f32f..cc5ac51 100644 --- a/drivers/spi/xilinx_spi.c +++ b/drivers/spi/xilinx_spi.c @@ -77,10 +77,6 @@ #define CONFIG_XILINX_SPI_IDLE_VAL GENMASK(7, 0) #endif -#ifndef CONFIG_SYS_XILINX_SPI_LIST -#define CONFIG_SYS_XILINX_SPI_LIST { CONFIG_SYS_SPI_BASE } -#endif - /* xilinx spi register set */ struct xilinx_spi_regs { u32 __space0__[7]; @@ -107,13 +103,12 @@ struct xilinx_spi_priv { unsigned int mode; }; -static unsigned long xilinx_spi_base_list[] = CONFIG_SYS_XILINX_SPI_LIST; static int xilinx_spi_probe(struct udevice *bus) { struct xilinx_spi_priv *priv = dev_get_priv(bus); struct xilinx_spi_regs *regs = priv->regs; - priv->regs = (struct xilinx_spi_regs *)xilinx_spi_base_list[bus->seq]; + priv->regs = (struct xilinx_spi_regs *)devfdt_get_addr(bus); writel(SPISSR_RESET_VALUE, ®s->srr); -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [UBOOT PATCH v5 4/4] spi: xilinx_spi: convert to livetree
Update the xilinx spi driver to support a live tree. Signed-off-by: Vipul Kumar --- Changes in v5: - No change --- drivers/spi/xilinx_spi.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/spi/xilinx_spi.c b/drivers/spi/xilinx_spi.c index 8621738..2b5f2cf 100644 --- a/drivers/spi/xilinx_spi.c +++ b/drivers/spi/xilinx_spi.c @@ -113,10 +113,9 @@ static int xilinx_spi_probe(struct udevice *bus) struct xilinx_spi_priv *priv = dev_get_priv(bus); struct xilinx_spi_regs *regs = priv->regs; - priv->regs = (struct xilinx_spi_regs *)devfdt_get_addr(bus); + priv->regs = (struct xilinx_spi_regs *)dev_read_addr(bus); - priv->fifo_depth = fdtdec_get_int(gd->fdt_blob, dev_of_offset(bus), - "fifo-size", 0); + priv->fifo_depth = dev_read_u32_default(bus, "fifo-size", 0); writel(SPISSR_RESET_VALUE, ®s->srr); -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [UBOOT PATCH v5 0/4] spi:xilinx_spi: Modify xilinx spi driver
This series of patches do the following: - This patch added support to get reg base address from DTS file - Added rxfifo() and txfifo() functions to add the modularity - Added support to read JEDEC-id twice at the boot time - Added live-tree support Changes in v2: - Split single patch into the series of patches Changes in v3: - Read reg in probe function - Removed xilinx_spi_ofdata_to_platdata function - Added fifo_depth read support in 2/3 and removed from 1/3 Changes in v4: - Moved static startup variable to private structure - Added live-tree support Changes in v5: - Changed function name to xilinx_spi_startup_block() Michal Simek (1): spi: xilinx: Read reg base address from DTS file Vipul Kumar (3): spi: xilinx_spi: Modify transfer logic xilinx_spi_xfer() function spi: xilinx_spi: Added support to read JEDEC-id twice at the boot time spi: xilinx_spi: convert to livetree drivers/spi/xilinx_spi.c | 152 ++- 1 file changed, 110 insertions(+), 42 deletions(-) -- 2.7.4 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 0/5] efi_loader: complete implementation of GetTime()
The EFI runtime service GetTime() is used to read the time form the real time clock. The RTC drivers are made usable even if U-Boot is built without CONFIG_CMD_DATE. RTC drivers not complying to the driver model are now supported by the EFI subsystem. The implementation of the GetTime() runtime service is corrected. A unit test is provided. Heinrich Schuchardt (5): rtc: remove CONFIG_CMD_DATE dependency efi_loader: remove unused efi_get_time_init() efi_loader: complete implementation of GetTime() efi_selftest: support printing leading zeroes efi_selftest: unit test for GetTime() cmd/bootefi.c | 3 - drivers/rtc/at91sam9_rtt.c | 4 - drivers/rtc/davinci.c | 2 - drivers/rtc/ds1302.c| 4 - drivers/rtc/ds1306.c| 4 - drivers/rtc/ds1307.c| 4 - drivers/rtc/ds1337.c| 4 - drivers/rtc/ds1374.c| 3 - drivers/rtc/ds164x.c| 4 - drivers/rtc/ds174x.c| 4 - drivers/rtc/ds3231.c| 4 - drivers/rtc/imxdi.c | 4 - drivers/rtc/m41t11.c| 3 - drivers/rtc/m41t60.c| 3 - drivers/rtc/m41t62.c| 4 - drivers/rtc/m48t35ax.c | 4 - drivers/rtc/max6900.c | 4 - drivers/rtc/mc146818.c | 3 - drivers/rtc/mcfrtc.c| 4 - drivers/rtc/mk48t59.c | 4 - drivers/rtc/pcf8563.c | 4 - drivers/rtc/pl031.c | 4 - drivers/rtc/rs5c372.c | 3 - drivers/rtc/rx8025.c| 4 - drivers/rtc/s3c24x0_rtc.c | 4 - drivers/rtc/x1205.c | 4 - include/efi_loader.h| 1 - lib/efi_loader/efi_runtime.c| 106 +++- lib/efi_selftest/Makefile | 1 + lib/efi_selftest/efi_selftest_console.c | 33 +--- lib/efi_selftest/efi_selftest_rtc.c | 67 +++ 31 files changed, 176 insertions(+), 128 deletions(-) create mode 100644 lib/efi_selftest/efi_selftest_rtc.c -- 2.18.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 3/5] efi_loader: complete implementation of GetTime()
Implement the missing parts of the GetTime() runtime service. Support CONFIG_DM_RTC=n. Fill seconds. Fill daylight saving time flag correctly. Provide dummy values for capabilities. Signed-off-by: Heinrich Schuchardt --- lib/efi_loader/efi_runtime.c | 101 +-- 1 file changed, 86 insertions(+), 15 deletions(-) diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c index 5ec17867fb..20eb3f373d 100644 --- a/lib/efi_loader/efi_runtime.c +++ b/lib/efi_loader/efi_runtime.c @@ -10,6 +10,7 @@ #include #include #include +#include #include /* For manual relocation support */ @@ -117,24 +118,86 @@ static void EFIAPI efi_reset_system_boottime( while (1) { } } +int __weak rtc_get(struct rtc_time *tm) +{ + return 1; +} + +#if defined(CONFIG_SYS_RTC_BUS_NUM) && !defined(CONFIG_DM_RTC) +/** + * efi_set_rtc_i2c_bus - select I2C bus for real time clock + * + * @bus: bus to select, -1 for default + * Return Value: previously selected bus + */ +static int efi_set_rtc_i2c_bus(int bus) +{ + int old_bus; + + if (bus < 0) + bus = CONFIG_SYS_RTC_BUS_NUM; + +#ifdef CONFIG_SYS_I2C + old_bus = i2c_get_bus_num(); + i2c_set_bus_num(bus); +#else + old_bus = I2C_GET_BUS(); + I2C_SET_BUS(bus); +#endif + return old_bus; +} +#endif /* CONFIG_SYS_RTC_BUS_NUM && !CONFIG_DM_RTC */ + +/** + * efi_get_time_boottime - get current time + * + * This function implements the GetTime runtime service. + * See the Unified Extensible Firmware Interface (UEFI) specification + * for details. + * + * @time: pointer to structure to receive current time + * @capabilities: pointer to structure to receive RTC properties + * Return Value: status code + */ static efi_status_t EFIAPI efi_get_time_boottime( struct efi_time *time, struct efi_time_cap *capabilities) { -#if defined(CONFIG_CMD_DATE) && defined(CONFIG_DM_RTC) - struct rtc_time tm; + efi_status_t ret = EFI_SUCCESS; int r; - struct udevice *dev; + struct rtc_time tm; EFI_ENTRY("%p %p", time, capabilities); - r = uclass_get_device(UCLASS_RTC, 0, &dev); - if (r) - return EFI_EXIT(EFI_DEVICE_ERROR); + if (!time) { + ret = EFI_INVALID_PARAMETER; + goto out; + } - r = dm_rtc_get(dev, &tm); - if (r) - return EFI_EXIT(EFI_DEVICE_ERROR); +#ifdef CONFIG_DM_RTC + { + struct udevice *dev; + + r = uclass_get_device(UCLASS_RTC, 0, &dev); + if (!r) + r = dm_rtc_get(dev, &tm); + } +#else + { +#ifdef CONFIG_SYS_RTC_BUS_NUM + int oldbus = efi_set_rtc_i2c_bus(-1); + +#endif + r = rtc_get(&tm); +#ifdef CONFIG_SYS_RTC_BUS_NUM + efi_set_rtc_i2c_bus(oldbus); +#endif + } +#endif + if (r) { + ret = EFI_DEVICE_ERROR; + goto out; + } memset(time, 0, sizeof(*time)); time->year = tm.tm_year; @@ -142,12 +205,20 @@ static efi_status_t EFIAPI efi_get_time_boottime( time->day = tm.tm_mday; time->hour = tm.tm_hour; time->minute = tm.tm_min; - time->daylight = tm.tm_isdst; - - return EFI_EXIT(EFI_SUCCESS); -#else - return EFI_DEVICE_ERROR; -#endif + time->second = tm.tm_sec; + time->daylight = EFI_TIME_ADJUST_DAYLIGHT; + if (tm.tm_isdst > 0) + time->daylight |= EFI_TIME_IN_DAYLIGHT; + time->timezone = EFI_UNSPECIFIED_TIMEZONE; + + if (capabilities) { + /* Set reasonable dummy values */ + capabilities->resolution = 1; /* 1 Hz */ + capabilities->accuracy = 1; /* 100 ppm */ + capabilities->sets_to_zero = false; + } +out: + return EFI_EXIT(ret); } /* Boards may override the helpers below to implement RTS functionality */ -- 2.18.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 2/5] efi_loader: remove unused efi_get_time_init()
Remove unused function efi_get_time_init(). Initialization of the RTC has to be done in board bring up not in the EFI subsystem. Signed-off-by: Heinrich Schuchardt --- cmd/bootefi.c| 3 --- include/efi_loader.h | 1 - lib/efi_loader/efi_runtime.c | 5 - 3 files changed, 9 deletions(-) diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 91277106a2..75d3eb967a 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -80,9 +80,6 @@ efi_status_t efi_init_obj_list(void) ret = efi_reset_system_init(); if (ret != EFI_SUCCESS) goto out; - ret = efi_get_time_init(); - if (ret != EFI_SUCCESS) - goto out; out: efi_obj_list_initialized = ret; diff --git a/include/efi_loader.h b/include/efi_loader.h index d6e1f50e22..cd6c722e00 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -418,7 +418,6 @@ efi_status_t efi_reset_system_init(void); efi_status_t __efi_runtime EFIAPI efi_get_time( struct efi_time *time, struct efi_time_cap *capabilities); -efi_status_t efi_get_time_init(void); #ifdef CONFIG_CMD_BOOTEFI_SELFTEST /* diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c index dd3ff8ad23..5ec17867fb 100644 --- a/lib/efi_loader/efi_runtime.c +++ b/lib/efi_loader/efi_runtime.c @@ -174,11 +174,6 @@ efi_status_t __weak __efi_runtime EFIAPI efi_get_time( return EFI_DEVICE_ERROR; } -efi_status_t __weak efi_get_time_init(void) -{ - return EFI_SUCCESS; -} - struct efi_runtime_detach_list_struct { void *ptr; void *patchto; -- 2.18.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 5/5] efi_selftest: unit test for GetTime()
Provide a unit test for the GetTime() runtime service. Signed-off-by: Heinrich Schuchardt --- lib/efi_selftest/Makefile | 1 + lib/efi_selftest/efi_selftest_rtc.c | 67 + 2 files changed, 68 insertions(+) create mode 100644 lib/efi_selftest/efi_selftest_rtc.c diff --git a/lib/efi_selftest/Makefile b/lib/efi_selftest/Makefile index bf5c8199cb..06b102bc30 100644 --- a/lib/efi_selftest/Makefile +++ b/lib/efi_selftest/Makefile @@ -23,6 +23,7 @@ efi_selftest_exitbootservices.o \ efi_selftest_fdt.o \ efi_selftest_gop.o \ efi_selftest_manageprotocols.o \ +efi_selftest_rtc.o \ efi_selftest_snp.o \ efi_selftest_textinput.o \ efi_selftest_textoutput.o \ diff --git a/lib/efi_selftest/efi_selftest_rtc.c b/lib/efi_selftest/efi_selftest_rtc.c new file mode 100644 index 00..8d440dc0b3 --- /dev/null +++ b/lib/efi_selftest/efi_selftest_rtc.c @@ -0,0 +1,67 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * efi_selftest_rtc + * + * Copyright (c) 2018 Heinrich Schuchardt + * + * Test the real time clock runtime services. + */ + +#include + +#define EFI_ST_NO_RTC "Could not read real time clock\n" + +static struct efi_runtime_services *runtime; + +/* + * Setup unit test. + * + * @handle:handle of the loaded image + * @systable: system table + * @return:EFI_ST_SUCCESS for success + */ +static int setup(const efi_handle_t handle, +const struct efi_system_table *systable) +{ + runtime = systable->runtime; + return EFI_ST_SUCCESS; +} + +/* + * Execute unit test. + * + * Display current time. + * + * @return:EFI_ST_SUCCESS for success + */ +static int execute(void) +{ + efi_status_t ret; + struct efi_time tm; + + /* Display current time */ + ret = runtime->get_time(&tm, NULL); + if (ret != EFI_SUCCESS) { +#ifdef CONFIG_CMD_DATE + efi_st_error(EFI_ST_NO_RTC); + return EFI_ST_FAILURE; +#else + efi_st_todo(EFI_ST_NO_RTC); + return EFI_ST_SUCCESS; +#endif + } else { + efi_st_printf("Time according to real time clock: " + "%.4u-%.2u-%.2u %.2u:%.2u:%.2u\n", + tm.year, tm.month, tm.day, + tm.hour, tm.minute, tm.second); + } + + return EFI_ST_SUCCESS; +} + +EFI_UNIT_TEST(rtc) = { + .name = "real time clock", + .phase = EFI_EXECUTE_BEFORE_BOOTTIME_EXIT, + .setup = setup, + .execute = execute, +}; -- 2.18.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 1/5] rtc: remove CONFIG_CMD_DATE dependency
The EFI subsystem accesses the real time clock and is enabled by default. So we should drop any CONFIG_CMD_DATE dependency from the real time clock drivers. Signed-off-by: Heinrich Schuchardt --- drivers/rtc/at91sam9_rtt.c | 4 drivers/rtc/davinci.c | 2 -- drivers/rtc/ds1302.c | 4 drivers/rtc/ds1306.c | 4 drivers/rtc/ds1307.c | 4 drivers/rtc/ds1337.c | 4 drivers/rtc/ds1374.c | 3 --- drivers/rtc/ds164x.c | 4 drivers/rtc/ds174x.c | 4 drivers/rtc/ds3231.c | 4 drivers/rtc/imxdi.c| 4 drivers/rtc/m41t11.c | 3 --- drivers/rtc/m41t60.c | 3 --- drivers/rtc/m41t62.c | 4 drivers/rtc/m48t35ax.c | 4 drivers/rtc/max6900.c | 4 drivers/rtc/mc146818.c | 3 --- drivers/rtc/mcfrtc.c | 4 drivers/rtc/mk48t59.c | 4 drivers/rtc/pcf8563.c | 4 drivers/rtc/pl031.c| 4 drivers/rtc/rs5c372.c | 3 --- drivers/rtc/rx8025.c | 4 drivers/rtc/s3c24x0_rtc.c | 4 drivers/rtc/x1205.c| 4 25 files changed, 93 deletions(-) diff --git a/drivers/rtc/at91sam9_rtt.c b/drivers/rtc/at91sam9_rtt.c index da5bb3e2f7..6f92660ef1 100644 --- a/drivers/rtc/at91sam9_rtt.c +++ b/drivers/rtc/at91sam9_rtt.c @@ -27,8 +27,6 @@ #include #include -#if defined(CONFIG_CMD_DATE) - int rtc_get (struct rtc_time *tmp) { at91_rtt_t *rtt = (at91_rtt_t *) ATMEL_BASE_RTT; @@ -78,5 +76,3 @@ void rtc_reset (void) while (readl(&rtt->vr) != 0) ; } - -#endif diff --git a/drivers/rtc/davinci.c b/drivers/rtc/davinci.c index f03dc56069..b6930bd839 100644 --- a/drivers/rtc/davinci.c +++ b/drivers/rtc/davinci.c @@ -9,7 +9,6 @@ #include #include -#if defined(CONFIG_CMD_DATE) int rtc_get(struct rtc_time *tmp) { struct davinci_rtc *rtc = (struct davinci_rtc *)DAVINCI_RTC_BASE; @@ -79,4 +78,3 @@ void rtc_reset(void) /* run RTC counter */ writel(0x01, &rtc->ctrl); } -#endif diff --git a/drivers/rtc/ds1302.c b/drivers/rtc/ds1302.c index 87ddd01916..b94163f748 100644 --- a/drivers/rtc/ds1302.c +++ b/drivers/rtc/ds1302.c @@ -9,8 +9,6 @@ #include #include -#if defined(CONFIG_CMD_DATE) - /* GPP Pins */ #define DATA 0x200 #define SCLK 0x400 @@ -328,5 +326,3 @@ int rtc_set(struct rtc_time *tmp) return 0; } - -#endif diff --git a/drivers/rtc/ds1306.c b/drivers/rtc/ds1306.c index bd1e0845aa..02d617e09c 100644 --- a/drivers/rtc/ds1306.c +++ b/drivers/rtc/ds1306.c @@ -19,8 +19,6 @@ #include #include -#if defined(CONFIG_CMD_DATE) - #defineRTC_SECONDS 0x00 #defineRTC_MINUTES 0x01 #defineRTC_HOURS 0x02 @@ -437,5 +435,3 @@ static void rtc_write (unsigned char reg, unsigned char val) } #endif /* end of code exclusion (see #ifdef CONFIG_SXNI855T above) */ - -#endif diff --git a/drivers/rtc/ds1307.c b/drivers/rtc/ds1307.c index cdb088c9b1..48220b45db 100644 --- a/drivers/rtc/ds1307.c +++ b/drivers/rtc/ds1307.c @@ -51,8 +51,6 @@ enum ds_type { #ifndef CONFIG_DM_RTC -#if defined(CONFIG_CMD_DATE) - /*-*/ #undef DEBUG_RTC @@ -204,8 +202,6 @@ static void rtc_write (uchar reg, uchar val) i2c_reg_write (CONFIG_SYS_I2C_RTC_ADDR, reg, val); } -#endif /* CONFIG_CMD_DATE*/ - #endif /* !CONFIG_DM_RTC */ #ifdef CONFIG_DM_RTC diff --git a/drivers/rtc/ds1337.c b/drivers/rtc/ds1337.c index 9a0a214386..9b31048e97 100644 --- a/drivers/rtc/ds1337.c +++ b/drivers/rtc/ds1337.c @@ -15,8 +15,6 @@ #include #include -#if defined(CONFIG_CMD_DATE) - /* * RTC register addresses */ @@ -190,5 +188,3 @@ static void rtc_write (uchar reg, uchar val) { i2c_reg_write (CONFIG_SYS_I2C_RTC_ADDR, reg, val); } - -#endif diff --git a/drivers/rtc/ds1374.c b/drivers/rtc/ds1374.c index bc27f61c72..5a2060fe75 100644 --- a/drivers/rtc/ds1374.c +++ b/drivers/rtc/ds1374.c @@ -18,8 +18,6 @@ #include #include -#if defined(CONFIG_CMD_DATE) - /*-*/ #undef DEBUG_RTC #define DEBUG_RTC @@ -214,4 +212,3 @@ static void rtc_write_raw (uchar reg, uchar val) { i2c_reg_write (CONFIG_SYS_I2C_RTC_ADDR, reg, val); } -#endif diff --git a/drivers/rtc/ds164x.c b/drivers/rtc/ds164x.c index 7ee6214b2b..f8707892e7 100644 --- a/drivers/rtc/ds164x.c +++ b/drivers/rtc/ds164x.c @@ -20,8 +20,6 @@ #include -#if defined(CONFIG_CMD_DATE) - static ucharrtc_read(unsigned int addr ); static void rtc_write(unsigned int addr, uchar val); @@ -171,5 +169,3 @@ static void rtc_write( unsigned int addr, uchar val ) #endif *(volatile unsigned char*)(addr) = val; } - -#endif diff --git a/drivers/rtc/ds174x.c b/drivers/rtc/ds174x.c index b6daf59e80..94f943d97a 100644 --- a/drivers/rtc/ds174x.c +++ b/drivers/rtc/ds174x.c @@ -16,8 +
[U-Boot] [PATCH 4/5] efi_selftest: support printing leading zeroes
Allow specifying the precision when printing integers, e.g. efi_st_printf("%.4u-%.2u-%.2u\n", year, month, day); Signed-off-by: Heinrich Schuchardt --- lib/efi_selftest/efi_selftest_console.c | 33 - 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/lib/efi_selftest/efi_selftest_console.c b/lib/efi_selftest/efi_selftest_console.c index c3655a1fcc..eb139c127c 100644 --- a/lib/efi_selftest/efi_selftest_console.c +++ b/lib/efi_selftest/efi_selftest_console.c @@ -70,11 +70,12 @@ static void pointer(void *pointer, u16 **buf) /* * Print an unsigned 32bit value as decimal number to an u16 string * - * @value: value to be printed - * @buf: pointer to buffer address - * on return position of terminating zero word + * @value: value to be printed + * @prec: minimum number of digits to display + * @buf: pointer to buffer address + * on return position of terminating zero word */ -static void uint2dec(u32 value, u16 **buf) +static void uint2dec(u32 value, int prec, u16 **buf) { u16 *pos = *buf; int i; @@ -93,7 +94,7 @@ static void uint2dec(u32 value, u16 **buf) for (i = 0; i < 10; ++i) { /* Write current digit */ c = f >> 60; - if (c || pos != *buf) + if (c || pos != *buf || 10 - i <= prec) *pos++ = c + '0'; /* Eliminate current digit */ f &= 0xfff; @@ -109,11 +110,12 @@ static void uint2dec(u32 value, u16 **buf) /* * Print a signed 32bit value as decimal number to an u16 string * - * @value: value to be printed - * @buf: pointer to buffer address + * @value: value to be printed + * @prec: minimum number of digits to display + * @buf: pointer to buffer address * on return position of terminating zero word */ -static void int2dec(s32 value, u16 **buf) +static void int2dec(s32 value, int prec, u16 **buf) { u32 u; u16 *pos = *buf; @@ -124,7 +126,7 @@ static void int2dec(s32 value, u16 **buf) } else { u = value; } - uint2dec(u, &pos); + uint2dec(u, prec, &pos); *buf = pos; } @@ -143,6 +145,7 @@ void efi_st_printc(int color, const char *fmt, ...) u16 *pos = buf; const char *s; u16 *u; + int prec; va_start(args, fmt); @@ -172,12 +175,20 @@ void efi_st_printc(int color, const char *fmt, ...) break; case '%': ++c; + /* Parse precision */ + if (*c == '.') { + ++c; + prec = *c - '0'; + ++c; + } else { + prec = 0; + } switch (*c) { case '\0': --c; break; case 'd': - int2dec(va_arg(args, s32), &pos); + int2dec(va_arg(args, s32), prec, &pos); break; case 'p': ++c; @@ -209,7 +220,7 @@ void efi_st_printc(int color, const char *fmt, ...) *pos++ = *s; break; case 'u': - uint2dec(va_arg(args, u32), &pos); + uint2dec(va_arg(args, u32), prec, &pos); break; default: break; -- 2.18.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 01/11] sandbox: eth-raw: Correct valid socket test in send/recv
In open, the socket is correctly checked to be -1 in the error case. In send and recv, we checked for 0, but that is a valid socket number. Correct this by checking for -1 as a bad socket everywhere. Signed-off-by: Joe Hershberger Reviewed-by: Simon Glass --- Changes in v2: None arch/sandbox/cpu/eth-raw-os.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/sandbox/cpu/eth-raw-os.c b/arch/sandbox/cpu/eth-raw-os.c index e054a0702a..61f23ed210 100644 --- a/arch/sandbox/cpu/eth-raw-os.c +++ b/arch/sandbox/cpu/eth-raw-os.c @@ -156,7 +156,7 @@ int sandbox_eth_raw_os_send(void *packet, int length, int retval; struct udphdr *udph = packet + sizeof(struct iphdr); - if (!priv->sd || !priv->device) + if (priv->sd < 0 || !priv->device) return -EINVAL; /* @@ -221,7 +221,7 @@ int sandbox_eth_raw_os_recv(void *packet, int *length, int retval; int saddr_size; - if (!priv->sd || !priv->device) + if (priv->sd < 0 || !priv->device) return -EINVAL; saddr_size = sizeof(struct sockaddr); retval = recvfrom(priv->sd, packet, 1536, 0, -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 00/11] sandbox: net: Fix sandbox eth drivers
It seems as sandbox moved to livetree these drivers were not updated. Heinrich suggested correctly that at this point we should be enumerating network interface names, not hard-coding eth0. Also, there were a few bugs that needed fixing. Changes in v2: - New patch - go back to u8_array - move DT accesses to ofdata_to_platdata() - store the host interface details in priv - switch to dev_read_string() Joe Hershberger (11): sandbox: eth-raw: Correct valid socket test in send/recv sandbox: Fix format of fake-host-hwaddr in test.dts net: Only call halt on a driver that has been init'ed sandbox: eth-raw: Make sure descriptors are always initialized net: Correct comment in Kconfig net: sandbox: Convert sandbox mock eth driver to livetree net: sandbox-raw: Convert raw eth driver to livetree sandbox: eth-raw: Add a function to ask the host about localhost sandbox: eth-raw: Allow interface to be specified by index sandbox: eth-raw: Make random MAC addresses available to eth-raw sandbox: eth-raw: Add a SIMPLE_BUS to enumerate host interfaces arch/sandbox/cpu/eth-raw-os.c | 81 ++- arch/sandbox/dts/sandbox.dts | 19 +++- arch/sandbox/dts/sandbox64.dts| 19 +++- arch/sandbox/dts/test.dts | 8 ++-- arch/sandbox/include/asm/eth-raw-os.h | 38 +++- drivers/net/Kconfig | 2 +- drivers/net/Makefile | 1 + drivers/net/sandbox-raw-bus.c | 65 drivers/net/sandbox-raw.c | 53 ++- drivers/net/sandbox.c | 16 +-- net/eth-uclass.c | 2 +- 11 files changed, 235 insertions(+), 69 deletions(-) create mode 100644 drivers/net/sandbox-raw-bus.c -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 05/11] net: Correct comment in Kconfig
Signed-off-by: Joe Hershberger Reviewed-by: Simon Glass --- Changes in v2: None drivers/net/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index e88f056d84..5f26a0004a 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -8,7 +8,7 @@ config DM_ETH Enable driver model for Ethernet. The eth_*() interface will be implemented by the UC_ETH class - This is currently implemented in net/eth.c + This is currently implemented in net/eth-uclass.c Look in include/net.h for details. config DRIVER_TI_CPSW -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 06/11] net: sandbox: Convert sandbox mock eth driver to livetree
Use the dev_ functions to access DT properties. Signed-off-by: Joe Hershberger --- Changes in v2: - go back to u8_array - move DT accesses to ofdata_to_platdata() drivers/net/sandbox.c | 16 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/net/sandbox.c b/drivers/net/sandbox.c index b34712bd06..b71c8f88d9 100644 --- a/drivers/net/sandbox.c +++ b/drivers/net/sandbox.c @@ -59,10 +59,8 @@ static int sb_eth_start(struct udevice *dev) debug("eth_sandbox: Start\n"); - fdtdec_get_byte_array(gd->fdt_blob, dev_of_offset(dev), - "fake-host-hwaddr", priv->fake_host_hwaddr, - ARP_HLEN); priv->recv_packet_buffer = net_rx_packets[0]; + return 0; } @@ -203,8 +201,18 @@ static int sb_eth_remove(struct udevice *dev) static int sb_eth_ofdata_to_platdata(struct udevice *dev) { struct eth_pdata *pdata = dev_get_platdata(dev); + struct eth_sandbox_priv *priv = dev_get_priv(dev); + const u8 *mac; + + pdata->iobase = dev_read_addr(dev); + + mac = dev_read_u8_array_ptr(dev, "fake-host-hwaddr", ARP_HLEN); + if (!mac) { + printf("'fake-host-hwaddr' is missing from the DT\n"); + return -EINVAL; + } + memcpy(priv->fake_host_hwaddr, mac, ARP_HLEN); - pdata->iobase = devfdt_get_addr(dev); return 0; } -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 08/11] sandbox: eth-raw: Add a function to ask the host about localhost
Instead of doing a simple string compare against "lo", look for the flag that indicates a localhost interface. Signed-off-by: Joe Hershberger --- Changes in v2: None arch/sandbox/cpu/eth-raw-os.c | 27 +++ arch/sandbox/include/asm/eth-raw-os.h | 8 drivers/net/sandbox-raw.c | 10 -- 3 files changed, 39 insertions(+), 6 deletions(-) diff --git a/arch/sandbox/cpu/eth-raw-os.c b/arch/sandbox/cpu/eth-raw-os.c index 82bf666886..12ddb345d9 100644 --- a/arch/sandbox/cpu/eth-raw-os.c +++ b/arch/sandbox/cpu/eth-raw-os.c @@ -1,9 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 /* - * Copyright (c) 2015 National Instruments - * - * (C) Copyright 2015 - * Joe Hershberger + * Copyright (c) 2015-2018 National Instruments + * Copyright (c) 2015-2018 Joe Hershberger */ #include @@ -25,6 +23,27 @@ #include #include +int sandbox_eth_raw_os_is_local(const char *ifname) +{ + int fd = socket(AF_INET, SOCK_DGRAM, 0); + struct ifreq ifr; + int ret = 0; + + if (fd < 0) + return -errno; + memset(&ifr, 0, sizeof(ifr)); + strncpy(ifr.ifr_name, ifname, IFNAMSIZ); + ret = ioctl(fd, SIOCGIFFLAGS, &ifr); + if (ret < 0) { + ret = -errno; + goto out; + } + ret = !!(ifr.ifr_flags & IFF_LOOPBACK); +out: + close(fd); + return ret; +} + static int _raw_packet_start(struct eth_sandbox_raw_priv *priv, unsigned char *ethmac) { diff --git a/arch/sandbox/include/asm/eth-raw-os.h b/arch/sandbox/include/asm/eth-raw-os.h index 760f5fbedd..28988c7970 100644 --- a/arch/sandbox/include/asm/eth-raw-os.h +++ b/arch/sandbox/include/asm/eth-raw-os.h @@ -34,6 +34,14 @@ struct eth_sandbox_raw_priv { unsigned short local_bind_udp_port; }; +/* + * Check if the interface named "ifname" is a localhost interface or not. + * ifname - the interface nome on the host to check + * + * returns - 0 if real interface, 1 if local, negative if error + */ +int sandbox_eth_raw_os_is_local(const char *ifname); + int sandbox_eth_raw_os_start(struct eth_sandbox_raw_priv *priv, unsigned char *ethmac); int sandbox_eth_raw_os_send(void *packet, int length, diff --git a/drivers/net/sandbox-raw.c b/drivers/net/sandbox-raw.c index 317e964019..c04b94c6e1 100644 --- a/drivers/net/sandbox-raw.c +++ b/drivers/net/sandbox-raw.c @@ -29,6 +29,8 @@ static int sb_eth_raw_start(struct udevice *dev) if (priv->local) { env_set("ipaddr", "127.0.0.1"); env_set("serverip", "127.0.0.1"); + net_ip = string_to_ip("127.0.0.1"); + net_server_ip = net_ip; } return ret; } @@ -140,6 +142,7 @@ static int sb_eth_raw_ofdata_to_platdata(struct udevice *dev) struct eth_pdata *pdata = dev_get_platdata(dev); struct eth_sandbox_raw_priv *priv = dev_get_priv(dev); const char *ifname; + u32 local; pdata->iobase = dev_read_addr(dev); @@ -147,10 +150,13 @@ static int sb_eth_raw_ofdata_to_platdata(struct udevice *dev) if (ifname) { strncpy(priv->host_ifname, ifname, IFNAMSIZ); printf(": Using %s from DT\n", priv->host_ifname); - if (strcmp(ifname, "lo") == 0) - priv->local = 1; } + local = sandbox_eth_raw_os_is_local(priv->host_ifname); + if (local < 0) + return local; + priv->local = local; + return 0; } -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 11/11] sandbox: eth-raw: Add a SIMPLE_BUS to enumerate host interfaces
Ask the OS for each of its interfaces and for each one, bind a U-Boot device and then probe it. This will allocate the priv data structure that is then populated. Signed-off-by: Joe Hershberger --- Changes in v2: None arch/sandbox/cpu/eth-raw-os.c | 10 ++ arch/sandbox/dts/sandbox.dts | 19 -- arch/sandbox/dts/sandbox64.dts| 19 -- arch/sandbox/include/asm/eth-raw-os.h | 11 ++ drivers/net/Makefile | 1 + drivers/net/sandbox-raw-bus.c | 65 +++ 6 files changed, 99 insertions(+), 26 deletions(-) create mode 100644 drivers/net/sandbox-raw-bus.c diff --git a/arch/sandbox/cpu/eth-raw-os.c b/arch/sandbox/cpu/eth-raw-os.c index df7acaa0bc..75bfaa4c90 100644 --- a/arch/sandbox/cpu/eth-raw-os.c +++ b/arch/sandbox/cpu/eth-raw-os.c @@ -23,6 +23,16 @@ #include #include +struct sandbox_eth_raw_if_nameindex *sandbox_eth_raw_if_nameindex(void) +{ + return (struct sandbox_eth_raw_if_nameindex *)if_nameindex(); +} + +void sandbox_eth_raw_if_freenameindex(struct sandbox_eth_raw_if_nameindex *ptr) +{ + if_freenameindex((struct if_nameindex *)ptr); +} + int sandbox_eth_raw_os_is_local(const char *ifname) { int fd = socket(AF_INET, SOCK_DGRAM, 0); diff --git a/arch/sandbox/dts/sandbox.dts b/arch/sandbox/dts/sandbox.dts index 0ea2452742..9164194023 100644 --- a/arch/sandbox/dts/sandbox.dts +++ b/arch/sandbox/dts/sandbox.dts @@ -8,7 +8,6 @@ model = "sandbox"; aliases { - eth5 = "/eth@9000"; i2c0 = &i2c_0; pci0 = &pci; rtc0 = &rtc_0; @@ -47,24 +46,18 @@ }; }; + ethrawbus { + reg = <0 0>; + compatible = "sandbox,eth-raw-bus"; + skip-localhost = <0>; + }; + eth@10002000 { compatible = "sandbox,eth"; reg = <0x10002000 0x1000>; fake-host-hwaddr = [00 00 66 44 22 00]; }; - eth@8000 { - compatible = "sandbox,eth-raw"; - reg = <0x8000 0x1000>; - host-raw-interface = "eth0"; - }; - - eth@9000 { - compatible = "sandbox,eth-raw"; - reg = <0x9000 0x1000>; - host-raw-interface = "lo"; - }; - gpio_a: gpios@0 { gpio-controller; compatible = "sandbox,gpio"; diff --git a/arch/sandbox/dts/sandbox64.dts b/arch/sandbox/dts/sandbox64.dts index 48e420e721..4a2fa9908e 100644 --- a/arch/sandbox/dts/sandbox64.dts +++ b/arch/sandbox/dts/sandbox64.dts @@ -8,7 +8,6 @@ model = "sandbox"; aliases { - eth5 = "/eth@9000"; i2c0 = &i2c_0; pci0 = &pci; rtc0 = &rtc_0; @@ -47,24 +46,18 @@ }; }; + ethrawbus { + reg = <0 0>; + compatible = "sandbox,eth-raw-bus"; + skip-localhost = <1>; + }; + eth@10002000 { compatible = "sandbox,eth"; reg = <0x0 0x10002000 0x0 0x1000>; fake-host-hwaddr = [00 00 66 44 22 00]; }; - eth@8000 { - compatible = "sandbox,eth-raw"; - reg = <0x0 0x8000 0x0 0x1000>; - host-raw-interface = "eth0"; - }; - - eth@9000 { - compatible = "sandbox,eth-raw"; - reg = <0x0 0x9000 0x0 0x1000>; - host-raw-interface = "lo"; - }; - gpio_a: gpios@0 { gpio-controller; compatible = "sandbox,gpio"; diff --git a/arch/sandbox/include/asm/eth-raw-os.h b/arch/sandbox/include/asm/eth-raw-os.h index bd352e9db4..50ec56ec16 100644 --- a/arch/sandbox/include/asm/eth-raw-os.h +++ b/arch/sandbox/include/asm/eth-raw-os.h @@ -34,6 +34,17 @@ struct eth_sandbox_raw_priv { unsigned short local_bind_udp_port; }; +/* A struct to mimic if_nameindex but that does not depend on Linux headers */ +struct sandbox_eth_raw_if_nameindex { + unsigned int if_index; /* Index of interface (1, 2, ...) */ + char*if_name; /* Null-terminated name ("eth0", etc.) */ +}; + +/* Enumerate host network interfaces */ +struct sandbox_eth_raw_if_nameindex *sandbox_eth_raw_if_nameindex(void); +/* Free the data structure of enumerated network interfaces */ +void sandbox_eth_raw_if_freenameindex(struct sandbox_eth_raw_if_nameindex *ptr); + /* * Check if the interface named "ifname" is a localhost interface or not. * ifname - the interface nome on the host to check diff --git a/drivers/net/Makefile b/drivers/net/Makefile index 058dd00768..c1ed44e21f 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile @@ -50,6 +50,7 @@ obj-$(CONFIG_RTL8139) += rtl8139.o obj-$(CONFIG_RTL8169) += rtl8169.o obj-$(CONFIG_ETH_SANDBOX) += sandbox.o obj-$(CONFIG_ETH_SAND
[U-Boot] [PATCH v2 09/11] sandbox: eth-raw: Allow interface to be specified by index
With systemd stable interface names, eth0 will almost never exist. Instead of using that name in the sandbox.dts, use an index. Signed-off-by: Joe Hershberger --- Changes in v2: None arch/sandbox/cpu/eth-raw-os.c | 7 +++ arch/sandbox/include/asm/eth-raw-os.h | 9 + drivers/net/sandbox-raw.c | 11 +++ 3 files changed, 27 insertions(+) diff --git a/arch/sandbox/cpu/eth-raw-os.c b/arch/sandbox/cpu/eth-raw-os.c index 12ddb345d9..df7acaa0bc 100644 --- a/arch/sandbox/cpu/eth-raw-os.c +++ b/arch/sandbox/cpu/eth-raw-os.c @@ -44,6 +44,13 @@ out: return ret; } +int sandbox_eth_raw_os_idx_to_name(struct eth_sandbox_raw_priv *priv) +{ + if (!if_indextoname(priv->host_ifindex, priv->host_ifname)) + return -errno; + return 0; +} + static int _raw_packet_start(struct eth_sandbox_raw_priv *priv, unsigned char *ethmac) { diff --git a/arch/sandbox/include/asm/eth-raw-os.h b/arch/sandbox/include/asm/eth-raw-os.h index 28988c7970..bd352e9db4 100644 --- a/arch/sandbox/include/asm/eth-raw-os.h +++ b/arch/sandbox/include/asm/eth-raw-os.h @@ -42,6 +42,15 @@ struct eth_sandbox_raw_priv { */ int sandbox_eth_raw_os_is_local(const char *ifname); +/* + * Look up the name of the interface based on the ifindex populated in priv. + * + * Overwrite the host_ifname member in priv based on looking up host_ifindex + * + * returns - 0 if success, negative if error + */ +int sandbox_eth_raw_os_idx_to_name(struct eth_sandbox_raw_priv *priv); + int sandbox_eth_raw_os_start(struct eth_sandbox_raw_priv *priv, unsigned char *ethmac); int sandbox_eth_raw_os_send(void *packet, int length, diff --git a/drivers/net/sandbox-raw.c b/drivers/net/sandbox-raw.c index c04b94c6e1..0d1fd4d931 100644 --- a/drivers/net/sandbox-raw.c +++ b/drivers/net/sandbox-raw.c @@ -143,6 +143,7 @@ static int sb_eth_raw_ofdata_to_platdata(struct udevice *dev) struct eth_sandbox_raw_priv *priv = dev_get_priv(dev); const char *ifname; u32 local; + int ret; pdata->iobase = dev_read_addr(dev); @@ -151,6 +152,16 @@ static int sb_eth_raw_ofdata_to_platdata(struct udevice *dev) strncpy(priv->host_ifname, ifname, IFNAMSIZ); printf(": Using %s from DT\n", priv->host_ifname); } + if (dev_read_u32(dev, "host-raw-interface-idx", +&priv->host_ifindex) < 0) { + priv->host_ifindex = 0; + } else { + ret = sandbox_eth_raw_os_idx_to_name(priv); + if (ret < 0) + return ret; + printf(": Using interface index %d from DT (%s)\n", + priv->host_ifindex, priv->host_ifname); + } local = sandbox_eth_raw_os_is_local(priv->host_ifname); if (local < 0) -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 02/11] sandbox: Fix format of fake-host-hwaddr in test.dts
test.dts specified the fake MAC address as a u32 array. Instead it should be a u8 array. Signed-off-by: Joe Hershberger --- Changes in v2: - New patch arch/sandbox/dts/test.dts | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts index 5752bf547e..1b5ef430d2 100644 --- a/arch/sandbox/dts/test.dts +++ b/arch/sandbox/dts/test.dts @@ -155,25 +155,25 @@ eth@10002000 { compatible = "sandbox,eth"; reg = <0x10002000 0x1000>; - fake-host-hwaddr = <0x00 0x00 0x66 0x44 0x22 0x00>; + fake-host-hwaddr = [00 00 66 44 22 00]; }; eth_5: eth@10003000 { compatible = "sandbox,eth"; reg = <0x10003000 0x1000>; - fake-host-hwaddr = <0x00 0x00 0x66 0x44 0x22 0x11>; + fake-host-hwaddr = [00 00 66 44 22 11]; }; eth_3: sbe5 { compatible = "sandbox,eth"; reg = <0x10005000 0x1000>; - fake-host-hwaddr = <0x00 0x00 0x66 0x44 0x22 0x33>; + fake-host-hwaddr = [00 00 66 44 22 33]; }; eth@10004000 { compatible = "sandbox,eth"; reg = <0x10004000 0x1000>; - fake-host-hwaddr = <0x00 0x00 0x66 0x44 0x22 0x22>; + fake-host-hwaddr = [00 00 66 44 22 22]; }; gpio_a: base-gpios { -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 04/11] sandbox: eth-raw: Make sure descriptors are always initialized
If we let descriptors equal 0, we can end up closing STDIN. Make sure they start out as -1. Signed-off-by: Joe Hershberger --- Changes in v2: None arch/sandbox/cpu/eth-raw-os.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/sandbox/cpu/eth-raw-os.c b/arch/sandbox/cpu/eth-raw-os.c index 61f23ed210..4263d8829a 100644 --- a/arch/sandbox/cpu/eth-raw-os.c +++ b/arch/sandbox/cpu/eth-raw-os.c @@ -34,6 +34,7 @@ static int _raw_packet_start(const char *ifname, unsigned char *ethmac, int flags; /* Prepare device struct */ + priv->local_bind_sd = -1; priv->device = malloc(sizeof(struct sockaddr_ll)); if (priv->device == NULL) return -ENOMEM; @@ -103,6 +104,8 @@ static int _local_inet_start(struct eth_sandbox_raw_priv *priv) int one = 1; /* Prepare device struct */ + priv->local_bind_sd = -1; + priv->local_bind_udp_port = 0; priv->device = malloc(sizeof(struct sockaddr_in)); if (priv->device == NULL) return -ENOMEM; @@ -136,8 +139,6 @@ static int _local_inet_start(struct eth_sandbox_raw_priv *priv) strerror(errno)); return -errno; } - priv->local_bind_sd = -1; - priv->local_bind_udp_port = 0; return 0; } -- 2.11.0 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot