oweals/u-boot.git
4 years agodm: core: Add a function to find a device by drvdata
Simon Glass [Thu, 6 Feb 2020 16:54:50 +0000 (09:54 -0700)]
dm: core: Add a function to find a device by drvdata

It is sometimes useful to find a device in a uclass using only its driver
data. The driver data often indicates the 'subtype' of the device, e,g,
via its compatible string.

Add a function to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agodm: core: Allow iterating devices without uclass_get()
Simon Glass [Thu, 6 Feb 2020 16:54:49 +0000 (09:54 -0700)]
dm: core: Allow iterating devices without uclass_get()

At present we have uclass_foreach_dev() which requires that uclass_get()
be called beforehand to find the uclass. This is good if we suspect that
that function might fail, but often we know that the uclass is available.

Add a new helper which does this uclass_get() automatically, so that only
the uclass ID is needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agox86: Move P2SB from Apollo Lake to a more generic location
Wolfgang Wallner [Tue, 4 Feb 2020 08:04:56 +0000 (09:04 +0100)]
x86: Move P2SB from Apollo Lake to a more generic location

The Primary to Sideband Bridge (P2SB) is not specific to Apollo Lake, so
move its driver to a common location within arch/x86.

Signed-off-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agoMerge tag 'efi-2020-04-rc2' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Fri, 7 Feb 2020 04:19:27 +0000 (23:19 -0500)]
Merge tag 'efi-2020-04-rc2' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi

Pull request for UEFI sub-system for efi-2020-04-rc2

Fix pylint issues in Python based tests.

4 years agoMerge branch 'master' of git://git.denx.de/u-boot-socfpga
Tom Rini [Fri, 7 Feb 2020 04:18:42 +0000 (23:18 -0500)]
Merge branch 'master' of git://git.denx.de/u-boot-socfpga

- Gen 5 and Watchdog fixes

4 years agovideo: enable VIDEO_ANSI and all VIDEO_BBP options
Anatolij Gustschin [Tue, 4 Feb 2020 21:43:06 +0000 (22:43 +0100)]
video: enable VIDEO_ANSI and all VIDEO_BBP options

This partially reverts changes by commit 2cc393f32fd9
("video: make BPP and ANSI configs optional") since it
caused issues with other boards (missing LCD console
output on pinebook, x86 platform or sandbox). Enable
all disabled options again and opt out of not supported
color depth in board defconfigs.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Reported-by: Vagrant Cascadian <vagrant@debian.org>
4 years agoconfigs: Resync with savedefconfig
Tom Rini [Thu, 6 Feb 2020 18:42:52 +0000 (13:42 -0500)]
configs: Resync with savedefconfig

Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agosandbox: Complete migration away from os_malloc()
Simon Glass [Mon, 3 Feb 2020 14:36:18 +0000 (07:36 -0700)]
sandbox: Complete migration away from os_malloc()

Now that we can use direct access to the system malloc() in sandbox, drop
the remaining uses of os_malloc().

The only one remaining now is for the RAM buffer, which we do want to be
at a known address, so this is intended.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: Drop the inclusion of linux/compat.h in dm.h
Simon Glass [Mon, 3 Feb 2020 14:36:17 +0000 (07:36 -0700)]
dm: core: Drop the inclusion of linux/compat.h in dm.h

Most files don't need this header and it pulls in quite of lots of stuff,
malloc() in particular. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: Create a new header file for 'compat' features
Simon Glass [Mon, 3 Feb 2020 14:36:16 +0000 (07:36 -0700)]
dm: core: Create a new header file for 'compat' features

At present dm/device.h includes the linux-compatible features. This
requires including linux/compat.h which in turn includes a lot of headers.
One of these is malloc.h which we thus end up including in every file in
U-Boot. Apart from the inefficiency of this, it is problematic for sandbox
which needs to use the system malloc() in some files.

Move the compatibility features into a separate header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: Require users of devres to include the header
Simon Glass [Mon, 3 Feb 2020 14:36:15 +0000 (07:36 -0700)]
dm: core: Require users of devres to include the header

At present devres.h is included in all files that include dm.h but few
make use of it. Also this pulls in linux/compat which adds several more
headers. Drop the automatic inclusion and require files to include devres
themselves. This provides a good indication of which files use devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>
4 years agosandbox: Support changing the LCD colour depth
Simon Glass [Mon, 3 Feb 2020 14:36:14 +0000 (07:36 -0700)]
sandbox: Support changing the LCD colour depth

Add a new device-tree property to control the colour depth. At present we
support 16bpp and 32bpp.

While we are here, update the code to use livetree.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>
4 years agosandbox: sdl: Add an option to double the screen size
Simon Glass [Mon, 3 Feb 2020 14:36:13 +0000 (07:36 -0700)]
sandbox: sdl: Add an option to double the screen size

On high-DPI displays U-Boot's LCD window can look very small. Add a
-K flag to expand it to make things easier to read, while still using
the existing resolution internally.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>
4 years agosandbox: sdl: Move to use SDL2
Simon Glass [Mon, 3 Feb 2020 14:36:12 +0000 (07:36 -0700)]
sandbox: sdl: Move to use SDL2

Sandbox currently uses SDL1.2. SDL2 has been around for quite a while and
is widely supported. It has a number of useful features. It seems
appropriate to move sandbox over.

Update the code to use SDL2 instead of SDL1.2.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agogitlab: Disable SDL when building sandbox
Simon Glass [Mon, 3 Feb 2020 14:36:11 +0000 (07:36 -0700)]
gitlab: Disable SDL when building sandbox

I am not sure how to add libsdl2-dev to the gitlab image, so disable
building sandbox with SDL for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agosandbox: sdl: Support waiting for audio to complete
Simon Glass [Mon, 3 Feb 2020 14:36:10 +0000 (07:36 -0700)]
sandbox: sdl: Support waiting for audio to complete

At present when audio stops, any in-progress output is cut off. Fix this
by waiting for output to finish.

Also use booleans for the boolean variables.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agosandbox: sdl: Improve error handling
Simon Glass [Mon, 3 Feb 2020 14:36:09 +0000 (07:36 -0700)]
sandbox: sdl: Improve error handling

A few errors are not checked. Fix these and use my preferred spelling for
init.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agosandbox: Add comments to the sdl struct
Simon Glass [Mon, 3 Feb 2020 14:36:08 +0000 (07:36 -0700)]
sandbox: Add comments to the sdl struct

Add comments for each struct member. Drop frequency since it is not used.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agosandbox: sound: Handle errors better in sound_beep()
Simon Glass [Mon, 3 Feb 2020 14:36:07 +0000 (07:36 -0700)]
sandbox: sound: Handle errors better in sound_beep()

At present an error does not stop the sound-output loop. This is incorrect
since nothing can be gained by trying to continue. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agosound: Add a new stop_play() method
Simon Glass [Mon, 3 Feb 2020 14:36:06 +0000 (07:36 -0700)]
sound: Add a new stop_play() method

At present there is no positive indication that U-Boot has finished
sending sound data. This means that it is not possible to power down an
audio codec, for example. Add a new method that is called once all sound
data has been sent.

Add a new method for this, called when the sound_play() call is done.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agosandbox: Add a new header for the system malloc()
Simon Glass [Mon, 3 Feb 2020 14:36:05 +0000 (07:36 -0700)]
sandbox: Add a new header for the system malloc()

Some files use U-Boot headers but still need to access the system
malloc(). Allow this by creating a new asm/malloc.h which can be used so
long as U-Boot's malloc.h has not been included.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agosandbox: Ensure that long-options array is terminated
Simon Glass [Mon, 3 Feb 2020 14:36:04 +0000 (07:36 -0700)]
sandbox: Ensure that long-options array is terminated

The last member of this array is supposed to be all zeroes according to
the getopt_long() man page. Fix the function to do this.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agosandbox: Drop os_realloc()
Simon Glass [Mon, 3 Feb 2020 14:36:03 +0000 (07:36 -0700)]
sandbox: Drop os_realloc()

Due to recent changes this function is no-longer used. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agosandbox: Drop use of special os_malloc() where possible
Simon Glass [Mon, 3 Feb 2020 14:36:02 +0000 (07:36 -0700)]
sandbox: Drop use of special os_malloc() where possible

Some sandbox files are not built with U-Boot headers, so with the renamed
malloc functions there is now no need to use the special os_... allocation
functions to access the system routines. Instead we can just call them
directly.

Update the affected files accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agosandbox: Rename strdup() functions
Simon Glass [Mon, 3 Feb 2020 14:36:01 +0000 (07:36 -0700)]
sandbox: Rename strdup() functions

These functions include calls to a memory-allocation routine and so need
to use the system routine when called from a library.

To preserve access to these functions for libraries that need it, such as
SDL, rename these functions within U-Boot.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agostring: Allow arch override of strndup() also
Simon Glass [Mon, 3 Feb 2020 14:36:00 +0000 (07:36 -0700)]
string: Allow arch override of strndup() also

At present architectures can override strdup() but not strndup(). Use
the same option for both.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agoexports: Add the malloc.h header
Simon Glass [Mon, 3 Feb 2020 14:35:59 +0000 (07:35 -0700)]
exports: Add the malloc.h header

This file should include the malloc.h header since it references malloc().
Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agosandbox: Use a prefix for all allocation functions
Simon Glass [Mon, 3 Feb 2020 14:35:58 +0000 (07:35 -0700)]
sandbox: Use a prefix for all allocation functions

In order to allow use of both U-Boot's malloc() and the C library's
version, set a prefix for the allocation functions so that they can
co-exist.

This is only done for sandbox. For other archs everything remains the
same.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agosandbox: Rename 'free' variable
Simon Glass [Mon, 3 Feb 2020 14:35:57 +0000 (07:35 -0700)]
sandbox: Rename 'free' variable

This name conflicts with our desire to #define free() to something else on
sandbox. Rename it.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agomtd: Rename free() to rfree()
Simon Glass [Mon, 3 Feb 2020 14:35:56 +0000 (07:35 -0700)]
mtd: Rename free() to rfree()

This function name conflicts with our desire to #define free() to
something else on sandbox. Since it deals with resources, rename it to
rfree().

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodma: Rename free() to rfree()
Simon Glass [Mon, 3 Feb 2020 14:35:55 +0000 (07:35 -0700)]
dma: Rename free() to rfree()

This function name conflicts with our desire to #define free() to
something else on sandbox. Since it deals with resources, rename it to
rfree().

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agoclk: Rename free() to rfree()
Simon Glass [Mon, 3 Feb 2020 14:35:54 +0000 (07:35 -0700)]
clk: Rename free() to rfree()

This function name conflicts with our desire to #define free() to
something else on sandbox. Since it deals with resources, rename it to
rfree().

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agogpio: Rename free() to rfree()
Simon Glass [Wed, 5 Feb 2020 03:15:17 +0000 (20:15 -0700)]
gpio: Rename free() to rfree()

This function name conflicts with our desire to #define free() to
something else on sandbox. Since it deals with resources, rename it to
rfree().

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agoreset: Rename free() to rfree()
Simon Glass [Mon, 3 Feb 2020 14:35:52 +0000 (07:35 -0700)]
reset: Rename free() to rfree()

This function name conflicts with our desire to #define free() to
something else on sandbox. Since it deals with resources, rename it to
rfree().

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agopower-domain: Rename free() to rfree()
Simon Glass [Mon, 3 Feb 2020 14:35:51 +0000 (07:35 -0700)]
power-domain: Rename free() to rfree()

This function name conflicts with our desire to #define free() to
something else on sandbox. Since it deals with resources, rename it to
rfree().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>
4 years agomailbox: Rename free() to rfree()
Simon Glass [Mon, 3 Feb 2020 14:35:50 +0000 (07:35 -0700)]
mailbox: Rename free() to rfree()

This function name conflicts with our desire to #define free() to
something else on sandbox. Since it deals with resources, rename it to
rfree().

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agovideo: sandbox: Enable all colour depths
Simon Glass [Mon, 3 Feb 2020 14:35:49 +0000 (07:35 -0700)]
video: sandbox: Enable all colour depths

For sandbox we want to have the maximum possible build coverage, so enable
all colour depths for video.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>
4 years agovideo: Support truetype fonts on a 32-bit display
Simon Glass [Mon, 3 Feb 2020 14:35:48 +0000 (07:35 -0700)]
video: Support truetype fonts on a 32-bit display

At present only a 16bpp display is supported for Truetype fonts. Add
support for 32bpp also since this is quite common.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>
4 years agosandbox: Sort the help options
Simon Glass [Mon, 3 Feb 2020 14:35:47 +0000 (07:35 -0700)]
sandbox: Sort the help options

At present options are presented in essentially random order. It is easier
to browse them if they are sorted into alphabetical order. Adjust the
help function to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodoc: dm: debugging: Fix the steps for activating debug
Fabio Estevam [Wed, 29 Jan 2020 17:45:33 +0000 (14:45 -0300)]
doc: dm: debugging: Fix the steps for activating debug

Following the recommendation of adding '#define DEBUG' at the top
of drivers/core/lists.c does not cause the debug messages to be
shown. Change it to '#define LOG_DEBUG' instead, which actually
makes it work as per doc/README.log.

While at it, provide the full path to lists.c to in order to make
the instructions clearer.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agodtc: add ability to make nodes conditional on them being referenced
Maxime Ripard [Tue, 21 Jan 2020 10:23:17 +0000 (10:23 +0000)]
dtc: add ability to make nodes conditional on them being referenced

This is needed when importing mainline DTs into U-Boot, as some started
using this /omit-if-no-ref/ tag, so won't compile with U-Boot's current
dtc copy. This is just a cherry-pick of the patch introducing this
feature.
Original commit message from Maxime:
------------------
A number of platforms have a need to reduce the number of DT nodes,
mostly because of two similar constraints: the size of the DT blob, and
the time it takes to parse it.

As the DT is used in more and more SoCs, and by more projects, some
constraints start to appear in bootloaders running from SRAM with an
order of magnitude of 10kB. A typical DT is in the same order of
magnitude, so any effort to reduce the blob size is welcome in such an
environment.

Some platforms also want to reach very fast boot time, and the time it
takes to parse a typical DT starts to be noticeable.

Both of these issues can be mitigated by reducing the number of nodes in
the DT. The biggest provider of nodes is usually the pin controller and
its subnodes, usually one for each valid pin configuration in a given
SoC.

Obviously, a single, fixed, set of these nodes will be used by a given
board, so we can introduce a node property that will tell the DT
compiler to drop the nodes when they are not referenced in the tree, and
as such wouldn't be useful in the targetted system.

Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agocmd: Add command to dump drivers and compatible strings
Sean Anderson [Fri, 17 Jan 2020 19:48:09 +0000 (14:48 -0500)]
cmd: Add command to dump drivers and compatible strings

This adds a subcommand to dm to dump out what drivers are installed, and their
compatible strings. I have found this useful in ensuring that I have the correct
drivers compiled, and that I have put in the correct compatible strings.

Signed-off-by Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agobuildman: Enable buildman on aarch64 hosts
Matthias Brugger [Fri, 17 Jan 2020 09:53:37 +0000 (10:53 +0100)]
buildman: Enable buildman on aarch64 hosts

At kernel.org aarch64 toolchains are published in folder
arm64. Fix the URL for that case, so that we can fetch
toolchains on aarch64 machines.

Signed-off-by: Matthias Brugger <mbrugger@suse.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agotpm2: ftpm: A driver for firmware TPM running inside TEE
Thirupathaiah Annapureddy [Mon, 13 Jan 2020 07:34:22 +0000 (23:34 -0800)]
tpm2: ftpm: A driver for firmware TPM running inside TEE

Add a driver for a firmware TPM running inside TEE.

Documentation of the firmware TPM:
https://www.microsoft.com/en-us/research/publication/ftpm-software-implementation-tpm-chip/

Implementation of the firmware TPM:
https://github.com/Microsoft/ms-tpm-20-ref/tree/master/Samples/ARM32-FirmwareTPM

Signed-off-by: Thirupathaiah Annapureddy <thiruan@linux.microsoft.com>
4 years agocli: Make the sandbox board_run_command the default
Sean Anderson [Fri, 10 Jan 2020 17:32:19 +0000 (12:32 -0500)]
cli: Make the sandbox board_run_command the default

If CONFIG_CMDLINE=n, common/cli.c calls board_run_command. This fails to
link on most architectures. However, the sandbox architecture has an
implementation which we can use.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
4 years agocmd: tpm: add a subcommand device
Philippe Reynes [Thu, 9 Jan 2020 17:45:46 +0000 (18:45 +0100)]
cmd: tpm: add a subcommand device

The command tpm (and tpm2) search the tpm and use it.
On sandbox, there are two tpm (tpm 1.x and tpm 2.0).
So the command tpm and tpm2 are always executed with
the first tpm (tpm 1.x), and the command tpm2 always
fails.

This add a subcommand device to command tpm and
command tpm2. Then the command tpm and tpm2 use
the device selected with the subcommand device.

To be compatible with previous behaviour, if the
subcommand device is not used before a tpm (or tpm2)
command, the device 0 is selected.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
4 years agotpm: add a helper to iterate on all tpm devices
Philippe Reynes [Thu, 9 Jan 2020 17:45:45 +0000 (18:45 +0100)]
tpm: add a helper to iterate on all tpm devices

This add a helper for_each_tpm_device that run
through all the tpm (1.x and 2.0) devices.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
4 years agoimage: fdt: check "status" of "/reserved-memory" subnodes
Thirupathaiah Annapureddy [Tue, 7 Jan 2020 06:21:42 +0000 (22:21 -0800)]
image: fdt: check "status" of "/reserved-memory" subnodes

boot_fdt_add_mem_rsv_regions() scans the subnodes of
"/reserved-memory" and adds them to reserved lmb regions.
Currently this scanning does not take into "status" property.
Even if the subnode is disabled, it gets added to the
reserved lmb regions.

This patch checks the "status" property before adding it
to reserved lmb regions.

Signed-off-by: Thirupathaiah Annapureddy <thiruan@linux.microsoft.com>
4 years agotest: Add a way to check each line of console output
Simon Glass [Mon, 27 Jan 2020 15:49:56 +0000 (08:49 -0700)]
test: Add a way to check each line of console output

When writing tests to check the output from commands it is useful to be
able to check the output line by line using an assertion. Add helper
macros to support this and to check that there is no unexpected trailing
data.

Also some commands produce a dump using print_buffer(). Add a way to check
that the correct number of bytes are dumped (ignoring the actual
contents).

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agotest: Enable console recording in tests
Simon Glass [Mon, 27 Jan 2020 15:49:55 +0000 (08:49 -0700)]
test: Enable console recording in tests

At present we reset the console buffer before each test but do not
actually set the recording flag. Without this, the output is not
recorded.

Update the code to set the flag before the test and clear it afterwards.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agoconsole: Add a function to read a line of the output / eof
Simon Glass [Mon, 27 Jan 2020 15:49:54 +0000 (08:49 -0700)]
console: Add a function to read a line of the output / eof

When recording the console output for testing it is useful to be able to
read the output a line at a time to check that the output is correct. Also
we need to check that we get to the end of the output.

Add a console function to return the next line and another to see how must
data is left.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agosandbox: pmic: Correct i2c pmic emulator platdata method
Simon Glass [Mon, 27 Jan 2020 15:49:53 +0000 (08:49 -0700)]
sandbox: pmic: Correct i2c pmic emulator platdata method

This currently reads the uclass's private data in the ofdata_to_platdata
method which is not allowed, since the uclass has not read it from the
device tree. This happens in the probe method.

Fix it by adding a probe() method and moving the code there.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agobloblist: Zero records when adding
Simon Glass [Mon, 27 Jan 2020 15:49:52 +0000 (08:49 -0700)]
bloblist: Zero records when adding

It is convenient for bloblist to zero out the contents of a records when
it is added. This saves the callers having to do it.

Update the API accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agobloblist: Tidy up a few comments and code-style nits
Simon Glass [Mon, 27 Jan 2020 15:49:51 +0000 (08:49 -0700)]
bloblist: Tidy up a few comments and code-style nits

Add a messing error code to bloblist_new() and tidy up the line length in
bloblist_addrec().

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agobloblist: Add a new function to add or check size
Simon Glass [Mon, 27 Jan 2020 15:49:50 +0000 (08:49 -0700)]
bloblist: Add a new function to add or check size

A common check is to see if a blob is present, create it if not and make
sure that the size is large enough. Add a function to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: Drop uclass_find_next_free_req_seq() conditions
Simon Glass [Mon, 27 Jan 2020 15:49:49 +0000 (08:49 -0700)]
dm: core: Drop uclass_find_next_free_req_seq() conditions

These conditions are not needed and just reduce build coverage. Drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: Add a way to iterate through children, probing each
Simon Glass [Mon, 27 Jan 2020 15:49:48 +0000 (08:49 -0700)]
dm: core: Add a way to iterate through children, probing each

It is sometimes useful to process all children, making sure they are
probed first. Add functions to help with this and a macro to make it more
convenient.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: Add a way to read platdata for all child devices
Simon Glass [Mon, 27 Jan 2020 15:49:47 +0000 (08:49 -0700)]
dm: core: Add a way to read platdata for all child devices

When generating ACPI tables we need to make sure that all devices have
read their platform data, so that they can generate the tables correctly.

Rather than adding this code in ACPI, create a core function to handle it.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: Add ofnode_get_chosen_prop()
Simon Glass [Mon, 27 Jan 2020 15:49:46 +0000 (08:49 -0700)]
dm: core: Add ofnode_get_chosen_prop()

Add a function to read a property from the chosen node, providing access
to its length. Update ofnode_get_chosen_string() to make use of it.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: Reimplement ofnode_read_size()
Simon Glass [Mon, 27 Jan 2020 15:49:45 +0000 (08:49 -0700)]
dm: core: Reimplement ofnode_read_size()

Now that we have ofnode_read_prop() we can rewrite this function using
that one, reducing the amount of duplicated code.

Update ofnode_read_size() and move it up next to the other similar
functions.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: Add ofnode_read_prop()
Simon Glass [Mon, 27 Jan 2020 15:49:44 +0000 (08:49 -0700)]
dm: core: Add ofnode_read_prop()

Add a new function to read a property that supports reading the length as
well.

Reimplement ofnode_read_string() using it and fix its comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: Rename ofnode_get_chosen_prop()
Simon Glass [Mon, 27 Jan 2020 15:49:43 +0000 (08:49 -0700)]
dm: core: Rename ofnode_get_chosen_prop()

This function is actually intended to read a string rather than a
property. All of its current callers use it that way. Also there is no way
to return the length of the property from this function.

Rename it to better indicate its purpose, using ofnode_read as the prefix
since this matches most other functions.

Also add some tests which are missing for these functions.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: Update comment for ofnode_get_chosen_node()
Simon Glass [Mon, 27 Jan 2020 15:49:42 +0000 (08:49 -0700)]
dm: core: Update comment for ofnode_get_chosen_node()

The current comment is a big vague and misleading. Rewrite it to state
precisely what the function does.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agotest: Add underscore prefix to macro parameters
Simon Glass [Mon, 27 Jan 2020 15:49:41 +0000 (08:49 -0700)]
test: Add underscore prefix to macro parameters

If a test happens to use the same variable as the macro parameter the
macro does not work as intended. Add an underscore to guard against this.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: Use const device for the dev_read_...() interface
Simon Glass [Mon, 27 Jan 2020 15:49:40 +0000 (08:49 -0700)]
dm: core: Use const device for the dev_read_...() interface

These functions do not modify the device so should use a const pointer to
it. Update the code accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: Use const device for the devfdt...() interface
Simon Glass [Mon, 27 Jan 2020 15:49:39 +0000 (08:49 -0700)]
dm: core: Use const device for the devfdt...() interface

These functions do not modify the device so should use a const pointer to
it. Update the code accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: pci: Update a few more interfaces for const udevice *
Simon Glass [Mon, 27 Jan 2020 15:49:38 +0000 (08:49 -0700)]
dm: pci: Update a few more interfaces for const udevice *

Tidy up a few places where const * should be used.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: pci: Update the PCI read_config() method to const dev *
Simon Glass [Mon, 27 Jan 2020 15:49:37 +0000 (08:49 -0700)]
dm: pci: Update the PCI read_config() method to const dev *

At present this method uses a non-const udevice pointer, but the call
should not modify the device. Use a const pointer.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: Use const where possible in device.h
Simon Glass [Mon, 27 Jan 2020 15:49:36 +0000 (08:49 -0700)]
dm: core: Use const where possible in device.h

Update this header file to use const devices where possible, to permit
callers to also use const.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-fsl-qoriq
Tom Rini [Wed, 5 Feb 2020 12:19:52 +0000 (07:19 -0500)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-fsl-qoriq

- Bug fixes on ls1012a, ls1021a, ls1028ardb platforms Integrate fspi for
  ls1028a, add DM-I2C support, update secure boot header offset

4 years agoMerge tag 'rpi-next-2020.04' of https://gitlab.denx.de/u-boot/custodians/u-boot-raspb...
Tom Rini [Wed, 5 Feb 2020 12:18:12 +0000 (07:18 -0500)]
Merge tag 'rpi-next-2020.04' of https://gitlab.denx.de/u-boot/custodians/u-boot-raspberrypi

- DFU support file operations lager then the default max size
- add dfu support to dwc2 for bcm2835
- enable DFU for RPi4
- Fix RPi4 memory map to include the genet device
- add driver for the genet ethernet device
- enable network support in RPi4 config

4 years agotest: efi_selftest: fix pylint warnings
Heinrich Schuchardt [Sat, 25 Jan 2020 20:58:56 +0000 (21:58 +0100)]
test: efi_selftest: fix pylint warnings

Fix pylint warnings:

* add missing module and function documentation
* correct indentation

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agotest: test_efi_fit: fix pylint warnings
Heinrich Schuchardt [Sat, 25 Jan 2020 20:41:29 +0000 (21:41 +0100)]
test: test_efi_fit: fix pylint warnings

Fix warnings issued by pylint:

* naming of variables
* usage of commas and semicolons
* indentation
* placement of module description

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoddr: altera: Add DDR2 support to Gen5 driver
Marek Vasut [Thu, 17 Oct 2019 22:22:31 +0000 (00:22 +0200)]
ddr: altera: Add DDR2 support to Gen5 driver

Add DDR2 support to Gen5 DRAM driver. As the DDR2 macro names generated
by Quartus are named differently than the DDR3 ones, use anon unions to
store them in the same structures, without growing their size.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Ley Foon Tan <ley.foon.tan@intel.com>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
4 years agowatchdog: designware: Optionally fetch clock and reset from DT
Marek Vasut [Thu, 3 Oct 2019 12:47:07 +0000 (14:47 +0200)]
watchdog: designware: Optionally fetch clock and reset from DT

Add optional support for fetching watchdog clock rate from DT
and ungating reset via reset framework. This is optional as not
all platforms using DW WDT support the clock and reset frameworks
yet.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Chin Liang See <chin.liang.see@intel.com>
Cc: Dalon Westergreen <dwesterg@gmail.com>
Cc: Dinh Nguyen <dinguyen@kernel.org>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Ley Foon Tan <ley.foon.tan@intel.com>
Cc: Philipp Tomisch <philipp.tomisch@theobroma-systems.com>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Cc: Tien Fong Chee <tien.fong.chee@intel.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
Tested-by: Jagan Teki <jagan@amarulasolutions.com> # roc-rk3399-pc
4 years agowatchdog: designware: Convert to DM and DT probing
Marek Vasut [Wed, 26 Jun 2019 23:19:23 +0000 (01:19 +0200)]
watchdog: designware: Convert to DM and DT probing

Convert the designware watchdog timer driver to DM and add DT probing
support. Perform minor coding style clean up, like drop superfluous
braces. These ought to be no functional change.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Chin Liang See <chin.liang.see@intel.com>
Cc: Dalon Westergreen <dwesterg@gmail.com>
Cc: Dinh Nguyen <dinguyen@kernel.org>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Ley Foon Tan <ley.foon.tan@intel.com>
Cc: Philipp Tomisch <philipp.tomisch@theobroma-systems.com>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Cc: Tien Fong Chee <tien.fong.chee@intel.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
Tested-by: Jagan Teki <jagan@amarulasolutions.com> # roc-rk3399-pc
4 years agovideo: mxsfb: call remove() when booting OS
Anatolij Gustschin [Sat, 25 Jan 2020 22:44:56 +0000 (23:44 +0100)]
video: mxsfb: call remove() when booting OS

Add DM_FLAG_OS_PREPARE flag to ensure that the driver's
remove() callback is invoked before booting the kernel.
This is required to stop the LCDIF controller. This was
the behaviour with old driver without DM_VIDEO support.
Without stopping the LCDIF we sometimes observe incorrect
Linux logo position.

Fixes: ae0760584b38 ("imx: mx6ul_14x14_evk: convert to DM_VIDEO")
Signed-off-by: Anatolij Gustschin <agust@denx.de>
Reported-by: Fabio Estevam <festevam@gmail.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
4 years agovideo: fix Coverity missing break issue
Anatolij Gustschin [Mon, 6 Jan 2020 22:00:38 +0000 (23:00 +0100)]
video: fix Coverity missing break issue

Fix:
>>>  CID 280902:  Control flow issues  (MISSING_BREAK)
>>>  The case for value "VIDEO_BPP32" is not terminated
>>>  by a 'break' statement.

Also fix
error: control reaches end of non-void function [-Werror=return-type]

Reported-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-x86
Tom Rini [Tue, 4 Feb 2020 16:36:49 +0000 (11:36 -0500)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-x86

- Various minor fixes for x86
- Switch to ACPI mode on Intel edison
- Support run-time configuration for NS16550 driver
- Update coreboot and slimbootloader serial drivers to use NS16550
run-time configuration
- ICH SPI driver fixes to hardware sequencing erase case
- Move ITSS from Apollo Lake to a more generic location
- Intel GPIO driver bug fixes
- Move to vs2017-win2016 platform build host for Azure pipelines

4 years agoMerge tag 'ti-v2020.04-rc2' of https://gitlab.denx.de/u-boot/custodians/u-boot-ti
Tom Rini [Tue, 4 Feb 2020 13:16:01 +0000 (08:16 -0500)]
Merge tag 'ti-v2020.04-rc2' of https://gitlab.denx.de/u-boot/custodians/u-boot-ti

- DFU boot support for J721e
- I2C support for J721e
- GPIO support for J721e
- Android boot image updates on AM57XX
- OMAP watchdog fixes

4 years agoboard: ls1012ardb: do not use imply CONFIG_
Heinrich Schuchardt [Sat, 25 Jan 2020 19:40:21 +0000 (20:40 +0100)]
board: ls1012ardb: do not use imply CONFIG_

Inside Kconfig we must not use the CONFIG_ prefix with the imply statement.

Fixes: 28e3c39e535b ("board: freescale: ls1012a2g5rdb: enable network
support on ls1012a2g5rdb")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoarmv8: ls2088a: Updates secure boot headers offset
Priyanka Singh [Wed, 22 Jan 2020 10:32:38 +0000 (10:32 +0000)]
armv8: ls2088a: Updates secure boot headers offset

Updates the secure boot headers offsets of Kernel and other
firmware images for SD and NOR boot sources used by
esbc_validate command.

Signed-off-by: Priyanka Singh <priyanka.singh@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoarmv8: ls1088a: Updates secure boot headers offset
Priyanka Singh [Wed, 22 Jan 2020 10:32:34 +0000 (10:32 +0000)]
armv8: ls1088a: Updates secure boot headers offset

Updates the secure boot headers offsets of Kernel and other
firmware images for SD and QSPI boot sources used by
esbc_validate command.

Signed-off-by: Priyanka Singh <priyanka.singh@nxp.com>
Signed-off-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoarmv8: lx2160a: Updates secure boot headers offset
Priyanka Singh [Wed, 22 Jan 2020 10:31:22 +0000 (10:31 +0000)]
armv8: lx2160a: Updates secure boot headers offset

Updates the secure boot headers offsets of Kernel and other
firmware images for SD and XSPI boot sources used by
esbc_validate command.

Signed-off-by: Priyanka Singh <priyanka.singh@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoarmv8: ls1012ardb: Updates secure boot headers offset
Priyanka Singh [Wed, 22 Jan 2020 10:29:52 +0000 (10:29 +0000)]
armv8: ls1012ardb: Updates secure boot headers offset

Updates the secure boot headers offsets of Kernel and other
firmware images used by esbc_validate command.

Signed-off-by: Priyanka Singh <priyanka.singh@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoarmv8: ls1046a: Updates secure boot headers offset
Priyanka Singh [Wed, 22 Jan 2020 10:29:46 +0000 (10:29 +0000)]
armv8: ls1046a: Updates secure boot headers offset

Updates the secure boot headers offsets of Kernel and other
firmware images for SD and QSPI boot sources used by
esbc_validate command.

Signed-off-by: Priyanka Singh <priyanka.singh@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoconfigs: ls1021a: Reserve low memory for CMA
Alison Wang [Tue, 21 Jan 2020 07:33:01 +0000 (07:33 +0000)]
configs: ls1021a: Reserve low memory for CMA

The default reserved memory for CMA is high memory. If LPAE is enabled,
highmem pages are non-remapped and can not be used with
dma_alloc_coherent. This patch will reserve low memory for CMA and fix
the issue on LS1021A.

Signed-off-by: Peng Ma <peng.ma@nxp.com>
Signed-off-by: Shengzhou Liu <Shengzhou.Liu@nxp.com>
Signed-off-by: Alison Wang <alison.wang@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agodm: arm: ls1021a: add i2c DM support
Biwen Li [Tue, 31 Dec 2019 07:33:44 +0000 (15:33 +0800)]
dm: arm: ls1021a: add i2c DM support

This supports i2c DM and enables CONFIG_DM_I2C
for SoC LS1021A

Signed-off-by: Biwen Li <biwen.li@nxp.com>
Signed-off-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agodm: arm64: ls1012a: add i2c DM support
Biwen Li [Tue, 31 Dec 2019 07:33:41 +0000 (15:33 +0800)]
dm: arm64: ls1012a: add i2c DM support

This supports i2c DM and enables CONFIG_DM_I2C
for SoC LS1012A

Signed-off-by: Biwen Li <biwen.li@nxp.com>
Signed-off-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoKconfigs: layerscape: use a convenient default value for SYS_MALLOC_F_LEN
Biwen Li [Tue, 31 Dec 2019 07:33:40 +0000 (15:33 +0800)]
Kconfigs: layerscape: use a convenient default value for SYS_MALLOC_F_LEN

The default value of CONFIG_SYS_MALLOC_F_LEN (0x400)
leaves U-Boot with not enough memory to load i2c driver
before relocate, causing it to hang.

Change the default value of CONFIG_SYS_MALLOC_F_LEN
for below SoCs,
- LS1012A
- LS1021A
- LS1043A
- LS1046A

Signed-off-by: Biwen Li <biwen.li@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoi2c: mxc_i2c: add DM_FLAG_PRE_RELOC flag
Biwen Li [Tue, 31 Dec 2019 07:33:39 +0000 (15:33 +0800)]
i2c: mxc_i2c: add DM_FLAG_PRE_RELOC flag

This adds DM_FLAG_PRE_RELOC flag to probe i2c driver
before relocation

Signed-off-by: Biwen Li <biwen.li@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoarmv8: fsl-layerscape: spl: fix build error when DM_I2C is enabled
Biwen Li [Tue, 31 Dec 2019 07:33:38 +0000 (15:33 +0800)]
armv8: fsl-layerscape: spl: fix build error when DM_I2C is enabled

Fix below SPL build error when DM_I2C is enabled,
- arch/arm/cpu/armv8/built-in.o: In function `board_init_f:
  arch/arm/cpu/armv8/fsl-layerscape/spl.c:74: undefined reference to `i2c_init_all'
  arch/arm/cpu/armv8/fsl-layerscape/spl.c:74:(.text.board_init_f+0x30):
  relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol
  `i2c_init_all'
  make[2]: *** [spl/u-boot-spl] Error 1
  make[1]: *** [spl/u-boot-spl] Error 2
  make: *** [sub-make] Error 2
  arch/arm/cpu/armv8/fsl-layerscape/spl.c: In function 'board_init_f':
  arch/arm/cpu/armv8/fsl-layerscape/spl.c:74:2: warning: implicit
  declaration of function 'i2c_init_all'; did you mean 'misc_init_r'?
  [-Wimplicit-function-declaration]`

Signed-off-by: Biwen Li <biwen.li@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agortc: pcf8563: Add driver model support
Biwen Li [Tue, 31 Dec 2019 07:33:37 +0000 (15:33 +0800)]
rtc: pcf8563: Add driver model support

Add support of driver model of pcf8563

Signed-off-by: Biwen Li <biwen.li@nxp.com>
Signed-off-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoconfigs: ls1028a: Enable FSPI support
Kuldeep Singh [Wed, 6 Nov 2019 11:08:02 +0000 (16:38 +0530)]
configs: ls1028a: Enable FSPI support

Enable FSPI controller support. So, flash environment can now be used

Signed-off-by: Kuldeep Singh <kuldeep.singh@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoarm: dts: lx2160a: Add FSPI node properties
Kuldeep Singh [Wed, 6 Nov 2019 11:08:01 +0000 (16:38 +0530)]
arm: dts: lx2160a: Add FSPI node properties

Align flexspi node properties with linux device-tree properties
Tested on LX2160A-RDB

Signed-off-by: Kuldeep Singh <kuldeep.singh@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoarm: dts: ls1028a: Add FSPI node properties
Kuldeep Singh [Wed, 6 Nov 2019 11:08:00 +0000 (16:38 +0530)]
arm: dts: ls1028a: Add FSPI node properties

Align flexspi node properties with linux device-tree properties
Tested on LS1028A-RDB

Signed-off-by: Kuldeep Singh <kuldeep.singh@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoboard: fsl: lx2160a: Add support to reset to eMMC
Meenakshi Aggarwal [Thu, 23 Jan 2020 12:25:10 +0000 (17:55 +0530)]
board: fsl: lx2160a: Add support to reset to eMMC

Add support of "qixis_reset emmc" command for lx2160a based platforms

Signed-off-by: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoarm: dts: ls1028a: fix interrupt properties
Michael Walle [Tue, 17 Dec 2019 23:10:00 +0000 (00:10 +0100)]
arm: dts: ls1028a: fix interrupt properties

Sync the interrupt properties with the ones from Linux. Also use the
constants provided by the dt-bindings header. Please note, that there
are actual changes/fixes in the irq flags. U-Boot won't use the
interrupt properties anyway. It's just to be consistent with the Linux
device tree.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoarm: ls1028a: use the new flexspi driver
Michael Walle [Tue, 17 Dec 2019 23:09:59 +0000 (00:09 +0100)]
arm: ls1028a: use the new flexspi driver

Also align the fspi node with the kernel one.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Kuldeep Singh <kuldeep.singh@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
4 years agoconfigs: ls1012ardb: Enable CONFIG_SYS_RELOC_GD_ENV_ADDR
Kuldeep Singh [Thu, 12 Dec 2019 09:16:04 +0000 (14:46 +0530)]
configs: ls1012ardb: Enable CONFIG_SYS_RELOC_GD_ENV_ADDR

Enable the config for ls1012ardb as the entry got missed earlier.

Fixes: 8d8ee47e03 ("env: Add CONFIG_SYS_RELOC_GD_ENV_ADDR symbol")
Signed-off-by: Kuldeep Singh <kuldeep.singh@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>