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