blob: 26600a1c53190ad3ae3724456a17dd7b8a35009d [file] [log] [blame]
Hanumath Prasad008f8a22010-08-19 12:06:32 +01001/*
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>
Linus Walleij865fab62012-10-18 14:20:16 +020014#include <linux/platform_data/dma-ste-dma40.h>
Hanumath Prasad008f8a22010-08-19 12:06:32 +010015
Linus Walleij4b4f7572011-02-15 15:01:35 +010016#include <asm/mach-types.h>
Arnd Bergmanne657bcf2013-03-21 22:51:12 +010017#include "devices.h"
Hanumath Prasad008f8a22010-08-19 12:06:32 +010018
Linus Walleij174e7792013-03-19 15:41:55 +010019#include "db8500-regs.h"
Rabin Vincentfbf1ead2010-09-29 19:46:32 +053020#include "devices-db8500.h"
Hanumath Prasad008f8a22010-08-19 12:06:32 +010021#include "board-mop500.h"
Linus Walleij5d7b8462010-10-14 13:57:59 +020022#include "ste-dma40-db8500.h"
Hanumath Prasad008f8a22010-08-19 12:06:32 +010023
Hanumath Prasad008f8a22010-08-19 12:06:32 +010024/*
Linus Walleijc15def12011-12-15 13:38:40 +010025 * 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/*
Rabin Vincentb8410a12010-08-09 19:18:17 +053031 * SDI 0 (MicroSD slot)
32 */
33
Linus Walleij5d7b8462010-10-14 13:57:59 +020034#ifdef CONFIG_STE_DMA40
35struct stedma40_chan_cfg mop500_sdi0_dma_cfg_rx = {
36 .mode = STEDMA40_MODE_LOGICAL,
Lee Jones98b68ab2013-05-15 10:51:53 +010037 .dir = DMA_DEV_TO_MEM,
Lee Jones26955c07d2013-05-03 15:31:56 +010038 .dev_type = DB8500_DMA_DEV29_SD_MM0,
Linus Walleij5d7b8462010-10-14 13:57:59 +020039};
40
41static struct stedma40_chan_cfg mop500_sdi0_dma_cfg_tx = {
42 .mode = STEDMA40_MODE_LOGICAL,
Lee Jones98b68ab2013-05-15 10:51:53 +010043 .dir = DMA_MEM_TO_DEV,
Lee Jones26955c07d2013-05-03 15:31:56 +010044 .dev_type = DB8500_DMA_DEV29_SD_MM0,
Linus Walleij5d7b8462010-10-14 13:57:59 +020045};
46#endif
47
Lee Jones5e1ac7d2012-05-29 14:40:04 +080048struct mmci_platform_data mop500_sdi0_data = {
Ulf Hanssonb6ff56a2013-05-23 15:13:45 +020049 .f_max = 100000000,
Linus Walleij02a73432011-03-30 16:00:39 +020050 .capabilities = MMC_CAP_4_BIT_DATA |
51 MMC_CAP_SD_HIGHSPEED |
Ulf Hanssonfd1cc1b2013-05-23 15:13:48 +020052 MMC_CAP_MMC_HIGHSPEED |
Ulf Hansson714c0b02013-05-23 15:13:50 +020053 MMC_CAP_ERASE |
54 MMC_CAP_UHS_SDR12 |
55 MMC_CAP_UHS_SDR25,
Rabin Vincentb8410a12010-08-09 19:18:17 +053056 .gpio_wp = -1,
Ulf Hanssonbc521812011-12-13 16:57:55 +010057 .sigdir = MCI_ST_FBCLKEN |
58 MCI_ST_CMDDIREN |
59 MCI_ST_DATA0DIREN |
60 MCI_ST_DATA2DIREN,
Linus Walleij5d7b8462010-10-14 13:57:59 +020061#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
Rabin Vincentb8410a12010-08-09 19:18:17 +053066};
67
Rabin Vincentb8410a12010-08-09 19:18:17 +053068/*
Stefan Nilsson XK76d67172011-10-26 10:50:42 +020069 * SDI1 (SDIO WLAN)
70 */
71#ifdef CONFIG_STE_DMA40
72static struct stedma40_chan_cfg sdi1_dma_cfg_rx = {
73 .mode = STEDMA40_MODE_LOGICAL,
Lee Jones98b68ab2013-05-15 10:51:53 +010074 .dir = DMA_DEV_TO_MEM,
Lee Jones26955c07d2013-05-03 15:31:56 +010075 .dev_type = DB8500_DMA_DEV32_SD_MM1,
Stefan Nilsson XK76d67172011-10-26 10:50:42 +020076};
77
78static struct stedma40_chan_cfg sdi1_dma_cfg_tx = {
79 .mode = STEDMA40_MODE_LOGICAL,
Lee Jones98b68ab2013-05-15 10:51:53 +010080 .dir = DMA_MEM_TO_DEV,
Lee Jones26955c07d2013-05-03 15:31:56 +010081 .dev_type = DB8500_DMA_DEV32_SD_MM1,
Stefan Nilsson XK76d67172011-10-26 10:50:42 +020082};
83#endif
84
Lee Jones9cf24b12012-08-30 16:11:08 +010085struct mmci_platform_data mop500_sdi1_data = {
Stefan Nilsson XK76d67172011-10-26 10:50:42 +020086 .ocr_mask = MMC_VDD_29_30,
Ulf Hanssonb6ff56a2013-05-23 15:13:45 +020087 .f_max = 100000000,
Ulf Hanssona7de8b302013-05-23 15:13:49 +020088 .capabilities = MMC_CAP_4_BIT_DATA |
89 MMC_CAP_NONREMOVABLE,
Stefan Nilsson XK76d67172011-10-26 10:50:42 +020090 .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/*
Hanumath Prasad008f8a22010-08-19 12:06:32 +0100100 * SDI 2 (POP eMMC, not on DB8500ed)
101 */
102
Linus Walleij5d7b8462010-10-14 13:57:59 +0200103#ifdef CONFIG_STE_DMA40
104struct stedma40_chan_cfg mop500_sdi2_dma_cfg_rx = {
105 .mode = STEDMA40_MODE_LOGICAL,
Lee Jones98b68ab2013-05-15 10:51:53 +0100106 .dir = DMA_DEV_TO_MEM,
Lee Jones26955c07d2013-05-03 15:31:56 +0100107 .dev_type = DB8500_DMA_DEV28_SD_MM2,
Linus Walleij5d7b8462010-10-14 13:57:59 +0200108};
109
110static struct stedma40_chan_cfg mop500_sdi2_dma_cfg_tx = {
111 .mode = STEDMA40_MODE_LOGICAL,
Lee Jones98b68ab2013-05-15 10:51:53 +0100112 .dir = DMA_MEM_TO_DEV,
Lee Jones26955c07d2013-05-03 15:31:56 +0100113 .dev_type = DB8500_DMA_DEV28_SD_MM2,
Linus Walleij5d7b8462010-10-14 13:57:59 +0200114};
115#endif
116
Lee Jones9cf24b12012-08-30 16:11:08 +0100117struct mmci_platform_data mop500_sdi2_data = {
Hanumath Prasad008f8a22010-08-19 12:06:32 +0100118 .ocr_mask = MMC_VDD_165_195,
Ulf Hanssonb6ff56a2013-05-23 15:13:45 +0200119 .f_max = 100000000,
Ulf Hanssona2be7762013-05-23 15:13:47 +0200120 .capabilities = MMC_CAP_4_BIT_DATA |
121 MMC_CAP_8_BIT_DATA |
Ulf Hanssona7de8b302013-05-23 15:13:49 +0200122 MMC_CAP_NONREMOVABLE |
Ulf Hanssona2be7762013-05-23 15:13:47 +0200123 MMC_CAP_MMC_HIGHSPEED |
Ulf Hanssonfd1cc1b2013-05-23 15:13:48 +0200124 MMC_CAP_ERASE |
Ulf Hanssona2be7762013-05-23 15:13:47 +0200125 MMC_CAP_CMD23,
Hanumath Prasad008f8a22010-08-19 12:06:32 +0100126 .gpio_cd = -1,
127 .gpio_wp = -1,
Linus Walleij5d7b8462010-10-14 13:57:59 +0200128#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
Hanumath Prasad008f8a22010-08-19 12:06:32 +0100133};
134
135/*
136 * SDI 4 (on-board eMMC)
137 */
138
Linus Walleij5d7b8462010-10-14 13:57:59 +0200139#ifdef CONFIG_STE_DMA40
140struct stedma40_chan_cfg mop500_sdi4_dma_cfg_rx = {
141 .mode = STEDMA40_MODE_LOGICAL,
Lee Jones98b68ab2013-05-15 10:51:53 +0100142 .dir = DMA_DEV_TO_MEM,
Lee Jones26955c07d2013-05-03 15:31:56 +0100143 .dev_type = DB8500_DMA_DEV42_SD_MM4,
Linus Walleij5d7b8462010-10-14 13:57:59 +0200144};
145
146static struct stedma40_chan_cfg mop500_sdi4_dma_cfg_tx = {
147 .mode = STEDMA40_MODE_LOGICAL,
Lee Jones98b68ab2013-05-15 10:51:53 +0100148 .dir = DMA_MEM_TO_DEV,
Lee Jones26955c07d2013-05-03 15:31:56 +0100149 .dev_type = DB8500_DMA_DEV42_SD_MM4,
Linus Walleij5d7b8462010-10-14 13:57:59 +0200150};
151#endif
152
Lee Jones5e1ac7d2012-05-29 14:40:04 +0800153struct mmci_platform_data mop500_sdi4_data = {
Ulf Hanssonb6ff56a2013-05-23 15:13:45 +0200154 .f_max = 100000000,
Ulf Hanssona2be7762013-05-23 15:13:47 +0200155 .capabilities = MMC_CAP_4_BIT_DATA |
156 MMC_CAP_8_BIT_DATA |
Ulf Hanssona7de8b302013-05-23 15:13:49 +0200157 MMC_CAP_NONREMOVABLE |
Ulf Hanssona2be7762013-05-23 15:13:47 +0200158 MMC_CAP_MMC_HIGHSPEED |
Ulf Hanssonfd1cc1b2013-05-23 15:13:48 +0200159 MMC_CAP_ERASE |
Ulf Hanssona2be7762013-05-23 15:13:47 +0200160 MMC_CAP_CMD23,
Hanumath Prasad008f8a22010-08-19 12:06:32 +0100161 .gpio_cd = -1,
162 .gpio_wp = -1,
Linus Walleij5d7b8462010-10-14 13:57:59 +0200163#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
Hanumath Prasad008f8a22010-08-19 12:06:32 +0100168};