dma.c 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. #include <linux/err.h>
  24. #include <linux/io.h>
  25. #include <linux/slab.h>
  26. #include <linux/module.h>
  27. #include <linux/init.h>
  28. #include <linux/device.h>
  29. #include <plat/omap_hwmod.h>
  30. #include <plat/omap_device.h>
  31. #include <plat/dma.h>
  32. static struct omap_device_pm_latency omap2_dma_latency[] = {
  33. {
  34. .deactivate_func = omap_device_idle_hwmods,
  35. .activate_func = omap_device_enable_hwmods,
  36. .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
  37. },
  38. };
  39. /* One time initializations */
  40. static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
  41. {
  42. struct omap_device *od;
  43. struct omap_system_dma_plat_info *p;
  44. char *name = "omap_dma_system";
  45. p = kzalloc(sizeof(struct omap_system_dma_plat_info), GFP_KERNEL);
  46. if (!p) {
  47. pr_err("%s: Unable to allocate pdata for %s:%s\n",
  48. __func__, name, oh->name);
  49. return -ENOMEM;
  50. }
  51. od = omap_device_build(name, 0, oh, p, sizeof(*p),
  52. omap2_dma_latency, ARRAY_SIZE(omap2_dma_latency), 0);
  53. kfree(p);
  54. if (IS_ERR(od)) {
  55. pr_err("%s: Cant build omap_device for %s:%s.\n",
  56. __func__, name, oh->name);
  57. return IS_ERR(od);
  58. }
  59. return 0;
  60. }
  61. static int __init omap2_system_dma_init(void)
  62. {
  63. return omap_hwmod_for_each_by_class("dma",
  64. omap2_system_dma_init_dev, NULL);
  65. }
  66. arch_initcall(omap2_system_dma_init);