Commit b30f8af3358b5c66be223e3a9f3d11b3d02b4a8f

Authored by Jarkko Lavinen
Committed by Pierre Ossman
1 parent 35ff8554d1

mmc: Add 8-bit bus width support

Signed-off-by: Jarkko Lavinen <jarkko.lavinen@nokia.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>

Showing 2 changed files with 16 additions and 4 deletions Side-by-side Diff

drivers/mmc/core/mmc.c
... ... @@ -434,13 +434,24 @@
434 434 * Activate wide bus (if supported).
435 435 */
436 436 if ((card->csd.mmca_vsn >= CSD_SPEC_VER_4) &&
437   - (host->caps & MMC_CAP_4_BIT_DATA)) {
  437 + (host->caps & (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA))) {
  438 + unsigned ext_csd_bit, bus_width;
  439 +
  440 + if (host->caps & MMC_CAP_8_BIT_DATA) {
  441 + ext_csd_bit = EXT_CSD_BUS_WIDTH_8;
  442 + bus_width = MMC_BUS_WIDTH_8;
  443 + } else {
  444 + ext_csd_bit = EXT_CSD_BUS_WIDTH_4;
  445 + bus_width = MMC_BUS_WIDTH_4;
  446 + }
  447 +
438 448 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
439   - EXT_CSD_BUS_WIDTH, EXT_CSD_BUS_WIDTH_4);
  449 + EXT_CSD_BUS_WIDTH, ext_csd_bit);
  450 +
440 451 if (err)
441 452 goto free_card;
442 453  
443   - mmc_set_bus_width(card->host, MMC_BUS_WIDTH_4);
  454 + mmc_set_bus_width(card->host, bus_width);
444 455 }
445 456  
446 457 if (!oldcard)
include/linux/mmc/host.h
... ... @@ -41,6 +41,7 @@
41 41  
42 42 #define MMC_BUS_WIDTH_1 0
43 43 #define MMC_BUS_WIDTH_4 2
  44 +#define MMC_BUS_WIDTH_8 3
44 45  
45 46 unsigned char timing; /* timing specification used */
46 47  
... ... @@ -116,6 +117,7 @@
116 117 #define MMC_CAP_SDIO_IRQ (1 << 3) /* Can signal pending SDIO IRQs */
117 118 #define MMC_CAP_SPI (1 << 4) /* Talks only SPI protocols */
118 119 #define MMC_CAP_NEEDS_POLL (1 << 5) /* Needs polling for card-detection */
  120 +#define MMC_CAP_8_BIT_DATA (1 << 6) /* Can the host do 8 bit transfers */
119 121  
120 122 /* host specific block data */
121 123 unsigned int max_seg_size; /* see blk_queue_max_segment_size */