1 /*
2  * Copyright (C) ST-Ericsson SA 2010
3  *
4  * Author: Hanumath Prasad <ulf.hansson@stericsson.com>
5  * License terms: GNU General Public License (GPL) version 2
6  */
7 
8 #include <linux/amba/mmci.h>
9 #include <linux/mmc/host.h>
10 
11 #include <plat/pincfg.h>
12 #include <plat/gpio-nomadik.h>
13 #include <mach/db5500-regs.h>
14 #include <plat/ste_dma40.h>
15 
16 #include "pins-db5500.h"
17 #include "devices-db5500.h"
18 #include "ste-dma40-db5500.h"
19 
20 static pin_cfg_t u5500_sdi_pins[] = {
21 	/* SDI0 (POP eMMC) */
22 	GPIO5_MC0_DAT0		| PIN_DIR_INPUT | PIN_PULL_UP,
23 	GPIO6_MC0_DAT1		| PIN_DIR_INPUT | PIN_PULL_UP,
24 	GPIO7_MC0_DAT2		| PIN_DIR_INPUT | PIN_PULL_UP,
25 	GPIO8_MC0_DAT3		| PIN_DIR_INPUT | PIN_PULL_UP,
26 	GPIO9_MC0_DAT4		| PIN_DIR_INPUT | PIN_PULL_UP,
27 	GPIO10_MC0_DAT5		| PIN_DIR_INPUT | PIN_PULL_UP,
28 	GPIO11_MC0_DAT6		| PIN_DIR_INPUT | PIN_PULL_UP,
29 	GPIO12_MC0_DAT7		| PIN_DIR_INPUT | PIN_PULL_UP,
30 	GPIO13_MC0_CMD		| PIN_DIR_INPUT | PIN_PULL_UP,
31 	GPIO14_MC0_CLK		| PIN_DIR_OUTPUT | PIN_VAL_LOW,
32 };
33 
34 #ifdef CONFIG_STE_DMA40
35 struct stedma40_chan_cfg u5500_sdi0_dma_cfg_rx = {
36 	.mode = STEDMA40_MODE_LOGICAL,
37 	.dir = STEDMA40_PERIPH_TO_MEM,
38 	.src_dev_type = DB5500_DMA_DEV24_SDMMC0_RX,
39 	.dst_dev_type = STEDMA40_DEV_DST_MEMORY,
40 	.src_info.data_width = STEDMA40_WORD_WIDTH,
41 	.dst_info.data_width = STEDMA40_WORD_WIDTH,
42 };
43 
44 static struct stedma40_chan_cfg u5500_sdi0_dma_cfg_tx = {
45 	.mode = STEDMA40_MODE_LOGICAL,
46 	.dir = STEDMA40_MEM_TO_PERIPH,
47 	.src_dev_type = STEDMA40_DEV_SRC_MEMORY,
48 	.dst_dev_type = DB5500_DMA_DEV24_SDMMC0_TX,
49 	.src_info.data_width = STEDMA40_WORD_WIDTH,
50 	.dst_info.data_width = STEDMA40_WORD_WIDTH,
51 };
52 #endif
53 
54 static struct mmci_platform_data u5500_sdi0_data = {
55 	.ocr_mask	= MMC_VDD_165_195,
56 	.f_max		= 50000000,
57 	.capabilities	= MMC_CAP_4_BIT_DATA |
58 				MMC_CAP_8_BIT_DATA |
59 				MMC_CAP_MMC_HIGHSPEED,
60 	.gpio_cd	= -1,
61 	.gpio_wp	= -1,
62 #ifdef CONFIG_STE_DMA40
63 	.dma_filter	= stedma40_filter,
64 	.dma_rx_param	= &u5500_sdi0_dma_cfg_rx,
65 	.dma_tx_param	= &u5500_sdi0_dma_cfg_tx,
66 #endif
67 };
68 
u5500_sdi_init(void)69 void __init u5500_sdi_init(void)
70 {
71 	nmk_config_pins(u5500_sdi_pins, ARRAY_SIZE(u5500_sdi_pins));
72 
73 	db5500_add_sdi0(&u5500_sdi0_data);
74 }
75