G, Manjunath Kondaiah | 59de3cf | 2010-12-20 18:27:19 -0800 | [diff] [blame^] | 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 | |
| 35 | static 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 */ |
| 44 | static 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 | |
| 69 | static 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 | } |
| 74 | arch_initcall(omap2_system_dma_init); |