aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap1/board-sx1-mmc.c
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2008-12-10 20:37:16 -0500
committerTony Lindgren <tony@atomide.com>2008-12-10 20:37:16 -0500
commitd88746652b4d133284d1fdd05b5e999e8f44c998 (patch)
tree2a6cfd6fe175a18eb4b4f600e0a79444259c9a5d /arch/arm/mach-omap1/board-sx1-mmc.c
parent652bcd8f72cc0cdf4499ce7d73990514e5e3e4b9 (diff)
omap mmc: Add better MMC low-level init
This will simplify the MMC low-level init, and make it more flexible to add support for a newer MMC controller in the following patches. The patch rearranges platform data and gets rid of slot vs controller confusion in the old data structures. Also fix device id numbering in the clock code. Some code snippets are based on an earlier patch by Russell King <linux@arm.linux.org.uk>. Cc: Pierre Ossman <drzeus-mmc@drzeus.cx> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap1/board-sx1-mmc.c')
-rw-r--r--arch/arm/mach-omap1/board-sx1-mmc.c31
1 files changed, 11 insertions, 20 deletions
diff --git a/arch/arm/mach-omap1/board-sx1-mmc.c b/arch/arm/mach-omap1/board-sx1-mmc.c
index 0ece109aee41..66a4d7d5255d 100644
--- a/arch/arm/mach-omap1/board-sx1-mmc.c
+++ b/arch/arm/mach-omap1/board-sx1-mmc.c
@@ -12,30 +12,20 @@
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
15#include <mach/hardware.h> 17#include <mach/hardware.h>
16#include <mach/mmc.h> 18#include <mach/mmc.h>
17#include <mach/gpio.h> 19#include <mach/gpio.h>
18 20
19#ifdef CONFIG_MMC_OMAP 21#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
20static int slot_cover_open;
21static struct device *mmc_device;
22 22
23static int sx1_mmc_set_power(struct device *dev, int slot, int power_on, 23static int mmc_set_power(struct device *dev, int slot, int power_on,
24 int vdd) 24 int vdd)
25{ 25{
26 int err; 26 int err;
27 u8 dat = 0; 27 u8 dat = 0;
28 28
29#ifdef CONFIG_MMC_DEBUG
30 dev_dbg(dev, "Set slot %d power: %s (vdd %d)\n", slot + 1,
31 power_on ? "on" : "off", vdd);
32#endif
33
34 if (slot != 0) {
35 dev_err(dev, "No such slot %d\n", slot + 1);
36 return -ENODEV;
37 }
38
39 err = sx1_i2c_read_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, &dat); 29 err = sx1_i2c_read_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, &dat);
40 if (err < 0) 30 if (err < 0)
41 return err; 31 return err;
@@ -48,19 +38,23 @@ static int sx1_mmc_set_power(struct device *dev, int slot, int power_on,
48 return sx1_i2c_write_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, dat); 38 return sx1_i2c_write_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, dat);
49} 39}
50 40
51static struct omap_mmc_platform_data sx1_mmc_data = { 41/* Cover switch is at OMAP_MPUIO(3) */
42static struct omap_mmc_platform_data mmc1_data = {
52 .nr_slots = 1, 43 .nr_slots = 1,
53 .slots[0] = { 44 .slots[0] = {
54 .set_power = sx1_mmc_set_power, 45 .set_power = mmc_set_power,
55 .ocr_mask = MMC_VDD_28_29 | MMC_VDD_30_31 | 46 .ocr_mask = MMC_VDD_28_29 | MMC_VDD_30_31 |
56 MMC_VDD_32_33 | MMC_VDD_33_34, 47 MMC_VDD_32_33 | MMC_VDD_33_34,
57 .name = "mmcblk", 48 .name = "mmcblk",
58 }, 49 },
59}; 50};
60 51
52static struct omap_mmc_platform_data *mmc_data[OMAP15XX_NR_MMC];
53
61void __init sx1_mmc_init(void) 54void __init sx1_mmc_init(void)
62{ 55{
63 omap_set_mmc_info(1, &sx1_mmc_data); 56 mmc_data[0] = &mmc1_data;
57 omap1_init_mmc(mmc_data, OMAP15XX_NR_MMC);
64} 58}
65 59
66#else 60#else
@@ -69,7 +63,4 @@ void __init sx1_mmc_init(void)
69{ 63{
70} 64}
71 65
72void sx1_mmc_slot_cover_handler(void *arg, int state)
73{
74}
75#endif 66#endif