diff options
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-s3c64xx/setup-sdhci-gpio.c | 15 | ||||
-rw-r--r-- | arch/arm/mach-s5pc100/setup-sdhci-gpio.c | 22 | ||||
-rw-r--r-- | arch/arm/mach-s5pv210/setup-sdhci-gpio.c | 22 | ||||
-rw-r--r-- | arch/arm/plat-samsung/dev-hsmmc.c | 5 | ||||
-rw-r--r-- | arch/arm/plat-samsung/dev-hsmmc1.c | 5 | ||||
-rw-r--r-- | arch/arm/plat-samsung/dev-hsmmc2.c | 5 | ||||
-rw-r--r-- | arch/arm/plat-samsung/dev-hsmmc3.c | 5 | ||||
-rw-r--r-- | arch/arm/plat-samsung/include/plat/sdhci.h | 29 |
8 files changed, 92 insertions, 16 deletions
diff --git a/arch/arm/mach-s3c64xx/setup-sdhci-gpio.c b/arch/arm/mach-s3c64xx/setup-sdhci-gpio.c index a58c0cc7ba5e..4a42ede99025 100644 --- a/arch/arm/mach-s3c64xx/setup-sdhci-gpio.c +++ b/arch/arm/mach-s3c64xx/setup-sdhci-gpio.c | |||
@@ -19,9 +19,11 @@ | |||
19 | 19 | ||
20 | #include <mach/gpio.h> | 20 | #include <mach/gpio.h> |
21 | #include <plat/gpio-cfg.h> | 21 | #include <plat/gpio-cfg.h> |
22 | #include <plat/sdhci.h> | ||
22 | 23 | ||
23 | void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width) | 24 | void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width) |
24 | { | 25 | { |
26 | struct s3c_sdhci_platdata *pdata = dev->dev.platform_data; | ||
25 | unsigned int gpio; | 27 | unsigned int gpio; |
26 | unsigned int end; | 28 | unsigned int end; |
27 | 29 | ||
@@ -33,12 +35,15 @@ void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width) | |||
33 | s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); | 35 | s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); |
34 | } | 36 | } |
35 | 37 | ||
36 | s3c_gpio_setpull(S3C64XX_GPG(6), S3C_GPIO_PULL_UP); | 38 | if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) { |
37 | s3c_gpio_cfgpin(S3C64XX_GPG(6), S3C_GPIO_SFN(2)); | 39 | s3c_gpio_setpull(S3C64XX_GPG(6), S3C_GPIO_PULL_UP); |
40 | s3c_gpio_cfgpin(S3C64XX_GPG(6), S3C_GPIO_SFN(2)); | ||
41 | } | ||
38 | } | 42 | } |
39 | 43 | ||
40 | void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width) | 44 | void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width) |
41 | { | 45 | { |
46 | struct s3c_sdhci_platdata *pdata = dev->dev.platform_data; | ||
42 | unsigned int gpio; | 47 | unsigned int gpio; |
43 | unsigned int end; | 48 | unsigned int end; |
44 | 49 | ||
@@ -50,8 +55,10 @@ void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width) | |||
50 | s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); | 55 | s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); |
51 | } | 56 | } |
52 | 57 | ||
53 | s3c_gpio_setpull(S3C64XX_GPG(6), S3C_GPIO_PULL_UP); | 58 | if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) { |
54 | s3c_gpio_cfgpin(S3C64XX_GPG(6), S3C_GPIO_SFN(3)); | 59 | s3c_gpio_setpull(S3C64XX_GPG(6), S3C_GPIO_PULL_UP); |
60 | s3c_gpio_cfgpin(S3C64XX_GPG(6), S3C_GPIO_SFN(3)); | ||
61 | } | ||
55 | } | 62 | } |
56 | 63 | ||
57 | void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width) | 64 | void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width) |
diff --git a/arch/arm/mach-s5pc100/setup-sdhci-gpio.c b/arch/arm/mach-s5pc100/setup-sdhci-gpio.c index 7769c760c9ef..dc7208c639ea 100644 --- a/arch/arm/mach-s5pc100/setup-sdhci-gpio.c +++ b/arch/arm/mach-s5pc100/setup-sdhci-gpio.c | |||
@@ -20,9 +20,11 @@ | |||
20 | 20 | ||
21 | #include <plat/gpio-cfg.h> | 21 | #include <plat/gpio-cfg.h> |
22 | #include <plat/regs-sdhci.h> | 22 | #include <plat/regs-sdhci.h> |
23 | #include <plat/sdhci.h> | ||
23 | 24 | ||
24 | void s5pc100_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width) | 25 | void s5pc100_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width) |
25 | { | 26 | { |
27 | struct s3c_sdhci_platdata *pdata = dev->dev.platform_data; | ||
26 | unsigned int gpio; | 28 | unsigned int gpio; |
27 | unsigned int end; | 29 | unsigned int end; |
28 | unsigned int num; | 30 | unsigned int num; |
@@ -47,12 +49,15 @@ void s5pc100_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width) | |||
47 | } | 49 | } |
48 | } | 50 | } |
49 | 51 | ||
50 | s3c_gpio_setpull(S5PC100_GPG1(2), S3C_GPIO_PULL_UP); | 52 | if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) { |
51 | s3c_gpio_cfgpin(S5PC100_GPG1(2), S3C_GPIO_SFN(2)); | 53 | s3c_gpio_setpull(S5PC100_GPG1(2), S3C_GPIO_PULL_UP); |
54 | s3c_gpio_cfgpin(S5PC100_GPG1(2), S3C_GPIO_SFN(2)); | ||
55 | } | ||
52 | } | 56 | } |
53 | 57 | ||
54 | void s5pc100_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width) | 58 | void s5pc100_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width) |
55 | { | 59 | { |
60 | struct s3c_sdhci_platdata *pdata = dev->dev.platform_data; | ||
56 | unsigned int gpio; | 61 | unsigned int gpio; |
57 | unsigned int end; | 62 | unsigned int end; |
58 | 63 | ||
@@ -64,12 +69,15 @@ void s5pc100_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width) | |||
64 | s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); | 69 | s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); |
65 | } | 70 | } |
66 | 71 | ||
67 | s3c_gpio_setpull(S5PC100_GPG2(6), S3C_GPIO_PULL_UP); | 72 | if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) { |
68 | s3c_gpio_cfgpin(S5PC100_GPG2(6), S3C_GPIO_SFN(2)); | 73 | s3c_gpio_setpull(S5PC100_GPG2(6), S3C_GPIO_PULL_UP); |
74 | s3c_gpio_cfgpin(S5PC100_GPG2(6), S3C_GPIO_SFN(2)); | ||
75 | } | ||
69 | } | 76 | } |
70 | 77 | ||
71 | void s5pc100_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width) | 78 | void s5pc100_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width) |
72 | { | 79 | { |
80 | struct s3c_sdhci_platdata *pdata = dev->dev.platform_data; | ||
73 | unsigned int gpio; | 81 | unsigned int gpio; |
74 | unsigned int end; | 82 | unsigned int end; |
75 | 83 | ||
@@ -81,6 +89,8 @@ void s5pc100_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width) | |||
81 | s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); | 89 | s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); |
82 | } | 90 | } |
83 | 91 | ||
84 | s3c_gpio_setpull(S5PC100_GPG3(6), S3C_GPIO_PULL_UP); | 92 | if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) { |
85 | s3c_gpio_cfgpin(S5PC100_GPG3(6), S3C_GPIO_SFN(2)); | 93 | s3c_gpio_setpull(S5PC100_GPG3(6), S3C_GPIO_PULL_UP); |
94 | s3c_gpio_cfgpin(S5PC100_GPG3(6), S3C_GPIO_SFN(2)); | ||
95 | } | ||
86 | } | 96 | } |
diff --git a/arch/arm/mach-s5pv210/setup-sdhci-gpio.c b/arch/arm/mach-s5pv210/setup-sdhci-gpio.c index fe7d86dad14c..b3ad2439e34b 100644 --- a/arch/arm/mach-s5pv210/setup-sdhci-gpio.c +++ b/arch/arm/mach-s5pv210/setup-sdhci-gpio.c | |||
@@ -21,9 +21,11 @@ | |||
21 | #include <mach/gpio.h> | 21 | #include <mach/gpio.h> |
22 | #include <plat/gpio-cfg.h> | 22 | #include <plat/gpio-cfg.h> |
23 | #include <plat/regs-sdhci.h> | 23 | #include <plat/regs-sdhci.h> |
24 | #include <plat/sdhci.h> | ||
24 | 25 | ||
25 | void s5pv210_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width) | 26 | void s5pv210_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width) |
26 | { | 27 | { |
28 | struct s3c_sdhci_platdata *pdata = dev->dev.platform_data; | ||
27 | unsigned int gpio; | 29 | unsigned int gpio; |
28 | 30 | ||
29 | /* Set all the necessary GPG0/GPG1 pins to special-function 2 */ | 31 | /* Set all the necessary GPG0/GPG1 pins to special-function 2 */ |
@@ -48,12 +50,15 @@ void s5pv210_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width) | |||
48 | break; | 50 | break; |
49 | } | 51 | } |
50 | 52 | ||
51 | s3c_gpio_setpull(S5PV210_GPG0(2), S3C_GPIO_PULL_UP); | 53 | if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) { |
52 | s3c_gpio_cfgpin(S5PV210_GPG0(2), S3C_GPIO_SFN(2)); | 54 | s3c_gpio_setpull(S5PV210_GPG0(2), S3C_GPIO_PULL_UP); |
55 | s3c_gpio_cfgpin(S5PV210_GPG0(2), S3C_GPIO_SFN(2)); | ||
56 | } | ||
53 | } | 57 | } |
54 | 58 | ||
55 | void s5pv210_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width) | 59 | void s5pv210_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width) |
56 | { | 60 | { |
61 | struct s3c_sdhci_platdata *pdata = dev->dev.platform_data; | ||
57 | unsigned int gpio; | 62 | unsigned int gpio; |
58 | 63 | ||
59 | /* Set all the necessary GPG1[0:1] pins to special-function 2 */ | 64 | /* Set all the necessary GPG1[0:1] pins to special-function 2 */ |
@@ -68,12 +73,15 @@ void s5pv210_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width) | |||
68 | s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); | 73 | s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); |
69 | } | 74 | } |
70 | 75 | ||
71 | s3c_gpio_setpull(S5PV210_GPG1(2), S3C_GPIO_PULL_UP); | 76 | if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) { |
72 | s3c_gpio_cfgpin(S5PV210_GPG1(2), S3C_GPIO_SFN(2)); | 77 | s3c_gpio_setpull(S5PV210_GPG1(2), S3C_GPIO_PULL_UP); |
78 | s3c_gpio_cfgpin(S5PV210_GPG1(2), S3C_GPIO_SFN(2)); | ||
79 | } | ||
73 | } | 80 | } |
74 | 81 | ||
75 | void s5pv210_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width) | 82 | void s5pv210_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width) |
76 | { | 83 | { |
84 | struct s3c_sdhci_platdata *pdata = dev->dev.platform_data; | ||
77 | unsigned int gpio; | 85 | unsigned int gpio; |
78 | 86 | ||
79 | /* Set all the necessary GPG2[0:1] pins to special-function 2 */ | 87 | /* Set all the necessary GPG2[0:1] pins to special-function 2 */ |
@@ -99,6 +107,8 @@ void s5pv210_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width) | |||
99 | break; | 107 | break; |
100 | } | 108 | } |
101 | 109 | ||
102 | s3c_gpio_setpull(S5PV210_GPG2(2), S3C_GPIO_PULL_UP); | 110 | if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) { |
103 | s3c_gpio_cfgpin(S5PV210_GPG2(2), S3C_GPIO_SFN(2)); | 111 | s3c_gpio_setpull(S5PV210_GPG2(2), S3C_GPIO_PULL_UP); |
112 | s3c_gpio_cfgpin(S5PV210_GPG2(2), S3C_GPIO_SFN(2)); | ||
113 | } | ||
104 | } | 114 | } |
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; | |||
20 | struct mmc_card; | 20 | struct mmc_card; |
21 | struct mmc_ios; | 21 | struct mmc_ios; |
22 | 22 | ||
23 | enum 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; | |||
37 | struct s3c_sdhci_platdata { | 58 | struct 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, |