b52445b83936c29c0a04d18ee70704b30ba7db57
[linux-2.6.git] / arch / arm / mach-tegra / board-pluto.c
1 /*
2  * arch/arm/mach-tegra/board-pluto.c
3  *
4  * Copyright (c) 2012-2013, NVIDIA CORPORATION. All rights reserved.
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 version 2 as
8  * published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18  */
19
20 #include <linux/kernel.h>
21 #include <linux/init.h>
22 #include <linux/slab.h>
23 #include <linux/ctype.h>
24 #include <linux/platform_device.h>
25 #include <linux/clk.h>
26 #include <linux/serial_8250.h>
27 #include <linux/i2c.h>
28 #include <linux/dma-mapping.h>
29 #include <linux/delay.h>
30 #include <linux/i2c-tegra.h>
31 #include <linux/gpio.h>
32 #include <linux/input.h>
33 #include <linux/platform_data/tegra_usb.h>
34 #include <linux/spi/spi.h>
35 #include <linux/spi/rm31080a_ts.h>
36 #include <linux/tegra_uart.h>
37 #include <linux/memblock.h>
38 #include <linux/spi-tegra.h>
39 #include <linux/nfc/pn544.h>
40 #include <linux/nfc/bcm2079x.h>
41 #include <linux/rfkill-gpio.h>
42 #include <linux/skbuff.h>
43 #include <linux/ti_wilink_st.h>
44 #include <linux/regulator/consumer.h>
45 #include <linux/smb349-charger.h>
46 #include <linux/max17048_battery.h>
47 #include <linux/leds.h>
48 #include <linux/i2c/at24.h>
49 #include <linux/mfd/max8831.h>
50 #include <linux/of_platform.h>
51 #include <linux/a2220.h>
52 #include <linux/mfd/tlv320aic3262-registers.h>
53 #include <linux/mfd/tlv320aic3xxx-core.h>
54
55 #include <asm/hardware/gic.h>
56
57 #include <mach/clk.h>
58 #include <mach/iomap.h>
59 #include <mach/irqs.h>
60 #include <mach/pinmux.h>
61 #include <mach/pinmux-t11.h>
62 #include <mach/iomap.h>
63 #include <mach/io.h>
64 #include <mach/io_dpd.h>
65 #include <mach/i2s.h>
66 #include <mach/tegra_asoc_pdata.h>
67 #include <asm/mach-types.h>
68 #include <asm/mach/arch.h>
69 #include <mach/usb_phy.h>
70 #include <mach/gpio-tegra.h>
71 #include <mach/tegra_fiq_debugger.h>
72 #include <mach/tegra-bb-power.h>
73 #include <linux/platform_data/tegra_usb_modem_power.h>
74 #include <mach/hardware.h>
75 #include <mach/xusb.h>
76
77 #include "board.h"
78 #include "board-common.h"
79 #include "board-touch-raydium.h"
80 #include "clock.h"
81 #include "board-pluto.h"
82 #include "baseband-xmm-power.h"
83 #include "tegra-board-id.h"
84 #include "devices.h"
85 #include "gpio-names.h"
86 #include "fuse.h"
87 #include "pm.h"
88 #include "common.h"
89
90
91 #ifdef CONFIG_BT_BLUESLEEP
92 static struct rfkill_gpio_platform_data pluto_bt_rfkill_pdata = {
93         .name           = "bt_rfkill",
94         .shutdown_gpio  = TEGRA_GPIO_PQ7,
95         .reset_gpio     = TEGRA_GPIO_PQ6,
96         .type           = RFKILL_TYPE_BLUETOOTH,
97 };
98
99 static struct platform_device pluto_bt_rfkill_device = {
100         .name = "rfkill_gpio",
101         .id             = -1,
102         .dev = {
103                 .platform_data = &pluto_bt_rfkill_pdata,
104         },
105 };
106
107 static noinline void __init pluto_setup_bt_rfkill(void)
108 {
109         platform_device_register(&pluto_bt_rfkill_device);
110 }
111
112 static struct resource pluto_bluesleep_resources[] = {
113         [0] = {
114                 .name = "gpio_host_wake",
115                         .start  = TEGRA_GPIO_PU6,
116                         .end    = TEGRA_GPIO_PU6,
117                         .flags  = IORESOURCE_IO,
118         },
119         [1] = {
120                 .name = "gpio_ext_wake",
121                         .start  = TEGRA_GPIO_PEE1,
122                         .end    = TEGRA_GPIO_PEE1,
123                         .flags  = IORESOURCE_IO,
124         },
125         [2] = {
126                 .name = "host_wake",
127                         .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
128         },
129 };
130
131 static struct platform_device pluto_bluesleep_device = {
132         .name           = "bluesleep",
133         .id             = -1,
134         .num_resources  = ARRAY_SIZE(pluto_bluesleep_resources),
135         .resource       = pluto_bluesleep_resources,
136 };
137
138 static noinline void __init pluto_setup_bluesleep(void)
139 {
140         pluto_bluesleep_resources[2].start =
141                 pluto_bluesleep_resources[2].end =
142                         gpio_to_irq(TEGRA_GPIO_PU6);
143         platform_device_register(&pluto_bluesleep_device);
144         return;
145 }
146 #elif defined CONFIG_BLUEDROID_PM
147 static struct resource pluto_bluedroid_pm_resources[] = {
148         [0] = {
149                 .name   = "shutdown_gpio",
150                 .start  = TEGRA_GPIO_PQ7,
151                 .end    = TEGRA_GPIO_PQ7,
152                 .flags  = IORESOURCE_IO,
153         },
154         [1] = {
155                 .name = "host_wake",
156                 .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
157         },
158         [2] = {
159                 .name = "gpio_ext_wake",
160                 .start  = TEGRA_GPIO_PEE1,
161                 .end    = TEGRA_GPIO_PEE1,
162                 .flags  = IORESOURCE_IO,
163         },
164         [3] = {
165                 .name = "gpio_host_wake",
166                 .start  = TEGRA_GPIO_PU6,
167                 .end    = TEGRA_GPIO_PU6,
168                 .flags  = IORESOURCE_IO,
169         },
170         [4] = {
171                 .name = "reset_gpio",
172                 .start  = TEGRA_GPIO_PQ6,
173                 .end    = TEGRA_GPIO_PQ6,
174                 .flags  = IORESOURCE_IO,
175         },
176         [5] = {
177                 .name = "min_cpu_freq",
178                 .start  = 102000,
179                 .end    = 102000,
180                 .flags  = IORESOURCE_IO,
181         },
182 };
183
184 static struct platform_device pluto_bluedroid_pm_device = {
185         .name = "bluedroid_pm",
186         .id             = 0,
187         .num_resources  = ARRAY_SIZE(pluto_bluedroid_pm_resources),
188         .resource       = pluto_bluedroid_pm_resources,
189 };
190
191 static noinline void __init pluto_setup_bluedroid_pm(void)
192 {
193         pluto_bluedroid_pm_resources[1].start =
194                 pluto_bluedroid_pm_resources[1].end =
195                                         gpio_to_irq(TEGRA_GPIO_PU6);
196         platform_device_register(&pluto_bluedroid_pm_device);
197 }
198 #endif
199
200 static __initdata struct tegra_clk_init_table pluto_clk_init_table[] = {
201         /* name         parent          rate            enabled */
202         { "pll_m",      NULL,           0,              false},
203         { "hda",        "pll_p",        108000000,      false},
204         { "hda2codec_2x", "pll_p",      48000000,       false},
205         { "pwm",        "pll_p",        3187500,        false},
206         { "i2s1",       "pll_a_out0",   0,              false},
207         { "i2s2",       "pll_a_out0",   0,              false},
208         { "i2s3",       "pll_a_out0",   0,              false},
209         { "i2s4",       "pll_a_out0",   0,              false},
210         { "spdif_out",  "pll_a_out0",   0,              false},
211         { "d_audio",    "clk_m",        12000000,       false},
212         { "dam0",       "clk_m",        12000000,       false},
213         { "dam1",       "clk_m",        12000000,       false},
214         { "dam2",       "clk_m",        12000000,       false},
215         { "audio0",     "i2s0_sync",    0,              false},
216         { "audio1",     "i2s1_sync",    0,              false},
217         { "audio2",     "i2s2_sync",    0,              false},
218         { "audio3",     "i2s3_sync",    0,              false},
219         { "audio4",     "i2s4_sync",    0,              false},
220         { "vi_sensor",  "pll_p",        150000000,      false},
221         { "cilab",      "pll_p",        150000000,      false},
222         { "cilcd",      "pll_p",        150000000,      false},
223         { "cile",       "pll_p",        150000000,      false},
224         { "i2c1",       "pll_p",        3200000,        false},
225         { "i2c2",       "pll_p",        3200000,        false},
226         { "i2c3",       "pll_p",        3200000,        false},
227         { "i2c4",       "pll_p",        3200000,        false},
228         { "i2c5",       "pll_p",        3200000,        false},
229         { "extern3",    "clk_m",        12000000,       false},
230         { "dsia",       "pll_d2_out0",  0,              false},
231         { NULL,         NULL,           0,              0},
232 };
233
234 static struct bcm2079x_platform_data nfc_pdata = {
235         .irq_gpio = TEGRA_GPIO_PW2,
236         .en_gpio = TEGRA_GPIO_PU4,
237         .wake_gpio = TEGRA_GPIO_PX7,
238         };
239
240 static struct i2c_board_info __initdata pluto_i2c_bus3_board_info[] = {
241         {
242                 I2C_BOARD_INFO("bcm2079x-i2c", 0x77),
243                 .platform_data = &nfc_pdata,
244         },
245 };
246
247 static struct tegra_i2c_platform_data pluto_i2c1_platform_data = {
248         .adapter_nr     = 0,
249         .bus_count      = 1,
250         .bus_clk_rate   = { 100000, 0 },
251         .scl_gpio               = {TEGRA_GPIO_I2C1_SCL, 0},
252         .sda_gpio               = {TEGRA_GPIO_I2C1_SDA, 0},
253         .arb_recovery = arb_lost_recovery,
254 };
255
256 static struct tegra_i2c_platform_data pluto_i2c2_platform_data = {
257         .adapter_nr     = 1,
258         .bus_count      = 1,
259         .bus_clk_rate   = { 100000, 0 },
260         .is_clkon_always = true,
261         .scl_gpio               = {TEGRA_GPIO_I2C2_SCL, 0},
262         .sda_gpio               = {TEGRA_GPIO_I2C2_SDA, 0},
263         .arb_recovery = arb_lost_recovery,
264 };
265
266 static struct tegra_i2c_platform_data pluto_i2c3_platform_data = {
267         .adapter_nr     = 2,
268         .bus_count      = 1,
269         .bus_clk_rate   = { 400000, 0 },
270         .scl_gpio               = {TEGRA_GPIO_I2C3_SCL, 0},
271         .sda_gpio               = {TEGRA_GPIO_I2C3_SDA, 0},
272         .arb_recovery = arb_lost_recovery,
273 };
274
275 static struct tegra_i2c_platform_data pluto_i2c4_platform_data = {
276         .adapter_nr     = 3,
277         .bus_count      = 1,
278         .bus_clk_rate   = { 10000, 0 },
279         .scl_gpio               = {TEGRA_GPIO_I2C4_SCL, 0},
280         .sda_gpio               = {TEGRA_GPIO_I2C4_SDA, 0},
281         .arb_recovery = arb_lost_recovery,
282 };
283
284 static struct tegra_i2c_platform_data pluto_i2c5_platform_data = {
285         .adapter_nr     = 4,
286         .bus_count      = 1,
287         .bus_clk_rate   = { 400000, 0 },
288         .scl_gpio               = {TEGRA_GPIO_I2C5_SCL, 0},
289         .sda_gpio               = {TEGRA_GPIO_I2C5_SDA, 0},
290         .arb_recovery = arb_lost_recovery,
291 };
292
293 static struct aic3262_gpio_setup aic3262_gpio[] = {
294         /* GPIO 1*/
295         {
296                 .used = 1,
297                 .in = 0,
298                 .value = AIC3262_GPIO1_FUNC_INT1_OUTPUT ,
299         },
300         /* GPIO 2*/
301         {
302                 .used = 1,
303                 .in = 0,
304                 .value = AIC3262_GPIO2_FUNC_ADC_MOD_CLK_OUTPUT,
305         },
306         /* GPI1 */
307         {
308                 .used = 1,
309                 .in = 1,
310         },
311         /* GPI2 */
312         {
313                 .used = 1,
314                 .in = 1,
315                 .in_reg = AIC3262_DMIC_INPUT_CNTL,
316                 .in_reg_bitmask = AIC3262_DMIC_CONFIGURE_MASK,
317                 .in_reg_shift = AIC3262_DMIC_CONFIGURE_SHIFT,
318                 .value = AIC3262_DMIC_GPI2_LEFT_GPI2_RIGHT,
319         },
320         /* GPO1 */
321         {
322                 .used = 1,
323                 .in = 0,
324                 .value = AIC3262_GPO1_FUNC_MSO_OUTPUT_FOR_SPI,
325         },
326 };
327 static struct aic3xxx_pdata aic3262_codec_pdata = {
328         .gpio_irq       = 0,
329         .gpio           = aic3262_gpio,
330         .naudint_irq    = 0,
331         .irq_base       = AIC3262_CODEC_IRQ_BASE,
332 };
333
334 static struct i2c_board_info __initdata cs42l73_board_info = {
335         I2C_BOARD_INFO("cs42l73", 0x4a),
336 };
337
338 static struct i2c_board_info __initdata pluto_codec_a2220_info = {
339         I2C_BOARD_INFO("audience_a2220", 0x3E),
340 };
341
342 static struct i2c_board_info __initdata pluto_codec_aic326x_info = {
343         I2C_BOARD_INFO("tlv320aic3262", 0x18),
344         .platform_data = &aic3262_codec_pdata,
345 };
346
347 static void pluto_i2c_init(void)
348 {
349         tegra11_i2c_device1.dev.platform_data = &pluto_i2c1_platform_data;
350         tegra11_i2c_device2.dev.platform_data = &pluto_i2c2_platform_data;
351         tegra11_i2c_device3.dev.platform_data = &pluto_i2c3_platform_data;
352         tegra11_i2c_device4.dev.platform_data = &pluto_i2c4_platform_data;
353         tegra11_i2c_device5.dev.platform_data = &pluto_i2c5_platform_data;
354
355         platform_device_register(&tegra11_i2c_device5);
356         platform_device_register(&tegra11_i2c_device4);
357         platform_device_register(&tegra11_i2c_device3);
358         platform_device_register(&tegra11_i2c_device2);
359         platform_device_register(&tegra11_i2c_device1);
360
361         i2c_register_board_info(0, &pluto_codec_a2220_info, 1);
362         i2c_register_board_info(0, &cs42l73_board_info, 1);
363         pluto_i2c_bus3_board_info[0].irq = gpio_to_irq(TEGRA_GPIO_PW2);
364         i2c_register_board_info(0, pluto_i2c_bus3_board_info, 1);
365         i2c_register_board_info(0, &pluto_codec_aic326x_info, 1);
366 }
367
368 static struct platform_device *pluto_uart_devices[] __initdata = {
369         &tegra_uarta_device,
370         &tegra_uartb_device,
371         &tegra_uartc_device,
372         &tegra_uartd_device,
373 };
374 static struct uart_clk_parent uart_parent_clk[] = {
375         [0] = {.name = "clk_m"},
376         [1] = {.name = "pll_p"},
377 #ifndef CONFIG_TEGRA_PLLM_RESTRICTED
378         [2] = {.name = "pll_m"},
379 #endif
380 };
381
382 static struct tegra_uart_platform_data pluto_uart_pdata;
383 static struct tegra_uart_platform_data pluto_loopback_uart_pdata;
384
385 static void __init uart_debug_init(void)
386 {
387         int debug_port_id;
388
389         debug_port_id = uart_console_debug_init(3);
390         if (debug_port_id < 0)
391                 return;
392         pluto_uart_devices[debug_port_id] = uart_console_debug_device;
393 }
394
395 static void __init pluto_uart_init(void)
396 {
397         struct clk *c;
398         int i;
399
400         for (i = 0; i < ARRAY_SIZE(uart_parent_clk); ++i) {
401                 c = tegra_get_clock_by_name(uart_parent_clk[i].name);
402                 if (IS_ERR_OR_NULL(c)) {
403                         pr_err("Not able to get the clock for %s\n",
404                                                 uart_parent_clk[i].name);
405                         continue;
406                 }
407                 uart_parent_clk[i].parent_clk = c;
408                 uart_parent_clk[i].fixed_clk_rate = clk_get_rate(c);
409         }
410         pluto_uart_pdata.parent_clk_list = uart_parent_clk;
411         pluto_uart_pdata.parent_clk_count = ARRAY_SIZE(uart_parent_clk);
412         pluto_loopback_uart_pdata.parent_clk_list = uart_parent_clk;
413         pluto_loopback_uart_pdata.parent_clk_count =
414                                                 ARRAY_SIZE(uart_parent_clk);
415         pluto_loopback_uart_pdata.is_loopback = true;
416         tegra_uarta_device.dev.platform_data = &pluto_uart_pdata;
417         tegra_uartb_device.dev.platform_data = &pluto_uart_pdata;
418         tegra_uartc_device.dev.platform_data = &pluto_uart_pdata;
419         tegra_uartd_device.dev.platform_data = &pluto_uart_pdata;
420
421         /* Register low speed only if it is selected */
422         if (!is_tegra_debug_uartport_hs())
423                 uart_debug_init();
424
425         platform_add_devices(pluto_uart_devices,
426                                 ARRAY_SIZE(pluto_uart_devices));
427 }
428
429 static struct resource tegra_rtc_resources[] = {
430         [0] = {
431                 .start = TEGRA_RTC_BASE,
432                 .end = TEGRA_RTC_BASE + TEGRA_RTC_SIZE - 1,
433                 .flags = IORESOURCE_MEM,
434         },
435         [1] = {
436                 .start = INT_RTC,
437                 .end = INT_RTC,
438                 .flags = IORESOURCE_IRQ,
439         },
440 };
441
442 static struct platform_device tegra_rtc_device = {
443         .name = "tegra_rtc",
444         .id   = -1,
445         .resource = tegra_rtc_resources,
446         .num_resources = ARRAY_SIZE(tegra_rtc_resources),
447 };
448
449 static struct tegra_asoc_platform_data pluto_audio_pdata = {
450         .gpio_spkr_en           = TEGRA_GPIO_SPKR_EN,
451         .gpio_hp_det            = TEGRA_GPIO_HP_DET,
452         .gpio_hp_mute           = -1,
453         .gpio_int_mic_en        = TEGRA_GPIO_INT_MIC_EN,
454         .gpio_ext_mic_en        = TEGRA_GPIO_EXT_MIC_EN,
455         .gpio_ldo1_en           = TEGRA_GPIO_LDO1_EN,
456         .edp_support            =  true,
457         .edp_states             = {1776, 888, 0},
458         .i2s_param[HIFI_CODEC]  = {
459                 .audio_port_id  = 1,
460                 .is_i2s_master  = 0,
461                 .i2s_mode       = TEGRA_DAIFMT_I2S,
462                 .sample_size    = 16,
463                 .channels       = 2,
464         },
465         .i2s_param[BASEBAND]    = {
466                 .audio_port_id  = 2,
467                 .is_i2s_master  = 1,
468                 .i2s_mode       = TEGRA_DAIFMT_I2S,
469                 .sample_size    = 16,
470                 .rate           = 16000,
471                 .channels       = 2,
472                 .bit_clk        = 1024000,
473         },
474         .i2s_param[BT_SCO]      = {
475                 .audio_port_id  = 3,
476                 .is_i2s_master  = 1,
477                 .i2s_mode       = TEGRA_DAIFMT_DSP_A,
478                 .sample_size    = 16,
479                 .channels       = 1,
480                 .bit_clk        = 512000,
481         },
482         .i2s_param[VOICE_CODEC] = {
483                 .audio_port_id  = 0,
484                 .is_i2s_master  = 1,
485                 .i2s_mode       = TEGRA_DAIFMT_I2S,
486                 .sample_size    = 16,
487                 .rate           = 16000,
488                 .channels       = 2,
489         },
490 };
491
492 static struct tegra_asoc_platform_data pluto_aic3262_pdata = {
493         .gpio_spkr_en           = TEGRA_GPIO_SPKR_EN,
494         .gpio_hp_det            = TEGRA_GPIO_HP_DET,
495         .gpio_hp_mute           = -1,
496         .gpio_int_mic_en        = TEGRA_GPIO_INT_MIC_EN,
497         .gpio_ext_mic_en        = TEGRA_GPIO_EXT_MIC_EN,
498         .gpio_ldo1_en           = TEGRA_GPIO_LDO1_EN,
499         .edp_support            = true,
500         .edp_states             = {1776, 888, 0},
501         .i2s_param[HIFI_CODEC]  = {
502                 .audio_port_id  = 1,
503                 .is_i2s_master  = 0,
504                 .i2s_mode       = TEGRA_DAIFMT_I2S,
505                 .sample_size    = 16,
506                 .rate           = 48000,
507                 .channels       = 2,
508         },
509         .i2s_param[BASEBAND]    = {
510                 .audio_port_id  = 2,
511                 .is_i2s_master  = 1,
512                 .i2s_mode       = TEGRA_DAIFMT_I2S,
513                 .sample_size    = 16,
514                 .rate           = 16000,
515                 .channels       = 2,
516                 .bit_clk        = 1024000,
517         },
518         .i2s_param[BT_SCO]      = {
519                 .audio_port_id  = 3,
520                 .is_i2s_master  = 1,
521                 .i2s_mode       = TEGRA_DAIFMT_DSP_A,
522                 .sample_size    = 16,
523                 .channels       = 1,
524                 .bit_clk        = 512000,
525         },
526         .i2s_param[VOICE_CODEC] = {
527                 .audio_port_id  = 0,
528                 .is_i2s_master  = 1,
529                 .i2s_mode       = TEGRA_DAIFMT_I2S,
530                 .sample_size    = 16,
531                 .rate           = 16000,
532                 .channels       = 2,
533         },
534 };
535
536 static struct platform_device pluto_audio_device = {
537         .name   = "tegra-snd-cs42l73",
538         .id     = 2,
539         .dev    = {
540                 .platform_data = &pluto_audio_pdata,
541         },
542 };
543
544 static struct platform_device pluto_audio_aic326x_device = {
545         .name   = "tegra-snd-aic326x",
546         .id     = 2,
547         .dev    = {
548                 .platform_data  = &pluto_aic3262_pdata,
549         },
550 };
551
552
553 static struct tegra_spi_device_controller_data dev_bdata = {
554         .rx_clk_tap_delay = 0,
555         .tx_clk_tap_delay = 0,
556 };
557 static struct spi_board_info aic326x_spi_board_info[] = {
558         {
559                 .modalias = "tlv320aic3xxx",
560                 .bus_num = 3,
561                 .chip_select = 0,
562                 .max_speed_hz = 4*1000*1000,
563                 .mode = SPI_MODE_1,
564                 .controller_data = &dev_bdata,
565                 .platform_data = &aic3262_codec_pdata,
566         },
567 };
568
569
570
571 #ifdef CONFIG_MHI_NETDEV
572 struct platform_device mhi_netdevice0 = {
573         .name = "mhi_net_device",
574         .id = 0,
575 };
576 #endif /* CONFIG_MHI_NETDEV */
577
578 static struct platform_device *pluto_devices[] __initdata = {
579         &tegra_pmu_device,
580         &tegra_rtc_device,
581         &tegra_udc_device,
582 #if defined(CONFIG_TEGRA_IOVMM_SMMU) || defined(CONFIG_TEGRA_IOMMU_SMMU)
583         &tegra_smmu_device,
584 #endif
585 #if defined(CONFIG_TEGRA_WATCHDOG)
586         &tegra_wdt0_device,
587 #endif
588 #if defined(CONFIG_TEGRA_AVP)
589         &tegra_avp_device,
590 #endif
591 #if defined(CONFIG_CRYPTO_DEV_TEGRA_SE)
592         &tegra11_se_device,
593 #endif
594         &tegra_ahub_device,
595         &tegra_pcm_device,
596         &tegra_dam_device0,
597         &tegra_dam_device1,
598         &tegra_dam_device2,
599         &tegra_i2s_device0,
600         &tegra_i2s_device1,
601         &tegra_i2s_device2,
602         &tegra_i2s_device3,
603         &tegra_i2s_device4,
604         &tegra_spdif_device,
605         &spdif_dit_device,
606         &bluetooth_dit_device,
607         &baseband_dit_device,
608         &pluto_audio_device,
609         &pluto_audio_aic326x_device,
610         &tegra_hda_device,
611 #if defined(CONFIG_CRYPTO_DEV_TEGRA_AES)
612         &tegra_aes_device,
613 #endif
614 #ifdef CONFIG_MHI_NETDEV
615         &mhi_netdevice0,  /* MHI netdevice */
616 #endif /* CONFIG_MHI_NETDEV */
617 };
618
619 #ifdef CONFIG_USB_SUPPORT
620
621 static void pluto_usb_hsic_postsupend(void)
622 {
623         pr_debug("%s\n", __func__);
624 #ifdef CONFIG_TEGRA_BB_XMM_POWER
625         baseband_xmm_set_power_status(BBXMM_PS_L2);
626 #endif
627 }
628
629 static void pluto_usb_hsic_preresume(void)
630 {
631         pr_debug("%s\n", __func__);
632 #ifdef CONFIG_TEGRA_BB_XMM_POWER
633         baseband_xmm_set_power_status(BBXMM_PS_L2TOL0);
634 #endif
635 }
636
637 static void pluto_usb_hsic_post_resume(void)
638 {
639         pr_debug("%s\n", __func__);
640 #ifdef CONFIG_TEGRA_BB_XMM_POWER
641         baseband_xmm_set_power_status(BBXMM_PS_L0);
642 #endif
643 }
644
645 static void pluto_usb_hsic_phy_power(void)
646 {
647         pr_debug("%s\n", __func__);
648 #ifdef CONFIG_TEGRA_BB_XMM_POWER
649         baseband_xmm_set_power_status(BBXMM_PS_L0);
650 #endif
651 }
652
653 static void pluto_usb_hsic_post_phy_off(void)
654 {
655         pr_debug("%s\n", __func__);
656 #ifdef CONFIG_TEGRA_BB_XMM_POWER
657         baseband_xmm_set_power_status(BBXMM_PS_L2);
658 #endif
659 }
660
661 static struct tegra_usb_phy_platform_ops oem2_plat_ops = {
662         .post_suspend = pluto_usb_hsic_postsupend,
663         .pre_resume = pluto_usb_hsic_preresume,
664         .port_power = pluto_usb_hsic_phy_power,
665         .post_resume = pluto_usb_hsic_post_resume,
666         .post_phy_off = pluto_usb_hsic_post_phy_off,
667 };
668
669 static struct tegra_usb_platform_data tegra_ehci3_hsic_smsc_hub_pdata = {
670         .port_otg = false,
671         .has_hostpc = true,
672         .unaligned_dma_buf_supported = false,
673         .phy_intf = TEGRA_USB_PHY_INTF_HSIC,
674         .op_mode        = TEGRA_USB_OPMODE_HOST,
675         .u_data.host = {
676                 .vbus_gpio = -1,
677                 .hot_plug = false,
678                 .remote_wakeup_supported = true,
679                 .power_off_on_suspend = true,
680         },
681 };
682
683 static struct tegra_usb_platform_data tegra_udc_pdata = {
684         .port_otg = true,
685         .has_hostpc = true,
686         .support_pmu_vbus = true,
687         .id_det_type = TEGRA_USB_PMU_ID,
688         .unaligned_dma_buf_supported = false,
689         .phy_intf = TEGRA_USB_PHY_INTF_UTMI,
690         .op_mode = TEGRA_USB_OPMODE_DEVICE,
691         .u_data.dev = {
692                 .vbus_pmu_irq = 0,
693                 .vbus_gpio = -1,
694                 .charging_supported = false,
695                 .remote_wakeup_supported = false,
696         },
697         .u_cfg.utmi = {
698                 .hssync_start_delay = 0,
699                 .elastic_limit = 16,
700                 .idle_wait_delay = 17,
701                 .term_range_adj = 6,
702                 .xcvr_setup = 8,
703                 .xcvr_lsfslew = 0,
704                 .xcvr_lsrslew = 3,
705                 .xcvr_setup_offset = 0,
706                 .xcvr_use_fuses = 1,
707         },
708 };
709
710 static struct tegra_usb_platform_data tegra_ehci1_utmi_pdata = {
711         .port_otg = true,
712         .has_hostpc = true,
713         .support_pmu_vbus = true,
714         .id_det_type = TEGRA_USB_PMU_ID,
715         .unaligned_dma_buf_supported = false,
716         .phy_intf = TEGRA_USB_PHY_INTF_UTMI,
717         .op_mode = TEGRA_USB_OPMODE_HOST,
718         .u_data.host = {
719                 .vbus_gpio = -1,
720                 .hot_plug = false,
721                 .remote_wakeup_supported = true,
722                 .power_off_on_suspend = true,
723         },
724         .u_cfg.utmi = {
725                 .hssync_start_delay = 0,
726                 .elastic_limit = 16,
727                 .idle_wait_delay = 17,
728                 .term_range_adj = 6,
729                 .xcvr_setup = 15,
730                 .xcvr_lsfslew = 0,
731                 .xcvr_lsrslew = 3,
732                 .xcvr_setup_offset = 0,
733                 .xcvr_use_fuses = 1,
734                 .vbus_oc_map = 0x7,
735         },
736 };
737
738 static struct tegra_xusb_board_data xusb_bdata = {
739         .portmap = TEGRA_XUSB_SS_P0 | TEGRA_XUSB_USB2_P0,
740         /* ss_portmap[0:3] = SS0 map, ss_portmap[4:7] = SS1 map */
741         .ss_portmap = (TEGRA_XUSB_SS_PORT_MAP_USB2_P0 << 0),
742 };
743
744 static struct tegra_usb_otg_data tegra_otg_pdata = {
745         .ehci_device = &tegra_ehci1_device,
746         .ehci_pdata = &tegra_ehci1_utmi_pdata,
747         .id_extcon_dev_name = "MAX77665_MUIC_ID",
748         .vbus_extcon_dev_name = "palmas-extcon",
749 };
750
751 static struct regulator *baseband_reg;
752 static struct gpio modem_gpios[] = { /* i500 modem */
753         {MDM_RST, GPIOF_OUT_INIT_LOW, "MODEM RESET"},
754 };
755
756 static struct gpio modem2_gpios[] = {
757         {MDM2_PWR_ON, GPIOF_OUT_INIT_LOW, "MODEM2 PWR ON"},
758         {MDM2_RST, GPIOF_OUT_INIT_LOW, "MODEM2 RESET"},
759 };
760
761 static struct tegra_usb_platform_data tegra_ehci2_hsic_baseband_pdata = {
762         .port_otg = false,
763         .has_hostpc = true,
764         .unaligned_dma_buf_supported = false,
765         .phy_intf = TEGRA_USB_PHY_INTF_HSIC,
766         .op_mode = TEGRA_USB_OPMODE_HOST,
767         .u_data.host = {
768                 .vbus_gpio = -1,
769                 .hot_plug = false,
770                 .remote_wakeup_supported = true,
771                 .power_off_on_suspend = true,
772         },
773 };
774
775 static struct tegra_usb_platform_data tegra_ehci3_hsic_baseband2_pdata = {
776         .port_otg = false,
777         .has_hostpc = true,
778         .unaligned_dma_buf_supported = false,
779         .phy_intf = TEGRA_USB_PHY_INTF_HSIC,
780         .op_mode = TEGRA_USB_OPMODE_HOST,
781         .u_data.host = {
782                 .vbus_gpio = -1,
783                 .hot_plug = false,
784                 .remote_wakeup_supported = true,
785                 .power_off_on_suspend = true,
786         },
787 };
788
789 static struct tegra_usb_platform_data tegra_hsic_pdata = {
790         .port_otg = false,
791         .has_hostpc = true,
792         .unaligned_dma_buf_supported = false,
793         .phy_intf = TEGRA_USB_PHY_INTF_HSIC,
794         .op_mode        = TEGRA_USB_OPMODE_HOST,
795         .u_data.host = {
796                 .vbus_gpio = -1,
797                 .hot_plug = false,
798                 .remote_wakeup_supported = true,
799                 .power_off_on_suspend = true,
800         },
801 };
802
803 static struct platform_device *
804 tegra_usb_hsic_host_register(struct platform_device *ehci_dev)
805 {
806         struct platform_device *pdev;
807         int val;
808
809         pdev = platform_device_alloc(ehci_dev->name, ehci_dev->id);
810         if (!pdev)
811                 return NULL;
812
813         val = platform_device_add_resources(pdev, ehci_dev->resource,
814                                                 ehci_dev->num_resources);
815         if (val)
816                 goto error;
817
818         pdev->dev.dma_mask =  ehci_dev->dev.dma_mask;
819         pdev->dev.coherent_dma_mask = ehci_dev->dev.coherent_dma_mask;
820
821         val = platform_device_add_data(pdev, &tegra_hsic_pdata,
822                         sizeof(struct tegra_usb_platform_data));
823         if (val)
824                 goto error;
825
826         val = platform_device_add(pdev);
827         if (val)
828                 goto error;
829
830         return pdev;
831
832 error:
833         pr_err("%s: failed to add the host contoller device\n", __func__);
834         platform_device_put(pdev);
835         return NULL;
836 }
837
838 static void tegra_usb_hsic_host_unregister(struct platform_device **platdev)
839 {
840         struct platform_device *pdev = *platdev;
841
842         if (pdev && &pdev->dev) {
843                 platform_device_unregister(pdev);
844                 *platdev = NULL;
845         } else
846                 pr_err("%s: no platform device\n", __func__);
847 }
848
849 static struct tegra_usb_phy_platform_ops oem1_hsic_pops;
850
851 static union tegra_bb_gpio_id bb_gpio_oem1 = {
852         .oem1 = {
853                 .reset = BB_OEM1_GPIO_RST,
854                 .pwron = BB_OEM1_GPIO_ON,
855                 .awr = BB_OEM1_GPIO_AWR,
856                 .cwr = BB_OEM1_GPIO_CWR,
857                 .spare = BB_OEM1_GPIO_SPARE,
858                 .wdi = BB_OEM1_GPIO_WDI,
859         },
860 };
861
862 static struct tegra_bb_pdata bb_pdata_oem1 = {
863         .id = &bb_gpio_oem1,
864         .device = &tegra_ehci3_device,
865         .ehci_register = tegra_usb_hsic_host_register,
866         .ehci_unregister = tegra_usb_hsic_host_unregister,
867         .bb_id = TEGRA_BB_OEM1,
868 };
869
870 static struct platform_device tegra_bb_oem1 = {
871         .name = "tegra_baseband_power",
872         .id = -1,
873         .dev = {
874                 .platform_data = &bb_pdata_oem1,
875         },
876 };
877
878 static int baseband_init(void)
879 {
880         int ret;
881
882         ret = gpio_request_array(modem_gpios, ARRAY_SIZE(modem_gpios));
883         if (ret) {
884                 pr_warn("%s:gpio request failed\n", __func__);
885                 return ret;
886         }
887
888         baseband_reg = regulator_get(NULL, "vdd_core_bb");
889         if (IS_ERR_OR_NULL(baseband_reg))
890                 pr_warn("%s: baseband regulator get failed\n", __func__);
891         else
892                 regulator_enable(baseband_reg);
893
894         /* enable pull-up for MDM1 UART RX */
895         tegra_pinmux_set_pullupdown(TEGRA_PINGROUP_GPIO_PU1,
896                                     TEGRA_PUPD_PULL_UP);
897
898         /* enable pull-down for MDM1_COLD_BOOT */
899         tegra_pinmux_set_pullupdown(TEGRA_PINGROUP_ULPI_DATA4,
900                                     TEGRA_PUPD_PULL_DOWN);
901
902         /* export GPIO for user space access through sysfs */
903         gpio_export(MDM_RST, false);
904
905         return 0;
906 }
907
908 static const struct tegra_modem_operations baseband_operations = {
909         .init = baseband_init,
910 };
911
912 #define MODEM_BOOT_EDP_MAX 0
913 /* FIXME: get accurate boot current value */
914 static unsigned int modem_boot_edp_states[] = { 1900, 0 };
915 static struct edp_client modem_boot_edp_client = {
916         .name = "modem_boot",
917         .states = modem_boot_edp_states,
918         .num_states = ARRAY_SIZE(modem_boot_edp_states),
919         .e0_index = MODEM_BOOT_EDP_MAX,
920         .priority = EDP_MAX_PRIO,
921 };
922
923 static struct tegra_usb_modem_power_platform_data baseband_pdata = {
924         .ops = &baseband_operations,
925         .wake_gpio = -1,
926         .boot_gpio = MDM_COLDBOOT,
927         .boot_irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
928         .autosuspend_delay = 2000,
929         .short_autosuspend_delay = 50,
930         .tegra_ehci_device = &tegra_ehci2_device,
931         .tegra_ehci_pdata = &tegra_ehci2_hsic_baseband_pdata,
932         .modem_boot_edp_client = &modem_boot_edp_client,
933         .edp_manager_name = "battery",
934         .i_breach_ppm = 500000,
935         /* FIXME: get useful adjperiods */
936         .i_thresh_3g_adjperiod = 10000,
937         .i_thresh_lte_adjperiod = 10000,
938 };
939
940 static struct platform_device icera_baseband_device = {
941         .name = "tegra_usb_modem_power",
942         .id = -1,
943         .dev = {
944                 .platform_data = &baseband_pdata,
945         },
946 };
947
948 static void baseband2_start(void)
949 {
950         pr_info("%s\n", __func__);
951         gpio_set_value(MDM2_PWR_ON, 1);
952 }
953
954 static void baseband2_reset(void)
955 {
956         /* Initiate power cycle on baseband sub system */
957         pr_info("%s\n", __func__);
958         gpio_set_value(MDM2_RST, 0);
959         mdelay(200);
960         gpio_set_value(MDM2_RST, 1);
961 }
962
963 static int baseband2_init(void)
964 {
965         int ret;
966
967         tegra_pinmux_set_tristate(TEGRA_PINGROUP_GPIO_X1_AUD, TEGRA_TRI_NORMAL);
968
969         ret = gpio_request_array(modem2_gpios, ARRAY_SIZE(modem2_gpios));
970         if (ret)
971                 return ret;
972
973         /* enable pull-down for MDM2_COLD_BOOT */
974         tegra_pinmux_set_pullupdown(TEGRA_PINGROUP_KB_ROW4,
975                                     TEGRA_PUPD_PULL_DOWN);
976
977         /* export GPIO for user space access through sysfs */
978         gpio_export(MDM2_RST, false);
979
980         return 0;
981 }
982
983 static const struct tegra_modem_operations baseband2_operations = {
984         .init = baseband2_init,
985         .start = baseband2_start,
986         .reset = baseband2_reset,
987 };
988
989 static struct tegra_usb_modem_power_platform_data baseband2_pdata = {
990         .ops = &baseband2_operations,
991         .wake_gpio = -1,
992         .boot_gpio = MDM2_COLDBOOT,
993         .boot_irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
994         .autosuspend_delay = 2000,
995         .short_autosuspend_delay = 50,
996         .tegra_ehci_device = &tegra_ehci3_device,
997         .tegra_ehci_pdata = &tegra_ehci3_hsic_baseband2_pdata,
998 };
999
1000 static struct platform_device icera_baseband2_device = {
1001         .name = "tegra_usb_modem_power",
1002         .id = -1,
1003         .dev = {
1004                 .platform_data = &baseband2_pdata,
1005         },
1006 };
1007
1008 static struct baseband_power_platform_data tegra_baseband_xmm_power_data = {
1009         .baseband_type = BASEBAND_XMM,
1010         .modem = {
1011                 .xmm = {
1012                         .bb_rst = XMM_GPIO_BB_RST,
1013                         .bb_on = XMM_GPIO_BB_ON,
1014                         .ipc_bb_wake = XMM_GPIO_IPC_BB_WAKE,
1015                         .ipc_ap_wake = XMM_GPIO_IPC_AP_WAKE,
1016                         .ipc_hsic_active = XMM_GPIO_IPC_HSIC_ACTIVE,
1017                         .ipc_hsic_sus_req = XMM_GPIO_IPC_HSIC_SUS_REQ,
1018                 },
1019         },
1020 };
1021
1022 static struct platform_device tegra_baseband_xmm_power_device = {
1023         .name = "baseband_xmm_power",
1024         .id = -1,
1025         .dev = {
1026                 .platform_data = &tegra_baseband_xmm_power_data,
1027         },
1028 };
1029
1030 static struct platform_device tegra_baseband_xmm_power2_device = {
1031         .name = "baseband_xmm_power2",
1032         .id = -1,
1033         .dev = {
1034                 .platform_data = &tegra_baseband_xmm_power_data,
1035         },
1036 };
1037
1038 static void pluto_usb_init(void)
1039 {
1040         int usb_port_owner_info = tegra_get_usb_port_owner_info();
1041         struct tegra_xusb_platform_data *xusb_pdata;
1042
1043         if ((usb_port_owner_info & UTMI1_PORT_OWNER_XUSB)) {
1044                 xusb_pdata = tegra_xusb_init(&xusb_bdata);
1045                 tegra_otg_pdata.is_xhci = true;
1046                 tegra_otg_pdata.xhci_device = &tegra_xhci_device;
1047                 tegra_otg_pdata.xhci_pdata = xusb_pdata;
1048         } else {
1049                 tegra_otg_pdata.is_xhci = false;
1050         }
1051         tegra_otg_device.dev.platform_data = &tegra_otg_pdata;
1052         platform_device_register(&tegra_otg_device);
1053
1054         /* Setup the udc platform data */
1055         tegra_udc_device.dev.platform_data = &tegra_udc_pdata;
1056 }
1057
1058 static void pluto_modem_init(void)
1059 {
1060         int modem_id = tegra_get_modem_id();
1061         struct board_info board_info;
1062         int usb_port_owner_info = tegra_get_usb_port_owner_info();
1063
1064         tegra_get_board_info(&board_info);
1065         pr_info("%s: modem_id = %d\n", __func__, modem_id);
1066
1067         switch (modem_id) {
1068         case TEGRA_BB_I500: /* on board i500 HSIC */
1069                 if (!(usb_port_owner_info & HSIC1_PORT_OWNER_XUSB)) {
1070                         platform_device_register(&icera_baseband_device);
1071                 }
1072                 break;
1073         case TEGRA_BB_I500SWD: /* i500 SWD HSIC */
1074                 if (!(usb_port_owner_info & HSIC2_PORT_OWNER_XUSB)) {
1075                         platform_device_register(&icera_baseband2_device);
1076                 }
1077                 break;
1078         case TEGRA_BB_OEM1:     /* OEM1 HSIC */
1079                 if ((board_info.board_id == BOARD_E1575) ||
1080                         ((board_info.board_id == BOARD_E1580) &&
1081                                 (board_info.fab >= BOARD_FAB_A03))) {
1082                         tegra_pinmux_set_tristate(TEGRA_PINGROUP_GPIO_X1_AUD,
1083                                                         TEGRA_TRI_NORMAL);
1084                         bb_gpio_oem1.oem1.pwron = BB_OEM1_GPIO_ON_V;
1085                 }
1086                 if (!(usb_port_owner_info & HSIC2_PORT_OWNER_XUSB)) {
1087                         tegra_hsic_pdata.ops = &oem1_hsic_pops;
1088                         tegra_ehci3_device.dev.platform_data
1089                                 = &tegra_hsic_pdata;
1090                         platform_device_register(&tegra_bb_oem1);
1091                 }
1092                 break;
1093         case TEGRA_BB_OEM2: /* XMM6260/XMM6360 HSIC */
1094                 /* fix wrong wiring in Pluto A02 */
1095                 if ((board_info.board_id == BOARD_E1580) &&
1096                         (board_info.fab == BOARD_FAB_A02)) {
1097                         pr_info(
1098 "%s: Pluto A02: replace MDM2_PWR_ON with MDM2_PWR_ON_FOR_PLUTO_A02\n",
1099                                 __func__);
1100                         if (tegra_baseband_xmm_power_data.modem.xmm.bb_on
1101                                 != MDM2_PWR_ON)
1102                                 pr_err(
1103 "%s: expected MDM2_PWR_ON default gpio for XMM bb_on\n",
1104                                         __func__);
1105                         tegra_baseband_xmm_power_data.modem.xmm.bb_on
1106                                 = MDM2_PWR_ON_FOR_PLUTO_A02;
1107                 }
1108                 /* baseband-power.ko will register ehci3 device */
1109                 tegra_hsic_pdata.ops = &oem2_plat_ops;
1110                 tegra_hsic_pdata.u_data.host.remote_wakeup_supported = false;
1111                 tegra_hsic_pdata.u_data.host.power_off_on_suspend = false;
1112                 tegra_ehci3_device.dev.platform_data =
1113                                         &tegra_hsic_pdata;
1114                 tegra_baseband_xmm_power_data.hsic_register =
1115                                                 &tegra_usb_hsic_host_register;
1116                 tegra_baseband_xmm_power_data.hsic_unregister =
1117                                                 &tegra_usb_hsic_host_unregister;
1118                 tegra_baseband_xmm_power_data.ehci_device =
1119                                         &tegra_ehci3_device;
1120                 platform_device_register(&tegra_baseband_xmm_power_device);
1121                 platform_device_register(&tegra_baseband_xmm_power2_device);
1122                 /* override audio settings - use 8kHz */
1123                 pluto_audio_pdata.i2s_param[BASEBAND].audio_port_id
1124                         = 2;
1125                 pluto_audio_pdata.i2s_param[BASEBAND].is_i2s_master
1126                         = 1;
1127                 pluto_audio_pdata.i2s_param[BASEBAND].i2s_mode
1128                         = TEGRA_DAIFMT_I2S;
1129                 pluto_audio_pdata.i2s_param[BASEBAND].sample_size
1130                         = 16;
1131                 pluto_audio_pdata.i2s_param[BASEBAND].rate
1132                         = 8000;
1133                 pluto_audio_pdata.i2s_param[BASEBAND].channels
1134                         = 2;
1135                 break;
1136         case TEGRA_BB_HSIC_HUB: /* HSIC hub */
1137                 if (!(usb_port_owner_info & HSIC2_PORT_OWNER_XUSB)) {
1138                         tegra_ehci3_device.dev.platform_data =
1139                                 &tegra_ehci3_hsic_smsc_hub_pdata;
1140                         platform_device_register(&tegra_ehci3_device);
1141                 }
1142                 break;
1143         default:
1144                 return;
1145         }
1146 }
1147
1148 #else
1149 static void pluto_usb_init(void) { }
1150 static void pluto_modem_init(void) { }
1151 #endif
1152
1153 static void pluto_audio_init(void)
1154 {
1155         struct board_info board_info;
1156
1157         tegra_get_board_info(&board_info);
1158
1159         spi_register_board_info(aic326x_spi_board_info,
1160                                         ARRAY_SIZE(aic326x_spi_board_info));
1161 }
1162
1163 static struct platform_device *pluto_spi_devices[] __initdata = {
1164         &tegra11_spi_device4,
1165 };
1166
1167 struct spi_clk_parent spi_parent_clk_pluto[] = {
1168         [0] = {.name = "pll_p"},
1169 #ifndef CONFIG_TEGRA_PLLM_RESTRICTED
1170         [1] = {.name = "pll_m"},
1171         [2] = {.name = "clk_m"},
1172 #else
1173         [1] = {.name = "clk_m"},
1174 #endif
1175 };
1176
1177 static struct tegra_spi_platform_data pluto_spi_pdata = {
1178         .max_dma_buffer         = 16 * 1024,
1179         .is_clkon_always        = false,
1180         .max_rate               = 25000000,
1181 };
1182
1183 static void __init pluto_spi_init(void)
1184 {
1185         int i;
1186         struct clk *c;
1187         struct board_info board_info, display_board_info;
1188
1189         tegra_get_board_info(&board_info);
1190         tegra_get_display_board_info(&display_board_info);
1191
1192         for (i = 0; i < ARRAY_SIZE(spi_parent_clk_pluto); ++i) {
1193                 c = tegra_get_clock_by_name(spi_parent_clk_pluto[i].name);
1194                 if (IS_ERR_OR_NULL(c)) {
1195                         pr_err("Not able to get the clock for %s\n",
1196                                                 spi_parent_clk_pluto[i].name);
1197                         continue;
1198                 }
1199                 spi_parent_clk_pluto[i].parent_clk = c;
1200                 spi_parent_clk_pluto[i].fixed_clk_rate = clk_get_rate(c);
1201         }
1202         pluto_spi_pdata.parent_clk_list = spi_parent_clk_pluto;
1203         pluto_spi_pdata.parent_clk_count = ARRAY_SIZE(spi_parent_clk_pluto);
1204         pluto_spi_pdata.is_dma_based = (tegra_revision == TEGRA_REVISION_A01)
1205                                                 ? false : true ;
1206         tegra11_spi_device4.dev.platform_data = &pluto_spi_pdata;
1207         platform_add_devices(pluto_spi_devices,
1208                                 ARRAY_SIZE(pluto_spi_devices));
1209 }
1210
1211 static __initdata struct tegra_clk_init_table touch_clk_init_table[] = {
1212         /* name         parent          rate            enabled */
1213         { "extern2",    "pll_p",        41000000,       false},
1214         { "clk_out_2",  "extern2",      40800000,       false},
1215         { NULL,         NULL,           0,              0},
1216 };
1217
1218 struct rm_spi_ts_platform_data rm31080ts_pluto_data = {
1219         .gpio_reset = TOUCH_GPIO_RST_RAYDIUM_SPI,
1220         .config = 0,
1221         .platform_id = RM_PLATFORM_P005,
1222         .name_of_clock = "clk_out_2",
1223         .name_of_clock_con = "extern2",
1224 };
1225
1226 static struct tegra_spi_device_controller_data dev_cdata = {
1227         .rx_clk_tap_delay = 0,
1228         .tx_clk_tap_delay = 0,
1229 };
1230
1231 struct spi_board_info rm31080a_pluto_spi_board[1] = {
1232         {
1233          .modalias = "rm_ts_spidev",
1234          .bus_num = 3,
1235          .chip_select = 2,
1236          .max_speed_hz = 12 * 1000 * 1000,
1237          .mode = SPI_MODE_0,
1238          .controller_data = &dev_cdata,
1239          .platform_data = &rm31080ts_pluto_data,
1240          },
1241 };
1242
1243 static int __init pluto_touch_init(void)
1244 {
1245         tegra_clk_init_from_table(touch_clk_init_table);
1246         rm31080a_pluto_spi_board[0].irq = gpio_to_irq(TOUCH_GPIO_IRQ_RAYDIUM_SPI);
1247         touch_init_raydium(TOUCH_GPIO_IRQ_RAYDIUM_SPI,
1248                                 TOUCH_GPIO_RST_RAYDIUM_SPI,
1249                                 &rm31080ts_pluto_data,
1250                                 &rm31080a_pluto_spi_board[0],
1251                                 ARRAY_SIZE(rm31080a_pluto_spi_board));
1252         return 0;
1253 }
1254
1255 static void __init pluto_dtv_init(void)
1256 {
1257         platform_device_register(&tegra_dtv_device);
1258 }
1259
1260 static void __init tegra_pluto_init(void)
1261 {
1262         pluto_sysedp_init();
1263         tegra_clk_init_from_table(pluto_clk_init_table);
1264         tegra_clk_verify_parents();
1265         tegra_soc_device_init("tegra_pluto");
1266         tegra_enable_pinmux();
1267         pluto_pinmux_init();
1268         pluto_i2c_init();
1269         pluto_spi_init();
1270         pluto_usb_init();
1271         pluto_uart_init();
1272         pluto_audio_init();
1273         platform_add_devices(pluto_devices, ARRAY_SIZE(pluto_devices));
1274         tegra_ram_console_debug_init();
1275         tegra_io_dpd_init();
1276         pluto_sdhci_init();
1277         pluto_regulator_init();
1278         pluto_dtv_init();
1279         pluto_suspend_init();
1280         pluto_touch_init();
1281         pluto_emc_init();
1282         pluto_edp_init();
1283         pluto_panel_init();
1284         pluto_pmon_init();
1285         pluto_kbc_init();
1286 #ifdef CONFIG_BT_BLUESLEEP
1287         pluto_setup_bluesleep();
1288         pluto_setup_bt_rfkill();
1289 #elif defined CONFIG_BLUEDROID_PM
1290         pluto_setup_bluedroid_pm();
1291 #endif
1292         tegra_release_bootloader_fb();
1293         pluto_modem_init();
1294 #ifdef CONFIG_TEGRA_WDT_RECOVERY
1295         tegra_wdt_recovery_init();
1296 #endif
1297         pluto_sensors_init();
1298         tegra_serial_debug_init(TEGRA_UARTD_BASE, INT_WDT_CPU, NULL, -1, -1);
1299         pluto_soctherm_init();
1300         tegra_register_fuse();
1301         pluto_sysedp_core_init();
1302         pluto_sysedp_psydepl_init();
1303 }
1304
1305 static void __init pluto_ramconsole_reserve(unsigned long size)
1306 {
1307         tegra_ram_console_debug_reserve(SZ_1M);
1308 }
1309
1310 static void __init tegra_pluto_dt_init(void)
1311 {
1312 #ifdef CONFIG_USE_OF
1313         of_platform_populate(NULL,
1314                 of_default_bus_match_table, NULL, NULL);
1315 #endif
1316
1317         tegra_pluto_init();
1318 }
1319 static void __init tegra_pluto_reserve(void)
1320 {
1321 #if defined(CONFIG_NVMAP_CONVERT_CARVEOUT_TO_IOVMM)
1322         /* for PANEL_5_SHARP_1080p: 1920*1080*4*2 = 16588800 bytes */
1323         tegra_reserve(0, SZ_16M, SZ_4M);
1324 #else
1325         tegra_reserve(SZ_128M, SZ_16M, SZ_4M);
1326 #endif
1327         pluto_ramconsole_reserve(SZ_1M);
1328 }
1329
1330 static const char * const pluto_dt_board_compat[] = {
1331         "nvidia,pluto",
1332         NULL
1333 };
1334
1335 MACHINE_START(TEGRA_PLUTO, "tegra_pluto")
1336         .atag_offset    = 0x100,
1337         .soc            = &tegra_soc_desc,
1338         .map_io         = tegra_map_common_io,
1339         .reserve        = tegra_pluto_reserve,
1340         .init_early     = tegra11x_init_early,
1341         .init_irq       = tegra_init_irq,
1342         .handle_irq     = gic_handle_irq,
1343         .timer          = &tegra_timer,
1344         .init_machine   = tegra_pluto_dt_init,
1345         .restart        = tegra_assert_system_reset,
1346         .dt_compat      = pluto_dt_board_compat,
1347 MACHINE_END