]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - arch/arm/mach-omap2/board-apollon-mmc.c
ARM: OMAP: Adds MMC multislot for apollon
[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
14 #include <asm/arch/gpio.h>
15 #include <asm/arch/mmc.h>
16
17 #ifdef CONFIG_MMC_OMAP
18
19 static struct device *mmc_device;
20
21 static int apollon_mmc_set_power(struct device *dev, int slot, int power_on,
22                                         int vdd)
23 {
24 #ifdef CONFIG_MMC_DEBUG
25         dev_dbg(dev, "Set slot %d power: %s (vdd %d)\n", slot + 1,
26                 power_on ? "on" : "off", vdd);
27 #endif
28         if (slot != 0) {
29                 dev_err(dev, "No such slot %d\n", slot + 1);
30                 return -ENODEV;
31         }
32
33         return 0;
34 }
35
36 static int apollon_mmc_set_bus_mode(struct device *dev, int slot, int bus_mode)
37 {
38 #ifdef CONFIG_MMC_DEBUG
39         dev_dbg(dev, "Set slot %d bus_mode %s\n", slot + 1,
40                 bus_mode == MMC_BUSMODE_OPENDRAIN ? "open-drain" : "push-pull");
41 #endif
42         if (slot != 0) {
43                 dev_err(dev, "No such slot %d\n", slot + 1);
44                 return -ENODEV;
45         }
46
47         return 0;
48 }
49
50 static int apollon_mmc_late_init(struct device *dev)
51 {
52         mmc_device = dev;
53
54         return 0;
55 }
56
57 static void apollon_mmc_cleanup(struct device *dev)
58 {
59 }
60
61 static struct omap_mmc_platform_data apollon_mmc_data = {
62         .nr_slots                       = 1,
63         .switch_slot                    = NULL,
64         .init                           = apollon_mmc_late_init,
65         .cleanup                        = apollon_mmc_cleanup,
66         .slots[0]       = {
67                 .set_power              = apollon_mmc_set_power,
68                 .set_bus_mode           = apollon_mmc_set_bus_mode,
69                 .get_ro                 = NULL,
70                 .get_cover_state        = NULL,
71                 .ocr_mask               = MMC_VDD_30_31 | MMC_VDD_31_32 |
72                                           MMC_VDD_32_33 | MMC_VDD_33_34,
73                 .name                   = "mmcblk",
74         },
75 };
76
77 void __init apollon_mmc_init(void)
78 {
79         omap_set_mmc_info(1, &apollon_mmc_data);
80 }
81
82 #else   /* !CONFIG_MMC_OMAP */
83
84 void __init apollon_mmc_init(void)
85 {
86 }
87
88 #endif  /* CONFIG_MMC_OMAP */