aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap1/board-nokia770.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap1/board-nokia770.c')
-rw-r--r--arch/arm/mach-omap1/board-nokia770.c86
1 files changed, 65 insertions, 21 deletions
diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index 38d9783ac6d6..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
@@ -102,7 +103,7 @@ static void mipid_shutdown(struct mipid_platform_data *pdata)
102{ 103{
103 if (pdata->nreset_gpio != -1) { 104 if (pdata->nreset_gpio != -1) {
104 printk(KERN_INFO "shutdown LCD\n"); 105 printk(KERN_INFO "shutdown LCD\n");
105 omap_set_gpio_dataout(pdata->nreset_gpio, 0); 106 gpio_set_value(pdata->nreset_gpio, 0);
106 msleep(120); 107 msleep(120);
107 } 108 }
108} 109}
@@ -124,13 +125,13 @@ static void mipid_dev_init(void)
124 125
125static void ads7846_dev_init(void) 126static void ads7846_dev_init(void)
126{ 127{
127 if (omap_request_gpio(ADS7846_PENDOWN_GPIO) < 0) 128 if (gpio_request(ADS7846_PENDOWN_GPIO, "ADS7846 pendown") < 0)
128 printk(KERN_ERR "can't get ads7846 pen down GPIO\n"); 129 printk(KERN_ERR "can't get ads7846 pen down GPIO\n");
129} 130}
130 131
131static int ads7846_get_pendown_state(void) 132static int ads7846_get_pendown_state(void)
132{ 133{
133 return !omap_get_gpio_datain(ADS7846_PENDOWN_GPIO); 134 return !gpio_get_value(ADS7846_PENDOWN_GPIO);
134} 135}
135 136
136static struct ads7846_platform_data nokia770_ads7846_platform_data __initdata = { 137static struct ads7846_platform_data nokia770_ads7846_platform_data __initdata = {
@@ -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)
@@ -228,9 +271,9 @@ static void nokia770_audio_pwr_up(void)
228 /* Turn on codec */ 271 /* Turn on codec */
229 aic23_power_up(); 272 aic23_power_up();
230 273
231 if (omap_get_gpio_datain(HEADPHONE_GPIO)) 274 if (gpio_get_value(HEADPHONE_GPIO))
232 /* HP not connected, turn on amplifier */ 275 /* HP not connected, turn on amplifier */
233 omap_set_gpio_dataout(AMPLIFIER_CTRL_GPIO, 1); 276 gpio_set_value(AMPLIFIER_CTRL_GPIO, 1);
234 else 277 else
235 /* HP connected, do not turn on amplifier */ 278 /* HP connected, do not turn on amplifier */
236 printk("HP connected\n"); 279 printk("HP connected\n");
@@ -250,7 +293,7 @@ static DECLARE_DELAYED_WORK(codec_power_down_work, codec_delayed_power_down);
250static void nokia770_audio_pwr_down(void) 293static void nokia770_audio_pwr_down(void)
251{ 294{
252 /* Turn off amplifier */ 295 /* Turn off amplifier */
253 omap_set_gpio_dataout(AMPLIFIER_CTRL_GPIO, 0); 296 gpio_set_value(AMPLIFIER_CTRL_GPIO, 0);
254 297
255 /* Turn off codec: schedule delayed work */ 298 /* Turn off codec: schedule delayed work */
256 schedule_delayed_work(&codec_power_down_work, HZ / 20); /* 50ms */ 299 schedule_delayed_work(&codec_power_down_work, HZ / 20); /* 50ms */
@@ -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)