diff options
author | Kyungmin Park <kyungmin.park@samsung.com> | 2009-11-17 02:41:23 -0500 |
---|---|---|
committer | Ben Dooks <ben-linux@fluff.org> | 2009-11-30 20:33:17 -0500 |
commit | 86cd4f5f83acbfa481c513c74666ad360b49d73b (patch) | |
tree | fadf026dc26dc06b7d6fc3d8405aa96795db23e9 /arch/arm/plat-s5pc1xx | |
parent | 067f131d09d89bd56864f1f4b3144cc778024b33 (diff) |
ARM: S5PC1xx: add platform helpers for SDHCI host controllers
Samsung S5PC100 has 3 SDHCI controllers compatible with the one known from
previous SoCs series. Add required platform setup and support code that
the devices can be used with sdhci-s3c driver.
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Diffstat (limited to 'arch/arm/plat-s5pc1xx')
-rw-r--r-- | arch/arm/plat-s5pc1xx/Kconfig | 6 | ||||
-rw-r--r-- | arch/arm/plat-s5pc1xx/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/plat-s5pc1xx/setup-sdhci-gpio.c | 86 |
3 files changed, 93 insertions, 0 deletions
diff --git a/arch/arm/plat-s5pc1xx/Kconfig b/arch/arm/plat-s5pc1xx/Kconfig index 1fc25b9f2242..1608e62b0c9d 100644 --- a/arch/arm/plat-s5pc1xx/Kconfig +++ b/arch/arm/plat-s5pc1xx/Kconfig | |||
@@ -55,4 +55,10 @@ config S5PC1XX_SETUP_I2C1 | |||
55 | bool | 55 | bool |
56 | help | 56 | help |
57 | Common setup code for i2c bus 1. | 57 | Common setup code for i2c bus 1. |
58 | |||
59 | config S5PC1XX_SETUP_SDHCI_GPIO | ||
60 | bool | ||
61 | help | ||
62 | Common setup code for SDHCI gpio. | ||
63 | |||
58 | endif | 64 | endif |
diff --git a/arch/arm/plat-s5pc1xx/Makefile b/arch/arm/plat-s5pc1xx/Makefile index 40ee9571fb01..278f26806089 100644 --- a/arch/arm/plat-s5pc1xx/Makefile +++ b/arch/arm/plat-s5pc1xx/Makefile | |||
@@ -28,3 +28,4 @@ obj-$(CONFIG_S5P_GPIO_CFG_S5PC1XX) += gpio-config.o | |||
28 | obj-$(CONFIG_S5PC1XX_SETUP_FB_24BPP) += setup-fb-24bpp.o | 28 | obj-$(CONFIG_S5PC1XX_SETUP_FB_24BPP) += setup-fb-24bpp.o |
29 | obj-$(CONFIG_S5PC1XX_SETUP_I2C0) += setup-i2c0.o | 29 | obj-$(CONFIG_S5PC1XX_SETUP_I2C0) += setup-i2c0.o |
30 | obj-$(CONFIG_S5PC1XX_SETUP_I2C1) += setup-i2c1.o | 30 | obj-$(CONFIG_S5PC1XX_SETUP_I2C1) += setup-i2c1.o |
31 | obj-$(CONFIG_S5PC1XX_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o | ||
diff --git a/arch/arm/plat-s5pc1xx/setup-sdhci-gpio.c b/arch/arm/plat-s5pc1xx/setup-sdhci-gpio.c new file mode 100644 index 000000000000..185c8941e644 --- /dev/null +++ b/arch/arm/plat-s5pc1xx/setup-sdhci-gpio.c | |||
@@ -0,0 +1,86 @@ | |||
1 | /* linux/arch/arm/plat-s5pc1xx/setup-sdhci-gpio.c | ||
2 | * | ||
3 | * Copyright 2009 Samsung Eletronics | ||
4 | * | ||
5 | * S5PC1XX - Helper functions for setting up SDHCI device(s) GPIO (HSMMC) | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #include <linux/kernel.h> | ||
13 | #include <linux/types.h> | ||
14 | #include <linux/interrupt.h> | ||
15 | #include <linux/platform_device.h> | ||
16 | #include <linux/io.h> | ||
17 | #include <linux/gpio.h> | ||
18 | #include <linux/mmc/host.h> | ||
19 | #include <linux/mmc/card.h> | ||
20 | |||
21 | #include <plat/gpio-cfg.h> | ||
22 | #include <plat/regs-sdhci.h> | ||
23 | |||
24 | void s5pc100_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width) | ||
25 | { | ||
26 | unsigned int gpio; | ||
27 | unsigned int end; | ||
28 | unsigned int num; | ||
29 | |||
30 | num = width; | ||
31 | /* In case of 8 width, we should decrease the 2 */ | ||
32 | if (width == 8) | ||
33 | num = width - 2; | ||
34 | |||
35 | end = S5PC100_GPG0(2 + num); | ||
36 | |||
37 | /* Set all the necessary GPG0/GPG1 pins to special-function 0 */ | ||
38 | for (gpio = S5PC100_GPG0(0); gpio < end; gpio++) { | ||
39 | s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2)); | ||
40 | s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); | ||
41 | } | ||
42 | |||
43 | if (width == 8) { | ||
44 | for (gpio = S5PC100_GPG1(0); gpio <= S5PC100_GPG1(1); gpio++) { | ||
45 | s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2)); | ||
46 | s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); | ||
47 | } | ||
48 | } | ||
49 | |||
50 | s3c_gpio_setpull(S5PC100_GPG1(2), S3C_GPIO_PULL_UP); | ||
51 | s3c_gpio_cfgpin(S5PC100_GPG1(2), S3C_GPIO_SFN(2)); | ||
52 | } | ||
53 | |||
54 | void s5pc100_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width) | ||
55 | { | ||
56 | unsigned int gpio; | ||
57 | unsigned int end; | ||
58 | |||
59 | end = S5PC100_GPG2(2 + width); | ||
60 | |||
61 | /* Set all the necessary GPG2 pins to special-function 2 */ | ||
62 | for (gpio = S5PC100_GPG2(0); gpio < end; gpio++) { | ||
63 | s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2)); | ||
64 | s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); | ||
65 | } | ||
66 | |||
67 | s3c_gpio_setpull(S5PC100_GPG2(6), S3C_GPIO_PULL_UP); | ||
68 | s3c_gpio_cfgpin(S5PC100_GPG2(6), S3C_GPIO_SFN(2)); | ||
69 | } | ||
70 | |||
71 | void s5pc100_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width) | ||
72 | { | ||
73 | unsigned int gpio; | ||
74 | unsigned int end; | ||
75 | |||
76 | end = S5PC100_GPG3(2 + width); | ||
77 | |||
78 | /* Set all the necessary GPG3 pins to special-function 2 */ | ||
79 | for (gpio = S5PC100_GPG3(0); gpio < end; gpio++) { | ||
80 | s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2)); | ||
81 | s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); | ||
82 | } | ||
83 | |||
84 | s3c_gpio_setpull(S5PC100_GPG3(6), S3C_GPIO_PULL_UP); | ||
85 | s3c_gpio_cfgpin(S5PC100_GPG3(6), S3C_GPIO_SFN(2)); | ||
86 | } | ||