Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/drzeus/mmc
authorLinus Torvalds <torvalds@linux-foundation.org>
Sun, 12 Oct 2008 18:51:57 +0000 (11:51 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 12 Oct 2008 18:51:57 +0000 (11:51 -0700)
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/drzeus/mmc: (24 commits)
  MMC: Use timeout values from CSR
  MMC: CSD and CID timeout values
  sdhci: 'scratch' may be used uninitialized
  mmc: explicitly mention SDIO support in Kconfig
  mmc: remove redundant "depends on"
  Fix comment in include/linux/mmc/host.h
  sdio: high-speed support
  mmc_block: hard code 512 byte block size
  sdhci: force high speed capability on some controllers
  mmc_block: filter out PC requests
  mmc_block: indicate strict ordering
  mmc_block: inform block layer about sector count restriction
  sdio: give sdio irq thread a host specific name
  sdio: make sleep on error interruptable
  sdhci: reduce card detection delay
  sdhci: let the controller wait for busy state to end
  atmel-mci: Add missing flush_dcache_page() in PIO transfer code
  atmel-mci: Don't overwrite error bits when NOTBUSY is set
  atmel-mci: Add experimental DMA support
  atmel-mci: support multiple mmc slots
  ...

1  2 
drivers/mmc/card/block.c

diff --combined drivers/mmc/card/block.c
index efacee0404a09c703b7f259fb0cb37401021b518,1d1e469e08ea8f79e5063fef5406c0c09ef59ef3..24c97d3d16bba43ab963d9b514ee27fbe938ddcc
@@@ -29,7 -29,6 +29,7 @@@
  #include <linux/blkdev.h>
  #include <linux/mutex.h>
  #include <linux/scatterlist.h>
 +#include <linux/string_helpers.h>
  
  #include <linux/mmc/card.h>
  #include <linux/mmc/host.h>
@@@ -58,7 -57,6 +58,6 @@@ struct mmc_blk_data 
        struct mmc_queue queue;
  
        unsigned int    usage;
-       unsigned int    block_bits;
        unsigned int    read_only;
  };
  
@@@ -84,7 -82,7 +83,7 @@@ static void mmc_blk_put(struct mmc_blk_
        mutex_lock(&open_lock);
        md->usage--;
        if (md->usage == 0) {
 -              int devidx = md->disk->first_minor >> MMC_SHIFT;
 +              int devidx = MINOR(disk_devt(md->disk)) >> MMC_SHIFT;
                __clear_bit(devidx, dev_use);
  
                put_disk(md->disk);
@@@ -216,8 -214,7 +215,7 @@@ static int mmc_blk_issue_rq(struct mmc_
        struct mmc_blk_data *md = mq->data;
        struct mmc_card *card = md->queue.card;
        struct mmc_blk_request brq;
-       int ret = 1, data_size, i;
-       struct scatterlist *sg;
+       int ret = 1;
  
        mmc_claim_host(card->host);
  
                if (!mmc_card_blockaddr(card))
                        brq.cmd.arg <<= 9;
                brq.cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_ADTC;
-               brq.data.blksz = 1 << md->block_bits;
+               brq.data.blksz = 512;
                brq.stop.opcode = MMC_STOP_TRANSMISSION;
                brq.stop.arg = 0;
                brq.stop.flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC;
-               brq.data.blocks = req->nr_sectors >> (md->block_bits - 9);
-               if (brq.data.blocks > card->host->max_blk_count)
-                       brq.data.blocks = card->host->max_blk_count;
+               brq.data.blocks = req->nr_sectors;
  
                if (brq.data.blocks > 1) {
                        /* SPI multiblock writes terminate using a special
  
                mmc_queue_bounce_pre(mq);
  
-               /*
-                * Adjust the sg list so it is the same size as the
-                * request.
-                */
-               if (brq.data.blocks !=
-                   (req->nr_sectors >> (md->block_bits - 9))) {
-                       data_size = brq.data.blocks * brq.data.blksz;
-                       for_each_sg(brq.data.sg, sg, brq.data.sg_len, i) {
-                               data_size -= sg->length;
-                               if (data_size <= 0) {
-                                       sg->length += data_size;
-                                       i++;
-                                       break;
-                               }
-                       }
-                       brq.data.sg_len = i;
-               }
                mmc_wait_for_req(card->host, &brq.mrq);
  
                mmc_queue_bounce_post(mq);
        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);
+                               ret = __blk_end_request(req, 0, blocks << 9);
                                spin_unlock_irq(&md->lock);
                        }
                } else {
@@@ -432,13 -404,6 +405,6 @@@ static struct mmc_blk_data *mmc_blk_all
         */
        md->read_only = mmc_blk_readonly(card);
  
-       /*
-        * Both SD and MMC specifications state (although a bit
-        * unclearly in the MMC case) that a block size of 512
-        * bytes must always be supported by the card.
-        */
-       md->block_bits = 9;
        md->disk = alloc_disk(1 << MMC_SHIFT);
        if (md->disk == NULL) {
                ret = -ENOMEM;
  
        sprintf(md->disk->disk_name, "mmcblk%d", devidx);
  
-       blk_queue_hardsect_size(md->queue.queue, 1 << md->block_bits);
+       blk_queue_hardsect_size(md->queue.queue, 512);
  
        if (!mmc_card_sd(card) && mmc_card_blockaddr(card)) {
                /*
@@@ -514,7 -479,7 +480,7 @@@ mmc_blk_set_blksize(struct mmc_blk_dat
  
        mmc_claim_host(card->host);
        cmd.opcode = MMC_SET_BLOCKLEN;
-       cmd.arg = 1 << md->block_bits;
+       cmd.arg = 512;
        cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC;
        err = mmc_wait_for_cmd(card->host, &cmd, 5);
        mmc_release_host(card->host);
@@@ -533,8 -498,6 +499,8 @@@ static int mmc_blk_probe(struct mmc_car
        struct mmc_blk_data *md;
        int err;
  
 +      char cap_str[10];
 +
        /*
         * Check that the card supports the command class(es) we need.
         */
        if (err)
                goto out;
  
 -      printk(KERN_INFO "%s: %s %s %lluKiB %s\n",
 +      string_get_size(get_capacity(md->disk) << 9, STRING_UNITS_2,
 +                      cap_str, sizeof(cap_str));
 +      printk(KERN_INFO "%s: %s %s %s %s\n",
                md->disk->disk_name, mmc_card_id(card), mmc_card_name(card),
 -              (unsigned long long)(get_capacity(md->disk) >> 1),
 -              md->read_only ? "(ro)" : "");
 +              cap_str, md->read_only ? "(ro)" : "");
  
        mmc_set_drvdata(card, md);
        add_disk(md->disk);