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 = { 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 |= (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 = mmap(0, 4096, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); it seems to work. However, dereferencing mmap_region, either thru data = *mmap_region; or data = mmap_region[0]; causes the board to lock hard. I would appreciate any suggestions or hints. Thanks, Ed