troubles mmaping PCI device on Au1550
I'm working on a Au1550 driver for a PCI based co-processor. The processor exports a 4Mbyte BAR that I want to mmap() into user space.
Quoted 4 lines · Clem Taylor
My driver code has something like:
remap_pfn_range( vma,vma->vm_start,( pci_resource_start ( pdev, BAR ) >> PAGE_SHIFT ) + vma->pgoff, vma->vm_end - vma->vm_start, vma->vm_page_prot );
The Au15xx uses 36-bit addressing for the PCI (among other) physical addresses. The mmap() in your driver is the right thing, but you need to use io_remap_page_range() where the 2nd parameter is a phys_t. Your offset should be a phys_t type, and pci_resource_start() also returns a phys_t.
Quoted 2 lines
I tried a similar test using
/dev/memand the address the linear framebuffer on my desktop machine (as returned by lspci).
You can't use /dev/mem for this on Au15xx because it doesn't have provisions for more than 32-bit addresses. Be careful with lspci, as it only returns the 32-bit BAR, not the 36-bit Au15xx address nor the 32-bit ioremapped address.
Thanks.
-- Dan
Quoted 5 lines · Dan Malek
The Au15xx uses 36-bit addressing for the PCI (among other) physical addresses. The
mmap()in your driver is the right thing, but you need to useio_remap_page_range()where the 2nd parameter is aphys_t. Your offset should be aphys_ttype, andpci_resource_start()also returns aphys_t.
Yeah, this was exactly my problem. Last night I managed to find the comment about this in au1000.h. Now I can happily mmap() the PCI devices memory. Thanks!
--Clem