aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap1/board-h3-mmc.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap1/board-h3-mmc.c')
-rw-r--r--arch/arm/mach-omap1/board-h3-mmc.c100
1 files changed, 29 insertions, 71 deletions
diff --git a/arch/arm/mach-omap1/board-h3-mmc.c b/arch/arm/mach-omap1/board-h3-mmc.c
index 36085819098c..fdfe793d56f2 100644
--- a/arch/arm/mach-omap1/board-h3-mmc.c
+++ b/arch/arm/mach-omap1/board-h3-mmc.c
@@ -12,94 +12,55 @@
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13 */ 13 */
14 14
15#include <linux/platform_device.h>
16
17#include <linux/i2c/tps65010.h>
18
15#include <mach/mmc.h> 19#include <mach/mmc.h>
16#include <mach/gpio.h> 20#include <mach/gpio.h>
17 21
18#ifdef CONFIG_MMC_OMAP 22#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
19static int slot_cover_open;
20static struct device *mmc_device;
21 23
22static int h3_mmc_set_power(struct device *dev, int slot, int power_on, 24static int mmc_set_power(struct device *dev, int slot, int power_on,
23 int vdd) 25 int vdd)
24{ 26{
25#ifdef CONFIG_MMC_DEBUG 27 if (power_on)
26 dev_dbg(dev, "Set slot %d power: %s (vdd %d)\n", slot + 1, 28 gpio_direction_output(H3_TPS_GPIO_MMC_PWR_EN, 1);
27 power_on ? "on" : "off", vdd); 29 else
28#endif 30 gpio_direction_output(H3_TPS_GPIO_MMC_PWR_EN, 0);
29 if (slot != 0) {
30 dev_err(dev, "No such slot %d\n", slot + 1);
31 return -ENODEV;
32 }
33 31
34 return 0; 32 return 0;
35} 33}
36 34
37static int h3_mmc_set_bus_mode(struct device *dev, int slot, int bus_mode) 35/*
38{ 36 * H3 could use the following functions tested:
39 int ret = 0; 37 * - mmc_get_cover_state that uses OMAP_MPUIO(1)
40 38 * - mmc_get_wp that maybe uses OMAP_MPUIO(3)
41#ifdef CONFIG_MMC_DEBUG 39 */
42 dev_dbg(dev, "Set slot %d bus_mode %s\n", slot + 1, 40static struct omap_mmc_platform_data mmc1_data = {
43 bus_mode == MMC_BUSMODE_OPENDRAIN ? "open-drain" : "push-pull");
44#endif
45 if (slot != 0) {
46 dev_err(dev, "No such slot %d\n", slot + 1);
47 return -ENODEV;
48 }
49
50 /* Treated on upper level */
51
52 return bus_mode;
53}
54
55static int h3_mmc_get_cover_state(struct device *dev, int slot)
56{
57 BUG_ON(slot != 0);
58
59 return slot_cover_open;
60}
61
62void h3_mmc_slot_cover_handler(void *arg, int state)
63{
64 if (mmc_device == NULL)
65 return;
66
67 slot_cover_open = state;
68 omap_mmc_notify_cover_event(mmc_device, 0, state);
69}
70
71static int h3_mmc_late_init(struct device *dev)
72{
73 int ret = 0;
74
75 mmc_device = dev;
76
77 return ret;
78}
79
80static void h3_mmc_cleanup(struct device *dev)
81{
82}
83
84static struct omap_mmc_platform_data h3_mmc_data = {
85 .nr_slots = 1, 41 .nr_slots = 1,
86 .switch_slot = NULL, 42 .dma_mask = 0xffffffff,
87 .init = h3_mmc_late_init,
88 .cleanup = h3_mmc_cleanup,
89 .slots[0] = { 43 .slots[0] = {
90 .set_power = h3_mmc_set_power, 44 .set_power = mmc_set_power,
91 .set_bus_mode = h3_mmc_set_bus_mode,
92 .get_ro = NULL,
93 .get_cover_state = h3_mmc_get_cover_state,
94 .ocr_mask = MMC_VDD_28_29 | MMC_VDD_30_31 | 45 .ocr_mask = MMC_VDD_28_29 | MMC_VDD_30_31 |
95 MMC_VDD_32_33 | MMC_VDD_33_34, 46 MMC_VDD_32_33 | MMC_VDD_33_34,
96 .name = "mmcblk", 47 .name = "mmcblk",
97 }, 48 },
98}; 49};
99 50
51static struct omap_mmc_platform_data *mmc_data[OMAP16XX_NR_MMC];
52
100void __init h3_mmc_init(void) 53void __init h3_mmc_init(void)
101{ 54{
102 omap_set_mmc_info(1, &h3_mmc_data); 55 int ret;
56
57 ret = gpio_request(H3_TPS_GPIO_MMC_PWR_EN, "MMC power");
58 if (ret < 0)
59 return;
60 gpio_direction_output(H3_TPS_GPIO_MMC_PWR_EN, 0);
61
62 mmc_data[0] = &mmc1_data;
63 omap1_init_mmc(mmc_data, OMAP16XX_NR_MMC);
103} 64}
104 65
105#else 66#else
@@ -108,7 +69,4 @@ void __init h3_mmc_init(void)
108{ 69{
109} 70}
110 71
111void h3_mmc_slot_cover_handler(void *arg, int state)
112{
113}
114#endif 72#endif