oweals/u-boot.git
6 years agomx7dsabresd: Add the qspi target to the list of supported defconfigs
Fabio Estevam [Sat, 1 Sep 2018 17:24:56 +0000 (14:24 -0300)]
mx7dsabresd: Add the qspi target to the list of supported defconfigs

Add an entry for mx7dsabresd_qspi_defconfig to avoid the following
warnings:

WARNING: no status info for 'mx7dsabresd_qspi'
WARNING: no maintainers for 'mx7dsabresd_qspi'

Reported-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
6 years agoimx: missing CONFIG_MII in mx7dsabresd_qspi_defconfig
Stefano Babic [Fri, 31 Aug 2018 10:08:43 +0000 (12:08 +0200)]
imx: missing CONFIG_MII in mx7dsabresd_qspi_defconfig

CONFIG_CMD_MII is set without CONFIG_MII, build is broken.

Signed-off-by: Stefano Babic <sbabic@denx.de>
6 years agocolibri_imx7_emmc: add Colibri iMX7D 1GB (eMMC) module support
Stefan Agner [Mon, 6 Aug 2018 07:19:19 +0000 (09:19 +0200)]
colibri_imx7_emmc: add Colibri iMX7D 1GB (eMMC) module support

This commit adds support for the Toradex Colibri iMX7D 1GB Computer
on Module. The module is very similar to the Colibri iMX7D 512MB
but uses eMMC instead of raw NAND. This patch introduces a new
board specific Kconfig symbol to select between the two flash
options.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
6 years agoboard: toradex: common: fail gracefully on missing NAND chip
Stefan Agner [Mon, 6 Aug 2018 07:19:18 +0000 (09:19 +0200)]
board: toradex: common: fail gracefully on missing NAND chip

If the NAND chip is missing get_nand_dev_by_index() returns NULL. Fail
gracefully in this case.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
6 years agoimx: mx7: add system suspend/resume support
Anson Huang [Wed, 8 Aug 2018 01:17:50 +0000 (09:17 +0800)]
imx: mx7: add system suspend/resume support

This patch adds system suspend/resume support,
when linux kernel enters deep sleep mode, SoC will go
into below mode:

 - CA7 platform goes into STOP mode;
 - SoC goes into DSM mode;
 - DDR goes into self-refresh mode;
 - CPU0/SCU will be powered down.

When wake up event arrives:

 - SoC DSM mdoe exits;
 - CA7 platform exit STOP mode, SCU/CPU0 power up;
 - Invalidate L1 cache;
 - DDR exit self-refresh mode;
 - Do secure monitor mode related initialization;
 - Jump to linux kernel resume entry.

Belwo is the log of 1 iteration of system suspend/resume:

[  338.824862] PM: suspend entry (deep)
[  338.828853] PM: Syncing filesystems ... done.
[  338.834433] Freezing user space processes ... (elapsed 0.001 seconds) done.
[  338.842939] OOM killer disabled.
[  338.846182] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
[  338.869717] PM: suspend devices took 0.010 seconds
[  338.877846] Disabling non-boot CPUs ...
[  338.960301] Retrying again to check for CPU kill
[  338.964953] CPU1 killed.
[  338.968104] Enabling non-boot CPUs ...
[  338.973598] CPU1 is up
[  339.267155] mmc1: queuing unknown CIS tuple 0x80 (2 bytes)
[  339.275833] mmc1: queuing unknown CIS tuple 0x80 (7 bytes)
[  339.284158] mmc1: queuing unknown CIS tuple 0x80 (6 bytes)
[  339.385065] PM: resume devices took 0.400 seconds
[  339.389836] OOM killer enabled.
[  339.392986] Restarting tasks ... done.
[  339.398990] PM: suspend exit

The resume entry function has to initialize stack pointer before calling
C code, otherwise there will be an external abort occur, in additional,
invalidate L1 cache must be done in secure section as well, so this
patch also adds assembly code back and keep it as simple as possible.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Acked-by: Stefan Agner <stefan@agner.ch>
Tested-by: Stefan Agner <stefan@agner.ch>
6 years agoimx: mx7: add gpc initialization for low power mode
Anson Huang [Wed, 8 Aug 2018 01:17:49 +0000 (09:17 +0800)]
imx: mx7: add gpc initialization for low power mode

Add i.MX7D GPC initialization for low power mode
support like system suspend/resume from linux kernel:

 - Pending IOMUXC IRQ to workaround GPC state machine issue;
 - Mask all GPC interrupts for M4/C0/C1;
 - Configure SCU timing;
 - Configure time slot ack;
 - Configure C0/C1 power up/down timing;
 - Configure wakeup source mechanism;
 - Disable DSM/RBC related settings.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
6 years agoimx: mx7: psci: improve cpu hotplug flow
Anson Huang [Wed, 8 Aug 2018 01:17:48 +0000 (09:17 +0800)]
imx: mx7: psci: improve cpu hotplug flow

This patch improves cpu hotplug, previous cpu_off
implementation is NOT safe, a CPU can NOT power down
itself in runtime, it will cause system bus hang due
to pending transaction. So need to use other online
CPU to kill it when it is ready for killed.

Here use SRC parameter register and a magic number
of ~0 as handshake for killing a offline CPU,
when the online CPU checks the psci_affinity_info,
it will help kill the offline CPU according to
the magic number stored in SRC parameter register.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
6 years agoCleanup CONFIG_BOOTDELAY on cl-som-imx7
Alex Kiernan [Tue, 24 Jul 2018 07:29:40 +0000 (07:29 +0000)]
Cleanup CONFIG_BOOTDELAY on cl-som-imx7

CONFIG_BOOTDELAY has been migrated to Kconfig, but cl-som-imx7 was
missed. We can just delete the assignments as the config already has
the correct value.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
6 years agowatchdog: mx25: use the imx_watchdog driver for mx25
Martin Kaiser [Sat, 21 Jul 2018 17:47:03 +0000 (19:47 +0200)]
watchdog: mx25: use the imx_watchdog driver for mx25

The existing imx_watchdog driver is compatible with mx25 chipsets.
Add a WDOG1_BASE_ADDR define for the base address and enable the driver
in watchdog's Makefile.

To use the driver, a board must define CONFIG_IMX_WATCHDOG and
CONFIG_HW_WATCHDOG.

This fixes an issue when booting an mx25 chip via usb/serial. In this
case, the boot rom will always enable the watchdog. If u-boot is running
in interactive mode and the watchdog is not serviced, the system is
rebooted when the watchdog expires.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
6 years agoimx: imx6ul_evk: Enable DM driver for iMX6UL EVK u-boot
Ye Li [Thu, 28 Jun 2018 03:23:17 +0000 (20:23 -0700)]
imx: imx6ul_evk: Enable DM driver for iMX6UL EVK u-boot

Convert the codes and configurations to enable DM drivers in u-boot for
modules: i2c, PMIC, regulator, USB, Ethernet, SD/MMC, GPIO and QSPI

This patch does not change SPL, so it still uses non-DM driver for
UART, GPIO and SD/MMC.

Signed-off-by: Ye Li <ye.li@nxp.com>
6 years agodts: imx6ul_evk: Add DTS files for 14x14 EVK and 9x9 EVK boards
Ye Li [Thu, 28 Jun 2018 03:23:16 +0000 (20:23 -0700)]
dts: imx6ul_evk: Add DTS files for 14x14 EVK and 9x9 EVK boards

Add the board DTS files for 14x14 EVK and 9x9 EVK. They are necessary
for converting to use u-boot DM driver.

Two -u-boot.dtsi are added to modify compatible string of SPI flash
device to "spi-flash".

Signed-off-by: Ye Li <ye.li@nxp.com>
6 years agodts: imx6ul: Update alias to support DM
Ye Li [Thu, 28 Jun 2018 03:23:15 +0000 (20:23 -0700)]
dts: imx6ul: Update alias to support DM

Add spi0 alias for qspi for enabling DM SPI.
Change usb alias for usbotg1 and usbotg2 for enabling DM USB

Signed-off-by: Ye Li <ye.li@nxp.com>
6 years agoimx: imx7d-sdb: Add DM QSPI support
Ye Li [Thu, 28 Jun 2018 02:30:53 +0000 (19:30 -0700)]
imx: imx7d-sdb: Add DM QSPI support

On iMX7D SabreSD board, the QSPI has pins conflict with EPDC (default).
To use QSPI, users have to rework the board (de-populate R388-R391, R396-R399
populate R392-R395, R299, R300). So we add new DTS file and new defconfig
dedicated for QSPI.

Other changes to support the DM QSPI:
 - Add QSPI node and alias spi0.
 - Modify spi4 (spi-gpio) node and add alias spi5 for it to avoid req
   conflict
 - Add EPDC node in imx7d.dtsi and disable it in imx7d-sdb-qspi.dts to
   align with kernel and also present the conflict.
 - Add -u-boot.dtsi to modify compatible string of mx25l51245g@0 to
   "spi-flash"
 - Remove iomux settings of qspi in board codes which is not needed
   for DM driver.

Signed-off-by: Ye Li <ye.li@nxp.com>
6 years agoimx: imx6sx-sabreauto: convert to use DM QSPI driver
Ye Li [Thu, 28 Jun 2018 02:27:00 +0000 (19:27 -0700)]
imx: imx6sx-sabreauto: convert to use DM QSPI driver

To support DM QSPI driver:
 - Add -u-boot.dtsi to modify n25q256a@0 and n25q256a@1 compatible string
   to "spi-flash" and add "num-cs" property.
 - Enable DM SPI and DM SPI FLASH configurations
 - Remove iomux settings of qspi1 in board codes which is not needed
   for DM driver.

Signed-off-by: Ye Li <ye.li@nxp.com>
6 years agoimx: imx6sx-sdb: Enable DM QSPI driver
Ye Li [Thu, 28 Jun 2018 02:26:59 +0000 (19:26 -0700)]
imx: imx6sx-sdb: Enable DM QSPI driver

To support DM QSPI driver
 - Add spi0 and spi1 alias for qspi1 and qspi2.
 - Add -u-boot.dtsi to modify n25q256a@0 and n25q256a@1 compatible string
   to "spi-flash" and add "num-cs" property.
 - Enable DM SPI/QSPI relavent configurations
 - Remove iomux settings of qspi2 in board codes which is not needed
   for DM driver.
 - Add sf default settings. So running "sf probe" can detect the flash

Signed-off-by: Ye Li <ye.li@nxp.com>
6 years agoconfigs: am57xx: change default board name to beagle_x15
Praneeth Bajjuri [Wed, 22 Aug 2018 04:47:49 +0000 (23:47 -0500)]
configs: am57xx: change default board name to beagle_x15

beagleboard x15 is the first supported platform variant of am57xx
in AOSP (android open source project) now.

changing board name to stay in consistent with aosp target name.

Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
6 years agocmd: ubi: change 'default y' for SUNXI to 'imply' in Kconfig
Masahiro Yamada [Mon, 9 Jul 2018 06:12:37 +0000 (15:12 +0900)]
cmd: ubi: change 'default y' for SUNXI to 'imply' in Kconfig

It is not preferred to put SUNXI-specific code in the common place.

Change it to 'imply' property of ARCH_SUNXI.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agoMerge branch 'master' of git://git.denx.de/u-boot-socfpga
Tom Rini [Fri, 24 Aug 2018 20:11:12 +0000 (16:11 -0400)]
Merge branch 'master' of git://git.denx.de/u-boot-socfpga

6 years agoMerge branch 'master' of git://git.denx.de/u-boot-usb
Tom Rini [Fri, 24 Aug 2018 20:11:01 +0000 (16:11 -0400)]
Merge branch 'master' of git://git.denx.de/u-boot-usb

6 years agoMerge branch 'master' of git://git.denx.de/u-boot-sunxi
Tom Rini [Fri, 24 Aug 2018 20:10:54 +0000 (16:10 -0400)]
Merge branch 'master' of git://git.denx.de/u-boot-sunxi

6 years agoARM: dts: am33xx: fix SLEWCTRL_FAST pinctrl binding
Christian Amann [Tue, 21 Aug 2018 15:04:09 +0000 (17:04 +0200)]
ARM: dts: am33xx: fix SLEWCTRL_FAST pinctrl binding

Copy missing Kernel patch to make SLEWCTRL_SLOW available in device tree
and to correct the value of SLEWCTRL_FAST.
After this patch, the Kernel and U-boot device tree settings for
SLEWCTRL have the same effect.

Original Kernel patch message:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=424e0f039bfa8a51fb5c5178b6ece8baa4996469

"
According to AM335x TRM, Document spruh73l, Revised February 2015,
Section 9.2.2 Pad Control Registers, setting bit 6 of the pad control
registers actually sets the SLEWCTRL value to slow rather than fast as
the current macro indicates. Introduce a new macro, SLEWCTRL_SLOW, that
sets the bit, and modify SLEWCTRL_FAST to 0 but keep it for
completeness. Current users of the macro (i2c and mdio) are left
unmodified as SLEWCTRL_FAST was the macro used and actual desired state.
Tested on am335x-gp-evm with no difference in software performance seen.
Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
"

Signed-off-by: Christian Amann <Christian.Amann@de.bosch.com>
6 years agoenv: ubi: Add missing ENV_NAME
Marek Vasut [Tue, 21 Aug 2018 13:53:33 +0000 (15:53 +0200)]
env: ubi: Add missing ENV_NAME

Add missing environment name for UBI, to prevent this NULL in output:
Loading Environment from <NULL>...
and rather have a valid UBI there:
Loading Environment from UBI...

Signed-off-by: Marek Vasut <marex@denx.de>
6 years agou-boot: align cache flushes in load_elf_image_shdr to line boundaries
Neil Stainton [Mon, 20 Aug 2018 15:46:19 +0000 (15:46 +0000)]
u-boot: align cache flushes in load_elf_image_shdr to line boundaries

Prevent cache warning messages when using the 'bootelf' command on an
Arm target. Round down each section start address and round up the
respective section end to the nearest cache line.

Currently when using bootelf to load an image on Arm, several warnings
such as the following appear in the console:
  CACHE: Misaligned operation at range [878000008783c5e0]
  CACHE: Misaligned operation at range [8783c5e08784b3e0]

Signed-off-by: Neil Stainton <nstainton@asl-control.co.uk>
[trini: Reword commit message to include the info after the --- which
included the Signed-off-by line, and change ' at ' to '@']
Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agoARM: display5: Remove "factory procedure" from display5 board config
Lukasz Majewski [Mon, 20 Aug 2018 14:23:58 +0000 (16:23 +0200)]
ARM: display5: Remove "factory procedure" from display5 board config

This code now is regarded as dead one and hence shall be removed.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
6 years agodm: test: Fix typo in test-main comment
Michal Simek [Mon, 20 Aug 2018 06:03:22 +0000 (08:03 +0200)]
dm: test: Fix typo in test-main comment

Trivial fix.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agomalloc_simple: calloc: don't call memset if malloc failed
Simon Goldschmidt [Thu, 16 Aug 2018 07:50:32 +0000 (09:50 +0200)]
malloc_simple: calloc: don't call memset if malloc failed

malloc_simple() can return 0 if out of memory. Don't call memset
from calloc() in this case but rely on the caller checking
the return value.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Marek Vasut <marex@denx.de>
6 years agoboard: arm: bcmstb: Declare get_ticks in timer.h
Thomas Fitzsimmons [Thu, 16 Aug 2018 01:33:49 +0000 (21:33 -0400)]
board: arm: bcmstb: Declare get_ticks in timer.h

In an earlier proposed patch, bcmstb.c implemented timer_read_counter,
but it was updated to implement get_ticks instead.  This patch updates
the declaration in timer.h accordingly.

Signed-off-by: Thomas Fitzsimmons <fitzsim@fitzsim.org>
6 years agoboards: amlogic: remove ethernet gpio reset code from boards
Beniamino Galvani [Tue, 14 Aug 2018 13:07:52 +0000 (15:07 +0200)]
boards: amlogic: remove ethernet gpio reset code from boards

The reset is already handled by the designware driver using
information from device tree.

Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>
Acked-by: Neil Armstrong <narmstrong@baylibre.com>
6 years agocommon: avb_verify: Fix division by zero in mmc_byte_io()
Eugeniu Rosca [Tue, 14 Aug 2018 00:43:09 +0000 (02:43 +0200)]
common: avb_verify: Fix division by zero in mmc_byte_io()

Compiling U-Boot with ubsan/asan libraries and running it in sandbox
may lead to below backtrace:

 => avb init 0
 => avb verify
 ## Android Verified Boot 2.0 version 1.1.0
read_is_device_unlocked not supported yet
common/avb_verify.c:407:31: runtime error: division by zero
AddressSanitizer:DEADLYSIGNAL
Reviewed-by: Igor Opaniuk <igor.opaniuk@linaro.org>
=================================================================
==9388==ERROR: AddressSanitizer: FPE on unknown address 0x0000004b467f \
    (pc 0x0000004b467f bp 0x000000000000 sp 0x7ffd899fe150 T0)
    #0 0x4b467e in mmc_byte_io common/avb_verify.c:407
    #1 0x4b4c47 in mmc_byte_io common/avb_verify.c:532
    #2 0x4b4c47 in read_from_partition common/avb_verify.c:533
    #3 0x69dc0d in load_and_verify_vbmeta lib/libavb/avb_slot_verify.c:560
    #4 0x6a1ee6 in avb_slot_verify lib/libavb/avb_slot_verify.c:1139
    #5 0x45dabd in do_avb_verify_part cmd/avb.c:245
    #6 0x4af77c in cmd_call common/command.c:499
    #7 0x4af77c in cmd_process common/command.c:538
    #8 0x46bafc in run_pipe_real common/cli_hush.c:1677
    #9 0x46bafc in run_list_real common/cli_hush.c:1875
    #10 0x46c780 in run_list common/cli_hush.c:2024
    #11 0x46c780 in parse_stream_outer common/cli_hush.c:3216
    #12 0x46d34b in parse_file_outer common/cli_hush.c:3299
    #13 0x4ad609 in cli_loop common/cli.c:217
    #14 0x4625ae in main_loop common/main.c:65
    #15 0x46f2d1 in run_main_loop common/board_r.c:648
    #16 0x640253 in initcall_run_list lib/initcall.c:30
    #17 0x46f9d0 in board_init_r common/board_r.c:879
    #18 0x40539b in main arch/sandbox/cpu/start.c:321
    #19 0x7fa94925f82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
    #20 0x408908 in _start (/srv/R/u-boot-master/u-boot+0x408908)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: FPE common/avb_verify.c:407 in mmc_byte_io
==9388==ABORTING

Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
6 years agocommon: avb_verify: Fix never-occurring avb_free(ops_data)
Eugeniu Rosca [Tue, 14 Aug 2018 00:43:08 +0000 (02:43 +0200)]
common: avb_verify: Fix never-occurring avb_free(ops_data)

Cppcheck (v1.85) reports w/o this patch:

[common/avb_verify.c:738] -> [common/avb_verify.c:741]: (warning) \
  Either the condition 'ops' is redundant or there is possible null \
  pointer dereference: ops.

Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@linaro.org>
6 years agocommon: avb_verify: Fix memory leaks
Eugeniu Rosca [Tue, 14 Aug 2018 00:43:07 +0000 (02:43 +0200)]
common: avb_verify: Fix memory leaks

Cppcheck (v1.85) reports w/o this patch:

[common/avb_verify.c:351]: (error) Memory leak: part
[common/avb_verify.c:356]: (error) Memory leak: part
[common/avb_verify.c:361]: (error) Memory leak: part
[common/avb_verify.c:366]: (error) Memory leak: part

Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@linaro.org>
6 years agocommon: avb_verify: Make local data static
Eugeniu Rosca [Tue, 14 Aug 2018 00:43:06 +0000 (02:43 +0200)]
common: avb_verify: Make local data static

Fix sparse complaint:

common/avb_verify.c:14:21: warning: \
  symbol 'avb_root_pub' was not declared. Should it be static?

Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@linaro.org>
6 years agocommon: kconfig: Mark AVB_VERIFY as dependent on PARTITION_UUIDS
Eugeniu Rosca [Tue, 14 Aug 2018 00:43:05 +0000 (02:43 +0200)]
common: kconfig: Mark AVB_VERIFY as dependent on PARTITION_UUIDS

Avoid below compiler [1] errors, reproduced with configuration [2]:

common/avb_verify.c: In function ‘get_unique_guid_for_partition’:
common/avb_verify.c:692:31: error: ‘disk_partition_t {aka struct disk_partition}’ has no member named ‘uuid’
  uuid_size = sizeof(part->info.uuid);
                               ^
common/avb_verify.c:696:29: error: ‘disk_partition_t {aka struct disk_partition}’ has no member named ‘uuid’
  memcpy(guid_buf, part->info.uuid, uuid_size);
                             ^
  LD      drivers/built-in.o
make[2]: *** [scripts/Makefile.build:278: common/avb_verify.o] Error 1

[1] aarch64-linux-gnu-gcc (Linaro GCC 7.2-2017.11)
[2] r8a7795_ulcb_defconfig, plus:
    CONFIG_AVB_VERIFY=y
    CONFIG_PARTITION_UUIDS=y
    CONFIG_UDP_FUNCTION_FASTBOOT=y
    CONFIG_LIBAVB=y

Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@linaro.org>
6 years agocommon: avb_verify: Fix invalid 'for' loop condition
Eugeniu Rosca [Tue, 14 Aug 2018 00:43:04 +0000 (02:43 +0200)]
common: avb_verify: Fix invalid 'for' loop condition

Fix below compiler [1] warning:

common/avb_verify.c: In function ‘avb_find_dm_args’:
common/avb_verify.c:179:30: warning: left-hand operand of comma expression has no effect [-Wunused-value]
  for (i = 0; i < AVB_MAX_ARGS, args[i]; ++i) {

[1] aarch64-linux-gnu-gcc (Linaro GCC 7.2-2017.11)

Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@linaro.org>
6 years agolibavb: Handle wrong hashtree_error_mode in avb_append_options()
Ievgen Maliarenko [Tue, 14 Aug 2018 00:43:03 +0000 (02:43 +0200)]
libavb: Handle wrong hashtree_error_mode in avb_append_options()

Exit with AVB_SLOT_VERIFY_RESULT_ERROR_INVALID_ARGUMENT
when hashtree_error_mode value passed to avb_append_options()
is unknown (not from AvbHashtreeErrorMode enum).

Otherwise, default value is not handled in the
switch(hashtree_error_mode), which causes below compile warning:

lib/libavb/avb_cmdline.c: In function ‘avb_append_options’:
lib/libavb/avb_cmdline.c:354:13: warning: ‘dm_verity_mode’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     new_ret = avb_replace(
     ~~~~~~~~^~~~~~~~~~~~~~
         slot_data->cmdline, "$(ANDROID_VERITY_MODE)", dm_verity_mode);
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/libavb/avb_cmdline.c:363:8: warning: ‘verity_mode’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   if (!cmdline_append_option(
        ^~~~~~~~~~~~~~~~~~~~~~
           slot_data, "androidboot.veritymode", verity_mode)) {

Signed-off-by: Ievgen Maliarenko <ievgen.maliarenko@globallogic.com>
Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Reviewed-by: Igor Opaniuk <igor.opaniuk@linaro.org>
6 years agoARM: dts: socfpga: Add missing NAND reset
Marek Vasut [Tue, 21 Aug 2018 13:54:22 +0000 (15:54 +0200)]
ARM: dts: socfpga: Add missing NAND reset

The NAND reset is missing from DT, so the reset manager cannot unreset the NAND.
Add the missing DT reset entry.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Chin Liang See <chin.liang.see@intel.com>
Cc: Dinh Nguyen <dinguyen@kernel.org>
Cc: Ley Foon Tan <ley.foon.tan@intel.com>
6 years agoARM: dts: socfpga: Drop ad-hoc UART clock frequency encoding from DT
Marek Vasut [Tue, 21 Aug 2018 14:26:32 +0000 (16:26 +0200)]
ARM: dts: socfpga: Drop ad-hoc UART clock frequency encoding from DT

The UART clock frequency can be obtained from the clock framework by the
ns16550 driver, so drop this redundant DT node.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Chin Liang See <chin.liang.see@intel.com>
Cc: Dinh Nguyen <dinguyen@kernel.org>
Cc: Ley Foon Tan <ley.foon.tan@intel.com>
6 years agoARM: socfpga: Convert Arria10 to timer framework
Marek Vasut [Sat, 18 Aug 2018 14:00:31 +0000 (16:00 +0200)]
ARM: socfpga: Convert Arria10 to timer framework

Switch the Arria10 from ad-hoc hardcoded timer to timer framework
and the DW APB timer driver. This allows the A10 to extract timer
information, like timer rate, from clock framework and thus DT
instead of having it hardcoded in U-Boot configuration files.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Chin Liang See <chin.liang.see@intel.com>
Cc: Dinh Nguyen <dinguyen@kernel.org>
Cc: Ley Foon Tan <ley.foon.tan@intel.com>
6 years agoARM: dts: socfpga: Flag timer clock as pre-reloc
Marek Vasut [Sat, 18 Aug 2018 17:13:28 +0000 (19:13 +0200)]
ARM: dts: socfpga: Flag timer clock as pre-reloc

Flag timer clock as DM pre-reloc, so that a timer driver can be used and
it can extract information about it's clock rate using the clock framework.
This patch also moves some of the pre-reloc flags into the core dtsi file,
this is because the timer is not board specific, but rather is used on all
boards.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Chin Liang See <chin.liang.see@intel.com>
Cc: Dinh Nguyen <dinguyen@kernel.org>
Cc: Ley Foon Tan <ley.foon.tan@intel.com>
6 years agotimer: dw-apb: Add Designware APB timer driver
Marek Vasut [Sat, 18 Aug 2018 13:58:32 +0000 (15:58 +0200)]
timer: dw-apb: Add Designware APB timer driver

Add timer driver for the Designware APB Timer IP. This is present
for example on the Altera SoCFPGA chips.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Chin Liang See <chin.liang.see@intel.com>
Cc: Dinh Nguyen <dinguyen@kernel.org>
Cc: Ley Foon Tan <ley.foon.tan@intel.com>
6 years agoARM: socfpga: Reorder Arria10 SPL
Marek Vasut [Sat, 18 Aug 2018 17:11:52 +0000 (19:11 +0200)]
ARM: socfpga: Reorder Arria10 SPL

The Arria10 SPL is a complete mess of calls to functions which are
called in the wrong context and it is surprise it works at all. This
patch tries to clean that mess up by shuffling the function calls
around and moving the calls into the correct context. Due to the
delicate nature of the reordering, this is done in one huge patch.

The following changes happen in this patch:
- Security policy init and NIC301 happens first in board_init_f()
- The clock init happens very early in board_init_f() in SPL only
- arch_early_init_r() only registers the FPGA, just like on Gen5
- arch_early_init_r() is never called from any _f() function
- Dedicated FPGA pins are inited in board_init_f() as on Gen5

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Chin Liang See <chin.liang.see@intel.com>
Cc: Dinh Nguyen <dinguyen@kernel.org>
Cc: Ley Foon Tan <ley.foon.tan@intel.com>
6 years agoarm: socfpga: stratix10: Fix mailbox urgent command with urgent register
Ley Foon Tan [Fri, 17 Aug 2018 08:22:03 +0000 (16:22 +0800)]
arm: socfpga: stratix10: Fix mailbox urgent command with urgent register

According to mailbox spec, software should send urgent command with
urgent register instead of COUT location. This patch write urgent
command index to urgent register.

Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
6 years agoarm: socfpga: stratix10: Enable EMAC to FPGA bridge based on handoff
Ley Foon Tan [Fri, 17 Aug 2018 08:22:02 +0000 (16:22 +0800)]
arm: socfpga: stratix10: Enable EMAC to FPGA bridge based on handoff

Code checking and setting EMAC use fpga is in
populate_sysmgr_fpgaintf_module(). So, call to sysmgr_pinmux_init()
instead of populate_sysmgr_pinmux().
In sysmgr_pinmux_init(), it will call to both populate_sysmgr_pinmux()
and populate_sysmgr_fpgaintf_module().

Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
6 years agoMerge git://git.denx.de/u-boot-fsl-qoriq
Tom Rini [Fri, 24 Aug 2018 00:05:37 +0000 (20:05 -0400)]
Merge git://git.denx.de/u-boot-fsl-qoriq

6 years agoPartially revert "efi_loader: Rename sections to allow for implicit data"
Simon Glass [Wed, 8 Aug 2018 09:54:16 +0000 (03:54 -0600)]
Partially revert "efi_loader: Rename sections to allow for implicit data"

This partially reverts commit 7e21fbca26d18327cf7cabaad08df276a06a07d8.

That change broke sandbox EFI support for unknown reasons. It also changes
sandbox to use--gc-sections which we don't want.

For now I am just reverting the sandbox portion as presumably this change
is safe on other architectures.

Fixes: 7e21fbca26 (efi_loader: Rename sections to allow for implicit data)
Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agoarmv8: layerscape: Build u-boot-with-spl.bin for selected boards
Jagdish Gediya [Thu, 23 Aug 2018 17:23:33 +0000 (22:53 +0530)]
armv8: layerscape: Build u-boot-with-spl.bin for selected boards

This patch reverts the changes made for ls1088a and ls2080a
based boards in commit 18b6dd6cb0564 ("armv8: layerscape: Drop
u-boot-with-spl.bin for selected boards").

u-boot-with-spl.bin is required for Gen3 based SoC where internal
ROM copy data in the internal memory

CC: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
CC: Priyanka Jain <priyanka.jain@nxp.com>
CC: Pramod Kumar <pramod.kumar_1@nxp.com>
CC: Ashish Kumar <ashish.kumar@nxp.com>
CC: York Sun <york.sun@nxp.com>
Signed-off-by: Jagdish Gediya <jagdish.gediya@nxp.com>
Reviewed-by: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
6 years agoarmv8: fsl-layerscape: Update README.falcon for compression
York Sun [Mon, 30 Jul 2018 16:53:19 +0000 (09:53 -0700)]
armv8: fsl-layerscape: Update README.falcon for compression

Update README.falcon to use "none" for compression property for
ramdisk image to avoid being uncompressed upon loading.

Signed-off-by: York Sun <york.sun@nxp.com>
6 years agousb: musb-new: Call musb_platform_exit from musb_stop
Jagan Teki [Fri, 20 Jul 2018 07:14:01 +0000 (12:44 +0530)]
usb: musb-new: Call musb_platform_exit from musb_stop

musb stop is musb core call during unregister or shutting down
gadget or host musb. For graceful exit add musb_platform_exit
on musb_stop so-that it can exit the musb platform driver as well.

Tested-by: Chen-Yu Tsai <wens@csie.org> # A33-OlinuXino
Tested-by: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
6 years agousb: musb-new: sunxi: Add proper musb exit support
Jagan Teki [Fri, 20 Jul 2018 07:14:00 +0000 (12:44 +0530)]
usb: musb-new: sunxi: Add proper musb exit support

musb have platform ops to do proper graceful exit,
so add the exit call and move musb platform exit code
instead of keeping it in driver remove.
This make proper shutdown of musb where .remove will
call disable, exit serially via musb_stop.

Tested-by: Chen-Yu Tsai <wens@csie.org> # A33-OlinuXino
Tested-by: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
6 years agomusb-new: sunxi: Access ahb_reset0_cfg via ccm offset
Jagan Teki [Fri, 20 Jul 2018 07:13:59 +0000 (12:43 +0530)]
musb-new: sunxi: Access ahb_reset0_cfg via ccm offset

reset0 is not available for sun4i, 5i and 7i so access
the reset0 offset from ccm via driver data for relevant
Allwinner SoC. this will eventually drop the existing
ifdef for SUN6I.

Tested-by: Chen-Yu Tsai <wens@csie.org> # A33-OlinuXino
Tested-by: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
6 years agousb: musb-new: sunxi: Allocate struct phy in private
Jagan Teki [Fri, 20 Jul 2018 07:13:57 +0000 (12:43 +0530)]
usb: musb-new: sunxi: Allocate struct phy in private

Allocate struct phy in private structure instead of allocating
locally and assign it to a pointer. This eventually fix miss
alignment phy which is used in another functions.

Tested-by: Chen-Yu Tsai <wens@csie.org> # A33-OlinuXino
Tested-by: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
6 years agousb: musb-new: Fix improper musb host pointer
Jagan Teki [Fri, 20 Jul 2018 07:13:56 +0000 (12:43 +0530)]
usb: musb-new: Fix improper musb host pointer

When MUSB is operating in peripheral mode, probe registering
musb core using musb_register which intern return int value
for validation. so there is no scope to preserve struct musb
pointer but the same can be used in .remove musb_stop.
So fix this by return musb_register with struct musb pointer.

Cc: Igor Grinberg <grinberg@compulab.co.il>
Cc: Purna Chandra Mandal <purna.mandal@microchip.com>
Tested-by: Chen-Yu Tsai <wens@csie.org> # A33-OlinuXino
Tested-by: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
6 years agoMerge branch 'master' of git://git.denx.de/u-boot-tegra
Tom Rini [Thu, 23 Aug 2018 02:36:08 +0000 (22:36 -0400)]
Merge branch 'master' of git://git.denx.de/u-boot-tegra

6 years agoMerge tag 'signed-efi-2018.09' of git://github.com/agraf/u-boot
Tom Rini [Tue, 21 Aug 2018 17:15:21 +0000 (13:15 -0400)]
Merge tag 'signed-efi-2018.09' of git://github.com/agraf/u-boot

Patch queue for efi - 2018-08-21

A few fixes for 2018.09. Most noticable are:

  - unbreak x86 target (-fdata-section fallout)
  - fix undefined behavior in a few corner cases
  - make Jetson TX1 boot again
  - RTS fixes
  - implement reset for simple output

6 years agoARM: tegra: avoid more operations in non-secure world
Stephen Warren [Tue, 31 Jul 2018 18:39:07 +0000 (12:39 -0600)]
ARM: tegra: avoid more operations in non-secure world

A secure monitor that runs before U-Boot, and hence causes U-Boot to run
in non-secure world, must implement a few operations that U-Boot
otherwise implements when running in secure world. Fix U-Boot to skip
these operations when running in non-secure world. In particular:

- The secure monitor must provide the LP0 resume code and own LP0
  configuration in order to maintain security, so must initialize all
  the PMC scratch registers used by the boot ROM during LP0 resume.
  Consequently, U-Boot should not attempt to clear those registers,
  since the register accesses will fail or cause an error.

- The secure monitor owns system security, and so is responsible for
  configuring security-related items such as the VPR.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Tom Warren <twarren@nvidia.com>
6 years agoarm: tegra: Restore host1x/dc dm-pre-reloc properties
Nicolas Chauvet [Wed, 11 Jul 2018 18:42:57 +0000 (20:42 +0200)]
arm: tegra: Restore host1x/dc dm-pre-reloc properties

Since commit f2faffecb016, tegra: Convert to use binman
the dm-pre-reloc properties are removed.

This leads U-Boot not to enable the display on paz00

This patch restore the dm-pre-reloc properties allowing
the bootloader to output to the display panel

v4: - Spell project name as appropriate
v3: - Fix few typos
v2: - Add more characters to commit hash

Signed-off-by: Nicolas Chauvet <kwizart@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>
6 years agocmd: Add bind/unbind commands to bind a device to a driver from the command line
Jean-Jacques Hiblot [Thu, 9 Aug 2018 14:17:46 +0000 (16:17 +0200)]
cmd: Add bind/unbind commands to bind a device to a driver from the command line

In some cases it can be useful to be able to bind a device to a driver from
the command line.
The obvious example is for versatile devices such as USB gadget.
Another use case is when the devices are not yet ready at startup and
require some setup before the drivers are bound (ex: FPGA which bitsream is
fetched from a mass storage or ethernet)

usage example:

bind usb_dev_generic 0 usb_ether
unbind usb_dev_generic 0 usb_ether
or
unbind eth 1

bind /ocp/omap_dwc3@48380000/usb@48390000 usb_ether
unbind /ocp/omap_dwc3@48380000/usb@48390000

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
6 years agodevice: expose the functions used to remove and unbind children of a device
Jean-Jacques Hiblot [Thu, 9 Aug 2018 14:17:45 +0000 (16:17 +0200)]
device: expose the functions used to remove and unbind children of a device

Also add a 'drv' parameter to filter the children to remove/unbind.
Exporting those functions is a preparatory work for the addition of the
bind/unbind commands.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
6 years agodm: convert device_get_global_by_of_offset() to device_get_global_by_ofnode()
Jean-Jacques Hiblot [Thu, 9 Aug 2018 14:17:44 +0000 (16:17 +0200)]
dm: convert device_get_global_by_of_offset() to device_get_global_by_ofnode()

Also add device_find_global_by_ofnode() that also find a device based on
the OF node, but doesn't probe the device.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
6 years agodm: print the index of the device when dumping the dm tree
Jean-Jacques Hiblot [Thu, 9 Aug 2018 14:17:43 +0000 (16:17 +0200)]
dm: print the index of the device when dumping the dm tree

Command "dm tree" dumps the devices with class, driver, name information.
Add the index of the device in the class too, because the information is
useful for the bind/unbind commands.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agouclass: Add dev_get_uclass_index() to get the uclass/index of a device
Jean-Jacques Hiblot [Thu, 9 Aug 2018 14:17:42 +0000 (16:17 +0200)]
uclass: Add dev_get_uclass_index() to get the uclass/index of a device

This function is the reciprocal of uclass_find_device().
It will be used to print the index information in dm tree dump.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
6 years agonet: eth-uclass: Fix for DM USB ethernet support
Jean-Jacques Hiblot [Thu, 9 Aug 2018 14:17:41 +0000 (16:17 +0200)]
net: eth-uclass: Fix for DM USB ethernet support

When a USB ethernet device is halted, the device driver is removed. When
this happens the uclass private memory is freed and uclass_priv is set to
NULL. This causes a data abort when uclass_priv->state is then set to
ETH_STATE_PASSIVE.

Fix it by checking if uclass_priv is NULL before setting uclass_priv->state

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
6 years agousb: gadget: Add bcdDevice for the DWC3 USB Gadget Controller
Jean-Jacques Hiblot [Thu, 9 Aug 2018 14:17:40 +0000 (16:17 +0200)]
usb: gadget: Add bcdDevice for the DWC3 USB Gadget Controller

Add an entry in usb_gadget_controller_number() for the DWC3 gadget
controller. Without it, it is not possible to bind the USB Ethernet driver.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
6 years agousb: musb-new: omap2430: Enable DM_USB and OF support
Adam Ford [Tue, 31 Jul 2018 10:58:01 +0000 (05:58 -0500)]
usb: musb-new: omap2430: Enable DM_USB and OF support

With upcoming changes that require CONFIG_BLK, this broke
USB Mass Storage on the OMAP3 boards because if CONFIG_BLK is
enabled, it assumes that DM_USB is enabled, but it wasn't yet
available on omap3 and omap4 boards.

This patch converts the OMAP2430 MUSB glue to support DM_USB and
extracts the necessary information based on the device tree.

It's based on the ti-musb driver, but there are enough significant
differences in both the architecture and device tree entires between
am33xx and OMAP3/OMAP4, that I think it makes sense to continue to
keep the separate.

Per doc/driver-model/usb-info.txt, the USB gadget stuff hasn't
migrated to DM_USB yet, so this only supports USB Host for now.

Users wanting USB Gadgets will need to disable DM_USB and leave
it the old way for now.

Signed-off-by: Adam Ford <aford173@gmail.com>
6 years agousb: musb-new: omap2430: Remove dead code
Adam Ford [Fri, 13 Jul 2018 20:50:02 +0000 (15:50 -0500)]
usb: musb-new: omap2430: Remove dead code

A bunch of code was encapsulated in #ifdef's whether or not
it is building or for U-Boot.  Since this code is always building
for U-Boot, this patch removes the dead code.

Signed-off-by: Adam Ford <aford173@gmail.com>
6 years agocmd: fastboot: Validate user input
Sam Protsenko [Fri, 29 Jun 2018 18:59:40 +0000 (21:59 +0300)]
cmd: fastboot: Validate user input

In case when user provides '-' as USB controller index, like this:

    => fastboot -

data abort occurs in strcmp() function in do_fastboot(), here:

    if (!strcmp(argv[1], "udp"))

(tested on BeagleBone Black).

That's because argv[1] is NULL when user types in the '-', and null
pointer dereference occurs in strcmp() (which is ok according to C
standard specification). So we must validate user input to prevent such
behavior.

While at it, check also the result of strtoul() function and handle
error cases properly.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
6 years agocmd: efi: Clarify calculation precedence for '&' and '?'
Eugeniu Rosca [Sat, 14 Jul 2018 20:53:32 +0000 (22:53 +0200)]
cmd: efi: Clarify calculation precedence for '&' and '?'

Fix cppcheck complaint:
[cmd/efi.c:173]: (style) Clarify calculation precedence for '&' and '?'.

Fixes: f1a0bafb5802 ("efi: Add a command to display the memory map")
Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi: Add EFI_MEMORY_{NV, MORE_RELIABLE, RO} attributes
Eugeniu Rosca [Sat, 14 Jul 2018 20:53:31 +0000 (22:53 +0200)]
efi: Add EFI_MEMORY_{NV, MORE_RELIABLE, RO} attributes

With this update, the memory attributes are in sync with Linux
kernel v4.18-rc4. They also match page 190 of UEFI 2.7 spec [1].

[1] http://www.uefi.org/sites/default/files/resources/UEFI_Spec_2_7.pdf

Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi: Fix truncation of constant value
Eugeniu Rosca [Sat, 14 Jul 2018 20:53:30 +0000 (22:53 +0200)]
efi: Fix truncation of constant value

Starting with commit 867a6ac86dd8 ("efi: Add start-up library code"),
sparse constantly complains about truncated constant value in efi.h:

include/efi.h:176:35: warning: cast truncates bits from constant value (8000000000000000 becomes 0)

This can get quite noisy, preventing real issues to be noticed:

$ make defconfig
*** Default configuration is based on 'sandbox_defconfig'
$ make C=2 -j12 2>&1 | grep truncates | wc -l
441

After the patch is applied:
$ make C=2 -j12 2>&1 | grep truncates | wc -l
0
$ sparse --version
v0.5.2

Following the suggestion of Heinrich Schuchardt, instead of only
fixing the root-cause, I replaced the whole enum of _SHIFT values
by ULL defines. This matches both the UEFI 2.7 spec and the Linux
kernel implementation.

Some ELF size comparison before and after the patch (gcc 7.3.0):

efi-x86_payload64_defconfig:
text    data    bss     dec       hex   filename
407174  29432   278676  715282    aea12 u-boot.old
407152  29464   278676  715292    aea1c u-boot.new
-22     +32     0       +10

efi-x86_payload32_defconfig:
text    data    bss     dec       hex   filename
447075  30308   280076  757459    b8ed3 u-boot.old
447053  30340   280076  757469    b8edd u-boot.new
-22     +32     0       +10

Fixes: 867a6ac86dd8 ("efi: Add start-up library code")
Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.Reset()
Heinrich Schuchardt [Thu, 5 Jul 2018 17:58:07 +0000 (19:58 +0200)]
efi_loader: EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.Reset()

Implement the reset service of the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.

This should resolve the error reported by the SCT in
Protocol/SimpleTextOut/BlackBoxTest/SimpleTextOutBBTestFunction_uefi.c:639

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoMerge branch 'master' of git://git.denx.de/u-boot-sunxi
Tom Rini [Mon, 20 Aug 2018 17:41:56 +0000 (13:41 -0400)]
Merge branch 'master' of git://git.denx.de/u-boot-sunxi

6 years agoMerge git://git.denx.de/u-boot-x86
Tom Rini [Mon, 20 Aug 2018 17:41:37 +0000 (13:41 -0400)]
Merge git://git.denx.de/u-boot-x86

6 years agodisplay5: Introduce fitImg_fw_sz variable
Lukasz Majewski [Sat, 18 Aug 2018 20:22:07 +0000 (22:22 +0200)]
display5: Introduce fitImg_fw_sz variable

This cosmetic change allow easy adjustment of the to-load kernel size if
needed.

Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Lukasz Majewski <lukma@denx.de>
6 years agoefi_selftest: correct block device unit test
Heinrich Schuchardt [Sun, 22 Jul 2018 06:06:57 +0000 (08:06 +0200)]
efi_selftest: correct block device unit test

The UEFI specification mandates that the create flag is only used in
conjunction with both the read and the write flag.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: document runtime functions
Heinrich Schuchardt [Sun, 29 Jul 2018 13:10:11 +0000 (15:10 +0200)]
efi_loader: document runtime functions

Add comments for runtime service functions.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: update runtime services table crc32
Heinrich Schuchardt [Sun, 29 Jul 2018 07:49:04 +0000 (09:49 +0200)]
efi_loader: update runtime services table crc32

The crc32 of the runtime services table must be updated after detaching.

efi_update_table_header_crc32() must be __efi_runtime. So move it to
efi_runtime.c

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agolib: crc32: mark function crc32() as __efi_runtime
Heinrich Schuchardt [Sun, 29 Jul 2018 07:49:03 +0000 (09:49 +0200)]
lib: crc32: mark function crc32() as __efi_runtime

The function crc32() is needed by the EFI subsystem at runtime. So it has
to be linked into the runtime section together with all dependencies.

Eliminate empty defines local and ZEXPORT.

Mark variables as static which are not exported.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoefi_loader: avoid NULL dereference in efi_get_memory_map()
Heinrich Schuchardt [Mon, 6 Aug 2018 20:28:18 +0000 (22:28 +0200)]
efi_loader: avoid NULL dereference in efi_get_memory_map()

We should only dereference parameter memory_map_size after checking that
it is valid.

Fixes: 8e835554b36b ("efi_loader: check parameters of GetMemoryMap")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoboard: sunxi: Remove unused local variables
Jagan Teki [Mon, 20 Aug 2018 11:43:15 +0000 (17:13 +0530)]
board: sunxi: Remove unused local variables

variables buf from board_mmc_init, and ret from misc_init_r
were unused on the functions, so remove it.

Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
6 years agoefi_loader: fix a parameter check at CreateEvent()
AKASHI Takahiro [Fri, 10 Aug 2018 06:36:32 +0000 (15:36 +0900)]
efi_loader: fix a parameter check at CreateEvent()

The commit 21b3edfc9644 ("efi_loader: check parameters of CreateEvent")
enforces a strict parameter check at CreateEvent(). On the other hand,
UEFI specification version 2.7, section 7.1, says:

    The EVT_NOTIFY_WAIT and EVT_NOTIFY_SIGNAL flags are exclusive. If
    neither flag is specified, the caller does not require any notification
    concerning the event and the NotifyTpl, NotifyFunction, and
    NotifyContext parameters are ignored.

So the check should be mitigated so as to comply with the specification.
Without this patch, EDK2's Shell.efi won't be started.

Fixes: 21b3edfc9644 ("efi_loader: check parameters of CreateEvent")
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoriscv: Include bss subsections in linker script
Alexander Graf [Mon, 20 Aug 2018 12:25:49 +0000 (14:25 +0200)]
riscv: Include bss subsections in linker script

When we build with -fdata-sections we may end up with bss subsections. Our
linker script explicitly lists only a single consecutive bss section though.

Adapt the statement to also include subsections.

Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agox86: Enable -fdata-sections always
Alexander Graf [Mon, 20 Aug 2018 12:20:51 +0000 (14:20 +0200)]
x86: Enable -fdata-sections always

We left -fdata-sections disabled for x86_64 before because we encountered
random bugs that were at that time inexplicable.

Turns out this really was just side effects of missing .bss* statements
in the linker scripts. With those fixed, we can enable data sections for all
targets.

Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agox86: Include bss subsections in linker script
Alexander Graf [Mon, 20 Aug 2018 12:17:41 +0000 (14:17 +0200)]
x86: Include bss subsections in linker script

When we build with -fdata-sections we may end up with bss subsections. Our
linker script explicitly lists only a single consecutive bss section though.

Adapt the statement to also include subsections.

This fixes booting efi-x86_app_defconfig.

Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agosunxi: fix sid base address macro name for H6
Icenowy Zheng [Sat, 18 Aug 2018 05:36:44 +0000 (13:36 +0800)]
sunxi: fix sid base address macro name for H6

In the current H6 CPU memory space code, the SUNXI in the macro name of
the SID address base is wrongly spelled as SNUXI, which leads to SID
readout not working.

Fix this macro name.

Fixes: 55f6b1c351c9 ("sunxi: add basic memory map definitions of H6 SoC")
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
6 years agoconfigs: sun7i: Fix to use emmc dts for OLinuXino_MICRO-eMMC
Jagan Teki [Mon, 13 Aug 2018 17:29:40 +0000 (22:59 +0530)]
configs: sun7i: Fix to use emmc dts for OLinuXino_MICRO-eMMC

A20 OLinuXino Micro eMMC board has emmc with mmc2 slot
so use proper dts, sun7i-a20-olinuxino-micro-emmc.dts

Cc: Stefan Mavrodiev <stefan@olimex.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
6 years agodoc: FIT image: fix typo
Pierre-Jean Texier [Sat, 18 Aug 2018 13:51:25 +0000 (15:51 +0200)]
doc: FIT image: fix typo

Fix typo in beaglebone verified boot documentation.

Signed-off-by: Pierre-Jean Texier <texier.pj2@gmail.com>
6 years agocmd: Add dtimg command
Sam Protsenko [Thu, 16 Aug 2018 20:34:13 +0000 (23:34 +0300)]
cmd: Add dtimg command

dtimg command allows user to work with Android DTB/DTBO image format.
Such as, getting the address of desired DTB/DTBO file, printing the dump
of the image in U-Boot shell, etc.

This command is needed to provide Android boot with new Android DT image
format further.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
6 years agocommon: Add support for Android DT image
Sam Protsenko [Thu, 16 Aug 2018 20:34:12 +0000 (23:34 +0300)]
common: Add support for Android DT image

Android documentation recommends new image format for storing DTB/DTBO
files: [1]. To support that format, this patch adds helper functions for
Android DTB/DTBO format. In image-android-dt.* files you can find helper
functions to work with Android DT image format, such us routines for:
    - printing the dump of image structure
    - getting the address and size of desired dtb/dtbo file

This patch uses dt_table.h file, that was added in commit 643cefa4d848
("Import Android's dt_table.h for DT image format") by Alex Deymo.

[1] https://source.android.com/devices/architecture/dto/partitions

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
6 years agofs/fat: debug-print file read position during file_fat_read_at()
Andreas Dannenberg [Tue, 14 Aug 2018 02:35:15 +0000 (21:35 -0500)]
fs/fat: debug-print file read position during file_fat_read_at()

In order to make the debug print in file_fat_read_at() a tad more useful,
show the offset the file is being read at alongside the filename.

Suggested-by: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
6 years agospl: fix debug print in spl_common_init()
Simon Goldschmidt [Mon, 13 Aug 2018 09:24:05 +0000 (11:24 +0200)]
spl: fix debug print in spl_common_init()

spl_common_init() debug-prints "spl_early_init()\n" but it is
called both from spl_early_init() and spl_init().

Fix this by moving the debug() statement to the calling functions
which now print their name.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
6 years agoARM: da8xxevm: README: Add NOR booting instructions
Adam Ford [Sat, 11 Aug 2018 12:34:55 +0000 (07:34 -0500)]
ARM: da8xxevm: README: Add NOR booting instructions

The da850evm with its UI expander board can boot XIP boot from
NOR flash.  This adds the instructions to the readme. file.

Signed-off-by: Adam Ford <aford173@gmail.com>
6 years agoARM: da850evm: Enable SPL_SYS_MALLOC_SIMPLE
Adam Ford [Fri, 10 Aug 2018 21:07:47 +0000 (16:07 -0500)]
ARM: da850evm: Enable SPL_SYS_MALLOC_SIMPLE

The SPL space is limited.  In order to try to enable DM in SPL,
we need more space. When combined wtih TINY_PRINTF, this reduces
the size of SPL by 6.5k

Original:

   text    data     bss     dec     hex filename
  20760    1216      80   22056    5628 spl/u-boot-spl

Tiny Printf
   text    data     bss     dec     hex filename
  17947    1216      80   19243    4b2b spl/u-boot-spl

Malloc Simple + Tiny Printf
   text    data     bss     dec     hex filename
  15187     176      28   15391    3c1f spl/u-boot-spl

Signed-off-by: Adam Ford <aford173@gmail.com>
6 years agoARM: da850evm: Enable USE_TINY_PRINTF
Adam Ford [Fri, 10 Aug 2018 20:53:41 +0000 (15:53 -0500)]
ARM: da850evm: Enable USE_TINY_PRINTF

The SPL space is limited.  In order to try to enable DM in SPL,
we need more space. This reduces the size of SPL by ~2.7K

before:
   text    data     bss     dec     hex filename
  20760    1216      80   22056    5628 spl/u-boot-spl
after:
   text    data     bss     dec     hex filename
  17947    1216      80   19243    4b2b spl/u-boot-spl

Signed-off-by: Adam Ford <aford173@gmail.com>
6 years agoconfigs: da850evm: Remove DM_I2C_COMPAT
Adam Ford [Fri, 10 Aug 2018 10:24:12 +0000 (05:24 -0500)]
configs: da850evm: Remove DM_I2C_COMPAT

Since using DM_I2C_COMPAT throws a warning during compilation,
and it isn't really needed any longer, so this patch removes
this feature and shrinks the code a bit.

from:
   text    data     bss     dec     hex filename
 343326   13388  123448  480162   753a2 u-boot

to:
   text    data     bss     dec     hex filename
 342924   13380  123440  479744   75200 u-boot

Signed-off-by: Adam Ford <aford173@gmail.com>
6 years agoefi_loader: relocate pointer to tables
Heinrich Schuchardt [Sat, 4 Aug 2018 21:16:06 +0000 (23:16 +0200)]
efi_loader: relocate pointer to tables

When applying a virtual memory map we have to update the pointer to the
list of configuration tables.

Fixes: 4182a129ef73 ("efi_loader: allocate configuration table array")
Reported-by: Mark Kettenis <mark.kettenis@xs4all.nl>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Tested-by: Mark Kettenis <kettenis@openbsd.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agoRevert "efi_loader: efi_allocate_pages is too restrictive"
Stephen Warren [Thu, 2 Aug 2018 17:45:57 +0000 (11:45 -0600)]
Revert "efi_loader: efi_allocate_pages is too restrictive"

This reverts commit aa909462d01866354f4cd4534db5f571c2cf1fbb. This change
caused "dhcp filename" to crash the system on p2371-2180 (Jetson TX1), for
example when running test/py.

Reverting this change isn't optimal, but at least restores TX1 to a working
state. In the future, we should:

a) Fix whatever problem causes the crash with this patch applied. This
needs further discussion, so isn't something we can immediately do.

b) Undo the revert; re-apply the original patch to efi_allocate_pages.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agosandbox: Move BSS after EFI sections
Alexander Graf [Mon, 6 Aug 2018 22:29:01 +0000 (00:29 +0200)]
sandbox: Move BSS after EFI sections

Something went wrong when writing the sandbox linker scripts and so we
ended up with a .bss section marker right before the efi runtime sections.

That obviously is a terrible idea, as it may result in overwriting efi
runtime code and data. So let's move the .bss identifier behind the efi
sections.

Signed-off-by: Alexander Graf <agraf@suse.de>
6 years agox86: efi: payload: Add default TSC frequency in the device tree
Bin Meng [Fri, 10 Aug 2018 09:39:38 +0000 (02:39 -0700)]
x86: efi: payload: Add default TSC frequency in the device tree

It was observed sometimes U-Boot as the EFI payload fails to boot on
QEMU. This is because TSC calibration fails with no valid frequency.
This adds default TSC frequency in the device tree.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agox86: coreboot: Add default TSC frequency in the device tree
Bin Meng [Fri, 10 Aug 2018 09:39:37 +0000 (02:39 -0700)]
x86: coreboot: Add default TSC frequency in the device tree

It was observed sometimes U-Boot as the coreboot payload fails to
boot on QEMU. This is because TSC calibration fails with no valid
frequency. This adds default TSC frequency in the device tree.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
6 years agox86: tsc: Try hardware calibration first
Bin Meng [Fri, 10 Aug 2018 09:39:36 +0000 (02:39 -0700)]
x86: tsc: Try hardware calibration first

At present if TSC frequency is provided in the device tree, it takes
precedence over hardware calibration result. This swaps the order to
try hardware calibration first and uses device tree as last resort.

This can be helpful when a generic dts (eg: coreboot/efi payload) is
supposed to work on as many hardware as possible, including emulators
like QEMU where TSC hardware calibration sometimes fails.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>