2 * arch/arm/mach-tegra/board-harmony-sdhci.c
4 * Copyright (C) 2010 Google, Inc.
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.
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.
17 #include <linux/resource.h>
18 #include <linux/platform_device.h>
19 #include <linux/delay.h>
20 #include <linux/gpio.h>
22 #include <asm/mach-types.h>
23 #include <mach/irqs.h>
24 #include <mach/iomap.h>
25 #include <mach/sdhci.h>
26 #include <mach/pinmux.h>
28 #include "gpio-names.h"
30 static struct resource sdhci_resource1[] = {
34 .flags = IORESOURCE_IRQ,
37 .start = TEGRA_SDMMC1_BASE,
38 .end = TEGRA_SDMMC1_BASE + TEGRA_SDMMC1_SIZE-1,
39 .flags = IORESOURCE_MEM,
43 static struct resource sdhci_resource2[] = {
47 .flags = IORESOURCE_IRQ,
50 .start = TEGRA_SDMMC2_BASE,
51 .end = TEGRA_SDMMC2_BASE + TEGRA_SDMMC2_SIZE-1,
52 .flags = IORESOURCE_MEM,
56 static struct resource sdhci_resource4[] = {
60 .flags = IORESOURCE_IRQ,
63 .start = TEGRA_SDMMC4_BASE,
64 .end = TEGRA_SDMMC4_BASE + TEGRA_SDMMC4_SIZE-1,
65 .flags = IORESOURCE_MEM,
69 static struct tegra_sdhci_platform_data tegra_sdhci_platform_data1 = {
77 static struct tegra_sdhci_platform_data tegra_sdhci_platform_data2 = {
80 .cd_gpio = TEGRA_GPIO_PI5,
81 .wp_gpio = TEGRA_GPIO_PH1,
82 .power_gpio = TEGRA_GPIO_PT3,
85 static struct tegra_sdhci_platform_data tegra_sdhci_platform_data4 = {
88 .cd_gpio = TEGRA_GPIO_PH2,
89 .wp_gpio = TEGRA_GPIO_PH3,
90 .power_gpio = TEGRA_GPIO_PI6,
93 static struct platform_device tegra_sdhci_device1 = {
94 .name = "sdhci-tegra",
96 .resource = sdhci_resource1,
97 .num_resources = ARRAY_SIZE(sdhci_resource1),
99 .platform_data = &tegra_sdhci_platform_data1,
103 static struct platform_device tegra_sdhci_device2 = {
104 .name = "sdhci-tegra",
106 .resource = sdhci_resource2,
107 .num_resources = ARRAY_SIZE(sdhci_resource2),
109 .platform_data = &tegra_sdhci_platform_data2,
113 static struct platform_device tegra_sdhci_device4 = {
114 .name = "sdhci-tegra",
116 .resource = sdhci_resource4,
117 .num_resources = ARRAY_SIZE(sdhci_resource4),
119 .platform_data = &tegra_sdhci_platform_data4,
123 int __init harmony_sdhci_init(void)
125 gpio_request(tegra_sdhci_platform_data2.power_gpio, "sdhci2_power");
126 gpio_request(tegra_sdhci_platform_data2.cd_gpio, "sdhci2_cd");
127 gpio_request(tegra_sdhci_platform_data2.wp_gpio, "sdhci2_wp");
129 tegra_gpio_enable(tegra_sdhci_platform_data2.power_gpio);
130 tegra_gpio_enable(tegra_sdhci_platform_data2.cd_gpio);
131 tegra_gpio_enable(tegra_sdhci_platform_data2.wp_gpio);
133 gpio_request(tegra_sdhci_platform_data4.power_gpio, "sdhci4_power");
134 gpio_request(tegra_sdhci_platform_data4.cd_gpio, "sdhci4_cd");
135 gpio_request(tegra_sdhci_platform_data4.wp_gpio, "sdhci4_wp");
137 tegra_gpio_enable(tegra_sdhci_platform_data4.power_gpio);
138 tegra_gpio_enable(tegra_sdhci_platform_data4.cd_gpio);
139 tegra_gpio_enable(tegra_sdhci_platform_data4.wp_gpio);
141 gpio_direction_output(tegra_sdhci_platform_data2.power_gpio, 1);
142 gpio_direction_output(tegra_sdhci_platform_data4.power_gpio, 1);
144 platform_device_register(&tegra_sdhci_device1);
145 platform_device_register(&tegra_sdhci_device2);
146 platform_device_register(&tegra_sdhci_device4);