Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 284479
b: refs/heads/master
c: 052d81d
h: refs/heads/master
i:
  284477: fe1ff5e
  284475: 823fbea
  284471: 16d2e7b
  284463: f86ae76
  284447: 42dedbf
  284415: c7a42c4
v: v3
  • Loading branch information
Stefan Nilsson XK authored and Chris Ball committed Jan 12, 2012
1 parent a1d74d4 commit dd516ab
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: fffe5d5aa05b4e69f79bc75a51c5ee0fc6203fa5
refs/heads/master: 052d81da6e6f0f8839ef6d5a46f215fc8cd99d5a
8 changes: 6 additions & 2 deletions trunk/drivers/mmc/core/sdio_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@ static inline unsigned int sdio_max_byte_size(struct sdio_func *func)
else
mval = min(mval, func->max_blksize);

if (mmc_card_broken_byte_mode_512(func->card))
return min(mval, 511u);

return min(mval, 512u); /* maximum size for byte mode */
}

Expand Down Expand Up @@ -314,7 +317,7 @@ static int sdio_io_rw_ext_helper(struct sdio_func *func, int write,
func->card->host->max_seg_size / func->cur_blksize);
max_blocks = min(max_blocks, 511u);

while (remainder > func->cur_blksize) {
while (remainder >= func->cur_blksize) {
unsigned blocks;

blocks = remainder / func->cur_blksize;
Expand All @@ -339,8 +342,9 @@ static int sdio_io_rw_ext_helper(struct sdio_func *func, int write,
while (remainder > 0) {
size = min(remainder, sdio_max_byte_size(func));

/* Indicate byte mode by setting "blocks" = 0 */
ret = mmc_io_rw_extended(func->card, write, func->num, addr,
incr_addr, buf, 1, size);
incr_addr, buf, 0, size);
if (ret)
return ret;

Expand Down
14 changes: 5 additions & 9 deletions trunk/drivers/mmc/core/sdio_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,6 @@ int mmc_io_rw_extended(struct mmc_card *card, int write, unsigned fn,

BUG_ON(!card);
BUG_ON(fn > 7);
BUG_ON(blocks == 1 && blksz > 512);
WARN_ON(blocks == 0);
WARN_ON(blksz == 0);

/* sanity check */
Expand All @@ -144,22 +142,20 @@ int mmc_io_rw_extended(struct mmc_card *card, int write, unsigned fn,
cmd.arg |= fn << 28;
cmd.arg |= incr_addr ? 0x04000000 : 0x00000000;
cmd.arg |= addr << 9;
if (blocks == 1 && blksz < 512)
cmd.arg |= blksz; /* byte mode */
else if (blocks == 1 && blksz == 512 &&
!(mmc_card_broken_byte_mode_512(card)))
cmd.arg |= 0; /* byte mode, 0==512 */
if (blocks == 0)
cmd.arg |= (blksz == 512) ? 0 : blksz; /* byte mode */
else
cmd.arg |= 0x08000000 | blocks; /* block mode */
cmd.flags = MMC_RSP_SPI_R5 | MMC_RSP_R5 | MMC_CMD_ADTC;

data.blksz = blksz;
data.blocks = blocks;
/* Code in host drivers/fwk assumes that "blocks" always is >=1 */
data.blocks = blocks ? blocks : 1;
data.flags = write ? MMC_DATA_WRITE : MMC_DATA_READ;
data.sg = &sg;
data.sg_len = 1;

sg_init_one(&sg, buf, blksz * blocks);
sg_init_one(&sg, buf, data.blksz * data.blocks);

mmc_set_data_timeout(&data, card);

Expand Down

0 comments on commit dd516ab

Please sign in to comment.