oweals/u-boot.git
4 years agoclk: renesas: Switch to fdtdec_get_addr_size_auto_noparent() on Gen2
Marek Vasut [Sat, 21 Mar 2020 15:45:29 +0000 (16:45 +0100)]
clk: renesas: Switch to fdtdec_get_addr_size_auto_noparent() on Gen2

The fdtdec_get_addr() does not take into account values set in #address-cells
and #size-cells , but assumes them to be 1 for 32bit systems and 2 for 64bit
systems. This is true for most DTs, however there are exceptions. Switch to
fdtdec_get_addr_size_auto_noparent(), which takes the #address/size-cells
values into consideration, otherwise the reset controller node register
offset is incorrectly parsed.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
4 years agoARM: rmobile: Convert Gen2 Blanche to DM_SPI{,_FLASH}
Marek Vasut [Sun, 1 Dec 2019 01:33:40 +0000 (02:33 +0100)]
ARM: rmobile: Convert Gen2 Blanche to DM_SPI{,_FLASH}

Enable DM_SPI and DM_SPI_FLASH in U-Boot on V2H Blanche.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
4 years agoMerge branch '2020-03-27-master-imports'
Tom Rini [Fri, 27 Mar 2020 21:54:38 +0000 (17:54 -0400)]
Merge branch '2020-03-27-master-imports'

- Update a few MAINTAINERS entries
- cache alignment fix in ext4 code
- Two small test fixes

4 years agotest: typo decompression
Heinrich Schuchardt [Mon, 23 Mar 2020 17:47:47 +0000 (18:47 +0100)]
test: typo decompression

%s/decopmression/decompression/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoMAINTAINERS: add myself as maintainer of fs/btrfs
Marek Behún [Wed, 25 Mar 2020 11:04:46 +0000 (12:04 +0100)]
MAINTAINERS: add myself as maintainer of fs/btrfs

Signed-off-by: Marek Behún <marek.behun@nic.cz>
4 years agofs: ext4: Fix alignment of cache buffers
Jan Kiszka [Wed, 25 Mar 2020 20:27:51 +0000 (21:27 +0100)]
fs: ext4: Fix alignment of cache buffers

We need to align the cache buffer to ARCH_DMA_MINALIGN in order to avoid
access errors like

CACHE: Misaligned operation at range [be0231e0be0235e0]

seen on the MCIMX7SABRE.

Fixes: d5aee659f217 ("fs: ext4: cache extent data")
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Tested-by: Peter Robinson <pbrobinson@gmail.com>
4 years agoMAINTAINERS: Add usb.h entry to usb
Marek Vasut [Wed, 25 Mar 2020 20:35:53 +0000 (21:35 +0100)]
MAINTAINERS: Add usb.h entry to usb

Add usb.h file into the USB list.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@konsulko.com>
4 years agotest/py: mmc: Fix 'mmc info' testcase
Harald Seiler [Thu, 26 Mar 2020 17:07:27 +0000 (18:07 +0100)]
test/py: mmc: Fix 'mmc info' testcase

Commit 41e30dcf8796 ("cmd: mmc: Make Mode: printout consistent") fixed
the layout of `mmc info` output.  Reflect this change in the respective
testcase.

Also fix a typo in the documentation.

Fixes: 41e30dcf8796 ("cmd: mmc: Make Mode: printout consistent")
Signed-off-by: Harald Seiler <hws@denx.de>
Acked-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoRevert "vexpress_ca9x4: Enable use of correct DTB file and restore EFI loader."
Tom Rini [Fri, 27 Mar 2020 15:47:04 +0000 (11:47 -0400)]
Revert "vexpress_ca9x4: Enable use of correct DTB file and restore EFI loader."

Currently this causes failures of the platform when running the EFI
loader tests, so disable it for now.

This reverts commit af827140e5965e5bb2bcad1c53ca8419b428ff6d.

Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agoMerge tag 'u-boot-rockchip-20200327' of https://gitlab.denx.de/u-boot/custodians...
Tom Rini [Fri, 27 Mar 2020 01:39:59 +0000 (21:39 -0400)]
Merge tag 'u-boot-rockchip-20200327' of https://gitlab.denx.de/u-boot/custodians/u-boot-rockchip

- Fixed for rv1108 and elgin-rv1108 board
- Fix the keyboard from USB instead of CrOS EC

4 years agorockchip: mkimage: Use an existing macro instead of a decimal value
Miquel Raynal [Wed, 18 Mar 2020 16:22:55 +0000 (17:22 +0100)]
rockchip: mkimage: Use an existing macro instead of a decimal value

Depending on the SoC, a header of four characters is prepended to the
image. There is already a macro defining the number of characters:
RK_SPL_HDR_SIZE, so use it instead of hardcoding "4".

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorv1108: Fix boot regression
Otavio Salvador [Fri, 13 Mar 2020 17:42:48 +0000 (14:42 -0300)]
rv1108: Fix boot regression

Since commit 79030a486128 ("rockchip: Add Single boot image
(with binman, pad_cat)") the following boot regression is seen:

U-Boot 2020.04-rc3-00050-gd16e18ca6c-dirty (Mar 09 2020 - 11:40:07 -0300)

Model: Elgin RV1108 R1 board
DRAM:  128 MiB
initcall sequence 67fd12a0 failed at call 6000b927 (err=-22)

This happens because the above commit missed to include the
"rockchip-u-boot.dtsi" for rv1108, so include this file
like it done for other Rockchip SoC dtsi's.

Fixes: 79030a486128 ("rockchip: Add Single boot image (with binman, pad_cat)")
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoelgin-rv1108: Avoid adc_channel_single_shot error
Otavio Salvador [Fri, 13 Mar 2020 17:42:47 +0000 (14:42 -0300)]
elgin-rv1108: Avoid adc_channel_single_shot error

Currently the following error message is seen during boot:

U-Boot 2020.01-08751-g55759ae141 (Mar 09 2020 - 14:44:52 -0300)

Model: Elgin RV1108 R1 board
DRAM:  128 MiB
APLL: 600000000 DPLL:1200000000 GPLL:1188000000
ACLK_BUS: 148500000 ACLK_PERI:148500000 HCLK_PERI:148500000 PCLK_PERI:74250000
MMC:   dwmmc@30110000: 0
Loading Environment from MMC... OK
In:    serial@10210000
Out:   serial@10210000
Err:   serial@10210000
Model: Elgin RV1108 R1 board
rockchip_dnl_key_pressed: adc_channel_single_shot fail!
....

Since the elgin-rv1108 does not use ADC to read the download
key status, select CONFIG_ROCKCHIP_BOOT_MODE_REG=0 to avoid
such error.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoelgin-rv1108: Use rk_board_late_init() for GPIO settings
Otavio Salvador [Fri, 13 Mar 2020 17:42:46 +0000 (14:42 -0300)]
elgin-rv1108: Use rk_board_late_init() for GPIO settings

Since commit 8e9a8d0d0c8c ("rockchip: elgin-rv1108: use board_early_init_f
for per-boar init") the function that configure the board GPIOs is no
longer called since CONFIG_BOARD_EARLY_INIT_F=y is not selected.

These GPIOs do not need to be configured in such early stagem, so change it
to rk_board_late_init() and also select CONFIG_BOARD_LATE_INIT=y
to fix the regression.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Fabio Berton <fabio.berton@ossystems.com.br>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agoARM: dts: Activate pullups in the console pins on rv1108-elgin-r1
Otavio Salvador [Fri, 13 Mar 2020 17:42:45 +0000 (14:42 -0300)]
ARM: dts: Activate pullups in the console pins on rv1108-elgin-r1

In order to make the console pins more robust to noise, activate
the pullups and increase its drive strength.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: Change keyboard input from CrOS EC keyboard to a USB keyboard
Peter Robinson [Mon, 2 Mar 2020 07:57:55 +0000 (07:57 +0000)]
rockchip: Change keyboard input from CrOS EC keyboard to a USB keyboard

These boards aren't ChromeOS devices so won't have a cros-ec-keyb
input as it's the keyboard available via the ChromeOS Embedded
Controller. Update them to use a USB keyboard which would actually
be available. Also enable the usb keyboard option for those devices
that don't have it enabled already.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
4 years agorockchip: evb-rv1108: Use syscon API to get grf base
Kever Yang [Wed, 19 Feb 2020 01:46:06 +0000 (09:46 +0800)]
rockchip: evb-rv1108: Use syscon API to get grf base

Use syscon API to get grf base instead of get from dts.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agorockchip: elgin-rv1108: Use syscon API to get grf base
Kever Yang [Wed, 19 Feb 2020 01:46:05 +0000 (09:46 +0800)]
rockchip: elgin-rv1108: Use syscon API to get grf base

Use syscon API to get grf base instead of get from dts.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Otavio Salvador <otavio@ossystems.com.br>
4 years agovexpress_ca9x4: Enable use of correct DTB file and restore EFI loader.
Kristian Amlie [Tue, 25 Feb 2020 17:22:16 +0000 (18:22 +0100)]
vexpress_ca9x4: Enable use of correct DTB file and restore EFI loader.

EFI was disabled in f95b8a4b5f64f because of the missing DTB file,
and indeed, the DTB file is required to load recent versions of GRUB
(2.04) correctly.

Signed-off-by: Kristian Amlie <kristian.amlie@northern.tech>
4 years agoMerge tag 'efi-2020-04-rc4-5' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Mon, 23 Mar 2020 14:14:31 +0000 (10:14 -0400)]
Merge tag 'efi-2020-04-rc4-5' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi

Pull request for UEFI sub-system for efi-2020-04-rc4 (5)

This series contains bug fixes for the UEFI sub-system:

* report correct variable length in GetNextVariable()
* correct copying direction if freestanding memmove()
* remove const for parameter of GetNextVariableName()
* correct function descriptions

Unit tests are added and adjusted.

4 years agoefi_loader: definition of GetNextVariableName()
Heinrich Schuchardt [Sun, 22 Mar 2020 17:28:20 +0000 (18:28 +0100)]
efi_loader: definition of GetNextVariableName()

'vendor' is both an input and an output parameter. So it cannot be
constant.

Fixes: 0bda81bfdc5c ("efi_loader: use const efi_guid_t * for variable services")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_selftest: test CalculateCrc32, CopyMem, SetMem
Heinrich Schuchardt [Sun, 22 Mar 2020 08:32:55 +0000 (09:32 +0100)]
efi_selftest: test CalculateCrc32, CopyMem, SetMem

Provide unit tests for CalculateCrc32(), CopyMem(), SetMem().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_loader: fix freestanding memmove()
Heinrich Schuchardt [Sun, 22 Mar 2020 08:52:48 +0000 (09:52 +0100)]
efi_loader: fix freestanding memmove()

For EFI binaries we have to provide an implementation of memmove() in
efi_freestanding.c.

Before this patch the memmove() function was copying in the wrong
direction.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_loader: description efi_convert_pointer()
Heinrich Schuchardt [Sun, 22 Mar 2020 07:28:15 +0000 (08:28 +0100)]
efi_loader: description efi_convert_pointer()

Correct the description of function efi_convert_pointer().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_loader: simplify logical expression in efi_disk_add_dev()
Heinrich Schuchardt [Thu, 19 Mar 2020 14:45:52 +0000 (15:45 +0100)]
efi_loader: simplify logical expression in efi_disk_add_dev()

To check if a variable is non-zero there is no need for '!= 0'.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_selftest: check length reported by GetNextVariableName()
Heinrich Schuchardt [Fri, 20 Mar 2020 18:20:17 +0000 (19:20 +0100)]
efi_selftest: check length reported by GetNextVariableName()

GetNextVariableName should report the length of the variable including the
final 0x0000 in bytes.

Check this in the unit test.

Increase the buffer size for variable names. 40 bytes is too short.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_loader: correct reported length in GetNextVariable()
Heinrich Schuchardt [Fri, 20 Mar 2020 18:04:34 +0000 (19:04 +0100)]
efi_loader: correct reported length in GetNextVariable()

The runtime service GetNextVariable() returns the length of the next
variable including the closing 0x0000. This length should be in bytes.

Comparing the output of EDK2 and U-Boot shows that this is currently not
correctly implemented:

EDK2:
OsIndicationsSupported: 46
PlatformLang: 26
PlatformLangCodes: 36

U-Boot:
OsIndicationsSupported: 23
PlatformLang: 13
PlatformLangCodes: 18

Provide correct length in GetNextVariable().

Fixes: d99a87f84b75 ("efi_loader: implement GetNextVariableName()")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_loader: fix function descriptions in efi_disk.c
Heinrich Schuchardt [Thu, 19 Mar 2020 12:49:34 +0000 (13:49 +0100)]
efi_loader: fix function descriptions in efi_disk.c

Use Sphinx style for function descriptions.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_loader: description of efi_variable.c
Heinrich Schuchardt [Thu, 19 Mar 2020 17:15:18 +0000 (17:15 +0000)]
efi_loader: description of efi_variable.c

Correct the file description.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoMerge branch 'master' of https://gitlab.denx.de/u-boot/custodians/u-boot-sunxi
Tom Rini [Wed, 18 Mar 2020 11:48:53 +0000 (07:48 -0400)]
Merge branch 'master' of https://gitlab.denx.de/u-boot/custodians/u-boot-sunxi

- Revert "sunxi: psci: avoid error address-of-packed-member"

4 years agoMerge tag 'efi-2020-04-rc4-4' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Wed, 18 Mar 2020 11:48:39 +0000 (07:48 -0400)]
Merge tag 'efi-2020-04-rc4-4' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi

Pull request for UEFI sub-system for efi-2020-04-rc4 (4)

This series fixes several bugs:

* consider the /reserved-memory node in the device tree
* consider memory reservations created in ft_board_setup()
* correct output of 'efidebug memmap' on the sandbox
* correct the definition of efi_capsule_header()

Furthermore some definitions needed for future patches are added to
header files.

4 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv
Tom Rini [Wed, 18 Mar 2020 11:48:11 +0000 (07:48 -0400)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Fix sbi_remote_sfence_vma{,_asid}.
- Avoid calling sbi_clear_ipi().
- Add new SBI v0.2 extensions support.

4 years agoRevert "sunxi: psci: avoid error address-of-packed-member"
Tomasz Duszynski [Sun, 16 Feb 2020 12:17:16 +0000 (13:17 +0100)]
Revert "sunxi: psci: avoid error address-of-packed-member"

Using memcpy() for some MMIO access is generally frowned upon and might
break things on some platforms. Allwinner H3, which fails to boot, being
an example here.

Moreover, fields being accessed are naturally aligned and warnings
produced by GCC have been quiesced for some time already by:

53dc8ae ("gcc-9: silence 'address-of-packed-member' warning")

That said, it should be okay to revert this commit.

This reverts commit 9bd34a69a453d409792e08c00953ce8862145e65.

Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Tomasz Duszynski <tduszyns@gmail.com>
Acked-by: Jagan Teki <jagan@amarulasolutions.com>
4 years agoefi_loader: correct a definition of struct efi_capsule_header
AKASHI Takahiro [Tue, 17 Mar 2020 02:12:37 +0000 (11:12 +0900)]
efi_loader: correct a definition of struct efi_capsule_header

See UEFI specification, section 8.5.3.
In addition, the structure, efi_capsule_header, should be "packed"
as it is a serialized binary format in a capsule file.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
4 years agoefi_loader: export a couple of protocol related functions
AKASHI Takahiro [Tue, 17 Mar 2020 02:12:36 +0000 (11:12 +0900)]
efi_loader: export a couple of protocol related functions

This is a preparatory patch.
Those functions will be used in an implementation of UEFI firmware
management protocol as part of my capsule update patch.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
4 years agoefi_loader: define System Resource Table macros
AKASHI Takahiro [Tue, 17 Mar 2020 02:12:35 +0000 (11:12 +0900)]
efi_loader: define System Resource Table macros

Some of those values will be used in an implementation of UEFI firmware
management protocol as part of my capsule update patch.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
4 years agoefi_loader: define OsIndicationsSupported flags
AKASHI Takahiro [Tue, 17 Mar 2020 02:12:34 +0000 (11:12 +0900)]
efi_loader: define OsIndicationsSupported flags

These flags are expected to be set in OsIndicationsSupported variable
if corresponding features are supported. See UEFI specification,
section 8.5.4.

In particular, capsule-related flags will be used in my capsule
update patch.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Fix misspelled EFI_OS_INDICATIONS_BOOT_TO_FW_UI.
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agocmd: bootefi: Parse reserved-memory node from DT
Atish Patra [Sat, 14 Mar 2020 00:11:30 +0000 (17:11 -0700)]
cmd: bootefi: Parse reserved-memory node from DT

Currently, bootefi only parses memory reservation block to setup
EFI reserved memory mappings. However, it doesn't parse the
reserved-memory[1] device tree node that also can contain the
reserved memory regions.

Add capability to parse reserved-memory node and update the EFI memory
mappings accordingly.

1. <U-Boot source>/doc/device-tree-bindings/reserved-memory/reserved-memory.txt]

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Fix an endless loop.

The /reserved-memory node may have children without reg property. Remove
a superfluous debug statement.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agocmd: map addresses to sysmem in efidebug memmap
Heinrich Schuchardt [Sat, 14 Mar 2020 07:44:07 +0000 (08:44 +0100)]
cmd: map addresses to sysmem in efidebug memmap

Addresses in the sandbox's device tree are in the sandbox's virtual address
space. If we want to compare memory reservations in the device-tree with
the output of 'efidebug memmap', we need to convert back to this address
space.

Adjust the output of the 'efidebug memmap' command.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_loader: create reservations after ft_board_setup
Heinrich Schuchardt [Sat, 14 Mar 2020 09:59:34 +0000 (10:59 +0100)]
efi_loader: create reservations after ft_board_setup

Some memory reservations are made in ft_board_setup(). Ensure that we
create reserved memory map entries after ft_board_setup().

The downside of this patch is that if bootefi is called multiple times with
an devicetree argument superfluous reservations for the old copies of the
device tree will exist. But that is still better than missing a reservation.

Deleting the superfluous reservations is not possible because reservations
in the memory map are rounded to page size and may be coallesced.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoriscv: Implement new SBI v0.2 extensions
Bin Meng [Tue, 10 Mar 2020 02:35:31 +0000 (19:35 -0700)]
riscv: Implement new SBI v0.2 extensions

Few v0.1 SBI calls are being replaced by new SBI calls that follows
v0.2 calling convention.

Implement the replacement extensions and few additional new SBI
function calls that makes way for a better SBI interface in future.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Pragnesh Patel <pragnesh.patel@sifive.com>
4 years agoriscv: Introduce a new config for SBI v0.1
Bin Meng [Tue, 10 Mar 2020 02:35:30 +0000 (19:35 -0700)]
riscv: Introduce a new config for SBI v0.1

We now have SBI v0.2 which is more scalable and extendable to handle
future needs for RISC-V supervisor interfaces.

Introduce a new config and move all SBI v0.1 code under that config.
This allows to implement the new replacement SBI extensions cleanly
and remove v0.1 extensions easily in future. Currently, the config
is enabled by default. Once all M-mode software, with v0.1, is no
longer in use, this config option and all relevant code can be easily
removed.

This commit is inspired from Linux kernel patch:
https://patchwork.kernel.org/patch/11407361/

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Pragnesh Patel <pragnesh.patel@sifive.com>
4 years agoriscv: Add SBI v0.2 extension definitions
Bin Meng [Tue, 10 Mar 2020 02:35:29 +0000 (19:35 -0700)]
riscv: Add SBI v0.2 extension definitions

Few v0.1 SBI calls are being replaced by new SBI calls that follows
v0.2 calling convention.

This patch just defines these new extensions.

This commit is inspired from Linux kernel patch:
https://patchwork.kernel.org/patch/11407359/

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Pragnesh Patel <pragnesh.patel@sifive.com>
4 years agoriscv: Add basic support for SBI v0.2
Bin Meng [Tue, 10 Mar 2020 02:35:28 +0000 (19:35 -0700)]
riscv: Add basic support for SBI v0.2

The SBI v0.2 introduces a base extension which is backward compatible
with v0.1. Implement all helper functions and minimum required SBI
calls from v0.2 for now. All other base extension function will be
added later as per need.

As v0.2 calling convention is backward compatible with v0.1, remove
the v0.1 helper functions and just use v0.2 calling convention.

Add a new Kconfig options CONFIG_SBI for the new SBI v0.2 codes, and
let CONFIG_SBI_IPI depend on it.

This commit is inspired from Linux kernel patch:
https://patchwork.kernel.org/patch/11407363/

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Pragnesh Patel <pragnesh.patel@sifive.com>
4 years agoriscv: Mark existing SBI as v0.1 SBI
Bin Meng [Tue, 10 Mar 2020 02:35:27 +0000 (19:35 -0700)]
riscv: Mark existing SBI as v0.1 SBI

As per the new SBI specification, current SBI implementation version
is defined as 0.1 and will be removed/replaced in future. Each of the
function call in 0.1 is defined as a separate extension which makes
easier to replace them one at a time.

Rename existing implementation to reflect that. This patch is just
a preparatory patch for SBI v0.2 and doesn't introduce any functional
changes.

This commit is inspired from Linux kernel patch:
https://patchwork.kernel.org/patch/11407355/

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Pragnesh Patel <pragnesh.patel@sifive.com>
4 years agoriscv: Avoid calling sbi_clear_ipi()
Bin Meng [Fri, 6 Mar 2020 08:44:17 +0000 (00:44 -0800)]
riscv: Avoid calling sbi_clear_ipi()

There is no need for S-mode U-Boot to call sbi_clear_ipi() as it
can be cleared directly from S-mode. This saves some cycles.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Lukas Auer <lukas@auer.io>
4 years agoriscv: Fix sbi_remote_sfence_vma{,_asid}
Bin Meng [Fri, 6 Mar 2020 08:44:16 +0000 (00:44 -0800)]
riscv: Fix sbi_remote_sfence_vma{,_asid}

Currently sbi_remote_sfence_vma{,_asid} does not pass their arguments
to SBI at all, which is semantically incorrect.

This keeps in sync with Linux kernel commit:
  a21344dfc6ad: fix sbi_remote_sfence_vma{,_asid}

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Lukas Auer <lukas@auer.io>
4 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-marvell
Tom Rini [Mon, 16 Mar 2020 16:33:24 +0000 (12:33 -0400)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-marvell

- Fix timer wrap (Chris)
- Use dev_read only if OF_PLATDATA is not enabled (Walter)

4 years agowatchdog: Handle timer wrap around
Chris Packham [Mon, 24 Feb 2020 00:20:33 +0000 (13:20 +1300)]
watchdog: Handle timer wrap around

On some platforms/architectures the value from get_timer() can wrap.
This is particularly problematic when long-running code needs to measure
a time difference as is the case with watchdog_reset() which tries to
avoid tickling the watchdog too frequently.

Use time_after() from time.h instead of a plain > comparison to avoid
any issues with the time wrapping on a system that has been sitting in
u-boot for a long time.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
4 years agowatchdog: Use dev_read only if OF_PLATDATA is not enabled
Walter Lozano [Thu, 23 Jan 2020 19:05:05 +0000 (16:05 -0300)]
watchdog: Use dev_read only if OF_PLATDATA is not enabled

Currently watchdog tries to use dev_read_u32_default to get timeout
configuration in case OF_CONTROL is enabled. However, if SPL is
built with OF_PLATDATA this has no sense as there is no device tree.

This patch fixes this issue by only use dev_read_u32_default if OF_CONTROL
is enabled but OF_PLATDATA is not.

Signed-off-by: Walter Lozano <walter.lozano@collabora.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoMerge branch '2020-03-13-master-imports'
Tom Rini [Fri, 13 Mar 2020 17:21:17 +0000 (13:21 -0400)]
Merge branch '2020-03-13-master-imports'

- Address the regression with the 'gpio' command
- Fix mcfuart regression
- Other minor fixes

4 years agoMAINTAINERS: update entry for ARM STI
Patrice Chotard [Thu, 12 Mar 2020 10:11:18 +0000 (11:11 +0100)]
MAINTAINERS: update entry for ARM STI

Add STi drivers/include files and git tree.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
4 years agofit: check return value of fit_image_get_data_size()
Heinrich Schuchardt [Wed, 11 Mar 2020 20:51:08 +0000 (21:51 +0100)]
fit: check return value of fit_image_get_data_size()

GCC-10 reports:

In file included from tools/common/image-fit.c:1:
include/image.h: In function ‘fit_image_get_data_and_size’:
./tools/../common/image-fit.c:1015:9: warning: ‘len’ may be used
uninitialized in this function [-Wmaybe-uninitialized]
 1015 |   *size = len;
      |   ~~~~~~^~~~~
./tools/../common/image-fit.c:996:6: note: ‘len’ was declared here
  996 |  int len;
      |      ^~~

Add the missing check of the return value of fit_image_get_data_size().

Fixes: c3c863880479 ("add FIT data-position & data-offset property support")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
4 years agowatchdog: Align Kconfig properties
Michal Simek [Wed, 11 Mar 2020 11:26:53 +0000 (12:26 +0100)]
watchdog: Align Kconfig properties

Just cleanup help indentation to be the same for all options.
It means <tab><space><space> indentation.

OMAP3 should be indented by tabs which is also fixed.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
4 years agocmd: gpio: Make `gpio input` return pin value again
Alex Kiernan [Wed, 11 Mar 2020 08:46:29 +0000 (08:46 +0000)]
cmd: gpio: Make `gpio input` return pin value again

4dbc107f4683 ("cmd: gpio: Correct do_gpio() return value") correctly
changed the behaviour of the gpio command to return CMD_RET_SUCCESS or
CMD_RET_FAILURE, but any existing script which expects the return value
to be the pin value is broken by this change.

Reinstate the legacy behaviour for `gpio input` only.

Fixes: 4dbc107f4683 ("cmd: gpio: Correct do_gpio() return value")
Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Signed-off-by: Alex Kiernan <alex.kiernan@hivehome.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoMakefile: doesn't need check stack size when dtb is not built
AKASHI Takahiro [Tue, 10 Mar 2020 00:20:43 +0000 (09:20 +0900)]
Makefile: doesn't need check stack size when dtb is not built

The commit 5fed97af20da ("Makefile: ensure DTB doesn't overflow into
initial stack") adds an extra check for stack size in BSS if
CONFIG_SYS_INIT_SP_BSS_OFFSET is enabled.
This check, however, doesn't make sense under the configuration where
control dtb won't be built in and it should be void in such cases.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Fixes: 5fed97af20da ("Makefile: ensure DTB doesn't overflow into initial stack")
Reviewed-by: Stephen Warren <swarren@nvidia.com>
4 years agoserial: mcfuart: renaming to a more appropriate name
Angelo Durgehello [Sat, 29 Feb 2020 00:09:35 +0000 (01:09 +0100)]
serial: mcfuart: renaming to a more appropriate name

All drivers seems to align now to serial_xxx maning, so, aligning
also this driver, to allow to be found easily.

Signed-off-by: Angelo Durgehello <angelo.dureghello@timesys.com>
4 years agoserial: mcfuart: fix uart port index
Angelo Durgehello [Sat, 29 Feb 2020 00:01:32 +0000 (01:01 +0100)]
serial: mcfuart: fix uart port index

Actually, using dev->seq value before probe to deduce the current
serial port index leads to reading an invalid seq value (-1).
So, getting dev->seq at probe time.

Signed-off-by: Angelo Durgehello <angelo.dureghello@timesys.com>
4 years agoMerge tag 'efi-2020-04-rc4-3' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Thu, 12 Mar 2020 16:51:44 +0000 (12:51 -0400)]
Merge tag 'efi-2020-04-rc4-3' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi

Pull request for UEFI sub-system for efi-2020-04-rc4 (3)

This pull request provides the hardware RNG driver for Amlogic systems needed
for the EFI_RNG_PROTOCOL.

Furthermore bug fixes are provided:

* correct an error message in the efidebug command
* correct an error in the 'efidebug rm' command
* remove an unnecessary assignment in efi_queue_event()

4 years agoMerge tag 'u-boot-stm32-20200310' of https://gitlab.denx.de/u-boot/custodians/u-boot-stm
Tom Rini [Thu, 12 Mar 2020 16:50:09 +0000 (12:50 -0400)]
Merge tag 'u-boot-stm32-20200310' of https://gitlab.denx.de/u-boot/custodians/u-boot-stm

- stm32mp: fix dependency for CONFIG_STM32_ETZPC

4 years agodrivers/rng: add Amlogic hardware RNG driver
Heinrich Schuchardt [Sun, 2 Feb 2020 18:52:04 +0000 (19:52 +0100)]
drivers/rng: add Amlogic hardware RNG driver

Add support for the hardware random number generator of Amlogic SOCs.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Sughosh Ganu <sughosh.ganu@linaro.org>
4 years agodrivers/rng: simplify Kconfig
Heinrich Schuchardt [Sun, 2 Feb 2020 18:45:35 +0000 (19:45 +0100)]
drivers/rng: simplify Kconfig

For all sandbox systems with DM_RNG we enable RNG_SANDBOX. So we can simply
set the default to yes.

All rng drivers depend on DM_RNG. Use a single 'if' instead of individual
dependencies. Now 'make menuconfig' shows the individual drivers neatly
indented under the DM_RNG entry.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Sughosh Ganu <sughosh.ganu@linaro.org>
4 years agoefi_loader: unnecessary assignment in efi_queue_event
Heinrich Schuchardt [Fri, 6 Mar 2020 20:56:10 +0000 (21:56 +0100)]
efi_loader: unnecessary assignment in efi_queue_event

The assigned value NULL is never used.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agocmd: efidebug: correct error message
Heinrich Schuchardt [Mon, 2 Mar 2020 19:13:10 +0000 (20:13 +0100)]
cmd: efidebug: correct error message

Add the missing line feed at the error message if the variable referred to
by 'efidebug boot rm' does not exist.

Shorten the format string by using the variable name instead of the number
of the boot variable.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agocmd: efidebug: fix a failure of "boot rm" sub-command
AKASHI Takahiro [Fri, 28 Feb 2020 00:05:04 +0000 (09:05 +0900)]
cmd: efidebug: fix a failure of "boot rm" sub-command

There is a wrong usage of utf8_utf16_strncpy() in "boot rm" command, and
then it will end up with a failure of this command due to a wrong
value of an interim variable ("var_name16").

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoefi_loader: get_memory_map: return parameters whenever possible
AKASHI Takahiro [Wed, 11 Mar 2020 06:18:18 +0000 (15:18 +0900)]
efi_loader: get_memory_map: return parameters whenever possible

Currently, if GetMemoryMap API returns EFI_BUFFER_TOO_SMALL, it doesn't
set valid values to other parameters, descriptor_size and
descriptor_version, except memory_map_size.
Some efi applications, however, may use those value; in particular,
xen uses descriptor_size to calculate a size of buffer to be allocated.

While UEFI specification is ambiguous in this point, it would be better
to address this issue proactively to maximize the compatibility with
existing efi applications.

With this patch, for example, xen.efi (and hence linux kernel) can be
started via bootefi without modification.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoMerge tag 'mmc-2020-3-9' of https://gitlab.denx.de/u-boot/custodians/u-boot-mmc
Tom Rini [Wed, 11 Mar 2020 01:13:26 +0000 (21:13 -0400)]
Merge tag 'mmc-2020-3-9' of https://gitlab.denx.de/u-boot/custodians/u-boot-mmc

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

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

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

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

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

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

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

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

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

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

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

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

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

4 years agostm32mp: update dependency for STM32_ETZPC
Patrick Delaunay [Tue, 10 Mar 2020 15:05:43 +0000 (16:05 +0100)]
stm32mp: update dependency for STM32_ETZPC

Correct the dependency for STM32 ETZPC protection, linked to SOC
STM32MP identified by CONFIG_STM32MP15x and not linked to
CONFIG_TARGET_STM32MP1 (no more existing).

This patch fix an issue introduced by commit 846254888e2e ("stm32mp1:
split board and SOC support for STM32MP15x family").

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Patrice Chotard <patrice.chotard@st.com>
4 years agoMerge branch 'master' of https://gitlab.denx.de/u-boot/custodians/u-boot-net
Tom Rini [Tue, 10 Mar 2020 11:51:56 +0000 (07:51 -0400)]
Merge branch 'master' of https://gitlab.denx.de/u-boot/custodians/u-boot-net

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

This fixes the following warning:

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

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

This fixes the following warning:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

So I increased size to 1MB : 0x100000

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

SPL boot cannot find dtb if CONFIG_SPL_SEPARATE_BSS is disabled :

CONFIG_SPL_SEPARATE_BSS=n

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

CONFIG_SPL_SEPARATE_BSS=y

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

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

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

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

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

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

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

When printing unsigned numbers use %u.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Added missing USDHC Base address defines

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

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

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

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

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

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

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

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

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

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

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

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

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

Signed-off-by: Baruch Siach <baruch@tkos.co.il>