Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Functions
sdio_func.h File Reference
#include <linux/device.h>
#include <linux/mod_devicetable.h>
#include <linux/mmc/pm.h>

Go to the source code of this file.

Data Structures

struct  sdio_func_tuple
 
struct  sdio_func
 
struct  sdio_driver
 

Macros

#define SDIO_STATE_PRESENT   (1<<0) /* present in sysfs */
 
#define sdio_func_present(f)   ((f)->state & SDIO_STATE_PRESENT)
 
#define sdio_func_set_present(f)   ((f)->state |= SDIO_STATE_PRESENT)
 
#define sdio_func_id(f)   (dev_name(&(f)->dev))
 
#define sdio_get_drvdata(f)   dev_get_drvdata(&(f)->dev)
 
#define sdio_set_drvdata(f, d)   dev_set_drvdata(&(f)->dev, d)
 
#define dev_to_sdio_func(d)   container_of(d, struct sdio_func, dev)
 
#define to_sdio_driver(d)   container_of(d, struct sdio_driver, drv)
 
#define SDIO_DEVICE(vend, dev)
 
#define SDIO_DEVICE_CLASS(dev_class)
 

Typedefs

typedef voidsdio_irq_handler_t )(struct sdio_func *)
 

Functions

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

Macro Definition Documentation

#define dev_to_sdio_func (   d)    container_of(d, struct sdio_func, dev)

Definition at line 72 of file sdio_func.h.

#define SDIO_DEVICE (   vend,
  dev 
)
Value:
.class = SDIO_ANY_ID, \
.vendor = (vend), .device = (dev)

SDIO_DEVICE - macro used to describe a specific SDIO device : the 16 bit manufacturer code : the 16 bit function id

This macro is used to create a struct sdio_device_id that matches a specific device. The class field will be set to SDIO_ANY_ID.

Definition at line 97 of file sdio_func.h.

#define SDIO_DEVICE_CLASS (   dev_class)
Value:

SDIO_DEVICE_CLASS - macro used to describe a specific SDIO device class : the 8 bit standard interface code

This macro is used to create a struct sdio_device_id that matches a specific standard SDIO function type. The vendor and device fields will be set to SDIO_ANY_ID.

Definition at line 109 of file sdio_func.h.

#define sdio_func_id (   f)    (dev_name(&(f)->dev))

Definition at line 68 of file sdio_func.h.

#define sdio_func_present (   f)    ((f)->state & SDIO_STATE_PRESENT)

Definition at line 64 of file sdio_func.h.

#define sdio_func_set_present (   f)    ((f)->state |= SDIO_STATE_PRESENT)

Definition at line 66 of file sdio_func.h.

#define sdio_get_drvdata (   f)    dev_get_drvdata(&(f)->dev)

Definition at line 70 of file sdio_func.h.

#define sdio_set_drvdata (   f,
  d 
)    dev_set_drvdata(&(f)->dev, d)

Definition at line 71 of file sdio_func.h.

#define SDIO_STATE_PRESENT   (1<<0) /* present in sysfs */

Definition at line 54 of file sdio_func.h.

#define to_sdio_driver (   d)    container_of(d, struct sdio_driver, drv)

Definition at line 87 of file sdio_func.h.

Typedef Documentation

typedef void( sdio_irq_handler_t)(struct sdio_func *)

Definition at line 23 of file sdio_func.h.

Function Documentation

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_claim_irq ( struct sdio_func func,
sdio_irq_handler_t handler 
)

sdio_claim_irq - claim the IRQ for a SDIO function : SDIO function : IRQ handler callback

Claim and activate the IRQ for the given SDIO function. The provided handler will be called when that IRQ is asserted. The host is always claimed already when the handler is called so the handler must not call sdio_claim_host() nor sdio_release_host().

Definition at line 238 of file sdio_irq.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.

int sdio_register_driver ( struct sdio_driver drv)

sdio_register_driver - register a function driver : SDIO function driver

Definition at line 236 of file sdio_bus.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_release_irq ( struct sdio_func func)

sdio_release_irq - release the IRQ for a SDIO function : SDIO function

Disable and release the IRQ for the given SDIO function.

Definition at line 281 of file sdio_irq.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_unregister_driver ( struct sdio_driver drv)

sdio_unregister_driver - unregister a function driver : SDIO function driver

Definition at line 248 of file sdio_bus.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.