简体   繁体   English

为什么ififd的pci linux实现使用“ platform_driver”而不是“ pci_driver”?

[英]Why is the pci linux implementation for ififd using “platform_driver” instead of “pci_driver”?

The PCI-IFIFD CAN implementation (drivers/net/can) of the linux mainline kernel ( link) is using the platform_driver structure instead of the pci_driver structure. linux主线内核( 链接)的PCI-IFIFD CAN实现(drivers / net / can)使用platform_driver结构而不是pci_driver结构。
I have some trouble differentiating between those two structures. 我在区分这两种结构时遇到了一些麻烦。 Therefor I informed myself: 为此,我通知自己:
- platform driver vs normal device driver - 平台驱动程序与普通设备驱动程序
- platform_driver -platform_driver
- pci_driver -pci_driver

According to the first source: 根据第一个消息来源:

Unlike PCI or USB devices, I2C devices are not enumerated at the hardware level (at run time). 与PCI或USB设备不同,I2C设备不是在硬件级别(运行时)枚举的。 Instead, the software must know (at compile time) which devices are connected on each I2C bus segment. 相反,软件必须(在编译时)知道每个I2C总线段上连接了哪些设备。 So USB and PCI are not platform devices . 因此,USB和PCI并不是平台设备

If this is the case, why is the PCI ififd implementation using the platform_driver struct? 如果是这种情况,为什么要使用platform_driver结构执行PCI ififd?
Additionally how can someone use this driver for pci-cards using ififd? 另外,有人如何使用ififd将此驱动程序用于PCI卡?

You have to differentiate platform_driver , which is bus (controller) driver and pci_driver which is PCI device driver (client on the bus). 您必须区分platform_driverpci_driver ,后者是总线(控制器)驱动程序,而pci_driver是PCI设备驱动程序(总线上的客户端)。

This is CAN Bus driver CAN bus driver for IFI CANFD controller 这是用于IFI CANFD控制器的CAN总线驱动程序

Bus controlers (adapters) are registered to kernel as platform_devices 总线控制程序(适配器)作为platform_devices注册到内核

PCI driver provides hooks (callbacks) and structures to register PCI device to kernel PCI layer and bind it to device. PCI驱动程序提供挂钩(回调)和结构,以将PCI设备注册到内核PCI层并将其绑定到设备。

pci_register_driver() is used to register pci_driver structure for a existing PCI device on the PCI bus defined in struct pci_device_id xxx_pci_tbl[] table with Class, Vendor and Device ID to match against a device. pci_register_driver()用于为struct pci_device_id xxx_pci_tbl[]表中定义的PCI总线上的现​​有PCI设备注册pci_driver结构,其类,供应商和设备ID与设备匹配。

struct pci_driver xxx_driver = {
    .name           = DRV_NAME,
    .probe          = xxx_pci_probe,
    .remove         = xxx_pci_remove,
    .id_table       = xxx_pci_tbl

/Documentation/PCI/pci.txt /Documentation/PCI/pci.txt

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM