board-mop500-sdi.c 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. /*
  2. * Copyright (C) ST-Ericsson SA 2010
  3. *
  4. * Author: Hanumath Prasad <hanumath.prasad@stericsson.com>
  5. * License terms: GNU General Public License (GPL) version 2
  6. */
  7. #include <linux/kernel.h>
  8. #include <linux/gpio.h>
  9. #include <linux/amba/bus.h>
  10. #include <linux/amba/mmci.h>
  11. #include <linux/mmc/host.h>
  12. #include <linux/platform_device.h>
  13. #include <linux/platform_data/dma-ste-dma40.h>
  14. #include <asm/mach-types.h>
  15. #include "devices.h"
  16. #include "db8500-regs.h"
  17. #include "devices-db8500.h"
  18. #include "board-mop500.h"
  19. #include "ste-dma40-db8500.h"
  20. /*
  21. * v2 has a new version of this block that need to be forced, the number found
  22. * in hardware is incorrect
  23. */
  24. #define U8500_SDI_V2_PERIPHID 0x10480180
  25. /*
  26. * SDI 0 (MicroSD slot)
  27. */
  28. #ifdef CONFIG_STE_DMA40
  29. struct stedma40_chan_cfg mop500_sdi0_dma_cfg_rx = {
  30. .mode = STEDMA40_MODE_LOGICAL,
  31. .dir = DMA_DEV_TO_MEM,
  32. .dev_type = DB8500_DMA_DEV29_SD_MM0,
  33. };
  34. static struct stedma40_chan_cfg mop500_sdi0_dma_cfg_tx = {
  35. .mode = STEDMA40_MODE_LOGICAL,
  36. .dir = DMA_MEM_TO_DEV,
  37. .dev_type = DB8500_DMA_DEV29_SD_MM0,
  38. };
  39. #endif
  40. struct mmci_platform_data mop500_sdi0_data = {
  41. .ocr_mask = MMC_VDD_29_30,
  42. .f_max = 50000000,
  43. .capabilities = MMC_CAP_4_BIT_DATA |
  44. MMC_CAP_SD_HIGHSPEED |
  45. MMC_CAP_MMC_HIGHSPEED,
  46. .gpio_wp = -1,
  47. .sigdir = MCI_ST_FBCLKEN |
  48. MCI_ST_CMDDIREN |
  49. MCI_ST_DATA0DIREN |
  50. MCI_ST_DATA2DIREN,
  51. #ifdef CONFIG_STE_DMA40
  52. .dma_filter = stedma40_filter,
  53. .dma_rx_param = &mop500_sdi0_dma_cfg_rx,
  54. .dma_tx_param = &mop500_sdi0_dma_cfg_tx,
  55. #endif
  56. };
  57. static void sdi0_configure(struct device *parent)
  58. {
  59. /* Add the device, force v2 to subrevision 1 */
  60. db8500_add_sdi0(parent, &mop500_sdi0_data, U8500_SDI_V2_PERIPHID);
  61. }
  62. void mop500_sdi_tc35892_init(struct device *parent)
  63. {
  64. mop500_sdi0_data.gpio_cd = GPIO_SDMMC_CD;
  65. sdi0_configure(parent);
  66. }
  67. /*
  68. * SDI1 (SDIO WLAN)
  69. */
  70. #ifdef CONFIG_STE_DMA40
  71. static struct stedma40_chan_cfg sdi1_dma_cfg_rx = {
  72. .mode = STEDMA40_MODE_LOGICAL,
  73. .dir = DMA_DEV_TO_MEM,
  74. .dev_type = DB8500_DMA_DEV32_SD_MM1,
  75. };
  76. static struct stedma40_chan_cfg sdi1_dma_cfg_tx = {
  77. .mode = STEDMA40_MODE_LOGICAL,
  78. .dir = DMA_MEM_TO_DEV,
  79. .dev_type = DB8500_DMA_DEV32_SD_MM1,
  80. };
  81. #endif
  82. struct mmci_platform_data mop500_sdi1_data = {
  83. .ocr_mask = MMC_VDD_29_30,
  84. .f_max = 50000000,
  85. .capabilities = MMC_CAP_4_BIT_DATA,
  86. .gpio_cd = -1,
  87. .gpio_wp = -1,
  88. #ifdef CONFIG_STE_DMA40
  89. .dma_filter = stedma40_filter,
  90. .dma_rx_param = &sdi1_dma_cfg_rx,
  91. .dma_tx_param = &sdi1_dma_cfg_tx,
  92. #endif
  93. };
  94. /*
  95. * SDI 2 (POP eMMC, not on DB8500ed)
  96. */
  97. #ifdef CONFIG_STE_DMA40
  98. struct stedma40_chan_cfg mop500_sdi2_dma_cfg_rx = {
  99. .mode = STEDMA40_MODE_LOGICAL,
  100. .dir = DMA_DEV_TO_MEM,
  101. .dev_type = DB8500_DMA_DEV28_SD_MM2,
  102. };
  103. static struct stedma40_chan_cfg mop500_sdi2_dma_cfg_tx = {
  104. .mode = STEDMA40_MODE_LOGICAL,
  105. .dir = DMA_MEM_TO_DEV,
  106. .dev_type = DB8500_DMA_DEV28_SD_MM2,
  107. };
  108. #endif
  109. struct mmci_platform_data mop500_sdi2_data = {
  110. .ocr_mask = MMC_VDD_165_195,
  111. .f_max = 50000000,
  112. .capabilities = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA |
  113. MMC_CAP_MMC_HIGHSPEED,
  114. .gpio_cd = -1,
  115. .gpio_wp = -1,
  116. #ifdef CONFIG_STE_DMA40
  117. .dma_filter = stedma40_filter,
  118. .dma_rx_param = &mop500_sdi2_dma_cfg_rx,
  119. .dma_tx_param = &mop500_sdi2_dma_cfg_tx,
  120. #endif
  121. };
  122. /*
  123. * SDI 4 (on-board eMMC)
  124. */
  125. #ifdef CONFIG_STE_DMA40
  126. struct stedma40_chan_cfg mop500_sdi4_dma_cfg_rx = {
  127. .mode = STEDMA40_MODE_LOGICAL,
  128. .dir = DMA_DEV_TO_MEM,
  129. .dev_type = DB8500_DMA_DEV42_SD_MM4,
  130. };
  131. static struct stedma40_chan_cfg mop500_sdi4_dma_cfg_tx = {
  132. .mode = STEDMA40_MODE_LOGICAL,
  133. .dir = DMA_MEM_TO_DEV,
  134. .dev_type = DB8500_DMA_DEV42_SD_MM4,
  135. };
  136. #endif
  137. struct mmci_platform_data mop500_sdi4_data = {
  138. .ocr_mask = MMC_VDD_29_30,
  139. .f_max = 50000000,
  140. .capabilities = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA |
  141. MMC_CAP_MMC_HIGHSPEED,
  142. .gpio_cd = -1,
  143. .gpio_wp = -1,
  144. #ifdef CONFIG_STE_DMA40
  145. .dma_filter = stedma40_filter,
  146. .dma_rx_param = &mop500_sdi4_dma_cfg_rx,
  147. .dma_tx_param = &mop500_sdi4_dma_cfg_tx,
  148. #endif
  149. };
  150. void __init mop500_sdi_init(struct device *parent)
  151. {
  152. /* PoP:ed eMMC */
  153. db8500_add_sdi2(parent, &mop500_sdi2_data, U8500_SDI_V2_PERIPHID);
  154. /* On-board eMMC */
  155. db8500_add_sdi4(parent, &mop500_sdi4_data, U8500_SDI_V2_PERIPHID);
  156. /*
  157. * On boards with the TC35892 GPIO expander, sdi0 will finally
  158. * be added when the TC35892 initializes and calls
  159. * mop500_sdi_tc35892_init() above.
  160. */
  161. }
  162. void __init snowball_sdi_init(struct device *parent)
  163. {
  164. /* On Snowball MMC_CAP_SD_HIGHSPEED isn't supported (Hardware issue?) */
  165. mop500_sdi0_data.capabilities &= ~MMC_CAP_SD_HIGHSPEED;
  166. /* On-board eMMC */
  167. db8500_add_sdi4(parent, &mop500_sdi4_data, U8500_SDI_V2_PERIPHID);
  168. /* External Micro SD slot */
  169. mop500_sdi0_data.gpio_cd = SNOWBALL_SDMMC_CD_GPIO;
  170. mop500_sdi0_data.cd_invert = true;
  171. sdi0_configure(parent);
  172. }
  173. void __init hrefv60_sdi_init(struct device *parent)
  174. {
  175. /* PoP:ed eMMC */
  176. db8500_add_sdi2(parent, &mop500_sdi2_data, U8500_SDI_V2_PERIPHID);
  177. /* On-board eMMC */
  178. db8500_add_sdi4(parent, &mop500_sdi4_data, U8500_SDI_V2_PERIPHID);
  179. /* External Micro SD slot */
  180. mop500_sdi0_data.gpio_cd = HREFV60_SDMMC_CD_GPIO;
  181. sdi0_configure(parent);
  182. /* WLAN SDIO channel */
  183. db8500_add_sdi1(parent, &mop500_sdi1_data, U8500_SDI_V2_PERIPHID);
  184. }