oweals/u-boot.git
5 years agoARM: dts: imx: dh-imx6: Fix SPI CS polarity on DHCOM iMX6 PDK2
Marek Vasut [Fri, 17 May 2019 14:58:48 +0000 (16:58 +0200)]
ARM: dts: imx: dh-imx6: Fix SPI CS polarity on DHCOM iMX6 PDK2

The SPI nCS signal is active low, make it so.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Ludwig Zenz <lzenz@dh-electronics.com>
Cc: Stefano Babic <sbabic@denx.de>
5 years agoARM: dts: imx: dh-imx6: Import DHCOM iMX6 PDK2 DTs from Linux
Marek Vasut [Fri, 17 May 2019 14:58:47 +0000 (16:58 +0200)]
ARM: dts: imx: dh-imx6: Import DHCOM iMX6 PDK2 DTs from Linux

Import DHCOM iMX6 PDK2 device tree from Linux 5.1.1 b724e9356404 .
Enable DT control in full U-Boot .

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Ludwig Zenz <lzenz@dh-electronics.com>
Cc: Stefano Babic <sbabic@denx.de>
5 years agoRevert "drivers/crypto/fsl: assign job-rings to non-TrustZone"
Breno Matheus Lima [Tue, 4 Jun 2019 02:54:44 +0000 (02:54 +0000)]
Revert "drivers/crypto/fsl: assign job-rings to non-TrustZone"

Commit 22191ac35344 ("drivers/crypto/fsl: assign job-rings to
 non-TrustZone") breaks HABv4 encrypted boot support in the
following i.MX devices:

- i.MX6UL
- i.MX7S
- i.MX7D
- i.MX7ULP

For preparing a HABv4 encrypted boot image it's necessary to
encapsulate the generated DEK in a blob. In devices listed
above the blob generation function takes into consideration
the Job Ring TrustZone ownership configuration (JROWN_NS)
and can be only decapsulated by the same configuration.

The ROM code expects DEK blobs encapsulated by the Secure World
environments which commonly have JROWN_NS = 0.

As U-Boot is running in Secure World we must have JROWN_NS = 0
so the blobs generated by dek_blob tool can be decapsulated
by the ROM code.

Job-rings assignment is now handled in OP-TEE OS, this commit can
be safely reverted.
https://github.com/OP-TEE/optee_os/pull/2986

This reverts commit 22191ac353445ad8fafc5a78aefcd94e78963041.

Signed-off-by: Breno Lima <breno.lima@nxp.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
Acked-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
5 years agoconfig: Update KP's imx53 HSC config to pass key pressed information
Lukasz Majewski [Wed, 8 May 2019 14:26:23 +0000 (16:26 +0200)]
config: Update KP's imx53 HSC config to pass key pressed information

The information about pressed key is relevant in performing correct
update and recovery scenarios via USB pendrive.

This commit modifies envs to provide it.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
5 years agoconfig: Update KP's imx53 HSC config to support SWUpdate
Lukasz Majewski [Wed, 8 May 2019 14:26:22 +0000 (16:26 +0200)]
config: Update KP's imx53 HSC config to support SWUpdate

This commit updates envs responsible for using USB pendrive as a
SWUpdate based tool for recovery and update.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
5 years agoimx: Use a convenient default value for SYS_MALLOC_F_LEN
Fabio Estevam [Fri, 3 May 2019 17:05:04 +0000 (14:05 -0300)]
imx: Use a convenient default value for SYS_MALLOC_F_LEN

Commit 3a7c45f6a772 ("simple-bus: add DM_FLAG_PRE_RELOC flag to
simple-bus driver") causes some i.MX boards that were converted
to DM, such as warp7, to fail to boot.

As explained by Lukas Auer:

"With the patch, U-Boot probes the drivers for devices under simple-bus
device tree nodes in the pre-relocation device model. The default value
of CONFIG_SYS_MALLOC_F_LEN (0x400) leaves U-Boot with not enough memory to
do this, causing it to hang."

Fix this problem by providing a convenient default value for
CONFIG_SYS_MALLOC_F_LEN.

Reported-by: Pierre-Jean Texier <pjtexier@koncepto.io>
Suggested-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Signed-off-by: Fabio Estevam <festevam@gmail.com>
Tested-by: Pierre-Jean Texier <pjtexier@koncepto.io>
Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Tested-by: Heiko Schocher <hs@denx.de>
5 years agoopos6uldev: don't call enable_lcdif_clock
Sébastien Szymanski [Tue, 14 May 2019 11:46:20 +0000 (13:46 +0200)]
opos6uldev: don't call enable_lcdif_clock

The mxsfb driver already calls enable_lcdif_clock.

Signed-off-by: Sébastien Szymanski <sebastien.szymanski@armadeus.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
5 years agoopos6ul: set REFSEL and REFR fields
Sébastien Szymanski [Tue, 14 May 2019 11:33:46 +0000 (13:33 +0200)]
opos6ul: set REFSEL and REFR fields

Signed-off-by: Sébastien Szymanski <sebastien.szymanski@armadeus.com>
5 years agoimx: hab: Increase CSF_SIZE for i.MX6 and i.MX7 devices
Breno Matheus Lima [Fri, 26 Apr 2019 02:56:48 +0000 (02:56 +0000)]
imx: hab: Increase CSF_SIZE for i.MX6 and i.MX7 devices

In certain i.MX devices the encrypted boot image is failing to boot.

According to AN12056 "Encrypted Boot on HABv4 and CAAM Enabled Devices"
it's necessary to pad CSF to 0x2000 and append DEK blob.

In this case the total image size in boot data structure must cover the
entire binary otherwise the dek_blob won't be copied to memory and image
won't be decrypted.

Increase CSF_SIZE to 0x4000 to avoid such issue when booting encrypted
boot images.

Signed-off-by: Breno Lima <breno.lima@nxp.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
5 years agocolibri-imx6ull: fix usb host mode
Marcel Ziswiler [Fri, 26 Apr 2019 18:48:14 +0000 (20:48 +0200)]
colibri-imx6ull: fix usb host mode

This fixes an issue with USB host mode.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
5 years agoARM: imx: apalis_imx6: Drop ad-hoc SATA binding
Marek Vasut [Sun, 12 May 2019 20:43:25 +0000 (22:43 +0200)]
ARM: imx: apalis_imx6: Drop ad-hoc SATA binding

Drop the ad-hoc AHCI binding code, this is superseded by
CONFIG_DWC_AHSATA_AHCI=y resp. drivers/ata/dwc_ahsata.c

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Cc: Max Krummenacher <max.krummenacher@toradex.com>
Cc: Stefan Agner <stefan.agner@toradex.com>
Cc: Stefano Babic <sbabic@denx.de>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
5 years agoregulator: bd71837: copy the bd71837 pmic driver from NXP imx u-boot
Matti Vaittinen [Tue, 7 May 2019 07:43:39 +0000 (10:43 +0300)]
regulator: bd71837: copy the bd71837 pmic driver from NXP imx u-boot

https://source.codeaurora.org/external/imx/uboot-imx

cherry picked, styled and merged commits:
- MLK-18387 pmic: Add pmic driver for BD71837e9a3bec2e95a
- MLK-18590 pmic: bd71837: Change to use new fdt API: acdc5c297a96

Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agocolibri_imx7: migrate usb to driver model
Igor Opaniuk [Fri, 10 May 2019 09:35:29 +0000 (12:35 +0300)]
colibri_imx7: migrate usb to driver model

Migrate USB to Driver Model (CONFIG_DM_USB=y).

Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
5 years agoconfigs: imx6-engicam: Update the recoveryboot setting
Jagan Teki [Fri, 26 Apr 2019 09:01:46 +0000 (14:31 +0530)]
configs: imx6-engicam: Update the recoveryboot setting

Since recovery boot on mmc can get the mmcpart and mmcroot
dynamically, drop the static definitions and handle it
properly.

Tested-by: Shyam Saini <shyam.saini@amarulasolutions.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agotoradex apalis/colibri: extend CONFIG_SYS_MALLOC_F_LEN
Igor Opaniuk [Fri, 17 May 2019 14:48:43 +0000 (17:48 +0300)]
toradex apalis/colibri: extend CONFIG_SYS_MALLOC_F_LEN

Extend size of the malloc() pool for use before relocation, from 0x400
(default one) to 0x2000 (CONFIG_SYS_MALLOC_F_LEN=0x2000),
as adding of DM_FLAG_PRE_RELOC flag to simple-bus driver introduced a
regression on multiple boards, because of more intensive usage of malloc()
pool and therefore a broken boot as the size of pool isn't sufficient.

Fixes: 3a7c45f6a7 ("simple-bus: add DM_FLAG_PRE_RELOC flag to simple-bus")
Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agoapalis_imx6: add device tree to makefile
Marcel Ziswiler [Tue, 9 Apr 2019 15:21:48 +0000 (17:21 +0200)]
apalis_imx6: add device tree to makefile

Add device tree to Makefile to avoid newly introduced error:

Device Tree Source is not correctly specified.
Please define 'CONFIG_DEFAULT_DEVICE_TREE'
or build with 'DEVICE_TREE=<device_tree>' argument

make[1]: *** [dts/Makefile:28: arch/arm/dts/imx6-apalis.dtb] Error 1
make: *** [Makefile:1009: dts/dt.dtb] Error 2

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
5 years agoapalis/colibri imx6: provide proper fdtfile value
Igor Opaniuk [Thu, 23 May 2019 11:05:50 +0000 (11:05 +0000)]
apalis/colibri imx6: provide proper fdtfile value

Provide proper fdtfile env variable value before invoking distro_bootcmd
command.

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
5 years agoARM: dts: i.MX6ULL: U-Boot specific dts for u-boot, dm-spl
Parthiban Nallathambi [Sun, 7 Apr 2019 18:32:42 +0000 (20:32 +0200)]
ARM: dts: i.MX6ULL: U-Boot specific dts for u-boot, dm-spl

u-boot,dm-spl property is specific to U-Boot, so created one
for i.MX6ULL platforms.

Signed-off-by: Parthiban Nallathambi <parthitce@gmail.com>
5 years agopower: pfuze100: Fix off by one error in voltage table handling
Trent Piepho [Thu, 4 Apr 2019 21:52:04 +0000 (21:52 +0000)]
power: pfuze100: Fix off by one error in voltage table handling

The code that sets a regulator by looking up the voltage in a table had
an off by one error.  vsel_mask is a bitmask, not the number of table
entries, so a vsel_mask value of 0x7 indicates there are 8, not 7,
entries in the table.

Cc: Peng Fan <Peng.Fan@freescale.com>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Trent Piepho <tpiepho@impinj.com>
5 years agomx7ulp: Add common plugin codes for mx7ulp
Ye Li [Thu, 16 May 2019 03:18:51 +0000 (03:18 +0000)]
mx7ulp: Add common plugin codes for mx7ulp

Add common plugin codes to call ROM's hwcnfg_setup and generate IVT2
header.

Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
5 years agoboard: toradex: add colibri imx8qxp 2gb wb it v1.0b module support
Marcel Ziswiler [Fri, 31 May 2019 15:56:39 +0000 (18:56 +0300)]
board: toradex: add colibri imx8qxp 2gb wb it v1.0b module support

This commit adds initial support for the Toradex Colibri iMX8QXP 2GB WB
IT V1.0B module. Unlike the V1.0A early access samples exclusively
booting from SD card, they are now strapped to boot from eFuses which
are factory fused to properly boot from their on-module eMMC. U-Boot
supports either booting from the on-module eMMC or may be used for
recovery purpose using the universal update utility (uuu) aka mfgtools
3.0.

Functionality wise the following is known to be working:
- eMMC and MMC/SD card
- Ethernet
- GPIOs
- I2C

Unfortunately, there is no USB functionality for the i.MX 8QXP as of
yet.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
5 years agoimx: fix building for i.mx8 without spl
Marcel Ziswiler [Fri, 31 May 2019 15:56:38 +0000 (18:56 +0300)]
imx: fix building for i.mx8 without spl

Building with Travis CI complained and stopped with the following error:
+cc1: fatal error: opening output file spl/u-boot-spl.cfgout: No such
file or directory
+compilation terminated.

This fixes commit caceb739ea07 ("imx: build flash.bin for i.MX8") which
took SPL being enabled on i.MX8 for granted.

Reported-by: Stefano Babic <sbabic@denx.de>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
5 years agoARM: imx6logic: Stop overwriting fdt_file if manually set
Adam Ford [Wed, 13 Mar 2019 15:49:22 +0000 (10:49 -0500)]
ARM: imx6logic: Stop overwriting fdt_file if manually set

The board file uses the processor type to determine what dtb file
is set.  Unfortunately, if the user wants to manually set this,
it get gets overwritten upon boot.  This patch adds a check to
see if the value is already set and only changes it if the value
is empty.

Signed-off-by: Adam Ford <aford173@gmail.com>
5 years agospl: Correct SPL_SIZE_LIMIT Kconfig option
Tom Rini [Sat, 8 Jun 2019 00:39:32 +0000 (20:39 -0400)]
spl: Correct SPL_SIZE_LIMIT Kconfig option

When introduced this limit was an int but was then changed to hex
without noting as much in the prompt nor changing existing users.  Put
this back to an int.

Reported-by: Fabio Estevam <festevam@gmail.com>
Tested-by: Fabio Estevam <festevam@gmail.com>
Fixes: 2577015dc5c4 ("spl: add overall SPL size check")
Signed-off-by: Tom Rini <trini@konsulko.com>
5 years agoMerge branch '2019-06-07-master-imports'
Tom Rini [Fri, 7 Jun 2019 22:03:18 +0000 (18:03 -0400)]
Merge branch '2019-06-07-master-imports'

- Include Heinrich's series to move the i.MX board size check function
  to be more widely available.
- Include Simon Goldschmidt's patch to make it possible to have a more
  accurate SPL size check applied.

5 years agospl: add overall SPL size check
Simon Goldschmidt [Fri, 24 May 2019 20:07:04 +0000 (22:07 +0200)]
spl: add overall SPL size check

This adds a size check for SPL that can dynamically check generated
SPL binaries (including devicetree) for a size limit that ensures
this image plus global data, heap and stack fit in initial SRAM.

Since some of these sizes are not available to make, a new host tool
'spl_size_limit' is added that dumps the resulting maximum size for
an SPL binary to stdout. This tool is used in toplevel Makefile to
implement the size check on SPL binaries.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
5 years agoconfigs: rk3288: Tinker Board SPL file must fit into 32 KiB
Heinrich Schuchardt [Tue, 2 Apr 2019 17:19:07 +0000 (19:19 +0200)]
configs: rk3288: Tinker Board SPL file must fit into 32 KiB

The SPL image for the Tinker Board has to fit into 32 KiB. This includes
up to 2 KiB for the file header.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoconfigs: define CONFIG_SPL_SIZE_LIMIT
Heinrich Schuchardt [Tue, 2 Apr 2019 17:19:06 +0000 (19:19 +0200)]
configs: define CONFIG_SPL_SIZE_LIMIT

A new configuration variable CONFIG_SPL_SIZE_LIMIT is introduced to define
the board specific maximum size for the SPL file.

Use Makefile function size_check() to implement the test.

Depending on the size of CONFIG_SPL_SIZE_LIMIT an error like the following
is thrown:

spl/u-boot-spl.bin exceeds file size limit:
  limit:  30720 bytes
  actual: 33426 bytes
  excess: 2706 bytes
make: *** [Makefile:1663: spl/u-boot-spl.bin] Error 1

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoimx: move BOARD_SIZE_CHECK to main Makefile
Heinrich Schuchardt [Tue, 2 Apr 2019 17:19:05 +0000 (19:19 +0200)]
imx: move BOARD_SIZE_CHECK to main Makefile

We currently have duplicate definitions for BOARD_SIZE_CHECK in Makefile
and arch/arm/mach-imx/Makefile.

Move the board size check from arch/arm/mach-imx/Makefile to Makefile.

Depending on the value of CONFIG_BOARD_SIZE_LIMIT an error like an error
like the following is thrown:

u-boot-dtb.imx exceeds file size limit:
  limit:  503696 bytes
  actual: 509720 bytes
  excess: 6024 bytes
make: *** [Makefile:1051: u-boot-dtb.imx] Error 1

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
5 years agoMakefile: reusable function for BOARD_SIZE_CHECK
Heinrich Schuchardt [Tue, 2 Apr 2019 17:19:04 +0000 (19:19 +0200)]
Makefile: reusable function for BOARD_SIZE_CHECK

Carve out function size_check from macro BOARD_SIZE_CHECK. This will allow
us to reuse the function for other file size checks.

Depending on the value of CONFIG_BOARD_SIZE_LIMIT an error like the
following is thrown:

u-boot-dtb.img exceeds file size limit:
  limit:  409516 bytes
  actual: 444346 bytes
  excess: 34830 bytes
make: *** [Makefile:1212: u-boot-dtb.img] Error 1

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agolib/vsprintf: allow printing upper case GUIDs
Heinrich Schuchardt [Mon, 29 Apr 2019 06:08:43 +0000 (08:08 +0200)]
lib/vsprintf: allow printing upper case GUIDs

In the UEFI context GUIDs are expected to be rendered in upper case.

The patch uses the formerly unused bit 1 of the parameter str_format
of function uuid_bin_to_str() to indicate if we need upper or lower case
output.

Function uuid_string() in vsprint.c is adjusted to correctly set the bit
depending on the print format code.

%pUb: 01020304-0506-0708-090a-0b0c0d0e0f10
%pUB: 01020304-0506-0708-090A-0B0C0D0E0F10
%pUl: 04030201-0605-0807-090a-0b0c0d0e0f10
%pUL: 04030201-0605-0807-090A-0B0C0D0E0F10

Up to this point only a diagnostic message in mount_ubifs() using '%pUB' is
concerned by the change. Further patches are needed to adjust the UEFI
subsystem.

A unit test is provided inside the ut_print command.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoMerge tag 'efi-2019-07-rc4-2' of git://git.denx.de/u-boot-efi
Tom Rini [Wed, 5 Jun 2019 19:53:18 +0000 (15:53 -0400)]
Merge tag 'efi-2019-07-rc4-2' of git://git.denx.de/u-boot-efi

Pull request for UEFI sub-system for v2019.07-rc4-2

Support for managing the non-volatile attribute of UEFI variables
is added though we do not have a backend for persistence yet.

Error messages for changes of UEFI variables are provided.

UEFI boottime service implementations are corrected.

5 years agoMerge branch '2019-06-05-master-imports'
Tom Rini [Wed, 5 Jun 2019 19:49:09 +0000 (15:49 -0400)]
Merge branch '2019-06-05-master-imports'

- More DaVinci fixes
- BuR platform fix

5 years agocmd/led: check subcommand "list" instead "l"
Heiko Schocher [Mon, 27 May 2019 06:14:16 +0000 (08:14 +0200)]
cmd/led: check subcommand "list" instead "l"

current implementation for checking if "led list"
command is called checks only if "l" is passed to the
led command. This prevents switching leds with name
which starts also with a "l". So check for passing
"list".

While at it, also fix a typo in led command usage.

Signed-off-by: Heiko Schocher <hs@denx.de>
5 years agoboard: am335x/mux: configure the pins for 8-bit data transfer on MMC1
Jean-Jacques Hiblot [Thu, 23 May 2019 12:07:23 +0000 (14:07 +0200)]
board: am335x/mux: configure the pins for 8-bit data transfer on MMC1

This is required for proper operation of the 8-bit data transfers.
This fixes transient errors seen on BeagleBone Black.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
5 years agoboard/km: update maintainer e-mail
Holger Brunck [Tue, 4 Jun 2019 12:10:32 +0000 (14:10 +0200)]
board/km: update maintainer e-mail

Signed-off-by: Holger Brunck <holger.brunck@ch.abb.com>
5 years agoarm: davinci: remove leftover assembly
Bartosz Golaszewski [Wed, 29 May 2019 08:02:00 +0000 (10:02 +0200)]
arm: davinci: remove leftover assembly

There are no more users of lowlevel_init.S. Remove the file.

Suggested-by: Adam Ford <aford173@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
5 years agoconfigs/legoev3: define CONFIG_SKIP_LOWLEVEL_INIT
David Lechner [Wed, 29 May 2019 08:01:59 +0000 (10:01 +0200)]
configs/legoev3: define CONFIG_SKIP_LOWLEVEL_INIT

This adds a define for CONFIG_SKIP_LOWLEVEL_INIT in the legoev3 config.
On the EV3, U-Boot is loaded into RAM by another bootloader, so we
don't need the lowlevel init in U-Boot.

Signed-off-by: David Lechner <david@lechnology.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
5 years agoARM: da850evm: Fix reading MAC from SPI
Adam Ford [Wed, 29 May 2019 14:36:58 +0000 (09:36 -0500)]
ARM: da850evm: Fix reading MAC from SPI

The MAC address is located at at the last 64K of SPI Flash, and
it's 6 bytes long.  This patch corrects both the length and
starting byte of the MAC address.

Signed-off-by: Adam Ford <aford173@gmail.com>
5 years agoarm: omap3: Manually initialize GPIO if OF_CONTROL doesn't
Adam Ford [Wed, 29 May 2019 20:42:53 +0000 (15:42 -0500)]
arm: omap3: Manually initialize GPIO if OF_CONTROL doesn't

The commong initialization code manually initializes the GPIO
even when OF_CONTROL does it, so we can reduce the code size a
bit by not doing it manually when we have device tree support.

Using the omap3_logic board (dm3730), the sizes shrunk:

Before:

   text    data     bss     dec     hex filename
 561066   28596  116880  706542   ac7ee u-boot
  55245    1605    1888   58738    e572 spl/u-boot-spl

After
  text    data     bss     dec     hex filename
 560898   28548  116872  706318   ac70e u-boot
  55121    1557    1888   58566    e4c6 spl/u-boot-spl

Signed-off-by: Adam Ford <aford173@gmail.com>
5 years agoARM: DTS: imx6q-logicpd: Resync with Linux 5.1
Adam Ford [Fri, 31 May 2019 12:09:22 +0000 (07:09 -0500)]
ARM: DTS: imx6q-logicpd: Resync with Linux 5.1

Resync imx6q-logicpd with Kernel 5.1.5

Signed-off-by: Adam Ford <aford173@gmail.com>
5 years agoARM: davinci: Remove ipam390 linker script from Kconfig
Adam Ford [Thu, 30 May 2019 23:04:44 +0000 (18:04 -0500)]
ARM: davinci: Remove ipam390 linker script from Kconfig

With ipam390 support removed in we can remove the reference to the
linker script since that case will never be true.

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
5 years agoARM: davinci: SPL: fix BSS initialization
Sekhar Nori [Thu, 30 May 2019 13:34:55 +0000 (19:04 +0530)]
ARM: davinci: SPL: fix BSS initialization

U-Boot README recommends initializing SDRAM in board_init_f(). DA850
was doing it as part of board_init_r() (through call to spl_board_init()
which calls arch_cpu_init() which calls da850_ddr_setup())

This worked fine till commit 15b8c7505819 ("davinci:
da850evm/omapl138-lcdk: Move BSS to SDRAM because SRAM is full") moved
BSS to SDRAM.

Functions like mmc_initialize() called in board_init_r() assume BSS is
available. Since SDRAM was not initialized when arch/arm/lib/crt0.S tried
to initialize BSS to 0, BSS is not initialized correctly.

Fix this by simply calling arch_cpu_init() from board_init_f(). Also move
preloader_console_init() there to help debug issues with board_init_r().

With this spl_board_init() is no longer needed, we remove it.

Tested using MMC/SD boot on OMAP-L138 LCDK board.

Tested-by: Adam Ford <aford173@gmail.com> #da850evm
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Tested-by: Peter Howard <phoward@gme.net.au> #omapl138_lcdk
5 years agoARM: davinci: omal138_lcdk: fix MMC boot breakage due to driver model conversion
Sekhar Nori [Thu, 30 May 2019 13:34:54 +0000 (19:04 +0530)]
ARM: davinci: omal138_lcdk: fix MMC boot breakage due to driver model conversion

commit 21af33ed0319 ("ARM: davinci: omapl138_lcdk: Enable DM_MMC")
wanted to enable DM_MMC only for U-Boot and not for SPL.

But CONFIG_DM_MMC is defined for SPL build too. Because of this
MMC device was not getting registered for SPL causing MMC/SD
boot breakage.

Instead use CONFIG_IS_ENABLED(DM_MMC) which will remain false until
CONFIG_SPL_DM_MMC is defined.

Tested-by: Adam Ford <aford173@gmail.com> #da850evm
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Tested-by: Peter Howard <phoward@gme.net.au> #omapl138_lcdk
5 years agoboard/BuR/common: fix detection for PSC/STM resetcontroller
Hannes Schmelzer [Fri, 10 May 2019 09:22:00 +0000 (11:22 +0200)]
board/BuR/common: fix detection for PSC/STM resetcontroller

Signed-off-by: Hannes Schmelzer <hannes.schmelzer@br-automation.com>
5 years agoMerge git://git.denx.de/u-boot-riscv
Tom Rini [Wed, 5 Jun 2019 14:07:31 +0000 (10:07 -0400)]
Merge git://git.denx.de/u-boot-riscv

- Support Microchip MPFS Icicle board.
- Enable e1000 and nvme support for qemu.
- Enable PCI host ECAM generic driver for qemu.
- Increase the environment size to 128kB for qemu.

5 years agoriscv: Add Microchip MPFS Icicle board support
Padmarao Begari [Tue, 28 May 2019 10:17:51 +0000 (15:47 +0530)]
riscv: Add Microchip MPFS Icicle board support

This patch adds Microchip MPFS Icicle board support.
For now, NS16550 serial driver is only enabled.
The Microchip MPFS Icicle defconfig by default builds
U-Boot for M-Mode with SMP support.

Signed-off-by: Padmarao Begari <padmarao.begari@microchip.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
5 years agoriscv: qemu: Enable e1000 and nvme support
Bin Meng [Wed, 15 May 2019 15:42:59 +0000 (08:42 -0700)]
riscv: qemu: Enable e1000 and nvme support

Since we have added the PCI support to the 'virt' target, enable
e1000 and NVME as alternate network and storage devices for these
virtio based devices.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Tested-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
5 years agoriscv: qemu: Enable PCI host ECAM generic driver
Bin Meng [Wed, 15 May 2019 15:42:58 +0000 (08:42 -0700)]
riscv: qemu: Enable PCI host ECAM generic driver

QEMU 4.0.0 'virt' target integrates a generic ECAM PCI host.
Enable the driver for it.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Tested-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
5 years agoriscv: increase the environment size for the qemu-riscv platform to 128kB
Karsten Merker [Sun, 5 May 2019 21:36:29 +0000 (23:36 +0200)]
riscv: increase the environment size for the qemu-riscv platform to 128kB

The existing default size of 4kB is too small as the default environment
has already nearly that size and defining a single additional environment
variable can exceed the available space.

Signed-off-by: Karsten Merker <merker@debian.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agocmd: env: add -nv option for UEFI non-volatile variable
AKASHI Takahiro [Tue, 4 Jun 2019 06:52:11 +0000 (15:52 +0900)]
cmd: env: add -nv option for UEFI non-volatile variable

With this option, -nv, at "setenv -e" command, a variable will be defined
as non-volatile.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agocmd: efidebug: make some boot variables non-volatile
AKASHI Takahiro [Tue, 4 Jun 2019 06:52:10 +0000 (15:52 +0900)]
cmd: efidebug: make some boot variables non-volatile

Boot####, BootOrder and BootNext should be non-volatile.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: bootmgr: make BootNext non-volatile
AKASHI Takahiro [Tue, 4 Jun 2019 06:52:09 +0000 (15:52 +0900)]
efi_loader: bootmgr: make BootNext non-volatile

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: variable: support non-volatile attribute
AKASHI Takahiro [Tue, 4 Jun 2019 06:52:06 +0000 (15:52 +0900)]
efi_loader: variable: support non-volatile attribute

The attribute, EFI_VARIABLE_NON_VOLATILE, should be encoded as "nv" flag
in U-Boot variable if specified.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: notify memory map changes
Heinrich Schuchardt [Tue, 4 Jun 2019 18:55:12 +0000 (20:55 +0200)]
efi_loader: notify memory map changes

When the memory map is changed signal events of the
EFI_EVENT_GROUP_MEMORY_MAP_CHANGE event group.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agocmd: env: print a message when setting UEFI variable failed
AKASHI Takahiro [Tue, 28 May 2019 00:00:35 +0000 (09:00 +0900)]
cmd: env: print a message when setting UEFI variable failed

Error message will alert a user that setting/deleting a variable failed.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: bootmgr: print a message when loading from BootNext failed
AKASHI Takahiro [Wed, 29 May 2019 18:54:25 +0000 (20:54 +0200)]
efi_loader: bootmgr: print a message when loading from BootNext failed

If a user defines BootNext but not BootOrder and loading from BootNext
fails, you will see only a message like this:
BootOrder not defined

This may confuse a user. Adding an error message will be helpful.

An example output looks like this:

=> efidebug boot add 0001 label1 scsi 0:1 "\path1\file1.efi" "--option foo"
=> efidebug boot add 0002 label2 scsi 0:1 "\path2\file2.efi" "--option bar"
=> efidebug boot add 0003 label3 scsi 0:1 "\path3\file3.efi" "--option no"
=> efidebug boot order 0001 0002
=> efidebug boot next 0003
=> bootefi bootmgr
Loading from Boot0003 'label3' failed
Loading from BootNext failed, falling back to BootOrder
Loading from Boot0001 'label1' failed
Loading from Boot0002 'label2' failed
EFI boot manager: Cannot load any image

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Adjust messages.
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: close protocols in UnloadImage()
Heinrich Schuchardt [Sun, 2 Jun 2019 18:02:32 +0000 (20:02 +0200)]
efi_loader: close protocols in UnloadImage()

When UnloadImage() is called all protocols opened by the image have to be
closed.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: fix EnableCursor()
Heinrich Schuchardt [Sun, 2 Jun 2019 20:54:28 +0000 (22:54 +0200)]
efi_loader: fix EnableCursor()

The EnableCursor() service of the simple text output protocol must update
the the CursorVisible field of the output mode.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: check timer events in Stall()
Heinrich Schuchardt [Sun, 2 Jun 2019 19:12:17 +0000 (21:12 +0200)]
efi_loader: check timer events in Stall()

During a call to Stall() we should periodically check for timer events.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agolib: time: export usec_to_tick()
Heinrich Schuchardt [Sun, 2 Jun 2019 19:02:10 +0000 (21:02 +0200)]
lib: time: export usec_to_tick()

In the UEFI Stall() boottime service we need access to usec_to_tick().

Export the function.

Remove redundant implementation in arch/arm/mach-rockchip/rk_timer.c.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: DisconnectController() with no driver
Heinrich Schuchardt [Sat, 1 Jun 2019 23:43:33 +0000 (01:43 +0200)]
efi_loader: DisconnectController() with no driver

If DisconnectController() is called and no driver is managing
ControllerHandle, return EFI_SUCCESS.

UEFI SCT II 2017, 3.3.12 DisconnectController(), 5.1.3.12.4 - 5.1.3.12.6

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoMerge git://git.denx.de/u-boot-marvell
Tom Rini [Tue, 4 Jun 2019 12:03:41 +0000 (08:03 -0400)]
Merge git://git.denx.de/u-boot-marvell

- Enable MMC in SPL to enable DM MMC booting on helios4 (Dennis)

5 years agoarm: mvebu: helios4: add MMC to SPL DT
Dennis Gilmore [Wed, 29 May 2019 14:36:13 +0000 (09:36 -0500)]
arm: mvebu: helios4: add MMC to SPL DT

This allows SPL to load the main U-Boot image from MMC once DM_MMC is
enabled.

Signed-off-by: Dennis Gilmore <dennis@ausil.us>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agoMerge tag 'efi-2019-07-rc4' of git://git.denx.de/u-boot-efi
Tom Rini [Sun, 2 Jun 2019 22:19:45 +0000 (18:19 -0400)]
Merge tag 'efi-2019-07-rc4' of git://git.denx.de/u-boot-efi

Pull request for UEFI sub-system for v2019.07-rc4

Corrections for boottime services for protocols and for the SetTime()
service are provided.

Error messages for the 'setenv -e' and 'bootefi bootmgr' commands are
added.

5 years agoMerge branch 'master' of git://git.denx.de/u-boot-net
Tom Rini [Sun, 2 Jun 2019 12:33:10 +0000 (08:33 -0400)]
Merge branch 'master' of git://git.denx.de/u-boot-net

- Basic bug fixes and minor features for 2019.07.

5 years agoefi_selftest: unit test for OpenProtocolInformation()
Heinrich Schuchardt [Sat, 1 Jun 2019 19:00:50 +0000 (21:00 +0200)]
efi_selftest: unit test for OpenProtocolInformation()

Provide a unit test that checks that the open protocol information is
correctly updated when opening and closing protocols.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: CloseProtocol() fix open protocol information
Heinrich Schuchardt [Sat, 1 Jun 2019 18:54:32 +0000 (20:54 +0200)]
efi_loader: CloseProtocol() fix open protocol information

CloseProtocol() must delete all open protocol information records relating
to import parameters not only one.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: open protocol information
Heinrich Schuchardt [Sat, 1 Jun 2019 18:15:10 +0000 (20:15 +0200)]
efi_loader: open protocol information

When a protocol is opened the open protocol information must be updated.
The key fields of the open protocol information records are ImageHandle,
ControllerHandle, and Attributes.

Consider the Attributes field when determining if an open protocol
information record has to be updated or a new one has to be created.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: correct HandleProtocol()
Heinrich Schuchardt [Sat, 1 Jun 2019 17:29:39 +0000 (19:29 +0200)]
efi_loader: correct HandleProtocol()

The UEFI specification requires that when a protocol is opened via
HandleProtocol() the agent handle is the image handle of the EFI firmware
(see chapter on EFI_BOOT_SERVICES.OpenProtocol()).

Let efi_handle_protocol() pass efi_root as agent handle to
efi_open_protocol().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agocmd: mdio: Fix access to arbitrary PHY addresses
Vladimir Oltean [Thu, 30 May 2019 00:08:32 +0000 (03:08 +0300)]
cmd: mdio: Fix access to arbitrary PHY addresses

Alex reported the following:

  "
  I'm doing some MDIO work on a freescale/NXP platform and I bumped into
  errors with this command:
  => mdio r emdio#3 5 3
  Reading from bus emdio#3
  "Synchronous Abort" handler, esr 0x8600000e
  elr: ffffffff862b8000 lr : 000000008200cce4 (reloc)
  ...

  mdio list does not list any PHYs currently because ethernet is using DM
  and the interfaces are not probed at this time.  The PHY does exist
  on the bus though.
  The above scenario works with this commit reverted:
  e55047ec51a662c12ed53ff543ec7cdf158b2137 cmd: mdio: Switch to generic
  helpers when accessing the registers

  The current code using generic helpers only works for PHYs that have
  been registered and show up in bus->phymap and crashes for arbitrary
  IDs.  I find it useful to allow reading from other addresses over MDIO
  too, certainly helpful for people debugging MDIO on various boards.
  "

Fix this by reverting to use the raw MDIO bus operations in case there
is no PHY probed based on DT at the specified address.

This restores the old behavior for these PHYs, which means that the
newly introduced MMD-over-C22 helpers won't be available for them, but
at least they will be accessible again without crashing the system.

Fixes: commit e55047ec51a6 ("cmd: mdio: Switch to generic helpers when accessing the registers")
Reported-by: Alex Marginean <alexm.osslist@gmail.com>
Signed-off-by: Vladimir Oltean <olteanv@gmail.com>
Reviewed-by: Alex Marginean <alexm.osslist@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
5 years agoriscv: sifive: fu540: Enable GEMGXL MGMT driver
Bin Meng [Wed, 22 May 2019 07:09:47 +0000 (00:09 -0700)]
riscv: sifive: fu540: Enable GEMGXL MGMT driver

Enable the new GEMGXL MGMT driver so that GEM 10/100 Mbps works now.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Tested-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
5 years agodm: net: macb: Implement link speed change callback
Bin Meng [Wed, 22 May 2019 07:09:46 +0000 (00:09 -0700)]
dm: net: macb: Implement link speed change callback

At present the link speed change callback is a nop. According to
macb device tree bindings, an optional "tx_clk" is used to clock
the ethernet controller's TX_CLK under different link speed.

In 10/100 MII mode, transmit logic must be clocked from a free
running clock generated by the external PHY. In gigabit GMII mode,
the controller, not the external PHY, must generate the 125 MHz
transmit clock towards the PHY.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Tested-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
5 years agodm: net: macb: Update macb_linkspd_cb() signature
Bin Meng [Wed, 22 May 2019 07:09:45 +0000 (00:09 -0700)]
dm: net: macb: Update macb_linkspd_cb() signature

This updates DM version macb_linkspd_cb() signature for future
expansion, eg: adding an implementation for link speed changes.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
5 years agoclk: sifive: Add clock driver for GEMGXL MGMT
Bin Meng [Wed, 22 May 2019 07:09:44 +0000 (00:09 -0700)]
clk: sifive: Add clock driver for GEMGXL MGMT

This adds a clock driver to support the GEMGXL management IP block
found in FU540 SoCs to control GEM TX clock operation mode for
10/100/1000 Mbps.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Tested-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
5 years agonet: eth-uclass: Support device tree MAC addresses
Thierry Reding [Mon, 20 May 2019 15:59:57 +0000 (17:59 +0200)]
net: eth-uclass: Support device tree MAC addresses

Add the standard Ethernet device tree bindings (imported from v5.0 of
the Linux kernel) and implement support for reading the MAC address for
Ethernet devices in the Ethernet uclass. If the "mac-address" property
exists, the MAC address will be parsed from that. If that property does
not exist, the "local-mac-address" property will be tried as fallback.

MAC addresses from device tree take precedence over the ones stored in
a network interface card's ROM.

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agonet: eth-uclass: Write MAC address to hardware after probe
Thierry Reding [Mon, 20 May 2019 15:59:56 +0000 (17:59 +0200)]
net: eth-uclass: Write MAC address to hardware after probe

In order for the device to use the proper MAC address, which can have
been configured in the environment prior to the device being registered,
ensure that the MAC address is written after the device has been probed.
For devices that are registered before the network stack is initialized,
this is already done during eth_initialize(). If the Ethernet device is
on a bus that is not initialized on early boot, such as PCI, the device
is not available at the time eth_initialize() is called, so we need the
MAC address programming to also happen after probe.

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
5 years agoefi_loader: Kconfig entries for GetTime(), SetTime()
Heinrich Schuchardt [Fri, 31 May 2019 20:56:02 +0000 (22:56 +0200)]
efi_loader: Kconfig entries for GetTime(), SetTime()

The GetTime() and the SetTime() runtime services are not obligatory. So
let's make them customizable.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: handling of daylight saving time
Heinrich Schuchardt [Fri, 31 May 2019 20:08:45 +0000 (22:08 +0200)]
efi_loader: handling of daylight saving time

If SetTime() is meant to set daylight saving time it will be called with
Time.Daylight == EFI_TIME_ADJUST_DAYLIGHT | EFI_TIME_IN_DAYLIGHT.

Return 0 from GetTime() if time is not in daylight because we cannot
determine if we are in a time zone with daylight saving time.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: export efi_set_time()
Heinrich Schuchardt [Fri, 31 May 2019 05:38:29 +0000 (07:38 +0200)]
efi_loader: export efi_set_time()

To let a board implement the runtime version of SetTime() we have to
provide the definition of the weak function in an include.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: check time in SetTime()
Heinrich Schuchardt [Fri, 31 May 2019 05:35:19 +0000 (07:35 +0200)]
efi_loader: check time in SetTime()

The UEFI spec prescribes that we check that the timestamp passed to
SetTime() is checked for validity.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agortc: export rtc_month_days()
Heinrich Schuchardt [Fri, 31 May 2019 05:21:03 +0000 (07:21 +0200)]
rtc: export rtc_month_days()

Export function rtc_month_days() for reuse in the UEFI subsystem.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: correct UninstallProtocolInterface()
Heinrich Schuchardt [Thu, 30 May 2019 18:12:19 +0000 (20:12 +0200)]
efi_loader: correct UninstallProtocolInterface()

When uninstalling a protocol the following steps are needed:
* request all drivers to disconnect
* close protocol for all non-drivers
* check if any open instance of the protocol exists on the handle and
  return EFI_ACCESS_DENIED in this case
* remove the protocol interface

By tort we tested for remaining open protocol instances already after
requesting drivers to disconnect.

With this correction the UEFI SCT II tests for UninstallProtocolInterface()
and ReinstallProtocolInterface are passed.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: avoid crash in OpenProtocol()
Heinrich Schuchardt [Thu, 30 May 2019 12:16:31 +0000 (14:16 +0200)]
efi_loader: avoid crash in OpenProtocol()

When trying to open a protocol exclusively attached drivers have to be
removed. This removes entries in the open protocol information linked list
over which we are looping. As additionally child controllers may have been
removed the only safe thing to do is to restart the loop over the linked
list when a driver is removed.

By observing the return code of DisconnectController() we can eliminate a
loop.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: correct OpenProtocol()
Heinrich Schuchardt [Thu, 30 May 2019 12:16:31 +0000 (14:16 +0200)]
efi_loader: correct OpenProtocol()

If a protocol is opened BY_DRIVER it cannot be opened by another agent
BY_DRIVER.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: registration key in LocateProtocol()
Heinrich Schuchardt [Wed, 29 May 2019 16:06:46 +0000 (18:06 +0200)]
efi_loader: registration key in LocateProtocol()

In LocateProtocol() implement searching by the registration key returned by
RegisterNotifyProtocol().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: factor out efi_check_register_notify_event()
Heinrich Schuchardt [Wed, 29 May 2019 05:46:33 +0000 (07:46 +0200)]
efi_loader: factor out efi_check_register_notify_event()

The code to check if a registration key is a valid key returned by
RegisterProtocolNotify() can be reused. So let us factor it out into a new
function efi_check_register_notify_event().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: bootmgr: print a message when loading from BootNext failed
AKASHI Takahiro [Fri, 24 May 2019 06:59:31 +0000 (15:59 +0900)]
efi_loader: bootmgr: print a message when loading from BootNext failed

If a user defines BootNext but not BootOrder and loading from BootNext
fails, you will see only a message like this:
BootOrder not defined

This may confuse a user. Adding an error message will be helpful.

An example output looks like this:

=> efidebug boot add 0001 label1 scsi 0:1 "\path1\file1.efi" "--option foo"
=> efidebug boot add 0002 label2 scsi 0:1 "\path2\file2.efi" "--option bar"
=> efidebug boot add 0003 label3 scsi 0:1 "\path3\file3.efi" "--option no"
=> efidebug boot order 0001 0002
=> efidebug boot next 0003
=> bootefi bootmgr
Loading from Boot0003 'label3' failed
Loading from BootNext failed, falling back to BootOrder
Loading from Boot0001 'label1' failed
Loading from Boot0002 'label2' failed
EFI boot manager: Cannot load any image

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Adjust messages.
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agocmd: env: print a message when setting UEFI variable failed
AKASHI Takahiro [Tue, 28 May 2019 00:00:35 +0000 (09:00 +0900)]
cmd: env: print a message when setting UEFI variable failed

Error message will alert a user that setting/deleting a variable failed.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoefi_loader: correct notification of protocol installation
Heinrich Schuchardt [Tue, 21 May 2019 16:19:01 +0000 (18:19 +0200)]
efi_loader: correct notification of protocol installation

When a protocol is installed the handle should be queued for the
registration key of each registered event. LocateHandle() should return the
first handle from the queue for the registration key and delete it from the
queue.

Implement the queueing.

Correct the selftest.

With the patch the UEFI SCT tests for LocateHandle() are passed without
failure.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoMerge tag 'rockchip-for-v2019.07-rc3' of git://git.denx.de/u-boot-rockchip
Tom Rini [Fri, 31 May 2019 11:17:09 +0000 (07:17 -0400)]
Merge tag 'rockchip-for-v2019.07-rc3' of git://git.denx.de/u-boot-rockchip

- some fix for rk3399-puma;
- rockchip script make_fit_atf.py cleanup
- Enable TPL for rk3399 orangepi and nanopi4;
- add support for rk3399 boards: Nanopi NEO4, Rockpro64, Rock PI 4;

5 years agoMerge tag 'u-boot-amlogic-20190531' of git://git.denx.de/u-boot-amlogic
Tom Rini [Fri, 31 May 2019 11:16:28 +0000 (07:16 -0400)]
Merge tag 'u-boot-amlogic-20190531' of git://git.denx.de/u-boot-amlogic

- Sync DT with Linux 5.2-rc1 for G12A
- Add USB clock support that was introduced in 5.2-rc1 bindings
- Add currently in-review for Linux eMMC & USB DT for G12A in -u-boot.dtsi
- Fix PHY routing to external PHY when chainloading from a misconfigred bootloader
- Remove useless PHY GPIO reset from q200 board file
- Enable USB support for Amlogic U200 reference board

5 years agoconfigs: u200: enable support for USB Host & Gadget
Neil Armstrong [Fri, 31 May 2019 08:07:56 +0000 (10:07 +0200)]
configs: u200: enable support for USB Host & Gadget

Now the Amlogic G12A DT and drivers are present, enable full USB
on the U200 Reference Design board.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
5 years agoboards: amlogic-g200: remove phy reset
Neil Armstrong [Tue, 28 May 2019 11:15:15 +0000 (13:15 +0200)]
boards: amlogic-g200: remove phy reset

The PHY reset is now handled by the MAC driver, remove this leftover.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
5 years agoARM: meson-gx: Reset GXL/GXM to external PHY when not using internal PHY
Neil Armstrong [Tue, 28 May 2019 11:13:19 +0000 (13:13 +0200)]
ARM: meson-gx: Reset GXL/GXM to external PHY when not using internal PHY

When using External PHY, reset the mux to use the external PHY in case U-Boot
was chainloaded from a misconfigured bootloader.

Fixes: 33e3378091 ("ARM: meson: rework soc arch file to prepare for new SoC")
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
5 years agoARM: dts: Add missing DT for Meson G12A support
Neil Armstrong [Tue, 28 May 2019 08:50:38 +0000 (10:50 +0200)]
ARM: dts: Add missing DT for Meson G12A support

The following DT nodes in the process on review for Linux 5.3,
until Linux 5.3 is tagged, add the missing DT nodes in u-boot specific
DTSI files that will be dropped when the v5.3-rc1 DT is synced again.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
5 years agoclk: meson-g12a: Add PCIE PLL support
Neil Armstrong [Tue, 28 May 2019 08:50:37 +0000 (10:50 +0200)]
clk: meson-g12a: Add PCIE PLL support

The G12A PCIE PLL clock was introduced in Linux 5.2-rc1, and is needed
for USB to operate, add basic support for it and associated gates.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
5 years agoARM: dts: sync Amlogic G12A DT with Linux 5.2-rc1
Neil Armstrong [Tue, 28 May 2019 08:50:36 +0000 (10:50 +0200)]
ARM: dts: sync Amlogic G12A DT with Linux 5.2-rc1

Sync from Linux commit a188339ca5a3 ("Linux 5.2-rc1")

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
5 years agodoc: rockchip: Add doc for rk3399 TPL build/flash
Jagan Teki [Wed, 29 May 2019 08:25:49 +0000 (13:55 +0530)]
doc: rockchip: Add doc for rk3399 TPL build/flash

This patch add documentation for TPL build and flashing steps
for rk3399 boards.

Add full boot log for future reference.

Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
5 years agork3399: nanopi4: Enable TPL
Jagan Teki [Wed, 29 May 2019 08:25:48 +0000 (13:55 +0530)]
rk3399: nanopi4: Enable TPL

Enable TPL for NanoPC T4, NanoPI M4 boards.

Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>