platform/kernel/u-boot.git
6 years agoMerge tag 'signed-efi-next' of git://github.com/agraf/u-boot
Tom Rini [Fri, 13 Oct 2017 13:53:58 +0000 (09:53 -0400)]
Merge tag 'signed-efi-next' of git://github.com/agraf/u-boot

Patch queue for efi - 2017-10-13

This is the second batch of amazing improvements for efi_loader in 2017.11:

  - New self tests to verify our own code
  - A few bug fixes
  - colored text support
  - event and SNP improvements, should get us close to iPXE working

6 years agoefi_selftest: correctly check return values
Heinrich Schuchardt [Thu, 12 Oct 2017 23:00:05 +0000 (01:00 +0200)]
efi_selftest: correctly check return values

When cancelling the timer we should check the return
value provided by the set_timer service.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoMerge git://git.denx.de/u-boot-fsl-qoriq
Tom Rini [Thu, 12 Oct 2017 17:36:58 +0000 (13:36 -0400)]
Merge git://git.denx.de/u-boot-fsl-qoriq

6 years agoMerge git://www.denx.de/git/u-boot-imx
Tom Rini [Thu, 12 Oct 2017 17:36:37 +0000 (13:36 -0400)]
Merge git://www.denx.de/git/u-boot-imx

6 years agoARM: imx6: Add DHCOM i.MX6 PDK board support
Marek Vasut [Mon, 9 Oct 2017 19:51:10 +0000 (21:51 +0200)]
ARM: imx6: Add DHCOM i.MX6 PDK board support

Add support for the DHCOM i.MX6 PDK board. This board has:
- FEC ethernet
- EHCI USB host
- 3x SDMMC

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Stefano Babic <sbabic@denx.de>
6 years agoimx: mx7: spl: remove redundant SATA definitionas
Uri Mashiach [Tue, 10 Oct 2017 06:13:10 +0000 (09:13 +0300)]
imx: mx7: spl: remove redundant SATA definitionas

The i.MX7 SOC doesn't include the SATA interface.

Signed-off-by: Uri Mashiach <uri.mashiach@compulab.co.il>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
6 years agomx6: sys_proto: Add prototypes for imx6_pcie_toggle() functions
Diego Dorta [Thu, 5 Oct 2017 12:15:58 +0000 (09:15 -0300)]
mx6: sys_proto: Add prototypes for imx6_pcie_toggle() functions

When compiling with W=1 errors are observed:

drivers/pci/pcie_imx.c:517:12: warning: no previous prototype for ‘imx6_pcie_toggle_power’ [-Wmissing-prototypes] __weak int imx6_pcie_toggle_power(void)

drivers/pci/pcie_imx.c:528:12: warning: no previous prototype for ‘imx6_pcie_toggle_reset’ [-Wmissing-prototypes] __weak int imx6_pcie_toggle_reset(void)

Remove these warnings by adding the functions prototypes on arch-mx6/sys_proto.

Signed-off-by: Diego Dorta <diego.dorta@nxp.com>
6 years agomx6: clock: Add a prototype for do_mx6_showclocks()
Diego Dorta [Thu, 5 Oct 2017 12:15:57 +0000 (09:15 -0300)]
mx6: clock: Add a prototype for do_mx6_showclocks()

When compiling with W=1 the following warning is observed:

arch/arm/mach-imx/mx6/clock.c:1268:5: warning: no previous prototype for ‘do_mx6_showclocks’ [-Wmissing-prototypes] int do_mx6_showclocks(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])

Remove this warning by adding the function prototype into arch-mx6/clock.h file.

Signed-off-by: Diego Dorta <diego.dorta@nxp.com>
6 years agoi.mx6ul: xpress: update UART init for current board revision
Anatolij Gustschin [Mon, 2 Oct 2017 19:32:55 +0000 (21:32 +0200)]
i.mx6ul: xpress: update UART init for current board revision

UART pinmux has been changed on the last board revision. Change
board pinmux accordingly. Console is on UART7 now, add pinmux,
base address and update console string in environment.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Reviewed-by: Stefano Babic <sbabic@denx.de>
6 years agomx6slevk: Use PARTUUID to specify the rootfs location
Fabio Estevam [Mon, 2 Oct 2017 13:11:37 +0000 (10:11 -0300)]
mx6slevk: Use PARTUUID to specify the rootfs location

mx6slevk can run different kernel versions, such as NXP 4.1 or mainline.

Currently the rootfs location is passed via mmcblk number and the
problem with this approach is that the mmcblk number for the SD
card changes depending on the kernel version.

In order to avoid such issue, use the UUID method to specify the
rootfs location.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
6 years agodrivers: pci: imx: fix imx_pcie_remove function
Sven-Ola Tuecke [Thu, 5 Oct 2017 11:46:42 +0000 (08:46 -0300)]
drivers: pci: imx: fix imx_pcie_remove function

We have at least a minor count of boards, that failed to re-initialize
PCI express in the Linux kernel. Typical failure rate is 20% on affected
boards. This is mitigated by commit 6ecbe1375671 ("drivers: pci: imx:
add imx_pcie_remove function").

However, at least on some i.MX6 custom boards, when calling
assert_core_reset() as part of the first-time PCIe init, read access
to PCIE_PL_PFLR simply hangs. Surround this readl() with
imx_pcie_fix_dabt_handler() does not help. For this reason, the forced
LTSSM detection is only used on the second assert_core_reset() that is
called shorly before starting the Linux kernel.

Signed-off-by: Sven-Ola Tuecke <sven-ola.tuecke@numberfour.eu>
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Tested-by: David Müller <d.mueller@elsoft.ch>
6 years agowandboard: Add support for the latest revd1 revision
Fabio Estevam [Mon, 2 Oct 2017 18:47:29 +0000 (15:47 -0300)]
wandboard: Add support for the latest revd1 revision

Latest wandboard hardware revision is revd1, which brings the following
new features:

- PFUZE100 PMIC
- AR8035 Ethernet PHY
- Upgrade Wifi/BT chip to BCM4339/BCM43430.

The detection mechanism is to probe the PMIC and when it is
found, then the revision of the board is revd1.

As the detection is done via PMIC, we need to print the board version
at a later stage via CONFIG_DISPLAY_BOARDINFO_LATE and also need
to disable CONFIG_DISPLAY_BOARDINFO, which is done much earlier.

Make the necessary adjustments for the AR8035 PHY to work on revd1.

Based on Richard Hu's work from Technexion's U-Boot tree.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
6 years agodoc: update imx_usb_loader URL
Stefan Agner [Tue, 3 Oct 2017 14:43:26 +0000 (16:43 +0200)]
doc: update imx_usb_loader URL

The changes required to use U-Boot's Serial Download Protocol
implementation are now available in upstream imx_usb_loader
repository. Update the URL accordingly.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
6 years agoarm: imx7d: add support for Compulab cl-som-imx7
Ilya Ledvich [Sun, 24 Sep 2017 06:00:25 +0000 (09:00 +0300)]
arm: imx7d: add support for Compulab cl-som-imx7

Add initial support for Compulab cl-som-imx7 SoM.
The initial support includes:
 - MMC
 - eMMC
 - SPI flash
 - I2C
 - FEC
 - USB
 - Serial console

Signed-off-by: Ilya Ledvich <ilya@compulab.co.il>
6 years agoimx: mx7: SPL support for i.MX7
Uri Mashiach [Sun, 24 Sep 2017 06:00:24 +0000 (09:00 +0300)]
imx: mx7: SPL support for i.MX7

Add configuration file and spl_boot_device function for the i.MX7 SPL.

Signed-off-by: Uri Mashiach <uri.mashiach@compulab.co.il>
6 years agoimx: mx7: DDR controller configuration for the i.MX7 architecture
Uri Mashiach [Sun, 24 Sep 2017 06:00:23 +0000 (09:00 +0300)]
imx: mx7: DDR controller configuration for the i.MX7 architecture

The configuration files imximage.cfg are used for the DDR controller
configuration.
Add DDR configuration function to replace the DDR controller
configuration in the imximage.cfg file. The function can be used for
DDR size detection.

Signed-off-by: Uri Mashiach <uri.mashiach@compulab.co.il>
6 years agoimx: mx7: fix the CCM_ macros
Uri Mashiach [Sun, 24 Sep 2017 06:00:22 +0000 (09:00 +0300)]
imx: mx7: fix the CCM_ macros

The CCM_ macros use the CCM_BASE_ADDRESS macro, which doesn't exist.
Replace the CCM_BASE_ADDRESS macros with CCM_BASE_ADDR.

Signed-off-by: Uri Mashiach <uri.mashiach@compulab.co.il>
Acked-by: Igor Grinberg <grinberg@compulab.co.il>
6 years agoicorem6_rqs: env: Return mmc devno
Jagan Teki [Thu, 28 Sep 2017 17:59:14 +0000 (23:29 +0530)]
icorem6_rqs: env: Return mmc devno

Instead of changing mmc devno from dts nodes better
to return the detected devno so-that env trigger the same.

Cc: Stefano Babic <sbabic@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
6 years agoicore: configs: Fix merge conflict issue
Jagan Teki [Thu, 28 Sep 2017 17:59:13 +0000 (23:29 +0530)]
icore: configs: Fix merge conflict issue

Fix for finding mmc devices on i.MX6Q icore boards
added in below comment
"icorem6: Fix to find MMC devices"
(sha1: a2b137b38d925df91afef52f5122927de024f81a)

which is reverted in during u-boot-imx merge
" Merge git://git.denx.de/u-boot-imx"
(sha1: 6aee2ab68c362ace5a59f89a63abed82e0bf19e5)

This patch, is recreated to fix merge conflict.

Cc: Stefano Babic <sbabic@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
6 years agotopic_miami: Remove CONFIG_CMD_BOOTZ undef
Fabio Estevam [Thu, 28 Sep 2017 19:46:00 +0000 (16:46 -0300)]
topic_miami: Remove CONFIG_CMD_BOOTZ undef

CONFIG_CMD_BOOTZ option has been converted to defconfig, so there
is no need to undefine it in board config file anymore.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
6 years agomx6sabresd: Include <usb/ehci-ci.h> header file
Diego Dorta [Wed, 27 Sep 2017 16:12:40 +0000 (13:12 -0300)]
mx6sabresd: Include <usb/ehci-ci.h> header file

When compiling with W=1 the following warning is observed:

board/freescale/mx6sabresd/mx6sabresd.c:586:5: warning: no previous prototype for ‘board_ehci_hcd_init’ [-Wmissing-prototypes] int board_ehci_hcd_init(int port)

Remove this warning by including <usb/ehci-ci.h>.

Signed-off-by: Diego Dorta <diego.dorta@nxp.com>
6 years agousb: ehci-ci: Add a prototype for board_ehci_power()
Diego Dorta [Wed, 27 Sep 2017 16:12:39 +0000 (13:12 -0300)]
usb: ehci-ci: Add a prototype for board_ehci_power()

When compiling with W=1 the following warning is observed:

board/freescale/mx6sabresd/mx6sabresd.c:601:5: warning: no previous prototype for ‘board_ehci_power’ [-Wmissing-prototypes] int board_ehci_power(int port, int on)

Remove this warning by adding the function prototype into usb/ehci-ci.h file.

Signed-off-by: Diego Dorta <diego.dorta@nxp.com>
6 years agomx6sabresd: Include <asm/mach-imx/spi.h> header file
Diego Dorta [Wed, 27 Sep 2017 16:12:38 +0000 (13:12 -0300)]
mx6sabresd: Include <asm/mach-imx/spi.h> header file

When compiling with W=1 the following warning is observed:

board/freescale/mx6sabresd/mx6sabresd.c:680:5: warning: no previous prototype for ‘board_spi_cs_gpio’ [-Wmissing-prototypes] int board_spi_cs_gpio(unsigned bus, unsigned cs)

Remove this warning by including <asm/mach-imx/spi.h>.

Signed-off-by: Diego Dorta <diego.dorta@nxp.com>
6 years agomx6: soc: Include <asm/bootm.h> header file
Diego Dorta [Wed, 27 Sep 2017 16:12:37 +0000 (13:12 -0300)]
mx6: soc: Include <asm/bootm.h> header file

When compiling with W=1 the following warning is observed:

arch/arm/mach-imx/mx6/soc.c:213:12: warning: no previous prototype for ‘get_board_rev’ [-Wmissing-prototypes] u32 __weak get_board_rev(void)

Fix the build warning by including <asm/bootm.h>.

Signed-off-by: Diego Dorta <diego.dorta@nxp.com>
6 years agomx7ulp_evk: Move CONFIG_CMD_BOOTZ to Kconfig
Fabio Estevam [Wed, 27 Sep 2017 18:00:41 +0000 (15:00 -0300)]
mx7ulp_evk: Move CONFIG_CMD_BOOTZ to Kconfig

CONFIG_CMD_BOOTZ symbol does not work in board config file
anymore, so fix this by moving it to Kconfig.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
6 years agoimx: sys_proto: Add a prototype for board_mmc_get_env_dev()
Diego Dorta [Thu, 21 Sep 2017 18:10:03 +0000 (15:10 -0300)]
imx: sys_proto: Add a prototype for board_mmc_get_env_dev()

When compiling with W=1 the following warning is observed:

board/freescale/mx6sabresd/mx6sabresd.c:266:5: warning:
no previous prototype for ‘board_mmc_get_env_dev’
[-Wmissing-prototypes] int board_mmc_get_env_dev(int devno)

Remove this warning by adding the function prototype into sys_proto.h file.

Signed-off-by: Diego Dorta <diego.dorta@nxp.com>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Stefano Babic <sbabic@denx.de>
6 years agoimx: Include <input.h> header file
Diego Dorta [Fri, 22 Sep 2017 15:12:18 +0000 (12:12 -0300)]
imx: Include <input.h> header file

When building with W=1 errors like the one below is seen:

board/freescale/mx6sabresd/mx6sabresd.c:546:5: warning:
no previous prototype for ‘overwrite_console’
[-Wmissing-prototypes] int overwrite_console(void)

Fix the build warnings by including <input.h>.

Signed-off-by: Diego Dorta <diego.dorta@nxp.com>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
6 years agomx6: toradex: Remove custom CONFIG_SPL_PAD_TO definition
Fabio Estevam [Mon, 25 Sep 2017 18:20:56 +0000 (15:20 -0300)]
mx6: toradex: Remove custom CONFIG_SPL_PAD_TO definition

CONFIG_SPL_PAD_TO is already defined inside "imx6_spl.h", so there
is no need to redefine it in the board config files.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Stefan Agner <stefan.agner@toradex.com>
6 years agomx25pdk: Remove duplicated define
Otavio Salvador [Sat, 30 Sep 2017 01:55:00 +0000 (22:55 -0300)]
mx25pdk: Remove duplicated define

The CONFIG_SYS_MMC_ENV_DEV is duplicated, drop it.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
6 years agomx25pdk: Use generic filesystem commands
Otavio Salvador [Sat, 30 Sep 2017 01:54:59 +0000 (22:54 -0300)]
mx25pdk: Use generic filesystem commands

This rework the board to use the generic filesystem commands instead
of forcing the use of FAT for the boot files.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
6 years agoREADME.imx6: Prefer loading SPL via the new SDP mechanism
Fabio Estevam [Wed, 20 Sep 2017 14:21:49 +0000 (11:21 -0300)]
README.imx6: Prefer loading SPL via the new SDP mechanism

Now that it is possible to load SPL and u-boot.img via imx_usb_loader
tool, mention this method instead of the old one that relied on ymodem.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
6 years agomx53loco: Let CONFIG_DISPLAY_CPUINFO be selected
Fabio Estevam [Tue, 19 Sep 2017 17:46:29 +0000 (14:46 -0300)]
mx53loco: Let CONFIG_DISPLAY_CPUINFO be selected

With CONFIG_DISPLAY_CPUINFO=y we get a "Reset cause" line, which
brings important information of the reboot cause.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
6 years agoimx6: disable clock command and print_cpuinfo code in SPL
Anatolij Gustschin [Mon, 28 Aug 2017 19:46:26 +0000 (21:46 +0200)]
imx6: disable clock command and print_cpuinfo code in SPL

We do not use print_cpuinfo and clock command code in SPL,
disable it when building SPL image.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
6 years agocolibri_imx6: Avoid calling setup_display() from SPL code
Fabio Estevam [Sat, 23 Sep 2017 02:45:33 +0000 (23:45 -0300)]
colibri_imx6: Avoid calling setup_display() from SPL code

There is no need call setup_display() from SPL code, so move it to
board_init(), which executes only in U-Boot proper.

Reported-by: Stefano Babic <sbabic@denx.de>
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
6 years agoapalis_imx6: Avoid calling setup_display() from SPL code
Fabio Estevam [Sat, 23 Sep 2017 02:45:32 +0000 (23:45 -0300)]
apalis_imx6: Avoid calling setup_display() from SPL code

There is no need call setup_display() from SPL code, so move it to
board_init(), which executes only in U-Boot proper.

Reported-by: Stefano Babic <sbabic@denx.de>
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
6 years agomx6cuboxi: Avoid calling setup_display() from SPL code
Fabio Estevam [Sat, 23 Sep 2017 02:45:31 +0000 (23:45 -0300)]
mx6cuboxi: Avoid calling setup_display() from SPL code

There is no need call setup_display() from SPL code, so move it to
board_init(), which executes only in U-Boot proper.

Reported-by: Stefano Babic <sbabic@denx.de>
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Stefano Babic <sbabic@denx.de>
6 years agowandboard: Avoid calling setup_display() from SPL code
Fabio Estevam [Sat, 23 Sep 2017 02:45:30 +0000 (23:45 -0300)]
wandboard: Avoid calling setup_display() from SPL code

There is no need call setup_display() from SPL code, so move it to
board_init(), which executes only in U-Boot proper.

Reported-by: Stefano Babic <sbabic@denx.de>
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Stefano Babic <sbabic@denx.de>
6 years agocgtqmx6eval: Avoid calling setup_display() from SPL code
Fabio Estevam [Sat, 23 Sep 2017 02:45:29 +0000 (23:45 -0300)]
cgtqmx6eval: Avoid calling setup_display() from SPL code

There is no need call setup_display() from SPL code, so move it to
board_init(), which executes only in U-Boot proper.

Reported-by: Stefano Babic <sbabic@denx.de>
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Stefano Babic <sbabic@denx.de>
6 years agomx6sabresd: Avoid calling setup_display() from SPL code
Fabio Estevam [Sat, 23 Sep 2017 02:45:28 +0000 (23:45 -0300)]
mx6sabresd: Avoid calling setup_display() from SPL code

There is no need call setup_display() from SPL code, so move it to
board_init(), which executes only in U-Boot proper.

Reported-by: Stefano Babic <sbabic@denx.de>
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Stefano Babic <sbabic@denx.de>
6 years agoefi_loader: console support for color attributes
Rob Clark [Tue, 10 Oct 2017 12:23:01 +0000 (08:23 -0400)]
efi_loader: console support for color attributes

Shell.efi uses this, and supporting color attributes makes things look
nicer.  Map the EFI fg/bg color attributes to ANSI escape sequences.
Not all colors have a perfect match, but spec just says "Devices
supporting a different number of text colors are required to emulate the
above colors to the best of the device’s capabilities".

Signed-off-by: Rob Clark <robdclark@gmail.com>
Tested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Alexander Graf <agraf@suse.de>
[agraf: s/unsigned/unsigned int/]
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: Add mem-mapped for fallback
Rob Clark [Tue, 10 Oct 2017 12:23:06 +0000 (08:23 -0400)]
efi_loader: Add mem-mapped for fallback

When we don't have a real device/image path, such as 'bootefi hello',
construct a mem-mapped device-path.

This fixes 'bootefi hello' after devicepath refactoring.

Fixes: 95c5553ea2 ("efi_loader: refactor boot device and loaded_image handling")
Signed-off-by: Rob Clark <robdclark@gmail.com>
Acked-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoMerge git://git.denx.de/u-boot-i2c
Tom Rini [Wed, 11 Oct 2017 12:38:20 +0000 (08:38 -0400)]
Merge git://git.denx.de/u-boot-i2c

6 years agoi2c: muxes: pca954x: look up width from chip_desc
Chris Packham [Thu, 28 Sep 2017 21:53:36 +0000 (10:53 +1300)]
i2c: muxes: pca954x: look up width from chip_desc

Commit 8e6eda7cda6c ("drivers/i2c/muxes/pca954x: Add pca9547 I2C mux
support") introduced a chip_desc for the pca954x devices but failed to
update pca954x_ofdata_to_platdata() to be aware of it. Make
pca954x_ofdata_to_platdata() lookup the chip_desc to validate the device
width.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Marek Behun <marek.behun@nic.cz>
6 years agoMerge branch 'rmobile' of git://git.denx.de/u-boot-sh
Tom Rini [Wed, 11 Oct 2017 00:14:38 +0000 (20:14 -0400)]
Merge branch 'rmobile' of git://git.denx.de/u-boot-sh

6 years agoconfigs: Re-sync CONFIG_CMD_IMLS with moveconfig
Tuomas Tynkkynen [Sun, 8 Oct 2017 18:48:02 +0000 (21:48 +0300)]
configs: Re-sync CONFIG_CMD_IMLS with moveconfig

The option is specified in Kconfig, but still a few config header files
are overriding the choice by #undef'ing it. Re-sync the option with
moveconfig to rid of the #undefs.

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
6 years agocmd: Toggle the default value of CONFIG_CMD_IMLS
Tuomas Tynkkynen [Sun, 8 Oct 2017 18:48:01 +0000 (21:48 +0300)]
cmd: Toggle the default value of CONFIG_CMD_IMLS

Having this as a 'default y' is rather annoying because it doesn't
actually compile unless other options are defined in the board header:

../cmd/bootm.c: In function 'do_imls_nor':
../cmd/bootm.c:330:7: error: 'CONFIG_SYS_MAX_FLASH_BANKS' undeclared (first use in this function); did you mean 'CONFIG_SYS_MAX_FLASH_SECT'?
   i < CONFIG_SYS_MAX_FLASH_BANKS; ++i, ++info) {

Make it 'default n' so people who develop new boards that start from a
blank defconfig have one less compilation failure to debug.

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
6 years agoefi_loader: don't increment part twice per loop
Jonathan Gray [Tue, 10 Oct 2017 10:32:29 +0000 (21:32 +1100)]
efi_loader: don't increment part twice per loop

Correct a mistake in the part number handling of commit
16a73b249d138fedeb188710533902ed7aac1ddc and only increment part once
per loop.

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Tested-by: Peter Robinson <pbrobinson@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: MAX_UTF8_PER_UTF16 = 3
Heinrich Schuchardt [Mon, 9 Oct 2017 19:09:05 +0000 (21:09 +0200)]
efi_loader: MAX_UTF8_PER_UTF16 = 3

The constant MAX_UTF8_PER_UTF16 is used to calculate
required memory when converting from UTF-16 to UTF-8.
If this constant is too big we waste memory.

A code point encoded by one UTF-16 symbol is converted to a
maximum of three UTF-8 symbols, e.g.

0xffff could be encoded as 0xef 0xbf 0xbf.
The first byte carries four bits, the second and third byte
carry six bits each.

A code point encoded by two UTF-16 symbols is converted to four
UTF-8 symbols.

So in this case we need a maximum of two UTF-8 symbols per
UTF-16 symbol.

As the overall maximum is three UTF-8 symobls per UTF-16 symbol
we need MAX_UTF8_PER_UTF16 = 3.

Fixes: 78178bb0c9d lib: add some utf16 handling helpers
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: search all possible disk partitions
Jonathan Gray [Tue, 10 Oct 2017 02:55:26 +0000 (13:55 +1100)]
efi_loader: search all possible disk partitions

When searching for partitions don't stop if a partition is not present
for a given partition number as there may be valid partitions after.

Search for up to MAX_SEARCH_PARTITIONS matching the other callers of
part_get_info().

This allows OpenBSD to boot via the efi_loader on rpi_3 again after
changes made after U-Boot 2017.09.  With MBR partitioning OpenBSD will
by default use the fourth partition for the 0xA6 (OpenBSD) partition.

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoMerge git://git.denx.de/u-boot-dm
Tom Rini [Tue, 10 Oct 2017 00:19:39 +0000 (20:19 -0400)]
Merge git://git.denx.de/u-boot-dm

6 years agoARM: rmobile: dts: Add SDR104/HS200 to Salvator-X
Marek Vasut [Fri, 6 Oct 2017 12:08:00 +0000 (14:08 +0200)]
ARM: rmobile: dts: Add SDR104/HS200 to Salvator-X

Add DT nodes to enable SDR104/HS200 modes on Salvator-X boards.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
6 years agoARM: rmobile: Fixup ULCB CPLD support after PFC rework
Marek Vasut [Wed, 4 Oct 2017 01:03:50 +0000 (03:03 +0200)]
ARM: rmobile: Fixup ULCB CPLD support after PFC rework

The ULCB CPLD support was not updated during the PFC table rework,
fix up the GPIO numbers until the CPLD support is rewritten to a
proper DM capable and DT probing driver.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
6 years agoMerge git://git.denx.de/u-boot-video
Tom Rini [Mon, 9 Oct 2017 17:31:33 +0000 (13:31 -0400)]
Merge git://git.denx.de/u-boot-video

6 years agoarmv8: ls1043ardb_sdcard: prepare falcon boot
York Sun [Thu, 28 Sep 2017 15:42:16 +0000 (08:42 -0700)]
armv8: ls1043ardb_sdcard: prepare falcon boot

Due to a conflict with recent Primary Protected Application (PPA),
PPA cannot be loaded for SPL stage, falcon boot is not enabled by
default. With compatible PPA image, to enable falcon boot, activate
these Kconfig options in defconfig
CONFIG_SPL_FIT=y
CONFIG_SPL_FSL_LS_PPA=y
CONFIG_SPL_GZIP=y
CONFIG_SPL_LOAD_FIT=y
CONFIG_SPL_OS_BOOT=y
CONFIG_SPL_OF_LIBFDT=y

Because environment variables are not avaiable during SPL stage for
SD boot, set "boot_os=y" as default.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoarmv8: ls1043ardb: Enable spl_board_init() function
York Sun [Thu, 28 Sep 2017 15:42:15 +0000 (08:42 -0700)]
armv8: ls1043ardb: Enable spl_board_init() function

CONFIG_SPL_BOARD_INIT is used for SPL boot. Enable it in defconfig
for LS1043ARDB SPL targets.

Signed-off-by: York Sun <york.sun@nxp.com>
6 years agoarmv8: layerscape: Enable falcon boot
York Sun [Thu, 28 Sep 2017 15:42:14 +0000 (08:42 -0700)]
armv8: layerscape: Enable falcon boot

Add jump_to_image_linux() for arm64. Add "noreturn" flag to
armv8_switch_to_el2(). Add hooks to fsl-layerscape to enable falcon
boot.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Łukasz Majewski <lukma@denx.de>
Tested-by: Łukasz Majewski <lukma@denx.de>
6 years agoarmv8: ls1043ardb: Use static DDR setting for SPL boot
York Sun [Thu, 28 Sep 2017 15:42:13 +0000 (08:42 -0700)]
armv8: ls1043ardb: Use static DDR setting for SPL boot

This board has soldered DDR chips. To reduce the SPL image size,
use static DDR setting instead of dynamic DDR driver.

Signed-off-by: York Sun <york.sun@nxp.com>
6 years agoarmv8: fsl-layerscape: Avoid running dram_init_banksize again
York Sun [Thu, 28 Sep 2017 15:42:12 +0000 (08:42 -0700)]
armv8: fsl-layerscape: Avoid running dram_init_banksize again

gd->ram_size is reduced in this function to reserve secure memory.
Avoid running this function again to further reduce memory size.
This fixes issue for SPL boot with PPA image loaded in which case
secure memory is incorrectly allocated due to repeated calling.

Signed-off-by: York Sun <york.sun@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agocmd: spl: fix compiling error when CONFIG_CMD_SPL_WRITE_SIZE not defined
York Sun [Thu, 28 Sep 2017 15:42:11 +0000 (08:42 -0700)]
cmd: spl: fix compiling error when CONFIG_CMD_SPL_WRITE_SIZE not defined

CONFIG_CMD_SPL_WRITE_SIZE is used for writing parameters to non-volatile
storage. So far it is only used for NAND. Fix compiling error when this
macro is not used for SD.

Signed-off-by: York Sun <york.sun@nxp.com>
CC: Anatolij Gustschin <agust@denx.de>
6 years agospl: fix assignment of board info to global data
York Sun [Thu, 28 Sep 2017 15:42:10 +0000 (08:42 -0700)]
spl: fix assignment of board info to global data

Commit 15eb1d43bf47 ("spl: reorder the assignment of board info to
global data") intended to move assignment of board info earlier,
into board_init_r(). However, function preload_console_init() is
called either from spl_board_init() or from board_init_f(). For the
latter case, the board info assignment is much earlier than proposed
board_init_r(). Create a new function to fill gd->bd and call this
function when needed.

Signed-off-by: York Sun <york.sun@nxp.com>
CC: Lokesh Vutla <lokeshvutla@ti.com>
CC: Ravi Babu <ravibabu@ti.com>
CC: Lukasz Majewski <lukma@denx.de>
CC: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoarmv8: ls1088a: Update MC boot sequence
Bogdan Purcareata [Thu, 5 Oct 2017 06:56:53 +0000 (06:56 +0000)]
armv8: ls1088a: Update MC boot sequence

The MC boot sequence is contained in mc_env_boot. Update LS1088A
boards to use this function, and hook it to reset_phy so that it's
called late enough, after the ports have been initialized, for
proper DPC / DPL fixup.

Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
6 years agoarmv8: fsl-layerscape: Allocate Secure memory from first ddr region
Sumit Garg [Tue, 3 Oct 2017 21:50:49 +0000 (03:20 +0530)]
armv8: fsl-layerscape: Allocate Secure memory from first ddr region

This change is required due to trusted OS (OP-TEE) not being position
independent code, it requires compile time fixed base address.

To take care of this it is assumed that all layerscape armv8 platforms
has minimum 2G ddr in first region. So we can have fixed address
space (66 MB -> (2MB for PPA + 64MB for trusted OS)) allocated from
top of first 2G ddr region and compile trusted OS with this fixed
base address.

But one exception here is ls1012 where we have only 1G (rdb) or 512M
(frdm) ddr memory. For those we can have different fixed compile time
base addresses for trusted OS.

Signed-off-by: Sumit Garg <sumit.garg@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
6 years agoarmv7: ls1021aiot: Move CONFIG_CMD_BOOTZ to Kconfig
Fabio Estevam [Thu, 28 Sep 2017 16:24:30 +0000 (13:24 -0300)]
armv7: ls1021aiot: Move CONFIG_CMD_BOOTZ to Kconfig

CONFIG_CMD_BOOTZ symbol does not work in board config file
anymore, so fix this by moving it to Kconfig.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
6 years agoarmv8: Apply workaround for USB erratum A-009007 to LS1088A
Ran Wang [Fri, 22 Sep 2017 07:21:34 +0000 (15:21 +0800)]
armv8: Apply workaround for USB erratum A-009007 to LS1088A

Rx Compliance tests may fail intermittently at high jitter
frequencies using default register values.

Program register USB_PHY_RX_OVRD_IN_HI in certain sequence
to make the Rx compliance test pass.

Signed-off-by: Ran Wang <ran.wang_1@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
6 years agoarmv8: ls1046aqds: Fix NAND offset for Fman ucode and env
Gong Qianyu [Mon, 18 Sep 2017 08:59:28 +0000 (16:59 +0800)]
armv8: ls1046aqds: Fix NAND offset for Fman ucode and env

Fix a bug of 'commit 8104deb2d6b7 ("armv8: layerscape: Adjust memory
mapping for Flash/SD card on LS1046A")' as NAND block size is 256KB
on LS1046AQDS.

Signed-off-by: Gong Qianyu <Qianyu.Gong@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
6 years agoefi_selftest: error handling in SNP test
Heinrich Schuchardt [Sun, 8 Oct 2017 04:57:28 +0000 (06:57 +0200)]
efi_selftest: error handling in SNP test

Avoid NULL pointer dereference after setup failed due to a
missing network.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: comments for functions add missing @return
Heinrich Schuchardt [Sun, 8 Oct 2017 04:57:27 +0000 (06:57 +0200)]
efi_loader: comments for functions add missing @return

For some functions the @return description is missing.

Fix typo.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: Fix disk dp's for pre-DM/legacy devices
Rob Clark [Sun, 8 Oct 2017 15:33:08 +0000 (11:33 -0400)]
efi_loader: Fix disk dp's for pre-DM/legacy devices

This fixes an issue with OpenBSD's bootloader, and I think should also
fix a similar issue with grub2 on legacy devices.  In the legacy case
we were creating disk objects for the partitions, but not also the
parent device.

Reported-by: Jonathan Gray <jsg@jsg.id.au>
Signed-off-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: avoid NULL dereference in efi_dp_match
Heinrich Schuchardt [Sun, 8 Oct 2017 04:57:26 +0000 (06:57 +0200)]
efi_loader: avoid NULL dereference in efi_dp_match

When calling bootefi hello twice a kernel dump occurs.

Neither bootefi hello nor bootefi selftest have an image
device patch. So do not try to dereference the NULL
value.

Fixes: 95c5553ea26 efi_loader: refactor boot device and loaded_image handling
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_selftest: avoid dereferencing NULL in tpl test
Heinrich Schuchardt [Sun, 8 Oct 2017 04:57:25 +0000 (06:57 +0200)]
efi_selftest: avoid dereferencing NULL in tpl test

The task priority levels test uses two events one passes the
notification counter as context. The other passes NULL.
Both use the same notification function. So we need to check
for NULL here.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_selftest: efi_st_memcmp return difference of bytes
Heinrich Schuchardt [Fri, 6 Oct 2017 18:39:13 +0000 (20:39 +0200)]
efi_selftest: efi_st_memcmp return difference of bytes

If the memory regions are different efi_st_memcmp currently
returns the difference of the addresses. Insted the
difference of the first differing byte pair should be
returned.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: supply EFI network test
Heinrich Schuchardt [Thu, 5 Oct 2017 14:36:07 +0000 (16:36 +0200)]
efi_loader: supply EFI network test

This patch provides an EFI application to check the correct function
of the Simple Network Protocol implementation.

It sends a DHCP request and analyzes the DHCP offer.

Different error conditions including a 10s timeout are checked.

A successful execution will look like this:

=> bootefi nettest
Scanning disk ide.blk#0...
Found 1 disks
WARNING: Invalid device tree, expect boot to fail
Network test
DHCP Discover
DHCP reply received from 192.168.76.2 (52:55:c0:a8:4c:02)
as broadcast message.
OK. The test was completed successfully.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_selftest: allow printing MAC addresses
Heinrich Schuchardt [Thu, 5 Oct 2017 14:36:06 +0000 (16:36 +0200)]
efi_selftest: allow printing MAC addresses

Add %pm as format string to print a MAC address.
This is helpful when analyzing network problems.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_selftest: correct definition of efi_st_error
Heinrich Schuchardt [Thu, 5 Oct 2017 14:36:05 +0000 (16:36 +0200)]
efi_selftest: correct definition of efi_st_error

Enclose definition in parantheses to allow using efi_st_error
like a void function.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: fill return values in SimpleNetworkProtocol
Heinrich Schuchardt [Thu, 5 Oct 2017 14:36:04 +0000 (16:36 +0200)]
efi_loader: fill return values in SimpleNetworkProtocol

In the receive function all return values should be filled.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: size fields in SimpleNetworkProtocol
Heinrich Schuchardt [Thu, 5 Oct 2017 14:36:03 +0000 (16:36 +0200)]
efi_loader: size fields in SimpleNetworkProtocol

The size fields in the Simple Network Protocol are all
UINTN in the UEFI spec. So use size_t.

Provide a function description of the receive function.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: fix efi_net_get_status
Heinrich Schuchardt [Thu, 5 Oct 2017 14:36:02 +0000 (16:36 +0200)]
efi_loader: fix efi_net_get_status

The returned interrupt status was wrong.

As out transmit buffer is empty we need to always set
EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT.

When we have received a packet we need to set
EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT.

Furthermore we should call efi_timer_check() to handle events.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: implement WaitForPacket event
Heinrich Schuchardt [Thu, 5 Oct 2017 14:36:01 +0000 (16:36 +0200)]
efi_loader: implement WaitForPacket event

The WaitForPacket event informs that a network package has been
received by the SimpleNetworkProtocol.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
[agraf: Move is_signaled = true line into efi_net_push()]
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: use events for efi_net_receive
Heinrich Schuchardt [Thu, 5 Oct 2017 14:36:00 +0000 (16:36 +0200)]
efi_loader: use events for efi_net_receive

A timer event is defined. The timer handler cares for receiving new
packets.

efi_timer_check is called both in efi_net_transmit and efi_net_receive
to enable events during network communication.

Calling efi_timer_check in efi_net_get_status is implemented in a
separate patch.

[agraf] This patch is needed to make efi_net_get_status() actually
        report incoming packets.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
[agraf: fix spelling in comment]
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_net: return EFI_UNSUPPORTED where appropriate
Heinrich Schuchardt [Thu, 5 Oct 2017 14:35:59 +0000 (16:35 +0200)]
efi_net: return EFI_UNSUPPORTED where appropriate

U-Boot does not implement all functions of the simple network
protocol. The unimplemented functions return either of
EFI_SUCCESS and EFI_INVALID_PARAMETER.

The UEFI spec foresees to return EFI_UNSUPPORTED in these cases.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: efi_net: hwaddr_size = 6
Heinrich Schuchardt [Thu, 5 Oct 2017 14:35:58 +0000 (16:35 +0200)]
efi_loader: efi_net: hwaddr_size = 6

The length of a MAC address is 6.
We have to set this length in the EFI_SIMPLE_NETWORK_MODE
structure of the EFI_SIMPLE_NETWORK_PROTOCOL.

Without this patch iPXE fails to initialize the network with
error message
SNP MAC(001e0633bcbf,0x0) has invalid hardware address length 0

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: fill simple network protocol revision
Heinrich Schuchardt [Thu, 5 Oct 2017 14:35:57 +0000 (16:35 +0200)]
efi_loader: fill simple network protocol revision

Provide the simple network protocol revision.
This revision number could be used to identify backwards compatible
enhancements of the protocol.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: correct bits of receive_filters bit mask
Heinrich Schuchardt [Thu, 5 Oct 2017 14:35:56 +0000 (16:35 +0200)]
efi_loader: correct bits of receive_filters bit mask

Remove extraneous commas.
Add comment.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: incorrect definition of EFI_SIMPLE_NETWORK_PROTOCOL
Heinrich Schuchardt [Thu, 5 Oct 2017 14:35:55 +0000 (16:35 +0200)]
efi_loader: incorrect definition of EFI_SIMPLE_NETWORK_PROTOCOL

WaitForPacket is an event and not a function pointer.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: wrong type in wait_for_event
Heinrich Schuchardt [Thu, 5 Oct 2017 14:35:54 +0000 (16:35 +0200)]
efi_loader: wrong type in wait_for_event

The UEFI spec defines parameter index of WaitForEvent as UINTN*.
So we should use size_t here.

I deliberately do not use UINTN because I hold a following patch
that will eliminate UINTN because uppercase types to not match
the U-Boot coding style.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: pass GUIDs as const efi_guid_t *
Heinrich Schuchardt [Thu, 5 Oct 2017 14:35:53 +0000 (16:35 +0200)]
efi_loader: pass GUIDs as const efi_guid_t *

We need to call some boottime services internally.
Our GUIDs are stored as const efi_guid_t *.

The boottime services never change GUIDs.
So we can define the parameters as const efi_guid_t *.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: parameters of CopyMem and SetMem
Heinrich Schuchardt [Thu, 5 Oct 2017 14:35:52 +0000 (16:35 +0200)]
efi_loader: parameters of CopyMem and SetMem

The UEFI spec defines the length parameters of CopyMem and SetMem
as UINTN. We should size_t here.

The source buffer of CopyMem should be marked as const.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: call EFI_EXIT in efi_copy_mem, efi_set_mem
Heinrich Schuchardt [Thu, 5 Oct 2017 14:35:51 +0000 (16:35 +0200)]
efi_loader: call EFI_EXIT in efi_copy_mem, efi_set_mem

EFI_ENTRY and EFI_EXIT calls must match.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: replace efi_div10 by do_div
Heinrich Schuchardt [Thu, 5 Oct 2017 14:14:14 +0000 (16:14 +0200)]
efi_loader: replace efi_div10 by do_div

We should use the existing 64bit division instead of
reinventing the wheel.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: provide function comments for boot services
Heinrich Schuchardt [Thu, 21 Sep 2017 16:30:11 +0000 (18:30 +0200)]
efi_loader: provide function comments for boot services

Provide comments describing the boot service functions.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_selftest: make tests easier to read
Heinrich Schuchardt [Wed, 4 Oct 2017 13:31:26 +0000 (15:31 +0200)]
efi_selftest: make tests easier to read

Rename counter to more illustrative names.
Update notification function description.
Simplify notification function.
Add comment for arbitrary non-zero value.
Document @return.
Use constants for return values of setup, execute, teardown.

Reported-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: use type bool for event states
Heinrich Schuchardt [Wed, 4 Oct 2017 13:03:24 +0000 (15:03 +0200)]
efi_loader: use type bool for event states

Queued and signaled describe boolean states of events.
So let's use type bool and rename the structure members to is_queued
and is_signaled.

Update the comments for is_queued and is_signaled.

Reported-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_selftest: use efi_st_error for all error messages
Heinrich Schuchardt [Wed, 4 Oct 2017 10:37:02 +0000 (12:37 +0200)]
efi_selftest: use efi_st_error for all error messages

All error messages in the selftests should use efi_st_error.
efi_st_error will print the file name and line number of the error.

Splitting message texts due to lines being over 80
characters is avoided. This resolves the issue reported
by Simon Glass in
https://lists.denx.de/pipermail/u-boot/2017-September/307387.html

Reported-by: Simon Glass <sjg@chromium.org>
Fixes: 623b3a579765 efi_selftest: provide an EFI selftest application
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agosandbox: avoid memory leak in os_dirent_ls
Heinrich Schuchardt [Thu, 21 Sep 2017 10:56:07 +0000 (12:56 +0200)]
sandbox: avoid memory leak in os_dirent_ls

Realloc does not free the old memory area if it fails.

Identified by cppcheck.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agodm: ofnode: query correct property in livetree ofnode_get_addr_size
Klaus Goger [Wed, 20 Sep 2017 11:50:41 +0000 (13:50 +0200)]
dm: ofnode: query correct property in livetree ofnode_get_addr_size

The livetree codepath of ofnode_get_addr_size always used the "reg"
property for of_get_property. Use the property parameter of the function
call instead and check the return value if the property exists.
Otherwise return FDT_ADDR_T_NONE.

This was discoverd while using SPI NOR with livetree.
spi_flash_decode_fdt checks for memory-map and will not fail with
livetree even if the property does not exist.

Signed-off-by: Klaus Goger <klaus.goger@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agodm: core: Round up size when allocating so that it is cache line aligned
Faiz Abbas [Tue, 19 Sep 2017 11:23:50 +0000 (16:53 +0530)]
dm: core: Round up size when allocating so that it is cache line aligned

The size variable may not be always be a mulitple of
ARCH_DMA_MINALIGN and using it to flush cache leads to cache
misaligned warnings.

Therefore, round up the size to a multiple of ARCH_DMA_MINLAIGN
when allocating private data.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agodm: gpio: pca953x: Drop pointless data structure checks
Simon Glass [Sun, 17 Sep 2017 22:54:54 +0000 (16:54 -0600)]
dm: gpio: pca953x: Drop pointless data structure checks

These checks cannot fail since driver model will not call a driver's
method if it cannot fully create the driver data structures.

It is confusing to have these checks and others might copy them. Drop this
code.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agodm: gpio: Correct use of -ENODEV in drivers
Simon Glass [Sun, 17 Sep 2017 22:54:53 +0000 (16:54 -0600)]
dm: gpio: Correct use of -ENODEV in drivers

In U-Boot -ENODEV means that there is no device. When there is a problem
with the device, drivers should return an error like -ENXIO or -EREMOTEIO.
When the device tree properties cannot be read correct , they should
return -EINVAL.

Update various GPIO drivers to follow this rule, to help with consistency
for future driver writers.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Adam Ford <aford173@gmail.com>
6 years agodm: gpio: Add a comment about not copying some drivers
Simon Glass [Sun, 17 Sep 2017 22:54:52 +0000 (16:54 -0600)]
dm: gpio: Add a comment about not copying some drivers

These three drivers all use U_BOOT_DEVICE rather than device tree to
create devices, so have to do manual allocation of platform data. This is
not true for new platforms.

Add a more explicit comment so that people do not copy this approach with
new boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Adam Ford <aford173@gmail.com>
6 years agodm: gpio: vybrid_gpio: Correct driver's use of bind() method
Simon Glass [Sun, 17 Sep 2017 22:54:51 +0000 (16:54 -0600)]
dm: gpio: vybrid_gpio: Correct driver's use of bind() method

It does not look like this driver needs to use a bind() method. It does
not manually create devices with device_bind() nor does it create devices
using U_BOOT_DEVICE(). It seems to only use device tree.

Therefore the manual allocation of platform data is not needed and is
confusing. Also platform data should be set up by the ofdata_to_platdata()
method, not bind().

Update the driver in case others use it as a model in future.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Adam Ford <aford173@gmail.com>