upload tizen1.0 source
[kernel/linux-2.6.36.git] / arch / arm / mach-s5pv310 / setup-mshci-gpio.c
1 /* linux/arch/arm/plat-s5pc1xx/setup-sdhci-gpio.c
2  *
3  * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4  *              http://www.samsung.com/
5  *
6  * S5PV310 - Helper functions for setting up SDHCI device(s) GPIO (HSMMC)
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 as
10  * published by the Free Software Foundation.
11 */
12
13 #include <linux/kernel.h>
14 #include <linux/types.h>
15 #include <linux/interrupt.h>
16 #include <linux/platform_device.h>
17 #include <linux/io.h>
18 #include <linux/mmc/host.h>
19 #include <linux/mmc/card.h>
20
21 #include <mach/gpio.h>
22 #include <plat/gpio-cfg.h>
23
24 void s5pv310_setup_mshci_cfg_gpio(struct platform_device *dev, int width)
25 {
26         unsigned int gpio;
27
28         /* Set all the necessary GPG0/GPG1 pins to special-function 2 */
29         for (gpio = S5PV310_GPK0(0); gpio < S5PV310_GPK0(3); gpio++) {
30                 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
31                 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
32                 s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4);
33         }
34         switch (width) {
35         case 8:
36                 for (gpio = S5PV310_GPK1(3); gpio <= S5PV310_GPK1(6); gpio++) {
37                         s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(4));
38                         s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
39                         s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4);
40                 }
41         case 4:
42                 for (gpio = S5PV310_GPK0(3); gpio <= S5PV310_GPK0(6); gpio++) {
43                         s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
44                         s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
45                         s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4);
46                 }
47                 break;
48         }
49 }
50