diff options
Diffstat (limited to 'arch/arm/mach-omap1/board-nokia770.c')
-rw-r--r-- | arch/arm/mach-omap1/board-nokia770.c | 74 |
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 | ||
176 | static 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, | 182 | static 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 | |||
193 | static int nokia770_mmc_get_cover_state(struct device *dev, int slot) | ||
194 | { | ||
195 | return gpio_get_value(NOKIA770_GPIO_MMC_SWITCH); | ||
196 | } | ||
197 | |||
198 | static 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 | ||
208 | static struct omap_mmc_platform_data *nokia770_mmc_data[OMAP16XX_NR_MMC]; | ||
209 | |||
210 | static 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 | ||
232 | static inline void nokia770_mmc_init(void) | ||
233 | { | ||
234 | } | ||
235 | #endif | ||
236 | |||
193 | static struct omap_board_config_kernel nokia770_config[] __initdata = { | 237 | static 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 | ||
340 | static void __init omap_nokia770_map_io(void) | 384 | static void __init omap_nokia770_map_io(void) |