oweals/u-boot.git
4 years agomips: mtmips: add SPL support
Weijie Gao [Tue, 21 Apr 2020 07:28:47 +0000 (09:28 +0200)]
mips: mtmips: add SPL support

This patch adds SPL support for mtmips platform. The lowlevel architecture
is split into SPL and the rest parts are built into a memory loadable
u-boot image. Optional SPL_DM and OF_CONTROL are also supported.

The increment of size is very small (< 10 KiB) if SPL_DM and OF_CONTROL are
not enabled and the memory bootable u-boot (u-boot.img) is generated
automatically so there is not need to add a separate config for it.

A lzma compressed payload (u-boot-lzma.img) is also generated and it will
be combined with u-boot-spl.bin to form the unified ROM bootable binary
u-boot-mtmips.bin.

A spl loader is added to support uncompress the payload.

Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
4 years agomips: mtmips: rewrite lowlevel codes of mt7628
Weijie Gao [Tue, 21 Apr 2020 07:28:34 +0000 (09:28 +0200)]
mips: mtmips: rewrite lowlevel codes of mt7628

This patch rewrites the mtmips architecture with the following changes:

1. Move MT7628 soc parts into a subfolder.
2. Lock parts of D-Cache as temporary stack.
3. Reimplement DDR initialization in C language.
4. Reimplement DDR calibration in a clear logic.
5. Add full support for auto size detection for DDR1 and DDR2.
6. Use accurate CPU clock depending on the input xtal frequency for timer
   and delay functions.

Note:

print_cpuinfo() has incompatible parts with MT7620 so it's moved into
mt7628 subfolder.

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
4 years agomips: add a option to support not reserving malloc space on initial stack
Weijie Gao [Tue, 21 Apr 2020 07:28:33 +0000 (09:28 +0200)]
mips: add a option to support not reserving malloc space on initial stack

The initial stack on some platforms is too small to hold a large malloc
space. This patch adds a option to allow these platforms not reserving the
malloc space on initial stack. These platforms should set the malloc base
after DRAM is usable.

Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
4 years agomips: add an option to support initialize SRAM for initial stack
Weijie Gao [Tue, 21 Apr 2020 07:28:27 +0000 (09:28 +0200)]
mips: add an option to support initialize SRAM for initial stack

Currently CONFIG_MIPS_INIT_STACK_IN_SRAM assumes the memory space for the
initial stack can be used directly. However on some platform the SRAM needs
initialization, e.g. lock cache.

This patch adds an option to allow a new function mips_sram_init() being
called before setup_stack_gd.

Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
4 years agospl: spl_legacy: Add lzma decompression support for legacy image
Weijie Gao [Tue, 21 Apr 2020 07:28:45 +0000 (09:28 +0200)]
spl: spl_legacy: Add lzma decompression support for legacy image

This patch adds support for decompressing LZMA compressed u-boot payload
in legacy uImage format.

Using this patch together with u-boot-lzma.img may be useful for some
platforms as they can reduce the size and load time of u-boot payload.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
4 years agospl: spl_nor: Remove unused variable 'ret' warning
Stefan Roese [Tue, 21 Apr 2020 07:28:44 +0000 (09:28 +0200)]
spl: spl_nor: Remove unused variable 'ret' warning

With the if statement now for the legacy image handling, the compiler
now generates this compile time warning:

common/spl/spl_nor.c:27:6: warning: unused variable 'ret' [-Wunused-variable]

This patch removes this warning by changing the 'ret' variable handling.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Weijie Gao <weijie.gao@mediatek.com>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
4 years agospl: spl_nor: Move legacy image loading into spl_legacy.c
Stefan Roese [Tue, 21 Apr 2020 07:28:43 +0000 (09:28 +0200)]
spl: spl_nor: Move legacy image loading into spl_legacy.c

Move the legacy image loading into spl_legacy.c. This makes it easier
to extend the legacy image handling with new features that other
SPL loaders might use (e.g. spl_spi.c etc).

No functional change intended.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Weijie Gao <weijie.gao@mediatek.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
4 years agospl: spl_legacy: Use IS_ENABLED() to remove #ifdef
Stefan Roese [Tue, 21 Apr 2020 07:28:42 +0000 (09:28 +0200)]
spl: spl_legacy: Use IS_ENABLED() to remove #ifdef

Use IS_ENABLED() instead of #ifdef CONFIG_ to remove one #ifdef.

No functional change intended.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Weijie Gao <weijie.gao@mediatek.com>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
4 years agospl: Extract legacy image handling into separate file
Stefan Roese [Tue, 21 Apr 2020 07:28:41 +0000 (09:28 +0200)]
spl: Extract legacy image handling into separate file

This patch moves the legacy image handling into a separate file, which
will be extended with other legacy image features later.

No function change intended.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Weijie Gao <weijie.gao@mediatek.com>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
4 years agoMakefile: add support to generate LZMA compressed u-boot image
Weijie Gao [Tue, 21 Apr 2020 07:28:39 +0000 (09:28 +0200)]
Makefile: add support to generate LZMA compressed u-boot image

This patch adds support for generating LZMA compressed u-boot image.
The compressed image can be used for SPL to reduce the size of the u-boot
binary.

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
4 years agolib: enable lzma decompression support for SPL build
Weijie Gao [Tue, 21 Apr 2020 07:28:38 +0000 (09:28 +0200)]
lib: enable lzma decompression support for SPL build

This patch enables LZMA decompression support for SPL build

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
4 years agodts: mtmips: add alternative pinmux node for uart2
Weijie Gao [Tue, 21 Apr 2020 07:28:35 +0000 (09:28 +0200)]
dts: mtmips: add alternative pinmux node for uart2

This patch adds a new pinmux for UART2, which shares the pins with SPIS.

Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
4 years agomips: add a mtmips-specific field to architecture-specific global data
Weijie Gao [Tue, 21 Apr 2020 07:28:32 +0000 (09:28 +0200)]
mips: add a mtmips-specific field to architecture-specific global data

SoCs of mtmips can use different CPU frequencies depending on the HW/SW
configurations. For example mt7628 uses 580MHz clock if the input xtal
frequency is 40MHz, and 575MHz clock if the xtal is 25MHz. Upon cold boot
the CPU uses the xtal frequency directly.

So hardcoding the timer frequency (half of the CPU frequency) in
CONFIG_SYS_MIPS_TIMER_FREQ is not a good idea for this case.

This patch adds a mtmips-specific field timer_freq to arch_global_data.
This field will be used later in mtmips-specific get_tbclk() to provide
accurate timer frequency in different boot stage.

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
4 years agomips: mtmips: make use of sysreset-resetctrl for mt7628 soc
Weijie Gao [Tue, 21 Apr 2020 07:28:30 +0000 (09:28 +0200)]
mips: mtmips: make use of sysreset-resetctrl for mt7628 soc

This patch replaces sysreset-syscon with sysreset-resetctrl for mt7628 soc.

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
4 years agosysreset: add reset controller based reboot driver
Weijie Gao [Tue, 21 Apr 2020 07:28:29 +0000 (09:28 +0200)]
sysreset: add reset controller based reboot driver

Some chips provide their sysreset function in reset controller, which is
normally a bit written to 1 to perform the sysreset.

This patch adds a new sysreset driver to take advantage of it.

Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
4 years agomips: spl: Flush cache before jumping to U-Boot proper
Stefan Roese [Tue, 21 Apr 2020 07:28:46 +0000 (09:28 +0200)]
mips: spl: Flush cache before jumping to U-Boot proper

This patch adds a MIPS specific jump_to_image_no_args() implementation,
which flushes the U-Boot proper image loaded from the boot device in
SPL before jumping to it.

It has been noticed on MT76x8, that this cache flush is needed. Other
MIPS platforms might need it as well.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Weijie Gao <weijie.gao@mediatek.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
4 years agomips: add an option to enable u_boot_list section for SPL loaders in u-boot-spl.lds
Weijie Gao [Tue, 21 Apr 2020 07:28:37 +0000 (09:28 +0200)]
mips: add an option to enable u_boot_list section for SPL loaders in u-boot-spl.lds

u_boot_list is not only used by DM, but also by some SPL image load methods
such as spl_nor.c.

This patch adds an option CONFIG_SPL_LOADER_SUPPORT in conjunction with
CONFIG_SPL_DM surrounding the u_boot_list section to make sure SPL image
loaders can be correctly built into u-boot SPL without DM enabled.

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
4 years agomips: enable support for appending dtb to spl binary
Weijie Gao [Tue, 21 Apr 2020 07:28:36 +0000 (09:28 +0200)]
mips: enable support for appending dtb to spl binary

If CONFIG_SPL_OF_CONTROL is enabled for SPL and CONFIG_OF_SEPARATE is also
enabled, the dtb will be appended to the u-boot-spl.bin.

When calling dm_init_and_scan() in SPL, fdtdec_setup() will try to locate
dtb at the end of u-boot-spl.bin, by referencing to _image_binary_end.

However _image_binary_end is currently missing in u-boot-spl.lds.
This patch adds _image_binary_end to u-boot-spl.lds to make sure linking
u-boot-spl will not fail.

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
4 years agomips: start.S: avoid overwriting outside gd when clearing global data in stack
Weijie Gao [Tue, 21 Apr 2020 07:28:28 +0000 (09:28 +0200)]
mips: start.S: avoid overwriting outside gd when clearing global data in stack

When setting up initial stack, global data will also be put in the stack,
and being cleared.

The assembler instructions for clearing gd is as follows:

move t0, k0
1:
PTR_S zero, 0(t0)
blt t0, t1, 1b
 PTR_ADDIU t0, PTRSIZE

t0 is the start address of gd, t1 is the end address of gd (t0 + GD_SIZE).

[PTR_ADDIU t0, PTRSIZE] is in the delay slot of [blt t0, t1, 1b], so it
will be executed before the branch operation.

However the comparison for the BLT instruction is done before executing the
delay slot. This means when the last word just before k1 is cleared, the
loop will continue to run once. This will clear an extra word at k1, which
is outside the global data.

Global data is placed at the top of the stack. If the initial stack is a
SRAM or locked cache, the area outside them may be inaccessible. A write
operation performed in this area may cause an exception.

To solve this, [PTR_ADDIU t0, PTRSIZE] should be placed before the BLT
instruction.

Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
4 years agomips: mtmips: add predefined i-cache/d-cache size and linesize
Weijie Gao [Tue, 21 Apr 2020 07:28:26 +0000 (09:28 +0200)]
mips: mtmips: add predefined i-cache/d-cache size and linesize

Both mt7620 and mt7628 has the same cache configuration. There is no need
to use CONFIG_SYS_CACHE_SIZE_AUTO to probe it at runtime.

Add them into Kconfig to reduce some code size.

Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
4 years agoconfigs: enable CONFIG_RESTORE_EXCEPTION_VECTOR_BASE for all mtmips boards
Weijie Gao [Tue, 21 Apr 2020 07:28:31 +0000 (09:28 +0200)]
configs: enable CONFIG_RESTORE_EXCEPTION_VECTOR_BASE for all mtmips boards

This patch enables CONFIG_RESTORE_EXCEPTION_VECTOR_BASE for all mtmips
boards.

Reviewed-by: Stefan Roese <sr@denx.de>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
4 years agomips: add support to restore exception vector base before booting linux
Weijie Gao [Tue, 21 Apr 2020 07:28:25 +0000 (09:28 +0200)]
mips: add support to restore exception vector base before booting linux

In U-Boot the exception vector base will be moved to top of memory, to be
used to display register dump when exception occurs.

But some old linux kernel does not honor the base set in CP0_EBASE. A
modified exception vector base will cause kernel crash.

This patch adds an option to enable reset exception vector base to its
previous value, or a user configured value before booting linux kernel.

Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
4 years agobmips: allow disabling usb support
Álvaro Fernández Rojas [Sat, 4 Apr 2020 14:01:12 +0000 (16:01 +0200)]
bmips: allow disabling usb support

Currently, if usb is disabled the following error is produced:
  CC      drivers/usb/host/ohci-hcd.o
drivers/usb/host/ohci-hcd.c: In function ‘usb_lowlevel_init’:
drivers/usb/host/ohci-hcd.c:2057:35: error: ‘CONFIG_SYS_USB_OHCI_REGS_BASE’ undeclared (first use in this function); did you mean ‘CONFIG_SYS_MONITOR_BASE’?
  gohci.regs = (struct ohci_regs *)CONFIG_SYS_USB_OHCI_REGS_BASE;
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                   CONFIG_SYS_MONITOR_BASE
drivers/usb/host/ohci-hcd.c:2057:35: note: each undeclared identifier is reported only once for each function it appears in
drivers/usb/host/ohci-hcd.c:2061:20: error: ‘CONFIG_SYS_USB_OHCI_SLOT_NAME’ undeclared (first use in this function); did you mean ‘CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS’?
  gohci.slot_name = CONFIG_SYS_USB_OHCI_SLOT_NAME;
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                    CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years agonand: brcmnand: return without disabling clock
Álvaro Fernández Rojas [Thu, 2 Apr 2020 08:37:52 +0000 (10:37 +0200)]
nand: brcmnand: return without disabling clock

Linux Broadcom NAND driver only disabled clock if no childs are initialized.
This section of the code seems to have been accidentally dropped when it was
imported in U-Boot.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
4 years agoMerge tag 'video-for-v2020.07-rc1' of https://gitlab.denx.de/u-boot/custodians/u...
Tom Rini [Mon, 27 Apr 2020 13:41:51 +0000 (09:41 -0400)]
Merge tag 'video-for-v2020.07-rc1' of https://gitlab.denx.de/u-boot/custodians/u-boot-video

- simple panel 'nv140fhmn49' compatible
- rockchip eDP and LVDS drivers build fix

4 years agovideo: simple_panel: add boe,nv140fhmn49 display
Peter Robinson [Mon, 20 Apr 2020 19:27:32 +0000 (20:27 +0100)]
video: simple_panel: add boe,nv140fhmn49 display

add "boe,nv140fhmn49" display to compatible node.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
Cc: Anatolij Gustschin <agust@denx.de>
4 years agodrivers: video: rockchip: fix building eDP and LVDS drivers
Peter Robinson [Mon, 20 Apr 2020 18:18:25 +0000 (19:18 +0100)]
drivers: video: rockchip: fix building eDP and LVDS drivers

The rk_edp.c and rk_lvds.c files reference rk_setreg which is declared in
hardware.h so include it so the drivers build. Adjust rk_lvds.c so
includes are in alphabetical order while updating.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
Reviewed-by: Anatolij Gustschin <agust@denx.de>
Tested-by: Vagrant Cascadian <vagrant@debian.org>
4 years agoMerge branch '2020-04-25-master-imports'
Tom Rini [Sat, 25 Apr 2020 12:20:22 +0000 (08:20 -0400)]
Merge branch '2020-04-25-master-imports'

- Assorted minor fixes
- Actions S700 SoC and Cubieboard7 support

4 years agortc: ds1374: typo Watchdog
Heinrich Schuchardt [Mon, 20 Apr 2020 16:31:21 +0000 (18:31 +0200)]
rtc: ds1374: typo Watchdog

%s/Watchdoc/Watchdog/

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agospi: mpc8xxx_spi: fix missing dev_err definition
Rasmus Villemoes [Mon, 20 Apr 2020 14:13:41 +0000 (16:13 +0200)]
spi: mpc8xxx_spi: fix missing dev_err definition

The build currently fails with

drivers/spi/mpc8xxx_spi.c:64:3: warning: implicit declaration of function ‘dev_err’ [-Wimplicit-function-declaration]
...
drivers/spi/built-in.o: In function `mpc8xxx_spi_set_speed':
drivers/spi/mpc8xxx_spi.c:227: undefined reference to `dev_err'

Fixes: 4856cc7a97 (mpc8xxx_spi: implement real ->set_speed)
Fixes: 1a7b462dee (mpc8xxx_spi: put max_cs to use)
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
4 years agospl: fit: do not check argument of free()
Heinrich Schuchardt [Mon, 20 Apr 2020 10:44:01 +0000 (12:44 +0200)]
spl: fit: do not check argument of free()

The free() function checks if its argument is NULL. It is superfluous to do
the same check on the calling side.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoMAINTAINERS: add entry for cubieboard7 config
Amit Singh Tomar [Sun, 19 Apr 2020 13:58:37 +0000 (19:28 +0530)]
MAINTAINERS: add entry for cubieboard7 config

This commit adds entry for cubieboard7 config under Actions Semi
OWL family.

Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
4 years agodoc: boards: add Cubieboard7 documentation
Amit Singh Tomar [Sun, 19 Apr 2020 13:58:36 +0000 (19:28 +0530)]
doc: boards: add Cubieboard7 documentation

This adds build and flash steps for Actions S700
based Cubieboard7 board.

Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
4 years agoarm: add Cubieboard7 board support
Amit Singh Tomar [Sun, 19 Apr 2020 13:58:35 +0000 (19:28 +0530)]
arm: add Cubieboard7 board support

The Cubieboard is a single board computer containing a
Actions S700 SoC(with 4 ARMv8 Cortex-A53 cores).

This patch adds respective defconfig alongwith .dts(copied
from Linux v5.5-rc6 with hash "b3a987b0264d").

Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
4 years agoactions: Move defconfig options to Kconfig
Amit Singh Tomar [Sun, 19 Apr 2020 13:58:34 +0000 (19:28 +0530)]
actions: Move defconfig options to Kconfig

This patch moves some of the config options from bubblegum_96_defconfig
to respective Kconfig files.

Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
4 years agoarm: add support Actions Semi S700
Amit Singh Tomar [Sun, 19 Apr 2020 13:58:33 +0000 (19:28 +0530)]
arm: add support Actions Semi S700

This patch adds basic support for Actions Semi based S700
SoC, which is driven by common owl framework.

Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
4 years agoarm: dts: actions: s700: add u-boot specific dtsi file
Amit Singh Tomar [Sun, 19 Apr 2020 13:58:32 +0000 (19:28 +0530)]
arm: dts: actions: s700: add u-boot specific dtsi file

Devices like uart and clk are needed to be enabled before relocation.
this patch adds u-boot.dtsi file that mark these device as dm-pre-reloc.

Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
4 years agoarm: actions: add S700 SoC device tree
Amit Singh Tomar [Sun, 19 Apr 2020 13:58:31 +0000 (19:28 +0530)]
arm: actions: add S700 SoC device tree

This patch adds .dtsi file(sync with Linux 5.5-rc6 with hash "b3a987b0264d")
and required binding for S700 SoC that is a 64-bit Quad-core ARM
Cortex-A53 cores.

It also provisions dts file to be built based on selected
platform(CONFIG_MACH_S900/S700).

Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
4 years agoclk: actions: Add common clock driver
Amit Singh Tomar [Sun, 19 Apr 2020 13:58:30 +0000 (19:28 +0530)]
clk: actions: Add common clock driver

This patch converts S900 clock driver to something common that can
be used for other SoCs, for instance S700(few of clk registers are same).

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
4 years agoarm: dts: actions: s900: add u-boot specific dtsi file
Amit Singh Tomar [Sun, 19 Apr 2020 13:58:29 +0000 (19:28 +0530)]
arm: dts: actions: s900: add u-boot specific dtsi file

Devices like uart and clk are needed to be enabled before relocation.
This patch adds u-boot.dtsi file that mark these device as dm-pre-reloc.

Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
4 years agoarm: dts: sync dts for Action Semi S900
Amit Singh Tomar [Sun, 19 Apr 2020 13:58:28 +0000 (19:28 +0530)]
arm: dts: sync dts for Action Semi S900

Synchronize device tree bindings with v5.5-rc6 tag with commit id
"b3a987b0264d".

Also, it removes older clock binding defined for S900 along with undocumented
compatible string "actions,s900-serial" from serial driver and adapts clock
driver to cater to new bindings.

Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
4 years agoserial: actions: add compatible string
Amit Singh Tomar [Sun, 19 Apr 2020 13:58:27 +0000 (19:28 +0530)]
serial: actions: add compatible string

This patch adds "actions,owl-uart" string to the owl uart driver. It
is also defined in Linux kernel.

Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
4 years agoarm: actions: rename sysmap-s900 to sysmap-owl
Amit Singh Tomar [Sun, 19 Apr 2020 13:58:26 +0000 (19:28 +0530)]
arm: actions: rename sysmap-s900 to sysmap-owl

Now that memory maps(for both S700 and S900 SoCs) can be managed using
a common file, rename sysmap-s900 to sysmap-owl to reflect the same.

Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
4 years agoarm: actions: Add common framework for Actions Owl Semi SoCs
Amit Singh Tomar [Sun, 19 Apr 2020 13:58:25 +0000 (19:28 +0530)]
arm: actions: Add common framework for Actions Owl Semi SoCs

This commit adds common arch support for Actions Semi Owl
series SoCs and removes the Bubblegum96 board files.

Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
4 years agococcinelle: adjust NULL check before free()
Heinrich Schuchardt [Sun, 19 Apr 2020 09:56:02 +0000 (11:56 +0200)]
coccinelle: adjust NULL check before free()

The free() function checks if its argument is NULL. We should avoid
checking for NULL before calling free like in

    if (result->tds)
        free(result->tds);

The list of relevant functions differs between Linux and U-Boot, e.g. we
use free().

Adjust the list of relevant functions.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agococcinelle: check for casting malloc output
Heinrich Schuchardt [Sun, 19 Apr 2020 09:07:34 +0000 (11:07 +0200)]
coccinelle: check for casting malloc output

Casting the (void *) output of memory allocation functions before
assignment like in

sata->cmd_hdr_tbl_offset = (void *)malloc(length + align);

is useless.

Adopt the Linux kernel script
scripts/coccinelle/api/alloc/alloc_cast.cocci.

Now 'make coccicheck' generates warnings like:

./drivers/ata/fsl_sata.c:143:29-33:
WARNING: casting value returned by memory allocation function
to (void *) is useless.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agokbuild: cherry-pick kbuild changes from Linux
Masahiro Yamada [Fri, 17 Apr 2020 07:21:36 +0000 (16:21 +0900)]
kbuild: cherry-pick kbuild changes from Linux

b42841b7bb62 kbuild: Get rid of KBUILD_STR
2aedcd098a94 kbuild: suppress annoying "... is up to date." message
9c8fa9bc08f6 kbuild: fix if_change and friends to consider argument order
ebf003f0cfb3 kbuild: Consolidate header generation from ASM offset information
2982c953570b kbuild: remove redundant $(wildcard ...) for cmd_files calculation
8a78756eb545 kbuild: create object directories simpler and faster
4d4b5c2e3b6e treewide: remove explicit rules for *offsets.s
01d509a48b46 kbuild: remove unimportant comments from ./Kbuild

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
4 years agokbuild: add FORCE to dependency of $(obj)/dts/dt-platdata.o
Masahiro Yamada [Fri, 17 Apr 2020 07:21:35 +0000 (16:21 +0900)]
kbuild: add FORCE to dependency of $(obj)/dts/dt-platdata.o

if_changed must have FORCE as a prerequisite.

Add $(obj)/dts/dt-platdata.o to 'targets' so that the corresponding
.cmd file is included.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
4 years agocache: l2x0: Fix write to incorrect shared-override bit
Ley Foon Tan [Fri, 17 Apr 2020 06:45:35 +0000 (14:45 +0800)]
cache: l2x0: Fix write to incorrect shared-override bit

The existing code write bit-0 for shared attribute override enable bit.
It should be bit-22 based on cache controller specification [1].

[1] http://infocenter.arm.com/help/topic/com.arm.doc.ddi0246f/DDI0246F_l2c310_r3p2_trm.pdf

Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
4 years agoREADME: remove references on no more used config CONFIG_SYS_RCAR_I2C*
Patrick Delaunay [Fri, 10 Apr 2020 14:34:41 +0000 (16:34 +0200)]
README: remove references on no more used config CONFIG_SYS_RCAR_I2C*

Remove the references in README on CONFIG_SYS_RCAR_I2C_* not use
in U-Boot drivers/i2c/rcar_i2c.c, since commit a4d9aafadb31 ("i2c:
 rcar_i2c: Remove the driver") and commit a06a0ac36d59 ("i2c: rcar_i2c:
 Add DM and DT capable I2C driver")

Checked by the command: grep -r SYS_RCAR_I2C *
And these CONFIG are only defined in
arch/arm/mach-rmobile/include/mach/rcar-base.h

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agocosmetic: README: Fix one CONFIG name
Patrick Delaunay [Fri, 10 Apr 2020 14:34:40 +0000 (16:34 +0200)]
cosmetic: README: Fix one CONFIG name

Only replace CONFIF_ by CONFIG_

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agodm: mmc: Update mmc_get_mmc_dev() to use const *
Simon Glass [Wed, 8 Apr 2020 14:33:00 +0000 (08:33 -0600)]
dm: mmc: Update mmc_get_mmc_dev() to use const *

This function does not modify the device to change it to use const *, so
that callers with a const udevice * can call it without a cast.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
4 years agopci: Add a macro to convert BDF from linux to U-Boot
Simon Glass [Wed, 8 Apr 2020 14:32:59 +0000 (08:32 -0600)]
pci: Add a macro to convert BDF from linux to U-Boot

U-Boot's BDF format has its bits in the same position as the device tree
PCI definition.

Some x86 devices use linux format in their register format and it is
useful to be able to convert to U-Boot format. Add a macro for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agouuid: Use const char * where possible
Simon Glass [Wed, 8 Apr 2020 14:32:58 +0000 (08:32 -0600)]
uuid: Use const char * where possible

Update the arguments of these functions so they can be called from code
which uses constant strings.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agolib: Add a function to convert a string to upper case
Simon Glass [Wed, 8 Apr 2020 14:32:56 +0000 (08:32 -0600)]
lib: Add a function to convert a string to upper case

Add a helper function for this operation. Update the strtoul() tests to
check upper case as well.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agotest: Add the beginnings of some string tests
Simon Glass [Wed, 8 Apr 2020 14:32:55 +0000 (08:32 -0600)]
test: Add the beginnings of some string tests

There are quite a few string functions in U-Boot with no tests. Make a
start by adding a test for strtoul().

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agolib: strto: Stop detection when invalid char is used
Michal Simek [Wed, 8 Apr 2020 08:09:16 +0000 (10:09 +0200)]
lib: strto: Stop detection when invalid char is used

This issue has been found when mtd partition are specified. Autodetection
code should stop when the first invalid char is found.

Here is the example of commands:
setenv mtdids nand0=memory-controller@e000e000
setenv mtdparts "mtdparts=nand0:4m(boot),4m(env),64m(kernel),96m(rootfs)"
mtd list

Before:
Zynq> mtd list
List of MTD devices:
* nand0
  - type: NAND flash
  - block size: 0x20000 bytes
  - min I/O: 0x800 bytes
  - OOB size: 64 bytes
  - OOB available: 16 bytes
  - ECC strength: 1 bits
  - ECC step size: 2048 bytes
  - bitflip threshold: 1 bits
  - 0x000000000000-0x000010000000 : "nand0"
  - 0x000000000000-0x000000400000 : "boot"
  - 0x000000400000-0x000000800000 : "env"
  - 0x000000800000-0x000006c00000 : "kernel"
  - 0x000006c00000-0x000010000000 : "rootfs"

Where it is visible that kernel partition has 100m instead of 64m

After:
Zynq> mtd list
* nand0
  - type: NAND flash
  - block size: 0x20000 bytes
  - min I/O: 0x800 bytes
  - OOB size: 64 bytes
  - OOB available: 16 bytes
  - ECC strength: 1 bits
  - ECC step size: 2048 bytes
  - bitflip threshold: 1 bits
  - 0x000000000000-0x000010000000 : "nand0"
  - 0x000000000000-0x000000400000 : "boot"
  - 0x000000400000-0x000000800000 : "env"
  - 0x000000800000-0x000004800000 : "kernel"
  - 0x000004800000-0x00000a800000 : "rootfs"

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Fixes: 0486497e2b5f ("lib: Improve _parse_integer_fixup_radix base 16 detection")
Tested-by: Heiko Schocher <hs@denx.de>
Tested-by: Pali Rohár <pali@kernel.org>
4 years agomtd: nand: pxa3xx: fix raw read when last_chunk_size == 0
Baruch Siach [Sun, 5 Apr 2020 16:19:31 +0000 (19:19 +0300)]
mtd: nand: pxa3xx: fix raw read when last_chunk_size == 0

Commit 6293b0361d9 ("mtd: nand: pxa3xx: add raw read support") added the
local data_len variable in handle_data_pio() to track read size, but
forgot to update the condition of drain_fifo() call. That happens to
work when the layout last_chunk_size != 0. But when last_chunk_size ==
0, drain_fifo() is not called to read the last chunk, which leads to
"Wait timeout!!!" error. Fix this.

Fixes: 6293b0361d9 ("mtd: nand: pxa3xx: add raw read support")
Cc: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
4 years agocommon/board_f: Make reserve_mmu generic
Ovidiu Panait [Sun, 29 Mar 2020 17:57:41 +0000 (20:57 +0300)]
common/board_f: Make reserve_mmu generic

Introduce arch_reserve_mmu to allow for architecture-specific reserve_mmu
routines. Also, define a weak nop stub for it.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoarm: asm/cache.c: Introduce arm_reserve_mmu
Ovidiu Panait [Sun, 29 Mar 2020 17:57:40 +0000 (20:57 +0300)]
arm: asm/cache.c: Introduce arm_reserve_mmu

As a preparation for turning reserve_mmu into an arch-specific variant,
introduce arm_reserve_mmu on ARM. It implements the default routine for
reserving memory for MMU TLB and needs to be weakly defined in order to allow
for machines to override it.

Without this decoupling, after introducing arch_reserve_mmu, there would be two
weak definitions for it, one in common/board_f.c and one in
arch/arm/lib/cache.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agocommon/board_f: Move arm-specific reserve_mmu to arch/arm/lib/cache.c
Ovidiu Panait [Sun, 29 Mar 2020 17:57:39 +0000 (20:57 +0300)]
common/board_f: Move arm-specific reserve_mmu to arch/arm/lib/cache.c

Move the ARM-specific reserve_mmu definition from common/board_f.c
to arch/arm/lib/cache.c.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoMerge tag 'u-boot-stm32-20200424' of https://gitlab.denx.de/u-boot/custodians/u-boot-stm
Tom Rini [Fri, 24 Apr 2020 18:07:59 +0000 (14:07 -0400)]
Merge tag 'u-boot-stm32-20200424' of https://gitlab.denx.de/u-boot/custodians/u-boot-stm

- Solve stm32mp15 pinctrl dts issue (patch conflict in branches master and next)
- Split device tree for DHCOR Som and AV 96 board
- Update PLL4 setting in AV96 board
- Enable bootd, iminfo, imxtract on DHCOM

4 years agoRevert "sunxi: Fix PHY regression on A20-OLinuXino-Lime2 and A20-Olimex-SOM-EVB"
Tom Rini [Fri, 24 Apr 2020 17:13:33 +0000 (13:13 -0400)]
Revert "sunxi: Fix PHY regression on A20-OLinuXino-Lime2 and A20-Olimex-SOM-EVB"

While the change is correct, generally, it was not intended to be pushed
just yet.

This reverts commit b897306341024695d17296efc1f9d83d06368209.

Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agoMerge branch '2020-04-24-master-imports'
Tom Rini [Fri, 24 Apr 2020 17:04:38 +0000 (13:04 -0400)]
Merge branch '2020-04-24-master-imports'

- Assorted minor bugfixes.
- Resync fixdep with Linux v5.7-rc1
- Numerous changes to reduce SPL in various cases including when we have
  read-only env support.
- Allow mkimage to align the header on FIT images to a specific size.

4 years agosunxi: Fix PHY regression on A20-OLinuXino-Lime2 and A20-Olimex-SOM-EVB
Tom Rini [Fri, 24 Apr 2020 16:30:45 +0000 (12:30 -0400)]
sunxi: Fix PHY regression on A20-OLinuXino-Lime2 and A20-Olimex-SOM-EVB

When moving the PHYLIB PHY drivers around in Kconfig we did not at the
same time perform a careful migration of the related drivers and
sub-options.  This lead to the case where previously Kconfig-enabled
driver choices were now disabled on some platforms.  Correct this by
enabling both the PHY driver and sub-option on the above referenced
platforms.

Fixes: af2cbfd6b982 ("drivers: net: Provide Kconfig menu for PHYLIB")
Fixes: 8728c97eff5b ("configs: Re-sync")
Reported-by: Dario <dario86@tutamail.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
---
After checking back on the original commit I can see that these are the
only two platforms to have been broken in the change.

4 years agoARM: stm32: Enable bootd, iminfo, imxtract on DHCOM
Marek Vasut [Wed, 1 Apr 2020 15:13:15 +0000 (17:13 +0200)]
ARM: stm32: Enable bootd, iminfo, imxtract on DHCOM

Enable these standard U-Boot commands for image manipulation and for
starting the default boot command using 'boot' command in U-Boot shell.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
4 years agotravis: Correct error checking when building boards
Simon Glass [Sun, 19 Apr 2020 23:02:32 +0000 (17:02 -0600)]
travis: Correct error checking when building boards

At present if buildman reports an error, the travis build still succeeds.

This is because the travis script does not stop when it sees errors; nor
does it automatically return the exit code. Also the current error
checking never triggers since 'ret' is not set.

Fix this by setting 'ret' correctly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Michal Simek <michal.simek@xilinx.com>
4 years agomkimage: fit: Free buf directly in fit_extract_data()
Bin Meng [Sat, 18 Apr 2020 08:59:11 +0000 (01:59 -0700)]
mkimage: fit: Free buf directly in fit_extract_data()

If given ptr to free() is NULL, no operation is performed.
Hence we can just free buf directly in fit_extract_data().

Signed-off-by: Bin Meng <bin.meng@windriver.com>
4 years agomkimage: fit: Unmmap the memory before closing fd in fit_import_data()
Lihua Zhao [Sat, 18 Apr 2020 08:59:10 +0000 (01:59 -0700)]
mkimage: fit: Unmmap the memory before closing fd in fit_import_data()

Without calling munmap(), the follow-up call to open() the same file
with a flag O_TRUNC seems not to cause any issue on Linux, but it fails
on Windows with error like below:

    Can't open kernel_fdt.itb.tmp: Permission denied

Fix this by unmapping the memory before closing fd in fit_import_data().

Signed-off-by: Lihua Zhao <lihua.zhao@windriver.com>
Signed-off-by: Bin Meng <bin.meng@windriver.com>
4 years agotools: Remove the out-of-date MinGW support codes
Bin Meng [Sat, 18 Apr 2020 08:59:09 +0000 (01:59 -0700)]
tools: Remove the out-of-date MinGW support codes

MinGW build for U-Boot tools has been broken for years. The official
support of Windows build is now MSYS2. Remove the MinGW support codes.

Signed-off-by: Bin Meng <bin.meng@windriver.com>
4 years agodoc: invalid doc link in rstFlatTable.py
Heinrich Schuchardt [Sat, 18 Apr 2020 00:16:34 +0000 (02:16 +0200)]
doc: invalid doc link in rstFlatTable.py

Remove an invalid documentation link in rstFlatTable.py. This synchronizes
the file with Linux next-20200413.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agospl: Kconfig: de-dup SPL_DM_GPIO definition
Joel Johnson [Fri, 17 Apr 2020 15:42:29 +0000 (09:42 -0600)]
spl: Kconfig: de-dup SPL_DM_GPIO definition

Two nearly concurrent commits (d4d65e112 and bcee8d676) added a
SPL_DM_GPIO symbol. Resolve the duplication in favor of the version
in drivers/gpio/Kconfig.

Signed-off-by: Joel Johnson <mrjoel@lixil.net>
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
4 years agofixdep: Re-sync with Linux 5.7-rc1
Masahiro Yamada [Thu, 16 Apr 2020 05:01:45 +0000 (14:01 +0900)]
fixdep: Re-sync with Linux 5.7-rc1

fixdep is a standalone host program, so we can just re-sync it with
the latest Linux in one commit.

I kept the U-Boot own code block surrounded by
/* hack for U-Boot */ ... /* U-boot hack end */.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
4 years agofixdep: handle CONFIG_IS_ENABLE() and friends for TPL
Masahiro Yamada [Thu, 16 Apr 2020 05:01:44 +0000 (14:01 +0900)]
fixdep: handle CONFIG_IS_ENABLE() and friends for TPL

Since commit f1c6e1922eb5 ("spl: dm: use CONFIG_IS_ENABLED to test for
the DM option"), CONFIG_IS_ENABLED() handles CONFIG_TPL_* options, but
fixdep still cannot because it hard-codes the "SPL_" prefix as follows:

    char tmp_buf[256] = "SPL_"; /* hack for U-Boot */

Take care of the "TPL_" prefix too.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
4 years ago.mailmap: map Ruchika Gupta's mail address
Heinrich Schuchardt [Wed, 15 Apr 2020 18:47:38 +0000 (18:47 +0000)]
.mailmap: map Ruchika Gupta's mail address

Freescale mail addresses are not valid anymore.

Reported-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agodlmalloc: remove unit test support in SPL
Heinrich Schuchardt [Wed, 15 Apr 2020 16:46:23 +0000 (18:46 +0200)]
dlmalloc: remove unit test support in SPL

We cannot run unit tests in SPL. So remove the unit test support.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agolib: do not provide hexdump in SPL
Heinrich Schuchardt [Wed, 15 Apr 2020 16:46:22 +0000 (18:46 +0200)]
lib: do not provide hexdump in SPL

SPL should not be enlarged by building with CONFIG_HEXDUMP=y.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
4 years agocommon: image_sign_info helper functions in SPL
Heinrich Schuchardt [Wed, 15 Apr 2020 16:46:21 +0000 (18:46 +0200)]
common: image_sign_info helper functions in SPL

Do not build image_sign_info helper functions in SPL if not needed.

Fixes: b983cc2da0ba ("lib: rsa: decouple rsa from FIT image verification")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
4 years agolib: do not build OID registry in SPL
Heinrich Schuchardt [Wed, 15 Apr 2020 16:46:19 +0000 (18:46 +0200)]
lib: do not build OID registry in SPL

The OID registry is only used by crypto functions that are not built in
SPL. So we should not build it in SPL.

Fixes: a9b45e6e8382 ("lib: add oid registry utility")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
4 years agotools: image-host.c: use correct output format
Heinrich Schuchardt [Sat, 11 Apr 2020 16:36:04 +0000 (18:36 +0200)]
tools: image-host.c: use correct output format

When building on a 32bit host the following warning occurs:

tools/image-host.c: In function ‘fit_image_read_data’:
tools/image-host.c:310:42: warning: format ‘%ld’ expects argument of type
‘long int’, but argument 3 has type ‘ssize_t’ {aka ‘int’} [-Wformat=]
   printf("Can't read all file %s (read %ld bytes, expexted %ld)\n",
                                        ~~^
                                        %d
          filename, n, sbuf.st_size);
                    ~

n is of type ssize_t so we should use %zd for printing.

Fixes: 7298e422504e ("mkimage: fit: add support to encrypt image with aes")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agoMakefile: ARMv7-M has no CPSR register
Heinrich Schuchardt [Fri, 10 Apr 2020 09:10:32 +0000 (11:10 +0200)]
Makefile: ARMv7-M has no CPSR register

Compiling on ARMv7-M fails when trying to address the CPSR register which
is not available on this architecture.

Atomic functions refer to the CPSR register if compiled with
arch/arm/include/asm/proc-armv/system.h. On ARMv7-M we should hence
use arch/arm/thumb1/include/asm/proc-armv/system.h instead.

Cf. https://stackoverflow.com/questions/61097841/error-selected-processor-does-not-support-requested-special-purpose-register

Reported-by: Sicris Rey Embay <sicris.embay@gmail.com>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agoqemu: don't allow to select 32- and 64-bit
Heinrich Schuchardt [Fri, 10 Apr 2020 07:37:21 +0000 (09:37 +0200)]
qemu: don't allow to select 32- and 64-bit

TARGET_QEMU_ARM_64BIT and TARGET_QEMU_ARM_32BIT should be mutually
exclusive.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agofvp: Add support for loading Android boot images via semihosting
Peter Collingbourne [Sat, 4 Apr 2020 02:58:24 +0000 (19:58 -0700)]
fvp: Add support for loading Android boot images via semihosting

FVP now loads an Android boot image named boot.img if available,
otherwise it falls back to the existing code path.

Signed-off-by: Peter Collingbourne <pcc@google.com>
Reviewed-by: Ryan Harkin <ryan.harkin@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
4 years agomkimage: fit_image: Add option to make fit header align
Kever Yang [Mon, 30 Mar 2020 03:56:24 +0000 (11:56 +0800)]
mkimage: fit_image: Add option to make fit header align

The image is usually stored in block device like emmc, SD card, make the
offset of image data aligned to block(512 byte) can avoid data copy
during boot process.
eg. SPL boot from FIT image with external data:
- SPL read the first block of FIT image, and then parse the header;
- SPL read image data separately;
- The first image offset is the base_offset which is the header size;
- The second image offset is just after the first image;
- If the offset of imge does not aligned, SPL will do memcpy;
The header size is a ramdon number, which is very possible not aligned, so
add '-B size'to specify the align size in hex for better performance.

example usage:
  ./tools/mkimage -E -f u-boot.its -B 0x200 u-boot.itb

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
Reviewed-by: Tom Rini <trini@konsulko.com>
4 years agolibfdt: Make fdtdec_get_child_count() available for HOST
Kever Yang [Mon, 30 Mar 2020 03:56:23 +0000 (11:56 +0800)]
libfdt: Make fdtdec_get_child_count() available for HOST

The tool need to use fdtdec_get_child_count(), make it available for
HOST_CC.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agotool: use ALIGN() to align the size
Kever Yang [Mon, 30 Mar 2020 03:56:22 +0000 (11:56 +0800)]
tool: use ALIGN() to align the size

Use the ALIGN() for size align so that the code is more readable.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agotools: imx8mimage: remove redundant code
Kever Yang [Mon, 30 Mar 2020 03:56:21 +0000 (11:56 +0800)]
tools: imx8mimage: remove redundant code

The align for fit_size has been done twice, remove the first one for it
does not make any sense.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
Reviewed-by: Tom Rini <trini@konsulko.com>
4 years agotools: kwbimage: use common ALIGN to do the size align
Kever Yang [Mon, 30 Mar 2020 03:56:20 +0000 (11:56 +0800)]
tools: kwbimage: use common ALIGN to do the size align

The ALIGN() is now available at imagetool.h, migrate to use it.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Stefan Roese <sr@denx.de>
4 years agotools: mkimage: use common ALIGN to do the size align
Kever Yang [Mon, 30 Mar 2020 03:56:19 +0000 (11:56 +0800)]
tools: mkimage: use common ALIGN to do the size align

The ALIGN() is now available at imagetool.h, migrate to use it.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
Reviewed-by: Tom Rini <trini@konsulko.com>
4 years agotool: aisimage: use ALIGN instead of self defiend macro
Kever Yang [Mon, 30 Mar 2020 03:56:18 +0000 (11:56 +0800)]
tool: aisimage: use ALIGN instead of self defiend macro

The ALIGN() is available at imagetool.h, no need to self define one.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
Reviewed-by: Tom Rini <trini@konsulko.com>
4 years agotool: Move ALIGN_MASK to header as common MACRO
Kever Yang [Mon, 30 Mar 2020 03:56:17 +0000 (11:56 +0800)]
tool: Move ALIGN_MASK to header as common MACRO

The ALIGN code is need by many files who need handle structure or image
align, so move the macro to imagetool.h file.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
Reviewed-by: Tom Rini <trini@konsulko.com>
4 years agodocs: Fix conf.py for Sphinx 2.0
Jonathan Corbet [Fri, 20 Mar 2020 06:18:30 +0000 (02:18 -0400)]
docs: Fix conf.py for Sphinx 2.0

commit 3bc8088464712fdcb078eefb68837ccfcc413c88 upstream.

Our version check in Documentation/conf.py never envisioned a world where
Sphinx moved beyond 1.x.  Now that the unthinkable has happened, fix our
version check to handle higher version numbers correctly.

Signed-off-by: Jonathan Corbet <corbet@lwn.net>
[rebase for u-boot]
Signed-off-by: Sean Anderson <seanga2@gmail.com>
4 years agoenv/sf.c: drop private CMD_SAVEENV logic
Rasmus Villemoes [Wed, 19 Feb 2020 09:47:43 +0000 (09:47 +0000)]
env/sf.c: drop private CMD_SAVEENV logic

Deciding whether to compile the env_sf_save() function based solely on
CONFIG_SPL_BUILD is wrong: For U-Boot proper, it leads to a build
warning in case CONFIG_CMD_SAVEENV=n (because the env_save_ptr() macro
causes the function to indeed not be referenced anywhere). And for
SPL, when one selects CONFIG_SPL_SAVEENV, one obviously expects to
actually be able to save the environment.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
4 years agoenv/ext4.c: remove CONFIG_CMD_SAVEENV ifdef
Rasmus Villemoes [Wed, 19 Feb 2020 09:47:42 +0000 (09:47 +0000)]
env/ext4.c: remove CONFIG_CMD_SAVEENV ifdef

Removing this ifdef/endif pair yields a "defined but unused warning"
for CONFIG_CMD_SAVEENV=n, but that vanishes if we use the ENV_SAVE_PTR
macro instead. This gives slightly better compile testing, and
moreover, it's possible to have

  CONFIG_CMD_SAVEENV=n
  CONFIG_SPL_SAVEENV=y
  SPL_ENV_IS_IN_EXT4=y

in which case env_ext4_save would erroneously not be compiled in.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
4 years agoenv/fat.c: remove private CMD_SAVEENV logic
Rasmus Villemoes [Wed, 19 Feb 2020 09:47:41 +0000 (09:47 +0000)]
env/fat.c: remove private CMD_SAVEENV logic

Always compile the env_fat_save() function, and let
CONFIG_IS_ENABLED(SAVEENV) (via the ENV_SAVE_PTR macro) decide whether
it actually ends up being compiled in.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
4 years agoenv_internal.h: add alternative ENV_SAVE_PTR macro
Rasmus Villemoes [Wed, 19 Feb 2020 09:47:40 +0000 (09:47 +0000)]
env_internal.h: add alternative ENV_SAVE_PTR macro

The current definition of the env_save_ptr does not take SPL_SAVEENV
into account. Moreover, the way it is implemented means that drivers
need to guard the definitions of their _save methods with ifdefs to
avoid "defined but unused" warnings in case CMD_SAVEENV=n.

The ifdeffery can be avoided by using a "something ? x : NULL"
construction instead and still have the compiler elide the _save
method when it is not referenced. Unfortunately we can't just switch
the existing env_save_ptr macro, since that would give a lot of build
errors unless all the ifdeffery is removed at the same time.
Conversely, removing that ifdeffery first would merely lead to the
"defined but unused" warnings temporarily, but for some storage
drivers it requires a bit more work than just removing their private
CMD_SAVEENV logic.

So introduce an alternative to env_save_ptr, which for lack of a
better name is simply uppercased, allowing one to update storage
drivers piecemeal to both reduce their ifdeffery and honour
CONFIG_SPL_SAVEENV.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
4 years agoenv: add SAVEENV as an alias of the CMD_SAVEENV symbol
Rasmus Villemoes [Wed, 19 Feb 2020 09:47:39 +0000 (09:47 +0000)]
env: add SAVEENV as an alias of the CMD_SAVEENV symbol

Currently, testing whether to compile in support for saving the
environment is a bit awkward when one needs to take SPL_SAVEENV into
account, and quite a few storage drivers currently do not honour
SPL_SAVEENV.

To make it a bit easier to decide whether environment saving should be
enabled, introduce SAVEENV as an alias for the CMD_SAVEENV
symbol. Then one can simply use

  CONFIG_IS_ENABLED(SAVEENV)

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
4 years agobootcount_ext: Add flag to enable/disable bootcount
Frédéric Danis [Tue, 17 Mar 2020 16:59:09 +0000 (17:59 +0100)]
bootcount_ext: Add flag to enable/disable bootcount

After a successful upgrade, multiple problem during boot sequence may
trigger the altbootcmd process.
This patch adds a version and an upgrade_available entries to the
bootcount file to enable/disable the bootcount check.
When failing to read the bootcount file it will consider that bootcount is
enabled, acting as previously, and update the file accordingly.

The bootcount file is only saved when `upgrade_available` is true, this
allows to save writes to the filesystem.

Signed-off-by: Frédéric Danis <frederic.danis@collabora.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agomake env_entry::callback conditional on !CONFIG_SPL_BUILD
Rasmus Villemoes [Thu, 27 Feb 2020 13:56:12 +0000 (13:56 +0000)]
make env_entry::callback conditional on !CONFIG_SPL_BUILD

The callback member of struct env_entry is always NULL for an SPL
build. Removing it thus saves a bit of run-time memory in the
SPL (when CONFIG_SPL_ENV_SUPPORT=y) since struct env_entry is embedded
in struct env_entry_node - i.e. about 2KB for the normal case of
512+change hash table entries.

Two small fixups are needed for this, all other references to the
callback member are already under !CONFIG_SPL_BUILD: Don't initialize
.callback in set_flags() - hsearch_r doesn't use that value
anyway. And make env_callback_init() initialize ->callback to NULL for
a new entry instead of relying on an unused or deleted entry having
NULL in ->callback.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agolib/hashtable.c: don't test ->callback in SPL
Rasmus Villemoes [Thu, 27 Feb 2020 13:56:11 +0000 (13:56 +0000)]
lib/hashtable.c: don't test ->callback in SPL

In SPL, environment callbacks are not supported, so e->callback is
always NULL. Removing this makes the SPL a little smaller (about 400
bytes in my ppc build) with no functional change.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Simon Glass <sjg@chromium.org>