]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - arch/arm/mach-omap2/board-apollon-mmc.c
ARM: OMAP: Clean-up MMC device init
[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 apollon_mmc_data = {
66         .nr_slots                       = 1,
67         .switch_slot                    = NULL,
68         .init                           = apollon_mmc_late_init,
69         .cleanup                        = apollon_mmc_cleanup,
70         .slots[0]       = {
71                 .enabled                = 1,
72                 .wire4                  = 1,
73
74                 /*
75                  * Use internal loop-back in MMC/SDIO Module Input Clock
76                  * selection
77                  */
78                 .internal_clock         = 1,
79
80                 .set_power              = apollon_mmc_set_power,
81                 .set_bus_mode           = apollon_mmc_set_bus_mode,
82                 .get_ro                 = NULL,
83                 .get_cover_state        = NULL,
84                 .ocr_mask               = MMC_VDD_30_31 | MMC_VDD_31_32 |
85                                           MMC_VDD_32_33 | MMC_VDD_33_34,
86                 .name                   = "mmcblk",
87         },
88 };
89
90 void __init apollon_mmc_init(void)
91 {
92         omap2_init_mmc(&apollon_mmc_data);
93 }
94
95 #else   /* !CONFIG_MMC_OMAP */
96
97 void __init apollon_mmc_init(void)
98 {
99 }
100
101 #endif  /* CONFIG_MMC_OMAP */