msm: pm2: Add memory markers across PM driver

Add memory markers in PM driver to know the SPC & PC code flow.
This patch is useful to debug the stability/field issues.
Currently below are marker locations used by individual cores.

Cores SPC/HOTPLUG marker locations:
----------------------------------
C0	-->	0xFC00010
C1	-->	0xFC00014
C2	-->	0xFC00018
C3	-->	0xFC0001C
Above all locations are written an unique value when
the core executes different parts of LPM code.

C0	-->	0xFC00020
C1	-->	0xFC00024
C2	-->	0xFC00028
C3	-->	0xFC0002C
If the values written become
	0x1	--> Cores are doing idleSPC
	0x2	--> Cores are in HOTPLUG state
	default	--> 0x0

e.g:
	0xFC00014	--> 0x4
	0xFC00024	--> 0x2
Above markers tell us that C1 is in HOTPLUG
	0xFC00014	--> 0x4
	0xFC00024	--> 0x2
Above markers tell us that C1 comes out of HOTPLUG

C0 PC marker locations:
----------------------
C0	-->	0xFC00030

Extra locations:
---------------
0x34	--> write 1, this tells 'idle-v7.S' that we are doing PC
0x38	--> tell us we are idlePC/suspendPC
	If the values written become
		default		--> 0x0
		suspendPC	--> 0x1
		idlePC		--> 0x2

Change-Id: If89e2c193d5e3134bd08d3910db95304d89a31db
Signed-off-by: Murali Nalajala <mnalajal@codeaurora.org>
msm: pm2: Extend memory marker support to 7x27A

Currently debug markers support presents for only 8x25.
This change was borken for 7x27a traget as it uses the same
kernel binary for 7x27a and 8x25 targets. Fix this for 7x27a
target by moving the "memblock_remove" API to 7x27a reserve
function.

Change-Id: I512af0dddc68eb4ce98774552a78fc16c5b5e39f
Signed-off-by: Murali Nalajala <mnalajal@codeaurora.org>
msm: pm2: Log SPM registers before executing the WFI

Dump SPM(CTL&CFG)and APPS_PWRDOWN  registers before
executing the WFI instruction for every GDFS&PC
(both idle&suspend).

Locations:

     |	SAW2_CFG	SAW2_CTL	APPS_PWRDOWN
----------------------------------------------------
SPM0 |	0xFC00050	0xFC00054	0xFC00058
SPM1 |	0xFC00060	0xFC00064
SPM2 |	0xFC00070	0xFC00074
SPM3 |	0xFC00080	0xFC00084

Change-Id: I44783c1ac011fe8a5c525873c3feadca02640c9f
Signed-off-by: Murali Nalajala <mnalajal@codeaurora.org>
msm: idle-macros: Do not access SPM registers for 7x27a

As there is no SPM h/w block on 7x27a, accessing the
SPM registers without target check causing the system
failures. Hence do a target check before accessing
the SPM registers

CRs-fixed: 470075
Change-Id: Id449b71ec84ae85b81fbca3533fd28af8c9e53a1
Signed-off-by: Murali Nalajala <mnalajal@codeaurora.org>
msm: pm2: Write a known pattern before executing the WFI

Write "0xAA" pattern to 'reserved' field in the shared
pm smem data structure variable before executing the
WFI instruction.

Whenever APPS starts a PC sequence, modem keep polls for
a value "0xAA" for every 10ms in a shared memory structure.
Once modem sees the "0xAA" value it again start a 3ms timer
and expect an interrupt from APPS(A2M_INT6). In a corner case
if modem didn't see an interrupt from APPS within a 3ms it
simulate PC sequence like as if it receives and interrupt.

CRs-fixed: 467148
Change-Id: Ie03bd2d4002fb13fec93388c1e9ad1d8233623f9
Signed-off-by: Murali Nalajala <mnalajal@codeaurora.org>
msm: pm2: Send SMSM RESET request to modem

On some senarios when the APPS initiate the PC
seqeunce it informs to modem and wait for MODEM
response back within 2.5sec. If it did not happens
then APPS moves to an indefinite loop and not
responde to any modem communication. This causing
the FS dog timeout after 532sec which is quite
a long time where modem do an ERR fatal.

Send SMSM RESET request to modem when there
is a timeout on APPS (> 2.5sec). This change
will reset the target when the timeout on APPS
is more than 2.5sec.

(Here the time is 50000*50 us = 2.5 Sec)

CRs-fixed: 469075
Change-Id: Ic60eb6d6ea4a791776f5ad2bc93a58288474fcc7
Signed-off-by: Venkat Devarasetty <vdevaras@codeaurora.org>
Signed-off-by: Murali Nalajala <mnalajal@codeaurora.org>
Merge "msm: pm2: Add memory markers across PM driver"
Merge "msm: pm2: Extend memory marker support to 7x27A"
Merge "msm: pm2: Log SPM registers before executing the WFI"
Merge "msm: idle-macros: Do not access SPM registers for 7x27a"
Merge "msm: pm2: Write a known pattern before executing the WFI"
Merge "msm: pm2: Send SMSM RESET request to modem"
msm: kgsl: Always reset global ts_cmp_enable on GPU interrupts

Always rest the ts_cmp_enable when an interrupt is received
from the GPU.  This keeps legacy code that is not using
per context timestamps correctly updated.  No effect is
seen with mainline code using per context timestamps.

CRs-fixed: 418172
Signed-off-by: Carter Cooper <ccooper@codeaurora.org>
(cherry picked from commit 95b0011ae56577e84d2912ae7d600ae62c08c2e4)

Change-Id: Id11bd4c7adfd5a396e01f508c383a62adab3d544
Signed-off-by: Gopal Goberu <ggober@codeaurora.org>
Merge "msm: kgsl: Always reset global ts_cmp_enable on GPU interrupts"