diff options
Diffstat (limited to 'drivers/mmc')
-rwxr-xr-x[-rw-r--r--] | drivers/mmc/core/sdio_io.c | 42 |
1 files changed, 16 insertions, 26 deletions
diff --git a/drivers/mmc/core/sdio_io.c b/drivers/mmc/core/sdio_io.c index cc42a41ff6ab..3ccf6919877c 100644..100755 --- a/drivers/mmc/core/sdio_io.c +++ b/drivers/mmc/core/sdio_io.c | |||
@@ -167,10 +167,8 @@ int sdio_set_block_size(struct sdio_func *func, unsigned blksz) | |||
167 | return -EINVAL; | 167 | return -EINVAL; |
168 | 168 | ||
169 | if (blksz == 0) { | 169 | if (blksz == 0) { |
170 | blksz = min(min( | 170 | blksz = min(func->max_blksize, func->card->host->max_blk_size); |
171 | func->max_blksize, | 171 | blksz = min(blksz, 512u); |
172 | func->card->host->max_blk_size), | ||
173 | 512u); | ||
174 | } | 172 | } |
175 | 173 | ||
176 | ret = mmc_io_rw_direct(func->card, 1, 0, | 174 | ret = mmc_io_rw_direct(func->card, 1, 0, |
@@ -311,10 +309,9 @@ static int sdio_io_rw_ext_helper(struct sdio_func *func, int write, | |||
311 | /* Blocks per command is limited by host count, host transfer | 309 | /* Blocks per command is limited by host count, host transfer |
312 | * size (we only use a single sg entry) and the maximum for | 310 | * size (we only use a single sg entry) and the maximum for |
313 | * IO_RW_EXTENDED of 511 blocks. */ | 311 | * IO_RW_EXTENDED of 511 blocks. */ |
314 | max_blocks = min(min( | 312 | max_blocks = min(func->card->host->max_blk_count, |
315 | func->card->host->max_blk_count, | 313 | func->card->host->max_seg_size / func->cur_blksize); |
316 | func->card->host->max_seg_size / func->cur_blksize), | 314 | max_blocks = min(max_blocks, 511u); |
317 | 511u); | ||
318 | 315 | ||
319 | while (remainder > func->cur_blksize) { | 316 | while (remainder > func->cur_blksize) { |
320 | unsigned blocks; | 317 | unsigned blocks; |
@@ -364,11 +361,10 @@ static int sdio_io_rw_ext_helper(struct sdio_func *func, int write, | |||
364 | * function. If there is a problem reading the address, 0xff | 361 | * function. If there is a problem reading the address, 0xff |
365 | * is returned and @err_ret will contain the error code. | 362 | * is returned and @err_ret will contain the error code. |
366 | */ | 363 | */ |
367 | unsigned char sdio_readb(struct sdio_func *func, unsigned int addr, | 364 | u8 sdio_readb(struct sdio_func *func, unsigned int addr, int *err_ret) |
368 | int *err_ret) | ||
369 | { | 365 | { |
370 | int ret; | 366 | int ret; |
371 | unsigned char val; | 367 | u8 val; |
372 | 368 | ||
373 | BUG_ON(!func); | 369 | BUG_ON(!func); |
374 | 370 | ||
@@ -397,8 +393,7 @@ EXPORT_SYMBOL_GPL(sdio_readb); | |||
397 | * function. @err_ret will contain the status of the actual | 393 | * function. @err_ret will contain the status of the actual |
398 | * transfer. | 394 | * transfer. |
399 | */ | 395 | */ |
400 | void sdio_writeb(struct sdio_func *func, unsigned char b, unsigned int addr, | 396 | void sdio_writeb(struct sdio_func *func, u8 b, unsigned int addr, int *err_ret) |
401 | int *err_ret) | ||
402 | { | 397 | { |
403 | int ret; | 398 | int ret; |
404 | 399 | ||
@@ -459,7 +454,6 @@ int sdio_readsb(struct sdio_func *func, void *dst, unsigned int addr, | |||
459 | { | 454 | { |
460 | return sdio_io_rw_ext_helper(func, 0, addr, 0, dst, count); | 455 | return sdio_io_rw_ext_helper(func, 0, addr, 0, dst, count); |
461 | } | 456 | } |
462 | |||
463 | EXPORT_SYMBOL_GPL(sdio_readsb); | 457 | EXPORT_SYMBOL_GPL(sdio_readsb); |
464 | 458 | ||
465 | /** | 459 | /** |
@@ -489,8 +483,7 @@ EXPORT_SYMBOL_GPL(sdio_writesb); | |||
489 | * function. If there is a problem reading the address, 0xffff | 483 | * function. If there is a problem reading the address, 0xffff |
490 | * is returned and @err_ret will contain the error code. | 484 | * is returned and @err_ret will contain the error code. |
491 | */ | 485 | */ |
492 | unsigned short sdio_readw(struct sdio_func *func, unsigned int addr, | 486 | u16 sdio_readw(struct sdio_func *func, unsigned int addr, int *err_ret) |
493 | int *err_ret) | ||
494 | { | 487 | { |
495 | int ret; | 488 | int ret; |
496 | 489 | ||
@@ -504,7 +497,7 @@ unsigned short sdio_readw(struct sdio_func *func, unsigned int addr, | |||
504 | return 0xFFFF; | 497 | return 0xFFFF; |
505 | } | 498 | } |
506 | 499 | ||
507 | return le16_to_cpu(*(u16*)func->tmpbuf); | 500 | return le16_to_cpup((__le16 *)func->tmpbuf); |
508 | } | 501 | } |
509 | EXPORT_SYMBOL_GPL(sdio_readw); | 502 | EXPORT_SYMBOL_GPL(sdio_readw); |
510 | 503 | ||
@@ -519,12 +512,11 @@ EXPORT_SYMBOL_GPL(sdio_readw); | |||
519 | * function. @err_ret will contain the status of the actual | 512 | * function. @err_ret will contain the status of the actual |
520 | * transfer. | 513 | * transfer. |
521 | */ | 514 | */ |
522 | void sdio_writew(struct sdio_func *func, unsigned short b, unsigned int addr, | 515 | void sdio_writew(struct sdio_func *func, u16 b, unsigned int addr, int *err_ret) |
523 | int *err_ret) | ||
524 | { | 516 | { |
525 | int ret; | 517 | int ret; |
526 | 518 | ||
527 | *(u16*)func->tmpbuf = cpu_to_le16(b); | 519 | *(__le16 *)func->tmpbuf = cpu_to_le16(b); |
528 | 520 | ||
529 | ret = sdio_memcpy_toio(func, addr, func->tmpbuf, 2); | 521 | ret = sdio_memcpy_toio(func, addr, func->tmpbuf, 2); |
530 | if (err_ret) | 522 | if (err_ret) |
@@ -543,8 +535,7 @@ EXPORT_SYMBOL_GPL(sdio_writew); | |||
543 | * 0xffffffff is returned and @err_ret will contain the error | 535 | * 0xffffffff is returned and @err_ret will contain the error |
544 | * code. | 536 | * code. |
545 | */ | 537 | */ |
546 | unsigned long sdio_readl(struct sdio_func *func, unsigned int addr, | 538 | u32 sdio_readl(struct sdio_func *func, unsigned int addr, int *err_ret) |
547 | int *err_ret) | ||
548 | { | 539 | { |
549 | int ret; | 540 | int ret; |
550 | 541 | ||
@@ -558,7 +549,7 @@ unsigned long sdio_readl(struct sdio_func *func, unsigned int addr, | |||
558 | return 0xFFFFFFFF; | 549 | return 0xFFFFFFFF; |
559 | } | 550 | } |
560 | 551 | ||
561 | return le32_to_cpu(*(u32*)func->tmpbuf); | 552 | return le32_to_cpup((__le32 *)func->tmpbuf); |
562 | } | 553 | } |
563 | EXPORT_SYMBOL_GPL(sdio_readl); | 554 | EXPORT_SYMBOL_GPL(sdio_readl); |
564 | 555 | ||
@@ -573,12 +564,11 @@ EXPORT_SYMBOL_GPL(sdio_readl); | |||
573 | * function. @err_ret will contain the status of the actual | 564 | * function. @err_ret will contain the status of the actual |
574 | * transfer. | 565 | * transfer. |
575 | */ | 566 | */ |
576 | void sdio_writel(struct sdio_func *func, unsigned long b, unsigned int addr, | 567 | void sdio_writel(struct sdio_func *func, u32 b, unsigned int addr, int *err_ret) |
577 | int *err_ret) | ||
578 | { | 568 | { |
579 | int ret; | 569 | int ret; |
580 | 570 | ||
581 | *(u32*)func->tmpbuf = cpu_to_le32(b); | 571 | *(__le32 *)func->tmpbuf = cpu_to_le32(b); |
582 | 572 | ||
583 | ret = sdio_memcpy_toio(func, addr, func->tmpbuf, 4); | 573 | ret = sdio_memcpy_toio(func, addr, func->tmpbuf, 4); |
584 | if (err_ret) | 574 | if (err_ret) |