2007-05-26 19:48:18 +08:00
|
|
|
/*
|
|
|
|
* include/linux/mmc/sdio_func.h
|
|
|
|
*
|
|
|
|
* Copyright 2007 Pierre Ossman
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or (at
|
|
|
|
* your option) any later version.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef MMC_SDIO_FUNC_H
|
|
|
|
#define MMC_SDIO_FUNC_H
|
|
|
|
|
|
|
|
struct mmc_card;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* SDIO function devices
|
|
|
|
*/
|
|
|
|
struct sdio_func {
|
|
|
|
struct mmc_card *card; /* the card this device belongs to */
|
|
|
|
struct device dev; /* the device */
|
|
|
|
unsigned int num; /* function number */
|
2007-06-12 03:01:00 +08:00
|
|
|
|
|
|
|
unsigned char class; /* standard interface class */
|
|
|
|
unsigned short vendor; /* vendor id */
|
|
|
|
unsigned short device; /* device id */
|
|
|
|
|
2007-05-26 19:48:18 +08:00
|
|
|
unsigned int state; /* function state */
|
|
|
|
#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) ((f)->dev.bus_id)
|
|
|
|
|
2007-05-27 18:00:02 +08:00
|
|
|
#define sdio_get_drvdata(f) dev_get_drvdata(&(f)->dev)
|
|
|
|
#define sdio_set_drvdata(f,d) dev_set_drvdata(&(f)->dev, d)
|
|
|
|
|
|
|
|
/*
|
|
|
|
* SDIO function device driver
|
|
|
|
*/
|
|
|
|
struct sdio_driver {
|
|
|
|
char *name;
|
|
|
|
|
|
|
|
int (*probe)(struct sdio_func *);
|
|
|
|
void (*remove)(struct sdio_func *);
|
|
|
|
|
|
|
|
struct device_driver drv;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern int sdio_register_driver(struct sdio_driver *);
|
|
|
|
extern void sdio_unregister_driver(struct sdio_driver *);
|
|
|
|
|
2007-05-27 18:57:15 +08:00
|
|
|
/*
|
|
|
|
* SDIO I/O operations
|
|
|
|
*/
|
|
|
|
extern void sdio_claim_host(struct sdio_func *func);
|
|
|
|
extern void sdio_release_host(struct sdio_func *func);
|
|
|
|
|
2007-05-27 20:22:37 +08:00
|
|
|
extern int sdio_enable_func(struct sdio_func *func);
|
|
|
|
extern int sdio_disable_func(struct sdio_func *func);
|
|
|
|
|
2007-05-27 18:57:15 +08:00
|
|
|
extern unsigned char sdio_readb(struct sdio_func *func,
|
|
|
|
unsigned int addr, int *err_ret);
|
|
|
|
|
|
|
|
extern void sdio_writeb(struct sdio_func *func, unsigned char b,
|
|
|
|
unsigned int addr, int *err_ret);
|
|
|
|
|
2007-05-26 19:48:18 +08:00
|
|
|
#endif
|
|
|
|
|