oweals/u-boot.git
4 years agoinclude/ata.h: remove invalid links
Heinrich Schuchardt [Wed, 26 Feb 2020 04:29:47 +0000 (05:29 +0100)]
include/ata.h: remove invalid links

Remove invalid URLs for "Information Technology - AT Attachment-3 Interface
(ATA-3)", point to ANSI X3.298-1997.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoKconfig: fix typos in CMD_BEDBUG description
Heinrich Schuchardt [Tue, 25 Feb 2020 20:44:05 +0000 (21:44 +0100)]
Kconfig: fix typos in CMD_BEDBUG description

Fix documentation bug reported by 'make refcheckdocs'.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agodoc: fix references to driver-model
Heinrich Schuchardt [Tue, 25 Feb 2020 20:35:39 +0000 (21:35 +0100)]
doc: fix references to driver-model

Fix some errors pointed out by 'make refcheckdocs'.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoREADME: replace reference to boards.cfg
Heinrich Schuchardt [Mon, 24 Feb 2020 17:36:30 +0000 (18:36 +0100)]
README: replace reference to boards.cfg

boards.cfg is not delivered with the U-Boot source. So it is preferable to
look at configs/*_defconfig to identify available deconfigs.

Fix a typo.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoimage: Add compressed Image parsing support in booti.
Atish Patra [Fri, 6 Mar 2020 00:24:23 +0000 (16:24 -0800)]
image: Add compressed Image parsing support in booti.

Add compressed Image parsing support so that booti can parse both
flat and compressed Image to boot Linux. Currently, it is difficult
to calculate a safe address for every board where the compressed
image can be decompressed. It is also not possible to figure out the
size of the compressed file as well. Thus, user need to set two
additional environment variables kernel_comp_addr_r and filesize to
make this work.

Following compression methods are supported for now.
lzma, lzo, bzip2, gzip.

lz4 support is not added as ARM64 kernel generates a lz4 compressed
image with legacy header which U-Boot doesn't know how to parse and
decompress.

Tested on HiFive Unleashed and Qemu for RISC-V.
Tested on Qemu for ARM64.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
[trini: Fix minor rST formatting problems]
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agoimage: Add a common compression type detection function.
Atish Patra [Fri, 6 Mar 2020 00:24:22 +0000 (16:24 -0800)]
image: Add a common compression type detection function.

Currently, there is no method that can detect compression types
given a file. This is very useful where a compressed kernel image
is loaded directly to the memory.

Inspect initial few bytes to figure out compression type of the
image. It will be used in booti method for now but can be reused
any other function in future as well.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
4 years agolib: kconfig: Add option to set BZIP2 compression method
Atish Patra [Fri, 6 Mar 2020 00:24:21 +0000 (16:24 -0800)]
lib: kconfig: Add option to set BZIP2 compression method

There is no way to select BZIP2 compression method.
Add it under library/compression config where all other
compression related configs are present.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
4 years agocmd: mem: Add bitflip memory test to alternate mtest
Stefan Roese [Thu, 5 Mar 2020 06:21:32 +0000 (07:21 +0100)]
cmd: mem: Add bitflip memory test to alternate mtest

This additional bitflip memory test is inspired by the bitflip test
in memtester v4.3.0. It show some errors on some problematic GARDENA
MT7688 based boards. The other memory tests usually don't show any
errors here.

Signed-off-by: Stefan Roese <sr@denx.de>
4 years agocmd: mem: Use IS_ENABLED instead of alt_test variable
Stefan Roese [Thu, 5 Mar 2020 06:21:31 +0000 (07:21 +0100)]
cmd: mem: Use IS_ENABLED instead of alt_test variable

This patch uses the IS_ENABLED() macro to check, which mtest variant
is enabled.

Signed-off-by: Stefan Roese <sr@denx.de>
4 years agocmd: mem: Drop eldk-4.2 workaround and use cast in unmap_sysmem()
Stefan Roese [Thu, 5 Mar 2020 06:21:30 +0000 (07:21 +0100)]
cmd: mem: Drop eldk-4.2 workaround and use cast in unmap_sysmem()

Use a cast instead of the "eldk-4.2" workaround for unmap_sysmem().

Signed-off-by: Stefan Roese <sr@denx.de>
4 years agocmd: mem: Correctly count the errors in mtest
Stefan Roese [Thu, 5 Mar 2020 06:21:29 +0000 (07:21 +0100)]
cmd: mem: Correctly count the errors in mtest

This patch changes mtest to correctly count the overall errors and
print them even in the abort (Ctrl-C) case.

Signed-off-by: Stefan Roese <sr@denx.de>
4 years agotee: optee: use dev_info in print_os_revision
Patrick Delaunay [Mon, 2 Mar 2020 12:21:53 +0000 (13:21 +0100)]
tee: optee: use dev_info in print_os_revision

Display TEE version at information level; this patch replaces
debug() call to dev_info() in print_os_revision() function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
4 years agodoc: spl: update reference to driver-model/README.txt
Patrick Delaunay [Mon, 2 Mar 2020 09:12:41 +0000 (10:12 +0100)]
doc: spl: update reference to driver-model/README.txt

Update the reference in doc/README.SPL to a no more existing file:
"driver-model/README.txt", it is changed to "doc/driver-model/design.rst".

Adding the directory path /doc/ allows to check this reference with
'make refcheckdocs'.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoscripts: add documentation-file-ref-check
Heinrich Schuchardt [Fri, 28 Feb 2020 17:33:36 +0000 (18:33 +0100)]
scripts: add documentation-file-ref-check

'make refcheckdocs' requires scripts/documentation-file-ref-check.
Adopt script from Linux v5.6-rc3.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agomkimage: fit: don't create image with 0700 permissions
Thomas Hebb [Sun, 1 Mar 2020 18:47:53 +0000 (10:47 -0800)]
mkimage: fit: don't create image with 0700 permissions

commit 7298e422504e ("mkimage: fit: add support to encrypt image with
aes") added a new copyfile() function as part of the FIT image creation
flow. This function as currently written creates the final image with a
mode of 0700 (before umask), differing from the old behavior of 0666.
Since there doesn't seem to be any reason to make the image executable
or non-group, non-other readable, change the mask to 0666 to preserve
the old behavior.

Fixes: 7298e422504e ("mkimage: fit: add support to encrypt image with aes")
Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>
4 years agoide: remove duplicate defines form include/ata.h
Heinrich Schuchardt [Thu, 27 Feb 2020 17:28:01 +0000 (18:28 +0100)]
ide: remove duplicate defines form include/ata.h

ATA commands are already defined in include/libata.h. There is no need to
duplicate them in include/ata.h.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoblock: ide: use definitions from include/libata.h
Heinrich Schuchardt [Thu, 27 Feb 2020 17:28:00 +0000 (18:28 +0100)]
block: ide: use definitions from include/libata.h

Currently ATA commands are defined both in include/libata.h and
include/ata.h. Use the command definitions from include/libata.h where
applicable.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agocmd: fat: remove unused includes
Heinrich Schuchardt [Wed, 26 Feb 2020 06:26:26 +0000 (07:26 +0100)]
cmd: fat: remove unused includes

Remove unused includes from cmd/fat.c.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoarm: dts: add pwm support for MediaTek SoCs
Sam Shih [Fri, 21 Feb 2020 13:01:47 +0000 (21:01 +0800)]
arm: dts: add pwm support for MediaTek SoCs

This patch add pwm support for mt7622, mt7623 and mt7629 SoCs

Signed-off-by: Sam Shih <sam.shih@mediatek.com>
4 years agomediatek: pwm: add pwm driver for MediaTek SoCs
Sam Shih [Fri, 21 Feb 2020 13:01:46 +0000 (21:01 +0800)]
mediatek: pwm: add pwm driver for MediaTek SoCs

This driver support the standard PWM API for
MediaTek MT7623, MT7622 and MT7629 SoCs

Signed-off-by: Sam Shih <sam.shih@mediatek.com>
4 years agocmd: Add unlz4 command
Yusuke Ashiduka [Thu, 20 Feb 2020 11:48:01 +0000 (20:48 +0900)]
cmd: Add unlz4 command

This command is a new command called "unlz4" that decompresses from memory
into memory.
Used with the CONFIG_CMD_UNLZ4 optionenabled.

Signed-off-by: Yusuke Ashiduka <ashiduka@fujitsu.com>
[trini: Use %zd / %zX not %ld / %lX in printf]
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agoenv: make file-scope env_ptr variables static
Rasmus Villemoes [Tue, 18 Feb 2020 08:54:09 +0000 (08:54 +0000)]
env: make file-scope env_ptr variables static

The combination ENV_IS_IN_NVRAM=y, ENV_IS_IN_REMOTE=y fails to build:

env/remote.o:/mnt/ext4/devel/u-boot/env/remote.c:17: multiple definition of `env_ptr'
env/nvram.o:/mnt/ext4/devel/u-boot/env/nvram.c:41: first defined here

It's not necessarily a meaningful combination, but for build-testing
it's nice to be able to enable most ENV_IS_IN_* at the same time, and
since these env_ptr are not declared anywhere, they really have no
reason to have external linkage.

nand.c and flash.c similarly already define file-scope static env_ptr
variables.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
4 years agoARM: bootm: take into account gd->ram_top
Patrice Chotard [Thu, 13 Feb 2020 18:29:50 +0000 (19:29 +0100)]
ARM: bootm: take into account gd->ram_top

If gd->ram_top has been tuned using board_get_usable_ram_top(),
it must be taken into account when reserving arch lmb.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agoMerge branch '2020-04-16-master-imports'
Tom Rini [Fri, 17 Apr 2020 15:08:08 +0000 (11:08 -0400)]
Merge branch '2020-04-16-master-imports'

- DM GPIO improvements
- BTRFS fixes
- Corrections around gd->new_bootstage alignment
- Start documentation improvements to support 'make refcheckdocs'

4 years agoboard_f.c: Ensure 16 alignment of start_addr_sp and reserved memory
Patrick Delaunay [Tue, 10 Mar 2020 09:15:05 +0000 (10:15 +0100)]
board_f.c: Ensure 16 alignment of start_addr_sp and reserved memory

Add a function reserve_stack_aligned() to reserved memory with 16 bits
alignment after the stack pointer (gd->start_addr_sp) and use this new
function in board_f.c to reserve all the memory area (malloc, board, gd,
fdt, bootstage, stacks).

This 16 byte alignment is needed for cast on struct pointer
for the reserved memory, for example:
+ x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes
+ ARMv8 Instruction Set Overview: quad word, 16 bytes

An other alignment value could be needed for other architecture.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
4 years agoarm: set the relocated gd with gd->new_gd
Patrick Delaunay [Tue, 10 Mar 2020 09:15:04 +0000 (10:15 +0100)]
arm: set the relocated gd with gd->new_gd

Simplify the arm relocation behavior and get gd directly form new_gd,
as it is already done in crt0_64.S:

ldr x18, [x18, #GD_NEW_GD] /* x18 <- gd->new_gd */

This patch avoid assumption on new GD location (new GD is below bd -
with #GD_SIZE offset).

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agoRevert "stm32mp1: remove the imply BOOTSTAGE"
Patrick Delaunay [Tue, 10 Mar 2020 09:15:03 +0000 (10:15 +0100)]
Revert "stm32mp1: remove the imply BOOTSTAGE"

This reverts the workaround introduced by the
commit 16fec9b0bc1a ("stm32mp1: remove the imply BOOTSTAGE")
As the bootstage alignment issue is now solved.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agoboard_f.c: Ensure gd->new_bootstage alignment
Patrice Chotard [Tue, 10 Mar 2020 09:15:02 +0000 (10:15 +0100)]
board_f.c: Ensure gd->new_bootstage alignment

In reserve_bootstage(), in case size is odd, gd->new_bootstage
is not aligned. In bootstage_relocate(), the platform hangs when
getting access to data->record[i].name.
To avoid this issue, make gd->new_bootstage 16 byte aligned.

To ensure that new_bootstage is 16 byte aligned (at least needed for
x86_64 and ARMv8) and new_bootstage starts down to get enough space,
ALIGN_DOWN macro is used.

Fixes: ac9cd4805c8b ("bootstage: Correct relocation algorithm")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas MANOCHA <vikas.manocha@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agoarm: imx: update reference to README.mxc_hab
Patrick Delaunay [Fri, 28 Feb 2020 14:18:16 +0000 (15:18 +0100)]
arm: imx: update reference to README.mxc_hab

Update reference in files detected by
scripts/documentation-file-ref-check

doc/README.mxc_hab  => doc/imx/habv4/*

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agodoc: device-tree-bindings: update reference to binding directory
Patrick Delaunay [Fri, 28 Feb 2020 14:18:15 +0000 (15:18 +0100)]
doc: device-tree-bindings: update reference to binding directory

Update reference in files detected by
scripts/documentation-file-ref-check

doc/devicetree/device-tree-bindings/  => doc/device-tree-bindings/

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agodoc: update reference to README.board
Patrick Delaunay [Fri, 28 Feb 2020 14:18:14 +0000 (15:18 +0100)]
doc: update reference to README.board

Update reference in files detected by
scripts/documentation-file-ref-check

doc/README.<board>  => board/<board>/README

Files moved in board directory in
commit 702e6014f15b ("doc: cleanup - move board
READMEs into respective board directories")'

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agodoc: update reference to README.imx8image
Patrick Delaunay [Fri, 28 Feb 2020 14:18:13 +0000 (15:18 +0100)]
doc: update reference to README.imx8image

Update reference in many files detected by
scripts/documentation-file-ref-check

README.imx8image  => imx/mkimage/imx8image.txt

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agodoc: update reference to README.imximage
Patrick Delaunay [Fri, 28 Feb 2020 14:18:12 +0000 (15:18 +0100)]
doc: update reference to README.imximage

Update reference in many files detected by
scripts/documentation-file-ref-check

README.imximage => imx/mkimage/imximage.txt

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agoKconfig: update reference to README.x86
Patrick Delaunay [Fri, 28 Feb 2020 14:18:11 +0000 (15:18 +0100)]
Kconfig: update reference to README.x86

Update reference in Kconfig detected by
scripts/documentation-file-ref-check

README.x86 => doc/arch/x86.rst

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoREADME: update reference to *.README
Patrick Delaunay [Fri, 28 Feb 2020 14:18:10 +0000 (15:18 +0100)]
README: update reference to *.README

Update some reference in README file detected by
scripts/documentation-file-ref-check

*.README => README.*

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agotest: pinmux: add pincontrol-gpio for pin configuration
Patrick Delaunay [Mon, 13 Jan 2020 10:35:15 +0000 (11:35 +0100)]
test: pinmux: add pincontrol-gpio for pin configuration

Add a simple pincontrol associated to the sandbox gpio driver,
that allows to check pin configuration with the command pinmux.

The pinmux test is also updated to test behavior with 2 pincontrols.

Example to check LED pin configuration:

=> pinmux list
| Device                        | Driver                        | Parent
| pinctrl-gpio                  | sandbox_pinctrl_gpio          | root_driver
| pinctrl                       | sandbox_pinctrl               | root_driver

=> pinmux dev pinctrl-gpio

=> pinmux status

a0        : gpio input .
a1        : gpio input .
a2        : gpio input .
a3        : gpio input .
a4        : gpio input .
a5        : gpio output .
a6        : gpio output .
...

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agotest: dm: update test for pins configuration in gpio
Patrick Delaunay [Mon, 13 Jan 2020 10:35:14 +0000 (11:35 +0100)]
test: dm: update test for pins configuration in gpio

Add tests for new API set_dir_flags and set_dir_flags and associated
code in gpio uclass.

Test support for new flags GPIO_OPEN_DRAIN, GPIO_OPEN_SOURCE
GPIO_PULL_UP and GPIO_PULL_DOWN.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agogpio: sandbox: cleanup binding support
Patrick Delaunay [Mon, 13 Jan 2020 10:35:13 +0000 (11:35 +0100)]
gpio: sandbox: cleanup binding support

Cleanup binding support, use the generic binding by default
(test u-class gpio_xlate_offs_flags function) and add
specific binding for added value.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agotest: dm: update test for pins configuration in pinctrl node
Patrick Delaunay [Mon, 13 Jan 2020 10:35:12 +0000 (11:35 +0100)]
test: dm: update test for pins configuration in pinctrl node

Add test for "pins" configuration in gpio uclass with set_state() ops
and test for generic parsing of pinconf_param array).

set_state() is called by:
- pinctrl_generic_set_state
 |- pinctrl_generic_set_state_subnode

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agopinctrl: sandbox: Add mux information in get_pin_muxing
Patrick Delaunay [Mon, 13 Jan 2020 10:35:11 +0000 (11:35 +0100)]
pinctrl: sandbox: Add mux information in get_pin_muxing

Add param information in pin information output.
This update prepare unitary test for pin configuration
in pinctrl node.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agodt-bindings: gpio: alignment with kernel v5.3
Patrick Delaunay [Mon, 13 Jan 2020 10:35:10 +0000 (11:35 +0100)]
dt-bindings: gpio: alignment with kernel v5.3

Update the binding file for gpio, it is just an alignment
with kernel v5.3.
The U-Boot code example for gpio-hog (not directly linked
to binding) is moved in a new file doc/README.gpio.
[commit 21676b706e99 ("gpio: fixes for gpio-hog support")
& 'commit 4762a9988ede ("gpio: add gpio-hog support")']

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agogpio: add ops to set dir flags
Patrick Delaunay [Mon, 13 Jan 2020 10:35:09 +0000 (11:35 +0100)]
gpio: add ops to set dir flags

Add the ops for GPIO driver set_dir_flags() to set the dir flags.
The user can update the direction and configuration
of each GPIO with a only call to dm_gpio_set_dir_flags() or
dm_gpio_set_dir() and respecting the configuration provided by
device tree (saved in desc->flags).

When these optional ops are absent, the gpio uclass use the mandatory
ops (direction_output, direction_input, get_value) and desc->flags
to manage only the main dir flags:
- GPIOD_IS_IN
- GPIOD_IS_OUT
- GPIOD_IS_OUT_ACTIVE
- GPIOD_ACTIVE_LOW

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agogpio: add ops to get dir flags
Patrick Delaunay [Mon, 13 Jan 2020 10:35:08 +0000 (11:35 +0100)]
gpio: add ops to get dir flags

Add the ops for GPIO driver get_dir_flags(), allows to get dynamically
the current gpio configuration; it is used by the API function
dm_gpio_get_dir_flags().

When these optional ops are absent, the gpio uclass continues to use
the mandatory ops (direction_output, direction_input, get_value) and
value of desc->flags to manage only the main dir flags:
- GPIOD_IS_IN
- GPIOD_IS_OUT
- GPIOD_IS_OUT_ACTIVE
- GPIOD_ACTIVE_LOW

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agogpio: add support of new GPIO direction flag
Patrick Delaunay [Mon, 13 Jan 2020 10:35:07 +0000 (11:35 +0100)]
gpio: add support of new GPIO direction flag

This commit manages the new dir flags that can be used in gpio
specifiers to indicate the pull-up or pull-down resistor
configuration for output gpio (GPIO_PULL_UP, GPIO_PULL_DOWN)
or the Open Drain/Open Source configuration for input gpio
(GPIO_OPEN_DRAIN, GPIO_OPEN_SOURCE).

These flags are already supported in Linux kernel in gpio lib.

This patch only parse and save the direction flags in GPIO
descriptor (desc->flags), it prepares the introduction of new ops
to manage them.
The GPIO uclass supports new GPIO flags from device-tree
(GPIO_XXX define in include/dt-bindings/gpio/gpio.h)
and translate them in the dir flags (GPIOD_XXX):
- GPIO_PULL_UP     => GPIOD_PULL_UP
- GPIO_PULL_DOWN   => GPIOD_PULL_DOWN
- GPIO_OPEN_DRAIN  => GPIOD_OPEN_DRAIN
- GPIO_OPEN_SOURCE => GPIOD_OPEN_SOURCE

This patch also adds protection in the check_dir_flags function for
new invalid configuration of the dir flags.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agogpio: update dir_flags management
Patrick Delaunay [Mon, 13 Jan 2020 10:35:06 +0000 (11:35 +0100)]
gpio: update dir_flags management

Update the flag management in GPIO uclass: the desc->flags is always
combined with the requested flags and the GPIO descriptor is updated
for further call.

Add a function dm_gpio_get_dir_flags to get dynamically
the current dir_flags (configuration and value).

This patch prepare introduction of the dir flags support with new ops.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agogpio: add helper GPIOD_FLAGS_OUTPUT
Patrick Delaunay [Mon, 13 Jan 2020 10:35:05 +0000 (11:35 +0100)]
gpio: add helper GPIOD_FLAGS_OUTPUT

Add a macro to provide the GPIO output value according
the dir flags content.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agogpio: add function check_dir_flags
Patrick Delaunay [Mon, 13 Jan 2020 10:35:04 +0000 (11:35 +0100)]
gpio: add function check_dir_flags

Add a dir flags validity check with a new function
check_dir_flags.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agogpio: add function _dm_gpio_set_dir_flags
Patrick Delaunay [Mon, 13 Jan 2020 10:35:03 +0000 (11:35 +0100)]
gpio: add function _dm_gpio_set_dir_flags

Introduce the function _dm_gpio_set_dir_flags to set dir flags
without check if the GPIO is reserved.

Separate the reserved check for "set_dir" and "set_dir_flags".

This patch is a preliminary step to add new ops.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agogpio: add function _gpio_get_value
Patrick Delaunay [Mon, 13 Jan 2020 10:35:02 +0000 (11:35 +0100)]
gpio: add function _gpio_get_value

Introduce the function _gpio_get_value to get the GPIO value
without check if it is reserved.
This patch prepare new ops introduction.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agogpio: add gpio descriptor initialization helper
Patrick Delaunay [Mon, 13 Jan 2020 10:35:01 +0000 (11:35 +0100)]
gpio: add gpio descriptor initialization helper

Add a helper function gpio_desc_init() to initialize the gpio descriptor;
with this function the flags will be always set to 0.

It wasn't the case before this patch in dm_gpio_lookup_name.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agogpio: remove the open_drain API and ops
Patrick Delaunay [Mon, 13 Jan 2020 10:35:00 +0000 (11:35 +0100)]
gpio: remove the open_drain API and ops

This patch removes the ops get_open_drain/set_open_drain
and the API dm_gpio_get_open_drain/dm_gpio_set_open_drain.

The ops only provided in one driver (mpc8xxx gpio) and the
associated API is never called in boards.

This patch prepare a more generic set/get_dir_flags ops,
including the open drain property.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agogpio: remove GPIOD_REQUESTED
Patrick Delaunay [Mon, 13 Jan 2020 10:34:59 +0000 (11:34 +0100)]
gpio: remove GPIOD_REQUESTED

Remove the define GPIOD_REQUESTED as it is never used
and use BIT() macro for other defines.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agodt-bindings: gpio: document the new pull-up/pull-down flags
Patrick Delaunay [Mon, 13 Jan 2020 10:34:58 +0000 (11:34 +0100)]
dt-bindings: gpio: document the new pull-up/pull-down flags

This commit extends the flags that can be used in GPIO specifiers to
indicate if a pull-up resistor or pull-down resistor should be
enabled.

It is the backport of linux commit ede033e1e863c ('dt-bindings:
gpio: document the new pull-up/pull-down flags')
from Thomas Petazzoni <thomas.petazzoni@bootlin.com>
and integrated in v5.1-rc1
https://github.com/torvalds/linux/commit/ede033e1e863c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agodm: pinctrl: migrate pinctrl-generic to livetree
Patrick Delaunay [Mon, 13 Jan 2020 10:34:57 +0000 (11:34 +0100)]
dm: pinctrl: migrate pinctrl-generic to livetree

Migrate pinctrl-generic to livetree:
- dev_for_each_property
- dev_read_prop_by_prop
- dev_read_string_count
- dev_read_string_index
and get rid of DECLARE_GLOBAL_DATA_PTR.

This patch solves the parsing issue during sandbox tests for pin
configuration (OF_LIVE is activated in sandbox_defconfig
and sub node are not correctly parsed in
pinctrl_generic_set_state_subnode with fdt lib API).

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agodm: core: add ofnode and dev function to iterate on node property
Patrick Delaunay [Mon, 13 Jan 2020 10:34:56 +0000 (11:34 +0100)]
dm: core: add ofnode and dev function to iterate on node property

Add functions to iterate on all property with livetree
- dev_read_first_prop
- dev_read_next_prop
- dev_read_prop_by_prop
and
- ofnode_get_first_property
- ofnode_get_next_property
- ofnode_get_property_by_prop

And helper: dev_for_each_property

For example:
struct ofprop property;

dev_for_each_property(property, config) {
value = dev_read_prop_by_prop(&property, &propname, &len);

or:

for (res = ofnode_get_first_property(node, &property);
     !res;
     res = ofnode_get_next_property(&property))
{
     value = ofnode_get_property_by_prop(&property, &propname, &len);
....
}

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agodm: pinctrl: convert pinctrl-single to livetree
Patrick Delaunay [Mon, 13 Jan 2020 10:34:55 +0000 (11:34 +0100)]
dm: pinctrl: convert pinctrl-single to livetree

Convert 'pinctrl-single' using livetree functions
- dev_read_prop
- dev_read_u32_default
- dev_read_u32_array
- dev_read_bool
- dev_read_addr
and get rid of DECLARE_GLOBAL_DATA_PTR.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agoREADME: remove requirement for CHANGELOG entry
Karl Palsson [Mon, 6 Apr 2020 15:58:02 +0000 (15:58 +0000)]
README: remove requirement for CHANGELOG entry

As indicated elsewhere in the README, the standalone CHANGELOG file was
removed in 2010.  Drop the instructions for creating patches on creating
a standalone CHANGELOG entry.

Signed-off-by: Karl Palsson <karlp@tweak.net.au>
4 years agofs: btrfs: Fix LZO false decompression error caused by pending zero
Qu Wenruo [Thu, 26 Mar 2020 05:35:56 +0000 (13:35 +0800)]
fs: btrfs: Fix LZO false decompression error caused by pending zero

For certain btrfs files with compressed file extent, uboot will fail to
load it:

  btrfs_read_extent_reg: disk_bytenr=14229504 disk_len=73728 offset=0 nr_bytes=131
  072
  decompress_lzo: tot_len=70770
  decompress_lzo: in_len=1389
  decompress_lzo: in_len=2400
  decompress_lzo: in_len=3002
  decompress_lzo: in_len=1379
  decompress_lzo: in_len=88539136
  decompress_lzo: header error, in_len=88539136 clen=65534 tot_len=62580

NOTE: except the last line, all other lines are debug output.

Btrfs lzo compression uses its own format to record compressed size
(segment header, LE32).

However to make decompression easier, we never put such segment header
across page boundary.

In above case, the xxd dump of the lzo compressed data looks like this:

00001fe0: 4cdc 02fc 0bfd 02c0 dc02 0d13 0100 0001  L...............
00001ff0: 0000 0008 0300 0000 0000 0011 0000|0000  ................
00002000: 4705 0000 0001 cc02 0000 0000 0000 1e01  G...............

'|' is the "expected" segment header start position.

But in that page, there are only 2 bytes left, can't contain the 4 bytes
segment header.

So btrfs compression will skip that 2 bytes, put the segment header in
next page directly.

Uboot doesn't have such check, and read the header with 2 bytes offset,
result 0x05470000 (88539136), other than the expected result
0x00000547 (1351), resulting above error.

Follow the btrfs-progs restore implementation, by introducing tot_in to
record total processed bytes (including headers), and do proper page
boundary skip to fix it.

Please note that, current code base doesn't parse fs_info thus we can't
grab sector size easily, so it uses PAGE_SIZE, and relying on fs open
time check to exclude unsupported sector size.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Cc: Marek Behun <marek.behun@nic.cz>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
4 years agofs: btrfs: Reject fs with sector size other than PAGE_SIZE
Qu Wenruo [Thu, 26 Mar 2020 05:35:55 +0000 (13:35 +0800)]
fs: btrfs: Reject fs with sector size other than PAGE_SIZE

Although in theory u-boot fs driver could easily support more sector
sizes, current code base doesn't have good enough way to grab sector
size yet.

This would cause problem for later LZO fixes which rely on sector size.

And considering that most u-boot boards are using 4K page size, which is
also the most common sector size for btrfs, rejecting fs with
non-page-sized sector size shouldn't cause much problem.

This should only be a quick fix before we implement better sector size
support.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Cc: Marek Behun <marek.behun@nic.cz>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
4 years agofs: btrfs: Use LZO_LEN to replace immediate number
Qu Wenruo [Thu, 26 Mar 2020 05:35:54 +0000 (13:35 +0800)]
fs: btrfs: Use LZO_LEN to replace immediate number

Just a cleanup. These immediate numbers make my eyes hurt.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Cc: Marek Behun <marek.behun@nic.cz>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
4 years agoMerge tag 'arc-fixes-for-2020.07-rc1' of https://gitlab.denx.de/u-boot/custodians...
Tom Rini [Thu, 16 Apr 2020 21:14:44 +0000 (17:14 -0400)]
Merge tag 'arc-fixes-for-2020.07-rc1' of https://gitlab.denx.de/u-boot/custodians/u-boot-arc

This is pretty minor set of changes mostly touching HSDK board:

 * Enable on-chip reset controller on HSDK
 * Add possibility to turn-on & off L2$ on more
   recent ARC HS processors.
 * AXI tunnel clock calculation on HSDK

4 years agoMerge tag 'efi-2020-07-rc1' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Thu, 16 Apr 2020 20:41:40 +0000 (16:41 -0400)]
Merge tag 'efi-2020-07-rc1' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi

Pull request for UEFI sub-system for efi-2020-07-rc1

This pull request

* provides an implementation of UEFI secure booting
* fixes a problem with the rsa_mod_exp driver which stops some boards
  from booting when CONFIG_RSA is enabled which is needed for UEFI
  secure booting
* enables the EFI_RNG_PROTOCOL if DM_RNG is enabled
* fixes some function comments

4 years agoARC: HSDK: CGU: fix tunnel clock calculation
Eugeniy Paltsev [Thu, 16 Apr 2020 19:35:11 +0000 (22:35 +0300)]
ARC: HSDK: CGU: fix tunnel clock calculation

We set wrong tunnel PLL frequency when we request 125MHz tunnel clock.
Fix that.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
4 years agoARC: HSDK: Enable on-chip reset controller
Eugeniy Paltsev [Wed, 11 Mar 2020 12:37:23 +0000 (15:37 +0300)]
ARC: HSDK: Enable on-chip reset controller

As the driver of on-chip reset controller became available
we are ready to enable it.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
4 years agoARC: CACHE: mark IOC helper functions as inlined_cachefunc
Eugeniy Paltsev [Wed, 11 Mar 2020 12:00:44 +0000 (15:00 +0300)]
ARC: CACHE: mark IOC helper functions as inlined_cachefunc

Force inlining of IOC related functions used in other cache
functions. This is preventive change.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
4 years agoARC: CACHE: add support for SL$ disable
Eugeniy Paltsev [Wed, 11 Mar 2020 12:00:43 +0000 (15:00 +0300)]
ARC: CACHE: add support for SL$ disable

Since version 3.0 ARC HS supports SL$ (L2 system level cache)
disable. So add support for SL$ disable/enable to code.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
4 years agoMerge tag 'dm-pull-10apr20-take2' of git://git.denx.de/u-boot-dm
Tom Rini [Thu, 16 Apr 2020 17:45:03 +0000 (13:45 -0400)]
Merge tag 'dm-pull-10apr20-take2' of git://git.denx.de/u-boot-dm

Functions for reading indexed values from device tree
Enhancements to 'dm' command
Log test enhancements and syslog driver
DM change to read parent ofdata before children
Minor fixes

4 years agodm: core: Read parent ofdata before children
Simon Glass [Sun, 5 Apr 2020 21:38:19 +0000 (15:38 -0600)]
dm: core: Read parent ofdata before children

At present a device can read its ofdata before its parent has done the
same. This can cause problems in the case where the parent has a 'ranges'
property, thus affecting the operation of dev_read_addr(), for example.

We already probe parent devices before children so it does not seem to be
a large step to do the same with ofdata.

Make the change and update the documentation in this area.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Ley Foon Tan <ley.foon.tan@intel.com>
4 years agotest: fdtdec: test fdtdec_set_carveout()
Laurentiu Tudor [Fri, 3 Apr 2020 10:43:04 +0000 (13:43 +0300)]
test: fdtdec: test fdtdec_set_carveout()

Add a new test for fdtdec_set_carveout().

Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Drop blank line at EFO:
Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agofdtdec: support multiple phandles in memory carveout
Laurentiu Tudor [Fri, 3 Apr 2020 10:43:03 +0000 (13:43 +0300)]
fdtdec: support multiple phandles in memory carveout

fdtdec_set_carveout() is limited to only one phandle. Fix this
limitation by adding support for multiple phandles.

Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: remove the duplicated function dm_ofnode_pre_reloc
Patrick Delaunay [Fri, 3 Apr 2020 09:39:18 +0000 (11:39 +0200)]
dm: core: remove the duplicated function dm_ofnode_pre_reloc

The content dm_ofnode_pre_reloc() is identical with ofnode_pre_reloc()
defined in drivers/core/ofnode.c and used only three times:
- drivers/core/lists.c:lists_bind_fdt()
- drivers/clk/at91/pmc.c::at91_clk_sub_device_bind
- drivers/clk/altera/clk-arria10.c::socfpga_a10_clk_bind

So this function dm_ofnode_pre_reloc can be removed and replaced
by these function calls by ofnode_pre_reloc().

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: refactor functions reading an u32 from dt
Dario Binacchi [Sun, 29 Mar 2020 16:04:42 +0000 (18:04 +0200)]
dm: core: refactor functions reading an u32 from dt

Now reading a 32 bit value from a device-tree property can be expressed
as reading the first element of an array with a single value.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: support reading a single indexed u32 value
Dario Binacchi [Sun, 29 Mar 2020 16:04:41 +0000 (18:04 +0200)]
dm: core: support reading a single indexed u32 value

The patch adds helper functions to allow reading a single indexed u32
value from a device-tree property containing multiple u32 values, that
is an array of integers.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agodm: test: add test case for dev_read_u64 function
Dario Binacchi [Sun, 29 Mar 2020 16:04:40 +0000 (18:04 +0200)]
dm: test: add test case for dev_read_u64 function

Add test case to cover dev_read_u64 and dev_read_u64_default functions.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: Add a way to skip powering down power domains
Simon Glass [Sat, 28 Mar 2020 20:03:48 +0000 (14:03 -0600)]
dm: core: Add a way to skip powering down power domains

When removing a device the power domains it uses are generally powered
off. But when we are trying to unbind all devices (e.g. for running tests)
we don't want to probe a device in the 'remove' path.

Add a new flag to skip this power-down step.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: Add logging on unbind failure
Simon Glass [Sat, 28 Mar 2020 20:03:47 +0000 (14:03 -0600)]
dm: core: Add logging on unbind failure

This failure path is tricky to debug since it continues after failure and
there are a lot of error paths. Add logging to help.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agofdt: Fix 'system' command
Tom Warren [Thu, 26 Mar 2020 22:20:44 +0000 (15:20 -0700)]
fdt: Fix 'system' command

'fdt systemsetup' wasn't working, due to the fact that the 'set' command
was being parsed in do_fdt() by only testing for the leading 's' instead
of "se", which kept the "sys" test further down from executing. Changed
to test for "se" instead, now 'fdt systemsetup' works (to test the
ft_system_setup proc w/o having to boot a kernel).

Signed-off-by: Tom Warren <twarren@nvidia.com>
4 years agosandbox: enable CMD_BOOTEFI_HELLO and CMD_EFIDEBUG
Heinrich Schuchardt [Sat, 14 Mar 2020 11:27:02 +0000 (12:27 +0100)]
sandbox: enable CMD_BOOTEFI_HELLO and CMD_EFIDEBUG

'bootefi hello' is used in one of the Python tests.

efidebug can be used to verify the correct initialization of the UEFI
sub-system.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromum.org>
4 years agosandbox: implement ft_board_setup()
Heinrich Schuchardt [Sat, 14 Mar 2020 11:13:40 +0000 (12:13 +0100)]
sandbox: implement ft_board_setup()

Currently we are not able to test reservations created by ft_board_setup().

Implement ft_board_setup() to create an arbitrary reservation and enable
OF_BOARD_SETUP.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromum.org>
4 years agosandbox: add reserved-memory node in device tree
Heinrich Schuchardt [Sat, 14 Mar 2020 11:13:39 +0000 (12:13 +0100)]
sandbox: add reserved-memory node in device tree

For testing the handling of memory reservations create a reserved-memory
node in sandbox.dts and sandbox64.dts.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromum.org>
4 years agopatman: Apply the cc limit to the cover letter also
Simon Glass [Fri, 28 Feb 2020 01:49:23 +0000 (18:49 -0700)]
patman: Apply the cc limit to the cover letter also

Quite often on a series that has clean-up patches, the individual patches
may fit within the cc limit but the cover letter does not. Apply the same
limit to the cover letter.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Chris Packham <judge.packham@gmail.com>
4 years agodoc: driver-model: there is no UCLASS_ETHERNET
Heinrich Schuchardt [Wed, 26 Feb 2020 19:18:54 +0000 (20:18 +0100)]
doc: driver-model: there is no UCLASS_ETHERNET

%s/UCLASS_ETHERNET/UCLASS_ETH/g

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoconfigs: sandbox: enable LOG_SYSLOG
Heinrich Schuchardt [Wed, 26 Feb 2020 20:48:20 +0000 (21:48 +0100)]
configs: sandbox: enable LOG_SYSLOG

For testing purposes enable the syslog logging driver.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agotest: log: test syslog logging driver
Heinrich Schuchardt [Wed, 26 Feb 2020 20:48:19 +0000 (21:48 +0100)]
test: log: test syslog logging driver

Provide unit tests for the syslog logging driver.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agotest: log functions with CONFIG_LOG=n
Heinrich Schuchardt [Wed, 26 Feb 2020 20:48:18 +0000 (21:48 +0100)]
test: log functions with CONFIG_LOG=n

If CONFIG_LOG=n, we still expect output for log_err(), log_warning(),
log_notice(), log_info() and in case of DEBUG=1 also for log_debug().

Provide unit tests verifying this.

The tests depend on:

CONFIG_CONSOLE_RECORD=y
CONFIG_LOG=n
CONFIG_UT_LOG=y

It may be necessary to increase the value of CONFIG_SYS_MALLOC_F_LEN to
accommodate CONFIG_CONSOLE_RECORD=y.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agolog: output for CONFIG_LOG=n
Heinrich Schuchardt [Wed, 26 Feb 2020 20:48:17 +0000 (21:48 +0100)]
log: output for CONFIG_LOG=n

If CONFIG_LOG=n, we should still output errors, warnings, notices, infos,
and for DEBUG=1 also debug messages.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agolog: syslog driver
Heinrich Schuchardt [Wed, 26 Feb 2020 20:48:16 +0000 (21:48 +0100)]
log: syslog driver

Provide a log driver that broadcasts RFC 3164 messages to syslog servers.
rsyslog is one implementation of such a server.

The messages are sent to the local broadcast address 255.255.255.255 on
port 514.

The environment variable log_hostname can be used to provide the HOSTNAME
field for the messages. The optional TIMESTAMP field of RFC 3164 is not
provided.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agolog: correct CONFIG_LOG_TEST prerequisites
Heinrich Schuchardt [Wed, 26 Feb 2020 20:48:15 +0000 (21:48 +0100)]
log: correct CONFIG_LOG_TEST prerequisites

An error

undefined reference to `do_log_test'

occurs for CONFIG_CMD_LOG=y, CONFIG_LOG_TEST=y, CONGIG_UNIT_TEST=n

Make CONFIG_UNIT_TEST a prerequisite.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: Move "/chosen" and "/firmware" node scan
Patrick Delaunay [Tue, 18 Feb 2020 14:43:46 +0000 (15:43 +0100)]
dm: core: Move "/chosen" and "/firmware" node scan

Use the new function dm_scan_fdt_ofnode_path() to scan all the nodes
which aren't devices themselves but may contain some:
- "/chosen"
- "/clocks"
- "/firmware"

The patch removes the strcmp call in recursive function dm_scan_fdt_live()
and also corrects a conflict with the 2 applied patches in
the commit 1712ca21924b ("dm: core: Scan /firmware node by default")
and in the commit 747558d01457 ("dm: fdt: scan for devices under
/firmware too"): the subnodes of "/firmware" (optee for example)
are bound 2 times.

For example the dm tree command result on STM32MP1 is:

STM32MP> dm tree
 Class     Index  Probed  Driver                Name
 -----------------------------------------------------------
 root          0  [ + ]   root_driver           root_driver
 firmware      0  [   ]   psci                  |-- psci
 sysreset      0  [   ]   psci-sysreset         |   `-- psci-sysreset
 simple_bus    0  [ + ]   generic_simple_bus    |-- soc
...
 tee           0  [ + ]   optee                 |-- optee
...
 tee           1  [   ]   optee                 `-- optee

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Tested-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: remove redundant assignment
Heinrich Schuchardt [Sat, 15 Feb 2020 20:46:04 +0000 (21:46 +0100)]
dm: core: remove redundant assignment

Variable count is initialized at the start of every round of the while
loop and it is not used after the while loop. So there is no need to
initialize it beforehand.

Identified by cppcheck.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: remove redundant if statement
Heinrich Schuchardt [Sat, 15 Feb 2020 20:38:48 +0000 (21:38 +0100)]
dm: core: remove redundant if statement

The value of parent is not changed in the first if statement. So we can
merge the two if statements depending on parent.

Indicated by cppcheck.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agosandbox: also restore terminal settings when killed by SIGINT
Rasmus Villemoes [Fri, 14 Feb 2020 10:58:37 +0000 (10:58 +0000)]
sandbox: also restore terminal settings when killed by SIGINT

Hitting Ctrl-C is a documented way to exit the sandbox, but it is not
actually equivalent to the reset command. The latter, since it follows
normal process exit, takes care to reset terminal settings and
restoring the O_NONBLOCK behaviour of stdin (and, in a terminal, that
is usually the same file description as stdout and stderr, i.e. some
/dev/pts/NN).

Failure to restore (remove) O_NONBLOCK from stdout/stderr can cause
very surprising and hard to debug problems back in the terminal. For
example, I had "make -j8" consistently failing without much
information about just exactly what went wrong, but sometimes I did
get a "echo: write error". I was at first afraid my disk was getting
bad, but then a simple "dmesg" _also_ failed with write error - so it
was writing to the terminal that was buggered. And both "make -j8" and
dmesg in another terminal window worked just fine.

So install a SIGINT handler so that if the chosen terminal
mode (cooked or raw-with-sigs) means Ctrl-C sends a SIGINT, we will
still call os_fd_restore(), then reraise the signal and die as usual
from SIGINT.

Before:

$ grep flags /proc/$$/fdinfo/1
flags:  0102002
$ ./u-boot
# hit Ctrl-C
$ grep flags /proc/$$/fdinfo/1
flags:  0106002

After:

$ grep flags /proc/$$/fdinfo/1
flags:  0102002
$ ./u-boot
# hit Ctrl-C
$ grep flags /proc/$$/fdinfo/1
flags:  0102002

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agosandbox: Update PCI nodes in dts files
Tom Rini [Tue, 11 Feb 2020 17:41:23 +0000 (12:41 -0500)]
sandbox: Update PCI nodes in dts files

The way the PCI nodes are written today causes a number of warnings if
we stop disabling some of the warnings we pass to DTC.  As these
warnings aren't disabled in current Linux Kernel builds, we should aim
to not disable them here either, so rewrite these slightly.  Update the
driver model doc as well.

Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agosandbox: p2sb: Silence compiler warning
Simon Glass [Sat, 8 Feb 2020 14:53:10 +0000 (07:53 -0700)]
sandbox: p2sb: Silence compiler warning

Some compilers produce a warning about 'child' being used before init.
Silence this by setting to NULL at the start.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agoserial: Set baudrate on boot
Sean Anderson [Sun, 2 Feb 2020 18:15:17 +0000 (13:15 -0500)]
serial: Set baudrate on boot

Currently, the baud rate is never set on boot. This works ok when a previous
bootloader has configured the baudrate properly, or when the baudrate is set to
a reasonable default in the serial driver's probe(). However, when this is not
the case, we could be using a different baud rate than what was configured.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
4 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-x86
Tom Rini [Thu, 16 Apr 2020 12:56:37 +0000 (08:56 -0400)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-x86

- Provide serial base clock speed via getinfo() for ACPI SPCR
- Initial ACPI support from DM core by leveraging existing ACPI support
  in x86

4 years agotest: Add hexdump.h to the unit test header
Simon Glass [Wed, 8 Apr 2020 22:57:40 +0000 (16:57 -0600)]
test: Add hexdump.h to the unit test header

Since ut_asserteq_mem() uses bin2hex() we should include this header in
ut.h to avoid errors. Add it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
4 years agoacpi: Add support for DMAR
Simon Glass [Wed, 8 Apr 2020 22:57:39 +0000 (16:57 -0600)]
acpi: Add support for DMAR

The DMA Remapping Reporting (DMAR) table contains information about DMA
remapping.

Add a version simple version of this table with only the minimum fields
filled out. i.e. no entries.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
4 years agoacpi: Add a central location for table version numbers
Simon Glass [Wed, 8 Apr 2020 22:57:38 +0000 (16:57 -0600)]
acpi: Add a central location for table version numbers

Each ACPI table has its own version number. Add the version numbers in a
single function so we can keep them consistent and easily see what
versions are supported.

Start a new acpi_table file in a generic directory to house this function.
We can move things over to this file from x86 as needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agoacpi: Add an __ACPI__ preprocessor symbol
Simon Glass [Wed, 8 Apr 2020 22:57:37 +0000 (16:57 -0600)]
acpi: Add an __ACPI__ preprocessor symbol

The ASL compiler cannot handle C structures and the like so needs some
sort of header guard around these.

We already have an __ASSEMBLY__ #define but it seems best to create a new
one for ACPI since the rules may be different.

Add the check to a few files that ACPI always includes.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>