rpmsg: resmgr: omap: allow _device_scale to call mach->ops function

The _device_scale function in the rpmsg omap resmgr code was stubbed
out previously as DVFS framework was not available in the kernel. This
would be used by resources such as IVA and FDIF to request a frequency
scale constraint. The DVFS code/framework implementation has been
added lately, and the stubbed code has therefore been cleaned up to
allow the _device_scale to actually call the .device_scale ops hook
registered through the platform data.

Change-Id: If8154a99fbcf4d7ddb200e0fae5215ea398912e2
Signed-off-by: Subramaniam Chanderashekarapuram <subramaniam.ca@ti.com>
rpmsg: resmgr: omap: use pm qos api for memory throughput

The rpmsg resmgr driver expects the bandwidth API (for memory
throughput requests) to be defined by the device platform data.
This is no longer required since the pm_qos API would be used
for requesting memory throughput.

The patch removes the mach specific calls for throughput and
invokes the pm_qos APIs from the omap rpmsg resmgr driver for
all resources that support/require memory throughput on the
L3 bus.

Change-Id: I02c4ee51bdca99c62b02d0f2b7b5559098c63089
Signed-off-by: Subramaniam Chanderashekarapuram <subramaniam.ca@ti.com>
rpmsg: resmgr: support resource-data request from rproc

Support data request from remote processor. Currently only
maximum frequency query is available for ivahd, iss and fdif.

Change-Id: I9bc19f2a299e5756648b0e38aae25e7ce4ac6b02
Signed-off-by: Juan Gutierrez <jgutierrez@ti.com>
Signed-off-by: Paul Hunt <hunt@ti.com>
Signed-off-by: Fernando Guzman Lugo <fernando.lugo@ti.com>
rpmsg: serialize the buffer receiving in rpmsg_recv_done function

The rpmsg_recv_done is the rpmsg transport layer function that
processes/retrieves the incoming messages from the rx virtqueue ring.
This function currently executes in a kthread context, and as such
can be preempted and deliver messages out of order w.r.t to the msg
order in the rx virtqueue ring. This can cause the state machine of
a recipient to go haywire.

The receive buffers delivery is serialized by locking the entire
routine.

Change-Id: I48d1a5bd6f6ec84103e6e8b3e7b92e81b060be12
Signed-off-by: Chandra Sekhar.Anagani <chandu@ti.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
remoteproc: omap: use pm qos api for memory throughput

The omap remoteproc driver expects the bandwidth API (for memory
throughput requests) to be defined by the device platform data.
This is no longer required since the pm_qos API would be used
for requesting the same.

The patch removes the machine specific calls for throughput and
calls the pm_qos APIs from the omap remoteproc driver.

Change-Id: Iad71a08017171c818915963963099a576af040f9
Signed-off-by: Subramaniam Chanderashekarapuram <subramaniam.ca@ti.com>
remoteproc: export rproc_error_reporter function

The rproc_error_reporter function is currently being used to
report MMU faults and trigger a recovery. This is internal to
the remoteproc framework.

However, the function can be used to report errors other than
just iommu faults, like errors that a remoteproc detects and
notifies the remoteproc driver. The rproc_error_reporter
function therefore is now exported to allow other clients to
report an error.

Change-Id: Ib4efd8a70e2ae745afbaaea5bca11f33ba07ad0a
Signed-off-by: Subramaniam Chanderashekarapuram <subramaniam.ca@ti.com>
remoteproc: introduce error types for watchdog and device exception

This patch introduces two new error types for watchdog and
device exception.

Change-Id: Iad3aeb887427b43554bf6f83c17b600eceee0b17
Signed-off-by: Subramaniam Chanderashekarapuram <subramaniam.ca@ti.com>
remoteproc: omap: trigger recovery for device exceptions

The omap remoteproc driver detects device exceptions when a mailbox
crash message is sent by the remote core.

The omap remoteproc driver notifies the remoteproc core using the
rproc_error_reporter function to trigger a recovery in the event
of any device exceptions.

Change-Id: Ief557c7d34b28011bc520b0412752c5d28fce37d
Signed-off-by: Subramaniam Chanderashekarapuram <subramaniam.ca@ti.com>
remoteproc: omap: fix timer cleanup in remoteproc start code

There is a minor cleanup bug in the omap remoteproc driver start
code, where in the timers are not released if the device_enable
fails. The same has been fixed.

Some other minor comments have also been corrected.

Change-Id: I24561c4988a31241accf289f1ea23af7e3bdd253
Signed-off-by: Subramaniam Chanderashekarapuram <subramaniam.ca@ti.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
remoteproc: omap: add watchdog functionality for remote processors

Remote processors can be stuck in a loop, and may not be recoverable
if they do not have a built-in watchdog. The watchdog implementation
for OMAP remote processors uses external gptimers that can be used
to interrupt both the Linux host as well as the remote processor.

Each remote processor is responsible for refreshing the timer during
normal behavior - during OS task scheduling or entering the idle loop
properly. During a watchdog condition (executing a tight loop causing
no scheduling), the host processor gets interrupts and schedules a
recovery. The remote processor also gets interrupted to be able to
print a back trace

A menuconfig option has also been added to disable the Watchdog
functionality. This is useful for any JTAG debugging.

Change-Id: Ide8c137ec3df020e90b7b73b370aa2a1d65023ad
Signed-off-by: Subramaniam Chanderashekarapuram <subramaniam.ca@ti.com>
Signed-off-by: Shahid Akhtar <sakhtar@ti.com>
Signed-off-by: Fernando Guzman Lugo <fernando.lugo@ti.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
remoteproc: implement last trace for remoteproc

The last trace is a way of preserving the remoteproc traces past
remoteproc recovery. This is achieved by creating a new last_trace
debugfs entry during a crash for each trace entry, and copying the
trace buffer contents into the corresponding last trace entry. This
copy can then be read out using a debugfs entry. The trace entries
themselves are cleaned up after the copy and are recreated during
recovery.

Something like,
	cat <debugfs root>/remoteproc/remoteprocX/traceX_last
should give the traces that were printed out just before the recovery
happened.

Change-Id: I2d6879421022a895dc34dfcc5c003ff33779128c
Signed-off-by: Subramaniam Chanderashekarapuram <subramaniam.ca@ti.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Fernando Guzman Lugo <fernando.lugo@ti.com>
remoteproc: handle only the first fatal error

The remoteproc driver gets notified of a Watchdog error or a MMU Fault
directly through an interrupt, and other internal exceptions through
a mailbox message. The remote processors can also get an interrupt for
printing the back trace for all exceptions, and may end up in sending
a exception mailbox message for the same error to the kernel-side.

However, the error handler thread has to handle only the first error
and bail out if the processing of the first error message is still
ongoing. A check has therefore been added to verify that the rproc
state is not already RPROC_CRASHED or RPROC_OFFLINE.

Change-Id: If44432fe245dd733a7e7ce29128eed00eb921f49
Signed-off-by: Fernando Guzman Lugo <fernando.lugo@ti.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
UBUNTU: Config add OMAP_REMOTEPROC_WATCHDOG

Signed-off-by: Xavier Boudet <x-boudet@ti.com>
OMAP4: ERRATA: ARM: Fix ARM Errata 742230

Errata 742230: This Errata workaround requires bit 4 to be set in the CP15
diagnostic control register. This patch takes care of this errata fix for GP
devices at CPU init time and at the cpu_resume stage.

Signed-off-by: Ruchika Kharwar <ruchika@ti.com>
Signed-off-by: Sebastien Jan <s-jan@ti.com>
OMAP4: ERRATA: ARM: Fix ARM Errata 751472

Errata 751472: This Errata workaround requires bit 11 to be set in the CP15
diagnostic control register. This patch takes care of this errata fix for GP
devices at CPU init time and at the cpu_resume stage.

Signed-off-by: Ruchika Kharwar <ruchika@ti.com>
Signed-off-by: Sebastien Jan <s-jan@ti.com>
OMAP4: ERRATA: ARM: Fix ARM Errata 743622

Errata 743622: This Errata workaround requires bit 6 to be set in the CP15
diagnostic control register. This patch takes care of this errata fix for GP
devices at CPU init time and at the cpu_resume stage.

Signed-off-by: Ruchika Kharwar <ruchika@ti.com>
Signed-off-by: Sebastien Jan <s-jan@ti.com>
UBUNTU: Config Update ERRATA list for OMAP4 4430/4460

Signed-off-by: Xavier Boudet <x-boudet@ti.com>
dce: do not try to manipulate a NULL pointer

If no output buffer is passed (which can happen when calling
process when flushing), we do not pass any output buffer.
UBUNTU: version 3.4.0-1486.4

Signed-off-by: Xavier Boudet <x-boudet@ti.com>