]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - arch/arm/mach-omap2/board-apollon-mmc.c
Merge branch 'omap-fixes'
[linux-2.6-omap-h63xx.git] / arch / arm / mach-omap2 / board-apollon-mmc.c
1 /*
2  * linux/arch/arm/mach-omap2/board-apollon-mmc.c
3  *
4  * Copyright (C) 2005-2007 Samsung Electronics
5  * Author: Kyungmin Park <kyungmin.park@samsung.com>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License version 2 as
9  * published by the Free Software Foundation.
10  */
11
12 #include <linux/kernel.h>
13 #include <linux/platform_device.h>
14
15 #include <mach/gpio.h>
16 #include <mach/mmc.h>
17
18 #ifdef CONFIG_MMC_OMAP
19
20 static struct device *mmc_device;
21
22 static int apollon_mmc_set_power(struct device *dev, int slot, int power_on,
23                                         int vdd)
24 {
25 #ifdef CONFIG_MMC_DEBUG
26         dev_dbg(dev, "Set slot %d power: %s (vdd %d)\n", slot + 1,
27                 power_on ? "on" : "off", vdd);
28 #endif
29         if (slot != 0) {
30                 dev_err(dev, "No such slot %d\n", slot + 1);
31                 return -ENODEV;
32         }
33
34         return 0;
35 }
36
37 static int apollon_mmc_set_bus_mode(struct device *dev, int slot, int bus_mode)
38 {
39 #ifdef CONFIG_MMC_DEBUG
40         dev_dbg(dev, "Set slot %d bus_mode %s\n", slot + 1,
41                 bus_mode == MMC_BUSMODE_OPENDRAIN ? "open-drain" : "push-pull");
42 #endif
43         if (slot != 0) {
44                 dev_err(dev, "No such slot %d\n", slot + 1);
45                 return -ENODEV;
46         }
47
48         return 0;
49 }
50
51 static int apollon_mmc_late_init(struct device *dev)
52 {
53         mmc_device = dev;
54
55         return 0;
56 }
57
58 static void apollon_mmc_cleanup(struct device *dev)
59 {
60 }
61
62 /*
63  * Note: If you want to detect card feature, please assign GPIO 37
64  */
65 static struct omap_mmc_platform_data mmc1_data = {
66         .nr_slots                       = 1,
67         .init                           = apollon_mmc_late_init,
68         .cleanup                        = apollon_mmc_cleanup,
69         .dma_mask                       = 0xffffffff,
70         .slots[0]       = {
71                 .wires                  = 4,
72
73                 /*
74                  * Use internal loop-back in MMC/SDIO Module Input Clock
75                  * selection
76                  */
77                 .internal_clock         = 1,
78
79                 .set_power              = apollon_mmc_set_power,
80                 .set_bus_mode           = apollon_mmc_set_bus_mode,
81                 .ocr_mask               = MMC_VDD_30_31 | MMC_VDD_31_32 |
82                                           MMC_VDD_32_33 | MMC_VDD_33_34,
83                 .name                   = "mmcblk",
84         },
85 };
86
87 static struct omap_mmc_platform_data *mmc_data[OMAP24XX_NR_MMC];
88
89 void __init apollon_mmc_init(void)
90 {
91         mmc_data[0] = &mmc1_data;
92         omap2_init_mmc(mmc_data, OMAP24XX_NR_MMC);
93 }
94
95 #else   /* !CONFIG_MMC_OMAP */
96
97 void __init apollon_mmc_init(void)
98 {
99 }
100
101 #endif  /* CONFIG_MMC_OMAP */