1 /* linux/arch/arm/plat-s5pc1xx/setup-sdhci-gpio.c
3 * Copyright 2009 Samsung Eletronics
5 * S5PC1XX - Helper functions for setting up SDHCI device(s) GPIO (HSMMC)
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
12 #include <linux/kernel.h>
13 #include <linux/types.h>
14 #include <linux/interrupt.h>
15 #include <linux/platform_device.h>
17 #include <linux/gpio.h>
18 #include <linux/mmc/host.h>
19 #include <linux/mmc/card.h>
21 #include <plat/gpio-cfg.h>
22 #include <plat/regs-sdhci.h>
24 void s5pc100_setup_sdhci0_cfg_gpio(struct platform_device
*dev
, int width
)
31 /* In case of 8 width, we should decrease the 2 */
35 end
= S5PC100_GPG0(2 + num
);
37 /* Set all the necessary GPG0/GPG1 pins to special-function 0 */
38 for (gpio
= S5PC100_GPG0(0); gpio
< end
; gpio
++) {
39 s3c_gpio_cfgpin(gpio
, S3C_GPIO_SFN(2));
40 s3c_gpio_setpull(gpio
, S3C_GPIO_PULL_NONE
);
44 for (gpio
= S5PC100_GPG1(0); gpio
<= S5PC100_GPG1(1); gpio
++) {
45 s3c_gpio_cfgpin(gpio
, S3C_GPIO_SFN(2));
46 s3c_gpio_setpull(gpio
, S3C_GPIO_PULL_NONE
);
50 s3c_gpio_setpull(S5PC100_GPG1(2), S3C_GPIO_PULL_UP
);
51 s3c_gpio_cfgpin(S5PC100_GPG1(2), S3C_GPIO_SFN(2));
54 void s5pc100_setup_sdhci1_cfg_gpio(struct platform_device
*dev
, int width
)
59 end
= S5PC100_GPG2(2 + width
);
61 /* Set all the necessary GPG2 pins to special-function 2 */
62 for (gpio
= S5PC100_GPG2(0); gpio
< end
; gpio
++) {
63 s3c_gpio_cfgpin(gpio
, S3C_GPIO_SFN(2));
64 s3c_gpio_setpull(gpio
, S3C_GPIO_PULL_NONE
);
67 s3c_gpio_setpull(S5PC100_GPG2(6), S3C_GPIO_PULL_UP
);
68 s3c_gpio_cfgpin(S5PC100_GPG2(6), S3C_GPIO_SFN(2));
71 void s5pc100_setup_sdhci2_cfg_gpio(struct platform_device
*dev
, int width
)
76 end
= S5PC100_GPG3(2 + width
);
78 /* Set all the necessary GPG3 pins to special-function 2 */
79 for (gpio
= S5PC100_GPG3(0); gpio
< end
; gpio
++) {
80 s3c_gpio_cfgpin(gpio
, S3C_GPIO_SFN(2));
81 s3c_gpio_setpull(gpio
, S3C_GPIO_PULL_NONE
);
84 s3c_gpio_setpull(S5PC100_GPG3(6), S3C_GPIO_PULL_UP
);
85 s3c_gpio_cfgpin(S5PC100_GPG3(6), S3C_GPIO_SFN(2));