1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-11-25 06:36:15 +02:00
openwrt-xburst/target/linux/s3c24xx/patches-2.6.26/1020-s3c_mci-gta01.patch.patch

98 lines
2.8 KiB
Diff
Raw Normal View History

From d63b12e946e83c7db8c9f94ae9d5d9d420a6f907 Mon Sep 17 00:00:00 2001
From: mokopatches <mokopatches@openmoko.org>
Date: Wed, 16 Jul 2008 14:44:50 +0100
Subject: [PATCH] s3c_mci-gta01.patch
---
arch/arm/mach-s3c2410/mach-gta01.c | 56 ++++++++++++++++++++++++++++++++++++
1 files changed, 56 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-s3c2410/mach-gta01.c b/arch/arm/mach-s3c2410/mach-gta01.c
index 3462c7f..87bb189 100644
--- a/arch/arm/mach-s3c2410/mach-gta01.c
+++ b/arch/arm/mach-s3c2410/mach-gta01.c
@@ -59,6 +59,7 @@
#include <asm/arch/regs-gpio.h>
#include <asm/arch/fb.h>
+#include <asm/arch/mci.h>
#include <asm/arch/spi.h>
#include <asm/arch/spi-gpio.h>
#include <asm/arch/usb-control.h>
@@ -382,6 +383,59 @@ static struct s3c2410_platform_nand gta01_nand_info = {
.sets = gta01_nand_sets,
};
+static void gta01_mmc_set_power(unsigned char power_mode, unsigned short vdd)
+{
+ int bit;
+ int mv = 1700; /* 1.7V for MMC_VDD_165_195 */
+
+ printk(KERN_DEBUG "mmc_set_power(power_mode=%u, vdd=%u\n",
+ power_mode, vdd);
+
+ switch (system_rev) {
+ case GTA01v3_SYSTEM_REV:
+ switch (power_mode) {
+ case MMC_POWER_OFF:
+ pcf50606_onoff_set(pcf50606_global,
+ PCF50606_REGULATOR_D2REG, 0);
+ break;
+ case MMC_POWER_ON:
+ /* translate MMC_VDD_* VDD bit to mv */
+ for (bit = 8; bit != 24; bit++)
+ if (vdd == (1 << bit))
+ mv += 100 * (bit - 4);
+ pcf50606_voltage_set(pcf50606_global,
+ PCF50606_REGULATOR_D2REG, mv);
+ pcf50606_onoff_set(pcf50606_global,
+ PCF50606_REGULATOR_D2REG, 1);
+ break;
+ }
+ break;
+ case GTA01v4_SYSTEM_REV:
+ case GTA01Bv2_SYSTEM_REV:
+ case GTA01Bv3_SYSTEM_REV:
+ case GTA01Bv4_SYSTEM_REV:
+ switch (power_mode) {
+ case MMC_POWER_OFF:
+ s3c2410_gpio_setpin(GTA01_GPIO_SDMMC_ON, 1);
+ break;
+ case MMC_POWER_ON:
+ s3c2410_gpio_setpin(GTA01_GPIO_SDMMC_ON, 0);
+ break;
+ }
+ break;
+ }
+}
+
+static struct s3c24xx_mci_pdata gta01_mmc_cfg = {
+ .gpio_detect = GTA01_GPIO_nSD_DETECT,
+ .set_power = &gta01_mmc_set_power,
+ .ocr_avail = MMC_VDD_165_195|MMC_VDD_20_21|
+ MMC_VDD_21_22|MMC_VDD_22_23|MMC_VDD_23_24|
+ MMC_VDD_24_25|MMC_VDD_25_26|MMC_VDD_26_27|
+ MMC_VDD_27_28|MMC_VDD_28_29|MMC_VDD_29_30|
+ MMC_VDD_30_31|MMC_VDD_31_32|MMC_VDD_32_33,
+};
+
static void gta01_udc_command(enum s3c2410_udc_cmd_e cmd)
{
printk(KERN_DEBUG "%s(%d)\n", __func__, cmd);
@@ -598,10 +652,12 @@ static void __init gta01_machine_init(void)
system_rev == GTA01Bv3_SYSTEM_REV ||
system_rev == GTA01Bv4_SYSTEM_REV) {
gta01_udc_cfg.udc_command = gta01_udc_command;
+ gta01_mmc_cfg.ocr_avail = MMC_VDD_32_33;
}
s3c_device_usb.dev.platform_data = &gta01_usb_info;
s3c_device_nand.dev.platform_data = &gta01_nand_info;
+ s3c_device_sdi.dev.platform_data = &gta01_mmc_cfg;
s3c24xx_fb_set_platdata(&gta01_lcd_cfg);
--
1.5.6.3