]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
3 years agoARM: at91: spl: add spl_early_init for sama5d2 platforms
Greg Gallagher [Thu, 21 Jan 2021 16:55:36 +0000 (11:55 -0500)]
ARM: at91: spl: add spl_early_init for sama5d2 platforms

The dm root node is needed early in the spl to allow the timer to be
used.  This change calls spl_early_init to initialize the dm root node.

Signed-off-by: Greg Gallagher <greg@embeddedgreg.com>
3 years agoconfigs: sama5d27_som1_ek: Set FDT filename based on defconfig
Greg Gallagher [Thu, 21 Jan 2021 16:55:35 +0000 (11:55 -0500)]
configs: sama5d27_som1_ek: Set FDT filename based on defconfig

Make the FDT file name based on the default on that is specified in the
defconfig file.

Signed-off-by: Greg Gallagher <greg@embeddedgreg.com>
3 years agoboard: atmel: Add SAMA5D27 giant board
Greg Gallagher [Thu, 21 Jan 2021 16:55:34 +0000 (11:55 -0500)]
board: atmel: Add SAMA5D27 giant board

Giant board is a tiny SBC based on the Adafruit Feather form factor,
created by groboards it contains a SAMA5D2 processor (SAMA5D27),
128 MB of RAM and a microSD card for storage.

Signed-off-by: Greg Gallagher <greg@embeddedgreg.com>
3 years agonet: macb: take into account all RGMII interface types
Claudiu Beznea [Tue, 19 Jan 2021 11:26:48 +0000 (13:26 +0200)]
net: macb: take into account all RGMII interface types

Take into account all RGMII interface types. Depending on it
the RGMII PHY's timings are setup.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
3 years agonet: macb: add support for sama7g5 emac
Claudiu Beznea [Tue, 19 Jan 2021 11:26:47 +0000 (13:26 +0200)]
net: macb: add support for sama7g5 emac

Add support for SAMA7G5 EMAC.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
3 years agonet: macb: add support for sama7g5 gmac
Claudiu Beznea [Tue, 19 Jan 2021 11:26:46 +0000 (13:26 +0200)]
net: macb: add support for sama7g5 gmac

Add support for SAMA7G5 GMAC.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
3 years agonet: macb: check clk_set_rate return value to be negative
Claudiu Beznea [Tue, 19 Jan 2021 11:26:45 +0000 (13:26 +0200)]
net: macb: check clk_set_rate return value to be negative

clk_set_rate() returns the set rate in case of success and a
negative number in case of failure. Consider failure only the
negative numbers.

Fixes: 3ef64444de157 ("dm: net: macb: Implement link speed change callback")
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
3 years agonet: macb: add user io config data structure
Claudiu Beznea [Tue, 19 Jan 2021 11:26:44 +0000 (13:26 +0200)]
net: macb: add user io config data structure

Different implementation of USER IO register needs different
mapping for bit fields of this register. Add implementation
for this and, since clken is part of USER IO and it needs to
be activated based on per SoC capabilities, add caps in
macb_config where clken specific information needs to be filled.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
3 years agosam9x60.h: Fix Galois Field Table offsets
Kai Stuhlemmer (ebee Engineering) [Fri, 8 Jan 2021 12:40:20 +0000 (14:40 +0200)]
sam9x60.h: Fix Galois Field Table offsets

Because ATMEL_BASE_ROM is defined to 0x100000, it already points
to the begin of the index table for 512 byte sectors correction.
Thus its offset must be zero and the index of the table for 1024
byte sectors must start at offset 0x8000.

Signed-off-by: Kai Stuhlemmer (ebee Engineering) <kai.stuhlemmer@ebee.de>
[ta: update commit message]
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
3 years agosama5d3: Fix Galois Field Table offsets
Tudor Ambarus [Fri, 8 Jan 2021 12:40:19 +0000 (14:40 +0200)]
sama5d3: Fix Galois Field Table offsets

Offsets are described in the datasheet at section:
"11.4.4.2 NAND Flash Boot: PMECC Error Detection and Correction".

For testing I "injected" bit flips into u-boot NAND memory area,
and then read back. PMECC could not correct the errors. With the
offsets updated everything is fine.

Fixes: 3225f34e5c ("ARM: atmel: add sama5d3xek support")
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
3 years agoconfigs: at91: Fix wrong definitions for CONFIG_PMECC_CAP
Tudor Ambarus [Fri, 8 Jan 2021 12:40:18 +0000 (14:40 +0200)]
configs: at91: Fix wrong definitions for CONFIG_PMECC_CAP

When CONFIG_ATMEL_NAND_HW_PMECC is set, CONFIG_PMECC_CAP defaults
to the value of 2. At the conversion to Kconfig for the PMECC config
values, some boards/defconfigs were wrongly configured.
Update CONFIG_PMECC_CAP to the PMECC_CAP value before the conversion.

Fixes: 49ad40298c ("ARM: at91: Convert SPL_GENERATE_ATMEL_PMECC_HEADER to Kconfig")
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
3 years agoconfigs: at91: Fix the involuntarily disablement of NAND PMECC
Tudor Ambarus [Fri, 8 Jan 2021 12:40:17 +0000 (14:40 +0200)]
configs: at91: Fix the involuntarily disablement of NAND PMECC

SPL_GENERATE_ATMEL_PMECC_HEADER selects:
ATMEL_NAND_HWECC [=y] && ATMEL_NAND_HW_PMECC [=y].

With the removal of SPL_GENERATE_ATMEL_PMECC_HEADER,
ATMEL_NAND_HW_PMECC and ATMEL_NAND_HWECC were no longer
selected. Also, when the SPL_GENERATE_ATMEL_PMECC_HEADER was removed,
the configs were not updated using savedefconfig, thus the
'commit d168bcb6fe39 ("configs: Resync with savedefconfig")'
further removes the CONFIG_PMECC_CAP value.

Update defconfigs and add CONFIG_ATMEL_NAND_HW_PMECC,
which selects ATMEL_NAND_HWECC, in order to restore NAND PMECC
support. Restore CONFIG_PMECC_CAP value.

Fixes: 57f76c2a47 ("configs: at91: remove SPL_GENERATE_ATMEL_PMECC_HEADER from non-nand configs")
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
3 years agopinctrl: at91-pio4: implement drive strength support
Eugen Hristev [Tue, 5 Jan 2021 08:54:01 +0000 (10:54 +0200)]
pinctrl: at91-pio4: implement drive strength support

Implement drive strength support, by preserving the same bindings
as in Linux.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
3 years agopinctrl: at91-pio4: convert to dev_read_prop
Eugen Hristev [Tue, 5 Jan 2021 08:51:53 +0000 (10:51 +0200)]
pinctrl: at91-pio4: convert to dev_read_prop

Use dev_read_prop instead of using the fdt_read_property which
reads from the GD struct's fdt.
This way the node is accessed via the device config instead of the
global struct, which makes code more portable and GD independent.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
3 years agodt-bindings: pinctrl: at91-pio4: add property for drive strength
Eugen Hristev [Tue, 5 Jan 2021 08:50:06 +0000 (10:50 +0200)]
dt-bindings: pinctrl: at91-pio4: add property for drive strength

Add drive strength property which is equivalent with the one in Linux

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
3 years agodt-bindings: pinctrl: at91-pio4: update license to SPDX style
Eugen Hristev [Tue, 5 Jan 2021 08:49:10 +0000 (10:49 +0200)]
dt-bindings: pinctrl: at91-pio4: update license to SPDX style

Update license header to SPDX style

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
3 years agonet: phy: micrel: fix typo
Claudiu Beznea [Thu, 3 Dec 2020 09:18:31 +0000 (11:18 +0200)]
net: phy: micrel: fix typo

Fix typo.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
3 years agonet: phy: micrel: add support for DLL setup on ksz9131
Claudiu Beznea [Thu, 3 Dec 2020 09:18:30 +0000 (11:18 +0200)]
net: phy: micrel: add support for DLL setup on ksz9131

Add support for DLL setup on KSZ9131.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
3 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-sh
Tom Rini [Mon, 18 Jan 2021 17:37:55 +0000 (12:37 -0500)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-sh

- R-Car pinctrl updates

3 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv
Tom Rini [Mon, 18 Jan 2021 13:04:28 +0000 (08:04 -0500)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

- Update qemu-riscv.rst build instructions.
- Add support for SPI on Kendryte K210.
- Add Microchip PolarFire SoC Icicle Kit support.
- Add support for an early timer.
  - Select TIMER_EARLY to avoid infinite recursion for Trace.

3 years agoMerge tag 'doc-2021-04-rc1' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Mon, 18 Jan 2021 13:04:05 +0000 (08:04 -0500)]
Merge tag 'doc-2021-04-rc1' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi

Pull request for documentation tag doc-2021-04-rc1

* document man-page base command
* move README.fdt-overlays to HTML documentation
* add synopsis for pstore command

3 years agoMerge branch '2021-01-16-assorted-improvements'
Tom Rini [Mon, 18 Jan 2021 12:55:54 +0000 (07:55 -0500)]
Merge branch '2021-01-16-assorted-improvements'

- Assorted testing improvements and fixes
- Assorted code cleanups

3 years agoARM: dts: renesas: Remove leading 0x from rpc node
Lad Prabhakar [Sun, 29 Nov 2020 13:21:53 +0000 (13:21 +0000)]
ARM: dts: renesas: Remove leading 0x from rpc node

Remove the leading "0x" from rpc node to fix the below dtc warning:

Warning (simple_bus_reg): Node /soc/rpc@0xee200000 simple-bus unit
address format error, expected "ee200000"

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
3 years agopinctrl: renesas: Implement get_pin_muxing() callback
Lad Prabhakar [Sat, 28 Nov 2020 13:13:09 +0000 (13:13 +0000)]
pinctrl: renesas: Implement get_pin_muxing() callback

Implement get_pin_muxing() callback so that pinmux status
command can be used on Renesas platforms.

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: Make sure the pin type is updated after setting the MUX
Lad Prabhakar [Sat, 28 Nov 2020 13:13:08 +0000 (13:13 +0000)]
pinctrl: renesas: Make sure the pin type is updated after setting the MUX

By default on startup all the pin types are configured to
PINMUX_TYPE_NONE (in sh_pfc_map_pins()), when pin is set as GPIO the
pin type is updated to PINMUX_TYPE_GPIO. But the type is not updated
when the pin is set as a function in sh_pfc_pinctrl_pin_set() or
sh_pfc_pinctrl_group_set() calls (these calls only set the MUX if
the pin type is PINMUX_TYPE_NONE ie unused).

So with the current implementation pin functionality could be overwritten
silently, for example if the same pin is added for SPI and serial.

This patch makes sure of updating pin type after every successful call to
sh_pfc_config_mux() and thus fixing from pin functionality to be
overwritten. Also a warning message is printed if the current pin is being
overwritten before abort.

This also avoids pin re-muxing to same type that is for example from
command line device is asked to re-probe/select (mmc dev x) we return
early with success in this case as the pin is already muxed.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
3 years agodoc: board: Add Microchip MPFS Icicle Kit doc
Padmarao Begari [Fri, 15 Jan 2021 02:50:41 +0000 (08:20 +0530)]
doc: board: Add Microchip MPFS Icicle Kit doc

This doc describes the procedure to build, flash and
boot Linux using U-boot on Microchip MPFS Icicle Kit.

Signed-off-by: Padmarao Begari <padmarao.begari@microchip.com>
Reviewed-by: Anup Patel <anup.patel@wdc.com>
Reviewed-by: Bin Meng <bin.meng@windriver.com>
3 years agoriscv: Add Microchip MPFS Icicle Kit support
Padmarao Begari [Fri, 15 Jan 2021 02:50:40 +0000 (08:20 +0530)]
riscv: Add Microchip MPFS Icicle Kit support

This patch adds Microchip MPFS Icicle Kit support. For now, only
NS16550 Serial, Microchip clock, Cadence eMMC and MACB drivers are
enabled. The Microchip MPFS Icicle defconfig by default builds
U-Boot for S-Mode because U-Boot on Microchip PolarFire SoC will run
in S-Mode as payload of HSS + OpenSBI.

Signed-off-by: Padmarao Begari <padmarao.begari@microchip.com>
Reviewed-by: Anup Patel <anup.patel@wdc.com>
Reviewed-by: Bin Meng <bin.meng@windriver.com>
Tested-by: Bin Meng <bin.meng@windriver.com>
3 years agoriscv: dts: Add device tree for Microchip Icicle Kit
Padmarao Begari [Fri, 15 Jan 2021 02:50:39 +0000 (08:20 +0530)]
riscv: dts: Add device tree for Microchip Icicle Kit

Add device tree for Microchip PolarFire SoC Icicle Kit.

Signed-off-by: Padmarao Begari <padmarao.begari@microchip.com>
Reviewed-by: Anup Patel <anup.patel@wdc.com>
Reviewed-by: Bin Meng <bin.meng@windriver.com>
3 years agoclk: Add Microchip PolarFire SoC clock driver
Padmarao Begari [Fri, 15 Jan 2021 02:50:38 +0000 (08:20 +0530)]
clk: Add Microchip PolarFire SoC clock driver

Add clock driver code for the Microchip PolarFire SoC. This driver
handles reset and clock control of the Microchip PolarFire SoC device.

Signed-off-by: Padmarao Begari <padmarao.begari@microchip.com>
Reviewed-by: Anup Patel <anup.patel@wdc.com>
Tested-by: Bin Meng <bin.meng@windriver.com>
3 years agonet: macb: Add phy address to read it from device tree
Padmarao Begari [Fri, 15 Jan 2021 02:50:37 +0000 (08:20 +0530)]
net: macb: Add phy address to read it from device tree

Read phy address from device tree and use it to find the phy device
if not found then search in the range of 0 to 31.

Signed-off-by: Padmarao Begari <padmarao.begari@microchip.com>
Reviewed-by: Anup Patel <anup.patel@wdc.com>
Reviewed-by: Bin Meng <bin.meng@windriver.com>
Tested-by: Bin Meng <bin.meng@windriver.com>
3 years agonet: macb: Add DMA 64-bit address support for macb
Padmarao Begari [Fri, 15 Jan 2021 02:50:36 +0000 (08:20 +0530)]
net: macb: Add DMA 64-bit address support for macb

Enable 32-bit or 64-bit DMA in the macb driver based on the macb
hardware compatibility and it is configured with structure macb_config
in the driver.

The Microchip PolarFire SoC Memory Protection Unit(MPU) gives the 64-bit
DMA access with the GEM, the MPU transactions on the AXI bus is 64-bit
not 32-bit So 64-bit DMA is enabled for the Microchip PolarFire SoC GEM.

Signed-off-by: Padmarao Begari <padmarao.begari@microchip.com>
Reviewed-by: Anup Patel <anup.patel@wdc.com>
Tested-by: Bin Meng <bin.meng@windriver.com>
3 years agoriscv: Add DMA 64-bit address support
Padmarao Begari [Fri, 15 Jan 2021 02:50:35 +0000 (08:20 +0530)]
riscv: Add DMA 64-bit address support

dma_addr_t holds any valid DMA address. If the DMA API only uses 32/64-bit
addresses, dma_addr_t need only be 32/64 bits wide.

Signed-off-by: Padmarao Begari <padmarao.begari@microchip.com>
Reviewed-by: Anup Patel <anup.patel@wdc.com>
Reviewed-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Rick Chen <rick@andestech.com>
3 years agoriscv: timer: Add support for an early timer
Pragnesh Patel [Sun, 17 Jan 2021 12:41:25 +0000 (18:11 +0530)]
riscv: timer: Add support for an early timer

Added support for timer_early_get_count() and timer_early_get_rate()
This is mostly useful in tracing.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Rick Chen <rick@andestech.com>
3 years agotrace: select TIMER_EARLY to avoid infinite recursion
Pragnesh Patel [Sun, 17 Jan 2021 12:41:24 +0000 (18:11 +0530)]
trace: select TIMER_EARLY to avoid infinite recursion

When tracing functions is enabled this adds calls to
__cyg_profile_func_enter() and __cyg_profile_func_exit() to the traced
functions.

__cyg_profile_func_enter() and __cyg_profile_func_exit() invoke
timer_get_us() to record the entry and exit time.

initr_dm() will make gd->dm_root = NULL and gd->timer = NULL, so
timer_get_us() -> get_ticks() -> dm_timer_init() will lead to an
indefinite recursion.

So select TIMER_EARLY when tracing got enabled.

Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>
3 years agoriscv: Add support for SPI on Kendryte K210
Sean Anderson [Tue, 22 Dec 2020 23:57:18 +0000 (18:57 -0500)]
riscv: Add support for SPI on Kendryte K210

This enables configs necessary for using SPI. The environment is saved to
the very end of SPI flash. This is unlikely to be overwritten unless the
entire flash is reprogrammed.

This also supplies a default bootcommand. It loads an image and device tree
from the first partition of the MMC. This is a minimal/least effort
bootcmd, so suggestions (especially in the form of patches) are welcome. I
didn't set up distro boot because I think it is unlikely that any
general-purpose linux distros will ever be ported to this board.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Tested-by: Chrstopher Obbard <obbardc@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
3 years agodoc: qemu-riscv: Fix opensbi build instructions
Atish Patra [Tue, 22 Dec 2020 19:50:01 +0000 (11:50 -0800)]
doc: qemu-riscv: Fix opensbi build instructions

Latest opensbi uses generic platform for Qemu. Update the build
instructions.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Rick Chen <rick@andestech.com>
3 years agocmd: disk: Remove fit_print_contents API
Ravik Hasija [Fri, 8 Jan 2021 17:55:58 +0000 (09:55 -0800)]
cmd: disk: Remove fit_print_contents API

fit_print_contents prints similar fit information as printed in bootm stages.
Removing this API reduces redundancy & provides improvement in boottime.

Signed-off-by: Ravik Hasija <rahasij@linux.microsoft.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agolib: cosmetic update of CONFIG_LIB_ELF description
Patrick Delaunay [Mon, 4 Jan 2021 14:33:28 +0000 (15:33 +0100)]
lib: cosmetic update of CONFIG_LIB_ELF description

Change 2 typo error in CONFIG_LIB_ELF description:
- Supoort => Support
- fir => for

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agotest: unit test for pr_err(), pr_cont()
Heinrich Schuchardt [Mon, 4 Jan 2021 07:02:56 +0000 (08:02 +0100)]
test: unit test for pr_err(), pr_cont()

Provide a unit test for printing via pr_err() and pr_cont().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agolog: provide missing macros
Heinrich Schuchardt [Mon, 4 Jan 2021 07:02:54 +0000 (08:02 +0100)]
log: provide missing macros

With commit d094a0734cee ("log: allow for message continuation") we have
defined a special log level and category for message continuation. Let's
have a macro for using these.

If logging is enabled log_cont() will create a continuation log output with
the same logging level and category as the previous message.

If logging is not enabled, log_cont() will print like printf().

Provide macros for logging levels LOG_EMERG, LOG_ALERT, LOG_CRIT.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agolog: make debug_cond() function like
Heinrich Schuchardt [Mon, 4 Jan 2021 07:02:53 +0000 (08:02 +0100)]
log: make debug_cond() function like

Change debug_cond() such that it can be used instead of a function like
debug().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoram: k3-j721e: rename BIT_MASK()
Heinrich Schuchardt [Mon, 4 Jan 2021 07:02:52 +0000 (08:02 +0100)]
ram: k3-j721e: rename BIT_MASK()

The macro BIT_MASK is already defined in include/linux/bitops.h. To avoid
name collisions rename BIT_MASK() in drivers/ram/k3-j721e/lpddr4_private.h
to LPDDR4_BIT_MASK().

Remove superfluous parantheses.
Remove superfluous comparison to 0.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agomtd: misplaced log.h and dm/devres.h
Heinrich Schuchardt [Sun, 3 Jan 2021 15:10:45 +0000 (16:10 +0100)]
mtd: misplaced log.h and dm/devres.h

log.h and dm/devres.h are U-Boot includes. So placing them
behind #ifndef __UBOOT__ does not make any sense.

Fixes: f7ae49fc4f36 ("common: Drop log.h from common header")
Fixes: 61b29b826838 ("dm: core: Require users of devres to include the header")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agolib: zlib: our putc() takes only one argument
Heinrich Schuchardt [Mon, 28 Dec 2020 20:41:40 +0000 (21:41 +0100)]
lib: zlib: our putc() takes only one argument

In contrast to the C99 standard [1] our putc() takes only one argument.

[1] ISO/IEC 9899:1999

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agolib: zlib: include ctype.h
Heinrich Schuchardt [Mon, 28 Dec 2020 20:31:43 +0000 (21:31 +0100)]
lib: zlib: include ctype.h

Our ctype.h is in include/linux/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agolib: aes: build failure with DEBUG=1
Heinrich Schuchardt [Mon, 28 Dec 2020 16:56:27 +0000 (17:56 +0100)]
lib: aes: build failure with DEBUG=1

Building fails with DEBUG=1:

lib/aes.c: In function ‘debug_print_vector’:
lib/aes.c:622:45: error:
cast from pointer to integer of different size
[-Werror=pointer-to-int-cast]
  622 |  printf("%s [%d] @0x%08x", name, num_bytes, (u32)data);

Pointers can only be cast to (uintptr_t). But anyway we have
%p for printing pointers.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoarmv8: Makefile: build cache files when needed
Peng Fan [Mon, 28 Dec 2020 12:13:13 +0000 (20:13 +0800)]
armv8: Makefile: build cache files when needed

If no need cache support, not build the cache files, such as in SPL.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
3 years agocommon: Makefile: drop duplicated line
Peng Fan [Mon, 28 Dec 2020 12:13:11 +0000 (20:13 +0800)]
common: Makefile: drop duplicated line

obj-$(CONFIG_$(SPL_TPL_)YMODEM_SUPPORT) += xyzModem.o is there,
no need obj-$(CONFIG_SPL_YMODEM_SUPPORT) += xyzModem.o

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agodts: Log name of expected .dtb file
Florian Klink [Sun, 27 Dec 2020 20:34:43 +0000 (21:34 +0100)]
dts: Log name of expected .dtb file

Make it more obvious what .dts file was expected by the build system.

When adding support for a new board, I kept getting this error message,
assuming I passed a wrong DEVICE_TREE parameter.

However, what was really the mistake was that the entry in
`arch/arm/dts/Makefile` was missing, and u-boot didn't like not being
able to find the .dtb file that should have been produced.

Simply logging the expected .dtb file name should make it easier to spot
such mistakes.

Signed-off-by: Florian Klink <flokli@flokli.de>
3 years agobootmenu: Allow to quit it via ESC/CTRL+C
Pali Rohár [Sun, 27 Dec 2020 00:04:38 +0000 (01:04 +0100)]
bootmenu: Allow to quit it via ESC/CTRL+C

When ESC/CTRL+C is pressed interrupt bootmenu and jump into U-Boot console.
As the last entry in bootmenu is always U-Boot console just choose the last
entry when ESC or CTRL+C is pressed.

ESC key is detected when either no other character appears after '\e'
within 10ms or when non-'[' appears after '\e'.

It is useful when bootmenu is part of boot process and you want to
interrupt boot process by scripts which control U-Boot (serial) console.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agostring: Use memcpy() within memmove() when we can
Patrick Delaunay [Fri, 11 Dec 2020 13:59:23 +0000 (14:59 +0100)]
string: Use memcpy() within memmove() when we can

A common use of memmove() can be handled by memcpy(). Also memcpy()
includes an optimization for large sizes: it copies a word at a time. So
we can get a speed-up by calling memcpy() to handle our move in this case.

Update memmove() to call also memcpy() if the source don't overlap
the destination (src + count <= dest).

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agodrivers: serial: probe all uart devices
Vabhav Sharma [Wed, 9 Dec 2020 05:12:04 +0000 (10:42 +0530)]
drivers: serial: probe all uart devices

U-Boot DM model probe only single device at a time
which is enabled and configured using device tree
or platform data method.

PL011 UART IP is SBSA compliant and firmware does the
serial port set-up, initialization and let the kernel use
UART port for sending and receiving characters.

Normally software talk to one serial port time but some
LayerScape platform require all the UART devices enabled
in Linux for various use case.

Adding support to probe all enabled serial devices like SBSA
compliant PL011 UART ports probe and initialization by firmware.

Signed-off-by: Vabhav Sharma <vabhav.sharma@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
3 years agodm: core: add function uclass_probe_all() to probe all devices
Vabhav Sharma [Wed, 9 Dec 2020 05:12:03 +0000 (10:42 +0530)]
dm: core: add function uclass_probe_all() to probe all devices

Support a common method to probe all devices associated with uclass.

This includes data structures and code for finding the first device and
looping for remaining devices associated with uclasses (groups of devices
with the same purpose, e.g. all SERIAL ports will be in the same uclass).

An example is SBSA compliant PL011 UART IP, where firmware does the serial
port initialization and prepare uart device to let the kernel use it for
sending and reveiving the characters.SERIAL uclass will use this function
to initialize PL011 UART ports.

The feature is enabled with CONFIG_DM.

Signed-off-by: Vabhav Sharma <vabhav.sharma@nxp.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
3 years agoconsole: cosmetics: remove #if 0
Patrick Delaunay [Wed, 2 Dec 2020 14:16:13 +0000 (15:16 +0100)]
console: cosmetics: remove #if 0

Remove the #if 0 present since the first version of console.c

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agocommon: always compile fixup_cmdtable()
Heinrich Schuchardt [Thu, 26 Nov 2020 19:46:37 +0000 (20:46 +0100)]
common: always compile fixup_cmdtable()

With our optimization settings the linker eliminates unused functions.

But for debugging it is better to compile with -Og or -O0. With -O0
compiling the sandbox fails due to the missing function fixup_cmdtable()
called by dm_reloc() and others.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agocommon: spl: spl_fit.c: report an error on hash check fail
Philippe Reynes [Tue, 24 Nov 2020 15:15:05 +0000 (16:15 +0100)]
common: spl: spl_fit.c: report an error on hash check fail

When the hash check fails on a loadable image, the SPL/TPL simply
jump to the next one. This commit changes this behaviour, when the
hash check fails on a loadable image, the function spl_load_simple_fit
stops and report an error.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agocli_readline: Only insert printable chars
Steve Bennett [Sun, 22 Nov 2020 04:58:45 +0000 (14:58 +1000)]
cli_readline: Only insert printable chars

There should be no need to insert non-printable characters
and this prevents line editing getting confused.

Signed-off-by: Steve Bennett <steveb@workware.net.au>
3 years agoAdd optional salt to AUTOBOOT_STOP_STR_SHA256
Joel Peshkin [Sun, 22 Nov 2020 01:18:59 +0000 (17:18 -0800)]
Add optional salt to AUTOBOOT_STOP_STR_SHA256

Adds an optional SALT value to AUTOBOOT_STOP_STR_SHA256.   If a string
followed by a ":" is prepended to the sha256, the portion to the left
of the colon will be used as a salt and the password will be appended
to the salt before the sha256 is computed and compared.

Signed-off-by: Joel Peshkin <joel.peshkin@broadcom.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Joel Peshkin <joel.peshkin@broadcom.com>
To: u-boot@lists.denx.de
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
3 years agodoc/README.gpt: reflow partition type GUID table
Rasmus Villemoes [Fri, 20 Nov 2020 10:45:37 +0000 (11:45 +0100)]
doc/README.gpt: reflow partition type GUID table

The previous patch made the table look bad. Fix it, and leave some
space for a future element being a bit longer than the current
maximum.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
3 years agodoc/README.gpt: define partition type GUID for U-Boot environment
Rasmus Villemoes [Fri, 20 Nov 2020 10:45:36 +0000 (11:45 +0100)]
doc/README.gpt: define partition type GUID for U-Boot environment

When setting aside a GPT partition for holding the U-Boot environment,
having a partition type GUID [1] indicating "Linux filesystem" (as
most tools default to) is somewhat misleading - and there's no other
well-known type GUID that is better suited. So to have a canonical
value to put into the type field, define

    3de21764-95bd-54bd-a5c3-4abe786f38a8

to mean a partition holding a U-Boot environment.

This is a v5 namespace-name GUID [2], generated [3] from a namespace
of "25cbcde0-8642-47c6-a298-1a3a57cd256b" and name "U-Boot
environment".

Should future type GUIDs be defined in the context of U-Boot, it's
sensible to use that same namespace GUID.

[1] https://en.wikipedia.org/wiki/GUID_Partition_Table#Partition_type_GUIDs
[2] https://en.wikipedia.org/wiki/Universally_unique_identifier#Versions_3_and_5_(namespace_name-based)
[3] https://www.uuidtools.com/v5

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
3 years agolib/uuid.c: change prototype of uuid_guid_get_str()
Rasmus Villemoes [Fri, 20 Nov 2020 10:45:35 +0000 (11:45 +0100)]
lib/uuid.c: change prototype of uuid_guid_get_str()

There's no reason to require an appropriately sized output parameter
for the string, that's error-prone should the table ever grow an
element with a longer string. We can just return the const char*
pointer directly.

Update the only caller accordingly, and get rid of pointless ifdeffery
in the header so that the compiler always sees a declaration and can
thus do type-checking, whether or not PARTITION_TYPE_GUID is enabled
or not.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
3 years agopower: regulator: Kconfig: add a dependency for POWER_SUPPORT for SPL
Nishanth Menon [Fri, 20 Nov 2020 04:10:54 +0000 (22:10 -0600)]
power: regulator: Kconfig: add a dependency for POWER_SUPPORT for SPL

power/regulator will not be built if just CONFIG_SPL_DM_REGULATOR is
enabled. It needs CONFIG_SPL_POWER_SUPPORT to be enabled as well.

For example, if we just need a GPIO regulator in SPL:
CONFIG_DM_REGULATOR=y
CONFIG_SPL_DM_REGULATOR=y
CONFIG_DM_REGULATOR_GPIO=y
CONFIG_SPL_DM_REGULATOR_GPIO=y

Will not suffice, since the entire regulator build for SPL depends on
CONFIG_SPL_POWER_SUPPORT. Elaborate that information in the Kconfig
dependency.

Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agotest: correct the test prefix in ut str
Patrick Delaunay [Thu, 19 Nov 2020 09:08:43 +0000 (10:08 +0100)]
test: correct the test prefix in ut str

Align the prefix used in cmd_ut_category function and name of tests
for ut str.
This patch solves the issues detected by "make qcheck" after previous
patch.

Fixes: fdc79a6b125d ("lib: Add a function to convert a string to upper case")
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agotest: correct the test prefix in ut cmd_mem
Patrick Delaunay [Thu, 19 Nov 2020 09:08:42 +0000 (10:08 +0100)]
test: correct the test prefix in ut cmd_mem

Align the prefix used in cmd_ut_category function and name of tests
for ut mem.
This patch solves the issues detected by "make qcheck" after previous
patch.

Fixes: 550a9e7902ce ("cmd: Update the memory-search command")
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agotest: Only enable bloblist test when supported
Simon Glass [Mon, 9 Nov 2020 04:08:44 +0000 (21:08 -0700)]
test: Only enable bloblist test when supported

This test cannot work unless CONFIG_BLOBLIST is enabled. Update it to add
that condition.

Reported-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agotest: Avoid assuming sandbox board for bloblist test
Simon Glass [Mon, 9 Nov 2020 04:08:43 +0000 (21:08 -0700)]
test: Avoid assuming sandbox board for bloblist test

This tests assumes it is running on sandbox. Add a few functions to handle
silencing the console on any board and use those instead.

Reported-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agocmd: gpt: add eMMC and GPT support
Corneliu Doban [Mon, 9 Nov 2020 06:19:16 +0000 (11:49 +0530)]
cmd: gpt: add eMMC and GPT support

Add eMMC and GPT support.
- GPT partition list and command to create the GPT added to u-boot
  environment
- eMMC boot commands added to u-boot environment
- new gpt commands (enumarate and setenv) that are used by broadcom
  update scripts and boot commands
- eMMC specific u-boot configurations with environment saved in eMMC
  and GPT support

Signed-off-by: Corneliu Doban <cdoban@broadcom.com>
Signed-off-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com>
[trini: Make gpt_setenv initialize ret to -1, given relevant return
        error values]
Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoKconfig: simple panel requires backlight
Marcin Juszkiewicz [Thu, 5 Nov 2020 16:30:26 +0000 (17:30 +0100)]
Kconfig: simple panel requires backlight

During build of simple panel driver backlight is needed so let's enable
it:

aarch64-linux-gnu-ld.bfd: drivers/built-in.o: in function `simple_panel_set_backlight':
u-boot/drivers/video/simple_panel.c:43: undefined reference to `backlight_set_brightness'
aarch64-linux-gnu-ld.bfd: drivers/built-in.o: in function `simple_panel_enable_backlight':
u-boot/drivers/video/simple_panel.c:28: undefined reference to `backlight_enable'

Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl>
3 years agocmd: CMD_CPU depends on CPU
Heinrich Schuchardt [Wed, 4 Nov 2020 23:29:11 +0000 (00:29 +0100)]
cmd: CMD_CPU depends on CPU

Compiling with CONFIG_CMD_CPU=y and CONFIG_CPU=n fails with:

aarch64-linux-gnu-ld.bfd: cmd/built-in.o: in function `print_cpu_list':
/home/user/u-boot/cmd/cpu.c:34: undefined reference to `cpu_get_desc'
aarch64-linux-gnu-ld.bfd:
/home/user/u-boot/cmd/cpu.c:39: undefined reference to `cpu_get_info'
Segmentation fault (core dumped)
make: *** [Makefile:1757: u-boot] Error 139
make: *** Deleting file 'u-boot'

See error report in https://stackoverflow.com/questions/64678347.

Add the missing build dependency.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agotest: test/lib/test_print.c depends on CONSOLE_RECORD
Heinrich Schuchardt [Thu, 5 Nov 2020 00:29:06 +0000 (01:29 +0100)]
test: test/lib/test_print.c depends on CONSOLE_RECORD

The tests in test/lib/test_print.c fail without CONFIG_CONSOLE_RECORD=y.

Add a build dependency.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoMerge branch '2021-01-15-assorted-improvements'
Tom Rini [Sat, 16 Jan 2021 16:14:21 +0000 (11:14 -0500)]
Merge branch '2021-01-15-assorted-improvements'

- Add MBR partition layout writing supporting, clean up code.
- A large number of assorted console/iomux cleanups
- A large number of board_r related cleanups.
- Log enhancements

3 years agodoc: sifive: fu540: fix heading levels
Heinrich Schuchardt [Thu, 31 Dec 2020 23:37:05 +0000 (00:37 +0100)]
doc: sifive: fu540: fix heading levels

Two sibling headings cannot have the same name.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agodoc: move README.fdt-overlays to HTML documentation
Heinrich Schuchardt [Thu, 31 Dec 2020 15:43:37 +0000 (16:43 +0100)]
doc: move README.fdt-overlays to HTML documentation

Convert doc/README.fdt-overlays to doc/usage/fdt_overlays.rst.

Edit the text for readability.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agodoc: board: fix README.b4860qds
Heinrich Schuchardt [Thu, 31 Dec 2020 23:31:37 +0000 (00:31 +0100)]
doc: board: fix README.b4860qds

Two sibling headings can never be the same.

Fix the heading levels.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
3 years agodoc: add synopsis for pstore command
Heinrich Schuchardt [Thu, 31 Dec 2020 14:58:20 +0000 (15:58 +0100)]
doc: add synopsis for pstore command

Add a synopsis section.

Use lower case for command name.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agodoc: man-page base command
Heinrich Schuchardt [Thu, 31 Dec 2020 14:42:05 +0000 (15:42 +0100)]
doc: man-page base command

Provide a description of the base command.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agocmd: Add MBR partition layout control utility
Marek Szyprowski [Wed, 23 Dec 2020 12:55:15 +0000 (13:55 +0100)]
cmd: Add MBR partition layout control utility

Add a 'mbr' command to let users create or verify MBR partition layout
based on the provided text description. The partition layout is
alternatively read from the 'mbr_parts' environment variable. This can be
used in scripts to help system image flashing tools to ensure proper
partition layout.

The syntax of the text description of the partition list is similar to
the one used by the 'gpt' command. Supported parameters are: name
(currently ignored), start (partition start offset in bytes), size (in
bytes or '-' to expand it to the whole free area), bootable (boolean
flag) and id (MBR partition type). If one wants to create more than 4
partitions, an 'Extended' primary partition (with 0x05 ID) has to be
explicitely provided as a one of the first 4 entries.

Here is an example how to create a 6 partitions (3 on the 'extended
volume'), some of the predefined sizes:

> setenv mbr_parts 'name=boot,start=4M,size=128M,bootable,id=0x0e;
  name=rootfs,size=3072M,id=0x83;
  name=system-data,size=512M,id=0x83;
  name=[ext],size=-,id=0x05;
  name=user,size=-,id=0x83;
  name=modules,size=100M,id=0x83;
  name=ramdisk,size=8M,id=0x83'
> mbr write mmc 0

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
3 years agodisk: dos: add code for creating MBR partition layout
Marek Szyprowski [Wed, 23 Dec 2020 12:55:14 +0000 (13:55 +0100)]
disk: dos: add code for creating MBR partition layout

Add a code for creating and writing MBR partition layout. The code generates
similar layout of EBRs (Exteneded Block Records) and logical volumes as
Linux's fdisk utility.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
3 years agodisk: dos: make some functions static
Marek Szyprowski [Wed, 23 Dec 2020 12:55:13 +0000 (13:55 +0100)]
disk: dos: make some functions static

Make functions not used outside this file static.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
[trini: Use __maybe_unused as there are cases they may not be used]
Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agodisk: dos: use generic macro for unaligned le32 access
Marek Szyprowski [Wed, 23 Dec 2020 12:55:12 +0000 (13:55 +0100)]
disk: dos: use generic macro for unaligned le32 access

Use a generic helper for reading LE32 integers.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
3 years agodisk: dos: add some defines for the hardcoded numbers
Marek Szyprowski [Wed, 23 Dec 2020 12:55:11 +0000 (13:55 +0100)]
disk: dos: add some defines for the hardcoded numbers

Add some handy defines for some hardcoded magic numbers related to
extended partition handling.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
3 years agodisk: dos: rename write_mbr_partition to write_mbr_sector
Marek Szyprowski [Wed, 23 Dec 2020 12:55:10 +0000 (13:55 +0100)]
disk: dos: rename write_mbr_partition to write_mbr_sector

write_mbr_partition() function name is a bit misleading, so rename it to
write_mbr_sector(). This is a preparation for adding code for writing a
complete MBR partition layout.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
3 years agoIOMUX: Stop dropped consoles
Andy Shevchenko [Mon, 21 Dec 2020 12:30:08 +0000 (14:30 +0200)]
IOMUX: Stop dropped consoles

When at some point environment shrinks we need to stop dropped devices.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoIOMUX: Drop indentation level by removing redundant 'else'
Andy Shevchenko [Mon, 21 Dec 2020 12:30:07 +0000 (14:30 +0200)]
IOMUX: Drop indentation level by removing redundant 'else'

Obviously the following has unnecessary indentation level in 'else' branch.

if (foo) {
...
return;
} else {
...
}

Drop indentation level by removing redundant 'else'.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoIOMUX: Refactor iomux_doenv() in order to increase readability
Andy Shevchenko [Mon, 21 Dec 2020 12:30:06 +0000 (14:30 +0200)]
IOMUX: Refactor iomux_doenv() in order to increase readability

Refactor iomux_doenv() a bit in order to increase readability.
There is no change in code generation on x86.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoIOMUX: Preserve console list if realloc() fails
Andy Shevchenko [Mon, 21 Dec 2020 12:30:05 +0000 (14:30 +0200)]
IOMUX: Preserve console list if realloc() fails

It's realloc() 101 to avoid `foo = realloc(foo, ...);` call
due to getting a memory leak.

Actually it's not clear why realloc() has been used here.
If we shrink the array, the memcpy() overwrites it anyway
with the contents of a new array. If it becomes bigger,
same story.

Drop useless realloc() for good and thus preserve console list
in case of failed allocation.

Fixes: 16a28ef219c2 ("IOMUX: Add console multiplexing support.")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoconsole: Provide a documentation for console_search_dev()
Andy Shevchenko [Mon, 21 Dec 2020 12:30:04 +0000 (14:30 +0200)]
console: Provide a documentation for console_search_dev()

Provide a documentation for console_search_dev().

Suggested-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
3 years agoconsole: rename search_device() to console_search_dev()
Andy Shevchenko [Mon, 21 Dec 2020 12:30:03 +0000 (14:30 +0200)]
console: rename search_device() to console_search_dev()

Rename search_device() to console_search_dev() since it's in console.h.

Suggested-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoconsole: move search_device() from iomux.h to console.h
Andy Shevchenko [Mon, 21 Dec 2020 12:30:02 +0000 (14:30 +0200)]
console: move search_device() from iomux.h to console.h

search_device() is defined in console.c. Move its declaration
to an appropriate header file.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoconsole: Keep ->start() and ->stop() balanced
Andy Shevchenko [Mon, 21 Dec 2020 12:30:01 +0000 (14:30 +0200)]
console: Keep ->start() and ->stop() balanced

There is no need to call ->start() for already started device. All the same,
there is no need to call ->stop() for devices still in use.

For now enforce this only for IOMUX case.

Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoconsole: Introduce console_start() and console_stop()
Andy Shevchenko [Mon, 21 Dec 2020 12:30:00 +0000 (14:30 +0200)]
console: Introduce console_start() and console_stop()

In the future we would like to stop unused consoles and
also add a reference counting to avoid imbalanced calls
to ->start() and ->stop() in some cases.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoconsole: add console_has_tstc helper function for CONSOLE_MUX
Patrick Delaunay [Fri, 18 Dec 2020 11:46:46 +0000 (12:46 +0100)]
console: add console_has_tstc helper function for CONSOLE_MUX

Add the helper function console_has_tstc() and replace the test
#if CONFIG_IS_ENABLED(CONSOLE_MUX) to a simple 'if' test to
respect the U-Boot coding rule.

No functional change.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoconsole: remove #ifdef CONFIG_CONSOLE_RECORD
Patrick Delaunay [Fri, 18 Dec 2020 11:46:45 +0000 (12:46 +0100)]
console: remove #ifdef CONFIG_CONSOLE_RECORD

Add helper functions to access to gd->console_out and gd->console_in
with membuff API and replace the #ifdef CONFIG_CONSOLE_RECORD test
by if (IS_ENABLED(CONFIG_CONSOLE_RECORD)) to respect the U-Boot
coding rule.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoconsole: add function console_devices_set
Patrick Delaunay [Fri, 18 Dec 2020 11:46:44 +0000 (12:46 +0100)]
console: add function console_devices_set

Add a new function to access to console_devices only defined if
CONFIG_IS_ENABLED(CONSOLE_MUX).

This path allows to remove #if CONFIG_IS_ENABLED(CONSOLE_MUX)
in console_getc function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agoconsole: remove #ifdef CONFIG when it is possible
Patrick Delaunay [Fri, 18 Dec 2020 11:46:43 +0000 (12:46 +0100)]
console: remove #ifdef CONFIG when it is possible

Remove #ifdef or #ifndef for CONFIG when it is possible to simplify
the console.c code and respect the U-Boot coding rules.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoglobal_data: Enable spl_handoff only if CONFIG_HANDOFF is set
Ovidiu Panait [Sat, 28 Nov 2020 08:43:20 +0000 (10:43 +0200)]
global_data: Enable spl_handoff only if CONFIG_HANDOFF is set

spl_handoff should only be enabled when CONFIG_HANDOFF is set. Drop the
nested ifdefs and check for CONFIG_HANDOFF instead.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agospl: Kconfig: Add SPL dependency to CONFIG_HANDOFF
Ovidiu Panait [Sat, 28 Nov 2020 08:43:19 +0000 (10:43 +0200)]
spl: Kconfig: Add SPL dependency to CONFIG_HANDOFF

CONFIG_HANDOFF is used in u-boot proper to locate handoff info from SPL
during pre-relocation init (in setup_spl_handoff). Add explicit dependency
on CONFIG_SPL, to fix the following build error when CONFIG_HANDOFF &&
!CONFIG_SPL:

common/board_f.c: In function ‘setup_spl_handoff’:
common/board_f.c:283:4: error: ‘gd_t {aka struct global_data}’
has no member named ‘spl_handoff’
  gd->spl_handoff = bloblist_find(BLOBLISTT_SPL_HANDOFF,
    ^~

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agocommon: board_r: Drop arch-specific ifdefs around initr_trap
Ovidiu Panait [Sat, 28 Nov 2020 08:43:18 +0000 (10:43 +0200)]
common: board_r: Drop arch-specific ifdefs around initr_trap

In order to remove the arch-specific ifdefs around initr_trap, introduce
arch_initr_trap weak initcall. Implementations for ppc/m68k/mips have
been moved to arch/<arch>/lib/traps.c

Default implementation is a nop stub.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
3 years agocommon: board_r: Drop initr_bbmii wrapper
Ovidiu Panait [Sat, 28 Nov 2020 08:43:17 +0000 (10:43 +0200)]
common: board_r: Drop initr_bbmii wrapper

Add a return value to bb_miiphy_init and use it directly in the
post-relocation init sequence, rather than using a wrapper stub.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agocommon: board_r: Drop initr_api wrapper
Ovidiu Panait [Sat, 28 Nov 2020 08:43:16 +0000 (10:43 +0200)]
common: board_r: Drop initr_api wrapper

Add a return value to api_init and use it directly in the
post-relocation init sequence, rather than using a wrapper stub.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>