]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
7 years agocolibri_imx6: Avoid calling setup_display() from SPL code
Fabio Estevam [Sat, 23 Sep 2017 02:45:33 +0000 (23:45 -0300)]
colibri_imx6: Avoid calling setup_display() from SPL code

There is no need call setup_display() from SPL code, so move it to
board_init(), which executes only in U-Boot proper.

Reported-by: Stefano Babic <sbabic@denx.de>
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
7 years agoapalis_imx6: Avoid calling setup_display() from SPL code
Fabio Estevam [Sat, 23 Sep 2017 02:45:32 +0000 (23:45 -0300)]
apalis_imx6: Avoid calling setup_display() from SPL code

There is no need call setup_display() from SPL code, so move it to
board_init(), which executes only in U-Boot proper.

Reported-by: Stefano Babic <sbabic@denx.de>
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
7 years agomx6cuboxi: Avoid calling setup_display() from SPL code
Fabio Estevam [Sat, 23 Sep 2017 02:45:31 +0000 (23:45 -0300)]
mx6cuboxi: Avoid calling setup_display() from SPL code

There is no need call setup_display() from SPL code, so move it to
board_init(), which executes only in U-Boot proper.

Reported-by: Stefano Babic <sbabic@denx.de>
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Stefano Babic <sbabic@denx.de>
7 years agowandboard: Avoid calling setup_display() from SPL code
Fabio Estevam [Sat, 23 Sep 2017 02:45:30 +0000 (23:45 -0300)]
wandboard: Avoid calling setup_display() from SPL code

There is no need call setup_display() from SPL code, so move it to
board_init(), which executes only in U-Boot proper.

Reported-by: Stefano Babic <sbabic@denx.de>
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Stefano Babic <sbabic@denx.de>
7 years agocgtqmx6eval: Avoid calling setup_display() from SPL code
Fabio Estevam [Sat, 23 Sep 2017 02:45:29 +0000 (23:45 -0300)]
cgtqmx6eval: Avoid calling setup_display() from SPL code

There is no need call setup_display() from SPL code, so move it to
board_init(), which executes only in U-Boot proper.

Reported-by: Stefano Babic <sbabic@denx.de>
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Stefano Babic <sbabic@denx.de>
7 years agomx6sabresd: Avoid calling setup_display() from SPL code
Fabio Estevam [Sat, 23 Sep 2017 02:45:28 +0000 (23:45 -0300)]
mx6sabresd: Avoid calling setup_display() from SPL code

There is no need call setup_display() from SPL code, so move it to
board_init(), which executes only in U-Boot proper.

Reported-by: Stefano Babic <sbabic@denx.de>
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Stefano Babic <sbabic@denx.de>
7 years agoMerge git://git.denx.de/u-boot-i2c
Tom Rini [Wed, 11 Oct 2017 12:38:20 +0000 (08:38 -0400)]
Merge git://git.denx.de/u-boot-i2c

7 years agoi2c: muxes: pca954x: look up width from chip_desc
Chris Packham [Thu, 28 Sep 2017 21:53:36 +0000 (10:53 +1300)]
i2c: muxes: pca954x: look up width from chip_desc

Commit 8e6eda7cda6c ("drivers/i2c/muxes/pca954x: Add pca9547 I2C mux
support") introduced a chip_desc for the pca954x devices but failed to
update pca954x_ofdata_to_platdata() to be aware of it. Make
pca954x_ofdata_to_platdata() lookup the chip_desc to validate the device
width.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Marek Behun <marek.behun@nic.cz>
7 years agoMerge branch 'rmobile' of git://git.denx.de/u-boot-sh
Tom Rini [Wed, 11 Oct 2017 00:14:38 +0000 (20:14 -0400)]
Merge branch 'rmobile' of git://git.denx.de/u-boot-sh

7 years agoconfigs: Re-sync CONFIG_CMD_IMLS with moveconfig
Tuomas Tynkkynen [Sun, 8 Oct 2017 18:48:02 +0000 (21:48 +0300)]
configs: Re-sync CONFIG_CMD_IMLS with moveconfig

The option is specified in Kconfig, but still a few config header files
are overriding the choice by #undef'ing it. Re-sync the option with
moveconfig to rid of the #undefs.

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
7 years agocmd: Toggle the default value of CONFIG_CMD_IMLS
Tuomas Tynkkynen [Sun, 8 Oct 2017 18:48:01 +0000 (21:48 +0300)]
cmd: Toggle the default value of CONFIG_CMD_IMLS

Having this as a 'default y' is rather annoying because it doesn't
actually compile unless other options are defined in the board header:

../cmd/bootm.c: In function 'do_imls_nor':
../cmd/bootm.c:330:7: error: 'CONFIG_SYS_MAX_FLASH_BANKS' undeclared (first use in this function); did you mean 'CONFIG_SYS_MAX_FLASH_SECT'?
   i < CONFIG_SYS_MAX_FLASH_BANKS; ++i, ++info) {

Make it 'default n' so people who develop new boards that start from a
blank defconfig have one less compilation failure to debug.

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
7 years agoMerge git://git.denx.de/u-boot-dm
Tom Rini [Tue, 10 Oct 2017 00:19:39 +0000 (20:19 -0400)]
Merge git://git.denx.de/u-boot-dm

7 years agoARM: rmobile: dts: Add SDR104/HS200 to Salvator-X
Marek Vasut [Fri, 6 Oct 2017 12:08:00 +0000 (14:08 +0200)]
ARM: rmobile: dts: Add SDR104/HS200 to Salvator-X

Add DT nodes to enable SDR104/HS200 modes on Salvator-X boards.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
7 years agoARM: rmobile: Fixup ULCB CPLD support after PFC rework
Marek Vasut [Wed, 4 Oct 2017 01:03:50 +0000 (03:03 +0200)]
ARM: rmobile: Fixup ULCB CPLD support after PFC rework

The ULCB CPLD support was not updated during the PFC table rework,
fix up the GPIO numbers until the CPLD support is rewritten to a
proper DM capable and DT probing driver.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
7 years agoMerge git://git.denx.de/u-boot-video
Tom Rini [Mon, 9 Oct 2017 17:31:33 +0000 (13:31 -0400)]
Merge git://git.denx.de/u-boot-video

7 years agosandbox: avoid memory leak in os_dirent_ls
Heinrich Schuchardt [Thu, 21 Sep 2017 10:56:07 +0000 (12:56 +0200)]
sandbox: avoid memory leak in os_dirent_ls

Realloc does not free the old memory area if it fails.

Identified by cppcheck.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agodm: ofnode: query correct property in livetree ofnode_get_addr_size
Klaus Goger [Wed, 20 Sep 2017 11:50:41 +0000 (13:50 +0200)]
dm: ofnode: query correct property in livetree ofnode_get_addr_size

The livetree codepath of ofnode_get_addr_size always used the "reg"
property for of_get_property. Use the property parameter of the function
call instead and check the return value if the property exists.
Otherwise return FDT_ADDR_T_NONE.

This was discoverd while using SPI NOR with livetree.
spi_flash_decode_fdt checks for memory-map and will not fail with
livetree even if the property does not exist.

Signed-off-by: Klaus Goger <klaus.goger@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agodm: core: Round up size when allocating so that it is cache line aligned
Faiz Abbas [Tue, 19 Sep 2017 11:23:50 +0000 (16:53 +0530)]
dm: core: Round up size when allocating so that it is cache line aligned

The size variable may not be always be a mulitple of
ARCH_DMA_MINALIGN and using it to flush cache leads to cache
misaligned warnings.

Therefore, round up the size to a multiple of ARCH_DMA_MINLAIGN
when allocating private data.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agodm: gpio: pca953x: Drop pointless data structure checks
Simon Glass [Sun, 17 Sep 2017 22:54:54 +0000 (16:54 -0600)]
dm: gpio: pca953x: Drop pointless data structure checks

These checks cannot fail since driver model will not call a driver's
method if it cannot fully create the driver data structures.

It is confusing to have these checks and others might copy them. Drop this
code.

Signed-off-by: Simon Glass <sjg@chromium.org>
7 years agodm: gpio: Correct use of -ENODEV in drivers
Simon Glass [Sun, 17 Sep 2017 22:54:53 +0000 (16:54 -0600)]
dm: gpio: Correct use of -ENODEV in drivers

In U-Boot -ENODEV means that there is no device. When there is a problem
with the device, drivers should return an error like -ENXIO or -EREMOTEIO.
When the device tree properties cannot be read correct , they should
return -EINVAL.

Update various GPIO drivers to follow this rule, to help with consistency
for future driver writers.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Adam Ford <aford173@gmail.com>
7 years agodm: gpio: Add a comment about not copying some drivers
Simon Glass [Sun, 17 Sep 2017 22:54:52 +0000 (16:54 -0600)]
dm: gpio: Add a comment about not copying some drivers

These three drivers all use U_BOOT_DEVICE rather than device tree to
create devices, so have to do manual allocation of platform data. This is
not true for new platforms.

Add a more explicit comment so that people do not copy this approach with
new boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Adam Ford <aford173@gmail.com>
7 years agodm: gpio: vybrid_gpio: Correct driver's use of bind() method
Simon Glass [Sun, 17 Sep 2017 22:54:51 +0000 (16:54 -0600)]
dm: gpio: vybrid_gpio: Correct driver's use of bind() method

It does not look like this driver needs to use a bind() method. It does
not manually create devices with device_bind() nor does it create devices
using U_BOOT_DEVICE(). It seems to only use device tree.

Therefore the manual allocation of platform data is not needed and is
confusing. Also platform data should be set up by the ofdata_to_platdata()
method, not bind().

Update the driver in case others use it as a model in future.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Adam Ford <aford173@gmail.com>
7 years agotest: print_ut: Add test for %ls strings
Rob Clark [Wed, 13 Sep 2017 22:46:54 +0000 (18:46 -0400)]
test: print_ut: Add test for %ls strings

Add a simple test for long strings.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agoconfigs: stm32h743-eval: enable filesystem related flags
Patrice Chotard [Tue, 3 Oct 2017 13:55:02 +0000 (15:55 +0200)]
configs: stm32h743-eval: enable filesystem related flags

Enable CMD_GPT/EXT2/EXT4/EXT4_WRITE/FAT_FS_GENERIC flags

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
7 years agoconfigs: stm32h743-disco: enable filesystem related flags
Patrice Chotard [Tue, 3 Oct 2017 13:55:01 +0000 (15:55 +0200)]
configs: stm32h743-disco: enable filesystem related flags

Enable CMD_GPT/EXT2/EXT4/EXT4_WRITE/FAT_FS_GENERIC flags

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
7 years agoconfigs: stm32h743-disco: enable SDMMC support
Patrice Chotard [Tue, 3 Oct 2017 13:55:00 +0000 (15:55 +0200)]
configs: stm32h743-disco: enable SDMMC support

Enable CMD_MMC, DM_MMC and STM32_SDMMC2 flags

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
7 years agoconfigs: stm32h743-eval: enable SDMMC support
Patrice Chotard [Tue, 3 Oct 2017 13:54:59 +0000 (15:54 +0200)]
configs: stm32h743-eval: enable SDMMC support

Enable CMD_MMC, DM_MMC and STM32_SDMMC2 flags

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
7 years agodm: mmc: remove DM_MMC_OPS for STM32_SDMMC
Patrice Chotard [Tue, 3 Oct 2017 13:54:58 +0000 (15:54 +0200)]
dm: mmc: remove DM_MMC_OPS for STM32_SDMMC

Since e7881d85 "dm: mmc: Drop CONFIG_DM_MMC_OPS" DM_MMC_OPS
is no more used, remove it from STM32_SDMMC2 dependencies

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
7 years agoARM: DTS: stm32: add SDMMC support fo stm32h743-eval
Patrice Chotard [Tue, 3 Oct 2017 13:54:57 +0000 (15:54 +0200)]
ARM: DTS: stm32: add SDMMC support fo stm32h743-eval

Add pinctrl and sdmmc nodes to add MMC support for
STM32H743 evaluation board.

Evaluation board needs a second pinctrl node
"pinctrl_sdmmc1_level_shifter" to drive a level shifter
on MMC bus.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
7 years agoARM: DTS: stm32: add SDMMC support for stm32h743 disco
Patrice Chotard [Tue, 3 Oct 2017 13:54:56 +0000 (15:54 +0200)]
ARM: DTS: stm32: add SDMMC support for stm32h743 disco

Add pinctrl and sdmmc nodes to add MMC support for
STM32H743 discovery board.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
7 years agoconfigs: stm32: update SRAM address for STM32H7 disco and eval
Patrice Chotard [Tue, 3 Oct 2017 13:47:59 +0000 (15:47 +0200)]
configs: stm32: update SRAM address for STM32H7 disco and eval

As suggested by Vikas Manocha, update embedded SRAM address
to use AXI SRAM available on D1 domain instead of using
AHB SRAM (D2 domain).
On some STM32H743 SoCs, D2 domain SRAM is accessible even if
SRAMxEN bit in AHB2ENR bits are not set whereas on others SoCs
version it's not accessible.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas Manocha <vikas.manocha@st.com>
7 years agoARM: stm32f7: fix prescaler calculation of timer
Bo Shen [Tue, 3 Oct 2017 05:47:59 +0000 (22:47 -0700)]
ARM: stm32f7: fix prescaler calculation of timer

As the timer 2 is on APB1 bus, the maximum of clock frequency of APB1 timer
clock is half of SYSCLK. Then to calculate the timer prescaler for timer 2
which need to be divided by 2.

Signed-off-by: Bo Shen <voice.shen@gmail.com>
Reviewed-by: Vikas Manocha <vikas.manocha@st.com>
7 years agofs/fat: Check malloc return values and fix memory leaks
Tuomas Tynkkynen [Sat, 30 Sep 2017 23:25:22 +0000 (02:25 +0300)]
fs/fat: Check malloc return values and fix memory leaks

Check malloc() return values and properly unwind on errors so
memory allocated for fat_itr structures get freed properly.

Also fixes a leak of fsdata.fatbuf in fat_size().

Fixes: 2460098cffacd1 ("fs/fat: Reduce stack usage")
Reported-by: Coverity (CID: 167225, 167233, 167234)
Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Reviewed-by: Tom Rini <trini@konsulko.com>
7 years agofs/fat: Fix 'CACHE: Misaligned operation at range' warnings
Tuomas Tynkkynen [Sat, 30 Sep 2017 23:25:21 +0000 (02:25 +0300)]
fs/fat: Fix 'CACHE: Misaligned operation at range' warnings

The 'block' field of fat_itr needs to be properly aligned for DMA and
while it does have '__aligned(ARCH_DMA_MINALIGN)', the fat_itr structure
itself needs to be properly aligned as well.

While at it use malloc_cache_aligned() for the other aligned allocations
in the file as well.

Fixes: 2460098cffacd1 ("fs/fat: Reduce stack usage")
Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Reviewed-by: Tom Rini <trini@konsulko.com>
7 years agocmd: Make CMD_LZMA / CMD_UNZIP default y if CMD_BOOTI
Tom Rini [Fri, 29 Sep 2017 18:32:44 +0000 (14:32 -0400)]
cmd: Make CMD_LZMA / CMD_UNZIP default y if CMD_BOOTI

In the Linux Kernel on ARM64, the Image.COMPRESSION file is not
self-extracting in the way that x86 and ARM images are.  So when
CMD_BOOTI is enabled we should also default to enabling CMD_UNZIP and
CONFIG_LZMA in order for the user to be able to decompress many of the
common compressions that will be done to an Image file.

Signed-off-by: Tom Rini <trini@konsulko.com>
7 years agoscripts: Move Kconfig contents to cmd/Kconfig
Sam Protsenko [Thu, 28 Sep 2017 19:33:45 +0000 (12:33 -0700)]
scripts: Move Kconfig contents to cmd/Kconfig

On case-insensitive file systems we have collision between
scripts/kconfig/ directory and scripts/Kconfig file. This patch moves
scripts/Kcofnig contents to cmd/Kconfig to fix that.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Acked-by: Masahiro Yamada <yamada.masahiro@socionext.com>
7 years agoserial: stm32x7: remove useless CONFIG_CLK and OF_CONTROL flag
Patrice Chotard [Wed, 27 Sep 2017 13:44:53 +0000 (15:44 +0200)]
serial: stm32x7: remove useless CONFIG_CLK and OF_CONTROL flag

This driver is currently used by STM32F7 and STM32H7 SoCs.
As CONFIG_CLK and OF_CONTROL flags are set by default for these
2 SoCs, this flag becomes useless in this driver, so remove it.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
7 years agoserial: stm32x7: add STM32F4 support
Patrice Chotard [Wed, 27 Sep 2017 13:44:52 +0000 (15:44 +0200)]
serial: stm32x7: add STM32F4 support

stm32f4 doesn't support FIFO and OVERRUN feature.
The enable bit is not at the same location in CR1
register than for STM32F7 and STM32H7.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
7 years agoserial: stm32x7: add fifo support for STM32H7
Patrice Chotard [Wed, 27 Sep 2017 13:44:51 +0000 (15:44 +0200)]
serial: stm32x7: add fifo support for STM32H7

Add fifo mode support for rx and tx.
As only STM32H7 supports this feature, add has_fifo flag
to uart configuration to use fifo only when possible.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
7 years agoserial: stm32x7: prepare the ground to STM32F4 support
Patrice Chotard [Wed, 27 Sep 2017 13:44:50 +0000 (15:44 +0200)]
serial: stm32x7: prepare the ground to STM32F4 support

STM32F4 serial IP is similar to F7 and H7, but registers
are not located at the same offset and some feature are
only supported by F7 and H7 version.

Registers offset must be added for each version and also
some flags indicated the supported feature.

Update registers name to match with datasheet (sr to isr,
rx_dr to rdr and tx_dr to tdr) and remove unused regs
(cr2, gtpr, rtor, and rqr).

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
7 years agoserial: stm32x7: remove stm32f7-usart and stm32h7-usart compatible
Patrice Chotard [Wed, 27 Sep 2017 13:44:49 +0000 (15:44 +0200)]
serial: stm32x7: remove stm32f7-usart and stm32h7-usart compatible

This patch remove the extra compatibility string "st,stm32h7-usart"
and "st,stm32f7-usart" to avoid confusion, save some time & space.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas Manocha <vikas.manocha@st.com>
7 years agoserial: stm32x7: cleanup code
Patrice Chotard [Wed, 27 Sep 2017 13:44:48 +0000 (15:44 +0200)]
serial: stm32x7: cleanup code

Use BIT() macro and GENMASK() macro

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Vikas Manocha <vikas.manocha@st.com>
7 years agoARMv8: make master CPU checking logic more clear
zijun_hu [Mon, 25 Sep 2017 07:28:50 +0000 (15:28 +0800)]
ARMv8: make master CPU checking logic more clear

macro branch_if_master checks master CPU via (Aff3 & (Aff2:Aff1:Aff0))
it is simple but a little obscure.

fix by checking Affx fields within MPIDR_EL1 directly.

Signed-off-by: zijun_hu <zijun_hu@htc.com>
7 years agoboard: STiH410-B2260: set ramdisk_addr_r to 0x48000000
Lee Jones [Mon, 25 Sep 2017 07:14:20 +0000 (09:14 +0200)]
board: STiH410-B2260: set ramdisk_addr_r to 0x48000000

Add missing ramdisk_addr_r param and set it to 0x48000000

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agoboard: STiH410-B2260: fix sdram size
Nicolas Le Bayon [Mon, 25 Sep 2017 07:14:19 +0000 (09:14 +0200)]
board: STiH410-B2260: fix sdram size

32MB are reserved for TrustZone purpose

Signed-off-by: Nicolas Le Bayon <nicolas.le.bayon@st.com>
7 years agoboard: STiH410-B2260: update environment variable
Patrice Chotard [Mon, 25 Sep 2017 07:14:18 +0000 (09:14 +0200)]
board: STiH410-B2260: update environment variable

Update environment variable by updating:
 _ BOOT_TARGET_DEVICE
 _ CONFIGS_BOOTARGS
 _ kernel_addr_r, fdtfile, fdt_addr_r, scriptaddr, fdt_high, intird_high

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agoARMv8: fix error in freeing stack frame
zijun_hu [Sat, 23 Sep 2017 05:30:58 +0000 (13:30 +0800)]
ARMv8: fix error in freeing stack frame

relocate_code() allocates 32 bytes stack frame but only 16 bytes are
freed before return. it will cause errors to possible previous frames
and doesn't make relocate_code() look like a function.

fix by freeing 32 bytes stack space

Signed-off-by: zijun_hu <zijun_hu@htc.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agoARMv8: get new GD address from gd->new_gd directly
zijun_hu [Fri, 22 Sep 2017 06:39:13 +0000 (14:39 +0800)]
ARMv8: get new GD address from gd->new_gd directly

the new GD address is calculated via board data BD currently
it require the new GD area locates below BD tightly, so a strict
constraint is imposed on memory layout which maybe make special
platform unpleasant.

fix it by getting new GD address from gd->new_gd directly.

Signed-off-by: zijun_hu <zijun_hu@htc.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agoTravis-CI: Fix microblaze and xilinx jobs
Tom Rini [Sat, 7 Oct 2017 19:54:18 +0000 (15:54 -0400)]
Travis-CI: Fix microblaze and xilinx jobs

Given how we handle the ARM toolchain we can't easily combine these two
jobs, so don't.  Give xilinx/ARM a separate build.

Signed-off-by: Tom Rini <trini@konsulko.com>
7 years agocmd/gpt.c, cmd/nvedit.c, tools/fit_image.c: Rework recent fixes for Coverity
Tom Rini [Sat, 7 Oct 2017 15:27:59 +0000 (11:27 -0400)]
cmd/gpt.c, cmd/nvedit.c, tools/fit_image.c: Rework recent fixes for Coverity

The recent changes to these files did not completely fix the previous
issues, or introduced different (minor) issues.  In cmd/gpt.c we need to
dereference str_disk_guid to be sure that malloc worked.  In
cmd/nvedit.c we need to be careful that we can also fit in that leading
space when adding to the string.  And in tools/fit_image.c we need to
re-work the error handling slightly in fit_import_data() so that we only
call munmap() once.  We have two error paths here, one where we have an
fd to close and one where we do not.  Adjust labels to match this.

Reported-by: Coverity (CID: 167366, 167367, 167370)
Signed-off-by: Tom Rini <trini@konsulko.com>
7 years agoMerge git://git.denx.de/u-boot-x86
Tom Rini [Sat, 7 Oct 2017 13:12:04 +0000 (09:12 -0400)]
Merge git://git.denx.de/u-boot-x86

7 years agox86: edison: Bring minimal ACPI support to the board
Andy Shevchenko [Tue, 3 Oct 2017 11:55:08 +0000 (14:55 +0300)]
x86: edison: Bring minimal ACPI support to the board

This board is based on Intel Tangier SoC (Intel Merrifield platform)
and may utilize ACPI powerfulness.

Bring minimum support by appending initial DSDT table for it.

Note, the addresses for generated tables are carefully chosen to avoid
any conflicts with existing shadowed BIOS data. The user have somewhat
like ~31 kB available for compiled ACPI tables that ought to be enough.

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
7 years agox86: tangier: Enable ACPI support for Intel Tangier
Andy Shevchenko [Tue, 3 Oct 2017 11:55:07 +0000 (14:55 +0300)]
x86: tangier: Enable ACPI support for Intel Tangier

Intel Tangier SoC is a part of Intel Merrifield platform which doesn't
utilize ACPI by default. Here is an attempt to unleash ACPI flexibility
power on Intel Merrifield based platforms.

The change brings minimum support of the devices that found on
Intel Merrifield based end user device.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: theadorable-x86-xxx_defconfig: Enable setexpr command
Stefan Roese [Fri, 6 Oct 2017 07:12:28 +0000 (09:12 +0200)]
x86: theadorable-x86-xxx_defconfig: Enable setexpr command

The setexpr command is useful for scripting, lets enable it for all
x86 based theadorable platforms.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: theadorable-x86-common: Move "-generic" into kernel-ver variable
Stefan Roese [Fri, 6 Oct 2017 07:12:27 +0000 (09:12 +0200)]
x86: theadorable-x86-common: Move "-generic" into kernel-ver variable

This enables the easier usage of "-custom" kernel versions as well.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agox86: theadorable-x86-common: Add further pci hotplug cmdline parameters
Stefan Roese [Fri, 6 Oct 2017 07:12:26 +0000 (09:12 +0200)]
x86: theadorable-x86-common: Add further pci hotplug cmdline parameters

This is needed for the PCIe hotplug to work correctly on some boards.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agoTravis-CI: Split out more vendors from the catch-all ARM job
Tom Rini [Fri, 6 Oct 2017 20:37:06 +0000 (16:37 -0400)]
Travis-CI: Split out more vendors from the catch-all ARM job

- Move SoCFPGA and K2 boards to their own job
- Expand the microblaze job to cover ARM boards from Xilinx as well.

Signed-off-by: Tom Rini <trini@konsulko.com>
7 years agoTravis-CI: Move Boundary and Engicam devices to their own jobs
Tom Rini [Fri, 6 Oct 2017 20:27:42 +0000 (16:27 -0400)]
Travis-CI: Move Boundary and Engicam devices to their own jobs

The i.MX6 job can still be close to the time limit, move a few more
devices out.

Signed-off-by: Tom Rini <trini@konsulko.com>
7 years agoTravis-CI: Move Toradex into its own job
Tom Rini [Fri, 6 Oct 2017 15:19:12 +0000 (11:19 -0400)]
Travis-CI: Move Toradex into its own job

A few of the big jobs are getting close to the time limit again, split a
few more things out.

Signed-off-by: Tom Rini <trini@konsulko.com>
7 years agofs/ext4/ext4fs.c: Free dirnode in error path of ext4fs_ls
Tom Rini [Wed, 27 Sep 2017 02:43:45 +0000 (22:43 -0400)]
fs/ext4/ext4fs.c: Free dirnode in error path of ext4fs_ls

As reported by Coverity, we did not free dirnode in the case of failure.
Do so now.

Reported-by: Coverity (CID: 131221)
Cc: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Tom Rini <trini@konsulko.com>
7 years agotools/fit_image.c: Update some return code paths
Tom Rini [Wed, 27 Sep 2017 02:14:44 +0000 (22:14 -0400)]
tools/fit_image.c: Update some return code paths

Coverity has found some problems with the return paths in parts of this
code.  We have a case where we were going to the wrong part of the
unwind (open() failed so we cannot close the fd), a case where we were
only free()ing our buf on the error path and finally a case where we did
not munmap in the failure path.

Reported-by: Coverity (CID: 138492, 138495, 143064)
Signed-off-by: Tom Rini <trini@konsulko.com>
7 years agocmd/time.c: Initialize 'repeatable' variable
Tom Rini [Wed, 27 Sep 2017 01:12:05 +0000 (21:12 -0400)]
cmd/time.c: Initialize 'repeatable' variable

We cannot leave this uninitialized, set it to 0.

Reported-by: Coverity (CID: 144426)
Signed-off-by: Tom Rini <trini@konsulko.com>
7 years agocmd/pxe.c: Rework initrd and bootargs handling slightly
Tom Rini [Wed, 27 Sep 2017 00:44:32 +0000 (20:44 -0400)]
cmd/pxe.c: Rework initrd and bootargs handling slightly

For the initrd portion of handling our bootm arguments we do not have a
sufficiently long enough buffer for some improbable 64bit cases.  Expand
this buffer to allow for a 64bit address and almost 256MB initrd to be
used.  Make use of strncpy/strncat when constructing the values here
since we know what the worst case valid values are, length wise.

Similarly for bootargs themselves, we need to make use of strlen/sizeof
and strncpy/strncat to ensure that we don't overflow bootargs itself.

Cc: Simon Glass <sjg@chromium.org>
Cc: Alexander Graf <agraf@suse.de>
Reported-by: Coverity (CID: 131256)
Signed-off-by: Tom Rini <trini@konsulko.com>
7 years agocmd/nvedit.c: Update input handling to cover overflow cases
Tom Rini [Tue, 26 Sep 2017 23:37:11 +0000 (19:37 -0400)]
cmd/nvedit.c: Update input handling to cover overflow cases

When we have multiple messages provided, we need to be sure that we do
not exceed the length of our 'message' buffer.  In the for loop, make
sure that pos is not larger than message.  Only copy in at most however
much of the message buffer remains.  Finally, if we have not reached the
end of the message buffer, put in a space and NULL, and if we have,
ensure the buffer is now NULL termined.

Reported-by: Coverity (CID: 165116)
Signed-off-by: Tom Rini <trini@konsulko.com>
7 years agotest/dm: Fix string handling issues in the eth test
Tom Rini [Tue, 26 Sep 2017 18:08:30 +0000 (14:08 -0400)]
test/dm: Fix string handling issues in the eth test

Coverity scan has identified potential buffer overruns in these tests.
Correct this by zeroing our buffer and using strncpy not strcpy.

Reported-by: Coverity (CID: 155462, 155463)
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
7 years agotest/overlay: Fix various malloc/free leaks
Tom Rini [Tue, 26 Sep 2017 16:43:12 +0000 (12:43 -0400)]
test/overlay: Fix various malloc/free leaks

With the overlay tests now being built in sandbox Coverity has found a
number of issues in the tests.  In short, if malloc ever failed we would
leak the previous mallocs, so we need to do the usual goto pattern to
free each in turn.  Finally, we always looked at the free()d location to
see how many tests had failed for the return code.

Reported-by: Coverity (CID: 167224, 167227, 167230, 167236)
Signed-off-by: Tom Rini <trini@konsulko.com>
7 years agoGPT: fix memory leaks identified by Coverity
Alison Chaiken [Tue, 26 Sep 2017 14:42:28 +0000 (07:42 -0700)]
GPT: fix memory leaks identified by Coverity

Create a common exit for most of the error handling code in
do_rename_gpt_parts.   Delete the list elements in disk_partitions
before calling INIT_LIST_HEAD from get_gpt_info() a second time.

The SIZEOF_MISMATCH error is not addressed, since that problem was
already fixed by "GPT: incomplete initialization in
allocate_disk_part".

Signed-off-by: Alison Chaiken <alison@peloton-tech.com>
Reported-by: Coverity (CID: 167222, 167235, 167237)
Reviewed-by: Tom Rini <trini@konsulko.com>
7 years agofs-test: Add test for a filename using '..' to go back to the root
Tuomas Tynkkynen [Mon, 25 Sep 2017 19:06:34 +0000 (22:06 +0300)]
fs-test: Add test for a filename using '..' to go back to the root

The previous commit fixed a problem in FAT code where going back to the
root directory using '..' wouldn't work correctly on FAT12 or FAT16.
Add a test to exercise this case (which was once fixed in commit
18a10d46f26 "fat: handle paths that include ../" but reintroduced due to
the directory iterator refactoring).

This test only very barely catches the problem - without the fix the
size command still gives valid output but the additional spurious
"Invalid FAT entry" error message makes it not get caught in the
'egrep -A3 ' output. I tried to make a proper test that grows the root
directory to two clusters lots of with dummy files but that causes the
write tests to crash the sandbox totally...

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Reviewed-by: Tom Rini <trini@konsulko.com>
7 years agofs/fat: Fix pathnames using '..' that lead to the root directory
Tuomas Tynkkynen [Mon, 25 Sep 2017 19:06:33 +0000 (22:06 +0300)]
fs/fat: Fix pathnames using '..' that lead to the root directory

If we end up back in the root directory via a '..' directory entry, set
itr->is_root accordingly. Failing to do that gives spews like
"Invalid FAT entry" and being unable to access directory entries located
past the first cluster of the root directory.

Fixes: 8eafae209c35 ("fat/fs: convert to directory iterators")
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
7 years agofs-test: Add FAT16 support
Tuomas Tynkkynen [Mon, 25 Sep 2017 19:06:32 +0000 (22:06 +0300)]
fs-test: Add FAT16 support

Currently we can only test FAT32 which is the default FAT version that
mkfs.vfat creates by default. Instead make it explicitly create either a
FAT16 or a FAT32 volume. This allows us to exercise more code, for
instance the root directory handling is done differently in FAT32 than
the older FATs.

Adding FAT12 support is a much bigger job since the test creates a 2.5GB
file and the FAT12 maximum partition size is way smaller than that.

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Reviewed-by: Tom Rini <trini@konsulko.com>
7 years agofs/ext4: Fix group descriptor checksum calculation
Tuomas Tynkkynen [Mon, 25 Sep 2017 19:06:31 +0000 (22:06 +0300)]
fs/ext4: Fix group descriptor checksum calculation

The current code doesn't compute the group descriptor checksum correctly
for the filesystems that e2fsprogs 1.43.4 creates (they have
'Group descriptor size: 64' as reported by tune2fs). Extend the checksum
calculation to be done as ext4_group_desc_csum() does in Linux.

This fixes these errors in dmesg from running fs-test.sh and makes it
succeed again:

[1671902.620699] EXT4-fs (loop1): ext4_check_descriptors: Checksum for group 0 failed (35782!=10965)
[1671902.620706] EXT4-fs (loop1): group descriptors corrupted!

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
7 years agodoc: Fix statements on case sensitivity for regulator prefix
Felix Brack [Fri, 22 Sep 2017 12:27:28 +0000 (14:27 +0200)]
doc: Fix statements on case sensitivity for regulator prefix

The regulator bindings state that regulator prefixes are allowd to be
in upper or lower case. However pmic_bind_children from pmic_uclass uses
strncmp to compare DT node name against prefix. This comparison is case
sensitive hence the regulator driver prefix case matters.

Signed-off-by: Felix Brack <fb@ltec.ch>
7 years agoomap: Fix warning when looking for userdata part
Sam Protsenko [Thu, 21 Sep 2017 22:51:59 +0000 (01:51 +0300)]
omap: Fix warning when looking for userdata part

When eMMC was formattaed for Linux partition table, "userdata" partition
is missing. In this case, part_get_info_by_name() iterates over all
registered drivers (which are PART_TYPE_EFI, PART_TYPE_DOS and
PART_TYPE_ISO). And when it comes to PART_TYPE_ISO (which has empty
partition table), we can see next warning in U-Boot output:

    ** First descriptor is NOT a primary desc on 1:1 **

This patch switches to part_get_info_by_name_type() API in order to
check only EFI partitions for "userdata" partitions. This eliminates
mentioned warning.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agodisk: Provide API to get partition by name for specific type
Sam Protsenko [Thu, 21 Sep 2017 22:51:58 +0000 (01:51 +0300)]
disk: Provide API to get partition by name for specific type

There is already existing function part_get_info_by_name().
But sometimes user is particularly interested in looking for only
specific partition type. This patch implements such an API that
provides partition searching by name for specified partition type.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agoomap: Omit fastboot.userdata_size related errors
Sam Protsenko [Thu, 21 Sep 2017 20:01:00 +0000 (23:01 +0300)]
omap: Omit fastboot.userdata_size related errors

When using regular $partitions variable (for Linux boot), we can see
some unwanted messages:

> ERROR: cannot find partition: 'userdata'

> at arch/arm/mach-omap2/utils.c:96/omap_mmc_get_part_size()
> Warning: fastboot.userdata_size: unable to calc

Let's remove those, as missing 'userdata' partition is correct behavior
for Linux partition, and we don't want to see some Android-related
messages in this case.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
7 years agotravis.yml: Add job for running test.py in qemu_arm
Tuomas Tynkkynen [Tue, 19 Sep 2017 20:18:08 +0000 (23:18 +0300)]
travis.yml: Add job for running test.py in qemu_arm

Note that this commit requires
https://github.com/swarren/uboot-test-hooks/pull/14 to go in first.

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
7 years agoARM: Add a new arch + board for QEMU's 'virt' machine
Tuomas Tynkkynen [Tue, 19 Sep 2017 20:18:07 +0000 (23:18 +0300)]
ARM: Add a new arch + board for QEMU's 'virt' machine

This board builds an U-Boot binary that is bootable with QEMU's 'virt'
machine on ARM. The minimal QEMU command line is:

    qemu-system-arm -machine virt,highmem=off -bios u-boot.bin

(Note that the 'highmem=off' parameter to the 'virt' machine is required for
PCI to work in U-Boot.) This command line enables the following:
    - u-boot.bin loaded and executing in the emulated flash at address 0x0
    - A generated device tree blob placed at the start of RAM
    - A freely configurable amount of RAM, described by the DTB
    - A PL011 serial port, discoverable via the DTB
    - An ARMv7 architected timer
    - PSCI for rebooting the system
    - A generic ECAM-based PCI host controller, discoverable via the DTB

Additionally, QEMU allows plugging a bunch of useful peripherals to the PCI bus.
The following ones are supported by both U-Boot and Linux:

- To add a Serial ATA disk via an Intel ICH9 AHCI controller, pass e.g.:
    -drive if=none,file=disk.img,id=mydisk -device ich9-ahci,id=ahci -device ide-drive,drive=mydisk,bus=ahci.0
- To add an Intel E1000 network adapter, pass e.g.:
    -net nic,model=e1000 -net user
- To add an EHCI-compliant USB host controller, pass e.g.:
    -device usb-ehci,id=ehci
- To add a NVMe disk, pass e.g.:
    -drive if=none,file=disk.img,id=mydisk -device nvme,drive=mydisk,serial=foo

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
7 years agoPCI: Add driver for a 'pci-host-ecam-generic' host controller
Tuomas Tynkkynen [Tue, 19 Sep 2017 20:18:06 +0000 (23:18 +0300)]
PCI: Add driver for a 'pci-host-ecam-generic' host controller

QEMU emulates such a device with '-machine virt,highmem=off' on ARM.
The 'highmem=off' part is required for things to work as the PCI code
in U-Boot doesn't seem to support 64-bit BARs.

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agopci: layerscape: Use pci_generic_mmap_{read, write}_config
Tuomas Tynkkynen [Tue, 19 Sep 2017 20:18:05 +0000 (23:18 +0300)]
pci: layerscape: Use pci_generic_mmap_{read, write}_config

Use the new helpers to avoid boilerplate in the driver.

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agopci: xilinx: Use pci_generic_mmap_{read, write}_config()
Tuomas Tynkkynen [Tue, 19 Sep 2017 20:18:04 +0000 (23:18 +0300)]
pci: xilinx: Use pci_generic_mmap_{read, write}_config()

Use the new helper function to avoid boilerplate in the driver.

Note that this changes __raw_writel et al. to writel. AFAICT this is
no problem because:

- The Linux driver for the same hardware uses the non-__raw variants as
  well (via pci_generic_config_write()).
- This driver seems to be used only on MIPS so far, where the __raw and
  non-__raw accessors are the same.

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agopci: Add helper for implementing memory-mapped config space accesses
Tuomas Tynkkynen [Tue, 19 Sep 2017 20:18:03 +0000 (23:18 +0300)]
pci: Add helper for implementing memory-mapped config space accesses

This sort of pattern for implementing memory-mapped PCI config space
accesses appears in U-Boot twice already, and a third user is coming up.
So add helper functions to avoid code duplication, similar to how Linux
has pci_generic_config_write and pci_generic_config_read.

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
7 years agoomap: detect board before spl_early_init()
Jean-Jacques Hiblot [Fri, 15 Sep 2017 10:57:33 +0000 (12:57 +0200)]
omap: detect board before spl_early_init()

In order to be able to select the right DTB, we need to have identified the
board before spl_early_init() is called.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agospl: dm: Make it possible for the SPL to pick its own DTB from a FIT
Jean-Jacques Hiblot [Fri, 15 Sep 2017 10:57:32 +0000 (12:57 +0200)]
spl: dm: Make it possible for the SPL to pick its own DTB from a FIT

u-boot can be embedded within a FIT image with multiple DTBs. It then
selects at run-time  which one is best suited for the platform.
Use the same principle here for the SPL: put the DTBs in a FIT image,
compress it (LZO, GZIP, or no compression) and append it at the end of the
SPL.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
[trini: Move default y of SPL_MULTI_DTB_FIT_DYN_ALLOC to it being the
default choice if SYS_MALLOC_F, drop spl.h include from lib/fdtdec.c
it's unused.]
Signed-off-by Tom Rini <trini@konsulko.com>

7 years agofdtdec: sort include files
Jean-Jacques Hiblot [Fri, 15 Sep 2017 10:57:31 +0000 (12:57 +0200)]
fdtdec: sort include files

Sort include files in accordance to U-Boot coding style.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
7 years agolib: allow building lzo for the SPL
Jean-Jacques Hiblot [Fri, 15 Sep 2017 10:57:30 +0000 (12:57 +0200)]
lib: allow building lzo for the SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agogzip: add a function to parse the header
Jean-Jacques Hiblot [Fri, 15 Sep 2017 10:57:29 +0000 (12:57 +0200)]
gzip: add a function to parse the header

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agolzo: add a function to check the validity of the header
Jean-Jacques Hiblot [Fri, 15 Sep 2017 10:57:28 +0000 (12:57 +0200)]
lzo: add a function to check the validity of the header

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agofit: If no matching config is found in fit_find_config_node(), use the default one
Jean-Jacques Hiblot [Fri, 15 Sep 2017 10:57:27 +0000 (12:57 +0200)]
fit: If no matching config is found in fit_find_config_node(), use the default one

If board_fit_config_name_match() doesn't match any configuration node,
then use the default one (if provided).

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agofit: fixed bug in locate_dtb_in_fit()
Jean-Jacques Hiblot [Fri, 15 Sep 2017 10:57:26 +0000 (12:57 +0200)]
fit: fixed bug in locate_dtb_in_fit()

If the dtb is the first data of the FIT, the its offset is 0x0. Change the
test to '<' instead of '<='

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agofit: use 'const' for the input of fdt_offset() and locate_dtb_in_fit()
Jean-Jacques Hiblot [Fri, 15 Sep 2017 10:57:25 +0000 (12:57 +0200)]
fit: use 'const' for the input of fdt_offset() and locate_dtb_in_fit()

Those 2 functions don't modify their input, we can mark it const.
This prevents compilation warnings when they are provided const input.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agodts: renamed FIT_EMBED to MULTI_DTB_FIT and moved it to the dts Kconfig
Jean-Jacques Hiblot [Fri, 15 Sep 2017 10:57:24 +0000 (12:57 +0200)]
dts: renamed FIT_EMBED to MULTI_DTB_FIT and moved it to the dts Kconfig

CONFIG_FIT_EMBED might be confused with CONFIG_OF_EMBED, rename it
MULTI_DTB_FIT as it is able to get a DTB from a FIT image containing
multiple DTBs. Also move the option to the Kconfig dedicated to the DTS
options and create a README for this feature.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agolinux/kernel.h: import DIV_ROUND_{DOWN, UP}_ULL from Linux
Masahiro Yamada [Wed, 13 Sep 2017 10:16:44 +0000 (19:16 +0900)]
linux/kernel.h: import DIV_ROUND_{DOWN, UP}_ULL from Linux

These macros are useful to avoid link error on 32-bit systems.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
7 years agodisk: part_dos: Use the original allocation scheme for the SPL case
Fabio Estevam [Wed, 4 Oct 2017 16:29:57 +0000 (13:29 -0300)]
disk: part_dos: Use the original allocation scheme for the SPL case

Since commit ff98cb90514d ("part: extract MBR signature from partitions")
SPL boot on i.MX6 starts to fail:

U-Boot SPL 2017.09-00221-g0d6ab32 (Oct 02 2017 - 15:13:19)
Trying to boot from MMC1
(keep in loop)

Use the original allocation scheme for the SPL case, so that MX6 boards
can boot again.

This is a temporary solution to avoid the boot regression.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Tested-by: Peter Robinson <pbrobinson@gmail.com>
7 years agoMerge git://git.denx.de/u-boot-sunxi
Tom Rini [Thu, 5 Oct 2017 12:26:36 +0000 (08:26 -0400)]
Merge git://git.denx.de/u-boot-sunxi

7 years agocommon: Drop LOGLEVEL to 4
Tom Rini [Wed, 4 Oct 2017 20:44:30 +0000 (16:44 -0400)]
common: Drop LOGLEVEL to 4

While this came in with a default value of 6 I am lowering this to 4.
The MTD/UBI code has a large number of error messages that we include
now.  In addition, "normally" warning messages are not included so this
feels like a more natural level to have.

Signed-off-by: Tom Rini <trini@konsulko.com>
7 years agodm: replace dm_dbg() with pr_debug()
Masahiro Yamada [Fri, 29 Sep 2017 03:31:20 +0000 (12:31 +0900)]
dm: replace dm_dbg() with pr_debug()

As we discussed before in ML, dm_dbg() causes undefined reference
error if #define DEBUG is added to users, but not drivers/core/util.c

We do not need this macro because we can use pr_debug() instead, and
it is pretty easy to enable it for the DM core by using ccflags-y.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
7 years agolinux/bitfield.h: import <linux/bitfield.h> from Linux 4.13
Masahiro Yamada [Fri, 29 Sep 2017 01:35:17 +0000 (10:35 +0900)]
linux/bitfield.h: import <linux/bitfield.h> from Linux 4.13

Copied from Linux 4.13.

Commit log of 3e9b3112ec74 of Linux explains well why this header
is useful.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
7 years agodm: define dev_*() log functions in DM header
Masahiro Yamada [Tue, 26 Sep 2017 02:58:29 +0000 (11:58 +0900)]
dm: define dev_*() log functions in DM header

Many drivers had started to use dev_err, dev_info, etc. for log
functions.  Currently, we are relying on <linux/compat.h>, but I
guess the best home is <dm/device.h>, taking into account that
Linux defines them in <linux/device.h>.

For now, I am leaving the ones in <linux/compat.h> because lots of
Linux-originated code uses dev_*(), but the first argument is not
struct udevice, so we need to ignore the bogus argument.  More
efforts are needed to iron out the issues.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
7 years agobug.h: move runtime BUG/WARN macros into <linux/bug.h>
Masahiro Yamada [Sat, 16 Sep 2017 05:10:45 +0000 (14:10 +0900)]
bug.h: move runtime BUG/WARN macros into <linux/bug.h>

Collect runtime BUG/WARN into a self-contained header <linux/bug.h>
to make these macros easier to use.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
7 years agobug.h: sync BUILD_BUG stuff with Linux 4.13
Masahiro Yamada [Sat, 16 Sep 2017 05:10:44 +0000 (14:10 +0900)]
bug.h: sync BUILD_BUG stuff with Linux 4.13

As commit 84b8bf6d5d2a ("bug.h: move BUILD_BUG_* defines to
include/linux/bug.h") noted, include/linux/bug.h was locally
modified for U-Boot because the name conflict of error() caused
build errors at that time.

Now error() is gone, so we can fully sync BUILD_BUG* with Linux.
These macros are just compile-time utilities.  Nothing depends on
platform code, so it should make sense to simply copy Linux's ones.

Please note Linux split BUILD_BUG stuff out into <linux/build_bug.h>
by commit bc6245e5efd7.  Let's follow it.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>