aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-samsung
diff options
context:
space:
mode:
authorMarek Szyprowski <m.szyprowski@samsung.com>2010-07-22 20:27:18 -0400
committerKukjin Kim <kgene.kim@samsung.com>2010-08-05 05:32:50 -0400
commit19206b174222f0ffef025fe53c9fbd4ab536fcfb (patch)
tree0a5e596b2f641006c7be75d9c9be6afbf0ba520c /arch/arm/plat-samsung
parentb3c674bc7f3efdcfcd773566639fbf34ffcbefb7 (diff)
ARM: SAMSUNG: Add new s3c-sdhci card detection methods for Samsung SoCs
On some Samsung SoCs not all SDHCI controllers have card detect (CD) line. For some embedded designs it is not even needed, because ususally the device (like SDIO flash memory or wifi controller) is permanently wired to the controller. There are also systems which have a card detect line connected to some of the external interrupt lines or the presence of the card depends on some other actions (like enabling a power regulator). This patch adds all required changes to platform support code, so another patch, which extends the driver with support for the new card detection methods can be applied. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> [kgene.kim@samsung.com: minor title and coding-style fixes] [kgene.kim@samsung.com: fix build errors] Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Diffstat (limited to 'arch/arm/plat-samsung')
-rw-r--r--arch/arm/plat-samsung/dev-hsmmc.c5
-rw-r--r--arch/arm/plat-samsung/dev-hsmmc1.c5
-rw-r--r--arch/arm/plat-samsung/dev-hsmmc2.c5
-rw-r--r--arch/arm/plat-samsung/dev-hsmmc3.c5
-rw-r--r--arch/arm/plat-samsung/include/plat/sdhci.h29
5 files changed, 49 insertions, 0 deletions
diff --git a/arch/arm/plat-samsung/dev-hsmmc.c b/arch/arm/plat-samsung/dev-hsmmc.c
index 4c05b39810e2..b0f93f11e281 100644
--- a/arch/arm/plat-samsung/dev-hsmmc.c
+++ b/arch/arm/plat-samsung/dev-hsmmc.c
@@ -60,6 +60,11 @@ void s3c_sdhci0_set_platdata(struct s3c_sdhci_platdata *pd)
60 struct s3c_sdhci_platdata *set = &s3c_hsmmc0_def_platdata; 60 struct s3c_sdhci_platdata *set = &s3c_hsmmc0_def_platdata;
61 61
62 set->max_width = pd->max_width; 62 set->max_width = pd->max_width;
63 set->cd_type = pd->cd_type;
64 set->ext_cd_init = pd->ext_cd_init;
65 set->ext_cd_cleanup = pd->ext_cd_cleanup;
66 set->ext_cd_gpio = pd->ext_cd_gpio;
67 set->ext_cd_gpio_invert = pd->ext_cd_gpio_invert;
63 68
64 if (pd->cfg_gpio) 69 if (pd->cfg_gpio)
65 set->cfg_gpio = pd->cfg_gpio; 70 set->cfg_gpio = pd->cfg_gpio;
diff --git a/arch/arm/plat-samsung/dev-hsmmc1.c b/arch/arm/plat-samsung/dev-hsmmc1.c
index e49bc4cd0ee6..1504fd802865 100644
--- a/arch/arm/plat-samsung/dev-hsmmc1.c
+++ b/arch/arm/plat-samsung/dev-hsmmc1.c
@@ -60,6 +60,11 @@ void s3c_sdhci1_set_platdata(struct s3c_sdhci_platdata *pd)
60 struct s3c_sdhci_platdata *set = &s3c_hsmmc1_def_platdata; 60 struct s3c_sdhci_platdata *set = &s3c_hsmmc1_def_platdata;
61 61
62 set->max_width = pd->max_width; 62 set->max_width = pd->max_width;
63 set->cd_type = pd->cd_type;
64 set->ext_cd_init = pd->ext_cd_init;
65 set->ext_cd_cleanup = pd->ext_cd_cleanup;
66 set->ext_cd_gpio = pd->ext_cd_gpio;
67 set->ext_cd_gpio_invert = pd->ext_cd_gpio_invert;
63 68
64 if (pd->cfg_gpio) 69 if (pd->cfg_gpio)
65 set->cfg_gpio = pd->cfg_gpio; 70 set->cfg_gpio = pd->cfg_gpio;
diff --git a/arch/arm/plat-samsung/dev-hsmmc2.c b/arch/arm/plat-samsung/dev-hsmmc2.c
index 824580bc0e06..b28ef173444d 100644
--- a/arch/arm/plat-samsung/dev-hsmmc2.c
+++ b/arch/arm/plat-samsung/dev-hsmmc2.c
@@ -61,6 +61,11 @@ void s3c_sdhci2_set_platdata(struct s3c_sdhci_platdata *pd)
61 struct s3c_sdhci_platdata *set = &s3c_hsmmc2_def_platdata; 61 struct s3c_sdhci_platdata *set = &s3c_hsmmc2_def_platdata;
62 62
63 set->max_width = pd->max_width; 63 set->max_width = pd->max_width;
64 set->cd_type = pd->cd_type;
65 set->ext_cd_init = pd->ext_cd_init;
66 set->ext_cd_cleanup = pd->ext_cd_cleanup;
67 set->ext_cd_gpio = pd->ext_cd_gpio;
68 set->ext_cd_gpio_invert = pd->ext_cd_gpio_invert;
64 69
65 if (pd->cfg_gpio) 70 if (pd->cfg_gpio)
66 set->cfg_gpio = pd->cfg_gpio; 71 set->cfg_gpio = pd->cfg_gpio;
diff --git a/arch/arm/plat-samsung/dev-hsmmc3.c b/arch/arm/plat-samsung/dev-hsmmc3.c
index 57bd394123cd..85aaf0f2842f 100644
--- a/arch/arm/plat-samsung/dev-hsmmc3.c
+++ b/arch/arm/plat-samsung/dev-hsmmc3.c
@@ -64,6 +64,11 @@ void s3c_sdhci3_set_platdata(struct s3c_sdhci_platdata *pd)
64 struct s3c_sdhci_platdata *set = &s3c_hsmmc3_def_platdata; 64 struct s3c_sdhci_platdata *set = &s3c_hsmmc3_def_platdata;
65 65
66 set->max_width = pd->max_width; 66 set->max_width = pd->max_width;
67 set->cd_type = pd->cd_type;
68 set->ext_cd_init = pd->ext_cd_init;
69 set->ext_cd_cleanup = pd->ext_cd_cleanup;
70 set->ext_cd_gpio = pd->ext_cd_gpio;
71 set->ext_cd_gpio_invert = pd->ext_cd_gpio_invert;
67 72
68 if (pd->cfg_gpio) 73 if (pd->cfg_gpio)
69 set->cfg_gpio = pd->cfg_gpio; 74 set->cfg_gpio = pd->cfg_gpio;
diff --git a/arch/arm/plat-samsung/include/plat/sdhci.h b/arch/arm/plat-samsung/include/plat/sdhci.h
index 3994a875473b..3880cc736a98 100644
--- a/arch/arm/plat-samsung/include/plat/sdhci.h
+++ b/arch/arm/plat-samsung/include/plat/sdhci.h
@@ -20,10 +20,31 @@ struct mmc_host;
20struct mmc_card; 20struct mmc_card;
21struct mmc_ios; 21struct mmc_ios;
22 22
23enum cd_types {
24 S3C_SDHCI_CD_INTERNAL, /* use mmc internal CD line */
25 S3C_SDHCI_CD_EXTERNAL, /* use external callback */
26 S3C_SDHCI_CD_GPIO, /* use external gpio pin for CD line */
27 S3C_SDHCI_CD_NONE, /* no CD line, use polling to detect card */
28 S3C_SDHCI_CD_PERMANENT, /* no CD line, card permanently wired to host */
29};
30
23/** 31/**
24 * struct s3c_sdhci_platdata() - Platform device data for Samsung SDHCI 32 * struct s3c_sdhci_platdata() - Platform device data for Samsung SDHCI
25 * @max_width: The maximum number of data bits supported. 33 * @max_width: The maximum number of data bits supported.
26 * @host_caps: Standard MMC host capabilities bit field. 34 * @host_caps: Standard MMC host capabilities bit field.
35 * @cd_type: Type of Card Detection method (see cd_types enum above)
36 * @ext_cd_init: Initialize external card detect subsystem. Called on
37 * sdhci-s3c driver probe when cd_type == S3C_SDHCI_CD_EXTERNAL.
38 * notify_func argument is a callback to the sdhci-s3c driver
39 * that triggers the card detection event. Callback arguments:
40 * dev is pointer to platform device of the host controller,
41 * state is new state of the card (0 - removed, 1 - inserted).
42 * @ext_cd_cleanup: Cleanup external card detect subsystem. Called on
43 * sdhci-s3c driver remove when cd_type == S3C_SDHCI_CD_EXTERNAL.
44 * notify_func argument is the same callback as for ext_cd_init.
45 * @ext_cd_gpio: gpio pin used for external CD line, valid only if
46 * cd_type == S3C_SDHCI_CD_GPIO
47 * @ext_cd_gpio_invert: invert values for external CD gpio line
27 * @cfg_gpio: Configure the GPIO for a specific card bit-width 48 * @cfg_gpio: Configure the GPIO for a specific card bit-width
28 * @cfg_card: Configure the interface for a specific card and speed. This 49 * @cfg_card: Configure the interface for a specific card and speed. This
29 * is necessary the controllers and/or GPIO blocks require the 50 * is necessary the controllers and/or GPIO blocks require the
@@ -37,9 +58,17 @@ struct mmc_ios;
37struct s3c_sdhci_platdata { 58struct s3c_sdhci_platdata {
38 unsigned int max_width; 59 unsigned int max_width;
39 unsigned int host_caps; 60 unsigned int host_caps;
61 enum cd_types cd_type;
40 62
41 char **clocks; /* set of clock sources */ 63 char **clocks; /* set of clock sources */
42 64
65 int ext_cd_gpio;
66 bool ext_cd_gpio_invert;
67 int (*ext_cd_init)(void (*notify_func)(struct platform_device *,
68 int state));
69 int (*ext_cd_cleanup)(void (*notify_func)(struct platform_device *,
70 int state));
71
43 void (*cfg_gpio)(struct platform_device *dev, int width); 72 void (*cfg_gpio)(struct platform_device *dev, int width);
44 void (*cfg_card)(struct platform_device *dev, 73 void (*cfg_card)(struct platform_device *dev,
45 void __iomem *regbase, 74 void __iomem *regbase,