diff options
author | Arindam Nath <arindam.nath@amd.com> | 2011-05-05 02:49:01 -0400 |
---|---|---|
committer | Chris Ball <cjb@laptop.org> | 2011-05-24 23:53:45 -0400 |
commit | 49c468fcf878d2c86e31920cf54aa90c88418a66 (patch) | |
tree | d8088bf8fb1a011f05ebbdefef49f2a6f4739432 /include | |
parent | 758535c4e3cdd2b5b09565d9651aaa541aac3de8 (diff) |
mmc: sd: add support for uhs bus speed mode selection
This patch adds support for setting UHS-I bus speed mode during UHS-I
initialization procedure. Since both the host and card can support
more than one bus speed, we select the highest speed based on both of
their capabilities. First we set the bus speed mode for the card using
CMD6 mode 1, and then we program the host controller to support the
required speed mode. We also set High Speed Enable in case one of the
UHS-I modes is selected. We take care to reset SD clock before setting
UHS mode in the Host Control2 register, and then re-enable it as per
the Host Controller spec v3.00. We then set the clock frequency for
the UHS-I mode selected.
Tested by Zhangfei Gao with a Toshiba uhs card and general hs card,
on mmp2 in SDMA mode.
Signed-off-by: Arindam Nath <arindam.nath@amd.com>
Reviewed-by: Philip Rakity <prakity@marvell.com>
Tested-by: Philip Rakity <prakity@marvell.com>
Acked-by: Zhangfei Gao <zhangfei.gao@marvell.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/mmc/card.h | 19 | ||||
-rw-r--r-- | include/linux/mmc/host.h | 5 |
2 files changed, 24 insertions, 0 deletions
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index 539327260dc1..4ef6ded6347d 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h | |||
@@ -81,7 +81,24 @@ struct sd_ssr { | |||
81 | 81 | ||
82 | struct sd_switch_caps { | 82 | struct sd_switch_caps { |
83 | unsigned int hs_max_dtr; | 83 | unsigned int hs_max_dtr; |
84 | unsigned int uhs_max_dtr; | ||
85 | #define UHS_SDR104_MAX_DTR 208000000 | ||
86 | #define UHS_SDR50_MAX_DTR 100000000 | ||
87 | #define UHS_DDR50_MAX_DTR 50000000 | ||
88 | #define UHS_SDR25_MAX_DTR UHS_DDR50_MAX_DTR | ||
89 | #define UHS_SDR12_MAX_DTR 25000000 | ||
84 | unsigned int sd3_bus_mode; | 90 | unsigned int sd3_bus_mode; |
91 | #define UHS_SDR12_BUS_SPEED 0 | ||
92 | #define UHS_SDR25_BUS_SPEED 1 | ||
93 | #define UHS_SDR50_BUS_SPEED 2 | ||
94 | #define UHS_SDR104_BUS_SPEED 3 | ||
95 | #define UHS_DDR50_BUS_SPEED 4 | ||
96 | |||
97 | #define SD_MODE_UHS_SDR12 (1 << UHS_SDR12_BUS_SPEED) | ||
98 | #define SD_MODE_UHS_SDR25 (1 << UHS_SDR25_BUS_SPEED) | ||
99 | #define SD_MODE_UHS_SDR50 (1 << UHS_SDR50_BUS_SPEED) | ||
100 | #define SD_MODE_UHS_SDR104 (1 << UHS_SDR104_BUS_SPEED) | ||
101 | #define SD_MODE_UHS_DDR50 (1 << UHS_DDR50_BUS_SPEED) | ||
85 | unsigned int sd3_drv_type; | 102 | unsigned int sd3_drv_type; |
86 | #define SD_DRIVER_TYPE_B 0x01 | 103 | #define SD_DRIVER_TYPE_B 0x01 |
87 | #define SD_DRIVER_TYPE_A 0x02 | 104 | #define SD_DRIVER_TYPE_A 0x02 |
@@ -166,6 +183,8 @@ struct mmc_card { | |||
166 | const char **info; /* info strings */ | 183 | const char **info; /* info strings */ |
167 | struct sdio_func_tuple *tuples; /* unknown common tuples */ | 184 | struct sdio_func_tuple *tuples; /* unknown common tuples */ |
168 | 185 | ||
186 | unsigned int sd_bus_speed; /* Bus Speed Mode set for the card */ | ||
187 | |||
169 | struct dentry *debugfs_root; | 188 | struct dentry *debugfs_root; |
170 | }; | 189 | }; |
171 | 190 | ||
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 949e4d525989..62375992bdd6 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h | |||
@@ -50,6 +50,11 @@ struct mmc_ios { | |||
50 | #define MMC_TIMING_LEGACY 0 | 50 | #define MMC_TIMING_LEGACY 0 |
51 | #define MMC_TIMING_MMC_HS 1 | 51 | #define MMC_TIMING_MMC_HS 1 |
52 | #define MMC_TIMING_SD_HS 2 | 52 | #define MMC_TIMING_SD_HS 2 |
53 | #define MMC_TIMING_UHS_SDR12 MMC_TIMING_LEGACY | ||
54 | #define MMC_TIMING_UHS_SDR25 MMC_TIMING_SD_HS | ||
55 | #define MMC_TIMING_UHS_SDR50 3 | ||
56 | #define MMC_TIMING_UHS_SDR104 4 | ||
57 | #define MMC_TIMING_UHS_DDR50 5 | ||
53 | 58 | ||
54 | unsigned char ddr; /* dual data rate used */ | 59 | unsigned char ddr; /* dual data rate used */ |
55 | 60 | ||