aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Edworthy <phil.edworthy@renesas.com>2014-06-30 03:54:22 -0400
committerBjorn Helgaas <bhelgaas@google.com>2014-07-05 13:58:12 -0400
commit2c3fd4c935880d756cb57f4bcdb35bb4b8348ec8 (patch)
tree66fa7788adb1b8e3b78c7a2e24669cc1c1c91366
parent8eb12c3b420fb5243ce9b4a8878f3b88a3c91e33 (diff)
PCI: rcar: Use correct initial HW settings
Although the R-Car PCIe driver works as it is, there are a number of incorrect settings that this patch corrects. It corrects: - enabling the PCI Express Extended Cap ID. - setting Data Link Layer Link Active Reporting Capable. - terminating list of capabilities. It also removes enabling the MAC data scrambling as this is the default HW setting, and removes incorrect code to enable slave bus mastering as this is done by the PCI core. Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Simon Horman <horms+renesas@verge.net.au>
-rw-r--r--drivers/pci/host/pcie-rcar.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c
index 027876a1fc3f..ab0ab0d8253c 100644
--- a/drivers/pci/host/pcie-rcar.c
+++ b/drivers/pci/host/pcie-rcar.c
@@ -481,14 +481,15 @@ static int rcar_pcie_hw_init(struct rcar_pcie *pcie)
481 rcar_rmw32(pcie, RCONF(PCI_SUBORDINATE_BUS), 0xff, 1); 481 rcar_rmw32(pcie, RCONF(PCI_SUBORDINATE_BUS), 0xff, 1);
482 482
483 /* Initialize default capabilities. */ 483 /* Initialize default capabilities. */
484 rcar_rmw32(pcie, REXPCAP(0), 0, PCI_CAP_ID_EXP); 484 rcar_rmw32(pcie, REXPCAP(0), 0xff, PCI_CAP_ID_EXP);
485 rcar_rmw32(pcie, REXPCAP(PCI_EXP_FLAGS), 485 rcar_rmw32(pcie, REXPCAP(PCI_EXP_FLAGS),
486 PCI_EXP_FLAGS_TYPE, PCI_EXP_TYPE_ROOT_PORT << 4); 486 PCI_EXP_FLAGS_TYPE, PCI_EXP_TYPE_ROOT_PORT << 4);
487 rcar_rmw32(pcie, RCONF(PCI_HEADER_TYPE), 0x7f, 487 rcar_rmw32(pcie, RCONF(PCI_HEADER_TYPE), 0x7f,
488 PCI_HEADER_TYPE_BRIDGE); 488 PCI_HEADER_TYPE_BRIDGE);
489 489
490 /* Enable data link layer active state reporting */ 490 /* Enable data link layer active state reporting */
491 rcar_rmw32(pcie, REXPCAP(PCI_EXP_LNKCAP), 0, PCI_EXP_LNKCAP_DLLLARC); 491 rcar_rmw32(pcie, REXPCAP(PCI_EXP_LNKCAP), PCI_EXP_LNKCAP_DLLLARC,
492 PCI_EXP_LNKCAP_DLLLARC);
492 493
493 /* Write out the physical slot number = 0 */ 494 /* Write out the physical slot number = 0 */
494 rcar_rmw32(pcie, REXPCAP(PCI_EXP_SLTCAP), PCI_EXP_SLTCAP_PSN, 0); 495 rcar_rmw32(pcie, REXPCAP(PCI_EXP_SLTCAP), PCI_EXP_SLTCAP_PSN, 0);
@@ -497,10 +498,7 @@ static int rcar_pcie_hw_init(struct rcar_pcie *pcie)
497 rcar_rmw32(pcie, TLCTLR+1, 0x3f, 50); 498 rcar_rmw32(pcie, TLCTLR+1, 0x3f, 50);
498 499
499 /* Terminate list of capabilities (Next Capability Offset=0) */ 500 /* Terminate list of capabilities (Next Capability Offset=0) */
500 rcar_rmw32(pcie, RVCCAP(0), 0xfff0, 0); 501 rcar_rmw32(pcie, RVCCAP(0), 0xfff00000, 0);
501
502 /* Enable MAC data scrambling. */
503 rcar_rmw32(pcie, MACCTLR, SCRAMBLE_DISABLE, 0);
504 502
505 /* Enable MSI */ 503 /* Enable MSI */
506 if (IS_ENABLED(CONFIG_PCI_MSI)) 504 if (IS_ENABLED(CONFIG_PCI_MSI))
@@ -517,11 +515,6 @@ static int rcar_pcie_hw_init(struct rcar_pcie *pcie)
517 /* Enable INTx interrupts */ 515 /* Enable INTx interrupts */
518 rcar_rmw32(pcie, PCIEINTXR, 0, 0xF << 8); 516 rcar_rmw32(pcie, PCIEINTXR, 0, 0xF << 8);
519 517
520 /* Enable slave Bus Mastering */
521 rcar_rmw32(pcie, RCONF(PCI_STATUS), PCI_STATUS_DEVSEL_MASK,
522 PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER |
523 PCI_STATUS_CAP_LIST | PCI_STATUS_DEVSEL_FAST);
524
525 wmb(); 518 wmb();
526 519
527 return 0; 520 return 0;