ARM: dma-mapping: use dma_mmap_from_coherent()

Change-Id: Ibc4086c0f48272356187966fce416a57160fab76
[lauraa: context conflicts]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
Patch-mainline: v3.5
Git-commit: 47142f07eea32e9c108f548a4b06c28bec7df6e4

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
ARM: dma-mapping: use pr_* instread of printk

Replace all calls to printk with pr_* functions family.

Change-Id: Id03dee8797cd736529ede3ef525a930b90a04042
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Tested-By: Subash Patel <subash.ramaswamy@linaro.org>
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
Patch-mainline: v3.5
Git-commit: 6b6f770b573903f8a7d1cfab1fc662685653f413
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
arm: Fix compilation error with gcc 4.5.2

Fix warning with the LDM/STM instructions. The instructions dont
have a register offset so set the offset to 0.

Change-Id: I2c988373c88e280015faa43076139650747d7ff3
Acked-by: Kaushik Sikdar <ksikdar@qualcomm.com>
Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
mm: add HAVE_MEMBLOCK_NODE_MAP support

ARCH_POPULATES_NODE_MAP in 3.0 is replaced by HAVE_MEMBLOCK_NODE_MAP in
3.4.  add_active_range() is replaced with memblock_set_node().  They do
basically the same thing, but embedding nid field into memblock_region
is much cleaner than a separate early_node_map.

HAVE_MEMBLOCK_NODE_MAP is not selected by default.

See commit 4a2164a7dbf0d3b6a1c2ef6f20c0d54350491a12 for more info.

Change-Id: Icb44a8cea365b2d32df80628a57535a3d46fbd55
Signed-off-by: Junjie Wu <junjiew@codeaurora.org>
ARM: dma-mapping: introduce DMA_ERROR_CODE constant

Replace all uses of ~0 with DMA_ERROR_CODE, what should make the code
easier to read.

Change-Id: I6c0fff904d8df3a9d2a8a727e62faf000a55c1b5
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Tested-By: Subash Patel <subash.ramaswamy@linaro.org>
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
Patch-mainline: v3.5
Git-commit: 553ac78877242b6d8b591323731df304140d0f99
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
ARM: dma-mapping: remove offset parameter to prepare for generic dma_ops

This patch removes the need for the offset parameter in dma bounce
functions. This is required to let dma-mapping framework on ARM
architecture to use common, generic dma_map_ops based dma-mapping
helpers.

Background and more detailed explaination:

dma_*_range_* functions are available from the early days of the dma
mapping api. They are the correct way of doing a partial syncs on the
buffer (usually used by the network device drivers). This patch changes
only the internal implementation of the dma bounce functions to let
them tunnel through dma_map_ops structure. The driver api stays
unchanged, so driver are obliged to call dma_*_range_* functions to
keep code clean and easy to understand.

The only drawback from this patch is reduced detection of the dma api
abuse. Let us consider the following code:

dma_addr = dma_map_single(dev, ptr, 64, DMA_TO_DEVICE);
dma_sync_single_range_for_cpu(dev, dma_addr+16, 0, 32, DMA_TO_DEVICE);

Without the patch such code fails, because dma bounce code is unable
to find the bounce buffer for the given dma_address. After the patch
the above sync call will be equivalent to:

dma_sync_single_range_for_cpu(dev, dma_addr, 16, 32, DMA_TO_DEVICE);

which succeeds.

I don't consider this as a real problem, because DMA API abuse should be
caught by debug_dma_* function family. This patch lets us to simplify
the internal low-level implementation without chaning the driver visible
API.

Change-Id: I9a847e30f345bf5e69fded1747ff79057750fb66
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Tested-By: Subash Patel <subash.ramaswamy@linaro.org>
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
Patch-mainline: v3.5
Git-commit: 553ac78877242b6d8b591323731df304140d0f99
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
arm: highmem: Add support for flushing kmap_atomic mappings

The highmem code provides kmap_flush_unused to ensure all kmap
mappings are really removed if they are unused. This code does not
handle kmap_atomic mappings since they are managed separately.
This prevents an issue for any code which relies on having absolutely
no mappings for a particular page. Rather than pay the penalty of
having CONFIG_DEBUG_HIGHMEM on all the time, add functionality
to remove the kmap_atomic mappings in a similar way to kmap_flush_unused.

Change-Id: Ieb25da809b377b1fae1629e2cb75f8aebc1c1bca
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
arm: mm: Use phys_addr_t properly for ioremap functions

Several of the ioremap functions use unsigned long in places
resulting in truncation if physical addresses greater than
4G are passed in. Change the types appropriately.

Change-Id: I1f8fb6999d6dbc4ca84c14c8163a72c1dc341143
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>