AnsweredAssumed Answered

iMX6 PCIe: How to mmap() a PCIe device?

Question asked by Fabrice Mousset on Jan 17, 2014
Latest reply on Oct 28, 2015 by AURELIEN BOUIN
Branched to a new discussion

On my system, I have connected to iMX6 (DualLite) via the PCIe Link an external MAC/Phy from Intel (i211).

To be able to use this Gigabit interface, I must program into internal PROM a MAC address.

The MAC address programming has to be done through the PCIe link, there is no other way to do this.

To do this, I need to mmap() the i211 registers, but the mmap() call fails with an error:

Unhandled fault: external abort on non-linefetch (0x1018) at 0x40248010


This is the code I try to execute:

Mapped1Address = mmap(NULL, 4096*32, PROT_WRITE | PROT_READ, MAP_SHARED, FileDescriptor, (off_t)WordLocation );


Where :

  • FileDescriptor : is the result of  fopen("/dev/mem", O_RDWR |O_SYNC)
  • WordLocation : is the physical address of the l’i211, which is 0x01100000


With lspci, I can see that my device is detected:

# lspci

00:00.0 Class 0604: 16c3:abcd

01:00.0 Class 0200: 8086:1532



And in /proc/iomem, the address space I try to mmap() is affected to PCIe:

# cat /proc/iomem

00000000-00000000 : iobase_vg

  00000000-00000000 : phys_baseaddr

00110000-00111fff : mxs-dma-apbh

00130000-00133fff : iobase_3d

  00130000-00133fff : galcore register region

00134000-00137fff : iobase_2d

  00134000-00137fff : galcore register region

01000000-01dfffff : PCIe 0 MEM

  01000000-010fffff : 0000:00:00.0

01100000-011fffff : PCI Bus 0000:01

01100000-0111ffff : 0000:01:00.0

01120000-01123fff : 0000:01:00.0

01200000-0120ffff : 0000:00:00.


So what I am doing wrong?

Any advice or suggestion?


My Linux system is build using Linux Kernel 3.0.35 (based on Freescale BSP 4.1.0).


Best regards