ocp: Initial patch for OCP handler.
authorDaeyeong Lee <daeyeong.lee@samsung.com>
Thu, 4 May 2017 02:20:02 +0000 (11:20 +0900)
committerlakkyung.jung <lakkyung.jung@samsung.com>
Mon, 23 Jul 2018 05:59:25 +0000 (14:59 +0900)
commitd13825955a25c02abc11960fa78b04cd8162b772
tree1dbd7b518d5276869b7a4db1a584a238413ffd53
parent8a2b4623f8b8bbb106d967362757015dc231de6b
ocp: Initial patch for OCP handler.

Change-Id: I17290b920385baa232feb2c6501e4ea568e80551
Signed-off-by: Daeyeong Lee <daeyeong.lee@samsung.com>
[9820] ocp: Move OCP register initialization to EL3

Change-Id: I76c0414fe88b4527737995ce46a6c9ec46b01537
Signed-off-by: Daeyeong Lee <daeyeong.lee@samsung.com>
[9820] ocp: Change the policy when en/disable interrupt and OCP controller

- Enable BPC interrupt only when OCP situration.
  Without OCP situration, the max frequency limit is cleared.
  The BPC interrupt is necessary to release the max frequency limit,
  so it is not necessary when the max frequency limit is off.

- Do not fix the OCP controller in the standby state during the OCP interrupt handling interval.
  Even during OCP interrupt handling,
  the OCP controller should prevent the system down through the uArch throttle.

Change-Id: I541204681f9d6dedfa5e8a5bf33e43b5de432695
Signed-off-by: Daeyeong Lee <daeyeong.lee@samsung.com>
[9820] ocp: MK errata 57068: Modify to only meerkat cores access OCP controller

- According to MK errata 57068, there may be a problem
  when accessing the GCU inside the MK Cluster NONCPU block on the APB bus.
  Therefore, the access to the GCU has been modified
  so that it can be performed only in the MR core.

Change-Id: I2476e0be8151a2f61baf325498e83fb90776dcd7
Signed-off-by: Daeyeong Lee <daeyeong.lee@samsung.com>
[9820] ocp: MK errata 57068: Use mrs/msr to access OCP controller instead of ioremap

Change-Id: I7595aced5b53a06cf598cc785d0e24ec906b20cb
Signed-off-by: Daeyeong Lee <daeyeong.lee@samsung.com>
[9820] ocp: MK errata 58402: Should not use DPM based function

 - To avoid bug 58402, BPC interrupt should not be used.
   Therefore, it is decided to use the timer to release the max frequency
   that restricted by OCP interrupt.

Change-Id: I86e4328594c898e01ed251e3afce80dbd6377c37
Signed-off-by: Daeyeong Lee <daeyeong.lee@samsung.com>
[9820] ocp: Combine exynos-ocp.h with exynos-ocp.c

Change-Id: Ifbb40192ac6ffe090d27d6a814e08cbed0275d96
Signed-off-by: Daeyeong Lee <daeyeong.lee@samsung.com>
[9820] ocp: Add code to change ocp flag to false when ocp is released

Change-Id: Ia66312da1a3cc3897eb9f32def362dd14e02c187
Signed-off-by: Daeyeong Lee <daeyeong.lee@samsung.com>
[9820] ocp: s2mps18: Use currentmeter info for determining BPC condition

Change-Id: Ia349ee985338d2d4bed70c4de2fa10b2da871d9a
Signed-off-by: Daeyeong Lee <daeyeong.lee@samsung.com>
[9820] ocp: Add sysfs attributes to show ocp stats

total_trans : show how many ocp max limit is changed. (wrap-around value)
time_in_state : show how long ocp max limit is held at each frequency.
clipped_freq : show current ocp max limit level.

Change-Id: I60597ed6b1d080ead0dded0cca62103d7368bc02
Signed-off-by: Daeyeong Lee <daeyeong.lee@samsung.com>
[9820] ocp: Modify OCP handler to set ocp max limit according to current limit

Previously, OCP handler set ocp max limit to lower than curruent frequency by down_step.
However this entangled with thermal and caused unintended behavior.
So modify OCP handler to set ocp max limit according to current limit,
instead of current frequency.

Change-Id: I773be8d0186e4549a1165644507a3b6799c82eeb
Signed-off-by: Daeyeong Lee <daeyeong.lee@samsung.com>
[9820] ocp: trace: power: Add trace_ocp_max_limit

Change-Id: I2448c962eaeafc0d4e16f2314c9f6c109377fa47
Signed-off-by: Daeyeong Lee <daeyeong.lee@samsung.com>
[9820] ocp: Change pr_info to pr_debug for debug information

Change-Id: Ia79682f547ce4ac184bd1acb6c5a94ed428375f9
Signed-off-by: Daeyeong Lee <daeyeong.lee@samsung.com>
[9820] ocp: Align code for readability

Change-Id: I5b65a82f418f6f74a8cab465e19cee9366f0f198
Signed-off-by: Daeyeong Lee <daeyeong.lee@samsung.com>
[9820] ocp: Add exynos-snapshot log

Change-Id: I21d2017880e48ccdfd6d17e77a2ca1133acc5e09
Signed-off-by: Daeyeong Lee <daeyeong.lee@samsung.com>
[9820] ocp: Add sysfs node to enable/disable OCP interrupt handling

User can control the ocp handling operation as below:
- echo 1 > /sys/devices/platform/exynos-ocp/ocp/enabled => enable
- echo 0 > /sys/devices/platform/exynos-ocp/ocp/enabled => disable

Change-Id: Ia4128f4b72c0cf68199cb563406fc5f806a6b6b5
Signed-off-by: Daeyeong Lee <daeyeong.lee@samsung.com>
[9820] ocp: Remove setting current dvfs level to OCP controller

Change-Id: Ie862c51256d6e1f866a26de70f67176a7099d4bc
Signed-off-by: Daeyeong Lee <daeyeong.lee@samsung.com>
[9820] ocp: Modify the way to get initial max/min frequency

"policy->min/max" could be changed by thermal already,
when the OCP probe function attempts to read the initial value
Therefore, modify OCP probe function to read the values of policy->user_policy.min/max

Change-Id: I605bfa01271bcfd6df28a1092e930587293e6877
Signed-off-by: Daeyeong Lee <daeyeong.lee@samsung.com>
[9820] ocp: s2mps19: change PMIC driver to s2mps19

Change-Id: I9869be76a54ae66d3daeefc2b5c2ed383619818e

[9820] ocp: update IRP value in OCPTOPPWRTHRESH instead of OCPINTCTL

In 9820, register map is changed; IRP field in OCPINTCTL is RO.
Therefore change register for IRP value update into OCPTOPPWRTHRESH.

Change-Id: If642179607edfc5fbff1d9973fadfef9d97d17a7

[9820] ocp: Use cpu load information for BPC condition

Change-Id: Ie65699ccb649c33f7ca7a704bc50764c002a5171
Signed-off-by: Daeyeong Lee <daeyeong.lee@samsung.com>
[9820] ocp: modify exynos-ss to debug-snapshot

Change-Id: I95c6fd983a23630d42b5045389fa39fc175dce23
arch/arm64/boot/dts/exynos/exynos9810_evt0.dtsi [new file with mode: 0644]
drivers/soc/samsung/Kconfig
drivers/soc/samsung/Makefile
drivers/soc/samsung/exynos-ocp.c [new file with mode: 0644]
include/trace/events/power.h