Linux 驱动分析--s3c6410 的SDIO驱动分析-bluedrum-ChinaUnix博客
来源:互联网 发布:淘宝图片大小多少合适 编辑:程序博客网 时间:2024/06/07 08:41
static struct bus_type sdio_bus_type = {
.name = "sdio",
.dev_attrs = sdio_dev_attrs,
.match = sdio_bus_match,
.uevent = sdio_bus_uevent,
.probe = sdio_bus_probe,
.remove = sdio_bus_remove,
};
int sdio_register_bus(void)
{
return bus_register(&sdio_bus_type);
}
void sdio_unregister_bus(void)
{
bus_unregister(&sdio_bus_type);
}
/*
* SDIO function device driver
*/
struct sdio_driver {
char *name;
const struct sdio_device_id *id_table;
int (*probe)(struct sdio_func *, const struct sdio_device_id *);
void (*remove)(struct sdio_func *);
struct device_driver drv;
};
extern void sdio_unregister_driver(struct sdio_driver *);
/*
* SDIO function devices
*/
struct sdio_func {
struct mmc_card *card; /* the card this device belongs to */
struct device dev; /* the device */
sdio_irq_handler_t *irq_handler; /* IRQ callback */
unsigned int num; /* function number */
unsigned char class; /* standard interface class */
unsigned short vendor; /* vendor id */
unsigned short device; /* device id */
unsigned max_blksize; /* maximum block size */
unsigned cur_blksize; /* current block size */
unsigned enable_timeout; /* max enable timeout in msec */
unsigned int state; /* function state */
#define SDIO_STATE_PRESENT (1< present in sysfs p>
u8 tmpbuf[4]; /* DMA:able scratch buffer */
unsigned num_info; /* number of info strings */
const char **info; /* info strings */
struct sdio_func_tuple *tuples;
};
void sdio_remove_func(struct sdio_func *func);
static struct sdio_driver if_sdio_driver = {
.name = "libertas_sdio",
.id_table = if_sdio_ids,
.probe = if_sdio_probe,
.remove = if_sdio_remove,
};
static int __init if_sdio_init_module(void)
{
int ret = 0;
ret = sdio_register_driver(&if_sdio_driver);
return ret;
}
static void __exit if_sdio_exit_module(void)
{
sdio_unregister_driver(&if_sdio_driver);
}
struct mmc_host {
struct device *parent;
struct device class_dev;
int index;
const struct mmc_host_ops *ops;
unsigned int f_min;
unsigned int f_max;
u32 ocr_avail;
unsigned long caps; /* Host capabilities */
/* host specific block data */
unsigned int max_seg_size; /* see blk_queue_max_segment_size */
unsigned short max_hw_segs; /* see blk_queue_max_hw_segments */
unsigned short max_phys_segs; /* see blk_queue_max_phys_segments */
unsigned short unused;
unsigned int max_req_size; /* maximum number of bytes in one req */
unsigned int max_blk_size; /* maximum size of one mmc block */
unsigned int max_blk_count; /* maximum number of blocks in one req */
/* private data */
spinlock_t lock; /* lock for claim and bus ops */
struct mmc_ios ios; /* current io bus settings */
u32 ocr; /* the current OCR setting */
/* group bitfields together to minimize padding */
unsigned int use_spi_crc:1;
unsigned int claimed:1; /* host exclusively claimed */
unsigned int bus_dead:1; /* bus has been released */
#ifdef CONFIG_MMC_DEBUG
unsigned int removed:1; /* host is being removed */
#endif
struct mmc_card *card; /* device attached to this host */
wait_queue_head_t wq;
struct delayed_work detect;
const struct mmc_bus_ops *bus_ops; /* current bus driver */
unsigned int bus_refs; /* reference counter */
unsigned int sdio_irqs;
struct task_struct *sdio_irq_thread;
atomic_t sdio_irq_thread_abort;
#ifdef CONFIG_LEDS_TRIGGERS
struct led_trigger *led; /* activity led */
#endif
struct dentry *debugfs_root;
unsigned long private[0] ____cacheline_aligned;
};
//drivers/mmc/core/host.c
static struct class mmc_host_class = {
.name = "mmc_host",
.dev_release = mmc_host_classdev_release,
};
int mmc_register_host_class(void)
{
return class_register(&mmc_host_class);
}
void mmc_unregister_host_class(void)
{
class_unregister(&mmc_host_class);
}
void (*request)(struct mmc_host *host, struct mmc_request *req);
void (*set_ios)(struct mmc_host *host, struct mmc_ios *ios);
int (*get_ro)(struct mmc_host *host);
int (*get_cd)(struct mmc_host *host);
void (*enable_sdio_irq)(struct mmc_host *host, int enable);
};
.request = s3c_hsmmc_request,
.set_ios = s3c_hsmmc_set_ios,
};
static struct bus_type mmc_bus_type = {
.name = "mmc",
.dev_attrs = mmc_dev_attrs,
.match = mmc_bus_match,
.uevent = mmc_bus_uevent,
.probe = mmc_bus_probe,
.remove = mmc_bus_remove,
.suspend = mmc_bus_suspend,
.resume = mmc_bus_resume,
};
int mmc_register_bus(void)
{
return bus_register(&mmc_bus_type);
}
void mmc_unregister_bus(void)
{
bus_unregister(&mmc_bus_type);
}
// include/linux/mmc/card.h
/*
* MMC device
*/
struct mmc_card {
struct mmc_host *host; /* the host this device belongs to */
struct device dev; /* the device */
unsigned int rca; /* relative card address of device */
unsigned int type; /* card type */
#define MMC_TYPE_MMC 0 /* MMC card */
#define MMC_TYPE_SD 1 /* SD card */
#define MMC_TYPE_SDIO 2 /* SDIO card */
unsigned int state; /* (our) card state */
#define MMC_STATE_PRESENT (1< present in sysfs br style='font-size:12px;font-style:normal;font-weight:normal;color:rgb(102, 102, 102);' />#define MMC_STATE_READONLY (1< card is read-only br style='font-size:12px;font-style:normal;font-weight:normal;color:rgb(102, 102, 102);' />#define MMC_STATE_HIGHSPEED (1< card is in high speed mode br style='font-size:12px;font-style:normal;font-weight:normal;color:rgb(102, 102, 102);' />#define MMC_STATE_BLOCKADDR (1< card uses block-addressing p>
u32 raw_cid[4]; /* raw card CID */
u32 raw_csd[4]; /* raw card CSD */
u32 raw_scr[2]; /* raw card SCR */
struct mmc_cid cid; /* card identification */
struct mmc_csd csd; /* card specific */
struct mmc_ext_csd ext_csd; /* mmc v4 extended card specific */
struct sd_scr scr; /* extra SD information */
struct sd_switch_caps sw_caps; /* switch (CMD6) caps */
unsigned int sdio_funcs; /* number of SDIO functions */
struct sdio_cccr cccr; /* common card info */
struct sdio_cis cis; /* common tuple info */
struct sdio_func *sdio_func[SDIO_MAX_FUNCS]; /* SDIO functions (devices) */
unsigned num_info; /* number of info strings */
const char **info; /* info strings */
struct sdio_func_tuple *tuples; /* unknown common tuples */
struct dentry *debugfs_root;
};
/*
* MMC device driver (e.g., Flash card, I/O card...)
*/
struct mmc_driver {
struct device_driver drv;
int (*probe)(struct mmc_card *);
void (*remove)(struct mmc_card *);
int (*suspend)(struct mmc_card *, pm_message_t);
int (*resume)(struct mmc_card *);
};
extern int mmc_register_driver(struct mmc_driver *);
extern void mmc_unregister_driver(struct mmc_driver *)
//driver/mmc/core/block.c
static struct mmc_driver mmc_driver = {
.drv = {
.name = "mmcblk",
},
.probe = mmc_blk_probe,
.remove = mmc_blk_remove,
.suspend = mmc_blk_suspend,
.resume = mmc_blk_resume,
};
.name = "s3c-hsmmc",
.id = 0,
.num_resources = ARRAY_SIZE(s3c_hsmmc0_resource),
.resource = s3c_hsmmc0_resource,
.dev = {
.platform_data = &s3c_hsmmc0_platform,
}
};
struct platform_device s3c_device_hsmmc1 = {
.name = "s3c-hsmmc",
.id = 1,
.num_resources = ARRAY_SIZE(s3c_hsmmc1_resource),
.resource = s3c_hsmmc1_resource,
.dev = {
.platform_data = &s3c_hsmmc1_platform,
}
};
{
.probe = s3c_hsmmc_probe,
.remove = s3c_hsmmc_remove,
.suspend = s3c_hsmmc_suspend,
.resume = s3c_hsmmc_resume,
.driver = {
.name = "s3c-hsmmc",
.owner = THIS_MODULE,
},
};
static int __init s3c_hsmmc_drv_init(void)
{
return platform_driver_register(&s3c_hsmmc_driver);
}
static void __exit s3c_hsmmc_drv_exit(void)
{
platform_driver_unregister(&s3c_hsmmc_driver);
}
struct s3c_sdhci_platdata s3c_hsmmc0_def_platdata = {
.max_width = 4,
.host_caps = (MMC_CAP_4_BIT_DATA | MMC_CAP_MMC_HIGHSPEED |
MMC_CAP_SD_HIGHSPEED),
.cfg_ext_cd = setup_sdhci0_irq_cd,
.detect_ext_cd = detect_sdhci0_irq_cd,
.ext_cd = S3C_EINT(13),
};
struct platform_device s3c_device_hsmmc0 = {
.name = "s3c-sdhci",
.id = 0,
.num_resources = ARRAY_SIZE(s3c_hsmmc_resource),
.resource = s3c_hsmmc_resource,
.dev = {
.dma_mask = &s3c_device_hsmmc_dmamask,
.coherent_dma_mask = 0xffffffffUL,
.platform_data = &s3c_hsmmc0_def_platdata,
},
};
//drivers/mmc/host/sdhci-s3c.c
static struct platform_driver sdhci_s3c_driver = {
.probe = sdhci_s3c_probe,
.remove = __devexit_p(sdhci_s3c_remove),
.suspend = sdhci_s3c_suspend,
.resume = sdhci_s3c_resume,
.driver = {
.owner = THIS_MODULE,
.name = "s3c-sdhci",
},
};
- Linux 驱动分析--s3c6410 的SDIO驱动分析-bluedrum-ChinaUnix博客
- Linux 驱动分析--s3c6410 的SDIO驱动分析-bluedrum-ChinaUnix博客
- Linux 驱动分析--s3c6410 的SDIO驱动分析
- Linux I2C驱动分析 S3C6410
- s3c6410 linux DMA驱动分析
- s3c6410 linux DMA驱动分析
- Linux下Liberats SDIO wifi驱动分析
- Linux下Liberats SDIO wifi驱动分析
- Linux下Liberats SDIO wifi驱动分析
- Linux SD/MMC/SDIO驱动分析
- Linux SD/MMC/SDIO驱动分析
- Linux SD/MMC/SDIO驱动分析
- linux下SD/MMC/SDIO驱动分析
- Linux SD/MMC/SDIO驱动分析(新)
- 基于linux-2.6.38.8内核的SDIO/wifi驱动分析
- 基于linux-2.6.38.8内核的SDIO/wifi驱动分析
- 基于linux-2.6.38.8内核的SDIO/wifi驱动分析
- 基于linux-2.6.38.8内核的SDIO/wifi驱动分析
- 变量和数据库事务
- activiti5 Junit4 Spring测试环境搭建
- WLAN驱动分析文档_gzc126_新浪博客
- 主题:同步/异步及阻塞/非阻塞
- Linux MMC/SD/SDIO体系结构 - 谦虚 勤奋就能更强 - 51CTO技术博客
- Linux 驱动分析--s3c6410 的SDIO驱动分析-bluedrum-ChinaUnix博客
- SDIO总线 驱动 - Dybinx的专栏 - 博客频道 - CSDN.NET
- 基于S3C2410的SD卡linux驱动工作原理(二)
- 关于java.lang.IllegalArgumentException: View not attached to window manager 错误的分析
- Hibernate Session方法小结
- linux设备驱动那点事儿之SD卡驱动理论篇
- Hibernate中两种获取Session的方式
- 【代码阅读的方法与实践】第2章 基本编程元素
- 【代码阅读的方法与实践】第3章 高级C数据类型