platform-dma.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or modify it under
  5. * the terms of the GNU General Public License version 2 as published by the
  6. * Free Software Foundation.
  7. */
  8. #include <linux/compiler.h>
  9. #include <linux/dma-mapping.h>
  10. #include <linux/err.h>
  11. #include <linux/init.h>
  12. #include <mach/mx23.h>
  13. #include <mach/mx28.h>
  14. #include <mach/devices-common.h>
  15. static struct platform_device *__init mxs_add_dma(const char *devid,
  16. resource_size_t base)
  17. {
  18. struct resource res[] = {
  19. {
  20. .start = base,
  21. .end = base + SZ_8K - 1,
  22. .flags = IORESOURCE_MEM,
  23. }
  24. };
  25. return mxs_add_platform_device_dmamask(devid, -1,
  26. res, ARRAY_SIZE(res), NULL, 0,
  27. DMA_BIT_MASK(32));
  28. }
  29. static int __init mxs_add_mxs_dma(void)
  30. {
  31. char *mx23_apbh = "imx23-dma-apbh";
  32. char *mx23_apbx = "imx23-dma-apbx";
  33. char *mx28_apbh = "imx28-dma-apbh";
  34. char *mx28_apbx = "imx28-dma-apbx";
  35. if (cpu_is_mx23()) {
  36. mxs_add_dma(mx23_apbh, MX23_APBH_DMA_BASE_ADDR);
  37. mxs_add_dma(mx23_apbx, MX23_APBX_DMA_BASE_ADDR);
  38. }
  39. if (cpu_is_mx28()) {
  40. mxs_add_dma(mx28_apbh, MX28_APBH_DMA_BASE_ADDR);
  41. mxs_add_dma(mx28_apbx, MX28_APBX_DMA_BASE_ADDR);
  42. }
  43. return 0;
  44. }
  45. arch_initcall(mxs_add_mxs_dma);