oweals/u-boot.git
7 years agorockchip: timer: update for 32/64bit-aware OF_PLATDATA
Philipp Tomsich [Mon, 14 Aug 2017 17:05:31 +0000 (19:05 +0200)]
rockchip: timer: update for 32/64bit-aware OF_PLATDATA

With dtoc emitting fdt64_t for addresses (and region sizes), the array
indices for accessing the reg[] array needs to be adjusted.  This
adjusts the Rockchip DM timer driver to correctly handle OF_PLATDATA
given this new structure layout.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agorockchip: defconfig: puma-rk3399: enable OF_LIVE (live tree)
Philipp Tomsich [Tue, 12 Sep 2017 15:32:29 +0000 (17:32 +0200)]
rockchip: defconfig: puma-rk3399: enable OF_LIVE (live tree)

With the critical drivers ready for switching to a live tree, we can
now enable it in the defconfig for the RK3399-Q7.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agorockchip: efuse: change to use dev_read_addr_ptr
Philipp Tomsich [Tue, 12 Sep 2017 15:32:26 +0000 (17:32 +0200)]
rockchip: efuse: change to use dev_read_addr_ptr

With the dev_read_addr_ptr function available, we can change the
efuse driver to use it (and eliminate the explicit type-cast).

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agorockchip: clk: rk3399: Convert to livetree
Philipp Tomsich [Tue, 12 Sep 2017 15:32:24 +0000 (17:32 +0200)]
rockchip: clk: rk3399: Convert to livetree

Update the clock driver for the RK3399  to support a live device tree.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agorockchip: dts: rk3399-puma: replace 'rockchip, vbus-gpio' with fixed regulator
Philipp Tomsich [Tue, 12 Sep 2017 15:30:57 +0000 (17:30 +0200)]
rockchip: dts: rk3399-puma: replace 'rockchip, vbus-gpio' with fixed regulator

On the RK3399-Q7, we need to turn on the on-module USB hub before using the
USB host interfaces (only the OTG interface is directly connected to the edge
connector).  This drops the deprecated 'rockchip,vbus-gpio' property and uses
a fixed regulator to turn on the USB hub.

References: 26a8b80 "usb: host: xhci-rockchip: use fixed regulator to control vbus"
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agorockchip: clk: rk3399: add clk_enable function and support USB HOST0/1
Philipp Tomsich [Tue, 12 Sep 2017 15:30:56 +0000 (17:30 +0200)]
rockchip: clk: rk3399: add clk_enable function and support USB HOST0/1

The generic ehci-driver (ehci-generic.c) will try to enable the clocks
listed in the DTSI. If this fails (e.g. due to clk_enable not being
implemented in a driver and -ENOSYS being returned by the clk-uclass),
the driver will bail our and print an error message.

This implements a minimal clk_enable for the RK3399 and supports the
clocks mandatory for the EHCI controllers; as these are enabled by
default we simply return success.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agorockchip: rk3368: add the missing target and pinctrl config for sheep board
Andy Yan [Mon, 4 Sep 2017 12:32:58 +0000 (20:32 +0800)]
rockchip: rk3368: add the missing target and pinctrl config for sheep board

Add the missing target and pinctrl config for rk3368 sheep board

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agorockchip: rk3368: add ENV_MEM_LAYOUT to extra env settings
Andy Yan [Mon, 4 Sep 2017 12:32:23 +0000 (20:32 +0800)]
rockchip: rk3368: add ENV_MEM_LAYOUT to extra env settings

Add the ENV_MEM_LAYOUT_SETTINGS to CONFIG_EXTRA_ENV_SETTINGS

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agork3288: Add Vyasa initial board support
Jagan Teki [Tue, 12 Sep 2017 11:45:47 +0000 (17:15 +0530)]
rk3288: Add Vyasa initial board support

This patch adds support for Vyasa RK3288 initial board
from Amarula Solutions.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agorockchip: rk3399: spl: remove hard-coded addresses for GRF and SGRF
Philipp Tomsich [Tue, 29 Aug 2017 16:24:05 +0000 (18:24 +0200)]
rockchip: rk3399: spl: remove hard-coded addresses for GRF and SGRF

On the RK3399, we will have either OF_PLATDATA or full OF_CONTROL
enabled: this allows the use of syscon to retrieve the addresses of
GRF and SGRF (except for the early debug UART setup, which runs so
early that the device-model is not initialised).

This removes the hard-coded addresses and goes through syscon to
retrieve the base-addresses of GRF and SGRF. After that, we use
the structure definitions to locate the respective registers.

In addition to this, the inclusion of header files is also cleaned up:
- all headers are included at the beginning (there was a spurious
  inclusion of the grf header from within a function)
- all #include statements for unused headers are removed
- the remaining #include statements are sorted (while keeping common.h
  included in front)

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agorockchip: lion-rk3368: defconfig: resync w/ OF_LIVE and BOOTSTAGE enabled
Philipp Tomsich [Mon, 11 Sep 2017 20:04:27 +0000 (22:04 +0200)]
rockchip: lion-rk3368: defconfig: resync w/ OF_LIVE and BOOTSTAGE enabled

This adds OF_LIVE and BOOTSTAGE support for the RK3368-uQ7 and
regenerates the defconfig (picking up a few changes/reorderings) from
upstream Kconfig changes.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agorockchip: dts: rk3368-lion: add /chosen/tick-timer
Philipp Tomsich [Mon, 11 Sep 2017 20:04:26 +0000 (22:04 +0200)]
rockchip: dts: rk3368-lion: add /chosen/tick-timer

To support bootstage recording, we want to mark our DM timer as the
tick-timer; this triggers the support for 'trying harder' to read the
timer in the Rockchip DM timer driver, even if the device model isn't
ready yet.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agorockchip: gpio: remove outdated/misleading comment
Philipp Tomsich [Mon, 11 Sep 2017 20:04:25 +0000 (22:04 +0200)]
rockchip: gpio: remove outdated/misleading comment

Remove a comment claiming that this driver only supports the RK3288,
as we also use it on the RK3368, RK3399 and (most likely) on other
variants.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Version-changes: 2
- use the dev_read_addr_ptr function in rk_gpio.c

7 years agorockchip: gpio: convert to livetree
Philipp Tomsich [Mon, 11 Sep 2017 20:04:24 +0000 (22:04 +0200)]
rockchip: gpio: convert to livetree

Update the Rockchip GPIO-bank driver to support a live tree.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Version-changes: 2
- use the dev_read_addr_ptr function in rk_gpio.c

7 years agorockchip: i2c: Convert to livetree
Philipp Tomsich [Mon, 11 Sep 2017 20:04:23 +0000 (22:04 +0200)]
rockchip: i2c: Convert to livetree

Update the Rockchip I2C driver to support livetree.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Acked-by: Heiko Schocher <hs@denx.de>
7 years agorockchip: rk8xx: remove unused header includes
Philipp Tomsich [Mon, 11 Sep 2017 20:04:22 +0000 (22:04 +0200)]
rockchip: rk8xx: remove unused header includes

Remove header file includes that have been left over after the
conversion to livetree-support.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agorockchip: sdhci: Convert to livetree
Philipp Tomsich [Mon, 11 Sep 2017 20:04:21 +0000 (22:04 +0200)]
rockchip: sdhci: Convert to livetree

Update the Rockchip SDHCI wrapper to support a live device tree.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Version-changes: 2
- use the dev_read_addr_ptr function in rockchip_sdhci.c

7 years agorockchip: spi: Convert to livetree
Philipp Tomsich [Mon, 11 Sep 2017 20:04:20 +0000 (22:04 +0200)]
rockchip: spi: Convert to livetree

Update the Rockchip SPI driver to support a live device tree.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jagan Teki <jagan@openedev.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agorockchip: pinctrl: rk3368: Convert to livetree
Philipp Tomsich [Mon, 11 Sep 2017 20:04:19 +0000 (22:04 +0200)]
rockchip: pinctrl: rk3368: Convert to livetree

Update the pinctrl driver for the RK3368 to support a live device tree.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agorockchip: clk: rk3368: Convert to livetree
Philipp Tomsich [Mon, 11 Sep 2017 20:04:18 +0000 (22:04 +0200)]
rockchip: clk: rk3368: Convert to livetree

Update the clock driver for the RK3368 to support a live device tree.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Version-changes: 2
- use the dev_read_addr_ptr function in clk_rk3368.c

7 years agorockchip: timer: Convert to livetree
Philipp Tomsich [Mon, 11 Sep 2017 20:04:17 +0000 (22:04 +0200)]
rockchip: timer: Convert to livetree

Update the Rockchip timer driver to support a live device tree.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agorockchip: timer: implement timer_get_boot_us
Philipp Tomsich [Mon, 11 Sep 2017 20:04:16 +0000 (22:04 +0200)]
rockchip: timer: implement timer_get_boot_us

To make the Rockchip DM timer driver useful for the timing of
bootstages, we need a few enhancements:
 - This implements timer_get_boot_us.
 - This avoids reinitialising the timer, if it has already been
   set up (e.g. by our TPL and SPL stages). Now, we have a single
   timebase ticking from TPL through the full U-Boot.
 - This adds support for reading the timer even before the
   device-model is ready: we find the timer via /chosen/tick-timer,
   then read its address and clock-frequency, and finally read the
   timeval directly).

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agorockchip: mmc: convert to livetree
Philipp Tomsich [Mon, 11 Sep 2017 20:04:15 +0000 (22:04 +0200)]
rockchip: mmc: convert to livetree

Update the Rockchip-specific wrapper for the Designware driver to
support a live device tree.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Version-changes: 2
- use the dev_read_addr_ptr function in rockchip_dw_mmc.c

7 years agonet: phy: micrel: Convert to livetree
Philipp Tomsich [Mon, 11 Sep 2017 20:04:14 +0000 (22:04 +0200)]
net: phy: micrel: Convert to livetree

Update the Micrel KSZ90x1 driver for a live tree.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agonet: designware: Convert to livetree
Philipp Tomsich [Mon, 11 Sep 2017 20:04:13 +0000 (22:04 +0200)]
net: designware: Convert to livetree

Update the Designware Ethernet MAC driver to support a live device
tree.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agodm: core: add dev_read_addr_ptr()
Philipp Tomsich [Mon, 11 Sep 2017 20:04:12 +0000 (22:04 +0200)]
dm: core: add dev_read_addr_ptr()

The dev_read_addr_ptr() mimics the behaviour of the devfdt_get_addr_ptr(),
retrieving the first address of the node's reg-property and returning
it as a pointer (or NULL on failure).

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agodm: timer: handle being called before dm_root is ready
Philipp Tomsich [Mon, 11 Sep 2017 20:04:11 +0000 (22:04 +0200)]
dm: timer: handle being called before dm_root is ready

When used with bootstage recording, dm_timer_init may be called
surprisingly early: i.e. before dm_root is ready. To deal with
this case, we explicitly check for this condition and return
-EAGAIN to the caller (refer to drivers/timer/rockchip_timer.c
for a case where this is needed/used).

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agodm: timer: Convert to livetree
Philipp Tomsich [Mon, 11 Sep 2017 20:04:10 +0000 (22:04 +0200)]
dm: timer: Convert to livetree

This updates dm_timer_init to support a live tree and deals with
some fallout (i.e. the need to restructure the code such, that we
don't need multiple discontinuous #if CONFIG_IS_ENABLED blocks).

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agobootstage: adjust Makefile to allow including bootstage in SPL, but not in TPL
Philipp Tomsich [Mon, 11 Sep 2017 20:04:09 +0000 (22:04 +0200)]
bootstage: adjust Makefile to allow including bootstage in SPL, but not in TPL

For timing our bootstages on the RK3368, which has a minimal TPL
(and where we consequently don't want to time the bootstages) and a
full-featured SPL (where we can bootstage recording), we need to
adjust the Makefile.

Use the $(SPL_TPL_) macro in the Makefile for bootstage.o

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agorockchip: board: puma_rk3399: update README flash instructions
Klaus Goger [Mon, 11 Sep 2017 19:05:00 +0000 (21:05 +0200)]
rockchip: board: puma_rk3399: update README flash instructions

Puma supports other boot sources then SD-Card. Update README to include
the required steps.

 * how to package a SPI-NOR SPL
 * how to flash eMMC with rkdeveloptool

Signed-off-by: Klaus Goger <klaus.goger@theobroma-systems.com>
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agorockchip: board: lion_rk3368: update README flash instructions
Klaus Goger [Mon, 11 Sep 2017 19:04:59 +0000 (21:04 +0200)]
rockchip: board: lion_rk3368: update README flash instructions

Add a section to the README on how to flash the on-board eMMC
with the rkdeveloptool.

Signed-off-by: Klaus Goger <klaus.goger@theobroma-systems.com>
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agorockchip: rk322x: Disable integrated macphy for saving power consuming
David Wu [Mon, 14 Aug 2017 07:04:28 +0000 (15:04 +0800)]
rockchip: rk322x: Disable integrated macphy for saving power consuming

Unfortunately, the integrated macphy default is enabled, which will
increase power consuming, if we do not use this PHY. So let's disable
it at first, which will save power consuming. If we really use it, then
enable it in driver level.

Signed-off-by: David Wu <david.wu@rock-chips.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agorockchip: rk322x: enable fastboot to set boot mode tag
Kever Yang [Wed, 9 Aug 2017 11:28:03 +0000 (19:28 +0800)]
rockchip: rk322x: enable fastboot to set boot mode tag

To support fastboot "fastboot reboot-bootloader" cmd.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agorockchip: enable rk322x sysreset driver
Kever Yang [Wed, 9 Aug 2017 11:10:13 +0000 (19:10 +0800)]
rockchip: enable rk322x sysreset driver

The sysreset driver for rk322x is ready but not enabled,
add it to Makefile to make sure it's enabled.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agoARM: dts: rockchip: add USB nodes for evb-rv1108
William Wu [Wed, 9 Aug 2017 03:36:28 +0000 (11:36 +0800)]
ARM: dts: rockchip: add USB nodes for evb-rv1108

This patch adds USB OTG/EHCI/OHCI nodes for evb-rv1108 USB ports.

Signed-off-by: William Wu <william.wu@rock-chips.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agoconfigs: rockchip: add USB configs for evb-rv1108 board
William Wu [Wed, 9 Aug 2017 03:36:27 +0000 (11:36 +0800)]
configs: rockchip: add USB configs for evb-rv1108 board

This patch adds USB configs to support the USB OTG port(consist
of DWC2 controller) and the USB Host port(consist of EHCI and OHCI
controllers) on evb-rv1108 board, and also support fastboot over
USB and USB mass storage.

Signed-off-by: William Wu <william.wu@rock-chips.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
7 years agoMerge git://git.denx.de/u-boot-x86
Tom Rini [Sun, 17 Sep 2017 15:46:51 +0000 (11:46 -0400)]
Merge git://git.denx.de/u-boot-x86

7 years agox86: ivybridge: remove unused variables
Heinrich Schuchardt [Tue, 12 Sep 2017 01:40:31 +0000 (03:40 +0200)]
x86: ivybridge: remove unused variables

legacy_hole_base_k and legacy_hole_size_k are defined but
not used.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: Enable early timer for chromebook_link
Simon Glass [Wed, 6 Sep 2017 01:49:50 +0000 (19:49 -0600)]
x86: Enable early timer for chromebook_link

Enable this option for link so that the timer is available earlier.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agobootstage: Provide a separate record count setting for SPL
Simon Glass [Wed, 6 Sep 2017 01:49:49 +0000 (19:49 -0600)]
bootstage: Provide a separate record count setting for SPL

With SPL we often have limited memory and do not need very many bootstage
records. Add a separate Kconfig option for SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agobootstage: Drop unused options
Simon Glass [Wed, 6 Sep 2017 01:49:48 +0000 (19:49 -0600)]
bootstage: Drop unused options

The CONFIG_BOOTSTAGE_USER_COUNT option is no-longer needed since we can now
support any number of user IDs. Also BOOTSTAGE_ID_COUNT is not needed now.

Drop these unused options.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agodm: x86: Allow TSC timer to be used before DM is ready
Simon Glass [Wed, 6 Sep 2017 01:49:46 +0000 (19:49 -0600)]
dm: x86: Allow TSC timer to be used before DM is ready

With bootstage we need access to the timer before driver model is set up.
To handle this, put the required state in global_data and provide a new
function to set up the device, separate from the driver's probe() method.

This will be used by the 'early' timer also.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agoboard_f: Drop the timer after relocation
Simon Glass [Wed, 6 Sep 2017 01:49:45 +0000 (19:49 -0600)]
board_f: Drop the timer after relocation

Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: Support Intel Cherry Hill board
Bin Meng [Wed, 16 Aug 2017 05:42:02 +0000 (22:42 -0700)]
x86: Support Intel Cherry Hill board

This adds support to Intel Cherry Hill board, a board based on
Intel Braswell SoC. The following devices are validated:

- serial port as the serial console
- on-board Realtek 8169 ethernet controller
- SATA AHCI controller
- EMMC/SDHC controller
- USB 3.0 xHCI controller
- PCIe x1 slot with a graphics card
- ICH SPI controller with an 8MB Macronix SPI flash
- Integrated graphics device as the video console

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agox86: braswell: Disable PUNIT power configuration for B0 stepping
Bin Meng [Wed, 16 Aug 2017 05:42:01 +0000 (22:42 -0700)]
x86: braswell: Disable PUNIT power configuration for B0 stepping

FSP's built-in UPD configuration enables PUNIT power configuration,
but on B0 stepping, this causes CPU hangs in fsp_init(). Disable it.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agox86: braswell: Add FSP configuration
Bin Meng [Wed, 16 Aug 2017 05:42:00 +0000 (22:42 -0700)]
x86: braswell: Add FSP configuration

Add FSP related configuration for Braswell.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agox86: braswell: Add microcode for B0/C0/D0 stepping SoC
Bin Meng [Wed, 16 Aug 2017 05:41:59 +0000 (22:41 -0700)]
x86: braswell: Add microcode for B0/C0/D0 stepping SoC

This adds microcode device tree fragment for Braswell B0 (406C2),
C0 (406C3) and D0 (406C4) stepping SoC.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agox86: Add Intel Braswell SoC support
Bin Meng [Wed, 16 Aug 2017 05:41:58 +0000 (22:41 -0700)]
x86: Add Intel Braswell SoC support

This adds initial Intel Braswell SoC support. It uses Intel FSP
to initialize the chipset.

Similar to its predecessor BayTrail, there are some work to do to
enable the legacy UART integrated in the Braswell SoC.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agox86: fsp: Update fsp command to show spec 1.1 header
Bin Meng [Wed, 16 Aug 2017 05:41:57 +0000 (22:41 -0700)]
x86: fsp: Update fsp command to show spec 1.1 header

FSP spec 1.1 adds 3 new APIs and their offsets are in the header.
Update the 'fsp hdr' command to show these new entries.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agox86: dm: video: Add a framebuffer driver that utilizes VBT
Bin Meng [Wed, 16 Aug 2017 05:41:56 +0000 (22:41 -0700)]
x86: dm: video: Add a framebuffer driver that utilizes VBT

When a VBT is given to an FSP that supports graphics initialization,
the FSP will produce a graphics info HOB that contains all necessary
information for the linear frame buffer of the integrated graphics
device. This adds a DM video driver for it.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agox86: dts: Include Intel Video BIOS Table in the ROM image
Bin Meng [Wed, 16 Aug 2017 05:41:55 +0000 (22:41 -0700)]
x86: dts: Include Intel Video BIOS Table in the ROM image

Now that binman is able to recognize the Video BIOS Table entry,
add such one in the u-boot.dtsi.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agotools: binman: Add a new entry type for Intel VBT
Bin Meng [Wed, 16 Aug 2017 05:41:54 +0000 (22:41 -0700)]
tools: binman: Add a new entry type for Intel VBT

This adds a new entry type for Intel Video BIOS Table.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agox86: Add Video BIOS Table (VBT) related Kconfig options
Bin Meng [Wed, 16 Aug 2017 05:41:53 +0000 (22:41 -0700)]
x86: Add Video BIOS Table (VBT) related Kconfig options

This adds Kconfig options for Video BIOS Table which is normally
required if you are using an Intel FSP firmware that is complaint
with spec 1.1 or later to initialize the integrated graphics device.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agox86: fsp: Add FSP_GRAPHICS_INFO_HOB
Bin Meng [Wed, 16 Aug 2017 05:41:52 +0000 (22:41 -0700)]
x86: fsp: Add FSP_GRAPHICS_INFO_HOB

This adds a new HOB type for graphics information introduced in FSP
spec 1.1. When graphics capability is included in FSP and enabled,
FSP produces an FSP_GRAPHICS_INFO_HOB as described in the EFI PI
specification which provides information about the graphics mode and
framebuffer.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agox86: fsp: Update struct common_buf for FSP spec 1.1
Bin Meng [Wed, 16 Aug 2017 05:41:51 +0000 (22:41 -0700)]
x86: fsp: Update struct common_buf for FSP spec 1.1

FSP spec 1.1 adds one more member to the struct common_buf to
determine the memory size that can be reserved by FSP below "top
of low usable memory" for bootloader usage. This new member uses
the reserved space so that it is still compatible with previous
FSP spec 1.0.

A new HOB (FSP_HOB_RESOURCE_OWNER_BOOTLOADER_TOLUM_GUID) is also
published when common_buf.tolum_size is valid and non zero.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agox86: tsc: Add Airmont reference clock values
Bin Meng [Wed, 16 Aug 2017 05:41:50 +0000 (22:41 -0700)]
x86: tsc: Add Airmont reference clock values

Per the Intel 64 and IA-32 Architecture Software Developer's Manual,
add the reference clock for Intel Atom Processors based on the Airmont
Microarchitecture (Braswell).

This keeps in sync with Linux kernel commit:
  6fcb41c: x86/tsc_msr: Add Airmont reference clock values

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agoMerge git://git.denx.de/u-boot-fdt
Tom Rini [Sat, 16 Sep 2017 02:34:34 +0000 (22:34 -0400)]
Merge git://git.denx.de/u-boot-fdt

7 years agotest/py: gpt: make use of infra-structure
Stephen Warren [Fri, 15 Sep 2017 18:19:38 +0000 (12:19 -0600)]
test/py: gpt: make use of infra-structure

Make various changes to the GPT test:

1) Reference the disk image using an absolute path in all cases. This
allows test/py to operate correctly if it's run from a directory other
than the root of the U-Boot source tree.

2) Store the disk image in the teswt/py persistent data directory. This
removes the need to re-generate it every time the tests are run.

3) Execute sgdisk using u_boot_utils.run_and_log() so that its output is
captured in the test log. This allows debugging any problems running it.

4) Make the disk image a test fixture. This removes the requirement to
always run all GPT tests, and run them in order. The current code doesn't
create the disk image if e.g. just test_gpt_uuid() is executed via the
test.py -k command-line option.

5) Use @pytest.mark.buildconfigspec for all feature dependencies, rather
than manually implementing some of them.

6) Make all tests depend on sandbox, since they use the sandbox-specific
host command.

Fixes: a2f422555fc8 ("add pytests for 'gpt guid' command in sandbox")
Fixes: c5772188ede9 ("add pytests for 'gpt rename' and 'gpt swap'")
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Tested-by: Tom Rini <trini@konsulko.com>
7 years agoARM: davinci: Remove CONFIG_SOC_DA830
Adam Ford [Fri, 15 Sep 2017 10:56:48 +0000 (05:56 -0500)]
ARM: davinci: Remove CONFIG_SOC_DA830

Nothing CONFIG_SOC_DA830 anymore, so let's remove it and
the one remaining source file for it. It appears to have been
abandoned a while ago.

Signed-off-by: Adam Ford <aford173@gmail.com>
7 years agoarm: dts: Add missing u-boot specific dtsi for dra7-evm
Jean-Jacques Hiblot [Fri, 15 Sep 2017 10:39:41 +0000 (12:39 +0200)]
arm: dts: Add missing u-boot specific dtsi for dra7-evm

commit b63b995 (arm: dts: Add u-boot specific compatibles) separated out
u-boot specific compatibles from dts files.
The u-boot specifics were moved in *-u-boot.dtsi files for all dra7
platforms except dra7-evm.
Without it the SD card is broken on DRA7-evm because the regulator cannot
be enabled.
Fix it by adding the missing dra7-evm-u-boot.dtsi with the needed
properties.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
7 years agoarm: mach-omap2: Relax checks on OP-TEE location to allow pageable image
Harinarayan Bhatta [Wed, 13 Sep 2017 18:27:44 +0000 (13:27 -0500)]
arm: mach-omap2: Relax checks on OP-TEE location to allow pageable image

When the OP-TEE image is built for secure paging the load address may be
in SRAM, remove checks that prevent this.

Signed-off-by: Harinarayan Bhatta <harinarayan@ti.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
7 years agofs/fat: fix fatbuf leak
Rob Clark [Tue, 12 Sep 2017 20:40:01 +0000 (16:40 -0400)]
fs/fat: fix fatbuf leak

A new fatbuf was allocated by get_fs_info() (called by fat_itr_root()),
but not freed, resulting in eventually running out of memory.  Spotted
by running 'ls -r' in a large FAT filesystem from Shell.efi.

fatbuf is mainly used to cache FAT entry lookups (get_fatent())..
possibly once fat_write.c it can move into the iterator to simplify
this.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Łukasz Majewski <lukma@denx.de>
7 years agofs/fat: Clean up open-coded sector <-> cluster conversions
Rob Clark [Sat, 9 Sep 2017 17:16:00 +0000 (13:16 -0400)]
fs/fat: Clean up open-coded sector <-> cluster conversions

Use the clust_to_sect() helper that was introduced earlier, and add an
inverse sect_to_clust(), plus update the various spots that open-coded
this conversion previously.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agofs/fat: fix case for FAT shortnames
Rob Clark [Sat, 9 Sep 2017 17:15:59 +0000 (13:15 -0400)]
fs/fat: fix case for FAT shortnames

Noticed when comparing our output to linux.  There are some lcase bits
which control whether filename and/or extension should be downcase'd.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Łukasz Majewski <lukma@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agofat/fs: move ls to generic implementation
Rob Clark [Sat, 9 Sep 2017 17:15:58 +0000 (13:15 -0400)]
fat/fs: move ls to generic implementation

Add a generic implementation of 'ls' using opendir/readdir/closedir, and
replace fat's custom implementation.  Other filesystems should move to
the generic implementation after they add opendir/readdir/closedir
support.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Łukasz Majewski <lukma@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agofat/fs: remove a bunch of dead code
Rob Clark [Sat, 9 Sep 2017 17:15:57 +0000 (13:15 -0400)]
fat/fs: remove a bunch of dead code

Spotted by chance, when trying to remove file_fat_ls(), I noticed there
were some dead users of the API.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Acked-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agofs/fat: implement opendir/readdir/closedir
Rob Clark [Sat, 9 Sep 2017 17:15:56 +0000 (13:15 -0400)]
fs/fat: implement opendir/readdir/closedir

Implement the readdir interface using the directory iterators.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Łukasz Majewski <lukma@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agofs: add fs_readdir()
Rob Clark [Sat, 9 Sep 2017 17:15:55 +0000 (13:15 -0400)]
fs: add fs_readdir()

Needed to support efi file protocol.  The fallback.efi loader wants
to be able to read the contents of the /EFI directory to find an OS
to boot.

Modelled after POSIX opendir()/readdir()/closedir().  Unlike the other
fs APIs, this is stateful (ie. state is held in the FS_DIR "directory
stream"), to avoid re-traversing of the directory structure at each
step.  The directory stream must be released with closedir() when it
is no longer needed.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Łukasz Majewski <lukma@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agofat/fs: convert to directory iterators
Rob Clark [Sat, 9 Sep 2017 17:15:54 +0000 (13:15 -0400)]
fat/fs: convert to directory iterators

And drop a whole lot of ugly code!

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Łukasz Majewski <lukma@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agofs/fat: introduce new director iterators
Rob Clark [Sat, 9 Sep 2017 17:15:53 +0000 (13:15 -0400)]
fs/fat: introduce new director iterators

Untangle directory traversal into a simple iterator, to replace the
existing multi-purpose do_fat_read_at() + get_dentfromdir().

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Łukasz Majewski <lukma@denx.de>
7 years agofs/fat: split out helper to init fsdata
Rob Clark [Sat, 9 Sep 2017 17:15:52 +0000 (13:15 -0400)]
fs/fat: split out helper to init fsdata

Want to re-use this in fat dirent iterator in next patch.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Łukasz Majewski <lukma@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agoMerge git://git.denx.de/u-boot-ubi
Tom Rini [Fri, 15 Sep 2017 12:45:21 +0000 (08:45 -0400)]
Merge git://git.denx.de/u-boot-ubi

7 years agoMerge git://git.denx.de/u-boot-i2c
Tom Rini [Fri, 15 Sep 2017 12:45:10 +0000 (08:45 -0400)]
Merge git://git.denx.de/u-boot-i2c

7 years agotest/py: u_boot_console_base.py: fix typo
Heinrich Schuchardt [Thu, 14 Sep 2017 10:27:07 +0000 (12:27 +0200)]
test/py: u_boot_console_base.py: fix typo

run_command does not have a parameter wait_for_each.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
7 years agocheckpatch.pl: Add warning for new __packed additions
Heinrich Schuchardt [Wed, 13 Sep 2017 02:59:05 +0000 (04:59 +0200)]
checkpatch.pl: Add warning for new __packed additions

While there are valid reasons to use __packed, often the answer is that
you should be doing something else here instead.

This reintroduces the changes of
f503cc49a570 (Add warning for new __packed additions)

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
7 years agocmd: blk: Use LBAFU in the common block command
Bin Meng [Wed, 13 Sep 2017 02:00:36 +0000 (19:00 -0700)]
cmd: blk: Use LBAFU in the common block command

There is already a macro LBAFU to aid formatted print with lbaint_t
variables. Let's use it in the common block command codes.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
7 years agoblk: Remove various places that do flush cache after read
Bin Meng [Wed, 13 Sep 2017 02:00:23 +0000 (19:00 -0700)]
blk: Remove various places that do flush cache after read

All these places seem to inherit the codes from the MMC driver where
a FIXME was put in the comment. However the correct operation after
read should be cache invalidate, not flush.

The underlying drivers should be responsible for the cache operation.
Remove these codes completely.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: York Sun <york.sun@nxp.com>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: York Sun <york.sun@nxp.com>
7 years agotest: overlay: Add unit test for stacked overlay
Pantelis Antoniou [Mon, 4 Sep 2017 20:12:23 +0000 (23:12 +0300)]
test: overlay: Add unit test for stacked overlay

Verify that stacked overlays work.

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Acked-by: Simon Glass <sjg@chromium.org>
7 years agout: fix fdt_getprop_u32() change
Pantelis Antoniou [Mon, 4 Sep 2017 20:12:22 +0000 (23:12 +0300)]
ut: fix fdt_getprop_u32() change

fdt_getprop_u32 is not exported and it's different than what the
unit test uses. Rename u32 prop access methods to something that's
unit test specific.

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Acked-by: Simon Glass <sjg@chromium.org>
7 years agoconfig: sandbox: Add unit tests
Pantelis Antoniou [Mon, 4 Sep 2017 20:12:21 +0000 (23:12 +0300)]
config: sandbox: Add unit tests

Add unit tests for sandbox default config.

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Acked-by: Simon Glass <sjg@chromium.org>
7 years agodtbo: make dtbos special
Pantelis Antoniou [Mon, 4 Sep 2017 20:12:20 +0000 (23:12 +0300)]
dtbo: make dtbos special

Special rule for dtbo generation

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Acked-by: Simon Glass <sjg@chromium.org>
7 years agodoc: overlays: Tweak documentation regarding overlays
Franklin S Cooper Jr [Mon, 4 Sep 2017 20:12:19 +0000 (23:12 +0300)]
doc: overlays: Tweak documentation regarding overlays

Pull some information regarding overlays from commit messages and
put them directly within the documentation. Also add some information
regarding required dtc version to properly use overlays.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>
7 years agodoc: Document how to apply fdt overlays
Pantelis Antoniou [Mon, 4 Sep 2017 20:12:18 +0000 (23:12 +0300)]
doc: Document how to apply fdt overlays

We have the capability to apply overlays on the command line but
we didn't have a document explaining how.

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Reviewed-by: Łukasz Majewski
Acked-by: Simon Glass <sjg@chromium.org>
7 years agofit: fdt overlays doc
Pantelis Antoniou [Mon, 4 Sep 2017 20:12:17 +0000 (23:12 +0300)]
fit: fdt overlays doc

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Reviewed-by: Łukasz Majewski
Acked-by: Simon Glass <sjg@chromium.org>
7 years agofit: Introduce methods for applying overlays on fit-load
Pantelis Antoniou [Mon, 4 Sep 2017 20:12:16 +0000 (23:12 +0300)]
fit: Introduce methods for applying overlays on fit-load

Introduce an overlay based method for constructing a base DT blob
to pass to the kernel.

It is based on a specific method now to get the FDT from a FIT image
named boot_get_fdt_fit().

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Acked-by: Simon Glass <sjg@chromium.org>
7 years agofit: Do not throw away extra configuration on fit_image_load()
Pantelis Antoniou [Mon, 4 Sep 2017 20:12:15 +0000 (23:12 +0300)]
fit: Do not throw away extra configuration on fit_image_load()

fit_image_load() threw away the extra configuration parts when
loading. We need them around for applying extra overlays for
building the boot fdt.

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Acked-by: Simon Glass <sjg@chromium.org>
7 years agofit: Allow multiple images per property
Pantelis Antoniou [Mon, 4 Sep 2017 20:12:14 +0000 (23:12 +0300)]
fit: Allow multiple images per property

As part of the fdt overlay support which need it, allow
a list of configurations per property.

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Acked-by: Simon Glass <sjg@chromium.org>
7 years agofdt: Allow stacked overlays phandle references
Pantelis Antoniou [Mon, 4 Sep 2017 20:12:13 +0000 (23:12 +0300)]
fdt: Allow stacked overlays phandle references

This patch enables an overlay to refer to a previous overlay's
labels by performing a merge of symbol information at application
time.

In a nutshell it allows an overlay to refer to a symbol that a previous
overlay has defined. It requires both the base and all the overlays
to be compiled with the -@ command line switch so that symbol
information is included.

base.dts
--------

/dts-v1/;
/ {
foo: foonode {
foo-property;
};
};

$ dtc -@ -I dts -O dtb -o base.dtb base.dts

bar.dts
-------

/dts-v1/;
/plugin/;
/ {
fragment@1 {
target = <&foo>;
__overlay__ {
overlay-1-property;
bar: barnode {
bar-property;
};
};
};
};

$ dtc -@ -I dts -O dtb -o bar.dtb bar.dts

baz.dts
-------

/dts-v1/;
/plugin/;
/ {
fragment@1 {
target = <&bar>;
__overlay__ {
overlay-2-property;
baz: baznode {
baz-property;
};
};
};
};

$ dtc -@ -I dts -O dtb -o baz.dtb baz.dts

Applying the overlays:

$ fdtoverlay -i base.dtb -o target.dtb bar.dtb baz.dtb

Dumping:

$ fdtdump target.dtb
/ {
            foonode {
                overlay-1-property;
                foo-property;
                linux,phandle = <0x00000001>;
                phandle = <0x00000001>;
                barnode {
                    overlay-2-property;
                    phandle = <0x00000002>;
                    linux,phandle = <0x00000002>;
                    bar-property;
                    baznode {
                        phandle = <0x00000003>;
                        linux,phandle = <0x00000003>;
                        baz-property;
                    };
                };
            };
            __symbols__ {
                baz = "/foonode/barnode/baznode";
                bar = "/foonode/barnode";
                foo = "/foonode";
            };
};

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Acked-by: Simon Glass <sjg@chromium.org>
7 years agofdt: Switch to using the verbose overlay application method
Pantelis Antoniou [Mon, 4 Sep 2017 20:12:12 +0000 (23:12 +0300)]
fdt: Switch to using the verbose overlay application method

The verbose overlay application method prints out more helpful
messages, so switch to it.

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Acked-by: Simon Glass <sjg@chromium.org>
7 years agofdt: Introduce helper method fdt_overlay_apply_verbose()
Pantelis Antoniou [Mon, 4 Sep 2017 20:12:11 +0000 (23:12 +0300)]
fdt: Introduce helper method fdt_overlay_apply_verbose()

Introduce fdt_overlay_apply_verbose, a method that applies an
overlay but in the case of an error produces a helpful message.

In addition if a base tree is found to be missing the __symbols__
node the message will point out that the probable reason is that
the base tree was miscompiled without the -@ option.

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Acked-by: Simon Glass <sjg@chromium.org>
7 years agolibfdt: Initialize the stack variable
Tien Fong Chee [Wed, 30 Aug 2017 05:15:42 +0000 (13:15 +0800)]
libfdt: Initialize the stack variable

Report Coverity log:
The code uses a variable that has not
been initialized, leading to unpredictable
or unintended results.

Reported-by: Coverity (CID: 60519)
Signed-off-by: Tien Fong Chee <tien.fong.chee@intel.com>
7 years agodtoc: Add a header to the generated files
Simon Glass [Tue, 29 Aug 2017 20:16:01 +0000 (14:16 -0600)]
dtoc: Add a header to the generated files

Add a header that indicates that the files generated by dtoc should not be
modified.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Kever Yang <kever.yang@rock-chips.com>
7 years agodtoc: Rename the auto-generated dt-structs.h file
Simon Glass [Tue, 29 Aug 2017 20:16:00 +0000 (14:16 -0600)]
dtoc: Rename the auto-generated dt-structs.h file

The filename of the auto-generated file is the same as the file that
includes it. Even though the form is in the generated/ subdirectory, this
could be confused.

Rename the generated file to something that makes it clear it is
auto-generated.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Kever Yang <kever.yang@rock-chips.com>
7 years agodtoc: Support properties containing multiple phandle values
Simon Glass [Tue, 29 Aug 2017 20:15:59 +0000 (14:15 -0600)]
dtoc: Support properties containing multiple phandle values

At present dtoc has a very simplistic view of phandles. It assumes that
a property has only a single phandle with a single argument (i.e. two
cells per property).

This is not true in many cases. Enhance the implementation to scan all
phandles in a property and to use the correct number of arguments (which
can be 0, 1, 2 or more) when generating the C code. For the struct
definitions, use a struct which can hold the maximum number of arguments
used by the property.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Kever Yang <kever.yang@rock-chips.com>
7 years agodtoc: Put phandle args in an array
Simon Glass [Tue, 29 Aug 2017 20:15:58 +0000 (14:15 -0600)]
dtoc: Put phandle args in an array

We want to support more than one phandle argument. It makes sense to use
an array for this rather than discrete struct members. Adjust the code to
support this. Rename the member to 'arg' instead of 'id'.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Kever Yang <kever.yang@rock-chips.com>
7 years agodtoc: Put each phandle on a separate line
Simon Glass [Tue, 29 Aug 2017 20:15:57 +0000 (14:15 -0600)]
dtoc: Put each phandle on a separate line

When writing values from properties which contain phandles, dtoc currently
writes 8 phandles per line. Change this to write one phandle per line.
This helps reduce line length, since phandles are generally longer and may
have arguments.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Kever Yang <kever.yang@rock-chips.com>
7 years agodtoc: Rename the phandle struct
Simon Glass [Tue, 29 Aug 2017 20:15:56 +0000 (14:15 -0600)]
dtoc: Rename the phandle struct

Rather than naming the phandle struct according to the number of cells it
uses (e.g. struct phandle_2_cell) name it according to the number of
arguments it has (e.g. struct phandle_1_arg). This is a more intuitive
naming.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Kever Yang <kever.yang@rock-chips.com>
7 years agodtoc: Rename is_phandle() and adjust it to return more detail
Simon Glass [Tue, 29 Aug 2017 20:15:55 +0000 (14:15 -0600)]
dtoc: Rename is_phandle() and adjust it to return more detail

Update this function to return more detail about a property that contains
phandles. This will allow (in a future commit) more accurate handling of
these properties.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Kever Yang <kever.yang@rock-chips.com>
7 years agodtoc: Make is_phandle() a member function
Simon Glass [Tue, 29 Aug 2017 20:15:54 +0000 (14:15 -0600)]
dtoc: Make is_phandle() a member function

This function will need to have access to class members once we enhance it
to support multiple phandle values. In preparation for that, move it into
the class.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Kever Yang <kever.yang@rock-chips.com>
7 years agodtoc: Use the Fdt's class's phandle map
Simon Glass [Tue, 29 Aug 2017 20:15:53 +0000 (14:15 -0600)]
dtoc: Use the Fdt's class's phandle map

Now that the Fdt class can map phandles to the associated nodes, use that
instead of a separate implementation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Kever Yang <kever.yang@rock-chips.com>