platform/kernel/u-boot.git
5 years agousb: Rename SPL_USB_SUPPORT to SPL_USB_STORAGE
Abel Vesa [Fri, 1 Feb 2019 16:40:07 +0000 (16:40 +0000)]
usb: Rename SPL_USB_SUPPORT to SPL_USB_STORAGE

Since there is the SPL_USB_HOST_SUPPORT for enabling USB support in SPL,
makes more sense to rename the SPL_USB_SUPPORT as SPL_USB_STORAGE.
Everything that is not part of the usb storage support in SPL is now
build under SPL_USB_HOST_SUPPORT.

Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
5 years agonet: mv88e61xx: fix autonegotiation on ports
Tim Harvey [Mon, 4 Feb 2019 20:56:52 +0000 (12:56 -0800)]
net: mv88e61xx: fix autonegotiation on ports

phy_reset should be called before autoneg is setup

The only boards using MV88E61XX_SWITCH are:
 - alliedtelesis/SBx81LIFKW
 - alliedtelesis/SBx81LIFXCAT
 - gateworks/gw_ventana

Cc: Chris Packham <chris.packham@alliedtelesis.co.nz>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
5 years agodoc: imx: habv4: Remove secure_boot.txt guide
Breno Matheus Lima [Wed, 23 Jan 2019 19:30:16 +0000 (19:30 +0000)]
doc: imx: habv4: Remove secure_boot.txt guide

The secure_boot.txt guide was replaced by mx6_mx7_secure_boot.txt and
mx6_mx7_spl_secure_boot.txt documents.

Both documents covers all steps needed for SPL and non-SPL tagets,
so remove secure_boot.txt file to avoid duplicated content.

Signed-off-by: Breno Lima <breno.lima@nxp.com>
5 years agodoc: imx: habv4: Move encrypted boot guide
Breno Matheus Lima [Wed, 23 Jan 2019 19:30:11 +0000 (19:30 +0000)]
doc: imx: habv4: Move encrypted boot guide

All guides are currently located at doc/imx/habv4/guides/ directory.

Move encrypted_boot.txt document to guides directory.

Signed-off-by: Breno Lima <breno.lima@nxp.com>
5 years agodoc: imx: habv4: Add Secure Boot guide for i.MX6 and i.MX7 SPL targets
Breno Matheus Lima [Wed, 23 Jan 2019 19:30:06 +0000 (19:30 +0000)]
doc: imx: habv4: Add Secure Boot guide for i.MX6 and i.MX7 SPL targets

The current U-Boot implementation includes SPL targets for
some NXP development boards:

- mx6sabreauto_defconfig
- mx6sabresd_defconfig
- mx6ul_14x14_evk_defconfig
- mx6ul_9x9_evk_defconfig

Add additional steps needed to completly secure the
bootloader image.

Signed-off-by: Breno Lima <breno.lima@nxp.com>
5 years agodoc: imx: habv4: Add Secure Boot guide for i.MX6 and i.MX7 non-SPL targets
Breno Matheus Lima [Wed, 23 Jan 2019 19:29:59 +0000 (19:29 +0000)]
doc: imx: habv4: Add Secure Boot guide for i.MX6 and i.MX7 non-SPL targets

Add HABv4 documentation for non-SPL targets covering the
following topics:

- How to sign an securely boot an u-boot-dtb.imx image.
- How to extend the root of trust for additional boot images.
- Add 3 CSF examples.
- Add IVT generation script example.

Reviewed-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Utkarsh Gupta <utkarsh.gupta@nxp.com>
Signed-off-by: Breno Lima <breno.lima@nxp.com>
5 years agodoc: imx: habv4: Add HABv4 introduction
Breno Matheus Lima [Wed, 23 Jan 2019 19:29:53 +0000 (19:29 +0000)]
doc: imx: habv4: Add HABv4 introduction

The HABv4 is supported in i.MX50, i.MX53, i.MX6, i.MX7,
series and i.MX 8M, i.MX8MM devices.

Add an introductory document containing the following topics:

- HABv4 Introduction
- HABv4 Secure Boot
- HABv4 Encrypted Boot
- HAB PKI tree generation
- HAB Fast Authentication PKI tree generation
- SRK Table and SRK Hash generation

Reviewed-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Utkarsh Gupta <utkarsh.gupta@nxp.com>
Signed-off-by: Breno Lima <breno.lima@nxp.com>
5 years agodoc: imx: habv4: Remove extra hab directory for a cleaner documentation structure
Breno Matheus Lima [Wed, 23 Jan 2019 19:29:46 +0000 (19:29 +0000)]
doc: imx: habv4: Remove extra hab directory for a cleaner documentation structure

There is no need to have an extra hab directory under doc/imx/.

Habv4 and AHAB documentation can be added directly in doc/imx/ for a
cleaner documentation structure.

Signed-off-by: Breno Lima <breno.lima@nxp.com>
5 years agoARM: dts: imx6ul-lite*: add DTS files for liteSOM and liteboard
Marcin Niestroj [Sat, 19 Jan 2019 16:06:45 +0000 (17:06 +0100)]
ARM: dts: imx6ul-lite*: add DTS files for liteSOM and liteboard

Import liteSOM and liteboard dts files from Linux v4.20. They will
be used after transition to driver model and device-tree based boot.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
5 years agoMTD: nand: mxs_nand: Allow driver to auto setup ECC in SPL
Adam Ford [Thu, 17 Jan 2019 13:16:39 +0000 (07:16 -0600)]
MTD: nand: mxs_nand: Allow driver to auto setup ECC in SPL

The initialization of the NAND in SPL hard-coded ecc.bytes,
ecc.size, and ecc.strength which may work for some NAND parts,
but it not appropriate for others.  With the pending patch
"mxs_nand: Fix BCH read timeout error on boards requiring ECC"
the driver can auto configure the ECC when these entries are
blank.  This patch has been tested in NAND flash with oob 64
and oob 128.

Signed-off-by: Adam Ford <aford173@gmail.com>
Tested-by: Jörg Krause <joerg.krause@embedded.rocks>
Acked-by: Tim Harvey <tharvey@gateworks.com>
Tested-by: Tim Harvey <tharvey@gateworks.com>
5 years agonet: dm: fec: Fix regulator enable when using DM_REGULATOR
Adam Ford [Tue, 15 Jan 2019 17:26:48 +0000 (11:26 -0600)]
net: dm: fec: Fix regulator enable when using DM_REGULATOR

When DM_REGULATOR is enabled, the driver attempts to call
regulator_autoset() which expects the regulators to be on at boot
and/or always on and fails if they are not true.
For a more generic approach, this patch just calls
regulator_set_enable() which shouldn't have such restrictions.

Fixes: ad8c43cbcafb ("net: dm: fec: Support the phy-supply
binding")

Signed-off-by: Adam Ford <aford173@gmail.com>
Tested-by: Martin Fuzzey <martin.fuzzey@flowbird.group>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
5 years agoARM: imx6q_logic: Correct phy fixup for broken ethernet
Adam Ford [Sat, 12 Jan 2019 23:32:00 +0000 (17:32 -0600)]
ARM: imx6q_logic: Correct phy fixup for broken ethernet

The Ethernet has been broken for some time.  This patch unifies
this board with a few others that use a similar approach to
enabling phy.  This fixes ar8031 Ethernet controller so it works.

Signed-off-by: Adam Ford <aford173@gmail.com>
5 years agoARM: imx6q_logic: Enable SPL Booting from NAND
Adam Ford [Sat, 12 Jan 2019 23:24:52 +0000 (17:24 -0600)]
ARM: imx6q_logic: Enable SPL Booting from NAND

This patch fixes a few values that were incorrect, and this
now lets SPL boot from NAND.

Signed-off-by: Adam Ford <aford173@gmail.com>
5 years agoMTD: NAND: mxs_nand_init_dma: Make mxs_nand_init_dma static
Adam Ford [Sat, 12 Jan 2019 12:25:48 +0000 (06:25 -0600)]
MTD: NAND: mxs_nand_init_dma: Make mxs_nand_init_dma static

mxs_nand_init_dma is only referenced from mxs_nand.c.  It's not
referenced in any headers or outside code, so this patch
defines it as static.

Signed-off-by: Adam Ford <aford173@gmail.com>
5 years agoMTD: mxs_nand: Fix BCH read timeout error on boards requiring ECC
Adam Ford [Thu, 3 Jan 2019 02:36:52 +0000 (20:36 -0600)]
MTD: mxs_nand: Fix BCH read timeout error on boards requiring ECC

The LogicPD board uses a Micron Flash with ECC.  To boot this from
SPL, the ECC needs to be correctly configured or the BCH engine
times out.

Signed-off-by: Adam Ford <aford173@gmail.com>
Acked-by: Stefan Agner <stefan.agner@toradex.com>
Tested-by: Jörg Krause <joerg.krause@embedded.rocks>
Acked-by: Tim Harvey <tharvey@gateworks.com>
Tested-by: Tim Harvey <tharvey@gateworks.com>
5 years agoddr: vybrid: Add calibration code to memory controler's (DDRMC) setup code
Lukasz Majewski [Wed, 5 Dec 2018 16:04:03 +0000 (17:04 +0100)]
ddr: vybrid: Add calibration code to memory controler's (DDRMC) setup code

This patch extends the vf610 DDR memory controller code to support SW
leveling.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Stefan Agner <stefan.agner@toradex.com>
5 years agoddr: vybrid: Provide code to perform on-boot calibration
Lukasz Majewski [Wed, 5 Dec 2018 16:04:02 +0000 (17:04 +0100)]
ddr: vybrid: Provide code to perform on-boot calibration

This patch provides the code to calibrate the DDR's
DQS to DQ signals (RDLVL).

It is based on:
VFxxx Controller Reference Manual, Rev. 0, 10/2016, page 1600
10.1.6.16.4.1 "Software Read Leveling in MC Evaluation Mode"

and NXP's community thread:
"Vybrid: About DDR leveling feature on DDRMC."
https://community.nxp.com/thread/395323

Signed-off-by: Lukasz Majewski <lukma@denx.de>
5 years agoddr: vybrid: Add DDRMC calibration related registers (DQS to DQ)
Lukasz Majewski [Wed, 5 Dec 2018 16:04:01 +0000 (17:04 +0100)]
ddr: vybrid: Add DDRMC calibration related registers (DQS to DQ)

This commit provides extra defines needed for DDR memory controller
calibration (read leveling performing).

Signed-off-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Stefan Agner <stefan.agner@toradex.com>
5 years agoMerge tag 'signed-efi-next' of git://github.com/agraf/u-boot
Tom Rini [Wed, 13 Feb 2019 12:12:29 +0000 (07:12 -0500)]
Merge tag 'signed-efi-next' of git://github.com/agraf/u-boot

Patch queue for efi - 2019-02-13

Goodness this time around:

  - HII protocol, finally allows us to run the UEFI Shell!
    (experimantal, disabled by default)
  - efi selftest now available on Cortex-M
  - NVMe support for distro boot
  - Lots of code cleanup

5 years agoefi_loader: fix EFI_FILE_PROTOCOL.GetInfo()
Heinrich Schuchardt [Sat, 9 Feb 2019 21:23:48 +0000 (22:23 +0100)]
efi_loader: fix EFI_FILE_PROTOCOL.GetInfo()

We check the existence of files with fs_exist(). This function calls
fs_close(). If we do not set the active block device again fs_opendir()
fails and we do not set the flag EFI_FILE_DIRECTORY. Due to this error the
`cd` command in the EFI shell fails.

So let's add the missing set_blk_dev(fh) call.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agolib: vsprintf: avoid overflow printing UTF16 strings
Heinrich Schuchardt [Sun, 10 Feb 2019 10:11:26 +0000 (11:11 +0100)]
lib: vsprintf: avoid overflow printing UTF16 strings

We have to ensure while printing UTF16 strings that we do not exceed the
end of the print buffer.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: Make HII a config option
Alexander Graf [Mon, 11 Feb 2019 14:24:00 +0000 (15:24 +0100)]
efi_loader: Make HII a config option

Heinrich ran into issues with HII and iPXE which lead to #SErrors on
his Odroid-C2 system. We definitely do not want to regress just yet,
so let's not expose the HII protocols by default.

Instead, let's make it a config option that people can play with
This way, we can stabilize the code in tree without breaking any
users.

Once someone figures out, why this breaks iPXE (probably a NULL
dereference), we can enable it by default.

Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
---

v1 -> v2:

  - Remove HII selftest as well

v2 -> v3:

  - Make config option

5 years agoarm: Leave smccc calls in .text when efi_loader=n
Alexander Graf [Mon, 11 Feb 2019 14:07:17 +0000 (15:07 +0100)]
arm: Leave smccc calls in .text when efi_loader=n

Commit 81ea00838c6 ("efi_loader: PSCI reset and shutdown") put the SMCCC
assembly code into the efi specific code section. This is wrong when we
do not have EFI_LOADER enabled, as that strips efi runtime sections from
the output binary

Reported-by: Michal Simek <monstr@monstr.eu>
Reported-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Tested-by: Michal Simek <monstr@monstr.eu>
Fixes: 81ea00838c6 ("efi_loader: PSCI reset and shutdown")
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: debug output for HII protocols
Heinrich Schuchardt [Wed, 23 Jan 2019 21:55:36 +0000 (22:55 +0100)]
efi_loader: debug output for HII protocols

For correct indention use EFI_PRINT() instead of debug().

For printing efi_uintn_t or size_t use the %zu or %zx format code.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_selftest: fix HII tests
Heinrich Schuchardt [Wed, 23 Jan 2019 19:36:27 +0000 (20:36 +0100)]
efi_selftest: fix HII tests

efi_st_printf() does not support format code %ld. Anyway the format code
for size_t would be %zu which isn't supported either.

We do not want any divisions to avoid invalid references to integer
arithmetic routines, cf.
https://gcc.gnu.org/onlinedocs/gccint/Integer-library-routines.html.

As a simple remedy remove the noisy messages from the output.
They are not relevant for automated testing.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_selftest: add HII database protocols test
AKASHI Takahiro [Mon, 21 Jan 2019 03:13:01 +0000 (12:13 +0900)]
efi_selftest: add HII database protocols test

This efi_selftest tests HII database protocol and HII string protocol.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi: hii: add HII config routing/access protocols
AKASHI Takahiro [Mon, 21 Jan 2019 03:13:00 +0000 (12:13 +0900)]
efi: hii: add HII config routing/access protocols

This patch is a place holder for HII configuration routing protocol and
HII configuration access protocol.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi: hii: add keyboard layout package support
AKASHI Takahiro [Mon, 21 Jan 2019 03:12:59 +0000 (12:12 +0900)]
efi: hii: add keyboard layout package support

Allow for handling keyboard layout package in HII database protocol.

A package can be added or deleted in HII database protocol, but
we don't set 'current' keyboard layout as there is no driver that
requests a keyboard layout.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi: hii: add guid package support
AKASHI Takahiro [Mon, 21 Jan 2019 03:12:58 +0000 (12:12 +0900)]
efi: hii: add guid package support

Allow for handling GUID package in HII database protocol.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: Initial HII database protocols
Leif Lindholm [Mon, 21 Jan 2019 03:12:57 +0000 (12:12 +0900)]
efi_loader: Initial HII database protocols

This patch provides enough implementation of the following protocols to
run EDKII's Shell.efi and UEFI SCT:

  * EfiHiiDatabaseProtocol
  * EfiHiiStringProtocol

Not implemented are:
  * ExportPackageLists()
  * RegisterPackageNotify()/UnregisterPackageNotify()
  * SetKeyboardLayout() (i.e. *current* keyboard layout)

HII database protocol in this patch series can handle only:
  * GUID package
  * string package
  * keyboard layout package
  (The other packages, except Device path package, will be necessary
   for interactive and graphical UI.)

Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agox86: do not use i386 code for x86_64 memory functions
Heinrich Schuchardt [Wed, 23 Jan 2019 01:42:39 +0000 (02:42 +0100)]
x86: do not use i386 code for x86_64 memory functions

arch/x86/lib/string.c contains assembler implementations of memcpy(),
memmove(), and memset() written for i386. Don't use it on x86_64.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: GetNextVariableName() relies on REGEX
Heinrich Schuchardt [Tue, 22 Jan 2019 20:35:23 +0000 (21:35 +0100)]
efi_loader: GetNextVariableName() relies on REGEX

Our implementation of GetNextVariableName() relies on
CONFIG_REGEX=y. So EFI_LOADER has to select it.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: fix GetNextVariableName
Heinrich Schuchardt [Tue, 22 Jan 2019 19:10:46 +0000 (20:10 +0100)]
efi_loader: fix GetNextVariableName

Our current implementation of GetNextVariableName() first collects all EFI
variables. If none is found at all hexport_r() returns a zero length string
terminated by \0 and the value 1 as number of bytes in the returned buffer.

In this case GetNextVariableName() has to return EFI_NOT_FOUND.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: do not use symbolic links
Heinrich Schuchardt [Mon, 21 Jan 2019 18:30:42 +0000 (19:30 +0100)]
efi_loader: do not use symbolic links

Symbolic links are not supported on all file systems, e.g. not on FAT. So
it is not wise to use them in our source tree.

Use a qualified path to refer to lib/efi_loader/efi_freestanding.c in
scripts/Makefile.lib instead.

Reported-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
[agraf: Fix build with O=]
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: use library memcpy() in helloworld.efi
Heinrich Schuchardt [Sun, 20 Jan 2019 07:20:32 +0000 (08:20 +0100)]
efi_loader: use library memcpy() in helloworld.efi

Helloworld does not need its own memcpy() implementation anymore. Use the
one provided in efi_freestanding.c.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: use freestanding library for efi apps
Heinrich Schuchardt [Sun, 20 Jan 2019 07:20:31 +0000 (08:20 +0100)]
efi_loader: use freestanding library for efi apps

GCC requires that freestanding programs provide memcpy(), memmove(),
memset(), and memcmp().

Add the library functions when building a *.efi files.

The EFI selftests might use other compilation flags. So use a symbolic
link to provide lib/efi_selftest/efi_freestanding.c and compile it
separately.

Reported-by: Alexander Graf <agraf@suse.de>
Fixes: 5be444d14b38 ("efi_loader: consistent build flags for EFI applications")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: provide freestanding library
Heinrich Schuchardt [Sun, 20 Jan 2019 07:20:30 +0000 (08:20 +0100)]
efi_loader: provide freestanding library

GCC requires that freestanding programs provide memcpy(), memmove(),
memset(), and memcmp().

Provide the required library functions.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_selftest: fix variables test for GetNextVariableName()
AKASHI Takahiro [Mon, 21 Jan 2019 11:43:14 +0000 (12:43 +0100)]
efi_selftest: fix variables test for GetNextVariableName()

There is a bug in efi variables test.
Fix it with some cosmetic improvements.

Please note that efi variables test still fails at QueryVariableInfo()
and GetVariable(), but this is not due to a change in this patch.
  ==8<==
  Testing EFI API implementation

  Selected test: 'variables'

  Setting up 'variables'
  Setting up 'variables' succeeded

  Executing 'variables'
  .../u-boot/lib/efi_selftest/efi_selftest_variables.c(60):
  TODO: QueryVariableInfo failed
  .../u-boot/lib/efi_selftest/efi_selftest_variables.c(131):
  TODO: GetVariable returned wrong length 7
  .../u-boot/lib/efi_selftest/efi_selftest_variables.c(133):
  TODO: GetVariable returned wrong value
  Executing 'variables' succeeded

  Boot services terminated

  Summary: 0 failures
  ==>8==

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>
5 years agoefi_loader: implement GetNextVariableName()
AKASHI Takahiro [Mon, 21 Jan 2019 11:43:13 +0000 (12:43 +0100)]
efi_loader: implement GetNextVariableName()

The current GetNextVariableName() is a placeholder.
With this patch, it works well as expected.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
rebased on efi-next
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: comments for variable services
Heinrich Schuchardt [Fri, 18 Jan 2019 18:52:05 +0000 (19:52 +0100)]
efi_loader: comments for variable services

Comment the functions implementing the runtime variable services.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: remove duplicate function mem2hex()
Heinrich Schuchardt [Fri, 18 Jan 2019 17:54:26 +0000 (18:54 +0100)]
efi_loader: remove duplicate function mem2hex()

Replace duplicate function mem2hex() by inline function bin2hex().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: eliminate duplicate function hex2mem()
Heinrich Schuchardt [Fri, 18 Jan 2019 11:31:54 +0000 (12:31 +0100)]
efi_loader: eliminate duplicate function hex2mem()

Use existing inline function hex2bin() instead of defining a new one.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: remove duplicate GUID definition
Heinrich Schuchardt [Tue, 15 Jan 2019 04:44:56 +0000 (05:44 +0100)]
efi_loader: remove duplicate GUID definition

Remove duplicate definition o EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: consistent build flags for EFI applications
Heinrich Schuchardt [Sat, 12 Jan 2019 14:32:06 +0000 (15:32 +0100)]
efi_loader: consistent build flags for EFI applications

At the same time adding and removing the -Os flag does not make any sense.
Actually it leads to -Os not being used.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: use u16* for file name
Heinrich Schuchardt [Sat, 12 Jan 2019 11:02:33 +0000 (12:02 +0100)]
efi_loader: use u16* for file name

UTF-16 strings in our code should all be u16 *. Fix an inconsistency for
file names which may lead to a warning for printf("%ls", ).

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: fix CopyMem()
Heinrich Schuchardt [Wed, 9 Jan 2019 20:41:13 +0000 (21:41 +0100)]
efi_loader: fix CopyMem()

CopyMem() must support overlapping buffers. So replace memcpy() by
memmove().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: refactor switch to non-secure mode
Heinrich Schuchardt [Tue, 8 Jan 2019 17:13:06 +0000 (18:13 +0100)]
efi_loader: refactor switch to non-secure mode

Refactor the switch from supervisor to hypervisor to a new function called
at the beginning of do_bootefi().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_driver: simplify error message
Heinrich Schuchardt [Sun, 6 Jan 2019 16:12:43 +0000 (17:12 +0100)]
efi_driver: simplify error message

Stating the function module is sufficient. We don't need file and line
number. Anyway the format code for the line number was incorrect (should
be %d).

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_selftest: tpl unit test, check return values
Heinrich Schuchardt [Sun, 6 Jan 2019 15:44:16 +0000 (16:44 +0100)]
efi_selftest: tpl unit test, check return values

For some API calls checks for the return values are missing.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_selftest: events unit test, check return values
Heinrich Schuchardt [Sun, 6 Jan 2019 15:38:57 +0000 (16:38 +0100)]
efi_selftest: events unit test, check return values

For some API calls checks for the return values are missing.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_selftest: SNP unit test on sandbox
Heinrich Schuchardt [Sat, 5 Jan 2019 22:50:41 +0000 (23:50 +0100)]
efi_selftest: SNP unit test on sandbox

Running the simple network protocol test on the sandbox requires setting
the environment variable ethact to a network interface connected to a DHCP
server and ethrotate to 'no'. So let's make it an on-request test on the
sandbox (selectable by setting environment variable efi_selftest).

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: efi_set_variable use const void *
Heinrich Schuchardt [Sun, 30 Dec 2018 20:03:15 +0000 (21:03 +0100)]
efi_loader: efi_set_variable use const void *

The SetVariable() runtime service does not change the data passed to it.
So mark the parameter as constant.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: use const efi_guid_t * for variable services
Heinrich Schuchardt [Sun, 30 Dec 2018 19:53:51 +0000 (20:53 +0100)]
efi_loader: use const efi_guid_t * for variable services

The runtime variable services never change GUIDs. So we should declare
the GUID parameters as constant.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: move efi_init_obj_list() to a new efi_setup.c
AKASHI Takahiro [Sun, 30 Dec 2018 14:16:55 +0000 (15:16 +0100)]
efi_loader: move efi_init_obj_list() to a new efi_setup.c

The function, efi_init_obj_list(), can be shared in different pseudo efi
applications, like bootefi/bootmgr as well as my efishell. Moreover, it
will be utilized to extend efi initialization, for example, my "removable
disk support" patch and "capsule-on-disk support" patch in the future.

So with this patch, it will be moved to a new file, efi_setup.c, under
lib/efi_loader and exported, making no changes in functionality.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Remove lines deactivated by #if 1 #else
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agodoc: README.uefi: fix typos
Heinrich Schuchardt [Sun, 30 Dec 2018 11:54:36 +0000 (12:54 +0100)]
doc: README.uefi: fix typos

%s/specfication/specification/
%s/selftest/self-test/
%s/little endian/little-endian/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_selftest: allow building on ARMv7-M
Heinrich Schuchardt [Sun, 30 Dec 2018 09:52:41 +0000 (10:52 +0100)]
efi_selftest: allow building on ARMv7-M

ARMv7-M only supports the Thumb instruction set. Our current crt0 code does
not support it. With the patch we can build all unit tests of the EFI
subsystem that do not require crt0.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: signature of StartImage and Exit
Heinrich Schuchardt [Fri, 28 Dec 2018 11:41:15 +0000 (12:41 +0100)]
efi_loader: signature of StartImage and Exit

We use u16* for Unicode strings and efi_uintn_t for UINTN. Correct the
signature of efi_exit() and efi_start_image().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: avoid unnecessary pointer to long conversion
Heinrich Schuchardt [Fri, 28 Dec 2018 11:41:14 +0000 (12:41 +0100)]
efi_loader: avoid unnecessary pointer to long conversion

debug() support supports %p to print pointers.

The debug message is unique. So there is not need to write a possibly
distracting line number.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: fix memory allocation on sandbox
Heinrich Schuchardt [Sat, 5 Jan 2019 22:41:36 +0000 (23:41 +0100)]
efi_loader: fix memory allocation on sandbox

Commit 7b78d6438a2b ("efi_loader: Reserve unaccessible memory") introduced
a comparison between RAM top and RAM start that was not known at the time
when the patch of commit 49759743bf09 ("efi_loader: eliminate sandbox
addresses") was written.

The sandbox uses an address space that is only relevant in the sandbox
context. We have to map ram_top from the sandbox address space to the
physical address space before using it in the EFI subsystem.

Fixes: 49759743bf09 ("efi_loader: eliminate sandbox addresses")
Fixes: 7b78d6438a2b ("efi_loader: Reserve unaccessible memory")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: CMD_BOOTEFI_HELLO_COMPILE in configs
Heinrich Schuchardt [Sun, 30 Dec 2018 09:11:14 +0000 (10:11 +0100)]
efi_loader: CMD_BOOTEFI_HELLO_COMPILE in configs

It should not be necessary to adjust CMD_BOOTEFI_HELLO_COMPILE in config
files.

arch/arm/lib/crt0_arm_efi.S cannot be compiled in thumbs mode. We can
disable CMD_BOOTEFI_HELLO_COMPILE for CONFIG_CPU_V7M. So there is no longer
a need to disable it in stm32 configs.

helloworld.efi can be built without problems on x86_64. So there is no need
to disable it in chromebook_link64_defconfig and qemu-x86_64_defconfig.

Same is true for ARM V7A. So do not disable CMD_BOOTEFI_HELLO_COMPILE in
kp_imx6q_tpc_defconfig.

Some architecture checks are already make for EFI_LOADER. There is no need
to repeat them for CMD_BOOTEFI_HELLO_COMPILE

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrice.Chotard@st.com
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: use named constant for efi_dp_from_mem()
Heinrich Schuchardt [Wed, 26 Dec 2018 21:23:00 +0000 (22:23 +0100)]
efi_loader: use named constant for efi_dp_from_mem()

When calling efi_dp_from_mem() use a named constant for the memory type.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agodistro: not taint environment variables if possible
AKASHI Takahiro [Tue, 4 Dec 2018 06:46:55 +0000 (15:46 +0900)]
distro: not taint environment variables if possible

The aim of this patch is not to have temporary variables used in
distro_bootcmd left as environment variables after run something.
See the discussion[1].
Without this patch, saveenv command also saves those variables, too.
While they are apparently safe, scsi_need_init can be harmful.

Please note that, in most cases, a variable should be converted to
hush's local variable, while "devplist" cannot because it is created
by "part" command as an environment variable.

[1] https://lists.denx.de/pipermail/u-boot/2018-December/350209.html

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: efi_connect_controller() use %pD
Heinrich Schuchardt [Sun, 9 Dec 2018 15:39:20 +0000 (16:39 +0100)]
efi_loader: efi_connect_controller() use %pD

EFI_ENTRY in efi_connect_controller() should use %pD to print the remaining
device path.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: efi_add_runtime_mmio()
Heinrich Schuchardt [Sun, 23 Dec 2018 01:35:13 +0000 (02:35 +0100)]
efi_loader: efi_add_runtime_mmio()

The first parameter of efi_add_runtime_mmio() is a pointer to a
pointer. This should be reflected in the documentation.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agodistro_bootcmd: add NVME support
Heinrich Schuchardt [Fri, 21 Dec 2018 01:18:16 +0000 (02:18 +0100)]
distro_bootcmd: add NVME support

Some boards support NVME drives. We should be able to use them as boot
devices.

NVME access requires running 'nvme scan'.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agotest: tests for u16_strdup() and u16_strcpy()
Heinrich Schuchardt [Fri, 14 Dec 2018 21:00:37 +0000 (22:00 +0100)]
test: tests for u16_strdup() and u16_strcpy()

Provide unit tests for u16_strdup() and u16_strcpy().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agolib: add u16_strcpy/strdup functions
Akashi, Takahiro [Fri, 14 Dec 2018 10:10:38 +0000 (19:10 +0900)]
lib: add u16_strcpy/strdup functions

Add u16_strcpy() and u16_strdup(). The latter function will be
used later in implementing efi HII database protocol.

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>
5 years agoefi_loader: struct efi_configuration_table
Heinrich Schuchardt [Mon, 17 Dec 2018 23:06:05 +0000 (00:06 +0100)]
efi_loader: struct efi_configuration_table

Commit 393fccdf6c73 ("efi_loader: efi_guid_t must be 64-bit aligned")
has changed the alignment of efi_guid_t. This changed the size of
struct efi_configuration_table on 32-bit systems form 20 to 24 bytes. As
an array of this type is pointed to by the system table this breaks
compatibility with existing versions of GRUB and Linux. Let's get back the
original size by using the attribute __packed.

Fixes: 393fccdf6c73 ("efi_loader: efi_guid_t must be 64-bit aligned")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agoefi_loader: efi_guid_t must be 64-bit aligned
Heinrich Schuchardt [Sun, 16 Dec 2018 10:16:03 +0000 (11:16 +0100)]
efi_loader: efi_guid_t must be 64-bit aligned

The UEFI Specification Version 2.7 Errata A defines:

"EFI_GUID
128-bit buffer containing a unique identifier value.
Unless otherwise specified, aligned on a 64-bit boundary."

Before this patch efi_guid_t was 8-bit aligned.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
5 years agotest/py: use default load address for tftp
Heinrich Schuchardt [Sat, 26 Jan 2019 14:25:12 +0000 (15:25 +0100)]
test/py: use default load address for tftp

On x86_64 the size of the file u-boot loaded by the tftp test has grown in
size such that when loading the file to 0x200000 it overwrites a memory
area reserved for PCI.

If no load address is specified for tftp do not use the ram base address
(or if zero 0x200000) but the default address.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoMerge git://git.denx.de/u-boot-x86
Tom Rini [Tue, 12 Feb 2019 12:16:46 +0000 (07:16 -0500)]
Merge git://git.denx.de/u-boot-x86

- Edison switch to CONFIG_OF_SEPARATE.
- Tangier initial ACPI support for PMIC device.
- TSC timer driver update to support native calibration.
- Fixes to 64-bit U-Boot proper.

5 years agox86: tangier: Add initial ACPI support for PMIC device
Andy Shevchenko [Tue, 5 Feb 2019 11:06:57 +0000 (13:06 +0200)]
x86: tangier: Add initial ACPI support for PMIC device

Basin Cove PMIC is connected to I2C0 bus which is hidden from the OS
and access is going via SCU device, enumerated via PCI.

For now, we add just a minimum support of PMIC device to allow enabling,
e.g. USB OTG, in the OS.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Bin Meng <bmeng.cn@gmail.com>
5 years agox86: Use the existing GDT in the ROM for 64-bit U-Boot proper
Bin Meng [Thu, 31 Jan 2019 16:22:14 +0000 (08:22 -0800)]
x86: Use the existing GDT in the ROM for 64-bit U-Boot proper

It is unnecessary to use a RAM version GDT for 64-bit U-Boot proper.
In fact we can just use the ROM version directly, which not only
eliminates the risk of being overwritten by application, but also
removes the complexity of patching the cpu_call64().

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agox86: Don't copy the cpu_call64() function to a hardcoded address
Bin Meng [Thu, 31 Jan 2019 16:22:13 +0000 (08:22 -0800)]
x86: Don't copy the cpu_call64() function to a hardcoded address

Before jumping to 64-bit U-Boot proper, SPL copies the cpu_call64()
function to a hardcoded address 0x3000000. This can have potential
conflicts with application usage. Switch the destination address
to be allocated from the heap to avoid such risk.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agox86: Change 4-level page table base address to low memory
Bin Meng [Thu, 31 Jan 2019 16:22:12 +0000 (08:22 -0800)]
x86: Change 4-level page table base address to low memory

At present the 4-level page table base address for 64-bit U-Boot
proper is assigned an address that conflicts with CONFIG_LOADADDR.
Change it to an address within the low memory range instead.

Fixes crashes seen when 'dhcp' on QEMU x86_64 with
"-net nic -net user,tftp=.,bootfile=u-boot".

Reported-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agox86: tsc: Add support for native calibration of TSC freq
Bernhard Messerklinger [Mon, 7 Jan 2019 11:14:40 +0000 (12:14 +0100)]
x86: tsc: Add support for native calibration of TSC freq

Add native tsc calibration function. Calibrate the tsc timer the same
way as linux does in arch/x86/kernel/tsc.c.

Fixes booting for Apollo Lake processors.

Signed-off-by: Bernhard Messerklinger <bernhard.messerklinger@br-automation.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agodoc: Fix CONFIG_OF_SEPARATE description
Andy Shevchenko [Tue, 8 Jan 2019 14:17:42 +0000 (16:17 +0200)]
doc: Fix CONFIG_OF_SEPARATE description

CONFIG_OF_SEPARATE description is not in align with actual code in Makefile and
thus has misleading instructions and explanation.

Make it aligned with the actual code.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agox86: edison: Switch to CONFIG_OF_SEPARATE
Andy Shevchenko [Tue, 8 Jan 2019 14:17:43 +0000 (16:17 +0200)]
x86: edison: Switch to CONFIG_OF_SEPARATE

There is no need for Intel Edison to have CONFIG_OF_EMBED to be enabled.
Replace it with CONFIG_OF_SEPARATE.

There is no functional change since u-boot.bin always contains DTB
either embedded or attached.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Ferry Toth <ftoth@exalondelft.nl>
5 years agoMerge branch 'master' of git://git.denx.de/u-boot-i2c
Tom Rini [Mon, 11 Feb 2019 16:15:34 +0000 (11:15 -0500)]
Merge branch 'master' of git://git.denx.de/u-boot-i2c

- DM I2C improvements

5 years agoMerge git://git.denx.de/u-boot-marvell
Tom Rini [Mon, 11 Feb 2019 15:35:52 +0000 (10:35 -0500)]
Merge git://git.denx.de/u-boot-marvell

- Fix BUILD_TARGET for ARCH_MVEBU from Baruch
- Fix MVEBU PCIe reset issues from Baruch
- Increase DDR stability on x530 from Chris

5 years agoARM: mvebu: x530: use MV_DDR_FREQ_SAR
Chris Packham [Mon, 11 Feb 2019 01:19:56 +0000 (14:19 +1300)]
ARM: mvebu: x530: use MV_DDR_FREQ_SAR

MV_DDR_FREQ_SAR lets the DDR frequency be determined by hardware
strapping. This also has the side effect of running the DDR clock in
synchronous mode with the CPU core clock rather than from an independent
PLL. We've seen this improve reliability in operation across a number of
boards and temperature ranges.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agoKconfig: fix BUILD_TARGET for ARCH_MVEBU
Baruch Siach [Thu, 7 Feb 2019 11:21:16 +0000 (13:21 +0200)]
Kconfig: fix BUILD_TARGET for ARCH_MVEBU

Commit dc146ca11187 ("Kconfig: Migrate CONFIG_BUILD_TARGET") made the
mvebu default build target depend on CONFIG_SPL_BUILD. Unfortunately,
there is no such Kconfig symbol. Use the CONFIG_SPL symbol instead to
fix that.

Cc: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agoarm: mvebu: cf gt-8k: dts: add PCIe slot reset support
Baruch Siach [Sun, 3 Feb 2019 13:15:40 +0000 (15:15 +0200)]
arm: mvebu: cf gt-8k: dts: add PCIe slot reset support

Describe the mini-PCIe slot gpio reset signal. This enables PCIe devices
on Clearfog GT-8K.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agopcie: designware: mvebu: fix reset release polarity
Baruch Siach [Sun, 3 Feb 2019 13:15:39 +0000 (15:15 +0200)]
pcie: designware: mvebu: fix reset release polarity

The dm_gpio_set_value() routine sets signal logical level, with
GPIO_ACTIVE_LOW/HIGH value taken into account. Reset active value is 1
(asserted), while reset inactive value is 0 (de-asserted). Fix the reset
toggle code to set the correct reset logic value.

Reported-by: Sven Auhagen <sven.auhagen@voleatech.de>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agoarm: mvebu: mcbin: dts: fix PCIe reset polarity
Baruch Siach [Sun, 3 Feb 2019 13:15:38 +0000 (15:15 +0200)]
arm: mvebu: mcbin: dts: fix PCIe reset polarity

The PCIe slot PERST signal is active low. Fix the gpio signal
description in the dts.

This happened to work because the pcie_dw_mvebu driver sets the reset
gpio level to 1 (high) to release the reset. The following commit will
fix that.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agoi2c: mux: Generate longer i2c mux name
Michal Simek [Thu, 31 Jan 2019 15:31:03 +0000 (16:31 +0100)]
i2c: mux: Generate longer i2c mux name

For !DM case busses are listed as
ZynqMP> i2c bus
Bus 0: zynq_0
Bus 1: zynq_0->PCA9544A@0x75:0
Bus 2: zynq_0->PCA9544A@0x75:1
Bus 3: zynq_0->PCA9544A@0x75:2
Bus 4: zynq_1
Bus 5: zynq_1->PCA9548@0x74:0
Bus 6: zynq_1->PCA9548@0x74:1
Bus 7: zynq_1->PCA9548@0x74:2
Bus 8: zynq_1->PCA9548@0x74:3
Bus 9: zynq_1->PCA9548@0x74:4
Bus 10: zynq_1->PCA9548@0x75:0
Bus 11: zynq_1->PCA9548@0x75:1
Bus 12: zynq_1->PCA9548@0x75:2
Bus 13: zynq_1->PCA9548@0x75:3
Bus 14: zynq_1->PCA9548@0x75:4
Bus 15: zynq_1->PCA9548@0x75:5
Bus 16: zynq_1->PCA9548@0x75:6
Bus 17: zynq_1->PCA9548@0x75:7

where is exactly describing i2c bus topology.
By moving to DM case i2c mux buses are using names from DT and because
i2c-muxes describing sub busses with the same names like i2c@0, etc it
is hard to identify which bus is where.
Linux is adding topology information to i2c-mux busses to identify them
better.
This patch is doing the same and composing bus name with topology
information.

When patch is applied with topology information on zcu102-revA.
ZynqMP> i2c bus
Bus 0: i2c@ff020000
   20: gpio@20, offset len 1, flags 0
   21: gpio@21, offset len 1, flags 0
   75: i2c-mux@75, offset len 1, flags 0
Bus 2: i2c@ff020000->i2c-mux@75->i2c@0
Bus 3: i2c@ff020000->i2c-mux@75->i2c@1
Bus 4: i2c@ff020000->i2c-mux@75->i2c@2
Bus 1: i2c@ff030000  (active 1)
   74: i2c-mux@74, offset len 1, flags 0
   75: i2c-mux@75, offset len 1, flags 0
Bus 5: i2c@ff030000->i2c-mux@74->i2c@0  (active 5)
   54: eeprom@54, offset len 1, flags 0
Bus 6: i2c@ff030000->i2c-mux@74->i2c@1
Bus 7: i2c@ff030000->i2c-mux@74->i2c@2
Bus 8: i2c@ff030000->i2c-mux@74->i2c@3
Bus 9: i2c@ff030000->i2c-mux@74->i2c@4
Bus 10: i2c@ff030000->i2c-mux@75->i2c@0
Bus 11: i2c@ff030000->i2c-mux@75->i2c@1
Bus 12: i2c@ff030000->i2c-mux@75->i2c@2
Bus 13: i2c@ff030000->i2c-mux@75->i2c@3
Bus 14: i2c@ff030000->i2c-mux@75->i2c@4
Bus 15: i2c@ff030000->i2c-mux@75->i2c@5
Bus 16: i2c@ff030000->i2c-mux@75->i2c@6
Bus 17: i2c@ff030000->i2c-mux@75->i2c@7

Behavior before the patch is applied.
ZynqMP> i2c bus
Bus 0: i2c@ff020000
   20: gpio@20, offset len 1, flags 0
   21: gpio@21, offset len 1, flags 0
   75: i2c-mux@75, offset len 1, flags 0
Bus 2: i2c@0
Bus 3: i2c@1
Bus 4: i2c@2
Bus 1: i2c@ff030000  (active 1)
   74: i2c-mux@74, offset len 1, flags 0
   75: i2c-mux@75, offset len 1, flags 0
Bus 5: i2c@0  (active 5)
   54: eeprom@54, offset len 1, flags 0
Bus 6: i2c@1
Bus 7: i2c@2
Bus 8: i2c@3
Bus 9: i2c@4
Bus 10: i2c@0
Bus 11: i2c@1
Bus 12: i2c@2
Bus 13: i2c@3
Bus 14: i2c@4
Bus 15: i2c@5
Bus 16: i2c@6
Bus 17: i2c@7

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
5 years agoi2c: Fill req_seq in i2c_post_bind()
Michal Simek [Thu, 31 Jan 2019 15:31:02 +0000 (16:31 +0100)]
i2c: Fill req_seq in i2c_post_bind()

For i2c controllers which are missing alias in DT there is no req_seq
setup. This function is setting up proper ID based on highest found
alias ID.

On zcu102 this is the behavior when patch is applied.
ZynqMP> i2c bus
Bus 0: i2c@ff020000
   20: gpio@20, offset len 1, flags 0
   21: gpio@21, offset len 1, flags 0
   75: i2c-mux@75, offset len 1, flags 0
Bus 2: i2c@0
Bus 3: i2c@1
Bus 4: i2c@2
Bus 1: i2c@ff030000  (active 1)
   74: i2c-mux@74, offset len 1, flags 0
   75: i2c-mux@75, offset len 1, flags 0
Bus 5: i2c@0  (active 5)
   54: eeprom@54, offset len 1, flags 0
Bus 6: i2c@1
Bus 7: i2c@2
Bus 8: i2c@3
Bus 9: i2c@4
Bus 10: i2c@0
Bus 11: i2c@1
Bus 12: i2c@2
Bus 13: i2c@3
Bus 14: i2c@4
Bus 15: i2c@5
Bus 16: i2c@6
Bus 17: i2c@7

Before this patch applied (controllers have -1 ID)
ZynqMP> i2c bus
Bus 0: i2c@ff020000
   20: gpio@20, offset len 1, flags 0
   21: gpio@21, offset len 1, flags 0
   75: i2c-mux@75, offset len 1, flags 0
Bus -1: i2c@0
Bus -1: i2c@1
Bus -1: i2c@2
Bus 1: i2c@ff030000  (active 1)
   74: i2c-mux@74, offset len 1, flags 0
   75: i2c-mux@75, offset len 1, flags 0
Bus -1: i2c@0  (active 0)
   54: eeprom@54, offset len 1, flags 0
Bus -1: i2c@1
Bus -1: i2c@2
Bus -1: i2c@3
Bus -1: i2c@4
Bus -1: i2c@0
Bus -1: i2c@1
Bus -1: i2c@2
Bus -1: i2c@3
Bus -1: i2c@4
Bus -1: i2c@5
Bus -1: i2c@6
Bus -1: i2c@7

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
5 years agoi2c: dm: Record maximum id of devices before probing devices
Michal Simek [Thu, 31 Jan 2019 15:31:01 +0000 (16:31 +0100)]
i2c: dm: Record maximum id of devices before probing devices

There is a need to find out the first free i2c ID which can be used for
i2s buses (including i2c buses connected to i2c mux). Do it early in
init and share this variable with other i2c classes for uniq bus
identification.

add from hs:
fix build problem in i2c-uclass.c for omap devices

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
5 years agoMerge branch 'master' of git://git.denx.de/u-boot-sh
Tom Rini [Sun, 10 Feb 2019 13:11:53 +0000 (08:11 -0500)]
Merge branch 'master' of git://git.denx.de/u-boot-sh

- SD/MMC fixes and ext4 memory leak fix

5 years agoMerge tag 'dm-pull-10feb19' of git://git.denx.de/u-boot-dm
Tom Rini [Sun, 10 Feb 2019 13:11:32 +0000 (08:11 -0500)]
Merge tag 'dm-pull-10feb19' of git://git.denx.de/u-boot-dm

Samsung sound patches (applied for Samsung maintainer)
Common sound support
buildman environment support
of-platdata documentation improvements

5 years agoMerge branch '2019-02-08-master-imports'
Tom Rini [Sun, 10 Feb 2019 13:04:53 +0000 (08:04 -0500)]
Merge branch '2019-02-08-master-imports'

- bcm6345 watchdog, bcm63158/bcm963158 initial support.
- Various TI platform resyncs and improvements.
- FDT support in Android-format images.
- stm32mp1 improvements.

5 years agosound: Allow audio codecs to be used by other SoCs
Simon Glass [Thu, 27 Dec 2018 20:24:39 +0000 (13:24 -0700)]
sound: Allow audio codecs to be used by other SoCs

At present there is still some samsung-specific code in the audio codecs.
Remove it so that these can be used by other SoCs.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agosound: i2s: Tidy up a few comments
Simon Glass [Thu, 27 Dec 2018 20:24:38 +0000 (13:24 -0700)]
sound: i2s: Tidy up a few comments

Fix a struct typo and drop a comment (and function prototype) which is not
actually used.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agosound: samsung: Fix 'regiter' typo
Simon Glass [Thu, 27 Dec 2018 20:24:37 +0000 (13:24 -0700)]
sound: samsung: Fix 'regiter' typo

Fix a typo that appears many times in this file.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agomisc: Allow child devices
Simon Glass [Thu, 27 Dec 2018 20:24:36 +0000 (13:24 -0700)]
misc: Allow child devices

Allow misc devices to have children, so that we can use this uclass for
cases where a child device (e.g. I2S) needs to access a misc driver for
transferring data.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agobuildman: fix typo
Chris Packham [Fri, 18 Jan 2019 07:40:29 +0000 (20:40 +1300)]
buildman: fix typo

Fix a typo in the error message from CheckOutputDir().

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agoof-platdata: improve documentation
Simon Goldschmidt [Wed, 16 Jan 2019 19:40:18 +0000 (20:40 +0100)]
of-platdata: improve documentation

Improve some things in the documentation of OF_PLATDATA that I found
while porting socfgpa_gen5 to it.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agobuildman: Write the environment out to an 'env' file
Simon Glass [Mon, 7 Jan 2019 23:44:23 +0000 (16:44 -0700)]
buildman: Write the environment out to an 'env' file

Sometimes it is useful to see the environment that was used to build
U-Boot. Write this out to a file in the build directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agommc: omap_hsmmc: Use regulator_set_enable_if_allowed for enabling regulator
Lokesh Vutla [Fri, 11 Jan 2019 09:45:52 +0000 (15:15 +0530)]
mmc: omap_hsmmc: Use regulator_set_enable_if_allowed for enabling regulator

Use regulator_set_enable_if_allowed() api instead of regulator_set_enable()
while enabling io regulators. This way the driver doesn't see an error
when disabling an always-on regulator and when enabling is not supported.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
5 years agopower: regulator: Introduce regulator_set_enable_if_allowed api
Lokesh Vutla [Fri, 11 Jan 2019 09:45:51 +0000 (15:15 +0530)]
power: regulator: Introduce regulator_set_enable_if_allowed api

regulator_set_enable() api throws an error in the following three cases:
- when requested to disable an always-on regulator
- when set_enable() ops not provided by regulator driver
- when enabling is actually failed.(Error returned by the regulator driver)

Sometimes consumer drivers doesn't want to track the first two scenarios
and just need to worry about the case where enabling is actually failed.
But it is also a good practice to have an error value returned in the
first two cases.

So introduce an api regulator_set_enable_if_allowed() which ignores the
first two error cases and returns an error as given by regulator driver.
Consumer drivers can use this api need not worry about the first two
error conditions.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>