diff options
author | Seungwon Jeon <tgih.jun@samsung.com> | 2013-02-06 03:01:43 -0500 |
---|---|---|
committer | Chris Ball <cjb@laptop.org> | 2013-02-24 14:37:15 -0500 |
commit | abd9ac144947d9a604beb763339e2f77ce8bec79 (patch) | |
tree | a38469db95588f02587c28743b5719bbb83f863d /drivers/mmc/core | |
parent | ac48653cec7dd9a5606a7057413a880d6880d5d3 (diff) |
mmc: add packed command feature of eMMC4.5
This patch adds packed command feature of eMMC4.5. The maximum number
for packing read (or write) is offered and exception event relevant to
packed command which is used for error handling is enabled. If host
wants to use this feature, MMC_CAP2_PACKED_CMD should be set.
Signed-off-by: Seungwon Jeon <tgih.jun@samsung.com>
Reviewed-by: Maya Erez <merez@codeaurora.org>
Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>
Reviewed-by: Namjae Jeon <linkinjeon@gmail.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc/core')
-rw-r--r-- | drivers/mmc/core/mmc.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 8a3ad602a877..c8f3d6e0684e 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c | |||
@@ -538,6 +538,11 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd) | |||
538 | } else { | 538 | } else { |
539 | card->ext_csd.data_tag_unit_size = 0; | 539 | card->ext_csd.data_tag_unit_size = 0; |
540 | } | 540 | } |
541 | |||
542 | card->ext_csd.max_packed_writes = | ||
543 | ext_csd[EXT_CSD_MAX_PACKED_WRITES]; | ||
544 | card->ext_csd.max_packed_reads = | ||
545 | ext_csd[EXT_CSD_MAX_PACKED_READS]; | ||
541 | } else { | 546 | } else { |
542 | card->ext_csd.data_sector_size = 512; | 547 | card->ext_csd.data_sector_size = 512; |
543 | } | 548 | } |
@@ -1275,6 +1280,29 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, | |||
1275 | } | 1280 | } |
1276 | } | 1281 | } |
1277 | 1282 | ||
1283 | /* | ||
1284 | * The mandatory minimum values are defined for packed command. | ||
1285 | * read: 5, write: 3 | ||
1286 | */ | ||
1287 | if (card->ext_csd.max_packed_writes >= 3 && | ||
1288 | card->ext_csd.max_packed_reads >= 5 && | ||
1289 | host->caps2 & MMC_CAP2_PACKED_CMD) { | ||
1290 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, | ||
1291 | EXT_CSD_EXP_EVENTS_CTRL, | ||
1292 | EXT_CSD_PACKED_EVENT_EN, | ||
1293 | card->ext_csd.generic_cmd6_time); | ||
1294 | if (err && err != -EBADMSG) | ||
1295 | goto free_card; | ||
1296 | if (err) { | ||
1297 | pr_warn("%s: Enabling packed event failed\n", | ||
1298 | mmc_hostname(card->host)); | ||
1299 | card->ext_csd.packed_event_en = 0; | ||
1300 | err = 0; | ||
1301 | } else { | ||
1302 | card->ext_csd.packed_event_en = 1; | ||
1303 | } | ||
1304 | } | ||
1305 | |||
1278 | if (!oldcard) | 1306 | if (!oldcard) |
1279 | host->card = card; | 1307 | host->card = card; |
1280 | 1308 | ||