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