arm: tegra: cardhu: Fix the issue of boot screen corruption.
[linux-2.6.git] / arch / arm / mach-tegra / board-cardhu.c
1 /*
2  * arch/arm/mach-tegra/board-cardhu.c
3  *
4  * Copyright (c) 2011, NVIDIA Corporation.
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 as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
14  * more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19  */
20
21 #include <linux/kernel.h>
22 #include <linux/init.h>
23 #include <linux/slab.h>
24 #include <linux/ctype.h>
25 #include <linux/platform_device.h>
26 #include <linux/clk.h>
27 #include <linux/serial_8250.h>
28 #include <linux/i2c.h>
29 #include <linux/i2c/panjit_ts.h>
30 #include <linux/dma-mapping.h>
31 #include <linux/delay.h>
32 #include <linux/i2c-tegra.h>
33 #include <linux/gpio.h>
34 #include <linux/input.h>
35 #include <linux/platform_data/tegra_usb.h>
36 #include <linux/spi/spi.h>
37 #include <linux/i2c/atmel_mxt_ts.h>
38 #include <linux/tegra_uart.h>
39
40 #include <sound/wm8903.h>
41
42 #include <mach/clk.h>
43 #include <mach/iomap.h>
44 #include <mach/irqs.h>
45 #include <mach/pinmux.h>
46 #include <mach/iomap.h>
47 #include <mach/io.h>
48 #include <mach/i2s.h>
49 #include <mach/tegra_wm8903_pdata.h>
50 #include <asm/mach-types.h>
51 #include <asm/mach/arch.h>
52 #include <mach/usb_phy.h>
53
54 #include "board.h"
55 #include "clock.h"
56 #include "board-cardhu.h"
57 #include "devices.h"
58 #include "gpio-names.h"
59 #include "fuse.h"
60
61
62 /* !!!TODO: Change for cardhu (Taken from Ventana) */
63 static struct tegra_utmip_config utmi_phy_config[] = {
64         [0] = {
65                         .hssync_start_delay = 0,
66                         .idle_wait_delay = 17,
67                         .elastic_limit = 16,
68                         .term_range_adj = 6,
69                         .xcvr_setup = 15,
70                         .xcvr_lsfslew = 2,
71                         .xcvr_lsrslew = 2,
72         },
73         [1] = {
74                         .hssync_start_delay = 0,
75                         .idle_wait_delay = 17,
76                         .elastic_limit = 16,
77                         .term_range_adj = 6,
78                         .xcvr_setup = 15,
79                         .xcvr_lsfslew = 2,
80                         .xcvr_lsrslew = 2,
81         },
82         [2] = {
83                         .hssync_start_delay = 0,
84                         .idle_wait_delay = 17,
85                         .elastic_limit = 16,
86                         .term_range_adj = 6,
87                         .xcvr_setup = 8,
88                         .xcvr_lsfslew = 2,
89                         .xcvr_lsrslew = 2,
90         },
91 };
92
93 #ifdef CONFIG_BCM4329_RFKILL
94 static struct resource cardhu_bcm4329_rfkill_resources[] = {
95         {
96                 .name   = "bcm4329_nshutdown_gpio",
97                 .start  = TEGRA_GPIO_PU0,
98                 .end    = TEGRA_GPIO_PU0,
99                 .flags  = IORESOURCE_IO,
100         },
101 };
102
103 static struct platform_device cardhu_bcm4329_rfkill_device = {
104         .name = "bcm4329_rfkill",
105         .id             = -1,
106         .num_resources  = ARRAY_SIZE(cardhu_bcm4329_rfkill_resources),
107         .resource       = cardhu_bcm4329_rfkill_resources,
108 };
109
110 static noinline void __init cardhu_bt_rfkill(void)
111 {
112         platform_device_register(&cardhu_bcm4329_rfkill_device);
113
114         return;
115 }
116 #else
117 static inline void cardhu_bt_rfkill(void) { }
118 #endif
119
120 #ifdef CONFIG_BT_BLUESLEEP
121 static noinline void __init tegra_setup_bluesleep(void)
122 {
123         struct platform_device *pdev = NULL;
124         struct resource *res;
125
126         pdev = platform_device_alloc("bluesleep", 0);
127         if (!pdev) {
128                 pr_err("unable to allocate platform device for bluesleep");
129                 return;
130         }
131
132         res = kzalloc(sizeof(struct resource) * 3, GFP_KERNEL);
133         if (!res) {
134                 pr_err("unable to allocate resource for bluesleep\n");
135                 goto err_free_dev;
136         }
137
138         res[0].name   = "gpio_host_wake";
139         res[0].start  = TEGRA_GPIO_PU6;
140         res[0].end    = TEGRA_GPIO_PU6;
141         res[0].flags  = IORESOURCE_IO;
142
143         res[1].name   = "gpio_ext_wake";
144         res[1].start  = TEGRA_GPIO_PU1;
145         res[1].end    = TEGRA_GPIO_PU1;
146         res[1].flags  = IORESOURCE_IO;
147
148         res[2].name   = "host_wake";
149         res[2].start  = gpio_to_irq(TEGRA_GPIO_PU6);
150         res[2].end    = gpio_to_irq(TEGRA_GPIO_PU6);
151         res[2].flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE ;
152
153         if (platform_device_add_resources(pdev, res, 3)) {
154                 pr_err("unable to add resources to bluesleep device\n");
155                 goto err_free_res;
156         }
157
158         if (platform_device_add(pdev)) {
159                 pr_err("unable to add bluesleep device\n");
160                 goto err_free_res;
161         }
162         tegra_gpio_enable(TEGRA_GPIO_PU6);
163         tegra_gpio_enable(TEGRA_GPIO_PU1);
164
165 return;
166
167 err_free_res:
168         kfree(res);
169 err_free_dev:
170         platform_device_put(pdev);
171         return;
172 }
173 #else
174 static inline void tegra_setup_bluesleep(void) { }
175 #endif
176
177 static __initdata struct tegra_clk_init_table cardhu_clk_init_table[] = {
178         /* name         parent          rate            enabled */
179         { "pll_m",      NULL,           0,              true},
180         { "hda",        "pll_p",        108000000,      false},
181         { "hda2codec_2x","pll_p",       48000000,       false},
182         { "pwm",        "clk_32k",      32768,          false},
183         { "blink",      "clk_32k",      32768,          true},
184         { "i2s1",       "pll_a_out0",   0,              false},
185         { NULL,         NULL,           0,              0},
186 };
187
188 static struct tegra_i2c_platform_data cardhu_i2c1_platform_data = {
189         .adapter_nr     = 0,
190         .bus_count      = 1,
191         .bus_clk_rate   = { 100000, 0 },
192 };
193
194 static struct tegra_i2c_platform_data cardhu_i2c2_platform_data = {
195         .adapter_nr     = 1,
196         .bus_count      = 1,
197         .bus_clk_rate   = { 100000, 0 },
198         .is_clkon_always = true,
199 };
200
201 static struct tegra_i2c_platform_data cardhu_i2c3_platform_data = {
202         .adapter_nr     = 2,
203         .bus_count      = 1,
204         .bus_clk_rate   = { 100000, 0 },
205 };
206
207 static struct tegra_i2c_platform_data cardhu_i2c4_platform_data = {
208         .adapter_nr     = 3,
209         .bus_count      = 1,
210         .bus_clk_rate   = { 100000, 0 },
211 };
212
213 static struct tegra_i2c_platform_data cardhu_i2c5_platform_data = {
214         .adapter_nr     = 4,
215         .bus_count      = 1,
216         .bus_clk_rate   = { 100000, 0 },
217 };
218
219
220 #if 0
221 struct tegra_wired_jack_conf audio_wr_jack_conf = {
222         .hp_det_n = TEGRA_GPIO_PW2,
223         .en_mic_ext = TEGRA_GPIO_PX1,
224         .en_mic_int = TEGRA_GPIO_PX0,
225 };
226 #endif
227
228 static struct wm8903_platform_data cardhu_wm8903_pdata = {
229         .irq_active_low = 0,
230         .micdet_cfg = 0,
231         .micdet_delay = 100,
232         .gpio_base = CARDHU_GPIO_WM8903(0),
233         .gpio_cfg = {
234                 WM8903_GPIO_NO_CONFIG,
235                 WM8903_GPIO_NO_CONFIG,
236                 0,
237                 WM8903_GPIO_NO_CONFIG,
238                 WM8903_GPIO_NO_CONFIG,
239         },
240 };
241
242 static struct i2c_board_info __initdata wm8903_board_info = {
243         I2C_BOARD_INFO("wm8903", 0x1a),
244         .platform_data = &cardhu_wm8903_pdata,
245         .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_CDC_IRQ),
246 };
247
248 static void cardhu_i2c_init(void)
249 {
250         tegra_i2c_device1.dev.platform_data = &cardhu_i2c1_platform_data;
251         tegra_i2c_device2.dev.platform_data = &cardhu_i2c2_platform_data;
252         tegra_i2c_device3.dev.platform_data = &cardhu_i2c3_platform_data;
253         tegra_i2c_device4.dev.platform_data = &cardhu_i2c4_platform_data;
254         tegra_i2c_device5.dev.platform_data = &cardhu_i2c5_platform_data;
255
256         platform_device_register(&tegra_i2c_device5);
257         platform_device_register(&tegra_i2c_device4);
258         platform_device_register(&tegra_i2c_device3);
259         platform_device_register(&tegra_i2c_device2);
260         platform_device_register(&tegra_i2c_device1);
261
262         i2c_register_board_info(4, &wm8903_board_info, 1);
263 }
264
265 static struct platform_device *cardhu_uart_devices[] __initdata = {
266         &tegra_uarta_device,
267         &tegra_uartb_device,
268         &tegra_uartc_device,
269         &tegra_uartd_device,
270         &tegra_uarte_device,
271 };
272 struct uart_clk_parent uart_parent_clk[] = {
273         [0] = {.name = "pll_p"},
274         [1] = {.name = "pll_m"},
275         [2] = {.name = "clk_m"},
276 };
277
278 static struct clk *debug_uart_clk;
279 static struct tegra_uart_platform_data cardhu_uart_pdata;
280
281 static void __init uart_debug_init(void)
282 {
283         struct board_info board_info;
284         int i;
285         struct clk *c;
286
287         for (i = 0; i < ARRAY_SIZE(uart_parent_clk); ++i) {
288                 c = tegra_get_clock_by_name(uart_parent_clk[i].name);
289                 if (IS_ERR_OR_NULL(c)) {
290                         pr_err("Not able to get the clock for %s\n",
291                                                 uart_parent_clk[i].name);
292                         continue;
293                 }
294                 uart_parent_clk[i].parent_clk = c;
295                 uart_parent_clk[i].fixed_clk_rate = clk_get_rate(c);
296         }
297         cardhu_uart_pdata.parent_clk_list = uart_parent_clk;
298         cardhu_uart_pdata.parent_clk_count = ARRAY_SIZE(uart_parent_clk);
299         tegra_uarta_device.dev.platform_data = &cardhu_uart_pdata;
300         tegra_uartb_device.dev.platform_data = &cardhu_uart_pdata;
301         tegra_uartc_device.dev.platform_data = &cardhu_uart_pdata;
302         tegra_uartd_device.dev.platform_data = &cardhu_uart_pdata;
303         tegra_uarte_device.dev.platform_data = &cardhu_uart_pdata;
304
305         tegra_get_board_info(&board_info);
306         if (board_info.sku & SKU_SLT_ULPI_SUPPORT) {
307                 if ((board_info.board_id == BOARD_E1186) ||
308                         (board_info.board_id == BOARD_E1187) ||
309                         (board_info.board_id == BOARD_PM269)) {
310                                 /* UARTB is the debug port. */
311                                 pr_info("Selecting UARTB as the debug console\n");
312                                 cardhu_uart_devices[1] = &debug_uartb_device;
313                                 debug_uart_clk =
314                                         clk_get_sys("serial8250.0", "uartb");
315                                 return;
316                 }
317                 pr_err("%s(): Unhandled SKU information for Board 0x%04x\n",
318                                 __func__, board_info.board_id);
319         }
320         /* UARTA is the debug port. */
321         pr_info("Selecting UARTA as the debug console\n");
322         cardhu_uart_devices[0] = &debug_uarta_device;
323         debug_uart_clk = clk_get_sys("serial8250.0", "uarta");
324 }
325
326 static void __init cardhu_uart_init(void)
327 {
328         struct clk *c;
329         /* Register low speed only if it is selected */
330         if (!is_tegra_debug_uartport_hs()) {
331                 uart_debug_init();
332                 /* Clock enable for the debug channel */
333                 if (!IS_ERR_OR_NULL(debug_uart_clk)) {
334                         pr_info("The debug console clock name is %s\n",
335                                                 debug_uart_clk->name);
336                         c = tegra_get_clock_by_name("pll_p");
337                         if (IS_ERR_OR_NULL(c))
338                                 pr_err("Not getting the parent clock pll_p\n");
339                         else
340                                 clk_set_parent(debug_uart_clk, c);
341
342                         clk_enable(debug_uart_clk);
343                         clk_set_rate(debug_uart_clk, clk_get_rate(c));
344                 } else {
345                         pr_err("Not getting the clock %s for debug console\n",
346                                         debug_uart_clk->name);
347                 }
348         }
349
350         platform_add_devices(cardhu_uart_devices,
351                                 ARRAY_SIZE(cardhu_uart_devices));
352 }
353
354 static struct platform_device tegra_camera = {
355         .name = "tegra_camera",
356         .id = -1,
357 };
358
359 static struct tegra_wm8903_platform_data cardhu_audio_pdata = {
360         .gpio_spkr_en           = TEGRA_GPIO_SPKR_EN,
361         .gpio_hp_det            = TEGRA_GPIO_HP_DET,
362         .gpio_hp_mute           = -1,
363         .gpio_int_mic_en        = -1,
364         .gpio_ext_mic_en        = -1,
365 };
366
367 static struct platform_device cardhu_audio_device = {
368         .name   = "tegra-snd-wm8903",
369         .id     = 0,
370         .dev    = {
371                 .platform_data  = &cardhu_audio_pdata,
372         },
373 };
374
375 static struct platform_device *cardhu_devices[] __initdata = {
376         &tegra_pmu_device,
377         &tegra_udc_device,
378 #if defined(CONFIG_SND_HDA_TEGRA)
379         &tegra_hda_device,
380 #endif
381 #if defined(CONFIG_TEGRA_IOVMM_SMMU)
382         &tegra_smmu_device,
383 #endif
384         &tegra_wdt_device,
385         &tegra_avp_device,
386         &tegra_camera,
387         &tegra_spi_device4,
388 #if defined(CONFIG_CRYPTO_DEV_TEGRA_SE)
389         &tegra_se_device,
390 #endif
391         &tegra_ahub_device,
392         &tegra_i2s_device1,
393         &tegra_pcm_device,
394         &cardhu_audio_device,
395 };
396
397 #define MXT_CONFIG_CRC  0xD62DE8
398 static const u8 config[] = {
399         0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
400         0xFF, 0xFF, 0x32, 0x0A, 0x00, 0x14, 0x14, 0x00,
401         0x00, 0x00, 0x00, 0x00, 0x00, 0x8B, 0x00, 0x00,
402         0x1B, 0x2A, 0x00, 0x20, 0x3C, 0x04, 0x05, 0x00,
403         0x02, 0x01, 0x00, 0x0A, 0x0A, 0x0A, 0x0A, 0xFF,
404         0x02, 0x55, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00,
405         0x00, 0x00, 0x00, 0x64, 0x02, 0x00, 0x00, 0x00,
406         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
407         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
408         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07,
409         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23,
410         0x00, 0x00, 0x00, 0x05, 0x0A, 0x15, 0x1E, 0x00,
411         0x00, 0x04, 0xFF, 0x03, 0x3F, 0x64, 0x64, 0x01,
412         0x0A, 0x14, 0x28, 0x4B, 0x00, 0x02, 0x00, 0x64,
413         0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
414         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
415         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
416         0x00, 0x00, 0x00, 0x08, 0x10, 0x3C, 0x00, 0x00,
417         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
418         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
419 };
420
421 static struct mxt_platform_data atmel_mxt_info = {
422         .x_line         = 27,
423         .y_line         = 42,
424         .x_size         = 768,
425         .y_size         = 1366,
426         .blen           = 0x20,
427         .threshold      = 0x3C,
428         .voltage        = 3300000,              /* 3.3V */
429         .orient         = 5,
430         .config         = config,
431         .config_length  = 157,
432         .config_crc     = MXT_CONFIG_CRC,
433         .irqflags       = IRQF_TRIGGER_FALLING,
434 /*      .read_chg       = &read_chg, */
435         .read_chg       = NULL,
436 };
437
438 static struct i2c_board_info __initdata atmel_i2c_info[] = {
439         {
440                 I2C_BOARD_INFO("atmel_mxt_ts", 0x5A),
441                 .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_PH4),
442                 .platform_data = &atmel_mxt_info,
443         }
444 };
445
446 static int __init cardhu_touch_init(void)
447 {
448         tegra_gpio_enable(TEGRA_GPIO_PH4);
449         tegra_gpio_enable(TEGRA_GPIO_PH6);
450
451         gpio_request(TEGRA_GPIO_PH4, "atmel-irq");
452         gpio_direction_input(TEGRA_GPIO_PH4);
453
454         gpio_request(TEGRA_GPIO_PH6, "atmel-reset");
455         gpio_direction_output(TEGRA_GPIO_PH6, 0);
456         msleep(1);
457         gpio_set_value(TEGRA_GPIO_PH6, 1);
458         msleep(100);
459
460         i2c_register_board_info(1, atmel_i2c_info, 1);
461
462         return 0;
463 }
464
465
466 static struct tegra_ehci_platform_data tegra_ehci_pdata[] = {
467         [0] = {
468                         .phy_config = &utmi_phy_config[0],
469                         .operating_mode = TEGRA_USB_HOST,
470                         .power_down_on_bus_suspend = 1,
471         },
472         [1] = {
473                         .phy_config = &utmi_phy_config[1],
474                         .operating_mode = TEGRA_USB_HOST,
475                         .power_down_on_bus_suspend = 1,
476         },
477         [2] = {
478                         .phy_config = &utmi_phy_config[2],
479                         .operating_mode = TEGRA_USB_HOST,
480                         .power_down_on_bus_suspend = 1,
481         },
482 };
483
484 static struct platform_device *tegra_usb_otg_host_register(void)
485 {
486         struct platform_device *pdev;
487         void *platform_data;
488         int val;
489
490         pdev = platform_device_alloc(tegra_ehci1_device.name,
491                 tegra_ehci1_device.id);
492         if (!pdev)
493                 return NULL;
494
495         val = platform_device_add_resources(pdev, tegra_ehci1_device.resource,
496                 tegra_ehci1_device.num_resources);
497         if (val)
498                 goto error;
499
500         pdev->dev.dma_mask =  tegra_ehci1_device.dev.dma_mask;
501         pdev->dev.coherent_dma_mask = tegra_ehci1_device.dev.coherent_dma_mask;
502
503         platform_data = kmalloc(sizeof(struct tegra_ehci_platform_data),
504                 GFP_KERNEL);
505         if (!platform_data)
506                 goto error;
507
508         memcpy(platform_data, &tegra_ehci_pdata[0],
509                                 sizeof(struct tegra_ehci_platform_data));
510         pdev->dev.platform_data = platform_data;
511
512         val = platform_device_add(pdev);
513         if (val)
514                 goto error_add;
515
516         return pdev;
517
518 error_add:
519         kfree(platform_data);
520 error:
521         pr_err("%s: failed to add the host contoller device\n", __func__);
522         platform_device_put(pdev);
523         return NULL;
524 }
525
526 static void tegra_usb_otg_host_unregister(struct platform_device *pdev)
527 {
528         platform_device_unregister(pdev);
529 }
530
531 #ifdef CONFIG_USB_SUPPORT
532 static struct usb_phy_plat_data tegra_usb_phy_pdata[] = {
533         [0] = {
534                         .instance = 0,
535                         .vbus_gpio = -1,
536                         .vbus_reg_supply = "vdd_vbus_micro_usb",
537         },
538         [1] = {
539                         .instance = 1,
540                         .vbus_gpio = -1,
541         },
542         [2] = {
543                         .instance = 2,
544                         .vbus_gpio = -1,
545                         .vbus_reg_supply = "vdd_vbus_typea_usb",
546         },
547 };
548
549 static struct tegra_ulpi_config uhsic_phy_config = {
550         .enable_gpio = EN_HSIC_GPIO,
551         .reset_gpio = -1,
552 };
553
554 static struct tegra_ehci_platform_data tegra_ehci_uhsic_pdata = {
555         .phy_type = TEGRA_USB_PHY_TYPE_HSIC,
556         .phy_config = &uhsic_phy_config,
557         .operating_mode = TEGRA_USB_HOST,
558         .power_down_on_bus_suspend = 1,
559 };
560
561 static struct tegra_otg_platform_data tegra_otg_pdata = {
562         .host_register = &tegra_usb_otg_host_register,
563         .host_unregister = &tegra_usb_otg_host_unregister,
564 };
565
566 static void cardhu_usb_init(void)
567 {
568         struct board_info bi;
569
570         tegra_get_board_info(&bi);
571
572         tegra_usb_phy_init(tegra_usb_phy_pdata, ARRAY_SIZE(tegra_usb_phy_pdata));
573
574         tegra_otg_device.dev.platform_data = &tegra_otg_pdata;
575         platform_device_register(&tegra_otg_device);
576
577         if (bi.board_id == BOARD_PM267) {
578                 uhsic_phy_config.reset_gpio =
579                         PM267_SMSC4640_HSIC_HUB_RESET_GPIO;
580                 tegra_ehci2_device.dev.platform_data = &tegra_ehci_uhsic_pdata;
581         } else if ((bi.board_id == BOARD_PM269) ||
582                 (bi.board_id == BOARD_E1186)) {
583                 tegra_ehci2_device.dev.platform_data = &tegra_ehci_uhsic_pdata;
584         } else {
585                 tegra_ehci2_device.dev.platform_data = &tegra_ehci_pdata[1];
586         }
587         platform_device_register(&tegra_ehci2_device);
588
589         tegra_ehci3_device.dev.platform_data = &tegra_ehci_pdata[2];
590         platform_device_register(&tegra_ehci3_device);
591
592 }
593 #else
594 static void cardhu_usb_init(void) { }
595 #endif
596
597 static void cardhu_gps_init(void)
598 {
599         tegra_gpio_enable(TEGRA_GPIO_PU2);
600         tegra_gpio_enable(TEGRA_GPIO_PU3);
601 }
602
603 static void cardhu_modem_init(void)
604 {
605         struct board_info board_info;
606         int w_disable_gpio;
607
608         tegra_get_board_info(&board_info);
609         switch (board_info.board_id) {
610         case BOARD_E1291:
611                 if (board_info.fab < 0x3) {
612                         w_disable_gpio = TEGRA_GPIO_PH5;
613                 } else {
614                         w_disable_gpio = TEGRA_GPIO_PDD5;
615                 }
616                 tegra_gpio_enable(w_disable_gpio);
617                 gpio_direction_input(w_disable_gpio);
618                 break;
619         default:
620                 break;
621         }
622 }
623
624 #ifdef CONFIG_SATA_AHCI_TEGRA
625 static void cardhu_sata_init(void)
626 {
627         platform_device_register(&tegra_sata_device);
628 }
629 #else
630 static void cardhu_sata_init(void) { }
631 #endif
632
633 static void __init tegra_cardhu_init(void)
634 {
635         tegra_clk_init_from_table(cardhu_clk_init_table);
636         cardhu_pinmux_init();
637         cardhu_i2c_init();
638         cardhu_usb_init();
639 #ifdef CONFIG_TEGRA_EDP_LIMITS
640         cardhu_edp_init();
641 #endif
642         cardhu_uart_init();
643         tegra_tsensor_init();
644         platform_add_devices(cardhu_devices, ARRAY_SIZE(cardhu_devices));
645         cardhu_sdhci_init();
646         cardhu_regulator_init();
647         cardhu_gpio_switch_regulator_init();
648         cardhu_suspend_init();
649         cardhu_power_off_init();
650         cardhu_touch_init();
651         cardhu_gps_init();
652         cardhu_modem_init();
653         cardhu_kbc_init();
654         cardhu_scroll_init();
655         cardhu_keys_init();
656         cardhu_panel_init();
657         cardhu_pmon_init();
658         cardhu_sensors_init();
659         cardhu_bt_rfkill();
660         tegra_setup_bluesleep();
661         cardhu_sata_init();
662         //audio_wired_jack_init();
663         cardhu_pins_state_init();
664         cardhu_emc_init();
665         tegra_release_bootloader_fb();
666 }
667
668 static void __init tegra_cardhu_reserve(void)
669 {
670 #if defined(CONFIG_NVMAP_CONVERT_CARVEOUT_TO_IOVMM)
671         tegra_reserve(0, SZ_8M, SZ_8M);
672 #else
673         tegra_reserve(SZ_128M, SZ_8M, SZ_8M);
674 #endif
675 }
676
677 MACHINE_START(CARDHU, "cardhu")
678         .boot_params    = 0x80000100,
679         .map_io         = tegra_map_common_io,
680         .reserve        = tegra_cardhu_reserve,
681         .init_early     = tegra_init_early,
682         .init_irq       = tegra_init_irq,
683         .timer          = &tegra_timer,
684         .init_machine   = tegra_cardhu_init,
685 MACHINE_END