ARM: add basic support for Trusted Foundations

Trusted Foundations is a TrustZone-based secure monitor for ARM that
can be invoked using the same SMC-based API on all supported
platforms. This patch adds initial basic support for Trusted
Foundations using the ARM firmware API. Current features are limited
to the ability to boot secondary processors.

Note: The API followed by Trusted Foundations does *not* follow the SMC
calling conventions. It has nothing to do with PSCI neither and is only
relevant to devices that use Trusted Foundations (like most Tegra-based
retail devices).

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Reviewed-by: Tomasz Figa <t.figa@samsung.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
ARM: tegra: add support for Trusted Foundations

Register the firmware operations for Trusted Foundations if the device
tree indicates it is active on the device.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Reviewed-by: Tomasz Figa <t.figa@samsung.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
ARM: tegra: split setting of CPU reset handler

Not all Tegra devices can set the CPU reset handler in the same way.
In particular, devices using a TrustZone secure monitor cannot set the
reset handler directly and need to do it through a firmware operation.

This patch separates the act of setting the reset handler from its
preparation, so the former can be implemented in a different way.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Reviewed-by: Tomasz Figa <t.figa@samsung.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
ARM: tegra: set CPU reset handler with firmware op

Use a firmware operation to set the CPU reset handler and only resort to
doing it ourselves if there is none defined.

This supports the booting of secondary CPUs on devices using a TrustZone
secure monitor.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Reviewed-by: Tomasz Figa <t.figa@samsung.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
ARM: tegra: support Trusted Foundations by default

Support for Trusted Foundations is light and allows the kernel to run on
a wider range of devices, so enable it by default.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Reviewed-by: Tomasz Figa <t.figa@samsung.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
simplefb: fix unmapping fb during destruction

Unfortunately, fbdev does not create its own "struct device" for
framebuffers. Instead, it attaches to the device of the parent layer. This
has the side-effect that devm_* managed resources are not cleaned up on
framebuffer-destruction but rather during destruction of the
parent-device. In case of fbdev this might be too late, though.
remove_conflicting_framebuffer() may remove fbdev devices but keep the
parent device as it is.

Therefore, we now use plain ioremap() and unmap the framebuffer in the
fb_destroy() callback. Note that we must not free the device here as this
might race with the parent-device removal. Instead, we rely on
unregister_framebuffer() as barrier and we're safe.

Reported-by: Tom Gundersen <teg@jklm.no>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
simplefb: use write-combined remapping

Framebuffers shouldn't be cached and it is usually very uncommon to read
them. Therefore, use ioremap_wc() to get significant speed improvements on
systems which provide it. On all other systems it's aliased to
ioremap_nocache() which is also fine.

Reported-by: Tom Gundersen <teg@jklm.no>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Tested-by: Tom Gundersen <teg@jklm.no>
Tested-by: Alexandre Courbot <acourbot@nvidia.com>
Tested-by: Stephen Warren <swarren@wwwdotorg.org>
regulator: bq2419x: Add driver

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
[mperttunen@nvidia.com: changed commit message]
Tested-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
ARM: tegra: add configuration for roth (SHIELD)

Roth requires a few additional configuration options compared to Tegra.
This is hopefully only temporary.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
ARM: tegra114: add device tree for roth (SHIELD)

Add roth's device tree along with pinmux, regulators, and devices
supported by the kernel.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
ARM: tegra: USB support for roth

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
ARM: tegra: Add bq2419x to roth device tree

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Add README.md

Display some information about this branch on Github.
[HACK] roth: init display clocks

Necessary to keep the display on after boot

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
usb: phy: tegra: Use OTG ID pin to manage VBUS regulator [HACK]

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
[HACK] Implement TF's do_idle()

This is probably not the way this should be done, but it keeps Tegra
alive when cpuidle kicks in.
Add missing UART pin in pinmux
ARM: roth: move command-line into device tree

It's way better there as we need a device tree anyway and it reduces the
difference with tegra_defconfig

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
ARM: roth: remove root boot arguments

Using initramfs to prepare the root FS, these should not be used.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
roth: increase max initrd size