Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 1 | /* |
| 2 | * |
| 3 | * arch/arm/mach-u300/mmc.c |
| 4 | * |
| 5 | * |
Linus Walleij | ec8f125 | 2010-08-13 11:31:59 +0200 | [diff] [blame] | 6 | * Copyright (C) 2009 ST-Ericsson SA |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 7 | * License terms: GNU General Public License (GPL) version 2 |
| 8 | * |
| 9 | * Author: Linus Walleij <linus.walleij@stericsson.com> |
Linus Walleij | ec8f125 | 2010-08-13 11:31:59 +0200 | [diff] [blame] | 10 | * Author: Johan Lundin |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 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> |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 16 | #include <linux/gpio.h> |
Linus Walleij | ec8f125 | 2010-08-13 11:31:59 +0200 | [diff] [blame] | 17 | #include <linux/dmaengine.h> |
Linus Walleij | 6ef297f | 2009-09-22 14:29:36 +0100 | [diff] [blame] | 18 | #include <linux/amba/mmci.h> |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 19 | #include <linux/slab.h> |
Linus Walleij | ec8f125 | 2010-08-13 11:31:59 +0200 | [diff] [blame] | 20 | #include <mach/coh901318.h> |
| 21 | #include <mach/dma_channels.h> |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 22 | |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 23 | #include "mmc.h" |
Linus Walleij | df1e052 | 2009-08-10 12:52:40 +0100 | [diff] [blame] | 24 | #include "padmux.h" |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 25 | |
Linus Walleij | 1a72185 | 2011-02-02 14:41:19 +0100 | [diff] [blame] | 26 | static struct mmci_platform_data mmc0_plat_data = { |
Linus Walleij | f9e8eef | 2009-09-24 21:42:44 +0100 | [diff] [blame] | 27 | /* |
| 28 | * Do not set ocr_mask or voltage translation function, |
| 29 | * we have a regulator we can control instead. |
| 30 | */ |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 31 | /* Nominally 2.85V on our platform */ |
Linus Walleij | 1a72185 | 2011-02-02 14:41:19 +0100 | [diff] [blame] | 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, |
Linus Walleij | ec8f125 | 2010-08-13 11:31:59 +0200 | [diff] [blame] | 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 |
Linus Walleij | 1a72185 | 2011-02-02 14:41:19 +0100 | [diff] [blame] | 43 | }; |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 44 | |
Linus Walleij | 1a72185 | 2011-02-02 14:41:19 +0100 | [diff] [blame] | 45 | int __devinit mmc_init(struct amba_device *adev) |
| 46 | { |
| 47 | struct device *mmcsd_device = &adev->dev; |
| 48 | struct pmx *pmx; |
| 49 | int ret = 0; |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 50 | |
Linus Walleij | 1a72185 | 2011-02-02 14:41:19 +0100 | [diff] [blame] | 51 | mmcsd_device->platform_data = &mmc0_plat_data; |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 52 | |
Linus Walleij | df1e052 | 2009-08-10 12:52:40 +0100 | [diff] [blame] | 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 | |
Linus Walleij | bb3cee2 | 2009-04-23 10:22:13 +0100 | [diff] [blame] | 67 | return ret; |
| 68 | } |