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

« back to all changes in this revision

Viewing changes to arch/arm/mach-omap2/board-omap3evm.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:
22
22
#include <linux/input.h>
23
23
#include <linux/input/matrix_keypad.h>
24
24
#include <linux/leds.h>
 
25
#include <linux/interrupt.h>
25
26
 
26
27
#include <linux/spi/spi.h>
27
28
#include <linux/spi/ads7846.h>
28
 
#include <linux/i2c/twl4030.h>
 
29
#include <linux/i2c/twl.h>
29
30
#include <linux/usb/otg.h>
 
31
#include <linux/smsc911x.h>
 
32
 
 
33
#include <linux/regulator/machine.h>
 
34
#include <linux/mmc/host.h>
30
35
 
31
36
#include <mach/hardware.h>
32
37
#include <asm/mach-types.h>
33
38
#include <asm/mach/arch.h>
34
39
#include <asm/mach/map.h>
35
40
 
36
 
#include <mach/board.h>
37
 
#include <mach/mux.h>
38
 
#include <mach/usb.h>
39
 
#include <mach/common.h>
40
 
#include <mach/mcspi.h>
 
41
#include <plat/board.h>
 
42
#include <plat/usb.h>
 
43
#include <plat/common.h>
 
44
#include <plat/mcspi.h>
 
45
#include <plat/display.h>
 
46
#include <plat/panel-generic-dpi.h>
41
47
 
 
48
#include "mux.h"
42
49
#include "sdram-micron-mt46h32m32lf-6.h"
43
 
#include "mmc-twl4030.h"
 
50
#include "hsmmc.h"
44
51
 
45
52
#define OMAP3_EVM_TS_GPIO       175
 
53
#define OMAP3_EVM_EHCI_VBUS     22
 
54
#define OMAP3_EVM_EHCI_SELECT   61
46
55
 
47
56
#define OMAP3EVM_ETHR_START     0x2c000000
48
57
#define OMAP3EVM_ETHR_SIZE      1024
 
58
#define OMAP3EVM_ETHR_ID_REV    0x50
49
59
#define OMAP3EVM_ETHR_GPIO_IRQ  176
50
 
#define OMAP3EVM_SMC911X_CS     5
51
 
 
52
 
static struct resource omap3evm_smc911x_resources[] = {
 
60
#define OMAP3EVM_SMSC911X_CS    5
 
61
 
 
62
static u8 omap3_evm_version;
 
63
 
 
64
u8 get_omap3_evm_rev(void)
 
65
{
 
66
        return omap3_evm_version;
 
67
}
 
68
EXPORT_SYMBOL(get_omap3_evm_rev);
 
69
 
 
70
static void __init omap3_evm_get_revision(void)
 
71
{
 
72
        void __iomem *ioaddr;
 
73
        unsigned int smsc_id;
 
74
 
 
75
        /* Ethernet PHY ID is stored at ID_REV register */
 
76
        ioaddr = ioremap_nocache(OMAP3EVM_ETHR_START, SZ_1K);
 
77
        if (!ioaddr)
 
78
                return;
 
79
        smsc_id = readl(ioaddr + OMAP3EVM_ETHR_ID_REV) & 0xFFFF0000;
 
80
        iounmap(ioaddr);
 
81
 
 
82
        switch (smsc_id) {
 
83
        /*SMSC9115 chipset*/
 
84
        case 0x01150000:
 
85
                omap3_evm_version = OMAP3EVM_BOARD_GEN_1;
 
86
                break;
 
87
        /*SMSC 9220 chipset*/
 
88
        case 0x92200000:
 
89
        default:
 
90
                omap3_evm_version = OMAP3EVM_BOARD_GEN_2;
 
91
        }
 
92
}
 
93
 
 
94
#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
 
95
static struct resource omap3evm_smsc911x_resources[] = {
53
96
        [0] =   {
54
97
                .start  = OMAP3EVM_ETHR_START,
55
98
                .end    = (OMAP3EVM_ETHR_START + OMAP3EVM_ETHR_SIZE - 1),
58
101
        [1] =   {
59
102
                .start  = OMAP_GPIO_IRQ(OMAP3EVM_ETHR_GPIO_IRQ),
60
103
                .end    = OMAP_GPIO_IRQ(OMAP3EVM_ETHR_GPIO_IRQ),
61
 
                .flags  = IORESOURCE_IRQ,
 
104
                .flags  = (IORESOURCE_IRQ | IRQF_TRIGGER_LOW),
62
105
        },
63
106
};
64
107
 
65
 
static struct platform_device omap3evm_smc911x_device = {
66
 
        .name           = "smc911x",
 
108
static struct smsc911x_platform_config smsc911x_config = {
 
109
        .phy_interface  = PHY_INTERFACE_MODE_MII,
 
110
        .irq_polarity   = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
 
111
        .irq_type       = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
 
112
        .flags          = (SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS),
 
113
};
 
114
 
 
115
static struct platform_device omap3evm_smsc911x_device = {
 
116
        .name           = "smsc911x",
67
117
        .id             = -1,
68
 
        .num_resources  = ARRAY_SIZE(omap3evm_smc911x_resources),
69
 
        .resource       = &omap3evm_smc911x_resources[0],
 
118
        .num_resources  = ARRAY_SIZE(omap3evm_smsc911x_resources),
 
119
        .resource       = &omap3evm_smsc911x_resources[0],
 
120
        .dev            = {
 
121
                .platform_data = &smsc911x_config,
 
122
        },
70
123
};
71
124
 
72
 
static inline void __init omap3evm_init_smc911x(void)
 
125
static inline void __init omap3evm_init_smsc911x(void)
73
126
{
74
127
        int eth_cs;
75
128
        struct clk *l3ck;
76
129
        unsigned int rate;
77
130
 
78
 
        eth_cs = OMAP3EVM_SMC911X_CS;
 
131
        eth_cs = OMAP3EVM_SMSC911X_CS;
79
132
 
80
133
        l3ck = clk_get(NULL, "l3_ck");
81
134
        if (IS_ERR(l3ck))
83
136
        else
84
137
                rate = clk_get_rate(l3ck);
85
138
 
86
 
        if (gpio_request(OMAP3EVM_ETHR_GPIO_IRQ, "SMC911x irq") < 0) {
87
 
                printk(KERN_ERR "Failed to request GPIO%d for smc911x IRQ\n",
 
139
        if (gpio_request(OMAP3EVM_ETHR_GPIO_IRQ, "SMSC911x irq") < 0) {
 
140
                printk(KERN_ERR "Failed to request GPIO%d for smsc911x IRQ\n",
88
141
                        OMAP3EVM_ETHR_GPIO_IRQ);
89
142
                return;
90
143
        }
91
144
 
92
145
        gpio_direction_input(OMAP3EVM_ETHR_GPIO_IRQ);
93
 
}
94
 
 
95
 
static struct twl4030_hsmmc_info mmc[] = {
 
146
        platform_device_register(&omap3evm_smsc911x_device);
 
147
}
 
148
 
 
149
#else
 
150
static inline void __init omap3evm_init_smsc911x(void) { return; }
 
151
#endif
 
152
 
 
153
/*
 
154
 * OMAP3EVM LCD Panel control signals
 
155
 */
 
156
#define OMAP3EVM_LCD_PANEL_LR           2
 
157
#define OMAP3EVM_LCD_PANEL_UD           3
 
158
#define OMAP3EVM_LCD_PANEL_INI          152
 
159
#define OMAP3EVM_LCD_PANEL_ENVDD        153
 
160
#define OMAP3EVM_LCD_PANEL_QVGA         154
 
161
#define OMAP3EVM_LCD_PANEL_RESB         155
 
162
#define OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO 210
 
163
#define OMAP3EVM_DVI_PANEL_EN_GPIO      199
 
164
 
 
165
static int lcd_enabled;
 
166
static int dvi_enabled;
 
167
 
 
168
static void __init omap3_evm_display_init(void)
 
169
{
 
170
        int r;
 
171
 
 
172
        r = gpio_request(OMAP3EVM_LCD_PANEL_RESB, "lcd_panel_resb");
 
173
        if (r) {
 
174
                printk(KERN_ERR "failed to get lcd_panel_resb\n");
 
175
                return;
 
176
        }
 
177
        gpio_direction_output(OMAP3EVM_LCD_PANEL_RESB, 1);
 
178
 
 
179
        r = gpio_request(OMAP3EVM_LCD_PANEL_INI, "lcd_panel_ini");
 
180
        if (r) {
 
181
                printk(KERN_ERR "failed to get lcd_panel_ini\n");
 
182
                goto err_1;
 
183
        }
 
184
        gpio_direction_output(OMAP3EVM_LCD_PANEL_INI, 1);
 
185
 
 
186
        r = gpio_request(OMAP3EVM_LCD_PANEL_QVGA, "lcd_panel_qvga");
 
187
        if (r) {
 
188
                printk(KERN_ERR "failed to get lcd_panel_qvga\n");
 
189
                goto err_2;
 
190
        }
 
191
        gpio_direction_output(OMAP3EVM_LCD_PANEL_QVGA, 0);
 
192
 
 
193
        r = gpio_request(OMAP3EVM_LCD_PANEL_LR, "lcd_panel_lr");
 
194
        if (r) {
 
195
                printk(KERN_ERR "failed to get lcd_panel_lr\n");
 
196
                goto err_3;
 
197
        }
 
198
        gpio_direction_output(OMAP3EVM_LCD_PANEL_LR, 1);
 
199
 
 
200
        r = gpio_request(OMAP3EVM_LCD_PANEL_UD, "lcd_panel_ud");
 
201
        if (r) {
 
202
                printk(KERN_ERR "failed to get lcd_panel_ud\n");
 
203
                goto err_4;
 
204
        }
 
205
        gpio_direction_output(OMAP3EVM_LCD_PANEL_UD, 1);
 
206
 
 
207
        r = gpio_request(OMAP3EVM_LCD_PANEL_ENVDD, "lcd_panel_envdd");
 
208
        if (r) {
 
209
                printk(KERN_ERR "failed to get lcd_panel_envdd\n");
 
210
                goto err_5;
 
211
        }
 
212
        gpio_direction_output(OMAP3EVM_LCD_PANEL_ENVDD, 0);
 
213
 
 
214
        return;
 
215
 
 
216
err_5:
 
217
        gpio_free(OMAP3EVM_LCD_PANEL_UD);
 
218
err_4:
 
219
        gpio_free(OMAP3EVM_LCD_PANEL_LR);
 
220
err_3:
 
221
        gpio_free(OMAP3EVM_LCD_PANEL_QVGA);
 
222
err_2:
 
223
        gpio_free(OMAP3EVM_LCD_PANEL_INI);
 
224
err_1:
 
225
        gpio_free(OMAP3EVM_LCD_PANEL_RESB);
 
226
 
 
227
}
 
228
 
 
229
static int omap3_evm_enable_lcd(struct omap_dss_device *dssdev)
 
230
{
 
231
        if (dvi_enabled) {
 
232
                printk(KERN_ERR "cannot enable LCD, DVI is enabled\n");
 
233
                return -EINVAL;
 
234
        }
 
235
        gpio_set_value(OMAP3EVM_LCD_PANEL_ENVDD, 0);
 
236
 
 
237
        if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2)
 
238
                gpio_set_value(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 0);
 
239
        else
 
240
                gpio_set_value(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 1);
 
241
 
 
242
        lcd_enabled = 1;
 
243
        return 0;
 
244
}
 
245
 
 
246
static void omap3_evm_disable_lcd(struct omap_dss_device *dssdev)
 
247
{
 
248
        gpio_set_value(OMAP3EVM_LCD_PANEL_ENVDD, 1);
 
249
 
 
250
        if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2)
 
251
                gpio_set_value(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 1);
 
252
        else
 
253
                gpio_set_value(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 0);
 
254
 
 
255
        lcd_enabled = 0;
 
256
}
 
257
 
 
258
static struct omap_dss_device omap3_evm_lcd_device = {
 
259
        .name                   = "lcd",
 
260
        .driver_name            = "sharp_ls_panel",
 
261
        .type                   = OMAP_DISPLAY_TYPE_DPI,
 
262
        .phy.dpi.data_lines     = 18,
 
263
        .platform_enable        = omap3_evm_enable_lcd,
 
264
        .platform_disable       = omap3_evm_disable_lcd,
 
265
};
 
266
 
 
267
static int omap3_evm_enable_tv(struct omap_dss_device *dssdev)
 
268
{
 
269
        return 0;
 
270
}
 
271
 
 
272
static void omap3_evm_disable_tv(struct omap_dss_device *dssdev)
 
273
{
 
274
}
 
275
 
 
276
static struct omap_dss_device omap3_evm_tv_device = {
 
277
        .name                   = "tv",
 
278
        .driver_name            = "venc",
 
279
        .type                   = OMAP_DISPLAY_TYPE_VENC,
 
280
        .phy.venc.type          = OMAP_DSS_VENC_TYPE_SVIDEO,
 
281
        .platform_enable        = omap3_evm_enable_tv,
 
282
        .platform_disable       = omap3_evm_disable_tv,
 
283
};
 
284
 
 
285
static int omap3_evm_enable_dvi(struct omap_dss_device *dssdev)
 
286
{
 
287
        if (lcd_enabled) {
 
288
                printk(KERN_ERR "cannot enable DVI, LCD is enabled\n");
 
289
                return -EINVAL;
 
290
        }
 
291
 
 
292
        gpio_set_value(OMAP3EVM_DVI_PANEL_EN_GPIO, 1);
 
293
 
 
294
        dvi_enabled = 1;
 
295
        return 0;
 
296
}
 
297
 
 
298
static void omap3_evm_disable_dvi(struct omap_dss_device *dssdev)
 
299
{
 
300
        gpio_set_value(OMAP3EVM_DVI_PANEL_EN_GPIO, 0);
 
301
 
 
302
        dvi_enabled = 0;
 
303
}
 
304
 
 
305
static struct panel_generic_dpi_data dvi_panel = {
 
306
        .name                   = "generic",
 
307
        .platform_enable        = omap3_evm_enable_dvi,
 
308
        .platform_disable       = omap3_evm_disable_dvi,
 
309
};
 
310
 
 
311
static struct omap_dss_device omap3_evm_dvi_device = {
 
312
        .name                   = "dvi",
 
313
        .type                   = OMAP_DISPLAY_TYPE_DPI,
 
314
        .driver_name            = "generic_dpi_panel",
 
315
        .data                   = &dvi_panel,
 
316
        .phy.dpi.data_lines     = 24,
 
317
};
 
318
 
 
319
static struct omap_dss_device *omap3_evm_dss_devices[] = {
 
320
        &omap3_evm_lcd_device,
 
321
        &omap3_evm_tv_device,
 
322
        &omap3_evm_dvi_device,
 
323
};
 
324
 
 
325
static struct omap_dss_board_info omap3_evm_dss_data = {
 
326
        .num_devices    = ARRAY_SIZE(omap3_evm_dss_devices),
 
327
        .devices        = omap3_evm_dss_devices,
 
328
        .default_device = &omap3_evm_lcd_device,
 
329
};
 
330
 
 
331
static struct platform_device omap3_evm_dss_device = {
 
332
        .name           = "omapdss",
 
333
        .id             = -1,
 
334
        .dev            = {
 
335
                .platform_data = &omap3_evm_dss_data,
 
336
        },
 
337
};
 
338
 
 
339
static struct regulator_consumer_supply omap3evm_vmmc1_supply = {
 
340
        .supply                 = "vmmc",
 
341
};
 
342
 
 
343
static struct regulator_consumer_supply omap3evm_vsim_supply = {
 
344
        .supply                 = "vmmc_aux",
 
345
};
 
346
 
 
347
/* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */
 
348
static struct regulator_init_data omap3evm_vmmc1 = {
 
349
        .constraints = {
 
350
                .min_uV                 = 1850000,
 
351
                .max_uV                 = 3150000,
 
352
                .valid_modes_mask       = REGULATOR_MODE_NORMAL
 
353
                                        | REGULATOR_MODE_STANDBY,
 
354
                .valid_ops_mask         = REGULATOR_CHANGE_VOLTAGE
 
355
                                        | REGULATOR_CHANGE_MODE
 
356
                                        | REGULATOR_CHANGE_STATUS,
 
357
        },
 
358
        .num_consumer_supplies  = 1,
 
359
        .consumer_supplies      = &omap3evm_vmmc1_supply,
 
360
};
 
361
 
 
362
/* VSIM for MMC1 pins DAT4..DAT7 (2 mA, plus card == max 50 mA) */
 
363
static struct regulator_init_data omap3evm_vsim = {
 
364
        .constraints = {
 
365
                .min_uV                 = 1800000,
 
366
                .max_uV                 = 3000000,
 
367
                .valid_modes_mask       = REGULATOR_MODE_NORMAL
 
368
                                        | REGULATOR_MODE_STANDBY,
 
369
                .valid_ops_mask         = REGULATOR_CHANGE_VOLTAGE
 
370
                                        | REGULATOR_CHANGE_MODE
 
371
                                        | REGULATOR_CHANGE_STATUS,
 
372
        },
 
373
        .num_consumer_supplies  = 1,
 
374
        .consumer_supplies      = &omap3evm_vsim_supply,
 
375
};
 
376
 
 
377
static struct omap2_hsmmc_info mmc[] = {
96
378
        {
97
379
                .mmc            = 1,
98
 
                .wires          = 4,
 
380
                .caps           = MMC_CAP_4_BIT_DATA,
99
381
                .gpio_cd        = -EINVAL,
100
382
                .gpio_wp        = 63,
101
383
        },
130
412
                unsigned gpio, unsigned ngpio)
131
413
{
132
414
        /* gpio + 0 is "mmc0_cd" (input/IRQ) */
133
 
        omap_cfg_reg(L8_34XX_GPIO63);
 
415
        omap_mux_init_gpio(63, OMAP_PIN_INPUT);
134
416
        mmc[0].gpio_cd = gpio + 0;
135
 
        twl4030_mmc_init(mmc);
 
417
        omap2_hsmmc_init(mmc);
 
418
 
 
419
        /* link regulators to MMC adapters */
 
420
        omap3evm_vmmc1_supply.dev = mmc[0].dev;
 
421
        omap3evm_vsim_supply.dev = mmc[0].dev;
136
422
 
137
423
        /*
138
424
         * Most GPIOs are for USB OTG.  Some are mostly sent to
139
425
         * the P2 connector; notably LEDA for the LCD backlight.
140
426
         */
141
427
 
 
428
        /* TWL4030_GPIO_MAX + 0 == ledA, LCD Backlight control */
 
429
        gpio_request(gpio + TWL4030_GPIO_MAX, "EN_LCD_BKL");
 
430
        gpio_direction_output(gpio + TWL4030_GPIO_MAX, 0);
 
431
 
 
432
        /* gpio + 7 == DVI Enable */
 
433
        gpio_request(gpio + 7, "EN_DVI");
 
434
        gpio_direction_output(gpio + 7, 0);
 
435
 
142
436
        /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */
143
437
        gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1;
144
438
 
159
453
        .usb_mode       = T2_USB_MODE_ULPI,
160
454
};
161
455
 
162
 
static int board_keymap[] = {
 
456
static uint32_t board_keymap[] = {
163
457
        KEY(0, 0, KEY_LEFT),
164
 
        KEY(0, 1, KEY_RIGHT),
165
 
        KEY(0, 2, KEY_A),
166
 
        KEY(0, 3, KEY_B),
167
 
        KEY(1, 0, KEY_DOWN),
 
458
        KEY(0, 1, KEY_DOWN),
 
459
        KEY(0, 2, KEY_ENTER),
 
460
        KEY(0, 3, KEY_M),
 
461
 
 
462
        KEY(1, 0, KEY_RIGHT),
168
463
        KEY(1, 1, KEY_UP),
169
 
        KEY(1, 2, KEY_E),
170
 
        KEY(1, 3, KEY_F),
171
 
        KEY(2, 0, KEY_ENTER),
172
 
        KEY(2, 1, KEY_I),
 
464
        KEY(1, 2, KEY_I),
 
465
        KEY(1, 3, KEY_N),
 
466
 
 
467
        KEY(2, 0, KEY_A),
 
468
        KEY(2, 1, KEY_E),
173
469
        KEY(2, 2, KEY_J),
174
 
        KEY(2, 3, KEY_K),
175
 
        KEY(3, 0, KEY_M),
176
 
        KEY(3, 1, KEY_N),
177
 
        KEY(3, 2, KEY_O),
 
470
        KEY(2, 3, KEY_O),
 
471
 
 
472
        KEY(3, 0, KEY_B),
 
473
        KEY(3, 1, KEY_F),
 
474
        KEY(3, 2, KEY_K),
178
475
        KEY(3, 3, KEY_P)
179
476
};
180
477
 
194
491
        .irq_line       = 1,
195
492
};
196
493
 
 
494
static struct twl4030_codec_audio_data omap3evm_audio_data = {
 
495
        .audio_mclk = 26000000,
 
496
};
 
497
 
 
498
static struct twl4030_codec_data omap3evm_codec_data = {
 
499
        .audio_mclk = 26000000,
 
500
        .audio = &omap3evm_audio_data,
 
501
};
 
502
 
 
503
static struct regulator_consumer_supply omap3_evm_vdda_dac_supply = {
 
504
        .supply         = "vdda_dac",
 
505
        .dev            = &omap3_evm_dss_device.dev,
 
506
};
 
507
 
 
508
/* VDAC for DSS driving S-Video */
 
509
static struct regulator_init_data omap3_evm_vdac = {
 
510
        .constraints = {
 
511
                .min_uV                 = 1800000,
 
512
                .max_uV                 = 1800000,
 
513
                .apply_uV               = true,
 
514
                .valid_modes_mask       = REGULATOR_MODE_NORMAL
 
515
                                        | REGULATOR_MODE_STANDBY,
 
516
                .valid_ops_mask         = REGULATOR_CHANGE_MODE
 
517
                                        | REGULATOR_CHANGE_STATUS,
 
518
        },
 
519
        .num_consumer_supplies  = 1,
 
520
        .consumer_supplies      = &omap3_evm_vdda_dac_supply,
 
521
};
 
522
 
 
523
/* VPLL2 for digital video outputs */
 
524
static struct regulator_consumer_supply omap3_evm_vpll2_supply =
 
525
        REGULATOR_SUPPLY("vdds_dsi", "omapdss");
 
526
 
 
527
static struct regulator_init_data omap3_evm_vpll2 = {
 
528
        .constraints = {
 
529
                .min_uV                 = 1800000,
 
530
                .max_uV                 = 1800000,
 
531
                .apply_uV               = true,
 
532
                .valid_modes_mask       = REGULATOR_MODE_NORMAL
 
533
                                        | REGULATOR_MODE_STANDBY,
 
534
                .valid_ops_mask         = REGULATOR_CHANGE_MODE
 
535
                                        | REGULATOR_CHANGE_STATUS,
 
536
        },
 
537
        .num_consumer_supplies  = 1,
 
538
        .consumer_supplies      = &omap3_evm_vpll2_supply,
 
539
};
 
540
 
197
541
static struct twl4030_platform_data omap3evm_twldata = {
198
542
        .irq_base       = TWL4030_IRQ_BASE,
199
543
        .irq_end        = TWL4030_IRQ_END,
203
547
        .madc           = &omap3evm_madc_data,
204
548
        .usb            = &omap3evm_usb_data,
205
549
        .gpio           = &omap3evm_gpio_data,
 
550
        .codec          = &omap3evm_codec_data,
 
551
        .vdac           = &omap3_evm_vdac,
 
552
        .vpll2          = &omap3_evm_vpll2,
206
553
};
207
554
 
208
555
static struct i2c_board_info __initdata omap3evm_i2c_boardinfo[] = {
216
563
 
217
564
static int __init omap3_evm_i2c_init(void)
218
565
{
 
566
        /*
 
567
         * REVISIT: These entries can be set in omap3evm_twl_data
 
568
         * after a merge with MFD tree
 
569
         */
 
570
        omap3evm_twldata.vmmc1 = &omap3evm_vmmc1;
 
571
        omap3evm_twldata.vsim = &omap3evm_vsim;
 
572
 
219
573
        omap_register_i2c_bus(1, 2600, omap3evm_i2c_boardinfo,
220
574
                        ARRAY_SIZE(omap3evm_i2c_boardinfo));
221
575
        omap_register_i2c_bus(2, 400, NULL, 0);
223
577
        return 0;
224
578
}
225
579
 
226
 
static struct platform_device omap3_evm_lcd_device = {
227
 
        .name           = "omap3evm_lcd",
228
 
        .id             = -1,
229
 
};
230
 
 
231
 
static struct omap_lcd_config omap3_evm_lcd_config __initdata = {
232
 
        .ctrl_name      = "internal",
233
 
};
234
 
 
235
580
static void ads7846_dev_init(void)
236
581
{
237
582
        if (gpio_request(OMAP3_EVM_TS_GPIO, "ADS7846 pendown") < 0)
238
583
                printk(KERN_ERR "can't get ads7846 pen down GPIO\n");
239
584
 
240
585
        gpio_direction_input(OMAP3_EVM_TS_GPIO);
241
 
 
242
 
        omap_set_gpio_debounce(OMAP3_EVM_TS_GPIO, 1);
243
 
        omap_set_gpio_debounce_time(OMAP3_EVM_TS_GPIO, 0xa);
 
586
        gpio_set_debounce(OMAP3_EVM_TS_GPIO, 310);
244
587
}
245
588
 
246
589
static int ads7846_get_pendown_state(void)
248
591
        return !gpio_get_value(OMAP3_EVM_TS_GPIO);
249
592
}
250
593
 
251
 
struct ads7846_platform_data ads7846_config = {
 
594
static struct ads7846_platform_data ads7846_config = {
252
595
        .x_max                  = 0x0fff,
253
596
        .y_max                  = 0x0fff,
254
597
        .x_plate_ohms           = 180,
259
602
        .get_pendown_state      = ads7846_get_pendown_state,
260
603
        .keep_vref_on           = 1,
261
604
        .settle_delay_usecs     = 150,
 
605
        .wakeup                         = true,
262
606
};
263
607
 
264
608
static struct omap2_mcspi_device_config ads7846_mcspi_config = {
266
610
        .single_channel = 1,    /* 0: slave, 1: master */
267
611
};
268
612
 
269
 
struct spi_board_info omap3evm_spi_board_info[] = {
 
613
static struct spi_board_info omap3evm_spi_board_info[] = {
270
614
        [0] = {
271
615
                .modalias               = "ads7846",
272
616
                .bus_num                = 1,
279
623
};
280
624
 
281
625
static struct omap_board_config_kernel omap3_evm_config[] __initdata = {
282
 
        { OMAP_TAG_LCD,         &omap3_evm_lcd_config },
283
626
};
284
627
 
285
628
static void __init omap3_evm_init_irq(void)
286
629
{
287
630
        omap_board_config = omap3_evm_config;
288
631
        omap_board_config_size = ARRAY_SIZE(omap3_evm_config);
289
 
        omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL);
 
632
        omap2_init_common_infrastructure();
 
633
        omap2_init_common_devices(mt46h32m32lf6_sdrc_params, NULL);
290
634
        omap_init_irq();
291
 
        omap_gpio_init();
292
 
        omap3evm_init_smc911x();
293
635
}
294
636
 
295
637
static struct platform_device *omap3_evm_devices[] __initdata = {
296
 
        &omap3_evm_lcd_device,
297
 
        &omap3evm_smc911x_device,
 
638
        &omap3_evm_dss_device,
 
639
};
 
640
 
 
641
static struct ehci_hcd_omap_platform_data ehci_pdata __initdata = {
 
642
 
 
643
        .port_mode[0] = EHCI_HCD_OMAP_MODE_UNKNOWN,
 
644
        .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY,
 
645
        .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
 
646
 
 
647
        .phy_reset  = true,
 
648
        /* PHY reset GPIO will be runtime programmed based on EVM version */
 
649
        .reset_gpio_port[0]  = -EINVAL,
 
650
        .reset_gpio_port[1]  = -EINVAL,
 
651
        .reset_gpio_port[2]  = -EINVAL
 
652
};
 
653
 
 
654
#ifdef CONFIG_OMAP_MUX
 
655
static struct omap_board_mux board_mux[] __initdata = {
 
656
        OMAP3_MUX(SYS_NIRQ, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP |
 
657
                                OMAP_PIN_OFF_INPUT_PULLUP | OMAP_PIN_OFF_OUTPUT_LOW |
 
658
                                OMAP_PIN_OFF_WAKEUPENABLE),
 
659
        OMAP3_MUX(MCSPI1_CS1, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP |
 
660
                                OMAP_PIN_OFF_INPUT_PULLUP | OMAP_PIN_OFF_OUTPUT_LOW),
 
661
        { .reg_offset = OMAP_MUX_TERMINATOR },
 
662
};
 
663
#endif
 
664
 
 
665
static struct omap_musb_board_data musb_board_data = {
 
666
        .interface_type         = MUSB_INTERFACE_ULPI,
 
667
        .mode                   = MUSB_OTG,
 
668
        .power                  = 100,
298
669
};
299
670
 
300
671
static void __init omap3_evm_init(void)
301
672
{
 
673
        omap3_evm_get_revision();
 
674
        omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
 
675
 
302
676
        omap3_evm_i2c_init();
303
677
 
304
678
        platform_add_devices(omap3_evm_devices, ARRAY_SIZE(omap3_evm_devices));
307
681
                                ARRAY_SIZE(omap3evm_spi_board_info));
308
682
 
309
683
        omap_serial_init();
310
 
#ifdef CONFIG_NOP_USB_XCEIV
 
684
 
311
685
        /* OMAP3EVM uses ISP1504 phy and so register nop transceiver */
312
686
        usb_nop_xceiv_register();
313
 
#endif
314
 
        usb_musb_init();
 
687
 
 
688
        if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) {
 
689
                /* enable EHCI VBUS using GPIO22 */
 
690
                omap_mux_init_gpio(22, OMAP_PIN_INPUT_PULLUP);
 
691
                gpio_request(OMAP3_EVM_EHCI_VBUS, "enable EHCI VBUS");
 
692
                gpio_direction_output(OMAP3_EVM_EHCI_VBUS, 0);
 
693
                gpio_set_value(OMAP3_EVM_EHCI_VBUS, 1);
 
694
 
 
695
                /* Select EHCI port on main board */
 
696
                omap_mux_init_gpio(61, OMAP_PIN_INPUT_PULLUP);
 
697
                gpio_request(OMAP3_EVM_EHCI_SELECT, "select EHCI port");
 
698
                gpio_direction_output(OMAP3_EVM_EHCI_SELECT, 0);
 
699
                gpio_set_value(OMAP3_EVM_EHCI_SELECT, 0);
 
700
 
 
701
                /* setup EHCI phy reset config */
 
702
                omap_mux_init_gpio(21, OMAP_PIN_INPUT_PULLUP);
 
703
                ehci_pdata.reset_gpio_port[1] = 21;
 
704
 
 
705
                /* EVM REV >= E can supply 500mA with EXTVBUS programming */
 
706
                musb_board_data.power = 500;
 
707
                musb_board_data.extvbus = 1;
 
708
        } else {
 
709
                /* setup EHCI phy reset on MDC */
 
710
                omap_mux_init_gpio(135, OMAP_PIN_OUTPUT);
 
711
                ehci_pdata.reset_gpio_port[1] = 135;
 
712
        }
 
713
        usb_musb_init(&musb_board_data);
 
714
        usb_ehci_init(&ehci_pdata);
315
715
        ads7846_dev_init();
316
 
}
317
 
 
318
 
static void __init omap3_evm_map_io(void)
319
 
{
320
 
        omap2_set_globals_343x();
321
 
        omap2_map_common_io();
 
716
        omap3evm_init_smsc911x();
 
717
        omap3_evm_display_init();
322
718
}
323
719
 
324
720
MACHINE_START(OMAP3EVM, "OMAP3 EVM")
325
721
        /* Maintainer: Syed Mohammed Khasim - Texas Instruments */
326
 
        .phys_io        = 0x48000000,
327
 
        .io_pg_offst    = ((0xd8000000) >> 18) & 0xfffc,
328
722
        .boot_params    = 0x80000100,
329
 
        .map_io         = omap3_evm_map_io,
 
723
        .map_io         = omap3_map_io,
 
724
        .reserve        = omap_reserve,
330
725
        .init_irq       = omap3_evm_init_irq,
331
726
        .init_machine   = omap3_evm_init,
332
727
        .timer          = &omap_timer,