platform/kernel/u-boot.git
3 years agoarm: rockchip: Explicitly cast gd->ram_top in dram_init_banksize()
Bin Meng [Sun, 31 Jan 2021 12:35:58 +0000 (20:35 +0800)]
arm: rockchip: Explicitly cast gd->ram_top in dram_init_banksize()

The min() macro used in dram_init_banksize() requires two elements
to compare have the same type. Let's explicitly cast gd->ram_top.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
3 years agoriscv: Adjust board_get_usable_ram_top() for 32-bit
Bin Meng [Sun, 31 Jan 2021 12:35:57 +0000 (20:35 +0800)]
riscv: Adjust board_get_usable_ram_top() for 32-bit

When testing QEMU RISC-V 'virt' machine with a 2 GiB memory
configuration, it was discovered gd->ram_top is assigned to
value zero in setup_dest_addr().

While gd->ram_top should not be declared as type `unsigned long`,
which will be updated in a future patch, the current logic in
board_get_usable_ram_top() can be updated to cover both 64-bit
and 32-bit RISC-V.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
3 years agodm: core: Add documentation about device removal
Simon Glass [Sun, 24 Jan 2021 21:32:48 +0000 (14:32 -0700)]
dm: core: Add documentation about device removal

Make mention of this feature in the core documentation so people can
discover it without looking at a header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoarm: Remove vital devices last
Simon Glass [Sun, 24 Jan 2021 21:32:47 +0000 (14:32 -0700)]
arm: Remove vital devices last

Update announce_and_cleanup() to remove all devices, with the vital ones
being removed last.

This is an extra patch on top of the recent RFC:

   http://patchwork.ozlabs.org/project/uboot/list/?series=223280

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Add late driver remove option
Marek Vasut [Sun, 24 Jan 2021 21:32:46 +0000 (14:32 -0700)]
dm: core: Add late driver remove option

Add another flag to the DM core which could be assigned to drivers and
which makes those drivers call their remove callbacks last, just before
booting OS and after all the other drivers finished with their remove
callbacks. This is necessary for things like clock drivers, where the
other drivers might depend on the clock driver in their remove callbacks.
Prime example is the mmc subsystem, which can reconfigure a card from HS
mode to slower modes in the remove callback and for that it needs to
reconfigure the controller clock.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Avoid partially removing devices
Simon Glass [Sun, 24 Jan 2021 21:32:45 +0000 (14:32 -0700)]
dm: core: Avoid partially removing devices

At present if device_remove() decides that the device should not actually
be removed, it still calls the uclass pre_remove() method and powers the
device down.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Remove children before advising uclass
Simon Glass [Sun, 24 Jan 2021 21:32:44 +0000 (14:32 -0700)]
dm: core: Remove children before advising uclass

At present the uclass pre-remove method is called before the children are
removed. But the children may refused to be removed, in whch case the
uclass is in a tricky situation. At present we handle this by calling
the uclass' post_probe() method. But it seems better to avoid doing
anything with the uclass in this case.

Switch the ordering so that we make sure the children can be removed
before advising the uclass.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: pci: Correct use of wrong flag name
Simon Glass [Sun, 24 Jan 2021 21:32:43 +0000 (14:32 -0700)]
dm: pci: Correct use of wrong flag name

Update a driver that uses the incorrect flag. Add a comment to hopefully
prevent furture mistakes.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: Rename DM_FLAG_REMOVE_WITH_PD_ON
Simon Glass [Sun, 24 Jan 2021 21:32:42 +0000 (14:32 -0700)]
dm: Rename DM_FLAG_REMOVE_WITH_PD_ON

This flag has the word 'REMOVE' in it which means it conflicts with
the DM_REMOVE flags. Rename it to DM_FLAG_LEAVE_PD_ON which seems to
indicate its purpose well enough.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agonand: brcmnand: Don't use -EPROBE_DEFER
Simon Glass [Sun, 24 Jan 2021 21:32:41 +0000 (14:32 -0700)]
nand: brcmnand: Don't use -EPROBE_DEFER

This has no useful meaning in U-Boot and will never be returned. We want
to reserve this flag for internal driver model use.

Drop the code.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agosmem: Don't use -EPROBE_DEFER
Simon Glass [Sun, 24 Jan 2021 21:32:40 +0000 (14:32 -0700)]
smem: Don't use -EPROBE_DEFER

This has no useful meaning in U-Boot. Use -ENOMEM since that appears to
be what has gone wrong in this case. We want to reserve this flag for
internal driver model use.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoMerge branch '2021-02-01-assorted-fixes'
Tom Rini [Tue, 2 Feb 2021 14:24:10 +0000 (09:24 -0500)]
Merge branch '2021-02-01-assorted-fixes'

- Assorted fixes

3 years agoazure: Add -E back for the world build script
Bin Meng [Sun, 31 Jan 2021 08:38:35 +0000 (16:38 +0800)]
azure: Add -E back for the world build script

Commit dd5c954e917b ("travis/gitlab/azure: Use -W to avoid warnings check")
added -W to avoid warnings check, but it mistakenly dropped -E for
the world build script in the azure pipelines.

This caused builds on the azure pipelines fail to report warnings. Let's
add it back.

Fixes: dd5c954e917b ("travis/gitlab/azure: Use -W to avoid warnings check")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agotest/py: fix runtest wrapper for pytest 6
Stephen Warren [Sun, 31 Jan 2021 03:12:18 +0000 (20:12 -0700)]
test/py: fix runtest wrapper for pytest 6

The implementation of pytest_runtest_protocol() must call
pytest_runtest_logstart() and pytest_runtest_logfinish(). This appears to
be necessary even in pytest 5.2.1 judging by the default version of
pytest_runtest_protocol(), but evidently some form of code reorganization
in pytest only made this have a practical effect in the newer version. I'd
previously been under the impression that 100% of the required work of
pytest_runtest_protocol() was handled by the fact it called
runtestprotocol() as its implementation. However, it appears that custom
implementations do need to do a little more than this.

Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoMAINTAINERS: Add maintainer to network subsystem
Ramon Fried [Fri, 29 Jan 2021 16:18:22 +0000 (18:18 +0200)]
MAINTAINERS: Add maintainer to network subsystem

Add myself as co maintainer to network subsystem
Acked-by: Tom Rini <trini@konsulko.com>
Acked-by: Marek Vasut <marex@denx.de>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
3 years agodisk: part_dos: update partition table entries after write
Gary Bisson [Thu, 28 Jan 2021 08:10:07 +0000 (09:10 +0100)]
disk: part_dos: update partition table entries after write

Fixes issues when switching from GPT to MBR partition tables.

Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
3 years agocommon: Kconfig.boot: Add FIT_PRINT config option
Ravik Hasija [Wed, 27 Jan 2021 22:01:48 +0000 (14:01 -0800)]
common: Kconfig.boot: Add FIT_PRINT config option

Config allows to disable printing contents of fitImage to optimize boottime.

Signed-off-by: Ravik Hasija <rahasij@linux.microsoft.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agocmd: load, emit error message for invalid block device
Heinrich Schuchardt [Wed, 27 Jan 2021 20:26:43 +0000 (21:26 +0100)]
cmd: load, emit error message for invalid block device

The load command should not silently return to the console prompt if an
invalid block device is specified and no file is loaded.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoarm: Remove #include <version.h> from armv8/fwcall.c
Pali Rohár [Wed, 27 Jan 2021 15:29:13 +0000 (16:29 +0100)]
arm: Remove #include <version.h> from armv8/fwcall.c

No version information is used in armv8/fwcall.c therefore do not include
version.h header file. This change prevents recompiling fwcall.o when
SOURCE_DATE_EPOCH changes.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agotools/fit_check_sign.c: Update usage function.
Ilies CHERGUI [Sun, 17 Jan 2021 15:52:16 +0000 (15:52 +0000)]
tools/fit_check_sign.c: Update usage function.

Add "-c" option to set the configuration name when
checking the FIT image signature.

Signed-off-by: Ilies CHERGUI <ilies.chergui@gmail.com>
3 years agoPrepare v2021.04-rc1
Tom Rini [Mon, 1 Feb 2021 15:28:20 +0000 (10:28 -0500)]
Prepare v2021.04-rc1

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-x86
Tom Rini [Mon, 1 Feb 2021 13:15:46 +0000 (08:15 -0500)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-x86

- Fix CMD_ACPI dependency in Kconfig
- Correct overflow in __udelay() in TSC timer driver
- Add a devicetree node for eMMC for Coral
- Minor improvements on image loading
- Reduce size of Samus image

3 years agox86: Reduce size of samus image
Simon Glass [Sun, 31 Jan 2021 16:17:07 +0000 (09:17 -0700)]
x86: Reduce size of samus image

With the recent addition of ACPI generation, the image size has got beyond
its current limit.

Samus does not actually use this, nor x86 emulation for PCI ROMs, so
disable both features.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: tpl: Show next stage being booted
Simon Glass [Sun, 24 Jan 2021 17:06:11 +0000 (10:06 -0700)]
x86: tpl: Show next stage being booted

Enhance the debugging to show the next stage being booted as well as a
dump of the start of the image.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: spl: Clear BSS unconditionally
Simon Glass [Sun, 24 Jan 2021 17:06:10 +0000 (10:06 -0700)]
x86: spl: Clear BSS unconditionally

This should be done even if not using TPL, since BSS may be in use or
boards that only use SPL. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: zimage: Improve command-line debug handling
Simon Glass [Sun, 24 Jan 2021 17:06:09 +0000 (10:06 -0700)]
x86: zimage: Improve command-line debug handling

At present if the command line is very long it is truncated by the
printf() statement, which works within a limited buffer. Use puts()
instead. Also show better debugging with the command-line setup
fails.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: zimage: Allow dumping the image from outside the module
Simon Glass [Sun, 24 Jan 2021 17:06:08 +0000 (10:06 -0700)]
x86: zimage: Allow dumping the image from outside the module

At present it is possible to dump an image within the zimage command, but
it is also useful to be able to dump it from elsewhere, for example in a
loader that has special handling for the different zimage stages.

Export this feature as a new function.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: Update Chromium OS GNVS names
Simon Glass [Sun, 24 Jan 2021 17:06:07 +0000 (10:06 -0700)]
x86: Update Chromium OS GNVS names

The Global Non-Volatile Storage struct has some fields with particular
meanings. Rename these to make things easier to follow. Also add a few
more boot flags.

GNVS should not be confused with GNVQ (Going Nowhere Very Quickly).

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: spl: Make moving BSS conditional
Simon Glass [Sun, 24 Jan 2021 17:06:06 +0000 (10:06 -0700)]
x86: spl: Make moving BSS conditional

At present BSS is always placed in SDRAM. If a separate BSS is not in use
this means that BSS doesn't work as expected. Make the setting conditional
on the SEPARATE_BSS option.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: Make sure the SPL image ends on a suitable boundary
Simon Glass [Sun, 24 Jan 2021 17:06:05 +0000 (10:06 -0700)]
x86: Make sure the SPL image ends on a suitable boundary

The part of U-Boot that actually ends up in u-boot-nodtb.bin is not built
with any particular alignment. It ends at the start of the BSS section.
The BSS section selects its own alignment, which may larger.
This means that there can be a gap of a few bytes between the image
ending and BSS starting.

Since u-boot.bin is build by joining u-boot-nodtb.bin and u-boot.dtb (with
perhaps some padding for BSS), the expected result is not obtained. U-Boot
uses the end of BSS to find the devicetree, so this means that it cannot
be found.

Add 32-byte alignment of BSS so that the image size is correct and
appending the devicetree will place it at the end of BSS.

Example SPL output without this patch:

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         000142a1  fef40000  fef40000  00001000  2**4
                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
  1 .u_boot_list  000014a4  fef542a8  fef542a8  000152a8  2**3
                  CONTENTS, ALLOC, LOAD, RELOC, DATA
  2 .rodata       0000599c  fef55760  fef55760  00016760  2**5
                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
  3 .data         00000970  fef5b100  fef5b100  0001c100  2**5
                  CONTENTS, ALLOC, LOAD, RELOC, DATA
  4 .binman_sym_table 00000020  fef5ba70  fef5ba70  0001ca70  2**2
                  CONTENTS, ALLOC, LOAD, DATA
  5 .bss          00000060  fef5baa0  fef5baa0  00000000  2**5
                  ALLOC

You can see that .bss is aligned to 2**5 (32 bytes). This is because of
the mallinfo struct in dlmalloc.c:

 17 .bss.current_mallinfo 00000028  00000000  00000000  000004c0  2**5
                  ALLOC

In this case the size of u-boot-spl-nodtb.bin is 0x1ba90. This matches up
with the _image_binary_end symbol:

fef5ba90 g       .binman_sym_table      00000000 _image_binary_end

But BSS starts 16 bytes later, at 0xfef5baa0, due to the 32-byte
alignment. So we must align _image_binary_end to a 32-byte boundary. This
forces the binary size to be 0x1baa0, i.e. ending at the start of bss, as
expected.

Note that gcc reports __BIGGEST_ALIGNMENT__ of 16 on this build, even
though it generates an object file with a member that requests 32-byte
alignment.

The current_mallinfo struct is 40 bytes in size. Increasing the struct to
68 bytes (i.e. just above a 64-byte boundary) does not cause the alignment
to go above 32 bytes. So it seems that 32 bytes is the maximum alignment
at present.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: add more details in the commit message to help people understand]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: apl: Enhance debugging in the SPL loader
Simon Glass [Sun, 24 Jan 2021 17:06:04 +0000 (10:06 -0700)]
x86: apl: Enhance debugging in the SPL loader

Move to log_debug() and make use of the new SPL function to find the
text base.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: spl: Add a function to find the text base
Simon Glass [Sun, 24 Jan 2021 17:06:03 +0000 (10:06 -0700)]
x86: spl: Add a function to find the text base

It is useful to know the TEXT_BASE value for the image being loaded in
TPL/SPL. Add a new spl_get_image_text_base() function to handle this.

Make use of this in the x86 SPL handler, instead of having the logic
there.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: acpi_gpe: Update driver name to match devicetree
Simon Glass [Sun, 24 Jan 2021 17:06:02 +0000 (10:06 -0700)]
x86: acpi_gpe: Update driver name to match devicetree

Use a driver name in line with the compatible string so that of-platdata
can use this driver.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agoacpi: Tidy up documentation for struct acpi_gpio
Simon Glass [Sat, 23 Jan 2021 18:08:38 +0000 (11:08 -0700)]
acpi: Tidy up documentation for struct acpi_gpio

Some comments were provided after this patch was applied. Address them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: coral: Add a devicetree node for eMMC
Simon Glass [Thu, 14 Jan 2021 03:29:53 +0000 (20:29 -0700)]
x86: coral: Add a devicetree node for eMMC

Add a node for this so we can indicate that it is does not require any
ACPI code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agox86: tsc_timer: Correct overflow in __udelay()
Simon Glass [Thu, 14 Jan 2021 03:29:45 +0000 (20:29 -0700)]
x86: tsc_timer: Correct overflow in __udelay()

At present long delays such as msleep(2000) can cause an overflow in this
function. There is no need for this, since it already uses a 64-bit int.

Add a cast to correct this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agocmd: CMD_ACPI depends on ACPIGEN
Heinrich Schuchardt [Wed, 20 Jan 2021 20:37:56 +0000 (21:37 +0100)]
cmd: CMD_ACPI depends on ACPIGEN

Trying to compile qemu-x86_64_defconfig with CONFIG_CMD_ACPI=y and
CONFIG_ACPIGEN=n fails with

ld.bfd: cmd/built-in.o: in function `do_acpi_items':
cmd/acpi.c:162: undefined reference to `acpi_dump_items'

Add the missing configuration dependency.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-sunxi
Tom Rini [Mon, 1 Feb 2021 00:44:45 +0000 (19:44 -0500)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-sunxi

- Allwinner H616 Ethernet support
- sunxi ata debug fix

3 years agoata: sunxi: fix debug messages
Dario Binacchi [Sun, 24 Jan 2021 18:13:10 +0000 (19:13 +0100)]
ata: sunxi: fix debug messages

It is useless and misleading to print the ret variable that is not set
by the dev_read_addr routine. Also, move the '\n' character after the
round bracket that contains the error code.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
3 years agosunxi: OrangePi Zero 2: Enable Ethernet
Andre Przywara [Sat, 23 Jan 2021 12:46:43 +0000 (12:46 +0000)]
sunxi: OrangePi Zero 2: Enable Ethernet

With the fixes to the sun8i-emac driver, we can now enable Ethernet
support on the OrangePi Zero2.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Tested-by: Jernej Skrabec <jernej.skrabec@siol.net>
Reviewed-by: Jernej Skrabec <jernej.skrabec@siol.net>
3 years agonet: sun8i-emac: Determine pinmux based on SoC, not EMAC type
Andre Przywara [Mon, 11 Jan 2021 20:11:49 +0000 (21:11 +0100)]
net: sun8i-emac: Determine pinmux based on SoC, not EMAC type

The pinmux choice for the RMII/RGMII pins the EMAC is connected to is
not dependent on the EMAC IP, but on the SoC it is integrated in.
Deriving the pinmux from the DT compatible string (as we do at the
moment) will thus cause problems with certain EMAC IP / SoC combinations.

To avoid this exact issue with the H616, let's use our Kconfig MACH
symbols to choose the correct pinmux setup.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Tested-by: Jernej Skrabec <jernej.skrabec@siol.net>
Reviewed-by: Jernej Skrabec <jernej.skrabec@siol.net>
3 years agonet: sun8i-emac: Always clear syscon EPHY register
Andre Przywara [Mon, 11 Jan 2021 20:11:45 +0000 (21:11 +0100)]
net: sun8i-emac: Always clear syscon EPHY register

At the moment we only consider the EPHY register for those SoCs were
we actually have an internal PHY to configure. However even other SoCs
have this register, an expect the EPHY select bit to be cleared for
proper operation with an external PHY.

Rework sun8i_emac_set_syscon_ephy() to be called regardless of the EMAC
model, and clear the H3_EPHY_SELECT bit if no internal PHY is used.

We get away without it so far because SoCs like the A64 clear this bit
on reset, but we need to explicitly clear it on the H616, for instance.
The Linux driver does so as well.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Tested-by: Jernej Skrabec <jernej.skrabec@siol.net>
Reviewed-by: Jernej Skrabec <jernej.skrabec@siol.net>
3 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-usb
Tom Rini [Sun, 31 Jan 2021 19:24:35 +0000 (14:24 -0500)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-usb

- Assorted gadget changes including:
  - dfu: Fix handling of UBI partitions in MTD backend
  - gadget: f_thor: fix wrong file size cast
  - Extend cmd: bcb
  - Fixes for fastboot and rockchip gadgets
  - dfu: Add SCRIPT and SKIP entities
  - dfu/thor: Add `dfu_alt_info` reinitialization from flashed script
  - u-boot: Reduce size of u-boot as usbd_device_* arrays are not exported

3 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-sh
Tom Rini [Sun, 31 Jan 2021 19:23:47 +0000 (14:23 -0500)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-sh

- Sync r8a774a1 DT files, tmio sdhi DMA fix

3 years agoMerge tag 'dm-pull-30jan21' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm
Tom Rini [Sun, 31 Jan 2021 13:49:53 +0000 (08:49 -0500)]
Merge tag 'dm-pull-30jan21' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm

tpm fixes for coral
binman fixes support for symbols in sub-sections
support for additional cros_ec commands
various minor fixes / tweaks

3 years agousb: gaget: ci: set ep's desc when enable ep
Li Jun [Mon, 25 Jan 2021 13:44:00 +0000 (21:44 +0800)]
usb: gaget: ci: set ep's desc when enable ep

As we need standard usb_ep's desc, so set it when enable ep.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: gadget: fastboot: use correct max packet size
Li Jun [Mon, 25 Jan 2021 13:43:59 +0000 (21:43 +0800)]
usb: gadget: fastboot: use correct max packet size

Change to use wMaxPacketSize of current speed EP desc for request
length wrap up.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: udc: ci: update speed handling
Li Jun [Mon, 25 Jan 2021 13:43:58 +0000 (21:43 +0800)]
usb: udc: ci: update speed handling

Remove the gadget driver speed check, and set its max_speed to
be USB_SPEED_HIGH.

Reviewed-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peter Chen <peter.chen@nxp.com>
Tested-by: faqiang.zhu <faqiang.zhu@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: composite: force gadget to be USB2 for HS only function
Li Jun [Mon, 25 Jan 2021 13:43:57 +0000 (21:43 +0800)]
usb: composite: force gadget to be USB2 for HS only function

If one of functions is not super speed capable, we need force the udc
to be high speed, this is an equivalent implementation of
usb_gadget_udc_set_speed() in kernel but simple, which set the gadget
max_speed to be high speed, so afterwards when start gadget duc can
set the HW to be USB 2.0 mode.

Reviewed-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peter Chen <peter.chen@nxp.com>
Tested-by: faqiang.zhu <faqiang.zhu@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: gadget: dnl: set dnl to be super speed
Li Jun [Mon, 25 Jan 2021 13:43:56 +0000 (21:43 +0800)]
usb: gadget: dnl: set dnl to be super speed

Set its max_speed to be super speed.

Reviewed-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peter Chen <peter.chen@nxp.com>
Tested-by: faqiang.zhu <faqiang.zhu@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: fastboot: add super speed support
Li Jun [Mon, 25 Jan 2021 13:43:55 +0000 (21:43 +0800)]
usb: fastboot: add super speed support

Add super speed EP config.

Reviewed-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peter Chen <peter.chen@nxp.com>
Tested-by: faqiang.zhu <faqiang.zhu@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: gadget: add super speed support
Li Jun [Mon, 25 Jan 2021 13:43:54 +0000 (21:43 +0800)]
usb: gadget: add super speed support

This patch is to add usb gadget super speed support in common
driver, including BOS descriptor and select the super speed
descriptor from function driver.

Reviewed-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peter Chen <peter.chen@nxp.com>
Tested-by: faqiang.zhu <faqiang.zhu@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: gadget: update os_desc_config when add config
Jun Li [Mon, 25 Jan 2021 13:43:53 +0000 (21:43 +0800)]
usb: gadget: update os_desc_config when add config

Always use the new added config for os_desc_config to fix cdev->
os_desc_config may miss set in case we restart usb gadget driver.

Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: gadget: set correct usb_configuration for os_desc_config
Jun Li [Mon, 25 Jan 2021 13:43:52 +0000 (21:43 +0800)]
usb: gadget: set correct usb_configuration for os_desc_config

The current way to set cdev->os_desc_config is wrong if user restart
fastboot, as the old config is not used anymore and new allocated
usb_configuration will be used, so set the os_desc_config while
usb_add_config.

Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: gadget: fastboot: add ext properties for WCID
Li Jun [Mon, 25 Jan 2021 13:43:51 +0000 (21:43 +0800)]
usb: gadget: fastboot: add ext properties for WCID

Add device interface GUID for Microsoft Extended Properties Feature
Descriptor.

Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: gadget: add WCID support for mfgtool
Li Jun [Mon, 25 Jan 2021 13:43:50 +0000 (21:43 +0800)]
usb: gadget: add WCID support for mfgtool

Enable WCID(Microsoft Compatible ID Feature Descriptor) for mfgtool.

Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: gadget: OS Feature Descriptors support
Li Jun [Mon, 25 Jan 2021 13:43:49 +0000 (21:43 +0800)]
usb: gadget: OS Feature Descriptors support

This is a proting patch from linux kernel: 37a3a533429e
("usb: gadget: OS Feature Descriptors support"), the original commit
log see below:

There is a custom (non-USB IF) extension to the USB standard:

http://msdn.microsoft.com/library/windows/hardware/gg463182

They grant permission to use the specification - there is
"Microsoft OS Descriptor Specification License Agreement"
under the link mentioned above, and its Section 2 "Grant
of License", letter (b) reads:

"Patent license. Microsoft hereby grants to You a nonexclusive,
royalty-free, nontransferable, worldwide license under Microsoft鈥檚
patents embodied solely within the Specification and that are owned
or licensable by Microsoft to make, use, import, offer to sell,
sell and distribute directly or indirectly to Your Licensees Your
Implementation. You may sublicense this patent license to Your
Licensees under the same terms and conditions."

The said extension is maintained by Microsoft for Microsoft.

Yet it is fairly common for various devices to use it, and a
popular proprietary operating system expects devices to provide
"OS descriptors", so Linux-based USB gadgets whishing to be able
to talk to a variety of operating systems should be able to provide
the "OS descriptors".

This patch adds optional support for gadgets whishing to expose
the so called "OS Feature Descriptors", that is "Extended Compatibility ID"
and "Extended Properties".

Hosts which do request "OS descriptors" from gadgets do so during
the enumeration phase and before the configuration is set with
SET_CONFIGURATION. What is more, those hosts never ask for configurations
at indices other than 0. Therefore, gadgets whishing to provide
"OS descriptors" must designate one configuration to be used with
this kind of hosts - this is what os_desc_config is added for in
struct usb_composite_dev. There is an additional advantage to it:
if a gadget provides "OS descriptors" and designates one configuration
to be used with such non-USB-compliant hosts it can invoke
"usb_add_config" in any order because the designated configuration
will be reported to be at index 0 anyway.

This patch also adds handling vendor-specific requests addressed
at device or interface and related to handling "OS descriptors"."

Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: gadget: add Kconfig for OS descriptors
Peng Fan [Mon, 25 Jan 2021 13:43:48 +0000 (21:43 +0800)]
usb: gadget: add Kconfig for OS descriptors

Add Kconfig for OS descriptors

Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: gadget: move utf8_to_utf16le to header file
Li Jun [Mon, 25 Jan 2021 13:43:47 +0000 (21:43 +0800)]
usb: gadget: move utf8_to_utf16le to header file

As other users may use utf8_to_utf16le() to convert the utf8
to utf16 for usb, so move it to head file.

Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: gadget: OS String support
Li Jun [Mon, 25 Jan 2021 13:43:46 +0000 (21:43 +0800)]
usb: gadget: OS String support

This is a porting patch from linux kernel: 19824d5eeece
("usb: gadget: OS String support"), original commit log
see below:

"There is a custom (non-USB IF) extension to the USB standard:

http://msdn.microsoft.com/library/windows/hardware/gg463182

They grant permission to use the specification - there is
"Microsoft OS Descriptor Specification License Agreement"
under the link mentioned above, and its Section 2 "Grant
of License", letter (b) reads:

"Patent license. Microsoft hereby grants to You a nonexclusive,
royalty-free, nontransferable, worldwide license under Microsoft鈥檚
patents embodied solely within the Specification and that are owned
or licensable by Microsoft to make, use, import, offer to sell,
sell and distribute directly or indirectly to Your Licensees Your
Implementation. You may sublicense this patent license to Your
Licensees under the same terms and conditions."

The said extension is maintained by Microsoft for Microsoft.

Yet it is fairly common for various devices to use it, and a
popular proprietary operating system expects devices to provide
"OS descriptors", so Linux-based USB gadgets whishing to be able
to talk to a variety of operating systems should be able to provide
the "OS descriptors".

This patch adds optional support for gadgets whishing to expose
the so called "OS String" under index 0xEE of language 0.
The contents of the string is generated based on the qw_sign
array and b_vendor_code.

Interested gadgets need to set the cdev->use_os_string flag,
fill cdev->qw_sign with appropriate values and fill cdev->b_vendor_code
with a value of their choice.

This patch does not however implement responding to any vendor-specific
USB requests."

Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: gadget: don't change ep name for dwc3 while ep autoconfig
Li Jun [Mon, 25 Jan 2021 13:43:45 +0000 (21:43 +0800)]
usb: gadget: don't change ep name for dwc3 while ep autoconfig

As the SDP protocol use the predefined ep num for communication, we can't
change its name hence reset its ep num while do ep autoconfig, this is
only apply for SPL.

Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: gadget: Add ep_config call back to usb_gadget_ops
Ye Li [Mon, 25 Jan 2021 13:43:44 +0000 (21:43 +0800)]
usb: gadget: Add ep_config call back to usb_gadget_ops

Since some new fields in usb_ep structure been moved to usb_ss_ep.
The CDNS3 gadget driver should replies on this operation to bind the
usb_ss_ep with the endpoint descriptor when function layer uses
usb_ep_autoconfig to add endpoint descriptors to gadget. So that
CDNS3 driver can know the EP information and configure the EP once
the set configuration request is received.

Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agousb: gadget: Do not export usbd_device_* arrays
Pali Rohár [Sat, 26 Dec 2020 18:12:11 +0000 (19:12 +0100)]
usb: gadget: Do not export usbd_device_* arrays

Each array is used only in one file (core.c or ep0.c). Move their content
to correct file, mark them as static and do not export out of current file.

This change allows to decrease size of u-boot.bin as more of those strings
are not used.

Signed-off-by: Pali Rohár <pali@kernel.org>
3 years agothor: add support for the dfu_alt_info reintialization from the flashed script
Marek Szyprowski [Tue, 22 Dec 2020 10:32:24 +0000 (11:32 +0100)]
thor: add support for the dfu_alt_info reintialization from the flashed script

Reinitialize dfu_env_entities after flashing the 'SCRIPT' entity to
ensure that the potential changes to the 'dfu_alt_info' environment
variable are applied.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
3 years agodfu: add support for the dfu_alt_info reintialization from the flashed script
Marek Szyprowski [Tue, 22 Dec 2020 10:32:23 +0000 (11:32 +0100)]
dfu: add support for the dfu_alt_info reintialization from the flashed script

Reinitialize DFU USB gadget after flashing the 'SCRIPT' entity to ensure
that the potential changes to the 'dfu_alt_info' environment variable are
applied.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
[lukma - I've moved the bool retry to avoid build (CI) errors]

3 years agodfu: add 'SCRIPT' entity
Marek Szyprowski [Tue, 22 Dec 2020 10:32:22 +0000 (11:32 +0100)]
dfu: add 'SCRIPT' entity

Define a new 'SCRIPT' type for DFU entities. The downloaded data are
treated as simple u-boot's scripts and executed with run_command_list()
function.

Flashing the 'SCRIPT' entity might result in changing the 'dfu_alt_info'
environment variable from the flashed script, so add a global variable
for tracking the potential need to reinitialize the dfu_alt_info related
structures.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
3 years agodfu: add 'SKIP' entity
Jaehoon Chung [Tue, 22 Dec 2020 10:32:21 +0000 (11:32 +0100)]
dfu: add 'SKIP' entity

Define a new 'SKIP' type for the DFU entities. The flashed data for that
entity is simply ignored without returning any error values.

This allows to have one flashing procedure and images for the different
board types or variants, where each board uses only the images relevant
to it and skips the rest. This is especially usefull for the THOR
protocol, which usually transfers more than one file in a single session.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Minkyu Kang <mk7.kang@samsung.com>
[mszyprow: rephrased commit message and docs for easier reading, changed
   subject to "dfu: add 'SKIP' entity"]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
3 years agodfu: mmc: use the default MMC device if entity specifies it as -1
Marek Szyprowski [Tue, 22 Dec 2020 10:32:20 +0000 (11:32 +0100)]
dfu: mmc: use the default MMC device if entity specifies it as -1

Use the default MMC device set in the command line if entity specifies it
as -1. This allows to use the same dfu_alt_info string for different MMC
devices (like embedded eMMC and external SD card if data layout is the
same on both devices).

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
3 years agocmd: usb_mass_storage: show device interface name
Marek Szyprowski [Thu, 17 Dec 2020 10:47:11 +0000 (11:47 +0100)]
cmd: usb_mass_storage: show device interface name

Show the interface name (i.e. 'mmc') in the information string to ease
user checking which device is exported via USB Mass Storage protocol.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
3 years agof_fastboot: Avoid use-after-free in the global pointer variable
Andy Shevchenko [Thu, 3 Dec 2020 15:32:05 +0000 (17:32 +0200)]
f_fastboot: Avoid use-after-free in the global pointer variable

In case of usb_add_function() failure the error path has an issue,
i.e the global pointer variable is assigned to garbage

Fix the above mentioned issue by assigning pointer to NULL.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
3 years agof_rockusb: Avoid use-after-free in the global pointer variable
Andy Shevchenko [Thu, 3 Dec 2020 15:32:04 +0000 (17:32 +0200)]
f_rockusb: Avoid use-after-free in the global pointer variable

In case of usb_add_function() failure the error path has two issues:
 - the potentially allocated structure isn't getting freed
 - the global pointer variable is assigned to garbage

Fix the above mentioned issues by freeing memory and assigning NULL.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
3 years agof_rockusb: Use NULL instead of 0 for pointers
Andy Shevchenko [Thu, 3 Dec 2020 15:32:03 +0000 (17:32 +0200)]
f_rockusb: Use NULL instead of 0 for pointers

get_rkusb() mistakenly uses integers without cast.
Convert them to proper type.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
3 years agocmd: bcb: Add support for processing const string literals in bcb_set()
Eugeniu Rosca [Fri, 23 Oct 2020 08:52:23 +0000 (11:52 +0300)]
cmd: bcb: Add support for processing const string literals in bcb_set()

On request/suggestion from Simon Glass back in May 22 2019 [1], the
'strsep' mechanism implemented in bcb_set() was set to work directly
with user-provided argv strings, to avoid duplicating memory and for
the sake of simpler implementation.

However, since we recently exposed bcb_write_reboot_reason() API to be
called by U-Boot fastboot, the idea is to be able to pass const string
literals to this new BCB API, carrying the reboot reason.

Since 'strsep' (just like its older/superseded sibling 'strtok')
modifies the input string passed as parameter, BCB command in its
current state would attempt to perform in-place modifications in a
readonly string, which might lead to unexpected results.

Fix the above with the cost of one dynamic memory allocation ('strdup').
This will also ensure no compiler warnings when passing string literals
to bcb_write_reboot_reason().

[1] http://u-boot.10912.n7.nabble.com/PATCH-v2-0-2-Add-bcb-command-to-read-modify-write-Android-BCB-td369934i20.html#a370456

Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Signed-off-by: Roman Kovalivskyi <roman.kovalivskyi@globallogic.com>
3 years agocmd: bcb: Expose 'bcb_write_reboot_reason' to external callers
Eugeniu Rosca [Fri, 23 Oct 2020 08:52:22 +0000 (11:52 +0300)]
cmd: bcb: Expose 'bcb_write_reboot_reason' to external callers

Fastboot is evolving and beginning with commit [1], the
upstream implementation expects bootloaders to offer support for:
 - reboot-recovery
 - reboot-fastboot

The most natural way to achieve the above is through a set of
pre-defined "reboot reason" strings, written into / read from
the BCB "command" field, e.g.:
 - bootonce-bootloader [2]
 - boot-fastboot [3]
 - boot-recovery [4]

Expose the first 'bcb' API meant to be called by e.g. fastboot stack,
to allow updating the BCB reboot reason via the BCB 'command' field.

[1] https://android.googlesource.com/platform/system/core/+/dea91b4b5354af2
    ("Add fastbootd.")
[2] https://android.googlesource.com/platform/bootable/recovery/+/cba7fa88d8b9
    ("Add 'reboot bootloader' to bootloader_message.")
[3] https://android.googlesource.com/platform/bootable/recovery/+/eee4e260f9f6
    ("recovery: Add "boot-fastboot" command to BCB.")
[4] https://android.googlesource.com/platform/system/core/+/5e98b633a748695f
    ("init: Write the reason in BCB on "reboot recovery"")

Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Signed-off-by: Roman Kovalivskyi <roman.kovalivskyi@globallogic.com>
[lukma - added missing #include <linux/errno.h> to avoid build breaks]

3 years agocmd: bcb: Extract '__bcb_store' from 'do_bcb_store' for internal needs
Eugeniu Rosca [Fri, 23 Oct 2020 08:52:21 +0000 (11:52 +0300)]
cmd: bcb: Extract '__bcb_store' from 'do_bcb_store' for internal needs

Enriching the functionality of U-Boot 'bcb' may assume using the
existing sub-commands as building blocks for the next ones.

A clean way to achive the above is to expose a number of static
routines, each mapped to an existing user command (e.g. load/set/store),
with a user/caller-friendly prototype (i.e. do not force the caller
to wrap an integer into a string).

This third patch makes '__bcb_store' available for internal needs.

No functional change intended.

Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Signed-off-by: Roman Kovalivskyi <roman.kovalivskyi@globallogic.com>
3 years agocmd: bcb: Extract '__bcb_set' from 'do_bcb_set' for internal needs
Eugeniu Rosca [Fri, 23 Oct 2020 08:52:20 +0000 (11:52 +0300)]
cmd: bcb: Extract '__bcb_set' from 'do_bcb_set' for internal needs

Enriching the functionality of U-Boot 'bcb' may assume using the
existing sub-commands as building blocks for the next ones.

A clean way to achive the above is to expose a number of static
routines, each mapped to an existing user command (e.g. load/set/store),
with a user/caller-friendly prototype (i.e. do not force the caller
to wrap an integer into a string).

This second patch makes '__bcb_set' available for internal needs.

No functional change intended.

Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Signed-off-by: Roman Kovalivskyi <roman.kovalivskyi@globallogic.com>
3 years agocmd: bcb: Extract '__bcb_load' from 'do_bcb_load' for internal needs
Eugeniu Rosca [Fri, 23 Oct 2020 08:52:19 +0000 (11:52 +0300)]
cmd: bcb: Extract '__bcb_load' from 'do_bcb_load' for internal needs

Enriching the functionality of U-Boot 'bcb' may assume using the
existing sub-commands as building blocks for the next ones.

A clean way to achive the above is to expose a number of static
routines, each mapped to an existing user command (e.g. load/set/store),
with a user/caller-friendly prototype (i.e. do not force the caller
to wrap an integer into a string).

This first patch makes '__bcb_load' available for internal needs.

No functional change, except for a tiny update in error handling.

Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Signed-off-by: Roman Kovalivskyi <roman.kovalivskyi@globallogic.com>
3 years agogadget: f_thor: fix wrong file size cast
Seung-Woo Kim [Fri, 16 Oct 2020 07:29:02 +0000 (16:29 +0900)]
gadget: f_thor: fix wrong file size cast

Casting 32bit int value directly into 64bit unsigned type causes
wrong value for file size equal or larger than 2GB. Fix the wrong
file size by casting uint32_t first.

Fixes: commit 1fe9ae76b113 ("gadget: f_thor: update to support more than 4GB file as thor 5.0")
Reported-by: Junghoon Kim <jhoon20.kim@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agodfu: Fix handling of UBI partitions in MTD backend
Guillermo Rodriguez [Wed, 2 Sep 2020 11:06:06 +0000 (13:06 +0200)]
dfu: Fix handling of UBI partitions in MTD backend

For UBI partitions ("partubi" in dfu_alt_info), dfu_fill_entity_mtd sets
the mtd.ubi flag; however other functions incorrectly check for nand.ubi
instead. Fix this by checking for the correct flag.

Signed-off-by: Guillermo Rodriguez <guille.rodriguez@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
3 years agommc: tmio: sdhi: Configure internal DMA bus width
Marek Vasut [Sun, 3 Jan 2021 10:38:25 +0000 (11:38 +0100)]
mmc: tmio: sdhi: Configure internal DMA bus width

The R-Car3 SDHI should set these two bits in DMA_MODE register according
to the specification, to indicate 64bit bus width. No other bus width
options are permitted and the default value is 0, which is incorrect.
Set the bits accordingly.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
3 years agoarm: dts: rmobile: r8a774a1: Synchronize DTs with Linux 5.10
Biju Das [Sun, 17 Jan 2021 16:30:11 +0000 (16:30 +0000)]
arm: dts: rmobile: r8a774a1: Synchronize DTs with Linux 5.10

DTS files apart from r8a774a1-hihope-rzg2m-u-boot.dts and
r8a774a1-u-boot.dtsi have been imported from linux 5.10
commit 2c85ebc57b3e1817 ("Linux 5.10").

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
3 years agodisk: part: sandbox support in dev_print()
Heinrich Schuchardt [Mon, 25 Jan 2021 11:57:15 +0000 (12:57 +0100)]
disk: part: sandbox support in dev_print()

Commands like 'fatinfo' call dev_print() to print device information. If
the block device is created via 'host bind', we should print accurate
information.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agosandbox: fill block device meta information
Heinrich Schuchardt [Mon, 25 Jan 2021 11:57:14 +0000 (12:57 +0100)]
sandbox: fill block device meta information

Provide information about host backed block device.

Mark the device created by 'host bind' as removable.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agodm: replace auto_alloc_size with auto
Dario Binacchi [Sat, 23 Jan 2021 18:48:57 +0000 (19:48 +0100)]
dm: replace auto_alloc_size with auto

The auto_alloc_size members of struct driver has been renamed auto.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agodo not pass NULL pointer to libfdt
Stanislav Pinchuk [Wed, 20 Jan 2021 18:52:23 +0000 (21:52 +0300)]
do not pass NULL pointer to libfdt

Re-send because of line-wraps.

Without this patch, u-boot just hangs if the fdt pointer is
not initialized. The diagnostic subsystems are not yet initialized,
so all you get is a blind hang.

Signed-off-by: Stanislav.Pinchuk@kaspersky.com
3 years agosandbox: keep time offset when resetting
Heinrich Schuchardt [Wed, 30 Dec 2020 17:07:48 +0000 (18:07 +0100)]
sandbox: keep time offset when resetting

The UEFI Self Certification Test (SCT) checks the SetTime() service with
the following steps:

* set date
* reset
* check date matches

To be compliant the sandbox should keep the offset to the host RTC during
resets. The implementation uses the environment variable
UBOOT_SB_TIME_OFFSET to persist the offset.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agobinman: Print a debug message when binman selects a node
Simon Glass [Thu, 21 Jan 2021 20:57:16 +0000 (13:57 -0700)]
binman: Print a debug message when binman selects a node

Add some debugging to indicate which node the binman library is looking
at.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoAdd a symlink for ctype.h
Simon Glass [Thu, 21 Jan 2021 20:57:15 +0000 (13:57 -0700)]
Add a symlink for ctype.h

Libraries that link with U-Boot typically may expect to be able to include
ctype.h but this file is in a different place in U-Boot. Add a symlink to
make this work.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Update ofnode_read_fmap_entry() to read hashes
Simon Glass [Thu, 21 Jan 2021 20:57:14 +0000 (13:57 -0700)]
dm: core: Update ofnode_read_fmap_entry() to read hashes

At present this function uses the old format for reading hashes. Add
support for the current format.

Add a test while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Add a comment about pinctrl_select_state()
Simon Glass [Thu, 21 Jan 2021 20:57:13 +0000 (13:57 -0700)]
dm: core: Add a comment about pinctrl_select_state()

The use of pinctrl in the core of driver model is useful but can provoke
some strange behaviour. Add a comment to aid debugging.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoclk: x86: Correct the driver name
Simon Glass [Thu, 21 Jan 2021 20:57:12 +0000 (13:57 -0700)]
clk: x86: Correct the driver name

The current driver name does not match its compatible string, so
of-platdata does not work correctly. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoclk: Add debugging for return values
Simon Glass [Thu, 21 Jan 2021 20:57:11 +0000 (13:57 -0700)]
clk: Add debugging for return values

Use the log_msg_ret() mechanism to get error-return information when
clocks fail to probe, etc.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodm: core: Don't inline dev_read...() calls with of-platdata
Simon Glass [Thu, 21 Jan 2021 20:57:10 +0000 (13:57 -0700)]
dm: core: Don't inline dev_read...() calls with of-platdata

At present if these calls are used with of-platdata, a confusing error is
produced, referring to a function not actually called by the code causing
the problem.

Fix this by not inlining, so that the error mentions the dev_read_...()
function and it is more obvious what is going on.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agosandbox: Disable I2C emulators in SPL
Simon Glass [Thu, 21 Jan 2021 20:57:09 +0000 (13:57 -0700)]
sandbox: Disable I2C emulators in SPL

These cannot work with of-platdata since they currently need the
devicetree at runtime. Disable the emulators and the sandbox I2C driver
that needs them. We can enable these later, if needed for testing.

Switch the of_plat_parent test over to use a simple bus instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
3 years agoi2c: desigware: Add an alias for Intel Apollo Lake
Simon Glass [Thu, 21 Jan 2021 20:57:08 +0000 (13:57 -0700)]
i2c: desigware: Add an alias for Intel Apollo Lake

Add an alias so that this driver can be used in TPL on coral.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
3 years agox86: coral: Support TPM and RTC in SPL
Simon Glass [Thu, 21 Jan 2021 20:57:07 +0000 (13:57 -0700)]
x86: coral: Support TPM and RTC in SPL

Update the devicetree so that the TPM and RTC can be used in SPL. Also
enable the pins used for getting the memory configuration settings while
we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agospl: Tidy up SPL/TPL malloc sizes
Simon Glass [Thu, 21 Jan 2021 20:57:06 +0000 (13:57 -0700)]
spl: Tidy up SPL/TPL malloc sizes

The current help talks about relocation which doesn't apply to SPL and
TPL. Update it to avoid confusion.

Also make the TPL size default to the same as the SPL size, since this is
more likely to be a useful value than the one used by U-Boot proper, which
may be quite a bit larger.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agocros_ec: Add vstore support
Simon Glass [Sat, 16 Jan 2021 21:52:31 +0000 (14:52 -0700)]
cros_ec: Add vstore support

The EC can store small amounts of data for the benefit of the
verified boot process. Since the EC is seldom reset, this can allow the
AP to store data that survives a reboot or a suspend/resume cycle.

Add support for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agocros_ec: Allow use with of-platdata
Simon Glass [Sat, 16 Jan 2021 21:52:30 +0000 (14:52 -0700)]
cros_ec: Allow use with of-platdata

Avoid reading the device tree when of-platdata is in use.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agocros_ec: Show events in human-readable form
Simon Glass [Sat, 16 Jan 2021 21:52:29 +0000 (14:52 -0700)]
cros_ec: Show events in human-readable form

Add a command to show the current events as a list of names. This is
easier to decipher than a bit mask.

Signed-off-by: Simon Glass <sjg@chromium.org>