]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
3 years agotools: kwbimage: Validate extended headers of v1 images
Pali Rohár [Fri, 23 Jul 2021 09:14:02 +0000 (11:14 +0200)]
tools: kwbimage: Validate extended headers of v1 images

Add basic checks for extended headers of v1 images.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Chris Packham <judge.packham@gmail.com>
Tested-by: Chris Packham <judge.packham@gmail.com>
3 years agotools: kwbimage: Fix check for v0 extended header checksum
Pali Rohár [Fri, 23 Jul 2021 09:14:01 +0000 (11:14 +0200)]
tools: kwbimage: Fix check for v0 extended header checksum

Extended header checksum for v0 image is present only in the case when
extended header is present. Skip checksum validation if extended header
is not present.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Chris Packham <judge.packham@gmail.com>
Tested-by: Chris Packham <judge.packham@gmail.com>
3 years agotools: kwbimage: Don't crash when binary file name does not contain '/'
Pali Rohár [Fri, 23 Jul 2021 09:14:00 +0000 (11:14 +0200)]
tools: kwbimage: Don't crash when binary file name does not contain '/'

In the case when the file name is specified relative to the current
working directory, it does not contain '/' character and strrchr()
returns NULL.

The following strcmp() function then crashes on NULL pointer
dereference.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Chris Packham <judge.packham@gmail.com>
Tested-by: Chris Packham <judge.packham@gmail.com>
3 years agotools: kwbimage: Fix generation of SATA, SDIO and PCIe images
Pali Rohár [Fri, 23 Jul 2021 09:13:59 +0000 (11:13 +0200)]
tools: kwbimage: Fix generation of SATA, SDIO and PCIe images

SATA and SDIO images must be aligned to sector size (which in most cases
is 512 bytes) and Source Address in main header is stored in number of
sectors from the beginning of the drive. SATA image must be stored at
sector 1 and SDIO image at sector 0. Source Address for PCIe image is
not used and must be set to 0xFFFFFFFF.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Chris Packham <judge.packham@gmail.com>
Tested-by: Chris Packham <judge.packham@gmail.com>
3 years agotools: kwbimage: Add constant for SDIO bootfrom
Marek Behún [Fri, 23 Jul 2021 09:13:58 +0000 (11:13 +0200)]
tools: kwbimage: Add constant for SDIO bootfrom

Add constant for SDIO value of the bootfrom header field.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Chris Packham <judge.packham@gmail.com>
Tested-by: Chris Packham <judge.packham@gmail.com>
3 years agotools: kwbimage: Align SPI and NAND images to 256 bytes
Pali Rohár [Fri, 23 Jul 2021 09:13:57 +0000 (11:13 +0200)]
tools: kwbimage: Align SPI and NAND images to 256 bytes

Writing into SPI NOR and NAND memory can be done only in 256 bytes long
blocks. Align final image size so that when it is burned into SPI NOR or
NAND memory via U-Boot's commands (sf or mtd), we can use the $filesize
variable directly as the length argument.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Chris Packham <judge.packham@gmail.com>
Tested-by: Chris Packham <judge.packham@gmail.com>
3 years agotools: kwbimage: Simplify aligning and calculating checksum
Pali Rohár [Fri, 23 Jul 2021 09:13:56 +0000 (11:13 +0200)]
tools: kwbimage: Simplify aligning and calculating checksum

The return value of kwbimage_generate() is used for aligning the data
part of kwbimage. Use it for calculating proper 4 byte alignment as is
required by BootROM and also use it for allocating additional 4 bytes
for the 32-bit data checksum.

This simplifies the alignment code to be only at one place (in function
kwbimage_generate) and also simplifies setting checksum as it can be
directly updated in memory.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Chris Packham <judge.packham@gmail.com>
Tested-by: Chris Packham <judge.packham@gmail.com>
3 years agotools: kwbimage: Fix compilation without CONFIG_SYS_U_BOOT_OFFS
Pali Rohár [Fri, 23 Jul 2021 09:13:55 +0000 (11:13 +0200)]
tools: kwbimage: Fix compilation without CONFIG_SYS_U_BOOT_OFFS

The CONFIG_SYS_U_BOOT_OFFS option may be defined as empty string.
In this case it causes compilation error:

    tools/kwbimage.c: In function ‘image_headersz_v1’:
    tools/kwbimage.c:1002:39: error: expected expression before ‘)’ token
      if (headersz > CONFIG_SYS_U_BOOT_OFFS) {
                                           ^
    tools/kwbimage.c:1006:41: error: expected expression before ‘)’ token
        (int)headersz, CONFIG_SYS_U_BOOT_OFFS);
                                             ^
    tools/kwbimage.c:1011:35: error: expected expression before ‘;’ token
      headersz = CONFIG_SYS_U_BOOT_OFFS;
                                       ^
    make[1]: *** [scripts/Makefile.host:112: tools/kwbimage.o] Error 1
    make: *** [Makefile:1822: tools] Error 2

Check whether the value of CONFIG_SYS_U_BOOT_OFFS is really set.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Chris Packham <judge.packham@gmail.com>
Tested-by: Chris Packham <judge.packham@gmail.com>
3 years agoMerge branch '2021-07-28-assorted-fixes'
Tom Rini [Thu, 29 Jul 2021 16:10:23 +0000 (12:10 -0400)]
Merge branch '2021-07-28-assorted-fixes'

- Assorted bugfixes

3 years agoMerge tag 'ti-v2021.10-rc2' of https://source.denx.de/u-boot/custodians/u-boot-ti
Tom Rini [Thu, 29 Jul 2021 12:20:06 +0000 (08:20 -0400)]
Merge tag 'ti-v2021.10-rc2' of https://source.denx.de/u-boot/custodians/u-boot-ti

- Add MMC High speed modes for AM64 and J7200
- Add Sierra/Torrent SERDES driver
- Minor clean-ups for R5F boot from SPL

3 years agoboard: ti: k2g: Program PadConfig_202 before locking RSTMUX8
Suman Anna [Mon, 26 Jul 2021 23:22:48 +0000 (18:22 -0500)]
board: ti: k2g: Program PadConfig_202 before locking RSTMUX8

The PADCONFIG_202 register (0x02621328) is affected by the locking
of the RSTMUX8 register (0x02620328), and so cannot be configured
in kernel. This has been confirmed as a hardware bug and affects
all K2G SoCs.

Setup the pinmux for this pin before locking the RSTMUX8 register
to allow the ICSS1 PRU1 Ethernet PHY port to work properly. The
workaround was added only for the K2G-ICE board to configure the
pins needed for the PRUSS Ethernet usecase.

Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210726232248.24395-1-s-anna@ti.com
3 years agomkimage: use environment variable MKIMAGE_SIGN_PIN to set pin for OpenSSL Engine
Marc Kleine-Budde [Fri, 23 Jul 2021 20:17:50 +0000 (22:17 +0200)]
mkimage: use environment variable MKIMAGE_SIGN_PIN to set pin for OpenSSL Engine

This patch adds the possibility to pass the PIN the OpenSSL Engine
used during signing via the environment variable MKIMAGE_SIGN_PIN.
This follows the approach used during kernel module
signing ("KBUILD_SIGN_PIN") or UBIFS image
signing ("MKIMAGE_SIGN_PIN").

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
3 years agotest/py: Improve check for mksquashfs version
Marek Behún [Thu, 22 Jul 2021 20:52:05 +0000 (22:52 +0200)]
test/py: Improve check for mksquashfs version

Some builds of squashfs-tools append version string with "-git" or
similar. The float() conversion will fail in this case.

Improve the code to only convert to float() the string before the '-'
character.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
3 years agobuild: remove the variable NM in gen_ll_addressable_symbols.sh
Patrick Delaunay [Wed, 21 Jul 2021 07:56:07 +0000 (09:56 +0200)]
build: remove the variable NM in gen_ll_addressable_symbols.sh

With LTO activated, the buildman tools failed with an error on my
configuration (Ubuntu 20.04, stm32mp15_trusted_defconfig) with the error:

../arm-linux-gnueabi/bin/nm:
scripts/gen_ll_addressable_symbols.sh: file format not recognized

It seems the shell variable initialization NM=$(NM) is not correctly
interpreted when shell is started in the Makefile, but I have not this
issue when I compile the same target without buildman.

I don't found the root reason of the problem but I solve it by
providing $(NM) as script parameter instead using a shell variable.

The command executed is identical:

cmd_keep-syms-lto.c := NM=arm-none-linux-gnueabihf-gcc-nm \
u-boot/scripts/gen_ll_addressable_symbols.sh arch/arm/cpu/built-in.o \
.... net/built-in.o >keep-syms-lto.c

cmd_keep-syms-lto.c := u-boot/scripts/gen_ll_addressable_symbols.sh \
arm-none-linux-gnueabihf-gcc-nm arch/arm/cpu/built-in.o \
... net/built-in.o > keep-syms-lto.c

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agolib: rsa: rsa-sign: Minor bug in debug message
Chan, Donald [Mon, 19 Jul 2021 16:18:54 +0000 (09:18 -0700)]
lib: rsa: rsa-sign: Minor bug in debug message

*sig_size isn't set until later so use the correct variables.

Signed-off-by: Donald Chan <hoiho@lab126.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agolib: rsa: rsa-verify: Fix a typo in a debug message
Thomas Perrot [Mon, 19 Jul 2021 14:04:44 +0000 (16:04 +0200)]
lib: rsa: rsa-verify: Fix a typo in a debug message

Signed-off-by: Thomas Perrot <thomas.perrot@bootlin.com>
3 years agoarm64: Update memcpy_{from, to}io() helpers
Patrice Chotard [Mon, 19 Jul 2021 09:21:51 +0000 (11:21 +0200)]
arm64: Update memcpy_{from, to}io() helpers

At early U-Boot stage, before relocation, MMU is not yet configured
and disabled. DDR may not be configured with the correct memory
attributes (can be configured in MT_DEVICE instead of MT_MEMORY).

In this case, usage of memcpy_{from, to}io() may leads to synchronous
abort in AARCH64 in case the normal memory address is not 64Bits aligned.

To avoid such situation, forbid usage of normal memory cast to (u64 *) in
case MMU is not enabled.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Cc: mark.kettenis@xs4all.nl
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agoarm: use the correct prototype for reset_cpu function
Patrick Delaunay [Mon, 19 Jul 2021 09:21:50 +0000 (11:21 +0200)]
arm: use the correct prototype for reset_cpu function

Align reset_cpu function with the next prototypes in
sysreset.h or in cpu_func.h to solve compilation issue:

  void reset_cpu(void);

This patch solves the prototype conflict when cpu_func.h is
included.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agodoc: sandbox: Fix up dependencies
Simon Glass [Sun, 18 Jul 2021 20:14:24 +0000 (14:14 -0600)]
doc: sandbox: Fix up dependencies

These are out of date. Update them and point to the existing build
instructions to avoid duplication. Add a few that are missing.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agopci: swap_case: Allow compilation on 32-bit machines
Simon Glass [Sun, 18 Jul 2021 20:14:23 +0000 (14:14 -0600)]
pci: swap_case: Allow compilation on 32-bit machines

At present this driver assumes that ulong is 64-bits long. On 32-bit
machines it is not. Use the 64-bit code only on 64-bit machines.

This makes things work correctly on 32-bit machines.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoMerge branch '2021-07-28-build-improvements'
Tom Rini [Wed, 28 Jul 2021 22:51:16 +0000 (18:51 -0400)]
Merge branch '2021-07-28-build-improvements'

- Assorted Makefile cleanups
- A few code / build cleanups

3 years agoMakefile: Move drivers/i2c/ into drivers/Makefile
Simon Glass [Sun, 11 Jul 2021 03:14:37 +0000 (21:14 -0600)]
Makefile: Move drivers/i2c/ into drivers/Makefile

This rule should not be in the top-level Makefile. Now that we have a
consistent set of I2C Kconfigs for U-Boot proper, SPL and TPL, we can move
it.

Make use of the existing SPL/TPL rule in drivers/Makefile instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoi2c: Rename SPL/TPL_I2C_SUPPORT to I2C
Simon Glass [Sun, 11 Jul 2021 03:14:36 +0000 (21:14 -0600)]
i2c: Rename SPL/TPL_I2C_SUPPORT to I2C

Rename these options so that CONFIG_IS_ENABLED can be used with them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
3 years agoi2c: Create a new Kconfig for I2C
Simon Glass [Sun, 11 Jul 2021 03:14:35 +0000 (21:14 -0600)]
i2c: Create a new Kconfig for I2C

At present we have CONFIG_SPL_I2C but not CONFIG_I2C. The reason
CONFIG_I2C is not strictly necessary is that:

a) We have CONFIG_SYS_I2C_LEGACY and CONFIG_DM_I2C for the two possible
   i2c stacks
b) In U-Boot proper, we always build drivers/i2c/ regardless of the
   options

Still, it is better to have CONFIG_I2C - it makes U-Boot proper similar to
SPL/TPL, so we can (in a future commit) simplify the Makefile rules.

Enable it by default, since as above, we have separate options
(SYS_I2C_LEGACY and DM_I2C) to control whether it is 'really' enabled.

Once we have migrated I2C to driver model, we can drop SYS_I2C_LEGACY and
make DM_I2C become I2C. For now, this lets us simplify the Makefile rules.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
3 years agoi2c: Drop unused CONFIG_I2C
Simon Glass [Sun, 11 Jul 2021 03:14:34 +0000 (21:14 -0600)]
i2c: Drop unused CONFIG_I2C

This actually does nothing but is defined by a few dozen boards. Drop it,
so we can define a real one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
3 years agoi2c: Fix the migration warning
Simon Glass [Sun, 11 Jul 2021 03:14:33 +0000 (21:14 -0600)]
i2c: Fix the migration warning

While there is a CONFIG_I2C it does not really mean anything and is
defined by only a few dozen boards. This should key off
CONFIG_SYS_I2C_LEGACY instead.

Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
3 years agoi2c: Rename CONFIG_SYS_I2C to CONFIG_SYS_I2C_LEGACY
Simon Glass [Sun, 11 Jul 2021 03:14:32 +0000 (21:14 -0600)]
i2c: Rename CONFIG_SYS_I2C to CONFIG_SYS_I2C_LEGACY

It is quite confusing that CONFIG_SYS_I2C selects the legacy I2C and
CONFIG_DM_I2C selects the current I2C. The deadline to migrate I2C is less
than a year away.

Also we want to have a CONFIG_I2C for U-Boot proper just like we have
CONFIG_SPL_I2C for SPL, so we can simplify the Makefile rules.

Rename this symbol so it is clear it is going away.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
3 years agoRename DRIVERS_MISC_SUPPORT to DRIVERS_MISC
Simon Glass [Sun, 11 Jul 2021 03:14:31 +0000 (21:14 -0600)]
Rename DRIVERS_MISC_SUPPORT to DRIVERS_MISC

Rename these options so that CONFIG_IS_ENABLED can be used with them.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoRename GPIO_SUPPORT to GPIO
Simon Glass [Sun, 11 Jul 2021 03:14:30 +0000 (21:14 -0600)]
Rename GPIO_SUPPORT to GPIO

Rename these options so that CONFIG_IS_ENABLED can be used with them.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoRename SPL_USB_HOST_SUPPORT to SPL_USB_HOST
Simon Glass [Sun, 11 Jul 2021 03:14:29 +0000 (21:14 -0600)]
Rename SPL_USB_HOST_SUPPORT to SPL_USB_HOST

Rename this option so that CONFIG_IS_ENABLED can be used with it.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoRename SPL_WATCHDOG_SUPPORT to SPL_WATCHDOG
Simon Glass [Sun, 11 Jul 2021 03:14:28 +0000 (21:14 -0600)]
Rename SPL_WATCHDOG_SUPPORT to SPL_WATCHDOG

Rename this option so that CONFIG_IS_ENABLED can be used with it.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoRename SPL_MUSB_NEW_SUPPORT to SPL_MUSB_NEW
Simon Glass [Sun, 11 Jul 2021 03:14:27 +0000 (21:14 -0600)]
Rename SPL_MUSB_NEW_SUPPORT to SPL_MUSB_NEW

Rename this option so that CONFIG_IS_ENABLED can be used with it.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoRename SPL_ETH_SUPPORT to SPL_ETH
Simon Glass [Sun, 11 Jul 2021 03:14:26 +0000 (21:14 -0600)]
Rename SPL_ETH_SUPPORT to SPL_ETH

Rename this option so that CONFIG_IS_ENABLED can be used with it.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoRename SPL_CRYPTO_SUPPORT to SPL_CRYPTO
Simon Glass [Sun, 11 Jul 2021 03:14:25 +0000 (21:14 -0600)]
Rename SPL_CRYPTO_SUPPORT to SPL_CRYPTO

Rename this option so that CONFIG_IS_ENABLED can be used with it.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoRename SPL_POWER_SUPPORT to SPL_POWER
Simon Glass [Sun, 11 Jul 2021 03:14:24 +0000 (21:14 -0600)]
Rename SPL_POWER_SUPPORT to SPL_POWER

Rename this option so that CONFIG_IS_ENABLED can be used with it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agoMakefile: Move phy rules into drivers/phy
Simon Glass [Sun, 11 Jul 2021 03:14:23 +0000 (21:14 -0600)]
Makefile: Move phy rules into drivers/phy

These don't belong in the drivers Makefile so move them down into
the correct place.

Signed-off-by: Simon Glass <sjg@chromium.org>
[trini: Fixup some missing dependencies this exposed]
Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoMakefile: Sort the subdirectories
Simon Glass [Sun, 11 Jul 2021 03:14:22 +0000 (21:14 -0600)]
Makefile: Sort the subdirectories

Adjust the subdirectories included in this file so that they are in
alphabetical order. This makes it easier to follow.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoREADME: Fix hyphenation in the directory docs
Simon Glass [Sun, 11 Jul 2021 03:14:21 +0000 (21:14 -0600)]
README: Fix hyphenation in the directory docs

Hyphens are missing in various places where the intent is to create an
adjective. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agolib: Create a new Kconfig option for charset conversion
Simon Glass [Fri, 2 Jul 2021 18:36:17 +0000 (12:36 -0600)]
lib: Create a new Kconfig option for charset conversion

Rather than looking at two KConfig options in the Makefile, create a new
Kconfig option for compiling lib/charset.c

Enable it for UFS also, which needs this support.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoAllow efi_loader header to be included always
Simon Glass [Fri, 2 Jul 2021 18:36:16 +0000 (12:36 -0600)]
Allow efi_loader header to be included always

It is bad practice to put function declarations behind an #ifdef since
it makes it impossible to use IS_ENABLED() in the C code. The main reason
for doing this is when an empty static inline function is desired when
the feature is disabled.

To this end, this header provides two different versions of various
functions and macros. Collect them together in one place for clarity.
Allow all the rest of the header to be included, regardless of the
setting of EFI_LOADER.

With the inclusion of blk.h the 'struct blk_desc' declaration is
unnecessary. Drop it while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoUse LIB_UUID with ACPIGEN and FS_BTRFS
Simon Glass [Fri, 2 Jul 2021 18:36:15 +0000 (12:36 -0600)]
Use LIB_UUID with ACPIGEN and FS_BTRFS

Since the ACPI-generation code makes use of UUIDs we typically need to
enabled UUID support for it to build. Add a new Kconfig condition.

Use it for BTRFS also.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodisk: Tidy up #ifdefs in part_efi
Simon Glass [Fri, 2 Jul 2021 18:36:14 +0000 (12:36 -0600)]
disk: Tidy up #ifdefs in part_efi

This file does not correctly handle the various cases, sometimes
producing warnings about partition_basic_data_guid being defined but not
used. Fix it.

There was some discussion about adjusting Kconfig or making
HAVE_BLOCK_DEVICE a prerequisite for PARTITIONS, but apparently this is
not feasible. Such changes can be undertaken separate from the goal of
this series.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoMakefile: Drop include/asm directory as well as symlink
Simon Glass [Fri, 2 Jul 2021 18:36:13 +0000 (12:36 -0600)]
Makefile: Drop include/asm directory as well as symlink

At present when using 'make mrproper' on an out-of-tree build, a warning
is shown about include/asm being a directory. With old versions of U-Boot
it is a file, but more recently it has become a directory.

Remove this directory first, since that covers both cases.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoMerge branch '2021-07-28-setexpr-fmt-support'
Tom Rini [Wed, 28 Jul 2021 13:51:09 +0000 (09:51 -0400)]
Merge branch '2021-07-28-setexpr-fmt-support'

- Add a new feature (and CONFIG option) to allow setexpr to take format
  (%d, etc) arguments.

3 years agoAzureCI: Move i.MX8 builds to their own job
Tom Rini [Tue, 27 Jul 2021 21:01:28 +0000 (17:01 -0400)]
AzureCI: Move i.MX8 builds to their own job

The aarch64 catch-all job is starting to get close to or exceed the time
limit for jobs.  Move the i.MX8 boards to their own job to fix this.

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agotest: cmd: setexpr: add format string tests
Roland Gaudig [Fri, 23 Jul 2021 12:29:23 +0000 (12:29 +0000)]
test: cmd: setexpr: add format string tests

Add test cases for the setexpr format string operator.

Signed-off-by: Roland Gaudig <roland.gaudig@weidmueller.com>
[trini: Enable on sandbox]
Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agodoc: usage: add description for setexpr command
Roland Gaudig [Fri, 23 Jul 2021 12:29:22 +0000 (12:29 +0000)]
doc: usage: add description for setexpr command

Add usage for the setexpr command. It has been added to describe
mainly the new setexpr format string operation.

Signed-off-by: Roland Gaudig <roland.gaudig@weidmueller.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agocmd: setexpr: add format string handling
Roland Gaudig [Fri, 23 Jul 2021 12:29:21 +0000 (12:29 +0000)]
cmd: setexpr: add format string handling

Add format string handling operator to the setexpr command.
It allows to use C or Bash like format string expressions to be
evaluated with the result being stored inside the environment variable
name.

  setexpr <name> fmt <format> [value]...

The following example

  setexpr foo fmt "%d, 0x%x" 0x100 ff

will result in $foo being set to "256, 0xff".

Signed-off-by: Roland Gaudig <roland.gaudig@weidmueller.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agocmd: printf: add helper functions from busybox
Roland Gaudig [Fri, 23 Jul 2021 12:29:20 +0000 (12:29 +0000)]
cmd: printf: add helper functions from busybox

Import the following helper functions from Busybox-1.33.1 which are
required by printf.c:

  process_escape_sequence from libbb/process_escape_sequence.c,
  skip_whitespace from libbb/skip_whitespace.c,
  overlapping_strcpy  from libbb/safe_strncpy.c

  src-url: https://git.busybox.net/busybox/
  commit bcc5b0e6caca6c7602a6a41f "Bump version to 1.33.1"
  version: 1.33.1

Signed-off-by: Roland Gaudig <roland.gaudig@weidmueller.com>
3 years agocmd: printf: import busybox-1.33.1 printf.c
Roland Gaudig [Fri, 23 Jul 2021 12:29:19 +0000 (12:29 +0000)]
cmd: printf: import busybox-1.33.1 printf.c

Import printf.c from the Busybox project, which provides Bash like
format string handling.

  src-url: https://git.busybox.net/busybox/
  commit bcc5b0e6caca6c7602a6a41f "Bump version to 1.33.1"
  version: 1.33.1

Signed-off-by: Roland Gaudig <roland.gaudig@weidmueller.com>
3 years agolib: strto: add simple_strtoll function
Roland Gaudig [Fri, 23 Jul 2021 12:29:18 +0000 (12:29 +0000)]
lib: strto: add simple_strtoll function

Add simple_strtoll function for converting a string containing digits
into a long long int value.

Signed-off-by: Roland Gaudig <roland.gaudig@weidmueller.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoMerge tag 'u-boot-amlogic-20210727' of https://source.denx.de/u-boot/custodians/u...
Tom Rini [Tue, 27 Jul 2021 15:42:31 +0000 (11:42 -0400)]
Merge tag 'u-boot-amlogic-20210727' of https://source.denx.de/u-boot/custodians/u-boot-amlogic

- Add SMBIOS info for Khadas VIM boards
- Fix meson-axg-mipi PHY build
- Fix VIM3 board phy-names property setup
- Return correct value for non emmc boot sources on VIM3
- add kernel compression vars

3 years agoMerge tag 'u-boot-stm32-20210727' of https://source.denx.de/u-boot/custodians/u-boot-stm
Tom Rini [Tue, 27 Jul 2021 13:11:25 +0000 (09:11 -0400)]
Merge tag 'u-boot-stm32-20210727' of https://source.denx.de/u-boot/custodians/u-boot-stm

- FIP Enable OP-TEE and TZC support in SPL for STM32MP15 SoC
- Add stm32mp15 missing SPI clock support
- Manage pull-up on gpio button STM32MP15 boards
- Correct STM32MP15 boot when TAMPER registers are invalid
- Fix EMMC pinmux on STM32MP15 Avenger96 board

3 years agoconfigs: Enable SMBIOS for Khadas VIM boards
Artem Lapkin [Tue, 27 Jul 2021 01:23:19 +0000 (09:23 +0800)]
configs: Enable SMBIOS for Khadas VIM boards

Enable configs to support SMBIOS for all Khadas VIM boards

Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Artem Lapkin <art@khadas.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
3 years agoARM: dts: meson: Use devicetree for SMBIOS settings for Khadas VIM boards
Artem Lapkin [Tue, 27 Jul 2021 01:23:18 +0000 (09:23 +0800)]
ARM: dts: meson: Use devicetree for SMBIOS settings for Khadas VIM boards

Khadas vim series: Use devicetree for SMBIOS settings
Add settings and enable the default sysinfo driver so that these can come
from the device tree.

Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Artem Lapkin <art@khadas.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
3 years agophy: meson-axg-mipi: Access parent ofnode through dev_ofnode()
Alper Nebi Yasak [Fri, 14 May 2021 20:54:20 +0000 (23:54 +0300)]
phy: meson-axg-mipi: Access parent ofnode through dev_ofnode()

With commit 84a42ae36683 ("dm: core: Rename device node to indicate it
is private") and commit f10643cf8a4c ("dm: core: Access device ofnode
through functions") accesses to the "node" member were replaced with
dev_ofnode(). Also apply that replacement here.

Fixes: 4547551aa019 ("phy: Add Amlogic AXG MIPI PCIe Analog PHY driver")
Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
3 years agophy: meson-axg-mipi: Rename "priv_auto_alloc_size" to "priv_auto"
Alper Nebi Yasak [Fri, 14 May 2021 20:54:19 +0000 (23:54 +0300)]
phy: meson-axg-mipi: Rename "priv_auto_alloc_size" to "priv_auto"

With commit 41575d8e4c33 ("dm: treewide: Rename auto_alloc_size members
to be shorter") "priv_auto_alloc_size" was renamed to "priv_auto". Apply
the rename to these two drivers as well.

Fixes: 4547551aa019 ("phy: Add Amlogic AXG MIPI PCIe Analog PHY driver")
Fixes: 7ef19503bacf ("phy: Add Amlogic AXG MIPI D-PHY driver")
Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
3 years agoboard: amlogic: vim3: fix phy-names property setup
Artem Lapkin [Tue, 13 Jul 2021 06:48:47 +0000 (14:48 +0800)]
board: amlogic: vim3: fix phy-names property setup

phy-names was improperly implemented resulting in an inoperable USB-OTG
port.

- phy-names = "usb2-phy0\0\0usb2-phy1\0";
+ phy-names = "usb2-phy0\0usb2-phy1";

Signed-off-by: Artem Lapkin <art@khadas.com>
Acked-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
3 years agoVIM3: mmc_get_env_dev correct non emmc boot sources
Artem Lapkin [Thu, 27 May 2021 07:35:28 +0000 (15:35 +0800)]
VIM3: mmc_get_env_dev correct non emmc boot sources

need return -1 if boot source is not EMMC or SD ( for example it will be
useful if we have multy env sources configuration and device was booted
from SPI flash and env need read from SPI not from mmc )

Signed-off-by: Artem Lapkin <art@khadas.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
3 years agomeson64: add kernel compression vars
Artem Lapkin [Thu, 27 May 2021 06:43:51 +0000 (14:43 +0800)]
meson64: add kernel compression vars

make possible to load simple compressed linux kernel for meson64

Signed-off-by: Artem Lapkin <art@khadas.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
3 years agoARM: dts: stm32mp: Add OP-TEE reserved memory to SPL dtb
Alexandru Gagniuc [Thu, 15 Jul 2021 19:19:27 +0000 (14:19 -0500)]
ARM: dts: stm32mp: Add OP-TEE reserved memory to SPL dtb

Add the "/reserved-memory/optee" node to the SPL devicetree. The
purpose is to allow configuring TZC regions when booting OP-TEE.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agostm32mp1: spl: Configure TrustZone controller for OP-TEE
Alexandru Gagniuc [Thu, 15 Jul 2021 19:19:26 +0000 (14:19 -0500)]
stm32mp1: spl: Configure TrustZone controller for OP-TEE

OP-TEE is very particular about how the TZC should be configured.
When booting an OP-TEE payload, an incorrect TZC configuration will
result in a panic.

Most information can be derived from the SPL devicetree. The only
information we don't have is the split between TZDRAM and shared
memory. This has to be hardcoded. The rest of the configuration is
fairly easy, and only requires 3 TZC regions. Configure them.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
3 years agoarm: stm32mp: Implement support for TZC 400 controller
Alexandru Gagniuc [Thu, 15 Jul 2021 19:19:25 +0000 (14:19 -0500)]
arm: stm32mp: Implement support for TZC 400 controller

The purpose of this change is to allow configuring TrustZone (TZC)
memory permissions. For example, OP-TEE expects TZC regions to be
configured in a very particular way. The API presented here is
intended to allow exactly that.

UCLASS support is not implemented, because it would not be too useful.
Changing TZC permissions needs to be done with care, so as not to cut
off access to memory we are currently using. One place where we can
use this is at the end of SPL, right before jumping to OP-TEE.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agospl: Introduce spl_board_prepare_for_optee() hook
Alexandru Gagniuc [Thu, 15 Jul 2021 19:19:24 +0000 (14:19 -0500)]
spl: Introduce spl_board_prepare_for_optee() hook

OP-TEE requires some particular setup, which is not needed for linux
or other payloads. Add a hook for platform-specific code to perform
any OP-TEE related configuration and initialization.

A weak function is used because it is symmetrical to other
spl_board_prepare_for_*() implementations. A solution to avoid the use
of weak functions would trivially apply to all these implementations.
However, re-designing this is beyond the scope of this patch.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agospl: mmc: Support OP-TEE payloads in Falcon mode
Alexandru Gagniuc [Thu, 15 Jul 2021 19:19:23 +0000 (14:19 -0500)]
spl: mmc: Support OP-TEE payloads in Falcon mode

In general, Falcon mode means we're booting a linux kernel directly.
With FIT images, however, an OP-TEE secure kernel can be booted before
linux. Thus, if the next stage is an IH_OS_TEE, this isn't necessarily
a problem.

Of course, a general solution would involve mmc_load_image_raw_os()
only loading the binary, and leaving the decision of suitability to
someone else. However, a rework of the boot flow is beyond the scope
of this patch. Accept IH_OS_TEE as a valid OS value.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agoARM: dts: stm32: Fix AV96 eMMC pinmux
Marek Vasut [Tue, 20 Jul 2021 21:46:07 +0000 (23:46 +0200)]
ARM: dts: stm32: Fix AV96 eMMC pinmux

Commit 500327e2ea7 ("ARM: dts: stm32mp1: DT alignment with Linux kernel v5.8-rc1")
renamed sdmmc2_d47_pins_b phandle to sdmmc2_d47_pins_c, but without updating
the AV96 DT which uses that phandle. Linux missed similar update as well and
it was only added in commit 1ad6e36ec266 ("ARM: dts: stm32: Fix sdmmc2 pins
on AV96") .

Update the AV96 DT pinmux phandle, otherwise eMMC 8bit mode does not work
and access to eMMC takes a very long time to fall back to 4bit mode.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agoclk: stm32mp1: add support of missing SPI clocks
Patrick Delaunay [Fri, 9 Jul 2021 12:24:34 +0000 (14:24 +0200)]
clk: stm32mp1: add support of missing SPI clocks

Add the missing SPI clock even if these instances are not available
on STMicroelectronics boards: SPI2_K, SPI3_K, SPI4_K, SPI6_K.

With this patch, the SPI2 / SPI3 / SPI4 / SPI6 instances can be used on
customer design without the clock driver error:
  stm32mp1_clk_get_id: clk id 131 not found

Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agostm32mp1: add pull-up for gpio button PA13 and PA14
Patrick Delaunay [Fri, 9 Jul 2021 07:53:37 +0000 (09:53 +0200)]
stm32mp1: add pull-up for gpio button PA13 and PA14

When a push-button is released and PA13/PA14 are defined as input (high-Z)
the LED should not be active as the circuit is open but a small current
leak through PCB or push-button close the circuit and allows a small LED
bias giving erroneous level voltage.

So it is recommended to activate an internal pull-up in order to clearly
fix the voltage at PA13/PA14 when button is released and to wait
a short delay before to read the GPIO value only when the pull-up is
correctly configured.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
3 years agoarm: stm32mp1: force boot_device variable for invalid TAMP register value
Patrick Delaunay [Thu, 8 Jul 2021 08:53:56 +0000 (10:53 +0200)]
arm: stm32mp1: force boot_device variable for invalid TAMP register value

When the TAMP register 20 have an invalid value (0x0 for example after
TAMPER error) the "boot_device" U-Boot env variable have no value and
no error is displayed in U-Boot log.

The STM32MP boot command bootcmd_stm32mp failed with strange trace:
  "Boot over !"

and the next command in bootcmd_stm32mp failed with few indication:
  if test ${boot_device} = serial || test ${boot_device} = usb;
then stm32prog ${boot_device} ${boot_instance};

As it is difficult to investigate, the current patch avoids this issue:
- change the debug message to error: "unexpected boot mode" is displayed
- display trace "Boot over invalid!" in bootcmd_stm32mp
- execute "run distro_bootcmd" to try all the possible target

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
3 years agoconfigs: j721e_evm_r5: Disable K3 R5F remoteproc
Suman Anna [Mon, 26 Jul 2021 21:13:11 +0000 (16:13 -0500)]
configs: j721e_evm_r5: Disable K3 R5F remoteproc

The J721E R5 SPL will no longer support booting of the Main R5FSS Core0
after the R5 SPL re-architecture for System Firmware split. The MCU R5F
branch-only boot does not use the K3 R5F remoteproc driver, and relies
only on the filesystem (FS) support for now. The K3 R5F remoteproc driver
is therefore no longer needed in R5 SPL, so drop it from the J721E R5
defconfig.

Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210726211311.5977-6-s-anna@ti.com
3 years agoarm: dts: k3-j721e-r5: Remove MAIN R5FSS0 cluster from SPL
Suman Anna [Mon, 26 Jul 2021 21:13:10 +0000 (16:13 -0500)]
arm: dts: k3-j721e-r5: Remove MAIN R5FSS0 cluster from SPL

The MAIN R5FSS0 cluster and corresponding nodes are no longer required
to be enabled in R5 SPL after removing the support for booting any core
from this cluster on R5 SPL. So, remove these from the relevant dts
files.

This is essentially a revert of the additions done in commit 2984b82b3b76
("arm: dts: k3-j721e-r5: Enable r5fss0 cluster in SPL").

Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210726211311.5977-5-s-anna@ti.com
3 years agoarm: mach-k3: Cleanup common start_non_linux_remote_cores()
Suman Anna [Mon, 26 Jul 2021 21:13:09 +0000 (16:13 -0500)]
arm: mach-k3: Cleanup common start_non_linux_remote_cores()

The mach-k3 common code defined a weak start_non_linux_remote_cores()
function so that the proper implementation can be plugged in the
SoC-specific source files. This won't be needed anymore, so remove the
the common code.

Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210726211311.5977-4-s-anna@ti.com
3 years agoarm: mach-k3: j721e: Cleanup MAIN R5 boot code from R5 SPL
Suman Anna [Mon, 26 Jul 2021 21:13:08 +0000 (16:13 -0500)]
arm: mach-k3: j721e: Cleanup MAIN R5 boot code from R5 SPL

The common J7 specific start_non_linux_remote_cores() override function
implements the logic to load and boot the Main R5FSS Core0 from R5 SPL.
This won't be supported any more for either J721E or J7200 after the R5
SPL rearchitecture for the System Firmware split into TI Foundation
Security (TIFS) and Device Management (DM) firmwares. So, cleanup the
corresponding code and the related SPL env variables.

Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210726211311.5977-3-s-anna@ti.com
3 years agoarm: mach-k3: j721e: Move booting of Main R5FSS Core0 to A72 U-Boot
Suman Anna [Mon, 26 Jul 2021 21:13:07 +0000 (16:13 -0500)]
arm: mach-k3: j721e: Move booting of Main R5FSS Core0 to A72 U-Boot

The Main R5FSS Core0 on J721E SoCs is originally booted from R5 SPL
itself to achieve certain product-level early-boot metrics. This is
no longer supported after the R5 SPL re-architecture (support merged
for v2021.10-rc1). Move the booting of this core altogether from R5
SPL to A72 U-Boot.

The env variables are left as is for now, and will be cleaned up
in a subsequent patch.

Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210726211311.5977-2-s-anna@ti.com
3 years agoarm: dts: k3-am65: Fix up MCU R5FSS cluster mode back to Split-mode
Suman Anna [Mon, 26 Jul 2021 16:22:13 +0000 (11:22 -0500)]
arm: dts: k3-am65: Fix up MCU R5FSS cluster mode back to Split-mode

The default U-Boot environment variables and design are all set up to
have the MCU R5FSS cluster to be in Split-mode. This is the setting
in v2021.01 U-Boot and the dt nodes are synched with the kernel binding
property names in commit 468ec2f3ef8f ("remoteproc: k3_r5: Sync to
upstreamed kernel DT property names") merged in v2021.04-rc2.

The mode for the cluster got switched back to LockStep mode by mistake
in commit e49787634312 ("arm: dts: k3-am65: Sync Linux v5.11-rc6 dts
into U-Boot") also in v2021.04-rc2. This throws the following warning
messages when early-booting the cores using default env variables,

  k3_r5f_rproc r5f@41400000: Invalid op: Trying to start secondary core 2 in lockstep mode
  Load Remote Processor 1 with data@addr=0x82000000 65268 bytes: Failed!

Fix this by switching back the cluster to the expected Split-mode.
Make this mode change in the u-boot specific dtsi file to avoid such
sync overrides in the future until the kernel dts is also switched to
Split-mode by default.

Fixes: e49787634312 ("arm: dts: k3-am65: Sync Linux v5.11-rc6 dts into U-Boot")
Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210726162213.28719-1-s-anna@ti.com
3 years agoconfigs: am64x_evm_*_defconfig: Enable config to support gpt and FDT library overlay
Aswath Govindraju [Mon, 26 Jul 2021 15:28:07 +0000 (20:58 +0530)]
configs: am64x_evm_*_defconfig: Enable config to support gpt and FDT library overlay

Enable config to support gpt command on AM642 evm/sk and enable config for
FDT library overlay support

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210726152807.22991-7-a-govindraju@ti.com
3 years agoconfigs: am64x_evm_*_defconfig: Enable configs to support eMMC boot
Kishon Vijay Abraham I [Mon, 26 Jul 2021 15:28:06 +0000 (20:58 +0530)]
configs: am64x_evm_*_defconfig: Enable configs to support eMMC boot

Enable configs to support eMMC boot.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210726152807.22991-6-a-govindraju@ti.com
3 years agoconfigs: am64x_evm: Move CONFIG_SYS_MMC_ENV_DEV and CONFIG_SYS_MMC_ENV_PART to defcon...
Aswath Govindraju [Mon, 26 Jul 2021 15:28:05 +0000 (20:58 +0530)]
configs: am64x_evm: Move CONFIG_SYS_MMC_ENV_DEV and CONFIG_SYS_MMC_ENV_PART to defconfig files and enable configs to save env in eMMC and FAT write.

Kconfig symbols for SYS_MMC_ENV_DEV and SYS_MMC_ENV_PART have been added by
commit 7d080773347c1f6e0e896d9284134a2a411155d6. Therefore, move the
definitions of configs to corresponding board defconfig files and enable
configs to save env in eMMC.

Also enable config for FAT write in U-Boot.

Fixes: 33b7258947f4 ("board: ti: am64x: Add board support for am64x evm")
Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210726152807.22991-5-a-govindraju@ti.com
3 years agoconfigs: am64x_evm_a53_defconfig: Enable configs to support HS200/HS400
Kishon Vijay Abraham I [Mon, 26 Jul 2021 15:28:04 +0000 (20:58 +0530)]
configs: am64x_evm_a53_defconfig: Enable configs to support HS200/HS400

Enable configs to support HS200/HS400.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210726152807.22991-4-a-govindraju@ti.com
3 years agoarch: dts: am642-sk-u-boot: Disable main_sdhci0 DT node and define alias index 1...
Aswath Govindraju [Mon, 26 Jul 2021 15:28:03 +0000 (20:58 +0530)]
arch: dts: am642-sk-u-boot: Disable main_sdhci0 DT node and define alias index 1 for main_sdhci1 node

A Wilink wireless device is connected to MMCSD0 subsystem and is not
supported in U-Boot. Therefore, disable main_sdhci0 device tree node in
U-Boot.

If main_sdhci0 device tree node is disabled then the the index of
main_sdhci1 node becomes 0 which leads to break in boot flow. Therefore,
add an alias to fix the index to 1.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210726152807.22991-3-a-govindraju@ti.com
3 years agoarch: arm: mach-k3: am642_init: Correct the function name spl_boot_mode() to spl_mmc_...
Aswath Govindraju [Mon, 26 Jul 2021 15:28:02 +0000 (20:58 +0530)]
arch: arm: mach-k3: am642_init: Correct the function name spl_boot_mode() to spl_mmc_boot_mode()

Function spl_boot_mode() is called in common/spl/spl_mmc.c, to find the
boot mode for a given boot device. This function was renamed to
spl_mmc_boot_mode() by commit e97590654aea4c964f49bd915543a417d0c76996.

Therefore, rename spl_boot_mode to spl_mmc_boot_mode.

Fixes: 57dba04afbb7 ("arm: mach-k3: am642: Add support for boot device detection")
Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210726152807.22991-2-a-govindraju@ti.com
3 years agoconfigs: am64x_evm_r5_defconfig: Fix CONFIG_SPL_TEXT_BASE to 0x70000000
Aswath Govindraju [Mon, 26 Jul 2021 14:58:39 +0000 (20:28 +0530)]
configs: am64x_evm_r5_defconfig: Fix CONFIG_SPL_TEXT_BASE to 0x70000000

CONFIG_SPL_TEXT_BASE was set to 0x70000000 in the commit,
"26f32c32b250 configs: am64x_evm_*_defconfig: Rearrange the components in
SRAM to satisfy the limitations for USB DFU boot mode". This change seems
to have been dropped during a merge commit.

Therefore, fix this by setting CONFIG_SPL_TEXT_BASE to 0x70000000.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210726145840.18977-1-a-govindraju@ti.com
3 years agodoc: board: j721e_evm: Add documentation for firmware loading
Kishon Vijay Abraham I [Wed, 21 Jul 2021 15:58:49 +0000 (21:28 +0530)]
doc: board: j721e_evm: Add documentation for firmware loading

Add documentation for loading firmwares to be used by remote cores in
the system including the environment variables that has to be set to
load the firmwares.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210721155849.20994-21-kishon@ti.com
3 years agodoc: board: Move j721e document to doc/board/ti/ directory
Kishon Vijay Abraham I [Wed, 21 Jul 2021 15:58:48 +0000 (21:28 +0530)]
doc: board: Move j721e document to doc/board/ti/ directory

Move j721e document from board/ti/j721e/README to
doc/board/ti/j721e_evm.rst after converting it to RST format.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210721155849.20994-20-kishon@ti.com
3 years agoconfigs: j7200_evm_a72: Add CONFIG_PREBOOT to configure ethernet PHY
Kishon Vijay Abraham I [Wed, 21 Jul 2021 15:58:47 +0000 (21:28 +0530)]
configs: j7200_evm_a72: Add CONFIG_PREBOOT to configure ethernet PHY

Add CONFIG_PREBOOT to provide an automatic and easier way
to configure ethernet PHY before loading the firmware.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210721155849.20994-19-kishon@ti.com
3 years agoenv: ti: j721e-evm: Add env variable to power on & reset QSGMII PHY in J7200 EVM
Kishon Vijay Abraham I [Wed, 21 Jul 2021 15:58:46 +0000 (21:28 +0530)]
env: ti: j721e-evm: Add env variable to power on & reset QSGMII PHY in J7200 EVM

MAIN CPSW0 requires the PHY to be powered on and reset for QSGMII
operation. Add a env variable to configure driving "0" on ENET_EXP_PWRDN
controlled by GPIO EXPANDER2 (I2C Addr: 0x22), PIN: 17 and driving "1"
on ENET_EXP_RESETZ controlled by GPIO EXPANDER2 (I2C Addr: 0x22),
PIN: 18.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Reviewed-by: Suman Anna <s-anna@ti.com>
Link: https://lore.kernel.org/r/20210721155849.20994-18-kishon@ti.com
3 years agoconfigs: j7200_evm_a72_defconfig: Add config for torrent serdes and common clock...
Aswath Govindraju [Wed, 21 Jul 2021 15:58:45 +0000 (21:28 +0530)]
configs: j7200_evm_a72_defconfig: Add config for torrent serdes and common clock framework

Add config for torrent serdes and common clock framework.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210721155849.20994-17-kishon@ti.com
3 years agoconfigs: j721e_evm_a72_defconfig: Enable the drivers required for the USB3 support
Jean-Jacques Hiblot [Wed, 21 Jul 2021 15:58:44 +0000 (21:28 +0530)]
configs: j721e_evm_a72_defconfig: Enable the drivers required for the USB3 support

Enable the mmio mux driver, the J721E-wiz PHy driver and the cadence sierra
phy driver. All of them are required for USB3 support

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210721155849.20994-16-kishon@ti.com
3 years agoarm: dts: k3-j7200-common-proc-board-u-boot: Add u-boot tags for torrent serdes
Aswath Govindraju [Wed, 21 Jul 2021 15:58:43 +0000 (21:28 +0530)]
arm: dts: k3-j7200-common-proc-board-u-boot: Add u-boot tags for torrent serdes

Add u-boot tags for torrent serdes. This has properties specific to
u-boot on top of DT in v5.13 Linux Kernel.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210721155849.20994-15-kishon@ti.com
3 years agoarm: dts: k3-j7200-common-proc-board: Enable SERDES DT
Aswath Govindraju [Wed, 21 Jul 2021 15:58:42 +0000 (21:28 +0530)]
arm: dts: k3-j7200-common-proc-board: Enable SERDES DT

Add default lane function for torrent serdes. This is in sync
with v5.13 Linux Kernel.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210721155849.20994-14-kishon@ti.com
3 years agoarm: dts: k3-j7200-main: Add DT node for torrent serdes
Aswath Govindraju [Wed, 21 Jul 2021 15:58:41 +0000 (21:28 +0530)]
arm: dts: k3-j7200-main: Add DT node for torrent serdes

Add DT node for torrent serdes. This is in sync with v5.13 Linux Kernel.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210721155849.20994-13-kishon@ti.com
3 years agoARM: dts: k3-j721e: Add support for USB3 in USB0 instance
Kishon Vijay Abraham I [Wed, 21 Jul 2021 15:58:40 +0000 (21:28 +0530)]
ARM: dts: k3-j721e: Add support for USB3 in USB0 instance

Configure the parent clock of wiz3_pll0_refclk to the internal clock
required for USB3 to be functional and also remove "ti,usb2-only"
property as it now supports USB3 mode. This has properties specific to
u-boot on top of DT present in v5.13 of Linux Kernel.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210721155849.20994-12-kishon@ti.com
3 years agoboard: ti: j721e: Add support for probing and configuring Torrent serdes on J7200
Aswath Govindraju [Wed, 21 Jul 2021 15:58:39 +0000 (21:28 +0530)]
board: ti: j721e: Add support for probing and configuring Torrent serdes on J7200

Add support for probing and configuring Torrent serdes on J7200.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210721155849.20994-11-kishon@ti.com
3 years agophy: ti: j721e-wiz: Add support for WIZ module present in TI J721E SoC
Jean-Jacques Hiblot [Wed, 21 Jul 2021 15:58:38 +0000 (21:28 +0530)]
phy: ti: j721e-wiz: Add support for WIZ module present in TI J721E SoC

Add support for WIZ module present in TI's J721E SoC. WIZ is a SERDES
wrapper used to configure some of the input signals to the SERDES. It is
used with both Sierra(16G) and Torrent(10G) SERDES. This driver configures
three clock selects (pll0, pll1, dig) and supports resets for each of the
lanes.

This is an adaptation of the linux driver.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210721155849.20994-10-kishon@ti.com
3 years agophy: cadence: Add driver for Torrent SERDES
Aswath Govindraju [Wed, 21 Jul 2021 15:58:37 +0000 (21:28 +0530)]
phy: cadence: Add driver for Torrent SERDES

Add driver for Torrent SERDES.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210721155849.20994-9-kishon@ti.com
3 years agophy: cadence: Add driver for Sierra PHY
Alan Douglas [Wed, 21 Jul 2021 15:58:36 +0000 (21:28 +0530)]
phy: cadence: Add driver for Sierra PHY

Add a Sierra PHY driver with PCIe and USB support.
This driver is a port from the mainline linux driver.

The PHY has multiple lanes, which can be configured into
groups, and a generic PHY device is created for each group.

There are two resets controlling the overall PHY block, one
to enable the APB interface for programming registers, and
another to enable the PHY itself.  Additionally there are
resets for each PHY lane.

The PHY can be configured in hardware to read register
settings from ROM, or they can be written by the driver.

The sequence of operation on startup is to enable the APB
bus, write the PHY registers (if required)  for each lane
group, and then enable the PHY.  Each group of lanes
can then be individually controlled using the power_on()/
power_off() function for that generic PHY

One difference with the linux driver is that the PHY is
always reset after it is powered-on. This is because role
switching is not supported in u-boot and the cable
orientation is handled by the PHY reset.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Signed-off-by: Alan Douglas <adouglas@cadence.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210721155849.20994-8-kishon@ti.com
3 years agodt-bindings: ti-serdes-mux: Add defines for AM64 SoC
Kishon Vijay Abraham I [Wed, 21 Jul 2021 15:58:35 +0000 (21:28 +0530)]
dt-bindings: ti-serdes-mux: Add defines for AM64 SoC

AM64 has a single lane SERDES which can be configured to be used
with either PCIe or USB. Define the possilbe values for the SERDES
function in AM64 SoC here.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210721155849.20994-7-kishon@ti.com
3 years agodt-bindings: phy: cadence-torrent: Add defines for refclk driver
Kishon Vijay Abraham I [Wed, 21 Jul 2021 15:58:34 +0000 (21:28 +0530)]
dt-bindings: phy: cadence-torrent: Add defines for refclk driver

Add defines for refclk driver used to route the refclk out of torrent
SERDES.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210721155849.20994-6-kishon@ti.com
3 years agodt-bindings: phy: Add defines for AM64 SERDES Wrapper
Kishon Vijay Abraham I [Wed, 21 Jul 2021 15:58:33 +0000 (21:28 +0530)]
dt-bindings: phy: Add defines for AM64 SERDES Wrapper

Add defines for AM64 SERDES Wrapper.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210721155849.20994-5-kishon@ti.com
3 years agodt-bindings: phy: Add definitions for additional phy types
Aswath Govindraju [Wed, 21 Jul 2021 15:58:32 +0000 (21:28 +0530)]
dt-bindings: phy: Add definitions for additional phy types

Add definitions for additional phy types that's used specifically for
Torrent SERDES.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Link: https://lore.kernel.org/r/20210721155849.20994-4-kishon@ti.com