9
0
Fork 0

ARM: move DMA alloc functions to dma.h

This better separates the DMA from the MMU functionality.

Also move all drivers that only depends on asm/mmu.h for the alloc
functions over to the common header.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Lucas Stach 2015-03-05 22:50:01 +01:00 committed by Sascha Hauer
parent a0c4e2203f
commit 381f034ed6
32 changed files with 52 additions and 38 deletions

View File

@ -5,4 +5,27 @@
*
*/
#include <asm/mmu.h>
#include <common.h>
#define dma_alloc dma_alloc
static inline void *dma_alloc(size_t size)
{
return xmemalign(64, ALIGN(size, 64));
}
#ifndef CONFIG_MMU
static inline void *dma_alloc_coherent(size_t size, dma_addr_t *dma_handle)
{
void *ret = xmemalign(4096, size);
if (dma_handle)
*dma_handle = (dma_addr_t)ret;
return ret;
}
static inline void dma_free_coherent(void *mem, dma_addr_t dma_handle,
size_t size)
{
free(mem);
}
#endif

View File

@ -11,8 +11,6 @@
#define PMD_SECT_DEF_UNCACHED (PMD_SECT_AP_WRITE | PMD_SECT_AP_READ | PMD_TYPE_SECT)
#define PMD_SECT_DEF_CACHED (PMD_SECT_WB | PMD_SECT_DEF_UNCACHED)
#define DMA_ADDRESS_BROKEN NULL
struct arm_memory;
static inline void mmu_enable(void)
@ -28,16 +26,7 @@ static inline void setup_dma_coherent(unsigned long offset)
{
}
#define dma_alloc dma_alloc
static inline void *dma_alloc(size_t size)
{
return xmemalign(64, ALIGN(size, 64));
}
#ifdef CONFIG_MMU
void *dma_alloc_coherent(size_t size, dma_addr_t *dma_handle);
void dma_free_coherent(void *mem, dma_addr_t dma_handle, size_t size);
void dma_clean_range(unsigned long, unsigned long);
void dma_flush_range(unsigned long, unsigned long);
void dma_inv_range(unsigned long, unsigned long);
@ -47,21 +36,6 @@ uint32_t mmu_get_pte_cached_flags(void);
uint32_t mmu_get_pte_uncached_flags(void);
#else
static inline void *dma_alloc_coherent(size_t size, dma_addr_t *dma_handle)
{
void *ret = xmemalign(4096, size);
if (dma_handle)
*dma_handle = (dma_addr_t)ret;
return ret;
}
static inline void dma_free_coherent(void *mem, dma_addr_t dma_handle,
size_t size)
{
free(mem);
}
static inline void dma_clean_range(unsigned long s, unsigned long e)
{
}

View File

@ -21,6 +21,7 @@
*/
#include <common.h>
#include <dma.h>
#include <init.h>
#include <errno.h>
#include <io.h>

View File

@ -20,13 +20,13 @@
#include <linux/list.h>
#include <linux/err.h>
#include <common.h>
#include <dma.h>
#include <driver.h>
#include <malloc.h>
#include <errno.h>
#include <init.h>
#include <io.h>
#include <asm/mmu.h>
#define HW_APBHX_CTRL0 0x000
#define BM_APBH_CTRL0_APB_BURST8_EN (1 << 29)

View File

@ -18,6 +18,7 @@
*/
#include <common.h>
#include <dma.h>
#include <driver.h>
#include <malloc.h>
#include <clock.h>

View File

@ -26,6 +26,7 @@
#include <linux/err.h>
#include <of_mtd.h>
#include <common.h>
#include <dma.h>
#include <malloc.h>
#include <errno.h>
#include <driver.h>
@ -33,7 +34,6 @@
#include <io.h>
#include <dma/apbh-dma.h>
#include <stmp-device.h>
#include <asm/mmu.h>
#include <mach/generic.h>
#define MX28_BLOCK_SFTRST (1 << 31)

View File

@ -21,6 +21,7 @@
*/
#include <common.h>
#include <dma.h>
#include <net.h>
#include <init.h>
#include <clock.h>

View File

@ -19,6 +19,7 @@
#include <asm/mmu.h>
#include <clock.h>
#include <common.h>
#include <dma.h>
#include <net.h>
#include <io.h>
#include <init.h>

View File

@ -20,6 +20,7 @@
*/
#include <common.h>
#include <dma.h>
#include <net.h>
#include <clock.h>
#include <malloc.h>

View File

@ -22,6 +22,7 @@
*/
#include <common.h>
#include <dma.h>
#include <init.h>
#include <io.h>
#include <net.h>

View File

@ -15,6 +15,7 @@
*/
#include <common.h>
#include <dma.h>
#include <malloc.h>
#include <net.h>
#include <init.h>

View File

@ -38,6 +38,7 @@
#include <net.h>
#include <clock.h>
#include <dma.h>
#include <malloc.h>
#include <xfuncs.h>
#include <init.h>

View File

@ -24,6 +24,7 @@
*/
#include <common.h>
#include <dma.h>
#include <init.h>
#include <io.h>
#include <net.h>

View File

@ -27,6 +27,7 @@
* MA 02110-1301 USA
*/
#include <common.h>
#include <dma.h>
#include <init.h>
#include <io.h>
#include <net.h>

View File

@ -1,4 +1,5 @@
#include <common.h>
#include <dma.h>
#include <net.h>
#include <malloc.h>
#include <init.h>

View File

@ -16,6 +16,7 @@
#include <asm/mmu.h>
#include <common.h>
#include <dma.h>
#include <init.h>
#include <net.h>
#include <malloc.h>

View File

@ -16,6 +16,7 @@
*/
#include <common.h>
#include <dma.h>
#include <net.h>
#include <clock.h>
#include <malloc.h>

View File

@ -23,7 +23,6 @@
#include <stmp-device.h>
#include <linux/clk.h>
#include <linux/err.h>
#include <asm/mmu.h>
#include <mach/generic.h>
#include <mach/clock.h>
#include <mach/ssp.h>

View File

@ -1,4 +1,5 @@
#include <common.h>
#include <dma.h>
#include <errno.h>
#include <dma.h>
#include <init.h>
@ -10,6 +11,8 @@
#include <asm/byteorder.h>
#include <linux/err.h>
#include <asm/mmu.h>
/* ### define USB registers here
*/
#define USB_MAX_CTRL_PAYLOAD 64

View File

@ -18,6 +18,7 @@
*/
/*#define DEBUG */
#include <common.h>
#include <dma.h>
#include <asm/byteorder.h>
#include <usb/usb.h>
#include <io.h>

View File

@ -41,6 +41,7 @@
* to activate workaround for bug #41 or this driver will NOT work!
*/
#include <common.h>
#include <dma.h>
#include <clock.h>
#include <malloc.h>
#include <usb/usb.h>

View File

@ -12,9 +12,9 @@
* warranty of any kind, whether express or implied.
*/
//#define DEBUG
#include <asm/mmu.h>
#include <clock.h>
#include <common.h>
#include <dma.h>
#include <init.h>
#include <io.h>
#include <linux/err.h>

View File

@ -14,7 +14,6 @@
* warranty of any kind, whether express or implied.
*/
//#define DEBUG
#include <asm/mmu.h>
#include <clock.h>
#include <common.h>
#include <io.h>

View File

@ -27,7 +27,6 @@
#include <mach/io.h>
#include <mach/cpu.h>
#include <errno.h>
#include <asm/mmu.h>
#include "atmel_lcdfb.h"

View File

@ -25,7 +25,6 @@
#include <mach/io.h>
#include <mach/cpu.h>
#include <errno.h>
#include <asm/mmu.h>
#include <linux/clk.h>
#include "atmel_lcdfb.h"

View File

@ -19,11 +19,11 @@
*/
#include <common.h>
#include <dma.h>
#include <io.h>
#include <linux/err.h>
#include <linux/clk.h>
#include <malloc.h>
#include <asm/mmu.h>
#include "atmel_lcdfb.h"

View File

@ -18,6 +18,7 @@
*/
#include <common.h>
#include <dma.h>
#include <init.h>
#include <io.h>
#include <mach/imx35-regs.h>

View File

@ -19,7 +19,6 @@
#include <clock.h>
#include <driver.h>
#include <init.h>
#include <asm/mmu.h>
#include <mach/generic.h>
#include <mach/imx6-regs.h>
#include <mach/imx53-regs.h>

View File

@ -12,6 +12,7 @@
#define pr_fmt(fmt) "IPU: " fmt
#include <common.h>
#include <dma.h>
#include <fb.h>
#include <io.h>
#include <driver.h>
@ -21,7 +22,6 @@
#include <linux/clk.h>
#include <linux/err.h>
#include <asm-generic/div64.h>
#include <asm/mmu.h>
#include "imx-ipu-v3.h"
#include "ipuv3-plane.h"

View File

@ -19,6 +19,7 @@
*/
#include <driver.h>
#include <dma.h>
#include <fb.h>
#include <errno.h>
#include <xfuncs.h>

View File

@ -24,6 +24,7 @@
*/
#include <common.h>
#include <dma.h>
#include <driver.h>
#include <errno.h>
#include <fb.h>
@ -37,7 +38,6 @@
#include <mach/pxafb.h>
#include <asm/io.h>
#include <asm/mmu.h>
#include <asm-generic/div64.h>
/* PXA LCD DMA descriptor */

View File

@ -14,6 +14,8 @@
#include <dma-dir.h>
#include <asm/dma.h>
#define DMA_ADDRESS_BROKEN NULL
#ifndef dma_alloc
static inline void *dma_alloc(size_t size)
{