Writing a device driver for Platform Bus in Embedded Systems?

送分小仙女□ 提交于 2019-12-24 02:09:28

问题


I have gone through some driver implementation in Linux Kernel Source and can see that these are the platform driver.

drivers/net/ethernet/smsc/smsc911x.c

  static struct platform_driver smc911x_driver = {
    .probe           = smc911x_drv_probe,
    .remove  = smc911x_drv_remove,
    .suspend         = smc911x_drv_suspend,
    .resume  = smc911x_drv_resume,
    .driver  = {
            .name    = CARDNAME,
            .owner  = THIS_MODULE,
    },
};

Above is a driver for platform device(smsc based Ethernet controller) and platform devices are devices which are not probed automatically during system boot-up unlike legacy devices sitting on the pci bus.

I guess this understanding of mine is OK here?

Now when I say it is the platform devices, is it mean these devices(Ethernet Controller) are sitting on Platform bus and on ARM architecture default platform bus is AMBA.

So when we solder the Ethernet controller on ARM based board it should be sit on or interfaced with AMBA bus?

How Do we decide that driver we're going to write is Platform driver or Normal driver?


回答1:


From my limited experience in developing ARM platform drivers, AMBA devices typically have identification registers at the end of their memory mapped IO register interface.

Generally speaking, if you look at the reference manual for your ethernet controller and register summary specifies peripheral/component identification registers (usually at offsets 0xFE0-0xFEC and 0xFF0-0xFFC), you should write an AMBA bus driver. These drivers can be identified automatically by the bus driver.

Otherwise, if the register interface doesn't specify any ID registers at offsets 0xFE0-0xFEC and 0xFF0-0xFFC, you'll probably just want to write a platform driver. These devices cannot be automatically identified and you need to specifically attach a driver to the device.



来源:https://stackoverflow.com/questions/23783649/writing-a-device-driver-for-platform-bus-in-embedded-systems

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!