aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-x[-rw-r--r--]drivers/mmc/core/sdio_io.c42
-rwxr-xr-x[-rw-r--r--]include/linux/mmc/sdio_func.h15
2 files changed, 22 insertions, 35 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 */
367unsigned char sdio_readb(struct sdio_func *func, unsigned int addr, 364u8 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 */
400void sdio_writeb(struct sdio_func *func, unsigned char b, unsigned int addr, 396void 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
463EXPORT_SYMBOL_GPL(sdio_readsb); 457EXPORT_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 */
492unsigned short sdio_readw(struct sdio_func *func, unsigned int addr, 486u16 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}
509EXPORT_SYMBOL_GPL(sdio_readw); 502EXPORT_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 */
522void sdio_writew(struct sdio_func *func, unsigned short b, unsigned int addr, 515void 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 */
546unsigned long sdio_readl(struct sdio_func *func, unsigned int addr, 538u32 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}
563EXPORT_SYMBOL_GPL(sdio_readl); 554EXPORT_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 */
576void sdio_writel(struct sdio_func *func, unsigned long b, unsigned int addr, 567void 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)
diff --git a/include/linux/mmc/sdio_func.h b/include/linux/mmc/sdio_func.h
index f57f22b3be88..28fb0a33acf8 100644..100755
--- a/include/linux/mmc/sdio_func.h
+++ b/include/linux/mmc/sdio_func.h
@@ -122,23 +122,20 @@ extern int sdio_release_irq(struct sdio_func *func);
122 122
123extern unsigned int sdio_align_size(struct sdio_func *func, unsigned int sz); 123extern unsigned int sdio_align_size(struct sdio_func *func, unsigned int sz);
124 124
125extern unsigned char sdio_readb(struct sdio_func *func, 125extern u8 sdio_readb(struct sdio_func *func, unsigned int addr, int *err_ret);
126 unsigned int addr, int *err_ret); 126extern u16 sdio_readw(struct sdio_func *func, unsigned int addr, int *err_ret);
127extern unsigned short sdio_readw(struct sdio_func *func, 127extern u32 sdio_readl(struct sdio_func *func, unsigned int addr, int *err_ret);
128 unsigned int addr, int *err_ret);
129extern unsigned long sdio_readl(struct sdio_func *func,
130 unsigned int addr, int *err_ret);
131 128
132extern int sdio_memcpy_fromio(struct sdio_func *func, void *dst, 129extern int sdio_memcpy_fromio(struct sdio_func *func, void *dst,
133 unsigned int addr, int count); 130 unsigned int addr, int count);
134extern int sdio_readsb(struct sdio_func *func, void *dst, 131extern int sdio_readsb(struct sdio_func *func, void *dst,
135 unsigned int addr, int count); 132 unsigned int addr, int count);
136 133
137extern void sdio_writeb(struct sdio_func *func, unsigned char b, 134extern void sdio_writeb(struct sdio_func *func, u8 b,
138 unsigned int addr, int *err_ret); 135 unsigned int addr, int *err_ret);
139extern void sdio_writew(struct sdio_func *func, unsigned short b, 136extern void sdio_writew(struct sdio_func *func, u16 b,
140 unsigned int addr, int *err_ret); 137 unsigned int addr, int *err_ret);
141extern void sdio_writel(struct sdio_func *func, unsigned long b, 138extern void sdio_writel(struct sdio_func *func, u32 b,
142 unsigned int addr, int *err_ret); 139 unsigned int addr, int *err_ret);
143 140
144extern int sdio_memcpy_toio(struct sdio_func *func, unsigned int addr, 141extern int sdio_memcpy_toio(struct sdio_func *func, unsigned int addr,