2 * linux/drivers/mmc/core/sdio_io.c
4 * Copyright 2007 Pierre Ossman
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or (at
9 * your option) any later version.
12 #include <linux/mmc/host.h>
13 #include <linux/mmc/card.h>
14 #include <linux/mmc/sdio_func.h>
19 * sdio_claim_host - exclusively claim a bus for a certain SDIO function
20 * @func: SDIO function that will be accessed
22 * Claim a bus for a set of operations. The SDIO function given
23 * is used to figure out which bus is relevant.
25 void sdio_claim_host(struct sdio_func *func)
30 mmc_claim_host(func->card->host);
32 EXPORT_SYMBOL_GPL(sdio_claim_host);
35 * sdio_release_host - release a bus for a certain SDIO function
36 * @func: SDIO function that was accessed
38 * Release a bus, allowing others to claim the bus for their
41 void sdio_release_host(struct sdio_func *func)
46 mmc_release_host(func->card->host);
48 EXPORT_SYMBOL_GPL(sdio_release_host);
51 * sdio_readb - read a single byte from a SDIO function
52 * @func: SDIO function to access
53 * @addr: address to read
54 * @err_ret: optional status value from transfer
56 * Reads a single byte from the address space of a given SDIO
57 * function. If there is a problem reading the address, 0xff
58 * is returned and @err_ret will contain the error code.
60 unsigned char sdio_readb(struct sdio_func *func, unsigned int addr,
71 ret = mmc_io_rw_direct(func->card, 0, func->num, addr, 0, &val);
80 EXPORT_SYMBOL_GPL(sdio_readb);
83 * sdio_writeb - write a single byte to a SDIO function
84 * @func: SDIO function to access
86 * @addr: address to write to
87 * @err_ret: optional status value from transfer
89 * Writes a single byte to the address space of a given SDIO
90 * function. @err_ret will contain the status of the actual
93 void sdio_writeb(struct sdio_func *func, unsigned char b, unsigned int addr,
100 ret = mmc_io_rw_direct(func->card, 1, func->num, addr, b, NULL);
104 EXPORT_SYMBOL_GPL(sdio_writeb);