oweals/u-boot.git
5 years agoarm: kirkwood: dts: Add openrd-* dtb makefile build targets
Stefan Roese [Thu, 11 Apr 2019 10:33:34 +0000 (12:33 +0200)]
arm: kirkwood: dts: Add openrd-* dtb makefile build targets

The following Kirkwood dtb build targets are currently missing:

kirkwood-openrd-base.dtb
kirkwood-openrd-client.dtb
kirkwood-openrd-ultimate.dtb

This patch adds them to the Makefile to fix the build error.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Chris Packham <judge.packham@gmail.com>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agoarm: mvebu: turris_omnia: use MMC driver model
Pierre Bourdon [Thu, 11 Apr 2019 02:56:59 +0000 (04:56 +0200)]
arm: mvebu: turris_omnia: use MMC driver model

Enable DM_MMC for compliance with the driver model migration.

Signed-off-by: Pierre Bourdon <delroth@gmail.com>
Cc: Marek Behun <marek.behun@nic.cz>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agommc: mv_sdhci: add driver model support
Pierre Bourdon [Thu, 11 Apr 2019 02:56:58 +0000 (04:56 +0200)]
mmc: mv_sdhci: add driver model support

The new DM implementation currently does not support the Sheeva
88SV331xV5 specific quirk present in the legacy implementation. The
legacy code is thus kept for this SoC and others not yet migrated to
DM_MMC.

Signed-off-by: Pierre Bourdon <delroth@gmail.com>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Cc: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agoarm: mvebu: turris_omnia: fix eeprom/mcu device names
Pierre Bourdon [Wed, 10 Apr 2019 23:00:23 +0000 (01:00 +0200)]
arm: mvebu: turris_omnia: fix eeprom/mcu device names

Commit c4bd12a7dad4 ("i2c: mux: Generate longer i2c mux name") changed
the naming scheme of i2c devices within a mux. This broke references to
i2c@0 in the Turris Omnia board initialization code.

Signed-off-by: Pierre Bourdon <delroth@gmail.com>
Cc: Marek BehĂșn <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Marek BehĂșn <marek.behun@nic.cz>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agoMerge tag 'pull-24apr19' of git://git.denx.de/u-boot-dm
Tom Rini [Wed, 24 Apr 2019 16:27:29 +0000 (12:27 -0400)]
Merge tag 'pull-24apr19' of git://git.denx.de/u-boot-dm

Various minor sandbox iumprovements
Fixes for tracing with sandbox
Refactoring for boot_get_fdt()

5 years agoMerge tag 'efi-2019-07-rc1-3' of git://git.denx.de/u-boot-efi
Tom Rini [Wed, 24 Apr 2019 16:26:58 +0000 (12:26 -0400)]
Merge tag 'efi-2019-07-rc1-3' of git://git.denx.de/u-boot-efi

Pull request for UEFI sub-system for v2019.07-rc1 (3)

This patch series reworks the implementation of the `bootefi` command to
remove code duplication by using the LoadImage() boot service to load
binaries.

Missing short texts for UEFI protocols are added for display by the
`efidebug dh` command.

Missing parameter checks for AllocatePages() and CreateDeviceNode() are
implemented.

The constants for protocol GUIDs are changed to match the names in the UEFI
specification.

5 years agoMerge tag 'u-boot-stm32-mcu-20190423' of https://github.com/pchotard/u-boot
Tom Rini [Wed, 24 Apr 2019 16:26:39 +0000 (12:26 -0400)]
Merge tag 'u-boot-stm32-mcu-20190423' of https://github.com/pchotard/u-boot

STM32 MCUs update:
- DT rework and alignment with DT kernel v4.20
- mmc: arm_pl180_mmci: Synchronize compatible with kernel v4.20
- mmc: stm32_sdmmc2: Synchronize properties with kernel v4.20
- configs: update for F746/769 boards

5 years agoMerge tag 'u-boot-amlogic-20190423' of git://git.denx.de/u-boot-amlogic
Tom Rini [Wed, 24 Apr 2019 16:26:25 +0000 (12:26 -0400)]
Merge tag 'u-boot-amlogic-20190423' of git://git.denx.de/u-boot-amlogic

- Add support for Amlogic p200 & p201 Reference Designs
- Add Amlogic SoC information display
- Add support for the Libretech-AC AML-S805X-AC board
- Add Amlogic AXG reset compatible
- Add I2C support for Amlogic AXG
- Fix AXG PIN and BANK pinctrl definitions
- Fix regmap_read_poll_timeout warning about sandbox_timer_add_offset
- Add initial support for Amlogic G12A SoC and U200 board
- Enable PHY_REALTEK for selected boards
- Fix Khadas VIM2 README

5 years agoMerge branch '2019-04-22-master-imports'
Tom Rini [Wed, 24 Apr 2019 13:04:23 +0000 (09:04 -0400)]
Merge branch '2019-04-22-master-imports'

- Add and enable brcmnand driver on a number of relevant platforms.
  Also add and enable LED drivers on more bcm platforms.
- Various ARMv8 fixes/improvements, including extending PSCI
  functionality.
- fs_loader improvments
- Various FIT/SPL improvements
- PCI bugfixes
- Poplar platform ethernet support
- MediaTek MMC improvements
- Android boot improvements

5 years agoimage: android: fix 'iminfo' typo
Eugeniu Rosca [Mon, 8 Apr 2019 15:35:28 +0000 (17:35 +0200)]
image: android: fix 'iminfo' typo

Fix below CP warning triggered by the 'iminfo' output in another patch:
WARNING: 'addrress' may be misspelled - perhaps 'address'?

Fixes: 4f1318b29c7a20 ("common: image: minimal android image iminfo support")
Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Acked-by: Marek Vasut <marek.vasut@gmail.com>
5 years agoimage: android: allow booting lz4-compressed kernels
Eugeniu Rosca [Mon, 8 Apr 2019 15:35:27 +0000 (17:35 +0200)]
image: android: allow booting lz4-compressed kernels

According to Android image format [1], kernel image resides at 1 page
offset from the boot image address. Grab the magic number from there
and allow U-Boot to handle LZ4-compressed KNL binaries instead of
hardcoding compression type to IH_COMP_NONE. Other compression types,
if needed, can be added later.

Tested on H3ULCB-KF using the image detailed in [2].

[1] Excerpt from include/android_image.h
    +-----------------+
    | boot header     | 1 page
    +-----------------+
    | kernel          | n pages
    +-----------------+
    | ramdisk         | m pages
    +-----------------+
    | second stage    | o pages
    +-----------------+

[2] => iminfo 4c000000
    ## Checking Image at 4c000000 ...
    Android image found
    kernel size:      85b9d1
    kernel address:   48080000
    ramdisk size:     54ddbc
    ramdisk addrress: 4a180000
    second size:      0
    second address:   48000800
    tags address:     48000100
    page size:        800
    os_version:       1200012a (ver: 0.9.0, level: 2018.10)
    name:
    cmdline:          buildvariant=userdebug

Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
5 years agotest: env: Enable env unit tests by default
Heinrich Schuchardt [Sun, 7 Apr 2019 15:57:40 +0000 (17:57 +0200)]
test: env: Enable env unit tests by default

If CONFIG_UNIT_TEST is enabled we should enable the individual tests by
default to ensure good test coverage.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agopci: pci.h: add missing maskbit
Ramon Fried [Sat, 6 Apr 2019 02:12:01 +0000 (05:12 +0300)]
pci: pci.h: add missing maskbit

PCI_MSI_FLAGS_MASKBIT was missing from include file,
add it.

Signed-off-by: Ramon Fried <ramon.fried@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agofdtdec: Use fdt_setprop_u32() for fdtdec_set_phandle()
Thierry Reding [Mon, 15 Apr 2019 08:08:20 +0000 (10:08 +0200)]
fdtdec: Use fdt_setprop_u32() for fdtdec_set_phandle()

The fdt_setprop_u32() function does everything that we need, so we
really only use the function as a convenience wrapper, in which case it
can simply be a static inline function.

Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agodm: core: Change platform specific translation-offset handling
Stefan Roese [Fri, 12 Apr 2019 14:42:28 +0000 (16:42 +0200)]
dm: core: Change platform specific translation-offset handling

Testing has shown that the current DM implementation of a platform /
board specific translation offset, as its needed for the SPL on MVEBU
platforms is buggy. The translation offset is confingured too late,
after the driver bind functions are run. This may result in incorrect
address translations. With the current implementation its not possible
to configure the offset earlier, as the DM code has not run at all.

This patch now removed the set_/get_translation_offset() calls and
moves the translation offset into the GD variable translation_offset.
This variable will get used when CONFIG_TRANSLATION_OFFSET is enabled.
This option is enabled only for MVEBU on ARM32 platforms, where its
currenty needed and configured in the SPL.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Pierre Bourdon <delroth@gmail.com>
Cc: Baruch Siach <baruch@tkos.co.il>
Cc: Simon Glass <sjg@chromium.org>
Cc: Heiko Schocher <hs@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Tested-by: Pierre Bourdon <delroth@gmail.com>
Tested-by: Baruch Siach <baruch@tkos.co.il>
5 years agosimple-bus: add DM_FLAG_PRE_RELOC flag to simple-bus driver
Lukas Auer [Wed, 10 Apr 2019 12:46:07 +0000 (14:46 +0200)]
simple-bus: add DM_FLAG_PRE_RELOC flag to simple-bus driver

Boards such as qemu-riscv, which receive their device tree at runtime,
for example from QEMU or firmware, are unable to add the appropriate
device tree properties to make devices available pre relocation.
Instead, they must rely on the DM_FLAG_PRE_RELOC flag to be set for the
required drivers.

Add the DM_FLAG_PRE_RELOC flag to the simple-bus driver to make devices
under it with drivers that have set the flag as well available pre
relocation for these boards.

Signed-off-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
5 years agosandbox: Enable the 'trace' command when tracing is used
Simon Glass [Mon, 8 Apr 2019 19:20:53 +0000 (13:20 -0600)]
sandbox: Enable the 'trace' command when tracing is used

Enable this by default so that tracing can be inspected if enabled. This
cannot rely on the 'imply' in lib/Kconfig since this method of enabling
tracing relates on an environment variable (FTRACE) and does not use
Kconfig.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agoConvert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig
Simon Glass [Mon, 8 Apr 2019 19:20:52 +0000 (13:20 -0600)]
Convert CONFIG_TRACE_BUFFER_SIZE et al to Kconfig

This converts the following to Kconfig:
   CONFIG_TRACE_BUFFER_SIZE
   CONFIG_TRACE_EARLY_SIZE
   CONFIG_TRACE_EARLY
   CONFIG_TRACE_EARLY_ADDR

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agoConvert CONFIG_TRACE to Kconfig
Simon Glass [Mon, 8 Apr 2019 19:20:51 +0000 (13:20 -0600)]
Convert CONFIG_TRACE to Kconfig

This converts the following to Kconfig:
   CONFIG_TRACE

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agotrace: Tidy up error returns
Simon Glass [Mon, 8 Apr 2019 19:20:50 +0000 (13:20 -0600)]
trace: Tidy up error returns

At present many functions in this file return -1. Update them to return a
valid error code. Also tidy up the 'return' statements at the same time,
since these should have a blank line before them.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodiv64: Don't instrument the division function
Simon Glass [Mon, 8 Apr 2019 19:20:49 +0000 (13:20 -0600)]
div64: Don't instrument the division function

This function may be called from tracing code, since that code needs to
read the timer and this often requires calling do_div(), which calls
__div64_32(). If this function is instrumented it causes an infinite loop,
since emitting a trace record requests the time, which in turn emits a
trace record, etc.

Update the prototype to prevent instrumentation code being added.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodiv64: Use kernel types
Simon Glass [Mon, 8 Apr 2019 19:20:48 +0000 (13:20 -0600)]
div64: Use kernel types

These functions still use uint32_t and uint64_t but checkpatch now
requests that the kernel types be used instead. Update them as well as a
few resulting checkpatch errors.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agoinitcall: Drop use of header files
Simon Glass [Mon, 8 Apr 2019 19:20:47 +0000 (13:20 -0600)]
initcall: Drop use of header files

This file should not include header files. They have already been included
by the time initcall.h is included. Also, document how to enable debugging
in this file.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agosandbox: Increase the early-trace-buffer size
Simon Glass [Mon, 8 Apr 2019 19:20:46 +0000 (13:20 -0600)]
sandbox: Increase the early-trace-buffer size

This buffer is too small now that sandbox has grown in size. Increase it.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobootstage: Allow calling bootstage_mark() before bootstage_init()
Simon Glass [Mon, 8 Apr 2019 19:20:45 +0000 (13:20 -0600)]
bootstage: Allow calling bootstage_mark() before bootstage_init()

It is possible for this to happen if something goes wrong very early in
the init sequence. Add a check for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agosandbox: Move pre-console buffer out of the way of tracing
Simon Glass [Mon, 8 Apr 2019 19:20:44 +0000 (13:20 -0600)]
sandbox: Move pre-console buffer out of the way of tracing

These two buffers currently conflict if tracing is enabled. Move the
pre-console buffer and update the documentation.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agosandbox: Drop the printf() in setup_ram_buf()
Simon Glass [Mon, 8 Apr 2019 19:20:43 +0000 (13:20 -0600)]
sandbox: Drop the printf() in setup_ram_buf()

This was really intended for debugging. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agosandbox: Correct maths in allocation routines
Simon Glass [Mon, 8 Apr 2019 19:20:42 +0000 (13:20 -0600)]
sandbox: Correct maths in allocation routines

Allocation routines were adjusted to ensure that the returned addresses
are a multiple of the page size, but the header code was not updated to
take account of this. These routines assume that the header size is the
same as the page size which is unlikely.

At present os_realloc() does not work correctly due to this bug. The only
user is the hostfs 'ls' command, and only if the directory contains a
unusually long filename, which likely explains why this bug was not
caught earlier.

Fix this by doing the calculations using the obtained page size.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agosandbox: Improve debugging in initcall_run_list()
Simon Glass [Mon, 8 Apr 2019 19:20:41 +0000 (13:20 -0600)]
sandbox: Improve debugging in initcall_run_list()

At present if one of the initcalls fails on sandbox the address printing
is not help, e.g.:

  initcall sequence 0000557678967c80 failed at call 00005576709dfe1f (err=-96)

This is because U-Boot gets relocated high into memory and the relocation
offset (gd->reloc_off) does not work correctly for sandbox.

Add support for finding the base address of the text region (at least on
Linux) and use that to set the relocation offset. This makes the output
better:

  initcall sequence 0000560775957c80 failed at call 0000000000048134 (err=-96)

Then you use can use grep to see which init call failed, e.g.:

   $ grep 0000000000048134 u-boot.map
   stdio_add_devices

Of course another option is to run it with a debugger such as gdb:

   $ gdb u-boot
   ...
   (gdb) br initcall.h:41
   Breakpoint 1 at 0x4db9d: initcall.h:41. (2 locations)

Note that two locations are reported, since this function is used in both
board_init_f() and board_init_r().

   (gdb) r
   Starting program: /tmp/b/sandbox/u-boot
   [Thread debugging using libthread_db enabled]
   Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

   U-Boot 2018.09-00264-ge0c2ba9814-dirty (Sep 22 2018 - 12:21:46 -0600)

   DRAM:  128 MiB
   MMC:

Breakpoint 1, initcall_run_list (init_sequence=0x5555559619e0 <init_sequence_f>)
    at /scratch/sglass/cosarm/src/third_party/u-boot/files/include/initcall.h:41
41 printf("initcall sequence %p failed at call %p (err=%d)\n",
   (gdb) print *init_fnc_ptr
   $1 = (const init_fnc_t) 0x55555559c114 <stdio_add_devices>
   (gdb)

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agocommon: command: Add command execution tracer.
Christoph Muellner [Fri, 5 Apr 2019 11:03:46 +0000 (13:03 +0200)]
common: command: Add command execution tracer.

When using boot scripts it can become quite hard to understand
which commands are actually executed during bootup (e.g. where
is a kernel image loaded from or which DTB is in use).

Shell scripts suffer from a similar problem and many shells address
this problem with a command execution tracer (e.g. BASH has xtrace,
which can be enabled by "set -x").

This patch introduces a command tracer for U-Boot, which prints
every command with its arguments before it is executed.

Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
5 years agofdt: boot_get_fdt: android: use ENV 'fdtaddr' as fallback
Eugeniu Rosca [Mon, 1 Apr 2019 10:52:52 +0000 (12:52 +0200)]
fdt: boot_get_fdt: android: use ENV 'fdtaddr' as fallback

Our platform doesn't store the DTB into the Android image second area,
but rather copies the DTB to RAM from a dedicated dtb.img partition [0],
prior to booting the Android image by calling bootm.

Similar to [1], we find it useful to just call 'bootm' and have the
right DTB being passed to OS (assuming its address has been previously
stored in 'fdtaddr' by calling `fdt addr <dtb-addr>`).

Booting Android with DTB from 'fdtaddr' will only occur if:
 - No DTB is embedded in the second area of Android image
 - 'fdtaddr' points to a valid DTB in RAM

[0] https://source.android.com/devices/architecture/dto/partitions
[1] https://patchwork.ozlabs.org/patch/1046652/
    ("Support boot Android image without address on bootm command")

Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agofdt: boot_get_fdt: android: compress handling (non-functional)
Eugeniu Rosca [Mon, 1 Apr 2019 10:45:36 +0000 (12:45 +0200)]
fdt: boot_get_fdt: android: compress handling (non-functional)

Prepare for booting Android images which lack any DTB in the second
area by using 'fdtaddr' environment variable as source/address of FDT.
No functional/behavioral change expected in this patch.

Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agofdt: boot_get_fdt: simplify no_fdt handling (non-functional)
Eugeniu Rosca [Mon, 1 Apr 2019 10:45:35 +0000 (12:45 +0200)]
fdt: boot_get_fdt: simplify no_fdt handling (non-functional)

Increase the readability of boot_get_fdt().
No change in behavior is expected.

Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agofdt: boot_get_fdt: really boot w/o FDT when "goto no_fdt"
Eugeniu Rosca [Mon, 1 Apr 2019 10:45:34 +0000 (12:45 +0200)]
fdt: boot_get_fdt: really boot w/o FDT when "goto no_fdt"

The 'no_fdt' goto label was introduced by v2015.01 commit [0] and it
had two review stages [1-2]. The *documented* purpose behind commit [0]
is (excerpt from commit description):

> allows both FDT and non-FDT kernels to boot by making the
> third parameter to the bootm/bootz optional

While [1] and [2] share the same goal, they have very different
implementations:
 - [1] was based on a very simple 'argc' check at function error out
   with returning success to the caller if the third parameter was NOT
   passed to bootm/bootz command. This approach had the downside of
   returning success to the caller even in case of legitimate internal
   errors, which should halt booting.
 - [2] added the "no_fdt" label and several "goto no_fdt" statements.
   This allowed to report the legitimate internal errors to the caller.

IOW the major difference between [1] and [2] is:
 - [1] boot w/o FDT if FDT address is not passed to boot{m,z,*}
 - [2] give *freedom* to the developer to boot w/o FDT from any
   (more or less) arbitrary point in the function flow (and here
   comes the peculiar aspect, which looks to be a leftover from [1])
   with the precondition that the 3rd argument (FDT address) is NOT
   provided to boot{m,z,*}. In practice, this means that only a subset
   of "goto no_fdt" end up booting w/o FDT while the other subset is
   returning an error to the caller.

This patch removes the peculiar behavior described above, such that
"goto no_fdt" performs really what it tells to the developer.

The motivation of this patch is to decrease the unneeded complexity
and increase the readability of boot_get_fdt().

[0] 48aead71c1ad ("fdt: Allow non-FDT kernels to boot when CONFIG_OF_LIBFDT is defined")
[1] https://patchwork.ozlabs.org/patch/412923/
    ("[U-Boot,v1] fdt: Allow non-FDT kernels to boot when CONFIG_OF_LIBFDT is defined")
[2] https://patchwork.ozlabs.org/patch/415635/
    ("[U-Boot,v2] fdt: Allow non-FDT kernels to boot when CONFIG_OF_LIBFDT is defined")

Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agofdt: boot_get_fdt: remove redundant zeroing out
Eugeniu Rosca [Mon, 1 Apr 2019 10:45:33 +0000 (12:45 +0200)]
fdt: boot_get_fdt: remove redundant zeroing out

Paranoid programming [1] lies at the foundation of proper software
development, but the repetitive zeroing-out of output arguments in the
context of the same function rather clutters the code and inhibits
further refactoring/optimization than is doing any good.

In boot_get_fdt(), we already perform zero/NULL-initialization of
*of_flat_tree and *of_size at the beginning of the function, so doing
the same at function error-out is redundant/superfluous.

Moreover, keeping the code unchanged might encourage the developers to
update *of_flat_tree and *of_size during some interim computations,
which is against the current design of boot_get_fdt(). Currently,
writing useful data into these arguments happens just before
successfully returning from boot_get_fdt() and it should better stay so.

[1] https://blog.regehr.org/archives/1106

Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agoARMv8: PSCI: Fix PSCI_TABLE relocation issue
Lars Povlsen [Thu, 4 Apr 2019 12:38:50 +0000 (14:38 +0200)]
ARMv8: PSCI: Fix PSCI_TABLE relocation issue

This fixes relaction isses with the PSCI_TABLE entries in
the psci_32_table and psci_64_table.

When using 32-bit adress pointers relocation was not being applied to
the tables, causing PSCI handlers to point to the un-relocated code
area. By using 64-bit data relocation is properly applied. The
handlers are thus in the "secure data" area, which is protected by
/memreserve/ in the FDT.

Signed-off-by: Lars Povlsen <lars.povlsen@microchip.com>
5 years agobootm: Simplying cache flush code
Trent Piepho [Wed, 27 Mar 2019 23:50:09 +0000 (23:50 +0000)]
bootm: Simplying cache flush code

The cache flush of the kernel load area needs to be aligned outward to
the DMA cache alignment.  The operations are simpler if we think of this
as aligning the start down, ALIGN_DOWN(load, ARCH_DMA_MINALIGN), and
aligning the end up, ALIGN(load_end, ARCH_DMA_MINALIGN), and then find
the length of the flushed region by subtracting the former from the
latter.

Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Trent Piepho <tpiepho@impinj.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agomalloc: Fix memalign not honoring alignment prior to full malloc init
Andreas Dannenberg [Wed, 27 Mar 2019 18:17:26 +0000 (13:17 -0500)]
malloc: Fix memalign not honoring alignment prior to full malloc init

When using memalign() in a scenario where U-Boot is configured for full
malloc support with simple malloc not explicitly enabled and before the
full malloc support is initialized, a memory block is being allocated
and returned without the alignment parameter getting honored.

Fix this issue by replacing the existing memalign pre-full malloc init
logic with a call to memalign_simple() this way ensuring proper alignment
of the returned memory block.

Fixes: ee038c58d519 ("malloc: Use malloc simple before malloc is fully initialized in memalign()")
Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
5 years agospl: spl_nand.c: Add NAND loading message
Stefan Roese [Tue, 26 Mar 2019 12:04:00 +0000 (13:04 +0100)]
spl: spl_nand.c: Add NAND loading message

This patch adds a short message to the SPL NAND loader, which displays
the source and destinations addresses including the size of the
loaded image, like this:

U-Boot SPL 2019.04-rc3-00113-g486efd8aaf (Mar 15 2019 - 14:18:02 +0100)
Trying to boot from NAND
Loading U-Boot from 0x00040000 (size 0x000a0000) to 0x22900000

I find this message quite helpful - hopefully others do so as well.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
5 years agoARM: MediaTek: Add support for MT8516 SoC
Fabien Parent [Sun, 24 Mar 2019 15:46:38 +0000 (16:46 +0100)]
ARM: MediaTek: Add support for MT8516 SoC

Add support for MediaTek MT8516 SoC. This include the file
that will initialize the SoC after boot and its device tree.

Signed-off-by: Fabien Parent <fparent@baylibre.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
5 years agopinctrl: add driver for MT8516
Fabien Parent [Sun, 24 Mar 2019 15:46:37 +0000 (16:46 +0100)]
pinctrl: add driver for MT8516

Add Pinctrl driver for MediaTek MT8516 SoC.

Signed-off-by: Fabien Parent <fparent@baylibre.com>
Acked-by: Ryder Lee <ryder.lee@mediatek.com>
5 years agoclk: mediatek: add driver for MT8516
Fabien Parent [Sun, 24 Mar 2019 15:46:36 +0000 (16:46 +0100)]
clk: mediatek: add driver for MT8516

Add clock driver for MediaTek MT8516 SoC.

Signed-off-by: Fabien Parent <fparent@baylibre.com>
Acked-by: Ryder Lee <ryder.lee@mediatek.com>
[trini: Redo whitespace]
Signed-off-by: Tom Rini <trini@konsulko.com>
5 years agoclk: mediatek: add support for SETCLR_INV and NO_SETCLR flags
Fabien Parent [Sun, 24 Mar 2019 15:46:35 +0000 (16:46 +0100)]
clk: mediatek: add support for SETCLR_INV and NO_SETCLR flags

Add the implementation for the CLK_GATE_SETCLR_INV and
CLK_GATE_NO_SETCLR flags.

Signed-off-by: Fabien Parent <fparent@baylibre.com>
Acked-by: Ryder Lee <ryder.lee@mediatek.com>
5 years agommc: mtk-sd: fix configuration option check
Fabien Parent [Sun, 24 Mar 2019 15:46:34 +0000 (16:46 +0100)]
mmc: mtk-sd: fix configuration option check

We either need to use IS_ENABLED(CONFIG_FOO) or CONFIG_IS_ENABLED(FOO).
IS_ENABLE(FOO) will always return false.

This commit fixes the comparison by using the CONFIG_IS_ENABLED(FOO)
syntax.

Signed-off-by: Fabien Parent <fparent@baylibre.com>
5 years agommc: mtk-sd: add support for MT8516
Fabien Parent [Sun, 24 Mar 2019 15:46:33 +0000 (16:46 +0100)]
mmc: mtk-sd: add support for MT8516

Add config for handling MT8516 SoC.

Signed-off-by: Fabien Parent <fparent@baylibre.com>
Acked-by: Ryder Lee <ryder.lee@mediatek.com>
5 years agommc: mtk-sd: add source_cg clock support
Fabien Parent [Sun, 24 Mar 2019 15:46:32 +0000 (16:46 +0100)]
mmc: mtk-sd: add source_cg clock support

Some MediaTek SoC need an additional clock "source_cg". Enable
this new clock. We reuse the same clock name as in the kernel.

Signed-off-by: Fabien Parent <fparent@baylibre.com>
Acked-by: Ryder Lee <ryder.lee@mediatek.com>
5 years agopoplar: enable Ethernet driver support
Shawn Guo [Wed, 20 Mar 2019 07:32:41 +0000 (15:32 +0800)]
poplar: enable Ethernet driver support

The 'phy' reset of gmac device in kernel device tree is not generic
enough for u-boot to use, so we need to overwrite the 'resets' property
as needed.  With this device tree fixup and poplar_defconfig changes,
Ethernet starts working on Poplar board.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
5 years agonet: add higmacv300 Ethernet driver for HiSilicon platform
Shawn Guo [Wed, 20 Mar 2019 07:32:40 +0000 (15:32 +0800)]
net: add higmacv300 Ethernet driver for HiSilicon platform

It adds the driver for HIGMACV300 Ethernet controller found on HiSilicon
SoCs like Hi3798CV200.  It's based on a downstream U-Boot driver, but
quite a lot of code gets rewritten and cleaned up to adopt driver model
and PHY API.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
5 years agoreset: add reset driver for HiSilicon platform
Shawn Guo [Wed, 20 Mar 2019 07:32:39 +0000 (15:32 +0800)]
reset: add reset driver for HiSilicon platform

It adds a Driver Model compatible reset driver for HiSlicon platform.
The driver implements a custom .of_xlate function, and uses .data field
as reset register offset and .id field as bit shift.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
5 years agoreset: add polarity field into struct reset_ctl
Shawn Guo [Wed, 20 Mar 2019 07:32:38 +0000 (15:32 +0800)]
reset: add polarity field into struct reset_ctl

Some reset controllers support different polarities for reset operation,
so let's add a polarity field into struct reset_ctl.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
5 years agopci: Scale MAX_PCI_REGIONS based on CONFIG_NR_DRAM_BANKS
Thierry Reding [Fri, 15 Mar 2019 15:32:33 +0000 (16:32 +0100)]
pci: Scale MAX_PCI_REGIONS based on CONFIG_NR_DRAM_BANKS

If a platform defines CONFIG_NR_DRAM_BANKS, each DRAM bank will be added
as a PCI region. The number of MAX_PCI_REGIONS therefore needs to scale
with the number of DRAM banks, otherwise we will end up with too little
space in the hose->regions array to store all system memory regions.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agopci: Add boundary check for hose->regions
Thierry Reding [Fri, 15 Mar 2019 15:32:32 +0000 (16:32 +0100)]
pci: Add boundary check for hose->regions

Make sure that we don't overflow the hose->regions array, otherwise we
would end up overwriting the hose->region_count field and cause mayhem
to ensue. Also print an error message when we'd be overflowing because
it indicates that there aren't enough regions available and the number
needs to be increased.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agoARM: da850evm: Remove legacy MMC code
Adam Ford [Fri, 15 Mar 2019 19:29:20 +0000 (14:29 -0500)]
ARM: da850evm: Remove legacy MMC code

With the migration to DM in SPL and the DT support, the
old legacy code is no longer neaded, so this patch removes it

Signed-off-by: Adam Ford <aford173@gmail.com>
5 years agobcm963158: enable led support
Philippe Reynes [Fri, 22 Mar 2019 16:02:08 +0000 (17:02 +0100)]
bcm963158: enable led support

Enable the led support in the configuration
of the board bcm963158.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
5 years agodt: bcm963158: enable led controller
Philippe Reynes [Fri, 22 Mar 2019 16:02:07 +0000 (17:02 +0100)]
dt: bcm963158: enable led controller

Enable the led controller in the device tree
of the board bcm963158.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
5 years agodt: bcm63158: add led controller
Philippe Reynes [Fri, 22 Mar 2019 16:02:06 +0000 (17:02 +0100)]
dt: bcm63158: add led controller

Add the led controller in the bcm63158 device tree.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
5 years agoled: bcm6858: allow to use this driver on ARCH_963158
Philippe Reynes [Fri, 22 Mar 2019 16:02:05 +0000 (17:02 +0100)]
led: bcm6858: allow to use this driver on ARCH_963158

Allow the led bcm6858 driver to be used on bcm63158.
They have the same led controller.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
5 years agobcm968580xref: enable led support
Philippe Reynes [Fri, 22 Mar 2019 16:02:04 +0000 (17:02 +0100)]
bcm968580xref: enable led support

Enable the led support in the configuration
of the board bcm968580xref.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
5 years agodt: bcm968580xref: enable led controller
Philippe Reynes [Fri, 22 Mar 2019 16:02:03 +0000 (17:02 +0100)]
dt: bcm968580xref: enable led controller

Enable the led controller in the device tree
of the board bcm968580xref.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
5 years agommc: stm32_sdmmc2: Fix r1b timeout issue
Christophe Kerello [Thu, 6 Dec 2018 14:58:10 +0000 (15:58 +0100)]
mmc: stm32_sdmmc2: Fix r1b timeout issue

On response type r1b, if DTIME is not defined or too short,
the Datatimeout and DPSM flag occurs. Like the DPSM is
activated all next data transfer will be frozen.
To avoid this freeze:
    -The driver must define a DTIME on all r1b response type.
    -DTIME of SDMMC must be defined for alls stop transmission
     (for read and write request) even if MMC_RSP_BUSY is not set.
    -If busy timeout occur, an abort request must be sent to
     reinitialize the DPSM.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Tested-by: Patrick DELAUNAY <patrick.delaunay@st.com>
5 years agommc: stm32_sdmmc2: Update DT properties with v4.19 bindings
Patrick Delaunay [Fri, 16 Nov 2018 09:25:54 +0000 (10:25 +0100)]
mmc: stm32_sdmmc2: Update DT properties with v4.19 bindings

Some properties name has been updated:
  - st,dirpol becomes st,sig-dir
  - st,negedge becomes st,neg-edge
  - st,pin-ckin becomes st,use-ckin

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
5 years agoARM: dts: stm32: Update sdmmc binding for stm32mp157c-ed1
Patrice Chotard [Tue, 12 Feb 2019 16:17:58 +0000 (17:17 +0100)]
ARM: dts: stm32: Update sdmmc binding for stm32mp157c-ed1

Update some sdmmc properties which have been updated with
v4.19 DT bindings:
      - st,dirpol becomes st,sig-dir
      - st,negedge becomes st,neg-edge
      - st,pin-ckin becomes st,use-ckin

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
5 years agoARM: dts: stm32: Update sdmmc binding for stm32h743i-eval
Patrice Chotard [Wed, 17 Apr 2019 09:53:29 +0000 (11:53 +0200)]
ARM: dts: stm32: Update sdmmc binding for stm32h743i-eval

Update some sdmmc properties which have been updated with
v4.19 DT bindings:
      - st,dirpol becomes st,sig-dir
      - st,negedge becomes st,neg-edge
      - st,pin-ckin becomes st,use-ckin

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
5 years agoboard: stm32f746-disco: Get MII/RMII phy_mode from DT
Patrice Chotard [Fri, 22 Feb 2019 14:04:44 +0000 (15:04 +0100)]
board: stm32f746-disco: Get MII/RMII phy_mode from DT

This is needed to make ethernet work on stm32f746-eval which
uses MII mode.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
5 years agoconfigs: stm32f746-disco: Enable SPI_FLASH_MACRONIX
Patrice Chotard [Fri, 22 Feb 2019 14:04:43 +0000 (15:04 +0100)]
configs: stm32f746-disco: Enable SPI_FLASH_MACRONIX

This config file is shared between stm32f746-disco and stm32f769-disco.
These 2 boards doesn't embed the same qspi flash (Micron n25q128a on
f746-disco, Macronix mx66l51235l on f769-disco).

To be able to use Macronix mx66l51235l on F769-disco, flags
SPI_FLASH_MACRONIX must be enabled.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
5 years agoconfigs: stm32f746-disco: enable CONFIG_DISTRO_DEFAULTS
Patrice Chotard [Thu, 21 Feb 2019 09:12:08 +0000 (10:12 +0100)]
configs: stm32f746-disco: enable CONFIG_DISTRO_DEFAULTS

Allows to boot linux distribution

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
5 years agoconfigs: stm32f746-disco: update EXTRA_ENV_SETTINGS
Patrice Chotard [Thu, 21 Feb 2019 09:07:54 +0000 (10:07 +0100)]
configs: stm32f746-disco: update EXTRA_ENV_SETTINGS

Allows to boot linux distribution.

As stm32f746-disco and stm32f769-disco are sharing the same defconfig
file, in case of stm32f769-disco build, "fdtfile=..." must be updated
with the correct stm32f769 DTB file name.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
5 years agommc: arm_pl180_mmci: Sync compatible with kernel
Patrice Chotard [Wed, 5 Dec 2018 13:04:32 +0000 (14:04 +0100)]
mmc: arm_pl180_mmci: Sync compatible with kernel

Initially the compatible string was wrongly set to "st,stm32f4xx-sdio".
Use compatible string used by kernel instead and identify mmci variant
using "arm,primecell-periphid" property.

Currently, the DM part of mmci driver is only used by STM32 SoCs,
that's why the switch case gets only one entry. It will be populated
easily with new variant in the future.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
5 years agopinctrl: stm32: Add st,stm32f769-pinctrl compatible string
Patrice Chotard [Tue, 11 Dec 2018 13:49:18 +0000 (14:49 +0100)]
pinctrl: stm32: Add st,stm32f769-pinctrl compatible string

Due to DT kernel synchronisation, add new pinctrl compatible
string for stm32f769.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
5 years agoARM: dts: stm32: Restore old usart1 clock bindings for stm32f7
Patrice Chotard [Mon, 18 Feb 2019 22:19:45 +0000 (23:19 +0100)]
ARM: dts: stm32: Restore old usart1 clock bindings for stm32f7

As U-boot stm32f clock driver doesn't support new
bindings for auxiliary clocks (clocks = <&rcc 1 ....>),
restore old bindings for usart1 to get console output.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
5 years agoARM: dts: stm32: Sync DT with v4.20 kernel for stm32h7
Patrice Chotard [Thu, 6 Dec 2018 10:53:39 +0000 (11:53 +0100)]
ARM: dts: stm32: Sync DT with v4.20 kernel for stm32h7

Synchronize stm32h7 device tree with kernel v4.20.
U-boot DT files and pinctrl bindings are updated,
useless nodes are removed and gpio compatible added.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
5 years agoARM: dts: Migrate U-boot nodes to U-boot DT files for stm32h7
Patrice Chotard [Thu, 6 Dec 2018 10:59:42 +0000 (11:59 +0100)]
ARM: dts: Migrate U-boot nodes to U-boot DT files for stm32h7

In order to prepare and ease future DT synchronization with kernel
DT, migrate all U-boot specific nodes/properties/addons to
U-boot DT files.

As sdmmc is not yet supported on kernel side, sdmmc nodes
are located in eval-u-boot and disco-u-boot DT files.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
5 years agoARM: dts: stm32: Sync DT with v4.20 kernel for stm32f7
Patrice Chotard [Tue, 19 Feb 2019 15:49:05 +0000 (16:49 +0100)]
ARM: dts: stm32: Sync DT with v4.20 kernel for stm32f7

Synchronize stm32f7 device tree with kernel v4.20.

All pinctrl bindings are updated.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
5 years agoARM: dts: stm32: Migrate U-boot nodes to U-boot DT files for stm32f7
Patrice Chotard [Mon, 18 Feb 2019 23:37:20 +0000 (00:37 +0100)]
ARM: dts: stm32: Migrate U-boot nodes to U-boot DT files for stm32f7

In order to prepare and ease future DT synchronization with kernel
DT, migrate all U-boot specific nodes/properties/addons to
U-boot DT files.

Migrate also DT nodes which are not yet available on kernel DT side
as ethernet, ltdc and qspi nodes.

Fix ethernet_mii pins and add missing qspi_pins for stm32746g-eval

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
5 years agoARM: dts: stm32: Sync DT files with v4.20 kernel for stm32f4
Patrice Chotard [Mon, 18 Feb 2019 21:54:35 +0000 (22:54 +0100)]
ARM: dts: stm32: Sync DT files with v4.20 kernel for stm32f4

Synchronize stm32f7 device tree with kernel v4.20.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
5 years agoARM:dts: stm32: sort nodes by alphabetical order in f4 u-boot files
Patrice Chotard [Mon, 18 Feb 2019 21:46:25 +0000 (22:46 +0100)]
ARM:dts: stm32: sort nodes by alphabetical order in f4 u-boot files

Sort nodes alphabetically to be coherent with all others STM32 DT files.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
5 years agoboard: amlogic-q200: fix Khadas VIM2 README
Neil Armstrong [Wed, 10 Apr 2019 14:22:41 +0000 (16:22 +0200)]
board: amlogic-q200: fix Khadas VIM2 README

The vendor U-boot branch and defconfig was wrong for the
Khadas VIM2, fix this.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
5 years agoboard: amlogic: enable PHY_REALTEK for selected boards
Neil Armstrong [Wed, 10 Apr 2019 14:41:30 +0000 (16:41 +0200)]
board: amlogic: enable PHY_REALTEK for selected boards

When using the generic PHY on boards using an RGMII Realtek PHY,
gigabit speed is not always reliable.

This patch enables the Realtek PHY driver for such boards.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
5 years agoboards: meson: add g12a u200
Jerome Brunet [Tue, 12 Feb 2019 13:23:25 +0000 (14:23 +0100)]
boards: meson: add g12a u200

The Amlogic U200 board is based on the Amlogic S905D2 SoC
from the Amlogic G12A SoC family.

The board has the following specifications :
 - Amlogic S905D2 ARM Cortex-A53 quad-core SoC
 - XGB DDR4 SDRAM
 - 10/100 Ethernet (Internal PHY)
 - 1 x USB 3.0 Host
 - eMMC
 - SDcard
 - Infrared receiver
 - SDIO WiFi Module
 - MIPI DSI Connector
 - Audio HAT Connector
 - PCI-E M.2 Connector

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
5 years agoARM: dts: Import Amlogic G12A u200 DT from Linux 5.1-rc1
Neil Armstrong [Fri, 8 Mar 2019 14:09:40 +0000 (15:09 +0100)]
ARM: dts: Import Amlogic G12A u200 DT from Linux 5.1-rc1

Import Linux 5.1-rc1 DT from 9e98c678c2d6 ("Linux 5.1-rc1") for the
meson-g12a-u200 board, the meson-g12a.dtsi and the corresponding bindings.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
5 years agoARM: meson: add G12a support
Jerome Brunet [Fri, 8 Feb 2019 15:23:20 +0000 (16:23 +0100)]
ARM: meson: add G12a support

Add support for the Amlogic G12A SoC, which is a mix between the
new physical memory mapping of AXG and the functionnalities of
the previous Amlogic GXL/GXM SoCs.

To handle the internal ethernet PHY, the Amlogic G12A SoCs now
embeds a dedicated PLL to feed the internal PHY.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
5 years agoclk: meson: add g12a support
Jerome Brunet [Mon, 11 Feb 2019 15:45:01 +0000 (16:45 +0100)]
clk: meson: add g12a support

Add basic support for the Amlogic G12A clock controller based on
the AXG driver.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
5 years agoclk: create meson directory and move related drivers
Jerome Brunet [Sun, 10 Feb 2019 13:54:30 +0000 (14:54 +0100)]
clk: create meson directory and move related drivers

In order to support the Amlogic G12A clock controller,
re-architect the clock files into a meson directory.

No functionnal changes.

MAINTAINERS entry is also updated.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
5 years agopinctrl: meson: add g12a support
Jerome Brunet [Fri, 8 Feb 2019 16:40:57 +0000 (17:40 +0100)]
pinctrl: meson: add g12a support

Add pinctrl support for the Amlogic G12A SoC, which is
very similar to the Amlogic AXG support but with an additionnal
drive-strength register bank.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
5 years agoregmap: fix regmap_read_poll_timeout warning about sandbox_timer_add_offset
Neil Armstrong [Thu, 11 Apr 2019 15:01:23 +0000 (17:01 +0200)]
regmap: fix regmap_read_poll_timeout warning about sandbox_timer_add_offset

When fixing sandbox test for regmap_read_poll_timeout(), the
sandbox_timer_add_offset was introduced but only defined in sandbox code
thus generating warnings when used out of sandbox :

include/regmap.h:289:2: note: in expansion of macro 'regmap_read_poll_timeout_test'
regmap_read_poll_timeout_test(map, addr, val, cond, sleep_us, \
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/spi/meson_spifc.c:169:8: note: in expansion of macro 'regmap_read_poll_timeout'
ret = regmap_read_poll_timeout(spifc->regmap, REG_SLAVE, data,
        ^~~~~~~~~~~~~~~~~~~~~~~~
drivers/spi/meson_spifc.c: In function 'meson_spifc_txrx':
include/regmap.h:277:4: warning: implicit declaration of function 'sandbox_timer_add_offset' [-Wimplicit-function-declaration]

This fix adds a timer_test_add_offset() only defined in sandbox, and
renames the previous sandbox_timer_add_offset() to it.

Cc: Simon Glass <sjg@chromium.org>
Reported-by: Tom Rini <trini@konsulko.com>
Fixes: df9cf1cc08 ("test: dm: regmap: Fix the long test delay")
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agoefi_loader: check length in CreateDeviceNode()
Heinrich Schuchardt [Mon, 22 Apr 2019 22:51:01 +0000 (00:51 +0200)]
efi_loader: check length in CreateDeviceNode()

When creating a device path node ensure that the size of the allocated
memory at lest matches the size of the node header.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: check memory type in AllocatePages()
Heinrich Schuchardt [Mon, 22 Apr 2019 22:30:53 +0000 (00:30 +0200)]
efi_loader: check memory type in AllocatePages()

The UEFI specification prescribes that AllocatePages() checks the memory
type.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: need either ACPI table or device tree
Heinrich Schuchardt [Sat, 20 Apr 2019 11:33:55 +0000 (13:33 +0200)]
efi_loader: need either ACPI table or device tree

The EBBR specification prescribes that we should have either an ACPI table
or a device tree but not both. Let us enforce this condition in the
`bootefi` command.

If the bootefi command is called without a device tree parameter use a
previously device tree or fall back to the internal device tree.

The fdt unit test should not be run on boards with an ACPI table.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_selftest: do not run FDT test with ACPI table.
Heinrich Schuchardt [Sat, 20 Apr 2019 11:33:55 +0000 (13:33 +0200)]
efi_selftest: do not run FDT test with ACPI table.

The EBBR specification prescribes that we should have either an ACPI table
or a device tree but not both.

So do not run the device tree unit test on boards with an ACPI table.
Hence there is no need any longer to make it 'on request' only.
Do not pass $fdtcontroladdr to `bootefi selftest`.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agotest/py: pytest.mark.notbuildconfigspec()
Heinrich Schuchardt [Mon, 22 Apr 2019 07:18:55 +0000 (09:18 +0200)]
test/py: pytest.mark.notbuildconfigspec()

We already can let a Python test depend on a build option being set via
@pytest.mark.buildconfigspec(). It may be necessary to let a test depend on
a build option *not* being set. So let's introduce

    @pytest.mark.notbuildconfigspec

for this purpose.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: disable EFI_LOADER on vexpress_ca15_tc2 and ca9x4
Heinrich Schuchardt [Sun, 21 Apr 2019 22:06:20 +0000 (00:06 +0200)]
efi_loader: disable EFI_LOADER on vexpress_ca15_tc2 and ca9x4

vexpress_ca15_tc2_defconfig and vexpress_ca9x4_defconfig do not provide
device trees (as $fdtcontroladdr) as needed to pass our Travis CI tests.

As we are on the move to requiring block devices to be based on the driver
model these boards either will have to be converted to use device trees or
will be kicked out of U-Boot.

So let's disable CONFIG_EFI_LOADER on these boards until the device tree
issue is resolved.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: rework bootmgr/bootefi using load_image API
AKASHI Takahiro [Fri, 19 Apr 2019 03:22:35 +0000 (12:22 +0900)]
efi_loader: rework bootmgr/bootefi using load_image API

In the current implementation, bootefi command and EFI boot manager
don't use load_image API, instead, use more primitive and internal
functions. This will introduce duplicated code and potentially
unknown bugs as well as inconsistent behaviours.

With this patch, do_efibootmgr() and do_boot_efi() are completely
overhauled and re-implemented using load_image API.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Use efi_root as parent handle for the loaded image.
LoadImage() should be called with BootPolicy = true by the boot manager.
Avoid duplicate free_pool().
Eliminate variable memdp which is not needed after anymore due to
"efi_loader: correctly split device path of loaded image".

Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: correctly split device path of loaded image
Heinrich Schuchardt [Sat, 20 Apr 2019 19:24:43 +0000 (19:24 +0000)]
efi_loader: correctly split device path of loaded image

When the LoadImage() service is called for an image that is already loaded
to memory the file path may be NULL or it will contain both a device path
as well as a media path. We should not assume that there is no media path.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agocmd: bootefi: carve out do_bootefi_image() from do_bootefi()
AKASHI Takahiro [Fri, 19 Apr 2019 03:22:34 +0000 (12:22 +0900)]
cmd: bootefi: carve out do_bootefi_image() from do_bootefi()

This is a preparatory patch for reworking do_bootefi() in later patch.
All the non-boot-manager-based (that is, bootefi <addr>) code is put
into one function, do_bootefi_image().

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agocmd: bootefi: carve out bootmgr code from do_bootefi()
AKASHI Takahiro [Fri, 19 Apr 2019 03:22:33 +0000 (12:22 +0900)]
cmd: bootefi: carve out bootmgr code from do_bootefi()

This is a preparatory patch for reworking do_bootefi() in later patch.
do_bootmgr_exec() is renamed to do_efibootmgr() as we put all the necessary
code into this function.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agocmd: bootefi: move do_bootefi_bootmgr_exec() forward
AKASHI Takahiro [Fri, 19 Apr 2019 03:22:32 +0000 (12:22 +0900)]
cmd: bootefi: move do_bootefi_bootmgr_exec() forward

This is a preparatory patch for reworking do_bootefi() in later patch.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agocmd: bootefi: carve out efi_selftest code from do_bootefi()
AKASHI Takahiro [Fri, 19 Apr 2019 03:22:31 +0000 (12:22 +0900)]
cmd: bootefi: carve out efi_selftest code from do_bootefi()

This is a preparatory patch for reworking do_bootefi() in later patch.

Efi_selftest code is unusual in terms of execution path in do_bootefi(),
which make that function complicated and hard to understand. With this
patch, all efi_selftest related code will be put in a separate function.

The change also includes expanding efi_run_prepare() and efi_run_finish()
in do_bootefi_exec().

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agocmd: bootefi: merge efi_install_fdt() and efi_process_fdt()
AKASHI Takahiro [Fri, 19 Apr 2019 03:22:30 +0000 (12:22 +0900)]
cmd: bootefi: merge efi_install_fdt() and efi_process_fdt()

This is a preparatory patch for reworking do_bootefi() in later patch.
For simplicity, merge two functions.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Return error code of efi_install_configuration_table() when aborting from
efi_install_fdt().

Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agocmd: bootefi: carve out fdt handling from do_bootefi()
AKASHI Takahiro [Fri, 19 Apr 2019 03:22:29 +0000 (12:22 +0900)]
cmd: bootefi: carve out fdt handling from do_bootefi()

This is a preparatory patch for reworking do_bootefi() in later patch.

Carve out a function to handle the installation of the device tree
as a configuration table in system table.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agocmd: bootefi: rework set_load_options()
AKASHI Takahiro [Fri, 19 Apr 2019 03:22:28 +0000 (12:22 +0900)]
cmd: bootefi: rework set_load_options()

set_load_options() can fail, so it should return error code to stop
invoking an image.
In addition, set_load_options() now takes a handle, instead of
loaded_image_info, to utilize efi_load_image() in a later patch.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>