]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
3 years agospi: add spi controller support for MediaTek MT7620 SoC
Weijie Gao [Thu, 12 Nov 2020 08:36:42 +0000 (16:36 +0800)]
spi: add spi controller support for MediaTek MT7620 SoC

This patch adds spi controller support for MediaTek MT7620 SoC.

The SPI controller supports two chip selects. These two chip selects are
implemented as two separate register groups, but they share the same bus
(DI/DO/CLK), only CS pins are dedicated for each register group.
Appearently these two register groups cannot operates simulataneously so
they are implemented as one controller.

Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
3 years agogpio: add GPIO controller driver for MediaTek MT7620 SoC
Weijie Gao [Thu, 12 Nov 2020 08:36:33 +0000 (16:36 +0800)]
gpio: add GPIO controller driver for MediaTek MT7620 SoC

This patch adds GPIO controller driver for MediaTek MT7620 SoC

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
3 years agowatchdog: add watchdog driver for MediaTek MT7620 SoC
Weijie Gao [Thu, 12 Nov 2020 08:36:28 +0000 (16:36 +0800)]
watchdog: add watchdog driver for MediaTek MT7620 SoC

This patch adds watchdog support for the Mediatek MT7620 SoC

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
3 years agopinctrl: mtmips: add support for MediaTek MT7620 SoC
Weijie Gao [Thu, 12 Nov 2020 08:36:24 +0000 (16:36 +0800)]
pinctrl: mtmips: add support for MediaTek MT7620 SoC

This patch adds pinctrl support for MediaTek MT7620 SoC.
The MT7620 SoC supports only pinmux.

Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
3 years agoreset: mtmips: add reset controller support for MediaTek MT7620 SoC
Weijie Gao [Thu, 12 Nov 2020 08:36:19 +0000 (16:36 +0800)]
reset: mtmips: add reset controller support for MediaTek MT7620 SoC

This patch adds reset controller bits definition header file for MediaTek
MT7620 SoC

Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
3 years agoclk: add clock driver for MediaTek MT7620 SoC
Weijie Gao [Thu, 12 Nov 2020 08:36:10 +0000 (16:36 +0800)]
clk: add clock driver for MediaTek MT7620 SoC

This patch adds a clock driver for MediaTek MT7620 SoC.
This driver provides clock gate control as well as getting clock frequency
for CPU/SYS/XTAL and some peripherals.

Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
3 years agoserial: add uart driver for MediaTek MT7620 SoC
Weijie Gao [Thu, 12 Nov 2020 08:36:05 +0000 (16:36 +0800)]
serial: add uart driver for MediaTek MT7620 SoC

This patch adds uart support for MediaTek MT7620 and earlier SoCs.

The UART used by MT7620 is incompatible with the ns16550a driver.
All registers of this UART have different addresses. A special 16-bit
register for Divisor Latch is used to set the baudrate instead of the
original two 8-bit registers (DLL and DLM).

The driver supports of-platdata which is useful for tiny SPL.

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
3 years agoconfigs: mtmips: refresh for mt7628 based boards
Weijie Gao [Thu, 12 Nov 2020 08:36:00 +0000 (16:36 +0800)]
configs: mtmips: refresh for mt7628 based boards

Since mt7620 is added into Kconfig, the CONFIG_SOC_MT7628=y which is
omitted by default must be added back, otherwise make xxx_defconfig for
these boards will be configured for mt7620 platform.

Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
3 years agomips: mtmips: add two reference boards for mt7620
Weijie Gao [Thu, 12 Nov 2020 08:35:56 +0000 (16:35 +0800)]
mips: mtmips: add two reference boards for mt7620

The mt7620_rfb board supports integrated 10/100M PHYs plus two external
giga PHYs. It also has 8MB SPI-NOR, mini PCI-e x1 slot, SDHC and USB.

The mt7620_mt7530_rfb boards supports an external MT7530 giga switch and a
16MB SPI-NOR flash.

Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
3 years agomips: mtmips: add support for MediaTek MT7620 SoC
Weijie Gao [Thu, 12 Nov 2020 08:35:52 +0000 (16:35 +0800)]
mips: mtmips: add support for MediaTek MT7620 SoC

This patch adds support for MediaTek MT7620 SoC.
All files are dedicated for u-boot.

Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
3 years agomips: mtmips: add support to initialize SDRAM
Weijie Gao [Thu, 12 Nov 2020 08:35:43 +0000 (16:35 +0800)]
mips: mtmips: add support to initialize SDRAM

This patch adds support for mtmips SoCs to initialize the SDRAM.

Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
3 years agomips: enable _machine_restart for spl
Weijie Gao [Thu, 12 Nov 2020 08:35:38 +0000 (16:35 +0800)]
mips: enable _machine_restart for spl

The sysreset driver has a config CONFIG_SPL_SYSRESET for the spl stage.
Change CONFIG_SYSRESET to CONFIG_IS_ENABLED(SYSRESET) will give spl a
chance to use _machine_restart instead of the sysreset driver.

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
3 years agomips: mtmips: fix dram size detection in dram_init
Weijie Gao [Thu, 12 Nov 2020 08:35:33 +0000 (16:35 +0800)]
mips: mtmips: fix dram size detection in dram_init

CONFIG_SYS_SDRAM_BASE points to cached memory, i.e. KSEG0, which is not
suitable for detecting memory size.

Replace CONFIG_SYS_SDRAM_BASE with KSEG1, and make dram_init() always do
memory size detection in any stage.

Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
3 years agomips: mtmips: select SYSRESET for mt7628 only
Weijie Gao [Thu, 12 Nov 2020 08:35:28 +0000 (16:35 +0800)]
mips: mtmips: select SYSRESET for mt7628 only

Currently only mt7628 needs the sysreset driver, do not select it for
mt7620.

Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
3 years agomips: mtmips: move mt7628 related Kconfig into mt7628 subdirectory
Weijie Gao [Thu, 12 Nov 2020 08:35:23 +0000 (16:35 +0800)]
mips: mtmips: move mt7628 related Kconfig into mt7628 subdirectory

This patch is a preparation for add a new soc fot mtmips.

Move all mt7628 related Kconfig (boards and UART selection) into mt7628
subdirectory and make sure the top directory of mtmips contains only
selection for SoCs.

Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
3 years agomips: dts: switch to board defines for dtb for mtmips
Weijie Gao [Thu, 12 Nov 2020 08:35:17 +0000 (16:35 +0800)]
mips: dts: switch to board defines for dtb for mtmips

Previous the dts files for gardena-smart-gateway-mt7688 and
linkit-smart-7688 are set to be built when mtmips is selected.

This can lead to a compilation error if another soc is added to this arch
with different dtsi files.

So it's better to build the dtb only if their board is selected.

Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
3 years agoMerge tag 'efi-2021-04-rc1-3' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Sun, 24 Jan 2021 00:07:00 +0000 (19:07 -0500)]
Merge tag 'efi-2021-04-rc1-3' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi

Pull request for UEFI sub-system for efi-2021-04-rc1-3

Bug fixes for UEFI sub-system:

* correct value of  EFI_BLOCK_IO_PROTOCOL.Media.LastBlock
* correct GUID when closing of EFI_LOAD_FILE_PROTOCOL
* error handling in mkeficapsule tool

Bug fixes for FAT file system:

* consistent error handling for flush dir()

3 years agoRevert "doc: update Kernel documentation build system"
Tom Rini [Sat, 23 Jan 2021 17:51:37 +0000 (12:51 -0500)]
Revert "doc: update Kernel documentation build system"

Unfortunately we now see a number of now-fatal warnings about duplicate
labels.  It is often unclear how best to re-write the document in
question to not duplicate these otherwise logical headings.

This reverts commit 10a1df3cd43ba2fe893d5dd1aeb2e7109ef0007f.

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoMerge branch '2021-01-22-tool-updates'
Tom Rini [Sat, 23 Jan 2021 14:55:35 +0000 (09:55 -0500)]
Merge branch '2021-01-22-tool-updates'

- Assorted updates to the tools/ code

3 years agoMerge branch '2021-01-22-doc-updates'
Tom Rini [Sat, 23 Jan 2021 14:54:02 +0000 (09:54 -0500)]
Merge branch '2021-01-22-doc-updates'

- Assorted documentation updates

3 years agodoc: move README.menu to HTML documentation
Heinrich Schuchardt [Mon, 18 Jan 2021 20:06:03 +0000 (21:06 +0100)]
doc: move README.menu to HTML documentation

Convert README.menu to reStructured text and add it to the HTML
documentation.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agodoc: move test/py/README.md to HTML documentation
Heinrich Schuchardt [Mon, 18 Jan 2021 19:24:03 +0000 (20:24 +0100)]
doc: move test/py/README.md to HTML documentation

Convert test/py/README.md to restructured text and add it to the generated
HTML documentation.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agodoc: move test/README to HTML documentation
Heinrich Schuchardt [Mon, 18 Jan 2021 19:24:02 +0000 (20:24 +0100)]
doc: move test/README to HTML documentation

Move test/README to the 'Develop U-Boot' chapter of the HTML documentation.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agodoc: structure doc/develop/index.rst
Heinrich Schuchardt [Mon, 18 Jan 2021 19:24:01 +0000 (20:24 +0100)]
doc: structure doc/develop/index.rst

Provide sub-chapters for 'Develop U-Boot'

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agodoc: update help message
Patrick Delaunay [Thu, 14 Jan 2021 11:04:04 +0000 (12:04 +0100)]
doc: update help message

Update the help message used for 'make help':

  Documentation targets:
    Linux kernel internal documentation in different formats from ReST:
=>
    U-Boot documentation in different formats from ReST:

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agodoc: update Kernel documentation build system
Heinrich Schuchardt [Fri, 1 Jan 2021 00:21:11 +0000 (01:21 +0100)]
doc: update Kernel documentation build system

Update the docomentation build system according to Linux v5.11-rc1.

With this patch we can build the HTML documentation using either of
Sphinx 2 and Sphinx 3.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
[Fix warning in b4860qds.rst about "Switch Settings"]
Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoefi_loader: correct EFI_BLOCK_IO_PROTOCOL.Media.LastBlock
Heinrich Schuchardt [Sat, 23 Jan 2021 05:52:21 +0000 (06:52 +0100)]
efi_loader: correct EFI_BLOCK_IO_PROTOCOL.Media.LastBlock

The field Media.LastBlock of the EFI_BLOCK_IO_PROTOCOL.Media was filled
incorrectly both for block devices as well as for partitions.

The field must be filled with the index of the last logical block (LBA):

* block devices: device size minus 1
* partitions: partition size minus 1

Reported-by: Alexander von Gluck IV <kallisti5@unixzen.com>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: notification with TPL_APPLICATION not allowed
Heinrich Schuchardt [Wed, 6 Jan 2021 11:55:22 +0000 (12:55 +0100)]
efi_loader: notification with TPL_APPLICATION not allowed

The UEFI specification requires event notification levels to be
> TPL_APPLICATION and <= TPL_HIGH_LEVEL.

With the patch the CreateEvent() and CreatedEventEx() services are changed
to check that the notification level is not TPL_APPLICATION.

Reference:
UEFI Specification 2.8 Errata B, table 27 "TPL Restrictions",
"Event Notification Levels"

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agomkeficapsule: Miscellaneous fixes in the utility
Sughosh Ganu [Fri, 22 Jan 2021 15:04:56 +0000 (20:34 +0530)]
mkeficapsule: Miscellaneous fixes in the utility

Miscellaneous fixes in the mkeficapsule utility -- these include a few
resource leak issues flagged by Coverity along with some additional
code improvements suggested by Heinrich during code review.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
3 years agotools: mkeficapsule: fill reserved members of structure
AKASHI Takahiro [Fri, 22 Jan 2021 01:43:49 +0000 (10:43 +0900)]
tools: mkeficapsule: fill reserved members of structure

Fill reserved members of efi_firmware_management_capsule_image_header
structure with zero's for safety.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Fixes: CID 316354
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: capsule: fix SIZEOF_MISMATCH warning
AKASHI Takahiro [Fri, 22 Jan 2021 01:43:27 +0000 (10:43 +0900)]
efi_loader: capsule: fix SIZEOF_MISMATCH warning

CID 316361 says:
> Passing argument "count * 8UL /* sizeof (*files) */" to
> function "dlmalloc" and then casting the return value to "u16 **" is
> suspicious. In this particular case "sizeof (u16 **)" happens to be equal
> to "sizeof (u16 *)", but this is not a portable assumption.
> > 767         tmp_files = malloc(count * sizeof(*files));

The change in this patch fixes the ambiguity.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Fixes: CID 316361
For readability use *tmp_files instead of tmp_files[0]
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agocmd: efidebug: always check return code from get_variable()
AKASHI Takahiro [Fri, 22 Jan 2021 01:42:48 +0000 (10:42 +0900)]
cmd: efidebug: always check return code from get_variable()

CID 316364 says:
> Null pointer dereferences  (FORWARD_NULL)
> printf("Result total size: 0x%x\n", result->variable_total_size);
at do_efi_capsule_res().

The code is basically safe because a buffer for "result" is allocated
by malloc() and filled up by the second get_variable(), which fails any way
if the allocation has failed.

But the first (and second) get_variable() possibly returns an error other
than EFI_SUCCESS. We always need to check the return code from
get_variable() before accessing the data in "result".

While this change won't suppress CID 316364, the resulting code is much
safer.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: fix efi_load_image_from_path()
Heinrich Schuchardt [Wed, 20 Jan 2021 21:57:46 +0000 (22:57 +0100)]
efi_loader: fix efi_load_image_from_path()

Use the correct GUID when closing the file load protocol.
Remove an unnecessary check (Coverity CID 316363).

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agofs: fat: structure for name and extension
Heinrich Schuchardt [Wed, 20 Jan 2021 23:23:33 +0000 (00:23 +0100)]
fs: fat: structure for name and extension

The short name and extension of FAT files are stored in adjacent fields of
the directory entry. For some operations like calculating a checksum or
copying both fields it is preferable to treat both as one structure.

Change the definition of the directory entry structure to include a
structure comprising the name and the extension field.

This resolves Coverity CID 316357, CID 316350, CID 316348.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agofs: fat: consistent error handling for flush_dir()
Heinrich Schuchardt [Wed, 20 Jan 2021 21:21:53 +0000 (22:21 +0100)]
fs: fat: consistent error handling for flush_dir()

Provide function description for flush_dir().
Move all error messages for flush_dir() from the callers to the function.
Move mapping of errors to -EIO to the function.
Always check return value of flush_dir() (Coverity CID 316362).

In fat_unlink() return -EIO if flush_dirty_fat_buffer() fails.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agotools: env: return error if ubi_update_start() fails
Martin Hundebøll [Mon, 30 Nov 2020 11:11:32 +0000 (12:11 +0100)]
tools: env: return error if ubi_update_start() fails

The UBI_IOCVOLUP ioctl can fail if exclusive access to the volume isn't
obtained. If this happens, the flush operation doesn't return error,
leaving the caller without knowledge of missing flush.

Fix this by forwarding the error (-1) from ubi_update_start().

Fixes: 34255b92e6e ("tools: env: Add support for direct read/write UBI volumes")
Signed-off-by: Martin Hundebøll <martin@geanix.com>
3 years agomkimage: Move padding commands outside of FIT_SIGNATURE
Joel Stanley [Tue, 8 Dec 2020 04:12:15 +0000 (14:42 +1030)]
mkimage: Move padding commands outside of FIT_SIGNATURE

These commands were disabled when CONFIG_FIT_SIGNATURE is disabled, but
they do not depend on crypto support so they can be unconditionally
enabled.

Signed-off-by: Joel Stanley <joel@jms.id.au>
3 years agoimage-fit: Fix FIT_CIPHER linking
Joel Stanley [Tue, 8 Dec 2020 04:12:14 +0000 (14:42 +1030)]
image-fit: Fix FIT_CIPHER linking

When CONFIG_FIT_CIPHER=y and CONFIG_FIT_SIGNATURE=n is there is no
implementation of image_get_host_blob for mkimage/dumpimage:

 /usr/bin/ld: tools/common/image-cipher.o: in function `fit_image_decrypt_data':
 image-cipher.c:(.text+0x9a): undefined reference to `image_get_host_blob'

Move the implementation to a common file so it can be shaed between
image-cipher.c and image-fit-sig.c.

Signed-off-by: Joel Stanley <joel@jms.id.au>
3 years agotools/Makefile: FIT_CIPHER requires libssl
Joel Stanley [Tue, 8 Dec 2020 04:12:13 +0000 (14:42 +1030)]
tools/Makefile: FIT_CIPHER requires libssl

If CONFIG_FIT_CIPHER is enabled without CONFIG_FIT_SIGNATURE then
mkimage/dumpimage will fail to link:

 /usr/bin/ld: tools/common/image-cipher.o: in function `fit_image_decrypt_data':
 image-cipher.c:(.text+0x9a): undefined reference to `image_get_host_blob'
 /usr/bin/ld: tools/common/image-cipher.o:(.data.rel+0x10): undefined reference to `EVP_aes_128_cbc'
 /usr/bin/ld: tools/common/image-cipher.o:(.data.rel+0x40): undefined reference to `EVP_aes_192_cbc'
 /usr/bin/ld: tools/common/image-cipher.o:(.data.rel+0x70): undefined reference to `EVP_aes_256_cbc'
 /usr/bin/ld: tools/lib/aes/aes-encrypt.o: in function `image_aes_encrypt':
 aes-encrypt.c:(.text+0x22): undefined reference to `EVP_CIPHER_CTX_new'
 /usr/bin/ld: aes-encrypt.c:(.text+0x6f): undefined reference to `EVP_EncryptInit_ex'
 /usr/bin/ld: aes-encrypt.c:(.text+0x8d): undefined reference to `EVP_EncryptUpdate'
 /usr/bin/ld: aes-encrypt.c:(.text+0xac): undefined reference to `EVP_CIPHER_CTX_free'
 /usr/bin/ld: aes-encrypt.c:(.text+0xf2): undefined reference to `EVP_EncryptFinal_ex'
 collect2: error: ld returned 1 exit status

Signed-off-by: Joel Stanley <joel@jms.id.au>
3 years agotools: image-host: add support for several sub-images
Philippe Reynes [Tue, 24 Nov 2020 13:39:48 +0000 (14:39 +0100)]
tools: image-host: add support for several sub-images

The propoerty sign-images points to images in the configuration
node. But thoses images may references severals "sub-images" (for
example for images loadable). This commit adds the support of
severals sub-images.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
3 years agotools: image-host: clean function fit_config_get_hash_list
Philippe Reynes [Tue, 24 Nov 2020 13:39:47 +0000 (14:39 +0100)]
tools: image-host: clean function fit_config_get_hash_list

This commit creates a function fit_config_add_hash that will be
used in the next commit to support several 'sub-images'.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agodoc: FIT image: Clarify format and simplify syntax
Alexandru Gagniuc [Tue, 15 Dec 2020 19:15:43 +0000 (13:15 -0600)]
doc: FIT image: Clarify format and simplify syntax

** Introduction

There are currently four ways to load an OS image with u-boot
  1. SPL -> u-boot -> bootm
  2. SPL blue falcon mode
  3. "Basic" FIT image (CONFIG_LOAD_FIT)
  4. "Full-featured" FIT image (CONFIG_LOAD_FIT_FULL)

These four code paths were developed independently, and share very
little code. (3) and (4), behave very differently, are littered with
special cases. They even have different DTS syntax and properties.

The cause of this divergence is that the FIT format specification
leaves a number of things open to interpretation. The purpose of this
change is to enable the reduction of code size, duplication, and
complexity by updating and streamlining the FIT format.

We are only marginally concerned with backwards compatibility, because
we don't have inter-compatibility. For example, CONFIG_LOAD_FIT is
able to load images that CONFIG_LOAD_FIT_FULL won't. This is a direct
result of the incompatible syntax between the two implementations.

Ideally, these changes would enable "simple" FIT to be a subset of the
"full" fit implementation, and share most code. These changes should
also eliminate the need for falcon mode (although we are not
advocating for the removal of falcon mode at this time).

** Description of changes

 * The "configurations" node is now mandatory

Guessing how to load components based on their "os" and "type" invites
confusion and superfluous heuristics. Instead, require each FIT image
to be explicit on how components should be loaded.

 * Eliminate "ramdisk", "setup", "standalone", and "fpga" properties

Having too many special purpose properties requires special-casing
FIT loading code. When a special property can be handled by another
property, it is redundant.
 - A "ramdisk" is identical to a loadable. Thus ramdisk images should
   be placed under "loadables".
 - A "setup" node can be achieved by using a "kernel" or "firmware"
   property instead.
 - "standalone" is used for u-boot nodes. The correct property to use
   in this case is "firmware".
 - "fpga" is a loadable

 * Prioritize control between "firmware" and "kernel"

"firmware" and "kernel" are special nodes in that control is passed
to the "entry-point" of the image. Both can be present, for example,
an OP-TEE firmware with a linux kernel. When both are present,
control is passed to the "firmware" image.

** Further generalizations (not included herein)

The "firmware" and "kernel" properties could be generalized as a
"next-boot-stage", or similar name. This "next" stage would be special
in that it is both executable, and is the stage that is passed
control. For example, "next-stage" could be an op-tee image, with
linux as a loadable, or a u-boot image.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
3 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-samsung.git
Tom Rini [Fri, 22 Jan 2021 21:01:27 +0000 (16:01 -0500)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-samsung.git

3 years agoMerge tag 'u-boot-rockchip-20210121' of https://gitlab.denx.de/u-boot/custodians...
Tom Rini [Thu, 21 Jan 2021 12:39:47 +0000 (07:39 -0500)]
Merge tag 'u-boot-rockchip-20210121' of https://gitlab.denx.de/u-boot/custodians/u-boot-rockchip

- New board: rk3328 NanoPi R2S board;
- Fix init voltage for some rk3399 boards;
- enable rng for rk3399 by default;
- set default to SPI bus 1 for SPI-flash for some board;
- add dwc PCIe controller driver on rockchip platform;

3 years agopci: Add Rockchip dwc based PCIe controller driver
Shawn Lin [Fri, 15 Jan 2021 10:01:22 +0000 (18:01 +0800)]
pci: Add Rockchip dwc based PCIe controller driver

Add Rockchip dwc based PCIe controller driver for rk356x platform.
Driver support Gen3 by operating as a Root complex.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Kever Yang<kever.yang@rock-chips.com>
3 years agophy: rockchip: Add Rockchip Synopsys PCIe 3.0 PHY
Shawn Lin [Fri, 15 Jan 2021 10:01:21 +0000 (18:01 +0800)]
phy: rockchip: Add Rockchip Synopsys PCIe 3.0 PHY

Add the Rockchip Synopsys based PCIe 3.0 PHY driver as
part of Generic PHY framework.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Kever Yang<kever.yang@rock-chips.com>
3 years agorockchip: rk3328: Add support for FriendlyARM NanoPi R2S
David Bauer [Wed, 6 Jan 2021 23:06:11 +0000 (00:06 +0100)]
rockchip: rk3328: Add support for FriendlyARM NanoPi R2S

This adds support for the NanoPi R2S from FriendlyArm.

Rockchip RK3328 SoC
1GB DDR4 RAM
Gigabit Ethernet (WAN)
Gigabit Ethernet (USB3) (LAN)
USB 2.0 Host Port
MicroSD slot
Reset button
WAN - LAN - SYS LED

Signed-off-by: David Bauer <mail@david-bauer.net>
Reviewed-by: Kever Yang<kever.yang@rock-chips.com>
3 years agoconfigs: rk3399: enable rng on firefly/rock960/rockpro64
Peter Robinson [Wed, 16 Dec 2020 15:48:43 +0000 (15:48 +0000)]
configs: rk3399: enable rng on firefly/rock960/rockpro64

Enable the RNG on the Firefly, rock960 and RockPro64 devices
to enable KASLR on devices that support it.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
Cc: Akash Gajjar <akash@openedev.com>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Reviewed-by: Kever Yang<kever.yang@rock-chips.com>
3 years agoarm: dts: rockchip: rk3399: enable rng at the SoC level
Peter Robinson [Wed, 16 Dec 2020 15:48:42 +0000 (15:48 +0000)]
arm: dts: rockchip: rk3399: enable rng at the SoC level

The rng is embedded in the SoC so enable it in the device tree
universally, the use of it can be controlled by enabling/disabling
at the device config level.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Kever Yang<kever.yang@rock-chips.com>
3 years agorockchip: leez-rk3399: Provide init voltage
Kever Yang [Mon, 7 Dec 2020 02:52:53 +0000 (10:52 +0800)]
rockchip: leez-rk3399: Provide init voltage

Add missing regulator-init-microvolt property to vdd_log regulator.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
3 years agorockchip: firefly-rk3399: Provide init voltage
Kever Yang [Mon, 7 Dec 2020 02:52:52 +0000 (10:52 +0800)]
rockchip: firefly-rk3399: Provide init voltage

Add missing regulator-init-microvolt property to vdd_log regulator.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
3 years agorockchip: evb-rk3399: Provide init voltage
Kever Yang [Mon, 7 Dec 2020 02:52:51 +0000 (10:52 +0800)]
rockchip: evb-rk3399: Provide init voltage

Add missing regulator-init-microvolt property to vdd_center regulator.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
3 years agorockchip: puma-haikou: default to SPI bus 1 for SPI-flash
Hugh Cole-Baker [Sun, 22 Nov 2020 13:03:46 +0000 (13:03 +0000)]
rockchip: puma-haikou: default to SPI bus 1 for SPI-flash

SPI flash on this machine is located on bus 1, default to using bus 1
for SPI flash and stop aliasing it to bus 0. Formerly the alias spi1
pointed to &spi5, use an alias spi5 for this instead.

Signed-off-by: Hugh Cole-Baker <sigmaris@gmail.com>
Suggested-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Kever Yang<kever.yang@rock-chips.com>
3 years agorockchip: rk3399-roc-pc: default to SPI bus 1 for SPI-flash
Hugh Cole-Baker [Sun, 22 Nov 2020 13:03:45 +0000 (13:03 +0000)]
rockchip: rk3399-roc-pc: default to SPI bus 1 for SPI-flash

SPI flash on this board is located on bus 1, default to using bus 1 for
SPI flash on both rk3399-roc-pc and -mezzanine, and stop aliasing it to
bus 0.

Signed-off-by: Hugh Cole-Baker <sigmaris@gmail.com>
Suggested-by: Simon Glass <sjg@chromium.org>
Fixes: c4cea2bb ("rockchip: Enable building a SPI ROM image on bob")
Reviewed-by: Kever Yang<kever.yang@rock-chips.com>
3 years agoMerge branch '2021-01-20-fs-fixes'
Tom Rini [Wed, 20 Jan 2021 21:45:21 +0000 (16:45 -0500)]
Merge branch '2021-01-20-fs-fixes'

- Minor SquashFS, BTRFS ubifs fixes

3 years agoubifs: do not decide upon uninitialized variable
Heinrich Schuchardt [Fri, 25 Dec 2020 14:19:39 +0000 (15:19 +0100)]
ubifs: do not decide upon uninitialized variable

Before 'if (err)' we have to initialize the variable otherwise we use a
random value from the stack.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agofs: btrfs: simplify close_ctree_fs_info()
Heinrich Schuchardt [Fri, 25 Dec 2020 12:45:25 +0000 (13:45 +0100)]
fs: btrfs: simplify close_ctree_fs_info()

At the beginning of close_ctree_fs_info() the value 0 is assigned to err
and never changed before testing it.

Let's get rid of the superfluous variable.

Fixes: f06bfcf54d0e ("fs: btrfs: Crossport open_ctree_fs_info() from btrfs-progs")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Qu Wenruo <wqu@suse.com>
3 years agoFix squashfs failing to load sparse files
Campbell Suter [Mon, 23 Nov 2020 02:40:03 +0000 (15:40 +1300)]
Fix squashfs failing to load sparse files

SquashFS supports sprase blocks in files - that is, if a given block is
composed only of zeros, it's not written to the output file to save
space and it's on-disk length field is set to zero to indicate that.

Previously the squashfs driver did not recognise that, and would attempt
to read and decompress a zero-sized block, which obviously failed.

The following command may be used to create a file for testing:

cat <(dd if=/dev/urandom of=/dev/stdout bs=1M count=1) \
<(dd if=/dev/zero of=/dev/stdout bs=1M count=1) \
<(dd if=/dev/urandom of=/dev/stdout bs=1k count=200) >test_file

Signed-off-by: Campbell Suter <campbell@snapit.group>
3 years agofs: btrfs: volumes: prevent overflow for multiplying
Qu Wenruo [Sat, 31 Oct 2020 01:07:50 +0000 (09:07 +0800)]
fs: btrfs: volumes: prevent overflow for multiplying

In __btrfs_map_block() we do a int * int and assign it to u64.
This is not safe as the result (int * int) is still evaluated as (int)
thus it can overflow.

Convert one of the multiplier to u64 to prevent such problem.

In real world, this should not cause problem as we have device number
limit thus it won't go beyond 4G for a single stripe.

But it's harder to teach coverity about all these hidden limits, so just
fix the possible overflow.

Reported-by: Coverity CID 312957
Reported-by: Coverity CID 312948
Signed-off-by: Qu Wenruo <wqu@suse.com>
3 years agoMerge tag 'efi-2021-04-rc1-2' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Wed, 20 Jan 2021 15:49:23 +0000 (10:49 -0500)]
Merge tag 'efi-2021-04-rc1-2' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi

Pull request for UEFI sub-system for efi-2021-04-rc1-2

* Provide a test tool for initial RAM disk provided via load file2 protocol.
* Make more items configurable to reduce code size:
  * Boot manager
  * EFI_DT_FIXUP_PROTOCOL
  * EFI_DEVICE_PATH_UTILITIES_PROTOCOL
* Bug fixes
  * avoid EFI runtime symbols in global symbol table

3 years agoMerge tag 'xilinx-for-v2021.04-v2' of https://gitlab.denx.de/u-boot/custodians/u...
Tom Rini [Wed, 20 Jan 2021 15:49:05 +0000 (10:49 -0500)]
Merge tag 'xilinx-for-v2021.04-v2' of https://gitlab.denx.de/u-boot/custodians/u-boot-microblaze

Xilinx changes for v2021.04-v2

env:
- Unlock redundant variable configuration for all

xilinx:
- Enable seps525 by default
- Export bootseq via variable
- Update board_fdt_blob_setup()

mmc:
- Xenon macro removal

3 years agoenv: Remove all dependencies for SYS_REDUNDAND_ENVIRONMENT
Michal Simek [Wed, 13 Jan 2021 09:25:50 +0000 (10:25 +0100)]
env: Remove all dependencies for SYS_REDUNDAND_ENVIRONMENT

CONFIG_SYS_REDUNDAND_ENVIRONMENT is changing in env_internal.h how u-boot
works with variables. struct environment_s has one byte flags property
which also affects ENV_SIZE macro.

I have reached the case where CONFIG_ENV_IS_NOWHERE is default setup
but custom scripts can be designed in a way that u-boot is asked to
import/export variables from/to file which can be in certain format.
That's why also for this configuration make sense to enable
CONFIG_SYS_REDUNDAND_ENVIRONMENT because it depends on environment file
format.

The patch is removing dependency on this configuration to support selecting
environment file format without any specific dependency where variables are
stored.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
3 years agoxilinx: common: Do not touch CONFIG_XILINX_OF_BOARD_DTB_ADDR in SPL
Michal Simek [Mon, 4 Jan 2021 10:07:28 +0000 (11:07 +0100)]
xilinx: common: Do not touch CONFIG_XILINX_OF_BOARD_DTB_ADDR in SPL

This hook is used in full U-Boot that's why there is no reason to touch
this location from SPL. The hook was introduced for QEMU usage but none is
really running SPL on QEMU that's why it shouldn't break any usecase.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
3 years agoxilinx: common: Change macro handling in board_fdt_blob_setup()
Michal Simek [Mon, 4 Jan 2021 10:03:36 +0000 (11:03 +0100)]
xilinx: common: Change macro handling in board_fdt_blob_setup()

Remove ifdef logic which is handled by preprocessor and move it link time
optimization to get full compile code coverage.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
3 years agoxilinx: zynqmp: Save bootseq number for SD/EMMC boot modes
Michal Simek [Mon, 11 Jan 2021 12:46:58 +0000 (13:46 +0100)]
xilinx: zynqmp: Save bootseq number for SD/EMMC boot modes

For systems which has both sdhci controllers enable it is worth to export
bootseq number for variables. Then the variable can be used in custom
scripts to tune logic for OS.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
3 years agommc: xenon_sdhci: Remove duplicated macros
Michal Simek [Tue, 5 Jan 2021 13:27:45 +0000 (14:27 +0100)]
mmc: xenon_sdhci: Remove duplicated macros

There is no need to define the same macros in drivers.
All macros have been added by commit 17a42abb40dd ("mmc: Define timing
macro's").

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agoarm64: zynqmp: Enable seps and related video configs
Michal Simek [Thu, 7 Jan 2021 13:05:23 +0000 (14:05 +0100)]
arm64: zynqmp: Enable seps and related video configs

Enable this driver to get build and probe for our platform.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
3 years agoefi_loader: Avoid emitting efi_var_buf to .GOT
Ilias Apalodimas [Sat, 16 Jan 2021 15:28:04 +0000 (17:28 +0200)]
efi_loader: Avoid emitting efi_var_buf to .GOT

Atish reports that on RISC-V, accessing the EFI variables causes
a kernel panic. An objdump of the file verifies that, since the
global pointer for efi_var_buf ends up in .GOT section which is
not mapped in virtual address space for Linux.

<snip of efi_var_mem_find>

0000000000000084 <efi_var_mem_find>:
  84:   715d                    addi    sp,sp,-80

* objdump -dr
0000000000000086 <.LCFI2>:
  86:   e0a2                    sd  s0,64(sp)
  88:   fc26                    sd  s1,56(sp)
  8a:   e486                    sd  ra,72(sp)
  8c:   f84a                    sd  s2,48(sp)
  8e:   f44e                    sd  s3,40(sp)
  90:   f052                    sd  s4,32(sp)
  92:   ec56                    sd  s5,24(sp)
  94:   00000497            auipc   s1,0x0
            94: R_RISCV_GOT_HI20    efi_var_buf
  98:   0004b483            ld  s1,0(s1) # 94 <.LCFI2+0xe>
            98: R_RISCV_PCREL_LO12_I    .L0
            98: R_RISCV_RELAX   *ABS*

* objdump -t
0000000000000084 g     F .text.efi_runtime  00000000000000b8 efi_var_mem_find

With the patch applied:

* objdump -dr
0000000000000086 <.LCFI2>:
  86:   e0a2                    sd  s0,64(sp)
  88:   fc26                    sd  s1,56(sp)
  8a:   e486                    sd  ra,72(sp)
  8c:   f84a                    sd  s2,48(sp)
  8e:   f44e                    sd  s3,40(sp)
  90:   f052                    sd  s4,32(sp)
  92:   ec56                    sd  s5,24(sp)
  94:   00000497            auipc   s1,0x0
            94: R_RISCV_PCREL_HI20  .LANCHOR0
            94: R_RISCV_RELAX   *ABS*
  98:   00048493            mv  s1,s1
            98: R_RISCV_PCREL_LO12_I    .L0
            98: R_RISCV_RELAX   *ABS*

* objdump -t
0000000000000008 l     O .data.efi_runtime  0000000000000008 efi_var_buf

On arm64 this works, because there's no .GOT entries for this
and everything is converted to relative references.

* objdump -dr (identical pre-post patch, only the new function shows up)
00000000000000b4 <efi_var_mem_find>:
  b4:   aa0003ee    mov x14, x0
  b8:   9000000a    adrp    x10, 0 <efi_var_mem_compare>
            b8: R_AARCH64_ADR_PREL_PG_HI21  .data.efi_runtime
  bc:   91000140    add x0, x10, #0x0
            bc: R_AARCH64_ADD_ABS_LO12_NC   .data.efi_runtime
  c0:   aa0103ed    mov x13, x1
  c4:   79400021    ldrh    w1, [x1]
  c8:   aa0203eb    mov x11, x2
  cc:   f9400400    ldr x0, [x0, #8]
  d0:   b940100c    ldr w12, [x0, #16]
  d4:   8b0c000c    add x12, x0, x12

So let's switch efi_var_buf to static and create a helper function for
anyone that needs to update it.

Fixes: e01aed47d6a0 ("efi_loader: Enable run-time variable support for tee based variables")
Reported-by: Atish Patra <atishp@atishpatra.org>
Tested-by: Atish Patra <atish.patra@wdc.com>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: efi_size_in_pages() missing parentheses
Heinrich Schuchardt [Sun, 17 Jan 2021 06:52:09 +0000 (07:52 +0100)]
efi_loader: efi_size_in_pages() missing parentheses

Add parentheses around size to avoid possible operator precedence problems.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_selftest: use CRLF as line endings in dtbdump
Heinrich Schuchardt [Tue, 19 Jan 2021 09:06:00 +0000 (10:06 +0100)]
efi_selftest: use CRLF as line endings in dtbdump

EFI applications must use CR LF as line endings.

Provide a print() function to reduce code size.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_selftest: provide initrddump test tool
Heinrich Schuchardt [Sun, 17 Jan 2021 06:30:26 +0000 (07:30 +0100)]
efi_selftest: provide initrddump test tool

Provide an UEFI application to save the initial RAM disk provided by U-Boot
via the Load File2 protocol.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
3 years agoefi_selftest: don't compile dtbdump if GENERATE_ACPI_TABLE
Heinrich Schuchardt [Sun, 17 Jan 2021 04:41:41 +0000 (05:41 +0100)]
efi_selftest: don't compile dtbdump if GENERATE_ACPI_TABLE

If we are using ACPI tables instead of a device tree, we don't need the
dtbdump.efi test tool.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_selftest: ask before overwriting in dtbdump.efi
Heinrich Schuchardt [Sun, 17 Jan 2021 04:13:21 +0000 (05:13 +0100)]
efi_selftest: ask before overwriting in dtbdump.efi

Before overwriting an existing file ask the user.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: remove EFI_UNICODE_COLLATION_PROTOCOL
Heinrich Schuchardt [Sat, 16 Jan 2021 08:58:06 +0000 (09:58 +0100)]
efi_loader: remove EFI_UNICODE_COLLATION_PROTOCOL

In EFI 1.10 a version of the Unicode collation protocol using ISO 639-2
language codes existed. This protocol is not part of the UEFI specification
any longer. It was however required to run the UEFI Self Certification Test
(SCT) II, version 2.6, 2017. So we implemented it for the sole purpose of
running the SCT.

As the SCT does not need the protocol anymore it is time for removal.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: EFI_DEVICE_PATH_UTILITIES_PROTOCOL configurable
Heinrich Schuchardt [Sat, 16 Jan 2021 08:44:25 +0000 (09:44 +0100)]
efi_loader: EFI_DEVICE_PATH_UTILITIES_PROTOCOL configurable

Allow the EFI_DEVICE_PATH_UTILITIES_PROTOCOL to be disabled via
configuration.

On systems that are very tight on U-Boot image size we may want to disable
the protocol. As it is required to run the UEFI Shell enable it by default.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: make EFI_DT_FIXUP_PROTOCOL configurable
Heinrich Schuchardt [Sat, 16 Jan 2021 08:33:24 +0000 (09:33 +0100)]
efi_loader: make EFI_DT_FIXUP_PROTOCOL configurable

Allow EFI_DT_FIXUP_PROTOCOL to be disabled via configuration.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: fixup protocol, avoid forward declaration
Heinrich Schuchardt [Sat, 16 Jan 2021 07:50:10 +0000 (08:50 +0100)]
efi_loader: fixup protocol, avoid forward declaration

Avoid a forward declaration.

Add a missing function description.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: make the UEFI boot manager configurable
Heinrich Schuchardt [Fri, 15 Jan 2021 18:02:50 +0000 (19:02 +0100)]
efi_loader: make the UEFI boot manager configurable

Some boards are very tight on the binary size. Booting via UEFI is possible
without using the boot manager.

Provide a configuration option to make the boot manager available.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoRevert "net: eth-uclass: Change uclass driver name to ethernet"
Tom Rini [Tue, 19 Jan 2021 20:35:00 +0000 (15:35 -0500)]
Revert "net: eth-uclass: Change uclass driver name to ethernet"

This reverts commit 1231184caacad32c180d7e2338a645f7dfe9571a.

While the change is fine in theory, a number of tests need to be updated
to match.

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoMerge branch '2021-01-19-networking-improvements'
Tom Rini [Tue, 19 Jan 2021 19:46:45 +0000 (14:46 -0500)]
Merge branch '2021-01-19-networking-improvements'

- e1000, ftgmac100: Add support for getting the MAC
- General networking improvements
- dwc_eth_qos, ks8851 fixes

3 years agoefi_loader: move load options to new module
Heinrich Schuchardt [Fri, 15 Jan 2021 18:02:49 +0000 (19:02 +0100)]
efi_loader: move load options to new module

Move all load options related functions to a new module. So that they can
be compiled independently.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agonet: eth-uclass: Change uclass driver name to ethernet
David Wu [Fri, 8 Jan 2021 02:53:05 +0000 (10:53 +0800)]
net: eth-uclass: Change uclass driver name to ethernet

dev_read_alias_seq() used uc_drv->name compared to alias
stem string, Ethernet's alias stem uses "ethernet", which
does not match the eth-uclass driver name "eth", can not
get the correct index of ethernet alias namer. So it seems
change uclass driver name to match the alias stem is a more
reasonable way.

Signed-off-by: David Wu <david.wu@rock-chips.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agonet: dwc_eth_qos: Pad descriptors to cacheline size
Marek Vasut [Thu, 7 Jan 2021 10:12:16 +0000 (11:12 +0100)]
net: dwc_eth_qos: Pad descriptors to cacheline size

The DWMAC4 IP has the possibility to skip up to 7 AXI bus width size words
after the descriptor. Use this to pad the descriptors to cacheline size and
remove the need for noncached memory altogether. Moreover, this lets Tegra
use the generic cache flush / invalidate operations.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Cc: Ramon Fried <rfried.dev@gmail.com>
Cc: Stephen Warren <swarren@nvidia.com>
Tested-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Tested-by: Patrice Chotard <patrice.chotard@foss.st.com>
3 years agonet: ks8851: Reset internal RXFC count on bad packet
Marek Vasut [Wed, 6 Jan 2021 14:16:01 +0000 (15:16 +0100)]
net: ks8851: Reset internal RXFC count on bad packet

A sporadic condition occurs when the "bad packet" error is triggered
repeatedly, which results in "bad packet" messages scrolling on the
console during transfer. To avoid triggering this, reset the internal
RXFC count on the first occurance of the "bad packet", which forces
the code to re-read the RX packet count from the MAC, and prevents
any additional "bad packet" messages if there are no more packets in
the MAC. Also print better debug information if this condition occurs.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Eugen Hristev <eugen.hristev@microchip.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Tom Rini <trini@konsulko.com>
3 years agonet: Use NDRNG device in srand_mac()
Matthias Brugger [Fri, 18 Dec 2020 09:28:04 +0000 (10:28 +0100)]
net: Use NDRNG device in srand_mac()

When calling srand_mac we use a weak seed dependent on the
mac address. If present, use a RNG device instead to incerase entropy.

Signed-off-by: Matthias Brugger <mbrugger@suse.com>
Reviewed-by: Torsten Duwe <duwe@suse.de>
3 years agolib: uuid: use RNG device if present
Matthias Brugger [Fri, 18 Dec 2020 09:28:03 +0000 (10:28 +0100)]
lib: uuid: use RNG device if present

When calculating a random UUID we use a weak seed.
Use a RNG device if present to increase entropy.

Signed-off-by: Matthias Brugger <mbrugger@suse.com>
Reviewed-by: Torsten Duwe <duwe@suse.de>
3 years agonet: ftgmac100: Read and retain MAC address
Hongwei Zhang [Thu, 10 Dec 2020 23:11:09 +0000 (18:11 -0500)]
net: ftgmac100: Read and retain MAC address

Read and retain MAC address across flash and QEMU support.

Signed-off-by: Hongwei Zhang <hongweiz@ami.com>
3 years agonet: eth_legacy - fix build CMD_PCAP
Jorge Ramirez-Ortiz [Fri, 4 Dec 2020 19:59:58 +0000 (20:59 +0100)]
net: eth_legacy - fix build CMD_PCAP

Fix typo which would cause a build error.

Fixes: 3eaac6307df ("net: introduce packet capture support")
Signed-off-by: Jorge Ramirez-Ortiz <jorge@foundries.io>
3 years agonet: tftp: Fix incorrect tftp_next_ack on no OACK
Harm Berntsen [Fri, 27 Nov 2020 21:45:56 +0000 (21:45 +0000)]
net: tftp: Fix incorrect tftp_next_ack on no OACK

When the tftp server did not send any OACK, the tftp_next_ack variable
was not set to the correct value . As the server was transmitting
blocks we generated a lot of 'Received unexpected block: $n, expected
$n+1' error messages. Depending on the timeout setting the transfer
could still complete though.

Signed-off-by: Harm Berntsen <harm.berntsen@nedap.com>
CC: Ramon Fried <rfried.dev@gmail.com>
Reviewed-By: Ramon Fried <rfried.dev@gmail.com>
3 years agonet: Do not respond to ICMP_ECHO_REQUEST if we do not have an IP address
David Rivshin [Sun, 15 Nov 2020 03:12:47 +0000 (22:12 -0500)]
net: Do not respond to ICMP_ECHO_REQUEST if we do not have an IP address

While doing DHCP the interface IP is set to 0.0.0.0. This causes the
check in net.c on dst_ip to be effectively skipped, and all IP datagrams
are accepted up the IP stack. In the case of an ICMP_ECHO_REQUEST for the
matching MAC address (regardless of destination IP), the result is that
an ICMP_ECHO_REPLY is sent. The source address of the ICMP_ECHO_REPLY is
0.0.0.0, which is an illegal source address.

This can happen in common practice with the following sequence:
DHCP (U-Boot or OS) acquires IP address 10.0.0.1
System reboots
U-Boot starts DHCP and send DHCP DISCOVER
DHCP server decides to OFFER 10.0.0.1 again
  (perhaps because of existing lease or manual configuration)
DHCP server tries to PING 10.0.0.1 to see if anyone is squatting on it
DHCP server still has our MAC address in its ARP table for 10.0.0.1
U-Boot receives PING, and responds with an illegal source address
This may further result in a the DHCP server seeing the response as
  confirmation that someone is squatting on 10.0.0.1, and picking a
  new IP address from the pool to try again

Signed-off-by: David Rivshin <drivshin@allworx.com>
3 years agonet: e1000: implement eth_write_hwaddr for DM_ETH
Ian Ray [Wed, 4 Nov 2020 16:26:01 +0000 (17:26 +0100)]
net: e1000: implement eth_write_hwaddr for DM_ETH

Implement programming MAC address to the hardware also for device model
configuration.

Fixes: b565b18a294f ("board: ge: bx50v3: Enable DM for PCI and ethernet")
Signed-off-by: Ian Ray <ian.ray@ge.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
3 years agonet: eth-uclass: avoid running start() twice without stop()
Matthias Schiffer [Wed, 4 Nov 2020 13:45:14 +0000 (14:45 +0100)]
net: eth-uclass: avoid running start() twice without stop()

Running the start() handler twice without a stop() inbetween completely
breaks communication for some ethernet drivers like fec_mxc.

eth_halt() is called before each eth_init(). Due to the switch to
eth_is_active() in commit 68acb51f442f ("net: Only call halt on a driver
that has been init'ed"), this is not sufficient anymore when netconsole
is active: eth_init_state_only()/eth_halt_state_only() manipulate the
state check that is performed by eth_is_active() without actually
calling into the driver.

The issue can be triggered by starting a network operation (e.g. ping or
tftp) while netconsole is active.

Add an additional "running" flag that reflects the actual state of the
driver and use it to ensure that eth_halt() actually stops the device as
it is supposed to.

Fixes: 68acb51f442f ("net: Only call halt on a driver that has been init'ed")
Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
3 years agoMerge branch '2021-01-18-assorted-platform-updates'
Tom Rini [Tue, 19 Jan 2021 12:56:59 +0000 (07:56 -0500)]
Merge branch '2021-01-18-assorted-platform-updates'

- Assorted MediaTek, AST2x00 updates
- Assorted driver fixes for various platforms
- Keymile platform updates
- Add pwm command, mp5416 pmic driver

3 years agodts: mt7622: use accurate clock source fot mtk_timer
Weijie Gao [Tue, 12 Jan 2021 05:44:11 +0000 (13:44 +0800)]
dts: mt7622: use accurate clock source fot mtk_timer

The input system clock for mt7622 timer is 10MHz and can be retrieved
through the clk driver.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
3 years agotimer: mtk_timer: initialize the timer before use
Weijie Gao [Tue, 12 Jan 2021 05:44:02 +0000 (13:44 +0800)]
timer: mtk_timer: initialize the timer before use

The timer being used by this driver may have already been used by first
stage bootloader (e.g. ATF/preloader), and it's settings may differ from
what this driver is going to use.

This may cause issues, such as inaccurate timer frequency due to
incorrect clock divider.

This patch adds the initialization code to avoid them.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
3 years agopinctrl: mediatek: correct error handling
Heinrich Schuchardt [Sun, 27 Dec 2020 20:18:26 +0000 (21:18 +0100)]
pinctrl: mediatek: correct error handling

If no GPIO controller is found, the return value should not depend on a
random value on the stack. Initialize variable ret.

The problem was indicated by cppcheck.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
3 years agomtd: remove drivers/mtd/mw_eeprom.c
Heinrich Schuchardt [Sun, 27 Dec 2020 10:54:23 +0000 (11:54 +0100)]
mtd: remove drivers/mtd/mw_eeprom.c

drivers/mtd/mw_eeprom.c contains code that never worked. mw_eeprom_write()
and mw_eeprom_read() have incorrect loop conditions:

while (len <= 2) {

CONFIG_MW_EEPROM is not set anywhere. So let's simply drop the module.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agodrivers: qe: avoid double free()
Heinrich Schuchardt [Sun, 27 Dec 2020 10:48:49 +0000 (11:48 +0100)]
drivers: qe: avoid double free()

Avoid calling free(addr) twice if the device for ucode is not found.

The problem was indicated by cppcheck.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agommc: fsl_esdhc_spl: remove superfluous free()
Heinrich Schuchardt [Sun, 27 Dec 2020 09:50:26 +0000 (10:50 +0100)]
mmc: fsl_esdhc_spl: remove superfluous free()

Freeing a buffer before calling hang() is superfluous. Removing the call
reduces the SPL size.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agodoc: board: freescale: advise to use newer atf and firmware
Andrey Zhizhikin [Sun, 13 Dec 2020 20:36:06 +0000 (20:36 +0000)]
doc: board: freescale: advise to use newer atf and firmware

Update branch and version information of ATF and DDR firmware files to
point to latest releases provided by NXP.

This is especially critical for imx8mp evk, as the ATF support for that
SoC is only available in latest releases.

Align all SoCs from imx8m family to use identical revisions of ATF and
DDR firmware.

Signed-off-by: Andrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>