From: willy jacobs <willy.jacobs@nl.thalesgroup.com>
To: linuxppc-embedded@ozlabs.org
Subject: Strange PCI mmap problem on MPC8555
Date: Fri, 13 Jul 2007 13:21:40 +0200 [thread overview]
Message-ID: <46976044.1030702@nl.thalesgroup.com> (raw)
Setup: ELDK 4.1, U-Boot 1.2.0 and Linux 2.6.20.2 (arch/ppc)
The PPC can communicate (memory mapped) with a FGPA through the PCI bus.
A user program should be able to access (read/write) the FPGA memory areas
directly via mmap() through a small Linux driver.
In the driver initialisation bar0 (1 KByte memory) the PCI physical
address
is remapped to virtual address space via ioremap().
A memory dump (with expected values) in the kernel driver shows:
0 1 2 3 4 5 6 7 8 9 A B C D E F
0xe1056000 17 31 04 00 02 00 00 00 07 20 07 03 00 00 00 00
The mmap call in driver looks like this:
static int
rvc_mmap (struct file *filp, struct vm_area_struct *vma)
{
...
if (remap_pfn_range(vma,
vma->vm_start,
phys_bar0 >> PAGE_SHIFT,
vma->vm_end - vma->vm_start,
vma->vm_page_prot)) {
printk(KERN_CRIT "rvc_mmap: remap_page bar0 failed\n");
return -EAGAIN;
...
}
The user space test program does a mmap() to bar0 and the memory dump
(erroneous values) now shows:
0 1 2 3 4 5 6 7 8 9 A B C D E F
0x30019000 17 31 04 00 17 31 04 00 07 20 07 03 07 20 07 03
^^^^^^^^^^^ ^^^^^^^^^^^
So the first 32-bit word is now exactly the same as the second 32-bit
word,
the 4th 32-bit word is the same as the 3rd 32-bit word, etc.
Also the same behaviour for bar1.
It looks like a 32-/64 bit problem, but the kernel I use is 32-bits.
Any idea what causes this strange behaviour?
--
willy
Unclassified
reply other threads:[~2007-07-13 13:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=46976044.1030702@nl.thalesgroup.com \
--to=willy.jacobs@nl.thalesgroup.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.