eff5a0274d31d735cad9fa9096339b656c960adc
[linux-3.10.git] / arch / arm / mach-tegra / board-roth.c
1 /*
2  * arch/arm/mach-tegra/board-roth.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/spi-tegra.h>
37 #include <linux/memblock.h>
38 #include <linux/rfkill-gpio.h>
39 #include <linux/skbuff.h>
40 #include <linux/ti_wilink_st.h>
41 #include <linux/regulator/consumer.h>
42 #include <linux/max17048_battery.h>
43 #include <linux/leds.h>
44 #include <linux/leds_pwm.h>
45 #include <linux/i2c/at24.h>
46 #include <linux/issp.h>
47 #include <linux/of_platform.h>
48 #include <linux/usb/tegra_usb_phy.h>
49 #include <linux/clk/tegra.h>
50 #include <linux/clocksource.h>
51 #include <linux/irqchip.h>
52
53 #include <asm/system_info.h>
54
55 #include <mach/irqs.h>
56 #include <mach/pinmux.h>
57 #include <mach/pinmux-t11.h>
58 #include <mach/io_dpd.h>
59 #include <mach/i2s.h>
60 #include <mach/isomgr.h>
61 #include <mach/tegra_asoc_pdata.h>
62 #include <asm/mach-types.h>
63 #include <asm/mach/arch.h>
64 #include <mach/gpio-tegra.h>
65 #include <mach/tegra_fiq_debugger.h>
66 #include <mach/edp.h>
67
68 #include "board.h"
69 #include "board-common.h"
70 #include "clock.h"
71 #include "board-roth.h"
72 #include "devices.h"
73 #include "gpio-names.h"
74 #include "fuse.h"
75 #include "iomap.h"
76 #include "pm.h"
77 #include "common.h"
78 #include "tegra-board-id.h"
79 #include "board-touch-raydium.h"
80
81 #ifdef CONFIG_BT_BLUESLEEP
82 static struct rfkill_gpio_platform_data roth_bt_rfkill_pdata = {
83                 .name           = "bt_rfkill",
84                 .shutdown_gpio  = TEGRA_GPIO_PQ7,
85                 .type           = RFKILL_TYPE_BLUETOOTH,
86 };
87
88 static struct platform_device roth_bt_rfkill_device = {
89         .name = "rfkill_gpio",
90         .id             = -1,
91         .dev = {
92                 .platform_data = &roth_bt_rfkill_pdata,
93         },
94 };
95
96 static struct resource roth_bluesleep_resources[] = {
97         [0] = {
98                 .name = "gpio_host_wake",
99                         .start  = TEGRA_GPIO_PU6,
100                         .end    = TEGRA_GPIO_PU6,
101                         .flags  = IORESOURCE_IO,
102         },
103         [1] = {
104                 .name = "gpio_ext_wake",
105                         .start  = TEGRA_GPIO_PEE1,
106                         .end    = TEGRA_GPIO_PEE1,
107                         .flags  = IORESOURCE_IO,
108         },
109         [2] = {
110                 .name = "host_wake",
111                         .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
112         },
113 };
114
115 static struct platform_device roth_bluesleep_device = {
116         .name           = "bluesleep",
117         .id             = -1,
118         .num_resources  = ARRAY_SIZE(roth_bluesleep_resources),
119         .resource       = roth_bluesleep_resources,
120 };
121
122 static noinline void __init roth_setup_bt_rfkill(void)
123 {
124                 roth_bt_rfkill_pdata.reset_gpio = TEGRA_GPIO_PQ6;
125         platform_device_register(&roth_bt_rfkill_device);
126 }
127
128 static noinline void __init roth_setup_bluesleep(void)
129 {
130         roth_bluesleep_resources[2].start =
131                 roth_bluesleep_resources[2].end =
132                         gpio_to_irq(TEGRA_GPIO_PU6);
133         platform_device_register(&roth_bluesleep_device);
134         return;
135 }
136 #elif defined CONFIG_BLUEDROID_PM
137 static struct resource roth_bluedroid_pm_resources[] = {
138         [0] = {
139                 .name   = "shutdown_gpio",
140                 .start  = TEGRA_GPIO_PQ7,
141                 .end    = TEGRA_GPIO_PQ7,
142                 .flags  = IORESOURCE_IO,
143         },
144         [1] = {
145                 .name = "host_wake",
146                 .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
147         },
148         [2] = {
149                 .name = "gpio_ext_wake",
150                 .start  = TEGRA_GPIO_PEE1,
151                 .end    = TEGRA_GPIO_PEE1,
152                 .flags  = IORESOURCE_IO,
153         },
154         [3] = {
155                 .name = "gpio_host_wake",
156                 .start  = TEGRA_GPIO_PU6,
157                 .end    = TEGRA_GPIO_PU6,
158                 .flags  = IORESOURCE_IO,
159         },
160 };
161
162 static struct platform_device roth_bluedroid_pm_device = {
163         .name = "bluedroid_pm",
164         .id             = 0,
165         .num_resources  = ARRAY_SIZE(roth_bluedroid_pm_resources),
166         .resource       = roth_bluedroid_pm_resources,
167 };
168
169 static noinline void __init roth_setup_bluedroid_pm(void)
170 {
171         roth_bluedroid_pm_resources[1].start =
172                 roth_bluedroid_pm_resources[1].end =
173                                 gpio_to_irq(TEGRA_GPIO_PU6);
174         platform_device_register(&roth_bluedroid_pm_device);
175 }
176 #endif
177 static __initdata struct tegra_clk_init_table roth_clk_init_table[] = {
178         /* name         parent          rate            enabled */
179         { "pll_m",      NULL,           0,              false},
180         { "hda",        "pll_p",        108000000,      false},
181         { "hda2codec_2x", "pll_p",      48000000,       false},
182         { "pwm",        "pll_p",        6000000,        false},
183         { "blink",      "clk_32k",      32768,          true},
184         { "i2s1",       "pll_a_out0",   0,              false},
185         { "i2s3",       "pll_a_out0",   0,              false},
186         { "i2s4",       "pll_a_out0",   0,              false},
187         { "spdif_out",  "pll_a_out0",   0,              false},
188         { "d_audio",    "clk_m",        12000000,       false},
189         { "dam0",       "clk_m",        12000000,       false},
190         { "dam1",       "clk_m",        12000000,       false},
191         { "dam2",       "clk_m",        12000000,       false},
192         { "audio1",     "i2s1_sync",    0,              false},
193         { "audio3",     "i2s3_sync",    0,              false},
194         /* Setting vi_sensor-clk to true for validation purpose, will imapact
195          * power, later set to be false.*/
196         { "vi_sensor",  "pll_p",        150000000,      false},
197         { "cilab",      "pll_p",        150000000,      false},
198         { "cilcd",      "pll_p",        150000000,      false},
199         { "cile",       "pll_p",        150000000,      false},
200         { "i2c1",       "pll_p",        3200000,        false},
201         { "i2c2",       "pll_p",        3200000,        false},
202         { "i2c3",       "pll_p",        3200000,        false},
203         { "i2c4",       "pll_p",        3200000,        false},
204         { "i2c5",       "pll_p",        3200000,        false},
205         { NULL,         NULL,           0,              0},
206 };
207
208 static struct tegra_i2c_platform_data roth_i2c1_platform_data = {
209         .bus_clk_rate   = 100000,
210         .scl_gpio       = TEGRA_GPIO_I2C1_SCL,
211         .sda_gpio       = TEGRA_GPIO_I2C1_SDA,
212 };
213
214 static struct tegra_i2c_platform_data roth_i2c2_platform_data = {
215         .bus_clk_rate   = 100000,
216         .is_clkon_always = true,
217         .scl_gpio       = TEGRA_GPIO_I2C2_SCL,
218         .sda_gpio       = TEGRA_GPIO_I2C2_SDA,
219 };
220
221 static struct tegra_i2c_platform_data roth_i2c3_platform_data = {
222         .bus_clk_rate   = 100000,
223         .scl_gpio       = TEGRA_GPIO_I2C3_SCL,
224         .sda_gpio       = TEGRA_GPIO_I2C3_SDA,
225 };
226
227 static struct tegra_i2c_platform_data roth_i2c4_platform_data = {
228         .bus_clk_rate   = 10000,
229         .scl_gpio       = TEGRA_GPIO_I2C4_SCL,
230         .sda_gpio       = TEGRA_GPIO_I2C4_SDA,
231 };
232
233 static struct tegra_i2c_platform_data roth_i2c5_platform_data = {
234         .bus_clk_rate   = 400000,
235         .scl_gpio       = TEGRA_GPIO_I2C5_SCL,
236         .sda_gpio       = TEGRA_GPIO_I2C5_SDA,
237         .needs_cl_dvfs_clock = true,
238 };
239
240 #if defined(CONFIG_ARCH_TEGRA_11x_SOC)
241 static struct i2c_board_info __initdata rt5640_board_info = {
242         I2C_BOARD_INFO("rt5640", 0x1c),
243 };
244
245 static struct i2c_board_info __initdata roth_codec_tfa9887R_info = {
246         I2C_BOARD_INFO("tfa9887R", 0x37),
247 };
248
249 static struct i2c_board_info __initdata roth_codec_tfa9887L_info = {
250         I2C_BOARD_INFO("tfa9887L", 0x34),
251 };
252 #endif
253
254 static void roth_i2c_init(void)
255 {
256         tegra11_i2c_device1.dev.platform_data = &roth_i2c1_platform_data;
257         tegra11_i2c_device2.dev.platform_data = &roth_i2c2_platform_data;
258         tegra11_i2c_device3.dev.platform_data = &roth_i2c3_platform_data;
259         tegra11_i2c_device4.dev.platform_data = &roth_i2c4_platform_data;
260         tegra11_i2c_device5.dev.platform_data = &roth_i2c5_platform_data;
261
262         platform_device_register(&tegra11_i2c_device5);
263         platform_device_register(&tegra11_i2c_device4);
264         platform_device_register(&tegra11_i2c_device3);
265         platform_device_register(&tegra11_i2c_device2);
266         platform_device_register(&tegra11_i2c_device1);
267
268         i2c_register_board_info(0, &rt5640_board_info, 1);
269         i2c_register_board_info(0, &roth_codec_tfa9887R_info, 1);
270         i2c_register_board_info(0, &roth_codec_tfa9887L_info, 1);
271 }
272
273 static struct platform_device *roth_uart_devices[] __initdata = {
274         &tegra_uarta_device,
275         &tegra_uartb_device,
276         &tegra_uartc_device,
277         &tegra_uartd_device,
278 };
279
280 static void __init uart_debug_init(void)
281 {
282         int debug_port_id;
283
284         debug_port_id = uart_console_debug_init(3);
285         if (debug_port_id < 0)
286                 return;
287
288         roth_uart_devices[debug_port_id] = uart_console_debug_device;
289 }
290
291 static void __init roth_uart_init(void)
292 {
293         /* Register low speed only if it is selected */
294         if (!is_tegra_debug_uartport_hs())
295                 uart_debug_init();
296
297         platform_add_devices(roth_uart_devices,
298                                 ARRAY_SIZE(roth_uart_devices));
299 }
300
301 static struct resource tegra_rtc_resources[] = {
302         [0] = {
303                 .start = TEGRA_RTC_BASE,
304                 .end = TEGRA_RTC_BASE + TEGRA_RTC_SIZE - 1,
305                 .flags = IORESOURCE_MEM,
306         },
307         [1] = {
308                 .start = INT_RTC,
309                 .end = INT_RTC,
310                 .flags = IORESOURCE_IRQ,
311         },
312 };
313
314 static struct platform_device tegra_rtc_device = {
315         .name = "tegra_rtc",
316         .id   = -1,
317         .resource = tegra_rtc_resources,
318         .num_resources = ARRAY_SIZE(tegra_rtc_resources),
319 };
320
321 static struct tegra_asoc_platform_data roth_audio_pdata = {
322         .gpio_spkr_en           = TEGRA_GPIO_SPKR_EN,
323         .gpio_hp_det            = TEGRA_GPIO_HP_DET,
324         .gpio_hp_mute           = -1,
325         .gpio_int_mic_en        = TEGRA_GPIO_INT_MIC_EN,
326         .gpio_ext_mic_en        = TEGRA_GPIO_EXT_MIC_EN,
327         .gpio_ldo1_en           = TEGRA_GPIO_LDO1_EN,
328         .gpio_codec1 = TEGRA_GPIO_CODEC1_EN,
329         .gpio_codec2 = TEGRA_GPIO_CODEC2_EN,
330         .gpio_codec3 = TEGRA_GPIO_CODEC3_EN,
331         .i2s_param[HIFI_CODEC]  = {
332                 .audio_port_id  = 1,
333                 .is_i2s_master  = 1,
334                 .i2s_mode       = TEGRA_DAIFMT_I2S,
335         },
336         .i2s_param[BT_SCO]      = {
337                 .audio_port_id  = 3,
338                 .is_i2s_master  = 1,
339                 .i2s_mode       = TEGRA_DAIFMT_DSP_A,
340         },
341 };
342
343 static struct platform_device roth_audio_device = {
344         .name   = "tegra-snd-rt5640",
345         .id     = 0,
346         .dev    = {
347                 .platform_data = &roth_audio_pdata,
348         },
349 };
350
351 static struct platform_device tegra_camera = {
352         .name = "tegra_camera",
353         .id = -1,
354 };
355
356
357 static struct issp_platform_data roth_issp_pdata_p2454 = {
358         .reset_gpio     = TEGRA_GPIO_PH4,
359         .data_gpio      = TEGRA_GPIO_PH6,
360         .clk_gpio       = TEGRA_GPIO_PH7,
361         .fw_name        = "p2454-uc.fw",
362         .si_id          = {0x00, 0xA2, 0x52, 0x21}, /* CY7C64345 */
363         .block_size     = 128,
364         .blocks         = 128,
365         .security_size  = 64,
366         .version_addr   = 0x0286,
367         .force_update   = 1,
368 };
369
370 static struct platform_device roth_issp_device_p2454 = {
371         .name   = "issp",
372         .dev    = {
373                 .platform_data = &roth_issp_pdata_p2454,
374         },
375 };
376
377 static struct issp_platform_data roth_issp_pdata_p2560 = {
378         .reset_gpio     = TEGRA_GPIO_PH4,
379         .data_gpio      = TEGRA_GPIO_PH6,
380         .clk_gpio       = TEGRA_GPIO_PH7,
381         .fw_name        = "p2560-uc.fw",
382         .si_id          = {0x00, 0xA2, 0x52, 0x21}, /* CY7C64345 */
383         .block_size     = 128,
384         .blocks         = 128,
385         .security_size  = 64,
386         .version_addr   = 0x0286,
387         .force_update   = 0,
388 };
389
390 static struct platform_device roth_issp_device_p2560 = {
391         .name   = "issp",
392         .dev    = {
393                 .platform_data = &roth_issp_pdata_p2560,
394         },
395 };
396
397 static void __init roth_issp_init(void)
398 {
399         if (system_rev == P2454)
400                 platform_device_register(&roth_issp_device_p2454);
401         else
402                 platform_device_register(&roth_issp_device_p2560);
403 }
404
405 static struct platform_device *roth_devices[] __initdata = {
406         &tegra_pmu_device,
407         &tegra_rtc_device,
408         &tegra_udc_device,
409 #if defined(CONFIG_TEGRA_AVP)
410         &tegra_avp_device,
411 #endif
412         &tegra_camera,
413 #if defined(CONFIG_CRYPTO_DEV_TEGRA_SE)
414         &tegra11_se_device,
415 #endif
416         &tegra_ahub_device,
417         &tegra_dam_device0,
418         &tegra_dam_device1,
419         &tegra_dam_device2,
420         &tegra_i2s_device1,
421         &tegra_i2s_device3,
422         &tegra_i2s_device4,
423         &tegra_spdif_device,
424         &spdif_dit_device,
425         &bluetooth_dit_device,
426         &roth_audio_device,
427         &tegra_hda_device,
428 #if defined(CONFIG_CRYPTO_DEV_TEGRA_AES)
429         &tegra_aes_device,
430 #endif
431 };
432
433 #ifdef CONFIG_USB_SUPPORT
434 static struct tegra_usb_platform_data tegra_udc_pdata = {
435         .port_otg = true,
436         .has_hostpc = true,
437         .phy_intf = TEGRA_USB_PHY_INTF_UTMI,
438         .op_mode = TEGRA_USB_OPMODE_DEVICE,
439         .u_data.dev = {
440                 .vbus_pmu_irq = 0,
441                 .vbus_gpio = -1,
442                 .charging_supported = false,
443                 .remote_wakeup_supported = false,
444         },
445         .u_cfg.utmi = {
446                 .hssync_start_delay = 0,
447                 .elastic_limit = 16,
448                 .idle_wait_delay = 17,
449                 .term_range_adj = 6,
450                 .xcvr_setup = 8,
451                 .xcvr_lsfslew = 2,
452                 .xcvr_lsrslew = 2,
453                 .xcvr_setup_offset = 0,
454                 .xcvr_use_fuses = 1,
455         },
456 };
457
458 static struct tegra_usb_platform_data tegra_ehci1_utmi_pdata = {
459         .port_otg = true,
460         .has_hostpc = true,
461         .unaligned_dma_buf_supported = false,
462         .phy_intf = TEGRA_USB_PHY_INTF_UTMI,
463         .op_mode = TEGRA_USB_OPMODE_HOST,
464         .u_data.host = {
465                 .vbus_gpio = -1,
466                 .hot_plug = true,
467                 .remote_wakeup_supported = true,
468                 .power_off_on_suspend = false,
469         },
470         .u_cfg.utmi = {
471                 .hssync_start_delay = 0,
472                 .elastic_limit = 16,
473                 .idle_wait_delay = 17,
474                 .term_range_adj = 6,
475                 .xcvr_setup = 15,
476                 .xcvr_lsfslew = 2,
477                 .xcvr_lsrslew = 2,
478                 .xcvr_setup_offset = 0,
479                 .xcvr_use_fuses = 1,
480                 .vbus_oc_map = 0x4,
481         },
482 };
483
484 static struct tegra_usb_platform_data tegra_ehci3_utmi_pdata = {
485         .port_otg = false,
486         .has_hostpc = true,
487         .unaligned_dma_buf_supported = false,
488         .phy_intf = TEGRA_USB_PHY_INTF_UTMI,
489         .op_mode = TEGRA_USB_OPMODE_HOST,
490         .u_data.host = {
491                 .vbus_gpio = -1,
492                 .hot_plug = true,
493                 .remote_wakeup_supported = true,
494                 .power_off_on_suspend = false,
495         },
496         .u_cfg.utmi = {
497         .hssync_start_delay = 0,
498                 .elastic_limit = 16,
499                 .idle_wait_delay = 17,
500                 .term_range_adj = 6,
501                 .xcvr_setup = 8,
502                 .xcvr_lsfslew = 2,
503                 .xcvr_lsrslew = 2,
504                 .xcvr_setup_offset = 0,
505                 .xcvr_use_fuses = 1,
506                 .vbus_oc_map = 0x5,
507         },
508 };
509
510 static struct tegra_usb_otg_data tegra_otg_pdata = {
511         .ehci_device = &tegra_ehci1_device,
512         .ehci_pdata = &tegra_ehci1_utmi_pdata,
513 };
514
515 static void roth_usb_init(void)
516 {
517         tegra_otg_device.dev.platform_data = &tegra_otg_pdata;
518         platform_device_register(&tegra_otg_device);
519
520         /* Setup the udc platform data */
521         tegra_udc_device.dev.platform_data = &tegra_udc_pdata;
522
523         tegra_ehci3_device.dev.platform_data = &tegra_ehci3_utmi_pdata;
524         platform_device_register(&tegra_ehci3_device);
525 }
526
527 #else
528 static void roth_usb_init(void) { }
529 #endif
530
531 static void roth_audio_init(void)
532 {
533         roth_audio_pdata.codec_name = "rt5640.0-001c";
534         roth_audio_pdata.codec_dai_name = "rt5640-aif1";
535 }
536
537
538 static struct platform_device *roth_spi_devices[] __initdata = {
539         &tegra11_spi_device4,
540 };
541
542 struct spi_clk_parent spi_parent_clk_roth[] = {
543         [0] = {.name = "pll_p"},
544 #ifndef CONFIG_TEGRA_PLLM_RESTRICTED
545         [1] = {.name = "pll_m"},
546         [2] = {.name = "clk_m"},
547 #else
548         [1] = {.name = "clk_m"},
549 #endif
550 };
551
552 static struct tegra_spi_platform_data roth_spi_pdata = {
553         .is_dma_based           = false,
554         .max_dma_buffer         = 16 * 1024,
555         .is_clkon_always        = false,
556         .max_rate               = 25000000,
557 };
558
559 static void __init roth_spi_init(void)
560 {
561         int i;
562         struct clk *c;
563
564         for (i = 0; i < ARRAY_SIZE(spi_parent_clk_roth); ++i) {
565                 c = tegra_get_clock_by_name(spi_parent_clk_roth[i].name);
566                 if (IS_ERR_OR_NULL(c)) {
567                         pr_err("Not able to get the clock for %s\n",
568                                 spi_parent_clk_roth[i].name);
569                         continue;
570                 }
571                 spi_parent_clk_roth[i].parent_clk = c;
572                 spi_parent_clk_roth[i].fixed_clk_rate = clk_get_rate(c);
573         }
574         roth_spi_pdata.parent_clk_list = spi_parent_clk_roth;
575         roth_spi_pdata.parent_clk_count = ARRAY_SIZE(spi_parent_clk_roth);
576         tegra11_spi_device4.dev.platform_data = &roth_spi_pdata;
577         platform_add_devices(roth_spi_devices,
578                 ARRAY_SIZE(roth_spi_devices));
579 }
580
581 static __initdata struct tegra_clk_init_table touch_clk_init_table[] = {
582         /* name         parent          rate            enabled */
583         { "extern2",    "pll_p",        41000000,       false},
584         { "clk_out_2",  "extern2",      40800000,       false},
585         { NULL,         NULL,           0,              0},
586 };
587
588 struct rm_spi_ts_platform_data rm31080ts_roth_data = {
589         .gpio_reset = TOUCH_GPIO_RST_RAYDIUM_SPI,
590         .config = 0,
591         .platform_id = RM_PLATFORM_R005,
592         .name_of_clock = "clk_out_2",
593         .name_of_clock_con = "extern2",
594 };
595
596 static struct tegra_spi_device_controller_data dev_cdata = {
597         .rx_clk_tap_delay = 16,
598         .tx_clk_tap_delay = 16,
599 };
600
601 struct spi_board_info rm31080a_roth_spi_board[1] = {
602         {
603          .modalias = "rm_ts_spidev",
604          .bus_num = 3,
605          .chip_select = 2,
606          .max_speed_hz = 12 * 1000 * 1000,
607          .mode = SPI_MODE_0,
608          .controller_data = &dev_cdata,
609          .platform_data = &rm31080ts_roth_data,
610          },
611 };
612
613 static int __init roth_touch_init(void)
614 {
615         struct board_info board_info;
616         int touch_panel_id = tegra_get_touch_panel_id();
617
618         tegra_get_board_info(&board_info);
619         if (touch_panel_id == PANEL_TPK ||
620                         touch_panel_id == PANEL_WINTEK) {
621                 int err;
622                 err = gpio_request(TOUCH_GPIO_CLK, "touch-gpio-clk");
623                 if (err < 0)
624                         pr_err("%s: gpio_request failed %d\n",
625                                 __func__, err);
626                 else {
627                         err = gpio_direction_output(TOUCH_GPIO_CLK, 0);
628                         if (err < 0)
629                                 pr_err("%s: set output failed %d\n",
630                                 __func__, err);
631                         gpio_free(TOUCH_GPIO_CLK);
632                 }
633                 tegra_pinmux_set_pullupdown(TOUCH_GPIO_CLK_PG,
634                                                 TEGRA_PUPD_NORMAL);
635                 tegra_pinmux_set_tristate(TOUCH_GPIO_CLK_PG,
636                                                 TEGRA_TRI_TRISTATE);
637                 rm31080ts_roth_data.name_of_clock = NULL;
638                 rm31080ts_roth_data.name_of_clock_con = NULL;
639         } else
640                 tegra_clk_init_from_table(touch_clk_init_table);
641         rm31080a_roth_spi_board[0].irq =
642                 gpio_to_irq(TOUCH_GPIO_IRQ_RAYDIUM_SPI);
643         touch_init_raydium(TOUCH_GPIO_IRQ_RAYDIUM_SPI,
644                                 TOUCH_GPIO_RST_RAYDIUM_SPI,
645                                 &rm31080ts_roth_data,
646                                 &rm31080a_roth_spi_board[0],
647                                 ARRAY_SIZE(rm31080a_roth_spi_board));
648         return 0;
649 }
650
651 static void __init tegra_roth_init(void)
652 {
653         tegra_clk_init_from_table(roth_clk_init_table);
654         tegra_clk_verify_parents();
655         tegra_soc_device_init("roth");
656         tegra_enable_pinmux();
657         roth_pinmux_init();
658         roth_i2c_init();
659         roth_spi_init();
660         roth_usb_init();
661         roth_uart_init();
662         roth_led_init();
663         roth_audio_init();
664         platform_add_devices(roth_devices, ARRAY_SIZE(roth_devices));
665         //tegra_ram_console_debug_init();
666         tegra_io_dpd_init();
667         roth_regulator_init();
668         roth_sdhci_init();
669         roth_suspend_init();
670         roth_emc_init();
671         roth_edp_init();
672         isomgr_init();
673         roth_touch_init();
674         /* roth will pass a null board id to panel_init */
675         roth_panel_init(0);
676         roth_kbc_init();
677         roth_pmon_init();
678 #ifdef CONFIG_BT_BLUESLEEP
679         roth_setup_bluesleep();
680         roth_setup_bt_rfkill();
681 #elif defined CONFIG_BLUEDROID_PM
682         roth_setup_bluedroid_pm();
683 #endif
684 #ifdef CONFIG_TEGRA_WDT_RECOVERY
685         tegra_wdt_recovery_init();
686 #endif
687         tegra_serial_debug_init(TEGRA_UARTD_BASE, INT_WDT_CPU, NULL, -1, -1);
688         roth_sensors_init();
689         roth_soctherm_init();
690         roth_fan_init();
691         tegra_register_fuse();
692         roth_issp_init();
693 }
694
695 static void __init roth_ramconsole_reserve(unsigned long size)
696 {
697         tegra_ram_console_debug_reserve(SZ_1M);
698 }
699
700 #ifdef CONFIG_USE_OF
701 struct of_dev_auxdata roth_auxdata_lookup[] __initdata = {
702         OF_DEV_AUXDATA("nvidia,tegra114-host1x", TEGRA_HOST1X_BASE, "host1x",
703                 NULL),
704         OF_DEV_AUXDATA("nvidia,tegra114-gr3d", TEGRA_GR3D_BASE, "gr3d", NULL),
705         OF_DEV_AUXDATA("nvidia,tegra114-gr2d", TEGRA_GR2D_BASE, "gr2d", NULL),
706         OF_DEV_AUXDATA("nvidia,tegra114-msenc", TEGRA_MSENC_BASE, "msenc",
707                 NULL),
708         OF_DEV_AUXDATA("nvidia,tegra114-vi", TEGRA_VI_BASE, "vi", NULL),
709         OF_DEV_AUXDATA("nvidia,tegra114-isp", TEGRA_ISP_BASE, "isp", NULL),
710         OF_DEV_AUXDATA("nvidia,tegra114-tsec", TEGRA_TSEC_BASE, "tsec", NULL),
711         {}
712 };
713 #endif
714
715 static void __init tegra_roth_dt_init(void)
716 {
717 #ifdef CONFIG_USE_OF
718         of_platform_populate(NULL,
719                 of_default_bus_match_table, roth_auxdata_lookup,
720                 &platform_bus);
721 #endif
722
723         tegra_roth_init();
724 }
725
726 static void __init tegra_roth_reserve(void)
727 {
728 #if defined(CONFIG_NVMAP_CONVERT_CARVEOUT_TO_IOVMM)
729         /* 1920*1200*4*2 = 18432000 bytes */
730         tegra_reserve(0, SZ_16M + SZ_2M, SZ_4M);
731 #else
732         tegra_reserve(SZ_128M, SZ_16M + SZ_2M, SZ_4M);
733 #endif
734         roth_ramconsole_reserve(SZ_1M);
735 }
736
737 static const char * const roth_dt_board_compat[] = {
738         "nvidia,roth",
739         NULL
740 };
741
742 MACHINE_START(ROTH, "roth")
743         .atag_offset    = 0x100,
744         .smp            = smp_ops(tegra_smp_ops),
745         .map_io         = tegra_map_common_io,
746         .reserve        = tegra_roth_reserve,
747         .init_early     = tegra11x_init_early,
748         .init_irq       = irqchip_init,
749         .init_time      = clocksource_of_init,
750         .init_machine   = tegra_roth_dt_init,
751         .restart        = tegra_assert_system_reset,
752         .dt_compat      = roth_dt_board_compat,
753 MACHINE_END