a5736c7d40de286513e744dc1a48411c9f792350
[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         { "i2s2",       "pll_a_out0",   0,              false},
191         { "i2s3",       "pll_a_out0",   0,              false},
192         { "spdif_out",  "pll_a_out0",   0,              false},
193         { "d_audio",    "pll_a_out0",   0,              false},
194         { "dam0",       "pll_a_out0",   0,              false},
195         { "dam1",       "pll_a_out0",   0,              false},
196         { "dam2",       "pll_a_out0",   0,              false},
197         { NULL,         NULL,           0,              0},
198 };
199
200 static struct tegra_i2c_platform_data enterprise_i2c1_platform_data = {
201         .adapter_nr     = 0,
202         .bus_count      = 1,
203         .bus_clk_rate   = { 100000, 0 },
204         .scl_gpio               = {TEGRA_GPIO_PC4, 0},
205         .sda_gpio               = {TEGRA_GPIO_PC5, 0},
206         .arb_recovery = arb_lost_recovery,
207 };
208
209 static struct tegra_i2c_platform_data enterprise_i2c2_platform_data = {
210         .adapter_nr     = 1,
211         .bus_count      = 1,
212         .bus_clk_rate   = { 100000, 0 },
213         .is_clkon_always = true,
214         .scl_gpio               = {TEGRA_GPIO_PT5, 0},
215         .sda_gpio               = {TEGRA_GPIO_PT6, 0},
216         .arb_recovery = arb_lost_recovery,
217 };
218
219 static struct tegra_i2c_platform_data enterprise_i2c3_platform_data = {
220         .adapter_nr     = 2,
221         .bus_count      = 1,
222         .bus_clk_rate   = { 100000, 0 },
223         .scl_gpio               = {TEGRA_GPIO_PBB1, 0},
224         .sda_gpio               = {TEGRA_GPIO_PBB2, 0},
225         .arb_recovery = arb_lost_recovery,
226 };
227
228 static struct tegra_i2c_platform_data enterprise_i2c4_platform_data = {
229         .adapter_nr     = 3,
230         .bus_count      = 1,
231         .bus_clk_rate   = { 100000, 0 },
232         .scl_gpio               = {TEGRA_GPIO_PV4, 0},
233         .sda_gpio               = {TEGRA_GPIO_PV5, 0},
234         .arb_recovery = arb_lost_recovery,
235 };
236
237 static struct tegra_i2c_platform_data enterprise_i2c5_platform_data = {
238         .adapter_nr     = 4,
239         .bus_count      = 1,
240         .bus_clk_rate   = { 100000, 0 },
241         .scl_gpio               = {TEGRA_GPIO_PZ6, 0},
242         .sda_gpio               = {TEGRA_GPIO_PZ7, 0},
243         .arb_recovery = arb_lost_recovery,
244 };
245
246 /* Equalizer filter coefs generated from the MAXIM MAX98088
247  * evkit software tool */
248 static struct max98088_eq_cfg max98088_eq_cfg[] = {
249         {
250                 .name = "FLAT",
251                 .rate = 44100,
252                 .band1 = {0x2000, 0xC002, 0x4000, 0x00E9, 0x0000},
253                 .band2 = {0x2000, 0xC00F, 0x4000, 0x02BC, 0x0000},
254                 .band3 = {0x2000, 0xC0A7, 0x4000, 0x0916, 0x0000},
255                 .band4 = {0x2000, 0xC5C2, 0x4000, 0x1A87, 0x0000},
256                 .band5 = {0x2000, 0xF6B0, 0x4000, 0x3F51, 0x0000},
257         },
258         {
259                 .name = "LOWPASS1K",
260                 .rate = 44100,
261                 .band1 = {0x205D, 0xC001, 0x3FEF, 0x002E, 0x02E0},
262                 .band2 = {0x5B9A, 0xC093, 0x3AB2, 0x088B, 0x1981},
263                 .band3 = {0x0D22, 0xC170, 0x26EA, 0x0D79, 0x32CF},
264                 .band4 = {0x0894, 0xC612, 0x01B3, 0x1B34, 0x3FFA},
265                 .band5 = {0x0815, 0x3FFF, 0xCF78, 0x0000, 0x29B7},
266         },
267         { /* BASS=-12dB, TREBLE=+9dB, Fc=5KHz */
268                 .name = "HIBOOST",
269                 .rate = 44100,
270                 .band1 = {0x0815, 0xC001, 0x3AA4, 0x0003, 0x19A2},
271                 .band2 = {0x0815, 0xC103, 0x092F, 0x0B55, 0x3F56},
272                 .band3 = {0x0E0A, 0xC306, 0x1E5C, 0x136E, 0x3856},
273                 .band4 = {0x2459, 0xF665, 0x0CAA, 0x3F46, 0x3EBB},
274                 .band5 = {0x5BBB, 0x3FFF, 0xCEB0, 0x0000, 0x28CA},
275         },
276         { /* BASS=12dB, TREBLE=+12dB */
277                 .name = "LOUD12DB",
278                 .rate = 44100,
279                 .band1 = {0x7FC1, 0xC001, 0x3EE8, 0x0020, 0x0BC7},
280                 .band2 = {0x51E9, 0xC016, 0x3C7C, 0x033F, 0x14E9},
281                 .band3 = {0x1745, 0xC12C, 0x1680, 0x0C2F, 0x3BE9},
282                 .band4 = {0x4536, 0xD7E2, 0x0ED4, 0x31DD, 0x3E42},
283                 .band5 = {0x7FEF, 0x3FFF, 0x0BAB, 0x0000, 0x3EED},
284         },
285         {
286                 .name = "FLAT",
287                 .rate = 16000,
288                 .band1 = {0x2000, 0xC004, 0x4000, 0x0141, 0x0000},
289                 .band2 = {0x2000, 0xC033, 0x4000, 0x0505, 0x0000},
290                 .band3 = {0x2000, 0xC268, 0x4000, 0x115F, 0x0000},
291                 .band4 = {0x2000, 0xDA62, 0x4000, 0x33C6, 0x0000},
292                 .band5 = {0x2000, 0x4000, 0x4000, 0x0000, 0x0000},
293         },
294         {
295                 .name = "LOWPASS1K",
296                 .rate = 16000,
297                 .band1 = {0x2000, 0xC004, 0x4000, 0x0141, 0x0000},
298                 .band2 = {0x5BE8, 0xC3E0, 0x3307, 0x15ED, 0x26A0},
299                 .band3 = {0x0F71, 0xD15A, 0x08B3, 0x2BD0, 0x3F67},
300                 .band4 = {0x0815, 0x3FFF, 0xCF78, 0x0000, 0x29B7},
301                 .band5 = {0x0815, 0x3FFF, 0xCF78, 0x0000, 0x29B7},
302         },
303         { /* BASS=-12dB, TREBLE=+9dB, Fc=2KHz */
304                 .name = "HIBOOST",
305                 .rate = 16000,
306                 .band1 = {0x0815, 0xC001, 0x3BD2, 0x0009, 0x16BF},
307                 .band2 = {0x080E, 0xC17E, 0xF653, 0x0DBD, 0x3F43},
308                 .band3 = {0x0F80, 0xDF45, 0xEE33, 0x36FE, 0x3D79},
309                 .band4 = {0x590B, 0x3FF0, 0xE882, 0x02BD, 0x3B87},
310                 .band5 = {0x4C87, 0xF3D0, 0x063F, 0x3ED4, 0x3FB1},
311         },
312         { /* BASS=12dB, TREBLE=+12dB */
313                 .name = "LOUD12DB",
314                 .rate = 16000,
315                 .band1 = {0x7FC1, 0xC001, 0x3D07, 0x0058, 0x1344},
316                 .band2 = {0x2DA6, 0xC013, 0x3CF1, 0x02FF, 0x138B},
317                 .band3 = {0x18F1, 0xC08E, 0x244D, 0x0863, 0x34B5},
318                 .band4 = {0x2BE0, 0xF385, 0x04FD, 0x3EC5, 0x3FCE},
319                 .band5 = {0x7FEF, 0x4000, 0x0BAB, 0x0000, 0x3EED},
320         },
321 };
322
323
324 static struct max98088_pdata enterprise_max98088_pdata = {
325         /* equalizer configuration */
326         .eq_cfg = max98088_eq_cfg,
327         .eq_cfgcnt = ARRAY_SIZE(max98088_eq_cfg),
328
329         /* debounce time */
330         .debounce_time_ms = 200,
331
332         /* microphone configuration */
333         .digmic_left_mode = 1,
334         .digmic_right_mode = 1,
335
336         /* receiver output configuration */
337         .receiver_mode = 0,     /* 0 = amplifier, 1 = line output */
338 };
339
340 static struct pn544_i2c_platform_data nfc_pdata = {
341                 .irq_gpio = TEGRA_GPIO_PS4,
342                 .ven_gpio = TEGRA_GPIO_PM6,
343                 .firm_gpio = 0,
344 };
345
346
347 static struct i2c_board_info __initdata max98088_board_info = {
348         I2C_BOARD_INFO("max98088", 0x10),
349         .platform_data = &enterprise_max98088_pdata,
350         .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_HP_DET),
351 };
352
353 static struct i2c_board_info __initdata nfc_board_info = {
354         I2C_BOARD_INFO("pn544", 0x28),
355         .platform_data = &nfc_pdata,
356         .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_PS4),
357 };
358
359 static void enterprise_i2c_init(void)
360 {
361         tegra_i2c_device1.dev.platform_data = &enterprise_i2c1_platform_data;
362         tegra_i2c_device2.dev.platform_data = &enterprise_i2c2_platform_data;
363         tegra_i2c_device3.dev.platform_data = &enterprise_i2c3_platform_data;
364         tegra_i2c_device4.dev.platform_data = &enterprise_i2c4_platform_data;
365         tegra_i2c_device5.dev.platform_data = &enterprise_i2c5_platform_data;
366
367         platform_device_register(&tegra_i2c_device5);
368         platform_device_register(&tegra_i2c_device4);
369         platform_device_register(&tegra_i2c_device3);
370         platform_device_register(&tegra_i2c_device2);
371         platform_device_register(&tegra_i2c_device1);
372
373         i2c_register_board_info(0, &max98088_board_info, 1);
374         i2c_register_board_info(0, &nfc_board_info, 1);
375 }
376
377 static struct platform_device *enterprise_uart_devices[] __initdata = {
378         &tegra_uarta_device,
379         &tegra_uartb_device,
380         &tegra_uartc_device,
381         &tegra_uartd_device,
382         &tegra_uarte_device,
383 };
384
385 static struct uart_clk_parent uart_parent_clk[] = {
386         [0] = {.name = "clk_m"},
387         [1] = {.name = "pll_p"},
388 #ifndef CONFIG_TEGRA_PLLM_RESTRICTED
389         [2] = {.name = "pll_m"},
390 #endif
391 };
392 static struct tegra_uart_platform_data enterprise_uart_pdata;
393
394 static void __init uart_debug_init(void)
395 {
396         unsigned long rate;
397         struct clk *c;
398
399         /* UARTD is the debug port. */
400         pr_info("Selecting UARTD as the debug console\n");
401         enterprise_uart_devices[3] = &debug_uartd_device;
402         debug_uart_port_base = ((struct plat_serial8250_port *)(
403                         debug_uartd_device.dev.platform_data))->mapbase;
404         debug_uart_clk = clk_get_sys("serial8250.0", "uartd");
405
406         /* Clock enable for the debug channel */
407         if (!IS_ERR_OR_NULL(debug_uart_clk)) {
408                 rate = ((struct plat_serial8250_port *)(
409                         debug_uartd_device.dev.platform_data))->uartclk;
410                 pr_info("The debug console clock name is %s\n",
411                                                 debug_uart_clk->name);
412                 c = tegra_get_clock_by_name("pll_p");
413                 if (IS_ERR_OR_NULL(c))
414                         pr_err("Not getting the parent clock pll_p\n");
415                 else
416                         clk_set_parent(debug_uart_clk, c);
417
418                 clk_enable(debug_uart_clk);
419                 clk_set_rate(debug_uart_clk, rate);
420         } else {
421                 pr_err("Not getting the clock %s for debug console\n",
422                                 debug_uart_clk->name);
423         }
424 }
425
426 static void __init enterprise_uart_init(void)
427 {
428         int i;
429         struct clk *c;
430
431         for (i = 0; i < ARRAY_SIZE(uart_parent_clk); ++i) {
432                 c = tegra_get_clock_by_name(uart_parent_clk[i].name);
433                 if (IS_ERR_OR_NULL(c)) {
434                         pr_err("Not able to get the clock for %s\n",
435                                                 uart_parent_clk[i].name);
436                         continue;
437                 }
438                 uart_parent_clk[i].parent_clk = c;
439                 uart_parent_clk[i].fixed_clk_rate = clk_get_rate(c);
440         }
441         enterprise_uart_pdata.parent_clk_list = uart_parent_clk;
442         enterprise_uart_pdata.parent_clk_count = ARRAY_SIZE(uart_parent_clk);
443         tegra_uarta_device.dev.platform_data = &enterprise_uart_pdata;
444         tegra_uartb_device.dev.platform_data = &enterprise_uart_pdata;
445         tegra_uartc_device.dev.platform_data = &enterprise_uart_pdata;
446         tegra_uartd_device.dev.platform_data = &enterprise_uart_pdata;
447         tegra_uarte_device.dev.platform_data = &enterprise_uart_pdata;
448
449         /* Register low speed only if it is selected */
450         if (!is_tegra_debug_uartport_hs())
451                 uart_debug_init();
452
453         platform_add_devices(enterprise_uart_devices,
454                                 ARRAY_SIZE(enterprise_uart_devices));
455 }
456
457
458
459 static struct resource tegra_rtc_resources[] = {
460         [0] = {
461                 .start = TEGRA_RTC_BASE,
462                 .end = TEGRA_RTC_BASE + TEGRA_RTC_SIZE - 1,
463                 .flags = IORESOURCE_MEM,
464         },
465         [1] = {
466                 .start = INT_RTC,
467                 .end = INT_RTC,
468                 .flags = IORESOURCE_IRQ,
469         },
470 };
471
472 static struct platform_device tegra_rtc_device = {
473         .name = "tegra_rtc",
474         .id   = -1,
475         .resource = tegra_rtc_resources,
476         .num_resources = ARRAY_SIZE(tegra_rtc_resources),
477 };
478
479 static struct platform_device tegra_camera = {
480         .name = "tegra_camera",
481         .id = -1,
482 };
483
484 static struct tegra_max98088_platform_data enterprise_audio_pdata = {
485         .gpio_spkr_en           = -1,
486         .gpio_hp_det            = TEGRA_GPIO_HP_DET,
487         .gpio_hp_mute           = -1,
488         .gpio_int_mic_en        = -1,
489         .gpio_ext_mic_en        = -1,
490         .audio_port_id          = {
491                 [HIFI_CODEC] = 0,
492                 [BASEBAND] = 2,
493                 [BT_SCO] = 3,
494         },
495         .baseband_param         = {
496                 .rate = 8000,
497                 .channels = 1,
498         },
499 };
500
501 static struct platform_device enterprise_audio_device = {
502         .name   = "tegra-snd-max98088",
503         .id     = 0,
504         .dev    = {
505                 .platform_data  = &enterprise_audio_pdata,
506         },
507 };
508
509 static struct platform_device *enterprise_devices[] __initdata = {
510         &tegra_pmu_device,
511         &tegra_rtc_device,
512         &tegra_udc_device,
513 #if defined(CONFIG_TEGRA_IOVMM_SMMU)
514         &tegra_smmu_device,
515 #endif
516         &tegra_wdt_device,
517 #if defined(CONFIG_TEGRA_AVP)
518         &tegra_avp_device,
519 #endif
520         &tegra_camera,
521         &tegra_ahub_device,
522         &tegra_dam_device0,
523         &tegra_dam_device1,
524         &tegra_dam_device2,
525         &tegra_i2s_device0,
526         &tegra_i2s_device2,
527         &tegra_i2s_device3,
528         &tegra_spdif_device,
529         &spdif_dit_device,
530         &bluetooth_dit_device,
531         &baseband_dit_device,
532         &tegra_pcm_device,
533         &enterprise_audio_device,
534         &tegra_spi_device4,
535         &tegra_hda_device,
536 #if defined(CONFIG_CRYPTO_DEV_TEGRA_SE)
537         &tegra_se_device,
538 #endif
539 #if defined(CONFIG_CRYPTO_DEV_TEGRA_AES)
540         &tegra_aes_device,
541 #endif
542 };
543
544 #define MXT_CONFIG_CRC 0x62F903
545 /*
546  * Config converted from memory-mapped cfg-file with
547  * following version information:
548  *
549  *
550  *
551  *      FAMILY_ID=128
552  *      VARIANT=1
553  *      VERSION=32
554  *      BUILD=170
555  *      VENDOR_ID=255
556  *      PRODUCT_ID=TBD
557  *      CHECKSUM=0xC189B6
558  *
559  *
560  */
561
562 static const u8 config[] = {
563         0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
564         0xFF, 0xFF, 0x32, 0x0A, 0x00, 0x05, 0x01, 0x00,
565         0x00, 0x1E, 0x0A, 0x8B, 0x00, 0x00, 0x13, 0x0B,
566         0x00, 0x10, 0x32, 0x03, 0x03, 0x00, 0x03, 0x01,
567         0x00, 0x0A, 0x0A, 0x0A, 0x0A, 0xBF, 0x03, 0x1B,
568         0x02, 0x00, 0x00, 0x37, 0x37, 0x00, 0x00, 0x00,
569         0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
570         0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
571         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
572         0x00, 0x00, 0x00, 0xA9, 0x7F, 0x9A, 0x0E, 0x00,
573         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
574         0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00,
575         0x00, 0x00, 0x03, 0x23, 0x00, 0x00, 0x00, 0x0A,
576         0x0F, 0x14, 0x19, 0x03, 0x00, 0x00, 0x00, 0x00,
577         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
578         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
579         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
580         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
581         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
582         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
583         0x00, 0x00, 0x00, 0x01, 0x00, 0x03, 0x08, 0x10,
584         0x00
585 };
586
587 static struct mxt_platform_data atmel_mxt_info = {
588         .x_line         = 19,
589         .y_line         = 11,
590         .x_size         = 960,
591         .y_size         = 540,
592         .blen           = 0x10,
593         .threshold      = 0x32,
594         .voltage        = 3300000,              /* 3.3V */
595         .orient         = 3,
596         .config         = config,
597         .config_length  = 168,
598         .config_crc     = MXT_CONFIG_CRC,
599         .irqflags       = IRQF_TRIGGER_FALLING,
600 /*      .read_chg       = &read_chg, */
601         .read_chg       = NULL,
602 };
603
604 static struct i2c_board_info __initdata atmel_i2c_info[] = {
605         {
606                 I2C_BOARD_INFO("atmel_mxt_ts", MXT224_I2C_ADDR1),
607                 .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_PH6),
608                 .platform_data = &atmel_mxt_info,
609         }
610 };
611
612 static int __init enterprise_touch_init(void)
613 {
614         tegra_gpio_enable(TEGRA_GPIO_PH6);
615         tegra_gpio_enable(TEGRA_GPIO_PF5);
616
617         gpio_request(TEGRA_GPIO_PH6, "atmel-irq");
618         gpio_direction_input(TEGRA_GPIO_PH6);
619
620         gpio_request(TEGRA_GPIO_PF5, "atmel-reset");
621         gpio_direction_output(TEGRA_GPIO_PF5, 0);
622         msleep(1);
623         gpio_set_value(TEGRA_GPIO_PF5, 1);
624         msleep(100);
625
626         i2c_register_board_info(1, atmel_i2c_info, 1);
627
628         return 0;
629 }
630
631 static struct usb_phy_plat_data tegra_usb_phy_pdata[] = {
632         [0] = {
633                         .instance = 0,
634                         .vbus_gpio = -1,
635                         .vbus_reg_supply = "usb_vbus",
636                         .vbus_irq = ENT_TPS80031_IRQ_BASE +
637                                                         TPS80031_INT_VBUS_DET,
638         },
639         [1] = {
640                         .instance = 1,
641                         .vbus_gpio = -1,
642         },
643         [2] = {
644                         .instance = 2,
645                         .vbus_gpio = -1,
646         },
647 };
648
649
650 static struct tegra_ehci_platform_data tegra_ehci_pdata[] = {
651         [0] = {
652                         .phy_config = &utmi_phy_config[0],
653                         .operating_mode = TEGRA_USB_HOST,
654                         .power_down_on_bus_suspend = 1,
655         },
656         [1] = {
657                         .phy_config = &utmi_phy_config[1],
658                         .operating_mode = TEGRA_USB_HOST,
659                         .power_down_on_bus_suspend = 1,
660         },
661         [2] = {
662                         .phy_config = &utmi_phy_config[2],
663                         .operating_mode = TEGRA_USB_HOST,
664                         .power_down_on_bus_suspend = 1,
665         },
666 };
667
668 static struct tegra_otg_platform_data tegra_otg_pdata = {
669         .ehci_device = &tegra_ehci1_device,
670         .ehci_pdata = &tegra_ehci_pdata[0],
671 };
672
673 static void enterprise_usb_init(void)
674 {
675         struct  fsl_usb2_platform_data *udc_pdata;
676
677         tegra_usb_phy_init(tegra_usb_phy_pdata, ARRAY_SIZE(tegra_usb_phy_pdata));
678
679         tegra_otg_device.dev.platform_data = &tegra_otg_pdata;
680         platform_device_register(&tegra_otg_device);
681
682         udc_pdata = tegra_udc_device.dev.platform_data;
683 }
684
685 static void enterprise_gps_init(void)
686 {
687         tegra_gpio_enable(TEGRA_GPIO_PE4);
688         tegra_gpio_enable(TEGRA_GPIO_PE5);
689 }
690
691 static void enterprise_baseband_init(void)
692 {
693         int modem_id = tegra_get_modem_id();
694
695         switch (modem_id) {
696         case 1: /* PH450 ULPI */
697                 enterprise_modem_init();
698                 break;
699         case 2: /* 6260 HSIC */
700                 break;
701         }
702 }
703
704 static void enterprise_nfc_init(void)
705 {
706         tegra_gpio_enable(TEGRA_GPIO_PS4);
707         tegra_gpio_enable(TEGRA_GPIO_PM6);
708 }
709
710 static void __init tegra_enterprise_init(void)
711 {
712         tegra_clk_init_from_table(enterprise_clk_init_table);
713         enterprise_pinmux_init();
714         enterprise_i2c_init();
715         enterprise_uart_init();
716         enterprise_usb_init();
717         enterprise_tsensor_init();
718         platform_add_devices(enterprise_devices, ARRAY_SIZE(enterprise_devices));
719         enterprise_regulator_init();
720         enterprise_sdhci_init();
721 #ifdef CONFIG_TEGRA_EDP_LIMITS
722         enterprise_edp_init();
723 #endif
724         enterprise_kbc_init();
725         enterprise_touch_init();
726         enterprise_gps_init();
727         enterprise_baseband_init();
728         enterprise_panel_init();
729         enterprise_bt_rfkill();
730         enterprise_setup_bluesleep();
731         enterprise_emc_init();
732         enterprise_sensors_init();
733         enterprise_suspend_init();
734         tegra_release_bootloader_fb();
735         enterprise_nfc_init();
736 }
737
738 static void __init tegra_enterprise_reserve(void)
739 {
740 #if defined(CONFIG_NVMAP_CONVERT_CARVEOUT_TO_IOVMM)
741         tegra_reserve(0, SZ_4M, SZ_8M);
742 #else
743         tegra_reserve(SZ_128M, SZ_4M, SZ_8M);
744 #endif
745 }
746
747 MACHINE_START(TEGRA_ENTERPRISE, "tegra_enterprise")
748         .boot_params    = 0x80000100,
749         .map_io         = tegra_map_common_io,
750         .reserve        = tegra_enterprise_reserve,
751         .init_early     = tegra_init_early,
752         .init_irq       = tegra_init_irq,
753         .timer          = &tegra_timer,
754         .init_machine   = tegra_enterprise_init,
755 MACHINE_END