board-mop500-sdi.c 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  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. .f_max = 100000000,
  42. .capabilities = MMC_CAP_4_BIT_DATA |
  43. MMC_CAP_SD_HIGHSPEED |
  44. MMC_CAP_MMC_HIGHSPEED |
  45. MMC_CAP_ERASE |
  46. MMC_CAP_UHS_SDR12 |
  47. MMC_CAP_UHS_SDR25,
  48. .gpio_wp = -1,
  49. .sigdir = MCI_ST_FBCLKEN |
  50. MCI_ST_CMDDIREN |
  51. MCI_ST_DATA0DIREN |
  52. MCI_ST_DATA2DIREN,
  53. #ifdef CONFIG_STE_DMA40
  54. .dma_filter = stedma40_filter,
  55. .dma_rx_param = &mop500_sdi0_dma_cfg_rx,
  56. .dma_tx_param = &mop500_sdi0_dma_cfg_tx,
  57. #endif
  58. };
  59. static void sdi0_configure(struct device *parent)
  60. {
  61. /* Add the device, force v2 to subrevision 1 */
  62. db8500_add_sdi0(parent, &mop500_sdi0_data, U8500_SDI_V2_PERIPHID);
  63. }
  64. void mop500_sdi_tc35892_init(struct device *parent)
  65. {
  66. mop500_sdi0_data.gpio_cd = GPIO_SDMMC_CD;
  67. sdi0_configure(parent);
  68. }
  69. /*
  70. * SDI1 (SDIO WLAN)
  71. */
  72. #ifdef CONFIG_STE_DMA40
  73. static struct stedma40_chan_cfg sdi1_dma_cfg_rx = {
  74. .mode = STEDMA40_MODE_LOGICAL,
  75. .dir = DMA_DEV_TO_MEM,
  76. .dev_type = DB8500_DMA_DEV32_SD_MM1,
  77. };
  78. static struct stedma40_chan_cfg sdi1_dma_cfg_tx = {
  79. .mode = STEDMA40_MODE_LOGICAL,
  80. .dir = DMA_MEM_TO_DEV,
  81. .dev_type = DB8500_DMA_DEV32_SD_MM1,
  82. };
  83. #endif
  84. struct mmci_platform_data mop500_sdi1_data = {
  85. .ocr_mask = MMC_VDD_29_30,
  86. .f_max = 100000000,
  87. .capabilities = MMC_CAP_4_BIT_DATA |
  88. MMC_CAP_NONREMOVABLE,
  89. .gpio_cd = -1,
  90. .gpio_wp = -1,
  91. #ifdef CONFIG_STE_DMA40
  92. .dma_filter = stedma40_filter,
  93. .dma_rx_param = &sdi1_dma_cfg_rx,
  94. .dma_tx_param = &sdi1_dma_cfg_tx,
  95. #endif
  96. };
  97. /*
  98. * SDI 2 (POP eMMC, not on DB8500ed)
  99. */
  100. #ifdef CONFIG_STE_DMA40
  101. struct stedma40_chan_cfg mop500_sdi2_dma_cfg_rx = {
  102. .mode = STEDMA40_MODE_LOGICAL,
  103. .dir = DMA_DEV_TO_MEM,
  104. .dev_type = DB8500_DMA_DEV28_SD_MM2,
  105. };
  106. static struct stedma40_chan_cfg mop500_sdi2_dma_cfg_tx = {
  107. .mode = STEDMA40_MODE_LOGICAL,
  108. .dir = DMA_MEM_TO_DEV,
  109. .dev_type = DB8500_DMA_DEV28_SD_MM2,
  110. };
  111. #endif
  112. struct mmci_platform_data mop500_sdi2_data = {
  113. .ocr_mask = MMC_VDD_165_195,
  114. .f_max = 100000000,
  115. .capabilities = MMC_CAP_4_BIT_DATA |
  116. MMC_CAP_8_BIT_DATA |
  117. MMC_CAP_NONREMOVABLE |
  118. MMC_CAP_MMC_HIGHSPEED |
  119. MMC_CAP_ERASE |
  120. MMC_CAP_CMD23,
  121. .gpio_cd = -1,
  122. .gpio_wp = -1,
  123. #ifdef CONFIG_STE_DMA40
  124. .dma_filter = stedma40_filter,
  125. .dma_rx_param = &mop500_sdi2_dma_cfg_rx,
  126. .dma_tx_param = &mop500_sdi2_dma_cfg_tx,
  127. #endif
  128. };
  129. /*
  130. * SDI 4 (on-board eMMC)
  131. */
  132. #ifdef CONFIG_STE_DMA40
  133. struct stedma40_chan_cfg mop500_sdi4_dma_cfg_rx = {
  134. .mode = STEDMA40_MODE_LOGICAL,
  135. .dir = DMA_DEV_TO_MEM,
  136. .dev_type = DB8500_DMA_DEV42_SD_MM4,
  137. };
  138. static struct stedma40_chan_cfg mop500_sdi4_dma_cfg_tx = {
  139. .mode = STEDMA40_MODE_LOGICAL,
  140. .dir = DMA_MEM_TO_DEV,
  141. .dev_type = DB8500_DMA_DEV42_SD_MM4,
  142. };
  143. #endif
  144. struct mmci_platform_data mop500_sdi4_data = {
  145. .f_max = 100000000,
  146. .capabilities = MMC_CAP_4_BIT_DATA |
  147. MMC_CAP_8_BIT_DATA |
  148. MMC_CAP_NONREMOVABLE |
  149. MMC_CAP_MMC_HIGHSPEED |
  150. MMC_CAP_ERASE |
  151. MMC_CAP_CMD23,
  152. .gpio_cd = -1,
  153. .gpio_wp = -1,
  154. #ifdef CONFIG_STE_DMA40
  155. .dma_filter = stedma40_filter,
  156. .dma_rx_param = &mop500_sdi4_dma_cfg_rx,
  157. .dma_tx_param = &mop500_sdi4_dma_cfg_tx,
  158. #endif
  159. };
  160. void __init mop500_sdi_init(struct device *parent)
  161. {
  162. /* PoP:ed eMMC */
  163. db8500_add_sdi2(parent, &mop500_sdi2_data, U8500_SDI_V2_PERIPHID);
  164. /* On-board eMMC */
  165. db8500_add_sdi4(parent, &mop500_sdi4_data, U8500_SDI_V2_PERIPHID);
  166. /*
  167. * On boards with the TC35892 GPIO expander, sdi0 will finally
  168. * be added when the TC35892 initializes and calls
  169. * mop500_sdi_tc35892_init() above.
  170. */
  171. }
  172. void __init snowball_sdi_init(struct device *parent)
  173. {
  174. /* On Snowball MMC_CAP_SD_HIGHSPEED isn't supported (Hardware issue?) */
  175. mop500_sdi0_data.capabilities &= ~MMC_CAP_SD_HIGHSPEED;
  176. /* On-board eMMC */
  177. db8500_add_sdi4(parent, &mop500_sdi4_data, U8500_SDI_V2_PERIPHID);
  178. /* External Micro SD slot */
  179. mop500_sdi0_data.gpio_cd = SNOWBALL_SDMMC_CD_GPIO;
  180. mop500_sdi0_data.cd_invert = true;
  181. sdi0_configure(parent);
  182. }
  183. void __init hrefv60_sdi_init(struct device *parent)
  184. {
  185. /* PoP:ed eMMC */
  186. db8500_add_sdi2(parent, &mop500_sdi2_data, U8500_SDI_V2_PERIPHID);
  187. /* On-board eMMC */
  188. db8500_add_sdi4(parent, &mop500_sdi4_data, U8500_SDI_V2_PERIPHID);
  189. /* External Micro SD slot */
  190. mop500_sdi0_data.gpio_cd = HREFV60_SDMMC_CD_GPIO;
  191. sdi0_configure(parent);
  192. /* WLAN SDIO channel */
  193. db8500_add_sdi1(parent, &mop500_sdi1_data, U8500_SDI_V2_PERIPHID);
  194. }