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