From: Ed Goforth <egoforth@gmail.com>
To: linuxppc-embedded <linuxppc-embedded@ozlabs.org>
Subject: mmap on 440gx
Date: Thu, 16 Jun 2005 17:33:44 -0400 [thread overview]
Message-ID: <75b39f0105061614333199ec37@mail.gmail.com> (raw)
I've been struggling with implementing mmap on a 440gx-based custom
board. I have been able to use ioremap(), but we really need a mmap()
for our software. The kernel is 2.4.18 (TimeSys 4.0).
I'm trying to access one of our FPGA's located at 0x50000000. Offsets
0x00000000 thru
0x000FFFFF are control and status registers. Offsets 0x01000000 thru
0x017FFFFF are the QDR SRAM on the FPGA.
Using ioremap_nocache(0x50000000, bytes_to_map) works (so long as
bytes_to_map isn't too large). I can then use in_be32() and
out_be32() to read/write the registers and the SRAM. However, trying
to implement mmap() causes the board to lock up hard. I have tried
iterations both where the driver first does an ioremap(), and where it
doesn't do the ioremap(). Some bits:
In driver module:
static struct file_operations test_mmap_fops =3D {
read : test_mmap_read,
mmap : test_mmap_mmap,
open : test_mmap_open,
release : test_mmap_release,
};
static int test_mmap_mmap (struct file *filp, struct vm_area_struct *vma) {
vma->vm_flags |=3D (VM_SHM | VM_LOCKED | VM_IO | VM_RESERVED);
if (remap_page_range(vma->vm_start, 0x50000000, 4096, vma->vm_page_prot))
return(-EAGAIN);
return(0);
} /* test_mmap_mmap() */
When the test code calls mmap():
unsigned long *mmap_region;
unsigned long data;
mmap_region =3D mmap(0, 4096, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
it seems to work. However, dereferencing mmap_region, either thru
data =3D *mmap_region;
or
data =3D mmap_region[0];
causes the board to lock hard.
I would appreciate any suggestions or hints.
Thanks,
Ed
next reply other threads:[~2005-06-16 21:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-16 21:33 Ed Goforth [this message]
2005-06-16 22:55 ` mmap on 440gx Matt Porter
2005-06-17 3:47 ` Ed Goforth
2005-06-17 4:41 ` Matt Porter
2005-06-17 5:42 ` Ed Goforth
2005-06-17 7:24 ` Matt Porter
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=75b39f0105061614333199ec37@mail.gmail.com \
--to=egoforth@gmail.com \
--cc=linuxppc-embedded@ozlabs.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;
as well as URLs for NNTP newsgroup(s).