oweals/u-boot.git
7 years agoARM: uniphier: use pr_() instead of printf() where appropriate
Masahiro Yamada [Fri, 13 Oct 2017 10:21:55 +0000 (19:21 +0900)]
ARM: uniphier: use pr_() instead of printf() where appropriate

Replace printf() with pr_() to specify proper loglevel.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
7 years agopinctrl: uniphier: simplify input enable and delete pin arrays
Masahiro Yamada [Fri, 13 Oct 2017 10:21:54 +0000 (19:21 +0900)]
pinctrl: uniphier: simplify input enable and delete pin arrays

The pin data are implemented for old SoCs to specify the bit shift of
the IECTRL register.  They are not wortwhile given the required memory
footprint.  Delete all the pin data and enable all bits of the IECTRL
register.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
7 years agopinctrl: uniphier: set PUPD_SIMPLE cap flag for PXs3
Masahiro Yamada [Fri, 13 Oct 2017 10:21:53 +0000 (19:21 +0900)]
pinctrl: uniphier: set PUPD_SIMPLE cap flag for PXs3

Like other recenct UniPhier SoCs, the pupdctrl number of PXs3
matches to the pin number.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
7 years agoARM: dts: uniphier: update GPIO nodes
Masahiro Yamada [Fri, 13 Oct 2017 10:21:52 +0000 (19:21 +0900)]
ARM: dts: uniphier: update GPIO nodes

Switch to the single node design.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
7 years agogpio: uniphier: rework single device node model
Masahiro Yamada [Fri, 13 Oct 2017 10:21:51 +0000 (19:21 +0900)]
gpio: uniphier: rework single device node model

First, I implemented this driver as per-bank model, but it was
a design mistake.

  - There are 31 banks in the maximum case.  It is painful to add
    so many nodes to DT.

  - The IRQ control registers are shared between banks.  Per-bank
    design is a problem for Linux.  The counterpart for Linux turned
    around to the single node model.

Rework based on the driver for Linux.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
7 years agoARM: uniphier: switch to CONFIG_ENV_IS_NOWHERE
Masahiro Yamada [Fri, 13 Oct 2017 10:21:50 +0000 (19:21 +0900)]
ARM: uniphier: switch to CONFIG_ENV_IS_NOWHERE

The non-volatile storage varies board by board.  The default should
be NOWHERE.  Please choose a proper device via Kconfig.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
7 years agomtd: nand: do not check R/B# for CMD_SET_FEATURES in nand_command(_lp)
Masahiro Yamada [Fri, 15 Sep 2017 12:44:59 +0000 (21:44 +0900)]
mtd: nand: do not check R/B# for CMD_SET_FEATURES in nand_command(_lp)

Set Features (0xEF) command toggles the R/B# pin after 4 sub feature
parameters are written.

Currently, nand_command(_lp) calls chip->dev_ready immediately after
the address cycle because NAND_CMD_SET_FEATURES falls into default:
label.  No wait is needed at this point.

If you see nand_onfi_set_features(), R/B# is already cared by the
chip->waitfunc call.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
[ Linux commit: c5d664aa5a4c4b257a54eb35045031630d105f49 ]

7 years agomtd: nand: do not check R/B# for CMD_READID in nand_command(_lp)
Masahiro Yamada [Fri, 15 Sep 2017 12:44:58 +0000 (21:44 +0900)]
mtd: nand: do not check R/B# for CMD_READID in nand_command(_lp)

Read ID (0x90) command does not toggle the R/B# pin.  Without this
patch, NAND_CMD_READID falls into the default: label, then R/B# is
checked by chip->dev_ready().

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
[ Linux commit: 3158fa0e739615769cc047d2428f30f4c3b6640e ]

7 years agomoveconfig: fix error message in do_autoconf()
Chris Packham [Sun, 27 Aug 2017 08:00:51 +0000 (20:00 +1200)]
moveconfig: fix error message in do_autoconf()

Move the % arch outside the double quote so that the missing toolchain
message is displayed correctly.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
7 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

7 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>
7 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

7 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

7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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

7 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>
7 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

7 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>
7 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>
7 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>
7 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>
7 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>
7 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

7 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>
7 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>
7 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

7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>