Amit Singh Tomar
Amit Singh Tomar

Reputation: 8610

Writing a device driver for Platform Bus in Embedded Systems?

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?

Upvotes: 2

Views: 2549

Answers (1)

tangrs
tangrs

Reputation: 9940

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.

Upvotes: 2

Related Questions