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