]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
6 years agoARC: Don't use COMMON section for global not-initialized variables
Alexey Brodkin [Thu, 11 Oct 2018 20:12:05 +0000 (23:12 +0300)]
ARC: Don't use COMMON section for global not-initialized variables

By default GCC puts global non-initialized variables in COMMON section.
And we used to ignore existence of COMMON section in our linker
scripts though smart LD silently appended it right after .bss.

And the problem here is variables from COMMON section even though
require zeroing in run-time were not zeroed as they were placed
right after __bss_end symbol.

It was a pure luck we never faced serious problem due to this,
but now it is fixed.

Now as for some other architectures we'll just force GCC to put
those global variables in normal .bss section.

This solution is much nicer than adding COMMON section to each and
every linker script.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
6 years agoiot_dk: Link for eFlash
Alexey Brodkin [Thu, 11 Oct 2018 11:14:13 +0000 (14:14 +0300)]
iot_dk: Link for eFlash

That's what we'll have in production.
But note it won't work for loading via JTAG as
eFlash is not directly writable, one needs to use
prebootloader to flash uboot.bin from SD-card into eFlash.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
6 years agoaxs10x/emdk/hsdk/iot_dk: Implement board_mmc_getcd()
Alexey Brodkin [Thu, 11 Oct 2018 09:39:55 +0000 (12:39 +0300)]
axs10x/emdk/hsdk/iot_dk: Implement board_mmc_getcd()

So now we may detect MMC/SD-card existence and
instead of completely misleading message on missing card:
------------------------>8-----------------------
Loading Environment from FAT... Card did not respond to voltage select!
------------------------>8-----------------------

we now get very clear one:
------------------------>8-----------------------
Loading Environment from FAT... MMC: no card present
------------------------>8-----------------------

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
6 years agoiot_dk: Save CPU clock value to gd->cpu_clk
Alexey Brodkin [Wed, 10 Oct 2018 13:15:20 +0000 (16:15 +0300)]
iot_dk: Save CPU clock value to gd->cpu_clk

Since gd->cpu_clk is a global item we may once populate it from .dtb
ans use it then in other places like for printing CPU info etc.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
6 years agoiot_dk: Add support of 136 MHz clock
Alexey Brodkin [Wed, 10 Oct 2018 12:53:45 +0000 (15:53 +0300)]
iot_dk: Add support of 136 MHz clock

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
6 years agoiot_dk: Implement board reset
Alexey Brodkin [Wed, 10 Oct 2018 11:20:11 +0000 (14:20 +0300)]
iot_dk: Implement board reset

It is done by writing some magic sequence in a special register.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
6 years agoiot_dk/hsdk: Implement its own print_cpuinfo()
Alexey Brodkin [Wed, 10 Oct 2018 11:03:47 +0000 (14:03 +0300)]
iot_dk/hsdk: Implement its own print_cpuinfo()

ARC IDENTITY register only encodes major architecture
type and version while for a particular board/silicon we
may know better which template was used and so we may identify
CPU more precise, which exactly we do here.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
6 years agoARC: make generic print_cpuinfo() weak
Alexey Brodkin [Wed, 10 Oct 2018 10:59:33 +0000 (13:59 +0300)]
ARC: make generic print_cpuinfo() weak

This allows board to override print_cpuinfo() because
they might know better which ARChitect template was used.
This way we may not only derive base architecture type and
version but more meaningful things like "ARC EM7D" instead of
simple "ARC EM", "ARC HS36" instead of "ARC HS".

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
6 years agoiot_dk: Disable networking support
Alexey Brodkin [Tue, 9 Oct 2018 10:26:26 +0000 (13:26 +0300)]
iot_dk: Disable networking support

There's no Ethernet controller on the board so no point in having
networking support. This also saves us 5.5 kB of precious memory.

| # bloat-o-meter u-boot.net u-boot.no_net_regex | tail -1
| Total: Before=127892, After=122334, chg -4.35%

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
6 years agoiot_dk: Add localversion string
Alexey Brodkin [Tue, 2 Oct 2018 12:04:39 +0000 (15:04 +0300)]
iot_dk: Add localversion string

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
6 years agoMerge tag 'dm-9oct18' of git://git.denx.de/u-boot-dm
Tom Rini [Wed, 10 Oct 2018 17:35:17 +0000 (13:35 -0400)]
Merge tag 'dm-9oct18' of git://git.denx.de/u-boot-dm

Test improvements to tidy up output and drop duplicate tests
Sandbox SPL/TPL support
Various dm-related improvements

6 years agoMerge branch 'master' of git://git.denx.de/u-boot-sh
Tom Rini [Wed, 10 Oct 2018 17:35:14 +0000 (13:35 -0400)]
Merge branch 'master' of git://git.denx.de/u-boot-sh

6 years agoarm: remove duplicated prototypes in u-boot.arm.h
Patrick Delaunay [Fri, 5 Oct 2018 09:33:53 +0000 (11:33 +0200)]
arm: remove duplicated prototypes in u-boot.arm.h

Remove the function prototypes duplicated between u-boot.arm.h
and init.h/common.h

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
6 years agoarm: remove prototype for get_timer_masked
Patrick Delaunay [Fri, 5 Oct 2018 09:33:52 +0000 (11:33 +0200)]
arm: remove prototype for get_timer_masked

The interruption support had be removed for ARM architecture and
the function get_timer_masked() is no more used except in some
the timer.c files.

This patch clean each timer.c which implement this function and
remove the associated prototype in u-boot-arm.h

For timer.c, I don't verify if the weak version of get_timer
(in lib/time.c) can be used

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
6 years agoarm: remove prototype for udelay_masked
Patrick Delaunay [Fri, 5 Oct 2018 09:33:51 +0000 (11:33 +0200)]
arm: remove prototype for udelay_masked

The interruption support had be removed for ARM architecture and
the function udelay_masked() is no more used except in some timer.c
files  and have the same content than udelay() or __udelay().

This patch update each timer.c implementing this function and
remove the associated prototype in u-boot-arm.h.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
6 years agoarm: remove prototype for reset_timer_masked
Patrick Delaunay [Fri, 5 Oct 2018 09:33:50 +0000 (11:33 +0200)]
arm: remove prototype for reset_timer_masked

Remove prototype for function only used in one file

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
6 years agoarm: remove prototype for arch_interrupt_init
Patrick Delaunay [Fri, 5 Oct 2018 09:33:49 +0000 (11:33 +0200)]
arm: remove prototype for arch_interrupt_init

Remove prototype for no more existing function

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
6 years agobootm: Add board specific OS preboot hook
Marek Vasut [Thu, 4 Oct 2018 19:16:31 +0000 (21:16 +0200)]
bootm: Add board specific OS preboot hook

Add board-specific hook which is executed before the code hands over
control to the OS. This lets the board perform some last-minute clean
ups.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
6 years agoarm: K3: am654: Add support for getting boot mode
Andrew F. Davis [Wed, 3 Oct 2018 15:03:23 +0000 (10:03 -0500)]
arm: K3: am654: Add support for getting boot mode

Read the boot mode register to find the boot mode. Only use eMMC boot0
mode when the mode is eMMC boot (called BOOT_DEVICE_MMC1 currently due
to current conflating of boot mode and boot device), and not iff the
boot device is MMC port 0.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
6 years agoarm: K3: am654: Choose MMC boot device based on boot port
Andrew F. Davis [Wed, 3 Oct 2018 15:03:22 +0000 (10:03 -0500)]
arm: K3: am654: Choose MMC boot device based on boot port

For most devices the boot mode maps directly to the boot
device. For MMC this is not the case as we have two MMC
boot modes and two MMC boot devices (ports). Check the
boot port to determine which MMC device was our boot
device. Make this change for both primary and secondary
boot modes.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
6 years agogpio: da8xx: Push generic defines of gpio.h out of mach-davinci
Keerthy [Wed, 3 Oct 2018 12:25:14 +0000 (17:55 +0530)]
gpio: da8xx: Push generic defines of gpio.h out of mach-davinci

Push generic defines of gpio.h out of mach-davinci to drivers/gpio
now that non-davinci architectures are beginning to use this IP.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
[trini: Fix calimain build]
Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agogpio: da8xx: Add k2g compatible
Keerthy [Wed, 3 Oct 2018 12:25:13 +0000 (17:55 +0530)]
gpio: da8xx: Add k2g compatible

Add k2g compatible so that k3 SoCs can be supported

Signed-off-by: Keerthy <j-keerthy@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
6 years agoboard: ks2: move uinitrd fixup logic inside ft_board_setup_ex
Nicholas Faustini [Wed, 3 Oct 2018 10:58:49 +0000 (12:58 +0200)]
board: ks2: move uinitrd fixup logic inside ft_board_setup_ex

The uinitrd fixup logic should be executed after the FDT /chosen
node has been properly populated by fdt_initrd()

Signed-off-by: Nicholas Faustini <nicholas.faustini@azcomtech.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
6 years agofdt: add call to ft_board_setup_ex() for ks2 boards
Nicholas Faustini [Wed, 3 Oct 2018 10:58:48 +0000 (12:58 +0200)]
fdt: add call to ft_board_setup_ex() for ks2 boards

When updating the board FDT, some of the operations
are performed by ft_board_setup_ex() and should be
executed also by the fdt command.

Signed-off-by: Nicholas Faustini <nicholas.faustini@azcomtech.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
6 years agoARM: meson: Add Khadas VIM2 board support
Loic Devulder [Wed, 3 Oct 2018 10:02:07 +0000 (12:02 +0200)]
ARM: meson: Add Khadas VIM2 board support

This adds platform code for the Khadas VIM2 board based on a
Meson GXM (S912) SoC with the Meson GXM configuration.

This initial submission supports UART, MMC/SDCard and Ethernet.
USB is partially supported.

All the code is from Neil Armstrong! I just rebased the code, do
some cleanup and tested on my board.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Loic Devulder <ldevulder@suse.de>
Acked-by: Neil Armstrong <narmstrong@baylibre.com>
6 years agoARM: meson: Add Khadas VIM2 board DT
Loic Devulder [Wed, 3 Oct 2018 10:02:06 +0000 (12:02 +0200)]
ARM: meson: Add Khadas VIM2 board DT

This adds Device Tree for the Khadas VIM2 board.

The meson-gxm-khadas-vim2.dts is synchronized from Linux 4.18.10.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Loic Devulder <ldevulder@suse.de>
Acked-by: Neil Armstrong <narmstrong@baylibre.com>
6 years agoARM: dts: stm32mp1: Add usbotg_hs regulator for stm32mp157c-ev1
Patrice Chotard [Wed, 3 Oct 2018 07:38:38 +0000 (09:38 +0200)]
ARM: dts: stm32mp1: Add usbotg_hs regulator for stm32mp157c-ev1

Add usbotg_hs regulator to allow to use the USB mass-storage
feature on OTG usb port.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
6 years agoARM: dts: rmobile: Reinstate missing CPLD on ULCB
Marek Vasut [Tue, 9 Oct 2018 11:13:13 +0000 (13:13 +0200)]
ARM: dts: rmobile: Reinstate missing CPLD on ULCB

The CPLD is used to reset the ULCB and it was removed
during DT sync with Linux 4.17. Reinstate it.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
6 years agommc: tmio: Limit DMA to 32bit on R-Car Gen3
Marek Vasut [Tue, 2 Oct 2018 22:46:24 +0000 (00:46 +0200)]
mmc: tmio: Limit DMA to 32bit on R-Car Gen3

The internal DMAC on Gen3 is 32bit only, limit the DMA address
range to 32bit.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agommc: tmio: Pass full address to tmio_sd_addr_is_dmaable()
Marek Vasut [Tue, 2 Oct 2018 22:44:37 +0000 (00:44 +0200)]
mmc: tmio: Pass full address to tmio_sd_addr_is_dmaable()

Pass the entire source data pointer to tmio_sd_addr_is_dmaable()
so we don't have to apply casts throughout the code.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agodtoc: Fix the value of SetInt()
Simon Glass [Mon, 1 Oct 2018 18:22:49 +0000 (12:22 -0600)]
dtoc: Fix the value of SetInt()

This does not set the correct value at present. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agovideo: Tidy up a few comments in video.o
Simon Glass [Mon, 1 Oct 2018 18:22:48 +0000 (12:22 -0600)]
video: Tidy up a few comments in video.o

Add a little more information to one comment and update the guard comment
to be more accurate.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>
6 years agovideo: at91: Adjust vidconsole_position_cursor() to use char pos
Simon Glass [Mon, 1 Oct 2018 18:22:47 +0000 (12:22 -0600)]
video: at91: Adjust vidconsole_position_cursor() to use char pos

At present this function uses pixels but it seems more useful for it to
position in terms of characters on the screen. This also matches the
comment to the function. Update this.

Unfortunately there is one user of this function (at91). Have a crack at
fixing this, since I cannot test it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>
6 years agosysreset: Add a way to find the last reset
Simon Glass [Mon, 1 Oct 2018 18:22:46 +0000 (12:22 -0600)]
sysreset: Add a way to find the last reset

We have a method to return the last reset as a string for humans, but not
a method that allows it to be used programmatically. Add a new method that
returns the last reset as an enum.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agosysreset: Tidy up a few comments and logging
Simon Glass [Mon, 1 Oct 2018 18:22:45 +0000 (12:22 -0600)]
sysreset: Tidy up a few comments and logging

Some comments are incorrect or missing pieces. Fix these and use logging
to print the error.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agopci: Add a little more debugging to pci_rom
Simon Glass [Mon, 1 Oct 2018 18:22:44 +0000 (12:22 -0600)]
pci: Add a little more debugging to pci_rom

Add some logging on failure.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
6 years agofdt: Allow C++ comments in link scripts and DT files
Simon Glass [Mon, 1 Oct 2018 18:22:43 +0000 (12:22 -0600)]
fdt: Allow C++ comments in link scripts and DT files

At present // in a device-tree file or link script causes a warning. But
this is used in the standard license header. Update the compiler flags to
use C99, which permits this.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agoctags: Minor changes to fix ctags output
Simon Glass [Mon, 1 Oct 2018 18:22:42 +0000 (12:22 -0600)]
ctags: Minor changes to fix ctags output

At present ctags emits lines with unmatched quotes which means that the
output file is invalid. This is with exuberant-ctags version 5.9~svn201103
but I also see it with plain ctags. I am not sure that it is a bug though.

Make a few minor changes in the source code to fix this problem.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agopanel: Expand the backlight support
Simon Glass [Mon, 1 Oct 2018 18:22:41 +0000 (12:22 -0600)]
panel: Expand the backlight support

At present the panel can be turned on but not off, and the brightness
cannot be controlled at run-time. Add a new API function to both the panel
and backlight uclasses to handle this. Enhance the PWM backlight driver
to deal with custom levels properly and allow the backlight to be turned
on and off.

Update the test to cover thes new features.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agotest: panel: Add a test for the panel uclass
Simon Glass [Mon, 1 Oct 2018 18:22:40 +0000 (12:22 -0600)]
test: panel: Add a test for the panel uclass

At present this uclass has no tests. Add a simple one which checks the PWM
configuration, regulator and GPIO.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agocros_ec: Add support for v3 messages on LPC
Simon Glass [Mon, 1 Oct 2018 18:22:39 +0000 (12:22 -0600)]
cros_ec: Add support for v3 messages on LPC

At present version 3 messages are only supported on SPI. Add support for
using LPC as well, as used on samus.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agocros_ec: Update cros_ec_read_hash() to specify the image
Simon Glass [Mon, 1 Oct 2018 18:22:38 +0000 (12:22 -0600)]
cros_ec: Update cros_ec_read_hash() to specify the image

Allow selection of which EC image to hash.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agox86: Update mtrr functions to allow leaving cache alone
Simon Glass [Mon, 1 Oct 2018 18:22:37 +0000 (12:22 -0600)]
x86: Update mtrr functions to allow leaving cache alone

At present the mtrr functions disable the cache before making changes and
enable it again afterwards. This is fine in U-Boot, but does not work if
running in CAR (such as we are in SPL).

Update the functions so that the caller can request that caches be left
alone.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
6 years agocros: Update ec_commands to latest version
Simon Glass [Mon, 1 Oct 2018 18:22:36 +0000 (12:22 -0600)]
cros: Update ec_commands to latest version

This file has changed quite a bit in the last 5 years as the capabilities
of the ECs have grown. Sync it up with the copy in coreboot commit
b9141f2215.

The only change is the addition of EC_VBNV_BLOCK_SIZE_V2. This is needed
because U-Boot uses the new v2 vboot API and this is not currently fully
supported by Chromium OS firmware.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agoRename GPT_HEADER_SIGNATURE to avoid conflict
Simon Glass [Mon, 1 Oct 2018 18:22:35 +0000 (12:22 -0600)]
Rename GPT_HEADER_SIGNATURE to avoid conflict

The current name conflicts with the Chrome OS verified boot library, which
prevents it being built. That library uses a string whereas U-Boot uses a
64-bit hex value. Rename this in U-Boot.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agoAdd a header file for strings
Simon Glass [Mon, 1 Oct 2018 18:22:34 +0000 (12:22 -0600)]
Add a header file for strings

Add a string.h header for libraries that expect this to be available, now
that U-Boot's version has moved to include/linux.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agolog: Add comments to the rest of the log categories
Simon Glass [Mon, 1 Oct 2018 18:22:32 +0000 (12:22 -0600)]
log: Add comments to the rest of the log categories

At present some of the log categories are missing comments. Add them.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agobinman: Move to three-digit test-file numbers
Simon Glass [Mon, 1 Oct 2018 18:22:30 +0000 (12:22 -0600)]
binman: Move to three-digit test-file numbers

We now have 99 tests. Before adding any more, rename everything to three
digits. This helps to preserve the ordering of tests and makes it easier
to find things.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agotpm: Add a few new commands for v1
Simon Glass [Mon, 1 Oct 2018 18:22:29 +0000 (12:22 -0600)]
tpm: Add a few new commands for v1

These are needed for the 2018 version of Chromium OS vboot. Add an
implementation for TPM v1, with v2 to come later.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agotpm: Tidy up logging in tpm-common.c
Simon Glass [Mon, 1 Oct 2018 18:22:28 +0000 (12:22 -0600)]
tpm: Tidy up logging in tpm-common.c

At present this file uses logging but it should use the new macros. Update
it and add a log message for an error.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agotpm: Use livetree and allow children
Simon Glass [Mon, 1 Oct 2018 18:22:27 +0000 (12:22 -0600)]
tpm: Use livetree and allow children

Adjust the TPM drivers to use livetree (only one does not). Also,
sometimes TPMs can have child devices if they provide a service to the
system (such as storing secure data), so permit that.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agovideo: Adjust video_clear() to return an error
Simon Glass [Mon, 1 Oct 2018 18:22:26 +0000 (12:22 -0600)]
video: Adjust video_clear() to return an error

All driver-model operation should return an error code. Adjust this
function to do so also.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>
6 years agofdt: Remove fdtdec_decode_region() function
Simon Glass [Mon, 1 Oct 2018 18:22:25 +0000 (12:22 -0600)]
fdt: Remove fdtdec_decode_region() function

This function is not used in U-Boot now. Remove it along with its 'memory'
version.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agodm: spi: Add logging of some return values
Simon Glass [Mon, 1 Oct 2018 18:22:24 +0000 (12:22 -0600)]
dm: spi: Add logging of some return values

When SPI flash operations fail it is helpful to be able to see the error
codes and where they are generated. Add logging to capture this
information for read operations.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agocros: Adjust board_get_cros_ec_dev() to return a udevice
Simon Glass [Mon, 1 Oct 2018 18:22:23 +0000 (12:22 -0600)]
cros: Adjust board_get_cros_ec_dev() to return a udevice

Rather than returning what is effectively an internal data structure,
return the cros EC device itself.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agocros: Update cros_ec code to use struct udevice
Simon Glass [Mon, 1 Oct 2018 18:22:22 +0000 (12:22 -0600)]
cros: Update cros_ec code to use struct udevice

At present we pass around a private pointer to specify the cros_ec device.
With driver model it makes more sense to pass the device. Update the code
to do this.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agofdt: Allow libfdt in TPL
Simon Glass [Mon, 1 Oct 2018 18:22:21 +0000 (12:22 -0600)]
fdt: Allow libfdt in TPL

In some cases (e.g. sandbox with verified boot) it is useful to support
libfdt in TPL. Update the Kconfig to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agoserial: Allow serial to be absent in TPL
Simon Glass [Mon, 1 Oct 2018 18:22:20 +0000 (12:22 -0600)]
serial: Allow serial to be absent in TPL

At present this option applies to SPL, but it should be available in TPL
also, and separately. Change to using CONFIG_IS_ENABLED(), add a new
Kconfig option and fix up hang().

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agotpm: Add support for SPL and TPL
Simon Glass [Mon, 1 Oct 2018 18:22:19 +0000 (12:22 -0600)]
tpm: Add support for SPL and TPL

At present the tpm can only be used in U-Boot proper. Updated it to work
in SPL and TPL also.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agofdt: Allow indicating a node is for U-Boot proper only
Simon Glass [Mon, 1 Oct 2018 18:22:18 +0000 (12:22 -0600)]
fdt: Allow indicating a node is for U-Boot proper only

At present it is not possible to specify that a node should be used before
relocation (in U-Boot proper) without it also ending up in SPL and TPL
device trees. Add a new "u-boot,dm-pre-proper" boolean property for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agodoc: Update docs for device tree in SPL, TPL
Simon Glass [Mon, 1 Oct 2018 18:22:17 +0000 (12:22 -0600)]
doc: Update docs for device tree in SPL, TPL

Make a few small updates to indicate that device tree can be used in SPL
and TPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agofdt: Document the fact that dtc is now built
Simon Glass [Mon, 1 Oct 2018 18:22:16 +0000 (12:22 -0600)]
fdt: Document the fact that dtc is now built

This documentation is out of date now that U-Boot builds dtc
automatically. Update it.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agortc: Allow use of RTC in SPL and TPL
Simon Glass [Mon, 1 Oct 2018 18:22:15 +0000 (12:22 -0600)]
rtc: Allow use of RTC in SPL and TPL

Add Kconfig options so that the RTC can be used in SPL and TPL. This is
helpful for accessing the contents of CMOS RAM, for example.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agoKconfig: Convert CONFIG_RTC_MC146818 to Kconfig
Simon Glass [Mon, 1 Oct 2018 18:22:14 +0000 (12:22 -0600)]
Kconfig: Convert CONFIG_RTC_MC146818 to Kconfig

Move this option to Kconfig and tidy up the two boards which use it.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agoblk: Support block drivers in TPL
Simon Glass [Mon, 1 Oct 2018 18:22:13 +0000 (12:22 -0600)]
blk: Support block drivers in TPL

At present it is not possible to enable/disable block drivers in TPL. This
is needed to provide sandbox support. Add a Kconfig option and adjust the
Makefile.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agoMakefile: Add a warning if SPL/TPL cannot be built
Simon Glass [Mon, 1 Oct 2018 18:22:11 +0000 (12:22 -0600)]
Makefile: Add a warning if SPL/TPL cannot be built

At present the build fails in strange ways if CONFIG_SPL is defined by
CONFIG_SUPPORT_SPL is not. Add a warning for this case as it can be very
confusing to debug.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agospl: input: Allow input in SPL and TPL
Simon Glass [Mon, 1 Oct 2018 18:22:10 +0000 (12:22 -0600)]
spl: input: Allow input in SPL and TPL

In some cases it is necessary to read the keyboard in early phases of
U-Boot. Update the config to allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agosf: Avoid allocating memory on every read operation
Simon Glass [Mon, 1 Oct 2018 18:22:09 +0000 (12:22 -0600)]
sf: Avoid allocating memory on every read operation

At present spi_flash_cmd_read_ops() allocates and frees a few bytes of
memory every time it is called. It is faster to use the stack for this
and this is now supported by the minimum GCC version required by U-Boot.

Remove the allocation and use a variable-sized array instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agodm: core: Update ofnode to read binman-style flash entry
Simon Glass [Mon, 1 Oct 2018 18:22:08 +0000 (12:22 -0600)]
dm: core: Update ofnode to read binman-style flash entry

At present ofnode_read_fmap_entry() reads a flash map entry in a format
which is not supported by binman. To allow use to use binman-format
descriptions, update this function.

Also add a simple test.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agodm: core: Add a function to find the first inactive child
Simon Glass [Mon, 1 Oct 2018 18:22:07 +0000 (12:22 -0600)]
dm: core: Add a function to find the first inactive child

Some devices have children and want to press an existing inactive child
into service when needed. Add a function to help with this.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agodm: core: Update some functions to use const
Simon Glass [Mon, 1 Oct 2018 18:22:06 +0000 (12:22 -0600)]
dm: core: Update some functions to use const

Quite a few functions do not actually modify the device that is passed in.
Update the function signatures to reflect that.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agodm: core: Alloc uclass-private data to be cache-aligned
Simon Glass [Mon, 1 Oct 2018 18:22:05 +0000 (12:22 -0600)]
dm: core: Alloc uclass-private data to be cache-aligned

There is no reason why this feature should not be supported for uclass-
private data. Update the code accordingly.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agosandbox: Restore blocking I/O on exit
Simon Glass [Mon, 1 Oct 2018 17:55:20 +0000 (11:55 -0600)]
sandbox: Restore blocking I/O on exit

At present sandbox sets non-blocking I/O as soon as any input is read
from the terminal. However it does not restore the previous state on
exit. Fix this and drop the old os_read_no_block() function.

This means that we always enable blocking I/O in sandbox (if input is a
terminal) whereas previously it would only happen on the first call to
tstc() or getc(). However, the difference is likely not important.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agodm: spi: Clean up detection of sandbox SPI emulator
Simon Glass [Mon, 1 Oct 2018 17:55:19 +0000 (11:55 -0600)]
dm: spi: Clean up detection of sandbox SPI emulator

Now that we don't have to deal with the command-line flag we can simplify
the code for detecting the emulator. Remove the lookup based on the SPI
specification, relying just on the device tree to locate the emulator.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agosandbox: tpm: Enhance to support the latest Chromium OS
Simon Glass [Mon, 1 Oct 2018 17:55:18 +0000 (11:55 -0600)]
sandbox: tpm: Enhance to support the latest Chromium OS

This driver was originally written against Chromium OS circa 2012. A few
new features have been added. Enhance the TPM driver to match. This mostly
includes a few new messages and properly modelling whether a particular
'space' is present or not.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agosandbox: tpm: Tidy up enums and return values
Simon Glass [Mon, 1 Oct 2018 17:55:17 +0000 (11:55 -0600)]
sandbox: tpm: Tidy up enums and return values

Use an enum for command values instead of open-coding them. This removes
the need for comments. Also make sure the driver returns proper error
numbers instead of -1.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agoserial: sandbox: Allow serial output without device tree
Simon Glass [Mon, 1 Oct 2018 17:55:16 +0000 (11:55 -0600)]
serial: sandbox: Allow serial output without device tree

At present sandbox assumes that device-tree control is active, but this
may not be the case in SPL or TPL. Add some conditions to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agosandbox: Add a debug UART
Simon Glass [Mon, 1 Oct 2018 17:55:15 +0000 (11:55 -0600)]
sandbox: Add a debug UART

Add support for the debug UART so that sandbox provides build testing for
this feature.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agosandbox: video: Speed up video output
Simon Glass [Mon, 1 Oct 2018 17:55:14 +0000 (11:55 -0600)]
sandbox: video: Speed up video output

At present there are many situations where sandbox syncs the display to
the SDL frame buffer. This is a very expensive operation but is only
needed every now and then. Update video_sync() so that we can specify
whether this operation is really needed.

At present this flag is not used on other architectures. It could also
be used for reducing writeback-cache flushes but the benefit of that would
need to be investigated.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>
6 years agosandbox: spi: Add more logging
Simon Glass [Mon, 1 Oct 2018 17:55:13 +0000 (11:55 -0600)]
sandbox: spi: Add more logging

Add logging to aid debugging features in these drivers. Also drop some
code in sandbox_spi_xfer() which is not used.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agosandbox: Remove the old memory file later
Simon Glass [Mon, 1 Oct 2018 17:55:12 +0000 (11:55 -0600)]
sandbox: Remove the old memory file later

When debugging sandbox it is sometimes annoying that the memory file is
deleted early on. If sandbox later crashes or we quit (using the
debugger), it is not possible to run it again with the same state since
the memory file is gone.

Remove the old memory file when sandbox exits, instead. Also add debugging
showing the memory filename.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agosandbox: Add a flag to set the default log level
Simon Glass [Mon, 1 Oct 2018 17:55:11 +0000 (11:55 -0600)]
sandbox: Add a flag to set the default log level

It is useful to be able to set the default log level from the command line
when running sandbox. Add a new -L command-line flag for this. The log
level is set using the enum log_level_t in log.h. At present a number must
be specified, e.g. -L7 for debug.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agosandbox: Support booting from TPL to SPL
Simon Glass [Mon, 1 Oct 2018 17:55:10 +0000 (11:55 -0600)]
sandbox: Support booting from TPL to SPL

At present we support booting from SPL to U-Boot proper. Add support for
the previous stage too, so sandbox can be started with TPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agosandbox: spi: Drop command-line SPI option
Simon Glass [Mon, 1 Oct 2018 17:55:09 +0000 (11:55 -0600)]
sandbox: spi: Drop command-line SPI option

At present we support specifying SPI flash devices to use in the device
tree and on the command line. Drop the second option, since it is a pain
to support nicely with driver model, and unnecessary.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agosandbox: Add a way to write data to the host filesystem
Simon Glass [Mon, 1 Oct 2018 17:55:08 +0000 (11:55 -0600)]
sandbox: Add a way to write data to the host filesystem

For debugging it is sometimes useful to write out data for inspection
using an external tool. Add a function which can write this data to a
given file.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agosandbox: Support file truncation with os_open()
Simon Glass [Mon, 1 Oct 2018 17:55:07 +0000 (11:55 -0600)]
sandbox: Support file truncation with os_open()

At present files are not truncated on writing. This is a useful feature.
Add support for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agolog: Add helpers for common log levels
Simon Glass [Mon, 1 Oct 2018 17:55:06 +0000 (11:55 -0600)]
log: Add helpers for common log levels

At present to output a log message you need something like:

   log(UCLASS_SPI, LOCL_INFO, "message1");
   log(UCLASS_SPI, LOCL_INFO, "message2");

but many files use the same category throughout. Also it is helpful to
shorten the length of log names, providing helpers for common logging
levels. Add some macros so that it is possible to do:

   (top of file, before #includes)
   #define LOG_CATEGORY UCLASS_SPI

   (later in the file)
   log_info("message1");
   log_debug("message2");
   log_err("message3");

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agocmd: pxe: add support for FIT config selection
Patrick Delaunay [Tue, 2 Oct 2018 08:54:48 +0000 (10:54 +0200)]
cmd: pxe: add support for FIT config selection

Add a way in configuration files (exlinux.conf for sysboot command)
to select a specific FIT configuration. The configuration is selected
with a string added after the FIT filename in the label "KERNEL" or
"LINUX", using the same format than bootm command:

KERNEL [Filename]#<conf>[#<extra-conf[#...]]

This configuration string, beginning by '#', is directly appended
to bootm argument 1 after <kernel_addr_r>.

bootm [<kernel_addr_r>]#<conf>[#<extra-conf[#...]]

see doc/uImage.FIT/command_syntax_extensions.txt for details

Example :
 KERNEL /fit.itb#cfg1
 KERNEL /fit.itb#cfg2

Configuration can be use also for overlay management :
 KERNEL /fit.itb#cfg1#dtbo1#dtbo3

see doc/uImage.FIT/overlay-fdt-boot.txt for details

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
6 years agoARM: meson: Extend mem_map to support 3GiB of RAM
Loic Devulder [Tue, 25 Sep 2018 14:30:35 +0000 (16:30 +0200)]
ARM: meson: Extend mem_map to support 3GiB of RAM

The current mem_map definition for Meson SoCs has support for up
to 2GiB of RAM. According to S905, S905X, S912 and S805X datasheets
the DDR region is set from 0x00000000 to 0xBFFFFFFF, so mem_map's
definition should be changed accordingly.

It is also needed to be able to boot Khadas VIM2 board with S912
SoC.

Signed-off-by: Loic Devulder <ldevulder@suse.de>
Acked-by: Neil Armstrong <narmstrong@baylibre.com>
Acked-by: Marek Vasut <marek.vasut@gmail.com>
6 years agofs: btrfs: Fix tree traversal with btrfs_next_slot()
Yevgeny Popovych [Fri, 7 Sep 2018 09:59:30 +0000 (12:59 +0300)]
fs: btrfs: Fix tree traversal with btrfs_next_slot()

When traversing slots in a btree (via btrfs_path) with btrfs_next_slot(),
we didn't correctly identify that the last slot in the leaf was reached
and we should jump to the next leaf.

This could lead to any kind of runtime errors or corruptions, like:
* file data not being read at all, or is read partially
* file is read but is corrupted
* (any) metadata being corrupted or not read at all, etc

The easiest way to reproduce this is to read a large enough file that
its EXTENT_DATA items don't fit into a single leaf.

Signed-off-by: Yevgeny Popovych <yevgenyp@pointgrab.com>
Cc: Marek Behun <marek.behun@nic.cz>
Tested-by: Marek BehĂșn <marek.behun@nic.cz>
6 years agortc: Add read8 and write8 support to isl1208 driver
Trent Piepho [Thu, 31 May 2018 18:14:44 +0000 (11:14 -0700)]
rtc: Add read8 and write8 support to isl1208 driver

This can be used for device register access from board code.

This allows access to capabilities in the RTC chip not abstracted in
U-Boot's RTC class.  E.g., device NVRAM or a tamper detection circuit.

Cc: Klaus Goger <klaus.goger@theobroma-systems.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Trent Piepho <tpiepho@impinj.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
6 years agolog: Correct definition of log_msg_ret()
Simon Glass [Tue, 2 Oct 2018 11:22:31 +0000 (05:22 -0600)]
log: Correct definition of log_msg_ret()

This macro should have two parameters, not one. Fix it so that it
correctly resolves to _ret when logging is disabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agoofnode: Add missing address translation into ofnode_get_addr_size()
Marek Vasut [Mon, 1 Oct 2018 10:37:20 +0000 (12:37 +0200)]
ofnode: Add missing address translation into ofnode_get_addr_size()

Of CONFIG_OF_TRANSLATE is enabled, this function still returns
untranslated bogus results. Add the missing translation.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoofnode: Replace of_n_addr_cells with of_n_size_cells
Marek Vasut [Mon, 1 Oct 2018 10:37:19 +0000 (12:37 +0200)]
ofnode: Replace of_n_addr_cells with of_n_size_cells

The size should be decoded using of_n_size_cells(), make it so.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agobinman: Run tests concurrently
Simon Glass [Tue, 2 Oct 2018 03:12:47 +0000 (21:12 -0600)]
binman: Run tests concurrently

At present the tests run one after the other using a single CPU. This is
not very efficient. Bring in the concurrencytest module and run the tests
concurrently, using one process for each CPU by default. A -P option
allows this to be overridden, which is necessary for code-coverage to
function correctly.

This requires fixing a few tests which are currently not fully
independent.

At some point we might consider doing this across all pytests in U-Boot.
There is a pytest version that supports specifying the number of processes
to use, but it did not work for me.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agotest: Reduce the number of tests run with sandbox_flattree
Simon Glass [Tue, 2 Oct 2018 03:12:46 +0000 (21:12 -0600)]
test: Reduce the number of tests run with sandbox_flattree

We only need to run driver-model tests with this config, since this is the
only thing that is different when CONFIG_OF_LIVE is not defined. Filter
out the other tests to same time.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agopatman: Don't clear progress in tout unless it was used
Simon Glass [Tue, 2 Oct 2018 03:12:45 +0000 (21:12 -0600)]
patman: Don't clear progress in tout unless it was used

At present calling Uninit() always called ClearProgress() which outputs
a \r character as well as spaces to remove any progress information on the
line. This can mess up the normal output of binman and other tools. Fix
this by outputing this only when progress information has actually been
previous written.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agotools: Set an initial value for indir
Simon Glass [Tue, 2 Oct 2018 03:12:44 +0000 (21:12 -0600)]
tools: Set an initial value for indir

This variable is not documented or set up in the module. Fix this.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agobuildman: dtoc: Suppress unwanted output from test
Simon Glass [Tue, 2 Oct 2018 03:12:43 +0000 (21:12 -0600)]
buildman: dtoc: Suppress unwanted output from test

There are a few test cases which print output. Suppress this so that tests
can run silently in the normal case.

Signed-off-by: Simon Glass <sjg@chromium.org>
6 years agobinman: Separate out testSplBssPad()
Simon Glass [Tue, 2 Oct 2018 03:12:42 +0000 (21:12 -0600)]
binman: Separate out testSplBssPad()

At present this test runs binman twice, which means that the temporary
files from the first run do not get cleaned up. Split this into two tests
to fix this problem.

Signed-off-by: Simon Glass <sjg@chromium.org>