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