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-s5p64x0/setup-sdhci-gpio.c
2  *
3  * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4  * http://www.samsung.com/
5  *
6  * S5P64X0 - 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/platform_device.h>
14 #include <linux/io.h>
15 #include <linux/gpio.h>
16 
17 #include <mach/regs-gpio.h>
18 #include <mach/regs-clock.h>
19 
20 #include <plat/gpio-cfg.h>
21 #include <plat/sdhci.h>
22 #include <plat/cpu.h>
23 
25 {
26  struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
27 
28  /* Set all the necessary GPG pins to special-function 2 */
29  if (soc_is_s5p6450())
30  s3c_gpio_cfgrange_nopull(S5P6450_GPG(0), 2 + width,
31  S3C_GPIO_SFN(2));
32  else
33  s3c_gpio_cfgrange_nopull(S5P6440_GPG(0), 2 + width,
34  S3C_GPIO_SFN(2));
35 
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()) {
41  } else {
44  }
45  }
46 }
47 
49 {
50  struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
51 
52  /* Set GPH[0:1] pins to special-function 2 - CLK and CMD */
53  if (soc_is_s5p6450())
54  s3c_gpio_cfgrange_nopull(S5P6450_GPH(0), 2, S3C_GPIO_SFN(2));
55  else
56  s3c_gpio_cfgrange_nopull(S5P6440_GPH(0), 2 , S3C_GPIO_SFN(2));
57 
58  switch (width) {
59  case 8:
60  /* Set data pins GPH[6:9] special-function 2 */
61  if (soc_is_s5p6450())
62  s3c_gpio_cfgrange_nopull(S5P6450_GPH(6), 4,
63  S3C_GPIO_SFN(2));
64  else
65  s3c_gpio_cfgrange_nopull(S5P6440_GPH(6), 4,
66  S3C_GPIO_SFN(2));
67  case 4:
68  /* set data pins GPH[2:5] special-function 2 */
69  if (soc_is_s5p6450())
70  s3c_gpio_cfgrange_nopull(S5P6450_GPH(2), 4,
71  S3C_GPIO_SFN(2));
72  else
73  s3c_gpio_cfgrange_nopull(S5P6440_GPH(2), 4,
74  S3C_GPIO_SFN(2));
75  default:
76  break;
77  }
78 
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()) {
84  } else {
87  }
88  }
89 }
90 
92 {
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));
95 
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));
98 }
99 
101 {
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));
104 }