Merge remote-tracking branch 'spi/fix/core' into spi-linus
[linux-drm-fsl-dcu.git] / arch / arm / mach-ux500 / board-mop500-sdi.c
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
8 #include <linux/kernel.h>
9 #include <linux/gpio.h>
10 #include <linux/amba/bus.h>
11 #include <linux/amba/mmci.h>
12 #include <linux/mmc/host.h>
13 #include <linux/platform_device.h>
14 #include <linux/platform_data/dma-ste-dma40.h>
15
16 #include <asm/mach-types.h>
17 #include "devices.h"
18
19 #include "db8500-regs.h"
20 #include "devices-db8500.h"
21 #include "board-mop500.h"
22 #include "ste-dma40-db8500.h"
23
24 /*
25  * v2 has a new version of this block that need to be forced, the number found
26  * in hardware is incorrect
27  */
28 #define U8500_SDI_V2_PERIPHID 0x10480180
29
30 /*
31  * SDI 0 (MicroSD slot)
32  */
33
34 #ifdef CONFIG_STE_DMA40
35 struct stedma40_chan_cfg mop500_sdi0_dma_cfg_rx = {
36         .mode = STEDMA40_MODE_LOGICAL,
37         .dir = DMA_DEV_TO_MEM,
38         .dev_type = DB8500_DMA_DEV29_SD_MM0,
39 };
40
41 static struct stedma40_chan_cfg mop500_sdi0_dma_cfg_tx = {
42         .mode = STEDMA40_MODE_LOGICAL,
43         .dir = DMA_MEM_TO_DEV,
44         .dev_type = DB8500_DMA_DEV29_SD_MM0,
45 };
46 #endif
47
48 struct mmci_platform_data mop500_sdi0_data = {
49         .f_max          = 100000000,
50         .capabilities   = MMC_CAP_4_BIT_DATA |
51                                 MMC_CAP_SD_HIGHSPEED |
52                                 MMC_CAP_MMC_HIGHSPEED |
53                                 MMC_CAP_ERASE |
54                                 MMC_CAP_UHS_SDR12 |
55                                 MMC_CAP_UHS_SDR25,
56         .gpio_wp        = -1,
57         .sigdir         = MCI_ST_FBCLKEN |
58                                 MCI_ST_CMDDIREN |
59                                 MCI_ST_DATA0DIREN |
60                                 MCI_ST_DATA2DIREN,
61 #ifdef CONFIG_STE_DMA40
62         .dma_filter     = stedma40_filter,
63         .dma_rx_param   = &mop500_sdi0_dma_cfg_rx,
64         .dma_tx_param   = &mop500_sdi0_dma_cfg_tx,
65 #endif
66 };
67
68 /*
69  * SDI1 (SDIO WLAN)
70  */
71 #ifdef CONFIG_STE_DMA40
72 static struct stedma40_chan_cfg sdi1_dma_cfg_rx = {
73         .mode = STEDMA40_MODE_LOGICAL,
74         .dir = DMA_DEV_TO_MEM,
75         .dev_type = DB8500_DMA_DEV32_SD_MM1,
76 };
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
85 struct mmci_platform_data mop500_sdi1_data = {
86         .ocr_mask       = MMC_VDD_29_30,
87         .f_max          = 100000000,
88         .capabilities   = MMC_CAP_4_BIT_DATA |
89                                 MMC_CAP_NONREMOVABLE,
90         .gpio_cd        = -1,
91         .gpio_wp        = -1,
92 #ifdef CONFIG_STE_DMA40
93         .dma_filter     = stedma40_filter,
94         .dma_rx_param   = &sdi1_dma_cfg_rx,
95         .dma_tx_param   = &sdi1_dma_cfg_tx,
96 #endif
97 };
98
99 /*
100  * SDI 2 (POP eMMC, not on DB8500ed)
101  */
102
103 #ifdef CONFIG_STE_DMA40
104 struct stedma40_chan_cfg mop500_sdi2_dma_cfg_rx = {
105         .mode = STEDMA40_MODE_LOGICAL,
106         .dir = DMA_DEV_TO_MEM,
107         .dev_type =  DB8500_DMA_DEV28_SD_MM2,
108 };
109
110 static struct stedma40_chan_cfg mop500_sdi2_dma_cfg_tx = {
111         .mode = STEDMA40_MODE_LOGICAL,
112         .dir = DMA_MEM_TO_DEV,
113         .dev_type = DB8500_DMA_DEV28_SD_MM2,
114 };
115 #endif
116
117 struct mmci_platform_data mop500_sdi2_data = {
118         .ocr_mask       = MMC_VDD_165_195,
119         .f_max          = 100000000,
120         .capabilities   = MMC_CAP_4_BIT_DATA |
121                                 MMC_CAP_8_BIT_DATA |
122                                 MMC_CAP_NONREMOVABLE |
123                                 MMC_CAP_MMC_HIGHSPEED |
124                                 MMC_CAP_ERASE |
125                                 MMC_CAP_CMD23,
126         .gpio_cd        = -1,
127         .gpio_wp        = -1,
128 #ifdef CONFIG_STE_DMA40
129         .dma_filter     = stedma40_filter,
130         .dma_rx_param   = &mop500_sdi2_dma_cfg_rx,
131         .dma_tx_param   = &mop500_sdi2_dma_cfg_tx,
132 #endif
133 };
134
135 /*
136  * SDI 4 (on-board eMMC)
137  */
138
139 #ifdef CONFIG_STE_DMA40
140 struct stedma40_chan_cfg mop500_sdi4_dma_cfg_rx = {
141         .mode = STEDMA40_MODE_LOGICAL,
142         .dir = DMA_DEV_TO_MEM,
143         .dev_type =  DB8500_DMA_DEV42_SD_MM4,
144 };
145
146 static struct stedma40_chan_cfg mop500_sdi4_dma_cfg_tx = {
147         .mode = STEDMA40_MODE_LOGICAL,
148         .dir = DMA_MEM_TO_DEV,
149         .dev_type = DB8500_DMA_DEV42_SD_MM4,
150 };
151 #endif
152
153 struct mmci_platform_data mop500_sdi4_data = {
154         .f_max          = 100000000,
155         .capabilities   = MMC_CAP_4_BIT_DATA |
156                                 MMC_CAP_8_BIT_DATA |
157                                 MMC_CAP_NONREMOVABLE |
158                                 MMC_CAP_MMC_HIGHSPEED |
159                                 MMC_CAP_ERASE |
160                                 MMC_CAP_CMD23,
161         .gpio_cd        = -1,
162         .gpio_wp        = -1,
163 #ifdef CONFIG_STE_DMA40
164         .dma_filter     = stedma40_filter,
165         .dma_rx_param   = &mop500_sdi4_dma_cfg_rx,
166         .dma_tx_param   = &mop500_sdi4_dma_cfg_tx,
167 #endif
168 };