Commit | Line | Data |
---|---|---|
bb3cee2b LW |
1 | /* |
2 | * | |
3 | * arch/arm/mach-u300/mmc.c | |
4 | * | |
5 | * | |
ec8f1253 | 6 | * Copyright (C) 2009 ST-Ericsson SA |
bb3cee2b LW |
7 | * License terms: GNU General Public License (GPL) version 2 |
8 | * | |
9 | * Author: Linus Walleij <linus.walleij@stericsson.com> | |
ec8f1253 | 10 | * Author: Johan Lundin |
bb3cee2b LW |
11 | * 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> | |
bb3cee2b | 16 | #include <linux/gpio.h> |
ec8f1253 | 17 | #include <linux/dmaengine.h> |
6ef297f8 | 18 | #include <linux/amba/mmci.h> |
5a0e3ad6 | 19 | #include <linux/slab.h> |
ec8f1253 LW |
20 | #include <mach/coh901318.h> |
21 | #include <mach/dma_channels.h> | |
bb3cee2b | 22 | |
bb3cee2b | 23 | #include "mmc.h" |
df1e0520 | 24 | #include "padmux.h" |
bb3cee2b | 25 | |
1a721859 LW |
26 | static struct mmci_platform_data mmc0_plat_data = { |
27 | /* | |
28 | * Do not set ocr_mask or voltage translation function, | |
29 | * we have a regulator we can control instead. | |
30 | */ | |
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, | |
ec8f1253 LW |
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 | |
bb3cee2b LW |
43 | }; |
44 | ||
bb3cee2b LW |
45 | int __devinit mmc_init(struct amba_device *adev) |
46 | { | |
bb3cee2b | 47 | struct device *mmcsd_device = &adev->dev; |
df1e0520 | 48 | struct pmx *pmx; |
bb3cee2b LW |
49 | int ret = 0; |
50 | ||
1a721859 | 51 | mmcsd_device->platform_data = &mmc0_plat_data; |
bb3cee2b | 52 | |
df1e0520 LW |
53 | /* |
54 | * Setup padmuxing for MMC. Since this must always be | |
55 | * compiled into the kernel, pmx is never released. | |
56 | */ | |
57 | pmx = pmx_get(mmcsd_device, U300_APP_PMX_MMC_SETTING); | |
58 | ||
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"); | |
65 | } | |
66 | ||
bb3cee2b LW |
67 | return ret; |
68 | } |