The explanation in struct device says
Associated device tree node.
But, I didn't clearly understand this.
Can anyone provide an example?
of_node is related to Open Firmware it holds the information of a device tree.
Device Tree is like config file (named nodes and properties) which describes hardware in detail.
The main advantage of device tree is you don't have to keep modifying kernel for specific hardware. All you have to do is define your h/w in device tree fmt and feed it to bootloader. Boot loader, for example uboot, passes the device tree information to kernel and kernel initializes the devices based on those information it received from boot-loader.
the below is example of device tree.
{
compatible = "acme,coyotes-revenge";
cpus {
cpu@0 {
compatible = "arm,cortex-a9";
};
cpu@1 {
compatible = "arm,cortex-a9";
};
};
serial@101F0000 {
compatible = "arm,pl011";
};
serial@101F2000 {
compatible = "arm,pl011";
};
interrupt-controller@10140000 {
compatible = "arm,pl190";
};
external-bus {
ethernet@0,0 {
compatible = "smc,smc91c111";
};
i2c@1,0 {
compatible = "acme,a1234-i2c-bus";
rtc@58 {
compatible = "maxim,ds1338";
};
};
flash@2,0 {
compatible = "samsung,k8f1315ebm", "cfi-flash";
};
};
};