]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
mmc_block: hard code 512 byte block size
authorPierre Ossman <drzeus@drzeus.cx>
Sun, 31 Aug 2008 12:10:08 +0000 (14:10 +0200)
committerPierre Ossman <drzeus@drzeus.cx>
Sun, 12 Oct 2008 09:04:33 +0000 (11:04 +0200)
We use 512 byte blocks on all cards, and newer cards support nothing
else, so hard code it and make the code less complex.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
drivers/mmc/card/block.c

index d73cac84d9f23c5812e6c9b4d8e6b0e41580a58b..1d1e469e08ea8f79e5063fef5406c0c09ef59ef3 100644 (file)
@@ -57,7 +57,6 @@ struct mmc_blk_data {
        struct mmc_queue queue;
 
        unsigned int    usage;
-       unsigned int    block_bits;
        unsigned int    read_only;
 };
 
@@ -231,11 +230,11 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
                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);
+               brq.data.blocks = req->nr_sectors;
 
                if (brq.data.blocks > 1) {
                        /* SPI multiblock writes terminate using a special
@@ -351,16 +350,11 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
        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 {
@@ -410,13 +404,6 @@ static struct mmc_blk_data *mmc_blk_alloc(struct mmc_card *card)
         */
        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;
@@ -454,7 +441,7 @@ static struct mmc_blk_data *mmc_blk_alloc(struct mmc_card *card)
 
        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)) {
                /*
@@ -492,7 +479,7 @@ mmc_blk_set_blksize(struct mmc_blk_data *md, struct mmc_card *card)
 
        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);