流程
修改方法:
根据设备节点的compatible属性,
在驱动程序中构造/注册 platform_driver,
在 platform_driver 的 probe 函数中获得中断资源
1.给dm9000网卡指定中断
/*bank4*/
srom-cs4@20000000 {
compatible = "simple-bus";
#address-cells = <1>;
#size-cells = <1>;
reg = <0x20000000 0x8000000>;//起始地址 128M
ranges;
ethernet@20000000 {
compatible = "davicom,dm9000";
reg = <0x20000000 0x2 0x20000004 0x2>;
interrupt-parent = <&gpf>;
interrupts = <7 IRQ_TYPE_EDGE_RISING>;
local-mac-address = [00 00 de ad be ef];
davicom,no-eeprom;
};
};
仿照设备树–按键中断程序,在原驱动程序中添加
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/of_platform.h>
static int dm9000drv_probe(struct platform_device *pdev)
{
struct device *dev = &pdev版权声明:本文为qq_34738528原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。