platform/kernel/u-boot.git
4 years agoMerge tag 'ti-v2020.07-next' of https://gitlab.denx.de/u-boot/custodians/u-boot-ti...
Tom Rini [Tue, 17 Mar 2020 15:59:58 +0000 (11:59 -0400)]
Merge tag 'ti-v2020.07-next' of https://gitlab.denx.de/u-boot/custodians/u-boot-ti into next

K3 J721E:
* OSPI boot support
* Support for loading remote cores in R5 SPL
* PMIC ESM Support
* Minor fixes for R5F and C7x remoteproc drivers

K3 AM654:
* Update AVS class 0 voltages.
* Add I2C nodes

DRA7xx/AM57xx:
* Fixed Android boot on AM57xx

AM33/AM43/Davinci:
* switch to driver model for the net and mdio driver for baltos
* Add DM/DTS support for omap video driver
* Enable fastboot on am335x-evm

4 years agoMerge tag '20200316-for-next' of https://gitlab.denx.de/u-boot/custodians/u-boot...
Tom Rini [Tue, 17 Mar 2020 15:33:59 +0000 (11:33 -0400)]
Merge tag '20200316-for-next' of https://gitlab.denx.de/u-boot/custodians/u-boot-i2c into next

i2c: for next
- i2c-gpio: make it possible to run deblock sequence on driver probe
- i2c-gpio: add clock stretching support
- updates the Designware I2C driver for high speed mode,
  fix a bug and add some improvements.
- add DM support for memory based bootcounter driver

4 years agoMerge branch '2020-03-16-kbuild-etc-resync-v4.18' into next
Tom Rini [Tue, 17 Mar 2020 13:54:45 +0000 (09:54 -0400)]
Merge branch '2020-03-16-kbuild-etc-resync-v4.18' into next

- Update our Kbuild / Kconfig and relate functionality to be in line
  with the Linux kernel v4.18 release.

4 years agoconfigs: Drop '$(ARCH)' usage in CONFIG_SPL_LDSCRIPT
Tom Rini [Wed, 11 Mar 2020 22:11:18 +0000 (18:11 -0400)]
configs: Drop '$(ARCH)' usage in CONFIG_SPL_LDSCRIPT

In a few boards we had overridden, intentionally, the value used for
CONFIG_SPL_LDSCRIPT.  However, rather than using the ARCH value (arm)
they used the $(ARCH) variable in make.  This doesn't help really, so
switch to a hard-coded value.

Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agokconfig / kbuild: re-sync with Linux 4.18
Tom Rini [Wed, 11 Mar 2020 22:11:17 +0000 (18:11 -0400)]
kconfig / kbuild: re-sync with Linux 4.18

Align Kconfig and Kbuild logic to Linux 4.18 release with minimal impact
on files outside of this scope.

Our previous Kconfig sync was done by commit e91610da7c8a ("kconfig:
re-sync with Linux 4.17-rc4").

A very small number of changes upstream since our sync with v4.17-rc4
that exist in the v4.18 release have already been applied here and have
been omitted from the list in this commit (and are readily available in
our own git history).

The imported Linux commits are:
[From prior to v4.17-rc4]
39a33ff80a25 kbuild: remove cc-option-align
db547ef19064 Kbuild: don't add obj tree in additional includes
b999596b963a Kbuild: don't add ../../ to include path

[From v4.17 to v4.18]
b3aa58d2e85d fixdep: suppress consecutive / from file paths in dependency list files
74656b682902 kbuild: disable new dtc graph and unit-address warnings
74d931716151 genksyms: remove symbol prefix support
e6ecfb45072c kbuild: do not display CHK for filechk
0b669a5076fd kconfig: refactor Qt package checks for building qconf
b464ef583dc7 kconfig: refactor GTK+ package checks for building gconf
1c5af5cf9308 kconfig: refactor ncurses package checks for building mconf and nconf
694c49a7c01c kconfig: drop localization support
96f60dfa5819 trace: Use -mcount-record for dynamic ftrace
bb222ceeb327 kconfig: remove string expansion in file_lookup()
96d8e48da55a kconfig: remove string expansion for mainmenu after yyparse()
5b31a9746756 kconfig: remove sym_expand_string_value()
137c0118a900 kconfig: make default prompt of mainmenu less specific
e298f3b49def kconfig: add built-in function support
2fd5b09c201e kconfig: add 'shell' built-in function
9de071536c87 kconfig: begin PARAM state only when seeing a command keyword
9ced3bddec08 kconfig: support user-defined function and recursively expanded variable
1175c02506ff kconfig: support simply expanded variable
ed2a22f277c6 kconfig: support append assignment operator
82bc8bd82e5c kconfig: expand lefthand side of assignment statement
1d6272e6fe43 kconfig: add 'info', 'warning-if', and 'error-if' built-in functions
a702a6176e2f kconfig: add 'filename' and 'lineno' built-in variables
915f64901eb3 kconfig: error out if a recursive variable references itself
2bece88f89fa kconfig: test: add Kconfig macro language tests
21c54b774744 kconfig: show compiler version text in the top comment
59f7b5847b0c kbuild: $(CHECK) doesnt need NOSTDINC_FLAGS twice
145167650b96 kbuild: add endianness flag to CHEKCFLAGS
1f2f01b122d7 kbuild: add machine size to CHECKFLAGS
d6a0c8a1326b kconfig: Add testconfig into make help output
bb6d83dde191 kbuild: Move last word of nconfig help to the previous line
8593080c0fcf kconfig: fix localmodconfig
ed7d40bc67b8 tracing: Fix SKIP_STACK_VALIDATION=1 build due to bad merge with -mrecord-mcount
b2d00d7c61c8 kconfig: fix line numbers for if-entries in menu tree
ecd53ac2f2c6 kconfig: handle P_SYMBOL in print_symbol()
73d1c580f92b kconfig: loop boundary condition fix
48f6e3cf5bc6 kbuild: do not drop -I without parameter
bd412d81b7ea kbuild: .PHONY is not a variable, but PHONY is
6916162c7308 kbuild: remove duplicated comments about PHONY

Cc: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Masahiro Yamada <masahiroy@kernel.org>
4 years agoscripts/dtc: Update to upstream version v1.4.6-21-g84e414b0b5bc
Rob Herring [Wed, 11 Mar 2020 22:11:16 +0000 (18:11 -0400)]
scripts/dtc: Update to upstream version v1.4.6-21-g84e414b0b5bc

This adds the following commits from upstream:

84e414b0b5bc tests: Add a test case for the omit-if-no-ref keyword
4038fd90056e dtc: add ability to make nodes conditional on them being referenced
e1f139ea4900 checks: drop warning for missing PCI bridge bus-range
f4eba68d89ee checks: Print duplicate node name instead of parent name
46df1fb1b211 .travis.yml: Run valgrind checks via Travis
14a3002a1aee tests: Update valgrind suppressions for sw_tree1
02c5fe9debc0 tests: Remove valgrind error from tests/get_path
df536831d02c checks: add graph binding checks
2347c96edcbe checks: add a check for duplicate unit-addresses of child nodes
8f1b35f88395 Correct overlay syntactic sugar for generating target-path fragments
afbddcd418fb Suppress warnings on overlay fragments
119e27300359 Improve tests for dtc overlay generation

[From Linux Kernel commit 50aafd60898a8b3edf2f60e014a8288da3b2e5e3]
Signed-off-by: Rob Herring <robh@kernel.org>
[For applying to U-Boot]
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agoAzure / GitLab / Travis: Add Kconfig unit tests to a job
Tom Rini [Wed, 11 Mar 2020 22:11:15 +0000 (18:11 -0400)]
Azure / GitLab / Travis: Add Kconfig unit tests to a job

The Kconfig language provides a unit test that can be run.  As these
require pytest to be installed and run very quickly, bundle them in to
an existing CI job.

Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agomach-davinci: Hard-code the default SPL_LDSCRIPT path
Tom Rini [Wed, 11 Mar 2020 22:11:14 +0000 (18:11 -0400)]
mach-davinci: Hard-code the default SPL_LDSCRIPT path

As there is only one linker script to use in this case, rather than use
the BOARDDIR variable hard-code the path.

Cc: Lokesh Vutla <lokeshvutla@ti.com>
Suggested-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
Reviewed-by: Masahiro Yamada <masahiroy@kernel.org>
4 years agoedminiv2: Move CONFIG_SPL_LDSCRIPT to defconfig
Tom Rini [Wed, 11 Mar 2020 22:11:13 +0000 (18:11 -0400)]
edminiv2: Move CONFIG_SPL_LDSCRIPT to defconfig

As there is only one machine under mach-orion5x, having a Kconfig entry
for SPL_LDSCRIPT is not helpful, move this to the defconfig file.

Suggested-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Masahiro Yamada <masahiroy@kernel.org>
4 years agomx31pdk: Move CONFIG_SPL_LDSCRIPT to defconfig
Tom Rini [Mon, 24 Feb 2020 18:05:36 +0000 (13:05 -0500)]
mx31pdk: Move CONFIG_SPL_LDSCRIPT to defconfig

As there is only one mx31pdk config file and with upcoming updates to
the Kconfig parsing logic, rather than have an entry in
board/freescale/mx31pdk/Kconfig, move this single setting to the
defconfig file.

Cc: Magnus Lilja <lilja.magnus@gmail.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Magnus Lilja <lilja.magnus@gmail.com>
4 years agoKconfig: Remove redundant variable sets
Tom Rini [Wed, 11 Mar 2020 22:11:12 +0000 (18:11 -0400)]
Kconfig: Remove redundant variable sets

In a few places we have Kconfig entries that set SPL_LDSCRIPT to what is
the default value anyways.  Drop these.

Cc: Michal Simek <monstr@monstr.eu>
Cc: Rick Chen <rick@andestech.com>
Cc: Philippe Reynes <tremyfr@yahoo.fr>
Cc: Eric Jarrige <eric.jarrige@armadeus.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Michal Simek <michal.simek@xilinx.com> (for Microblaze)
Reviewed-by: Masahiro Yamada <masahiroy@kernel.org>
4 years agospl: Kconfig: Escape '$(ARCH)' in LDSCRIPT entries
Tom Rini [Wed, 11 Mar 2020 22:11:11 +0000 (18:11 -0400)]
spl: Kconfig: Escape '$(ARCH)' in LDSCRIPT entries

The default SPL / TPL linker script is in the $(ARCH) directory.  The
way we use this today works but isn't ideal.  With an update to Kconfig
to re-sync with the Linux Kernel, we need to escape the '$' here so that
it will end up being evaluated by make.

Cc: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Masahiro Yamada <masahiroy@kernel.org>
4 years agokbuild: remove unused dtc-version.sh script
Masahiro Yamada [Tue, 25 Feb 2020 23:02:24 +0000 (08:02 +0900)]
kbuild: remove unused dtc-version.sh script

This is U-Boot own code, and no longer used since commit 36dd5f1b8abc
("dtc: Switch to building and using our own dtc unless provided").

Prior to that commit, U-Boot relied on an external dtc, so this script
was used to check the dtc version.

Now U-Boot bundles our own dtc in script/dtc/dtc like Linux kernel.

Users are still allowed to pass DTC= option from the command line,
but they are supposed to choose correct version of dtc in this case.
So, we do not check the dtc version any more.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
4 years agospl.h: make <spl.h> self-contained
Masahiro Yamada [Mon, 24 Feb 2020 17:25:46 +0000 (02:25 +0900)]
spl.h: make <spl.h> self-contained

The static inline function spl_phase needs <asm/global_data.h>.

Some functions take pointers to struct blk_desc or image_header.
Add forward declarations.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agodebug_uart.h: make <debug_uart.h> self-contained
Masahiro Yamada [Mon, 24 Feb 2020 17:24:54 +0000 (02:24 +0900)]
debug_uart.h: make <debug_uart.h> self-contained

'uint' is not a primitive type. You need to include <linux/types.h>
or otherwise change it to (unsigned int).

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoasm-generic/u-boot.h: make <asm-generic/u-boot.h> self-contained
Masahiro Yamada [Mon, 24 Feb 2020 17:24:17 +0000 (02:24 +0900)]
asm-generic/u-boot.h: make <asm-generic/u-boot.h> self-contained

This header uses 'phys_addr_t' and 'ulong'. Include the definitions.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
[trini: Move include to below __ASSEMBLY__ test]
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agoglobal_data.h: make <asm-generic/global_data.h> self-contained
Masahiro Yamada [Mon, 24 Feb 2020 17:22:27 +0000 (02:22 +0900)]
global_data.h: make <asm-generic/global_data.h> self-contained

The compiler never knows what 'bd_t' is without including <asm/u-boot.h>.

By changing it to (struct bd_info), the compiler learns it is struct.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
4 years agoscripts/Makefile.lib: Re-add -Wno-simple_bus_reg to DTC_FLAGS
Tom Rini [Mon, 24 Feb 2020 17:50:35 +0000 (12:50 -0500)]
scripts/Makefile.lib: Re-add -Wno-simple_bus_reg to DTC_FLAGS

This exists in Linux Kernel with commit 70523a3ce5ff so put it in the
list of DTC_FLAGS that mirror Linux as we will catch up there.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Masahiro Yamada <masahiroy@kernel.org>
4 years agoscripts/Makefile.lib: Restore PCI related warnings to DTC_FLAGS
Tom Rini [Mon, 24 Feb 2020 17:50:34 +0000 (12:50 -0500)]
scripts/Makefile.lib: Restore PCI related warnings to DTC_FLAGS

While we are working on correcting usage related to the pci_bridge and
pci_device_bus_num warnings, disable these flags for now.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Masahiro Yamada <masahiroy@kernel.org>
4 years agokbuild: Re-sync DTC flag logic with v4.17
Tom Rini [Mon, 24 Feb 2020 17:50:33 +0000 (12:50 -0500)]
kbuild: Re-sync DTC flag logic with v4.17

The way that we have been handling additional DTC warning flags hasn't
matched the way the Linux Kernel does.  Resync this logic with v4.17.

Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agokbuild: fixdep: Resync this with v4.17
Tom Rini [Mon, 24 Feb 2020 17:50:32 +0000 (12:50 -0500)]
kbuild: fixdep: Resync this with v4.17

The previous kbuild resync of e91610da7c8a ("kconfig: re-sync with Linux
4.17-rc4") accidentally did not sync the fixdep program.  This commit
brings fixdep in line with the rest of that previous resync.

This includes all of the following Linux kernel commits:
fbfa9be9904e kbuild: move include/config/ksym/* to include/ksym/*
5b8ad96d1a44 fixdep: remove some false CONFIG_ matches
14a596a7e6fd fixdep: remove stale references to uml-config.h
ab9ce9feed36 fixdep: use existing helper to check modular CONFIG options
87b95a81357d fixdep: refactor parse_dep_file()
5d1ef76f5a22 fixdep: move global variables to local variables of main()
ccfe78873c22 fixdep: remove unneeded memcpy() in parse_dep_file()
4003fd80cba9 fixdep: factor out common code for reading files
01b5cbe7012f fixdep: use malloc() and read() to load dep_file to buffer
41f92cffba19 fixdep: remove unnecessary <arpa/inet.h> inclusion
7c2ec43a2154 fixdep: exit with error code in error branches of do_config_file()
4e433fc4d1a9 fixdep: trivial: typo fix and correction
dee81e988674 fixdep: faster CONFIG_ search
c1a95fda2a40 kbuild: add fine grained build dependencies for exported symbols
d8329e35cc08 fixdep: accept extra dependencies on stdin
4c835b57b8de fixdep: constify strrcmp arguments

Of note is that when applying dee81e988674 above our logic in that area
required some careful consideration to continue to apply.

[Fold in bugfix to allow us to include 638e69cf2230 from upstream]
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
[Merge everything to U-Boot, rework dee81e988674]
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Masahiro Yamada <masahiroy@kernel.org>
4 years agofixdep: fix U-Boot own code to handle only valid symbol characters
Masahiro Yamada [Tue, 18 Feb 2020 11:05:39 +0000 (20:05 +0900)]
fixdep: fix U-Boot own code to handle only valid symbol characters

Currently, fixdep skips parsing include/linux/kconfig.h, but if it
parsed it, it would translate the following code in kconfig.h

  config_enabled(CONFIG_VAL(option##_MODULE)

into:

  $(wildcard include/config/option##/module.h)

When Kbuild includes .*.cmd, it would emit the following error:

  *** unterminated call to function 'wildcard': missing ')'.  Stop.

This issue prevents us from importing the upstream Linux commit
638e69cf2230 ("fixdep: do not ignore kconfig.h").

Fix this by handling only alphanumerical characters and underscores.
This makes sense because they match to the valid character sets in
Kconfig symbols.

As a side-note, you can reproduce this issue only on GNU Make <= 4.2.1

For GNU Make <= 4.2.1, the '#' always means the start of a comment.
Hence, GNU Make thinks the closing ')' is missing.

The following commit in GNU Make changed how it handles '#' in
function invocations. So, this does not happen for GNU Make 4.3

| commit c6966b323811c37acedff05b576b907b06aea5f4
| Author: Paul Smith <psmith@gnu.org>
| Date:   Thu Dec 22 18:47:26 2016 -0500
|
|    [SV 20513] Un-escaped # are not comments in function invocations

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reported-by: Tom Rini <trini@konsulko.com>
4 years agobootcounter: add DM support for memory based bootcounter
Heiko Schocher [Mon, 2 Mar 2020 14:43:59 +0000 (15:43 +0100)]
bootcounter: add DM support for memory based bootcounter

add DM/DTS support for the memory based bootcounter
in drivers/bootcount/bootcount.c.

Let the old implementation in, so boards which have
not yet convert to DM/DTS do not break.

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoi2c: designware_i2c: add 'hs_hcnt' and 'hs_lcnt' for high speed
Jun Chen [Mon, 2 Mar 2020 08:58:57 +0000 (16:58 +0800)]
i2c: designware_i2c: add 'hs_hcnt' and 'hs_lcnt' for high speed

Add support for high speed if scl_sda_cfg exist.

Signed-off-by: Jun Chen <ptchentw@gmail.com>
Signed-off-by: Jun Chen <jun.chen@vatics.com>
4 years agoi2c: designware_i2c: remove 'has_high_speed'
Jun Chen [Mon, 2 Mar 2020 08:58:56 +0000 (16:58 +0800)]
i2c: designware_i2c: remove 'has_high_speed'

Remove 'has_high_speed' config since we can check high speed support
from IC_COMP_PARAM_1 register.

Signed-off-by: Jun Chen <ptchentw@gmail.com>
Signed-off-by: Jun Chen <jun.chen@vatics.com>
4 years agoi2c: designware_i2c: check is high speed possible support
Jun Chen [Mon, 2 Mar 2020 08:58:55 +0000 (16:58 +0800)]
i2c: designware_i2c: check is high speed possible support

To read IC_COMP_PARAM_1[3:2] to check is high speed possible,
and fall back to fast mode if not.

Signed-off-by: Jun Chen <ptchentw@gmail.com>
Signed-off-by: Jun Chen <jun.chen@vatics.com>
4 years agoi2c: designware_i2c: Fix IC_CON register setting for high speed mode
Jun Chen [Mon, 2 Mar 2020 08:58:54 +0000 (16:58 +0800)]
i2c: designware_i2c: Fix IC_CON register setting for high speed mode

IC_CON[2:1] should be 3 for high speed mode

Signed-off-by: Jun Chen <ptchentw@gmail.com>
Signed-off-by: Jun Chen <jun.chen@vatics.com>
4 years agomisc: i2c_eeprom: store pagesize instead of pagewidth in i2c_eeprom_drv_data
Masahiro Yamada [Fri, 28 Feb 2020 13:04:14 +0000 (22:04 +0900)]
misc: i2c_eeprom: store pagesize instead of pagewidth in i2c_eeprom_drv_data

Associate the pagesize with compatible strings, and copy it to
priv->pagesize. This is more straight-forward.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
4 years agoremoteproc: k3-r5: Fix rproc init failure on Split-mode _only_ devices
Suman Anna [Wed, 11 Mar 2020 01:24:29 +0000 (20:24 -0500)]
remoteproc: k3-r5: Fix rproc init failure on Split-mode _only_ devices

The R5F subsystem/cluster on K3 SoCs can support both LockStep and
Split-modes (superset) or just Split-mode depending on an eFUSE
capability register. The LockStep configuration bit is Read-only
though on Split-mode _only_ devices and as such the System Firmware
does not allow the LockStep mode bit to be configured on such devices.
The current logic in k3_r5f_rproc_configure() fails on Split-mode
devices because of this unconditional programming of the LockStep
mode bit, and results in the probe failure shown during the
"rproc init" step at U-Boot prompt.

Fix this by limiting the LockStep mode bit clear configuration only on
devices supporting both LockStep/Split-modes.

Fixes: 4c850356a83f ("remoteproc: Introduce K3 remoteproc driver for R5F subsystem")
Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
4 years agomisc: i2c_eeprom: remove pagewidth field from i2c_eeprom
Masahiro Yamada [Fri, 28 Feb 2020 13:04:13 +0000 (22:04 +0900)]
misc: i2c_eeprom: remove pagewidth field from i2c_eeprom

This struct member is not used in any effective way. Remove it.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
4 years agoremoteproc: k3-r5: Fix rproc init failure for Main R5FSS0
Suman Anna [Tue, 10 Mar 2020 23:34:54 +0000 (18:34 -0500)]
remoteproc: k3-r5: Fix rproc init failure for Main R5FSS0

The Main R5FSS0 cluster is also enabled to probe the R5F remoteproc
driver within R5 SPL for booting the Core0 very early. This results
in a ti_sci_power_domain_on failure during the probe from the A72
U-Boot when "rproc init" is executed at U-Boot prompt, and doesn't
enumerate all the rproc devices.

Fix this by suppressing the power_domain_on altogether using the
flag DM_FLAG_DEFAULT_PD_CTRL_OFF added in commit af94ad418dc7
("dm: core: Allow for not controlling the power-domain by DM framework").

Fixes: fac6aa817a09 ("configs: j721e_evm_r5: Enable R5F remoteproc support")
Signed-off-by: Suman Anna <s-anna@ti.com>
4 years agoremoteproc: k3-dsp: Add support for L2RAM loading on C66x DSPs
Suman Anna [Tue, 10 Mar 2020 21:05:56 +0000 (16:05 -0500)]
remoteproc: k3-dsp: Add support for L2RAM loading on C66x DSPs

The resets for the DSP processors on K3 SoCs are managed through the
Power and Sleep Controller (PSC) module. Each DSP typically has two
resets - a global module reset for powering on the device, and a local
reset that affects only the CPU while allowing access to the other
sub-modules within the DSP processor sub-systems.

The C66x DSPs have two levels of internal RAMs that can be used to
boot from, and the firmware loading into these RAMs require the
local reset to be asserted with the device powered on/enabled using
the module reset. Enhance the K3 DSP remoteproc driver to add support
for loading into the internal RAMs. The local reset is deasserted on
SoC power-on-reset, so logic has to be added in probe in remoteproc
mode to balance the remoteproc state-machine.

Note that the local resets are a no-op on C71x cores, and the hardware
does not supporting loading into its internal RAMs.

Signed-off-by: Suman Anna <s-anna@ti.com>
4 years agoarmv8: K3: j721e: Add DSP internal memory regions in MMU table
Suman Anna [Tue, 10 Mar 2020 21:05:55 +0000 (16:05 -0500)]
armv8: K3: j721e: Add DSP internal memory regions in MMU table

The A72 U-Boot code supports early load and boot of a number of
remote processors including the C66_0 and C66_1 DSPs. The current
code supports only loading into the DDR regions which were already
given the appropriate memory attributes. The C66 DSPs also have L1
and L2 internal memory regions that can behave as normal-memories.

Add a new entry to the J721E MMU table covering these regions with
the appropriate memory attributes to allow the A72 U-Boot code to
support loading directly into these memory regions.

Signed-off-by: Suman Anna <s-anna@ti.com>
4 years agoremoteproc: k3-dsp: Add a sanity check for DSP boot address alignment
Suman Anna [Tue, 10 Mar 2020 21:05:54 +0000 (16:05 -0500)]
remoteproc: k3-dsp: Add a sanity check for DSP boot address alignment

The DSP remote processors on K3 SoCs require a boot register to be
programmed with a boot address, and these boot addresses need to be
aligned on certain address boundaries. The current code does not have
any error checks, and relies on the System Firmware to perform the
checking. Add logic to perform this sanity check within the remoteproc
driver itself to detect these anomalies specifically, and print a
meaningful trace. This avoids the cumbersome debug of root-causing
such failures from the corresponding TI-SCI failure.

The C66x and C71x DSP cores have different alignment needs and are
as follows:
C66x DSP = 1 KB (0x400)
C71x DSP = 2 MB (0x200000)

Signed-off-by: Suman Anna <s-anna@ti.com>
4 years agoremoteproc: k3-dsp: Fix unbalanced state machine in k3_dsp_start
Suman Anna [Tue, 10 Mar 2020 21:05:53 +0000 (16:05 -0500)]
remoteproc: k3-dsp: Fix unbalanced state machine in k3_dsp_start

The global module reset is deasserted through the ti_sci_power_domain_on()
call in k3_dsp_start(), but is not asserted back if the local module reset
fails. Fix this.

While at this, remove the stale comment about assigned-clock-rates that
seems to have been copied from the K3 ARM64 Remoteproc driver.

Fixes: ab827b385718 ("remoteproc: Introduce K3 C66 and C71 remoteproc driver")
Signed-off-by: Suman Anna <s-anna@ti.com>
4 years agodm: i2c-gpio: add support for clock stretching
Heiko Schocher [Mon, 16 Mar 2020 06:55:06 +0000 (07:55 +0100)]
dm: i2c-gpio: add support for clock stretching

This adds support for clock stretching to the i2c-gpio driver. This is
accomplished by switching the GPIO used for the SCL line to an input
when it should be driven high, and polling on the SCL line value until
it goes high (indicating that the I2C slave is no longer pulling it
low).

This is enabled by default; for gpios which cannot be configured as
inputs, the i2c-gpio,scl-output-only property can be used to fall back
to the previous behavior.

Signed-off-by: Michael Auchter <michael.auchter@ni.com>
Cc: Heiko Schocher <hs@denx.de>
Reviewed-by: Heiko Schocher <hs@denx.de>
4 years agodm: i2c-gpio: rework gpio get/set functions
Michael Auchter [Fri, 7 Feb 2020 16:55:31 +0000 (10:55 -0600)]
dm: i2c-gpio: rework gpio get/set functions

This patch reworks i2c-gpio to make it easier to switch out the
implementation of the sda/scl get/set functions. This is in preparation
for a patch to conditionally implement clock stretching support.

Signed-off-by: Michael Auchter <michael.auchter@ni.com>
Cc: Heiko Schocher <hs@denx.de>
Reviewed-by: Heiko Schocher <hs@denx.de>
4 years agodoc: i2c: gpio: Document deblock sequence on probe
Marek Vasut [Tue, 18 Feb 2020 17:24:42 +0000 (18:24 +0100)]
doc: i2c: gpio: Document deblock sequence on probe

Document the gpio-i2c deblocking sequence binding.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Heiko Schocher <hs@denx.de>
4 years agoi2c: gpio: Run deblock sequence on probe
Marek Vasut [Fri, 7 Feb 2020 15:57:52 +0000 (16:57 +0100)]
i2c: gpio: Run deblock sequence on probe

Add deblock dequence for the I2C bus, needed on some devices. This sequence
is issued once, when probing the driver, and is controlled by DT property,
"i2c-gpio,deblock".

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Heiko Schocher <hs@denx.de>
4 years agoi2c: Add option to send start condition after deblocking
Marek Vasut [Fri, 7 Feb 2020 15:57:51 +0000 (16:57 +0100)]
i2c: Add option to send start condition after deblocking

Add option to send start condition after deblocking SDA.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Heiko Schocher <hs@denx.de>
4 years agoi2c: Export i2c_deblock_gpio_loop()
Marek Vasut [Fri, 7 Feb 2020 15:57:50 +0000 (16:57 +0100)]
i2c: Export i2c_deblock_gpio_loop()

Export the i2c_deblock_gpio_loop() so it can be used in other places in
U-Boot. In particular, this is useful in the GPIO I2C driver, which claims
the SDA/SCL GPIOs and thus prevents the i2c_deblock() implementation from
claiming the pins as GPIOs again.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Heiko Schocher <hs@denx.de>
4 years agoi2c: Make deblock delay and SCL clock configurable
Marek Vasut [Fri, 7 Feb 2020 15:57:49 +0000 (16:57 +0100)]
i2c: Make deblock delay and SCL clock configurable

Make the delay between SCL line changes and the number of SCL clock
changes configurable as a parameter of the deblock function. No
functional change.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Heiko Schocher <hs@denx.de>
4 years agoMerge branch '2020-03-12-rsa-improvements' into next
Tom Rini [Thu, 12 Mar 2020 16:45:27 +0000 (12:45 -0400)]
Merge branch '2020-03-12-rsa-improvements' into next

(Description from AKASHI Takahiro)

extend rsa_verify() for UEFI secure boot:

The current rsa_verify() requires five parameters for a RSA public key
for efficiency while RSA, in theory, requires only two. In addition,
those parameters are expected to come from FIT image.

So this function won't fit very well when we want to use it for the
purpose of implementing UEFI secure boot, in particular, image
authentication as well as variable authentication, where the essential
two parameters are set to be retrieved from one of X509 certificates in
signature database.

So, in this patch, additional three parameters will be calculated on the
fly when rsa_verify() is called without fdt which should contain
parameters above.

This calculation heavily relies on "big-number (or multi-precision)
library." Therefore some routines from BearSSL under MIT license are
imported in this implementation.

4 years agotest: enable RSA library test on sandbox
AKASHI Takahiro [Fri, 21 Feb 2020 06:13:01 +0000 (15:13 +0900)]
test: enable RSA library test on sandbox

We want to always run RSA library test on sandbox build in Travis CI.
Just adding CONFIG_RSA_VERIFY_WITH_PKEY would be good enough for this
purpose.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
4 years agotest: add rsa_verify() unit test
AKASHI Takahiro [Fri, 21 Feb 2020 06:13:00 +0000 (15:13 +0900)]
test: add rsa_verify() unit test

In this patch, a very simple test is added to verify that rsa_verify()
using rsa_verify_with_pkey() work correctly.

To keep the code simple, all the test data, either public key and
verified binary data, are embedded in the source.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
4 years agolib: rsa: add rsa_verify_with_pkey()
AKASHI Takahiro [Fri, 21 Feb 2020 06:12:59 +0000 (15:12 +0900)]
lib: rsa: add rsa_verify_with_pkey()

This function, and hence rsa_verify(), will perform RSA verification
with two essential parameters for a RSA public key in contract of
rsa_verify_with_keynode(), which requires additional three parameters
stored in FIT image.

It will be used in implementing UEFI secure boot, i.e. image authentication
and variable authentication.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agolib: rsa: generate additional parameters for public key
AKASHI Takahiro [Fri, 21 Feb 2020 06:12:58 +0000 (15:12 +0900)]
lib: rsa: generate additional parameters for public key

In the current implementation of FIT_SIGNATURE, five parameters for
a RSA public key are required while only two of them are essential.
(See rsa-mod-exp.h and uImage.FIT/signature.txt)
This is a result of considering relatively limited computer power
and resources on embedded systems, while such a assumption may not
be quite practical for other use cases.

In this patch, added is a function, rsa_gen_key_prop(), which will
generate additional parameters for other uses, in particular
UEFI secure boot, on the fly.

Note: the current code uses some "big number" routines from BearSSL
for the calculation.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
4 years agoinclude: image.h: add key info to image_sign_info
AKASHI Takahiro [Fri, 21 Feb 2020 06:12:57 +0000 (15:12 +0900)]
include: image.h: add key info to image_sign_info

For FIT verification, all the properties of a public key come from
"control fdt" pointed to by fdt_blob. In UEFI secure boot, on the other
hand, a public key is located and retrieved from dedicated signature
database stored as UEFI variables.

Added two fields may hold values of a public key if fdt_blob is NULL, and
will be used in rsa_verify_with_pkey() to verify a signature in UEFI
sub-system.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agorsa: add CONFIG_RSA_VERIFY_WITH_PKEY config
AKASHI Takahiro [Fri, 21 Feb 2020 06:12:56 +0000 (15:12 +0900)]
rsa: add CONFIG_RSA_VERIFY_WITH_PKEY config

In the next couple of commits, under new CONFIG_RSA_VERIFY_WITH_PKEY,
rsa_verify() will be extended to be able to perform RSA decryption without
additional RSA key properties from FIT image, i.e. rr and n0inv.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agolib: rsa: decouple rsa from FIT image verification
AKASHI Takahiro [Fri, 21 Feb 2020 06:12:55 +0000 (15:12 +0900)]
lib: rsa: decouple rsa from FIT image verification

Introduce new configuration, CONFIG_RSA_VERIFY which will decouple building
RSA functions from FIT verification and allow for adding a RSA-based
signature verification for other file formats, in particular PE file
for UEFI secure boot.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoimage.h: isolate android_image_* functions from tooling
Eugeniu Rosca [Sun, 8 Mar 2020 00:11:18 +0000 (01:11 +0100)]
image.h: isolate android_image_* functions from tooling

On Feb. 16, 2020, Tom reported [1] build failure of U-Boot in-tree
tooling after applying https://patchwork.ozlabs.org/cover/1229663/
("[v6,0/7] rsa: extend rsa_verify() for UEFI secure boot").

Later on, Heinrich stressed the urgency of the issue in
https://patchwork.ozlabs.org/patch/1250858/#2379069:

 >>>>>>>>>
 We should finalize the topic as it stops EFI patches from being merged
 >>>>>>>>>

On the surface, the problem is caused by U-Boot commits [2-3], which
employed 'u32' in 'include/image.h', while historically U-Boot tooling
stayed agnostic on the {u,s}{8,16,32} types.

Thanks to Tom, Yamada-san and Heinrich, the following solutions have
been put head-to-head ('+' pros, '-' cons):

 A. Use an equivalent fixed-size type, i.e. s/u32/uint32_t/ in both
    android function prototypes (image.h) and definitions (c file):
    + quick and low-line-count
    - creates a 'soup' of fixed-sized types in the Android C file
    - will confuse contributors
    - is going against Linux kernel best practices [4]

 B. Guard Android functions by '!defined(USE_HOSTCC)' in image.h:
    + quick and low-line-count
    + reflects the reality (no android function is used by tooling)
    + zero impact on other subsystems
    - ifdeffery may look annoying (pre-existing problem of image.h)

 C. Make {u8,u16,u32} available in U-Boot tooling:
    + quick and low-line-count
    + [Yamada-san][5]:
      * forbidding u32 for tools is questionable to me
      * Linux kernel and Barebox use {u8,u16,u32} for the tools space
    - breaks U-Boot tradition?
    - has larger impact than [A] and [B]
    - adds type complexity/inconsistency in the tooling space

 D. [Yamada-san] Refactor the headers to minimize the code shared
    between U-Boot space and tooling space:
    + probably the long-term solution
    - high effort
    - can be seen/done as an incremental update on top of [B]

Looking at the above, [B] looks like the natural way to go forward.

[1] https://patchwork.ozlabs.org/patch/1238245/#2363052
[2] commit 7f2531502c74c0 ("image: android: Add routine to get dtbo params")
[3] commit c3bfad825a71ea ("image: android: Add functions for handling dtb field")
[4] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e6176fa4728fb6d
    ("checkpatch: add --strict warning for c99 fixed size typedefs : int<size>_t")
[5] https://patchwork.ozlabs.org/patch/1238245/#2363340

Cc: Masahiro Yamada <masahiroy@kernel.org>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Sam Protsenko <joe.skb7@gmail.com>
Cc: Lokesh Vutla <lokeshvutla@ti.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reported-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Tested-by: Heinrich Schuchardt <xpyron.glpk@gmx.de>
4 years agoarm: mach-k3: Add a separate function for printing sysfw version
Lokesh Vutla [Tue, 10 Mar 2020 11:20:58 +0000 (16:50 +0530)]
arm: mach-k3: Add a separate function for printing sysfw version

Add a separate function for printing sysfw version so that it can be
called independently of k3_sysfw_loader.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
4 years agodefconfigs: am65x_hs_evm: Sync HS and non-HS defconfigs
Andrew F. Davis [Tue, 10 Mar 2020 15:08:41 +0000 (11:08 -0400)]
defconfigs: am65x_hs_evm: Sync HS and non-HS defconfigs

Additions have been made to the non-HS defconfig without the same
being made to the HS defconfig, sync them.

Signed-off-by: Andrew F. Davis <afd@ti.com>
4 years agoMerge tag 'mmc-2020-3-9' of https://gitlab.denx.de/u-boot/custodians/u-boot-mmc
Tom Rini [Wed, 11 Mar 2020 01:13:26 +0000 (21:13 -0400)]
Merge tag 'mmc-2020-3-9' of https://gitlab.denx.de/u-boot/custodians/u-boot-mmc

- DM support for CAxxxx SoCs
- eMMC board for presidio-asic
- Add defer probe for mmc sdhci
- TI SoCs mmc misc update

4 years agoarm: mediatek: remove unused binman config
Sam Shih [Wed, 4 Mar 2020 12:03:48 +0000 (20:03 +0800)]
arm: mediatek: remove unused binman config

The binman-option BINMAN_FDT is introduced by this commit:
commit 3c10dc95bdd0 ("binman: Add a library to access binman entries")
BINMAN_FDT being selected when BINMAN=y that resulting in mt7623
and mt7622 are unable to boot. The root cause of this issue is commit:
commit cbd2fba1eca1 ("arm: MediaTek: add basic support for MT7629 boards")
select BINMAN=y in all mediatek SoCs, and others mediatek SoCs not
expect to use BINMAN_FDT.
This patch remove BINMAN=y option when ARCH_MEDIATEK=y and
move this to the specify SoCs part config.

Signed-off-by: Sam Shih <sam.shih@mediatek.com>
Tested-by: Frank Wunderlich <frank-w@public-files.de>
4 years agopower-domain: fix hang in endless loop on i.MX8
Anatolij Gustschin [Mon, 17 Feb 2020 08:42:11 +0000 (09:42 +0100)]
power-domain: fix hang in endless loop on i.MX8

Currently when booting the kernel on i.MX8 U-Boot hangs in an
endless loop when switching off dma, connectivity or lsio power
domains during device removal. It hapens first when removing
gpio0 (gpio@5d080000) device, here its power domain device
'lsio_gpio0' is obtained for switching off power. Since the
obtained 'lsio_gpio0' device is removed afterwards, its power
domain is also switched off and here the parent power domain
device 'lsio_power_domain' is optained for switching off the
power. Thereafter, when the obtained 'lsio_power_domain' is
removed, device_remove() removes its first child 'lsio_gpio0'.
During this child removal the 'lsio_power_domain' device is
obtained again for switching and when removing it later,
the same child removal is repeated, so we are stuck in an
endless loop. Below is a snippet from dm tree on i.MX8QXP
for better illustration of the DM devices relationship:

 Class     Index  Probed  Driver                Name
-----------------------------------------------------------
 root          0  [ + ]   root_driver           root_driver
...
 simple_bus    0  [ + ]   generic_simple_bus    |-- imx8qx-pm
 power_doma    0  [ + ]   imx8_power_domain     |   |-- lsio_power_domain
 power_doma    1  [ + ]   imx8_power_domain     |   |   |-- lsio_gpio0
 power_doma    2  [ + ]   imx8_power_domain     |   |   |-- lsio_gpio1

Do not remove a power domain device if it is a parent of the
currently controlled device.

Fixes: 52edfed65de9 ("dm: core: device: switch off power domain after device removal")
Signed-off-by: Anatolij Gustschin <agust@denx.de>
Reported-by: Oliver Graute <oliver.graute@gmail.com>
Reported-by: Fabio Estevam <festevam@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
Tested-by: Fabio Estevam <festevam@gmail.com>
4 years agoMerge tag 'u-boot-imx-20200310' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx
Tom Rini [Tue, 10 Mar 2020 17:13:08 +0000 (13:13 -0400)]
Merge tag 'u-boot-imx-20200310' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx

Fixes for 2020.04
-----------------

- DM : mx6sabresd
- mx6ul_14x14_evk: fix video
- mx8qxp; fix console for booting
- sync DTS with kernel (imx6sx)
- drop obsolete woodburn (mx35)

Travis: https://travis-ci.org/sbabic/u-boot-imx/builds/660550811

4 years agoMerge tag 'u-boot-atmel-fixes-2020.04-a' of https://gitlab.denx.de/u-boot/custodians...
Tom Rini [Tue, 10 Mar 2020 17:12:21 +0000 (13:12 -0400)]
Merge tag 'u-boot-atmel-fixes-2020.04-a' of https://gitlab.denx.de/u-boot/custodians/u-boot-atmel

First set of u-boot-atmel fixes for 2020.04 cycle:
- Includes two small configuration fixes that will solve the SPL booting
  on sama5d3_xplained board.

4 years agoMerge branch 'master' of https://gitlab.denx.de/u-boot/custodians/u-boot-net
Tom Rini [Tue, 10 Mar 2020 11:51:56 +0000 (07:51 -0400)]
Merge branch 'master' of https://gitlab.denx.de/u-boot/custodians/u-boot-net

4 years agomx6slevk: Convert to DM_ETH
Pedro Jardim [Thu, 13 Feb 2020 12:25:32 +0000 (09:25 -0300)]
mx6slevk: Convert to DM_ETH

This fixes the following warning:

===================== WARNING ======================
This board does not use CONFIG_DM_ETH (Driver Model
for Ethernet drivers). Please update the board to use
CONFIG_DM_ETH before the v2020.07 release. Failure to
update by the deadline may result in board removal.
See doc/driver-model/migration.rst for more info.
====================================================

Signed-off-by: Pedro Jardim <jardim.c.pedro@gmail.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
4 years agomx6sabreauto: Convert to DM_ETH
Pedro Jardim [Thu, 13 Feb 2020 17:59:43 +0000 (14:59 -0300)]
mx6sabreauto: Convert to DM_ETH

This fixes the following warning:

===================== WARNING ======================
This board does not use CONFIG_DM_ETH (Driver Model
for Ethernet drivers). Please update the board to use
CONFIG_DM_ETH before the v2020.07 release. Failure to
update by the deadline may result in board removal.
See doc/driver-model/migration.rst for more info.
====================================================

Signed-off-by: Pedro Jardim <jardim.c.pedro@gmail.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
4 years agomx7dsabresd: Boot in non secure by default
Fabio Estevam [Tue, 18 Feb 2020 19:09:59 +0000 (16:09 -0300)]
mx7dsabresd: Boot in non secure by default

Booting a mainline kernel in secure mode on i.MX7D causes only
one CPU to be brought up.

Change it to booting in non secure mode by default, which
allows the two CPUs to be brought up.

It does have a side effect of not probing the CAAM driver.
If CAAM driver is needed then a secure world OS such as OPTEE needs
to be used.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
4 years agoimx: imx8qm: enable relocation of fdt and initrd
Oliver Graute [Wed, 12 Feb 2020 12:01:17 +0000 (12:01 +0000)]
imx: imx8qm: enable relocation of fdt and initrd

Set CONFIG_SYS_BOOTMAPSZ to the amount of memory available which is needed
to relocate the kernel, device tree and initrd.

Remove 'fdt_high' and 'initrd_high' environment variables from default
environment which prevents relocation of FDT and initrd.

Signed-off-by: Oliver Graute <oliver.graute@kococonnector.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Ye Li <ye.li@nxp.com>
Cc: uboot-imx <uboot-imx@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
4 years agoarm: dts: imx8mq-evk: add phy-reset-gpios for fec1
Alifer Moraes [Fri, 14 Feb 2020 19:18:50 +0000 (16:18 -0300)]
arm: dts: imx8mq-evk: add phy-reset-gpios for fec1

Instead of resetting the ethernet phy through functions in imx8mq_evk.c, let the
driver reset the phy via dts description adding a reset duration of 10 ms
following atheros 8031's datasheet recommendation.

Signed-off-by: Alifer Moraes <alifer.wsdm@gmail.com>
4 years agomx6sabresd: Convert ethernet to driver model
Alifer Moraes [Mon, 10 Feb 2020 14:28:01 +0000 (11:28 -0300)]
mx6sabresd: Convert ethernet to driver model

Convert imx6sabresd ethernet to driver model to fix the following warning:

===================== WARNING ======================
This board does not use CONFIG_DM_ETH (Driver Model
for Ethernet drivers). Please update the board to use
CONFIG_DM_ETH before the v2020.07 release. Failure to
update by the deadline may result in board removal.
See doc/driver-model/migration.rst for more info.
====================================================

Signed-off-by: Alifer Moraes <alifer.wsdm@gmail.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
4 years agoboard: sama5d3_xplained: Fix uboot size when loaded from NAND by SPL
Fabien Lehoussel [Mon, 24 Feb 2020 15:45:31 +0000 (16:45 +0100)]
board: sama5d3_xplained: Fix uboot size when loaded from NAND by SPL

Uboot size is incorrect.
Uboot SPL use CONFIG_SYS_MONITOR_LEN to read uboot from NAND : 0x80000
With sama5d3_xplained_nandflash_defconfig : u-boot.bin size is ~800Ko 0xC0000

So I increased size to 1MB : 0x100000

Signed-off-by: Fabien Lehoussel <fabien.lehoussel@medianesysteme.com>
4 years agoboard: sama5d3_xplained: Fix SPL DTB read from NAND
Fabien Lehoussel [Mon, 24 Feb 2020 15:28:32 +0000 (16:28 +0100)]
board: sama5d3_xplained: Fix SPL DTB read from NAND

SPL boot cannot find dtb if CONFIG_SPL_SEPARATE_BSS is disabled :

CONFIG_SPL_SEPARATE_BSS=n

RomBOOT
<debug_uart> Missing DTB
 ### ERROR ### Please RESET the board ###
RomBOOT

CONFIG_SPL_SEPARATE_BSS=y

RomBOOT
<debug_uart>
U-Boot SPL 2019.04-linux4sam_6.2-icp-dirty (Feb 24 2020 - 15:34:35 +0100)
Trying to boot from NAND
<debug_uart>

Signed-off-by: Fabien Lehoussel <fabien.lehoussel@medianesysteme.com>
4 years agonet: phy: marvell: Unify 88E151x series phy_driver
Clemens Gruber [Mon, 24 Feb 2020 19:52:20 +0000 (20:52 +0100)]
net: phy: marvell: Unify 88E151x series phy_driver

The PHY models of the Marvell 88E151x series are not reliably
distinguishable by their uid / PHY identifiers.
The 88E1510, 88E1512, 88E1514 and 88E1518 all have the same OUI and
model number and bits 3:0 in the PHY Identifier 2 (Page 0, Reg 3) are
described as HW revision number, but both 88E1510 and 88E1518 PHYs were
observed with the same HW rev number (1).

Before commit 83cfbeb0df9f ("net: phy: Fix mask so that we can identify
Marvell 88E1518"), the 88E151x were detected because the HW revision
bits were masked from the uid. After that change, 88E1510/12/18 were all
detected as 88E1518 and the 88E1510 specific code was no longer run.

I modified the mask to again ignore all four HW revision bits, removed
the 88E1510 specific code (board-specific LED/INTn setup), which was not
called since late 2016 anyway and renamed the config function and
phy_driver struct to the better fitting 88e151x.

The uid and mask bits 3:0 are now again the same as in the Linux kernel.

Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com>
4 years agonet: tftp: use correct printf codes
Heinrich Schuchardt [Sat, 22 Feb 2020 07:43:40 +0000 (08:43 +0100)]
net: tftp: use correct printf codes

When printing unsigned numbers use %u.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: phy: dp83867: Add SGMII mode type switching
Michal Simek [Tue, 18 Feb 2020 12:51:02 +0000 (13:51 +0100)]
net: phy: dp83867: Add SGMII mode type switching

This patch adds ability to switch beetween two PHY SGMII modes.
Some hardware, for example, FPGA IP designs may use 6-wire mode
which enables differential SGMII clock to MAC.

Patch description, dt flags have been done in mainline Linux by
commit a2111c460c0c ("net: phy: dp83867: Add documentation for SGMII mode type")
and by commit 507ddd5c0d47 ("net: phy: dp83867: Add SGMII mode type switching")

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
4 years agodt-bindings: net: dp83867: Remove binding doc from U-Boot tree
Michal Simek [Mon, 17 Feb 2020 09:38:57 +0000 (10:38 +0100)]
dt-bindings: net: dp83867: Remove binding doc from U-Boot tree

U-Boot is having DT which doesn't cover all options currently supported by
driver. DT binding is aligned with Linux kernel version available here.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/net/ti,dp83867.txt
Based on my talk with Grygorii Strashko better will be to remove it.

Also Linux kernel bindings are being converted to yaml that's another
reason to do it only at one place.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>
4 years agonet: phy: add XFI, USXGMII types to is_10g_interface() helper
Alex Marginean [Thu, 9 Jan 2020 08:50:05 +0000 (10:50 +0200)]
net: phy: add XFI, USXGMII types to is_10g_interface() helper

The helper is used to reset PHYs on connect and it determines the clause
to use (C22/C45) based on interface type.  This fixes 'PHY reset timed out'
warnings in console for USXGMII/XFI PHYs.

Signed-off-by: Alex Marginean <alexandru.marginean@nxp.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
4 years agonet: phy: Fix overlong PHY timeout
Andre Przywara [Fri, 3 Jan 2020 22:08:47 +0000 (22:08 +0000)]
net: phy: Fix overlong PHY timeout

Commit 27c3f70f3b50 ("net: phy: Increase link up delay in
genphy_update_link()") increased the per-iteration waiting time from
1ms to 50ms, without adjusting the timeout counter. This lead to the
timeout increasing from the typical 4 seconds to over three minutes.

Adjust the timeout counter evaluation by that factor of 50 to bring the
timeout back to the intended value.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Fixes: net: phy: Increase link up delay in genphy_update_link() ("27c3f70f3b50")
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Matthias Brugger <mbrugger@suse.com>
Tested-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
4 years agodoc: net: Rewrite network driver documentation
Andre Przywara [Mon, 25 Nov 2019 01:32:15 +0000 (01:32 +0000)]
doc: net: Rewrite network driver documentation

doc/README.drivers.eth seems like a good source for understanding
U-Boot's network subsystem, but is only talking about legacy network
drivers. This is particularly sad as proper documentation would help in
porting drivers over to the driver model.

Rewrite the document to describe network drivers in the new driver model
world. Most driver callbacks/methods are almost identical in their
semantic, but recv() differs in some important details.

Also keep some parts of the original text at the end, to help
understanding old drivers. Add some hints on how to port drivers over.

This also uses the opportunity to reformat the document in reST, on the
way moving it into doc/driver-model and adding it into the structure
there.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
4 years agodrivers: net: phy: aquantia: make it less verbose
Alex Marginean [Wed, 4 Dec 2019 13:32:16 +0000 (15:32 +0200)]
drivers: net: phy: aquantia: make it less verbose

The driver now unconditionally prints some information that's not
universally useful.  Replace printf with debug.

Signed-off-by: Alex Marginean <alexandru.marginean@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
4 years agodrivers: net: phy: aquantia: drop XGMII as a valid system interface proto
Alex Marginean [Wed, 4 Dec 2019 13:32:15 +0000 (15:32 +0200)]
drivers: net: phy: aquantia: drop XGMII as a valid system interface proto

Use either USXGMII or XFI in aquantia_set_proto and drop XGMII as a valid
protocol configuration.  The PHY doesn't support it, it's just used as an
alias for one of the other two protocols.

Signed-off-by: Florin Chiculita <florinlaurentiu.chiculita@nxp.com>
Signed-off-by: Alex Marginean <alexandru.marginean@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
4 years agoenv: Update env_addr for mmc environment driver
Pankit Garg [Tue, 19 Nov 2019 09:49:31 +0000 (09:49 +0000)]
env: Update env_addr for mmc environment driver

Make sure the gd struct is up-to-date.

Signed-off-by: Pankit Garg <pankit.garg@nxp.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
4 years agophy: Include NC-SI in phy setup
Samuel Mendoza-Jonas [Tue, 18 Jun 2019 01:37:18 +0000 (11:37 +1000)]
phy: Include NC-SI in phy setup

Add NC-SI to the usual phy handling. This makes two notable changes:
- Somewhat similar to a fixed phy, phy_connect() will create an NC-SI
phy if CONFIG_PHY_NCSI is defined.
- An early return is added to phy_read() and phy_write() to handle a
case like the NC-SI phy which does not define a bus.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Reviewed-by: Joel Stanley <joel@jms.id.au>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
4 years agophy: Add support for the NC-SI protocol
Samuel Mendoza-Jonas [Tue, 18 Jun 2019 01:37:17 +0000 (11:37 +1000)]
phy: Add support for the NC-SI protocol

This introduces support for the NC-SI protocol, modelled as a phy driver
for other ethernet drivers to consume.

NC-SI (Network Controller Sideband Interface) is a protocol to manage a
sideband connection to a proper network interface, for example a BMC
(Baseboard Management Controller) sharing the NIC of the host system.
Probing and configuration occurs by communicating with the "remote" NIC
via NC-SI control frames (Ethernet header 0x88f8).

This implementation is roughly based on the upstream Linux
implementation[0], with a reduced feature set and an emphasis on getting
a link up as fast as possible rather than probing the full possible
topology of the bus.
The current phy model relies on the network being "up", sending NC-SI
command frames via net_send_packet() and receiving them from the
net_loop() loop (added in a following patch).

The ncsi-pkt.h header[1] is copied from the Linux kernel for consistent
field definitions.

[0]: https://github.com/torvalds/linux/tree/master/net/ncsi
[1]: https://github.com/torvalds/linux/blob/master/net/ncsi/ncsi-pkt.h

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Reviewed-by: Joel Stanley <joel@jms.id.au>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
4 years agoAzure/Travis: Re-sync jobs and clarify exclusions
Tom Rini [Mon, 9 Mar 2020 17:01:57 +0000 (13:01 -0400)]
Azure/Travis: Re-sync jobs and clarify exclusions

We keep both of these jobs in sync as much as possible even when the
primary motivation is to keep Travis from exceeding the build time limit
there.  With that in mind:
- Use "rk" not "rockchip" to get all Rockchip SoC platforms in one job,
  rather than just all Rockchip vendor platforms.
- The NXP LX216* SoCs have their own job, exclude them from the AArch64
  generic job.
- SoCFPGA SoCs have their own job, exclude them from the AArch64 generic
  job.

Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agoimx: imx8qm_rom7720: added missing USDHC Base address defines
Oliver Graute [Thu, 19 Dec 2019 14:25:53 +0000 (14:25 +0000)]
imx: imx8qm_rom7720: added missing USDHC Base address defines

Added missing USDHC Base address defines

Signed-off-by: Oliver Graute <oliver.graute@kococonnector.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Ye Li <ye.li@nxp.com>
Cc: uboot-imx <uboot-imx@nxp.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
4 years agoARM: dts: imx8mm-verdin: drop rgmii_rxc_dly/txc_dly
Max Krummenacher [Fri, 14 Feb 2020 12:36:44 +0000 (14:36 +0200)]
ARM: dts: imx8mm-verdin: drop rgmii_rxc_dly/txc_dly

The FEC in the i.MX8MM doesn't support this feature. So don't pretend one
can use it.

Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
4 years agoARM: dts: imx8mm-verdin: dm-spl for pinctrl_usdhc1 node
Igor Opaniuk [Fri, 14 Feb 2020 12:36:43 +0000 (14:36 +0200)]
ARM: dts: imx8mm-verdin: dm-spl for pinctrl_usdhc1 node

Let pinctrl configuration for eMMC node (usdhc1) also be
accessible in SPL.

Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
4 years agoserial_lpuart: make clock failure less verbose
Giulio Benetti [Fri, 31 Jan 2020 13:39:47 +0000 (14:39 +0100)]
serial_lpuart: make clock failure less verbose

Some device may enable CONFIG_CLK but not still support this clock in
CC, so better use debug() in place of dev_warn() otherwise a lot of
boards will throw useless dev_warn()s.

Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoimx8mm/mn: Add missing root clock entry for ARM core clock
Frieder Schrempf [Wed, 5 Feb 2020 11:45:28 +0000 (11:45 +0000)]
imx8mm/mn: Add missing root clock entry for ARM core clock

The current implementation in arch/arm/mach-imx/cpu.c uses non-DM
code to retrieve the core clock frequency. As the root clock is not
listed we currently get:

CPU:   Freescale i.MX8MMQ rev1.0 at 0 MHz

Fix this by adding the missing entry, which results in:

CPU:   Freescale i.MX8MMQ rev1.0 at 1200 MHz

Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
4 years agomx6cuboxi: don't disable fdt relocation
Baruch Siach [Tue, 4 Feb 2020 16:57:08 +0000 (18:57 +0200)]
mx6cuboxi: don't disable fdt relocation

fdt_high value of 0xffffffff disables fdt relocation on boot. We don't
need that for Cubox-i/Hummingboard. Rely on generic code to find the
optimal fdt location at boot time.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
4 years agoimx: Makefile: added missing ahab.o
Oliver Graute [Wed, 26 Feb 2020 12:15:24 +0000 (12:15 +0000)]
imx: Makefile: added missing ahab.o

added missing ahab.o in Makefile

Signed-off-by: Oliver Graute <oliver.graute@kococonnector.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Ye Li <ye.li@nxp.com>
Cc: uboot-imx <uboot-imx@nxp.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
4 years agomx6sxsabresd: Enable DM_PCI
Fabio Estevam [Wed, 19 Feb 2020 12:56:28 +0000 (09:56 -0300)]
mx6sxsabresd: Enable DM_PCI

Enale DM_PCI support in order to avoid board removal from
the project.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
4 years agoconfigs: imxrt1050-evk: enable D/I cache
Giulio Benetti [Sat, 1 Feb 2020 14:29:45 +0000 (15:29 +0100)]
configs: imxrt1050-evk: enable D/I cache

Soc supports cache so let's enable it.

Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
4 years agoimx: mx6ul_14x14_evk: configure for 24bpp display
Anatolij Gustschin [Wed, 5 Feb 2020 16:49:59 +0000 (17:49 +0100)]
imx: mx6ul_14x14_evk: configure for 24bpp display

Before DM_VIDEO conversion this board used 24bpp
display configuration, so use it again.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
4 years agoARM: dts: imx6sx-sdb: Sync with kernel 5.4.16
Fabio Estevam [Wed, 19 Feb 2020 12:56:27 +0000 (09:56 -0300)]
ARM: dts: imx6sx-sdb: Sync with kernel 5.4.16

Sync the imx6sx-sdb dts files with kernel 5.4.16.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
4 years agoARM: dts: imx6sx: Sync with kernel 5.4.16
Fabio Estevam [Wed, 19 Feb 2020 12:56:26 +0000 (09:56 -0300)]
ARM: dts: imx6sx: Sync with kernel 5.4.16

Sync the imx6sx dts files with kernel 5.4.16.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
4 years agoimx8qxp_mek: Add myself as maintainer
Fabio Estevam [Thu, 27 Feb 2020 17:58:55 +0000 (14:58 -0300)]
imx8qxp_mek: Add myself as maintainer

I would like to help co-maintaining this board.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
4 years agomx7dsabresd: Add myself as maintainer
Fabio Estevam [Thu, 27 Feb 2020 17:58:54 +0000 (14:58 -0300)]
mx7dsabresd: Add myself as maintainer

I would like to help co-maintaining this board.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
4 years agoimx8qxp_mek: Fix the console command line string
Fabio Estevam [Mon, 17 Feb 2020 18:17:01 +0000 (15:17 -0300)]
imx8qxp_mek: Fix the console command line string

Currently the expansion of the console variable leads to
the following kernel command line:

console=ttyLP0,${baudrate} earlycon root=/dev/mmcblk1p2 rootwait rw

, which causes the console to not show characters after the LPUART driver
is probed as the 'baudrate' variable is not properly translated.

Fix it by splitting the console variable in two parts: one for the
ttyLP0 part and the other one for the baudrate, which matches the way
it is done on other i.MX targets.

Tested by successfully booting a mainline kernel on a i.MX8QXP MEK
board.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
4 years agoimx: remove woodburn board
Stefano Babic [Wed, 19 Feb 2020 13:36:25 +0000 (14:36 +0100)]
imx: remove woodburn board

Board is not longer used, remove it.

Signed-off-by: Stefano Babic <sbabic@denx.de>
4 years agoimx6, aristainetos2c: add da9063 pmic setup
Heiko Schocher [Mon, 2 Mar 2020 08:44:03 +0000 (09:44 +0100)]
imx6, aristainetos2c: add da9063 pmic setup

On the aristainetos2c boards the PMIC needs to be initialized,
because the Ethernet PHY uses a different regulator that is not
setup per hardware default. This does not influence the other
versions as this regulator isn't used there at all.

Signed-off-by: Heiko Schocher <hs@denx.de>
4 years agoconfigs: j721e_evm: Add Support for eMMC boot
Faiz Abbas [Wed, 26 Feb 2020 08:14:39 +0000 (13:44 +0530)]
configs: j721e_evm: Add Support for eMMC boot

Enable configs to support eMMC boot.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
4 years agoconfigs: am65x_evm: Add CONFIG_SUPPORT_EMMC_BOOT
Faiz Abbas [Wed, 26 Feb 2020 08:14:38 +0000 (13:44 +0530)]
configs: am65x_evm: Add CONFIG_SUPPORT_EMMC_BOOT

With CONFIG_SUPPORT_EMMC_BOOT moved to Kconfig, move it to defconfig
files.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
4 years agoarm: dts: k3-j721e-r5-common-proc-board: Use unique names for dummy clocks
Faiz Abbas [Wed, 26 Feb 2020 08:14:37 +0000 (13:44 +0530)]
arm: dts: k3-j721e-r5-common-proc-board: Use unique names for dummy clocks

Update the dummy clock names to use unique identifiers. Otherwise the
previous node just gets overwitten by the next one with the same name.
This fixes eMMC boot not working on J721e-evm.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>