changed Makefile and profiles, added patches for kernel 2.6.24 (stable-branch of...
[openwrt/openwrt.git] / target / linux / s3c24xx / patches-2.6.24 / 1024-s3c_mci-gta01.patch.patch
1 From 948f60af720f34294629041773d9947bcefc0a9a Mon Sep 17 00:00:00 2001
2 From: mokopatches <mokopatches@openmoko.org>
3 Date: Fri, 4 Apr 2008 11:33:24 +0100
4 Subject: [PATCH] s3c_mci-gta01.patch
5
6 ---
7 arch/arm/mach-s3c2410/mach-gta01.c | 56 ++++++++++++++++++++++++++++++++++++
8 1 files changed, 56 insertions(+), 0 deletions(-)
9
10 diff --git a/arch/arm/mach-s3c2410/mach-gta01.c b/arch/arm/mach-s3c2410/mach-gta01.c
11 index 3462c7f..87bb189 100644
12 --- a/arch/arm/mach-s3c2410/mach-gta01.c
13 +++ b/arch/arm/mach-s3c2410/mach-gta01.c
14 @@ -59,6 +59,7 @@
15
16 #include <asm/arch/regs-gpio.h>
17 #include <asm/arch/fb.h>
18 +#include <asm/arch/mci.h>
19 #include <asm/arch/spi.h>
20 #include <asm/arch/spi-gpio.h>
21 #include <asm/arch/usb-control.h>
22 @@ -382,6 +383,59 @@ static struct s3c2410_platform_nand gta01_nand_info = {
23 .sets = gta01_nand_sets,
24 };
25
26 +static void gta01_mmc_set_power(unsigned char power_mode, unsigned short vdd)
27 +{
28 + int bit;
29 + int mv = 1700; /* 1.7V for MMC_VDD_165_195 */
30 +
31 + printk(KERN_DEBUG "mmc_set_power(power_mode=%u, vdd=%u\n",
32 + power_mode, vdd);
33 +
34 + switch (system_rev) {
35 + case GTA01v3_SYSTEM_REV:
36 + switch (power_mode) {
37 + case MMC_POWER_OFF:
38 + pcf50606_onoff_set(pcf50606_global,
39 + PCF50606_REGULATOR_D2REG, 0);
40 + break;
41 + case MMC_POWER_ON:
42 + /* translate MMC_VDD_* VDD bit to mv */
43 + for (bit = 8; bit != 24; bit++)
44 + if (vdd == (1 << bit))
45 + mv += 100 * (bit - 4);
46 + pcf50606_voltage_set(pcf50606_global,
47 + PCF50606_REGULATOR_D2REG, mv);
48 + pcf50606_onoff_set(pcf50606_global,
49 + PCF50606_REGULATOR_D2REG, 1);
50 + break;
51 + }
52 + break;
53 + case GTA01v4_SYSTEM_REV:
54 + case GTA01Bv2_SYSTEM_REV:
55 + case GTA01Bv3_SYSTEM_REV:
56 + case GTA01Bv4_SYSTEM_REV:
57 + switch (power_mode) {
58 + case MMC_POWER_OFF:
59 + s3c2410_gpio_setpin(GTA01_GPIO_SDMMC_ON, 1);
60 + break;
61 + case MMC_POWER_ON:
62 + s3c2410_gpio_setpin(GTA01_GPIO_SDMMC_ON, 0);
63 + break;
64 + }
65 + break;
66 + }
67 +}
68 +
69 +static struct s3c24xx_mci_pdata gta01_mmc_cfg = {
70 + .gpio_detect = GTA01_GPIO_nSD_DETECT,
71 + .set_power = &gta01_mmc_set_power,
72 + .ocr_avail = MMC_VDD_165_195|MMC_VDD_20_21|
73 + MMC_VDD_21_22|MMC_VDD_22_23|MMC_VDD_23_24|
74 + MMC_VDD_24_25|MMC_VDD_25_26|MMC_VDD_26_27|
75 + MMC_VDD_27_28|MMC_VDD_28_29|MMC_VDD_29_30|
76 + MMC_VDD_30_31|MMC_VDD_31_32|MMC_VDD_32_33,
77 +};
78 +
79 static void gta01_udc_command(enum s3c2410_udc_cmd_e cmd)
80 {
81 printk(KERN_DEBUG "%s(%d)\n", __func__, cmd);
82 @@ -598,10 +652,12 @@ static void __init gta01_machine_init(void)
83 system_rev == GTA01Bv3_SYSTEM_REV ||
84 system_rev == GTA01Bv4_SYSTEM_REV) {
85 gta01_udc_cfg.udc_command = gta01_udc_command;
86 + gta01_mmc_cfg.ocr_avail = MMC_VDD_32_33;
87 }
88
89 s3c_device_usb.dev.platform_data = &gta01_usb_info;
90 s3c_device_nand.dev.platform_data = &gta01_nand_info;
91 + s3c_device_sdi.dev.platform_data = &gta01_mmc_cfg;
92
93 s3c24xx_fb_set_platdata(&gta01_lcd_cfg);
94
95 --
96 1.5.6.5
97