I think I understand about IOCTL's and mapping bus address space
into kernel memory. But I don't want to mmap /dev/mem into user
space because it risks pointer or mapping errors crashing the OS (I
think)
How to do this properly...
Take a look at the Sparc framebuffer drivers for some examples. Note
this is the traditional way most OS's perform this. The user does a
mmap request, your driver has an mmap file operations method, that
gets called and essentially the user gets back a user space mapping of
the place where the device are exists.
The only subtleties are that you should add VM_IO and VM_LOCKED to the
vma->vm_flags so the swapper doesn't try to swap it out ;-)