* Strange PCI mmap problem on MPC8555
@ 2007-07-13 11:21 willy jacobs
0 siblings, 0 replies; only message in thread
From: willy jacobs @ 2007-07-13 11:21 UTC (permalink / raw)
To: linuxppc-embedded
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-07-13 13:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-13 11:21 Strange PCI mmap problem on MPC8555 willy jacobs
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox