Backport some pm functions to be ready for: Two flags for
 async suspend_noirq and suspend_late Asynchronous threads for resume_noirq
 ...
PM-sleep-Asynchronous-threads-for-resume_noirq
PM-sleep-Asynchronous-threads-for-resume_noirq
Add missing mutex_unlock() call to prevent deadlocks.
OMAP4: Enable main inst clock for save to ram.

In HS-devices we must ensure that l3_main_inst
clock is enabled for saveram operation

Change-Id: Id9a5ab013ed99499f0fde89d9251ae5a95a49b45
Signed-off-by: Axel Haslam <axelhaslam@ti.com>
Signed-off-by: Akash Choudhari <akashc@ti.com>
Signed-off-by: Chittim Madhusudan <c-madhu@ti.com>
OMAP4+: Add ability to store reboot reason

Bootloaders need to know when their platforms do a reboot.
The only memory that is retained is SAR ram accross reboots,
provide ability to store the reboot reason in a standard location
in the SAR memory (using the last 0xf bytes in SAR BANK1 ram).

This is now populated with the string "normal" if the reboot
is due to ordinary reboot commands, if the reboot reason is
for other reasons, such as bootloader or recovery as is the
case with Android systems, this stores the same.

NOTE: bootloader should be updated accordingly.

Change-Id: I32d05ef023682a1530b34315dac90fd97bed3265
Signed-off-by: Nishanth Menon <nm@ti.com>

Conflicts:
	arch/arm/mach-omap2/Kconfig

Conflicts:
	arch/arm/mach-omap2/Kconfig
OMAP: Support for Android RAM console

Android's RAMCONSOLE framework is handy framework which allows
saving the kernel printk messages to a buffer in RAM, so that
after a kernel panic they can be viewed in the next kernel
invocation, by accessing /proc/last_kmsg.

This obviously needs DDR to be in selfrefresh mode. Board files
which have relevant support need to enable CONFIG_OMAP_RAM_CONSOLE
and call omap_ram_console_init with relevant parameters for this
to function.

Change-Id: I2dd5ad55a0a3af5a5dcb9a9b8a797e1371af39bc
Signed-off-by: Huzefa Kankroliwala <huzefank@ti.com>
Signed-off-by: Akash Choudhari <akashc@ti.com>
Signed-off-by: Ameya Palande <ameya.palande@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
ARM: OMAP: Fix ramconsole init.

Fix the issue when trying to register a platform device
before the platform device was initialized.

Postpone the device registration until the board file init.

Change-Id: I3920f9236fec957e4f63f39ff9aa3bae530af014
Signed-off-by: Dan Murphy <dmurphy@ti.com>
OMAP: ramconsole: fix offset by 1 error in recovery path

memblock_add in recovery path of omap_ram_console_register takes
size parameter which is end - start + 1 instead of just end - start.

Change-Id: Iceb88c41538e497611d94dc49e2fc2fff8ee4d30
Signed-off-by: Nishanth Menon <nm@ti.com>
OMAP: ramconsole: make omap_ram_console_register device_initcall

Commit: 65b0b50251c8aa66d5e1da712e3183c74b08c615
(ARM: OMAP: Fix ramconsole init) fixes the symptom of not having
platform_device root device available at reserve. However,
there is no need for omap_ram_console_register to be invoked
by board files as we can do the registration internal to ram_console
logic itself as part of device_initcall.

We use a flag to ensure that we register the device only if the board
file has updated relevant parameters.

Change-Id: I1a0c622612007b0a0ce3249cf71a1dfed9401e24
Signed-off-by: Nishanth Menon <nm@ti.com>
OMAP4+: reboot-reason: handle wdt trigger

consider a scenario where one does a adb reboot-bootloader
the SAR memory is populated with "bootloader", and fastboot
reboot. If the bootloader does not cleanup the SAR memory
and a wdt triggers, the normal arch reset path is not
taken, instead bootloader will startup and detect the
previous string, which is wrong. kernel should be able
to recover as much as possible any miscoded bootloaders.

Change-Id: Icec723287415511b7733955c47f8931e0b43d3c5
Signed-off-by: Nishanth Menon <nm@ti.com>
OMAP4: PRM: fix RSTTIME and RSTST offsets

RSTTIME is offset 0x8 and RSTST is offset 0x04 for OMAP4430 and
OMAP4460.

Change-Id: I6626f4f0a5b1704b755181635d47a5eb5cbf6254
Signed-off-by: Nishanth Menon <nm@ti.com>
OMAP4: USB: Fixed tshut reboot issue

Wakeup enable was set for usbb1_ulpitll_dir.usbb1_ulpiphy_dir. This is also
muxed with gpio 86. When a wakeup event was detected as part of the
gpio runtime resume, it set the gpio 86 event causing a tshut irq event.
We now rely on the wakeup from pin usbb1_ulpitll_dat0.usbb1_ulpiphy_dat0 for
USB wakeup events.

Change-Id: Ic32a976118944e45b91c0bdce6099ab090da3ae7
Signed-off-by: Huzefa Kankroliwala <huzefank@ti.com>
Signed-off-by: Ruchika Kharwar <ruchika@ti.com>