ion: convert system heap to alloc_page()

vmalloc() allocates pages and maps them into kernel space.  If nobody
requires the area to be mapped in kernel space, this uses potentially
valuable VM address space.  Split into separate allocation and mapping
of pages.

Change-Id: I98411b93edea67c2068e20b5e48708fb38a4cd1f
Signed-off-by: David Schleef <ds@ti.com>
ion: add support for tiler reservation heap

The tiler reservation heap is for allocating TILER address space, but
not the underlying pages.  The idea is to allocate TILER address space
and one or more ION buffers from the system heap, and map system heap
buffers into the allocated TILER address space.

Change-Id: Ibd53ab811259cabec87384cf2ab4f99c0cbdca23
Signed-off-by: David Schleef <ds@ti.com>

Conflicts:
	drivers/gpu/ion/omap/omap_tiler_heap.c
ion: fix comment to match reality

Change-Id: Ib722e6c34965bf48ca5bdaaef3b4741146cc1508
Signed-off-by: David Schleef <ds@ti.com>
omap: Add ION system heap to omap board file

gives ion clients access to system heap for allocation
instead of being restricted to pre-allocated carveouts

Change-Id: I560e7b8cda1b561d737b9c5bc427b5cbf2591731
Signed-off-by: David Schleef <ds@ti.com>
omap: Add TILER reservation ION heap to omap4 board file

registration gives ion clients access to tiler reservation heap

The tiler reservation heap is for allocating TILER address space, but
not the underlying pages.  The idea is to allocate TILER address space
and one or more ION buffers from the system heap, and map system heap
buffers into the allocated TILER address space.

Signed-off-by: David Schleef <ds@ti.com>
Change-Id: I3eb8125d604106185c37f75d61cbbd9f2ef175a1
rpmsg: omx: fix copy_to_user in register/unregister ioctls

The ION fd registration and deregistration ioctls has the
arguments reversed in the copy_to_user() calls. The same
has been fixed.

Also included a minor additional case for returning a NULL
ION handle back to user-space.

Change-Id: I9d45957f9b913fa1775e70618f0da82e914a41d6
Signed-off-by: Tyler Luu <tluu@ti.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
rpmsg: omx: send disconnect only if omx state is connected

The rpmsg_omx driver sends a disconnect message automatically when the
driver's .release is called. This should be done only if a connection
has been established, otherwise just destroy the local end point.

Change-Id: I21b84aa6d91ae0d456f49cbe958f8e64caf691d5
Signed-off-by: Miguel Vadillo <vadillo@ti.com>
rpmsg: omx: initialize completion event in rpmsg_omx_open

An omx object is created when opening the rpmsg-omx device. However
the "reply_arrived" completion event is not initialized until the
connection message is sent across.

When the rpmsg_omx driver is removed (like in recovery), all pending
threads waiting on the "reply_arrived" are unblocked by a complete_all
call, however, if the rpmsg-omx device was only opened, such event is
not initialized yet, so the complete_all call will dereference a null
object causing a panic.

This patch moves the initialization of the "reply_arrived" completion
event to the open call, after the allocation of the omx object.

Change-Id: I92cf9cf5ac748456cb43bedc88fe1a8d80addd6c
Signed-off-by: Juan Gutierrez <jgutierrez@ti.com>
OMAP: TILER: validate input width and height

Add validation of input width and height to ensure that it does
not exceed maximum pixel width and height for the specific format.

Validate maximum length for 1D allocations.

Change-Id: I64b00f93a312ae715a040da28a0b0fe663afa9d8
Signed-off-by: Andy Gross <andy.gross@ti.com>
gpu: ion: check for input arguments in ion_free

ion_free is a public API and is directly dereferencing a
pointer without checking for NULL. A check has been
added for the same and throws a WARN in case of invalid
arguments.

Change-Id: Idcf72e4449f8cba2b8342d6fb0f64600c2c59c7e
Signed-off-by: Suman Anna <s-anna@ti.com>
ion: omap: change behaviour of getting buffers from pvr fd

previous implemention shares the pvr ion client and the ion
handles associated with that client for a particular pvr fd.
now, we just call ion_share on the handles and return the
shared buffers. caller is in charge of calling ion_import using
its own ion client to get the ion handles.

Change-Id: I2abdee1daed7b5c57c66b2e5fddc4eb0d0cc1305
Signed-off-by: Tyler Luu <tluu@ti.com>
Add a generic OMAP Remote Procedure Call Driver

Change-Id: I7c54eb41f62c104c7a1d0f525e1fd85450441cd3
Signed-off-by: Erik Rainey <erik.rainey@ti.com>
Signed-off-by: Alberto Aguirre <a-aguirre@ti.com>
omaprpc: ion: adapt to omap ion api change

api to retrieve ion handles from a pvr fd has changed from
omap_ion_fd_to_handles to omap_ion_share_fd_to_buffers.
after calling omap_ion_share_fd_to_buffers, we are also
expected to do an ion_import of the returned buffers.

Change-Id: I8a2da70ee1cd2caa63fc5d4c2b765d70418e72ea
Signed-off-by: Tyler Luu <tluu@ti.com>
OMAP4: OMAPDSS: Request higher bandwidth for 1080p FB

Request higher L3 bandwidth when we have 1080p, or higher,
resolution framebuffer. This is done to avoid underflow on
DSS pipelines.

Change-Id: Ieca56ae8bc9ec6147ab9301c267c29279a9399ca
Signed-off-by: Dandawate Saket <dsaket@ti.com>
Signed-off-by: Peter Nordström <nordstrom@ti.com>
OMAP4: DVFS: Fix scaling dependent frequencies.

When scaling dependent frequencies down it is observed that the order
in which frequencies are changed is incorrect.  For example, when core
domain changes OPP down from OPP119 to OPP50 the order is:
a) scale L3 freq down to OPP50
b) scale SGX freq down to OPP50
which is wrong.

Frequencies are scaled in order devices are registered in omap dvfs
framework in device list. Devices are inserted to the list in order,
such as dependences are satisfied if scaling frequencies up.

When scaling frequencies down traverse list backwards.

Change-Id: I752bcb264cac12514f358986a906f29ee81ba75e
Signed-off-by: Oleksandr Kozaruk <oleksandr.kozaruk@ti.com>
OMAP4470: OPP: Add initial BB2D OPP definitions

Add new 4470 OPP definitions for 2D graphics accelerator subsystem

Change-Id: I8e41b788df4769ed2ffab496f8a2ea4fc8cb5b1f
Signed-off-by: Taras Kondratiuk <taras@ti.com>
Signed-off-by: Eugen Mandrenko <ievgen.mandrenko@ti.com>
usb: musb: implement (un)map_urb_for_dma hooks

MUSB controller cannot work in DMA mode with misaligned buffers,
switching in PIO mode.

HCD core has hooks that allow to override the default DMA
mapping and unmapping routines for host controllers that have
special DMA requirements, such as alignment contraints.

It is observed that work in PIO mode is slow and it's better
to align buffers properly before pass them to MUSB

Some ideas taken from ehci-tegra.c

Change-Id: Id6eeaa811063d408f121c79012aba921f26eb582
Signed-off-by: Ruslan Bilovol <ruslan.bilovol@ti.com>
usb: hcd: Add a dma_align flag

Some host controllers has special DMA requirements,
such as alignment contraints.
Added a flag dma_align for indicating this requirement

Change-Id: I06277ade030429a832e6db38cc695128a1033f08
Signed-off-by: Ruslan Bilovol <ruslan.bilovol@ti.com>
usbnet: dma alignment fix

Allow usb ethernet driver to be used with a controller
driver that does not support DMA to adresses not aligned
to a 4-byte boundary

Change-Id: I017163921792c888c1cffff2531de55ef7bdb7f3
Signed-off-by: Ruslan Bilovol <ruslan.bilovol@ti.com>

Conflicts:
	drivers/net/usb/usbnet.c
usb: musb: indicate DMA alignment requirement

The MUSB host controller requires DMA buffers to be aligned.
If DMA buffers are misaligned it will use (un)map_urb_for_dma
for re-aligning buffers.
This often happens with USB network adapters, where skbuff
alignment is often in the middle of a 4-byte dword.
Indicate host controller DMA alignment requirement for such cases

Change-Id: I8a03f392caff762e9b48b65d31a119fdd833ae69
Signed-off-by: Ruslan Bilovol <ruslan.bilovol@ti.com>