• 0

How should a uio_dmem_genirq driver be configured?


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:

[email protected] {
  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:

[email protected] {
  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>;
};

[email protected] {
  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 post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

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:

[email protected] {
  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.

Edited by Musko
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now