summaryrefslogtreecommitdiff
path: root/arch/arm/mach-tegra/board-cardhu-sdhci.c
diff options
context:
space:
mode:
authorPradeep Goudagunta <pgoudagunta@nvidia.com>2011-05-04 17:01:23 +0530
committerDan Willemsen <dwillemsen@nvidia.com>2011-11-30 21:45:54 -0800
commitde7b0d811d30484550980516b48661f364dbdd40 (patch)
tree20bf132aaf43ecd5906f48e4f9176368d965cd2d /arch/arm/mach-tegra/board-cardhu-sdhci.c
parenta77fcfa831da6f693c41fb20abc93d361d5c7681 (diff)
ARM: tegra: pm269: sdhci: Support for PM269
Added support to read board ID and then configure clk frequency for WiFi and SDCARD_WP gpio initialization. Bug 823160 Original-Change-Id: Ia05c8258b275541c2130fc8a038a8fc4348a5866 Reviewed-on: http://git-master/r/30373 Reviewed-by: Niket Sirsi <nsirsi@nvidia.com> Tested-by: Niket Sirsi <nsirsi@nvidia.com> Rebase-Id: Re4a5c9ef539f2273f3a108972c0890fc343fe86e
Diffstat (limited to 'arch/arm/mach-tegra/board-cardhu-sdhci.c')
-rw-r--r--arch/arm/mach-tegra/board-cardhu-sdhci.c106
1 files changed, 47 insertions, 59 deletions
diff --git a/arch/arm/mach-tegra/board-cardhu-sdhci.c b/arch/arm/mach-tegra/board-cardhu-sdhci.c
index 701c8bb24407..a89f60fa737f 100644
--- a/arch/arm/mach-tegra/board-cardhu-sdhci.c
+++ b/arch/arm/mach-tegra/board-cardhu-sdhci.c
@@ -33,6 +33,7 @@
#define CARDHU_SD_CD TEGRA_GPIO_PI5
#define CARDHU_SD_WP TEGRA_GPIO_PT3
+#define PM269_SD_WP TEGRA_GPIO_PZ4
static struct resource sdhci_resource0[] = {
[0] = {
@@ -86,7 +87,7 @@ static struct tegra_sdhci_platform_data tegra_sdhci_platform_data0 = {
.slot_rail_name = NULL,
.vdd_max_uv = -1,
.vdd_min_uv = -1,
- .max_clk = 48000000,
+ .max_clk = 0,
.is_8bit_supported = false,
};
@@ -122,41 +123,14 @@ static struct tegra_sdhci_platform_data tegra_sdhci_platform_data3 = {
.is_8bit_supported = true,
};
-static struct tegra_sdhci_platform_data tegra_pm269_sdhci_platform_data0 = {
- .clk_id = NULL,
- .force_hs = 0,
- .cd_gpio = -1,
- .wp_gpio = -1,
- .power_gpio = -1,
- .tap_delay = 6,
- .is_voltage_switch_supported = false,
- .vdd_rail_name = NULL,
- .slot_rail_name = NULL,
- .max_clk = 48000000,
- .is_8bit_supported = false,
-};
-
-static struct tegra_sdhci_platform_data tegra_pm269_sdhci_platform_data2 = {
- .clk_id = NULL,
- .force_hs = 1,
- .cd_gpio = -1,
- .wp_gpio = -1,
- .power_gpio = -1,
- .tap_delay = 6,
- .is_voltage_switch_supported = false,
- .vdd_rail_name = "vddio_sdmmc3",
- .slot_rail_name = "vddio_sd_slot",
- .vdd_max_uv = 3300000,
- .vdd_min_uv = 3300000,
- .max_clk = 48000000,
- .is_8bit_supported = false,
-};
-
static struct platform_device tegra_sdhci_device0 = {
.name = "sdhci-tegra",
.id = 0,
.resource = sdhci_resource0,
.num_resources = ARRAY_SIZE(sdhci_resource0),
+ .dev = {
+ .platform_data = &tegra_sdhci_platform_data0,
+ },
};
static struct platform_device tegra_sdhci_device2 = {
@@ -164,6 +138,9 @@ static struct platform_device tegra_sdhci_device2 = {
.id = 2,
.resource = sdhci_resource2,
.num_resources = ARRAY_SIZE(sdhci_resource2),
+ .dev = {
+ .platform_data = &tegra_sdhci_platform_data2,
+ },
};
static struct platform_device tegra_sdhci_device3 = {
@@ -218,50 +195,61 @@ static int cardhu_sd_wp_gpio_init(void)
return 0;
}
+static int pm269_sd_wp_gpio_init(void)
+{
+ unsigned int rc = 0;
+
+ rc = gpio_request(PM269_SD_WP, "write_protect");
+ if (rc) {
+ pr_err("Write protect gpio request failed:%d\n", rc);
+ return rc;
+ }
+
+ tegra_gpio_enable(PM269_SD_WP);
+
+ rc = gpio_direction_input(PM269_SD_WP);
+ if (rc) {
+ pr_err("Unable to configure direction for write protect gpio:%d\n", rc);
+ return rc;
+ }
+
+ return 0;
+}
+
int __init cardhu_sdhci_init(void)
{
unsigned int rc = 0;
struct board_info board_info;
tegra_get_board_info(&board_info);
if (board_info.board_id == BOARD_PM269) {
- tegra_sdhci_device2.dev.platform_data =
- &tegra_pm269_sdhci_platform_data2;
- tegra_sdhci_device0.dev.platform_data =
- &tegra_pm269_sdhci_platform_data0;
- platform_device_register(&tegra_sdhci_device3);
-
- /* Fix ME: The gpios have to enabled for hot plug support */
- rc = cardhu_sd_cd_gpio_init();
+ tegra_sdhci_platform_data2.max_clk = 12000000;
+ rc = pm269_sd_wp_gpio_init();
if (!rc) {
- tegra_pm269_sdhci_platform_data2.cd_gpio =
- CARDHU_SD_CD;
- tegra_pm269_sdhci_platform_data2.cd_gpio_polarity = 0;
+ tegra_sdhci_platform_data0.wp_gpio = PM269_SD_WP;
+ tegra_sdhci_platform_data0.wp_gpio_polarity = 1;
}
-
- platform_device_register(&tegra_sdhci_device2);
-
} else {
- tegra_sdhci_device2.dev.platform_data =
- &tegra_sdhci_platform_data2;
- tegra_sdhci_device0.dev.platform_data =
- &tegra_sdhci_platform_data0;
- platform_device_register(&tegra_sdhci_device3);
- platform_device_register(&tegra_sdhci_device2);
-
- /* Fix ME: The gpios have to enabled for hot plug support */
- rc = cardhu_sd_cd_gpio_init();
- if (!rc) {
- tegra_sdhci_platform_data0.cd_gpio = CARDHU_SD_CD;
- tegra_sdhci_platform_data0.cd_gpio_polarity = 0;
- }
+ tegra_sdhci_platform_data2.max_clk = 48000000;
rc = cardhu_sd_wp_gpio_init();
if (!rc) {
tegra_sdhci_platform_data0.wp_gpio = CARDHU_SD_WP;
tegra_sdhci_platform_data0.wp_gpio_polarity = 1;
}
+ }
+
+ platform_device_register(&tegra_sdhci_device3);
+ platform_device_register(&tegra_sdhci_device2);
- platform_device_register(&tegra_sdhci_device0);
+ /* Fix ME: The gpios have to enabled for hot plug support */
+ rc = cardhu_sd_cd_gpio_init();
+ if (!rc) {
+ tegra_sdhci_platform_data0.cd_gpio = CARDHU_SD_CD;
+ tegra_sdhci_platform_data0.cd_gpio_polarity = 0;
}
+
+
+ platform_device_register(&tegra_sdhci_device0);
+
return 0;
}