public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Aras Vaichas <arasv@magtech.com.au>
To: linux-kernel@vger.kernel.org
Subject: mmaping an IO port device
Date: Thu, 13 Dec 2007 10:45:02 +1100	[thread overview]
Message-ID: <4760727E.2090906@magtech.com.au> (raw)

Hi,

Can I implement mmap with an io port connected device on an x86 based CPU?


Background:

I've got a device driver which can be compiled for either x86 or ARM. 
The driver provides an interface to an FPGA via either an IO port 
(0x180) on the x86 or as a memory mapped SRAM-like device (0x30000000) 
on the ARM.

To get myself an "address" for ioread calls I use:

FPGA_base = (u32) ioremap_nocache(FPGA_REG_IO_BASE, SZ_4K) for both CPU 
types.

FPGA_REG_IO_BASE is set to either 0x180 or 0x30000000 for x86 and ARM 
respectively.

I then call ioread16(FPGA_base + FPGA_register) for both x86 and ARM and 
it all works perfectly. No problems there.

My problem is that I am now moving from ioctl calls to a mmap interface. 
This isn't a problem with ARM as I can pass (0x30000000 >> PAGE_SHIFT) 
to remap_pfn_range() in the .mmap fops function but I can't pass 0x180 
because ... well, it's obvious.

Is there a trick?

Aras

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

             reply	other threads:[~2007-12-12 23:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-12 23:45 Aras Vaichas [this message]
2007-12-12 23:57 ` mmaping an IO port device Aras Vaichas
2007-12-13  0:39 ` H. Peter Anvin
2007-12-13  1:04 ` Aras Vaichas
     [not found] <fa.noVJACisdR+sMNi3JjMxD+zdqf8@ifi.uio.no>
2007-12-13  0:52 ` Robert Hancock

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4760727E.2090906@magtech.com.au \
    --to=arasv@magtech.com.au \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox