devices-db8500.c 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /*
  2. * Copyright (C) ST-Ericsson SA 2010
  3. *
  4. * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
  5. * License terms: GNU General Public License (GPL) version 2
  6. */
  7. #include <linux/kernel.h>
  8. #include <linux/platform_device.h>
  9. #include <linux/interrupt.h>
  10. #include <linux/io.h>
  11. #include <linux/gpio.h>
  12. #include <linux/amba/bus.h>
  13. #include <plat/ste_dma40.h>
  14. #include <mach/hardware.h>
  15. #include <mach/setup.h>
  16. #include "ste-dma40-db8500.h"
  17. static struct resource dma40_resources[] = {
  18. [0] = {
  19. .start = U8500_DMA_BASE,
  20. .end = U8500_DMA_BASE + SZ_4K - 1,
  21. .flags = IORESOURCE_MEM,
  22. .name = "base",
  23. },
  24. [1] = {
  25. .start = U8500_DMA_LCPA_BASE,
  26. .end = U8500_DMA_LCPA_BASE + 2 * SZ_1K - 1,
  27. .flags = IORESOURCE_MEM,
  28. .name = "lcpa",
  29. },
  30. [2] = {
  31. .start = IRQ_DB8500_DMA,
  32. .end = IRQ_DB8500_DMA,
  33. .flags = IORESOURCE_IRQ,
  34. }
  35. };
  36. /* Default configuration for physcial memcpy */
  37. struct stedma40_chan_cfg dma40_memcpy_conf_phy = {
  38. .mode = STEDMA40_MODE_PHYSICAL,
  39. .dir = STEDMA40_MEM_TO_MEM,
  40. .src_info.data_width = STEDMA40_BYTE_WIDTH,
  41. .src_info.psize = STEDMA40_PSIZE_PHY_1,
  42. .src_info.flow_ctrl = STEDMA40_NO_FLOW_CTRL,
  43. .dst_info.data_width = STEDMA40_BYTE_WIDTH,
  44. .dst_info.psize = STEDMA40_PSIZE_PHY_1,
  45. .dst_info.flow_ctrl = STEDMA40_NO_FLOW_CTRL,
  46. };
  47. /* Default configuration for logical memcpy */
  48. struct stedma40_chan_cfg dma40_memcpy_conf_log = {
  49. .dir = STEDMA40_MEM_TO_MEM,
  50. .src_info.data_width = STEDMA40_BYTE_WIDTH,
  51. .src_info.psize = STEDMA40_PSIZE_LOG_1,
  52. .src_info.flow_ctrl = STEDMA40_NO_FLOW_CTRL,
  53. .dst_info.data_width = STEDMA40_BYTE_WIDTH,
  54. .dst_info.psize = STEDMA40_PSIZE_LOG_1,
  55. .dst_info.flow_ctrl = STEDMA40_NO_FLOW_CTRL,
  56. };
  57. /*
  58. * Mapping between destination event lines and physical device address.
  59. * The event line is tied to a device and therefor the address is constant.
  60. */
  61. static const dma_addr_t dma40_tx_map[DB8500_DMA_NR_DEV];
  62. /* Mapping between source event lines and physical device address */
  63. static const dma_addr_t dma40_rx_map[DB8500_DMA_NR_DEV];
  64. /* Reserved event lines for memcpy only */
  65. static int dma40_memcpy_event[] = {
  66. DB8500_DMA_MEMCPY_TX_0,
  67. DB8500_DMA_MEMCPY_TX_1,
  68. DB8500_DMA_MEMCPY_TX_2,
  69. DB8500_DMA_MEMCPY_TX_3,
  70. DB8500_DMA_MEMCPY_TX_4,
  71. DB8500_DMA_MEMCPY_TX_5,
  72. };
  73. static struct stedma40_platform_data dma40_plat_data = {
  74. .dev_len = DB8500_DMA_NR_DEV,
  75. .dev_rx = dma40_rx_map,
  76. .dev_tx = dma40_tx_map,
  77. .memcpy = dma40_memcpy_event,
  78. .memcpy_len = ARRAY_SIZE(dma40_memcpy_event),
  79. .memcpy_conf_phy = &dma40_memcpy_conf_phy,
  80. .memcpy_conf_log = &dma40_memcpy_conf_log,
  81. .disabled_channels = {-1},
  82. };
  83. struct platform_device u8500_dma40_device = {
  84. .dev = {
  85. .platform_data = &dma40_plat_data,
  86. },
  87. .name = "dma40",
  88. .id = 0,
  89. .num_resources = ARRAY_SIZE(dma40_resources),
  90. .resource = dma40_resources
  91. };
  92. void dma40_u8500ed_fixup(void)
  93. {
  94. dma40_plat_data.memcpy = NULL;
  95. dma40_plat_data.memcpy_len = 0;
  96. dma40_resources[0].start = U8500_DMA_BASE_ED;
  97. dma40_resources[0].end = U8500_DMA_BASE_ED + SZ_4K - 1;
  98. dma40_resources[1].start = U8500_DMA_LCPA_BASE_ED;
  99. dma40_resources[1].end = U8500_DMA_LCPA_BASE_ED + 2 * SZ_1K - 1;
  100. }
  101. struct resource keypad_resources[] = {
  102. [0] = {
  103. .start = U8500_SKE_BASE,
  104. .end = U8500_SKE_BASE + SZ_4K - 1,
  105. .flags = IORESOURCE_MEM,
  106. },
  107. [1] = {
  108. .start = IRQ_DB8500_KB,
  109. .end = IRQ_DB8500_KB,
  110. .flags = IORESOURCE_IRQ,
  111. },
  112. };
  113. struct platform_device u8500_ske_keypad_device = {
  114. .name = "nmk-ske-keypad",
  115. .id = -1,
  116. .num_resources = ARRAY_SIZE(keypad_resources),
  117. .resource = keypad_resources,
  118. };