Ventana: KBC: Removing the KBC usage on ventana
[linux-2.6.git] / arch / arm / mach-tegra / board-enterprise-sdhci.c
1 /*
2  * arch/arm/mach-tegra/board-enterprise-sdhci.c
3  *
4  * Copyright (C) 2011 NVIDIA Corporation.
5  *
6  * This software is licensed under the terms of the GNU General Public
7  * License version 2, as published by the Free Software Foundation, and
8  * may be copied, distributed, and modified under those terms.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  */
16
17 #include <linux/resource.h>
18 #include <linux/platform_device.h>
19 #include <linux/delay.h>
20 #include <linux/gpio.h>
21 #include <linux/clk.h>
22 #include <linux/err.h>
23 #include <linux/mmc/host.h>
24
25 #include <asm/mach-types.h>
26 #include <mach/irqs.h>
27 #include <mach/iomap.h>
28 #include <mach/sdhci.h>
29
30 #include "gpio-names.h"
31 #include "board.h"
32
33
34 #define ENTERPRISE_SD_CD TEGRA_GPIO_PI5
35
36 static struct resource sdhci_resource2[] = {
37         [0] = {
38                 .start  = INT_SDMMC3,
39                 .end    = INT_SDMMC3,
40                 .flags  = IORESOURCE_IRQ,
41         },
42         [1] = {
43                 .start  = TEGRA_SDMMC3_BASE,
44                 .end    = TEGRA_SDMMC3_BASE + TEGRA_SDMMC3_SIZE-1,
45                 .flags  = IORESOURCE_MEM,
46         },
47 };
48
49 static struct resource sdhci_resource3[] = {
50         [0] = {
51                 .start  = INT_SDMMC4,
52                 .end    = INT_SDMMC4,
53                 .flags  = IORESOURCE_IRQ,
54         },
55         [1] = {
56                 .start  = TEGRA_SDMMC4_BASE,
57                 .end    = TEGRA_SDMMC4_BASE + TEGRA_SDMMC4_SIZE-1,
58                 .flags  = IORESOURCE_MEM,
59         },
60 };
61
62
63 static struct tegra_sdhci_platform_data tegra_sdhci_platform_data2 = {
64         .cd_gpio = -1,
65         .wp_gpio = -1,
66         .power_gpio = -1,
67 };
68
69 static struct tegra_sdhci_platform_data tegra_sdhci_platform_data3 = {
70         .cd_gpio = -1,
71         .wp_gpio = -1,
72         .power_gpio = -1,
73 };
74
75 static struct platform_device tegra_sdhci_device2 = {
76         .name           = "sdhci-tegra",
77         .id             = 2,
78         .resource       = sdhci_resource2,
79         .num_resources  = ARRAY_SIZE(sdhci_resource2),
80         .dev = {
81                 .platform_data = &tegra_sdhci_platform_data2,
82         },
83 };
84
85 static struct platform_device tegra_sdhci_device3 = {
86         .name           = "sdhci-tegra",
87         .id             = 3,
88         .resource       = sdhci_resource3,
89         .num_resources  = ARRAY_SIZE(sdhci_resource3),
90         .dev = {
91                 .platform_data = &tegra_sdhci_platform_data3,
92         },
93 };
94
95 int __init enterprise_sdhci_init(void)
96 {
97         platform_device_register(&tegra_sdhci_device3);
98
99         tegra_gpio_enable(ENTERPRISE_SD_CD);
100         tegra_sdhci_platform_data2.cd_gpio = ENTERPRISE_SD_CD;
101
102         platform_device_register(&tegra_sdhci_device2);
103
104         return 0;
105 }