Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
sdio_io.c File Reference
#include <linux/export.h>
#include <linux/mmc/host.h>
#include <linux/mmc/card.h>
#include <linux/mmc/sdio.h>
#include <linux/mmc/sdio_func.h>
#include "sdio_ops.h"

Go to the source code of this file.

Functions

void sdio_claim_host (struct sdio_func *func)
 
 EXPORT_SYMBOL_GPL (sdio_claim_host)
 
void sdio_release_host (struct sdio_func *func)
 
 EXPORT_SYMBOL_GPL (sdio_release_host)
 
int sdio_enable_func (struct sdio_func *func)
 
 EXPORT_SYMBOL_GPL (sdio_enable_func)
 
int sdio_disable_func (struct sdio_func *func)
 
 EXPORT_SYMBOL_GPL (sdio_disable_func)
 
int sdio_set_block_size (struct sdio_func *func, unsigned blksz)
 
 EXPORT_SYMBOL_GPL (sdio_set_block_size)
 
unsigned int sdio_align_size (struct sdio_func *func, unsigned int sz)
 
 EXPORT_SYMBOL_GPL (sdio_align_size)
 
u8 sdio_readb (struct sdio_func *func, unsigned int addr, int *err_ret)
 
 EXPORT_SYMBOL_GPL (sdio_readb)
 
void sdio_writeb (struct sdio_func *func, u8 b, unsigned int addr, int *err_ret)
 
 EXPORT_SYMBOL_GPL (sdio_writeb)
 
u8 sdio_writeb_readb (struct sdio_func *func, u8 write_byte, unsigned int addr, int *err_ret)
 
 EXPORT_SYMBOL_GPL (sdio_writeb_readb)
 
int sdio_memcpy_fromio (struct sdio_func *func, void *dst, unsigned int addr, int count)
 
 EXPORT_SYMBOL_GPL (sdio_memcpy_fromio)
 
int sdio_memcpy_toio (struct sdio_func *func, unsigned int addr, void *src, int count)
 
 EXPORT_SYMBOL_GPL (sdio_memcpy_toio)
 
int sdio_readsb (struct sdio_func *func, void *dst, unsigned int addr, int count)
 
 EXPORT_SYMBOL_GPL (sdio_readsb)
 
int sdio_writesb (struct sdio_func *func, unsigned int addr, void *src, int count)
 
 EXPORT_SYMBOL_GPL (sdio_writesb)
 
u16 sdio_readw (struct sdio_func *func, unsigned int addr, int *err_ret)
 
 EXPORT_SYMBOL_GPL (sdio_readw)
 
void sdio_writew (struct sdio_func *func, u16 b, unsigned int addr, int *err_ret)
 
 EXPORT_SYMBOL_GPL (sdio_writew)
 
u32 sdio_readl (struct sdio_func *func, unsigned int addr, int *err_ret)
 
 EXPORT_SYMBOL_GPL (sdio_readl)
 
void sdio_writel (struct sdio_func *func, u32 b, unsigned int addr, int *err_ret)
 
 EXPORT_SYMBOL_GPL (sdio_writel)
 
unsigned char sdio_f0_readb (struct sdio_func *func, unsigned int addr, int *err_ret)
 
 EXPORT_SYMBOL_GPL (sdio_f0_readb)
 
void sdio_f0_writeb (struct sdio_func *func, unsigned char b, unsigned int addr, int *err_ret)
 
 EXPORT_SYMBOL_GPL (sdio_f0_writeb)
 
mmc_pm_flag_t sdio_get_host_pm_caps (struct sdio_func *func)
 
 EXPORT_SYMBOL_GPL (sdio_get_host_pm_caps)
 
int sdio_set_host_pm_flags (struct sdio_func *func, mmc_pm_flag_t flags)
 
 EXPORT_SYMBOL_GPL (sdio_set_host_pm_flags)
 

Function Documentation

EXPORT_SYMBOL_GPL ( sdio_claim_host  )
EXPORT_SYMBOL_GPL ( sdio_release_host  )
EXPORT_SYMBOL_GPL ( sdio_enable_func  )
EXPORT_SYMBOL_GPL ( sdio_disable_func  )
EXPORT_SYMBOL_GPL ( sdio_set_block_size  )
EXPORT_SYMBOL_GPL ( sdio_align_size  )
EXPORT_SYMBOL_GPL ( sdio_readb  )
EXPORT_SYMBOL_GPL ( sdio_writeb  )
EXPORT_SYMBOL_GPL ( sdio_writeb_readb  )
EXPORT_SYMBOL_GPL ( sdio_memcpy_fromio  )
EXPORT_SYMBOL_GPL ( sdio_memcpy_toio  )
EXPORT_SYMBOL_GPL ( sdio_readsb  )
EXPORT_SYMBOL_GPL ( sdio_writesb  )
EXPORT_SYMBOL_GPL ( sdio_readw  )
EXPORT_SYMBOL_GPL ( sdio_writew  )
EXPORT_SYMBOL_GPL ( sdio_readl  )
EXPORT_SYMBOL_GPL ( sdio_writel  )
EXPORT_SYMBOL_GPL ( sdio_f0_readb  )
EXPORT_SYMBOL_GPL ( sdio_f0_writeb  )
EXPORT_SYMBOL_GPL ( sdio_get_host_pm_caps  )
EXPORT_SYMBOL_GPL ( sdio_set_host_pm_flags  )
unsigned int sdio_align_size ( struct sdio_func func,
unsigned int  sz 
)

sdio_align_size - pads a transfer size to a more optimal value : SDIO function : original transfer size

Pads the original data size with a number of extra bytes in order to avoid controller bugs and/or performance hits (e.g. some controllers revert to PIO for certain sizes).

If possible, it will also adjust the size so that it can be handled in just a single request.

Returns the improved size, which might be unmodified.

Definition at line 219 of file sdio_io.c.

void sdio_claim_host ( struct sdio_func func)

sdio_claim_host - exclusively claim a bus for a certain SDIO function : SDIO function that will be accessed

Claim a bus for a set of operations. The SDIO function given is used to figure out which bus is relevant.

Definition at line 27 of file sdio_io.c.

int sdio_disable_func ( struct sdio_func func)

sdio_disable_func - disable a SDIO function : SDIO function to disable

Powers down and deactivates a SDIO function. Register access to this function will fail until the function is reenabled.

Definition at line 110 of file sdio_io.c.

int sdio_enable_func ( struct sdio_func func)

sdio_enable_func - enables a SDIO function for usage : SDIO function to enable

Powers up and activates a SDIO function so that register access is possible.

Definition at line 59 of file sdio_io.c.

unsigned char sdio_f0_readb ( struct sdio_func func,
unsigned int  addr,
int err_ret 
)

sdio_f0_readb - read a single byte from SDIO function 0 : an SDIO function of the card : address to read : optional status value from transfer

Reads a single byte from the address space of SDIO function 0. If there is a problem reading the address, 0xff is returned and will contain the error code.

Definition at line 624 of file sdio_io.c.

void sdio_f0_writeb ( struct sdio_func func,
unsigned char  b,
unsigned int  addr,
int err_ret 
)

sdio_f0_writeb - write a single byte to SDIO function 0 : an SDIO function of the card : byte to write : address to write to : optional status value from transfer

Writes a single byte to the address space of SDIO function 0. will contain the status of the actual transfer.

Only writes to the vendor specific CCCR registers (0xF0 - 0xFF) are permiited; will be set to -EINVAL for * writes outside this range.

Definition at line 660 of file sdio_io.c.

mmc_pm_flag_t sdio_get_host_pm_caps ( struct sdio_func func)

sdio_get_host_pm_caps - get host power management capabilities : SDIO function attached to host

Returns a capability bitmask corresponding to power management features supported by the host controller that the card function might rely upon during a system suspend. The host doesn't need to be claimed, nor the function active, for this information to be obtained.

Definition at line 689 of file sdio_io.c.

int sdio_memcpy_fromio ( struct sdio_func func,
void dst,
unsigned int  addr,
int  count 
)

sdio_memcpy_fromio - read a chunk of memory from a SDIO function : SDIO function to access : buffer to store the data : address to begin reading from : number of bytes to read

Reads from the address space of a given SDIO function. Return value indicates if the transfer succeeded or not.

Definition at line 453 of file sdio_io.c.

int sdio_memcpy_toio ( struct sdio_func func,
unsigned int  addr,
void src,
int  count 
)

sdio_memcpy_toio - write a chunk of memory to a SDIO function : SDIO function to access : address to start writing to : buffer that contains the data to write : number of bytes to write

Writes to the address space of a given SDIO function. Return value indicates if the transfer succeeded or not.

Definition at line 470 of file sdio_io.c.

u8 sdio_readb ( struct sdio_func func,
unsigned int  addr,
int err_ret 
)

sdio_readb - read a single byte from a SDIO function : SDIO function to access : address to read : optional status value from transfer

Reads a single byte from the address space of a given SDIO function. If there is a problem reading the address, 0xff is returned and will contain the error code.

Definition at line 369 of file sdio_io.c.

u32 sdio_readl ( struct sdio_func func,
unsigned int  addr,
int err_ret 
)

sdio_readl - read a 32 bit integer from a SDIO function : SDIO function to access : address to read : optional status value from transfer

Reads a 32 bit integer from the address space of a given SDIO function. If there is a problem reading the address, 0xffffffff is returned and will contain the error code.

Definition at line 573 of file sdio_io.c.

int sdio_readsb ( struct sdio_func func,
void dst,
unsigned int  addr,
int  count 
)

sdio_readsb - read from a FIFO on a SDIO function : SDIO function to access : buffer to store the data : address of (single byte) FIFO : number of bytes to read

Reads from the specified FIFO of a given SDIO function. Return value indicates if the transfer succeeded or not.

Definition at line 487 of file sdio_io.c.

u16 sdio_readw ( struct sdio_func func,
unsigned int  addr,
int err_ret 
)

sdio_readw - read a 16 bit integer from a SDIO function : SDIO function to access : address to read : optional status value from transfer

Reads a 16 bit integer from the address space of a given SDIO function. If there is a problem reading the address, 0xffff is returned and will contain the error code.

Definition at line 521 of file sdio_io.c.

void sdio_release_host ( struct sdio_func func)

sdio_release_host - release a bus for a certain SDIO function : SDIO function that was accessed

Release a bus, allowing others to claim the bus for their operations.

Definition at line 43 of file sdio_io.c.

int sdio_set_block_size ( struct sdio_func func,
unsigned  blksz 
)

sdio_set_block_size - set the block size of an SDIO function : SDIO function to change : new block size or 0 to use the default.

The default block size is the largest supported by both the function and the host, with a maximum of 512 to ensure that arbitrarily sized data transfer use the optimal (least) number of commands.

A driver may call this to override the default block size set by the core. This can be used to set a block size greater than the maximum that reported by the card; it is the driver's responsibility to ensure it uses a value that the card supports.

Returns 0 on success, -EINVAL if the host does not support the requested block size, or -EIO (etc.) if one of the resultant FBR block size register writes failed.

Definition at line 159 of file sdio_io.c.

int sdio_set_host_pm_flags ( struct sdio_func func,
mmc_pm_flag_t  flags 
)

sdio_set_host_pm_flags - set wanted host power management capabilities : SDIO function attached to host

Set a capability bitmask corresponding to wanted host controller power management features for the upcoming suspend state. This must be called, if needed, each time the suspend method of the function driver is called, and must contain only bits that were returned by sdio_get_host_pm_caps(). The host doesn't need to be claimed, nor the function active, for this information to be set.

Definition at line 710 of file sdio_io.c.

void sdio_writeb ( struct sdio_func func,
u8  b,
unsigned int  addr,
int err_ret 
)

sdio_writeb - write a single byte to a SDIO function : SDIO function to access : byte to write : address to write to : optional status value from transfer

Writes a single byte to the address space of a given SDIO function. will contain the status of the actual transfer.

Definition at line 401 of file sdio_io.c.

u8 sdio_writeb_readb ( struct sdio_func func,
u8  write_byte,
unsigned int  addr,
int err_ret 
)

sdio_writeb_readb - write and read a byte from SDIO function : SDIO function to access : byte to write : address to write to : optional status value from transfer

Performs a RAW (Read after Write) operation as defined by SDIO spec - single byte is written to address space of a given SDIO function and response is read back from the same address, both using single request. If there is a problem with the operation, 0xff is returned and will contain the error code.

Definition at line 426 of file sdio_io.c.

void sdio_writel ( struct sdio_func func,
u32  b,
unsigned int  addr,
int err_ret 
)

sdio_writel - write a 32 bit integer to a SDIO function : SDIO function to access : integer to write : address to write to : optional status value from transfer

Writes a 32 bit integer to the address space of a given SDIO function. will contain the status of the actual transfer.

Definition at line 602 of file sdio_io.c.

int sdio_writesb ( struct sdio_func func,
unsigned int  addr,
void src,
int  count 
)

sdio_writesb - write to a FIFO of a SDIO function : SDIO function to access : address of (single byte) FIFO : buffer that contains the data to write : number of bytes to write

Writes to the specified FIFO of a given SDIO function. Return value indicates if the transfer succeeded or not.

Definition at line 504 of file sdio_io.c.

void sdio_writew ( struct sdio_func func,
u16  b,
unsigned int  addr,
int err_ret 
)

sdio_writew - write a 16 bit integer to a SDIO function : SDIO function to access : integer to write : address to write to : optional status value from transfer

Writes a 16 bit integer to the address space of a given SDIO function. will contain the status of the actual transfer.

Definition at line 550 of file sdio_io.c.