Strange PCI mmap problem on MPC8555
willy jacobs
willy.jacobs at nl.thalesgroup.com
Fri Jul 13 21:21:40 EST 2007
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
More information about the Linuxppc-embedded
mailing list