Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
setup-sdhci-gpio.c
Go to the documentation of this file.
1 /* linux/arch/arm/mach-exynos4/setup-sdhci-gpio.c
2  *
3  * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
4  * http://www.samsung.com
5  *
6  * EXYNOS4 - 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/gpio.h>
19 #include <linux/mmc/host.h>
20 #include <linux/mmc/card.h>
21 
22 #include <plat/gpio-cfg.h>
23 #include <plat/regs-sdhci.h>
24 #include <plat/sdhci.h>
25 
27 {
28  struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
29  unsigned int gpio;
30 
31  /* Set all the necessary GPK0[0:1] pins to special-function 2 */
32  for (gpio = EXYNOS4_GPK0(0); gpio < EXYNOS4_GPK0(2); gpio++) {
33  s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
36  }
37 
38  switch (width) {
39  case 8:
40  for (gpio = EXYNOS4_GPK1(3); gpio <= EXYNOS4_GPK1(6); gpio++) {
41  /* Data pin GPK1[3:6] to special-function 3 */
42  s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
45  }
46  case 4:
47  for (gpio = EXYNOS4_GPK0(3); gpio <= EXYNOS4_GPK0(6); gpio++) {
48  /* Data pin GPK0[3:6] to special-function 2 */
49  s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
52  }
53  default:
54  break;
55  }
56 
57  if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
61  }
62 }
63 
65 {
66  struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
67  unsigned int gpio;
68 
69  /* Set all the necessary GPK1[0:1] pins to special-function 2 */
70  for (gpio = EXYNOS4_GPK1(0); gpio < EXYNOS4_GPK1(2); gpio++) {
71  s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
74  }
75 
76  for (gpio = EXYNOS4_GPK1(3); gpio <= EXYNOS4_GPK1(6); gpio++) {
77  /* Data pin GPK1[3:6] to special-function 2 */
78  s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
81  }
82 
83  if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
87  }
88 }
89 
91 {
92  struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
93  unsigned int gpio;
94 
95  /* Set all the necessary GPK2[0:1] pins to special-function 2 */
96  for (gpio = EXYNOS4_GPK2(0); gpio < EXYNOS4_GPK2(2); gpio++) {
97  s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
100  }
101 
102  switch (width) {
103  case 8:
104  for (gpio = EXYNOS4_GPK3(3); gpio <= EXYNOS4_GPK3(6); gpio++) {
105  /* Data pin GPK3[3:6] to special-function 3 */
106  s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
109  }
110  case 4:
111  for (gpio = EXYNOS4_GPK2(3); gpio <= EXYNOS4_GPK2(6); gpio++) {
112  /* Data pin GPK2[3:6] to special-function 2 */
113  s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
116  }
117  default:
118  break;
119  }
120 
121  if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
125  }
126 }
127 
129 {
130  struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
131  unsigned int gpio;
132 
133  /* Set all the necessary GPK3[0:1] pins to special-function 2 */
134  for (gpio = EXYNOS4_GPK3(0); gpio < EXYNOS4_GPK3(2); gpio++) {
135  s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
138  }
139 
140  for (gpio = EXYNOS4_GPK3(3); gpio <= EXYNOS4_GPK3(6); gpio++) {
141  /* Data pin GPK3[3:6] to special-function 2 */
142  s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
145  }
146 
147  if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
151  }
152 }