oweals/u-boot.git
6 years agomips: mt76xx: Add watchdog DT node to mt7628a.dtsi
Stefan Roese [Tue, 9 Oct 2018 06:59:08 +0000 (08:59 +0200)]
mips: mt76xx: Add watchdog DT node to mt7628a.dtsi

Add the watchdog DT node to the DTS file.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
6 years agomips: mt76xx: Add GPIO DT nodes to mt7628a.dtsi
Stefan Roese [Tue, 9 Oct 2018 06:59:07 +0000 (08:59 +0200)]
mips: mt76xx: Add GPIO DT nodes to mt7628a.dtsi

Add the GPIO DT nodes to the DTS file.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
6 years agomips: mt76xx: Add ethernet DT node to mt7628a.dtsi
Stefan Roese [Tue, 9 Oct 2018 06:59:06 +0000 (08:59 +0200)]
mips: mt76xx: Add ethernet DT node to mt7628a.dtsi

Add the ethernet DT node to the DTS file.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
6 years agomips: mt76xx: lowlevel_init.S: Add missing memory controller reset in DDR init
Stefan Roese [Tue, 9 Oct 2018 06:59:04 +0000 (08:59 +0200)]
mips: mt76xx: lowlevel_init.S: Add missing memory controller reset in DDR init

This fixes an issue which has been noticed on the Gardena board, with
the watchdog enabled, where the watdchdog reset (after a system hang)
did result in reporting of 2.9 GiB and a hang after this. With this
patch applied the memory controller is correctly reset and initialized
again even after a watchdog reset.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
6 years agogpio: Add MT7621 GPIO support
Stefan Roese [Mon, 8 Oct 2018 10:38:01 +0000 (12:38 +0200)]
gpio: Add MT7621 GPIO support

This patch adds GPIO support for the Mediatek MT7621 SoC, tested on
MT7688 (Gardena smart-gateway). The driver is loosly based on the
Linux kernel version.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
[fixed checkpatch.pl warnings: Prefer 'unsigned int' to bare use of 'unsigned']
Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
6 years agowdt: Add MT7621 watchdog driver
Stefan Roese [Thu, 4 Oct 2018 11:39:07 +0000 (13:39 +0200)]
wdt: Add MT7621 watchdog driver

This patch adds watchdog support for the Mediatek MT7621 SoC. The driver
is loosly based on the Linux kernel version.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
[fixed merge conflict in drivers/watchdog/Kconfig]
Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
6 years agoMerge branch '2018-11-16-master-imports'
Tom Rini [Sat, 17 Nov 2018 13:19:40 +0000 (08:19 -0500)]
Merge branch '2018-11-16-master-imports'

- Initial bcm968580xref, am65x_evm_r5 support
- lpc32xx, omap3_logic/am3517_evm updates
- pinctrl command
- fs_loader available for SPL

6 years agosunxi: Update MAINTAINERS file for recent boards
Tom Rini [Fri, 16 Nov 2018 14:32:31 +0000 (09:32 -0500)]
sunxi: Update MAINTAINERS file for recent boards

Add entries for the pine64-lts and pinebook configs.

Cc: Vasily Khoruzhick <anarsoul@gmail.com>
Cc: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agofdt_region: Ensure that depth never goes below -1
Konrad Beckmann [Wed, 7 Nov 2018 19:51:46 +0000 (14:51 -0500)]
fdt_region: Ensure that depth never goes below -1

A specially crafted FIT image makes it possible to overflow the stack
with controlled values when using the verified boot feature. Depending
on the memory layout, this could be used to overwrite configuration
variables on the heap and setting them to 0, e.g. disable signature
verification, thus bypassing it.

This change fixes a bug in fdt_find_regions where the fdt structure is
parsed. A lower value than -1 of depth can lead to a buffer underflow
write on the stack.

Signed-off-by: Konrad Beckmann <konrad.beckmann@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoimage-sig: Ensure that hashed-nodes is null-terminated
Konrad Beckmann [Wed, 7 Nov 2018 19:51:45 +0000 (14:51 -0500)]
image-sig: Ensure that hashed-nodes is null-terminated

A specially crafted FIT image leads to memory corruption in the stack
when using the verified boot feature. The function fit_config_check_sig
has a logic error that makes it possible to write past the end of the
stack allocated array node_inc. This could potentially be used to bypass
the signature check when using verified boot.

This change ensures that the number of strings is correct when counted.

Signed-off-by: Konrad Beckmann <konrad.beckmann@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoAbility to modify distro boot filename
Martyn Welch [Tue, 6 Nov 2018 12:23:53 +0000 (12:23 +0000)]
Ability to modify distro boot filename

Add in the ability to modify the distro boot filename. Whilst not
immediately useful in normal usage, it allows an alternative
configuration to be provided when other u-boot functionality is used, such
as bootcount limit, to fallback to an alternative boot configuration. In
this case we can follow the same boot path as for normal boot, just
using an alternatively named configuration file.

For example, by providing the following `altbootcmd` when bootcount is in
use:

altbootcmd=setenv boot_extlinx_conf extlinux-rollback.conf; \
run distro_bootcmd

Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
6 years agomisc: fs_loader: Fix compiler warning
Keerthy [Mon, 5 Nov 2018 06:04:54 +0000 (11:34 +0530)]
misc: fs_loader: Fix compiler warning

Fix compiler warning

drivers/misc/fs_loader.c:193:9: warning: format ‘%d’ expects
argument of type ‘int’, but argument 5 has type ‘size_t
{aka long unsigned int}’ [-Wformat=]

Signed-off-by: Keerthy <j-keerthy@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agomisc: fs_loader: Use device_get_global_by_ofnode to get to node
Keerthy [Mon, 5 Nov 2018 06:04:53 +0000 (11:34 +0530)]
misc: fs_loader: Use device_get_global_by_ofnode to get to node

Instead of two staged ofnode_to_offset followed by
device_get_global_by_of_offset approach, direcly use the
device_get_global_by_ofnode to fetch the device.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agofs: Makefile: Add fs.c under SPL for fs_loader
Keerthy [Mon, 5 Nov 2018 06:04:52 +0000 (11:34 +0530)]
fs: Makefile: Add fs.c under SPL for fs_loader

Add fs.c under SPL as well as it is needed for fs_loader

Signed-off-by: Keerthy <j-keerthy@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
[trini: Add as obj-$(CONFIG_FS_LOADER) for non-SPL_FRAMEWORK builds]
Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agoserial: ns16550: add setconfig support
Simon Goldschmidt [Fri, 2 Nov 2018 20:28:08 +0000 (21:28 +0100)]
serial: ns16550: add setconfig support

Add possibility to update the serial parity used.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Hannes Schmelzer <hannes.schmelzer@br-automation.com>
6 years agodm: serial: fix comment on dm_serial_ops setconfig
Simon Goldschmidt [Fri, 2 Nov 2018 20:08:16 +0000 (21:08 +0100)]
dm: serial: fix comment on dm_serial_ops setconfig

The comment on this function prototype describes nonexistent
parameters. It seems to be copied from 'setparity'.

Update it to match its the parameter list.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoboard: ti: am65x: Update README to add R5 build support
Lokesh Vutla [Fri, 2 Nov 2018 14:21:11 +0000 (19:51 +0530)]
board: ti: am65x: Update README to add R5 build support

Update the README file to add r5 build support and system
firmware support.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
6 years agoconfigs: am65x_evm_r5: Add initial support
Lokesh Vutla [Fri, 2 Nov 2018 14:21:10 +0000 (19:51 +0530)]
configs: am65x_evm_r5: Add initial support

Add initial defconfig support for AM65x
that runs on R5.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Signed-off-by: Keerthy <j-keerthy@ti.com>
6 years agoarmv7r: dts: am654: Add initial support
Lokesh Vutla [Fri, 2 Nov 2018 14:21:09 +0000 (19:51 +0530)]
armv7r: dts: am654: Add initial support

Add R5 specific dts for am654-evm.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Signed-off-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Schuyler Patton <spatton@ti.com>
Signed-off-by: James Doublesin <doublesin@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
6 years agoarm: dts: k3: Sync dts from Linux
Lokesh Vutla [Fri, 2 Nov 2018 14:21:08 +0000 (19:51 +0530)]
arm: dts: k3: Sync dts from Linux

Sync the k3-am654 specific dts files from Linux next with tag
20181019. This changes are in queue for Linux v4.20-rc1

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
6 years agoboard: ti: am654: r5: Add initial support for am654
Lokesh Vutla [Fri, 2 Nov 2018 14:21:07 +0000 (19:51 +0530)]
board: ti: am654: r5: Add initial support for am654

Add initial support for AM654 based EVM running on R5.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
6 years agoarmv7R: K3: am654: Add support for triggering ddr init from SPL
Lokesh Vutla [Fri, 2 Nov 2018 14:21:06 +0000 (19:51 +0530)]
armv7R: K3: am654: Add support for triggering ddr init from SPL

In SPL, DDR should be made available by the end of board_init_f()
so that apis in board_init_r() can use ddr. Adding support
for triggering DDR initialization from board_init_f().

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
6 years agoarmv7R: K3: am654: Add support to start ATF from R5 SPL
Lokesh Vutla [Fri, 2 Nov 2018 14:21:05 +0000 (19:51 +0530)]
armv7R: K3: am654: Add support to start ATF from R5 SPL

Considering the boot time requirements, Cortex-A core
should be able to start immediately after SPL on R5.
Add support for the same.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
6 years agoarmv7R: K3: am654: Add support for generating build targets
Lokesh Vutla [Fri, 2 Nov 2018 14:21:04 +0000 (19:51 +0530)]
armv7R: K3: am654: Add support for generating build targets

Update Makefiles to generate:
- tiboot3.bin: Image format that can be processed by ROM.

Below is the tiboot3.bin image format that is required by ROM:

 _______________________
|  X509 |
|     Certificate |
| ____________________ |
| |       | |
| | u-boot-spl.bin    | |
| |       | |
| |___________________| |
|_______________________|

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
6 years agoarmv7R: K3: am654: Enable MPU regions
Lokesh Vutla [Fri, 2 Nov 2018 14:21:03 +0000 (19:51 +0530)]
armv7R: K3: am654: Enable MPU regions

Enable MPU regions for AM654 evm:
- Region0: 0x00000000 - 0xFFFFFFFF: Device memory, not executable
- Region1: 0x41c00000 - 0x42400000: Normal, executable, WB, Write alloc
- Region2: 0x80000000 - 0xFFFFFFFF: Normal, executable, WB, Write alloc
- region3-15: Disabled

With this dcache can be enabled either in SPL or U-Boot.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
6 years agoram: Introduce K3 AM654 DDR Sub System driver
Lokesh Vutla [Fri, 2 Nov 2018 14:21:02 +0000 (19:51 +0530)]
ram: Introduce K3 AM654 DDR Sub System driver

K3 based AM654 devices has DDR memory subsystem that comprises
Synopys DDR controller, Synopsis DDR phy and wrapper logic to
intergrate these blocks into the device. This DDR subsystem
provides an interface to external SDRAM devices. Adding support
for the initialization of the external SDRAM devices by
configuring the DDRSS registers and using the buitin PHY
routines.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Signed-off-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Schuyler Patton <spatton@ti.com>
Signed-off-by: James Doublesin <doublesin@ti.com>
6 years agoi2c: stm32f7: change setup struct to const
Patrick Delaunay [Mon, 29 Oct 2018 14:31:56 +0000 (15:31 +0100)]
i2c: stm32f7: change setup struct to const

Change static array to const when it is useful to save memory
(move stm32f7_setup=0x18 from .data to .rodata section)

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
6 years agoi2c: stm32f7: cosmetic: clean the driver
Patrick Delaunay [Mon, 29 Oct 2018 14:31:55 +0000 (15:31 +0100)]
i2c: stm32f7: cosmetic: clean the driver

Solve alignments issues in the driver to avoid
checkpatch error.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
6 years agoARM: am3517_evm: Remove SPL_OF_CONTROL and OF_PLATDATA
Adam Ford [Sun, 28 Oct 2018 13:49:57 +0000 (08:49 -0500)]
ARM: am3517_evm: Remove SPL_OF_CONTROL and OF_PLATDATA

After the recomendation, some testing shows like these are unnecessary.

Suggested-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Signed-off-by: Adam Ford <aford173@gmail.com>
6 years agoARM: omap3_logic: Remove SPL_OF_CONTROL and OF_PLATDATA
Adam Ford [Sun, 28 Oct 2018 13:49:56 +0000 (08:49 -0500)]
ARM: omap3_logic: Remove SPL_OF_CONTROL and OF_PLATDATA

After the recomendation, some testing shows like these are unnecessary.

Suggested-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Signed-off-by: Adam Ford <aford173@gmail.com>
6 years agoarm: Make arch specific memcpy thumb-safe.
Klaus Goger [Thu, 26 Apr 2018 18:18:10 +0000 (20:18 +0200)]
arm: Make arch specific memcpy thumb-safe.

The current arch implementation of memcpy cannot be called
from thumb code, because it does not use bx instructions on return.
This patch addresses that. Note, that this patch does not touch
the hot loop of memcpy, so performance is not affected.

Tested on MXS (arm926ejs) with and without thumb-mode enabled.

Signed-off-by: Klaus Goger <klaus.goger@theobroma-systems.com>
Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com>
6 years agotest/py: test pinmux command
Patrice Chotard [Wed, 24 Oct 2018 12:10:23 +0000 (14:10 +0200)]
test/py: test pinmux command

Add pinmux test which test the following commands:
  - pinmux list
  - pinmux dev
  - pinmux status

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
[trini: Mark some tests as sandbox-centric]
Signed-off-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agopinctrl: sandbox: Add get_pin_muxing ops support
Patrice Chotard [Wed, 24 Oct 2018 12:10:22 +0000 (14:10 +0200)]
pinctrl: sandbox: Add get_pin_muxing ops support

Add get_pin_mux ops support to display the pin muxing
description of the sandbox_pins[]

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agogpio: stm32f7: Add ops get_function
Patrice Chotard [Wed, 24 Oct 2018 12:10:21 +0000 (14:10 +0200)]
gpio: stm32f7: Add ops get_function

This patch adds gpio get_function ops support.
This function reports the state of a gpio.

Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
6 years agopinctrl: stm32: Add get_pin_muxing() ops
Patrice Chotard [Wed, 24 Oct 2018 12:10:20 +0000 (14:10 +0200)]
pinctrl: stm32: Add get_pin_muxing() ops

Add get_pin_muxing() ops to obtain the pin muxing description
a given pin index.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agopinctrl: stm32: Add get_pin_name() ops
Patrice Chotard [Wed, 24 Oct 2018 12:10:19 +0000 (14:10 +0200)]
pinctrl: stm32: Add get_pin_name() ops

Add get_pin_name ops to obtain a pin name given a
pin index of a specified pin-controller.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agopinctrl: stm32: Add get_pins_count() ops
Patrice Chotard [Wed, 24 Oct 2018 12:10:18 +0000 (14:10 +0200)]
pinctrl: stm32: Add get_pins_count() ops

Add get_pins_count ops to obtain the number of pins
owns by a pin-controller.
On STM32 SoCs bindings, each pin-controller owns
several gpio banks. Each GPIO bank can own up to 16 pins.

To obtain the total pins count, walk through each sub-nodes
(ie GPIO banks) and sum each GPIO banks pins number. For that
in probe() we build a list with each GPIO device reference found.
This list will also be used with future get_pin_muxing and get_pin_name
ops to speed up and optimize walk through all GPIO banks.

As this code is common to all STM32 SoCs, this code is put
under SPL_BUILD compilation flag to avoid to increase SPL code size
for STM32F7 which is limited to 32Ko.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agocmd: pinmux: Add pinmux command
Patrice Chotard [Wed, 24 Oct 2018 12:10:17 +0000 (14:10 +0200)]
cmd: pinmux: Add pinmux command

pinmux command allows to :
 - list all pin-controllers available on platforms
 - select a pin-controller
 - display the muxing of all pins of the current pin-controller
   or all pin-controllers depending of given options

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
cmd: pinmux: Fix pinmux command

if "pinmux status" command is used without having
set dev using "pinmux dev", print pinmux usage
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agodm: uclass: Add uclass_foreach_dev_probe
Patrice Chotard [Wed, 24 Oct 2018 12:10:16 +0000 (14:10 +0200)]
dm: uclass: Add uclass_foreach_dev_probe

Add uclass_foreach_dev_probe() which iterates through
devices of a given uclass. Devices are probed if necessary
and are ready to use.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agodm: uclass: Add uclass_next_device_err() to return a valid device
Patrice Chotard [Wed, 24 Oct 2018 12:10:15 +0000 (14:10 +0200)]
dm: uclass: Add uclass_next_device_err() to return a valid device

Similarly to uclass_first_device_err(), add uclass_next_device_err()
which returns an error if there are no next devices in that uclass.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agodm: pinctrl: Add pinctrl_get_pin_name and pinctrl_get_pins_count
Patrice Chotard [Wed, 24 Oct 2018 12:10:14 +0000 (14:10 +0200)]
dm: pinctrl: Add pinctrl_get_pin_name and pinctrl_get_pins_count

Add pinctrl_get_pin_name() and pinctrl_get_pins_count() methods
to obtain pin's name and pin's muxing given a pin reference.

This will be used by the new pinmux command.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agodm: pinctrl: Add get_pin_muxing() ops
Patrice Chotard [Wed, 24 Oct 2018 12:10:13 +0000 (14:10 +0200)]
dm: pinctrl: Add get_pin_muxing() ops

Add get_pin_muxing() which allows to display the muxing
of a given pin belonging to a pin-controller.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agow1-eeprom: Add support for Maxim DS2502 add only memory
Martin Fuzzey [Wed, 24 Oct 2018 08:21:19 +0000 (10:21 +0200)]
w1-eeprom: Add support for Maxim DS2502 add only memory

Signed-off-by: Martin Fuzzey <martin.fuzzey@flowbird.group>
6 years agoARM: omap3_logic: Make CONFIG_SYS_TEXT_BASE match README.omap3
Adam Ford [Sun, 21 Oct 2018 18:58:39 +0000 (13:58 -0500)]
ARM: omap3_logic: Make CONFIG_SYS_TEXT_BASE match README.omap3

README.omap3 has two options.  For option 1, CONFIG_SYS_TEXT_BASE
is set to 0x80100000.  Option 2 lists 0x80008000.  The existing
value is neither of these, so this patch makes it equivalent to
Option 1.

Signed-off-by: Adam Ford <aford173@gmail.com>
6 years agoARM: am3517_evm: Build for Thumb
Adam Ford [Sun, 21 Oct 2018 15:50:59 +0000 (10:50 -0500)]
ARM: am3517_evm: Build for Thumb

In an effort to free up more resources in SPL and U-Boot, building
for Thumb shrinks the code side.

Before:

  text    data     bss     dec     hex filename
  685588  25808  275724  987120   f0ff0 u-boot

  text    data     bss     dec     hex filename
  55324     417   67460  123201   1e141 spl/u-boot-spl

After:

   text    data     bss     dec     hex filename
 515502   25808  275708  817018   c777a u-boot

   text    data     bss     dec     hex filename
  42910     417   67460  110787   1b0c3 spl/u-boot-spl

Signed-off-by: Adam Ford <aford173@gmail.com>
6 years agoconfigs: am3517_evm: Use default OMAP3 memory settings
Adam Ford [Sun, 21 Oct 2018 15:34:49 +0000 (10:34 -0500)]
configs: am3517_evm: Use default OMAP3 memory settings

The AM3517 is mostly am omap3, so this partch removes the custom
memory configurations and just uses the default common entries
for omap3 and armv7.

Signed-off-by: Adam Ford <aford173@gmail.com>
6 years agoARM: DTS: Resync am3517-evm.dts with Linux 4.19
Adam Ford [Sun, 21 Oct 2018 14:09:01 +0000 (09:09 -0500)]
ARM: DTS: Resync am3517-evm.dts with Linux 4.19

Some minor changes have been made to the AM3517-evm and the underlying
am3517.dtsi files.  This patch re-sync's the DTS and DTSI files with
Linux.

Signed-off-by: Adam Ford <aford173@gmail.com>
6 years agomtd: nand: lpc32xx slc: disable DMA support in SPL builds
Vladimir Zapolskiy [Fri, 19 Oct 2018 00:21:18 +0000 (03:21 +0300)]
mtd: nand: lpc32xx slc: disable DMA support in SPL builds

Testing and analysis shows that at the moment LPC32xx NAND SLC driver
can not get PL080 DMA backbone support in SPL build, because SPL NAND
loaders operate with subpage (ECC step to be precisely) reads, and
this is not supported in the NAND SLC + DMA + hardware ECC calculation
bundle.

The change removes a cautious build time warning and explicitly
disables DMA flavour of the driver for SPL builds, to reduce the
amound of #ifdef sections the code blocks are minimally reorganized.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
6 years agomtd: nand: lpc32xx mlc: predefine number of NAND chips to support
Vladimir Zapolskiy [Fri, 19 Oct 2018 00:21:05 +0000 (03:21 +0300)]
mtd: nand: lpc32xx mlc: predefine number of NAND chips to support

Build option CONFIG_SYS_MAX_NAND_CHIPS is used by NXP LPC32xx NAND MLC
driver only, as a preparation for potential removal or replacement of
the option the change predefines CONFIG_SYS_MAX_NAND_CHIPS to 1, same
value is used by the single user Work Microwave Work 92105 board, thus
it will be safe now to remove the option as a board specific one.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
6 years agogpio: pca953x: Clear the polarity invert register at init
Ye Li [Thu, 18 Oct 2018 14:16:46 +0000 (16:16 +0200)]
gpio: pca953x: Clear the polarity invert register at init

The pca953x_gpio driver uses default value of polarity inversion
register. For some devices like PCA9557 and MAX7310, their polarity
inversion register default value is 0xf0. So for high 4 ports, when
reading their values, the values are inverted as the actual level.

This patch clears the polarity inversion register to 0 at init, so
that the port read and write values are aligned.

Signed-off-by: Ye Li <ye.li@nxp.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
6 years agoclk: Allow clock defaults to be set also during re-reloc state
Andreas Dannenberg [Wed, 17 Oct 2018 08:13:14 +0000 (13:43 +0530)]
clk: Allow clock defaults to be set also during re-reloc state

The earlier commit f4fcba5c5ba ("clk: implement clk_set_defaults()")
which introduced the functionality for setting clock defaults such as
rates and parents will skip the processing when executing in a re-reloc
state. This for example can prevent the assigning of clock parents
when running in SPL code. Go ahead and remove this limitation.

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
6 years agobcm968580xref: add initial support
Philippe Reynes [Thu, 11 Oct 2018 16:31:59 +0000 (18:31 +0200)]
bcm968580xref: add initial support

This add the initial support of the broadcom reference
board bcm968580xref with a bcm6858 SoC.

This board has 512 MB of ram, 256 MB of flash (nand),
2 usb port, 1 uart, 4 ethernet ports (LAN), 1 ethernet port (WAN).

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
6 years agobcm6858: add initial support
Philippe Reynes [Thu, 11 Oct 2018 16:31:58 +0000 (18:31 +0200)]
bcm6858: add initial support

This add the initial support of the broadcom bcm6858 SoC family,
only the cpu, dram and uart are supported.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
6 years agoserial: bcm6858: add serial support
Philippe Reynes [Thu, 11 Oct 2018 16:31:57 +0000 (18:31 +0200)]
serial: bcm6858: add serial support

This driver add the support of serial on bcm6858.
It's based on serial for bcm6345.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
6 years agocmd/bdinfo: correct output of numerical values
Heinrich Schuchardt [Thu, 11 Oct 2018 11:15:01 +0000 (13:15 +0200)]
cmd/bdinfo: correct output of numerical values

Display all digits on 64bit systems. Currently we print only the lower
32 bits. Examples of values that can exceed 32 bits are the size and start of
memory banks.

For fdt_blob use the same output method as for other values. This avoids
misalignment.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
6 years agoarm: at91: wdt: Convert watchdog driver to dm/dt
Prasanthi Chellakumar [Tue, 9 Oct 2018 18:46:40 +0000 (11:46 -0700)]
arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support
the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG"
to new "CONFIG_WDT_AT91" Kconfig option.

Signed-off-by: Prasanthi Chellakumar <prasanthi.chellakumar@microchip.com>
6 years agoARMv8: SError exception handling in PSCI exception vectors
Chee Hong Ang [Mon, 20 Aug 2018 17:57:36 +0000 (10:57 -0700)]
ARMv8: SError exception handling in PSCI exception vectors

Allow platform vendors to handle SError interrupt exceptions from
ARMv8 PSCI exception vectors by overriding this weak function
'plat_error_handler'.

Signed-off-by: Chee Hong Ang <chee.hong.ang@intel.com>
6 years agoARMv8: Add EL3 exception handling for ARMv8's Kconfig
Chee Hong Ang [Mon, 20 Aug 2018 17:57:35 +0000 (10:57 -0700)]
ARMv8: Add EL3 exception handling for ARMv8's Kconfig

Kconfig option to allow all External Abort and SError exception
taken to EL3.

Signed-off-by: Chee Hong Ang <chee.hong.ang@intel.com>
6 years agoARMv8: Enable all asynchronous abort exceptions taken to EL3
Chee Hong Ang [Mon, 20 Aug 2018 17:57:34 +0000 (10:57 -0700)]
ARMv8: Enable all asynchronous abort exceptions taken to EL3

Allow EL3 to handle all the External Abort and SError interrupt
exception occur in all exception levels.

Signed-off-by: Chee Hong Ang <chee.hong.ang@intel.com>
6 years agoconfigs: Enable THUMB2 on various ARM boards
Tom Rini [Fri, 16 Nov 2018 18:32:59 +0000 (13:32 -0500)]
configs: Enable THUMB2 on various ARM boards

The clearfog, corvus, wb45n and picosam9g45 configs are close to
exceeding their size limits, so enable THUMB2 builds on them to reclaim
space.

Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agoMerge tag 'pull-14nov18' of git://git.denx.de/u-boot-dm
Tom Rini [Fri, 16 Nov 2018 13:37:50 +0000 (08:37 -0500)]
Merge tag 'pull-14nov18' of git://git.denx.de/u-boot-dm

- virtio implementation and supporting patches
- DM_FLAG_PRE_RELOC fixes
- regmap improvements
- minor buildman and sandbox things

6 years agotravis: Ensure we use pytest 2.8.7
Tom Rini [Thu, 15 Nov 2018 12:25:00 +0000 (07:25 -0500)]
travis: Ensure we use pytest 2.8.7

The latest version of pytest (4.0.0) makes some of the code we have in
test/py/conftest.py a fatal error that needs to be migrated.
Unfortunately this in turn requires changes that don't exist in older
versions of pytest such as 2.8.7 that ships with Ubuntu 16.04.  Force
travis to use this older version of pytest.

Signed-off-by: Tom Rini <trini@konsulko.com>
6 years agoMerge branch 'master' of git://git.denx.de/u-boot-sunxi
Tom Rini [Wed, 14 Nov 2018 23:25:34 +0000 (18:25 -0500)]
Merge branch 'master' of git://git.denx.de/u-boot-sunxi

6 years agoRevert "imx8qxp_mek: Disable CONFIG_DISPLAY_CPUINFO"
Bin Meng [Mon, 12 Nov 2018 15:02:17 +0000 (07:02 -0800)]
Revert "imx8qxp_mek: Disable CONFIG_DISPLAY_CPUINFO"

This reverts commit c5bbfaf05dc8592b479a44df6abaadbab54fec2b.

Disabling CONFIG_DISPLAY_CPUINFO was a temporary solution to get
the v2018.11 release out. Now the merge window opens, revert it.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agocpu: sandbox: Add "u-boot, dm-pre-reloc" for all cpu nodes
Bin Meng [Sun, 14 Oct 2018 08:07:20 +0000 (01:07 -0700)]
cpu: sandbox: Add "u-boot, dm-pre-reloc" for all cpu nodes

To support CONFIG_DISPLAY_CPUINFO, add "u-boot,dm-pre-reloc" for
all cpu nodes in Sandbox test.dts.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
6 years agocpu: Add DM_FLAG_PRE_RELOC flag to various cpu drivers
Bin Meng [Sun, 14 Oct 2018 08:07:19 +0000 (01:07 -0700)]
cpu: Add DM_FLAG_PRE_RELOC flag to various cpu drivers

It turns out commit c0434407b595 broke some boards which have DM CPU
driver with CONFIG_DISPLAY_CPUINFO option on. These boards just fail
to boot when print_cpuinfo() is called during boot.

Fixes: c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active")
Reported-by: Stefan Roese <sr@denx.de>
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
6 years agodm: doc: Update description of pre-relocation support
Bin Meng [Wed, 24 Oct 2018 13:36:40 +0000 (06:36 -0700)]
dm: doc: Update description of pre-relocation support

Add some description about pre-relocation driver binding, including
usage of DM_FLAG_PRE_RELOC flag and caveats.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agowatchdog: Remove DM_FLAG_PRE_RELOC flag in various drivers
Bin Meng [Wed, 24 Oct 2018 13:36:39 +0000 (06:36 -0700)]
watchdog: Remove DM_FLAG_PRE_RELOC flag in various drivers

When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be
bound before relocation. However due to a bug in the DM core,
the flag only takes effect when devices are statically declared
via U_BOOT_DEVICE(). This bug has been fixed recently by commit
"dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in
lists_bind_fdt()", but with the fix, it has a side effect that
all existing drivers that declared DM_FLAG_PRE_RELOC flag will
be bound before relocation now. This may expose potential boot
failure on some boards due to insufficient memory during the
pre-relocation stage.

To mitigate this potential impact, the following changes are
implemented:

- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver
  only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device
  is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for
  drivers that support both statically declared devices and
  configuration from device tree

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agovideo: simplefb: Remove DM_FLAG_PRE_RELOC flag
Bin Meng [Wed, 24 Oct 2018 13:36:38 +0000 (06:36 -0700)]
video: simplefb: Remove DM_FLAG_PRE_RELOC flag

When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be
bound before relocation. However due to a bug in the DM core,
the flag only takes effect when devices are statically declared
via U_BOOT_DEVICE(). This bug has been fixed recently by commit
"dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in
lists_bind_fdt()", but with the fix, it has a side effect that
all existing drivers that declared DM_FLAG_PRE_RELOC flag will
be bound before relocation now. This may expose potential boot
failure on some boards due to insufficient memory during the
pre-relocation stage.

To mitigate this potential impact, the following changes are
implemented:

- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver
  only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device
  is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for
  drivers that support both statically declared devices and
  configuration from device tree

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agosysreset: Remove DM_FLAG_PRE_RELOC flag in various drivers
Bin Meng [Wed, 24 Oct 2018 13:36:37 +0000 (06:36 -0700)]
sysreset: Remove DM_FLAG_PRE_RELOC flag in various drivers

When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be
bound before relocation. However due to a bug in the DM core,
the flag only takes effect when devices are statically declared
via U_BOOT_DEVICE(). This bug has been fixed recently by commit
"dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in
lists_bind_fdt()", but with the fix, it has a side effect that
all existing drivers that declared DM_FLAG_PRE_RELOC flag will
be bound before relocation now. This may expose potential boot
failure on some boards due to insufficient memory during the
pre-relocation stage.

To mitigate this potential impact, the following changes are
implemented:

- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver
  only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device
  is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for
  drivers that support both statically declared devices and
  configuration from device tree

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoserial: Remove DM_FLAG_PRE_RELOC flag in various drivers
Bin Meng [Wed, 24 Oct 2018 13:36:36 +0000 (06:36 -0700)]
serial: Remove DM_FLAG_PRE_RELOC flag in various drivers

When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be
bound before relocation. However due to a bug in the DM core,
the flag only takes effect when devices are statically declared
via U_BOOT_DEVICE(). This bug has been fixed recently by commit
"dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in
lists_bind_fdt()", but with the fix, it has a side effect that
all existing drivers that declared DM_FLAG_PRE_RELOC flag will
be bound before relocation now. This may expose potential boot
failure on some boards due to insufficient memory during the
pre-relocation stage.

To mitigate this potential impact, the following changes are
implemented:

- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver
  only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device
  is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for
  drivers that support both statically declared devices and
  configuration from device tree

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agotimer: Remove DM_FLAG_PRE_RELOC flag in various drivers
Bin Meng [Wed, 24 Oct 2018 13:36:35 +0000 (06:36 -0700)]
timer: Remove DM_FLAG_PRE_RELOC flag in various drivers

When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be
bound before relocation. However due to a bug in the DM core,
the flag only takes effect when devices are statically declared
via U_BOOT_DEVICE(). This bug has been fixed recently by commit
"dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in
lists_bind_fdt()", but with the fix, it has a side effect that
all existing drivers that declared DM_FLAG_PRE_RELOC flag will
be bound before relocation now. This may expose potential boot
failure on some boards due to insufficient memory during the
pre-relocation stage.

To mitigate this potential impact, the following changes are
implemented:

- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver
  only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device
  is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for
  drivers that support both statically declared devices and
  configuration from device tree

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoram: bmips: Remove DM_FLAG_PRE_RELOC flag
Bin Meng [Wed, 24 Oct 2018 13:36:34 +0000 (06:36 -0700)]
ram: bmips: Remove DM_FLAG_PRE_RELOC flag

When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be
bound before relocation. However due to a bug in the DM core,
the flag only takes effect when devices are statically declared
via U_BOOT_DEVICE(). This bug has been fixed recently by commit
"dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in
lists_bind_fdt()", but with the fix, it has a side effect that
all existing drivers that declared DM_FLAG_PRE_RELOC flag will
be bound before relocation now. This may expose potential boot
failure on some boards due to insufficient memory during the
pre-relocation stage.

To mitigate this potential impact, the following changes are
implemented:

- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver
  only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device
  is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for
  drivers that support both statically declared devices and
  configuration from device tree

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agopinctrl: Remove DM_FLAG_PRE_RELOC flag in various drivers
Bin Meng [Wed, 24 Oct 2018 13:36:33 +0000 (06:36 -0700)]
pinctrl: Remove DM_FLAG_PRE_RELOC flag in various drivers

When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be
bound before relocation. However due to a bug in the DM core,
the flag only takes effect when devices are statically declared
via U_BOOT_DEVICE(). This bug has been fixed recently by commit
"dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in
lists_bind_fdt()", but with the fix, it has a side effect that
all existing drivers that declared DM_FLAG_PRE_RELOC flag will
be bound before relocation now. This may expose potential boot
failure on some boards due to insufficient memory during the
pre-relocation stage.

To mitigate this potential impact, the following changes are
implemented:

- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver
  only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device
  is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for
  drivers that support both statically declared devices and
  configuration from device tree

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agommc: omap: Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check
Bin Meng [Wed, 24 Oct 2018 13:36:32 +0000 (06:36 -0700)]
mmc: omap: Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check

When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be
bound before relocation. However due to a bug in the DM core,
the flag only takes effect when devices are statically declared
via U_BOOT_DEVICE(). This bug has been fixed recently by commit
"dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in
lists_bind_fdt()", but with the fix, it has a side effect that
all existing drivers that declared DM_FLAG_PRE_RELOC flag will
be bound before relocation now. This may expose potential boot
failure on some boards due to insufficient memory during the
pre-relocation stage.

To mitigate this potential impact, the following changes are
implemented:

- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver
  only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device
  is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for
  drivers that support both statically declared devices and
  configuration from device tree

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoi2c: omap24xx: Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check
Bin Meng [Wed, 24 Oct 2018 13:36:31 +0000 (06:36 -0700)]
i2c: omap24xx: Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check

When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be
bound before relocation. However due to a bug in the DM core,
the flag only takes effect when devices are statically declared
via U_BOOT_DEVICE(). This bug has been fixed recently by commit
"dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in
lists_bind_fdt()", but with the fix, it has a side effect that
all existing drivers that declared DM_FLAG_PRE_RELOC flag will
be bound before relocation now. This may expose potential boot
failure on some boards due to insufficient memory during the
pre-relocation stage.

To mitigate this potential impact, the following changes are
implemented:

- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver
  only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device
  is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for
  drivers that support both statically declared devices and
  configuration from device tree

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agogpio: Remove DM_FLAG_PRE_RELOC flag in various drivers
Bin Meng [Wed, 24 Oct 2018 13:36:30 +0000 (06:36 -0700)]
gpio: Remove DM_FLAG_PRE_RELOC flag in various drivers

When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be
bound before relocation. However due to a bug in the DM core,
the flag only takes effect when devices are statically declared
via U_BOOT_DEVICE(). This bug has been fixed recently by commit
"dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in
lists_bind_fdt()", but with the fix, it has a side effect that
all existing drivers that declared DM_FLAG_PRE_RELOC flag will
be bound before relocation now. This may expose potential boot
failure on some boards due to insufficient memory during the
pre-relocation stage.

To mitigate this potential impact, the following changes are
implemented:

- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver
  only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device
  is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for
  drivers that support both statically declared devices and
  configuration from device tree

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
6 years agoclk: Remove DM_FLAG_PRE_RELOC flag in various drivers
Bin Meng [Wed, 24 Oct 2018 13:36:29 +0000 (06:36 -0700)]
clk: Remove DM_FLAG_PRE_RELOC flag in various drivers

When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be
bound before relocation. However due to a bug in the DM core,
the flag only takes effect when devices are statically declared
via U_BOOT_DEVICE(). This bug has been fixed recently by commit
"dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in
lists_bind_fdt()", but with the fix, it has a side effect that
all existing drivers that declared DM_FLAG_PRE_RELOC flag will
be bound before relocation now. This may expose potential boot
failure on some boards due to insufficient memory during the
pre-relocation stage.

To mitigate this potential impact, the following changes are
implemented:

- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver
  only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device
  is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for
  drivers that support both statically declared devices and
  configuration from device tree

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoarm: stm32mp: Remove DM_FLAG_PRE_RELOC flag
Bin Meng [Wed, 24 Oct 2018 13:36:28 +0000 (06:36 -0700)]
arm: stm32mp: Remove DM_FLAG_PRE_RELOC flag

When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be
bound before relocation. However due to a bug in the DM core,
the flag only takes effect when devices are statically declared
via U_BOOT_DEVICE(). This bug has been fixed recently by commit
"dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in
lists_bind_fdt()", but with the fix, it has a side effect that
all existing drivers that declared DM_FLAG_PRE_RELOC flag will
be bound before relocation now. This may expose potential boot
failure on some boards due to insufficient memory during the
pre-relocation stage.

To mitigate this potential impact, the following changes are
implemented:

- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver
  only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device
  is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for
  drivers that support both statically declared devices and
  configuration from device tree

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com>
6 years agoserial: ns16550: fix debug uart putc called before init
Simon Goldschmidt [Thu, 9 Aug 2018 19:04:19 +0000 (21:04 +0200)]
serial: ns16550: fix debug uart putc called before init

If _debug_uart_putc() is called before _debug_uart_init(), the
ns16550 debug uart driver hangs in a tight loop waiting for the
tx FIFO to get empty.

As this can happen via a printf sneaking in before the port calls
debug_uart_init(), let's rather ignore characters before the debug
uart is initialized.

This is done by reading the baudrate divisor and aborting if is zero.

Tested on socfpga_cyclone5_socrates.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
6 years agouclass: Use uclass_foreach_dev() macro instead of open coding
Liviu Dudau [Fri, 28 Sep 2018 13:12:55 +0000 (14:12 +0100)]
uclass: Use uclass_foreach_dev() macro instead of open coding

Use the uclass_foreach_dev() macro instead of the open coded version.

Signed-off-by: Liviu Dudau <liviu.dudau@foss.arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agodoc: Document virtio support
Bin Meng [Mon, 15 Oct 2018 09:21:27 +0000 (02:21 -0700)]
doc: Document virtio support

Add REAME.virtio to describe the information about U-Boot support for
VirtIO devices, including supported boards, build instructions, driver
details etc.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agotest: dm: virtio: Add test cases for virtio uclass
Bin Meng [Mon, 15 Oct 2018 09:21:26 +0000 (02:21 -0700)]
test: dm: virtio: Add test cases for virtio uclass

Now that we have a sandbox virtio transport driver, add some test
cases to test virtio uclass driver.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agovirtio: Add a Sandbox transport driver
Bin Meng [Mon, 15 Oct 2018 09:21:25 +0000 (02:21 -0700)]
virtio: Add a Sandbox transport driver

This driver provides support for Sandbox implementation of virtio
transport driver which is used for testing purpose only.

Two drivers are provided. The 2nd one is a driver that lacks the
'notify' op.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agovirtio: net: Support non-legacy device
Bin Meng [Mon, 15 Oct 2018 09:21:24 +0000 (02:21 -0700)]
virtio: net: Support non-legacy device

For v1.0 compliant device, it always assumes the member 'num_buffers'
exists in the struct virtio_net_hdr while the legacy driver only
presented 'num_buffers' when VIRTIO_NET_F_MRG_RXBUF was negotiated.
Without that feature the structure was 2 bytes shorter.

Update the driver to support the non-legacy device.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agovirtio: pci: Support non-legacy PCI transport device
Bin Meng [Mon, 15 Oct 2018 09:21:23 +0000 (02:21 -0700)]
virtio: pci: Support non-legacy PCI transport device

By default QEMU creates legacy PCI transport devices, but we can
ask QEMU to create non-legacy one if we pass additional device
property/value pairs in the command line:

  -device virtio-blk-pci,disable-legacy=true,disable-modern=false

This adds a new driver driver to support non-legacy (modern) device
mode. Previous driver/file name is changed accordingly.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agotest: dm: pci: Add cases for finding next PCI capability APIs
Bin Meng [Mon, 15 Oct 2018 09:21:22 +0000 (02:21 -0700)]
test: dm: pci: Add cases for finding next PCI capability APIs

Add test cases to cover the two newly added PCI APIs:
dm_pci_find_next_capability() & dm_pci_find_next_ext_capability().

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agodm: pci: Add APIs to find next capability and extended capability
Bin Meng [Mon, 15 Oct 2018 09:21:21 +0000 (02:21 -0700)]
dm: pci: Add APIs to find next capability and extended capability

This introduces two new APIs dm_pci_find_next_capability() and
dm_pci_find_next_ext_capability() to get PCI capability address
and PCI express extended capability address for a given PCI device
starting from a given offset.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agox86: qemu: Imply virtio PCI transport and device drivers
Bin Meng [Mon, 15 Oct 2018 09:21:20 +0000 (02:21 -0700)]
x86: qemu: Imply virtio PCI transport and device drivers

Add virtio drivers for QEMU x86 targets.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoarm: qemu: Enumerate virtio bus during early boot
Bin Meng [Mon, 15 Oct 2018 09:21:19 +0000 (02:21 -0700)]
arm: qemu: Enumerate virtio bus during early boot

Currently devices on the virtio bus is not automatically enumerated,
which means peripherals on the virtio bus are not discovered by their
drivers. This uses board_init() to do the virtio enumeration.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoarm: qemu: Add a Kconfig in the board directory
Bin Meng [Mon, 15 Oct 2018 09:21:18 +0000 (02:21 -0700)]
arm: qemu: Add a Kconfig in the board directory

This adds a Kconfig file in the board directory, so that some
board-specific options can be specified there.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agovirtio: Add virtio over pci transport driver
Bin Meng [Mon, 15 Oct 2018 09:21:17 +0000 (02:21 -0700)]
virtio: Add virtio over pci transport driver

This adds a transport driver that implements UCLASS_VIRTIO for
virtio over pci, which is commonly used on x86.

It only supports the legacy interface of the pci transport, which
is the default device that QEMU emulates.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agox86: Implement arch-specific io accessor routines
Bin Meng [Mon, 15 Oct 2018 09:21:16 +0000 (02:21 -0700)]
x86: Implement arch-specific io accessor routines

At present the generic io{read,write}{8,16,32} routines only support
MMIO access. With architecture like x86 that has a separate IO space,
these routines cannot be used to access I/O ports.

Implement x86-specific version to support both PIO and MMIO access,
so that drivers for multiple architectures can use these accessors
without the need to know whether it's MMIO or PIO.

These are ported from Linux kernel lib/iomap.c, with slight changes.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agokconfig: Introduce HAVE_ARCH_IOMAP
Bin Meng [Mon, 15 Oct 2018 09:21:15 +0000 (02:21 -0700)]
kconfig: Introduce HAVE_ARCH_IOMAP

Introduce a new Kconfig option for architecture codes to control
whether it provides io{read,write}{8,16,32} I/O accessor functions.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoriscv: qemu: Include some useful commands
Bin Meng [Mon, 15 Oct 2018 09:21:14 +0000 (02:21 -0700)]
riscv: qemu: Include some useful commands

With the virtio net and blk drivers, we can do more stuff with some
useful commands. Imply those in the board Kconfig.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoriscv: qemu: Enumerate virtio bus during early boot
Bin Meng [Mon, 15 Oct 2018 09:21:13 +0000 (02:21 -0700)]
riscv: qemu: Enumerate virtio bus during early boot

Currently devices on the virtio bus is not automatically enumerated,
which means peripherals on the virtio bus are not discovered by their
drivers. This uses board_init() to do the virtio enumeration.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agovirtio: cmd: Add virtio command for virtio devices
Tuomas Tynkkynen [Mon, 15 Oct 2018 09:21:12 +0000 (02:21 -0700)]
virtio: cmd: Add virtio command for virtio devices

Add 'virtio' command in U-Boot command line.

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agovirtio: Add block driver support
Tuomas Tynkkynen [Mon, 15 Oct 2018 09:21:11 +0000 (02:21 -0700)]
virtio: Add block driver support

This adds virtio block device driver support.

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoblk: Introduce IF_TYPE_VIRTIO
Tuomas Tynkkynen [Mon, 15 Oct 2018 09:21:10 +0000 (02:21 -0700)]
blk: Introduce IF_TYPE_VIRTIO

This adds a new block interface type for VirtIO block devices.

Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
6 years agoblk: Make blk_next_free_devnum() public
Bin Meng [Mon, 15 Oct 2018 09:21:09 +0000 (02:21 -0700)]
blk: Make blk_next_free_devnum() public

blk_next_free_devnum() can be helpful in some cases. Make it
a public API.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>