]> nv-tegra.nvidia Code Review - linux-2.6.git/blob - arch/arm/mach-tegra/board-macallan.c
soc: tegra: rt5640: support speaker volume edp table
[linux-2.6.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/spi/spi.h>
35 #include <linux/spi/rm31080a_ts.h>
36 #include <linux/tegra_uart.h>
37 #include <linux/memblock.h>
38 #include <linux/spi-tegra.h>
39 #include <linux/nfc/pn544.h>
40 #include <linux/skbuff.h>
41 #include <linux/ti_wilink_st.h>
42 #include <linux/regulator/consumer.h>
43 #include <linux/smb349-charger.h>
44 #include <linux/max17048_battery.h>
45 #include <linux/leds.h>
46 #include <linux/i2c/at24.h>
47 #include <linux/of_platform.h>
48 #include <linux/edp.h>
49
50 #include <asm/hardware/gic.h>
51
52 #include <mach/clk.h>
53 #include <mach/iomap.h>
54 #include <mach/irqs.h>
55 #include <mach/pinmux.h>
56 #include <mach/pinmux-t11.h>
57 #include <mach/iomap.h>
58 #include <mach/io.h>
59 #include <mach/io_dpd.h>
60 #include <mach/i2s.h>
61 #include <mach/tegra_asoc_pdata.h>
62 #include <asm/mach-types.h>
63 #include <asm/mach/arch.h>
64 #include <mach/usb_phy.h>
65 #include <mach/gpio-tegra.h>
66 #include <mach/tegra_fiq_debugger.h>
67 #include <linux/platform_data/tegra_usb_modem_power.h>
68 #include <mach/hardware.h>
69
70 #include "board-touch-raydium.h"
71 #include "board.h"
72 #include "board-common.h"
73 #include "clock.h"
74 #include "board-macallan.h"
75 #include "devices.h"
76 #include "gpio-names.h"
77 #include "fuse.h"
78 #include "pm.h"
79 #include "pm-irq.h"
80 #include "common.h"
81 #include "tegra-board-id.h"
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 static struct tegra_i2c_platform_data macallan_i2c1_platform_data = {
165         .adapter_nr     = 0,
166         .bus_count      = 1,
167         .bus_clk_rate   = { 100000, 0 },
168         .scl_gpio               = {TEGRA_GPIO_I2C1_SCL, 0},
169         .sda_gpio               = {TEGRA_GPIO_I2C1_SDA, 0},
170         .arb_recovery = arb_lost_recovery,
171 };
172
173 static struct tegra_i2c_platform_data macallan_i2c2_platform_data = {
174         .adapter_nr     = 1,
175         .bus_count      = 1,
176         .bus_clk_rate   = { 100000, 0 },
177         .is_clkon_always = true,
178         .scl_gpio               = {TEGRA_GPIO_I2C2_SCL, 0},
179         .sda_gpio               = {TEGRA_GPIO_I2C2_SDA, 0},
180         .arb_recovery = arb_lost_recovery,
181 };
182
183 static struct tegra_i2c_platform_data macallan_i2c3_platform_data = {
184         .adapter_nr     = 2,
185         .bus_count      = 1,
186         .bus_clk_rate   = { 400000, 0 },
187         .scl_gpio               = {TEGRA_GPIO_I2C3_SCL, 0},
188         .sda_gpio               = {TEGRA_GPIO_I2C3_SDA, 0},
189         .arb_recovery = arb_lost_recovery,
190 };
191
192 static struct tegra_i2c_platform_data macallan_i2c4_platform_data = {
193         .adapter_nr     = 3,
194         .bus_count      = 1,
195         .bus_clk_rate   = { 10000, 0 },
196         .scl_gpio               = {TEGRA_GPIO_I2C4_SCL, 0},
197         .sda_gpio               = {TEGRA_GPIO_I2C4_SDA, 0},
198         .arb_recovery = arb_lost_recovery,
199 };
200
201 static struct tegra_i2c_platform_data macallan_i2c5_platform_data = {
202         .adapter_nr     = 4,
203         .bus_count      = 1,
204         .bus_clk_rate   = { 400000, 0 },
205         .scl_gpio               = {TEGRA_GPIO_I2C5_SCL, 0},
206         .sda_gpio               = {TEGRA_GPIO_I2C5_SDA, 0},
207         .arb_recovery = arb_lost_recovery,
208 };
209
210 static struct i2c_board_info __initdata rt5640_board_info = {
211         I2C_BOARD_INFO("rt5640", 0x1c),
212 };
213
214 static struct pn544_i2c_platform_data nfc_pdata = {
215         .irq_gpio = TEGRA_GPIO_PW2,
216         .ven_gpio = TEGRA_GPIO_PQ3,
217         .firm_gpio = TEGRA_GPIO_PH0,
218 };
219
220 static struct i2c_board_info __initdata nfc_board_info = {
221         I2C_BOARD_INFO("pn544", 0x28),
222         .platform_data = &nfc_pdata,
223 };
224
225 static void macallan_i2c_init(void)
226 {
227         struct board_info board_info;
228
229         tegra_get_board_info(&board_info);
230         tegra11_i2c_device1.dev.platform_data = &macallan_i2c1_platform_data;
231         tegra11_i2c_device2.dev.platform_data = &macallan_i2c2_platform_data;
232         tegra11_i2c_device3.dev.platform_data = &macallan_i2c3_platform_data;
233         tegra11_i2c_device4.dev.platform_data = &macallan_i2c4_platform_data;
234         tegra11_i2c_device5.dev.platform_data = &macallan_i2c5_platform_data;
235
236         nfc_board_info.irq = gpio_to_irq(TEGRA_GPIO_PW2);
237         i2c_register_board_info(0, &nfc_board_info, 1);
238
239         platform_device_register(&tegra11_i2c_device5);
240         platform_device_register(&tegra11_i2c_device4);
241         platform_device_register(&tegra11_i2c_device3);
242         platform_device_register(&tegra11_i2c_device2);
243         platform_device_register(&tegra11_i2c_device1);
244
245         i2c_register_board_info(0, &rt5640_board_info, 1);
246 }
247
248 static struct platform_device *macallan_uart_devices[] __initdata = {
249         &tegra_uarta_device,
250         &tegra_uartb_device,
251         &tegra_uartc_device,
252         &tegra_uartd_device,
253 };
254 static struct uart_clk_parent uart_parent_clk[] = {
255         [0] = {.name = "clk_m"},
256         [1] = {.name = "pll_p"},
257 #ifndef CONFIG_TEGRA_PLLM_RESTRICTED
258         [2] = {.name = "pll_m"},
259 #endif
260 };
261
262 static struct tegra_uart_platform_data macallan_uart_pdata;
263 static struct tegra_uart_platform_data macallan_loopback_uart_pdata;
264
265 static void __init uart_debug_init(void)
266 {
267         int debug_port_id;
268
269         debug_port_id = uart_console_debug_init(3);
270         if (debug_port_id < 0)
271                 return;
272
273         macallan_uart_devices[debug_port_id] = uart_console_debug_device;
274 }
275
276 static void __init macallan_uart_init(void)
277 {
278         struct clk *c;
279         int i;
280
281         for (i = 0; i < ARRAY_SIZE(uart_parent_clk); ++i) {
282                 c = tegra_get_clock_by_name(uart_parent_clk[i].name);
283                 if (IS_ERR_OR_NULL(c)) {
284                         pr_err("Not able to get the clock for %s\n",
285                                                 uart_parent_clk[i].name);
286                         continue;
287                 }
288                 uart_parent_clk[i].parent_clk = c;
289                 uart_parent_clk[i].fixed_clk_rate = clk_get_rate(c);
290         }
291         macallan_uart_pdata.parent_clk_list = uart_parent_clk;
292         macallan_uart_pdata.parent_clk_count = ARRAY_SIZE(uart_parent_clk);
293         macallan_loopback_uart_pdata.parent_clk_list = uart_parent_clk;
294         macallan_loopback_uart_pdata.parent_clk_count =
295                                                 ARRAY_SIZE(uart_parent_clk);
296         macallan_loopback_uart_pdata.is_loopback = true;
297         tegra_uarta_device.dev.platform_data = &macallan_uart_pdata;
298         tegra_uartb_device.dev.platform_data = &macallan_uart_pdata;
299         tegra_uartc_device.dev.platform_data = &macallan_uart_pdata;
300         tegra_uartd_device.dev.platform_data = &macallan_uart_pdata;
301
302         /* Register low speed only if it is selected */
303         if (!is_tegra_debug_uartport_hs())
304                 uart_debug_init();
305
306         platform_add_devices(macallan_uart_devices,
307                                 ARRAY_SIZE(macallan_uart_devices));
308 }
309
310 static struct resource tegra_rtc_resources[] = {
311         [0] = {
312                 .start = TEGRA_RTC_BASE,
313                 .end = TEGRA_RTC_BASE + TEGRA_RTC_SIZE - 1,
314                 .flags = IORESOURCE_MEM,
315         },
316         [1] = {
317                 .start = INT_RTC,
318                 .end = INT_RTC,
319                 .flags = IORESOURCE_IRQ,
320         },
321 };
322
323 static struct platform_device tegra_rtc_device = {
324         .name = "tegra_rtc",
325         .id   = -1,
326         .resource = tegra_rtc_resources,
327         .num_resources = ARRAY_SIZE(tegra_rtc_resources),
328 };
329
330 static struct tegra_asoc_platform_data macallan_audio_pdata = {
331         .gpio_spkr_en           = TEGRA_GPIO_SPKR_EN,
332         .gpio_hp_det            = TEGRA_GPIO_HP_DET,
333         .gpio_hp_mute           = -1,
334         .gpio_int_mic_en        = TEGRA_GPIO_INT_MIC_EN,
335         .gpio_ext_mic_en        = TEGRA_GPIO_EXT_MIC_EN,
336         .gpio_ldo1_en           = TEGRA_GPIO_LDO1_EN,
337         .edp_support            = true,
338         .edp_states             = {1100, 1100, 0},
339         .edp_vol                = {0x8, 0x8, 0x27},
340         .gpio_codec1 = TEGRA_GPIO_CODEC1_EN,
341         .gpio_codec2 = TEGRA_GPIO_CODEC2_EN,
342         .gpio_codec3 = TEGRA_GPIO_CODEC3_EN,
343         .i2s_param[HIFI_CODEC]  = {
344                 .audio_port_id  = 1,
345                 .is_i2s_master  = 1,
346                 .i2s_mode       = TEGRA_DAIFMT_I2S,
347         },
348         .i2s_param[BT_SCO]      = {
349                 .audio_port_id  = 3,
350                 .is_i2s_master  = 1,
351                 .i2s_mode       = TEGRA_DAIFMT_DSP_A,
352         },
353 };
354
355 static struct platform_device macallan_audio_device = {
356         .name   = "tegra-snd-rt5640",
357         .id     = 0,
358         .dev    = {
359                 .platform_data = &macallan_audio_pdata,
360         },
361 };
362
363 static struct platform_device *macallan_devices[] __initdata = {
364         &tegra_pmu_device,
365         &tegra_rtc_device,
366         &tegra_udc_device,
367 #if defined(CONFIG_TEGRA_IOVMM_SMMU) || defined(CONFIG_TEGRA_IOMMU_SMMU)
368         &tegra_smmu_device,
369 #endif
370 #if defined(CONFIG_TEGRA_AVP)
371         &tegra_avp_device,
372 #endif
373 #if defined(CONFIG_CRYPTO_DEV_TEGRA_SE)
374         &tegra11_se_device,
375 #endif
376         &tegra_ahub_device,
377         &tegra_dam_device0,
378         &tegra_dam_device1,
379         &tegra_dam_device2,
380         &tegra_i2s_device1,
381         &tegra_i2s_device3,
382         &tegra_i2s_device4,
383         &tegra_spdif_device,
384         &spdif_dit_device,
385         &bluetooth_dit_device,
386         &tegra_pcm_device,
387         &macallan_audio_device,
388         &tegra_hda_device,
389 #if defined(CONFIG_CRYPTO_DEV_TEGRA_AES)
390         &tegra_aes_device,
391 #endif
392 };
393
394 #ifdef CONFIG_USB_SUPPORT
395 static struct tegra_usb_platform_data tegra_udc_pdata = {
396         .port_otg = true,
397         .has_hostpc = true,
398         .support_pmu_vbus = true,
399         .id_det_type = TEGRA_USB_PMU_ID,
400         .phy_intf = TEGRA_USB_PHY_INTF_UTMI,
401         .unaligned_dma_buf_supported = false,
402         .op_mode = TEGRA_USB_OPMODE_DEVICE,
403         .u_data.dev = {
404                 .vbus_pmu_irq = 0,
405                 .vbus_gpio = -1,
406                 .charging_supported = false,
407                 .remote_wakeup_supported = false,
408         },
409         .u_cfg.utmi = {
410                 .hssync_start_delay = 0,
411                 .elastic_limit = 16,
412                 .idle_wait_delay = 17,
413                 .term_range_adj = 6,
414                 .xcvr_setup = 8,
415                 .xcvr_lsfslew = 0,
416                 .xcvr_lsrslew = 3,
417                 .xcvr_setup_offset = 0,
418                 .xcvr_use_fuses = 1,
419         },
420 };
421
422 static struct tegra_usb_platform_data tegra_ehci1_utmi_pdata = {
423         .port_otg = true,
424         .has_hostpc = true,
425         .support_pmu_vbus = true,
426         .id_det_type = TEGRA_USB_PMU_ID,
427         .unaligned_dma_buf_supported = false,
428         .phy_intf = TEGRA_USB_PHY_INTF_UTMI,
429         .op_mode = TEGRA_USB_OPMODE_HOST,
430         .u_data.host = {
431                 .vbus_gpio = -1,
432                 .hot_plug = false,
433                 .remote_wakeup_supported = true,
434                 .power_off_on_suspend = true,
435                 .turn_off_vbus_on_lp0 = true,
436         },
437         .u_cfg.utmi = {
438                 .hssync_start_delay = 0,
439                 .elastic_limit = 16,
440                 .idle_wait_delay = 17,
441                 .term_range_adj = 6,
442                 .xcvr_setup = 15,
443                 .xcvr_lsfslew = 0,
444                 .xcvr_lsrslew = 3,
445                 .xcvr_setup_offset = 0,
446                 .xcvr_use_fuses = 1,
447                 .vbus_oc_map = 0x4,
448         },
449 };
450
451 static struct tegra_usb_otg_data tegra_otg_pdata = {
452         .ehci_device = &tegra_ehci1_device,
453         .ehci_pdata = &tegra_ehci1_utmi_pdata,
454         .vbus_extcon_dev_name = "palmas-extcon",
455         .id_extcon_dev_name = "palmas-extcon",
456 };
457
458 static void macallan_usb_init(void)
459 {
460         int usb_port_owner_info = tegra_get_usb_port_owner_info();
461
462         /* Set USB wake sources for macallan */
463         tegra_set_usb_wake_source();
464
465         if (!(usb_port_owner_info & UTMI1_PORT_OWNER_XUSB)) {
466                 tegra_otg_device.dev.platform_data = &tegra_otg_pdata;
467                 platform_device_register(&tegra_otg_device);
468                 /* Setup the udc platform data */
469                 tegra_udc_device.dev.platform_data = &tegra_udc_pdata;
470         }
471 }
472
473 static struct gpio modem_gpios[] = { /* Nemo modem */
474         {MODEM_EN, GPIOF_OUT_INIT_HIGH, "MODEM EN"},
475         {MDM_RST, GPIOF_OUT_INIT_LOW, "MODEM RESET"},
476 };
477
478 static struct tegra_usb_platform_data tegra_ehci2_hsic_baseband_pdata = {
479         .port_otg = false,
480         .has_hostpc = true,
481         .unaligned_dma_buf_supported = false,
482         .phy_intf = TEGRA_USB_PHY_INTF_HSIC,
483         .op_mode = TEGRA_USB_OPMODE_HOST,
484         .u_data.host = {
485                 .vbus_gpio = -1,
486                 .hot_plug = false,
487                 .remote_wakeup_supported = true,
488                 .power_off_on_suspend = true,
489         },
490 };
491
492 static int baseband_init(void)
493 {
494         int ret;
495
496         ret = gpio_request_array(modem_gpios, ARRAY_SIZE(modem_gpios));
497         if (ret) {
498                 pr_warn("%s:gpio request failed\n", __func__);
499                 return ret;
500         }
501
502         /* enable pull-down for MDM_COLD_BOOT */
503         tegra_pinmux_set_pullupdown(TEGRA_PINGROUP_ULPI_DATA4,
504                                     TEGRA_PUPD_PULL_DOWN);
505
506         /* export GPIO for user space access through sysfs */
507         gpio_export(MDM_RST, false);
508
509         return 0;
510 }
511
512 static const struct tegra_modem_operations baseband_operations = {
513         .init = baseband_init,
514 };
515
516 static struct tegra_usb_modem_power_platform_data baseband_pdata = {
517         .ops = &baseband_operations,
518         .wake_gpio = -1,
519         .boot_gpio = MDM_COLDBOOT,
520         .boot_irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
521         .autosuspend_delay = 2000,
522         .short_autosuspend_delay = 50,
523         .tegra_ehci_device = &tegra_ehci2_device,
524         .tegra_ehci_pdata = &tegra_ehci2_hsic_baseband_pdata,
525 };
526
527 static struct platform_device icera_nemo_device = {
528         .name = "tegra_usb_modem_power",
529         .id = -1,
530         .dev = {
531                 .platform_data = &baseband_pdata,
532         },
533 };
534
535 static void macallan_modem_init(void)
536 {
537         int modem_id = tegra_get_modem_id();
538         int usb_port_owner_info = tegra_get_usb_port_owner_info();
539         switch (modem_id) {
540         case TEGRA_BB_NEMO: /* on board i500 HSIC */
541                 if (!(usb_port_owner_info & HSIC1_PORT_OWNER_XUSB))
542                         platform_device_register(&icera_nemo_device);
543                 break;
544         }
545 }
546
547 #else
548 static void macallan_usb_init(void) { }
549 static void macallan_modem_init(void) { }
550 #endif
551
552 static void macallan_audio_init(void)
553 {
554         struct board_info board_info;
555
556         tegra_get_board_info(&board_info);
557
558         macallan_audio_pdata.codec_name = "rt5640.0-001c";
559         macallan_audio_pdata.codec_dai_name = "rt5640-aif1";
560 }
561
562
563 static struct platform_device *macallan_spi_devices[] __initdata = {
564         &tegra11_spi_device1,
565 };
566
567 struct spi_clk_parent spi_parent_clk_macallan[] = {
568         [0] = {.name = "pll_p"},
569 #ifndef CONFIG_TEGRA_PLLM_RESTRICTED
570         [1] = {.name = "pll_m"},
571         [2] = {.name = "clk_m"},
572 #else
573         [1] = {.name = "clk_m"},
574 #endif
575 };
576
577 static struct tegra_spi_platform_data macallan_spi_pdata = {
578         .max_dma_buffer         = 16 * 1024,
579         .is_clkon_always        = false,
580         .max_rate               = 25000000,
581 };
582
583 static void __init macallan_spi_init(void)
584 {
585         int i;
586         struct clk *c;
587         struct board_info board_info, display_board_info;
588
589         tegra_get_board_info(&board_info);
590         tegra_get_display_board_info(&display_board_info);
591
592         for (i = 0; i < ARRAY_SIZE(spi_parent_clk_macallan); ++i) {
593                 c = tegra_get_clock_by_name(spi_parent_clk_macallan[i].name);
594                 if (IS_ERR_OR_NULL(c)) {
595                         pr_err("Not able to get the clock for %s\n",
596                                         spi_parent_clk_macallan[i].name);
597                         continue;
598                 }
599                 spi_parent_clk_macallan[i].parent_clk = c;
600                 spi_parent_clk_macallan[i].fixed_clk_rate = clk_get_rate(c);
601         }
602         macallan_spi_pdata.parent_clk_list = spi_parent_clk_macallan;
603         macallan_spi_pdata.parent_clk_count = ARRAY_SIZE(spi_parent_clk_macallan);
604         macallan_spi_pdata.is_dma_based = (tegra_revision == TEGRA_REVISION_A01)
605                                                         ? false : true ;
606         tegra11_spi_device1.dev.platform_data = &macallan_spi_pdata;
607         platform_add_devices(macallan_spi_devices,
608                                 ARRAY_SIZE(macallan_spi_devices));
609 }
610
611 static __initdata struct tegra_clk_init_table touch_clk_init_table[] = {
612         /* name         parent          rate            enabled */
613         { "extern2",    "pll_p",        41000000,       false},
614         { "clk_out_2",  "extern2",      40800000,       false},
615         { NULL,         NULL,           0,              0},
616 };
617
618 struct rm_spi_ts_platform_data rm31080ts_macallan_data = {
619         .gpio_reset = TOUCH_GPIO_RST_RAYDIUM_SPI,
620         .config = 0,
621         .platform_id = RM_PLATFORM_D010,
622         .name_of_clock = "clk_out_2",
623         .name_of_clock_con = "extern2",
624 };
625
626 static struct tegra_spi_device_controller_data dev_cdata = {
627         .rx_clk_tap_delay = 0,
628         .tx_clk_tap_delay = 16,
629 };
630
631 struct spi_board_info rm31080a_macallan_spi_board[1] = {
632         {
633          .modalias = "rm_ts_spidev",
634          .bus_num = 0,
635          .chip_select = 0,
636          .max_speed_hz = 12 * 1000 * 1000,
637          .mode = SPI_MODE_0,
638          .controller_data = &dev_cdata,
639          .platform_data = &rm31080ts_macallan_data,
640          },
641 };
642
643 static int __init macallan_touch_init(void)
644 {
645         struct board_info board_info;
646
647         tegra_get_display_board_info(&board_info);
648         tegra_clk_init_from_table(touch_clk_init_table);
649         if (board_info.board_id == BOARD_E1582)
650                 rm31080ts_macallan_data.platform_id = RM_PLATFORM_P005;
651         else
652                 rm31080ts_macallan_data.platform_id = RM_PLATFORM_D010;
653         mdelay(20);
654         rm31080a_macallan_spi_board[0].irq = gpio_to_irq(TOUCH_GPIO_IRQ_RAYDIUM_SPI);
655         touch_init_raydium(TOUCH_GPIO_IRQ_RAYDIUM_SPI,
656                                 TOUCH_GPIO_RST_RAYDIUM_SPI,
657                                 &rm31080ts_macallan_data,
658                                 &rm31080a_macallan_spi_board[0],
659                                 ARRAY_SIZE(rm31080a_macallan_spi_board));
660         return 0;
661 }
662
663 static void __init tegra_macallan_init(void)
664 {
665         struct board_info board_info;
666
667         macallan_sysedp_init();
668         tegra_get_display_board_info(&board_info);
669         tegra_clk_init_from_table(macallan_clk_init_table);
670         tegra_clk_verify_parents();
671         tegra_soc_device_init("macallan");
672         tegra_enable_pinmux();
673         macallan_pinmux_init();
674         macallan_i2c_init();
675         macallan_spi_init();
676         macallan_usb_init();
677         macallan_uart_init();
678         macallan_audio_init();
679         platform_add_devices(macallan_devices, ARRAY_SIZE(macallan_devices));
680         tegra_ram_console_debug_init();
681         tegra_io_dpd_init();
682         macallan_regulator_init();
683         macallan_sdhci_init();
684         macallan_suspend_init();
685         macallan_emc_init();
686         macallan_edp_init();
687         macallan_touch_init();
688         macallan_panel_init();
689         macallan_kbc_init();
690         macallan_pmon_init();
691 #if defined CONFIG_TI_ST || defined CONFIG_TI_ST_MODULE
692         macallan_bt_st();
693         macallan_tegra_setup_st_host_wake();
694 #endif
695         tegra_release_bootloader_fb();
696         macallan_modem_init();
697 #ifdef CONFIG_TEGRA_WDT_RECOVERY
698         tegra_wdt_recovery_init();
699 #endif
700         tegra_serial_debug_init(TEGRA_UARTD_BASE, INT_WDT_CPU, NULL, -1, -1);
701         macallan_sensors_init();
702         macallan_soctherm_init();
703         tegra_register_fuse();
704         macallan_sysedp_core_init();
705         macallan_sysedp_psydepl_init();
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 #ifdef CONFIG_USE_OF
716         of_platform_populate(NULL,
717                 of_default_bus_match_table, NULL, NULL);
718 #endif
719
720         tegra_macallan_init();
721 }
722
723 static void __init tegra_macallan_reserve(void)
724 {
725 #if defined(CONFIG_NVMAP_CONVERT_CARVEOUT_TO_IOVMM)
726         /* 1920*1200*4*2 = 18432000 bytes */
727         tegra_reserve(0, SZ_16M + SZ_2M, SZ_16M);
728 #else
729         tegra_reserve(SZ_128M, SZ_16M + SZ_2M, SZ_4M);
730 #endif
731         macallan_ramconsole_reserve(SZ_1M);
732 }
733
734 static const char * const macallan_dt_board_compat[] = {
735         "nvidia,macallan",
736         NULL
737 };
738
739 MACHINE_START(MACALLAN, "macallan")
740         .atag_offset    = 0x100,
741         .soc            = &tegra_soc_desc,
742         .map_io         = tegra_map_common_io,
743         .reserve        = tegra_macallan_reserve,
744         .init_early     = tegra11x_init_early,
745         .init_irq       = tegra_init_irq,
746         .handle_irq     = gic_handle_irq,
747         .timer          = &tegra_timer,
748         .init_machine   = tegra_macallan_dt_init,
749         .restart        = tegra_assert_system_reset,
750         .dt_compat      = macallan_dt_board_compat,
751 MACHINE_END