APPLIED: Validate dtc is new enough

Subsequent patches assume that dtc supports various recent features.
These are available in dtc 1.4.0. Validate that dtc is at least that
version.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
---
v2: New patch.
APPLIED: xilinx: move microblaze-generic .dts to standard location

Aside from microblaze, all other SoCs/boards/vendors store their DT files
in board/$vendor/dts/$soc-$board.dts. Move microblaze-generic.dts to this
location for consistency.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
Acked-by: Michal Simek <monstr@monstr.eu>
APPLIED: dts/Makefile: simplify dtc invocation

The invocation of dtc is significantly more complex that it could be,
in order to work around an issue on old versions of dtc, which print
a message to stdout every time they run.

Remove this workaround, on the assumption that people have or will
upgrade to a newer version of dtc. This simplifies the build rule
significantly.

Related, split the invocation of cpp and dtc into separate commands
rather than a pipeline, so that if either fail, it is detected. This has
the nice benefit of saving off the result of the pre-processing step,
allowing it to be easily inspected.

Assuming a new enough dtc (which an earlier patch enforces), dtc will
parse #line directives in its input file, and generate correct file and
line numbers in error messages, even though cpp is unconditionally
applied to its input file.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
---
v2:
* Added note to commit description re: line numbers.
* s/.dtstmp/dts.tmp/ in temporary filenames.
APPLIED: dts/Makefile: unify cpp/dtc include paths

*.dts may use #include (via cpp) or /include/ (via dtc; assuming a newer
dtc). The choice is up to the creator of the DT. Create a common variable
DTC_INCDIRS that lists the paths searched by include statements, and
update cpp and dtc invocation to use them.

For cpp, also specify -nostdinc to ensure the same set of paths is
available to both type of include statement.

For dtc, create a new DTC_FLAGS variable to hold all the flags passed to
dtc.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
APPLIED: dt: don't use ARCH_CPU_DTS

Now that we assume dtc supports the -i option, we don't need to use
ARCH_CPU_DTS in *.dts{,i}; we simply specify the include filename
directly, and dtc will find it.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
APPLIED: dts/Makefile: don't define ARCH_CPU_DTS, BOARD_DTS

Now that nothing uses the defines ARCH_CPU_DTS, BOARD_DTS, stop defining
them.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
APPLIED: config: don't define CONFIG_ARCH_DEVICE_TREE

Now that nothing uses CONFIG_ARCH_DEVICE_TREE, stop defining it.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
APPLIED: dts/Makefile: don't use cpp -P

Recent dtc supports #line directives in the input source code, and even
uses them to generate useful line numbers in any messages it emits. Stop
passing -P to cpp, since there's no need any more.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
APPLIED: dts/Makefile: pass -undef -D__DTS__ to cpp

This brings U-Boot's cpp invocation into line with the way the Linux
kernel invokes cpp on device trees. Consistency will be useful to ensure
*.dts is portable between the two.

-undef also has the added advantage of not defining "linux", so DT
property names such as "linux,keymap" don't get mangled.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
fdt: make fdt_fixup_memory_banks dynamically size tmp array

The array of banks passed to fdt_fixup_memory_banks() might not be the
same as U-Boot's internal array of memory banks. For example, if some
memory is reserved for simplefb, one of U-Boot's banks might need to be
split into two pieces when passed to the kernel. Hence, it's invalid to
assume that CONFIG_NR_DRAM_BANKS is the correct size for any array of
memory banks passed to the kernel. Instead, size the array dynamically
so that any number of banks will work.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
lcd: implement lcd_adjust_memory_banks()

If simplefb is used, then the RAM used for the FB data cannot be used
by the OS as regular RAM; instead, it must be carved out of the memory
banks passed to the kernel. This patch implemnts a function that will
delete, split, or resize the entries in U-Boot's list of memory banks
so that the list of banks passed to the kernel doesn't include the FB
memory.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
ARM: fdt: use lcd_adjust_memory_banks()

If simplefb is enabled, then before calling fdt_fixup_memory_banks(),
pass the array of banks through lcd_adjust_memory_banks() to make sure
that the FB memory region isn't passed to the kernel.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
ARM: tegra: add simplefb DT node during bootz/m

Signed-off-by: Stephen Warren <swarren@nvidia.com>
ARM: tegra: support raw ramdisks

This way, we don't have to run mkimage on them.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
NET: Improve TFTP booting performance when CONFIG_USB_KEYBOARD

TFTP booting is slow when a USB keyboard is installed and
CONFIG_USB_KEYBOARD is defined.
This fix is to change Ctrl-C polling to every second when NET transfer
is running.

Signed-off-by: Jim Lin <jilin@nvidia.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
ARM: tegra: Make cache line size SoC specific

Currently all Tegra SoCs are assumed to have 32 byte cache lines. This
isn't true for Tegra114, however, which uses 4 Cortex-A15 cores and
therefore uses a cache line size of 64 bytes. Move the cache line size
setting to the per-SoC common configuration file.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
ARM: tegra: Enable data cache on Dalmore

Disabling the data cache is no longer required to boot Dalmore, so
enable it. This results in notably better performance when loading
and booting the Linux kernel.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>