2010-08-19 11:06:32 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) ST-Ericsson SA 2010
|
|
|
|
*
|
|
|
|
* Author: Hanumath Prasad <hanumath.prasad@stericsson.com>
|
|
|
|
* License terms: GNU General Public License (GPL) version 2
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/gpio.h>
|
|
|
|
#include <linux/amba/bus.h>
|
|
|
|
#include <linux/amba/mmci.h>
|
|
|
|
#include <linux/mmc/host.h>
|
|
|
|
#include <linux/platform_device.h>
|
|
|
|
|
2010-10-14 11:57:59 +00:00
|
|
|
#include <plat/ste_dma40.h>
|
2010-08-19 11:06:32 +00:00
|
|
|
#include <mach/devices.h>
|
|
|
|
#include <mach/hardware.h>
|
|
|
|
|
2010-09-29 14:16:32 +00:00
|
|
|
#include "devices-db8500.h"
|
2010-08-19 11:06:32 +00:00
|
|
|
#include "board-mop500.h"
|
2010-10-14 11:57:59 +00:00
|
|
|
#include "ste-dma40-db8500.h"
|
2010-08-19 11:06:32 +00:00
|
|
|
|
2010-08-09 13:48:17 +00:00
|
|
|
/*
|
|
|
|
* SDI 0 (MicroSD slot)
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* MMCIPOWER bits */
|
|
|
|
#define MCI_DATA2DIREN (1 << 2)
|
|
|
|
#define MCI_CMDDIREN (1 << 3)
|
|
|
|
#define MCI_DATA0DIREN (1 << 4)
|
|
|
|
#define MCI_DATA31DIREN (1 << 5)
|
|
|
|
#define MCI_FBCLKEN (1 << 7)
|
|
|
|
|
|
|
|
static u32 mop500_sdi0_vdd_handler(struct device *dev, unsigned int vdd,
|
|
|
|
unsigned char power_mode)
|
|
|
|
{
|
|
|
|
if (power_mode == MMC_POWER_UP)
|
2010-09-09 20:29:34 +00:00
|
|
|
gpio_set_value_cansleep(GPIO_SDMMC_EN, 1);
|
2010-08-09 13:48:17 +00:00
|
|
|
else if (power_mode == MMC_POWER_OFF)
|
2010-09-09 20:29:34 +00:00
|
|
|
gpio_set_value_cansleep(GPIO_SDMMC_EN, 0);
|
2010-08-09 13:48:17 +00:00
|
|
|
|
|
|
|
return MCI_FBCLKEN | MCI_CMDDIREN | MCI_DATA0DIREN |
|
|
|
|
MCI_DATA2DIREN | MCI_DATA31DIREN;
|
|
|
|
}
|
|
|
|
|
2010-10-14 11:57:59 +00:00
|
|
|
#ifdef CONFIG_STE_DMA40
|
|
|
|
struct stedma40_chan_cfg mop500_sdi0_dma_cfg_rx = {
|
|
|
|
.mode = STEDMA40_MODE_LOGICAL,
|
|
|
|
.dir = STEDMA40_PERIPH_TO_MEM,
|
|
|
|
.src_dev_type = DB8500_DMA_DEV29_SD_MM0_RX,
|
|
|
|
.dst_dev_type = STEDMA40_DEV_DST_MEMORY,
|
|
|
|
.src_info.data_width = STEDMA40_WORD_WIDTH,
|
|
|
|
.dst_info.data_width = STEDMA40_WORD_WIDTH,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct stedma40_chan_cfg mop500_sdi0_dma_cfg_tx = {
|
|
|
|
.mode = STEDMA40_MODE_LOGICAL,
|
|
|
|
.dir = STEDMA40_MEM_TO_PERIPH,
|
|
|
|
.src_dev_type = STEDMA40_DEV_SRC_MEMORY,
|
|
|
|
.dst_dev_type = DB8500_DMA_DEV29_SD_MM0_TX,
|
|
|
|
.src_info.data_width = STEDMA40_WORD_WIDTH,
|
|
|
|
.dst_info.data_width = STEDMA40_WORD_WIDTH,
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2010-08-09 13:48:17 +00:00
|
|
|
static struct mmci_platform_data mop500_sdi0_data = {
|
|
|
|
.vdd_handler = mop500_sdi0_vdd_handler,
|
|
|
|
.ocr_mask = MMC_VDD_29_30,
|
|
|
|
.f_max = 100000000,
|
|
|
|
.capabilities = MMC_CAP_4_BIT_DATA,
|
|
|
|
.gpio_cd = GPIO_SDMMC_CD,
|
|
|
|
.gpio_wp = -1,
|
2010-10-14 11:57:59 +00:00
|
|
|
#ifdef CONFIG_STE_DMA40
|
|
|
|
.dma_filter = stedma40_filter,
|
|
|
|
.dma_rx_param = &mop500_sdi0_dma_cfg_rx,
|
|
|
|
.dma_tx_param = &mop500_sdi0_dma_cfg_tx,
|
|
|
|
#endif
|
2010-08-09 13:48:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
void mop500_sdi_tc35892_init(void)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = gpio_request(GPIO_SDMMC_EN, "SDMMC_EN");
|
|
|
|
if (!ret)
|
|
|
|
ret = gpio_request(GPIO_SDMMC_1V8_3V_SEL,
|
|
|
|
"GPIO_SDMMC_1V8_3V_SEL");
|
|
|
|
if (ret)
|
|
|
|
return;
|
|
|
|
|
2011-01-27 13:35:37 +00:00
|
|
|
gpio_direction_output(GPIO_SDMMC_1V8_3V_SEL, 0);
|
|
|
|
gpio_direction_output(GPIO_SDMMC_EN, 1);
|
2010-08-09 13:48:17 +00:00
|
|
|
|
2010-09-29 14:16:32 +00:00
|
|
|
db8500_add_sdi0(&mop500_sdi0_data);
|
2010-08-09 13:48:17 +00:00
|
|
|
}
|
|
|
|
|
2010-08-19 11:06:32 +00:00
|
|
|
/*
|
|
|
|
* SDI 2 (POP eMMC, not on DB8500ed)
|
|
|
|
*/
|
|
|
|
|
2010-10-14 11:57:59 +00:00
|
|
|
#ifdef CONFIG_STE_DMA40
|
|
|
|
struct stedma40_chan_cfg mop500_sdi2_dma_cfg_rx = {
|
|
|
|
.mode = STEDMA40_MODE_LOGICAL,
|
|
|
|
.dir = STEDMA40_PERIPH_TO_MEM,
|
|
|
|
.src_dev_type = DB8500_DMA_DEV28_SD_MM2_RX,
|
|
|
|
.dst_dev_type = STEDMA40_DEV_DST_MEMORY,
|
|
|
|
.src_info.data_width = STEDMA40_WORD_WIDTH,
|
|
|
|
.dst_info.data_width = STEDMA40_WORD_WIDTH,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct stedma40_chan_cfg mop500_sdi2_dma_cfg_tx = {
|
|
|
|
.mode = STEDMA40_MODE_LOGICAL,
|
|
|
|
.dir = STEDMA40_MEM_TO_PERIPH,
|
|
|
|
.src_dev_type = STEDMA40_DEV_SRC_MEMORY,
|
|
|
|
.dst_dev_type = DB8500_DMA_DEV28_SD_MM2_TX,
|
|
|
|
.src_info.data_width = STEDMA40_WORD_WIDTH,
|
|
|
|
.dst_info.data_width = STEDMA40_WORD_WIDTH,
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2010-08-19 11:06:32 +00:00
|
|
|
static struct mmci_platform_data mop500_sdi2_data = {
|
|
|
|
.ocr_mask = MMC_VDD_165_195,
|
|
|
|
.f_max = 100000000,
|
|
|
|
.capabilities = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
|
|
|
|
.gpio_cd = -1,
|
|
|
|
.gpio_wp = -1,
|
2010-10-14 11:57:59 +00:00
|
|
|
#ifdef CONFIG_STE_DMA40
|
|
|
|
.dma_filter = stedma40_filter,
|
|
|
|
.dma_rx_param = &mop500_sdi2_dma_cfg_rx,
|
|
|
|
.dma_tx_param = &mop500_sdi2_dma_cfg_tx,
|
|
|
|
#endif
|
2010-08-19 11:06:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* SDI 4 (on-board eMMC)
|
|
|
|
*/
|
|
|
|
|
2010-10-14 11:57:59 +00:00
|
|
|
#ifdef CONFIG_STE_DMA40
|
|
|
|
struct stedma40_chan_cfg mop500_sdi4_dma_cfg_rx = {
|
|
|
|
.mode = STEDMA40_MODE_LOGICAL,
|
|
|
|
.dir = STEDMA40_PERIPH_TO_MEM,
|
|
|
|
.src_dev_type = DB8500_DMA_DEV42_SD_MM4_RX,
|
|
|
|
.dst_dev_type = STEDMA40_DEV_DST_MEMORY,
|
|
|
|
.src_info.data_width = STEDMA40_WORD_WIDTH,
|
|
|
|
.dst_info.data_width = STEDMA40_WORD_WIDTH,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct stedma40_chan_cfg mop500_sdi4_dma_cfg_tx = {
|
|
|
|
.mode = STEDMA40_MODE_LOGICAL,
|
|
|
|
.dir = STEDMA40_MEM_TO_PERIPH,
|
|
|
|
.src_dev_type = STEDMA40_DEV_SRC_MEMORY,
|
|
|
|
.dst_dev_type = DB8500_DMA_DEV42_SD_MM4_TX,
|
|
|
|
.src_info.data_width = STEDMA40_WORD_WIDTH,
|
|
|
|
.dst_info.data_width = STEDMA40_WORD_WIDTH,
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2010-08-19 11:06:32 +00:00
|
|
|
static struct mmci_platform_data mop500_sdi4_data = {
|
|
|
|
.ocr_mask = MMC_VDD_29_30,
|
|
|
|
.f_max = 100000000,
|
|
|
|
.capabilities = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA |
|
|
|
|
MMC_CAP_MMC_HIGHSPEED,
|
|
|
|
.gpio_cd = -1,
|
|
|
|
.gpio_wp = -1,
|
2010-10-14 11:57:59 +00:00
|
|
|
#ifdef CONFIG_STE_DMA40
|
|
|
|
.dma_filter = stedma40_filter,
|
|
|
|
.dma_rx_param = &mop500_sdi4_dma_cfg_rx,
|
|
|
|
.dma_tx_param = &mop500_sdi4_dma_cfg_tx,
|
|
|
|
#endif
|
2010-08-19 11:06:32 +00:00
|
|
|
};
|
|
|
|
|
2010-12-02 11:05:18 +00:00
|
|
|
void __init mop500_sdi_init(void)
|
2010-08-19 11:06:32 +00:00
|
|
|
{
|
2011-02-15 09:46:59 +00:00
|
|
|
/* PoP:ed eMMC on top of DB8500 v1.0 has problems with high speed */
|
|
|
|
if (!cpu_is_u8500v10())
|
|
|
|
mop500_sdi2_data.capabilities |= MMC_CAP_MMC_HIGHSPEED;
|
|
|
|
db8500_add_sdi2(&mop500_sdi2_data);
|
|
|
|
|
|
|
|
/* On-board eMMC */
|
|
|
|
db8500_add_sdi4(&mop500_sdi4_data);
|
2010-08-19 11:06:32 +00:00
|
|
|
|
2010-12-02 11:05:18 +00:00
|
|
|
/*
|
|
|
|
* sdi0 will finally be added when the TC35892 initializes and calls
|
|
|
|
* mop500_sdi_tc35892_init() above.
|
|
|
|
*/
|
2010-08-19 11:06:32 +00:00
|
|
|
}
|