是什么平台的驱动程序和正常的设备驱动程序之间的区别..? [英] What is the difference between Platform driver and normal device driver..?

查看:428
本文介绍了是什么平台的驱动程序和正常的设备驱动程序之间的区别..?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我previously有一个关于该平台的驱动程序的思想以及正常的设备驱动程序,如:


  • 平台驱动程序是对于那些对芯片器件。和

  • 普通的设备驱动程序是那些接口到proccesor芯片。
    之前跨越一个I2C驱动来了。

    但在这里,我通过定义为平台的驱动程序多功能I2C驱动读书。我已通过<一个了href=\"https://www.kernel.org/doc/Documentation/driver-model/platform.txt\">https://www.kernel.org/doc/Documentation/driver-model/platform.txt.但还是没能得到明确的想法来如何定义的驱动程序,就像两个片上以及接口设备的结论。
    我通过这个环节也去了..
    <一href=\"http://meld.org/discussion/general-discussion/platform-driver-vs-ordinary-device-drivers\">http://meld.org/discussion/general-discussion/platform-driver-vs-ordinary-device-drivers


请别人解释。


解决方案

您引用是好的,但缺乏的什么是平台设备的定义。有一个在 LWN 。我们可以通过此页面了解:


  1. 平台设备的本身没有发现,即硬件不能说的嘿!我是present!应用于软件。典型的例子是I2C器件,内核/文档/ I2C /实例化的设备规定:


      

    不同于PCI或USB设备,I2C设备不会在硬件级别(在运行时)计数。
      相反,软件必须知道(在编译时),该装置连接在每个I2C总线段。
      所以USB和PCI是的的平台设备。



  2. 平台设备绑定到驱动程序的通过匹配的名字


  3. 平台设备应注册很早系统启动过程中。因为他们往往​​是系统(平台)及其驱动程序的其余部分是至关重要的。

所以基本上,这个问题的它是一个平台,设备或标准设备?的是公交车,它使用 更多的问题。与特定平台的设备工作,你必须:


  1. 注册平台的驱动程序将管理此设备。它应该定义的唯一的名称,

  2. 注册平台设备,定义名称相同的驱动程序。


  

平台驱动程序是对于那些对芯片的设备。


并非如此(在理论,但在实践中真正)。 I2C器件都没有片上,但平台设备,因为它们不会被发现。此外,我们可以认为这是的正常的设备片上的设备。例如:在一个现代的x86处理器集成的PCI GPU芯片。这是发现的,因此不是一个平台的设备。


  

普通设备驱动程序是用于那些接口到处理器芯片。之前跨越一个I2C驱动来了。


事实并非如此。许多正常的设备接口到所述处理器,但不通过一个I2C总线。例如:USB鼠标

在你的情况,看看到驱动器/ USB /主机/ OHCI-pnx4008.c ,这是一个USB主机控制器平台设备(这里的USB主机控制器不被发现,而USB设备,这将连接到它,是)。它是由注册的平台设备中的板文件的(弓/ ARM /马赫pnx4008 / core.c:pnx4008_init )。而其探测函数中,它注册其I2C设备到总线i2c_register_driver 。我们可以推断出USB主控制器芯片组的会谈的通过I2C总线的CPU。

为什么架构?因为一方面,该装置可以被认为是提供了一些功能,以系统的裸I2C器件。另一方面,它是一个USB主机功能的设备。它需要注册到USB栈( usb_create_hcd )。所以探测仅I2C不足。看看到文档/ I2C /实例化的设备

I previously had a thought about the platform driver as well as normal device driver like :

Please somebody explain.

解决方案

Your references are good but lack a definition of what is a platform device. There is one on LWN. What we can learn from this page:

  1. Platform devices are inherently not discoverable, i.e. the hardware cannot say "Hey! I'm present!" to the software. Typical examples are i2c devices, kernel/Documentation/i2c/instantiating-devices states:

    Unlike PCI or USB devices, I2C devices are not enumerated at the hardware level (at run time). Instead, the software must know (at compile time) which devices are connected on each I2C bus segment. So USB and PCI are not platform devices.

  2. Platform devices are bound to drivers by matching names,

  3. Platform devices should be registered very early during system boot. Because they are often critical to the rest of the system (platform) and its drivers.

So basically, the question "is it a platform device or a standard device?" is more a question of which bus it uses. To work with a particular platform device, you have to:

  1. register a platform driver that will manage this device. It should define a unique name,
  2. register your platform device, defining the same name as the driver.

Platform driver is for those devices that are on chip.

Not true (in theory, but true in practice). i2c devices are not onChip, but are platform devices because they are not discoverable. Also we can think of onChip devices which are normal devices. Example: an integrated PCI GPU chip on a modern x86 processor. It is discoverable, thus not a platform device.

Normal device driver are for those that are interfaced to the processor chip. before coming across one i2c driver.

Not true. Many normal devices are interfaced to the processor, but not through an i2c bus. Example: a USB mouse.

[EDIT] In your case, have a look to drivers/usb/host/ohci-pnx4008.c, which is a USB host controller platform device (Here the USB host controller is not discoverable, whereas USB devices, which will connect to it, are). It is a platform device registered by the board file (arch/arm/mach-pnx4008/core.c:pnx4008_init). And within its probe function, it registers its i2c device to the bus with i2c_register_driver. We can infer that the USB Host controller chipset talks to the CPU through an i2c bus.

Why that architecture? Because on one hand, this device can be considered a bare i2c device providing some functionalities to the system. On the other hand, it is a USB Host capable device. It needs to register to the USB stack (usb_create_hcd). So probing only i2c will be insufficient. Have a look to Documentation/i2c/instantiating-devices.

这篇关于是什么平台的驱动程序和正常的设备驱动程序之间的区别..?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆