aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/dma.c
diff options
context:
space:
mode:
authorG, Manjunath Kondaiah <manjugk@ti.com>2010-12-20 21:27:19 -0500
committerTony Lindgren <tony@atomide.com>2010-12-20 21:38:30 -0500
commit59de3cf1ce9a961ba9ab657707727db2111e72fa (patch)
tree417039340f3564e4b82f35e096f4371d4378d573 /arch/arm/mach-omap2/dma.c
parent6568f7c43a72f9631910e26092ef3ecf67cc99eb (diff)
OMAP2+: DMA: hwmod: Device registration
Prepare OMAP2+ DMA to use hwmod infrastructure so that DMA can register as platform device. Signed-off-by: G, Manjunath Kondaiah <manjugk@ti.com> Tested-by: Kevin Hilman <khilman@deeprootsystems.com> Acked-by: Kevin Hilman <khilman@deeprootsystems.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2/dma.c')
-rw-r--r--arch/arm/mach-omap2/dma.c74
1 files changed, 74 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/dma.c b/arch/arm/mach-omap2/dma.c
new file mode 100644
index 000000000000..2130059e98cb
--- /dev/null
+++ b/arch/arm/mach-omap2/dma.c
@@ -0,0 +1,74 @@
1/*
2 * OMAP2+ DMA driver
3 *
4 * Copyright (C) 2003 - 2008 Nokia Corporation
5 * Author: Juha Yrjölä <juha.yrjola@nokia.com>
6 * DMA channel linking for 1610 by Samuel Ortiz <samuel.ortiz@nokia.com>
7 * Graphics DMA and LCD DMA graphics tranformations
8 * by Imre Deak <imre.deak@nokia.com>
9 * OMAP2/3 support Copyright (C) 2004-2007 Texas Instruments, Inc.
10 * Some functions based on earlier dma-omap.c Copyright (C) 2001 RidgeRun, Inc.
11 *
12 * Copyright (C) 2009 Texas Instruments
13 * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com>
14 *
15 * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
16 * Converted DMA library into platform driver
17 * - G, Manjunath Kondaiah <manjugk@ti.com>
18 *
19 * This program is free software; you can redistribute it and/or modify
20 * it under the terms of the GNU General Public License version 2 as
21 * published by the Free Software Foundation.
22 */
23
24#include <linux/err.h>
25#include <linux/io.h>
26#include <linux/slab.h>
27#include <linux/module.h>
28#include <linux/init.h>
29#include <linux/device.h>
30
31#include <plat/omap_hwmod.h>
32#include <plat/omap_device.h>
33#include <plat/dma.h>
34
35static struct omap_device_pm_latency omap2_dma_latency[] = {
36 {
37 .deactivate_func = omap_device_idle_hwmods,
38 .activate_func = omap_device_enable_hwmods,
39 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
40 },
41};
42
43/* One time initializations */
44static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
45{
46 struct omap_device *od;
47 struct omap_system_dma_plat_info *p;
48 char *name = "omap_dma_system";
49
50 p = kzalloc(sizeof(struct omap_system_dma_plat_info), GFP_KERNEL);
51 if (!p) {
52 pr_err("%s: Unable to allocate pdata for %s:%s\n",
53 __func__, name, oh->name);
54 return -ENOMEM;
55 }
56
57 od = omap_device_build(name, 0, oh, p, sizeof(*p),
58 omap2_dma_latency, ARRAY_SIZE(omap2_dma_latency), 0);
59 kfree(p);
60 if (IS_ERR(od)) {
61 pr_err("%s: Cant build omap_device for %s:%s.\n",
62 __func__, name, oh->name);
63 return IS_ERR(od);
64 }
65
66 return 0;
67}
68
69static int __init omap2_system_dma_init(void)
70{
71 return omap_hwmod_for_each_by_class("dma",
72 omap2_system_dma_init_dev, NULL);
73}
74arch_initcall(omap2_system_dma_init);