PCIe didn't work well on Jetson TX2

In our application ,we put a DSP(Texas Instrument C66x) on the PCIE bus of Jetson TX2.The Linux Driver we use is Version 28.2,which has the kernel 4.4.38-tegra.
After power on, we execute the command “lspci -vvv”, the output is like this:
//
Multimedia controller:Texas Instruments Device b005(rev 01)
Control: I/O- Mem+ BusMaster+ SpecCycle- …
Statue: Cap+ 66MHz- UDF- FastB2B- ParErr- …
Latency:0
Interrupt: pin A routed to IRQ 389
Region 0 : Memory at 50800000 (32-bit, non-prefetchable)
Region 1 : Memory at 50900000 (32-bit, prefetchable)
Region 2 : Memory at 50a00000 (32-bit, prefetchable)
Region 3 : Memory at 51000000 (32-bit, prefetchable)
Region 4 : Memory at 50b00000 (32-bit, prefetchable)
Region 5 : Memory at 50c00000 (32-bit, prefetchable)
Capabilities:
/
/

It seems OK?
But when we try to read it in the function probe,we met some problem.
function probe is defined like this:
/*******************************************************************/
static int hello_probe(struct pci_dev *pdev, const struct pci_device_id *id)
{
int i;
for(i=0;i<5;i++)
{
barStart [i] = pci_resource_start (pdev, i);
barLen [i] = pci_resource_len (pdev, i);
barFlags [i] = pci_resource_flags (pdev, i);

    printk("barStart [%d]: 0x%x; barLen [%d]: 0x%x; barFlags [%d]: 0x%x\n",i,barStart [i],i,barLen[i],i,barFlags[i]);
}

    ......(following doesn't showed)

}
//
And the output is like this:
/
/
barStart [0]: 0x7b324b80; barLen [0]: 0x84cdb481; barFlags [0]:0x50800000
barStart [1]: 0x7b326560; barLen [0]: 0xffffe678; barFlags [0]:0x50900000
barStart [2]: 0x7b326560; barLen [0]: 0xffffe6b1; barFlags [0]:0x50a00000
barStart [3]: 0x7b326560; barLen [0]: 0xffffe721; barFlags [0]:0x51000000
barStart [4]: 0x7b326560; barLen [0]: 0x84cd9aa1; barFlags [0]:0x50b00000
/***/
Well, it seems bar start is put in barFlags?
Then we check the function pci_resource_xxx, find it just output the data in pcidev->resource.The we output the data in pcidev-resource directly.
The resource is defined like this:
/
/
struct resource {
resource_size_t start;
resource_size_t end;
const char name;
unsigned long flags;
struct resource parent, sibling, child;
};
/
/
The result is like this,just as we expect, the data seems not on the right position:
data vield Output value The value it should be
Bar0.start 0xe4a00b80 0x50800000
Bar0.end 0x0 0x508fffff
Bar0.name 0x1000 0xe4abf280
Bar0.flags 0x50800000 0x40200
Bar0.parent 0x508fffff 0xe4950d60
Bar0.sibling 0xe4abf280 0xe4a00bd8
Bar0.child 0x40200 0x0
Bar1.start 0xe4950d60 0x50900000
Bar1.end 0xe4a00bd8 0x509fffff
Bar1.name 0x0 0xe4abf280
Bar1.flags 0x50900000 0x42208
Bar1.parent 0x509fffff 0xe4950d60
Bar1.sibling 0xe4abf280 0xe4a00c10
Bar1.child 0x42208 0x0

We guess that when linux scan the pci bus to create the pci device information, it didn’t put the value in the right place. But why? Since we can’t trace the operation during pci scan, so I have to ask for help.Thank you very much.

The last data-sheet is not showed very tidy.I will show it again:
We output the data in pdev->resource, it’s like following(We show the right data at the right side):

Data field Output value The value it should be
Bar0.start 0xe4a00b80 0x50800000
Bar0.end 0x0 0x508fffff
Bar0.name 0x1000 0xe4abf280
Bar0.flags 0x50800000 0x40200
Bar0.parent 0x508fffff 0xe4950d60
Bar0.sibling 0xe4abf280 0xe4a00bd8
Bar0.child 0x40200 0x0
Bar1.start 0xe4950d60 0x50900000
Bar1.end 0xe4a00bd8 0x509fffff
Bar1.name 0x0 0xe4abf280
Bar1.flags 0x50900000 0x42208
Bar1.parent 0x509fffff 0xe4950d60
Bar1.sibling 0xe4abf280 0xe4a00c10
Bar1.child 0x42208 0x0

Your lspci output looks fine.
I just checked with 28.2 code base with a Realtek NIC card and I don’t see this issue. Is it possible to share your driver privately?

Hi, that’s ok. Could you provide your email? Or do I have other ways to send you my driver? Thank you.

Hi vidyas, I have sent the driver code to you by private message.Thank you very much for help.You can reply back to me if you find something.