diff options
author | Murali Karicheri <m-karicheri2@ti.com> | 2014-09-10 13:12:39 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2014-09-16 17:45:46 -0400 |
commit | 8665a482dbb5dd4cba44f46e3099e783a3695027 (patch) | |
tree | d8e7b416e714ed3439a58269207aaced1ef65430 /drivers/pci/host | |
parent | 4455efc90855ff5a6065caea835b0d13a284c5a1 (diff) |
PCI: keystone: Set device ID based on SoC to support multiple ports
K2E SoC has two PCI ports. The SATA controller is connected to second PCI
port (port 1). To support multiple port handling in Keystone PCI driver,
read the PCI device ID dynamically by iomap/read/unmap during probe and
save it in driver's private data and update it in host init code. The PCI
device ID field in the RC's config space is not filled by default by the
hardware and has to be updated by the PCI driver by reading the same from
the SoC register indicated by reg index #2 in DT bindings.
Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/host')
-rw-r--r-- | drivers/pci/host/pci-keystone.c | 9 | ||||
-rw-r--r-- | drivers/pci/host/pci-keystone.h | 4 |
2 files changed, 7 insertions, 6 deletions
diff --git a/drivers/pci/host/pci-keystone.c b/drivers/pci/host/pci-keystone.c index e69932ddd19c..c95608368508 100644 --- a/drivers/pci/host/pci-keystone.c +++ b/drivers/pci/host/pci-keystone.c | |||
@@ -253,8 +253,8 @@ static int keystone_pcie_fault(unsigned long addr, unsigned int fsr, | |||
253 | 253 | ||
254 | static void __init ks_pcie_host_init(struct pcie_port *pp) | 254 | static void __init ks_pcie_host_init(struct pcie_port *pp) |
255 | { | 255 | { |
256 | u32 vendor_device_id, val; | ||
257 | struct keystone_pcie *ks_pcie = to_keystone_pcie(pp); | 256 | struct keystone_pcie *ks_pcie = to_keystone_pcie(pp); |
257 | u32 val; | ||
258 | 258 | ||
259 | ks_pcie_establish_link(ks_pcie); | 259 | ks_pcie_establish_link(ks_pcie); |
260 | ks_dw_pcie_setup_rc_app_regs(ks_pcie); | 260 | ks_dw_pcie_setup_rc_app_regs(ks_pcie); |
@@ -263,8 +263,7 @@ static void __init ks_pcie_host_init(struct pcie_port *pp) | |||
263 | pp->dbi_base + PCI_IO_BASE); | 263 | pp->dbi_base + PCI_IO_BASE); |
264 | 264 | ||
265 | /* update the Vendor ID */ | 265 | /* update the Vendor ID */ |
266 | vendor_device_id = readl(ks_pcie->va_reg_pciid); | 266 | writew(ks_pcie->device_id, pp->dbi_base + PCI_DEVICE_ID); |
267 | writew((vendor_device_id >> 16), pp->dbi_base + PCI_DEVICE_ID); | ||
268 | 267 | ||
269 | /* update the DEV_STAT_CTRL to publish right mrrs */ | 268 | /* update the DEV_STAT_CTRL to publish right mrrs */ |
270 | val = readl(pp->dbi_base + PCIE_CAP_BASE + PCI_EXP_DEVCTL); | 269 | val = readl(pp->dbi_base + PCIE_CAP_BASE + PCI_EXP_DEVCTL); |
@@ -373,7 +372,9 @@ static int __init ks_pcie_probe(struct platform_device *pdev) | |||
373 | reg_p = devm_ioremap_resource(dev, res); | 372 | reg_p = devm_ioremap_resource(dev, res); |
374 | if (IS_ERR(reg_p)) | 373 | if (IS_ERR(reg_p)) |
375 | return PTR_ERR(reg_p); | 374 | return PTR_ERR(reg_p); |
376 | ks_pcie->va_reg_pciid = reg_p; | 375 | ks_pcie->device_id = readl(reg_p) >> 16; |
376 | devm_iounmap(dev, reg_p); | ||
377 | devm_release_mem_region(dev, res->start, resource_size(res)); | ||
377 | 378 | ||
378 | pp->dev = dev; | 379 | pp->dev = dev; |
379 | platform_set_drvdata(pdev, ks_pcie); | 380 | platform_set_drvdata(pdev, ks_pcie); |
diff --git a/drivers/pci/host/pci-keystone.h b/drivers/pci/host/pci-keystone.h index 729ea7d3994b..80cfa8e80632 100644 --- a/drivers/pci/host/pci-keystone.h +++ b/drivers/pci/host/pci-keystone.h | |||
@@ -19,8 +19,8 @@ | |||
19 | struct keystone_pcie { | 19 | struct keystone_pcie { |
20 | struct clk *clk; | 20 | struct clk *clk; |
21 | struct pcie_port pp; | 21 | struct pcie_port pp; |
22 | void __iomem *va_reg_pciid; | 22 | /* PCI Device ID */ |
23 | 23 | u32 device_id; | |
24 | int num_legacy_host_irqs; | 24 | int num_legacy_host_irqs; |
25 | int legacy_host_irqs[MAX_LEGACY_HOST_IRQS]; | 25 | int legacy_host_irqs[MAX_LEGACY_HOST_IRQS]; |
26 | struct device_node *legacy_intc_np; | 26 | struct device_node *legacy_intc_np; |