]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
mmc: remove multiwrite capability
authorPierre Ossman <drzeus@drzeus.cx>
Sat, 5 Jul 2008 23:10:27 +0000 (01:10 +0200)
committerPierre Ossman <drzeus@drzeus.cx>
Tue, 15 Jul 2008 12:14:49 +0000 (14:14 +0200)
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>
drivers/mmc/card/block.c
drivers/mmc/host/at91_mci.c
drivers/mmc/host/atmel-mci.c
drivers/mmc/host/mmc_spi.c
drivers/mmc/host/mmci.c
drivers/mmc/host/omap.c
drivers/mmc/host/tifm_sd.c
drivers/mmc/host/wbsd.c
include/linux/mmc/host.h

index 4b0f8220f15361829d88a16fd31b663baf13ddae..66e5a5487c20a228c67793e90d2f95b5dc36e53b 100644 (file)
@@ -237,17 +237,6 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
                if (brq.data.blocks > card->host->max_blk_count)
                        brq.data.blocks = card->host->max_blk_count;
 
-               /*
-                * If the host doesn't support multiple block writes, force
-                * block writes to single block. SD cards are excepted from
-                * this rule as they support querying the number of
-                * successfully written sectors.
-                */
-               if (rq_data_dir(req) != READ &&
-                   !(card->host->caps & MMC_CAP_MULTIWRITE) &&
-                   !mmc_card_sd(card))
-                       brq.data.blocks = 1;
-
                if (brq.data.blocks > 1) {
                        /* SPI multiblock writes terminate using a special
                         * token, not a STOP_TRANSMISSION request.
@@ -367,30 +356,32 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
         * mark the known good sectors as ok.
         *
         * If the card is not SD, we can still ok written sectors
-        * if the controller can do proper error reporting.
+        * as reported by the controller (which might be less than
+        * the real number of written sectors, but never more).
         *
         * For reads we just fail the entire chunk as that should
         * be safe in all cases.
         */
-       if (rq_data_dir(req) != READ && mmc_card_sd(card)) {
-               u32 blocks;
-               unsigned int bytes;
-
-               blocks = mmc_sd_num_wr_blocks(card);
-               if (blocks != (u32)-1) {
-                       if (card->csd.write_partial)
-                               bytes = blocks << md->block_bits;
-                       else
-                               bytes = blocks << 9;
+       if (rq_data_dir(req) != READ) {
+               if (mmc_card_sd(card)) {
+                       u32 blocks;
+                       unsigned int bytes;
+
+                       blocks = mmc_sd_num_wr_blocks(card);
+                       if (blocks != (u32)-1) {
+                               if (card->csd.write_partial)
+                                       bytes = blocks << md->block_bits;
+                               else
+                                       bytes = blocks << 9;
+                               spin_lock_irq(&md->lock);
+                               ret = __blk_end_request(req, 0, bytes);
+                               spin_unlock_irq(&md->lock);
+                       }
+               } else {
                        spin_lock_irq(&md->lock);
-                       ret = __blk_end_request(req, 0, bytes);
+                       ret = __blk_end_request(req, 0, brq.data.bytes_xfered);
                        spin_unlock_irq(&md->lock);
                }
-       } else if (rq_data_dir(req) != READ &&
-                  (card->host->caps & MMC_CAP_MULTIWRITE)) {
-               spin_lock_irq(&md->lock);
-               ret = __blk_end_request(req, 0, brq.data.bytes_xfered);
-               spin_unlock_irq(&md->lock);
        }
 
        mmc_release_host(card->host);
index 16df235fcc2e15a43a19c9f8e78fe0111cc6acaf..f15e2064305cd227ab93f7fdaaa8006ceb684e36 100644 (file)
@@ -995,7 +995,7 @@ static int __init at91_mci_probe(struct platform_device *pdev)
        mmc->f_min = 375000;
        mmc->f_max = 25000000;
        mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
-       mmc->caps = MMC_CAP_MULTIWRITE | MMC_CAP_SDIO_IRQ;
+       mmc->caps = MMC_CAP_SDIO_IRQ;
 
        mmc->max_blk_size = 4095;
        mmc->max_blk_count = mmc->max_req_size;
index 25d5324ab7e2557a0b15ce970082a54ad7c6f6b5..cce873c5a149528f7d65fb3c5891a71bb5cdb502 100644 (file)
@@ -849,7 +849,7 @@ static int __init atmci_probe(struct platform_device *pdev)
        mmc->f_min = (host->bus_hz + 511) / 512;
        mmc->f_max = host->bus_hz / 2;
        mmc->ocr_avail  = MMC_VDD_32_33 | MMC_VDD_33_34;
-       mmc->caps |= MMC_CAP_4_BIT_DATA | MMC_CAP_MULTIWRITE;
+       mmc->caps |= MMC_CAP_4_BIT_DATA;
 
        mmc->max_hw_segs = 64;
        mmc->max_phys_segs = 64;
index 4e82f64a96bc7f3af6ed5a571991c3754369ccd1..41cc63360e43d357db2d5d42a06cf55b0abd47b3 100644 (file)
@@ -1252,10 +1252,7 @@ static int mmc_spi_probe(struct spi_device *spi)
        mmc->ops = &mmc_spi_ops;
        mmc->max_blk_size = MMC_SPI_BLOCKSIZE;
 
-       /* As long as we keep track of the number of successfully
-        * transmitted blocks, we're good for multiwrite.
-        */
-       mmc->caps = MMC_CAP_SPI | MMC_CAP_MULTIWRITE;
+       mmc->caps = MMC_CAP_SPI;
 
        /* SPI doesn't need the lowspeed device identification thing for
         * MMC or SD cards, since it never comes up in open drain mode.
index da5fecad74d9a79152076730981a36d35cfe3bed..696cf3647ceb3e61c6a9f41bf5ffae889c11ffef 100644 (file)
@@ -535,7 +535,6 @@ static int mmci_probe(struct amba_device *dev, void *id)
        mmc->f_min = (host->mclk + 511) / 512;
        mmc->f_max = min(host->mclk, fmax);
        mmc->ocr_avail = plat->ocr_mask;
-       mmc->caps = MMC_CAP_MULTIWRITE;
 
        /*
         * We can do SGIO
index 549517c35675971b3448a988f83cb2b2369b305d..dbc26eb6a89e06c280f263a88ed02a20736220e7 100644 (file)
@@ -1317,7 +1317,7 @@ static int __init mmc_omap_new_slot(struct mmc_omap_host *host, int id)
 
        host->slots[id] = slot;
 
-       mmc->caps = MMC_CAP_MULTIWRITE;
+       mmc->caps = 0;
        if (host->pdata->conf.wire4)
                mmc->caps |= MMC_CAP_4_BIT_DATA;
 
index 1c14a186f000acc10b23b59b5bc554533bf6a4ec..13844843e8de147a091f19166f1885df9e7262cb 100644 (file)
@@ -973,7 +973,7 @@ static int tifm_sd_probe(struct tifm_dev *sock)
 
        mmc->ops = &tifm_sd_ops;
        mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
-       mmc->caps = MMC_CAP_4_BIT_DATA | MMC_CAP_MULTIWRITE;
+       mmc->caps = MMC_CAP_4_BIT_DATA;
        mmc->f_min = 20000000 / 60;
        mmc->f_max = 24000000;
 
index f7dcd8ec0d7f9d08adaac521af11e3b015456373..adda37952032af52335dcfbb69fb925bf16e5046 100644 (file)
@@ -1219,7 +1219,7 @@ static int __devinit wbsd_alloc_mmc(struct device *dev)
        mmc->f_min = 375000;
        mmc->f_max = 24000000;
        mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
-       mmc->caps = MMC_CAP_4_BIT_DATA | MMC_CAP_MULTIWRITE;
+       mmc->caps = MMC_CAP_4_BIT_DATA;
 
        spin_lock_init(&host->lock);
 
index 753b7231b887ff0129d92fe8c5c2056ed29dbcae..10a2080086ca9e6402eec37178bd8dea384f3f92 100644 (file)
@@ -111,12 +111,11 @@ struct mmc_host {
        unsigned long           caps;           /* Host capabilities */
 
 #define MMC_CAP_4_BIT_DATA     (1 << 0)        /* Can the host do 4 bit transfers */
-#define MMC_CAP_MULTIWRITE     (1 << 1)        /* Can accurately report bytes sent to card on error */
-#define MMC_CAP_MMC_HIGHSPEED  (1 << 2)        /* Can do MMC high-speed timing */
-#define MMC_CAP_SD_HIGHSPEED   (1 << 3)        /* Can do SD high-speed timing */
-#define MMC_CAP_SDIO_IRQ       (1 << 4)        /* Can signal pending SDIO IRQs */
-#define MMC_CAP_SPI            (1 << 5)        /* Talks only SPI protocols */
-#define MMC_CAP_NEEDS_POLL     (1 << 6)        /* Needs polling for card-detection */
+#define MMC_CAP_MMC_HIGHSPEED  (1 << 1)        /* Can do MMC high-speed timing */
+#define MMC_CAP_SD_HIGHSPEED   (1 << 2)        /* Can do SD high-speed timing */
+#define MMC_CAP_SDIO_IRQ       (1 << 3)        /* Can signal pending SDIO IRQs */
+#define MMC_CAP_SPI            (1 << 4)        /* Talks only SPI protocols */
+#define MMC_CAP_NEEDS_POLL     (1 << 5)        /* Needs polling for card-detection */
 
        /* host specific block data */
        unsigned int            max_seg_size;   /* see blk_queue_max_segment_size */