blob: 4d482aacc2720e82c14238f69f247985339e93f2 [file] [log] [blame]
Linus Walleijbb3cee22009-04-23 10:22:13 +01001/*
2 *
3 * arch/arm/mach-u300/mmc.c
4 *
5 *
Linus Walleijec8f1252010-08-13 11:31:59 +02006 * Copyright (C) 2009 ST-Ericsson SA
Linus Walleijbb3cee22009-04-23 10:22:13 +01007 * License terms: GNU General Public License (GPL) version 2
8 *
9 * Author: Linus Walleij <linus.walleij@stericsson.com>
Linus Walleijec8f1252010-08-13 11:31:59 +020010 * Author: Johan Lundin
Linus Walleijbb3cee22009-04-23 10:22:13 +010011 * Author: Jonas Aaberg <jonas.aberg@stericsson.com>
12 */
13#include <linux/device.h>
14#include <linux/amba/bus.h>
15#include <linux/mmc/host.h>
Linus Walleijec8f1252010-08-13 11:31:59 +020016#include <linux/dmaengine.h>
Linus Walleij6ef297f2009-09-22 14:29:36 +010017#include <linux/amba/mmci.h>
Tejun Heo5a0e3ad2010-03-24 17:04:11 +090018#include <linux/slab.h>
Linus Walleijec8f1252010-08-13 11:31:59 +020019#include <mach/coh901318.h>
20#include <mach/dma_channels.h>
Linus Walleijeb3cf182011-08-22 08:34:26 +010021#include <mach/gpio-u300.h>
Linus Walleijbb3cee22009-04-23 10:22:13 +010022
Linus Walleijbb3cee22009-04-23 10:22:13 +010023#include "mmc.h"
24
Linus Walleij1a721852011-02-02 14:41:19 +010025static struct mmci_platform_data mmc0_plat_data = {
Linus Walleijf9e8eef2009-09-24 21:42:44 +010026 /*
27 * Do not set ocr_mask or voltage translation function,
28 * we have a regulator we can control instead.
29 */
Linus Walleijbb3cee22009-04-23 10:22:13 +010030 /* Nominally 2.85V on our platform */
Linus Walleij1a721852011-02-02 14:41:19 +010031 .f_max = 24000000,
32 .gpio_wp = -1,
33 .gpio_cd = U300_GPIO_PIN_MMC_CD,
34 .cd_invert = true,
35 .capabilities = MMC_CAP_MMC_HIGHSPEED |
36 MMC_CAP_SD_HIGHSPEED | MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
Linus Walleijec8f1252010-08-13 11:31:59 +020037#ifdef CONFIG_COH901318
38 .dma_filter = coh901318_filter_id,
39 .dma_rx_param = (void *) U300_DMA_MMCSD_RX_TX,
40 /* Don't specify a TX channel, this RX channel is bidirectional */
41#endif
Linus Walleij1a721852011-02-02 14:41:19 +010042};
Linus Walleijbb3cee22009-04-23 10:22:13 +010043
Linus Walleij1a721852011-02-02 14:41:19 +010044int __devinit mmc_init(struct amba_device *adev)
45{
46 struct device *mmcsd_device = &adev->dev;
Linus Walleij1a721852011-02-02 14:41:19 +010047 int ret = 0;
Linus Walleijbb3cee22009-04-23 10:22:13 +010048
Linus Walleij1a721852011-02-02 14:41:19 +010049 mmcsd_device->platform_data = &mmc0_plat_data;
Linus Walleijbb3cee22009-04-23 10:22:13 +010050
Linus Walleijbb3cee22009-04-23 10:22:13 +010051 return ret;
52}