ARM: Tegra: FDT: Add USB EHCI function for T30/T114

Add DT node for USB EHCI function.
Add support for T30-Cardhu, T30-Beaver, T114-Dalmore boards.

Signed-off-by: Jim Lin <jilin@nvidia.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
ARM: Tegra: USB: EHCI: Add support for Tegra30/Tegra114

Tegra30 and Tegra114 are compatible except PLL parameters.

Tested on Tegra30 Cardhu, and Tegra114 Dalmore
platforms. All works well.

Signed-off-by: Jim Lin <jilin@nvidia.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Tegra: Config: Enable Tegra30/Tegra114 USB function

Add USB EHCI, storage and network support.

Tested on Tegra30 Cardhu, and Tegra114 Dalmore
platforms. All works well.

Signed-off-by: Jim Lin <jilin@nvidia.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
HACK: fix MAKEALL microblaze-generic

Signed-off-by: Stephen Warren <swarren@nvidia.com>
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>
---
v2: New patch.
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>
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>
---
v2:
* Added note to commit description re: line numbers.
* s/.dtstmp/dts.tmp/ in temporary filenames.
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>
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>
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>
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>
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>
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>
Revert "usb: hub: Power-cycle on root-hub ports"

This reverts commit 020bbcb76b5be0d5406d2ae7c26dbdb013ead812.

Conflicts:
	common/usb_hub.c

Signed-off-by: Stephen Warren <swarren@nvidia.com>
ARM: tegra: enable LCD panel on Harmony

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
v2: Removed CONFIG_LCD_DT_SIMPLEFB
ARM: tegra: enable LCD panel on Ventana

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
v2: Removed CONFIG_LCD_DT_SIMPLEFB
lcd: remove unaligned access in lcd_dt_simplefb_configure_node()

Some ARM compilers may emit code that makes unaligned accesses when
faced with constructs such as:

const char format[] = "r5g6b5";

Make this data static since it doesn't chagne; the compiler will simply
place it into the .rodata section directly, and avoid any unaligned run-
time initialization.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
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>