]> git.baikalelectronics.ru Git - uboot.git/log
uboot.git
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 1554a5f5ade5 ("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: 1459b1520336 ("common: Drop log.h from common header")
Fixes: aa6e2886b4c1 ("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: 042148c1d1ea ("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: 067bdef465e9 ("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 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>
3 years agocommon: board_r: Drop initr_jumptable wrapper
Ovidiu Panait [Sat, 28 Nov 2020 08:43:15 +0000 (10:43 +0200)]
common: board_r: Drop initr_jumptable wrapper

Add a return value to jumptable_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_xen wrapper
Ovidiu Panait [Sat, 28 Nov 2020 08:43:14 +0000 (10:43 +0200)]
common: board_r: Drop initr_xen wrapper

Add a return value to xen_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_noncached wrapper
Ovidiu Panait [Sat, 28 Nov 2020 08:43:13 +0000 (10:43 +0200)]
common: board_r: Drop initr_noncached wrapper

Add a return value to noncached_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_pci wrapper
Ovidiu Panait [Sat, 28 Nov 2020 08:43:12 +0000 (10:43 +0200)]
common: board_r: Drop initr_pci wrapper

Add a return value to pci_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_pci_ep wrapper
Ovidiu Panait [Sat, 28 Nov 2020 08:43:11 +0000 (10:43 +0200)]
common: board_r: Drop initr_pci_ep wrapper

Add a return value to pci_ep_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_post_backlog wrapper
Ovidiu Panait [Sat, 28 Nov 2020 08:43:10 +0000 (10:43 +0200)]
common: board_r: Drop initr_post_backlog wrapper

Add a return value to post_output_backlog 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_secondary_cpu wrapper
Ovidiu Panait [Sat, 28 Nov 2020 08:43:09 +0000 (10:43 +0200)]
common: board_r: Drop initr_secondary_cpu wrapper

Add a return value to cpu_secondary_init_r 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_console_record wrapper
Ovidiu Panait [Sat, 28 Nov 2020 08:43:08 +0000 (10:43 +0200)]
common: board_r: Drop initr_console_record wrapper

Drop initr_console_record wrapper and call console_record_init directly.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agocommon: board_f: Use IS_ENABLED(CONFIG_OF_EMBED) in reserve_fdt, reloc_fdt
Ovidiu Panait [Sat, 28 Nov 2020 08:43:07 +0000 (10:43 +0200)]
common: board_f: Use IS_ENABLED(CONFIG_OF_EMBED) in reserve_fdt, reloc_fdt

Use IS_ENABLED(CONFIG_OF_EMBED) in instead of #ifdefs in reserve_fdt,
reloc_fdt functions.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agocommon: board_f: Move setup_machine code to setup_bdinfo
Ovidiu Panait [Sat, 28 Nov 2020 08:43:06 +0000 (10:43 +0200)]
common: board_f: Move setup_machine code to setup_bdinfo

setup_bdinfo is used to populate various bdinfo fields, so move
setup_machine code there, as all it does is setting
gd->bd->bi_arch_number.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agocommon: board_f: Use IS_ENABLED(CONFIG_TIMER_EARLY) in initf_dm
Ovidiu Panait [Sat, 28 Nov 2020 08:43:05 +0000 (10:43 +0200)]
common: board_f: Use IS_ENABLED(CONFIG_TIMER_EARLY) in initf_dm

Use IS_ENABLED(CONFIG_TIMER_EARLY) instead of #ifdef in initf_dm. Also,
move timer code to the main ifdef, so that ret is defined.

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

Drop initf_console_record wrapper and call console_record_init directly.

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

Currently, the following #ifdef construct is used to check whether to run
console_record_init() during pre-relocation init:
 defined(CONFIG_CONSOLE_RECORD) && CONFIG_VAL(SYS_MALLOC_F_LEN)

Introduce CONFIG_CONSOLE_RECORD_INIT_F Kconfig option to get rid of the
complex ifdef check. Also, use IS_ENABLED() instead of #ifdef.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agolog: call vsnprintf only when it is needed to emit trace
Patrick Delaunay [Fri, 27 Nov 2020 10:20:59 +0000 (11:20 +0100)]
log: call vsnprintf only when it is needed to emit trace

Reduce the log overhead when the traces are filtered,
by moving the vsnprintf call from _log() to log_dispatch().

This patch avoids the printf treatment when LOG features is
activated, but trace is filtered, for example when
MAX_LOG_LEVEL=8 and LOG_DEFAULT_LEVEL=6.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
3 years agotest: log: add test for console output of dropped messages
Patrick Delaunay [Fri, 27 Nov 2020 10:20:58 +0000 (11:20 +0100)]
test: log: add test for console output of dropped messages

Add a new test to check the content of the dropped messages
sent to console puts function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoconsole: allow to record console output before ready
Patrick Delaunay [Fri, 27 Nov 2020 10:20:57 +0000 (11:20 +0100)]
console: allow to record console output before ready

Allow to record the console output before before U-Boot
has a console ready.

This patch allows to test the console output in sandbox test
based on console record.

It is possible because GD_FLG_RECORD and GD_FLG_SERIAL_READY
are 2 independent flags.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoconsole: remove duplicated test on gd value
Patrick Delaunay [Fri, 27 Nov 2020 10:20:56 +0000 (11:20 +0100)]
console: remove duplicated test on gd value

Reorder test on gd value and remove the duplicated test (!gd)
in putc and puts function.

This patch is a preliminary step for rework of this function.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agotest: add test for dropped trace before log_init
Patrick Delaunay [Fri, 27 Nov 2020 10:20:55 +0000 (11:20 +0100)]
test: add test for dropped trace before log_init

Add test for dropped trace before log_init, displayed by debug uart.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agolog: use console puts to output trace before LOG init
Patrick Delaunay [Fri, 27 Nov 2020 10:20:54 +0000 (11:20 +0100)]
log: use console puts to output trace before LOG init

Use the console puts functions to output the traces before
the log initialization (when CONFIG_LOG is not activated).

This patch allows to display the first U-Boot traces
(with macro debug) when CONFIG_DEBUG_UART is activated
and not only drop them.

For example for traces in board_f.c requested by the macro debug,
when LOG_DEBUG is defined and CONFIG_LOG is activated.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
3 years agotest: log: add test for dropped messages
Patrick Delaunay [Fri, 27 Nov 2020 10:20:53 +0000 (11:20 +0100)]
test: log: add test for dropped messages

Add a new test to check the dropped messages when LOG is not ready
with log_drop_count and the result of _log().

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agolog: don't build the trace buffer when log is not ready
Patrick Delaunay [Fri, 27 Nov 2020 10:20:52 +0000 (11:20 +0100)]
log: don't build the trace buffer when log is not ready

Update _log function to drop any traces when log is yet initialized:
vsnprintf is no more executed in this case.

This patch allows to reduce the cost for the dropped early debug trace.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
3 years agotest: add LOGL_FORCE_DEBUG flags support in log tests
Patrick Delaunay [Fri, 27 Nov 2020 10:20:51 +0000 (11:20 +0100)]
test: add LOGL_FORCE_DEBUG flags support in log tests

Add a check of the _log function with LOGL_FORCE_DEBUG flags,
used to force the trace display.

The trace should be displayed for all the level when flags
have LOGL_FORCE_DEBUG bit is set, for any filter.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agodm: fix build errors generated by last merges
Dario Binacchi [Fri, 15 Jan 2021 08:10:26 +0000 (09:10 +0100)]
dm: fix build errors generated by last merges

Something was wrong in the merge process into the mainline.
Some added patches access driver structure fields and functions that
have been modified by previous patches.
The patch renames:
 - dev_get_platdata to dev_get_plat
 - dev_get_uclass_platdata to dev_get_uclass_plat
 - ofdata_to_platdata to of_to_plat
 - plat_data_alloc_size to plat_auto
 - priv_auto_alloc_size to priv_auto
 - video_uc_platdata to video_uc_plat

Signed-off-by: Dario Binacchi <dariobin@libero.it>
3 years agoMerge branch '2021.04-rc' of https://github.com/lftan/u-boot
Tom Rini [Fri, 15 Jan 2021 12:23:50 +0000 (07:23 -0500)]
Merge branch '2021.04-rc' of https://github.com/lftan/u-boot

- Add ATF flow for SoC64 devices
- Update socfpgaimage to support print header and update padding flow

3 years agotools: socfpgaimage: update padding flow
Ley Foon Tan [Wed, 13 Jan 2021 10:53:05 +0000 (18:53 +0800)]
tools: socfpgaimage: update padding flow

The existing socfpgaimage always pads the image to the maximum size of
OCRAM size. This will break in the encryption flow where it expects the
image to be un-padded. The encryption tool will do the encryption for
the whole image and append the signature key at end of the image.
The signature key will append to beyond the size of OCRAM if the image
is padded with the maximum size before encryption.

Move the padding step from socfpgaimage to Makefile and pads with objcopy
command.

socfpgaimage will pad the image with 16 bytes aligned (including CRC word),
this is a requirement in encryption flow.

Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
3 years agoconfigs: socfpga: Add CONFIG_SPL_PAD_TO
Ley Foon Tan [Tue, 22 Dec 2020 01:53:25 +0000 (09:53 +0800)]
configs: socfpga: Add CONFIG_SPL_PAD_TO

Add CONFIG_SPL_PAD_TO for Gen5 and Arria 10. CONFIG_SPL_PAD_TO is set to
size of OCRAM.

This is preparation for image padding change in socfpgaimage.

Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
3 years agotools: socfpgaimage: Print image header information
Ley Foon Tan [Fri, 11 Dec 2020 06:46:47 +0000 (14:46 +0800)]
tools: socfpgaimage: Print image header information

Print image header information if the header is verified.

Example output from mkimage "-l" option:

$ ./tools/mkimage -l spl/u-boot-spl.sfp
Image Type      : Cyclone V / Arria V SoC Image
Validation word : 0x31305341
Version         : 0x00000000
Flags           : 0x00000000
Program length  : 0x00003a59
Header checksum : 0x00000188

$ ./tools/mkimage -l spl/u-boot-spl.sfp
Image Type      : Arria 10 SoC Image
Validation word : 0x31305341
Version         : 0x00000001
Flags           : 0x00000000
Header length   : 0x00000014
Program length  : 0x000138e0
Program entry   : 0x00000014
Header checksum : 0x00000237

Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
3 years agoconfigs: socfpga: Add defconfig for Agilex and Stratix 10 with ATF support
Chee Hong Ang [Thu, 24 Dec 2020 10:21:13 +0000 (18:21 +0800)]
configs: socfpga: Add defconfig for Agilex and Stratix 10 with ATF support

Booting Agilex and Stratix 10 with ATF support.

SPL now loads ATF (BL31), U-Boot proper and DTB from FIT
image. The new boot flow with ATF support is as follow:

SPL -> ATF (BL31) -> U-Boot proper -> OS (Linux)

U-Boot proper now starts at 0x200000 (CONFIG_SYS_TEXT_BASE).
ATF will occupy the address range starting from 0x1000.

Signed-off-by: Chee Hong Ang <chee.hong.ang@intel.com>
Signed-off-by: Siew Chin Lim <elly.siew.chin.lim@intel.com>
3 years agoarm: socfpga: soc64: Enable FIT image generation using binman
Siew Chin Lim [Thu, 24 Dec 2020 10:21:12 +0000 (18:21 +0800)]
arm: socfpga: soc64: Enable FIT image generation using binman

Enable BINMAN when using Arm-Trusted-Firmware (ATF) to
generate FIT images.

Signed-off-by: Siew Chin Lim <elly.siew.chin.lim@intel.com>
3 years agoarm: socfpga: dts: soc64: Add binman node of FIT image with ATF support
Siew Chin Lim [Thu, 24 Dec 2020 10:21:11 +0000 (18:21 +0800)]
arm: socfpga: dts: soc64: Add binman node of FIT image with ATF support

Add binman node to device tree to generate the FIT image for u-boot
(u-boot.itb) and OS kernel (kernel.itb).

u-boot.itb contains arm trusted firmware (ATF), u-boot proper and
u-boot device tree for ATF u-boot flow.

kernel.itb contains Linux Image and Linux device tree.

Signed-off-by: Siew Chin Lim <elly.siew.chin.lim@intel.com>
3 years agoarm: socfpga: soc64: Skip handoff data access in SSBL
Chee Hong Ang [Thu, 24 Dec 2020 10:21:10 +0000 (18:21 +0800)]
arm: socfpga: soc64: Skip handoff data access in SSBL

SPL already setup the Clock Manager with the handoff data
from OCRAM. When the Clock Manager's driver get probed again
in SSBL, it shall skip the handoff data access in OCRAM.

Signed-off-by: Chee Hong Ang <chee.hong.ang@intel.com>
3 years agoarm: socfpga: soc64: SSBL shall not setup stack on OCRAM
Chee Hong Ang [Thu, 24 Dec 2020 10:21:09 +0000 (18:21 +0800)]
arm: socfpga: soc64: SSBL shall not setup stack on OCRAM

Since SSBL is running in DRAM, it shall setup the stack in DRAM
instead of OCRAM which is occupied by SPL and handoff data.

Signed-off-by: Chee Hong Ang <chee.hong.ang@intel.com>
3 years agoarm: socfpga: mailbox: Add 'SYSTEM_RESET' PSCI support to mbox_reset_cold()
Chee Hong Ang [Thu, 24 Dec 2020 10:21:08 +0000 (18:21 +0800)]
arm: socfpga: mailbox: Add 'SYSTEM_RESET' PSCI support to mbox_reset_cold()

mbox_reset_cold() will invoke ATF's PSCI service when running in
non-secure mode (EL2).

Signed-off-by: Chee Hong Ang <chee.hong.ang@intel.com>
3 years agoarm: socfpga: soc64: Add ATF support for FPGA reconfig driver
Chee Hong Ang [Thu, 24 Dec 2020 10:21:07 +0000 (18:21 +0800)]
arm: socfpga: soc64: Add ATF support for FPGA reconfig driver

In non-secure mode (EL2), FPGA reconfiguration driver calls the
SMC/PSCI services provided by ATF to configure the FPGA.

Signed-off-by: Chee Hong Ang <chee.hong.ang@intel.com>
3 years agoarm: socfpga: soc64: Add ATF support for Reset Manager driver
Chee Hong Ang [Thu, 24 Dec 2020 10:21:06 +0000 (18:21 +0800)]
arm: socfpga: soc64: Add ATF support for Reset Manager driver

In non-secure mode (EL2), Reset Manager driver calls the
SMC/PSCI service provided by ATF to enable/disable the
SOCFPGA bridges.

Signed-off-by: Chee Hong Ang <chee.hong.ang@intel.com>
Signed-off-by: Siew Chin Lim <elly.siew.chin.lim@intel.com>
3 years agonet: designware: socfpga: Add ATF support for MAC driver
Chee Hong Ang [Thu, 24 Dec 2020 10:21:05 +0000 (18:21 +0800)]
net: designware: socfpga: Add ATF support for MAC driver

In non-secure mode (EL2), MAC driver calls the SMC/PSCI services
provided by ATF to setup the PHY interface.

Signed-off-by: Chee Hong Ang <chee.hong.ang@intel.com>
Signed-off-by: Siew Chin Lim <elly.siew.chin.lim@intel.com>
3 years agommc: dwmmc: socfpga: Add ATF support for MMC driver
Chee Hong Ang [Thu, 24 Dec 2020 10:21:04 +0000 (18:21 +0800)]
mmc: dwmmc: socfpga: Add ATF support for MMC driver

In non-secure mode (EL2), MMC driver calls the SMC/PSCI services
provided by ATF to set SDMMC's DRVSEL and SMPLSEL.

Signed-off-by: Chee Hong Ang <chee.hong.ang@intel.com>
Signed-off-by: Siew Chin Lim <elly.siew.chin.lim@intel.com>
3 years agommc: dwmmc: Change designware MMC 'clksel' callback function to return status
Siew Chin Lim [Thu, 24 Dec 2020 10:21:03 +0000 (18:21 +0800)]
mmc: dwmmc: Change designware MMC 'clksel' callback function to return status

Change 'clksel' callback function to allow the code to return a
status.

This patch is a preparation for enabling Arm-Trusted-Firmware (ATF)
in Intel SoC FPGA. This patch does not change functionality.

When using Arm-Trusted-Firmware (ATF) in Intel SoC FPGA, the MMC clock
related register is secure register which is required to be written
via SMC/PCSI call. It is possible that U-Boot fail to write the
register if there is unexpected error between U-Boot and ATF.
As a result, there maybe signal integrity on MMC connection due to
clock. So, the code should reports error to user when 'clksel' fail.

Signed-off-by: Siew Chin Lim <elly.siew.chin.lim@intel.com>
3 years agoarm: socfpga: Add secure register access helper functions for SoC 64bits
Siew Chin Lim [Thu, 24 Dec 2020 10:21:02 +0000 (18:21 +0800)]
arm: socfpga: Add secure register access helper functions for SoC 64bits

These secure register access functions allow U-Boot proper running
at EL2 (non-secure) to access System Manager's secure registers
by calling the ATF's PSCI runtime services (EL3/secure).

Signed-off-by: Siew Chin Lim <elly.siew.chin.lim@intel.com>
Reviewed-by: Ley Foon Tan <ley.foon.tan@intel.com>
3 years agoarm: socfpga: soc64: Define SMC function identifiers for PSCI SiP services
Chee Hong Ang [Thu, 24 Dec 2020 10:21:01 +0000 (18:21 +0800)]
arm: socfpga: soc64: Define SMC function identifiers for PSCI SiP services

This header file defines the Secure Monitor Call (SMC) message
protocol for ATF (BL31) PSCI runtime services. It includes all
the PSCI SiP function identifiers for the secure runtime services
provided by ATF. The secure runtime services include System Manager's
registers access, 2nd phase bitstream FPGA reconfiguration, Remote
System Update (RSU) and etc.

Signed-off-by: Chee Hong Ang <chee.hong.ang@intel.com>
Signed-off-by: Siew Chin Lim <elly.siew.chin.lim@intel.com>
3 years agoarm: socfpga: soc64: Add SMC helper function for Intel SOCFPGA (64bits)
Chee Hong Ang [Thu, 24 Dec 2020 10:21:00 +0000 (18:21 +0800)]
arm: socfpga: soc64: Add SMC helper function for Intel SOCFPGA (64bits)

invoke_smc() allow U-Boot proper running in non-secure mode (EL2)
to invoke SMC call to ATF's PSCI runtime services such as
System Manager's registers access, 2nd phase bitstream FPGA
reconfiguration, Remote System Update (RSU) and etc.

smc_send_mailbox() is a send mailbox command helper function which invokes
the ATF's PSCI runtime service (function ID: INTEL_SIP_SMC_MBOX_SEND_CMD)
to send mailbox messages to Secure Device Manager (SDM).

Signed-off-by: Chee Hong Ang <chee.hong.ang@intel.com>
3 years agoarm: socfpga: Disable "spin-table" method for booting Linux
Chee Hong Ang [Thu, 24 Dec 2020 10:20:59 +0000 (18:20 +0800)]
arm: socfpga: Disable "spin-table" method for booting Linux

Standard PSCI function "CPU_ON" provided by ATF is now used
by Linux kernel to bring up the secondary CPUs to enable SMP
booting in Linux on SoC 64bits platform.

Signed-off-by: Chee Hong Ang <chee.hong.ang@intel.com>