Skip to contentSkip to conversation

UIO patches for 2.6.21

PATCH New Greg KH 1 participant 4 messages May 8, 2007

Subsystems (2)
lore
Share & tools
lore

Greg KH

author
#0 lore raw

PATCH 1/1 UIO patches for 2.6.21

Here is another round of the updated UIO (Userspace I/O driver framework) patches for 2.6.21.

All of the issues raised from the last time the patches were posted (last week) have been fixed in this version.

Many thanks for all of the review comments from everyone who took the time to read over the code.

These patches include full documentation, are self-contained from the rest of the kernel, and have been in the -mm tree for the past few months with no complaints.

Please pull from:

	master.kernel.org:/pub/scm/linux/kernel/git/gregkh/uio-2.6.git/

Patches will be sent as a follow-on to this message to lkml for people to see.

thanks,

greg k-h

 Documentation/DocBook/kernel-api.tmpl |    4 
 Documentation/DocBook/uio-howto.tmpl  |  611 +++++++++++++++++++++++++++++
 drivers/Kconfig                       |    1 
 drivers/Makefile                      |    1 
 drivers/uio/Kconfig                   |   27 +
 drivers/uio/Makefile                  |    2 
 drivers/uio/uio.c                     |  701 ++++++++++++++++++++++++++++++++++
 drivers/uio/uio_cif.c                 |  156 +++++++
 include/linux/uio_driver.h            |   91 ++++
 9 files changed, 1594 insertions(+)

---------------

Hans J. Koch (2):
UIO: Add the User IO core code
UIO: Documentation

Hans-Jürgen Koch (1):
UIO: Hilscher CIF card driver

#1 lore raw

PATCH 1/3 UIO: Add the User IO core code

From: Hans J. Koch <[email protected]>

This interface allows the ability to write the majority of a driver in userspace with only a very small shell of a driver in the kernel itself. It uses a char device and sysfs to interact with a userspace process to process interrupts and control memory accesses.

See the docbook documentation for more details on how to use this interface.

From: Hans J. Koch <[email protected]>

Cc Thomas Gleixner <[email protected]>
Cc Benedikt Spranger <[email protected]>
---
 drivers/Kconfig            |    1 +
 drivers/Makefile           |    1 +
 drivers/uio/Kconfig        |   14 +
 drivers/uio/Makefile       |    1 +
 drivers/uio/uio.c          |  701 ++++++++++++++++++++++++++++++++++++++++++++
 include/linux/uio_driver.h |   91 ++++++
 6 files changed, 809 insertions(+), 0 deletions(-)
 create mode 100644 drivers/uio/Kconfig
 create mode 100644 drivers/uio/Makefile
 create mode 100644 drivers/uio/uio.c
 create mode 100644 include/linux/uio_driver.h
drivers/Kconfig +1 -0
index 050323f..325a108 100644
@@ -84,4 +84,5 @@ source "drivers/auxdisplay/Kconfig"
 
 source "drivers/kvm/Kconfig"
 
+source "drivers/uio/Kconfig"
 endmenu
drivers/Makefile +1 -0
index 26ca903..1e2974c 100644
@@ -37,6 +37,7 @@ obj-$(CONFIG_SCSI)		+= scsi/
 obj-$(CONFIG_ATA)		+= ata/
 obj-$(CONFIG_FUSION)		+= message/
 obj-$(CONFIG_IEEE1394)		+= ieee1394/
+obj-$(CONFIG_UIO)		+= uio/
 obj-y				+= cdrom/
 obj-y				+= auxdisplay/
 obj-$(CONFIG_MTD)		+= mtd/
drivers/uio/Kconfig new file +14 -0
new file mode 100644
index 0000000..8fcef21
@@ -0,0 +1,14 @@
+menu "Userspace I/O"
+config UIO
+	tristate "Userspace I/O drivers"
+	default n
+	help
+	  Enable this to allow the userspace driver core code to be
+	  built.  This code allows userspace programs easy access to
+	  kernel interrupts and memory locations, allowing some drivers
+	  to be written in userspace.  Note that a small kernel driver
+	  is also required for interrupt handling to work properly.
+
+	  If you don't know what to do here, say N.
+
+endmenu
drivers/uio/Makefile new file +1 -0
new file mode 100644
index 0000000..9b7c830
@@ -0,0 +1 @@
+obj-$(CONFIG_UIO) += uio.o
drivers/uio/uio.c new file +701 -0

701 lines not on this page · raw message

include/linux/uio_driver.h new file +91 -0

91 lines not on this page · raw message

Signature · 1 line
1.5.1.3
#2 lore raw

PATCH 2/3 UIO: Documentation

From: Hans J. Koch <[email protected]>

Documentation for the UIO interface

From: Hans J. Koch <[email protected]>

---
 Documentation/DocBook/kernel-api.tmpl |    4 +
 Documentation/DocBook/uio-howto.tmpl  |  611 +++++++++++++++++++++++++++++++++
 2 files changed, 615 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/DocBook/uio-howto.tmpl
Documentation/DocBook/kernel-api.tmpl +4 -0
index b61dfc7..4b7b2fd 100644
@@ -402,6 +402,10 @@ X!Edrivers/pnp/system.c
 !Edrivers/pnp/manager.c
 !Edrivers/pnp/support.c
      </sect1>
+     <sect1><title>Userspace IO devices</title>
+!Edrivers/uio/uio.c
+!Iinclude/linux/uio_driver.h
+     </sect1>
   </chapter>
 
   <chapter id="blkdev">
Documentation/DocBook/uio-howto.tmpl new file +611 -0

611 lines not on this page · raw message

Signature · 1 line
1.5.1.3
#3 lore raw

PATCH 3/3 UIO: Hilscher CIF card driver

From: Hans-Jürgen Koch <[email protected]>

this is a patch that adds support for Hilscher CIF DeviceNet and Profibus cards. I tested it on a Kontron CPX board, and Thomas reviewed it.

You can find the user space part here:

http://www.osadl.org/projects/downloads/UIO/user/cif-0.1.0.tar.gz

Notes: cif_api.c is the main file you want to look at. It contains the functions to open, close, mmap and so on. cif_dps.c adds functions specific to Profibus cards, and cif_dn.c contains functions for DeviceNet cards. cif.c is a universal playground, it's just a small test program. The user space part of this UIO driver is still work in progress, and not everything is tested yet. At the moment, the thread in cif_api.c contains some code that artificially makes the card generate interrupts, this was added for testing and will be removed later. But the driver already contains all the functions needed for useful operation, so it gives a good idea of how such a thing looks like.

For comparison, here's what you get from the manufacturer (www.hilscher.com) when you ask for a Linux 2.6 driver:

http://www.tglx.de/private/hjk/cif-orig-2.6.tar.bz2

WARNING: Don't look at the code for too long, you might become sick :-)

---
 drivers/uio/Kconfig   |   13 ++++
 drivers/uio/Makefile  |    3 +-
 drivers/uio/uio_cif.c |  156 +++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 171 insertions(+), 1 deletions(-)
 create mode 100644 drivers/uio/uio_cif.c
drivers/uio/Kconfig +13 -0
index 8fcef21..279f26c 100644
@@ -11,4 +11,17 @@ config UIO
 
 	  If you don't know what to do here, say N.
 
+config UIO_CIF
+	tristate "generic Hilscher CIF Card driver"
+	depends on UIO && PCI
+	default n
+	help
+	  Driver for Hilscher CIF DeviceNet and Profibus cards.  This
+	  driver requires a userspace component that handles all of the
+	  heavy lifting and can be found at:
+	  	http://www.osadl.org/projects/downloads/UIO/user/cif-*
+
+	  To compile this driver as a module, choose M here: the module
+	  will be called uio_cif.
+
 endmenu
drivers/uio/Makefile +2 -1
index 9b7c830..7fecfb4 100644
@@ -1 +1,2 @@
-obj-$(CONFIG_UIO) += uio.o
+obj-$(CONFIG_UIO)	+= uio.o
+obj-$(CONFIG_UIO_CIF)	+= uio_cif.o
drivers/uio/uio_cif.c new file +156 -0

156 lines not on this page · raw message

Signature · 1 line
1.5.1.3