~ubuntu-branches/debian/wheezy/linux-2.6/wheezy

« back to all changes in this revision

Viewing changes to arch/arm/mach-omap2/board-omap3stalker.c

  • Committer: Bazaar Package Importer
  • Author(s): Ben Hutchings, Ben Hutchings, Aurelien Jarno, Martin Michlmayr
  • Date: 2011-04-06 13:53:30 UTC
  • mfrom: (43.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20110406135330-wjufxhd0tvn3zx4z
Tags: 2.6.38-3
[ Ben Hutchings ]
* [ppc64] Add to linux-tools package architectures (Closes: #620124)
* [amd64] Save cr4 to mmu_cr4_features at boot time (Closes: #620284)
* appletalk: Fix bugs introduced when removing use of BKL
* ALSA: Fix yet another race in disconnection
* cciss: Fix lost command issue
* ath9k: Fix kernel panic in AR2427
* ses: Avoid kernel panic when lun 0 is not mapped
* PCI/ACPI: Report ASPM support to BIOS if not disabled from command line

[ Aurelien Jarno ]
* rtlwifi: fix build when PCI is not enabled.

[ Martin Michlmayr ]
* rtlwifi: Eliminate udelay calls with too large values (Closes: #620204)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * linux/arch/arm/mach-omap2/board-omap3evm.c
 
3
 *
 
4
 * Copyright (C) 2008 Guangzhou EMA-Tech
 
5
 *
 
6
 * Modified from mach-omap2/board-omap3evm.c
 
7
 *
 
8
 * Initial code: Syed Mohammed Khasim
 
9
 *
 
10
 * This program is free software; you can redistribute it and/or modify
 
11
 * it under the terms of the GNU General Public License version 2 as
 
12
 * published by the Free Software Foundation.
 
13
 */
 
14
 
 
15
#include <linux/kernel.h>
 
16
#include <linux/init.h>
 
17
#include <linux/platform_device.h>
 
18
#include <linux/delay.h>
 
19
#include <linux/err.h>
 
20
#include <linux/clk.h>
 
21
#include <linux/io.h>
 
22
#include <linux/leds.h>
 
23
#include <linux/gpio.h>
 
24
#include <linux/input.h>
 
25
#include <linux/gpio_keys.h>
 
26
 
 
27
#include <linux/regulator/machine.h>
 
28
#include <linux/i2c/twl.h>
 
29
#include <linux/mmc/host.h>
 
30
 
 
31
#include <mach/hardware.h>
 
32
#include <asm/mach-types.h>
 
33
#include <asm/mach/arch.h>
 
34
#include <asm/mach/map.h>
 
35
#include <asm/mach/flash.h>
 
36
 
 
37
#include <plat/board.h>
 
38
#include <plat/common.h>
 
39
#include <plat/gpmc.h>
 
40
#include <plat/nand.h>
 
41
#include <plat/usb.h>
 
42
#include <plat/display.h>
 
43
#include <plat/panel-generic-dpi.h>
 
44
 
 
45
#include <plat/mcspi.h>
 
46
#include <linux/input/matrix_keypad.h>
 
47
#include <linux/spi/spi.h>
 
48
#include <linux/spi/ads7846.h>
 
49
#include <linux/interrupt.h>
 
50
#include <linux/smsc911x.h>
 
51
#include <linux/i2c/at24.h>
 
52
 
 
53
#include "sdram-micron-mt46h32m32lf-6.h"
 
54
#include "mux.h"
 
55
#include "hsmmc.h"
 
56
#include "timer-gp.h"
 
57
 
 
58
#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
 
59
#define OMAP3STALKER_ETHR_START 0x2c000000
 
60
#define OMAP3STALKER_ETHR_SIZE  1024
 
61
#define OMAP3STALKER_ETHR_GPIO_IRQ      19
 
62
#define OMAP3STALKER_SMC911X_CS 5
 
63
 
 
64
static struct resource omap3stalker_smsc911x_resources[] = {
 
65
        [0] = {
 
66
               .start   = OMAP3STALKER_ETHR_START,
 
67
               .end     =
 
68
               (OMAP3STALKER_ETHR_START + OMAP3STALKER_ETHR_SIZE - 1),
 
69
               .flags   = IORESOURCE_MEM,
 
70
        },
 
71
        [1] = {
 
72
               .start   = OMAP_GPIO_IRQ(OMAP3STALKER_ETHR_GPIO_IRQ),
 
73
               .end     = OMAP_GPIO_IRQ(OMAP3STALKER_ETHR_GPIO_IRQ),
 
74
               .flags   = (IORESOURCE_IRQ | IRQF_TRIGGER_LOW),
 
75
        },
 
76
};
 
77
 
 
78
static struct smsc911x_platform_config smsc911x_config = {
 
79
        .phy_interface  = PHY_INTERFACE_MODE_MII,
 
80
        .irq_polarity   = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
 
81
        .irq_type       = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
 
82
        .flags          = (SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS),
 
83
};
 
84
 
 
85
static struct platform_device omap3stalker_smsc911x_device = {
 
86
        .name           = "smsc911x",
 
87
        .id             = -1,
 
88
        .num_resources  = ARRAY_SIZE(omap3stalker_smsc911x_resources),
 
89
        .resource       = &omap3stalker_smsc911x_resources[0],
 
90
        .dev            = {
 
91
                .platform_data  = &smsc911x_config,
 
92
        },
 
93
};
 
94
 
 
95
static inline void __init omap3stalker_init_eth(void)
 
96
{
 
97
        int eth_cs;
 
98
        struct clk *l3ck;
 
99
        unsigned int rate;
 
100
 
 
101
        eth_cs = OMAP3STALKER_SMC911X_CS;
 
102
 
 
103
        l3ck = clk_get(NULL, "l3_ck");
 
104
        if (IS_ERR(l3ck))
 
105
                rate = 100000000;
 
106
        else
 
107
                rate = clk_get_rate(l3ck);
 
108
 
 
109
        omap_mux_init_gpio(19, OMAP_PIN_INPUT_PULLUP);
 
110
        if (gpio_request(OMAP3STALKER_ETHR_GPIO_IRQ, "SMC911x irq") < 0) {
 
111
                printk(KERN_ERR
 
112
                       "Failed to request GPIO%d for smc911x IRQ\n",
 
113
                       OMAP3STALKER_ETHR_GPIO_IRQ);
 
114
                return;
 
115
        }
 
116
 
 
117
        gpio_direction_input(OMAP3STALKER_ETHR_GPIO_IRQ);
 
118
 
 
119
        platform_device_register(&omap3stalker_smsc911x_device);
 
120
}
 
121
 
 
122
#else
 
123
static inline void __init omap3stalker_init_eth(void)
 
124
{
 
125
        return;
 
126
}
 
127
#endif
 
128
 
 
129
/*
 
130
 * OMAP3 DSS control signals
 
131
 */
 
132
 
 
133
#define DSS_ENABLE_GPIO 199
 
134
#define LCD_PANEL_BKLIGHT_GPIO  210
 
135
#define ENABLE_VPLL2_DEV_GRP    0xE0
 
136
 
 
137
static int lcd_enabled;
 
138
static int dvi_enabled;
 
139
 
 
140
static void __init omap3_stalker_display_init(void)
 
141
{
 
142
        return;
 
143
}
 
144
 
 
145
static int omap3_stalker_enable_lcd(struct omap_dss_device *dssdev)
 
146
{
 
147
        if (dvi_enabled) {
 
148
                printk(KERN_ERR "cannot enable LCD, DVI is enabled\n");
 
149
                return -EINVAL;
 
150
        }
 
151
        gpio_set_value(DSS_ENABLE_GPIO, 1);
 
152
        gpio_set_value(LCD_PANEL_BKLIGHT_GPIO, 1);
 
153
        lcd_enabled = 1;
 
154
        return 0;
 
155
}
 
156
 
 
157
static void omap3_stalker_disable_lcd(struct omap_dss_device *dssdev)
 
158
{
 
159
        gpio_set_value(DSS_ENABLE_GPIO, 0);
 
160
        gpio_set_value(LCD_PANEL_BKLIGHT_GPIO, 0);
 
161
        lcd_enabled = 0;
 
162
}
 
163
 
 
164
static struct panel_generic_dpi_data lcd_panel = {
 
165
        .name                   = "generic",
 
166
        .platform_enable        = omap3_stalker_enable_lcd,
 
167
        .platform_disable       = omap3_stalker_disable_lcd,
 
168
};
 
169
 
 
170
static struct omap_dss_device omap3_stalker_lcd_device = {
 
171
        .name                   = "lcd",
 
172
        .driver_name            = "generic_dpi_panel",
 
173
        .data                   = &lcd_panel,
 
174
        .phy.dpi.data_lines     = 24,
 
175
        .type                   = OMAP_DISPLAY_TYPE_DPI,
 
176
};
 
177
 
 
178
static int omap3_stalker_enable_tv(struct omap_dss_device *dssdev)
 
179
{
 
180
        return 0;
 
181
}
 
182
 
 
183
static void omap3_stalker_disable_tv(struct omap_dss_device *dssdev)
 
184
{
 
185
}
 
186
 
 
187
static struct omap_dss_device omap3_stalker_tv_device = {
 
188
        .name                   = "tv",
 
189
        .driver_name            = "venc",
 
190
        .type                   = OMAP_DISPLAY_TYPE_VENC,
 
191
#if defined(CONFIG_OMAP2_VENC_OUT_TYPE_SVIDEO)
 
192
        .phy.venc.type          = OMAP_DSS_VENC_TYPE_SVIDEO,
 
193
#elif defined(CONFIG_OMAP2_VENC_OUT_TYPE_COMPOSITE)
 
194
        .u.venc.type            = OMAP_DSS_VENC_TYPE_COMPOSITE,
 
195
#endif
 
196
        .platform_enable        = omap3_stalker_enable_tv,
 
197
        .platform_disable       = omap3_stalker_disable_tv,
 
198
};
 
199
 
 
200
static int omap3_stalker_enable_dvi(struct omap_dss_device *dssdev)
 
201
{
 
202
        if (lcd_enabled) {
 
203
                printk(KERN_ERR "cannot enable DVI, LCD is enabled\n");
 
204
                return -EINVAL;
 
205
        }
 
206
        gpio_set_value(DSS_ENABLE_GPIO, 1);
 
207
        dvi_enabled = 1;
 
208
        return 0;
 
209
}
 
210
 
 
211
static void omap3_stalker_disable_dvi(struct omap_dss_device *dssdev)
 
212
{
 
213
        gpio_set_value(DSS_ENABLE_GPIO, 0);
 
214
        dvi_enabled = 0;
 
215
}
 
216
 
 
217
static struct panel_generic_dpi_data dvi_panel = {
 
218
        .name                   = "generic",
 
219
        .platform_enable        = omap3_stalker_enable_dvi,
 
220
        .platform_disable       = omap3_stalker_disable_dvi,
 
221
};
 
222
 
 
223
static struct omap_dss_device omap3_stalker_dvi_device = {
 
224
        .name                   = "dvi",
 
225
        .type                   = OMAP_DISPLAY_TYPE_DPI,
 
226
        .driver_name            = "generic_dpi_panel",
 
227
        .data                   = &dvi_panel,
 
228
        .phy.dpi.data_lines     = 24,
 
229
};
 
230
 
 
231
static struct omap_dss_device *omap3_stalker_dss_devices[] = {
 
232
        &omap3_stalker_lcd_device,
 
233
        &omap3_stalker_tv_device,
 
234
        &omap3_stalker_dvi_device,
 
235
};
 
236
 
 
237
static struct omap_dss_board_info omap3_stalker_dss_data = {
 
238
        .num_devices    = ARRAY_SIZE(omap3_stalker_dss_devices),
 
239
        .devices        = omap3_stalker_dss_devices,
 
240
        .default_device = &omap3_stalker_dvi_device,
 
241
};
 
242
 
 
243
static struct platform_device omap3_stalker_dss_device = {
 
244
        .name   = "omapdss",
 
245
        .id     = -1,
 
246
        .dev    = {
 
247
                .platform_data  = &omap3_stalker_dss_data,
 
248
        },
 
249
};
 
250
 
 
251
static struct regulator_consumer_supply omap3stalker_vmmc1_supply = {
 
252
        .supply         = "vmmc",
 
253
};
 
254
 
 
255
static struct regulator_consumer_supply omap3stalker_vsim_supply = {
 
256
        .supply         = "vmmc_aux",
 
257
};
 
258
 
 
259
/* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */
 
260
static struct regulator_init_data omap3stalker_vmmc1 = {
 
261
        .constraints            = {
 
262
                .min_uV                 = 1850000,
 
263
                .max_uV                 = 3150000,
 
264
                .valid_modes_mask       = REGULATOR_MODE_NORMAL
 
265
                | REGULATOR_MODE_STANDBY,
 
266
                .valid_ops_mask         = REGULATOR_CHANGE_VOLTAGE
 
267
                | REGULATOR_CHANGE_MODE | REGULATOR_CHANGE_STATUS,
 
268
        },
 
269
        .num_consumer_supplies  = 1,
 
270
        .consumer_supplies      = &omap3stalker_vmmc1_supply,
 
271
};
 
272
 
 
273
/* VSIM for MMC1 pins DAT4..DAT7 (2 mA, plus card == max 50 mA) */
 
274
static struct regulator_init_data omap3stalker_vsim = {
 
275
        .constraints            = {
 
276
                .min_uV                 = 1800000,
 
277
                .max_uV                 = 3000000,
 
278
                .valid_modes_mask       = REGULATOR_MODE_NORMAL
 
279
                | REGULATOR_MODE_STANDBY,
 
280
                .valid_ops_mask         = REGULATOR_CHANGE_VOLTAGE
 
281
                | REGULATOR_CHANGE_MODE | REGULATOR_CHANGE_STATUS,
 
282
        },
 
283
        .num_consumer_supplies  = 1,
 
284
        .consumer_supplies      = &omap3stalker_vsim_supply,
 
285
};
 
286
 
 
287
static struct omap2_hsmmc_info mmc[] = {
 
288
        {
 
289
         .mmc           = 1,
 
290
         .caps          = MMC_CAP_4_BIT_DATA,
 
291
         .gpio_cd       = -EINVAL,
 
292
         .gpio_wp       = 23,
 
293
         },
 
294
        {}                      /* Terminator */
 
295
};
 
296
 
 
297
static struct gpio_keys_button gpio_buttons[] = {
 
298
        {
 
299
         .code          = BTN_EXTRA,
 
300
         .gpio          = 18,
 
301
         .desc          = "user",
 
302
         .wakeup        = 1,
 
303
         },
 
304
};
 
305
 
 
306
static struct gpio_keys_platform_data gpio_key_info = {
 
307
        .buttons        = gpio_buttons,
 
308
        .nbuttons       = ARRAY_SIZE(gpio_buttons),
 
309
};
 
310
 
 
311
static struct platform_device keys_gpio = {
 
312
        .name           = "gpio-keys",
 
313
        .id             = -1,
 
314
        .dev            = {
 
315
                .platform_data  = &gpio_key_info,
 
316
        },
 
317
};
 
318
 
 
319
static struct gpio_led gpio_leds[] = {
 
320
        {
 
321
         .name                  = "stalker:D8:usr0",
 
322
         .default_trigger       = "default-on",
 
323
         .gpio                  = 126,
 
324
         },
 
325
        {
 
326
         .name                  = "stalker:D9:usr1",
 
327
         .default_trigger       = "default-on",
 
328
         .gpio                  = 127,
 
329
         },
 
330
        {
 
331
         .name                  = "stalker:D3:mmc0",
 
332
         .gpio                  = -EINVAL,      /* gets replaced */
 
333
         .active_low            = true,
 
334
         .default_trigger       = "mmc0",
 
335
         },
 
336
        {
 
337
         .name                  = "stalker:D4:heartbeat",
 
338
         .gpio                  = -EINVAL,      /* gets replaced */
 
339
         .active_low            = true,
 
340
         .default_trigger       = "heartbeat",
 
341
         },
 
342
};
 
343
 
 
344
static struct gpio_led_platform_data gpio_led_info = {
 
345
        .leds           = gpio_leds,
 
346
        .num_leds       = ARRAY_SIZE(gpio_leds),
 
347
};
 
348
 
 
349
static struct platform_device leds_gpio = {
 
350
        .name   = "leds-gpio",
 
351
        .id     = -1,
 
352
        .dev    = {
 
353
                .platform_data  = &gpio_led_info,
 
354
        },
 
355
};
 
356
 
 
357
static int
 
358
omap3stalker_twl_gpio_setup(struct device *dev,
 
359
                            unsigned gpio, unsigned ngpio)
 
360
{
 
361
        /* gpio + 0 is "mmc0_cd" (input/IRQ) */
 
362
        omap_mux_init_gpio(23, OMAP_PIN_INPUT);
 
363
        mmc[0].gpio_cd = gpio + 0;
 
364
        omap2_hsmmc_init(mmc);
 
365
 
 
366
        /* link regulators to MMC adapters */
 
367
        omap3stalker_vmmc1_supply.dev = mmc[0].dev;
 
368
        omap3stalker_vsim_supply.dev = mmc[0].dev;
 
369
 
 
370
        /*
 
371
         * Most GPIOs are for USB OTG.  Some are mostly sent to
 
372
         * the P2 connector; notably LEDA for the LCD backlight.
 
373
         */
 
374
 
 
375
        /* TWL4030_GPIO_MAX + 0 == ledA, LCD Backlight control */
 
376
        gpio_request(gpio + TWL4030_GPIO_MAX, "EN_LCD_BKL");
 
377
        gpio_direction_output(gpio + TWL4030_GPIO_MAX, 0);
 
378
 
 
379
        /* gpio + 7 == DVI Enable */
 
380
        gpio_request(gpio + 7, "EN_DVI");
 
381
        gpio_direction_output(gpio + 7, 0);
 
382
 
 
383
        /* TWL4030_GPIO_MAX + 1 == ledB (out, mmc0) */
 
384
        gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1;
 
385
        /* GPIO + 13 == ledsync (out, heartbeat) */
 
386
        gpio_leds[3].gpio = gpio + 13;
 
387
 
 
388
        platform_device_register(&leds_gpio);
 
389
        return 0;
 
390
}
 
391
 
 
392
static struct twl4030_gpio_platform_data omap3stalker_gpio_data = {
 
393
        .gpio_base      = OMAP_MAX_GPIO_LINES,
 
394
        .irq_base       = TWL4030_GPIO_IRQ_BASE,
 
395
        .irq_end        = TWL4030_GPIO_IRQ_END,
 
396
        .use_leds       = true,
 
397
        .setup          = omap3stalker_twl_gpio_setup,
 
398
};
 
399
 
 
400
static struct twl4030_usb_data omap3stalker_usb_data = {
 
401
        .usb_mode       = T2_USB_MODE_ULPI,
 
402
};
 
403
 
 
404
static uint32_t board_keymap[] = {
 
405
        KEY(0, 0, KEY_LEFT),
 
406
        KEY(0, 1, KEY_DOWN),
 
407
        KEY(0, 2, KEY_ENTER),
 
408
        KEY(0, 3, KEY_M),
 
409
 
 
410
        KEY(1, 0, KEY_RIGHT),
 
411
        KEY(1, 1, KEY_UP),
 
412
        KEY(1, 2, KEY_I),
 
413
        KEY(1, 3, KEY_N),
 
414
 
 
415
        KEY(2, 0, KEY_A),
 
416
        KEY(2, 1, KEY_E),
 
417
        KEY(2, 2, KEY_J),
 
418
        KEY(2, 3, KEY_O),
 
419
 
 
420
        KEY(3, 0, KEY_B),
 
421
        KEY(3, 1, KEY_F),
 
422
        KEY(3, 2, KEY_K),
 
423
        KEY(3, 3, KEY_P)
 
424
};
 
425
 
 
426
static struct matrix_keymap_data board_map_data = {
 
427
        .keymap         = board_keymap,
 
428
        .keymap_size    = ARRAY_SIZE(board_keymap),
 
429
};
 
430
 
 
431
static struct twl4030_keypad_data omap3stalker_kp_data = {
 
432
        .keymap_data    = &board_map_data,
 
433
        .rows           = 4,
 
434
        .cols           = 4,
 
435
        .rep            = 1,
 
436
};
 
437
 
 
438
static struct twl4030_madc_platform_data omap3stalker_madc_data = {
 
439
        .irq_line       = 1,
 
440
};
 
441
 
 
442
static struct twl4030_codec_audio_data omap3stalker_audio_data = {
 
443
        .audio_mclk     = 26000000,
 
444
};
 
445
 
 
446
static struct twl4030_codec_data omap3stalker_codec_data = {
 
447
        .audio_mclk     = 26000000,
 
448
        .audio          = &omap3stalker_audio_data,
 
449
};
 
450
 
 
451
static struct regulator_consumer_supply omap3_stalker_vdda_dac_supply = {
 
452
        .supply         = "vdda_dac",
 
453
        .dev            = &omap3_stalker_dss_device.dev,
 
454
};
 
455
 
 
456
/* VDAC for DSS driving S-Video */
 
457
static struct regulator_init_data omap3_stalker_vdac = {
 
458
        .constraints            = {
 
459
                .min_uV                 = 1800000,
 
460
                .max_uV                 = 1800000,
 
461
                .apply_uV               = true,
 
462
                .valid_modes_mask       = REGULATOR_MODE_NORMAL
 
463
                | REGULATOR_MODE_STANDBY,
 
464
                .valid_ops_mask         = REGULATOR_CHANGE_MODE
 
465
                | REGULATOR_CHANGE_STATUS,
 
466
        },
 
467
        .num_consumer_supplies  = 1,
 
468
        .consumer_supplies      = &omap3_stalker_vdda_dac_supply,
 
469
};
 
470
 
 
471
/* VPLL2 for digital video outputs */
 
472
static struct regulator_consumer_supply omap3_stalker_vpll2_supply = {
 
473
        .supply         = "vdds_dsi",
 
474
        .dev            = &omap3_stalker_lcd_device.dev,
 
475
};
 
476
 
 
477
static struct regulator_init_data omap3_stalker_vpll2 = {
 
478
        .constraints            = {
 
479
                .name                   = "VDVI",
 
480
                .min_uV                 = 1800000,
 
481
                .max_uV                 = 1800000,
 
482
                .apply_uV = true,
 
483
                .valid_modes_mask       = REGULATOR_MODE_NORMAL
 
484
                | REGULATOR_MODE_STANDBY,
 
485
                .valid_ops_mask         = REGULATOR_CHANGE_MODE
 
486
                | REGULATOR_CHANGE_STATUS,
 
487
        },
 
488
        .num_consumer_supplies  = 1,
 
489
        .consumer_supplies      = &omap3_stalker_vpll2_supply,
 
490
};
 
491
 
 
492
static struct twl4030_platform_data omap3stalker_twldata = {
 
493
        .irq_base       = TWL4030_IRQ_BASE,
 
494
        .irq_end        = TWL4030_IRQ_END,
 
495
 
 
496
        /* platform_data for children goes here */
 
497
        .keypad         = &omap3stalker_kp_data,
 
498
        .madc           = &omap3stalker_madc_data,
 
499
        .usb            = &omap3stalker_usb_data,
 
500
        .gpio           = &omap3stalker_gpio_data,
 
501
        .codec          = &omap3stalker_codec_data,
 
502
        .vdac           = &omap3_stalker_vdac,
 
503
        .vpll2          = &omap3_stalker_vpll2,
 
504
};
 
505
 
 
506
static struct i2c_board_info __initdata omap3stalker_i2c_boardinfo[] = {
 
507
        {
 
508
         I2C_BOARD_INFO("twl4030", 0x48),
 
509
         .flags         = I2C_CLIENT_WAKE,
 
510
         .irq           = INT_34XX_SYS_NIRQ,
 
511
         .platform_data = &omap3stalker_twldata,
 
512
         },
 
513
};
 
514
 
 
515
static struct at24_platform_data fram_info = {
 
516
        .byte_len       = (64 * 1024) / 8,
 
517
        .page_size      = 8192,
 
518
        .flags          = AT24_FLAG_ADDR16 | AT24_FLAG_IRUGO,
 
519
};
 
520
 
 
521
static struct i2c_board_info __initdata omap3stalker_i2c_boardinfo3[] = {
 
522
        {
 
523
         I2C_BOARD_INFO("24c64", 0x50),
 
524
         .flags         = I2C_CLIENT_WAKE,
 
525
         .platform_data = &fram_info,
 
526
         },
 
527
};
 
528
 
 
529
static int __init omap3_stalker_i2c_init(void)
 
530
{
 
531
        /*
 
532
         * REVISIT: These entries can be set in omap3evm_twl_data
 
533
         * after a merge with MFD tree
 
534
         */
 
535
        omap3stalker_twldata.vmmc1 = &omap3stalker_vmmc1;
 
536
        omap3stalker_twldata.vsim = &omap3stalker_vsim;
 
537
 
 
538
        omap_register_i2c_bus(1, 2600, omap3stalker_i2c_boardinfo,
 
539
                              ARRAY_SIZE(omap3stalker_i2c_boardinfo));
 
540
        omap_register_i2c_bus(2, 400, NULL, 0);
 
541
        omap_register_i2c_bus(3, 400, omap3stalker_i2c_boardinfo3,
 
542
                              ARRAY_SIZE(omap3stalker_i2c_boardinfo3));
 
543
        return 0;
 
544
}
 
545
 
 
546
#define OMAP3_STALKER_TS_GPIO   175
 
547
static void ads7846_dev_init(void)
 
548
{
 
549
        if (gpio_request(OMAP3_STALKER_TS_GPIO, "ADS7846 pendown") < 0)
 
550
                printk(KERN_ERR "can't get ads7846 pen down GPIO\n");
 
551
 
 
552
        gpio_direction_input(OMAP3_STALKER_TS_GPIO);
 
553
        gpio_set_debounce(OMAP3_STALKER_TS_GPIO, 310);
 
554
}
 
555
 
 
556
static int ads7846_get_pendown_state(void)
 
557
{
 
558
        return !gpio_get_value(OMAP3_STALKER_TS_GPIO);
 
559
}
 
560
 
 
561
static struct ads7846_platform_data ads7846_config = {
 
562
        .x_max                  = 0x0fff,
 
563
        .y_max                  = 0x0fff,
 
564
        .x_plate_ohms           = 180,
 
565
        .pressure_max           = 255,
 
566
        .debounce_max           = 10,
 
567
        .debounce_tol           = 3,
 
568
        .debounce_rep           = 1,
 
569
        .get_pendown_state      = ads7846_get_pendown_state,
 
570
        .keep_vref_on           = 1,
 
571
        .settle_delay_usecs     = 150,
 
572
};
 
573
 
 
574
static struct omap2_mcspi_device_config ads7846_mcspi_config = {
 
575
        .turbo_mode             = 0,
 
576
        .single_channel         = 1,    /* 0: slave, 1: master */
 
577
};
 
578
 
 
579
static struct spi_board_info omap3stalker_spi_board_info[] = {
 
580
        [0] = {
 
581
               .modalias        = "ads7846",
 
582
               .bus_num         = 1,
 
583
               .chip_select     = 0,
 
584
               .max_speed_hz    = 1500000,
 
585
               .controller_data = &ads7846_mcspi_config,
 
586
               .irq             = OMAP_GPIO_IRQ(OMAP3_STALKER_TS_GPIO),
 
587
               .platform_data   = &ads7846_config,
 
588
        },
 
589
};
 
590
 
 
591
static struct omap_board_config_kernel omap3_stalker_config[] __initdata = {
 
592
};
 
593
 
 
594
static void __init omap3_stalker_init_irq(void)
 
595
{
 
596
        omap_board_config = omap3_stalker_config;
 
597
        omap_board_config_size = ARRAY_SIZE(omap3_stalker_config);
 
598
        omap2_init_common_infrastructure();
 
599
        omap2_init_common_devices(mt46h32m32lf6_sdrc_params, NULL);
 
600
        omap_init_irq();
 
601
#ifdef CONFIG_OMAP_32K_TIMER
 
602
        omap2_gp_clockevent_set_gptimer(12);
 
603
#endif
 
604
}
 
605
 
 
606
static struct platform_device *omap3_stalker_devices[] __initdata = {
 
607
        &omap3_stalker_dss_device,
 
608
        &keys_gpio,
 
609
};
 
610
 
 
611
static struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
 
612
        .port_mode[0] = EHCI_HCD_OMAP_MODE_UNKNOWN,
 
613
        .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY,
 
614
        .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
 
615
 
 
616
        .phy_reset = true,
 
617
        .reset_gpio_port[0] = -EINVAL,
 
618
        .reset_gpio_port[1] = 21,
 
619
        .reset_gpio_port[2] = -EINVAL,
 
620
};
 
621
 
 
622
#ifdef CONFIG_OMAP_MUX
 
623
static struct omap_board_mux board_mux[] __initdata = {
 
624
        OMAP3_MUX(SYS_NIRQ, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP |
 
625
                  OMAP_PIN_OFF_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE),
 
626
        OMAP3_MUX(MCSPI1_CS1, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP |
 
627
                  OMAP_PIN_OFF_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE),
 
628
        {.reg_offset = OMAP_MUX_TERMINATOR},
 
629
};
 
630
#endif
 
631
 
 
632
static struct omap_musb_board_data musb_board_data = {
 
633
        .interface_type = MUSB_INTERFACE_ULPI,
 
634
        .mode           = MUSB_OTG,
 
635
        .power          = 100,
 
636
};
 
637
 
 
638
static void __init omap3_stalker_init(void)
 
639
{
 
640
        omap3_mux_init(board_mux, OMAP_PACKAGE_CUS);
 
641
 
 
642
        omap3_stalker_i2c_init();
 
643
 
 
644
        platform_add_devices(omap3_stalker_devices,
 
645
                             ARRAY_SIZE(omap3_stalker_devices));
 
646
 
 
647
        spi_register_board_info(omap3stalker_spi_board_info,
 
648
                                ARRAY_SIZE(omap3stalker_spi_board_info));
 
649
 
 
650
        omap_serial_init();
 
651
        usb_musb_init(&musb_board_data);
 
652
        usb_ehci_init(&ehci_pdata);
 
653
        ads7846_dev_init();
 
654
 
 
655
        omap_mux_init_gpio(21, OMAP_PIN_OUTPUT);
 
656
        omap_mux_init_gpio(18, OMAP_PIN_INPUT_PULLUP);
 
657
 
 
658
        omap3stalker_init_eth();
 
659
        omap3_stalker_display_init();
 
660
/* Ensure SDRC pins are mux'd for self-refresh */
 
661
        omap_mux_init_signal("sdr_cke0", OMAP_PIN_OUTPUT);
 
662
        omap_mux_init_signal("sdr_cke1", OMAP_PIN_OUTPUT);
 
663
}
 
664
 
 
665
MACHINE_START(SBC3530, "OMAP3 STALKER")
 
666
        /* Maintainer: Jason Lam -lzg@ema-tech.com */
 
667
        .boot_params            = 0x80000100,
 
668
        .map_io                 = omap3_map_io,
 
669
        .init_irq               = omap3_stalker_init_irq,
 
670
        .init_machine           = omap3_stalker_init,
 
671
        .timer                  = &omap_timer,
 
672
MACHINE_END