Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 336279
b: refs/heads/master
c: 968a64e
h: refs/heads/master
i:
  336277: 5acd4fe
  336275: 0b17e5e
  336271: 1808173
v: v3
  • Loading branch information
Kyoungil Kim authored and Chris Ball committed Dec 6, 2012
1 parent 7d2c07a commit 75c7aa8
Show file tree
Hide file tree
Showing 3 changed files with 32 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: 8fee476b219d1869762d9ef5c189a0c85e919a4d
refs/heads/master: 968a64ea638bbd48839b41981ff50197f3412676
10 changes: 3 additions & 7 deletions trunk/drivers/mmc/core/sdio_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,7 @@ EXPORT_SYMBOL_GPL(sdio_set_block_size);
*/
static inline unsigned int sdio_max_byte_size(struct sdio_func *func)
{
unsigned mval = min(func->card->host->max_seg_size,
func->card->host->max_blk_size);
unsigned mval = func->card->host->max_blk_size;

if (mmc_blksz_for_byte_mode(func->card))
mval = min(mval, func->cur_blksize);
Expand Down Expand Up @@ -311,11 +310,8 @@ static int sdio_io_rw_ext_helper(struct sdio_func *func, int write,
/* Do the bulk of the transfer using block mode (if supported). */
if (func->card->cccr.multi_block && (size > sdio_max_byte_size(func))) {
/* Blocks per command is limited by host count, host transfer
* size (we only use a single sg entry) and the maximum for
* IO_RW_EXTENDED of 511 blocks. */
max_blocks = min(func->card->host->max_blk_count,
func->card->host->max_seg_size / func->cur_blksize);
max_blocks = min(max_blocks, 511u);
* size and the maximum for IO_RW_EXTENDED of 511 blocks. */
max_blocks = min(func->card->host->max_blk_count, 511u);

while (remainder >= func->cur_blksize) {
unsigned blocks;
Expand Down
32 changes: 28 additions & 4 deletions trunk/drivers/mmc/core/sdio_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,10 @@ int mmc_io_rw_extended(struct mmc_card *card, int write, unsigned fn,
struct mmc_request mrq = {NULL};
struct mmc_command cmd = {0};
struct mmc_data data = {0};
struct scatterlist sg;
struct scatterlist sg, *sg_ptr;
struct sg_table sgtable;
unsigned int nents, left_size, i;
unsigned int seg_size = card->host->max_seg_size;

BUG_ON(!card);
BUG_ON(fn > 7);
Expand Down Expand Up @@ -152,15 +155,36 @@ int mmc_io_rw_extended(struct mmc_card *card, int write, unsigned fn,
/* 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, data.blksz * data.blocks);
left_size = data.blksz * data.blocks;
nents = (left_size - 1) / seg_size + 1;
if (nents > 1) {
if (sg_alloc_table(&sgtable, nents, GFP_KERNEL))
return -ENOMEM;

data.sg = sgtable.sgl;
data.sg_len = nents;

for_each_sg(data.sg, sg_ptr, data.sg_len, i) {
sg_set_page(sg_ptr, virt_to_page(buf + (i * seg_size)),
min(seg_size, left_size),
offset_in_page(buf + (i * seg_size)));
left_size = left_size - seg_size;
}
} else {
data.sg = &sg;
data.sg_len = 1;

sg_init_one(&sg, buf, left_size);
}

mmc_set_data_timeout(&data, card);

mmc_wait_for_req(card->host, &mrq);

if (nents > 1)
sg_free_table(&sgtable);

if (cmd.error)
return cmd.error;
if (data.error)
Expand Down

0 comments on commit 75c7aa8

Please sign in to comment.