1 /* linux/arch/arm/mach-s5p64x0/setup-sdhci-gpio.c
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
6 * S5P64X0 - 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/platform_device.h>
15 #include <linux/gpio.h>
17 #include <mach/regs-gpio.h>
18 #include <mach/regs-clock.h>
20 #include <plat/gpio-cfg.h>
21 #include <plat/sdhci.h>
24 void s5p64x0_setup_sdhci0_cfg_gpio(struct platform_device
*dev
, int width
)
26 struct s3c_sdhci_platdata
*pdata
= dev
->dev
.platform_data
;
28 /* Set all the necessary GPG pins to special-function 2 */
30 s3c_gpio_cfgrange_nopull(S5P6450_GPG(0), 2 + width
,
33 s3c_gpio_cfgrange_nopull(S5P6440_GPG(0), 2 + width
,
36 /* Set GPG[6] pin to special-function 2 - MMC0 CDn */
37 if (pdata
->cd_type
== S3C_SDHCI_CD_INTERNAL
) {
38 if (soc_is_s5p6450()) {
39 s3c_gpio_setpull(S5P6450_GPG(6), S3C_GPIO_PULL_UP
);
40 s3c_gpio_cfgpin(S5P6450_GPG(6), S3C_GPIO_SFN(2));
42 s3c_gpio_setpull(S5P6440_GPG(6), S3C_GPIO_PULL_UP
);
43 s3c_gpio_cfgpin(S5P6440_GPG(6), S3C_GPIO_SFN(2));
48 void s5p64x0_setup_sdhci1_cfg_gpio(struct platform_device
*dev
, int width
)
50 struct s3c_sdhci_platdata
*pdata
= dev
->dev
.platform_data
;
52 /* Set GPH[0:1] pins to special-function 2 - CLK and CMD */
54 s3c_gpio_cfgrange_nopull(S5P6450_GPH(0), 2, S3C_GPIO_SFN(2));
56 s3c_gpio_cfgrange_nopull(S5P6440_GPH(0), 2 , S3C_GPIO_SFN(2));
60 /* Set data pins GPH[6:9] special-function 2 */
62 s3c_gpio_cfgrange_nopull(S5P6450_GPH(6), 4,
65 s3c_gpio_cfgrange_nopull(S5P6440_GPH(6), 4,
68 /* set data pins GPH[2:5] special-function 2 */
70 s3c_gpio_cfgrange_nopull(S5P6450_GPH(2), 4,
73 s3c_gpio_cfgrange_nopull(S5P6440_GPH(2), 4,
79 /* Set GPG[6] pin to special-funtion 3 : MMC1 CDn */
80 if (pdata
->cd_type
== S3C_SDHCI_CD_INTERNAL
) {
81 if (soc_is_s5p6450()) {
82 s3c_gpio_setpull(S5P6450_GPG(6), S3C_GPIO_PULL_UP
);
83 s3c_gpio_cfgpin(S5P6450_GPG(6), S3C_GPIO_SFN(3));
85 s3c_gpio_setpull(S5P6440_GPG(6), S3C_GPIO_PULL_UP
);
86 s3c_gpio_cfgpin(S5P6440_GPG(6), S3C_GPIO_SFN(3));
91 void s5p6440_setup_sdhci2_cfg_gpio(struct platform_device
*dev
, int width
)
93 /* Set GPC[4:5] pins to special-function 3 - CLK and CMD */
94 s3c_gpio_cfgrange_nopull(S5P6440_GPC(4), 2, S3C_GPIO_SFN(3));
96 /* Set data pins GPH[6:9] pins to special-function 3 */
97 s3c_gpio_cfgrange_nopull(S5P6440_GPH(6), 4, S3C_GPIO_SFN(3));
100 void s5p6450_setup_sdhci2_cfg_gpio(struct platform_device
*dev
, int width
)
102 /* Set all the necessary GPG pins to special-function 3 */
103 s3c_gpio_cfgrange_nopull(S5P6450_GPG(7), 2 + width
, S3C_GPIO_SFN(3));