oweals/u-boot.git
8 years agoMerge branch 'master' of git://git.denx.de/u-boot-samsung
Tom Rini [Fri, 15 Jul 2016 12:06:42 +0000 (08:06 -0400)]
Merge branch 'master' of git://git.denx.de/u-boot-samsung

8 years agoMerge git://git.denx.de/u-boot-dm
Tom Rini [Fri, 15 Jul 2016 12:06:22 +0000 (08:06 -0400)]
Merge git://git.denx.de/u-boot-dm

8 years agodm: Update the of-platdata README for the new features
Simon Glass [Mon, 4 Jul 2016 17:58:42 +0000 (11:58 -0600)]
dm: Update the of-platdata README for the new features

Revise the content based on the v2 additions. This is kept as a separate
patch to avoid confusing those who have already reviewed the v1 series.

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Tom Rini <trini@konsulko.com>
8 years agodm: Add a test for of-platdata
Simon Glass [Mon, 4 Jul 2016 17:58:41 +0000 (11:58 -0600)]
dm: Add a test for of-platdata

Add a simple test which checks that the of-platdata system is working
correctly. The sequence is as follows:

- SPL starts up and probes all the UCLASS_MISC drivers
- There are 3 of these in sandbox.dts
- Therefore there should be 3 U_BOOT_DEVICE() declarations in dt-platdata.c
- These should produce 3 sandbox_spl_test devices
- Each device prints out its platform data when probed
- This test checks for this output and compares it against expectations

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agotest/py: Start sandbox SPL when enabled
Simon Glass [Mon, 4 Jul 2016 17:58:40 +0000 (11:58 -0600)]
test/py: Start sandbox SPL when enabled

When sandbox SPL is enabled we want to start that rather than U-Boot proper,
since some tests may rely on running it first.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agotest/py: Provide a way to get early console output
Simon Glass [Mon, 4 Jul 2016 17:58:39 +0000 (11:58 -0600)]
test/py: Provide a way to get early console output

Some tests want to check the console output from SPL or U-Boot proper.
Provide a means to do this.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agotest/py: Note which console produced unexpected output
Simon Glass [Mon, 4 Jul 2016 17:58:38 +0000 (11:58 -0600)]
test/py: Note which console produced unexpected output

At present the SPL and U-Boot consoles both present the same error message
when the expected console output does not appear. Add "SPL" to the SPL error
message to resolve this ambiguity.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agotest/py: Handle testing with the sandbox_spl board
Simon Glass [Mon, 4 Jul 2016 17:58:37 +0000 (11:58 -0600)]
test/py: Handle testing with the sandbox_spl board

This board can sometimes be used for tests. Handle it the same way as
sandbox.

Note: I plan to drop the sandbox_spl board at some point and merge its
features into sandbox. So this commit may not be necessary.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agorockchip: Use of-platdata for firefly-rk3288
Simon Glass [Mon, 4 Jul 2016 17:58:36 +0000 (11:58 -0600)]
rockchip: Use of-platdata for firefly-rk3288

As an experiment, move this board over to use of-platdata. This means that
its SPL configuration will come from C structures generated at build-time
from the device tree, instead of coming from the device tree at run-time.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agorockchip: sdram: Update the driver to support of-platdata
Simon Glass [Mon, 4 Jul 2016 17:58:35 +0000 (11:58 -0600)]
rockchip: sdram: Update the driver to support of-platdata

Add support for of-platdata with rk3288 SDRAM initr. This requires decoding
the of-platdata struct and setting up the device from that. Also the driver
needs to be renamed to match the string that of-platdata will search for.

The platform data is copied from the of-platdata structure to the one used
by the driver. This allows the same code to be used with device tree and
of-platdata.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agorockchip: sdram: Move all DT decoding to ofdata_to_platdata()
Simon Glass [Mon, 4 Jul 2016 17:58:34 +0000 (11:58 -0600)]
rockchip: sdram: Move all DT decoding to ofdata_to_platdata()

It is more correct to avoid touching the device tree in the probe() method.
Update the driver to work this way. Note that only SPL needs to fiddle with
the SDRAM registers, so decoding the platform data fully is not necessary in
U-Boot proper.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agorockchip: syscon: Update to work with of-platdata
Simon Glass [Mon, 4 Jul 2016 17:58:33 +0000 (11:58 -0600)]
rockchip: syscon: Update to work with of-platdata

The syscon devices all end up having diffent driver names with of-platdata,
since the driver name comes from the first string in the compatible list.
Add separate device declarations for each one, and add a bind method to set
up driver_data correctly.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agorockchip: Don't use spl_boot_device() with of-platdata
Simon Glass [Mon, 4 Jul 2016 17:58:32 +0000 (11:58 -0600)]
rockchip: Don't use spl_boot_device() with of-platdata

This function cannot look at the device tree when of-platdata is used.
Update the code to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agorockchip: Move the MMC setup check earlier
Simon Glass [Mon, 4 Jul 2016 17:58:31 +0000 (11:58 -0600)]
rockchip: Move the MMC setup check earlier

When the boot ROM sets up MMC we don't need to do it again. Remove the
MMC setup code entirely.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agorockchip: pinctrl: Update the rk3288 driver to support of-platdata
Simon Glass [Mon, 4 Jul 2016 17:58:30 +0000 (11:58 -0600)]
rockchip: pinctrl: Update the rk3288 driver to support of-platdata

Add support for of-platdata with rk3288. This requires disabling access to
the device tree and renaming the driver to match the string that of-platdata
will search for.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agorockchip: clk: Update the rk3288 driver to support of-platdata
Simon Glass [Mon, 4 Jul 2016 17:58:29 +0000 (11:58 -0600)]
rockchip: clk: Update the rk3288 driver to support of-platdata

Add support for of-platdata with rk3288. This requires decoding the
of-platdata struct and setting up the devices from that. Also the driver
needs to be renamed to match the string that of-platdata will search for.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agorockchip: clk: Move all DT decoding to ofdata_to_platdata()
Simon Glass [Mon, 4 Jul 2016 17:58:28 +0000 (11:58 -0600)]
rockchip: clk: Move all DT decoding to ofdata_to_platdata()

It is more correct to avoid touching the device tree in the probe() method.
Update the driver to work this way. Also add an error check on grf since if
that fails then we should not use it.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agorockchip: mmc: Update the driver to support of-platdata
Simon Glass [Mon, 4 Jul 2016 17:58:27 +0000 (11:58 -0600)]
rockchip: mmc: Update the driver to support of-platdata

Add support for of-platdata with rk3288. This requires decoding the
of-platdata struct and setting up the device from that. Also the driver
needs to be renamed to match the string that of-platdata will search for.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agorockchip: mmc: Move all DT decoding to ofdata_to_platdata()
Simon Glass [Mon, 4 Jul 2016 17:58:26 +0000 (11:58 -0600)]
rockchip: mmc: Move all DT decoding to ofdata_to_platdata()

It is more correct to avoid touching the device tree in the probe() method.
Update the driver to work this way.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agorockchip: Update the sdram-channel property to support of-platdata
Simon Glass [Mon, 4 Jul 2016 17:58:25 +0000 (11:58 -0600)]
rockchip: Update the sdram-channel property to support of-platdata

Add an extra byte so that this data is not byteswapped. Add a comment to
the code to explain the purpose.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agorockchip: serial: Add an of-platdata driver for rockchip
Simon Glass [Mon, 4 Jul 2016 17:58:24 +0000 (11:58 -0600)]
rockchip: serial: Add an of-platdata driver for rockchip

Add a driver that works with of-platdata. It sets up the platform data and
calls the standard ns16550 driver.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: serial: ns16550: Update to support of-platdata
Simon Glass [Mon, 4 Jul 2016 17:58:23 +0000 (11:58 -0600)]
dm: serial: ns16550: Update to support of-platdata

With of-platdata this driver cannot know the format of the of-platdata
struct, so we cannot use generic code for accessing the of-platdata. Each
SoC that uses this driver will need to set up ns16550's platdata for it.
So don't compile in the generic code.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: core: Add an implementation of regmap_init_mem_platdata()
Simon Glass [Mon, 4 Jul 2016 17:58:22 +0000 (11:58 -0600)]
dm: core: Add an implementation of regmap_init_mem_platdata()

Add an implementation of this function which mirrors the functions of the
automatic device-tree implementation. This can be used with of-platdata to
create regmaps.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: core: Move regmap allocation into a separate function
Simon Glass [Mon, 4 Jul 2016 17:58:21 +0000 (11:58 -0600)]
dm: core: Move regmap allocation into a separate function

We plan to add a new way of creating a regmap for of-platdata. Move the
allocation code into a separate function so that it can be shared.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: sandbox: Enable of-platdata for sandbox_spl
Simon Glass [Mon, 4 Jul 2016 17:58:20 +0000 (11:58 -0600)]
dm: sandbox: Enable of-platdata for sandbox_spl

Enable this feature so that we can use it for testing in sandbox_spl.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agosandbox: Don't bring in the eeprom emulator in SPL
Simon Glass [Mon, 4 Jul 2016 17:58:19 +0000 (11:58 -0600)]
sandbox: Don't bring in the eeprom emulator in SPL

This driver should not be used in SPL since we do not have I2C support
enabled in SPL on sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: core: Expand platdata for of-platdata devices
Simon Glass [Mon, 4 Jul 2016 17:58:18 +0000 (11:58 -0600)]
dm: core: Expand platdata for of-platdata devices

Devices which use of-platdata have their own platdata. However, in many
cases the driver will have its own auto-alloced platdata, for use with the
device tree. The ofdata_to_platdata() method converts the device tree
settings to platdata.

With of-platdata we would not normally allocate the platdata since it is
provided by the U_BOOT_DEVICE() declaration. However this is inconvenient
since the of-platdata struct is closely tied to the device tree properties.
It is unlikely to exactly match the platdata needed by the driver.

In fact a useful approach is to declare platdata in the driver like this:

struct r3288_mmc_platdata {
struct dtd_rockchip_rk3288_dw_mshc of_platdata;
/* the 'normal' fields go here */
};

In this case we have dt_platadata available, but the normal fields are not
present, since ofdata_to_platdata() is never called. In fact driver model
doesn't allocate any space for the 'normal' fields, since it sees that there
is already platform data attached to the device.

To make this easier, adjust driver model to allocate the full size of the
struct (i.e. platdata_auto_alloc_size from the driver) and copy in the
of-platdata. This means that when the driver's bind() method is called,
the of-platdata will be present, followed by zero bytes for the empty
'normal field' portion.

A new DM_FLAG_OF_PLATDATA flag is available that indicates that the platdata
came from of-platdata. When the allocation/copy happens, the
DM_FLAG_ALLOC_PDATA flag will be set as well. The dtoc tool is updated to
output the platdata_size field, since U-Boot has no other way of knowing
the size of the of-platdata struct.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: Don't attach the device tree to SPL with of-platdata
Simon Glass [Mon, 4 Jul 2016 17:58:17 +0000 (11:58 -0600)]
dm: Don't attach the device tree to SPL with of-platdata

When of-platdata is used in SPL we don't use the device tree. So there is no
point in attaching it. Adjust the Makefile to skip attaching the device tree
when of-platdata is enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodtoc: Ignore the u-boot, dm-pre-reloc property
Simon Glass [Mon, 4 Jul 2016 17:58:16 +0000 (11:58 -0600)]
dtoc: Ignore the u-boot, dm-pre-reloc property

This property is not useful for of-platdata, so omit it.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: core: Rename DM_NAME_ALLOCED to DM_FLAG_NAME_ALLOCED
Simon Glass [Mon, 4 Jul 2016 17:58:15 +0000 (11:58 -0600)]
dm: core: Rename DM_NAME_ALLOCED to DM_FLAG_NAME_ALLOCED

This is a flag. Adjust the name to be consistent with the other flags.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: spl: Bind in all devices in SPL with of-platdata
Simon Glass [Mon, 4 Jul 2016 17:58:14 +0000 (11:58 -0600)]
dm: spl: Bind in all devices in SPL with of-platdata

When CONFIG_OF_PLATDATA is enabled, we cannot use the u-boot,dm-pre-reloc
device tree property since the device tree is not available. However,
dt-platdata.c only includes devices which would have been present in the
device tree, and we can assume that all such devices are needed for SPL.
If they were not needed, they would have been omitted to save space.

So in this case, bind all devices regardless of the u-boot,dm-pre-reloc
setting. This avoids needing to add a DM_FLAG_PRE_RELOC to every driver,
thus affecting U-Boot proper also.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agotiny-printf: Support assert()
Simon Glass [Mon, 4 Jul 2016 17:58:13 +0000 (11:58 -0600)]
tiny-printf: Support assert()

At present assert() is not supported with tiny-printf, so when DEBUG is
enabled a build error is generated for each assert().

Add an __assert_fail() function to correct this. It prints a message and
then hangs.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agoOnly build the libfdt python module if 'swig' is available
Simon Glass [Mon, 4 Jul 2016 17:58:12 +0000 (11:58 -0600)]
Only build the libfdt python module if 'swig' is available

When swig is not available, we can still build correctly. So make this
optional. Add a comment about how to enable this build.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: Add a more efficient libfdt library
Simon Glass [Mon, 4 Jul 2016 17:58:11 +0000 (11:58 -0600)]
dm: Add a more efficient libfdt library

Add a Python version of the libfdt library which contains enough features to
support the dtoc tool. This is only a very bare-bones implementation. It
requires the 'swig' to build.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: Makefile: Build of-platdata files when the feature is enabled
Simon Glass [Mon, 4 Jul 2016 17:58:10 +0000 (11:58 -0600)]
dm: Makefile: Build of-platdata files when the feature is enabled

Update the Makefile to call dtoc to create the C header and source files,
then build these into the image.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: Add a tool to generate C code from a device tree
Simon Glass [Mon, 4 Jul 2016 17:58:09 +0000 (11:58 -0600)]
dm: Add a tool to generate C code from a device tree

This tool can produce C struct definitions and C platform data tables.
This is used to support the of-platdata feature.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: Add a library to provide simple device-tree access
Simon Glass [Mon, 4 Jul 2016 17:58:08 +0000 (11:58 -0600)]
dm: Add a library to provide simple device-tree access

This Python library provides a way to access the contents of the device
tree. It uses fdtget, so is inefficient for larger device tree files.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: Add a README for of-platdata
Simon Glass [Mon, 4 Jul 2016 17:58:07 +0000 (11:58 -0600)]
dm: Add a README for of-platdata

Add documentation on how this works, including the benefits and drawbacks.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: Add an option to enable the of-platdata feature
Simon Glass [Mon, 4 Jul 2016 17:58:06 +0000 (11:58 -0600)]
dm: Add an option to enable the of-platdata feature

Add a Kconfig option to enable this feature.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: Don't include fdtdec functions when of-platdata is enabled
Simon Glass [Mon, 4 Jul 2016 17:58:05 +0000 (11:58 -0600)]
dm: Don't include fdtdec functions when of-platdata is enabled

We cannot access the device tree in this case, so avoid compiling in the
various device-tree helper functions.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: serial: Add support for of-platdata
Simon Glass [Mon, 4 Jul 2016 17:58:04 +0000 (11:58 -0600)]
dm: serial: Add support for of-platdata

When this feature is enabled, we cannot access the device tree to find out
which serial device to use. Just use the first serial driver we find.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: clk: Add support for of-platdata
Simon Glass [Mon, 4 Jul 2016 17:58:03 +0000 (11:58 -0600)]
dm: clk: Add support for of-platdata

Add support for this feature in the core clock code.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: Add a header that provides access to the of-platdata structs
Simon Glass [Mon, 4 Jul 2016 17:58:02 +0000 (11:58 -0600)]
dm: Add a header that provides access to the of-platdata structs

This header can be included from anywhere, but will only pull in the
of-platdata struct definitions when this feature is enabled (and only in
SPL).

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: sandbox: Add a simple driver to test of-platdata
Simon Glass [Mon, 4 Jul 2016 17:58:01 +0000 (11:58 -0600)]
dm: sandbox: Add a simple driver to test of-platdata

Add a driver which uses of-platdata to obtain its platform data. This can
be used to test the feature in sandbox. It displays the contents of its
platform data.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: syscon: Add support for of-platdata
Simon Glass [Mon, 4 Jul 2016 17:58:00 +0000 (11:58 -0600)]
dm: syscon: Add support for of-platdata

Provide a new function which can cope with obtaining information from
of-platdata instead of the device tree.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: regmap: Add a dummy implementation for of-platdata
Simon Glass [Mon, 4 Jul 2016 17:57:59 +0000 (11:57 -0600)]
dm: regmap: Add a dummy implementation for of-platdata

Add a placeholder for now so that this code will compile. It currently does
nothing.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: core: Don't use device tree with of-platdata
Simon Glass [Mon, 4 Jul 2016 17:57:58 +0000 (11:57 -0600)]
dm: core: Don't use device tree with of-platdata

When CONFIG_SPL_OF_PLATDATA is enabled we should not access the device
tree. Remove all references to this in the core driver-model code.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: Makefile: Build of-platdata before SPL
Simon Glass [Mon, 4 Jul 2016 17:57:57 +0000 (11:57 -0600)]
dm: Makefile: Build of-platdata before SPL

Since SPL needs the of-platdata structures, build these before starting
to build any SPL components.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agodm: spl: Don't set up device tree with of-platdata
Simon Glass [Mon, 4 Jul 2016 17:57:56 +0000 (11:57 -0600)]
dm: spl: Don't set up device tree with of-platdata

When this feature is enabled, we should not access the device tree.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agosandbox: Add a test device that uses of-platdata
Simon Glass [Mon, 4 Jul 2016 17:57:55 +0000 (11:57 -0600)]
sandbox: Add a test device that uses of-platdata

Start up the test devices. These print out of-platdata contents, providing a
check that the of-platdata feature is working correctly.

The device-tree changes are made to sandbox.dts rather than test.dts. since
the former controls the of-platdata generation.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agosandbox: Add a new sandbox_spl board
Simon Glass [Mon, 4 Jul 2016 17:57:54 +0000 (11:57 -0600)]
sandbox: Add a new sandbox_spl board

It is useful to be able to build SPL for sandbox. It provides additional
build coverage and allows SPL features to be tested in sandbox. However
it does not need worthwhile to always create an SPL build. It nearly
doubles the build time and the feature is (so far) seldom used.

So for now, create a separate build target for sandbox SPL. This allows
experimentation with this new feature without impacting existing workflows.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agosandbox: serial: Don't sync video in SPL
Simon Glass [Mon, 4 Jul 2016 17:57:53 +0000 (11:57 -0600)]
sandbox: serial: Don't sync video in SPL

SPL does not support an LCD display so there is no need to sync the video
when there is serial output.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agosandbox: Don't use IDE and iotrace in SPL
Simon Glass [Mon, 4 Jul 2016 17:57:52 +0000 (11:57 -0600)]
sandbox: Don't use IDE and iotrace in SPL

These functions are not supported in SPL, so drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agosandbox: Add basic SPL implementation
Simon Glass [Mon, 4 Jul 2016 17:57:51 +0000 (11:57 -0600)]
sandbox: Add basic SPL implementation

Add an sandbox implementation for the generic SPL framework. This supports
locating and running U-Boot proper.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agosandbox: Don't include the main loop in SPL
Simon Glass [Mon, 4 Jul 2016 17:57:50 +0000 (11:57 -0600)]
sandbox: Don't include the main loop in SPL

SPL does not have a command interface so we should not include the main loop
code.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agosandbox: Don't use PCI in SPL
Simon Glass [Mon, 4 Jul 2016 17:57:49 +0000 (11:57 -0600)]
sandbox: Don't use PCI in SPL

PCI is not supported in SPL for sandbox, so avoid using it.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agosandbox: Add some missing headers in cpu.c
Simon Glass [Mon, 4 Jul 2016 17:57:48 +0000 (11:57 -0600)]
sandbox: Add some missing headers in cpu.c

These headers are needed in case they are not transitively included.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agosandbox: Correct header file order in cpu.c
Simon Glass [Mon, 4 Jul 2016 17:57:47 +0000 (11:57 -0600)]
sandbox: Correct header file order in cpu.c

The dm/ file should go at the end. Move it.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agosandbox: Support building an SPL image
Simon Glass [Mon, 4 Jul 2016 17:57:46 +0000 (11:57 -0600)]
sandbox: Support building an SPL image

When building an SPL image, override the link flags so that it uses the
system libraries. This is similar to the way the non-SPL image is built.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agosandbox: Allow chaining from SPL to U-Boot proper
Simon Glass [Mon, 4 Jul 2016 17:57:45 +0000 (11:57 -0600)]
sandbox: Allow chaining from SPL to U-Boot proper

SPL is expected to load and run U-Boot. This needs to work with sandbox also.
Provide a function to locate the U-Boot image, and another to start it. This
allows SPL to function on sandbox as it does on other archs.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agoMakefile: Allow the SPL final link rule to be overridden
Simon Glass [Mon, 4 Jul 2016 17:57:44 +0000 (11:57 -0600)]
Makefile: Allow the SPL final link rule to be overridden

Overriding the final link rule is possible with U-Boot proper. It us used to
create a sandbox image links with host libraries. To build a sandbox SPL
image we need the same feature for SPL.

To support this, update the SPL link rule so sandbox can override it.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agospl: Drop include of i2c.h
Simon Glass [Mon, 4 Jul 2016 17:57:43 +0000 (11:57 -0600)]
spl: Drop include of i2c.h

This file does not appear to use I2C, so drop this include.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agoREADME: Remove CONFIG_SYS_MALLOC_F_LEN comment
Simon Glass [Mon, 4 Jul 2016 17:57:42 +0000 (11:57 -0600)]
README: Remove CONFIG_SYS_MALLOC_F_LEN comment

This option is now widely available, so remove the comment that it is only
available on ARM and sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agosandbox: Don't print a warning for CONFIG_I2C_COMPAT
Simon Glass [Mon, 4 Jul 2016 17:57:41 +0000 (11:57 -0600)]
sandbox: Don't print a warning for CONFIG_I2C_COMPAT

Sandbox includes this code to provide build coverage. While we retain this
feature we should have sandbox build it. Sandbox does not in fact use the
I2C compatibility mode. Showing a warning for sandbox is just confusing,
since no conversion is expected.

Drop the warning for sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agortc: Tidy up the code style
Simon Glass [Mon, 20 Jun 2016 01:51:00 +0000 (19:51 -0600)]
rtc: Tidy up the code style

This code generates lots of checkpatch errors. Fix them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
8 years agoarm: Show cache warnings in U-Boot proper only
Simon Glass [Mon, 20 Jun 2016 01:43:05 +0000 (19:43 -0600)]
arm: Show cache warnings in U-Boot proper only

Avoid bloating the SPL image size.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agoAdd warn_non_spl() to show a message in U-Boot proper
Simon Glass [Mon, 20 Jun 2016 01:43:04 +0000 (19:43 -0600)]
Add warn_non_spl() to show a message in U-Boot proper

SPL tends to be more space-constrained that U-Boot proper. Some error
messages are best suppressed in SPL. Add a macros to make this easy.

warn_non_spl() does nothing when built in SPL code.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agoAdd comments for debug() and pr_fmt
Simon Glass [Mon, 20 Jun 2016 01:43:03 +0000 (19:43 -0600)]
Add comments for debug() and pr_fmt

Add a note to each of these so it is more obvious how they work.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agoarm: Don't invalidate unaligned cache regions
Simon Glass [Mon, 20 Jun 2016 01:43:02 +0000 (19:43 -0600)]
arm: Don't invalidate unaligned cache regions

At present armv7 will unhappily invalidate a cache region and print an
error message. Make it skip the operation instead, as it does with other
cache operations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
8 years agoarm: Move check_cache_range() into a common place
Simon Glass [Mon, 20 Jun 2016 01:43:01 +0000 (19:43 -0600)]
arm: Move check_cache_range() into a common place

This code is common, so move it into a common file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Marek Vasut <marex@denx.de>
8 years agoboard_f: prevent misleading "Watchdog enabled" output
Anatolij Gustschin [Mon, 13 Jun 2016 12:24:24 +0000 (14:24 +0200)]
board_f: prevent misleading "Watchdog enabled" output

Output the "Watchdog enabled" message only if hw_watchdog_init()
call really happened.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
8 years agoboard_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y
Anatolij Gustschin [Mon, 13 Jun 2016 12:24:23 +0000 (14:24 +0200)]
board_f: init designware watchdog if CONFIG_DESIGNWARE_WATCHDOG=y

The designware watchdog init is skipped even if CONFIG_DESIGNWARE_WATCHDOG
is enabled. Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
8 years agoconfigs: da850evm: enable bootz command
Sekhar Nori [Tue, 12 Jul 2016 10:54:48 +0000 (16:24 +0530)]
configs: da850evm: enable bootz command

Enable bootz command on Texas Instruments DA850 EVM
board. This helps it boot zImage with device-tree
blob passed.

Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Tested-by: Kevin Hilman <khilman@baylibre.com>
8 years agoARM: OMAP5+: Enable errata i727
Lokesh Vutla [Tue, 12 Jul 2016 09:17:41 +0000 (14:47 +0530)]
ARM: OMAP5+: Enable errata i727

Errata i727 is applicable on all OMAP5 and DRA7 variants but enabled only
on OMAP5 ES1.0. So, enable it on all platforms.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agomkimage: fix missing break for -p switch
Teddy Reed [Tue, 12 Jul 2016 05:54:26 +0000 (22:54 -0700)]
mkimage: fix missing break for -p switch

Signed-off-by: Teddy Reed <teddy.reed@gmail.com>
Reported-by: Coverity (CID: 150277)
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agobootm: fixup silent Linux out of BOOTM_STATE_LOADOS state
Hector Palacios [Mon, 11 Jul 2016 10:34:37 +0000 (12:34 +0200)]
bootm: fixup silent Linux out of BOOTM_STATE_LOADOS state

The function fixup_silent_linux() is called in status BOOTM_STATE_LOADOS
to silence Linux if variable 'silent' is set.
Currently only the 'bootm' command state machine contains
BOOTM_STATE_LOADOS, but others like 'booti' or 'bootz' commands do not.
This means silent Linux does not work with these commands.

This patch moves the fixup_silent_linux() call out of the
BOOTM_STATE_LOADOS state and into BOOTM_STATE_OS_PREP, to silence Linux
independently of the used command (booti, bootm or bootz).

Signed-off-by: Hector Palacios <hector.palacios@digi.com>
8 years agostm32: Change USART port to USART6 for stm32f746 discovery board
Toshifumi NISHINAGA [Thu, 7 Jul 2016 16:02:26 +0000 (01:02 +0900)]
stm32: Change USART port to USART6 for stm32f746 discovery board

This change is to remove a halt at about 200KiB
while sending a large(1MiB) binary to a micro controller using USART1.
USART1 is connected to a PC via an on-board ST-Link debugger
that also functions as a USB-Serial converter.
However, it seems to loss some data occasionally.
So I changed the serial port to USART6 and connected it to the PC using
an FTDI USB-Serial cable, therefore the transmission was successfully
completed.

Signed-off-by: Toshifumi NISHINAGA <tnishinaga.dev@gmail.com>
8 years agostm32: Add SDRAM support for stm32f746 discovery board
Toshifumi NISHINAGA [Thu, 7 Jul 2016 16:02:25 +0000 (01:02 +0900)]
stm32: Add SDRAM support for stm32f746 discovery board

This patch adds SDRAM support for stm32f746 discovery board.
This patch depends on previous patch.
This patch is based on STM32F4 and emcraft's[1].

[1]:  https://github.com/EmcraftSystems/u-boot

Signed-off-by: Toshifumi NISHINAGA <tnishinaga.dev@gmail.com>
8 years agostm32: clk: Add 200MHz clock configuration for stm32f746 discovery board
Toshifumi NISHINAGA [Thu, 7 Jul 2016 16:02:24 +0000 (01:02 +0900)]
stm32: clk: Add 200MHz clock configuration for stm32f746 discovery board

This patch adds 200MHz clock configuration for stm32f746 discovery board.
This patch is based on STM32F4 and emcraft's[1].

[1]:  https://github.com/EmcraftSystems/u-boot

Signed-off-by: Toshifumi NISHINAGA <tnishinaga.dev@gmail.com>
8 years agodragonboard410c: adding missing default addr for script and pxe boot
Ricardo Salveti de Araujo [Sun, 3 Jul 2016 17:16:03 +0000 (14:16 -0300)]
dragonboard410c: adding missing default addr for script and pxe boot

Cc: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
Signed-off-by: Ricardo Salveti <rsalveti@rsalveti.net>
8 years agodragonboard410c: prefer sdcard boot over emmc
Ricardo Salveti de Araujo [Sun, 3 Jul 2016 16:59:01 +0000 (13:59 -0300)]
dragonboard410c: prefer sdcard boot over emmc

Make the external devices the preferred ones when booting the system
(usb is already the first option). This allows users to easily boot
custom distributions without requiring them to reflash/customize u-boot.

Cc: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
Signed-off-by: Ricardo Salveti <rsalveti@rsalveti.net>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Tested-by: Andreas Färber <afaerber@suse.de>
Acked-by: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
8 years agotest: Convert the vboot test to test/py
Simon Glass [Sun, 3 Jul 2016 15:40:46 +0000 (09:40 -0600)]
test: Convert the vboot test to test/py

Now that we have a suitable test framework we should move all tests into it.
The vboot test is a suitable candidate. Rewrite it in Python and move the
data files into an appropriate directory.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agotools: Correct error handling in fit_image_process_hash()
Simon Glass [Sun, 3 Jul 2016 15:40:44 +0000 (09:40 -0600)]
tools: Correct error handling in fit_image_process_hash()

We should not be returning -1 as an error code. This can mask a situation
where we run out of space adding things to the FIT. By returning the correct
error in this case (-ENOSPC) it can be handled by the higher-level code.

This may fix the error reported by Tom Van Deun here:

https://www.mail-archive.com/u-boot@lists.denx.de/msg217417.html

although I am not sure as I cannot actually repeat it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Tom Van Deun <tom.vandeun@wapice.com>
Reviewed-by: Teddy Reed <teddy.reed@gmail.com>
8 years agotools: Add an error code when fit_handle_file() fails
Simon Glass [Sun, 3 Jul 2016 15:40:43 +0000 (09:40 -0600)]
tools: Add an error code when fit_handle_file() fails

The error code may provide useful information for debugging. Add it to the
error string.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Teddy Reed <teddy.reed@gmail.com>
8 years agotest/py: Add a helper to run a list of U-Boot commands
Simon Glass [Sun, 3 Jul 2016 15:40:42 +0000 (09:40 -0600)]
test/py: Add a helper to run a list of U-Boot commands

Some tests want to execute a sequence of commands. Add a helper for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Teddy Reed <teddy.reed@gmail.com>
8 years agotest/py: Provide a way to check that a command fails
Simon Glass [Sun, 3 Jul 2016 15:40:41 +0000 (09:40 -0600)]
test/py: Provide a way to check that a command fails

Sometimes we want to run a command and check that it fails. Add a function
to handle this. It can check the return code and also make sure that the
output contains a given error message.

Signed-off-by: Simon Glass <sjg@chromium.org>
8 years agotest/py: Add an option to execute a string containing a command
Simon Glass [Sun, 3 Jul 2016 15:40:40 +0000 (09:40 -0600)]
test/py: Add an option to execute a string containing a command

It is sometimes inconvenient to convert a string into a list for execution
with run_and_log(). Provide a helper function to do this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Teddy Reed <teddy.reed@gmail.com>
8 years agotest/py: Return output from run_and_log()
Simon Glass [Sun, 3 Jul 2016 15:40:39 +0000 (09:40 -0600)]
test/py: Return output from run_and_log()

It is useful to be able to obtain the output from a command. Return it from
this function.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Teddy Reed <teddy.reed@gmail.com>
8 years agotest/py: Provide output from exceptions with RunAndLog()
Simon Glass [Sun, 3 Jul 2016 15:40:38 +0000 (09:40 -0600)]
test/py: Provide output from exceptions with RunAndLog()

Tests may want to look at the output from running a command, even if it
fails (e.g. with a non-zero return code). Provide a means to obtain this.

Another approach would be to return a class object containing both the
output and the exception, but I'm not sure if that would result in a lot
of refactoring.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Teddy Reed <teddy.reed@gmail.com>
8 years agotest/py: Allow RunAndLog() to return the output
Simon Glass [Sun, 3 Jul 2016 15:40:37 +0000 (09:40 -0600)]
test/py: Allow RunAndLog() to return the output

Tests may want to look at the output from running a command. Return it so
that this is possible.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Teddy Reed <teddy.reed@gmail.com>
8 years agotest/py: Allow tests to control the sandbox device-tree file
Simon Glass [Sun, 3 Jul 2016 15:40:36 +0000 (09:40 -0600)]
test/py: Allow tests to control the sandbox device-tree file

Normally tests will run with the test.dtb file designed for this purpose.
However, the verified boot tests need to run with their own device-tree
file, containing a public key.

Make the device-tree file a config option so that it can be adjusted by
tests. The default is to keep the current behaviour.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Teddy Reed <teddy.reed@gmail.com>
8 years agosandbox: Don't exit when bootm completes
Simon Glass [Sun, 3 Jul 2016 15:40:35 +0000 (09:40 -0600)]
sandbox: Don't exit when bootm completes

At present sandbox exits when the 'bootm' command completes, since it is not
actually able to run the OS that is loaded. Normally 'bootm' failure is
considered a fatal error in U-Boot.

However this is annoying for tests, which may want to examine the state
after a test is complete. In any case there is a 'reset' command which can
be used to exit, if required.

Change the behaviour to return normally from the 'bootm' command on sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Teddy Reed <teddy.reed@gmail.com>
8 years agotest: Add a simple script to run tests on sandbox
Simon Glass [Sun, 3 Jul 2016 15:40:34 +0000 (09:40 -0600)]
test: Add a simple script to run tests on sandbox

A common check before sending patches is to run all available tests on
sandbox. But everytime I do this I have to look up the README. This presents
quite a barrier to actually doing this.

Add a shell script to help. To run the tests, type:

   test/run

in the U-Boot directory, which should be easy to remember.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Teddy Reed <teddy.reed@gmail.com>
8 years agotest: Add a README
Simon Glass [Sun, 3 Jul 2016 15:40:33 +0000 (09:40 -0600)]
test: Add a README

Add a few notes about how testing works in U-Boot.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Teddy Reed <teddy.reed@gmail.com>
8 years agotools: Allow building with debug enabled
Simon Glass [Thu, 30 Jun 2016 16:52:20 +0000 (10:52 -0600)]
tools: Allow building with debug enabled

Sometimes it is useful to build tools with debugging information included so
that line-number information is available when run under gdb. Add a Kconfig
option to support this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agomkimage: Show item lists for all categories
Simon Glass [Thu, 30 Jun 2016 16:52:19 +0000 (10:52 -0600)]
mkimage: Show item lists for all categories

Update the error-handling code for -A, -C and -O to show a list of valid
options when an invalid one is provided.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Vinoth Eswaran <evinoth1206@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agomkimage: Use generic code for showing an 'image type' error
Simon Glass [Thu, 30 Jun 2016 16:52:18 +0000 (10:52 -0600)]
mkimage: Use generic code for showing an 'image type' error

The existing error code only displays image types which are claimed by a
particular U_BOOT_IMAGE_TYPE() driver. But this does not seem correct. The
mkimage tool should support all image types, so it makes sense to allow
creation of images of any type with the tool.

When an incorrect image type is provided, use generic code to display the
error.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agomkimage: Allow display of a list of any image header category
Simon Glass [Thu, 30 Jun 2016 16:52:17 +0000 (10:52 -0600)]
mkimage: Allow display of a list of any image header category

Add a generic function which can display a list of items in any category.
This will allow displaying of images for the -A, -C, -O and -T flags. At
present only -T is supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoimage: Add functions to obtain category information
Simon Glass [Thu, 30 Jun 2016 16:52:16 +0000 (10:52 -0600)]
image: Add functions to obtain category information

Add generic functions which can look up information about a category:

- the number of items in the category
- the category description
- an item long time
- an item short time

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
8 years agoimage: Add a name for invalid types
Simon Glass [Thu, 30 Jun 2016 16:52:15 +0000 (10:52 -0600)]
image: Add a name for invalid types

At present the name is NULL, which prevents qsort() fromp being used. Use
the name "invalid" instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>