aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap1/board-nokia770.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-nokia770.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-nokia770.c')
-rw-r--r--arch/arm/mach-omap1/board-nokia770.c74
1 files changed, 59 insertions, 15 deletions
diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index b26782471e59..4970c402a594 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -35,6 +35,7 @@
35#include <mach/aic23.h> 35#include <mach/aic23.h>
36#include <mach/omapfb.h> 36#include <mach/omapfb.h>
37#include <mach/lcd_mipid.h> 37#include <mach/lcd_mipid.h>
38#include <mach/mmc.h>
38 39
39#define ADS7846_PENDOWN_GPIO 15 40#define ADS7846_PENDOWN_GPIO 15
40 41
@@ -173,26 +174,68 @@ static struct omap_usb_config nokia770_usb_config __initdata = {
173 .pins[0] = 6, 174 .pins[0] = 6,
174}; 175};
175 176
176static struct omap_mmc_config nokia770_mmc_config __initdata = { 177#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
177 .mmc[0] = { 178
178 .enabled = 0, 179#define NOKIA770_GPIO_MMC_POWER 41
179 .wire4 = 0, 180#define NOKIA770_GPIO_MMC_SWITCH 23
180 .wp_pin = -1, 181
181 .power_pin = -1, 182static int nokia770_mmc_set_power(struct device *dev, int slot, int power_on,
182 .switch_pin = -1, 183 int vdd)
183 }, 184{
184 .mmc[1] = { 185 if (power_on)
185 .enabled = 0, 186 gpio_set_value(NOKIA770_GPIO_MMC_POWER, 1);
186 .wire4 = 0, 187 else
187 .wp_pin = -1, 188 gpio_set_value(NOKIA770_GPIO_MMC_POWER, 0);
188 .power_pin = -1, 189
189 .switch_pin = -1, 190 return 0;
191}
192
193static int nokia770_mmc_get_cover_state(struct device *dev, int slot)
194{
195 return gpio_get_value(NOKIA770_GPIO_MMC_SWITCH);
196}
197
198static struct omap_mmc_platform_data nokia770_mmc2_data = {
199 .nr_slots = 1,
200 .dma_mask = 0xffffffff,
201 .slots[0] = {
202 .set_power = nokia770_mmc_set_power,
203 .get_cover_state = nokia770_mmc_get_cover_state,
204 .name = "mmcblk",
190 }, 205 },
191}; 206};
192 207
208static struct omap_mmc_platform_data *nokia770_mmc_data[OMAP16XX_NR_MMC];
209
210static void __init nokia770_mmc_init(void)
211{
212 int ret;
213
214 ret = gpio_request(NOKIA770_GPIO_MMC_POWER, "MMC power");
215 if (ret < 0)
216 return;
217 gpio_direction_output(NOKIA770_GPIO_MMC_POWER, 0);
218
219 ret = gpio_request(NOKIA770_GPIO_MMC_SWITCH, "MMC cover");
220 if (ret < 0) {
221 gpio_free(NOKIA770_GPIO_MMC_POWER);
222 return;
223 }
224 gpio_direction_input(NOKIA770_GPIO_MMC_SWITCH);
225
226 /* Only the second MMC controller is used */
227 nokia770_mmc_data[1] = &nokia770_mmc2_data;
228 omap1_init_mmc(nokia770_mmc_data, OMAP16XX_NR_MMC);
229}
230
231#else
232static inline void nokia770_mmc_init(void)
233{
234}
235#endif
236
193static struct omap_board_config_kernel nokia770_config[] __initdata = { 237static struct omap_board_config_kernel nokia770_config[] __initdata = {
194 { OMAP_TAG_USB, NULL }, 238 { OMAP_TAG_USB, NULL },
195 { OMAP_TAG_MMC, &nokia770_mmc_config },
196}; 239};
197 240
198#if defined(CONFIG_OMAP_DSP) 241#if defined(CONFIG_OMAP_DSP)
@@ -335,6 +378,7 @@ static void __init omap_nokia770_init(void)
335 omap_dsp_init(); 378 omap_dsp_init();
336 ads7846_dev_init(); 379 ads7846_dev_init();
337 mipid_dev_init(); 380 mipid_dev_init();
381 nokia770_mmc_init();
338} 382}
339 383
340static void __init omap_nokia770_map_io(void) 384static void __init omap_nokia770_map_io(void)