oweals/u-boot.git
5 years agorockchip: rk3399; move spl_board_init() into soc file
Kever Yang [Mon, 22 Jul 2019 11:59:39 +0000 (19:59 +0800)]
rockchip: rk3399; move spl_board_init() into soc file

Move spl_board_init() into rk3399.c so that we can re-use the
common SPL board file later.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agorockchip: rk3399: move SoC setting into arch_cpu_init()
Kever Yang [Mon, 22 Jul 2019 11:59:38 +0000 (19:59 +0800)]
rockchip: rk3399: move SoC setting into arch_cpu_init()

SoC setting like DDR secure region and EMMC clock setting
should go to arch_cpu_init().

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agorockchip: rk3399: show SPL BANNER earlier in board_init_f()
Kever Yang [Mon, 22 Jul 2019 11:59:37 +0000 (19:59 +0800)]
rockchip: rk3399: show SPL BANNER earlier in board_init_f()

Show the SPL BANNER earlier so that we know already get into SPL.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agorockchip: rk3399: move spl_perform_fixups() into soc file
Kever Yang [Mon, 22 Jul 2019 11:59:36 +0000 (19:59 +0800)]
rockchip: rk3399: move spl_perform_fixups() into soc file

Move the spl_perform_fixups() into rk3399.c so that we can
use common spl board file later.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agorockchip: rk3368: add boot_devices mapping to support 'same-as-spl'
Kever Yang [Mon, 22 Jul 2019 11:59:35 +0000 (19:59 +0800)]
rockchip: rk3368: add boot_devices mapping to support 'same-as-spl'

The driver need a mapping to get the dts node by boot srouce ID.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agorockchip: rk3368: migrate to use common spl board file
Kever Yang [Mon, 22 Jul 2019 11:59:34 +0000 (19:59 +0800)]
rockchip: rk3368: migrate to use common spl board file

rk3368 has similar boot flow in SPL with other Rockchip SoCs,
migrate to use common spl board file.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agorockchip: rk3328: add boot_devices mapping to support 'same-as-spl'
Kever Yang [Mon, 22 Jul 2019 11:59:33 +0000 (19:59 +0800)]
rockchip: rk3328: add boot_devices mapping to support 'same-as-spl'

The driver need a mapping to get the dts node by boot srouce ID.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agorockchip: rk3328: migrate to use common spl board file
Kever Yang [Mon, 22 Jul 2019 11:59:32 +0000 (19:59 +0800)]
rockchip: rk3328: migrate to use common spl board file

rk3328 has similar boot flow in SPL with other Rockchip SoCs,
migrate to use common spl board file.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agorockchip: rk3328: add STIMER_BASE definition
Kever Yang [Mon, 22 Jul 2019 11:59:31 +0000 (19:59 +0800)]
rockchip: rk3328: add STIMER_BASE definition

Add the CONFIG_ROCKCHIP_STIMER_BASE so that we can use the stimer
init function in tpl.c and spl.c

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agorockchip: rk3288: add boot_devices mapping to support 'same-as-spl'
Kever Yang [Mon, 22 Jul 2019 11:59:30 +0000 (19:59 +0800)]
rockchip: rk3288: add boot_devices mapping to support 'same-as-spl'

The driver need a mapping to get the dts node by boot srouce ID.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agorockchip: rk3288-veyron: Migrate "u-boot, boot0" to "u-boot, spl-boot-order"
Kever Yang [Mon, 22 Jul 2019 11:59:29 +0000 (19:59 +0800)]
rockchip: rk3288-veyron: Migrate "u-boot, boot0" to "u-boot, spl-boot-order"

"u-boot,spl-boot-order" is more flexible and other rockchip SoCs
has convert to use it, migrate to use the new dts property.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agorockchip: phycore: remove no use "u-boot, boot0" in dts
Kever Yang [Mon, 22 Jul 2019 11:59:28 +0000 (19:59 +0800)]
rockchip: phycore: remove no use "u-boot, boot0" in dts

We are using "u-boot,spl-boot-order" now and re-use the
definition from rk3288-u-boot.dtsi, so remove it directly here.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agorockchip: rk3288: Migrate to use common spl board file
Kever Yang [Mon, 22 Jul 2019 11:59:27 +0000 (19:59 +0800)]
rockchip: rk3288: Migrate to use common spl board file

rk3288 has similar boot flow in SPL with other Rockchip SoCs,
migrate to use common spl board file.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agorockchip: rk3288: move dram_init_banksize() into soc file
Kever Yang [Mon, 22 Jul 2019 11:59:26 +0000 (19:59 +0800)]
rockchip: rk3288: move dram_init_banksize() into soc file

Mov edram_init_banksize() into rk3288.c so that we can re-use
the common SPL board file later.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agorockchip: rk3288-phycore: move phycore_init() to its own board file
Kever Yang [Mon, 22 Jul 2019 11:59:25 +0000 (19:59 +0800)]
rockchip: rk3288-phycore: move phycore_init() to its own board file

phycore_init() is use for phycore board only, it should be move back
to phycore-rk3288.c

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agorockchip: rk3288: move setup_led() to firefly-rk3288
Kever Yang [Mon, 22 Jul 2019 11:59:24 +0000 (19:59 +0800)]
rockchip: rk3288: move setup_led() to firefly-rk3288

Only firefly-rk3288 has the dts node "u-boot,boot-led",
while CONFIG_SPL_LED is not enable, move code to firefly-rk3288
now in case someone need this code.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agorockchip: rk3288: show SPL BANNER earlier in board_init_f()
Kever Yang [Mon, 22 Jul 2019 11:59:23 +0000 (19:59 +0800)]
rockchip: rk3288: show SPL BANNER earlier in board_init_f()

Show the SPL BANNER earlier so that we know already get into SPL.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agorockchip: fit_spl_optee: rockchip: fix warning unit_address_vs_reg
Kever Yang [Mon, 22 Jul 2019 11:59:22 +0000 (19:59 +0800)]
rockchip: fit_spl_optee: rockchip: fix warning unit_address_vs_reg

Update to fix warning:
u-boot.itb.tmp: Warning (unit_address_vs_reg): Node /images/uboot@1
has a unit name, but no reg property
u-boot.itb.tmp: Warning (unit_address_vs_reg): Node /images/optee@1
has a unit name, but no reg property
u-boot.itb.tmp: Warning (unit_address_vs_reg): Node /images/fdt@1
has a unit name, but no reg property
u-boot.itb.tmp: Warning (unit_address_vs_reg): Node /configurations/conf@1
has a unit name, but no reg property

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agorockchip: rk322x: add boot_devices mapping to support 'same-as-spl'
Kever Yang [Mon, 22 Jul 2019 11:59:21 +0000 (19:59 +0800)]
rockchip: rk322x: add boot_devices mapping to support 'same-as-spl'

The driver need a mapping to get the dts node by boot srouce ID.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agorockchip: rk322x: migrate to use common spl board file
Kever Yang [Mon, 22 Jul 2019 11:59:20 +0000 (19:59 +0800)]
rockchip: rk322x: migrate to use common spl board file

rk322x has similar boot flow in SPL with other Rockchip SoCs,
migrate to use common spl board file.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agorockchip: rk322x: introduce arch_cpu_init() for SoC setting init
Kever Yang [Mon, 22 Jul 2019 11:59:19 +0000 (19:59 +0800)]
rockchip: rk322x: introduce arch_cpu_init() for SoC setting init

Use arch_cpu_init() to init SoC secure region and move it to
rk322x.c

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agorockchip: rk3188: migrate to use common spl board file
Kever Yang [Mon, 22 Jul 2019 11:59:18 +0000 (19:59 +0800)]
rockchip: rk3188: migrate to use common spl board file

rk3188 has similar boot flow in SPL with other Rockchip SoCs,
migrate to use common spl board file.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agorockchip: rk3188: add boot_devices mapping to support 'same-as-spl'
Kever Yang [Mon, 22 Jul 2019 11:59:17 +0000 (19:59 +0800)]
rockchip: rk3188: add boot_devices mapping to support 'same-as-spl'

The driver need a mapping to get the dts node by boot srouce ID.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agorockchip: rk3188: move spl_board_init() into rk3188.c
Kever Yang [Mon, 22 Jul 2019 11:59:16 +0000 (19:59 +0800)]
rockchip: rk3188: move spl_board_init() into rk3188.c

Clean up the rk3188.c so that we can re-use the common spl board file.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agorockchip: Migrate to use BOOTROM_SUPPORT driver
Kever Yang [Mon, 22 Jul 2019 11:59:15 +0000 (19:59 +0800)]
rockchip: Migrate to use BOOTROM_SUPPORT driver

SPL bootrom support is a boot device just like mmc and etc,
use formal boot device instead of jump to bootrom directly.
Enable the Kconfig by default if ROCKCHIP_BACK_TO_BROM is enabled.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agorockchip: rk3188: move usb uart init into arch_cpu_init()
Kever Yang [Mon, 22 Jul 2019 11:59:14 +0000 (19:59 +0800)]
rockchip: rk3188: move usb uart init into arch_cpu_init()

The SoC feature init will be better to use arch_cpu_init() and
goes to soc file.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agorockchip: rk3188: init CPU freq in clock driver
Kever Yang [Mon, 22 Jul 2019 11:59:13 +0000 (19:59 +0800)]
rockchip: rk3188: init CPU freq in clock driver

Init CPU frquency in clock driver instead of in SPL board file,
this will help for use common board file later.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agorockchip: add common spl board file
Kever Yang [Mon, 22 Jul 2019 11:59:12 +0000 (19:59 +0800)]
rockchip: add common spl board file

The common spl board file handles board_init_f() in SPL,
and with board_early_init_f() and arch_cpu_init() callback,
other operateion after board_init_f() should go to board specific
spl_board_init().

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agorockchip: declear boot_devices in bootrom.h
Kever Yang [Mon, 22 Jul 2019 11:59:11 +0000 (19:59 +0800)]
rockchip: declear boot_devices in bootrom.h

boot_devices may defined in soc file, and used in board file,
we need to delear it in header file.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agorockchip: intruduce common BROM_BOOTSOURCE_ID_ADDR
Kever Yang [Mon, 22 Jul 2019 11:59:10 +0000 (19:59 +0800)]
rockchip: intruduce common BROM_BOOTSOURCE_ID_ADDR

The boot source from BootRom is store at a fix offset of IRAM,
update to use the common macro instead of rk3399 specific one.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agorockchip: add CONFIG_IRAM_BASE for all SoCs
Kever Yang [Mon, 22 Jul 2019 11:59:09 +0000 (19:59 +0800)]
rockchip: add CONFIG_IRAM_BASE for all SoCs

Rockchip SoCs have internal sram for bootrom data area and for
sdram init program space. Introduce the base address in case
we need to use it.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agorockchip: remove redundant CONFIG_SYS_NS16550_MEM32
Kever Yang [Mon, 22 Jul 2019 11:59:08 +0000 (19:59 +0800)]
rockchip: remove redundant CONFIG_SYS_NS16550_MEM32

The CONFIG_SYS_NS16550_MEM32 already defined in
rockchip_common.h, no need to define again in soc
level header.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agoinclude: configs: Increase CONFIG_SYS_BOOTM_LEN to 16MB
Shyam Saini [Thu, 18 Apr 2019 14:17:39 +0000 (19:47 +0530)]
include: configs: Increase CONFIG_SYS_BOOTM_LEN to 16MB

The default value of CONFIG_SYS_BOOTM_LEN is 0x800000 i.e, 8MB which
causes board reset because of larger uImage size.

This was tested on rk3288 Amarula Vyasa and rk3288 Asus Tinker
boards.

Error log snippet:
   Booting using the fdt blob at 0x1f00000
   Loading Kernel Image ... Image too large: increase CONFIG_SYS_BOOTM_LEN
Must RESET board to recover
resetting ...

Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: Shyam Saini <shyam.saini@amarulasolutions.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
5 years agogitlab-ci: Update Docker image to xenial-20190720-24Jul2019 tag
Tom Rini [Wed, 24 Jul 2019 15:29:47 +0000 (11:29 -0400)]
gitlab-ci: Update Docker image to xenial-20190720-24Jul2019 tag

- Add in lzma-alone for current binman tests
- Update to Ubuntu's xenial-20190720 tag (latest).

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agogitlab-ci: Add pyelftools to the binman testsuite section
Tom Rini [Wed, 24 Jul 2019 17:14:56 +0000 (13:14 -0400)]
gitlab-ci: Add pyelftools to the binman testsuite section

We need pyelftools here to run rather than skip some tests.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agoMerge tag 'dm-pull-24jul19-take3' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm
Tom Rini [Wed, 24 Jul 2019 20:24:50 +0000 (16:24 -0400)]
Merge tag 'dm-pull-24jul19-take3' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm

Minor driver-model fixes and tweaks
A few device-tree fixes
Binman support for extracting files from an image

5 years agodm: device: make power domain calls optional
Anatolij Gustschin [Sun, 14 Jul 2019 19:11:01 +0000 (21:11 +0200)]
dm: device: make power domain calls optional

Reduce power domain calls when CONFIG_POWER_DOMAIN is disabled.
With gcc v8.2, this change saves 104 bytes.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
5 years agobuildman: fix invocation examples typos
Baruch Siach [Thu, 11 Jul 2019 09:57:41 +0000 (12:57 +0300)]
buildman: fix invocation examples typos

Also, make command line example indentation consistent.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
5 years agoclk: initialize clk->data when using default xlate
Sekhar Nori [Thu, 11 Jul 2019 09:00:24 +0000 (14:30 +0530)]
clk: initialize clk->data when using default xlate

Right now when using clk_of_xlate_default(), clk->data
remains un-initialized because clk_get_bulk() does not
initialize memory on allocation of clock structure.

This can cause problems when data is used to match if
two clocks pointers are exactly the same underlying
clocks, for example.

Fix it by initializing clk->data to 0.

Suggested-by: Lokesh Vutla <lokeshvutla@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
5 years agodm: uclass: fix comment copy/paste error
Baruch Siach [Thu, 11 Jul 2019 08:23:44 +0000 (11:23 +0300)]
dm: uclass: fix comment copy/paste error

The uclass_next_device() routine continues a previously started device
iteration. Change the description that is copied from
uclass_first_device().

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agocommon: fdt_support: Add missing cpu_to_fdt32() to fdt_pci_dma_ranges()
Marek Vasut [Tue, 9 Jul 2019 00:49:29 +0000 (02:49 +0200)]
common: fdt_support: Add missing cpu_to_fdt32() to fdt_pci_dma_ranges()

The fdt_pci_dma_ranges() cannot work on e.g. ARM, since the DT entries
endianness is not adjusted at all. Fix this.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Tom Rini <trini@konsulko.com>
5 years agodm: Fix parameter description of dev_read_name()
Bin Meng [Fri, 5 Jul 2019 16:23:18 +0000 (09:23 -0700)]
dm: Fix parameter description of dev_read_name()

The comments of dev_read_name() wrongly describe "node" as its
parameter.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agodm: core: Set correct "status" value for a node
Bin Meng [Fri, 5 Jul 2019 16:23:17 +0000 (09:23 -0700)]
dm: core: Set correct "status" value for a node

Per device tree spec, "status" property can have a value of "okay",
or "disabled", but not "disable".

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agodm: core: Call clk_set_defaults() during probe() only for a valid ofnode
Bin Meng [Fri, 5 Jul 2019 16:23:16 +0000 (09:23 -0700)]
dm: core: Call clk_set_defaults() during probe() only for a valid ofnode

Without a valid ofnode, it's meaningless to call clk_set_defaults()
to process various properties.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agodm: timer: Skip device that does not have a valid ofnode in pre_probe()
Bin Meng [Fri, 5 Jul 2019 16:23:15 +0000 (09:23 -0700)]
dm: timer: Skip device that does not have a valid ofnode in pre_probe()

It is possible that a timer device has a null ofnode, hence there is
no need to further parse DT for the clock rate.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agofdt: make fdt_get_base_address() return OF_BAD_ADDR when "reg" not found
Masahiro Yamada [Thu, 27 Jun 2019 07:39:57 +0000 (16:39 +0900)]
fdt: make fdt_get_base_address() return OF_BAD_ADDR when "reg" not found

Currently, fdt_get_base_address() returns 0 if the "reg" property is
missing. Since 0 is a valid value, it is not suitable for the error
handling. Return OF_BAD_ADDR instead.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agobinman: Add a test for nested and aligned sections
Simon Glass [Mon, 8 Jul 2019 20:25:53 +0000 (14:25 -0600)]
binman: Add a test for nested and aligned sections

Current test coverage is likely sufficient for the logic used to place
sections in the image. However it seems useful to add a test specifically
for nested sections, since these could have some unusual interactions.

Add a new test for this and aligned sections. This test failed before the
refactor to drop the bsection.py file (Section class), but passes now.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Add an 'extract' command
Simon Glass [Mon, 8 Jul 2019 20:25:52 +0000 (14:25 -0600)]
binman: Add an 'extract' command

It is useful to be able to extract all binaries from the image, or a
subset of them. Add a new 'extract' command to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Support reading from CBFS entries
Simon Glass [Mon, 8 Jul 2019 20:25:51 +0000 (14:25 -0600)]
binman: Support reading from CBFS entries

CBFS is a bit like a section but with a custom format. Provide the list of
entries and the compression type to binman so that it can extract the data
from the CBFS, just like any other part of the image.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Allow reading an entry from an image
Simon Glass [Mon, 8 Jul 2019 20:25:50 +0000 (14:25 -0600)]
binman: Allow reading an entry from an image

It is useful to be able to extract entry contents from an image to see
what is inside. Add a simple function to read the contents of an entry,
decompressing it by default.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Allow for logging information to be displayed
Simon Glass [Mon, 8 Jul 2019 20:25:49 +0000 (14:25 -0600)]
binman: Allow for logging information to be displayed

Binman generally operates silently but in some cases it is useful to see
what Binman is actually doing at each step. Enable some logging output
with different logging levels selectable via the -v flag.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Support listing an image
Simon Glass [Mon, 8 Jul 2019 20:25:48 +0000 (14:25 -0600)]
binman: Support listing an image

Add support for listing the entries in an image. This relies on the image
having an FDT map.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Convert Image to a subclass of Entry
Simon Glass [Mon, 8 Jul 2019 20:25:47 +0000 (14:25 -0600)]
binman: Convert Image to a subclass of Entry

When support for sections (and thus hierarchical images) was added to
binman, the decision was made to create a new Section class which could
be used by both Image and an Entry_section class. The decision between
using inheritance and composition was tricky to make, but in the end it
was decided that Image was different enough from Entry that it made sense
to put the implementation of sections in an entirely separate class. It
also has the advantage that core Image code does have to rely on an entry
class in the etype directory.

This work was mostly completed in commit:

   8f1da50ccc "binman: Refactor much of the image code into 'section'

As a result of this, the Section class has its own version of things like
offset and size and these must be kept in sync with the parent
Entry_section class in some cases.

In the last year it has become apparent that the cost of keeping things in
sync is larger than expected, since more and more code wants to access
these properties.

An alternative approach, previously considered and rejected, now seems
better.

Adjust Image to be a subclass of Entry_section. Move the code from Section
(in bsection.py) to Entry_section and delete Section. Update all tests
accordingly.

This requires substantial changes to Image. Overall the changes reduce
code size by about 240 lines. While much of that is just boilerplate from
Section, there are quite a few functions in Entry_section which now do not
need to be overiden from Entry. This suggests the change is beneficial
even without further functionality being added.

A side benefit is that the properties of sections are now consistent with
other entries. This fixes a problem in testListCmd() where some properties
are missing for sections.

Unfortunately this is a very large commit since it is not feasible to do
the migration piecemeal. Given the substantial tests available and the
100% code coverage of binman, we should be able to do this safely.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Support reading an image into an Image object
Simon Glass [Mon, 8 Jul 2019 20:25:46 +0000 (14:25 -0600)]
binman: Support reading an image into an Image object

It is possible to read an Image, locate its FDT map and then read it into
the binman data structures. This allows full access to the entries that
were written to the image. Add support for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Support locating an image header
Simon Glass [Mon, 8 Jul 2019 20:25:45 +0000 (14:25 -0600)]
binman: Support locating an image header

Add support for locating an image header in an image.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Support locating an FDT map
Simon Glass [Mon, 8 Jul 2019 20:25:44 +0000 (14:25 -0600)]
binman: Support locating an FDT map

Add support for locating an image's Fdt map which is used to determine
the contents and structure of the image.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Allow listing the entries in an image
Simon Glass [Mon, 8 Jul 2019 20:25:43 +0000 (14:25 -0600)]
binman: Allow listing the entries in an image

It is useful to be able to summarise all the entries in an image, e.g. to
display this to this user. Add a new ListEntries() method to Entry, and
set up a way to call it through the Image class.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Detect bad CBFS file types
Simon Glass [Mon, 8 Jul 2019 20:25:42 +0000 (14:25 -0600)]
binman: Detect bad CBFS file types

Detect when an unknown or unsupported file type is specified and report
an error.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Support FDT update for CBFS
Simon Glass [Mon, 8 Jul 2019 20:25:41 +0000 (14:25 -0600)]
binman: Support FDT update for CBFS

It is useful to add the CBFS file information (offset, size, etc.) into
the FDT so that the layout is complete. Add support for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Use the cbfs memlen field only for uncompressed length
Simon Glass [Mon, 8 Jul 2019 20:25:40 +0000 (14:25 -0600)]
binman: Use the cbfs memlen field only for uncompressed length

The purpose of this badly named field is a bit ambiguous. Adjust the code
to use it only to store the uncompressed length of a file, leaving it set
to None if there is no compression used. This makes it easy to see if the
value in this field is relevant / useful.

Also set data_len for compressed fields, since it should be the length of
the compressed data, not the uncompressed data.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Provide the actual data address for cbfs files
Simon Glass [Mon, 8 Jul 2019 20:25:39 +0000 (14:25 -0600)]
binman: Provide the actual data address for cbfs files

At present a file with no explicit CBFS offset is placed in the next
available location but there is no way to find out where it ended up.
Update and rename the get_data() function to provide this information.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Allow device-tree entries to be compressed
Simon Glass [Mon, 8 Jul 2019 20:25:38 +0000 (14:25 -0600)]
binman: Allow device-tree entries to be compressed

At present the logic skips the blob class' handling of compression, so
this is not supported with device tree entries. Fix this.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Allow entries to expand after packing
Simon Glass [Mon, 8 Jul 2019 20:25:37 +0000 (14:25 -0600)]
binman: Allow entries to expand after packing

Add support for detecting entries that change size after they have already
been packed, and re-running packing when it happens.

This removes the limitation that entry size cannot change after
PackEntries() is called.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Add a control for post-pack entry expansion
Simon Glass [Mon, 8 Jul 2019 20:25:36 +0000 (14:25 -0600)]
binman: Add a control for post-pack entry expansion

We plan to support changing the size of entries after they have been
packed. For now it will always be enabled. But to aid testing of both
cases (in the event that we want to add a command-line flag, for example),
add a setting to control it.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Add a return value to ProcessContentsUpdate()
Simon Glass [Mon, 8 Jul 2019 20:25:35 +0000 (14:25 -0600)]
binman: Add a return value to ProcessContentsUpdate()

At present if this function tries to update the contents such that the
size changes, it raises an error. We plan to add the ability to change
the size of entries after packing is completed, since in some cases it is
not possible to determine the size in advance.

An example of this is with a compressed device tree, where the values
of the device tree change in SetCalculatedProperties() or
ProcessEntryContents(). While the device tree itself does not change size,
since placeholders for any new properties have already bee added by
AddMissingProperties(), we cannot predict the size of the device tree
after compression. If a value changes from 0 to 0x1234 (say), then the
compressed device tree may expand.

As a first step towards supporting this, make ProcessContentsUpdate()
return a value indicating whether the content size is OK. For now this is
always True (since otherwise binman raises an error), but later patches
will adjust this.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Call ProcessUpdateContents() consistently
Simon Glass [Mon, 8 Jul 2019 20:25:34 +0000 (14:25 -0600)]
binman: Call ProcessUpdateContents() consistently

SetContents() should only be called to set the contents of an entry from
within the ObtainContents() call, since it has no guard against increasing
the size of the contents, thus triggering incorrect operation.

Change all such calls to use ProcessUpdateContents() instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Fix up ProcessUpdateContents error and comments
Simon Glass [Mon, 8 Jul 2019 20:25:33 +0000 (14:25 -0600)]
binman: Fix up ProcessUpdateContents error and comments

This function raises an exception with its arguments around the wrong way
so the message is incorrect. Fix this as well as a few minor comment
problems.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Allow easy importing of entry modules
Simon Glass [Mon, 8 Jul 2019 20:25:32 +0000 (14:25 -0600)]
binman: Allow easy importing of entry modules

At present entry modules can only be accessed using Entry.Lookup() or
Entry.Create(). Most of the time this is fine, but sometimes a module
needs to provide constants or helper functions useful to other modules.
It is easier in this case to use 'import'.

Add an __init__ file to permit this.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Drop an unused arg in Entry.Lookup()
Simon Glass [Mon, 8 Jul 2019 20:25:31 +0000 (14:25 -0600)]
binman: Drop an unused arg in Entry.Lookup()

The first argument is not used. Remove it.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Move compression into the Entry base class
Simon Glass [Mon, 8 Jul 2019 20:25:30 +0000 (14:25 -0600)]
binman: Move compression into the Entry base class

Compression is currently available only with blobs. However we want to
report the compression algorithm and uncompressed size for all entries,
so that other entry types can support compression. This will help with
the forthcoming 'list' feature which lists entries in the image.

Move the compression properties into the base class. Also fix up the docs
which had the wrong property name.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Convert to use ArgumentParser
Simon Glass [Mon, 8 Jul 2019 20:25:29 +0000 (14:25 -0600)]
binman: Convert to use ArgumentParser

This class is the new way to handle arguments in Python. Convert binman
over to use it. At the same time, introduce commands so that we can
separate out the different parts of binman functionality.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Add an image header
Simon Glass [Mon, 8 Jul 2019 20:25:28 +0000 (14:25 -0600)]
binman: Add an image header

It is useful to be able to quickly locate the FDT map in the image. An
easy way to do this is with a pointer at the start or end of the image.

Add an 'image header' entry, which places a magic number followed by a
pointer to the FDT map. This can be located at the start or end of the
image, or at a chosen location.

As part of this, update GetSiblingImagePos() to detect missing siblings.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Add an FDT map
Simon Glass [Mon, 8 Jul 2019 20:25:27 +0000 (14:25 -0600)]
binman: Add an FDT map

An FDT map is an entry which holds a full description of the image
entries, in FDT format. It can be discovered using the magic string at
its start. Tools can locate and read this entry to find out what entries
are in the image and where each entry is located.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Add a convenience functions for real-DTB tests
Simon Glass [Mon, 8 Jul 2019 20:25:26 +0000 (14:25 -0600)]
binman: Add a convenience functions for real-DTB tests

Quite a few tests will use a real device tree and need it updated with the
binman metadata. Add a helper function for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Update help for new features
Simon Glass [Mon, 8 Jul 2019 20:25:25 +0000 (14:25 -0600)]
binman: Update help for new features

A few new features have been added. This has rendered part of the README
obsolete. Update it.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Update future features
Simon Glass [Mon, 8 Jul 2019 20:25:24 +0000 (14:25 -0600)]
binman: Update future features

A few features have been completed and a few items are added.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Simplify the entry test
Simon Glass [Mon, 8 Jul 2019 20:25:23 +0000 (14:25 -0600)]
binman: Simplify the entry test

The current test for the 'entry' module is a bit convoluted since it has
to import the module multiple times. It also relies on ordering, in that
test1EntryNoImportLib() must run before test2EntryImportLib() if they are
running in the same Python process.

This is unreliable since neither the ordering of tests nor the process
that they run in is defined.

Fix this by always reloading the entry in these two tests. Also add a
check that the expected value of have_importlib is obtained.

This corrects a code-coverage problem in the 'entry' module on some
systems.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Add support for fixed-offset files in CBFS
Simon Glass [Mon, 8 Jul 2019 19:18:56 +0000 (13:18 -0600)]
binman: Add support for fixed-offset files in CBFS

A feature of CBFS is that it allows files to be positioned at particular
offset (as with binman in general). This is useful to support
execute-in-place (XIP) code, since this may not be relocatable.

Add a new cbfs-offset property to control this.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Pad empty areas of the CBFS with files
Simon Glass [Mon, 8 Jul 2019 19:18:55 +0000 (13:18 -0600)]
binman: Pad empty areas of the CBFS with files

When there is lots of open space in a CBFS it is normally padded with
'empty' files so that sequentially scanning the CBFS can skip from one to
the next without a break.

Add support for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Add support for Intel IFWI entries
Simon Glass [Mon, 8 Jul 2019 19:18:54 +0000 (13:18 -0600)]
binman: Add support for Intel IFWI entries

An Integrated Firmware Image is used to hold various binaries used for
booting with Apollolake and some later devices. Add support for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Add support for CBFS entries
Simon Glass [Mon, 8 Jul 2019 19:18:53 +0000 (13:18 -0600)]
binman: Add support for CBFS entries

Add support for putting CBFSs (Coreboot Filesystems) in an image. This
allows binman to produce firmware images used by coreboot to boot.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Add a utility library for coreboot CBFS
Simon Glass [Mon, 8 Jul 2019 19:18:52 +0000 (13:18 -0600)]
binman: Add a utility library for coreboot CBFS

Coreboot uses a simple flash-based filesystem called Coreboot Filesystem
(CBFS) to organise files used during boot. This allows files to be named
and their position in the flash to be set. It has special features for
dealing with x86 devices which typically memory-map their SPI flash to the
top of 32-bit address space and need a 'boot block' ending there.

Create a library to help create and read CBFS files. This includes a
writer class, a reader class and associated other helpers. Only a subset
of features are currently supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agopatman: Add a function to write ifwitool
Simon Glass [Mon, 8 Jul 2019 19:18:51 +0000 (13:18 -0600)]
patman: Add a function to write ifwitool

This tool has quite a few arguments and options, so put the functionality
in a function so that we call it from one place and hopefully get it
right.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobinman: Pass the toolpath to tests
Simon Glass [Mon, 8 Jul 2019 19:18:50 +0000 (13:18 -0600)]
binman: Pass the toolpath to tests

Tools like ifwitool may not be available in the PATH, but are available in
the build. These tools may be needed by tests, so allow tests to use the
--toolpath flag.

Also use this flag with travis.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agoMerge branch '2019-07-24-master-imports'
Tom Rini [Wed, 24 Jul 2019 18:15:51 +0000 (14:15 -0400)]
Merge branch '2019-07-24-master-imports'

- Various Android related changes including A/B update and BCB updates
- Assorted minor fixes

5 years agopsci: Fix warnings when compiling with W=1
Patrick Delaunay [Mon, 22 Jul 2019 12:19:20 +0000 (14:19 +0200)]
psci: Fix warnings when compiling with W=1

This patch solves the following warnings:
arch/arm/mach-stm32mp/psci.c:

warning: no previous prototype for ‘psci_set_state’ [-Wmissing-prototypes]
warning: no previous prototype for ‘psci_arch_cpu_entry’ [-Wmissing-prototypes]
warning: no previous prototype for ‘psci_features’ [-Wmissing-prototypes]
warning: no previous prototype for ‘psci_version’ [-Wmissing-prototypes]
warning: no previous prototype for ‘psci_affinity_info’ [-Wmissing-prototypes]
warning: no previous prototype for ‘psci_migrate_info_type’ [-Wmissing-prototypes]
warning: no previous prototype for ‘psci_cpu_on’ [-Wmissing-prototypes]
warning: no previous prototype for ‘psci_cpu_off’ [-Wmissing-prototypes]
warning: no previous prototype for ‘psci_system_reset’ [-Wmissing-prototypes]
warning: no previous prototype for ‘psci_system_off’ [-Wmissing-prototypes]

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
5 years agodistro_bootcmd: refactor virtio to support PCI block devices
David Abdurachmanov [Mon, 22 Jul 2019 08:38:11 +0000 (11:38 +0300)]
distro_bootcmd: refactor virtio to support PCI block devices

Starting libvirt v5.3.0 with QEMU 4.0.0 use of PCI is automatic
and thus storage is connected via PCI, which is not visible to
U-Boot out-of-the-box.

Refactor to do "pci enum" followed by "virtio scan" to see PCI
connected storage, and allow bootloader to load kernel and
initramfs images.

Tested with Fedora/RISCV using releases: libvirt 5.4.0 & 5.5.0,
QEMU 4.0.0 and U-Boot 2019.07 RC4.

Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
5 years agoremoteproc: Fix potential build issues with SPL remoteproc
Suman Anna [Fri, 19 Jul 2019 15:27:56 +0000 (10:27 -0500)]
remoteproc: Fix potential build issues with SPL remoteproc

The rproc uclass driver can either be built with SPL_REMOTEPROC
or REMOTEPROC, but the function prototypes in remoteproc.h are
defined only when CONFIG_REMOTEPROC is defined. This can cause
build issues in SPL if CONFIG_REMOTEPROC is not selected.

Fix this by replacing the existing precompiler macro usage with
CONFIG_IS_ENABLED.

Fixes: ddf56bc7e3ef ("drivers: Introduce a simplified remoteproc framework")
Signed-off-by: Suman Anna <s-anna@ti.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
5 years agodoc: fitImage: Cosmetics break lines
Mickaël Tansorier [Wed, 17 Jul 2019 15:57:29 +0000 (17:57 +0200)]
doc: fitImage: Cosmetics break lines

Add missing newline before title and subtitle.

Signed-off-by: Mickaël Tansorier <mickael.tansorier@smile.fr>
5 years agodoc: fitImage: Fix conf number incrementation
Mickaël Tansorier [Wed, 17 Jul 2019 15:57:16 +0000 (17:57 +0200)]
doc: fitImage: Fix conf number incrementation

Increment conf id to avoid to have two same conf name
into one configuration description.

Signed-off-by: Mickaël Tansorier <mickael.tansorier@smile.fr>
5 years agodoc: Add the U-Boot logo to the html doc
Bin Meng [Tue, 16 Jul 2019 16:39:20 +0000 (09:39 -0700)]
doc: Add the U-Boot logo to the html doc

Now we have a logo for U-Boot, we can include it in the Sphinx
html doc.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
5 years agodoc: Add .gitignore for the Sphinx build output directory
Bin Meng [Tue, 16 Jul 2019 16:39:19 +0000 (09:39 -0700)]
doc: Add .gitignore for the Sphinx build output directory

With Sphinx documentation moving from Documentation directory
to doc directory, we missed updating .gitignore for the Sphinx
build output directory.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
5 years agospl: sata: support U-Boot load from raw sata disk
Baruch Siach [Sun, 14 Jul 2019 14:54:21 +0000 (17:54 +0300)]
spl: sata: support U-Boot load from raw sata disk

Support load of the U-Boot image from raw SATA disk sector. This is
equivalent to load from MMC raw sector.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
5 years agoscripts/kernel-doc: fix parsing of function pointers
Heinrich Schuchardt [Sun, 14 Jul 2019 09:30:23 +0000 (11:30 +0200)]
scripts/kernel-doc: fix parsing of function pointers

kernel-doc fails to parse function definitions like the one below

efi_status_t efi_create_event(uint32_t type, efi_uintn_t notify_tpl,
      void (EFIAPI *notify_function) (
struct efi_event *event,
void *context),
      void *notify_context, efi_guid_t *group,
      struct efi_event **event)
{

due to the "EFIAPI" attribute preceding the function name.

cf. https://lkml.org/lkml/2018/9/3/1185

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoscripts/kernel-doc: update script from Linux 5.2
Heinrich Schuchardt [Sun, 14 Jul 2019 09:30:22 +0000 (11:30 +0200)]
scripts/kernel-doc: update script from Linux 5.2

Update the script from Linux 5.2 to avoid some warnings.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agodoc: Cope with Sphinx logging deprecations
Jonathan Corbet [Sun, 14 Jul 2019 08:35:45 +0000 (10:35 +0200)]
doc: Cope with Sphinx logging deprecations

Recent versions of sphinx will emit messages like:

  doc/sphinx/kerneldoc.py:103:
     RemovedInSphinx20Warning: app.warning() is now deprecated.
     Use sphinx.util.logging instead.

Switch to sphinx.util.logging to make this unsightly message go away.
Alas, that interface was only added in version 1.6, so we have to add a
version check to keep things working with older sphinxes.

Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Rebased for U-Boot
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoenv: am57xx: Implement A/B boot process
Ruslan Trofymenko [Fri, 5 Jul 2019 12:37:36 +0000 (15:37 +0300)]
env: am57xx: Implement A/B boot process

Add support for A/B boot process on AM57xx based boards:

  1. Define 'slot_suffix' variable (using 'ab_select' command)
  2. Extend 'emmc_android_boot' boot command (add commands for A/B boot
     process)

'ab_select' command is used to decide which slot should be used for
booting up. A/B metadata resides in 'misc' partition.

To activate the A/B boot process, the following config options must be
set:

    CONFIG_ANDROID_AB=y
    CONFIG_CMD_AB_SELECT=y

For successful A/B boot, the corresponding A/B infrastructure must be
involved on Android side [1] (including mounting system as root), and
disk must be partitioned accordingly.

When A/B boot is enabled, there are some known limitations currently
exist (not related to A/B patches, need to be implemented later):

  1. The 'Verified Boot' sequence is not supported
  2. dev path to system partition (system_a or system_b) is passed via
     'bootargs' as 'root=' argument like 'root=/dev/mmcblk1p12', but
     further we'll need to rework it with respect to dm-verity
     requirements [2]

In case when A/B partitions are not present in system (and A/B boot is
enabled), boot up process will be terminated and next message will be
shown:

    "boot_a(b) partition not found"

[1] https://source.android.com/devices/tech/ota/ab
[2] https://source.android.com/devices/tech/ota/ab/ab_implement#kernel

Signed-off-by: Ruslan Trofymenko <ruslan.trofymenko@linaro.org>
Signed-off-by: Igor Opaniuk <igor.opaniuk@gmail.com>
Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Alistair Strachan <astrachan@google.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agodoc: android: Add simple guide for A/B updates
Ruslan Trofymenko [Fri, 5 Jul 2019 12:37:35 +0000 (15:37 +0300)]
doc: android: Add simple guide for A/B updates

Add a short documentation for A/B enablement and 'ab_select' command
usage.

Signed-off-by: Ruslan Trofymenko <ruslan.trofymenko@linaro.org>
Signed-off-by: Igor Opaniuk <igor.opaniuk@gmail.com>
Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Alistair Strachan <astrachan@google.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agotest/py: Add base test case for A/B updates
Ruslan Trofymenko [Fri, 5 Jul 2019 12:37:34 +0000 (15:37 +0300)]
test/py: Add base test case for A/B updates

Add sandbox test for 'ab_select' command.

Test: ./test/py/test.py --bd sandbox --build -k test_ab

Signed-off-by: Ruslan Trofymenko <ruslan.trofymenko@linaro.org>
Signed-off-by: Igor Opaniuk <igor.opaniuk@gmail.com>
Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Alistair Strachan <astrachan@google.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agocmd: Add 'ab_select' command
Ruslan Trofymenko [Fri, 5 Jul 2019 12:37:33 +0000 (15:37 +0300)]
cmd: Add 'ab_select' command

For A/B system update support the Android boot process requires to send
'androidboot.slot_suffix' parameter as a command line argument. This
patch implementes 'ab_select' command which allows us to obtain current
slot by processing the A/B metadata.

The patch was extracted from commit [1] with one modification: the
separator for specifying the name of metadata partition was changed
from ';' to '#', because ';' is used for commands separation.

[1] https://android-review.googlesource.com/c/platform/external/u-boot/+/729880/2

Signed-off-by: Ruslan Trofymenko <ruslan.trofymenko@linaro.org>
Signed-off-by: Igor Opaniuk <igor.opaniuk@gmail.com>
Reviewed-by: Alistair Strachan <astrachan@google.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>