Handling resources
The main purpose of a device driver is to provide a set of driving functions for a given device and expose its capabilities to users. Here, the objective is to gather the device's configuration parameters, especially resources (such as the memory region, interrupt line, DMA channel, and more) that will help the driver to perform its job.
The struct resource
Once probed, device resources assigned to the device (either in the device or the board/machine file) are gathered and allocated either by of_platform
or by the platform
cores using struct resource
, as follows:
struct resource { resource_size_t start; resource_size_t end; const char *name; unsigned long flags; [...] };
The following lists the meanings of the elements in the data structure:
start
: Depending on the resource flag, this can be the starting address of a memory region, an IRQ line...