diff options
-rw-r--r-- | Documentation/DocBook/uio-howto.tmpl | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/Documentation/DocBook/uio-howto.tmpl b/Documentation/DocBook/uio-howto.tmpl index ac3d0018140c..fdbf86fcfccd 100644 --- a/Documentation/DocBook/uio-howto.tmpl +++ b/Documentation/DocBook/uio-howto.tmpl | |||
@@ -719,6 +719,62 @@ framework to set up sysfs files for this region. Simply leave it alone. | |||
719 | </para> | 719 | </para> |
720 | </sect1> | 720 | </sect1> |
721 | 721 | ||
722 | <sect1 id="using uio_dmem_genirq"> | ||
723 | <title>Using uio_dmem_genirq for platform devices</title> | ||
724 | <para> | ||
725 | In addition to statically allocated memory ranges, they may also be | ||
726 | a desire to use dynamically allocated regions in a user space driver. | ||
727 | In particular, being able to access memory made available through the | ||
728 | dma-mapping API, may be particularly useful. The | ||
729 | <varname>uio_dmem_genirq</varname> driver provides a way to accomplish | ||
730 | this. | ||
731 | </para> | ||
732 | <para> | ||
733 | This driver is used in a similar manner to the | ||
734 | <varname>"uio_pdrv_genirq"</varname> driver with respect to interrupt | ||
735 | configuration and handling. | ||
736 | </para> | ||
737 | <para> | ||
738 | Set the <varname>.name</varname> element of | ||
739 | <varname>struct platform_device</varname> to | ||
740 | <varname>"uio_dmem_genirq"</varname> to use this driver. | ||
741 | </para> | ||
742 | <para> | ||
743 | When using this driver, fill in the <varname>.platform_data</varname> | ||
744 | element of <varname>struct platform_device</varname>, which is of type | ||
745 | <varname>struct uio_dmem_genirq_pdata</varname> and which contains the | ||
746 | following elements: | ||
747 | </para> | ||
748 | <itemizedlist> | ||
749 | <listitem><varname>struct uio_info uioinfo</varname>: The same | ||
750 | structure used as the <varname>uio_pdrv_genirq</varname> platform | ||
751 | data</listitem> | ||
752 | <listitem><varname>unsigned int *dynamic_region_sizes</varname>: | ||
753 | Pointer to list of sizes of dynamic memory regions to be mapped into | ||
754 | user space. | ||
755 | </listitem> | ||
756 | <listitem><varname>unsigned int num_dynamic_regions</varname>: | ||
757 | Number of elements in <varname>dynamic_region_sizes</varname> array. | ||
758 | </listitem> | ||
759 | </itemizedlist> | ||
760 | <para> | ||
761 | The dynamic regions defined in the platform data will be appended to | ||
762 | the <varname> mem[] </varname> array after the platform device | ||
763 | resources, which implies that the total number of static and dynamic | ||
764 | memory regions cannot exceed <varname>MAX_UIO_MAPS</varname>. | ||
765 | </para> | ||
766 | <para> | ||
767 | The dynamic memory regions will be allocated when the UIO device file, | ||
768 | <varname>/dev/uioX</varname> is opened. | ||
769 | Simiar to static memory resources, the memory region information for | ||
770 | dynamic regions is then visible via sysfs at | ||
771 | <varname>/sys/class/uio/uioX/maps/mapY/*</varname>. | ||
772 | The dynmaic memory regions will be freed when the UIO device file is | ||
773 | closed. When no processes are holding the device file open, the address | ||
774 | returned to userspace is DMA_ERROR_CODE. | ||
775 | </para> | ||
776 | </sect1> | ||
777 | |||
722 | </chapter> | 778 | </chapter> |
723 | 779 | ||
724 | <chapter id="userspace_driver" xreflabel="Writing a driver in user space"> | 780 | <chapter id="userspace_driver" xreflabel="Writing a driver in user space"> |