• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/linux/linux-2.6/drivers/mmc/core/

Lines Matching refs:func

21  *	@func: SDIO function that will be accessed
26 void sdio_claim_host(struct sdio_func *func)
28 BUG_ON(!func);
29 BUG_ON(!func->card);
31 mmc_claim_host(func->card->host);
37 * @func: SDIO function that was accessed
42 void sdio_release_host(struct sdio_func *func)
44 BUG_ON(!func);
45 BUG_ON(!func->card);
47 mmc_release_host(func->card->host);
53 * @func: SDIO function to enable
58 int sdio_enable_func(struct sdio_func *func)
64 BUG_ON(!func);
65 BUG_ON(!func->card);
67 pr_debug("SDIO: Enabling device %s...\n", sdio_func_id(func));
69 ret = mmc_io_rw_direct(func->card, 0, 0, SDIO_CCCR_IOEx, 0, &reg);
73 reg |= 1 << func->num;
75 ret = mmc_io_rw_direct(func->card, 1, 0, SDIO_CCCR_IOEx, reg, NULL);
79 timeout = jiffies + msecs_to_jiffies(func->enable_timeout);
82 ret = mmc_io_rw_direct(func->card, 0, 0, SDIO_CCCR_IORx, 0, &reg);
85 if (reg & (1 << func->num))
92 pr_debug("SDIO: Enabled device %s\n", sdio_func_id(func));
97 pr_debug("SDIO: Failed to enable device %s\n", sdio_func_id(func));
104 * @func: SDIO function to disable
109 int sdio_disable_func(struct sdio_func *func)
114 BUG_ON(!func);
115 BUG_ON(!func->card);
117 pr_debug("SDIO: Disabling device %s...\n", sdio_func_id(func));
119 ret = mmc_io_rw_direct(func->card, 0, 0, SDIO_CCCR_IOEx, 0, &reg);
123 reg &= ~(1 << func->num);
125 ret = mmc_io_rw_direct(func->card, 1, 0, SDIO_CCCR_IOEx, reg, NULL);
129 pr_debug("SDIO: Disabled device %s\n", sdio_func_id(func));
134 pr_debug("SDIO: Failed to disable device %s\n", sdio_func_id(func));
141 * @func: SDIO function to change
158 int sdio_set_block_size(struct sdio_func *func, unsigned blksz)
162 if (blksz > func->card->host->max_blk_size)
166 blksz = min(func->max_blksize, func->card->host->max_blk_size);
170 ret = mmc_io_rw_direct(func->card, 1, 0,
171 SDIO_FBR_BASE(func->num) + SDIO_FBR_BLKSIZE,
175 ret = mmc_io_rw_direct(func->card, 1, 0,
176 SDIO_FBR_BASE(func->num) + SDIO_FBR_BLKSIZE + 1,
180 func->cur_blksize = blksz;
188 static inline unsigned int sdio_max_byte_size(struct sdio_func *func)
190 unsigned mval = min(func->card->host->max_seg_size,
191 func->card->host->max_blk_size);
193 if (mmc_blksz_for_byte_mode(func->card))
194 mval = min(mval, func->cur_blksize);
196 mval = min(mval, func->max_blksize);
203 * @func: SDIO function
215 unsigned int sdio_align_size(struct sdio_func *func, unsigned int sz)
228 sz = mmc_align_data_size(func->card, sz);
234 if (sz <= sdio_max_byte_size(func))
237 if (func->card->cccr.multi_block) {
241 if ((sz % func->cur_blksize) == 0)
248 blk_sz = ((sz + func->cur_blksize - 1) /
249 func->cur_blksize) * func->cur_blksize;
250 blk_sz = mmc_align_data_size(func->card, blk_sz);
256 if ((blk_sz % func->cur_blksize) == 0)
263 byte_sz = mmc_align_data_size(func->card,
264 sz % func->cur_blksize);
265 if (byte_sz <= sdio_max_byte_size(func)) {
266 blk_sz = sz / func->cur_blksize;
267 return blk_sz * func->cur_blksize + byte_sz;
274 chunk_sz = mmc_align_data_size(func->card,
275 sdio_max_byte_size(func));
276 if (chunk_sz == sdio_max_byte_size(func)) {
282 byte_sz = mmc_align_data_size(func->card,
300 static int sdio_io_rw_ext_helper(struct sdio_func *func, int write,
308 if (func->card->cccr.multi_block && (size > sdio_max_byte_size(func))) {
312 max_blocks = min(func->card->host->max_blk_count,
313 func->card->host->max_seg_size / func->cur_blksize);
316 while (remainder > func->cur_blksize) {
319 blocks = remainder / func->cur_blksize;
322 size = blocks * func->cur_blksize;
324 ret = mmc_io_rw_extended(func->card, write,
325 func->num, addr, incr_addr, buf,
326 blocks, func->cur_blksize);
339 size = min(remainder, sdio_max_byte_size(func));
341 ret = mmc_io_rw_extended(func->card, write, func->num, addr,
356 * @func: SDIO function to access
364 u8 sdio_readb(struct sdio_func *func, unsigned int addr, int *err_ret)
369 BUG_ON(!func);
374 ret = mmc_io_rw_direct(func->card, 0, func->num, addr, 0, &val);
387 * @func: SDIO function to access
396 void sdio_writeb(struct sdio_func *func, u8 b, unsigned int addr, int *err_ret)
400 BUG_ON(!func);
402 ret = mmc_io_rw_direct(func->card, 1, func->num, addr, b, NULL);
410 * @func: SDIO function to access
421 u8 sdio_writeb_readb(struct sdio_func *func, u8 write_byte,
427 ret = mmc_io_rw_direct(func->card, 1, func->num, addr,
440 * @func: SDIO function to access
448 int sdio_memcpy_fromio(struct sdio_func *func, void *dst,
451 return sdio_io_rw_ext_helper(func, 0, addr, 1, dst, count);
457 * @func: SDIO function to access
465 int sdio_memcpy_toio(struct sdio_func *func, unsigned int addr,
468 return sdio_io_rw_ext_helper(func, 1, addr, 1, src, count);
474 * @func: SDIO function to access
482 int sdio_readsb(struct sdio_func *func, void *dst, unsigned int addr,
485 return sdio_io_rw_ext_helper(func, 0, addr, 0, dst, count);
491 * @func: SDIO function to access
499 int sdio_writesb(struct sdio_func *func, unsigned int addr, void *src,
502 return sdio_io_rw_ext_helper(func, 1, addr, 0, src, count);
508 * @func: SDIO function to access
516 u16 sdio_readw(struct sdio_func *func, unsigned int addr, int *err_ret)
523 ret = sdio_memcpy_fromio(func, func->tmpbuf, addr, 2);
530 return le16_to_cpup((__le16 *)func->tmpbuf);
536 * @func: SDIO function to access
545 void sdio_writew(struct sdio_func *func, u16 b, unsigned int addr, int *err_ret)
549 *(__le16 *)func->tmpbuf = cpu_to_le16(b);
551 ret = sdio_memcpy_toio(func, addr, func->tmpbuf, 2);
559 * @func: SDIO function to access
568 u32 sdio_readl(struct sdio_func *func, unsigned int addr, int *err_ret)
575 ret = sdio_memcpy_fromio(func, func->tmpbuf, addr, 4);
582 return le32_to_cpup((__le32 *)func->tmpbuf);
588 * @func: SDIO function to access
597 void sdio_writel(struct sdio_func *func, u32 b, unsigned int addr, int *err_ret)
601 *(__le32 *)func->tmpbuf = cpu_to_le32(b);
603 ret = sdio_memcpy_toio(func, addr, func->tmpbuf, 4);
611 * @func: an SDIO function of the card
619 unsigned char sdio_f0_readb(struct sdio_func *func, unsigned int addr,
625 BUG_ON(!func);
630 ret = mmc_io_rw_direct(func->card, 0, 0, addr, 0, &val);
643 * @func: an SDIO function of the card
655 void sdio_f0_writeb(struct sdio_func *func, unsigned char b, unsigned int addr,
660 BUG_ON(!func);
662 if ((addr < 0xF0 || addr > 0xFF) && (!mmc_card_lenient_fn0(func->card))) {
668 ret = mmc_io_rw_direct(func->card, 1, 0, addr, b, NULL);
676 * @func: SDIO function attached to host
684 mmc_pm_flag_t sdio_get_host_pm_caps(struct sdio_func *func)
686 BUG_ON(!func);
687 BUG_ON(!func->card);
689 return func->card->host->pm_caps;
695 * @func: SDIO function attached to host
705 int sdio_set_host_pm_flags(struct sdio_func *func, mmc_pm_flag_t flags)
709 BUG_ON(!func);
710 BUG_ON(!func->card);
712 host = func->card->host;