mach-u300: use mmci driver for GPIO card detect
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / arm / mach-u300 / mmc.c
blob8bb4ef42ab0480155186a6245f5e3ea7088d04fc
1 /*
3 * arch/arm/mach-u300/mmc.c
6 * Copyright (C) 2009 ST-Ericsson AB
7 * License terms: GNU General Public License (GPL) version 2
9 * Author: Linus Walleij <linus.walleij@stericsson.com>
10 * Author: Johan Lundin <johan.lundin@stericsson.com>
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/gpio.h>
17 #include <linux/amba/mmci.h>
18 #include <linux/slab.h>
20 #include "mmc.h"
21 #include "padmux.h"
23 static struct mmci_platform_data mmc0_plat_data = {
25 * Do not set ocr_mask or voltage translation function,
26 * we have a regulator we can control instead.
28 /* Nominally 2.85V on our platform */
29 .f_max = 24000000,
30 .gpio_wp = -1,
31 .gpio_cd = U300_GPIO_PIN_MMC_CD,
32 .cd_invert = true,
33 .capabilities = MMC_CAP_MMC_HIGHSPEED |
34 MMC_CAP_SD_HIGHSPEED | MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
37 int __devinit mmc_init(struct amba_device *adev)
39 struct device *mmcsd_device = &adev->dev;
40 struct pmx *pmx;
41 int ret = 0;
43 mmcsd_device->platform_data = &mmc0_plat_data;
46 * Setup padmuxing for MMC. Since this must always be
47 * compiled into the kernel, pmx is never released.
49 pmx = pmx_get(mmcsd_device, U300_APP_PMX_MMC_SETTING);
51 if (IS_ERR(pmx))
52 pr_warning("Could not get padmux handle\n");
53 else {
54 ret = pmx_activate(mmcsd_device, pmx);
55 if (IS_ERR_VALUE(ret))
56 pr_warning("Could not activate padmuxing\n");
59 return ret;