ARM: tegra: macallan: update vbus extcon dev name
[linux-3.10.git] / arch / arm / mach-tegra / board-macallan.c
1 /*
2  * arch/arm/mach-tegra/board-macallan.c
3  *
4  * Copyright (c) 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/usb/tegra_usb_phy.h>
35 #include <linux/spi/spi.h>
36 #include <linux/spi/rm31080a_ts.h>
37 #include <linux/tegra_uart.h>
38 #include <linux/memblock.h>
39 #include <linux/spi-tegra.h>
40 #include <linux/nfc/pn544.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
51 #include <asm/hardware/gic.h>
52
53 #include <mach/clk.h>
54 #include <mach/irqs.h>
55 #include <mach/pinmux.h>
56 #include <mach/pinmux-tegra30.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
67 #include "board-touch-raydium.h"
68 #include "board.h"
69 #include "board-common.h"
70 #include "clock.h"
71 #include "board-macallan.h"
72 #include "devices.h"
73 #include "gpio-names.h"
74 #include "fuse.h"
75 #include "iomap.h"
76 #include "pm.h"
77 #include "pm-irq.h"
78 #include "common.h"
79 #include "tegra-board-id.h"
80
81 static struct board_info board_info, display_board_info;
82
83 #if defined CONFIG_TI_ST || defined CONFIG_TI_ST_MODULE
84 struct ti_st_plat_data macallan_wilink_pdata = {
85         .nshutdown_gpio = TEGRA_GPIO_PQ7,
86         .dev_name = BLUETOOTH_UART_DEV_NAME,
87         .flow_cntrl = 1,
88         .baud_rate = 3000000,
89 };
90
91 static struct platform_device wl128x_device = {
92         .name           = "kim",
93         .id             = -1,
94         .dev.platform_data = &macallan_wilink_pdata,
95 };
96
97 static struct platform_device btwilink_device = {
98         .name = "btwilink",
99         .id = -1,
100 };
101
102 static noinline void __init macallan_bt_st(void)
103 {
104         pr_info("macallan_bt_st");
105
106         platform_device_register(&wl128x_device);
107         platform_device_register(&btwilink_device);
108 }
109
110 static struct resource macallan_st_host_wake_resources[] = {
111         [0] = {
112                 .name = "host_wake",
113                 .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
114         },
115 };
116
117 static struct platform_device macallan_st_host_wake_device = {
118         .name           = "st_host_wake",
119         .id             = 0,
120         .num_resources  = ARRAY_SIZE(macallan_st_host_wake_resources),
121         .resource       = macallan_st_host_wake_resources,
122 };
123
124 static noinline void __init macallan_tegra_setup_st_host_wake(void)
125 {
126         macallan_st_host_wake_resources[0].start =
127                 macallan_st_host_wake_resources[0].end =
128                 gpio_to_irq(TEGRA_GPIO_PU6);
129         platform_device_register(&macallan_st_host_wake_device);
130 }
131 #endif
132
133 static __initdata struct tegra_clk_init_table macallan_clk_init_table[] = {
134         /* name         parent          rate            enabled */
135         { "pll_m",      NULL,           0,              false},
136         { "hda",        "pll_p",        108000000,      false},
137         { "hda2codec_2x", "pll_p",      48000000,       false},
138         { "pwm",        "pll_p",        3187500,        false},
139         { "blink",      "clk_32k",      32768,          true},
140         { "i2s1",       "pll_a_out0",   0,              false},
141         { "i2s3",       "pll_a_out0",   0,              false},
142         { "i2s4",       "pll_a_out0",   0,              false},
143         { "spdif_out",  "pll_a_out0",   0,              false},
144         { "d_audio",    "clk_m",        12000000,       false},
145         { "dam0",       "clk_m",        12000000,       false},
146         { "dam1",       "clk_m",        12000000,       false},
147         { "dam2",       "clk_m",        12000000,       false},
148         { "audio1",     "i2s1_sync",    0,              false},
149         { "audio3",     "i2s3_sync",    0,              false},
150         /* Setting vi_sensor-clk to true for validation purpose, will imapact
151          * power, later set to be false.*/
152         { "vi_sensor",  "pll_p",        150000000,      false},
153         { "cilab",      "pll_p",        150000000,      false},
154         { "cilcd",      "pll_p",        150000000,      false},
155         { "cile",       "pll_p",        150000000,      false},
156         { "i2c1",       "pll_p",        3200000,        false},
157         { "i2c2",       "pll_p",        3200000,        false},
158         { "i2c3",       "pll_p",        3200000,        false},
159         { "i2c4",       "pll_p",        3200000,        false},
160         { "i2c5",       "pll_p",        3200000,        false},
161         { NULL,         NULL,           0,              0},
162 };
163
164 #ifndef CONFIG_USE_OF
165 static struct tegra_i2c_platform_data macallan_i2c1_platform_data = {
166         .bus_clk_rate   = 100000,
167         .scl_gpio       = TEGRA_GPIO_I2C1_SCL,
168         .sda_gpio       = TEGRA_GPIO_I2C1_SDA,
169 };
170
171 static struct tegra_i2c_platform_data macallan_i2c2_platform_data = {
172         .bus_clk_rate   = 100000,
173         .is_clkon_always = true,
174         .scl_gpio       = TEGRA_GPIO_I2C2_SCL,
175         .sda_gpio       = TEGRA_GPIO_I2C2_SDA,
176 };
177
178 static struct tegra_i2c_platform_data macallan_i2c3_platform_data = {
179         .bus_clk_rate   = 400000,
180         .scl_gpio       = TEGRA_GPIO_I2C3_SCL,
181         .sda_gpio       = TEGRA_GPIO_I2C3_SDA,
182 };
183
184 static struct tegra_i2c_platform_data macallan_i2c4_platform_data = {
185         .bus_clk_rate   = 10000,
186         .scl_gpio       = TEGRA_GPIO_I2C4_SCL,
187         .sda_gpio       = TEGRA_GPIO_I2C4_SDA,
188 };
189
190 static struct tegra_i2c_platform_data macallan_i2c5_platform_data = {
191         .bus_clk_rate   = 400000,
192         .scl_gpio       = TEGRA_GPIO_I2C5_SCL,
193         .sda_gpio       = TEGRA_GPIO_I2C5_SDA,
194 };
195 #endif
196
197 static struct i2c_board_info __initdata rt5640_board_info = {
198         I2C_BOARD_INFO("rt5640", 0x1c),
199 };
200
201 static struct pn544_i2c_platform_data nfc_pdata = {
202         .irq_gpio = TEGRA_GPIO_PW2,
203         .ven_gpio = TEGRA_GPIO_PQ3,
204         .firm_gpio = TEGRA_GPIO_PH0,
205 };
206
207 static struct i2c_board_info __initdata nfc_board_info = {
208         I2C_BOARD_INFO("pn544", 0x28),
209         .platform_data = &nfc_pdata,
210 };
211
212 static void macallan_i2c_init(void)
213 {
214 #ifndef CONFIG_USE_OF
215         tegra11_i2c_device1.dev.platform_data = &macallan_i2c1_platform_data;
216         tegra11_i2c_device2.dev.platform_data = &macallan_i2c2_platform_data;
217         tegra11_i2c_device3.dev.platform_data = &macallan_i2c3_platform_data;
218         tegra11_i2c_device4.dev.platform_data = &macallan_i2c4_platform_data;
219         tegra11_i2c_device5.dev.platform_data = &macallan_i2c5_platform_data;
220
221         platform_device_register(&tegra11_i2c_device5);
222         platform_device_register(&tegra11_i2c_device4);
223         platform_device_register(&tegra11_i2c_device3);
224         platform_device_register(&tegra11_i2c_device2);
225         platform_device_register(&tegra11_i2c_device1);
226 #endif
227
228         nfc_board_info.irq = gpio_to_irq(TEGRA_GPIO_PW2);
229         i2c_register_board_info(0, &nfc_board_info, 1);
230         i2c_register_board_info(0, &rt5640_board_info, 1);
231 }
232
233 static struct platform_device *macallan_uart_devices[] __initdata = {
234         &tegra_uarta_device,
235         &tegra_uartb_device,
236         &tegra_uartc_device,
237         &tegra_uartd_device,
238 };
239 static struct uart_clk_parent uart_parent_clk[] = {
240         [0] = {.name = "clk_m"},
241         [1] = {.name = "pll_p"},
242 #ifndef CONFIG_TEGRA_PLLM_RESTRICTED
243         [2] = {.name = "pll_m"},
244 #endif
245 };
246
247 static struct tegra_uart_platform_data macallan_uart_pdata;
248 static struct tegra_uart_platform_data macallan_loopback_uart_pdata;
249
250 static void __init uart_debug_init(void)
251 {
252         int debug_port_id;
253
254         debug_port_id = uart_console_debug_init(3);
255         if (debug_port_id < 0)
256                 return;
257
258         macallan_uart_devices[debug_port_id] = uart_console_debug_device;
259 }
260
261 static void __init macallan_uart_init(void)
262 {
263         struct clk *c;
264         int i;
265
266         for (i = 0; i < ARRAY_SIZE(uart_parent_clk); ++i) {
267                 c = tegra_get_clock_by_name(uart_parent_clk[i].name);
268                 if (IS_ERR_OR_NULL(c)) {
269                         pr_err("Not able to get the clock for %s\n",
270                                                 uart_parent_clk[i].name);
271                         continue;
272                 }
273                 uart_parent_clk[i].parent_clk = c;
274                 uart_parent_clk[i].fixed_clk_rate = clk_get_rate(c);
275         }
276         macallan_uart_pdata.parent_clk_list = uart_parent_clk;
277         macallan_uart_pdata.parent_clk_count = ARRAY_SIZE(uart_parent_clk);
278         macallan_loopback_uart_pdata.parent_clk_list = uart_parent_clk;
279         macallan_loopback_uart_pdata.parent_clk_count =
280                                                 ARRAY_SIZE(uart_parent_clk);
281         macallan_loopback_uart_pdata.is_loopback = true;
282         tegra_uarta_device.dev.platform_data = &macallan_uart_pdata;
283         tegra_uartb_device.dev.platform_data = &macallan_uart_pdata;
284         tegra_uartc_device.dev.platform_data = &macallan_uart_pdata;
285         tegra_uartd_device.dev.platform_data = &macallan_uart_pdata;
286
287         /* Register low speed only if it is selected */
288         if (!is_tegra_debug_uartport_hs())
289                 uart_debug_init();
290
291         platform_add_devices(macallan_uart_devices,
292                                 ARRAY_SIZE(macallan_uart_devices));
293 }
294
295 static struct resource tegra_rtc_resources[] = {
296         [0] = {
297                 .start = TEGRA_RTC_BASE,
298                 .end = TEGRA_RTC_BASE + TEGRA_RTC_SIZE - 1,
299                 .flags = IORESOURCE_MEM,
300         },
301         [1] = {
302                 .start = INT_RTC,
303                 .end = INT_RTC,
304                 .flags = IORESOURCE_IRQ,
305         },
306 };
307
308 static struct platform_device tegra_rtc_device = {
309         .name = "tegra_rtc",
310         .id   = -1,
311         .resource = tegra_rtc_resources,
312         .num_resources = ARRAY_SIZE(tegra_rtc_resources),
313 };
314
315 static struct tegra_asoc_platform_data macallan_audio_pdata = {
316         .gpio_spkr_en           = TEGRA_GPIO_SPKR_EN,
317         .gpio_hp_det            = TEGRA_GPIO_HP_DET,
318         .gpio_hp_mute           = -1,
319         .gpio_int_mic_en        = TEGRA_GPIO_INT_MIC_EN,
320         .gpio_ext_mic_en        = TEGRA_GPIO_EXT_MIC_EN,
321         .gpio_ldo1_en           = TEGRA_GPIO_LDO1_EN,
322         .gpio_codec1 = TEGRA_GPIO_CODEC1_EN,
323         .gpio_codec2 = TEGRA_GPIO_CODEC2_EN,
324         .gpio_codec3 = TEGRA_GPIO_CODEC3_EN,
325         .i2s_param[HIFI_CODEC]  = {
326                 .audio_port_id  = 1,
327                 .is_i2s_master  = 1,
328                 .i2s_mode       = TEGRA_DAIFMT_I2S,
329         },
330         .i2s_param[BT_SCO]      = {
331                 .audio_port_id  = 3,
332                 .is_i2s_master  = 1,
333                 .i2s_mode       = TEGRA_DAIFMT_DSP_A,
334         },
335 };
336
337 static struct platform_device macallan_audio_device = {
338         .name   = "tegra-snd-rt5640",
339         .id     = 0,
340         .dev    = {
341                 .platform_data = &macallan_audio_pdata,
342         },
343 };
344
345 static struct platform_device *macallan_devices[] __initdata = {
346         &tegra_pmu_device,
347         &tegra_rtc_device,
348         &tegra_udc_device,
349 #if defined(CONFIG_TEGRA_AVP)
350         &tegra_avp_device,
351 #endif
352 #if defined(CONFIG_CRYPTO_DEV_TEGRA_SE)
353         &tegra11_se_device,
354 #endif
355         &tegra_ahub_device,
356         &tegra_dam_device0,
357         &tegra_dam_device1,
358         &tegra_dam_device2,
359         &tegra_i2s_device1,
360         &tegra_i2s_device3,
361         &tegra_i2s_device4,
362         &tegra_spdif_device,
363         &spdif_dit_device,
364         &bluetooth_dit_device,
365         &macallan_audio_device,
366         &tegra_hda_device,
367 #if defined(CONFIG_CRYPTO_DEV_TEGRA_AES)
368         &tegra_aes_device,
369 #endif
370 };
371
372 #ifdef CONFIG_USB_SUPPORT
373 static struct tegra_usb_platform_data tegra_udc_pdata = {
374         .port_otg = true,
375         .has_hostpc = true,
376         .support_pmu_vbus = true,
377         .phy_intf = TEGRA_USB_PHY_INTF_UTMI,
378         .op_mode = TEGRA_USB_OPMODE_DEVICE,
379         .u_data.dev = {
380                 .vbus_pmu_irq = 0,
381                 .vbus_gpio = -1,
382                 .charging_supported = false,
383                 .remote_wakeup_supported = false,
384         },
385         .u_cfg.utmi = {
386                 .hssync_start_delay = 0,
387                 .elastic_limit = 16,
388                 .idle_wait_delay = 17,
389                 .term_range_adj = 6,
390                 .xcvr_setup = 8,
391                 .xcvr_lsfslew = 2,
392                 .xcvr_lsrslew = 2,
393                 .xcvr_setup_offset = 0,
394                 .xcvr_use_fuses = 1,
395         },
396 };
397
398 static struct tegra_usb_platform_data tegra_ehci1_utmi_pdata = {
399         .port_otg = true,
400         .has_hostpc = true,
401         .support_pmu_vbus = true,
402         .unaligned_dma_buf_supported = false,
403         .phy_intf = TEGRA_USB_PHY_INTF_UTMI,
404         .op_mode = TEGRA_USB_OPMODE_HOST,
405         .u_data.host = {
406                 .vbus_gpio = -1,
407                 .hot_plug = false,
408                 .remote_wakeup_supported = true,
409                 .power_off_on_suspend = true,
410         },
411         .u_cfg.utmi = {
412                 .hssync_start_delay = 0,
413                 .elastic_limit = 16,
414                 .idle_wait_delay = 17,
415                 .term_range_adj = 6,
416                 .xcvr_setup = 15,
417                 .xcvr_lsfslew = 2,
418                 .xcvr_lsrslew = 2,
419                 .xcvr_setup_offset = 0,
420                 .xcvr_use_fuses = 1,
421                 .vbus_oc_map = 0x4,
422         },
423 };
424
425 static struct tegra_usb_otg_data tegra_otg_pdata = {
426         .ehci_device = &tegra_ehci1_device,
427         .ehci_pdata = &tegra_ehci1_utmi_pdata,
428         .vbus_extcon_dev_name = "palmas-extcon",
429 };
430
431 static void macallan_usb_init(void)
432 {
433         int usb_port_owner_info = tegra_get_usb_port_owner_info();
434
435         /* Set USB wake sources for macallan */
436         tegra_set_usb_wake_source();
437
438         if (!(usb_port_owner_info & UTMI1_PORT_OWNER_XUSB)) {
439                 tegra_otg_device.dev.platform_data = &tegra_otg_pdata;
440                 platform_device_register(&tegra_otg_device);
441                 /* Setup the udc platform data */
442                 tegra_udc_device.dev.platform_data = &tegra_udc_pdata;
443         }
444 }
445
446 static struct gpio modem_gpios[] = { /* Nemo modem */
447         {MODEM_EN, GPIOF_OUT_INIT_HIGH, "MODEM EN"},
448         {MDM_RST, GPIOF_OUT_INIT_LOW, "MODEM RESET"},
449 };
450
451 static struct tegra_usb_platform_data tegra_ehci2_hsic_baseband_pdata = {
452         .port_otg = false,
453         .has_hostpc = true,
454         .unaligned_dma_buf_supported = false,
455         .phy_intf = TEGRA_USB_PHY_INTF_HSIC,
456         .op_mode = TEGRA_USB_OPMODE_HOST,
457         .u_data.host = {
458                 .vbus_gpio = -1,
459                 .hot_plug = false,
460                 .remote_wakeup_supported = true,
461                 .power_off_on_suspend = true,
462         },
463 };
464
465 static int baseband_init(void)
466 {
467         int ret;
468
469         ret = gpio_request_array(modem_gpios, ARRAY_SIZE(modem_gpios));
470         if (ret) {
471                 pr_warn("%s:gpio request failed\n", __func__);
472                 return ret;
473         }
474
475         /* enable pull-down for MDM_COLD_BOOT */
476         tegra_pinmux_set_pullupdown(TEGRA_PINGROUP_ULPI_DATA4,
477                                     TEGRA_PUPD_PULL_DOWN);
478
479         /* export GPIO for user space access through sysfs */
480         gpio_export(MDM_RST, false);
481
482         return 0;
483 }
484
485 static const struct tegra_modem_operations baseband_operations = {
486         .init = baseband_init,
487 };
488
489 static struct tegra_usb_modem_power_platform_data baseband_pdata = {
490         .ops = &baseband_operations,
491         .wake_gpio = -1,
492         .boot_gpio = MDM_COLDBOOT,
493         .boot_irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
494         .autosuspend_delay = 2000,
495         .short_autosuspend_delay = 50,
496         .tegra_ehci_device = &tegra_ehci2_device,
497         .tegra_ehci_pdata = &tegra_ehci2_hsic_baseband_pdata,
498 };
499
500 static struct platform_device icera_nemo_device = {
501         .name = "tegra_usb_modem_power",
502         .id = -1,
503         .dev = {
504                 .platform_data = &baseband_pdata,
505         },
506 };
507
508 static void macallan_modem_init(void)
509 {
510         int modem_id = tegra_get_modem_id();
511         int usb_port_owner_info = tegra_get_usb_port_owner_info();
512         switch (modem_id) {
513         case TEGRA_BB_NEMO: /* on board i500 HSIC */
514                 if (!(usb_port_owner_info & HSIC1_PORT_OWNER_XUSB))
515                         platform_device_register(&icera_nemo_device);
516                 break;
517         }
518 }
519
520 #else
521 static void macallan_usb_init(void) { }
522 static void macallan_modem_init(void) { }
523 #endif
524
525 static void macallan_audio_init(void)
526 {
527         macallan_audio_pdata.codec_name = "rt5640.0-001c";
528         macallan_audio_pdata.codec_dai_name = "rt5640-aif1";
529 }
530
531
532 static struct platform_device *macallan_spi_devices[] __initdata = {
533         &tegra11_spi_device1,
534 };
535
536 struct spi_clk_parent spi_parent_clk_macallan[] = {
537         [0] = {.name = "pll_p"},
538 #ifndef CONFIG_TEGRA_PLLM_RESTRICTED
539         [1] = {.name = "pll_m"},
540         [2] = {.name = "clk_m"},
541 #else
542         [1] = {.name = "clk_m"},
543 #endif
544 };
545
546 static struct tegra_spi_platform_data macallan_spi_pdata = {
547         .is_dma_based           = false,
548         .max_dma_buffer         = 16 * 1024,
549         .is_clkon_always        = false,
550         .max_rate               = 25000000,
551 };
552
553 static void __init macallan_spi_init(void)
554 {
555         int i;
556         struct clk *c;
557
558         for (i = 0; i < ARRAY_SIZE(spi_parent_clk_macallan); ++i) {
559                 c = tegra_get_clock_by_name(spi_parent_clk_macallan[i].name);
560                 if (IS_ERR_OR_NULL(c)) {
561                         pr_err("Not able to get the clock for %s\n",
562                                         spi_parent_clk_macallan[i].name);
563                         continue;
564                 }
565                 spi_parent_clk_macallan[i].parent_clk = c;
566                 spi_parent_clk_macallan[i].fixed_clk_rate = clk_get_rate(c);
567         }
568         macallan_spi_pdata.parent_clk_list = spi_parent_clk_macallan;
569         macallan_spi_pdata.parent_clk_count = ARRAY_SIZE(spi_parent_clk_macallan);
570         tegra11_spi_device1.dev.platform_data = &macallan_spi_pdata;
571         platform_add_devices(macallan_spi_devices,
572                                 ARRAY_SIZE(macallan_spi_devices));
573 }
574
575 static __initdata struct tegra_clk_init_table touch_clk_init_table[] = {
576         /* name         parent          rate            enabled */
577         { "extern2",    "pll_p",        41000000,       false},
578         { "clk_out_2",  "extern2",      40800000,       false},
579         { NULL,         NULL,           0,              0},
580 };
581
582 struct rm_spi_ts_platform_data rm31080ts_macallan_data = {
583         .gpio_reset = TOUCH_GPIO_RST_RAYDIUM_SPI,
584         .config = 0,
585         .platform_id = RM_PLATFORM_D010,
586         .name_of_clock = "clk_out_2",
587         .name_of_clock_con = "extern2",
588 };
589
590 static struct tegra_spi_device_controller_data dev_cdata = {
591         .rx_clk_tap_delay = 0,
592         .tx_clk_tap_delay = 16,
593 };
594
595 struct spi_board_info rm31080a_macallan_spi_board[1] = {
596         {
597          .modalias = "rm_ts_spidev",
598          .bus_num = 0,
599          .chip_select = 0,
600          .max_speed_hz = 12 * 1000 * 1000,
601          .mode = SPI_MODE_0,
602          .controller_data = &dev_cdata,
603          .platform_data = &rm31080ts_macallan_data,
604          },
605 };
606
607 static int __init macallan_touch_init(void)
608 {
609         tegra_clk_init_from_table(touch_clk_init_table);
610         if (display_board_info.board_id == BOARD_E1582)
611                 rm31080ts_macallan_data.platform_id = RM_PLATFORM_P005;
612         else
613                 rm31080ts_macallan_data.platform_id = RM_PLATFORM_D010;
614         mdelay(20);
615         rm31080a_macallan_spi_board[0].irq = gpio_to_irq(TOUCH_GPIO_IRQ_RAYDIUM_SPI);
616         touch_init_raydium(TOUCH_GPIO_IRQ_RAYDIUM_SPI,
617                                 TOUCH_GPIO_RST_RAYDIUM_SPI,
618                                 &rm31080ts_macallan_data,
619                                 &rm31080a_macallan_spi_board[0],
620                                 ARRAY_SIZE(rm31080a_macallan_spi_board));
621         return 0;
622 }
623
624 #ifdef CONFIG_USE_OF
625 struct of_dev_auxdata macallan_auxdata_lookup[] __initdata = {
626         OF_DEV_AUXDATA("nvidia,tegra114-sdhci", 0x78000600, "sdhci-tegra.3",
627                                 NULL),
628         OF_DEV_AUXDATA("nvidia,tegra114-sdhci", 0x78000400, "sdhci-tegra.2",
629                                 NULL),
630         OF_DEV_AUXDATA("nvidia,tegra114-sdhci", 0x78000000, "sdhci-tegra.0",
631                                 &macallan_tegra_sdhci_platform_data0),
632         OF_DEV_AUXDATA("nvidia,tegra114-camera", 0x0, "tegra_camera",
633                                 NULL),
634         OF_DEV_AUXDATA("nvidia,tegra114-host1x", TEGRA_HOST1X_BASE, "host1x",
635                                 NULL),
636         OF_DEV_AUXDATA("nvidia,tegra114-gr3d", TEGRA_GR3D_BASE, "gr3d",
637                                 NULL),
638         OF_DEV_AUXDATA("nvidia,tegra114-gr2d", TEGRA_GR2D_BASE, "gr2d",
639                                 NULL),
640         OF_DEV_AUXDATA("nvidia,tegra114-msenc", TEGRA_MSENC_BASE, "msenc",
641                                 NULL),
642         OF_DEV_AUXDATA("nvidia,tegra114-vi", TEGRA_VI_BASE, "vi",
643                                 NULL),
644         OF_DEV_AUXDATA("nvidia,tegra114-isp", TEGRA_ISP_BASE, "isp",
645                                 NULL),
646         OF_DEV_AUXDATA("nvidia,tegra114-tsec", TEGRA_TSEC_BASE, "tsec",
647                                 NULL),
648
649         OF_DEV_AUXDATA("nvidia,tegra114-i2c", 0x7000c000, "tegra11-i2c.0",
650                                 NULL),
651         OF_DEV_AUXDATA("nvidia,tegra114-i2c", 0x7000c400, "tegra11-i2c.1",
652                                 NULL),
653         OF_DEV_AUXDATA("nvidia,tegra114-i2c", 0x7000c500, "tegra11-i2c.2",
654                                 NULL),
655         OF_DEV_AUXDATA("nvidia,tegra114-i2c", 0x7000c700, "tegra11-i2c.3",
656                                 NULL),
657         OF_DEV_AUXDATA("nvidia,tegra114-i2c", 0x7000d000, "tegra11-i2c.4",
658                                 NULL),
659         {}
660 };
661 #endif
662
663 static void __init tegra_macallan_early_init(void)
664 {
665         tegra_clk_init_from_table(macallan_clk_init_table);
666         tegra_clk_verify_parents();
667         tegra_soc_device_init("macallan");
668 }
669
670
671 static void __init tegra_macallan_late_init(void)
672 {
673         platform_device_register(&tegra_pinmux_device);
674         macallan_pinmux_init();
675         macallan_i2c_init();
676         macallan_spi_init();
677         macallan_usb_init();
678         macallan_uart_init();
679         macallan_audio_init();
680         platform_add_devices(macallan_devices, ARRAY_SIZE(macallan_devices));
681         //tegra_ram_console_debug_init();
682         tegra_io_dpd_init();
683         macallan_regulator_init();
684         macallan_sdhci_init();
685         macallan_suspend_init();
686         macallan_emc_init();
687         macallan_edp_init();
688         isomgr_init();
689         macallan_touch_init();
690         macallan_panel_init();
691         macallan_kbc_init();
692         macallan_pmon_init();
693 #if defined CONFIG_TI_ST || defined CONFIG_TI_ST_MODULE
694         macallan_bt_st();
695         macallan_tegra_setup_st_host_wake();
696 #endif
697         tegra_release_bootloader_fb();
698         macallan_modem_init();
699 #ifdef CONFIG_TEGRA_WDT_RECOVERY
700         tegra_wdt_recovery_init();
701 #endif
702         tegra_serial_debug_init(TEGRA_UARTD_BASE, INT_WDT_CPU, NULL, -1, -1);
703         macallan_sensors_init();
704         macallan_soctherm_init();
705         tegra_register_fuse();
706 }
707
708 static void __init macallan_ramconsole_reserve(unsigned long size)
709 {
710         tegra_ram_console_debug_reserve(SZ_1M);
711 }
712
713 static void __init tegra_macallan_dt_init(void)
714 {
715         tegra_get_board_info(&board_info);
716         tegra_get_display_board_info(&display_board_info);
717
718         tegra_macallan_early_init();
719
720 #ifdef CONFIG_USE_OF
721         of_platform_populate(NULL,
722                 of_default_bus_match_table, macallan_auxdata_lookup,
723                 &platform_bus);
724 #else
725         platform_device_register(&tegra_gpio_device);
726 #endif
727
728         tegra_macallan_late_init();
729 }
730
731 static void __init tegra_macallan_reserve(void)
732 {
733 #if defined(CONFIG_NVMAP_CONVERT_CARVEOUT_TO_IOVMM)
734         /* 1920*1200*4*2 = 18432000 bytes */
735         tegra_reserve(0, SZ_16M + SZ_2M, SZ_16M);
736 #else
737         tegra_reserve(SZ_128M, SZ_16M + SZ_2M, SZ_4M);
738 #endif
739         macallan_ramconsole_reserve(SZ_1M);
740 }
741
742 static const char * const macallan_dt_board_compat[] = {
743         "nvidia,macallan",
744         NULL
745 };
746
747 MACHINE_START(MACALLAN, "macallan")
748         .atag_offset    = 0x100,
749         .smp            = smp_ops(tegra_smp_ops),
750         .map_io         = tegra_map_common_io,
751         .reserve        = tegra_macallan_reserve,
752         .init_early     = tegra11x_init_early,
753         .init_irq       = tegra_dt_init_irq,
754         .handle_irq     = gic_handle_irq,
755         .timer          = &tegra_sys_timer,
756         .init_machine   = tegra_macallan_dt_init,
757         .restart        = tegra_assert_system_reset,
758         .dt_compat      = macallan_dt_board_compat,
759 MACHINE_END