dma-db5500.c 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /*
  2. * Copyright (C) ST-Ericsson SA 2010
  3. *
  4. * Author: Per Forlin <per.forlin@stericsson.com> for ST-Ericsson
  5. * Author: Jonas Aaberg <jonas.aberg@stericsson.com> for ST-Ericsson
  6. * Author: Rabin Vincent <rabinv.vincent@stericsson.com> for ST-Ericsson
  7. *
  8. * License terms: GNU General Public License (GPL), version 2
  9. */
  10. #include <linux/kernel.h>
  11. #include <linux/platform_device.h>
  12. #include <plat/ste_dma40.h>
  13. #include <mach/setup.h>
  14. #include <mach/hardware.h>
  15. #include "ste-dma40-db5500.h"
  16. static struct resource dma40_resources[] = {
  17. [0] = {
  18. .start = U5500_DMA_BASE,
  19. .end = U5500_DMA_BASE + SZ_4K - 1,
  20. .flags = IORESOURCE_MEM,
  21. .name = "base",
  22. },
  23. [1] = {
  24. .start = U5500_DMA_LCPA_BASE,
  25. .end = U5500_DMA_LCPA_BASE + 2 * SZ_1K - 1,
  26. .flags = IORESOURCE_MEM,
  27. .name = "lcpa",
  28. },
  29. [2] = {
  30. .start = IRQ_DB5500_DMA,
  31. .end = IRQ_DB5500_DMA,
  32. .flags = IORESOURCE_IRQ
  33. }
  34. };
  35. /* Default configuration for physical memcpy */
  36. static struct stedma40_chan_cfg dma40_memcpy_conf_phy = {
  37. .mode = STEDMA40_MODE_PHYSICAL,
  38. .dir = STEDMA40_MEM_TO_MEM,
  39. .src_info.data_width = STEDMA40_BYTE_WIDTH,
  40. .src_info.psize = STEDMA40_PSIZE_PHY_1,
  41. .src_info.flow_ctrl = STEDMA40_NO_FLOW_CTRL,
  42. .dst_info.data_width = STEDMA40_BYTE_WIDTH,
  43. .dst_info.psize = STEDMA40_PSIZE_PHY_1,
  44. .dst_info.flow_ctrl = STEDMA40_NO_FLOW_CTRL,
  45. };
  46. /* Default configuration for logical memcpy */
  47. static struct stedma40_chan_cfg dma40_memcpy_conf_log = {
  48. .dir = STEDMA40_MEM_TO_MEM,
  49. .src_info.data_width = STEDMA40_BYTE_WIDTH,
  50. .src_info.psize = STEDMA40_PSIZE_LOG_1,
  51. .src_info.flow_ctrl = STEDMA40_NO_FLOW_CTRL,
  52. .dst_info.data_width = STEDMA40_BYTE_WIDTH,
  53. .dst_info.psize = STEDMA40_PSIZE_LOG_1,
  54. .dst_info.flow_ctrl = STEDMA40_NO_FLOW_CTRL,
  55. };
  56. /*
  57. * Mapping between soruce event lines and physical device address This was
  58. * created assuming that the event line is tied to a device and therefore the
  59. * address is constant, however this is not true for at least USB, and the
  60. * values are just placeholders for USB. This table is preserved and used for
  61. * now.
  62. */
  63. static const dma_addr_t dma40_rx_map[DB5500_DMA_NR_DEV] = {
  64. [DB5500_DMA_DEV24_SDMMC0_RX] = -1,
  65. };
  66. /* Mapping between destination event lines and physical device address */
  67. static const dma_addr_t dma40_tx_map[DB5500_DMA_NR_DEV] = {
  68. [DB5500_DMA_DEV24_SDMMC0_TX] = -1,
  69. };
  70. static int dma40_memcpy_event[] = {
  71. DB5500_DMA_MEMCPY_TX_1,
  72. DB5500_DMA_MEMCPY_TX_2,
  73. DB5500_DMA_MEMCPY_TX_3,
  74. DB5500_DMA_MEMCPY_TX_4,
  75. DB5500_DMA_MEMCPY_TX_5,
  76. };
  77. static struct stedma40_platform_data dma40_plat_data = {
  78. .dev_len = ARRAY_SIZE(dma40_rx_map),
  79. .dev_rx = dma40_rx_map,
  80. .dev_tx = dma40_tx_map,
  81. .memcpy = dma40_memcpy_event,
  82. .memcpy_len = ARRAY_SIZE(dma40_memcpy_event),
  83. .memcpy_conf_phy = &dma40_memcpy_conf_phy,
  84. .memcpy_conf_log = &dma40_memcpy_conf_log,
  85. .disabled_channels = {-1},
  86. };
  87. static struct platform_device dma40_device = {
  88. .dev = {
  89. .platform_data = &dma40_plat_data,
  90. },
  91. .name = "dma40",
  92. .id = 0,
  93. .num_resources = ARRAY_SIZE(dma40_resources),
  94. .resource = dma40_resources
  95. };
  96. void __init db5500_dma_init(void)
  97. {
  98. int ret;
  99. ret = platform_device_register(&dma40_device);
  100. if (ret)
  101. dev_err(&dma40_device.dev, "unable to register device: %d\n", ret);
  102. }