platform/kernel/u-boot.git
3 years agoIPQ40xx: clk: use dev_read_addr()
Robert Marko [Wed, 28 Oct 2020 12:56:23 +0000 (13:56 +0100)]
IPQ40xx: clk: use dev_read_addr()

Lets convert the driver to use dev_read_addr() instead of the devfdt_get_addr().

While we are here, lets also alphabetise the includes.

Signed-off-by: Robert Marko <robert.marko@sartura.hr>
Cc: Luka Perkov <luka.perkov@sartura.hr>
3 years agocmd: Kconfig: migrate CONFIG_SYS_PROMPT_HUSH_PS2
Patrick Delaunay [Mon, 26 Oct 2020 08:31:42 +0000 (09:31 +0100)]
cmd: Kconfig: migrate CONFIG_SYS_PROMPT_HUSH_PS2

Move CONFIG_SYS_PROMPT_HUSH_PS2 in Kconfig, depending
on CONFIG_HUSH_PARSER, and remove the default value defined
in cli_hush.c under __U_BOOT__.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agohush: Remove default CONFIG_SYS_PROMPT_HUSH_PS2 setting from board files
Patrick Delaunay [Mon, 26 Oct 2020 08:31:41 +0000 (09:31 +0100)]
hush: Remove default CONFIG_SYS_PROMPT_HUSH_PS2 setting from board files

There is no reason to define default option for this macro which is
already done in common/cli_hush.c.

  87 #ifndef CONFIG_SYS_PROMPT_HUSH_PS2
  88 #define CONFIG_SYS_PROMPT_HUSH_PS2      "> "
  89 #endif

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
3 years agonet: sntp: remove CONFIG_TIMESTAMP constraint
Heinrich Schuchardt [Fri, 23 Oct 2020 10:58:27 +0000 (12:58 +0200)]
net: sntp: remove CONFIG_TIMESTAMP constraint

CONFIG_TIMESTAMP is not related to the RTC drivers. It does not make any
sense to let the updating of the RTC by the sntp command depend on it.

Drop the CONFIG_TIMESTAMP checks.

Furthermore function dm_rtc_set() is enabled by CONFIG_DM_RTC. There is no
reason to require CONFIG_CMD_DATE when using a driver model RTC. The UEFI
sub-system can consume the RTC functions even if there is not date command.

Only check CONFIG_CMD_DATE when using a non-driver model RTC.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agosetexpr: Add support for strings
Simon Glass [Sun, 1 Nov 2020 21:15:44 +0000 (14:15 -0700)]
setexpr: Add support for strings

Add support for dealing with string operands, including reading a string
from memory into an environment variable and concatenating two strings.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Marek Behún <marek.behun@nic.cz>
3 years agosetexpr: Convert to use a struct for values
Simon Glass [Sun, 1 Nov 2020 21:15:43 +0000 (14:15 -0700)]
setexpr: Convert to use a struct for values

At present a ulong is used to hold operand values. This means that
strings cannot be used. While most operations are not useful for strings,
concatenation is. As a starting point to supporting strings, convert the
code to use a struct instead of a ulong for operands.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agosetexpr: Correct buffer overflow bug and enable tests
Simon Glass [Sun, 1 Nov 2020 21:15:42 +0000 (14:15 -0700)]
setexpr: Correct buffer overflow bug and enable tests

At present when more than one substitution is made this function
overwrites its buffers. Fix this bug and update the tests now that they
can pass.

Also update the debug code to show all substrings, since at present it
omits the final one.

Fixes: 855f18ea0e6 ("setexpr: add regex substring matching and substitution")
Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agosetexpr: Correct dropping of final unmatched string
Simon Glass [Sun, 1 Nov 2020 21:15:41 +0000 (14:15 -0700)]
setexpr: Correct dropping of final unmatched string

At present the 'nlen' variable increases with each loop. If the previous
loop had back references, then subsequent loops without back references
use the wrong value of nlen. The value is larger, meaning that the string
terminator from nbuf is copied along to the main buffer, thus terminating
the string prematurely.

This leads to the final result being truncated, e.g. missing the last
(unmatched) part of the string. So "match match tail" become
"replaced replaced" instead of "replaced replaced tail".

Fix this by resetting nlen to the correct value each time around the lop.

Fixes: 855f18ea0e6 ("setexpr: add regex substring matching and substitution")
Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agosetexpr: Add some tests for buffer overflow and backref
Simon Glass [Sun, 1 Nov 2020 21:15:40 +0000 (14:15 -0700)]
setexpr: Add some tests for buffer overflow and backref

Add tests to check for buffer overflow using simple replacement as well
as back references. At present these don't fully pass.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agosetexpr: Split the core logic into its own function
Simon Glass [Sun, 1 Nov 2020 21:15:39 +0000 (14:15 -0700)]
setexpr: Split the core logic into its own function

At present this function always allocates a large amount of stack, and
selects its own size for buffers. This makes it hard to test the code
for buffer overflow.

Separate out the inner logic of the substitution so that tests can call
this directly. This will allow checking that the algorithm does not
overflow the buffer.

Fix up one of the error lines at the same time, since it should be
printing nbuf_size, not data_size.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agotest: Add some setexpr regex tests
Simon Glass [Sun, 1 Nov 2020 21:15:38 +0000 (14:15 -0700)]
test: Add some setexpr regex tests

Add tests for the setexpr regex commands.

Note that these tests currently crash on sandbox due to an existing bug in
the setexpr implementation, so two of the tests are commented out.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agosetexpr: Add explicit support for 32- and 64-bit ints
Simon Glass [Sun, 1 Nov 2020 21:15:37 +0000 (14:15 -0700)]
setexpr: Add explicit support for 32- and 64-bit ints

At present this function assumes that a size of 4 refers to a ulong. This
is true on 32-bit machines but not commonly on 64-bit machines.

This means that the 'l' specify does not work correctly with setexpr.

Add an explicit case for 32-bit values so that 64-bit machines can still
use the 'l' specifier. On 32-bit machines, 64-bit is still not supported.

This corrects the operation of the default size (which is 4 for setexpr),
so update the tests accordingly.

The original code for reading from memory was included in 47ab5ad1457
("cmd_setexpr: allow memory addresses in expressions") but I am not adding
a Fixes: tag since that code was not written with 64-bit machines in mind.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agocommand: Add constants for cmd_get_data_size string / error
Simon Glass [Sun, 1 Nov 2020 21:15:36 +0000 (14:15 -0700)]
command: Add constants for cmd_get_data_size string / error

At present these values are open-coded in a few places. Add constants so
the meaning is clear.

Also add a comment to cmd_get_data_size()

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agotest: Add some tests for setexpr
Simon Glass [Sun, 1 Nov 2020 21:15:35 +0000 (14:15 -0700)]
test: Add some tests for setexpr

This command currently has no tests. Add some for basic assignment and the
integer operations.

Note that the default size for setexpr is ulong, which varies depending on
the build machine. So for sandbox on a 64-bit host, this means that the
default size is 64 bits.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoMakefile: Correctly propagate failure when removing target
Pali Rohár [Mon, 26 Oct 2020 13:10:49 +0000 (14:10 +0100)]
Makefile: Correctly propagate failure when removing target

On more places is used pattern 'command > $@ || rm -f $@'. But it does not
propagate failure from 'command' as 'rm -f' returns success.

Fix it by calling 'false' to correctly propagate failure after 'rm -f'.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agogpio: Convert to use APIs which support live DT
Patrick Delaunay [Wed, 9 Sep 2020 16:26:16 +0000 (18:26 +0200)]
gpio: Convert to use APIs which support live DT

Use ofnode_ or dev_ APIs instead of fdt_ and fdtdec_ APIs so that the
driver can support live DT.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
3 years agoAdds basic support for ProxyDHCP
Lyle Franklin [Mon, 5 Aug 2019 10:23:42 +0000 (06:23 -0400)]
Adds basic support for ProxyDHCP

- ProxyDHCP allows a second DHCP server to exist alongside your main
  DHCP server and supply additional BOOTP related options
- When u-boot sends out a DHCP request, the real DHCP server will
  respond with a normal response containing the new client IP address
  while simultaneously the ProxyDHCP server will respond with a blank
  client IP address and a `bootfile` option
- This patch adds CONFIG_SERVERIP_FROM_PROXYDHCP (default false) to
  enable this behavior and CONFIG_SERVERIP_FROM_PROXYDHCP_DELAY_MS
  (default 100) which tells u-boot to wait additional time after
  receiving the main DHCP response to give the ProxyDHCP response time
  to arrive
- The PXE spec for ProxyDHCP is more complicated than the solution
  added here as diagramed on page 16:
  http://www.pix.net/software/pxeboot/archive/pxespec.pdf:

```
DHCP Discover will be retried four times. The four timeouts are 4, 8, 16
and 32 seconds respectively. If a DHCPOFFER is received without an Option
timeouts in an attempt to receive a PXE response.
```

- Adding a simple delay worked for my purposes but let me know if a
  more robust solution is required

Signed-off-by: Lyle Franklin <lylejfranklin@gmail.com>
3 years agocmd: pxe: Use internal FDT if retrieving from FDTDIR fails
Anton Leontiev [Tue, 3 Sep 2019 07:52:24 +0000 (10:52 +0300)]
cmd: pxe: Use internal FDT if retrieving from FDTDIR fails

As FDTDIR label doesn't specify exact file to be loaded, it should
not fail if no file exists in the directory. In this case try to boot
with internal FDT if it exists.

Signed-off-by: Anton Leontiev <aleontiev@elvees.com>
3 years agoPrepare v2021.01-rc3
Tom Rini [Mon, 30 Nov 2020 18:09:42 +0000 (13:09 -0500)]
Prepare v2021.01-rc3

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoconfigs: Resync with savedefconfig
Tom Rini [Mon, 30 Nov 2020 17:50:32 +0000 (12:50 -0500)]
configs: Resync with savedefconfig

Rsync all defconfig files using moveconfig.py

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoMerge tag 'mmc-2020-11-29' of https://gitlab.denx.de/u-boot/custodians/u-boot-mmc
Tom Rini [Sun, 29 Nov 2020 16:12:59 +0000 (11:12 -0500)]
Merge tag 'mmc-2020-11-29' of https://gitlab.denx.de/u-boot/custodians/u-boot-mmc

- mmc minor update for better debug and error check
- fsl_esdhc sysctl set and make sure delay check for HS400

3 years agoMerge tag 'efi-2021-01-rc3-3' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Sun, 29 Nov 2020 16:12:49 +0000 (11:12 -0500)]
Merge tag 'efi-2021-01-rc3-3' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi

Pull request for UEFI sub-system for efi-2021-01-rc3 (3)

The following errors are corrected:

* Linux crash when accessing UEFI variables at runtime.
* UEFI variable using standalone MM on 32 bit systems
  not working due to missing packing of communication
  structure
* NULL dereference when FAT16 root directory is full
* FAT files with a short file name starting with 0xE5 (0x05 in directory
  entry) where treated as deleted.

The UEFI SetTime() service is enabled on ARM QEMU.

3 years agocharset: make u16_strnlen accessible at runtime
Ilias Apalodimas [Sun, 22 Nov 2020 13:10:26 +0000 (15:10 +0200)]
charset: make u16_strnlen accessible at runtime

commit 1fabfeef506c ("efi_loader: parameter check in GetNextVariableName()")
introduces a check using u16_strnlen(). This code is used on EFI
runtime variables as well, so unless we mark it as runtime, the kernel
will crash trying to access it.

Fixes: 1fabfeef506c ("efi_loader: parameter check in GetNextVariableName()")
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agolib/efi_loader: fix ABI in efi_mm_communicate_header
Etienne Carriere [Sat, 21 Nov 2020 10:59:33 +0000 (11:59 +0100)]
lib/efi_loader: fix ABI in efi_mm_communicate_header

Pack struct efi_mm_communicate_header as done in EDK2 as seen in
release 201808 [1]. If not packed sizeof() for the structure adds
4 additional bytes on 32bit targets which breaks the ABI.

Link: [1] https://github.com/tianocore/edk2/blob/edk2-stable201808/MdePkg/Include/Protocol/MmCommunication.h#L21
Fixes: 23a397d2e2fb ("efi_loader: Add headers for EDK2 StandAloneMM communication")
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
3 years agoefi_loader: enable EFI_SET_TIME on sandbox and QEMU ARM
Heinrich Schuchardt [Sat, 21 Nov 2020 19:52:18 +0000 (20:52 +0100)]
efi_loader: enable EFI_SET_TIME on sandbox and QEMU ARM

Enable EFI_SET_TIME on the sandbox and QEMU ARM to ensure that we compile
and test the relevant code.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agofs: fat: use ATTR_ARCH instead of anonymous 0x20
Heinrich Schuchardt [Sun, 22 Nov 2020 10:13:33 +0000 (11:13 +0100)]
fs: fat: use ATTR_ARCH instead of anonymous 0x20

Using constants instead of anonymous numbers increases code readability.

Fixes: 704df6aa0a28 ("fs: fat: refactor write interface for a file offset")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agofs: fat: directory entries starting with 0x05
Heinrich Schuchardt [Sat, 21 Nov 2020 11:34:20 +0000 (12:34 +0100)]
fs: fat: directory entries starting with 0x05

0x05 is used as replacement letter for 0xe5 at the first position of short
file names. We must not skip over directory entries starting with 0x05.

Cf. Microsoft FAT Specification, August 30 2005

Fixes: 39606d462c97 ("fs: fat: handle deleted directory entries correctly")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agofs: fat: avoid NULL dereference when root dir is full
Heinrich Schuchardt [Thu, 19 Nov 2020 11:24:44 +0000 (12:24 +0100)]
fs: fat: avoid NULL dereference when root dir is full

When trying to create a file in the full root directory of a FAT32
filesystem a NULL dereference can be observed.

When the root directory of a FAT16 filesystem is full fill_dir_slot() must
return -1 to signal that a new directory entry could not be allocated.

Fixes: cd2d727fff7e ("fs: fat: allocate a new cluster for root directory of fat32")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-i2c
Tom Rini [Sat, 28 Nov 2020 15:55:46 +0000 (10:55 -0500)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-i2c

3 years agoriscv: sifive/fu540: kconfig: Enable support for Opencores I2C controller
Pragnesh Patel [Sat, 14 Nov 2020 09:12:35 +0000 (14:42 +0530)]
riscv: sifive/fu540: kconfig: Enable support for Opencores I2C controller

Enable support for SiFive FU540 Opencores I2C master controller.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Rick Chen <rick@andestech.com>
3 years agoi2c: ocores: add i2c driver for OpenCores I2C controller
Pragnesh Patel [Sat, 14 Nov 2020 09:12:34 +0000 (14:42 +0530)]
i2c: ocores: add i2c driver for OpenCores I2C controller

Add support for the OpenCores I2C controller IP core
(See http://www.opencores.org/projects.cgi/web/i2c/overview).

This driver implementation is inspired from the Linux OpenCores
I2C driver available.

Thanks to Peter Korsgaard <peter@korsgaard.com> for writing Linux
OpenCores I2C driver.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Rick Chen <rick@andestech.com>
3 years agoi2c: designware_i2c: Don't warn if no reset controller
Simon Glass [Mon, 9 Nov 2020 14:12:49 +0000 (07:12 -0700)]
i2c: designware_i2c: Don't warn if no reset controller

At present if CONFIG_RESET is not enabled, this code shows a warning:

  designware_i2c_ofdata_to_platdata() i2c_designware_pci i2c2@16,0:
Can't get reset: -524

Avoid this by checking if reset is supported, first.

Fixes: 622597dee4f ("i2c: designware: add reset ctrl to driver")
Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoi2c: mvtwsi: disable i2c slave also on Armada 8k
Baruch Siach [Thu, 1 Oct 2020 11:49:02 +0000 (14:49 +0300)]
i2c: mvtwsi: disable i2c slave also on Armada 8k

The hidden I2C slave is also present on the Armada 8k AP806. Testing
shows that this I2C slave causes the same issues as Armada 38x.
Disabling that I2C slave fixes all these issues.

I2C blocks on the Armada 8k CP110 are not affected.

Extend the I2C slave disable to Armada 8k as well.

Cc: Stefan Roese <sr@denx.de>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
3 years agommc: check a return value about regulator's always-on
Jaehoon Chung [Fri, 6 Nov 2020 11:30:41 +0000 (20:30 +0900)]
mmc: check a return value about regulator's always-on

Regulator can be set to "always-on".
It's not error about enable/disable. It needs to check about
its condition.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
3 years agommc: display an error number to debug
Jaehoon Chung [Mon, 16 Nov 2020 22:04:59 +0000 (07:04 +0900)]
mmc: display an error number to debug

It's useful to know an error number when it's debugging.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
3 years agommc: fsl_esdhc: make sure delay chain locked for HS400
Yangbo Lu [Tue, 20 Oct 2020 03:04:52 +0000 (11:04 +0800)]
mmc: fsl_esdhc: make sure delay chain locked for HS400

For eMMC HS400 mode, the DLL reset is a required step for mmc rescan.
This step has not been documented in reference manual, but the RM will
be fixed sooner or later.

In previous commit to support eMMC HS400,
  db8f936 mmc: fsl_esdhc: support eMMC HS400 mode

the steps to configure DLL could be found in commit message,
  13. Set DLLCFG0[DLL_ENABLE] and DLLCFG0[DLL_FREQ_SEL].
  14. Wait for delay chain to lock.

these would be fixed as,
  13.   Set DLLCFG0[DLL_ENABLE] and DLLCFG0[DLL_FREQ_SEL].
  13.1  Write DLLCFG0[DLL_RESET] to 1 and wait for 1us,
        then write DLLCFG0[DLL_RESET]
  14.   Wait for delay chain to lock.

This patch is to add the step of DLL reset, and make sure delay chain
locked for HS400.

Fixes: db8f93672b42 ("mmc: fsl_esdhc: support eMMC HS400 mode")
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agommc: fsl_esdhc: set sysctl register for clock initialization
Yangbo Lu [Tue, 20 Oct 2020 03:04:51 +0000 (11:04 +0800)]
mmc: fsl_esdhc: set sysctl register for clock initialization

The initial clock setting should be through sysctl register only,
while the mmc_set_clock() will call mmc_set_ios() introduce other
configurations like bus width, mode, and so on.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agommc: Add some helper functions for retrying on error
Sean Anderson [Sat, 17 Oct 2020 12:36:27 +0000 (08:36 -0400)]
mmc: Add some helper functions for retrying on error

All of the existing quirks add retries to various calls of mmc_send_cmd.
mmc_send_cmd_quirks is a helper function to do this retrying behavior. It
checks if quirks mode is enabled, and if a specific quirk is activated it
retries on error.

This also adds mmc_send_cmd_retry, which retries on error every time
(instead of if a quirk is activated).

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agoMerge tag 'u-boot-stm32-20201125' of https://gitlab.denx.de/u-boot/custodians/u-boot-stm
Tom Rini [Wed, 25 Nov 2020 16:00:52 +0000 (11:00 -0500)]
Merge tag 'u-boot-stm32-20201125' of https://gitlab.denx.de/u-boot/custodians/u-boot-stm

- STM32 MCU's DT update
- Add DHCOM based STM32MP15x PicoITX board
- Correct ALIGN macro usage for on syram for SPL dcache support
- Fixes on DHCOM: uSD card-detect GPIO and Drop QSPI CS2
- Fix compilation issue for spl_mmc_boot_partition
- Fix MTD partitions for serial boot
- Add support of MCU HOLD BOOT with reset for stm32 remoteproc
  (prepare alligneent with  kernel DT)
- Correct bias information and support in STM32 soc and STMFX
- Support optional vbus in usbphyc
- Update FIT examples to avoid kernel zImage relocation before decompression

3 years agoboard: st: stm32mp1: update load address for FIT examples
Patrick Delaunay [Wed, 25 Nov 2020 11:28:10 +0000 (12:28 +0100)]
board: st: stm32mp1: update load address for FIT examples

Update kernel load address for FIT examples to avoid relocation:
- Kernel example uses Image.gz with U-Boot gzip decompression
  at final kernel location 0x0xC0008000.
- Copro example loads zImage at a correct location (0xC4000000),
  to avoid zImage relocation before decompression by kernel code.

An other solution to avoid zImage relocation is to align
the kernel load and entry address with the real location in FIT
(the relocation of zImage is skipped in U-Boot bootm command for
identical address) but it is less flexible because this offset
depends on FIT content:

For example:

## Loading kernel from FIT Image at c2000000 ...
   Using 'ev1' configuration
   Trying 'kernel' kernel subimage
     Description:  Linux kernel
     Created:      2020-10-22   9:08:32 UTC
     Type:         Kernel Image
     Compression:  uncompressed
     Data Start:   0xc20000cc

The kernel offset in FIT is 0xCC in FIT and zImage is decompressed at
0xC0008000 by kernel code:

kernel {
description = "Linux kernel";
data = /incbin/("zImage");
type = "kernel";
arch = "arm";
os = "linux";
compression = "none";
load = <0xC20000cc>;
entry = <0xC20000cc>;
hash-1 {
algo = "sha1";
};
};

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agophy: stm32: usbphyc: manage optional vbus regulator on phy_power_on/off
Patrick Delaunay [Thu, 15 Oct 2020 12:50:57 +0000 (14:50 +0200)]
phy: stm32: usbphyc: manage optional vbus regulator on phy_power_on/off

This patch adds support for optional vbus regulator.
It is managed on phy_power_on/off calls and may be needed for host mode.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agopinctrl: stmfx: update pin name
Patrick Delaunay [Wed, 28 Oct 2020 09:51:57 +0000 (10:51 +0100)]
pinctrl: stmfx: update pin name

Update pin name to avoid duplicated name with SOC GPIO
gpio0...gpio15 / agpio0....agpio7: add a stmfx prefix.

This pin name can be used in pinmux command.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agopinctrl: stmfx: update pincontrol and gpio device name
Patrick Delaunay [Wed, 28 Oct 2020 09:51:56 +0000 (10:51 +0100)]
pinctrl: stmfx: update pincontrol and gpio device name

The device name is used in pinmux command and in log trace
so it is better to use the parent parent name ("stmfx@42" for
example) than a generic name ("pinctrl" or "stmfx-gpio")
to identify the device instance.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agogpio: stm32: correct the bias management
Patrick Delaunay [Wed, 28 Oct 2020 09:49:08 +0000 (10:49 +0100)]
gpio: stm32: correct the bias management

Use the bias configuration for all the GPIO configurations and not
only for input GPIO, as indicated in Reference manual
(Table 81. Port bit configuration table).

Fixes: 43efbb6a3ebf0223f9eab8d45916f602d876319f ("gpio: stm32: add ops get_dir_flags")
Fixes: f13ff88b61c32ac8f0e9068c41328b265ef619eb ("gpio: stm32: add ops set_dir_flags")
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agopinctrl: stm32: display bias information for all pins
Patrick Delaunay [Wed, 28 Oct 2020 09:49:07 +0000 (10:49 +0100)]
pinctrl: stm32: display bias information for all pins

Display the bias information for input gpios or AF configuration,
and not only for output pin, as described in Reference manual
(Table 81. Port bit configuration table).

Fixes: da7a0bb1f279 ("pinctrl: stm32: add information on pin configuration")
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agoremoteproc: stm32: update error management in stm32_copro_start
Patrick Delaunay [Thu, 15 Oct 2020 13:01:13 +0000 (15:01 +0200)]
remoteproc: stm32: update error management in stm32_copro_start

The coprocessor is running as soon as the hold boot is de-asserted.

So indicate this running state and save the resource table even
if the protective assert, to avoid autonomous reboot, is failed.

This error case should never occurs.

Cc: Fabien DESSENNE <fabien.dessenne@st.com>
Cc: Arnaud POULIQUEN <arnaud.pouliquen@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agoremoteproc: stm32: use reset for hold boot
Patrick Delaunay [Thu, 15 Oct 2020 13:01:12 +0000 (15:01 +0200)]
remoteproc: stm32: use reset for hold boot

Use the reset function to handle the hold boot bit in RCC
with device tree handle with MCU_HOLD_BOOT identifier.

This generic reset allows to remove the two specific properties:
- st,syscfg-holdboot
- st,syscfg-tz

This patch prepares alignment with kernel device tree.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Cc: Fabien DESSENNE <fabien.dessenne@st.com>
Cc: Arnaud POULIQUEN <arnaud.pouliquen@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agoreset: stm32: Add support of MCU HOLD BOOT
Patrick Delaunay [Thu, 15 Oct 2020 13:01:11 +0000 (15:01 +0200)]
reset: stm32: Add support of MCU HOLD BOOT

Handle the register RCC_MP_GCR without SET/CLR registers
but with a direct access to bit BOOT_MCU:
- deassert => set the bit: The MCU will not be in HOLD_BOOT
- assert => clear the bit: The MCU will be set in HOLD_BOOT

With this patch the RCC driver handles the MCU_HOLD_BOOT_R value
added in binding stm32mp1-resets.h

Cc: Fabien DESSENNE <fabien.dessenne@st.com>
Cc: Arnaud POULIQUEN <arnaud.pouliquen@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agoboard: stm32mp1: no MTD partitions fixup for serial boot
Patrick Delaunay [Thu, 15 Oct 2020 12:52:30 +0000 (14:52 +0200)]
board: stm32mp1: no MTD partitions fixup for serial boot

Remove the update of the MTD partitions in kernel device tree
for serial boot (USB / UART), and the kernel will use the MTD
partitions define in the loaded DTB because U-Boot can't known the
expected flash layout in this case.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
3 years agoSPL: stm32mp1: fix spl_mmc_boot_partition not defined
Richard Genoud [Mon, 12 Oct 2020 14:11:09 +0000 (16:11 +0200)]
SPL: stm32mp1: fix spl_mmc_boot_partition not defined

spl_mmc_boot_partition is only defined when
CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION is defined.

Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
3 years agoARM: dts: stm32: Drop QSPI CS2 on DHCOM
Marek Vasut [Wed, 28 Oct 2020 20:37:59 +0000 (21:37 +0100)]
ARM: dts: stm32: Drop QSPI CS2 on DHCOM

The QSPI CS2 is not used on DHCOM, remove the pinmux and flash@1.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrice Chotard <patrice.chotard@st.com>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
3 years agoARM: dts: stm32: Fix uSD card-detect GPIO on DHCOM
Marek Vasut [Wed, 28 Oct 2020 20:38:21 +0000 (21:38 +0100)]
ARM: dts: stm32: Fix uSD card-detect GPIO on DHCOM

The uSD slot card-detect GPIO is connected to PG1, fix it.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrice Chotard <patrice.chotard@st.com>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
3 years agoARM: dts: stm32: Add DHCOM based PicoITX board
Marek Vasut [Tue, 3 Nov 2020 18:14:58 +0000 (19:14 +0100)]
ARM: dts: stm32: Add DHCOM based PicoITX board

Add DT for DH PicoITX unit, which is a bare-bones carrier board for
the DHCOM. The board has ethernet port, USB, CAN, LEDs and a custom
board-to-board expansion connector.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrice Chotard <patrice.chotard@st.com>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
3 years agoarm: stm32mp: correct the ALIGN macro usage
Patrick Delaunay [Wed, 4 Nov 2020 08:22:09 +0000 (09:22 +0100)]
arm: stm32mp: correct the ALIGN macro usage

Correct the ALIGN macro usage in mmu_set_region_dcache_behaviour
call: the address must use ALIGN_DOWN and size can use ALIGN macro.

With STM32_SYSRAM_BASE=0x2FFC0000 and MMU_SECTION_SIZE=0x100000 for
STM32MP15x the computed address was 30000000 instead of 2ff00000.

Fixes: 43fe9d2fda24 ("stm32mp1: mmu_set_region_dcache_behaviour")
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
3 years agoARM: dts: stm32: Fix typo in stm32h7-u-boot.dtsi
Patrice Chotard [Fri, 6 Nov 2020 07:12:00 +0000 (08:12 +0100)]
ARM: dts: stm32: Fix typo in stm32h7-u-boot.dtsi

Fix typo "firsct"

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
3 years agoARM: dts: stm32: Fix timer initialization for stm32 MCU's board
Patrice Chotard [Fri, 6 Nov 2020 07:11:59 +0000 (08:11 +0100)]
ARM: dts: stm32: Fix timer initialization for stm32 MCU's board

Commit 4b2be78ab66c ("time: Fix get_ticks being non-monotonic")
puts in evidence that get_ticks is called before timer initialization.
Fix it by initializing timer before relocation.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
3 years agoARM: dts: stm32: DT sync with kernel v5.10-rc1 for MCU's boards
Patrice Chotard [Fri, 6 Nov 2020 07:11:58 +0000 (08:11 +0100)]
ARM: dts: stm32: DT sync with kernel v5.10-rc1 for MCU's boards

Device tree alignment with kernel v5.10-rc1.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
3 years agoARM: dts: sync armv7-m.dtsi with kernel v5.10-rc1
Patrice Chotard [Fri, 6 Nov 2020 07:11:57 +0000 (08:11 +0100)]
ARM: dts: sync armv7-m.dtsi with kernel v5.10-rc1

Since kernel v4.8-rc1, commit 05b23ebc2bd9 ("ARM: dts: armv7-m: remove skeleton.dtsi include"),
skeleton.dtsi file is no more included.

This synchronization is needed to avoid to get 2 memory node
in DTB file if, in DTS file, memory node is declared with the correct
syntax as following:

memory@90000000 {
  device_type = "memory";
  reg = <0x90000000 0x800000>;
  };

Then in DTB, we will have the 2 memory nodes, which is incorrect and
cause misbehavior during DT parsing by U-boot:

memory {
device_type = "memory";
reg = <0x00 0x00>;
};

memory@90000000 {
device_type = "memory";
reg = <0x90000000 0x800000>;
};

Issue found when synchronizing MCU's STM32 DT from kernel v5.10-rc1.
When using fdtdec_setup_mem_size_base() or fdtdec_setup_memory_banksize()
API, first above memory node is found (with reg = <0x00 0x00>), so
gd->ram_size, gd->ram_base, gd->bd->bi_dram[bank].start and
gd->bd->bi_dram[bank].size are all set to 0 which avoid boards to boot.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
3 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-usb
Tom Rini [Sun, 22 Nov 2020 16:00:11 +0000 (11:00 -0500)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-usb

- DWC2, DWC3 fixes

3 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-sh
Tom Rini [Sun, 22 Nov 2020 15:59:49 +0000 (10:59 -0500)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-sh

- Assorted pinctrl updates

3 years agousb: gadget: dwc2_udc_otg: return zero when reset property is not present
Jaehoon Chung [Wed, 21 Oct 2020 12:28:41 +0000 (21:28 +0900)]
usb: gadget: dwc2_udc_otg: return zero when reset property is not present

If reset DT property is not present, -ENOENT is returned.
But it's not really error.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agousb: dwc3: Handle case where setup_phy is not needed
Siva Durga Prasad Paladugu [Wed, 21 Oct 2020 12:17:31 +0000 (14:17 +0200)]
usb: dwc3: Handle case where setup_phy is not needed

If CONFIG_PHY is not enabled then the dwc3_setup_phy()
returns ENOTSUPP which can be still valid and intentional
so modify error check to handle this -ENOTSUPP.

The same error handling exists in drivers/usb/host/xhci-dwc3.c already
added by commit d648a50c0a27 ("dwc3: move phy operation to core.c").

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
3 years agousb: dwc2: add "u-boot,force-vbus-detection" for stm32
Patrick Delaunay [Thu, 15 Oct 2020 12:49:37 +0000 (14:49 +0200)]
usb: dwc2: add "u-boot,force-vbus-detection" for stm32

On some board, the ID pin is not connected so the B session must be
overridden with "u-boot,force_b_session_valid" but the VBus sensing
must continue to be handle.

To managed it, this patch adds a new DT field
"u-boot,force-vbus-detection" to use with "u-boot,force_b_session_valid"

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
3 years agopinctrl: renesas: Drop unused members from struct sh_pfc_pinctrl
Lad Prabhakar [Wed, 4 Nov 2020 17:27:04 +0000 (17:27 +0000)]
pinctrl: renesas: Drop unused members from struct sh_pfc_pinctrl

Drop unused members from struct sh_pfc_pinctrl.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
3 years agopinctrl: renesas: r8a7795: Optimize pinctrl image size for R8A774E1
Biju Das [Wed, 28 Oct 2020 10:34:25 +0000 (10:34 +0000)]
pinctrl: renesas: r8a7795: Optimize pinctrl image size for R8A774E1

This driver supports both RZ/G2H and R-Car H3 SoCs.
Optimize pinctrl image size for RZ/G2H, when support for R-Car H3
(R8A7795) is not enabled

Based on the similar patch on Linux.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
3 years agopinctrl: renesas: r8a77965: Optimize pinctrl image size for R8A774B1
Biju Das [Wed, 28 Oct 2020 10:34:24 +0000 (10:34 +0000)]
pinctrl: renesas: r8a77965: Optimize pinctrl image size for R8A774B1

This driver supports both RZ/G2N and R-Car M3-N SoCs.
Optimize pinctrl image size for RZ/G2N, when support for R-Car M3-N
(R8A77965) is not enabled.

Based on the simialr patch on Linux.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
3 years agopinctrl: renesas: r8a7796: Optimize pinctrl image size for R8A774A1
Biju Das [Wed, 28 Oct 2020 10:34:23 +0000 (10:34 +0000)]
pinctrl: renesas: r8a7796: Optimize pinctrl image size for R8A774A1

This driver supports both RZ/G2M and R-Car M3-W/W+ SoCs.
Optimize pinctrl image size for RZ/G2M, when support for R-Car M3-W/W+
(R8A7796[01]) is not enabled.

Based on the similar patch on Linux.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
3 years agopinctrl: renesas: r8a77951: Add R8A774E1 PFC support
Biju Das [Wed, 28 Oct 2020 10:34:22 +0000 (10:34 +0000)]
pinctrl: renesas: r8a77951: Add R8A774E1 PFC support

Renesas RZ/G2H (r8a774e1) is pin compatible with R-Car H3 (r8a77951),
however it doesn't have several automotive specific peripherals. Add
a r8a77951 specific pin groups/functions along with common pin
groups/functions for supporting both r8a77951 and r8a774e1 SoC.

PFC changes are synced from mainline linux-5.9 commit
bbf5c979011a ("Linux 5.9").

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
3 years agopinctrl: renesas: r8a77965: Add R8A774B1 PFC support
Biju Das [Wed, 28 Oct 2020 10:34:21 +0000 (10:34 +0000)]
pinctrl: renesas: r8a77965: Add R8A774B1 PFC support

Renesas RZ/G2N (r8a774b1) is pin compatible with R-Car M3-N (r8a77965),
however it doesn't have several automotive specific peripherals. Add
a r8a77965 specific pin groups/functions along with common pin
groups/functions for supporting both r8a77965 and r8a774b1 SoC.

PFC changes are synced from mainline linux-5.9 commit
bbf5c979011a ("Linux 5.9").

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
3 years agoMerge tag 'efi-2021-01-rc3-2' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Sat, 21 Nov 2020 13:04:39 +0000 (08:04 -0500)]
Merge tag 'efi-2021-01-rc3-2' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi

Pull request for UEFI sub-system for efi-2021-01-rc3 (2)

The parameter check for UEFI service GetNextVariableName() is corrected.

The dependencies of CONFIG_DFU_TFTP are simplified.

The set of supported hash algorithms reported by the EFI_TCG2_PROTOCOL is
corrected.

3 years agoefi_loader: parameter check in GetNextVariableName()
Heinrich Schuchardt [Thu, 19 Nov 2020 18:40:08 +0000 (19:40 +0100)]
efi_loader: parameter check in GetNextVariableName()

If GetNextVariableName() is called with a non-existing combination of
VariableName and VendorGuid, return EFI_INVALID_PARAMETER.

If GetNextVariableName() is called with a string that is not zero
terminated, return EFI_INVALID_PARAMETER.

Reformat a line over 80 characters.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: tcg2 protocol updates
Ilias Apalodimas [Mon, 16 Nov 2020 06:52:41 +0000 (08:52 +0200)]
efi_loader: tcg2 protocol updates

On pull reuqest
https://lists.denx.de/pipermail/u-boot/2020-November/432735.html
V4 of the patchset was sent instead of the v5.
This is the v4->v5 missing diff

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
3 years agodfu: simplify the dependencies of DFU_TFTP
AKASHI Takahiro [Tue, 17 Nov 2020 00:27:16 +0000 (09:27 +0900)]
dfu: simplify the dependencies of DFU_TFTP

Since CONFIG_UPDATE_COMMON always selects CONFIG_DFU_WRITE_ALT, we can
drop the latter from dependencies of CONFIG_DFU_TFTP.

Fixes: 3149e524fc1e ("common: update: add a generic interface for FIT
       image")
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoMerge tag 'xilinx-for-v2021.01-rc3' of https://gitlab.denx.de/u-boot/custodians/u...
Tom Rini [Fri, 20 Nov 2020 14:00:20 +0000 (09:00 -0500)]
Merge tag 'xilinx-for-v2021.01-rc3' of https://gitlab.denx.de/u-boot/custodians/u-boot-microblaze

Xilinx changes for v2021.01-rc3

Microblaze:
- Enable GC
- Get rid of xparameters.h and switch to DT for CFI
- Fix config file

tpm:
- Fix TPM code

zynqmp:
- Enable TPM by default
- Remove unused macros

fru:
- Several fixes especially use limit for recording

3 years agofru: common: Record pcie/uuid fields in custom board area
Michal Simek [Fri, 6 Nov 2020 12:58:01 +0000 (13:58 +0100)]
fru: common: Record pcie/uuid fields in custom board area

Add additional fields. They will be just recorded and filled but not shown.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
3 years agofru: ops: Do not let parser to write data to not allocated space
Michal Simek [Fri, 6 Nov 2020 12:55:45 +0000 (13:55 +0100)]
fru: ops: Do not let parser to write data to not allocated space

If customs fields in board area are used it will likely go over allocated
space in struct fru_board_data. That's why calculate limit of this
structure to make sure that different data is not rewritten by accident.
When limit is reached stop to record fields.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
3 years agofru: common: Switch capture variable with the rest
Michal Simek [Fri, 6 Nov 2020 12:53:01 +0000 (13:53 +0100)]
fru: common: Switch capture variable with the rest

capture variable is bool which is just one byte and it is just causing
unaligned accesses. Better to have it as last entry in the structure.

It also simplify offset calculation for initial header copy.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
3 years agoarm64: zynqmp: Enable TPM for xilinx platforms
Michal Simek [Mon, 9 Nov 2020 14:46:57 +0000 (15:46 +0100)]
arm64: zynqmp: Enable TPM for xilinx platforms

TPMs are becoming popular that's why enable drivers and command for it.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
3 years agoarm64: zynqmp: Get rid of unused macros
Michal Simek [Tue, 10 Nov 2020 12:10:04 +0000 (13:10 +0100)]
arm64: zynqmp: Get rid of unused macros

There is no reason to have these macros. But record offsets of missing
register in the structure for future use.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
3 years agotpm: spi: Cleanup source code
Michal Simek [Fri, 6 Nov 2020 14:05:57 +0000 (15:05 +0100)]
tpm: spi: Cleanup source code

There is no need for GD to be used and priv variable is unused.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agomicroblaze: Detect NOR flash based on DT
Michal Simek [Wed, 4 Nov 2020 15:14:06 +0000 (16:14 +0100)]
microblaze: Detect NOR flash based on DT

Remove fixed configuration and detect flash based on DT.

Also increase amount of flash sectors to 2048 because on kc705 flash has
1027 sectors.

Bank # 1: CFI conformant flash (16 x 16)  Size: 128 MB in 1027 Sectors
  Intel Extended command set, Manufacturer ID: 0x89, Device ID: 0x8962
  Erase timeout: 4096 ms, write timeout: 2 ms
  Buffer write timeout: 5 ms, buffer size: 1024 bytes

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
3 years agomicroblaze: Unify of setting for SPL_NOR/XIP support
Michal Simek [Wed, 4 Nov 2020 15:12:20 +0000 (16:12 +0100)]
microblaze: Unify of setting for SPL_NOR/XIP support

XIP is not enabled in SPL. SPL_NOR is enabled but any macro setting with
using SYS_FLASH_BASE are wrong because it is not aligned with DM.
That's why change these macro and align them with TEXT_BASE macro.
Information should be find at run time based on DT but implementation is
not done yet.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
3 years agomicroblaze: Remove CONFIG_SYS_FDT_SIZE
Michal Simek [Wed, 4 Nov 2020 15:08:40 +0000 (16:08 +0100)]
microblaze: Remove CONFIG_SYS_FDT_SIZE

CONFIG_SYS_FDT_SIZE is not use anywhere that's why remove it.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
3 years agomicroblaze: Get rid of xparameters.h
Michal Simek [Wed, 4 Nov 2020 15:00:38 +0000 (16:00 +0100)]
microblaze: Get rid of xparameters.h

There is no need to use this file anymore. Include it in main config file
and simplify logic based on it.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
3 years agomicroblaze: Simplify cache handling
Michal Simek [Wed, 4 Nov 2020 14:58:04 +0000 (15:58 +0100)]
microblaze: Simplify cache handling

Enable caches by default. For now just simplify config file but it should
be read from DT or PVRs.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
3 years agomicroblaze: Clean config file from ifdef mess
Michal Simek [Wed, 4 Nov 2020 14:46:32 +0000 (15:46 +0100)]
microblaze: Clean config file from ifdef mess

A lot of configs has been moved to Kconfig and it ends up in ifdef mess
with no bodies. That's why remove all of them.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
3 years agomicroblaze: Enable GCC garbage collector for full U-Boot
Michal Simek [Wed, 4 Nov 2020 13:01:45 +0000 (14:01 +0100)]
microblaze: Enable GCC garbage collector for full U-Boot

GCC's garbage collector works for Microblaze for quite a long time but none
has enabled it.
The same change has be done for example by commit fac4790491f6 ("arc:
Eliminate unused code and data with GCC's garbage collector").

Before:
   text    data     bss     dec     hex filename
 588760   33592   39192  661544   a1828 u-boot

After:
   text    data     bss     dec     hex filename
 504504   32164   38608  575276   8c72c u-boot

Which saves almost 15% of memory footprint.

Also group symbols/functions to proper section.

Reported-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
3 years agoMerge branch '2020-11-18-assorted-fixes'
Tom Rini [Thu, 19 Nov 2020 15:23:50 +0000 (10:23 -0500)]
Merge branch '2020-11-18-assorted-fixes'

- Assorted SquashFS fixes and cleanups
- Fixes for various Coverity issues
- Various fixups to other platforms / code

3 years agofs/squashfs: implement exists() function
Richard Genoud [Tue, 3 Nov 2020 11:11:26 +0000 (12:11 +0100)]
fs/squashfs: implement exists() function

This permits to find a file and use the distro_bootcmd

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
3 years agofs/squashfs: sqfs_read: remove buggy offset functionality
Richard Genoud [Tue, 3 Nov 2020 11:11:24 +0000 (12:11 +0100)]
fs/squashfs: sqfs_read: remove buggy offset functionality

offset is the offset in the file read, not the offset in the destination
buffer.
If the offset is not null, this will lead to a memory corruption.
So, for now, we are returning an error if the offset is used.

Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
3 years agofs/squashfs: sqfs_read: don't write beyond buffer size
Richard Genoud [Tue, 3 Nov 2020 11:11:23 +0000 (12:11 +0100)]
fs/squashfs: sqfs_read: don't write beyond buffer size

The length of the buffer wasn't taken into account when writing to the
given buffer.

Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
3 years agofs/squashfs: sqfs_probe: use sqfs_decompressor_init() return value
Richard Genoud [Tue, 3 Nov 2020 11:11:22 +0000 (12:11 +0100)]
fs/squashfs: sqfs_probe: use sqfs_decompressor_init() return value

sqfs_decompressor_init() returns a value, so it's better to use it than
to force the return value to EINVAL (it could be ENOMEM)

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
3 years agofs/squashfs: sqfs_probe: reset cur_dev/cur_part_info to NULL on error
Richard Genoud [Tue, 3 Nov 2020 11:11:21 +0000 (12:11 +0100)]
fs/squashfs: sqfs_probe: reset cur_dev/cur_part_info to NULL on error

Resetting the context on error will prevent some checks like:
if (!ctx.cur_dev)
To pass when the probe method has failed

Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
3 years agofs/squashfs: sqfs_probe: fix possible memory leak on error
Richard Genoud [Tue, 3 Nov 2020 11:11:19 +0000 (12:11 +0100)]
fs/squashfs: sqfs_probe: fix possible memory leak on error

If SquashFS magic number is invalid, there's a memory leak.

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
3 years agofs/squashfs: sqfs_read: fix memory leak on finfo.blk_sizes
Richard Genoud [Tue, 3 Nov 2020 11:11:18 +0000 (12:11 +0100)]
fs/squashfs: sqfs_read: fix memory leak on finfo.blk_sizes

finfo.blk_sizes may not be freed in case of error in the for loop
Setting it to null and freeing it at the end makes prevents that from
happening.

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
3 years agofs/squashfs: sqfs_get_abs_path: fix possible memory leak on error
Richard Genoud [Tue, 3 Nov 2020 11:11:17 +0000 (12:11 +0100)]
fs/squashfs: sqfs_get_abs_path: fix possible memory leak on error

if  sqfs_tokenize(rel_tokens, rc, rel); fails, the function exits
without freeing the array base_tokens.

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
3 years agofs/squashfs: sqfs_get_abs_path: fix error check
Richard Genoud [Tue, 3 Nov 2020 11:11:16 +0000 (12:11 +0100)]
fs/squashfs: sqfs_get_abs_path: fix error check

the return value of sqfs_tokenize(rel_tokens, rc, rel); wasn't checked.
(but "ret" value was !)
This is obviouly a typo.

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
3 years agofs/squashfs: sqfs_frag_lookup: simplify error handling
Richard Genoud [Tue, 3 Nov 2020 11:11:15 +0000 (12:11 +0100)]
fs/squashfs: sqfs_frag_lookup: simplify error handling

For consistency with other functions.

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
3 years agofs/squashfs: sqfs_read: fix another memory leak
Richard Genoud [Tue, 3 Nov 2020 11:11:14 +0000 (12:11 +0100)]
fs/squashfs: sqfs_read: fix another memory leak

data_buffer was allocated in a loop and freed only once.

Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
3 years agofs/squashfs: sqfs_read: fix memory leak
Richard Genoud [Tue, 3 Nov 2020 11:11:13 +0000 (12:11 +0100)]
fs/squashfs: sqfs_read: fix memory leak

sqfs_closedir() should be called to free memory allocated by
sqfs_opendir()

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>