基于QualComm的mmc driver解析(Kernel-3.10)——(2)sdio总线
2017-04-26 14:34
381 查看
sdio总线的注册函数也是在core.c 文件中调用注册的:
总线名字为sdio,
调用
以上两个函数是driver 匹配device使用的函数。
ret = sdio_register_bus(); if (ret) goto unregister_host_class;
sdio_register_bus在sdio_bus.c 文件中定义:
int sdio_register_bus(void) { return bus_register(&sdio_bus_type); }
sdio_register_bus通过
bus_register函数注册了sdio总线, sdio总线的结构体定义如下:
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, .pm = SDIO_PM_OPS_PTR, };
总线名字为sdio,
sdio_dev_attrs在bus目录下创建属性节点。
sdio_bus_match函数定义:
static int sdio_bus_match(struct device *dev, struct device_driver *drv) { struct sdio_func *func = dev_to_sdio_func(dev); struct sdio_driver *sdrv = to_sdio_driver(drv); if (sdio_match_device(func, sdrv)) return 1; return 0; }
调用
sdio_match_device:
static const struct sdio_device_id *sdio_match_device(struct sdio_func *func, struct sdio_driver *sdrv) { const struct sdio_device_id *ids; ids = sdrv->id_table; if (ids) { while (ids->class || ids->vendor || ids->device) { if (sdio_match_one(func, ids)) return ids; ids++; } } return NULL; }
以上两个函数是driver 匹配device使用的函数。
sdio_bus_probe函数:
static int sdio_bus_probe(struct device *dev) { struct sdio_driver *drv = to_sdio_driver(dev->driver); struct sdio_func *func = dev_to_sdio_func(dev); const struct sdio_device_id *id; int ret; id = sdio_match_device(func, drv); if (!id) return -ENODEV; /* Unbound SDIO functions are always suspended. * During probe, the function is set active and the usage count * is incremented. If the driver supports runtime PM, * it should call pm_runtime_put_noidle() in its probe routine and * pm_runtime_get_noresume() in its remove routine. */ if (func->card->host->caps & MMC_CAP_POWER_OFF_CARD) { ret = pm_runtime_get_sync(dev); if (ret < 0) goto disable_runtimepm; } /* Set the default block size so the driver is sure it's something * sensible. */ sdio_claim_host(func); ret = sdio_set_block_size(func, 0); sdio_release_host(func); if (ret) goto disable_runtimepm; ret = drv->probe(func, id); if (ret) goto disable_runtimepm; return 0; disable_runtimepm: if (func->card->host->caps & MMC_CAP_POWER_OFF_CARD) pm_runtime_put_noidle(dev); return ret; }
相关文章推荐
- 基于QualComm的mmc driver解析(Kernel-3.10)——(1)mmc bus
- 基于qualcomm平台Dragonboard 410c 的LCD driver移植解析
- sd 卡驱动在2.6内核的编写.sd/mmc/sdio kernel,sd/mmc/sdio 内核
- 基于STM32的SDIO用4位总线24MHZDMA模式操作SHDC卡。
- Device Module之device,driver和class(基于kernel 4.11)
- 基于IO Packet隐藏文件和注册表,过磁盘解析和总线解析
- 基于ARM含SD控制器的SD卡的SDIO模式驱动解析
- 基于STM32的SDIO用4位总线24MHZDMA模式操作SHDC卡
- 基于ARM含SD控制器的SD卡的SDIO模式驱动解析
- SDIO驱动(4)sdio总线上driver和设备的match
- 全面解析Linux 内核 3.10.x - 内核入口函数__kernel_entry
- sd 卡驱动在2.6内核的编写.sd/mmc/sdio kernel,sd/mmc/sdio 内核
- 基于ARM含SD控制器的SD卡的SDIO模式驱动解析
- kvm_mmu_page结构和用法解析(基于Kernel3.10.0)
- 全面解析Linux 内核 3.10.x - start_kernel()
- sd/mmc驱动总线函数指针解析
- 全面解析Linux 内核 3.10.x - 内核入口函数__kernel_entry
- 基于ARM含SD控制器的SD卡的SDIO模式驱动解析
- vring的创建(基于kernel 3.10, qemu2.0.0)
- 基于ARM含SD控制器的SD卡的SDIO模式驱动解析