Merge remote-tracking branch 'moduleh/module.h-split'
[linux-2.6/next.git] / arch / arm / mach-u300 / mmc.c
blobd9a5c92db74a5cc0aa9a69276bdd17fc464628ff
1 /*
3 * arch/arm/mach-u300/mmc.c
6 * Copyright (C) 2009 ST-Ericsson SA
7 * License terms: GNU General Public License (GPL) version 2
9 * Author: Linus Walleij <linus.walleij@stericsson.com>
10 * Author: Johan Lundin
11 * Author: Jonas Aaberg <jonas.aberg@stericsson.com>
13 #include <linux/device.h>
14 #include <linux/amba/bus.h>
15 #include <linux/mmc/host.h>
16 #include <linux/dmaengine.h>
17 #include <linux/amba/mmci.h>
18 #include <linux/slab.h>
19 #include <mach/coh901318.h>
20 #include <mach/dma_channels.h>
21 #include <mach/gpio-u300.h>
23 #include "mmc.h"
24 #include "padmux.h"
26 static struct mmci_platform_data mmc0_plat_data = {
28 * Do not set ocr_mask or voltage translation function,
29 * we have a regulator we can control instead.
31 /* Nominally 2.85V on our platform */
32 .f_max = 24000000,
33 .gpio_wp = -1,
34 .gpio_cd = U300_GPIO_PIN_MMC_CD,
35 .cd_invert = true,
36 .capabilities = MMC_CAP_MMC_HIGHSPEED |
37 MMC_CAP_SD_HIGHSPEED | MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
38 #ifdef CONFIG_COH901318
39 .dma_filter = coh901318_filter_id,
40 .dma_rx_param = (void *) U300_DMA_MMCSD_RX_TX,
41 /* Don't specify a TX channel, this RX channel is bidirectional */
42 #endif
45 int __devinit mmc_init(struct amba_device *adev)
47 struct device *mmcsd_device = &adev->dev;
48 struct pmx *pmx;
49 int ret = 0;
51 mmcsd_device->platform_data = &mmc0_plat_data;
54 * Setup padmuxing for MMC. Since this must always be
55 * compiled into the kernel, pmx is never released.
57 pmx = pmx_get(mmcsd_device, U300_APP_PMX_MMC_SETTING);
59 if (IS_ERR(pmx))
60 pr_warning("Could not get padmux handle\n");
61 else {
62 ret = pmx_activate(mmcsd_device, pmx);
63 if (IS_ERR_VALUE(ret))
64 pr_warning("Could not activate padmuxing\n");
67 return ret;