Ventana: KBC: Removing the KBC usage on ventana
[linux-2.6.git] / arch / arm / mach-tegra / board-ventana-sdhci.c
1 /*
2  * arch/arm/mach-tegra/board-harmony-sdhci.c
3  *
4  * Copyright (C) 2010 Google, Inc.
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
22 #include <asm/mach-types.h>
23 #include <mach/irqs.h>
24 #include <mach/iomap.h>
25 #include <mach/sdhci.h>
26
27 #include "gpio-names.h"
28 #include "board.h"
29
30 static struct resource sdhci_resource0[] = {
31         [0] = {
32                 .start  = INT_SDMMC1,
33                 .end    = INT_SDMMC1,
34                 .flags  = IORESOURCE_IRQ,
35         },
36         [1] = {
37                 .start  = TEGRA_SDMMC1_BASE,
38                 .end    = TEGRA_SDMMC1_BASE + TEGRA_SDMMC1_SIZE-1,
39                 .flags  = IORESOURCE_MEM,
40         },
41 };
42
43 static struct resource sdhci_resource2[] = {
44         [0] = {
45                 .start  = INT_SDMMC3,
46                 .end    = INT_SDMMC3,
47                 .flags  = IORESOURCE_IRQ,
48         },
49         [1] = {
50                 .start  = TEGRA_SDMMC3_BASE,
51                 .end    = TEGRA_SDMMC3_BASE + TEGRA_SDMMC3_SIZE-1,
52                 .flags  = IORESOURCE_MEM,
53         },
54 };
55
56 static struct resource sdhci_resource3[] = {
57         [0] = {
58                 .start  = INT_SDMMC4,
59                 .end    = INT_SDMMC4,
60                 .flags  = IORESOURCE_IRQ,
61         },
62         [1] = {
63                 .start  = TEGRA_SDMMC4_BASE,
64                 .end    = TEGRA_SDMMC4_BASE + TEGRA_SDMMC4_SIZE-1,
65                 .flags  = IORESOURCE_MEM,
66         },
67 };
68
69 static struct tegra_sdhci_platform_data tegra_sdhci_platform_data0 = {
70         .cd_gpio = -1,
71         .wp_gpio = -1,
72         .power_gpio = -1,
73 };
74
75 static struct tegra_sdhci_platform_data tegra_sdhci_platform_data2 = {
76         .cd_gpio = TEGRA_GPIO_PI5,
77         .wp_gpio = TEGRA_GPIO_PH1,
78         .power_gpio = TEGRA_GPIO_PT3,
79 };
80
81 static struct tegra_sdhci_platform_data tegra_sdhci_platform_data3 = {
82         .cd_gpio = -1,
83         .wp_gpio = -1,
84         .power_gpio = TEGRA_GPIO_PI6,
85 };
86
87 static struct platform_device tegra_sdhci_device0 = {
88         .name           = "sdhci-tegra",
89         .id             = 0,
90         .resource       = sdhci_resource0,
91         .num_resources  = ARRAY_SIZE(sdhci_resource0),
92         .dev = {
93                 .platform_data = &tegra_sdhci_platform_data0,
94         },
95 };
96
97 static struct platform_device tegra_sdhci_device2 = {
98         .name           = "sdhci-tegra",
99         .id             = 2,
100         .resource       = sdhci_resource2,
101         .num_resources  = ARRAY_SIZE(sdhci_resource2),
102         .dev = {
103                 .platform_data = &tegra_sdhci_platform_data2,
104         },
105 };
106
107 static struct platform_device tegra_sdhci_device3 = {
108         .name           = "sdhci-tegra",
109         .id             = 3,
110         .resource       = sdhci_resource3,
111         .num_resources  = ARRAY_SIZE(sdhci_resource3),
112         .dev = {
113                 .platform_data = &tegra_sdhci_platform_data3,
114         },
115 };
116
117 int __init ventana_sdhci_init(void)
118 {
119         tegra_gpio_enable(tegra_sdhci_platform_data2.power_gpio);
120         tegra_gpio_enable(tegra_sdhci_platform_data2.cd_gpio);
121         tegra_gpio_enable(tegra_sdhci_platform_data2.wp_gpio);
122         tegra_gpio_enable(tegra_sdhci_platform_data3.power_gpio);
123
124         platform_device_register(&tegra_sdhci_device3);
125         platform_device_register(&tegra_sdhci_device2);
126         platform_device_register(&tegra_sdhci_device0);
127
128         return 0;
129 }