aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap1/board-h2-mmc.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap1/board-h2-mmc.c')
-rw-r--r--arch/arm/mach-omap1/board-h2-mmc.c89
1 files changed, 32 insertions, 57 deletions
diff --git a/arch/arm/mach-omap1/board-h2-mmc.c b/arch/arm/mach-omap1/board-h2-mmc.c
index ab9ee5820c48..409fa56d0a87 100644
--- a/arch/arm/mach-omap1/board-h2-mmc.c
+++ b/arch/arm/mach-omap1/board-h2-mmc.c
@@ -12,90 +12,68 @@
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 h2_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(H2_TPS_GPIO_MMC_PWR_EN, 1);
27 power_on ? "on" : "off", vdd); 29 else
28#endif 30 gpio_direction_output(H2_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 h2_mmc_set_bus_mode(struct device *dev, int slot, int bus_mode) 35static int mmc_late_init(struct device *dev)
38{ 36{
39#ifdef CONFIG_MMC_DEBUG 37 int ret;
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 38
48 return 0; 39 ret = gpio_request(H2_TPS_GPIO_MMC_PWR_EN, "MMC power");
49} 40 if (ret < 0)
41 return ret;
50 42
51static int h2_mmc_get_cover_state(struct device *dev, int slot) 43 gpio_direction_output(H2_TPS_GPIO_MMC_PWR_EN, 0);
52{
53 BUG_ON(slot != 0);
54
55 return slot_cover_open;
56}
57
58void h2_mmc_slot_cover_handler(void *arg, int state)
59{
60 if (mmc_device == NULL)
61 return;
62
63 slot_cover_open = state;
64 omap_mmc_notify_cover_event(mmc_device, 0, state);
65}
66
67static int h2_mmc_late_init(struct device *dev)
68{
69 int ret = 0;
70
71 mmc_device = dev;
72 44
73 return ret; 45 return ret;
74} 46}
75 47
76static void h2_mmc_cleanup(struct device *dev) 48static void mmc_shutdown(struct device *dev)
77{ 49{
50 gpio_free(H2_TPS_GPIO_MMC_PWR_EN);
78} 51}
79 52
80static struct omap_mmc_platform_data h2_mmc_data = { 53/*
54 * H2 could use the following functions tested:
55 * - mmc_get_cover_state that uses OMAP_MPUIO(1)
56 * - mmc_get_wp that uses OMAP_MPUIO(3)
57 */
58static struct omap_mmc_platform_data mmc1_data = {
81 .nr_slots = 1, 59 .nr_slots = 1,
82 .switch_slot = NULL, 60 .init = mmc_late_init,
83 .init = h2_mmc_late_init, 61 .shutdown = mmc_shutdown,
84 .cleanup = h2_mmc_cleanup, 62 .dma_mask = 0xffffffff,
85 .slots[0] = { 63 .slots[0] = {
86 .set_power = h2_mmc_set_power, 64 .set_power = mmc_set_power,
87 .set_bus_mode = h2_mmc_set_bus_mode,
88 .get_ro = NULL,
89 .get_cover_state = h2_mmc_get_cover_state,
90 .ocr_mask = MMC_VDD_28_29 | MMC_VDD_30_31 | 65 .ocr_mask = MMC_VDD_28_29 | MMC_VDD_30_31 |
91 MMC_VDD_32_33 | MMC_VDD_33_34, 66 MMC_VDD_32_33 | MMC_VDD_33_34,
92 .name = "mmcblk", 67 .name = "mmcblk",
93 }, 68 },
94}; 69};
95 70
71static struct omap_mmc_platform_data *mmc_data[OMAP16XX_NR_MMC];
72
96void __init h2_mmc_init(void) 73void __init h2_mmc_init(void)
97{ 74{
98 omap_set_mmc_info(1, &h2_mmc_data); 75 mmc_data[0] = &mmc1_data;
76 omap1_init_mmc(mmc_data, OMAP16XX_NR_MMC);
99} 77}
100 78
101#else 79#else
@@ -104,7 +82,4 @@ void __init h2_mmc_init(void)
104{ 82{
105} 83}
106 84
107void h2_mmc_slot_cover_handler(void *arg, int state)
108{
109}
110#endif 85#endif