diff options
author | Ulf Hansson <ulf.hansson@stericsson.com> | 2011-12-13 10:57:55 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2012-01-19 19:00:56 -0500 |
commit | bc521818e28042bb6018d91c353d24fb01ccb162 (patch) | |
tree | e6ba5c3f5ae30dfb5e227ee92744c7491c8d3135 | |
parent | 4d1a3a0dc551cfa7304ca46e014231500f3b81a6 (diff) |
ARM: 7219/1: mmc: mmci: Change vdd_handler to a generic ios_handler
The purpose of the vdd_handler does not make sense. We remove it
and use a generic approach instead. A new ios_handler is added, the
purpose of which e.g. can be to control GPIO pins to a levelshifter.
Previously the vdd_handler was also used for making additional
changes to the power register bits. This option is superfluous and is
therefore removed.
Adaptaptions from the old vdd_handler to the new ios_handler is done for
mach-ux500 board, which was the only one using the vdd_handler.
This patch is based upon a patch from Sebastian Rasmussen.
Tested-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sebastian Rasmussen <sebastian.rasmussen@stericsson.com>
Signed-off-by: Ulf Hansson <ulf.hansson@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | arch/arm/mach-ux500/board-mop500-sdi.c | 21 | ||||
-rw-r--r-- | drivers/mmc/host/mmci.c | 8 | ||||
-rw-r--r-- | include/linux/amba/mmci.h | 6 |
3 files changed, 15 insertions, 20 deletions
diff --git a/arch/arm/mach-ux500/board-mop500-sdi.c b/arch/arm/mach-ux500/board-mop500-sdi.c index 23be34b3bb6e..4049bd7f061f 100644 --- a/arch/arm/mach-ux500/board-mop500-sdi.c +++ b/arch/arm/mach-ux500/board-mop500-sdi.c | |||
@@ -31,21 +31,13 @@ | |||
31 | * SDI 0 (MicroSD slot) | 31 | * SDI 0 (MicroSD slot) |
32 | */ | 32 | */ |
33 | 33 | ||
34 | /* MMCIPOWER bits */ | ||
35 | #define MCI_DATA2DIREN (1 << 2) | ||
36 | #define MCI_CMDDIREN (1 << 3) | ||
37 | #define MCI_DATA0DIREN (1 << 4) | ||
38 | #define MCI_DATA31DIREN (1 << 5) | ||
39 | #define MCI_FBCLKEN (1 << 7) | ||
40 | |||
41 | /* GPIO pins used by the sdi0 level shifter */ | 34 | /* GPIO pins used by the sdi0 level shifter */ |
42 | static int sdi0_en = -1; | 35 | static int sdi0_en = -1; |
43 | static int sdi0_vsel = -1; | 36 | static int sdi0_vsel = -1; |
44 | 37 | ||
45 | static u32 mop500_sdi0_vdd_handler(struct device *dev, unsigned int vdd, | 38 | static int mop500_sdi0_ios_handler(struct device *dev, struct mmc_ios *ios) |
46 | unsigned char power_mode) | ||
47 | { | 39 | { |
48 | switch (power_mode) { | 40 | switch (ios->power_mode) { |
49 | case MMC_POWER_UP: | 41 | case MMC_POWER_UP: |
50 | case MMC_POWER_ON: | 42 | case MMC_POWER_ON: |
51 | /* | 43 | /* |
@@ -65,8 +57,7 @@ static u32 mop500_sdi0_vdd_handler(struct device *dev, unsigned int vdd, | |||
65 | break; | 57 | break; |
66 | } | 58 | } |
67 | 59 | ||
68 | return MCI_FBCLKEN | MCI_CMDDIREN | MCI_DATA0DIREN | | 60 | return 0; |
69 | MCI_DATA2DIREN | MCI_DATA31DIREN; | ||
70 | } | 61 | } |
71 | 62 | ||
72 | #ifdef CONFIG_STE_DMA40 | 63 | #ifdef CONFIG_STE_DMA40 |
@@ -90,13 +81,17 @@ static struct stedma40_chan_cfg mop500_sdi0_dma_cfg_tx = { | |||
90 | #endif | 81 | #endif |
91 | 82 | ||
92 | static struct mmci_platform_data mop500_sdi0_data = { | 83 | static struct mmci_platform_data mop500_sdi0_data = { |
93 | .vdd_handler = mop500_sdi0_vdd_handler, | 84 | .ios_handler = mop500_sdi0_ios_handler, |
94 | .ocr_mask = MMC_VDD_29_30, | 85 | .ocr_mask = MMC_VDD_29_30, |
95 | .f_max = 50000000, | 86 | .f_max = 50000000, |
96 | .capabilities = MMC_CAP_4_BIT_DATA | | 87 | .capabilities = MMC_CAP_4_BIT_DATA | |
97 | MMC_CAP_SD_HIGHSPEED | | 88 | MMC_CAP_SD_HIGHSPEED | |
98 | MMC_CAP_MMC_HIGHSPEED, | 89 | MMC_CAP_MMC_HIGHSPEED, |
99 | .gpio_wp = -1, | 90 | .gpio_wp = -1, |
91 | .sigdir = MCI_ST_FBCLKEN | | ||
92 | MCI_ST_CMDDIREN | | ||
93 | MCI_ST_DATA0DIREN | | ||
94 | MCI_ST_DATA2DIREN, | ||
100 | #ifdef CONFIG_STE_DMA40 | 95 | #ifdef CONFIG_STE_DMA40 |
101 | .dma_filter = stedma40_filter, | 96 | .dma_filter = stedma40_filter, |
102 | .dma_rx_param = &mop500_sdi0_dma_cfg_rx, | 97 | .dma_rx_param = &mop500_sdi0_dma_cfg_rx, |
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index eb11ce61941d..0af1507d15c0 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c | |||
@@ -1026,6 +1026,10 @@ static void mmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
1026 | unsigned long flags; | 1026 | unsigned long flags; |
1027 | int ret; | 1027 | int ret; |
1028 | 1028 | ||
1029 | if (host->plat->ios_handler && | ||
1030 | host->plat->ios_handler(mmc_dev(mmc), ios)) | ||
1031 | dev_err(mmc_dev(mmc), "platform ios_handler failed\n"); | ||
1032 | |||
1029 | switch (ios->power_mode) { | 1033 | switch (ios->power_mode) { |
1030 | case MMC_POWER_OFF: | 1034 | case MMC_POWER_OFF: |
1031 | if (host->vcc) | 1035 | if (host->vcc) |
@@ -1045,10 +1049,6 @@ static void mmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
1045 | return; | 1049 | return; |
1046 | } | 1050 | } |
1047 | } | 1051 | } |
1048 | if (host->plat->vdd_handler) | ||
1049 | pwr |= host->plat->vdd_handler(mmc_dev(mmc), ios->vdd, | ||
1050 | ios->power_mode); | ||
1051 | |||
1052 | /* | 1052 | /* |
1053 | * The ST Micro variant doesn't have the PL180s MCI_PWR_UP | 1053 | * The ST Micro variant doesn't have the PL180s MCI_PWR_UP |
1054 | * and instead uses MCI_PWR_ON so apply whatever value is | 1054 | * and instead uses MCI_PWR_ON so apply whatever value is |
diff --git a/include/linux/amba/mmci.h b/include/linux/amba/mmci.h index b51bf5fa85f8..32a89cf5ec45 100644 --- a/include/linux/amba/mmci.h +++ b/include/linux/amba/mmci.h | |||
@@ -31,7 +31,8 @@ struct dma_chan; | |||
31 | * @ocr_mask: available voltages on the 4 pins from the block, this | 31 | * @ocr_mask: available voltages on the 4 pins from the block, this |
32 | * is ignored if a regulator is used, see the MMC_VDD_* masks in | 32 | * is ignored if a regulator is used, see the MMC_VDD_* masks in |
33 | * mmc/host.h | 33 | * mmc/host.h |
34 | * @vdd_handler: a callback function to translate a MMC_VDD_* | 34 | * @ios_handler: a callback function to act on specfic ios changes, |
35 | * used for example to control a levelshifter | ||
35 | * mask into a value to be binary (or set some other custom bits | 36 | * mask into a value to be binary (or set some other custom bits |
36 | * in MMCIPWR) or:ed and written into the MMCIPWR register of the | 37 | * in MMCIPWR) or:ed and written into the MMCIPWR register of the |
37 | * block. May also control external power based on the power_mode. | 38 | * block. May also control external power based on the power_mode. |
@@ -61,8 +62,7 @@ struct dma_chan; | |||
61 | struct mmci_platform_data { | 62 | struct mmci_platform_data { |
62 | unsigned int f_max; | 63 | unsigned int f_max; |
63 | unsigned int ocr_mask; | 64 | unsigned int ocr_mask; |
64 | u32 (*vdd_handler)(struct device *, unsigned int vdd, | 65 | int (*ios_handler)(struct device *, struct mmc_ios *); |
65 | unsigned char power_mode); | ||
66 | unsigned int (*status)(struct device *); | 66 | unsigned int (*status)(struct device *); |
67 | int gpio_wp; | 67 | int gpio_wp; |
68 | int gpio_cd; | 68 | int gpio_cd; |