common/Makefile: reorder targets

Reorder targets alphabetically to make the file look nicer, no
functional change.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
defaultenv: simplify env dependencies

Finding out whether to rebuild the environment is a difficult task
since we have to track all files in a directory. Instead of trying
this, just rebuild the environment during every build and only if
it differs to the last one overwrite the target. This way make
only sees a change when the environment is changed.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
make: Add wildcard rules for compressed files

To simplify generating compressed files.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
defaultenv: use wildcard compression rules

Now that we have wildcard rules for compresed files use them.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
tegra: add -fno-jump-tables to lowlevel code

Lowlevel code runs when not relocated yet, so we have to make extra sure
not to emit jump-tables with absolute adresses when evaluating switch
statements.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
tegra: lowlevel: switch to __always_inline macro

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
tegra: add lowlevel delay function

For proper startup we need to give clocks and IO signals some time to
stabilize. Tegra2 got away without them, but Tegra3 seems to be a bit
pickier.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
ARM: i.MX: Karo-tx25: build image for internal boot

This adds an image for the TX25 in internal boot mode. This can
be used for USB booting.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
ARM: i.MX6: sabresd: switch to multi-image

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Kconfig: Select default compression type

Instead of asking explicitly for the default environment compression
type ask for the in-barebox default compression type. This also adds
a DEFAULT_COMPRESSION_SUFFIX make variable which can be used together
with the wildcard rules for compressed files to generate compressed
files without explicitly support each compression type.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
ARM: i.MX6: sabresd: set USB PHY and DR mode

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
filetype: Add detection for barebox environment

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
environment: constify arguments

The directory arguments to envfs_load and envfs_save can
be const.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
environment: Add function to load envfs from buffer

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
defaultenv: Align defaultenv array

The default environment buffer is an unsigned char array and thus
may be unaligned. Some decompression algorithms expect the buffer
to be sufficiently aligned for u32 accesses. We make this sure by
copying the default env to a temporary buffer. Instead of doing this
just add a __aligned(4) to the default environment.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
ARM: i.MX: Make mxc_iomux_v3_setup_multiple_pads argument const

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
make: Add bbenv-y target to generate default environment files

This adds a target to generate environment files from directories.
These are compiled into the barebox binary.

use it as:

bbenv-$(CONFIG_SOMETHING) += my-environment

The directory containing the files to compile into the binary
should be named my-environment.

This can be accessed in C code later as:

extern unsigned char __bbenv_my_environment_start[];
extern unsigned char __bbenv_my_environment_end[];

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
move defaultenv-1 to defaultenv/defaultenv-1

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
move defaultenv-2 to defaultenv/defaultenv-2-*

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
lib: math: Return NULL pointer

Fix the following sparse warning:

lib/math.c:309:16: warning: Using plain integer as NULL pointer

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>