Jump to content
  • 0

How should a uio_dmem_genirq driver be configured?


moritz.ulmer

Question

The uio_dmem_genirq driver is backwards compatible with the uio_pdrv_genirq driver but with the addition that it dynamically allocates continuous memory. How do the device tree entries have to be defined to load the dmem driver? The working configuration for the pdrv version consists of the following device tree entry:

spw0@7aa00000 {
  compatible = "generic-uio";
  reg = <0x7aa00000 0x10000>;
  interrupts = <0x0 0x1D 0x4>;
  interrupt-parent = <0x3>;
  clocks = <0x1>;
};

and changing the bootargs to console=ttyPS0,115200 root=/dev/mmcblk0p1 rw rootwait earlyprintk uio_pdrv_genirq.of_id=generic-uio.

My current configuration for the dmem version looks as follows, but does not load the UIO driver despite it being compiled into the kernel. This is the output of /lib/modules/4.4.0-xilinx/modules.builtin

kernel/drivers/uio/uio.ko
kernel/drivers/uio/uio_pdrv_genirq.ko
kernel/drivers/uio/uio_dmem_genirq.ko

The two different styles used to try and configure the drivers are:

spw0@7aa00000 {
  compatible = "generic-uio";
  reg = <0x7aa00000 0x10000>;
  uio,number-of-dynamic-regions = <1>;
  uio,dynamic-regions-sizes = <0x4000>;
  interrupts = <0x0 0x1D 0x4>;
  interrupt-parent = <0x3>;
  clocks = <0x1>;
};

spw1@7aa00000 {
  compatible = "generic-uio";
  num_dynamic_regions = <2>;
  dynamic_region_sizes = <0x8000>;
  interrupts = <0x0 0x1E 0x4>;
  interrupt-parent = <0x3>;
  clocks = <0x1>;
};

And the bootargs are updated to console=ttyPS0,115200 root=/dev/mmcblk0p1 rw rootwait earlyprintk uio_dmem_genirq.of_id=generic-uio.

Note: this is based on my StackOverflow question

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

I think the uio_dmem_genirq is missing compatible device tree driver definition and so it does not get probed.

If you diff the two drivers you will see that at the end (inside CONFIG_OF def) there is missing module parameter named of_id:

module_param_string(of_id, uio_of_genirq_match[0].compatible, 128, 0);
MODULE_PARM_DESC(of_id, "Openfirmware id of the device to be handled by uio");

The technique used here is to pass the driver .compatible definition through module parameter (uio_pdrv_genirq.of_id=generic-uio).

If you would load uio_pdrv_genirq via modprobe you would do it:

modprob <path_to_driver>/uio_pdrv_genirq of_id=generic-uio

The drivers .compatible definition is than matched to device tree entries and if found the driver is probed.

For uio_dmem_genirq a device tree entry to put in, I think this one is OK for uio_dmem_genirq:

spw1@7aa00000 {
  compatible = "generic-uio";
  num_dynamic_regions = <2>;
  dynamic_region_sizes = <0x8000>;
  interrupts = <0x0 0x1E 0x4>;
  interrupt-parent = <0x3>;
  clocks = <0x1>;
};
The "uio,number-of-dynamic-regions" is different string than "num_dynamic_regions". 
But you can experiment or check what dev_get_platdata() function is expected.

The answer is not complete copy/paste solution, but should point you to right direction.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...