platform/kernel/u-boot.git
6 years agoAdd a header file for strings
Simon Glass [Mon, 1 Oct 2018 18:22:34 +0000 (12:22 -0600)]
Add a header file for strings

Add a string.h header for libraries that expect this to be available, now
that U-Boot's version has moved to include/linux.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agolog: Add comments to the rest of the log categories
Simon Glass [Mon, 1 Oct 2018 18:22:32 +0000 (12:22 -0600)]
log: Add comments to the rest of the log categories

At present some of the log categories are missing comments. Add them.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agobinman: Move to three-digit test-file numbers
Simon Glass [Mon, 1 Oct 2018 18:22:30 +0000 (12:22 -0600)]
binman: Move to three-digit test-file numbers

We now have 99 tests. Before adding any more, rename everything to three
digits. This helps to preserve the ordering of tests and makes it easier
to find things.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agotpm: Add a few new commands for v1
Simon Glass [Mon, 1 Oct 2018 18:22:29 +0000 (12:22 -0600)]
tpm: Add a few new commands for v1

These are needed for the 2018 version of Chromium OS vboot. Add an
implementation for TPM v1, with v2 to come later.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agotpm: Tidy up logging in tpm-common.c
Simon Glass [Mon, 1 Oct 2018 18:22:28 +0000 (12:22 -0600)]
tpm: Tidy up logging in tpm-common.c

At present this file uses logging but it should use the new macros. Update
it and add a log message for an error.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agotpm: Use livetree and allow children
Simon Glass [Mon, 1 Oct 2018 18:22:27 +0000 (12:22 -0600)]
tpm: Use livetree and allow children

Adjust the TPM drivers to use livetree (only one does not). Also,
sometimes TPMs can have child devices if they provide a service to the
system (such as storing secure data), so permit that.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agovideo: Adjust video_clear() to return an error
Simon Glass [Mon, 1 Oct 2018 18:22:26 +0000 (12:22 -0600)]
video: Adjust video_clear() to return an error

All driver-model operation should return an error code. Adjust this
function to do so also.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>
6 years agofdt: Remove fdtdec_decode_region() function
Simon Glass [Mon, 1 Oct 2018 18:22:25 +0000 (12:22 -0600)]
fdt: Remove fdtdec_decode_region() function

This function is not used in U-Boot now. Remove it along with its 'memory'
version.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agodm: spi: Add logging of some return values
Simon Glass [Mon, 1 Oct 2018 18:22:24 +0000 (12:22 -0600)]
dm: spi: Add logging of some return values

When SPI flash operations fail it is helpful to be able to see the error
codes and where they are generated. Add logging to capture this
information for read operations.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agocros: Adjust board_get_cros_ec_dev() to return a udevice
Simon Glass [Mon, 1 Oct 2018 18:22:23 +0000 (12:22 -0600)]
cros: Adjust board_get_cros_ec_dev() to return a udevice

Rather than returning what is effectively an internal data structure,
return the cros EC device itself.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agocros: Update cros_ec code to use struct udevice
Simon Glass [Mon, 1 Oct 2018 18:22:22 +0000 (12:22 -0600)]
cros: Update cros_ec code to use struct udevice

At present we pass around a private pointer to specify the cros_ec device.
With driver model it makes more sense to pass the device. Update the code
to do this.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agofdt: Allow libfdt in TPL
Simon Glass [Mon, 1 Oct 2018 18:22:21 +0000 (12:22 -0600)]
fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agoserial: Allow serial to be absent in TPL
Simon Glass [Mon, 1 Oct 2018 18:22:20 +0000 (12:22 -0600)]
serial: Allow serial to be absent in TPL

At present this option applies to SPL, but it should be available in TPL
also, and separately. Change to using CONFIG_IS_ENABLED(), add a new
Kconfig option and fix up hang().

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agotpm: Add support for SPL and TPL
Simon Glass [Mon, 1 Oct 2018 18:22:19 +0000 (12:22 -0600)]
tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agofdt: Allow indicating a node is for U-Boot proper only
Simon Glass [Mon, 1 Oct 2018 18:22:18 +0000 (12:22 -0600)]
fdt: Allow indicating a node is for U-Boot proper only

At present it is not possible to specify that a node should be used before
relocation (in U-Boot proper) without it also ending up in SPL and TPL
device trees. Add a new "u-boot,dm-pre-proper" boolean property for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agodoc: Update docs for device tree in SPL, TPL
Simon Glass [Mon, 1 Oct 2018 18:22:17 +0000 (12:22 -0600)]
doc: Update docs for device tree in SPL, TPL

Make a few small updates to indicate that device tree can be used in SPL
and TPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agofdt: Document the fact that dtc is now built
Simon Glass [Mon, 1 Oct 2018 18:22:16 +0000 (12:22 -0600)]
fdt: Document the fact that dtc is now built

This documentation is out of date now that U-Boot builds dtc
automatically. Update it.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agortc: Allow use of RTC in SPL and TPL
Simon Glass [Mon, 1 Oct 2018 18:22:15 +0000 (12:22 -0600)]
rtc: Allow use of RTC in SPL and TPL

Add Kconfig options so that the RTC can be used in SPL and TPL. This is
helpful for accessing the contents of CMOS RAM, for example.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agoKconfig: Convert CONFIG_RTC_MC146818 to Kconfig
Simon Glass [Mon, 1 Oct 2018 18:22:14 +0000 (12:22 -0600)]
Kconfig: Convert CONFIG_RTC_MC146818 to Kconfig

Move this option to Kconfig and tidy up the two boards which use it.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agoblk: Support block drivers in TPL
Simon Glass [Mon, 1 Oct 2018 18:22:13 +0000 (12:22 -0600)]
blk: Support block drivers in TPL

At present it is not possible to enable/disable block drivers in TPL. This
is needed to provide sandbox support. Add a Kconfig option and adjust the
Makefile.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agoMakefile: Add a warning if SPL/TPL cannot be built
Simon Glass [Mon, 1 Oct 2018 18:22:11 +0000 (12:22 -0600)]
Makefile: Add a warning if SPL/TPL cannot be built

At present the build fails in strange ways if CONFIG_SPL is defined by
CONFIG_SUPPORT_SPL is not. Add a warning for this case as it can be very
confusing to debug.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agospl: input: Allow input in SPL and TPL
Simon Glass [Mon, 1 Oct 2018 18:22:10 +0000 (12:22 -0600)]
spl: input: Allow input in SPL and TPL

In some cases it is necessary to read the keyboard in early phases of
U-Boot. Update the config to allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agosf: Avoid allocating memory on every read operation
Simon Glass [Mon, 1 Oct 2018 18:22:09 +0000 (12:22 -0600)]
sf: Avoid allocating memory on every read operation

At present spi_flash_cmd_read_ops() allocates and frees a few bytes of
memory every time it is called. It is faster to use the stack for this
and this is now supported by the minimum GCC version required by U-Boot.

Remove the allocation and use a variable-sized array instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agodm: core: Update ofnode to read binman-style flash entry
Simon Glass [Mon, 1 Oct 2018 18:22:08 +0000 (12:22 -0600)]
dm: core: Update ofnode to read binman-style flash entry

At present ofnode_read_fmap_entry() reads a flash map entry in a format
which is not supported by binman. To allow use to use binman-format
descriptions, update this function.

Also add a simple test.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agodm: core: Add a function to find the first inactive child
Simon Glass [Mon, 1 Oct 2018 18:22:07 +0000 (12:22 -0600)]
dm: core: Add a function to find the first inactive child

Some devices have children and want to press an existing inactive child
into service when needed. Add a function to help with this.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agodm: core: Update some functions to use const
Simon Glass [Mon, 1 Oct 2018 18:22:06 +0000 (12:22 -0600)]
dm: core: Update some functions to use const

Quite a few functions do not actually modify the device that is passed in.
Update the function signatures to reflect that.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agodm: core: Alloc uclass-private data to be cache-aligned
Simon Glass [Mon, 1 Oct 2018 18:22:05 +0000 (12:22 -0600)]
dm: core: Alloc uclass-private data to be cache-aligned

There is no reason why this feature should not be supported for uclass-
private data. Update the code accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agosandbox: Restore blocking I/O on exit
Simon Glass [Mon, 1 Oct 2018 17:55:20 +0000 (11:55 -0600)]
sandbox: Restore blocking I/O on exit

At present sandbox sets non-blocking I/O as soon as any input is read
from the terminal. However it does not restore the previous state on
exit. Fix this and drop the old os_read_no_block() function.

This means that we always enable blocking I/O in sandbox (if input is a
terminal) whereas previously it would only happen on the first call to
tstc() or getc(). However, the difference is likely not important.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agodm: spi: Clean up detection of sandbox SPI emulator
Simon Glass [Mon, 1 Oct 2018 17:55:19 +0000 (11:55 -0600)]
dm: spi: Clean up detection of sandbox SPI emulator

Now that we don't have to deal with the command-line flag we can simplify
the code for detecting the emulator. Remove the lookup based on the SPI
specification, relying just on the device tree to locate the emulator.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agosandbox: tpm: Enhance to support the latest Chromium OS
Simon Glass [Mon, 1 Oct 2018 17:55:18 +0000 (11:55 -0600)]
sandbox: tpm: Enhance to support the latest Chromium OS

This driver was originally written against Chromium OS circa 2012. A few
new features have been added. Enhance the TPM driver to match. This mostly
includes a few new messages and properly modelling whether a particular
'space' is present or not.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agosandbox: tpm: Tidy up enums and return values
Simon Glass [Mon, 1 Oct 2018 17:55:17 +0000 (11:55 -0600)]
sandbox: tpm: Tidy up enums and return values

Use an enum for command values instead of open-coding them. This removes
the need for comments. Also make sure the driver returns proper error
numbers instead of -1.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agoserial: sandbox: Allow serial output without device tree
Simon Glass [Mon, 1 Oct 2018 17:55:16 +0000 (11:55 -0600)]
serial: sandbox: Allow serial output without device tree

At present sandbox assumes that device-tree control is active, but this
may not be the case in SPL or TPL. Add some conditions to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agosandbox: Add a debug UART
Simon Glass [Mon, 1 Oct 2018 17:55:15 +0000 (11:55 -0600)]
sandbox: Add a debug UART

Add support for the debug UART so that sandbox provides build testing for
this feature.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agosandbox: video: Speed up video output
Simon Glass [Mon, 1 Oct 2018 17:55:14 +0000 (11:55 -0600)]
sandbox: video: Speed up video output

At present there are many situations where sandbox syncs the display to
the SDL frame buffer. This is a very expensive operation but is only
needed every now and then. Update video_sync() so that we can specify
whether this operation is really needed.

At present this flag is not used on other architectures. It could also
be used for reducing writeback-cache flushes but the benefit of that would
need to be investigated.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>
6 years agosandbox: spi: Add more logging
Simon Glass [Mon, 1 Oct 2018 17:55:13 +0000 (11:55 -0600)]
sandbox: spi: Add more logging

Add logging to aid debugging features in these drivers. Also drop some
code in sandbox_spi_xfer() which is not used.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agosandbox: Remove the old memory file later
Simon Glass [Mon, 1 Oct 2018 17:55:12 +0000 (11:55 -0600)]
sandbox: Remove the old memory file later

When debugging sandbox it is sometimes annoying that the memory file is
deleted early on. If sandbox later crashes or we quit (using the
debugger), it is not possible to run it again with the same state since
the memory file is gone.

Remove the old memory file when sandbox exits, instead. Also add debugging
showing the memory filename.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agosandbox: Add a flag to set the default log level
Simon Glass [Mon, 1 Oct 2018 17:55:11 +0000 (11:55 -0600)]
sandbox: Add a flag to set the default log level

It is useful to be able to set the default log level from the command line
when running sandbox. Add a new -L command-line flag for this. The log
level is set using the enum log_level_t in log.h. At present a number must
be specified, e.g. -L7 for debug.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agosandbox: Support booting from TPL to SPL
Simon Glass [Mon, 1 Oct 2018 17:55:10 +0000 (11:55 -0600)]
sandbox: Support booting from TPL to SPL

At present we support booting from SPL to U-Boot proper. Add support for
the previous stage too, so sandbox can be started with TPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agosandbox: spi: Drop command-line SPI option
Simon Glass [Mon, 1 Oct 2018 17:55:09 +0000 (11:55 -0600)]
sandbox: spi: Drop command-line SPI option

At present we support specifying SPI flash devices to use in the device
tree and on the command line. Drop the second option, since it is a pain
to support nicely with driver model, and unnecessary.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agosandbox: Add a way to write data to the host filesystem
Simon Glass [Mon, 1 Oct 2018 17:55:08 +0000 (11:55 -0600)]
sandbox: Add a way to write data to the host filesystem

For debugging it is sometimes useful to write out data for inspection
using an external tool. Add a function which can write this data to a
given file.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agosandbox: Support file truncation with os_open()
Simon Glass [Mon, 1 Oct 2018 17:55:07 +0000 (11:55 -0600)]
sandbox: Support file truncation with os_open()

At present files are not truncated on writing. This is a useful feature.
Add support for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agolog: Add helpers for common log levels
Simon Glass [Mon, 1 Oct 2018 17:55:06 +0000 (11:55 -0600)]
log: Add helpers for common log levels

At present to output a log message you need something like:

   log(UCLASS_SPI, LOCL_INFO, "message1");
   log(UCLASS_SPI, LOCL_INFO, "message2");

but many files use the same category throughout. Also it is helpful to
shorten the length of log names, providing helpers for common logging
levels. Add some macros so that it is possible to do:

   (top of file, before #includes)
   #define LOG_CATEGORY UCLASS_SPI

   (later in the file)
   log_info("message1");
   log_debug("message2");
   log_err("message3");

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agolog: Correct definition of log_msg_ret()
Simon Glass [Tue, 2 Oct 2018 11:22:31 +0000 (05:22 -0600)]
log: Correct definition of log_msg_ret()

This macro should have two parameters, not one. Fix it so that it
correctly resolves to _ret when logging is disabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agoofnode: Add missing address translation into ofnode_get_addr_size()
Marek Vasut [Mon, 1 Oct 2018 10:37:20 +0000 (12:37 +0200)]
ofnode: Add missing address translation into ofnode_get_addr_size()

Of CONFIG_OF_TRANSLATE is enabled, this function still returns
untranslated bogus results. Add the missing translation.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoofnode: Replace of_n_addr_cells with of_n_size_cells
Marek Vasut [Mon, 1 Oct 2018 10:37:19 +0000 (12:37 +0200)]
ofnode: Replace of_n_addr_cells with of_n_size_cells

The size should be decoded using of_n_size_cells(), make it so.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agobinman: Run tests concurrently
Simon Glass [Tue, 2 Oct 2018 03:12:47 +0000 (21:12 -0600)]
binman: Run tests concurrently

At present the tests run one after the other using a single CPU. This is
not very efficient. Bring in the concurrencytest module and run the tests
concurrently, using one process for each CPU by default. A -P option
allows this to be overridden, which is necessary for code-coverage to
function correctly.

This requires fixing a few tests which are currently not fully
independent.

At some point we might consider doing this across all pytests in U-Boot.
There is a pytest version that supports specifying the number of processes
to use, but it did not work for me.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agotest: Reduce the number of tests run with sandbox_flattree
Simon Glass [Tue, 2 Oct 2018 03:12:46 +0000 (21:12 -0600)]
test: Reduce the number of tests run with sandbox_flattree

We only need to run driver-model tests with this config, since this is the
only thing that is different when CONFIG_OF_LIVE is not defined. Filter
out the other tests to same time.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agopatman: Don't clear progress in tout unless it was used
Simon Glass [Tue, 2 Oct 2018 03:12:45 +0000 (21:12 -0600)]
patman: Don't clear progress in tout unless it was used

At present calling Uninit() always called ClearProgress() which outputs
a \r character as well as spaces to remove any progress information on the
line. This can mess up the normal output of binman and other tools. Fix
this by outputing this only when progress information has actually been
previous written.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agotools: Set an initial value for indir
Simon Glass [Tue, 2 Oct 2018 03:12:44 +0000 (21:12 -0600)]
tools: Set an initial value for indir

This variable is not documented or set up in the module. Fix this.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agobuildman: dtoc: Suppress unwanted output from test
Simon Glass [Tue, 2 Oct 2018 03:12:43 +0000 (21:12 -0600)]
buildman: dtoc: Suppress unwanted output from test

There are a few test cases which print output. Suppress this so that tests
can run silently in the normal case.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agobinman: Separate out testSplBssPad()
Simon Glass [Tue, 2 Oct 2018 03:12:42 +0000 (21:12 -0600)]
binman: Separate out testSplBssPad()

At present this test runs binman twice, which means that the temporary
files from the first run do not get cleaned up. Split this into two tests
to fix this problem.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agobinman: Fix up removal of temporary directories
Simon Glass [Tue, 2 Oct 2018 03:12:41 +0000 (21:12 -0600)]
binman: Fix up removal of temporary directories

At present 'make check' leaves some temporary directories around. Part of
this is because we call tools.PrepareOutputDir() twice in some cases,
without calling tools.FinaliseOutputDir() in between.

Fix this.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agobinman: Add a default path to libfdt.py
Simon Glass [Tue, 2 Oct 2018 03:12:40 +0000 (21:12 -0600)]
binman: Add a default path to libfdt.py

This module is often available in the sandbox_spl build created by
'make check'. Use this as a default path so that just typing 'binman -t'
(without setting PYTHONPATH) will generally run the tests.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agotest: Tidy up comments and variable name
Simon Glass [Tue, 2 Oct 2018 03:12:39 +0000 (21:12 -0600)]
test: Tidy up comments and variable name

The 'result' variable counts the number of failures in running the tests.
Rename it to 'failures' to make this more obvious. Also tidy up a few
comments.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agotest: Print the name of each test before running it
Simon Glass [Tue, 2 Oct 2018 03:12:38 +0000 (21:12 -0600)]
test: Print the name of each test before running it

At present the tests are run without any indication of what is running.
For the tests which start with a build this is pretty obvious, but for
tools it is not.

Add a name for each test we run, and print it before starting the test.
Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agotest: Simplify the PATH setup
Simon Glass [Tue, 2 Oct 2018 03:12:37 +0000 (21:12 -0600)]
test: Simplify the PATH setup

Use 'export' to avoid repeating the path setup for each command.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agoMakefile: Add a 'check' target for make
Simon Glass [Tue, 2 Oct 2018 03:12:36 +0000 (21:12 -0600)]
Makefile: Add a 'check' target for make

At present we use 'make tests' to run the tests. For many projects
'make check' is more common, so support that as well. Also add some help
to 'make help'.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agobuildman: Make the toolchain test more forgiving
Simon Glass [Tue, 2 Oct 2018 03:12:35 +0000 (21:12 -0600)]
buildman: Make the toolchain test more forgiving

The filenames of the toolchains on kernel.org changes every now and then.
Fix it for the current change, and make the test use a regex so that it
has a better chance of passing with future changes too.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agotest/py: Fix unicode handling for log filtering
Simon Glass [Tue, 2 Oct 2018 03:12:34 +0000 (21:12 -0600)]
test/py: Fix unicode handling for log filtering

At present the unicode filtering seems to get confused at times with
this error:

  UnicodeDecodeError: 'ascii' codec can't decode byte 0x80 in position
     32: ordinal not in range(128)

It seems to be due to self._nonprint being interpreted as UTF-8. Fix it
by using ordinals instead of characters, changing the string to set.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Tested-by: Michal Simek <michal.simek@xilinx.com>
6 years agopatman: Handle unicode in _ProjectConfigParser tests
Simon Glass [Tue, 2 Oct 2018 03:12:33 +0000 (21:12 -0600)]
patman: Handle unicode in _ProjectConfigParser tests

With Python 2.7.15rc1, ConfigParser.SafeConfigParser has unfortunately
started returning unicode, for unknown reasons. Adjust the code to handle
this by converting everything to unicode. We cannot convert things to
ASCII since email addresses may be encoded with UTF-8.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agosandbox: Unprotect DATA regions in bus tests
Simon Glass [Tue, 2 Oct 2018 03:12:32 +0000 (21:12 -0600)]
sandbox: Unprotect DATA regions in bus tests

On my Ubuntu 18.04.1 machine two driver-model bus tests have started
failing recently. The problem appears to be that the DATA region of the
executable is protected. This does not seem correct, but perhaps there
is a reason.

To work around it, unprotect the regions in these tests before accessing
them.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agoKconfig: sandbox: enable cmd_avb and dependencies
Jens Wiklander [Tue, 25 Sep 2018 14:40:23 +0000 (16:40 +0200)]
Kconfig: sandbox: enable cmd_avb and dependencies

Enables cmd_avb and its dependencies need to run the AVB tests.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
[trini: Disable for sandbox_noblk]
Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agoavb_verify: support sandbox configuration
Jens Wiklander [Tue, 25 Sep 2018 14:40:22 +0000 (16:40 +0200)]
avb_verify: support sandbox configuration

Change get_sector_buf() to use map_sysmem() to get a pointer to the
CONFIG_FASTBOOT_BUF_ADDR in memory.

Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agotest_avb: Update pymark.buildconfigspec information for the AVB tests
Jens Wiklander [Tue, 25 Sep 2018 14:40:21 +0000 (16:40 +0200)]
test_avb: Update pymark.buildconfigspec information for the AVB tests

Update the pymark.buildconfigspec to depend on 'cmd_mmc' in addition to
'cmd_avb' for those tests that needs more a more complete MMC
implementation or the "mmc" command.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
6 years agoavb_verify: support using OP-TEE TA AVB
Jens Wiklander [Tue, 25 Sep 2018 14:40:20 +0000 (16:40 +0200)]
avb_verify: support using OP-TEE TA AVB

With CONFIG_OPTEE_TA_AVB use the trusted application AVB provided by
OP-TEE to manage rollback indexes and device-lock status.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
6 years agotest: tee: test TEE uclass
Jens Wiklander [Tue, 25 Sep 2018 14:40:19 +0000 (16:40 +0200)]
test: tee: test TEE uclass

Tests the TEE uclass with a sandbox tee driver.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
[trini: initialize session to 0 in dm_test_tee]
Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agotee: add sandbox driver
Jens Wiklander [Tue, 25 Sep 2018 14:40:18 +0000 (16:40 +0200)]
tee: add sandbox driver

Adds a sandbox tee driver which emulates a generic TEE with the OP-TEE
AVB TA.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
[trini: Fix printf warnings in ta_avb_invoke_func, slots is uint]
Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agosandbox: imply CONFIG_TEE (TEE uclass)
Jens Wiklander [Tue, 25 Sep 2018 14:40:17 +0000 (16:40 +0200)]
sandbox: imply CONFIG_TEE (TEE uclass)

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
6 years agosandbox: dt: add sandbox_tee node
Jens Wiklander [Tue, 25 Sep 2018 14:40:16 +0000 (16:40 +0200)]
sandbox: dt: add sandbox_tee node

Adds a sandbox_tee node to enable the sandbox tee driver in all the
sandbox dts files.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
6 years agotee: optee: support AVB trusted application
Jens Wiklander [Tue, 25 Sep 2018 14:40:15 +0000 (16:40 +0200)]
tee: optee: support AVB trusted application

Adds configuration option OPTEE_TA_AVB and a header file describing the
interface to the Android Verified Boot 2.0 (AVB) trusted application
provided by OP-TEE.

Tested-by: Igor Opaniuk <igor.opaniuk@linaro.org>
Reviewed-by: Igor Opaniuk <igor.opaniuk@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agooptee: support routing of rpmb data frames to mmc
Jens Wiklander [Tue, 25 Sep 2018 14:40:14 +0000 (16:40 +0200)]
optee: support routing of rpmb data frames to mmc

Adds support in optee supplicant to route signed (MACed) RPMB frames
from OP-TEE Secure OS to MMC and vice versa to manipulate the RPMB
partition.

Tested-by: Igor Opaniuk <igor.opaniuk@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoarm: dt: hikey: Add optee node
Jens Wiklander [Tue, 25 Sep 2018 14:40:13 +0000 (16:40 +0200)]
arm: dt: hikey: Add optee node

Sync with 14e21cb8f811 ("arm64: dt: hikey: Add optee node"
from Linux kernel.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
6 years agoDocumentation: tee uclass and op-tee driver
Jens Wiklander [Tue, 25 Sep 2018 14:40:12 +0000 (16:40 +0200)]
Documentation: tee uclass and op-tee driver

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
6 years agotee: add OP-TEE driver
Jens Wiklander [Tue, 25 Sep 2018 14:40:11 +0000 (16:40 +0200)]
tee: add OP-TEE driver

Adds a OP-TEE driver.

* Targets ARM and ARM64
* Supports using any U-Boot memory as shared memory
* Probes OP-TEE version using SMCs
* Uses OPTEE message protocol version 2 to communicate with secure world

Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Igor Opaniuk <igor.opaniuk@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
6 years agodt/bindings: add bindings for optee
Jens Wiklander [Tue, 25 Sep 2018 14:40:10 +0000 (16:40 +0200)]
dt/bindings: add bindings for optee

Sync with c8bfafb15944 ("dt/bindings: add bindings for optee")
from Linux kernel.

Introduces linaro prefix and adds bindings for ARM TrustZone based OP-TEE
implementation.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
6 years agoAdd UCLASS_TEE for Trusted Execution Environment
Jens Wiklander [Tue, 25 Sep 2018 14:40:09 +0000 (16:40 +0200)]
Add UCLASS_TEE for Trusted Execution Environment

Adds a uclass to interface with a TEE (Trusted Execution Environment).

A TEE driver is a driver that interfaces with a trusted OS running in
some secure environment, for example, TrustZone on ARM cpus, or a
separate secure co-processor etc.

The TEE subsystem can serve a TEE driver for a Global Platform compliant
TEE, but it's not limited to only Global Platform TEEs.

The over all design is based on the TEE subsystem in the Linux kernel,
tailored for U-Boot.

Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Igor Opaniuk <igor.opaniuk@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
6 years agommc: rpmb: add mmc_rpmb_route_frames()
Jens Wiklander [Tue, 25 Sep 2018 14:40:08 +0000 (16:40 +0200)]
mmc: rpmb: add mmc_rpmb_route_frames()

Adds mmc_rpmb_route_frames() to route RPMB data frames from/to an
external entity.

Tested-by: Igor Opaniuk <igor.opaniuk@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agocmd: avb: print error message if command fails
Jens Wiklander [Tue, 25 Sep 2018 14:40:07 +0000 (16:40 +0200)]
cmd: avb: print error message if command fails

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
6 years agocmd: avb read_rb: print rb_idx in hexadecimal
Jens Wiklander [Tue, 25 Sep 2018 14:40:06 +0000 (16:40 +0200)]
cmd: avb read_rb: print rb_idx in hexadecimal

Prior to this patch was do_avb_write_rb() reading supplied rb_idx as a
hexadecimal number while do_avb_read_rb() printed the read out rb_idx as
decimal number. For consistency change do_avb_read_rb() to print rb_idx
as a hexadecimal number too.

Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Igor Opaniuk <igor.opaniuk@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
6 years agodm: fdt: scan for devices under /firmware too
Jens Wiklander [Tue, 25 Sep 2018 14:40:05 +0000 (16:40 +0200)]
dm: fdt: scan for devices under /firmware too

Just as /chosen may contain devices /firmware may contain devices, scan
for devices under /firmware too.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
6 years agospl: spi: Do not hardcode fixed size for header
Michal Simek [Thu, 4 Oct 2018 07:30:20 +0000 (09:30 +0200)]
spl: spi: Do not hardcode fixed size for header

Find out size directly from header structure.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agospl: ram: Fix u_boot_pos calculation
Michal Simek [Thu, 4 Oct 2018 07:29:20 +0000 (09:29 +0200)]
spl: ram: Fix u_boot_pos calculation

The patch:
"spl: Weed out CONFIG_SYS_TEXT_BASE usage"
(sha1: 04ce5427bd3914cab8be78513275a20ab878520a)
introduced bug where assigning to u_boot_pos variable wasn't done
which end up in situation where SPL wasn't able to find out
image on the selected address.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
6 years agomach-stm32: Set MPU SDRAM size to 512MB for STM32F7/H7
Patrice Chotard [Tue, 2 Oct 2018 07:03:10 +0000 (09:03 +0200)]
mach-stm32: Set MPU SDRAM size to 512MB for STM32F7/H7

This allows to boot all STM32F7 and STM32H7 boards independently
of the amount of embedded SDRAM.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas Manocha <vikas.manocha@st.com>
6 years agofs: fat: fix set_cluster()
Heinrich Schuchardt [Tue, 2 Oct 2018 07:30:45 +0000 (09:30 +0200)]
fs: fat: fix set_cluster()

Avoid CoverityScan warning SIGN_EXTENSION by changing the type of
parameter size of set_cluster().

Avoid leaking stack content when writing an incomplete last sector.

Reported-by: Coverity (CID: 184096)
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
6 years agofs: fat: memory leak in fat_unlink()
Heinrich Schuchardt [Tue, 2 Oct 2018 04:58:00 +0000 (06:58 +0200)]
fs: fat: memory leak in fat_unlink()

Do not leak filename_copy in case of error.
Catch out of memory when calling strdup.

Reported-by: Coverity (CID: 184086)
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
6 years agoARM: LogicPD: omap3logic: Remove Torpedo/SOM-LV autodection
Adam Ford [Sat, 29 Sep 2018 19:10:19 +0000 (14:10 -0500)]
ARM: LogicPD: omap3logic: Remove Torpedo/SOM-LV autodection

With there now being four device tree files, and 4 separate
defconfig files, the code necessary to determine which board is
being used is no longer necessary as the corresponding pin-muxing
and board names are determined by the device tree.

Signed-off-by: Adam Ford <aford173@gmail.com>
6 years agoARM: DTS: Add Logic PD OMAP35/DM37 SOM-LV and OMAP35 Torpedo
Adam Ford [Sat, 29 Sep 2018 19:10:18 +0000 (14:10 -0500)]
ARM: DTS: Add Logic PD OMAP35/DM37 SOM-LV and OMAP35 Torpedo

With the device trees doing most of the work of pin-muxing and
DM doing much of the peripheral initialization, this creates
new defconfig files for each of the Logic PD variants with
proper register settings/pin-muxing.

Signed-off-by: Adam Ford <aford173@gmail.com>
[trini: Update MAINTAINERS entry]
Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agoARM: DTS: Add support for Logic PD OMAP35 Torpedo & SOM-LV
Adam Ford [Sat, 29 Sep 2018 19:10:17 +0000 (14:10 -0500)]
ARM: DTS: Add support for Logic PD OMAP35 Torpedo & SOM-LV

The baseboards and SOM's are virtually identical to their DM37
counterparts, but OMAP36/37 and OMAP3 have some minor register
differences.  With the boards being mostly driven by device trees
now, this synchronizes their respective device trees with linux-omap
for-next branch destined for 4.20 (or whatever the version after 4.19
will be called)

Signed-off-by: Adam Ford <aford173@gmail.com>
6 years agoARM: DTS: Remove unnecessary u-boot.dtsi options from omap3/36xx
Adam Ford [Sat, 29 Sep 2018 19:10:16 +0000 (14:10 -0500)]
ARM: DTS: Remove unnecessary u-boot.dtsi options from omap3/36xx

With the introduction of the omap serial driver, the need for some
of these U-Boot specific modifications is gone.  This cleans up
this unnneeded stuff.

Signed-off-by: Adam Ford <aford173@gmail.com>
6 years agoARM: DTS: LogicPD-SOM-LV & Torpedo: Resync DTS with Kernel
Adam Ford [Sat, 29 Sep 2018 19:10:15 +0000 (14:10 -0500)]
ARM: DTS: LogicPD-SOM-LV & Torpedo: Resync DTS with Kernel

The device tree entries are from linux-omap's for-next branch
destined to me put into 4.20 (or whatever the version is after 4.19)

Signed-off-by: Adam Ford <aford173@gmail.com>
6 years agomisc: Add support for the Arm Versatile Express config bus
Liviu Dudau [Fri, 28 Sep 2018 12:43:31 +0000 (13:43 +0100)]
misc: Add support for the Arm Versatile Express config bus

Add support for the Arm Versatile Express config bus that is
being used for exposing various subsystems via a generic
configuration bus. This driver adds support for generating
transactions on this configuration bus and can be used by
other drivers to abstract the communication with the actual
function providers.

Signed-off-by: Liviu Dudau <liviu.dudau@foss.arm.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
6 years agoconfigs: drop CONFIG_SYS_EXTRA_ENV_RELOC
Simon Goldschmidt [Thu, 27 Sep 2018 10:38:34 +0000 (12:38 +0200)]
configs: drop CONFIG_SYS_EXTRA_ENV_RELOC

Instead of manually specifying CONFIG_SYS_EXTRA_ENV_RELOC
for every board that needs it, it shouldn't hurt to let
initr_reloc_global_data() always relocate gd->env_addr
unless we know this pointer is outside the initial binary.

To achieve this, the relocation is omitted if
CONFIG_ENV_ADDR is defined (and ENV_IS_EMBEDDED is not).

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
6 years agotest/py: test_fs: add docstring comments to helper functions
Akashi Takahiro [Thu, 27 Sep 2018 07:07:23 +0000 (16:07 +0900)]
test/py: test_fs: add docstring comments to helper functions

After Siomon's comment, add a descriptive comment (docstring) to each of
helper functions in conftest.py. No functionality changed.

Signed-off-by: Akashi Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agotest/py: test_fs: remove fs_type argument from umount_fs()
Akashi Takahiro [Thu, 27 Sep 2018 07:07:22 +0000 (16:07 +0900)]
test/py: test_fs: remove fs_type argument from umount_fs()

Since there is no use of fs_type in umount_fs(), just remove it.

Signed-off-by: Akashi Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agotest/py: ignore console read exceptions after test failure
Stephen Warren [Thu, 20 Sep 2018 22:55:03 +0000 (16:55 -0600)]
test/py: ignore console read exceptions after test failure

After a test has failed, test/py drains the U-Boot console log to ensure
that any relevant output is captured. At this point, we don't care about
detecting any additional errors, since the test is already known to have
failed, and U-Boot will be restarted. To ensure that the test cleanup code
is not interrupted, and can correctly terminate the log sections for the
failed test, ignore any exception that occurs while reading the U-Boot
console output during this limited period of time.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
6 years agoMerge branch 'master' of git://git.denx.de/u-boot-sh
Tom Rini [Sat, 6 Oct 2018 01:17:35 +0000 (21:17 -0400)]
Merge branch 'master' of git://git.denx.de/u-boot-sh

6 years agoMerge branch 'master' of git://git.denx.de/u-boot-socfpga
Tom Rini [Sat, 6 Oct 2018 01:17:21 +0000 (21:17 -0400)]
Merge branch 'master' of git://git.denx.de/u-boot-socfpga

6 years agoMerge tag 'rockchip-for-v2018.11-rc2' of git://git.denx.de/u-boot-rockchip
Tom Rini [Fri, 5 Oct 2018 14:16:46 +0000 (10:16 -0400)]
Merge tag 'rockchip-for-v2018.11-rc2' of git://git.denx.de/u-boot-rockchip

Rockchip-focused changes for v2018.11-rc2:
 - fixes to rkimage for SPL boot via USB
 - fixes to make_fit_atf.py, incl. entry-point calculation and python3
   compatibility
 - OP-TEE support for ARMv7-based SoCs
 - fixes to RGMII/GMII selection on the RK3328

Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agoMerge tag 'arc-updates-for-2018.11-rc2' of git://git.denx.de/u-boot-arc
Tom Rini [Fri, 5 Oct 2018 14:16:31 +0000 (10:16 -0400)]
Merge tag 'arc-updates-for-2018.11-rc2' of git://git.denx.de/u-boot-arc

Here we do a couple of impovements for all ARC boards
as well as introduce yet another developemnt board.

1. Now for ARC boards we print CPU and board info
   which is useful for users and helps with
   analysis of logs "post-mortem".

2. Synopsys IoT development kit support is added
   This one might bw a bit too late as we're past RC1
   but:
    1) This doesn't affect any other arches etc
       as we change purely ARC code.
    2) I've got a chance to talk about U-Boot on
       IoT platforms during ELCE (my proposal was on
       a wait list and only this week I've got
       an update and invitation to talk) so it would
       be good to have this board as a primer in upstream
       code-base by the time of ELCE 2018.
    3) For complete support of IoT devkit I'm yet to
       significantly rework regmap subsystem in U-Boot
       but that's a different topic and hopefully it will
       be done sometime soon... though not this release
       cycle for sure.

6 years agoarc: Add support for IoT development kit
Alexey Brodkin [Wed, 24 Jan 2018 18:37:14 +0000 (21:37 +0300)]
arc: Add support for IoT development kit

The DesignWare ARC IoT Development Kit is a versatile platform
that includes the necessary hardware and software to accelerate
software development and debugging of sensor fusion,
voice recognition and face detection designs.

More information is avaialble here [1] and here [2].

The board is based on real silicon with
ARC EM9D-based Data Fusion IP Subsystem.

It sports a rich set of I/O including
 * DW USB OTG
 * DW MobileStorage (used for micro SD-card)
 * GPIO
 * multiple serial interface including DW APB UART
 * ADC, PWM and eFlash, SRAM and SPI Flash memory
 * Real-Time Clock (RTC)
 * Bluetooth module with worldwide regulatory compliance
   (FCC, IC, CE, ETSI, TELEC)
 * On-board 9-axis sensor (gyro, accelerometer and compass)

Extensible with Arduino, Pmod, mikroBUS connectors and a 2x18
extension header.

One of the most interesting features for developers is built-in
Digilent USB JTAG probe so only micro-USB cable is needed!

[1] https://www.synopsys.com/dw/ipdir.php?ds=arc_iot_development_kit
[2] https://www.synopsys.com/dw/doc.php/ds/cc/iot_dev_kit.pdf

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>