arm: tegra: dalmore - Bruce modem platform data
[linux-3.10.git] / arch / arm / mach-tegra / board-dalmore.c
1 /*
2  * arch/arm/mach-tegra/board-dalmore.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/rfkill-gpio.h>
41 #include <linux/skbuff.h>
42 #include <linux/ti_wilink_st.h>
43 #include <linux/regulator/consumer.h>
44 #include <linux/smb349-charger.h>
45 #include <linux/max17048_battery.h>
46 #include <linux/leds.h>
47 #include <linux/i2c/at24.h>
48 #include <linux/of_platform.h>
49 #include <linux/edp.h>
50 #include <linux/usb/tegra_usb_phy.h>
51 #include <linux/clk/tegra.h>
52 #include <linux/clocksource.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 <linux/platform_data/tegra_usb_modem_power.h>
66 #include <mach/xusb.h>
67
68 #include "board-touch-raydium.h"
69 #include "board.h"
70 #include "board-common.h"
71 #include "clock.h"
72 #include "board-dalmore.h"
73 #include "devices.h"
74 #include "gpio-names.h"
75 #include "fuse.h"
76 #include "iomap.h"
77 #include "pm.h"
78 #include "pm-irq.h"
79 #include "common.h"
80 #include "tegra-board-id.h"
81
82 static struct board_info board_info, display_board_info;
83
84 #if defined(CONFIG_BT_BLUESLEEP) || defined(CONFIG_BT_BLUESLEEP_MODULE)
85 static struct rfkill_gpio_platform_data dalmore_bt_rfkill_pdata = {
86                 .name           = "bt_rfkill",
87                 .shutdown_gpio  = TEGRA_GPIO_PQ7,
88                 .reset_gpio     = TEGRA_GPIO_PQ6,
89                 .type           = RFKILL_TYPE_BLUETOOTH,
90 };
91
92 static struct platform_device dalmore_bt_rfkill_device = {
93         .name = "rfkill_gpio",
94         .id             = -1,
95         .dev = {
96                 .platform_data = &dalmore_bt_rfkill_pdata,
97         },
98 };
99
100 static struct resource dalmore_bluesleep_resources[] = {
101         [0] = {
102                 .name = "gpio_host_wake",
103                         .start  = TEGRA_GPIO_PU6,
104                         .end    = TEGRA_GPIO_PU6,
105                         .flags  = IORESOURCE_IO,
106         },
107         [1] = {
108                 .name = "gpio_ext_wake",
109                         .start  = TEGRA_GPIO_PEE1,
110                         .end    = TEGRA_GPIO_PEE1,
111                         .flags  = IORESOURCE_IO,
112         },
113         [2] = {
114                 .name = "host_wake",
115                         .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
116         },
117 };
118
119 static struct platform_device dalmore_bluesleep_device = {
120         .name           = "bluesleep",
121         .id             = -1,
122         .num_resources  = ARRAY_SIZE(dalmore_bluesleep_resources),
123         .resource       = dalmore_bluesleep_resources,
124 };
125
126 static noinline void __init dalmore_setup_bt_rfkill(void)
127 {
128         platform_device_register(&dalmore_bt_rfkill_device);
129 }
130
131 static noinline void __init dalmore_setup_bluesleep(void)
132 {
133         dalmore_bluesleep_resources[2].start =
134                 dalmore_bluesleep_resources[2].end =
135                         gpio_to_irq(TEGRA_GPIO_PU6);
136         platform_device_register(&dalmore_bluesleep_device);
137         return;
138 }
139 #elif defined(CONFIG_BLUEDROID_PM) || defined(CONFIG_BLUEDROID_PM_MODULE)
140 static struct resource dalmore_bluedroid_pm_resources[] = {
141         [0] = {
142                 .name   = "shutdown_gpio",
143                 .start  = TEGRA_GPIO_PQ7,
144                 .end    = TEGRA_GPIO_PQ7,
145                 .flags  = IORESOURCE_IO,
146         },
147         [1] = {
148                 .name = "host_wake",
149                 .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
150         },
151         [2] = {
152                 .name = "gpio_ext_wake",
153                 .start  = TEGRA_GPIO_PEE1,
154                 .end    = TEGRA_GPIO_PEE1,
155                 .flags  = IORESOURCE_IO,
156         },
157         [3] = {
158                 .name = "gpio_host_wake",
159                 .start  = TEGRA_GPIO_PU6,
160                 .end    = TEGRA_GPIO_PU6,
161                 .flags  = IORESOURCE_IO,
162         },
163         [4] = {
164                 .name = "reset_gpio",
165                 .start  = TEGRA_GPIO_PQ6,
166                 .end    = TEGRA_GPIO_PQ6,
167                 .flags  = IORESOURCE_IO,
168         },
169 };
170
171 static struct platform_device dalmore_bluedroid_pm_device = {
172         .name = "bluedroid_pm",
173         .id             = 0,
174         .num_resources  = ARRAY_SIZE(dalmore_bluedroid_pm_resources),
175         .resource       = dalmore_bluedroid_pm_resources,
176 };
177
178 static noinline void __init dalmore_setup_bluedroid_pm(void)
179 {
180         dalmore_bluedroid_pm_resources[1].start =
181                 dalmore_bluedroid_pm_resources[1].end =
182                                 gpio_to_irq(TEGRA_GPIO_PU6);
183         platform_device_register(&dalmore_bluedroid_pm_device);
184 }
185 #endif
186
187 static __initdata struct tegra_clk_init_table dalmore_clk_init_table[] = {
188         /* name         parent          rate            enabled */
189         { "pll_m",      NULL,           0,              false},
190         { "hda",        "pll_p",        108000000,      false},
191         { "hda2codec_2x", "pll_p",      48000000,       false},
192         { "pwm",        "pll_p",        3187500,        false},
193         { "blink",      "clk_32k",      32768,          true},
194         { "i2s1",       "pll_a_out0",   0,              false},
195         { "i2s3",       "pll_a_out0",   0,              false},
196         { "i2s4",       "pll_a_out0",   0,              false},
197         { "spdif_out",  "pll_a_out0",   0,              false},
198         { "d_audio",    "clk_m",        12000000,       false},
199         { "dam0",       "clk_m",        12000000,       false},
200         { "dam1",       "clk_m",        12000000,       false},
201         { "dam2",       "clk_m",        12000000,       false},
202         { "audio1",     "i2s1_sync",    0,              false},
203         { "audio3",     "i2s3_sync",    0,              false},
204         /* Setting vi_sensor-clk to true for validation purpose, will imapact
205          * power, later set to be false.*/
206         { "vi_sensor",  "pll_p",        150000000,      false},
207         { "cilab",      "pll_p",        150000000,      false},
208         { "cilcd",      "pll_p",        150000000,      false},
209         { "cile",       "pll_p",        150000000,      false},
210         { "i2c1",       "pll_p",        3200000,        false},
211         { "i2c2",       "pll_p",        3200000,        false},
212         { "i2c3",       "pll_p",        3200000,        false},
213         { "i2c4",       "pll_p",        3200000,        false},
214         { "i2c5",       "pll_p",        3200000,        false},
215         { "sbc1",       "pll_p",        25000000,       false},
216         { "sbc2",       "pll_p",        25000000,       false},
217         { "sbc3",       "pll_p",        25000000,       false},
218         { "sbc4",       "pll_p",        25000000,       false},
219         { "sbc5",       "pll_p",        25000000,       false},
220         { "sbc6",       "pll_p",        25000000,       false},
221         { "uarta",      "pll_p",        408000000,      false},
222         { "uartb",      "pll_p",        408000000,      false},
223         { "uartc",      "pll_p",        408000000,      false},
224         { "uartd",      "pll_p",        408000000,      false},
225         { NULL,         NULL,           0,              0},
226 };
227
228 #ifndef CONFIG_USE_OF
229 static struct tegra_i2c_platform_data dalmore_i2c1_platform_data = {
230         .bus_clk_rate   = 100000,
231         .scl_gpio       = TEGRA_GPIO_I2C1_SCL,
232         .sda_gpio       = TEGRA_GPIO_I2C1_SDA,
233 };
234
235 static struct tegra_i2c_platform_data dalmore_i2c2_platform_data = {
236         .bus_clk_rate   = 100000,
237         .is_clkon_always = true,
238         .scl_gpio       = TEGRA_GPIO_I2C2_SCL,
239         .sda_gpio       = TEGRA_GPIO_I2C2_SDA,
240 };
241
242 static struct tegra_i2c_platform_data dalmore_i2c3_platform_data = {
243         .bus_clk_rate   = 400000,
244         .scl_gpio       = TEGRA_GPIO_I2C3_SCL,
245         .sda_gpio       = TEGRA_GPIO_I2C3_SDA,
246 };
247
248 static struct tegra_i2c_platform_data dalmore_i2c4_platform_data = {
249         .bus_clk_rate   = 10000,
250         .scl_gpio       = TEGRA_GPIO_I2C4_SCL,
251         .sda_gpio       = TEGRA_GPIO_I2C4_SDA,
252 };
253
254 static struct tegra_i2c_platform_data dalmore_i2c5_platform_data = {
255         .bus_clk_rate   = 400000,
256         .scl_gpio       = TEGRA_GPIO_I2C5_SCL,
257         .sda_gpio       = TEGRA_GPIO_I2C5_SDA,
258         .needs_cl_dvfs_clock = true,
259 };
260 #endif
261
262 static struct i2c_board_info __initdata rt5640_board_info = {
263         I2C_BOARD_INFO("rt5640", 0x1c),
264 };
265
266 static struct pn544_i2c_platform_data nfc_pdata = {
267         .irq_gpio = TEGRA_GPIO_PW2,
268         .ven_gpio = TEGRA_GPIO_PQ3,
269         .firm_gpio = TEGRA_GPIO_PH0,
270 };
271
272 static struct i2c_board_info __initdata nfc_board_info = {
273         I2C_BOARD_INFO("pn544", 0x28),
274         .platform_data = &nfc_pdata,
275 };
276
277 static void dalmore_i2c_init(void)
278 {
279 #ifndef CONFIG_USE_OF
280         tegra11_i2c_device1.dev.platform_data = &dalmore_i2c1_platform_data;
281         tegra11_i2c_device2.dev.platform_data = &dalmore_i2c2_platform_data;
282         tegra11_i2c_device3.dev.platform_data = &dalmore_i2c3_platform_data;
283         tegra11_i2c_device4.dev.platform_data = &dalmore_i2c4_platform_data;
284         tegra11_i2c_device5.dev.platform_data = &dalmore_i2c5_platform_data;
285
286         platform_device_register(&tegra11_i2c_device5);
287         platform_device_register(&tegra11_i2c_device4);
288         platform_device_register(&tegra11_i2c_device3);
289         platform_device_register(&tegra11_i2c_device2);
290         platform_device_register(&tegra11_i2c_device1);
291 #endif
292         nfc_board_info.irq = gpio_to_irq(TEGRA_GPIO_PW2);
293         i2c_register_board_info(0, &nfc_board_info, 1);
294         i2c_register_board_info(0, &rt5640_board_info, 1);
295 }
296
297 static struct tegra_serial_platform_data dalmore_uartd_pdata = {
298         .dma_req_selector = 19,
299         .modem_interrupt = false,
300 };
301
302 static void __init dalmore_uart_init(void)
303 {
304         int debug_port_id;
305
306         /* Register low speed only if it is selected */
307         if (!is_tegra_debug_uartport_hs()) {
308                 debug_port_id = uart_console_debug_init(3);
309                 if (debug_port_id < 0)
310                         return;
311
312                 platform_device_register(uart_console_debug_device);
313
314         } else {
315                 tegra_uartd_device.dev.platform_data = &dalmore_uartd_pdata;
316                 platform_device_register(&tegra_uartd_device);
317         }
318
319 }
320
321 static struct resource tegra_rtc_resources[] = {
322         [0] = {
323                 .start = TEGRA_RTC_BASE,
324                 .end = TEGRA_RTC_BASE + TEGRA_RTC_SIZE - 1,
325                 .flags = IORESOURCE_MEM,
326         },
327         [1] = {
328                 .start = INT_RTC,
329                 .end = INT_RTC,
330                 .flags = IORESOURCE_IRQ,
331         },
332 };
333
334 static struct platform_device tegra_rtc_device = {
335         .name = "tegra_rtc",
336         .id   = -1,
337         .resource = tegra_rtc_resources,
338         .num_resources = ARRAY_SIZE(tegra_rtc_resources),
339 };
340
341 static struct tegra_asoc_platform_data dalmore_audio_pdata = {
342         .gpio_spkr_en           = TEGRA_GPIO_SPKR_EN,
343         .gpio_hp_det            = TEGRA_GPIO_HP_DET,
344         .gpio_hp_mute           = -1,
345         .gpio_int_mic_en        = TEGRA_GPIO_INT_MIC_EN,
346         .gpio_ext_mic_en        = TEGRA_GPIO_EXT_MIC_EN,
347         .gpio_ldo1_en           = TEGRA_GPIO_LDO1_EN,
348         .gpio_codec1 = TEGRA_GPIO_CODEC1_EN,
349         .gpio_codec2 = TEGRA_GPIO_CODEC2_EN,
350         .gpio_codec3 = TEGRA_GPIO_CODEC3_EN,
351         .i2s_param[HIFI_CODEC]  = {
352                 .audio_port_id  = 1,
353                 .is_i2s_master  = 1,
354                 .i2s_mode       = TEGRA_DAIFMT_I2S,
355         },
356         .i2s_param[BT_SCO]      = {
357                 .audio_port_id  = 3,
358                 .is_i2s_master  = 1,
359                 .i2s_mode       = TEGRA_DAIFMT_DSP_A,
360         },
361 };
362
363 static struct platform_device dalmore_audio_device = {
364         .name   = "tegra-snd-rt5640",
365         .id     = 0,
366         .dev    = {
367                 .platform_data = &dalmore_audio_pdata,
368         },
369 };
370
371 static struct platform_device *dalmore_devices[] __initdata = {
372         &tegra_pmu_device,
373         &tegra_rtc_device,
374         &tegra_udc_device,
375 #if defined(CONFIG_TEGRA_AVP)
376         &tegra_avp_device,
377 #endif
378 #if defined(CONFIG_CRYPTO_DEV_TEGRA_SE)
379         &tegra11_se_device,
380 #endif
381         &tegra_ahub_device,
382         &tegra_dam_device0,
383         &tegra_dam_device1,
384         &tegra_dam_device2,
385         &tegra_i2s_device1,
386         &tegra_i2s_device3,
387         &tegra_i2s_device4,
388         &tegra_spdif_device,
389         &spdif_dit_device,
390         &bluetooth_dit_device,
391         &tegra_pcm_device,
392         &dalmore_audio_device,
393         &tegra_hda_device,
394 #if defined(CONFIG_TEGRA_CEC_SUPPORT)
395         &tegra_cec_device,
396 #endif
397 #if defined(CONFIG_CRYPTO_DEV_TEGRA_AES)
398         &tegra_aes_device,
399 #endif
400 };
401
402 #ifdef CONFIG_USB_SUPPORT
403 static struct tegra_usb_platform_data tegra_udc_pdata = {
404         .port_otg = true,
405         .has_hostpc = true,
406         .phy_intf = TEGRA_USB_PHY_INTF_UTMI,
407         .unaligned_dma_buf_supported = false,
408         .op_mode = TEGRA_USB_OPMODE_DEVICE,
409         .u_data.dev = {
410                 .vbus_pmu_irq = 0,
411                 .vbus_gpio = -1,
412                 .charging_supported = false,
413                 .remote_wakeup_supported = false,
414         },
415         .u_cfg.utmi = {
416                 .hssync_start_delay = 0,
417                 .elastic_limit = 16,
418                 .idle_wait_delay = 17,
419                 .term_range_adj = 6,
420                 .xcvr_setup = 8,
421                 .xcvr_lsfslew = 0,
422                 .xcvr_lsrslew = 3,
423                 .xcvr_setup_offset = 0,
424                 .xcvr_use_fuses = 1,
425         },
426 };
427
428 static struct tegra_usb_platform_data tegra_ehci1_utmi_pdata = {
429         .port_otg = true,
430         .has_hostpc = true,
431         .unaligned_dma_buf_supported = false,
432         .phy_intf = TEGRA_USB_PHY_INTF_UTMI,
433         .op_mode = TEGRA_USB_OPMODE_HOST,
434         .u_data.host = {
435                 .vbus_gpio = -1,
436                 .hot_plug = false,
437                 .remote_wakeup_supported = true,
438                 .power_off_on_suspend = true,
439         },
440         .u_cfg.utmi = {
441                 .hssync_start_delay = 0,
442                 .elastic_limit = 16,
443                 .idle_wait_delay = 17,
444                 .term_range_adj = 6,
445                 .xcvr_setup = 15,
446                 .xcvr_lsfslew = 0,
447                 .xcvr_lsrslew = 3,
448                 .xcvr_setup_offset = 0,
449                 .xcvr_use_fuses = 1,
450                 .vbus_oc_map = 0x4,
451         },
452 };
453
454 static struct tegra_usb_platform_data tegra_ehci3_utmi_pdata = {
455         .port_otg = false,
456         .has_hostpc = true,
457         .unaligned_dma_buf_supported = false,
458         .phy_intf = TEGRA_USB_PHY_INTF_UTMI,
459         .op_mode = TEGRA_USB_OPMODE_HOST,
460         .u_data.host = {
461                 .vbus_gpio = -1,
462                 .hot_plug = false,
463                 .remote_wakeup_supported = true,
464                 .power_off_on_suspend = true,
465         },
466         .u_cfg.utmi = {
467         .hssync_start_delay = 0,
468                 .elastic_limit = 16,
469                 .idle_wait_delay = 17,
470                 .term_range_adj = 6,
471                 .xcvr_setup = 8,
472                 .xcvr_lsfslew = 0,
473                 .xcvr_lsrslew = 3,
474                 .xcvr_setup_offset = 0,
475                 .xcvr_use_fuses = 1,
476                 .vbus_oc_map = 0x5,
477         },
478 };
479
480 static struct tegra_usb_otg_data tegra_otg_pdata = {
481         .ehci_device = &tegra_ehci1_device,
482         .ehci_pdata = &tegra_ehci1_utmi_pdata,
483 };
484
485 static void dalmore_usb_init(void)
486 {
487         int usb_port_owner_info = tegra_get_usb_port_owner_info();
488
489         /* Set USB wake sources for dalmore */
490         tegra_set_usb_wake_source();
491
492         if (!(usb_port_owner_info & UTMI1_PORT_OWNER_XUSB)) {
493                 tegra_otg_device.dev.platform_data = &tegra_otg_pdata;
494                 platform_device_register(&tegra_otg_device);
495                 /* Setup the udc platform data */
496                 tegra_udc_device.dev.platform_data = &tegra_udc_pdata;
497         }
498
499         if (!(usb_port_owner_info & UTMI2_PORT_OWNER_XUSB)) {
500                 tegra_ehci3_device.dev.platform_data = &tegra_ehci3_utmi_pdata;
501                 platform_device_register(&tegra_ehci3_device);
502         }
503 }
504
505 static struct tegra_xusb_board_data xusb_bdata = {
506         .portmap = TEGRA_XUSB_SS_P0 | TEGRA_XUSB_USB2_P1,
507         /* ss_portmap[0:3] = SS0 map, ss_portmap[4:7] = SS1 map */
508         .ss_portmap = (TEGRA_XUSB_SS_PORT_MAP_USB2_P1 << 0),
509         .uses_external_pmic = false,
510         .supply = {
511                 .utmi_vbuses = {
512                         NULL, "usb_vbus", NULL
513                 },
514                 .s3p3v = "hvdd_usb",
515                 .s1p8v = "avdd_usb_pll",
516                 .vddio_hsic = "vddio_hsic",
517                 .s1p05v = "avddio_usb",
518         },
519 };
520
521 static void dalmore_xusb_init(void)
522 {
523         int usb_port_owner_info = tegra_get_usb_port_owner_info();
524
525         if (usb_port_owner_info & UTMI2_PORT_OWNER_XUSB)
526                 tegra_xusb_init(&xusb_bdata);
527 }
528
529 static struct gpio modem_gpios[] = { /* Nemo modem */
530         {MODEM_EN, GPIOF_OUT_INIT_HIGH, "MODEM EN"},
531         {MDM_RST, GPIOF_OUT_INIT_LOW, "MODEM RESET"},
532 };
533
534 static struct tegra_usb_platform_data tegra_ehci2_hsic_baseband_pdata = {
535         .port_otg = false,
536         .has_hostpc = true,
537         .unaligned_dma_buf_supported = false,
538         .phy_intf = TEGRA_USB_PHY_INTF_HSIC,
539         .op_mode = TEGRA_USB_OPMODE_HOST,
540         .u_data.host = {
541                 .vbus_gpio = -1,
542                 .hot_plug = false,
543                 .remote_wakeup_supported = true,
544                 .power_off_on_suspend = true,
545         },
546 };
547
548 static int baseband_init(void)
549 {
550         int ret;
551
552         ret = gpio_request_array(modem_gpios, ARRAY_SIZE(modem_gpios));
553         if (ret) {
554                 pr_warn("%s:gpio request failed\n", __func__);
555                 return ret;
556         }
557
558         /* enable pull-down for MDM_COLD_BOOT */
559         tegra_pinmux_set_pullupdown(TEGRA_PINGROUP_KB_COL5,
560                                     TEGRA_PUPD_PULL_DOWN);
561
562         /* export GPIO for user space access through sysfs */
563         gpio_export(MDM_RST, false);
564
565         return 0;
566 }
567
568 static const struct tegra_modem_operations baseband_operations = {
569         .init = baseband_init,
570 };
571
572 static struct tegra_usb_modem_power_platform_data baseband_pdata = {
573         .ops = &baseband_operations,
574         .regulator_name = "vdd_modem_3v3",
575         .wake_gpio = -1,
576         .boot_gpio = MDM_COLDBOOT,
577         .boot_irq_flags = IRQF_TRIGGER_RISING |
578                                     IRQF_TRIGGER_FALLING |
579                                     IRQF_ONESHOT,
580         .autosuspend_delay = 2000,
581         .short_autosuspend_delay = 50,
582         .tegra_ehci_device = &tegra_ehci2_device,
583         .tegra_ehci_pdata = &tegra_ehci2_hsic_baseband_pdata,
584 };
585
586 static struct platform_device icera_nemo_device = {
587         .name = "tegra_usb_modem_power",
588         .id = -1,
589         .dev = {
590                 .platform_data = &baseband_pdata,
591         },
592 };
593
594 static void dalmore_modem_init(void)
595 {
596         int modem_id = tegra_get_modem_id();
597         int usb_port_owner_info = tegra_get_usb_port_owner_info();
598         switch (modem_id) {
599         case TEGRA_BB_NEMO: /* on board i500 HSIC */
600                 if (!(usb_port_owner_info & HSIC1_PORT_OWNER_XUSB)) {
601                         platform_device_register(&icera_nemo_device);
602                 }
603                 break;
604         }
605 }
606
607 #else
608 static void dalmore_usb_init(void) { }
609 static void dalmore_modem_init(void) { }
610 static void dalmore_xusb_init(void) { }
611 #endif
612
613 static void dalmore_audio_init(void)
614 {
615         dalmore_audio_pdata.codec_name = "rt5640.0-001c";
616         dalmore_audio_pdata.codec_dai_name = "rt5640-aif1";
617 }
618
619 #ifndef CONFIG_USE_OF
620 static struct platform_device *dalmore_spi_devices[] __initdata = {
621         &tegra11_spi_device4,
622 };
623
624 static struct tegra_spi_platform_data dalmore_spi_pdata = {
625         .dma_req_sel            = 0,
626         .spi_max_frequency      = 25000000,
627         .clock_always_on        = false,
628 };
629
630 static void __init dalmore_spi_init(void)
631 {
632         tegra11_spi_device4.dev.platform_data = &dalmore_spi_pdata;
633         platform_add_devices(dalmore_spi_devices,
634                                 ARRAY_SIZE(dalmore_spi_devices));
635 }
636 #else
637 static void __init dalmore_spi_init(void)
638 {
639 }
640 #endif
641
642 static __initdata struct tegra_clk_init_table touch_clk_init_table[] = {
643         /* name         parent          rate            enabled */
644         { "extern2",    "pll_p",        41000000,       false},
645         { "clk_out_2",  "extern2",      40800000,       false},
646         { NULL,         NULL,           0,              0},
647 };
648
649 struct rm_spi_ts_platform_data rm31080ts_dalmore_data = {
650         .gpio_reset = TOUCH_GPIO_RST_RAYDIUM_SPI,
651         .config = 0,
652         .platform_id = RM_PLATFORM_D010,
653         .name_of_clock = "clk_out_2",
654         .name_of_clock_con = "extern2",
655 };
656
657 static struct tegra_spi_device_controller_data dev_cdata = {
658         .rx_clk_tap_delay = 16,
659         .tx_clk_tap_delay = 16,
660 };
661
662 struct spi_board_info rm31080a_dalmore_spi_board[1] = {
663         {
664          .modalias = "rm_ts_spidev",
665          .bus_num = 3,
666          .chip_select = 2,
667          .max_speed_hz = 12 * 1000 * 1000,
668          .mode = SPI_MODE_0,
669          .controller_data = &dev_cdata,
670          .platform_data = &rm31080ts_dalmore_data,
671          },
672 };
673
674 static int __init dalmore_touch_init(void)
675 {
676         tegra_clk_init_from_table(touch_clk_init_table);
677         if (display_board_info.board_id == BOARD_E1582)
678                 rm31080ts_dalmore_data.platform_id = RM_PLATFORM_P005;
679         else
680                 rm31080ts_dalmore_data.platform_id = RM_PLATFORM_D010;
681         mdelay(20);
682         rm31080a_dalmore_spi_board[0].irq = gpio_to_irq(TOUCH_GPIO_IRQ_RAYDIUM_SPI);
683         touch_init_raydium(TOUCH_GPIO_IRQ_RAYDIUM_SPI,
684                                 TOUCH_GPIO_RST_RAYDIUM_SPI,
685                                 &rm31080ts_dalmore_data,
686                                 &rm31080a_dalmore_spi_board[0],
687                                 ARRAY_SIZE(rm31080a_dalmore_spi_board));
688         return 0;
689 }
690
691 #ifdef CONFIG_USE_OF
692 struct of_dev_auxdata dalmore_auxdata_lookup[] __initdata = {
693         OF_DEV_AUXDATA("nvidia,tegra114-sdhci", 0x78000600, "sdhci-tegra.3",
694                                 NULL),
695         OF_DEV_AUXDATA("nvidia,tegra114-sdhci", 0x78000400, "sdhci-tegra.2",
696                                 NULL),
697         OF_DEV_AUXDATA("nvidia,tegra114-sdhci", 0x78000000, "sdhci-tegra.0",
698                                 &dalmore_tegra_sdhci_platform_data0),
699         OF_DEV_AUXDATA("nvidia,tegra114-camera", 0x0, "tegra_camera",
700                                 NULL),
701         OF_DEV_AUXDATA("nvidia,tegra114-host1x", TEGRA_HOST1X_BASE, "host1x",
702                                 NULL),
703         OF_DEV_AUXDATA("nvidia,tegra114-gr3d", TEGRA_GR3D_BASE, "gr3d",
704                                 NULL),
705         OF_DEV_AUXDATA("nvidia,tegra114-gr2d", TEGRA_GR2D_BASE, "gr2d",
706                                 NULL),
707         OF_DEV_AUXDATA("nvidia,tegra114-msenc", TEGRA_MSENC_BASE, "msenc",
708                                 NULL),
709         OF_DEV_AUXDATA("nvidia,tegra114-vi", TEGRA_VI_BASE, "vi",
710                                 NULL),
711         OF_DEV_AUXDATA("nvidia,tegra114-isp", TEGRA_ISP_BASE, "isp",
712                                 NULL),
713         OF_DEV_AUXDATA("nvidia,tegra114-tsec", TEGRA_TSEC_BASE, "tsec",
714                                 NULL),
715
716         OF_DEV_AUXDATA("nvidia,tegra114-i2c", 0x7000c000, "tegra11-i2c.0",
717                                 NULL),
718         OF_DEV_AUXDATA("nvidia,tegra114-i2c", 0x7000c400, "tegra11-i2c.1",
719                                 NULL),
720         OF_DEV_AUXDATA("nvidia,tegra114-i2c", 0x7000c500, "tegra11-i2c.2",
721                                 NULL),
722         OF_DEV_AUXDATA("nvidia,tegra114-i2c", 0x7000c700, "tegra11-i2c.3",
723                                 NULL),
724         OF_DEV_AUXDATA("nvidia,tegra114-i2c", 0x7000d000, "tegra11-i2c.4",
725                                 NULL),
726         OF_DEV_AUXDATA("nvidia,tegra114-spi", 0x7000d400, "spi-tegra114.0",
727                                 NULL),
728         OF_DEV_AUXDATA("nvidia,tegra114-spi", 0x7000d600, "spi-tegra114.1",
729                                 NULL),
730         OF_DEV_AUXDATA("nvidia,tegra114-spi", 0x7000d800, "spi-tegra114.2",
731                                 NULL),
732         OF_DEV_AUXDATA("nvidia,tegra114-spi", 0x7000da00, "spi-tegra114.3",
733                                 NULL),
734         OF_DEV_AUXDATA("nvidia,tegra114-spi", 0x7000dc00, "spi-tegra114.4",
735                                 NULL),
736         OF_DEV_AUXDATA("nvidia,tegra114-spi", 0x7000de00, "spi-tegra114.5",
737                                 NULL),
738         OF_DEV_AUXDATA("nvidia,tegra114-apbdma", 0x6000a000, "tegra-apbdma",
739                                 NULL),
740         OF_DEV_AUXDATA("nvidia,tegra114-hsuart", 0x70006000, "serial-tegra.0",
741                                 NULL),
742         OF_DEV_AUXDATA("nvidia,tegra114-hsuart", 0x70006040, "serial-tegra.1",
743                                 NULL),
744         OF_DEV_AUXDATA("nvidia,tegra114-hsuart", 0x70006200, "serial-tegra.2",
745                                 NULL),
746         {}
747 };
748 #endif
749
750 static void __init tegra_dalmore_early_init(void)
751 {
752         tegra_clk_init_from_table(dalmore_clk_init_table);
753         tegra_clk_verify_parents();
754         tegra_soc_device_init("dalmore");
755 }
756
757 static void __init tegra_dalmore_late_init(void)
758 {
759         platform_device_register(&tegra_pinmux_device);
760         dalmore_pinmux_init();
761         dalmore_i2c_init();
762         dalmore_spi_init();
763         dalmore_usb_init();
764         dalmore_xusb_init();
765         dalmore_uart_init();
766         dalmore_audio_init();
767         platform_add_devices(dalmore_devices, ARRAY_SIZE(dalmore_devices));
768         //tegra_ram_console_debug_init();
769         tegra_io_dpd_init();
770         dalmore_regulator_init();
771         dalmore_sdhci_init();
772         dalmore_suspend_init();
773         dalmore_emc_init();
774         dalmore_edp_init();
775         isomgr_init();
776         dalmore_touch_init();
777         if (board_info.board_id == BOARD_E1582)
778                 roth_panel_init(board_info.board_id);
779         else
780                 dalmore_panel_init();
781         dalmore_kbc_init();
782         dalmore_pmon_init();
783 #if defined(CONFIG_BT_BLUESLEEP) || defined(CONFIG_BT_BLUESLEEP_MODULE)
784         dalmore_setup_bluesleep();
785         dalmore_setup_bt_rfkill();
786 #elif defined(CONFIG_BLUEDROID_PM) || defined(CONFIG_BLUEDROID_PM_MODULE)
787         dalmore_setup_bluedroid_pm();
788 #endif
789         dalmore_modem_init();
790 #ifdef CONFIG_TEGRA_WDT_RECOVERY
791         tegra_wdt_recovery_init();
792 #endif
793         tegra_serial_debug_init(TEGRA_UARTD_BASE, INT_WDT_CPU, NULL, -1, -1);
794         dalmore_sensors_init();
795         dalmore_soctherm_init();
796         tegra_register_fuse();
797 }
798
799 static void __init dalmore_ramconsole_reserve(unsigned long size)
800 {
801         tegra_ram_console_debug_reserve(SZ_1M);
802 }
803
804 static void __init tegra_dalmore_dt_init(void)
805 {
806         tegra_get_board_info(&board_info);
807         tegra_get_display_board_info(&display_board_info);
808
809         tegra_dalmore_early_init();
810
811         of_platform_populate(NULL,
812                 of_default_bus_match_table, dalmore_auxdata_lookup,
813                 &platform_bus);
814
815         tegra_dalmore_late_init();
816 }
817
818 static void __init tegra_dalmore_reserve(void)
819 {
820 #if defined(CONFIG_NVMAP_CONVERT_CARVEOUT_TO_IOVMM)
821         /* 1920*1200*4*2 = 18432000 bytes */
822         tegra_reserve(0, SZ_16M + SZ_2M, SZ_16M);
823 #else
824         tegra_reserve(SZ_512M, SZ_16M + SZ_2M, SZ_4M);
825 #endif
826         dalmore_ramconsole_reserve(SZ_1M);
827 }
828
829 static const char * const dalmore_dt_board_compat[] = {
830         "nvidia,dalmore",
831         NULL
832 };
833
834 MACHINE_START(DALMORE, "dalmore")
835         .atag_offset    = 0x100,
836         .smp            = smp_ops(tegra_smp_ops),
837         .map_io         = tegra_map_common_io,
838         .reserve        = tegra_dalmore_reserve,
839         .init_early     = tegra11x_init_early,
840         .init_irq       = tegra_dt_init_irq,
841         .init_time      = clocksource_of_init,
842         .init_machine   = tegra_dalmore_dt_init,
843         .restart        = tegra_assert_system_reset,
844         .dt_compat      = dalmore_dt_board_compat,
845         .init_late      = tegra_init_late,
846 MACHINE_END