00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef _SLOT_API_H
00010 #define _SLOT_API_H
00011
00012 #include <sdioemb/sdio_api.h>
00013
00014 struct sdioemb_slot;
00015
00031 #define SDIOEMB_BUS_FREQ_OFF 0
00032 #define SDIOEMB_BUS_FREQ_DEFAULT -1
00033 #define SDIOEMB_BUS_FREQ_IDLE -2
00034
00040 enum sdioemb_power {
00041 SDIOEMB_POWER_OFF = 0,
00042 SDIOEMB_POWER_3V3 = 33,
00043 };
00044
00050 struct slot_caps {
00051 int max_bus_freq;
00052 int max_bus_width;
00053 uint8_t cspi_mode;
00054 };
00055
00061 enum slot_controller_type {
00062 SDIOEMB_SLOT_TYPE_SD = 0,
00063 SDIOEMB_SLOT_TYPE_SPI,
00064 SDIOEMB_SLOT_TYPE_SPI_CSPI,
00065 };
00066
00072 enum sdioemb_add_func_status {
00076 SDIOEMB_ADD_FUNC_NOW = 0,
00081 SDIOEMB_ADD_FUNC_DEFERRED = 1,
00082 };
00083
00092 struct sdioemb_slot_notifiers {
00121 int (*add_function)(struct sdioemb_slot *slot, struct sdioemb_dev *fdev);
00122
00133 void (*del_function)(struct sdioemb_slot *slot, struct sdioemb_dev *fdev);
00134 };
00135
00136 struct sdioemb_slot_priv;
00137
00145 struct sdioemb_slot {
00155 char name[64];
00156
00160 enum slot_controller_type type;
00161
00190 int (*set_bus_freq)(struct sdioemb_slot *slot, int clk);
00191
00209 int (*set_bus_width)(struct sdioemb_slot *slot, int bus_width);
00210
00224 int (*start_cmd)(struct sdioemb_slot *slot, struct sdioemb_cmd *cmd);
00225
00235 int (*card_present)(struct sdioemb_slot *slot);
00236
00248 int (*card_power)(struct sdioemb_slot *slot, enum sdioemb_power power);
00249
00257 void (*enable_card_int)(struct sdioemb_slot *slot);
00258
00266 void (*disable_card_int)(struct sdioemb_slot *slot);
00267
00284 int (*hard_reset)(struct sdioemb_slot *slot);
00285
00286 struct slot_caps caps;
00287 int clock_freq;
00288 int bus_width;
00289 struct sdioemb_slot_notifiers notifs;
00290 int cspi_reg_pad;
00291 int cspi_burst_pad;
00292 struct sdioemb_slot_priv *priv;
00293 void * drv_data;
00294 };
00295
00296 struct sdioemb_slot *sdioemb_slot_alloc(size_t drv_data_size);
00297 void sdioemb_slot_free(struct sdioemb_slot *slot);
00298 int sdioemb_slot_register(struct sdioemb_slot *slot);
00299 void sdioemb_slot_unregister(struct sdioemb_slot *slot);
00300 int sdioemb_card_inserted(struct sdioemb_slot *slot);
00301 void sdioemb_card_removed(struct sdioemb_slot *slot);
00302 void sdioemb_interrupt(struct sdioemb_slot *slot);
00303 void sdioemb_cmd_complete(struct sdioemb_slot *slot, struct sdioemb_cmd *cmd);
00304
00305 void sdioemb_suspend(struct sdioemb_slot *slot);
00306 void sdioemb_resume(struct sdioemb_slot *slot);
00307
00308 void sdioemb_add_function(struct sdioemb_dev *fdev);
00309 void sdioemb_del_function(struct sdioemb_dev *fdev);
00310 void sdioemb_get_function(struct sdioemb_dev *fdev);
00311 void sdioemb_put_function(struct sdioemb_dev *fdev);
00312
00313 #endif