platform-dma.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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/err.h>
  10. #include <linux/init.h>
  11. #include <mach/mx23.h>
  12. #include <mach/mx28.h>
  13. #include <mach/devices-common.h>
  14. static struct platform_device *__init mxs_add_dma(const char *devid,
  15. resource_size_t base)
  16. {
  17. struct resource res[] = {
  18. {
  19. .start = base,
  20. .end = base + SZ_8K - 1,
  21. .flags = IORESOURCE_MEM,
  22. }
  23. };
  24. return mxs_add_platform_device_dmamask(devid, -1,
  25. res, ARRAY_SIZE(res), NULL, 0,
  26. DMA_BIT_MASK(32));
  27. }
  28. static int __init mxs_add_mxs_dma(void)
  29. {
  30. char *apbh = "mxs-dma-apbh";
  31. char *apbx = "mxs-dma-apbx";
  32. if (cpu_is_mx23()) {
  33. mxs_add_dma(apbh, MX23_APBH_DMA_BASE_ADDR);
  34. mxs_add_dma(apbx, MX23_APBX_DMA_BASE_ADDR);
  35. }
  36. if (cpu_is_mx28()) {
  37. mxs_add_dma(apbh, MX28_APBH_DMA_BASE_ADDR);
  38. mxs_add_dma(apbx, MX28_APBX_DMA_BASE_ADDR);
  39. }
  40. return 0;
  41. }
  42. arch_initcall(mxs_add_mxs_dma);