SDIO slot driver API

The SDIO slot driver API provides an interface for the SDIO layer to driver an SDIO slot (socket). More...

Data Structures

struct  slot_caps
struct  sdioemb_slot_notifiers
struct  sdioemb_slot

Defines

#define CSPI_FUNC(f)   (f)
#define CSPI_READ   0x10
#define CSPI_WRITE   0x20
#define CSPI_BURST   0x40
#define CSPI_TYPE_MASK   0x70
#define CSPI_MODE   0xf7
#define CSPI_MODE_PADDED_WRITE_HDRS   (1 << 7)
#define CSPI_MODE_PADDED_READ_HDRS   (1 << 6)
#define CSPI_MODE_BE_REG   (1 << 5)
#define CSPI_MODE_BE_BURST   (1 << 4)
#define CSPI_MODE_INT_ACTIVE_HIGH   (1 << 3)
#define CSPI_MODE_INT_ON_ERR   (1 << 2)
#define CSPI_MODE_LEN_FIELD_PRESENT   (1 << 1)
#define CSPI_MODE_DRV_MISO_ON_RISING_CLK   (1 << 0)
#define CSPI_STATUS   0xf8
#define CSPI_PADDING   0xf9
#define CSPI_PADDING_REG(p)   ((p) << 0)
#define CSPI_PADDING_BURST(p)   ((p) << 4)
#define CSPI_PADDING_MAX   15
#define CSPI_PADDING_REG_DFLT   0
#define CSPI_PADDING_BURST_DFLT   2
#define CSPI_REG_TRANSFER_LEN   (1 + 3 + CSPI_PADDING_MAX + 1 + 2)

Enumerations

enum  sdioemb_power {
  SDIOEMB_POWER_OFF = 0,
  SDIOEMB_POWER_3V3 = 33
}
enum  slot_controller_type {
  SDIOEMB_SLOT_TYPE_SD = 0,
  SDIOEMB_SLOT_TYPE_SPI,
  SDIOEMB_SLOT_TYPE_SPI_CSPI
}
enum  sdioemb_add_func_status {
  SDIOEMB_ADD_FUNC_NOW = 0,
  SDIOEMB_ADD_FUNC_DEFERRED = 1
}

Functions

int sdioemb_card_inserted (struct sdioemb_slot *slot)
void sdioemb_card_removed (struct sdioemb_slot *slot)
void sdioemb_cmd_complete (struct sdioemb_slot *slot, struct sdioemb_cmd *cmd)
void sdioemb_get_function (struct sdioemb_dev *fdev)
void sdioemb_put_function (struct sdioemb_dev *fdev)
void sdioemb_add_function (struct sdioemb_dev *fdev)
void sdioemb_del_function (struct sdioemb_dev *fdev)
void sdioemb_interrupt (struct sdioemb_slot *slot)
void sdioemb_suspend (struct sdioemb_slot *slot)
void sdioemb_resume (struct sdioemb_slot *slot)
struct sdioemb_slotsdioemb_slot_alloc (size_t drv_data_size)
void sdioemb_slot_free (struct sdioemb_slot *slot)
int sdioemb_slot_register (struct sdioemb_slot *slot)
void sdioemb_slot_unregister (struct sdioemb_slot *slot)

Detailed Description

The SDIO slot driver API provides an interface for the SDIO layer to driver an SDIO slot (socket).

Slot drivers register with the SDIO layer (sdioemb_slot_register()), providing functions to starting commands, enabling/disable card interrupts, card detection and bus power control.

Functions are provided to notify the SDIO layer when a command has completed (sdioemb_cmd_complete()) and when an SDIO card interrupt has occurred (sdioemb_interrupt()).


Define Documentation

#define CSPI_MODE   0xf7

CSPI_MODE function 0 register.

Various CSPI mode settings.

See also:
CSPI specification (CS-110124-SP)

#define CSPI_MODE_BE_REG   (1 << 5)

BigEndianRegisters bit of CSPI_MODE -- enable big-endian CSPI register reads and writes.

Warning:
This bit should never be set as it's not possible to use this mode without knowledge of which registers are 8 bit and which are 16 bit.


Enumeration Type Documentation

Return values from the add_function() notifier.

Enumerator:
SDIOEMB_ADD_FUNC_NOW  The core will call sdioemb_add_function().
SDIOEMB_ADD_FUNC_DEFERRED  The slot driver will call sdioemb_add_function() or the function driver will call sdioemb_driver_probe() directly.

Valid SDIO bus voltage levels.

Enumerator:
SDIOEMB_POWER_OFF  Power switched off.
SDIOEMB_POWER_3V3  Voltage set to 3.3V.

Controller hardware type.

Enumerator:
SDIOEMB_SLOT_TYPE_SD  SD/SDIO controller.
SDIOEMB_SLOT_TYPE_SPI  SPI controller.
SDIOEMB_SLOT_TYPE_SPI_CSPI  SPI controller capable of CSPI.


Function Documentation

void sdioemb_add_function ( struct sdioemb_dev fdev  ) 

Add a function to the list of functions available for use with function drivers.

A slot driver must call this if it returned SDIOEMB_ADD_FUNC_DEFERRED in its add_function() notifier.

Alternatively, sdioemb_driver_probe() can be called instead.

Parameters:
fdev the SDIO function to be added.

References sdioemb_dev::priv.

int sdioemb_card_inserted ( struct sdioemb_slot slot  ) 

Notify the SDIO layer that a card has been inserted.

Callable from: thread context.

Parameters:
slot the slot for the inserted card.
Returns:
0 if the inserted call was successfull initialized and enumerated.

-ve if the initialization failed.

References sdioemb_slot::name, sdioemb_slot::priv, sdioemb_card_removed(), and sdioemb_put_function().

void sdioemb_card_removed ( struct sdioemb_slot slot  ) 

Notify the SDIO layer that a card has been removed

Callable from: thread context.

Parameters:
slot the slot for the removed card.

References sdioemb_slot::name, sdioemb_slot::priv, and sdioemb_put_function().

Referenced by sdioemb_card_inserted().

void sdioemb_cmd_complete ( struct sdioemb_slot slot,
struct sdioemb_cmd cmd 
)

Notify the SDIO layer that an SDIO commmand has completed.

Slot drivers should set the cmd's status and response and call this when a command has completed (either successfully or not).

Callable from: interrupt context.

Parameters:
slot the slot which completed the command.
cmd the completed command.

References sdioemb_cmd::callback, sdioemb_slot::card_present, sdioemb_cmd::flags, SDIOEMB_CMD_ERR_NO_CARD, and sdioemb_cmd::status.

void sdioemb_del_function ( struct sdioemb_dev fdev  ) 

Remove a function from the list of functions available for use with function drivers.

This may be used if the slot driver called sdioemb_add_function().

Parameters:
fdev the SDIO function to be removed.

References sdioemb_dev::priv.

void sdioemb_get_function ( struct sdioemb_dev fdev  ) 

Increase the reference count for a function.

Parameters:
fdev the function.

References sdioemb_dev::priv.

void sdioemb_interrupt ( struct sdioemb_slot slot  ) 

Notify the SDIO layer that the card interrupt is asserted.

Callable from: interrupt context.

Parameters:
slot the slot with the asserted interrupt.

References sdioemb_func_driver::card_int_handler, sdioemb_slot::disable_card_int, sdioemb_dev::driver, and sdioemb_slot::priv.

void sdioemb_put_function ( struct sdioemb_dev fdev  ) 

Decrease the reference count for a function.

Parameters:
fdev the function.

References sdioemb_dev::priv.

Referenced by sdioemb_card_inserted(), and sdioemb_card_removed().

void sdioemb_resume ( struct sdioemb_slot slot  ) 

Notify the SDIO driver that the resume event has been received.

Parameters:
slot the slot being resumed.

References sdioemb_slot::priv.

struct sdioemb_slot* sdioemb_slot_alloc ( size_t  drv_data_size  )  [read]

Allocate and initialize and SDIO slot driver structure.

Callable from: thread context.

Parameters:
drv_data_size size of slot driver's drv_data.
Returns:
the allocated structure; or NULL if no memory could be allocated.

References sdioemb_slot::caps, sdioemb_slot::drv_data, slot_caps::max_bus_freq, and sdioemb_slot::priv.

void sdioemb_slot_free ( struct sdioemb_slot slot  ) 

Free a slot_driver allocated with sdioemb_slot_alloc().

Callable from: thread context.

Parameters:
slot the slot driver to free.

References sdioemb_slot::priv.

int sdioemb_slot_register ( struct sdioemb_slot slot  ) 

Register a slot driver with the SDIO layer.

Callable from: thread context.

Parameters:
slot the slot driver to register.
Returns:
0 on success; -ve on error: -ENOMEM - maximum number of slots are already registered.
See also:
SDIOEMB_SLOTS_MAX

References sdioemb_slot::name, and sdioemb_slot::priv.

Referenced by sdioemb_wdf_slot_register().

void sdioemb_slot_unregister ( struct sdioemb_slot slot  ) 

Unregister a slot driver from the SDIO layer.

Callable from: thread context.

Parameters:
slot the slot driver to unregister.

References sdioemb_slot::name.

Referenced by sdioemb_wdf_slot_unregister().

void sdioemb_suspend ( struct sdioemb_slot slot  ) 

Notify the SDIO driver that the suspend event has been received.

Parameters:
slot the slot being suspended.

References sdioemb_slot::priv.


Generated on Wed Oct 27 15:18:12 2010 for sdioemb by  doxygen 1.5.5