aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-s5p64x0/Kconfig24
-rw-r--r--arch/arm/mach-s5p64x0/Makefile1
-rw-r--r--arch/arm/mach-s5p64x0/cpu.c9
-rw-r--r--arch/arm/mach-s5p64x0/setup-sdhci-gpio.c104
-rw-r--r--arch/arm/plat-samsung/include/plat/sdhci.h44
5 files changed, 182 insertions, 0 deletions
diff --git a/arch/arm/mach-s5p64x0/Kconfig b/arch/arm/mach-s5p64x0/Kconfig
index dd8c85ef6dab..c87f6108eeb1 100644
--- a/arch/arm/mach-s5p64x0/Kconfig
+++ b/arch/arm/mach-s5p64x0/Kconfig
@@ -41,6 +41,11 @@ config S5P64X0_SETUP_SPI
41 help 41 help
42 Common setup code for SPI GPIO configurations 42 Common setup code for SPI GPIO configurations
43 43
44config S5P64X0_SETUP_SDHCI_GPIO
45 bool
46 help
47 Common setup code for SDHCI gpio.
48
44# machine support 49# machine support
45 50
46config MACH_SMDK6440 51config MACH_SMDK6440
@@ -50,12 +55,16 @@ config MACH_SMDK6440
50 select S3C_DEV_I2C1 55 select S3C_DEV_I2C1
51 select S3C_DEV_RTC 56 select S3C_DEV_RTC
52 select S3C_DEV_WDT 57 select S3C_DEV_WDT
58 select S3C_DEV_HSMMC
59 select S3C_DEV_HSMMC1
60 select S3C_DEV_HSMMC2
53 select SAMSUNG_DEV_ADC 61 select SAMSUNG_DEV_ADC
54 select SAMSUNG_DEV_BACKLIGHT 62 select SAMSUNG_DEV_BACKLIGHT
55 select SAMSUNG_DEV_PWM 63 select SAMSUNG_DEV_PWM
56 select SAMSUNG_DEV_TS 64 select SAMSUNG_DEV_TS
57 select S5P64X0_SETUP_FB_24BPP 65 select S5P64X0_SETUP_FB_24BPP
58 select S5P64X0_SETUP_I2C1 66 select S5P64X0_SETUP_I2C1
67 select S5P64X0_SETUP_SDHCI_GPIO
59 help 68 help
60 Machine support for the Samsung SMDK6440 69 Machine support for the Samsung SMDK6440
61 70
@@ -66,13 +75,28 @@ config MACH_SMDK6450
66 select S3C_DEV_I2C1 75 select S3C_DEV_I2C1
67 select S3C_DEV_RTC 76 select S3C_DEV_RTC
68 select S3C_DEV_WDT 77 select S3C_DEV_WDT
78 select S3C_DEV_HSMMC
79 select S3C_DEV_HSMMC1
80 select S3C_DEV_HSMMC2
69 select SAMSUNG_DEV_ADC 81 select SAMSUNG_DEV_ADC
70 select SAMSUNG_DEV_BACKLIGHT 82 select SAMSUNG_DEV_BACKLIGHT
71 select SAMSUNG_DEV_PWM 83 select SAMSUNG_DEV_PWM
72 select SAMSUNG_DEV_TS 84 select SAMSUNG_DEV_TS
73 select S5P64X0_SETUP_FB_24BPP 85 select S5P64X0_SETUP_FB_24BPP
74 select S5P64X0_SETUP_I2C1 86 select S5P64X0_SETUP_I2C1
87 select S5P64X0_SETUP_SDHCI_GPIO
75 help 88 help
76 Machine support for the Samsung SMDK6450 89 Machine support for the Samsung SMDK6450
77 90
91menu "Use 8-bit SDHCI bus width"
92
93config S5P64X0_SD_CH1_8BIT
94 bool "SDHCI Channel 1 (Slot 1)"
95 depends on MACH_SMDK6450 || MACH_SMDK6440
96 help
97 Support SDHCI Channel 1 8-bit bus.
98 If selected, Channel 2 is disabled.
99
100endmenu
101
78endif 102endif
diff --git a/arch/arm/mach-s5p64x0/Makefile b/arch/arm/mach-s5p64x0/Makefile
index a7d7a499d99e..b44cc044b3c3 100644
--- a/arch/arm/mach-s5p64x0/Makefile
+++ b/arch/arm/mach-s5p64x0/Makefile
@@ -30,3 +30,4 @@ obj-y += dev-audio.o
30obj-$(CONFIG_S5P64X0_SETUP_I2C1) += setup-i2c1.o 30obj-$(CONFIG_S5P64X0_SETUP_I2C1) += setup-i2c1.o
31obj-$(CONFIG_S5P64X0_SETUP_FB_24BPP) += setup-fb-24bpp.o 31obj-$(CONFIG_S5P64X0_SETUP_FB_24BPP) += setup-fb-24bpp.o
32obj-$(CONFIG_S5P64X0_SETUP_SPI) += setup-spi.o 32obj-$(CONFIG_S5P64X0_SETUP_SPI) += setup-spi.o
33obj-$(CONFIG_S5P64X0_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o
diff --git a/arch/arm/mach-s5p64x0/cpu.c b/arch/arm/mach-s5p64x0/cpu.c
index ecab40cf19ab..f6e24f3ef760 100644
--- a/arch/arm/mach-s5p64x0/cpu.c
+++ b/arch/arm/mach-s5p64x0/cpu.c
@@ -40,6 +40,7 @@
40#include <plat/s5p6450.h> 40#include <plat/s5p6450.h>
41#include <plat/adc-core.h> 41#include <plat/adc-core.h>
42#include <plat/fb-core.h> 42#include <plat/fb-core.h>
43#include <plat/sdhci.h>
43 44
44/* Initial IO mappings */ 45/* Initial IO mappings */
45 46
@@ -112,6 +113,10 @@ void __init s5p6440_map_io(void)
112 s3c_adc_setname("s3c64xx-adc"); 113 s3c_adc_setname("s3c64xx-adc");
113 s3c_fb_setname("s5p64x0-fb"); 114 s3c_fb_setname("s5p64x0-fb");
114 115
116 s5p64x0_default_sdhci0();
117 s5p64x0_default_sdhci1();
118 s5p6440_default_sdhci2();
119
115 iotable_init(s5p64x0_iodesc, ARRAY_SIZE(s5p64x0_iodesc)); 120 iotable_init(s5p64x0_iodesc, ARRAY_SIZE(s5p64x0_iodesc));
116 iotable_init(s5p6440_iodesc, ARRAY_SIZE(s5p6440_iodesc)); 121 iotable_init(s5p6440_iodesc, ARRAY_SIZE(s5p6440_iodesc));
117 init_consistent_dma_size(SZ_8M); 122 init_consistent_dma_size(SZ_8M);
@@ -123,6 +128,10 @@ void __init s5p6450_map_io(void)
123 s3c_adc_setname("s3c64xx-adc"); 128 s3c_adc_setname("s3c64xx-adc");
124 s3c_fb_setname("s5p64x0-fb"); 129 s3c_fb_setname("s5p64x0-fb");
125 130
131 s5p64x0_default_sdhci0();
132 s5p64x0_default_sdhci1();
133 s5p6450_default_sdhci2();
134
126 iotable_init(s5p64x0_iodesc, ARRAY_SIZE(s5p64x0_iodesc)); 135 iotable_init(s5p64x0_iodesc, ARRAY_SIZE(s5p64x0_iodesc));
127 iotable_init(s5p6450_iodesc, ARRAY_SIZE(s5p6450_iodesc)); 136 iotable_init(s5p6450_iodesc, ARRAY_SIZE(s5p6450_iodesc));
128 init_consistent_dma_size(SZ_8M); 137 init_consistent_dma_size(SZ_8M);
diff --git a/arch/arm/mach-s5p64x0/setup-sdhci-gpio.c b/arch/arm/mach-s5p64x0/setup-sdhci-gpio.c
new file mode 100644
index 000000000000..8410af0d12bf
--- /dev/null
+++ b/arch/arm/mach-s5p64x0/setup-sdhci-gpio.c
@@ -0,0 +1,104 @@
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
24void s5p64x0_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
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()) {
39 s3c_gpio_setpull(S5P6450_GPG(6), S3C_GPIO_PULL_UP);
40 s3c_gpio_cfgpin(S5P6450_GPG(6), S3C_GPIO_SFN(2));
41 } else {
42 s3c_gpio_setpull(S5P6440_GPG(6), S3C_GPIO_PULL_UP);
43 s3c_gpio_cfgpin(S5P6440_GPG(6), S3C_GPIO_SFN(2));
44 }
45 }
46}
47
48void s5p64x0_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width)
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()) {
82 s3c_gpio_setpull(S5P6450_GPG(6), S3C_GPIO_PULL_UP);
83 s3c_gpio_cfgpin(S5P6450_GPG(6), S3C_GPIO_SFN(3));
84 } else {
85 s3c_gpio_setpull(S5P6440_GPG(6), S3C_GPIO_PULL_UP);
86 s3c_gpio_cfgpin(S5P6440_GPG(6), S3C_GPIO_SFN(3));
87 }
88 }
89}
90
91void s5p6440_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width)
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
100void s5p6450_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width)
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}
diff --git a/arch/arm/plat-samsung/include/plat/sdhci.h b/arch/arm/plat-samsung/include/plat/sdhci.h
index dcff7dd1ae8a..656dc00d30ed 100644
--- a/arch/arm/plat-samsung/include/plat/sdhci.h
+++ b/arch/arm/plat-samsung/include/plat/sdhci.h
@@ -123,6 +123,10 @@ extern void exynos4_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
123extern void exynos4_setup_sdhci1_cfg_gpio(struct platform_device *, int w); 123extern void exynos4_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
124extern void exynos4_setup_sdhci2_cfg_gpio(struct platform_device *, int w); 124extern void exynos4_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
125extern void exynos4_setup_sdhci3_cfg_gpio(struct platform_device *, int w); 125extern void exynos4_setup_sdhci3_cfg_gpio(struct platform_device *, int w);
126extern void s5p64x0_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
127extern void s5p64x0_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
128extern void s5p6440_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
129extern void s5p6450_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
126 130
127/* S3C2416 SDHCI setup */ 131/* S3C2416 SDHCI setup */
128 132
@@ -146,6 +150,7 @@ static inline void s3c2416_default_sdhci0(void) { }
146static inline void s3c2416_default_sdhci1(void) { } 150static inline void s3c2416_default_sdhci1(void) { }
147 151
148#endif /* CONFIG_S3C2416_SETUP_SDHCI */ 152#endif /* CONFIG_S3C2416_SETUP_SDHCI */
153
149/* S3C64XX SDHCI setup */ 154/* S3C64XX SDHCI setup */
150 155
151#ifdef CONFIG_S3C64XX_SETUP_SDHCI 156#ifdef CONFIG_S3C64XX_SETUP_SDHCI
@@ -201,6 +206,45 @@ static inline void s3c6400_default_sdhci2(void) { }
201 206
202#endif /* CONFIG_S3C64XX_SETUP_SDHCI */ 207#endif /* CONFIG_S3C64XX_SETUP_SDHCI */
203 208
209/* S5P64X0 SDHCI setup */
210
211#ifdef CONFIG_S5P64X0_SETUP_SDHCI
212static inline void s5p64x0_default_sdhci0(void)
213{
214#ifdef CONFIG_S3C_DEV_HSMMC
215 s3c_hsmmc0_def_platdata.cfg_gpio = s5p64x0_setup_sdhci0_cfg_gpio;
216#endif
217}
218
219static inline void s5p64x0_default_sdhci1(void)
220{
221#ifdef CONFIG_S3C_DEV_HSMMC1
222 s3c_hsmmc1_def_platdata.cfg_gpio = s5p64x0_setup_sdhci1_cfg_gpio;
223#endif
224}
225
226static inline void s5p6440_default_sdhci2(void)
227{
228#ifdef CONFIG_S3C_DEV_HSMMC2
229 s3c_hsmmc2_def_platdata.cfg_gpio = s5p6440_setup_sdhci2_cfg_gpio;
230#endif
231}
232
233static inline void s5p6450_default_sdhci2(void)
234{
235#ifdef CONFIG_S3C_DEV_HSMMC2
236 s3c_hsmmc2_def_platdata.cfg_gpio = s5p6450_setup_sdhci2_cfg_gpio;
237#endif
238}
239
240#else
241static inline void s5p64x0_default_sdhci0(void) { }
242static inline void s5p64x0_default_sdhci1(void) { }
243static inline void s5p6440_default_sdhci2(void) { }
244static inline void s5p6450_default_sdhci2(void) { }
245
246#endif /* CONFIG_S5P64X0_SETUP_SDHCI */
247
204/* S5PC100 SDHCI setup */ 248/* S5PC100 SDHCI setup */
205 249
206#ifdef CONFIG_S5PC100_SETUP_SDHCI 250#ifdef CONFIG_S5PC100_SETUP_SDHCI