mailbox: add documentation to core code and headers

The current mailbox code lacks any meaningful documentation,
making life hard for any new users to understand the API/usage.
Hopefully, this patch adds enough basic info for the developers.

This patch does not touch any code pieces, it is strictly limited
to documentation and code comments.

Signed-off-by: Suman Anna <s-anna@ti.com>
ARM: DRA7: clock: Fix the wrong ABE PLL lock frequency

The ABE PLL (used by ATL) was wrongly locked at twice the frequency.
Fix it and also set the dpll_abe_m2x2_ck rate explicitely so that we
have m2 set to 1.

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
ARM: OMAP4+: Init the target pwrdm state before the pwrdms are setup

Fix the wrong init of pwrdm target state which is done *after*
the pwrdms are setup. Do it instead *before* the pwrdm setup so
it has an affect.

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
iommu/omap: Remove unnecessary null pointer check

The pointer obj is dereferenced in line 146 and 149 respectively, so it is not
necessary to check null again in line 149 and 175. And I have checked that all
the callers of these two functions guarantee the parameter obj passed is not
null.

Signed-off-by: Cong Ding <dinggnu@gmail.com>
Acked-by: Ohad Ben-Cohen <ohad@wizery.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Joerg Roedel <joro@8bytes.org>
iommu/omap: fix checkpatch warnings in omap iommu code

This patch fixes the checkpatch warnings in omap iommu
code, most of them are related to broken strings.

Signed-off-by: Suman Anna <s-anna@ti.com>
gpu: ion: omap: re-populate flags parameters into buffer

Since the flags function param of omap_tiler_heap_allocate
is used to pass the omap_tiler_info struct, pass the
actual flags param from the client inside omap_tiler_info
struct and re-populate it into the buffer struct.

Change-Id: I06f3b6125c2760f7b4bcc7f174458139d80ec000
Signed-off-by: Sundar Raman <a0393242@ti.com>
gpu: ion: omap: Fix TILER secure heap base address

Access to ION TILER buffers were resulting in data aborts
because of incorrect heap base address initialization.
The omap_ion_heap_tiler_base variable was not being
initialized. With this patch the ION tests pass.

Change-Id: Ic072767a5b70b1eab37caf0a7fadb96f1da97b34
Signed-off-by: Sundar Raman <a0393242@ti.com>
gpu: ion: omap: add checks for carveout addresses and sizes

This patch adds sanity checks on the carveout and size parameters
read from the device tree file and returns error. It also checks
if the device tree is populated and returns error accordingly.

Change-Id: Ic1f4e9d7c5f7e9361d9fe922544f9dbc105d99c3
Signed-off-by: Sundar Raman <a0393242@ti.com>
gpu: ion: fix omap_ion_share_fd_to_buffers api

the output value from ion_share_dma_buf is a dma buf fd
buffers array was filled mistakenly as the code was ported
from k3.4 where the equivalent function ion_share used to
return pointer to ion_buffer. updated the code to upref
using ion_share_dma_buf() and get the handle to buffer using
ion_handle_buffer().

Change-Id: I3bb39f918a9dde8ee78ffa3adcab447589295fdf
Signed-off-by: Sundar Raman <a0393242@ti.com>
ARM: dts: DRA7/OMAP5: reserve carveout buffers & fix carveout size

Carveout buffers were initialized but not reserved for
DRA7. This patch adds the missing memreserves without
which there could be data corruption in highmem region.

In addition, the carveout size for TILER secure heap was programmed
wrongly to 96MB whereas it should have been 81 MB. This patch
fixes this and re-adjusts the carveout base addresses.

Change-Id: I151bd37f089aa7fbf590035ea4f612f1da12f53a
Signed-off-by: Sundar Raman <a0393242@ti.com>
gpu: ion: DRA7: ensure TILER 2d mappings are shared device

Write combined mappings are not supported for TILER 2D on DRA7
similar  to OMAP5 due to h/w issue. So, shared mappings should
be used. Added the check which was missing for DRA7.

Change-Id: I8ba9bd676f2942dd6a8bd5737bab8e25c8f1cbd3
Signed-off-by: Sundar Raman <a0393242@ti.com>
gpu: ion: add support for more cache operations

Enhance ion_sync_for_device to take in cache direction

Change-Id: I78bef9c2b5cc461b5f49c6019d031a15ce1a36de
Signed-off-by: Sundar Raman <a0393242@ti.com>
Merge branch 'ion' into p-ti-android-3.8.y-video

This contains the ION cleanup series and caching changes

* ion:
  gpu: ion: add support for more cache operations
  gpu: ion: DRA7: ensure TILER 2d mappings are shared device
  ARM: dts: DRA7/OMAP5: reserve carveout buffers & fix carveout size
  gpu: ion: fix omap_ion_share_fd_to_buffers api
  gpu: ion: omap: add checks for carveout addresses and sizes
  gpu: ion: omap: Fix TILER secure heap base address
  gpu: ion: omap: re-populate flags parameters into buffer

Signed-off-by: Sundar Raman <a0393242@ti.com>
Merge branch 'p-ti-android-3.8.y-video' of git://git.ti.com/android-sdk/kernel-video into p-ti-android-3.8.y

* 'p-ti-android-3.8.y-video' of git://git.ti.com/android-sdk/kernel-video:
  gpu: ion: add support for more cache operations
  gpu: ion: DRA7: ensure TILER 2d mappings are shared device
  ARM: dts: DRA7/OMAP5: reserve carveout buffers & fix carveout size
  gpu: ion: fix omap_ion_share_fd_to_buffers api
  gpu: ion: omap: add checks for carveout addresses and sizes
  gpu: ion: omap: Fix TILER secure heap base address
  gpu: ion: omap: re-populate flags parameters into buffer

Change-Id: I0985cd0eb7bb96cd5a9fbd20964ef24a8ee816d6
Signed-off-by: Vishal Mahaveer <vishalm@ti.com>
mailbox: remove unused function prototype

The internal function mailbox_init_seq is not defined
anywhere, so clean up its prototype declaration.

Signed-off-by: Suman Anna <s-anna@ti.com>
mailbox: remove mailbox_type_t from mailbox_ops

The mailbox_type_t is a legacy carry-over from the OMAP mailbox
code. It was primarily used to distinquish the hardware FIFO type
between OMAP1 & OMAP2+ SoCs. The type field serves no purpose in
the common mailbox ops, and has therefore been cleaned up.

The OMAP & DBX500 mailbox client drivers do have an internal type
field in their respective private mbox structures, and is used for
differentiating the mailbox types or register sets.

Signed-off-by: Suman Anna <s-anna@ti.com>
mailbox: introduce irq_flags per mailbox

Leave it to the individual driver implementation to decide the
irq_flags needed when requesting the irq.

Signed-off-by: Suman Anna <s-anna@ti.com>
ARM: OMAP2+: add user and fifo info to mailbox platform data

The different generations of OMAP2+ SoCs have almost the same
mailbox IP, but the IP has configurable parameters for number
of users (interrupts it can generate out towards processors)
and number of fifos (the base unidirectional h/w communication
channel). This data cannot be read from any registers, and so
has been added to the platform data.

This data together with the interrupt-type configuration can be
used in properly figuring out the number of registers to save
and restore in the OMAP mailbox driver code.

Signed-off-by: Suman Anna <s-anna@ti.com>
mailbox: add support for multiple instances

The current mailbox driver core is designed to have only one mailbox
h/w block in the system, but this is very unrealistic. Support has
been added for multiple instances of same or different mailbox h/w
blocks by adding a containing mailbox_device structure. The mailboxes
contained within a h/w block are associated with this mailbox device
structure. The mailbox drivers have to create this mailbox device object
and register their mailboxes with this device.

The design includes changing the mailbox_register/unregister functions
to allow the registration and deregistration of mailboxes using a
containing mailbox device object. Function ops are added per mailbox
device as well, to have flexibility in each individual mailbox device
implementations. The mailbox startup code is reconfigured to use both
the mailbox_device and mbox startup/shutdown ops accordingly.

While at it, modify the OMAP & DBX500 mailbox drivers to adapt to
these new API changes.

Signed-off-by: Suman Anna <s-anna@ti.com>
mailbox/omap: add support for parsing dt devices

Logic has been added to the OMAP2+ mailbox code to
parse the mailbox dt nodes and construct the different
mailboxes associated with the instance. The design is
based on gathering the same information that was being
passed previously through the platform data, except for
the interrupt type configuration information.

Signed-off-by: Suman Anna <s-anna@ti.com>