1 /* linux/arch/arm/plat-s5pc1xx/setup-sdhci-gpio.c
3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
6 * S5PV210 - Helper functions for setting up SDHCI device(s) GPIO (HSMMC)
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.
13 #include <linux/kernel.h>
14 #include <linux/types.h>
15 #include <linux/interrupt.h>
16 #include <linux/platform_device.h>
18 #include <linux/gpio.h>
19 #include <linux/mmc/host.h>
20 #include <linux/mmc/card.h>
22 #include <plat/gpio-cfg.h>
23 #include <plat/regs-sdhci.h>
24 #include <plat/sdhci.h>
26 void s5pv210_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
28 struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
30 /* Set all the necessary GPG0/GPG1 pins to special-function 2 */
31 s3c_gpio_cfgall_range(S5PV210_GPG0(0), 2,
32 S3C_GPIO_SFN(2), S3C_GPIO_PULL_NONE);
36 /* GPG1[3:6] special-funtion 3 */
37 s3c_gpio_cfgall_range(S5PV210_GPG1(3), 4,
38 S3C_GPIO_SFN(3), S3C_GPIO_PULL_NONE);
40 /* GPG0[3:6] special-funtion 2 */
41 s3c_gpio_cfgall_range(S5PV210_GPG0(3), 4,
42 S3C_GPIO_SFN(2), S3C_GPIO_PULL_NONE);
47 if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
48 s3c_gpio_setpull(S5PV210_GPG0(2), S3C_GPIO_PULL_UP);
49 s3c_gpio_cfgpin(S5PV210_GPG0(2), S3C_GPIO_SFN(2));
53 void s5pv210_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width)
55 struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
57 /* Set all the necessary GPG1[0:1] pins to special-function 2 */
58 s3c_gpio_cfgall_range(S5PV210_GPG1(0), 2,
59 S3C_GPIO_SFN(2), S3C_GPIO_PULL_NONE);
61 /* Data pin GPG1[3:6] to special-function 2 */
62 s3c_gpio_cfgall_range(S5PV210_GPG1(3), 4,
63 S3C_GPIO_SFN(2), S3C_GPIO_PULL_NONE);
65 if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
66 s3c_gpio_setpull(S5PV210_GPG1(2), S3C_GPIO_PULL_UP);
67 s3c_gpio_cfgpin(S5PV210_GPG1(2), S3C_GPIO_SFN(2));
71 void s5pv210_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width)
73 struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
75 /* Set all the necessary GPG2[0:1] pins to special-function 2 */
76 s3c_gpio_cfgall_range(S5PV210_GPG2(0), 2,
77 S3C_GPIO_SFN(2), S3C_GPIO_PULL_NONE);
81 /* Data pin GPG3[3:6] to special-function 3 */
82 s3c_gpio_cfgall_range(S5PV210_GPG3(3), 4,
83 S3C_GPIO_SFN(3), S3C_GPIO_PULL_NONE);
85 /* Data pin GPG2[3:6] to special-function 2 */
86 s3c_gpio_cfgall_range(S5PV210_GPG2(3), 4,
87 S3C_GPIO_SFN(2), S3C_GPIO_PULL_NONE);
92 if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
93 s3c_gpio_setpull(S5PV210_GPG2(2), S3C_GPIO_PULL_UP);
94 s3c_gpio_cfgpin(S5PV210_GPG2(2), S3C_GPIO_SFN(2));
98 void s5pv210_setup_sdhci3_cfg_gpio(struct platform_device *dev, int width)
100 struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
102 /* Set all the necessary GPG3[0:1] pins to special-function 2 */
103 s3c_gpio_cfgall_range(S5PV210_GPG3(0), 2,
104 S3C_GPIO_SFN(2), S3C_GPIO_PULL_NONE);
106 /* Data pin GPG3[3:6] to special-function 2 */
107 s3c_gpio_cfgall_range(S5PV210_GPG3(3), 4,
108 S3C_GPIO_SFN(2), S3C_GPIO_PULL_NONE);
110 if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
111 s3c_gpio_setpull(S5PV210_GPG3(2), S3C_GPIO_PULL_UP);
112 s3c_gpio_cfgpin(S5PV210_GPG3(2), S3C_GPIO_SFN(2));