diff options
author | Pierre Ossman <drzeus@drzeus.cx> | 2008-07-05 19:10:27 -0400 |
---|---|---|
committer | Pierre Ossman <drzeus@drzeus.cx> | 2008-07-15 08:14:49 -0400 |
commit | 23af60398af2f5033e2f53665538a09f498dbc03 (patch) | |
tree | fc244139d7d6bb1a82b80cc60fae86970e60c8c5 | |
parent | 97067d5581ec831a75a45a52e417bee0f7943dbf (diff) |
mmc: remove multiwrite capability
Relax requirements on host controllers and only require that they do not
report a transfer count than is larger than the actual one (i.e. a lower
value is okay). This is how many other parts of the kernel behaves so
upper layers should already be prepared to handle that scenario. This
gives us a performance boost on MMC cards.
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
-rw-r--r-- | drivers/mmc/card/block.c | 47 | ||||
-rw-r--r-- | drivers/mmc/host/at91_mci.c | 2 | ||||
-rw-r--r-- | drivers/mmc/host/atmel-mci.c | 2 | ||||
-rw-r--r-- | drivers/mmc/host/mmc_spi.c | 5 | ||||
-rw-r--r-- | drivers/mmc/host/mmci.c | 1 | ||||
-rw-r--r-- | drivers/mmc/host/omap.c | 2 | ||||
-rw-r--r-- | drivers/mmc/host/tifm_sd.c | 2 | ||||
-rw-r--r-- | drivers/mmc/host/wbsd.c | 2 | ||||
-rw-r--r-- | include/linux/mmc/host.h | 11 |
9 files changed, 30 insertions, 44 deletions
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 4b0f8220f153..66e5a5487c20 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c | |||
@@ -237,17 +237,6 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) | |||
237 | if (brq.data.blocks > card->host->max_blk_count) | 237 | if (brq.data.blocks > card->host->max_blk_count) |
238 | brq.data.blocks = card->host->max_blk_count; | 238 | brq.data.blocks = card->host->max_blk_count; |
239 | 239 | ||
240 | /* | ||
241 | * If the host doesn't support multiple block writes, force | ||
242 | * block writes to single block. SD cards are excepted from | ||
243 | * this rule as they support querying the number of | ||
244 | * successfully written sectors. | ||
245 | */ | ||
246 | if (rq_data_dir(req) != READ && | ||
247 | !(card->host->caps & MMC_CAP_MULTIWRITE) && | ||
248 | !mmc_card_sd(card)) | ||
249 | brq.data.blocks = 1; | ||
250 | |||
251 | if (brq.data.blocks > 1) { | 240 | if (brq.data.blocks > 1) { |
252 | /* SPI multiblock writes terminate using a special | 241 | /* SPI multiblock writes terminate using a special |
253 | * token, not a STOP_TRANSMISSION request. | 242 | * token, not a STOP_TRANSMISSION request. |
@@ -367,30 +356,32 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) | |||
367 | * mark the known good sectors as ok. | 356 | * mark the known good sectors as ok. |
368 | * | 357 | * |
369 | * If the card is not SD, we can still ok written sectors | 358 | * If the card is not SD, we can still ok written sectors |
370 | * if the controller can do proper error reporting. | 359 | * as reported by the controller (which might be less than |
360 | * the real number of written sectors, but never more). | ||
371 | * | 361 | * |
372 | * For reads we just fail the entire chunk as that should | 362 | * For reads we just fail the entire chunk as that should |
373 | * be safe in all cases. | 363 | * be safe in all cases. |
374 | */ | 364 | */ |
375 | if (rq_data_dir(req) != READ && mmc_card_sd(card)) { | 365 | if (rq_data_dir(req) != READ) { |
376 | u32 blocks; | 366 | if (mmc_card_sd(card)) { |
377 | unsigned int bytes; | 367 | u32 blocks; |
378 | 368 | unsigned int bytes; | |
379 | blocks = mmc_sd_num_wr_blocks(card); | 369 | |
380 | if (blocks != (u32)-1) { | 370 | blocks = mmc_sd_num_wr_blocks(card); |
381 | if (card->csd.write_partial) | 371 | if (blocks != (u32)-1) { |
382 | bytes = blocks << md->block_bits; | 372 | if (card->csd.write_partial) |
383 | else | 373 | bytes = blocks << md->block_bits; |
384 | bytes = blocks << 9; | 374 | else |
375 | bytes = blocks << 9; | ||
376 | spin_lock_irq(&md->lock); | ||
377 | ret = __blk_end_request(req, 0, bytes); | ||
378 | spin_unlock_irq(&md->lock); | ||
379 | } | ||
380 | } else { | ||
385 | spin_lock_irq(&md->lock); | 381 | spin_lock_irq(&md->lock); |
386 | ret = __blk_end_request(req, 0, bytes); | 382 | ret = __blk_end_request(req, 0, brq.data.bytes_xfered); |
387 | spin_unlock_irq(&md->lock); | 383 | spin_unlock_irq(&md->lock); |
388 | } | 384 | } |
389 | } else if (rq_data_dir(req) != READ && | ||
390 | (card->host->caps & MMC_CAP_MULTIWRITE)) { | ||
391 | spin_lock_irq(&md->lock); | ||
392 | ret = __blk_end_request(req, 0, brq.data.bytes_xfered); | ||
393 | spin_unlock_irq(&md->lock); | ||
394 | } | 385 | } |
395 | 386 | ||
396 | mmc_release_host(card->host); | 387 | mmc_release_host(card->host); |
diff --git a/drivers/mmc/host/at91_mci.c b/drivers/mmc/host/at91_mci.c index 16df235fcc2e..f15e2064305c 100644 --- a/drivers/mmc/host/at91_mci.c +++ b/drivers/mmc/host/at91_mci.c | |||
@@ -995,7 +995,7 @@ static int __init at91_mci_probe(struct platform_device *pdev) | |||
995 | mmc->f_min = 375000; | 995 | mmc->f_min = 375000; |
996 | mmc->f_max = 25000000; | 996 | mmc->f_max = 25000000; |
997 | mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34; | 997 | mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34; |
998 | mmc->caps = MMC_CAP_MULTIWRITE | MMC_CAP_SDIO_IRQ; | 998 | mmc->caps = MMC_CAP_SDIO_IRQ; |
999 | 999 | ||
1000 | mmc->max_blk_size = 4095; | 1000 | mmc->max_blk_size = 4095; |
1001 | mmc->max_blk_count = mmc->max_req_size; | 1001 | mmc->max_blk_count = mmc->max_req_size; |
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c index 25d5324ab7e2..cce873c5a149 100644 --- a/drivers/mmc/host/atmel-mci.c +++ b/drivers/mmc/host/atmel-mci.c | |||
@@ -849,7 +849,7 @@ static int __init atmci_probe(struct platform_device *pdev) | |||
849 | mmc->f_min = (host->bus_hz + 511) / 512; | 849 | mmc->f_min = (host->bus_hz + 511) / 512; |
850 | mmc->f_max = host->bus_hz / 2; | 850 | mmc->f_max = host->bus_hz / 2; |
851 | mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34; | 851 | mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34; |
852 | mmc->caps |= MMC_CAP_4_BIT_DATA | MMC_CAP_MULTIWRITE; | 852 | mmc->caps |= MMC_CAP_4_BIT_DATA; |
853 | 853 | ||
854 | mmc->max_hw_segs = 64; | 854 | mmc->max_hw_segs = 64; |
855 | mmc->max_phys_segs = 64; | 855 | mmc->max_phys_segs = 64; |
diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c index 4e82f64a96bc..41cc63360e43 100644 --- a/drivers/mmc/host/mmc_spi.c +++ b/drivers/mmc/host/mmc_spi.c | |||
@@ -1252,10 +1252,7 @@ static int mmc_spi_probe(struct spi_device *spi) | |||
1252 | mmc->ops = &mmc_spi_ops; | 1252 | mmc->ops = &mmc_spi_ops; |
1253 | mmc->max_blk_size = MMC_SPI_BLOCKSIZE; | 1253 | mmc->max_blk_size = MMC_SPI_BLOCKSIZE; |
1254 | 1254 | ||
1255 | /* As long as we keep track of the number of successfully | 1255 | mmc->caps = MMC_CAP_SPI; |
1256 | * transmitted blocks, we're good for multiwrite. | ||
1257 | */ | ||
1258 | mmc->caps = MMC_CAP_SPI | MMC_CAP_MULTIWRITE; | ||
1259 | 1256 | ||
1260 | /* SPI doesn't need the lowspeed device identification thing for | 1257 | /* SPI doesn't need the lowspeed device identification thing for |
1261 | * MMC or SD cards, since it never comes up in open drain mode. | 1258 | * MMC or SD cards, since it never comes up in open drain mode. |
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index da5fecad74d9..696cf3647ceb 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c | |||
@@ -535,7 +535,6 @@ static int mmci_probe(struct amba_device *dev, void *id) | |||
535 | mmc->f_min = (host->mclk + 511) / 512; | 535 | mmc->f_min = (host->mclk + 511) / 512; |
536 | mmc->f_max = min(host->mclk, fmax); | 536 | mmc->f_max = min(host->mclk, fmax); |
537 | mmc->ocr_avail = plat->ocr_mask; | 537 | mmc->ocr_avail = plat->ocr_mask; |
538 | mmc->caps = MMC_CAP_MULTIWRITE; | ||
539 | 538 | ||
540 | /* | 539 | /* |
541 | * We can do SGIO | 540 | * We can do SGIO |
diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c index 549517c35675..dbc26eb6a89e 100644 --- a/drivers/mmc/host/omap.c +++ b/drivers/mmc/host/omap.c | |||
@@ -1317,7 +1317,7 @@ static int __init mmc_omap_new_slot(struct mmc_omap_host *host, int id) | |||
1317 | 1317 | ||
1318 | host->slots[id] = slot; | 1318 | host->slots[id] = slot; |
1319 | 1319 | ||
1320 | mmc->caps = MMC_CAP_MULTIWRITE; | 1320 | mmc->caps = 0; |
1321 | if (host->pdata->conf.wire4) | 1321 | if (host->pdata->conf.wire4) |
1322 | mmc->caps |= MMC_CAP_4_BIT_DATA; | 1322 | mmc->caps |= MMC_CAP_4_BIT_DATA; |
1323 | 1323 | ||
diff --git a/drivers/mmc/host/tifm_sd.c b/drivers/mmc/host/tifm_sd.c index 1c14a186f000..13844843e8de 100644 --- a/drivers/mmc/host/tifm_sd.c +++ b/drivers/mmc/host/tifm_sd.c | |||
@@ -973,7 +973,7 @@ static int tifm_sd_probe(struct tifm_dev *sock) | |||
973 | 973 | ||
974 | mmc->ops = &tifm_sd_ops; | 974 | mmc->ops = &tifm_sd_ops; |
975 | mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34; | 975 | mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34; |
976 | mmc->caps = MMC_CAP_4_BIT_DATA | MMC_CAP_MULTIWRITE; | 976 | mmc->caps = MMC_CAP_4_BIT_DATA; |
977 | mmc->f_min = 20000000 / 60; | 977 | mmc->f_min = 20000000 / 60; |
978 | mmc->f_max = 24000000; | 978 | mmc->f_max = 24000000; |
979 | 979 | ||
diff --git a/drivers/mmc/host/wbsd.c b/drivers/mmc/host/wbsd.c index f7dcd8ec0d7f..adda37952032 100644 --- a/drivers/mmc/host/wbsd.c +++ b/drivers/mmc/host/wbsd.c | |||
@@ -1219,7 +1219,7 @@ static int __devinit wbsd_alloc_mmc(struct device *dev) | |||
1219 | mmc->f_min = 375000; | 1219 | mmc->f_min = 375000; |
1220 | mmc->f_max = 24000000; | 1220 | mmc->f_max = 24000000; |
1221 | mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34; | 1221 | mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34; |
1222 | mmc->caps = MMC_CAP_4_BIT_DATA | MMC_CAP_MULTIWRITE; | 1222 | mmc->caps = MMC_CAP_4_BIT_DATA; |
1223 | 1223 | ||
1224 | spin_lock_init(&host->lock); | 1224 | spin_lock_init(&host->lock); |
1225 | 1225 | ||
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 753b7231b887..10a2080086ca 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h | |||
@@ -111,12 +111,11 @@ struct mmc_host { | |||
111 | unsigned long caps; /* Host capabilities */ | 111 | unsigned long caps; /* Host capabilities */ |
112 | 112 | ||
113 | #define MMC_CAP_4_BIT_DATA (1 << 0) /* Can the host do 4 bit transfers */ | 113 | #define MMC_CAP_4_BIT_DATA (1 << 0) /* Can the host do 4 bit transfers */ |
114 | #define MMC_CAP_MULTIWRITE (1 << 1) /* Can accurately report bytes sent to card on error */ | 114 | #define MMC_CAP_MMC_HIGHSPEED (1 << 1) /* Can do MMC high-speed timing */ |
115 | #define MMC_CAP_MMC_HIGHSPEED (1 << 2) /* Can do MMC high-speed timing */ | 115 | #define MMC_CAP_SD_HIGHSPEED (1 << 2) /* Can do SD high-speed timing */ |
116 | #define MMC_CAP_SD_HIGHSPEED (1 << 3) /* Can do SD high-speed timing */ | 116 | #define MMC_CAP_SDIO_IRQ (1 << 3) /* Can signal pending SDIO IRQs */ |
117 | #define MMC_CAP_SDIO_IRQ (1 << 4) /* Can signal pending SDIO IRQs */ | 117 | #define MMC_CAP_SPI (1 << 4) /* Talks only SPI protocols */ |
118 | #define MMC_CAP_SPI (1 << 5) /* Talks only SPI protocols */ | 118 | #define MMC_CAP_NEEDS_POLL (1 << 5) /* Needs polling for card-detection */ |
119 | #define MMC_CAP_NEEDS_POLL (1 << 6) /* Needs polling for card-detection */ | ||
120 | 119 | ||
121 | /* host specific block data */ | 120 | /* host specific block data */ |
122 | unsigned int max_seg_size; /* see blk_queue_max_segment_size */ | 121 | unsigned int max_seg_size; /* see blk_queue_max_segment_size */ |