ARM: OMAP4: cpuidle: Configure MPU C4 state to OSWR

Due to MPU_EMIF_NO_DYNDEP_IDLE_iXXX, MPU->EMIF dynamic dependency
is disabled when going to LP mode. This allows us to enable deeper
power state for MPU as MPU can transition to lower power state
independent of core power domain. We have observed 1.5mA saving in
OS Idle Screen on use case.

Change-Id: If4ec4426626dabf810b1f21ed33cdabafa386d5f
Signed-off-by: Madhusudan Chittim <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
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>
OMAP: dmtimer: Fix memory leak on dmtimer error

Change-Id: I858c24a21410f2c1c85b1b8b2c1fc4dc5d3c1e6d
Signed-off-by: Jared Suttles <jsuttles@motorola.com>
OMAP: dmtimer: Fix timer handling logic for non loses_context timers

The use of the enabled flag is currently tightly coupled with the
loses_context flag on the timer struct. This change makes the enabled
flag behave more sanely without consideration of the loses_context flag.

Change-Id: I9d33bb4cc3fd7917ad493adde75cf57cb240b106
Signed-off-by: Jared Suttles <jsuttles@motorola.com>
SGX-KM: Add build config for SGX 544 (OMAP 4470)

Adding build config for SGX 544 (OMAP 4470)

Change-Id: Iaecdbd3db551b5685f8d8e3b93656a4b3f33b721
Signed-off-by: Hemant Hariyani <hemanthariyani@ti.com>
rpmsg: omx: add return values to the pa to da convert function

This patch adds return values to the pa to da conversion function.
This will help in propagation of proper error codes to the calling
functions.

Change-Id: Ie547f7b7e7c51eff4b7998cbd336a61663995708
Signed-off-by: Subramaniam C.A <subramaniam.ca@ti.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
OMAP4: PM: Handle LPDDR CLK IO errata during suspend/idle

There is a HW bug in CMD PHY which gives ISO signals as same for
both PADn and PADp on differential IO pad, because of which IO
leaks higher as pull controls are differential internally and
pull value does not match A value.
Though there is no functionality impact due to this bug, it is
seen that by disabling the pulls there is a savings ~500uA in
OSWR, but draws ~300uA more during OFF mode.

To save power during both idle/suspend following approach taken:
 1) Enable WA during boot-up.
 2) Disable WA while attempting suspend and enable during resume.

CDDS no: OMAP4460-1.0BUG00291
(OMAP official errata ID yet to be available).

Change-Id: Ic39f17be50ff602c71e714b05af3811b35c1a67f
Reported-by: Logan Lee <hklee@ti.com>
Signed-off-by: Shashi Shekar B.S. <shashi.shekar@ti.com>
Signed-off-by: Ambresh K <ambresh@ti.com>
ARM: omap4: emif: use device level self refresh timing

Use a single self refresh time param for the entire device.

Increase selfrefresh time to 262144 cycles from 2048.

Change-Id: Ie6ab6c36a19418cde3a22c7a2ddbe0db1986af02
Signed-off-by: Dan Murphy <dmurphy@ti.com>

Conflicts:
	arch/arm/mach-omap2/lpddr2_elpida_data.c
omap: rpmsg: sleep while recovering from mbox null situation

Mbox null situation, due to the auto-suspend path happening at the
same time a new message is trying to be sent, was workarounded by
trying to wake up Ducati in a loop. However the loop was not giving
the chance for the suspending path to completes. So, Ducati was never
wake it up again since it is necesary to be in suspended state.

This patch adds an sleep that gives a chance for the suspending path
to completes before trying to wake Ducati up again.

Change-Id: Ic6ecffc40f6651aef482d49da93086445fd391e2
Signed-off-by: Juan Gutierrez <jgutierrez@ti.com>
Signed-off-by: Fernando Guzman Lugo <fernando.lugo@ti.com>
OMAP4: EMIF: Add processing of memory overheating.

We need to turn the device off if memory is overheated.
This patch makes shutdown device if memory overheated in run-time
and makes reboot if memory overheated during booting.
In last case bootloader should process overheating

Change-Id: I28a0bfcd79a4018a628ffc099e3715b17b7034c1
Signed-off-by: Dan Murphy <dmurphy@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>
OMAPDSS: DSS: Complete callbacks on mgr->blank if not wait_for_go

Disabled panels do not clear GO automatically, therefore, we
assume no wait_for_go on disabled panels.

When not waiting for GO, complete all pending composition
callbacks regardless of dirty state, as dirty state will not
be propagated.

Change-Id: Ic5ddd81414bab56d136a716907fd8e6dfa0f795f
Signed-off-by: Lajos Molnar <lajos@ti.com>
OMAPDSS: DSS: Fix wait_for_go support on mgr->blank() for manual update panels

Manual update panels do not clear GO automatically.  For these panels we need
to call update so that GO gets cleared.

Change-Id: Idb446af8c77553cec8baf7af893d180cfbaa7582
Signed-off-by: Lajos Molnar <lajos@ti.com>
OMAP: TILER: Make character driver creation configurable

The TILER code that creates the character driver code and
interacts with the userspace has been placed under the
kernel configuration option that controls the userspace,
so that the cdev creation is bypassed when userspace is
disabled.

Change-Id: I3d5d372433fc89e676e54088dc8af8bdb74b8007
Signed-off-by: Shivananda Hebbar <x0hebbar@ti.com>
Signed-off-by: Andy Gross <andy.gross@ti.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
OMAP: TILER: Kconfig: Disable tiler ioctl interface

TILER provided an interface to userspace through a
character driver /dev/tiler, and through a MemMgr
API in the userspace. This TILER ioctl interface
is currently deprecated. The kernel config options
have been changed accordingly to avoid any misuse.

Change-Id: Ia69f4f6161e6f4d5fb45ef12aaac5976e0bdd53d
Signed-off-by: Shivananda Hebbar <x0hebbar@ti.com>
Signed-off-by: Andy Gross <andy.gross@ti.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
ARM: OMAP4: l2x0: Cleanup prefetch offset register setting

The bits [31:5] of Prefetch Offset Register are reserved in
PL310 r2p0 so they should be kept unchanged.
It's enough to set Data prefetch enable bit in PL310 auxiliary
control register to enable the feature, so setting of bit 28 of POR
is removed.
Before writing POR value, the bits [4:0] has to be cleared to remove
previous value.

Change-Id: Id5d047da0daa0c841c69d4d587d2280d2f3433f9
Signed-off-by: Konstantin Shlyakhovoy <x0155534@ti.com>