arm: tegra: enterprise: enable i2s3 and bt device
[linux-2.6.git] / arch / arm / mach-tegra / board-enterprise.c
1 /*
2  * arch/arm/mach-tegra/board-enterprise.c
3  *
4  * Copyright (c) 2011, NVIDIA Corporation.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
14  * more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19  */
20
21 #include <linux/kernel.h>
22 #include <linux/init.h>
23 #include <linux/slab.h>
24 #include <linux/ctype.h>
25 #include <linux/platform_device.h>
26 #include <linux/clk.h>
27 #include <linux/serial_8250.h>
28 #include <linux/i2c.h>
29 #include <linux/dma-mapping.h>
30 #include <linux/delay.h>
31 #include <linux/i2c-tegra.h>
32 #include <linux/gpio.h>
33 #include <linux/input.h>
34 #include <linux/platform_data/tegra_usb.h>
35 #include <linux/spi/spi.h>
36 #include <linux/tegra_uart.h>
37 #include <linux/fsl_devices.h>
38 #include <linux/i2c/atmel_mxt_ts.h>
39
40 #include <linux/nfc/pn544.h>
41 #include <sound/max98088.h>
42
43 #include <mach/clk.h>
44 #include <mach/iomap.h>
45 #include <mach/irqs.h>
46 #include <mach/pinmux.h>
47 #include <mach/iomap.h>
48 #include <mach/io.h>
49 #include <asm/mach-types.h>
50 #include <asm/mach/arch.h>
51 #include <mach/usb_phy.h>
52 #include <mach/i2s.h>
53 #include <mach/tegra_max98088_pdata.h>
54
55 #include "board.h"
56 #include "clock.h"
57 #include "board-enterprise.h"
58 #include "devices.h"
59 #include "gpio-names.h"
60 #include "fuse.h"
61 #include "pm.h"
62
63 /* !!!TODO: Change for enterprise (Taken from Cardhu) */
64 static struct tegra_utmip_config utmi_phy_config[] = {
65         [0] = {
66                         .hssync_start_delay = 0,
67                         .idle_wait_delay = 17,
68                         .elastic_limit = 16,
69                         .term_range_adj = 6,
70                         .xcvr_setup = 15,
71                         .xcvr_setup_offset = 0,
72                         .xcvr_use_fuses = 1,
73                         .xcvr_lsfslew = 2,
74                         .xcvr_lsrslew = 2,
75         },
76         [1] = {
77                         .hssync_start_delay = 0,
78                         .idle_wait_delay = 17,
79                         .elastic_limit = 16,
80                         .term_range_adj = 6,
81                         .xcvr_setup = 15,
82                         .xcvr_setup_offset = 0,
83                         .xcvr_use_fuses = 1,
84                         .xcvr_lsfslew = 2,
85                         .xcvr_lsrslew = 2,
86         },
87         [2] = {
88                         .hssync_start_delay = 0,
89                         .idle_wait_delay = 17,
90                         .elastic_limit = 16,
91                         .term_range_adj = 6,
92                         .xcvr_setup = 8,
93                         .xcvr_setup_offset = 0,
94                         .xcvr_use_fuses = 1,
95                         .xcvr_lsfslew = 2,
96                         .xcvr_lsrslew = 2,
97         },
98 };
99
100 #ifdef CONFIG_BCM4329_RFKILL
101 static struct resource enterprise_bcm4329_rfkill_resources[] = {
102         {
103                 .name   = "bcm4329_nshutdown_gpio",
104                 .start  = TEGRA_GPIO_PE6,
105                 .end    = TEGRA_GPIO_PE6,
106                 .flags  = IORESOURCE_IO,
107         },
108 };
109
110 static struct platform_device enterprise_bcm4329_rfkill_device = {
111         .name = "bcm4329_rfkill",
112         .id             = -1,
113         .num_resources  = ARRAY_SIZE(enterprise_bcm4329_rfkill_resources),
114         .resource       = enterprise_bcm4329_rfkill_resources,
115 };
116
117 static noinline void __init enterprise_bt_rfkill(void)
118 {
119         platform_device_register(&enterprise_bcm4329_rfkill_device);
120
121         return;
122 }
123 #else
124 static inline void enterprise_bt_rfkill(void) { }
125 #endif
126
127 static void __init enterprise_setup_bluesleep(void)
128 {
129         struct platform_device *pdev = NULL;
130         struct resource *res;
131
132         pdev = platform_device_alloc("bluesleep", 0);
133         if (!pdev) {
134                 pr_err("unable to allocate platform device for bluesleep");
135                 return;
136         }
137
138         res = kzalloc(sizeof(struct resource) * 3, GFP_KERNEL);
139         if (!res) {
140                 pr_err("unable to allocate resource for bluesleep\n");
141                 goto err_free_dev;
142         }
143
144         res[0].name   = "gpio_host_wake";
145         res[0].start  = TEGRA_GPIO_PS2;
146         res[0].end    = TEGRA_GPIO_PS2;
147         res[0].flags  = IORESOURCE_IO;
148
149         res[1].name   = "gpio_ext_wake";
150         res[1].start  = TEGRA_GPIO_PE7;
151         res[1].end    = TEGRA_GPIO_PE7;
152         res[1].flags  = IORESOURCE_IO;
153
154         res[2].name   = "host_wake";
155         res[2].start  = gpio_to_irq(TEGRA_GPIO_PS2);
156         res[2].end    = gpio_to_irq(TEGRA_GPIO_PS2);
157         res[2].flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE ;
158
159         if (platform_device_add_resources(pdev, res, 3)) {
160                 pr_err("unable to add resources to bluesleep device\n");
161                 goto err_free_res;
162         }
163
164         if (platform_device_add(pdev)) {
165                 pr_err("unable to add bluesleep device\n");
166                 goto err_free_res;
167         }
168         tegra_gpio_enable(TEGRA_GPIO_PS2);
169         tegra_gpio_enable(TEGRA_GPIO_PE7);
170
171         return;
172
173 err_free_res:
174         kfree(res);
175 err_free_dev:
176         platform_device_put(pdev);
177         return;
178 }
179
180 static __initdata struct tegra_clk_init_table enterprise_clk_init_table[] = {
181         /* name         parent          rate            enabled */
182         { "pll_m",      NULL,           0,              false},
183         { "hda",        "pll_p",        108000000,      false},
184         { "hda2codec_2x","pll_p",       48000000,       false},
185         { "pwm",        "clk_32k",      32768,          false},
186         { "blink",      "clk_32k",      32768,          true},
187         { "pll_a",      NULL,           564480000,      false},
188         { "pll_a_out0", NULL,           11289600,       false},
189         { "i2s0",       "pll_a_out0",   0,              false},
190         { "i2s3",       "pll_a_out0",   0,              false},
191         { "spdif_out",  "pll_a_out0",   0,              false},
192         { "d_audio",    "pll_a_out0",   0,              false},
193         { "dam0",       "pll_a_out0",   0,              false},
194         { "dam1",       "pll_a_out0",   0,              false},
195         { "dam2",       "pll_a_out0",   0,              false},
196         { NULL,         NULL,           0,              0},
197 };
198
199 static struct tegra_i2c_platform_data enterprise_i2c1_platform_data = {
200         .adapter_nr     = 0,
201         .bus_count      = 1,
202         .bus_clk_rate   = { 100000, 0 },
203         .scl_gpio               = {TEGRA_GPIO_PC4, 0},
204         .sda_gpio               = {TEGRA_GPIO_PC5, 0},
205         .arb_recovery = arb_lost_recovery,
206 };
207
208 static struct tegra_i2c_platform_data enterprise_i2c2_platform_data = {
209         .adapter_nr     = 1,
210         .bus_count      = 1,
211         .bus_clk_rate   = { 100000, 0 },
212         .is_clkon_always = true,
213         .scl_gpio               = {TEGRA_GPIO_PT5, 0},
214         .sda_gpio               = {TEGRA_GPIO_PT6, 0},
215         .arb_recovery = arb_lost_recovery,
216 };
217
218 static struct tegra_i2c_platform_data enterprise_i2c3_platform_data = {
219         .adapter_nr     = 2,
220         .bus_count      = 1,
221         .bus_clk_rate   = { 100000, 0 },
222         .scl_gpio               = {TEGRA_GPIO_PBB1, 0},
223         .sda_gpio               = {TEGRA_GPIO_PBB2, 0},
224         .arb_recovery = arb_lost_recovery,
225 };
226
227 static struct tegra_i2c_platform_data enterprise_i2c4_platform_data = {
228         .adapter_nr     = 3,
229         .bus_count      = 1,
230         .bus_clk_rate   = { 100000, 0 },
231         .scl_gpio               = {TEGRA_GPIO_PV4, 0},
232         .sda_gpio               = {TEGRA_GPIO_PV5, 0},
233         .arb_recovery = arb_lost_recovery,
234 };
235
236 static struct tegra_i2c_platform_data enterprise_i2c5_platform_data = {
237         .adapter_nr     = 4,
238         .bus_count      = 1,
239         .bus_clk_rate   = { 100000, 0 },
240         .scl_gpio               = {TEGRA_GPIO_PZ6, 0},
241         .sda_gpio               = {TEGRA_GPIO_PZ7, 0},
242         .arb_recovery = arb_lost_recovery,
243 };
244
245 /* Equalizer filter coefs generated from the MAXIM MAX98088
246  * evkit software tool */
247 static struct max98088_eq_cfg max98088_eq_cfg[] = {
248         {
249                 .name = "FLAT",
250                 .rate = 44100,
251                 .band1 = {0x2000, 0xC002, 0x4000, 0x00E9, 0x0000},
252                 .band2 = {0x2000, 0xC00F, 0x4000, 0x02BC, 0x0000},
253                 .band3 = {0x2000, 0xC0A7, 0x4000, 0x0916, 0x0000},
254                 .band4 = {0x2000, 0xC5C2, 0x4000, 0x1A87, 0x0000},
255                 .band5 = {0x2000, 0xF6B0, 0x4000, 0x3F51, 0x0000},
256         },
257         {
258                 .name = "LOWPASS1K",
259                 .rate = 44100,
260                 .band1 = {0x205D, 0xC001, 0x3FEF, 0x002E, 0x02E0},
261                 .band2 = {0x5B9A, 0xC093, 0x3AB2, 0x088B, 0x1981},
262                 .band3 = {0x0D22, 0xC170, 0x26EA, 0x0D79, 0x32CF},
263                 .band4 = {0x0894, 0xC612, 0x01B3, 0x1B34, 0x3FFA},
264                 .band5 = {0x0815, 0x3FFF, 0xCF78, 0x0000, 0x29B7},
265         },
266         { /* BASS=-12dB, TREBLE=+9dB, Fc=5KHz */
267                 .name = "HIBOOST",
268                 .rate = 44100,
269                 .band1 = {0x0815, 0xC001, 0x3AA4, 0x0003, 0x19A2},
270                 .band2 = {0x0815, 0xC103, 0x092F, 0x0B55, 0x3F56},
271                 .band3 = {0x0E0A, 0xC306, 0x1E5C, 0x136E, 0x3856},
272                 .band4 = {0x2459, 0xF665, 0x0CAA, 0x3F46, 0x3EBB},
273                 .band5 = {0x5BBB, 0x3FFF, 0xCEB0, 0x0000, 0x28CA},
274         },
275         { /* BASS=12dB, TREBLE=+12dB */
276                 .name = "LOUD12DB",
277                 .rate = 44100,
278                 .band1 = {0x7FC1, 0xC001, 0x3EE8, 0x0020, 0x0BC7},
279                 .band2 = {0x51E9, 0xC016, 0x3C7C, 0x033F, 0x14E9},
280                 .band3 = {0x1745, 0xC12C, 0x1680, 0x0C2F, 0x3BE9},
281                 .band4 = {0x4536, 0xD7E2, 0x0ED4, 0x31DD, 0x3E42},
282                 .band5 = {0x7FEF, 0x3FFF, 0x0BAB, 0x0000, 0x3EED},
283         },
284         {
285                 .name = "FLAT",
286                 .rate = 16000,
287                 .band1 = {0x2000, 0xC004, 0x4000, 0x0141, 0x0000},
288                 .band2 = {0x2000, 0xC033, 0x4000, 0x0505, 0x0000},
289                 .band3 = {0x2000, 0xC268, 0x4000, 0x115F, 0x0000},
290                 .band4 = {0x2000, 0xDA62, 0x4000, 0x33C6, 0x0000},
291                 .band5 = {0x2000, 0x4000, 0x4000, 0x0000, 0x0000},
292         },
293         {
294                 .name = "LOWPASS1K",
295                 .rate = 16000,
296                 .band1 = {0x2000, 0xC004, 0x4000, 0x0141, 0x0000},
297                 .band2 = {0x5BE8, 0xC3E0, 0x3307, 0x15ED, 0x26A0},
298                 .band3 = {0x0F71, 0xD15A, 0x08B3, 0x2BD0, 0x3F67},
299                 .band4 = {0x0815, 0x3FFF, 0xCF78, 0x0000, 0x29B7},
300                 .band5 = {0x0815, 0x3FFF, 0xCF78, 0x0000, 0x29B7},
301         },
302         { /* BASS=-12dB, TREBLE=+9dB, Fc=2KHz */
303                 .name = "HIBOOST",
304                 .rate = 16000,
305                 .band1 = {0x0815, 0xC001, 0x3BD2, 0x0009, 0x16BF},
306                 .band2 = {0x080E, 0xC17E, 0xF653, 0x0DBD, 0x3F43},
307                 .band3 = {0x0F80, 0xDF45, 0xEE33, 0x36FE, 0x3D79},
308                 .band4 = {0x590B, 0x3FF0, 0xE882, 0x02BD, 0x3B87},
309                 .band5 = {0x4C87, 0xF3D0, 0x063F, 0x3ED4, 0x3FB1},
310         },
311         { /* BASS=12dB, TREBLE=+12dB */
312                 .name = "LOUD12DB",
313                 .rate = 16000,
314                 .band1 = {0x7FC1, 0xC001, 0x3D07, 0x0058, 0x1344},
315                 .band2 = {0x2DA6, 0xC013, 0x3CF1, 0x02FF, 0x138B},
316                 .band3 = {0x18F1, 0xC08E, 0x244D, 0x0863, 0x34B5},
317                 .band4 = {0x2BE0, 0xF385, 0x04FD, 0x3EC5, 0x3FCE},
318                 .band5 = {0x7FEF, 0x4000, 0x0BAB, 0x0000, 0x3EED},
319         },
320 };
321
322
323 static struct max98088_pdata enterprise_max98088_pdata = {
324         /* equalizer configuration */
325         .eq_cfg = max98088_eq_cfg,
326         .eq_cfgcnt = ARRAY_SIZE(max98088_eq_cfg),
327
328         /* debounce time */
329         .debounce_time_ms = 200,
330
331         /* microphone configuration */
332         .digmic_left_mode = 1,
333         .digmic_right_mode = 1,
334
335         /* receiver output configuration */
336         .receiver_mode = 0,     /* 0 = amplifier, 1 = line output */
337 };
338
339 static struct pn544_i2c_platform_data nfc_pdata = {
340                 .irq_gpio = TEGRA_GPIO_PS4,
341                 .ven_gpio = TEGRA_GPIO_PM6,
342                 .firm_gpio = 0,
343 };
344
345
346 static struct i2c_board_info __initdata max98088_board_info = {
347         I2C_BOARD_INFO("max98088", 0x10),
348         .platform_data = &enterprise_max98088_pdata,
349         .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_HP_DET),
350 };
351
352 static struct i2c_board_info __initdata nfc_board_info = {
353         I2C_BOARD_INFO("pn544", 0x28),
354         .platform_data = &nfc_pdata,
355         .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_PS4),
356 };
357
358 static void enterprise_i2c_init(void)
359 {
360         tegra_i2c_device1.dev.platform_data = &enterprise_i2c1_platform_data;
361         tegra_i2c_device2.dev.platform_data = &enterprise_i2c2_platform_data;
362         tegra_i2c_device3.dev.platform_data = &enterprise_i2c3_platform_data;
363         tegra_i2c_device4.dev.platform_data = &enterprise_i2c4_platform_data;
364         tegra_i2c_device5.dev.platform_data = &enterprise_i2c5_platform_data;
365
366         platform_device_register(&tegra_i2c_device5);
367         platform_device_register(&tegra_i2c_device4);
368         platform_device_register(&tegra_i2c_device3);
369         platform_device_register(&tegra_i2c_device2);
370         platform_device_register(&tegra_i2c_device1);
371
372         i2c_register_board_info(0, &max98088_board_info, 1);
373         i2c_register_board_info(0, &nfc_board_info, 1);
374 }
375
376 static struct platform_device *enterprise_uart_devices[] __initdata = {
377         &tegra_uarta_device,
378         &tegra_uartb_device,
379         &tegra_uartc_device,
380         &tegra_uartd_device,
381         &tegra_uarte_device,
382 };
383
384 static struct uart_clk_parent uart_parent_clk[] = {
385         [0] = {.name = "clk_m"},
386         [1] = {.name = "pll_p"},
387         [2] = {.name = "pll_m"},
388 };
389 static struct tegra_uart_platform_data enterprise_uart_pdata;
390
391 static void __init uart_debug_init(void)
392 {
393         unsigned long rate;
394         struct clk *c;
395
396         /* UARTD is the debug port. */
397         pr_info("Selecting UARTD as the debug console\n");
398         enterprise_uart_devices[3] = &debug_uartd_device;
399         debug_uart_port_base = ((struct plat_serial8250_port *)(
400                         debug_uartd_device.dev.platform_data))->mapbase;
401         debug_uart_clk = clk_get_sys("serial8250.0", "uartd");
402
403         /* Clock enable for the debug channel */
404         if (!IS_ERR_OR_NULL(debug_uart_clk)) {
405                 rate = ((struct plat_serial8250_port *)(
406                         debug_uartd_device.dev.platform_data))->uartclk;
407                 pr_info("The debug console clock name is %s\n",
408                                                 debug_uart_clk->name);
409                 c = tegra_get_clock_by_name("pll_p");
410                 if (IS_ERR_OR_NULL(c))
411                         pr_err("Not getting the parent clock pll_p\n");
412                 else
413                         clk_set_parent(debug_uart_clk, c);
414
415                 clk_enable(debug_uart_clk);
416                 clk_set_rate(debug_uart_clk, rate);
417         } else {
418                 pr_err("Not getting the clock %s for debug console\n",
419                                 debug_uart_clk->name);
420         }
421 }
422
423 static void __init enterprise_uart_init(void)
424 {
425         int i;
426         struct clk *c;
427
428         for (i = 0; i < ARRAY_SIZE(uart_parent_clk); ++i) {
429                 c = tegra_get_clock_by_name(uart_parent_clk[i].name);
430                 if (IS_ERR_OR_NULL(c)) {
431                         pr_err("Not able to get the clock for %s\n",
432                                                 uart_parent_clk[i].name);
433                         continue;
434                 }
435                 uart_parent_clk[i].parent_clk = c;
436                 uart_parent_clk[i].fixed_clk_rate = clk_get_rate(c);
437         }
438         enterprise_uart_pdata.parent_clk_list = uart_parent_clk;
439         enterprise_uart_pdata.parent_clk_count = ARRAY_SIZE(uart_parent_clk);
440         tegra_uarta_device.dev.platform_data = &enterprise_uart_pdata;
441         tegra_uartb_device.dev.platform_data = &enterprise_uart_pdata;
442         tegra_uartc_device.dev.platform_data = &enterprise_uart_pdata;
443         tegra_uartd_device.dev.platform_data = &enterprise_uart_pdata;
444         tegra_uarte_device.dev.platform_data = &enterprise_uart_pdata;
445
446         /* Register low speed only if it is selected */
447         if (!is_tegra_debug_uartport_hs())
448                 uart_debug_init();
449
450         platform_add_devices(enterprise_uart_devices,
451                                 ARRAY_SIZE(enterprise_uart_devices));
452 }
453
454
455
456 static struct resource tegra_rtc_resources[] = {
457         [0] = {
458                 .start = TEGRA_RTC_BASE,
459                 .end = TEGRA_RTC_BASE + TEGRA_RTC_SIZE - 1,
460                 .flags = IORESOURCE_MEM,
461         },
462         [1] = {
463                 .start = INT_RTC,
464                 .end = INT_RTC,
465                 .flags = IORESOURCE_IRQ,
466         },
467 };
468
469 static struct platform_device tegra_rtc_device = {
470         .name = "tegra_rtc",
471         .id   = -1,
472         .resource = tegra_rtc_resources,
473         .num_resources = ARRAY_SIZE(tegra_rtc_resources),
474 };
475
476 static struct platform_device tegra_camera = {
477         .name = "tegra_camera",
478         .id = -1,
479 };
480
481 static struct tegra_max98088_platform_data enterprise_audio_pdata = {
482         .gpio_spkr_en           = -1,
483         .gpio_hp_det            = TEGRA_GPIO_HP_DET,
484         .gpio_hp_mute           = -1,
485         .gpio_int_mic_en        = -1,
486         .gpio_ext_mic_en        = -1,
487 };
488
489 static struct platform_device enterprise_audio_device = {
490         .name   = "tegra-snd-max98088",
491         .id     = 0,
492         .dev    = {
493                 .platform_data  = &enterprise_audio_pdata,
494         },
495 };
496
497 static struct platform_device *enterprise_devices[] __initdata = {
498         &tegra_pmu_device,
499         &tegra_rtc_device,
500         &tegra_udc_device,
501 #if defined(CONFIG_TEGRA_IOVMM_SMMU)
502         &tegra_smmu_device,
503 #endif
504         &tegra_wdt_device,
505 #if defined(CONFIG_TEGRA_AVP)
506         &tegra_avp_device,
507 #endif
508         &tegra_camera,
509         &tegra_ahub_device,
510         &tegra_dam_device0,
511         &tegra_dam_device1,
512         &tegra_dam_device2,
513         &tegra_i2s_device0,
514         &tegra_i2s_device3,
515         &tegra_spdif_device,
516         &spdif_dit_device,
517         &bluetooth_dit_device,
518         &tegra_pcm_device,
519         &enterprise_audio_device,
520         &tegra_spi_device4,
521         &tegra_hda_device,
522 #if defined(CONFIG_CRYPTO_DEV_TEGRA_SE)
523         &tegra_se_device,
524 #endif
525 #if defined(CONFIG_CRYPTO_DEV_TEGRA_AES)
526         &tegra_aes_device,
527 #endif
528 };
529
530 #define MXT_CONFIG_CRC 0x62F903
531 /*
532  * Config converted from memory-mapped cfg-file with
533  * following version information:
534  *
535  *
536  *
537  *      FAMILY_ID=128
538  *      VARIANT=1
539  *      VERSION=32
540  *      BUILD=170
541  *      VENDOR_ID=255
542  *      PRODUCT_ID=TBD
543  *      CHECKSUM=0xC189B6
544  *
545  *
546  */
547
548 static const u8 config[] = {
549         0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
550         0xFF, 0xFF, 0x32, 0x0A, 0x00, 0x05, 0x01, 0x00,
551         0x00, 0x1E, 0x0A, 0x8B, 0x00, 0x00, 0x13, 0x0B,
552         0x00, 0x10, 0x32, 0x03, 0x03, 0x00, 0x03, 0x01,
553         0x00, 0x0A, 0x0A, 0x0A, 0x0A, 0xBF, 0x03, 0x1B,
554         0x02, 0x00, 0x00, 0x37, 0x37, 0x00, 0x00, 0x00,
555         0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
556         0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
557         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
558         0x00, 0x00, 0x00, 0xA9, 0x7F, 0x9A, 0x0E, 0x00,
559         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
560         0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00,
561         0x00, 0x00, 0x03, 0x23, 0x00, 0x00, 0x00, 0x0A,
562         0x0F, 0x14, 0x19, 0x03, 0x00, 0x00, 0x00, 0x00,
563         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
564         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
565         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
566         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
567         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
568         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
569         0x00, 0x00, 0x00, 0x01, 0x00, 0x03, 0x08, 0x10,
570         0x00
571 };
572
573 static struct mxt_platform_data atmel_mxt_info = {
574         .x_line         = 19,
575         .y_line         = 11,
576         .x_size         = 960,
577         .y_size         = 540,
578         .blen           = 0x10,
579         .threshold      = 0x32,
580         .voltage        = 3300000,              /* 3.3V */
581         .orient         = 3,
582         .config         = config,
583         .config_length  = 168,
584         .config_crc     = MXT_CONFIG_CRC,
585         .irqflags       = IRQF_TRIGGER_FALLING,
586 /*      .read_chg       = &read_chg, */
587         .read_chg       = NULL,
588 };
589
590 static struct i2c_board_info __initdata atmel_i2c_info[] = {
591         {
592                 I2C_BOARD_INFO("atmel_mxt_ts", MXT224_I2C_ADDR1),
593                 .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_PH6),
594                 .platform_data = &atmel_mxt_info,
595         }
596 };
597
598 static int __init enterprise_touch_init(void)
599 {
600         tegra_gpio_enable(TEGRA_GPIO_PH6);
601         tegra_gpio_enable(TEGRA_GPIO_PF5);
602
603         gpio_request(TEGRA_GPIO_PH6, "atmel-irq");
604         gpio_direction_input(TEGRA_GPIO_PH6);
605
606         gpio_request(TEGRA_GPIO_PF5, "atmel-reset");
607         gpio_direction_output(TEGRA_GPIO_PF5, 0);
608         msleep(1);
609         gpio_set_value(TEGRA_GPIO_PF5, 1);
610         msleep(100);
611
612         i2c_register_board_info(1, atmel_i2c_info, 1);
613
614         return 0;
615 }
616
617 static struct usb_phy_plat_data tegra_usb_phy_pdata[] = {
618         [0] = {
619                         .instance = 0,
620                         .vbus_gpio = -1,
621                         .vbus_reg_supply = "usb_vbus",
622                         .vbus_irq = ENT_TPS80031_IRQ_BASE +
623                                                         TPS80031_INT_VBUS_DET,
624         },
625         [1] = {
626                         .instance = 1,
627                         .vbus_gpio = -1,
628         },
629         [2] = {
630                         .instance = 2,
631                         .vbus_gpio = -1,
632         },
633 };
634
635
636 static struct tegra_ehci_platform_data tegra_ehci_pdata[] = {
637         [0] = {
638                         .phy_config = &utmi_phy_config[0],
639                         .operating_mode = TEGRA_USB_HOST,
640                         .power_down_on_bus_suspend = 1,
641         },
642         [1] = {
643                         .phy_config = &utmi_phy_config[1],
644                         .operating_mode = TEGRA_USB_HOST,
645                         .power_down_on_bus_suspend = 1,
646         },
647         [2] = {
648                         .phy_config = &utmi_phy_config[2],
649                         .operating_mode = TEGRA_USB_HOST,
650                         .power_down_on_bus_suspend = 1,
651         },
652 };
653
654 static struct tegra_otg_platform_data tegra_otg_pdata = {
655         .ehci_device = &tegra_ehci1_device,
656         .ehci_pdata = &tegra_ehci_pdata[0],
657 };
658
659 static void enterprise_usb_init(void)
660 {
661         struct  fsl_usb2_platform_data *udc_pdata;
662
663         tegra_usb_phy_init(tegra_usb_phy_pdata, ARRAY_SIZE(tegra_usb_phy_pdata));
664
665         tegra_otg_device.dev.platform_data = &tegra_otg_pdata;
666         platform_device_register(&tegra_otg_device);
667
668         udc_pdata = tegra_udc_device.dev.platform_data;
669 }
670
671 static void enterprise_gps_init(void)
672 {
673         tegra_gpio_enable(TEGRA_GPIO_PE4);
674         tegra_gpio_enable(TEGRA_GPIO_PE5);
675 }
676
677 static void enterprise_baseband_init(void)
678 {
679         int modem_id = tegra_get_modem_id();
680
681         switch (modem_id) {
682         case 1: /* PH450 ULPI */
683                 enterprise_modem_init();
684                 break;
685         case 2: /* 6260 HSIC */
686                 break;
687         }
688 }
689
690 static void enterprise_nfc_init(void)
691 {
692         tegra_gpio_enable(TEGRA_GPIO_PS4);
693         tegra_gpio_enable(TEGRA_GPIO_PM6);
694 }
695
696 static void __init tegra_enterprise_init(void)
697 {
698         tegra_clk_init_from_table(enterprise_clk_init_table);
699         enterprise_pinmux_init();
700         enterprise_i2c_init();
701         enterprise_uart_init();
702         enterprise_usb_init();
703         enterprise_tsensor_init();
704         platform_add_devices(enterprise_devices, ARRAY_SIZE(enterprise_devices));
705         enterprise_regulator_init();
706         enterprise_sdhci_init();
707 #ifdef CONFIG_TEGRA_EDP_LIMITS
708         enterprise_edp_init();
709 #endif
710         enterprise_kbc_init();
711         enterprise_touch_init();
712         enterprise_gps_init();
713         enterprise_baseband_init();
714         enterprise_panel_init();
715         enterprise_bt_rfkill();
716         enterprise_setup_bluesleep();
717         enterprise_emc_init();
718         enterprise_sensors_init();
719         enterprise_suspend_init();
720         tegra_release_bootloader_fb();
721         enterprise_nfc_init();
722 }
723
724 static void __init tegra_enterprise_reserve(void)
725 {
726 #if defined(CONFIG_NVMAP_CONVERT_CARVEOUT_TO_IOVMM)
727         tegra_reserve(0, SZ_4M, SZ_8M);
728 #else
729         tegra_reserve(SZ_128M, SZ_4M, SZ_8M);
730 #endif
731 }
732
733 MACHINE_START(TEGRA_ENTERPRISE, "tegra_enterprise")
734         .boot_params    = 0x80000100,
735         .map_io         = tegra_map_common_io,
736         .reserve        = tegra_enterprise_reserve,
737         .init_early     = tegra_init_early,
738         .init_irq       = tegra_init_irq,
739         .timer          = &tegra_timer,
740         .init_machine   = tegra_enterprise_init,
741 MACHINE_END