[PATCH v2 2/2] PCI: keystone: update to support multiple pci ports

Murali Karicheri
2014-09-09T22:50:13Z

On 09/09/2014 05:52 PM, Arnd Bergmann wrote:
> On Tuesday 09 September 2014 17:49:19 Murali Karicheri wrote:
>> Actually this is an inteded. The vendor ID is in a register indicated by
>> reg offset and as per the device spec, it needs to be read and updated
>> by the software. Now since multiple instances of PCI device needs to be
>> read the same register, the reading happens in the probe() and same is
>> unmapped after that.
>>
>> + ks_pcie->device_id = readl(reg_p)>> 16;
>> + devm_iounmap(dev, reg_p);
>> + devm_release_mem_region(dev, res->start, resource_size(res));
>>
>> Afetr that in ks_pcie_host_init(), it update the device_id in the RC's
>> config space.
>
> I'm not sure I understand the purpose of this. Do you mean you read
> the vendor/device ID of whichever device happens to get probed first
> and then program the same ID into all other devices as well?

My mistake. It is the device ID, not vendor ID. The PCI driver supports
PCI h/w on K2HK, K2E and K2L SoCs for which PCI device IDs are assigned as

+#define PCIE_RC_K2HK 0xb008
+#define PCIE_RC_K2E 0xb009
+#define PCIE_RC_K2L 0xb00a
+

and the same driver code runs on all these h/w. The device ID is not
filled in by default by the h/w, in the config space of the RC at offset
1000h "VENDOR_DEVICE_ID Vendor and Device Identification Register".
Same is available in a seperate SoC register whose offset is specified
by index 2. This is read by driver and updated in the config space. The
Vendor ID is however set by default.

There is a mrrs PCI quirk required for Keystone PCI which depends on
this vendor ID to be filled correctly as it match vendor id/ device id
of the bridge device to apply the quirk.

Hope this clarify your question.

Murali

>
> What if the order changes between two boots? Why does the vendor/device
> ID of the host bridge even matter at all?
>
> Arnd