diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2017-11-14 13:11:35 -0500 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2017-11-14 13:11:35 -0500 |
commit | d238be6957b2e57913f602fc4429813ca6027e93 (patch) | |
tree | 534e0557a95e05add9dbb12fe33b066b5238483e | |
parent | 2b61a44e115e346dcf248b4b35ae2aafed99bb78 (diff) | |
parent | 9cea513d8cbc75ee26327d3d8971fe7b58288d8f (diff) |
Merge branch 'pci/host-tegra' into next
* pci/host-tegra:
PCI: tegra: Add Tegra186 PCIe support
dt-bindings: pci: tegra: Document Tegra186 PCIe DT
PCI: tegra: Use generic accessors where possible
-rw-r--r-- | Documentation/devicetree/bindings/pci/nvidia,tegra20-pcie.txt | 134 | ||||
-rw-r--r-- | drivers/pci/host/pci-tegra.c | 158 |
2 files changed, 261 insertions, 31 deletions
diff --git a/Documentation/devicetree/bindings/pci/nvidia,tegra20-pcie.txt b/Documentation/devicetree/bindings/pci/nvidia,tegra20-pcie.txt index 982a74ea6df9..33d2e2139333 100644 --- a/Documentation/devicetree/bindings/pci/nvidia,tegra20-pcie.txt +++ b/Documentation/devicetree/bindings/pci/nvidia,tegra20-pcie.txt | |||
@@ -1,10 +1,15 @@ | |||
1 | NVIDIA Tegra PCIe controller | 1 | NVIDIA Tegra PCIe controller |
2 | 2 | ||
3 | Required properties: | 3 | Required properties: |
4 | - compatible: For Tegra20, must contain "nvidia,tegra20-pcie". For Tegra30, | 4 | - compatible: Must be: |
5 | "nvidia,tegra30-pcie". For Tegra124, must contain "nvidia,tegra124-pcie". | 5 | - "nvidia,tegra20-pcie": for Tegra20 |
6 | Otherwise, must contain "nvidia,<chip>-pcie", plus one of the above, where | 6 | - "nvidia,tegra30-pcie": for Tegra30 |
7 | <chip> is tegra132 or tegra210. | 7 | - "nvidia,tegra124-pcie": for Tegra124 and Tegra132 |
8 | - "nvidia,tegra210-pcie": for Tegra210 | ||
9 | - "nvidia,tegra186-pcie": for Tegra186 | ||
10 | - power-domains: To ungate power partition by BPMP powergate driver. Must | ||
11 | contain BPMP phandle and PCIe power partition ID. This is required only | ||
12 | for Tegra186. | ||
8 | - device_type: Must be "pci" | 13 | - device_type: Must be "pci" |
9 | - reg: A list of physical base address and length for each set of controller | 14 | - reg: A list of physical base address and length for each set of controller |
10 | registers. Must contain an entry for each entry in the reg-names property. | 15 | registers. Must contain an entry for each entry in the reg-names property. |
@@ -124,6 +129,16 @@ Power supplies for Tegra210: | |||
124 | - vddio-pex-ctl-supply: Power supply for PCIe control I/O partition. Must | 129 | - vddio-pex-ctl-supply: Power supply for PCIe control I/O partition. Must |
125 | supply 1.8 V. | 130 | supply 1.8 V. |
126 | 131 | ||
132 | Power supplies for Tegra186: | ||
133 | - Required: | ||
134 | - dvdd-pex-supply: Power supply for digital PCIe I/O. Must supply 1.05 V. | ||
135 | - hvdd-pex-pll-supply: High-voltage supply for PLLE (shared with USB3). Must | ||
136 | supply 1.8 V. | ||
137 | - hvdd-pex-supply: High-voltage supply for PCIe I/O and PCIe output clocks. | ||
138 | Must supply 1.8 V. | ||
139 | - vddio-pexctl-aud-supply: Power supply for PCIe side band signals. Must | ||
140 | supply 1.8 V. | ||
141 | |||
127 | Root ports are defined as subnodes of the PCIe controller node. | 142 | Root ports are defined as subnodes of the PCIe controller node. |
128 | 143 | ||
129 | Required properties: | 144 | Required properties: |
@@ -546,3 +561,114 @@ Board DTS: | |||
546 | status = "okay"; | 561 | status = "okay"; |
547 | }; | 562 | }; |
548 | }; | 563 | }; |
564 | |||
565 | Tegra186: | ||
566 | --------- | ||
567 | |||
568 | SoC DTSI: | ||
569 | |||
570 | pcie@10003000 { | ||
571 | compatible = "nvidia,tegra186-pcie"; | ||
572 | power-domains = <&bpmp TEGRA186_POWER_DOMAIN_PCX>; | ||
573 | device_type = "pci"; | ||
574 | reg = <0x0 0x10003000 0x0 0x00000800 /* PADS registers */ | ||
575 | 0x0 0x10003800 0x0 0x00000800 /* AFI registers */ | ||
576 | 0x0 0x40000000 0x0 0x10000000>; /* configuration space */ | ||
577 | reg-names = "pads", "afi", "cs"; | ||
578 | |||
579 | interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>, /* controller interrupt */ | ||
580 | <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>; /* MSI interrupt */ | ||
581 | interrupt-names = "intr", "msi"; | ||
582 | |||
583 | #interrupt-cells = <1>; | ||
584 | interrupt-map-mask = <0 0 0 0>; | ||
585 | interrupt-map = <0 0 0 0 &gic GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>; | ||
586 | |||
587 | bus-range = <0x00 0xff>; | ||
588 | #address-cells = <3>; | ||
589 | #size-cells = <2>; | ||
590 | |||
591 | ranges = <0x82000000 0 0x10000000 0x0 0x10000000 0 0x00001000 /* port 0 configuration space */ | ||
592 | 0x82000000 0 0x10001000 0x0 0x10001000 0 0x00001000 /* port 1 configuration space */ | ||
593 | 0x82000000 0 0x10004000 0x0 0x10004000 0 0x00001000 /* port 2 configuration space */ | ||
594 | 0x81000000 0 0x0 0x0 0x50000000 0 0x00010000 /* downstream I/O (64 KiB) */ | ||
595 | 0x82000000 0 0x50100000 0x0 0x50100000 0 0x07F00000 /* non-prefetchable memory (127 MiB) */ | ||
596 | 0xc2000000 0 0x58000000 0x0 0x58000000 0 0x28000000>; /* prefetchable memory (640 MiB) */ | ||
597 | |||
598 | clocks = <&bpmp TEGRA186_CLK_AFI>, | ||
599 | <&bpmp TEGRA186_CLK_PCIE>, | ||
600 | <&bpmp TEGRA186_CLK_PLLE>; | ||
601 | clock-names = "afi", "pex", "pll_e"; | ||
602 | |||
603 | resets = <&bpmp TEGRA186_RESET_AFI>, | ||
604 | <&bpmp TEGRA186_RESET_PCIE>, | ||
605 | <&bpmp TEGRA186_RESET_PCIEXCLK>; | ||
606 | reset-names = "afi", "pex", "pcie_x"; | ||
607 | |||
608 | status = "disabled"; | ||
609 | |||
610 | pci@1,0 { | ||
611 | device_type = "pci"; | ||
612 | assigned-addresses = <0x82000800 0 0x10000000 0 0x1000>; | ||
613 | reg = <0x000800 0 0 0 0>; | ||
614 | status = "disabled"; | ||
615 | |||
616 | #address-cells = <3>; | ||
617 | #size-cells = <2>; | ||
618 | ranges; | ||
619 | |||
620 | nvidia,num-lanes = <2>; | ||
621 | }; | ||
622 | |||
623 | pci@2,0 { | ||
624 | device_type = "pci"; | ||
625 | assigned-addresses = <0x82001000 0 0x10001000 0 0x1000>; | ||
626 | reg = <0x001000 0 0 0 0>; | ||
627 | status = "disabled"; | ||
628 | |||
629 | #address-cells = <3>; | ||
630 | #size-cells = <2>; | ||
631 | ranges; | ||
632 | |||
633 | nvidia,num-lanes = <1>; | ||
634 | }; | ||
635 | |||
636 | pci@3,0 { | ||
637 | device_type = "pci"; | ||
638 | assigned-addresses = <0x82001800 0 0x10004000 0 0x1000>; | ||
639 | reg = <0x001800 0 0 0 0>; | ||
640 | status = "disabled"; | ||
641 | |||
642 | #address-cells = <3>; | ||
643 | #size-cells = <2>; | ||
644 | ranges; | ||
645 | |||
646 | nvidia,num-lanes = <1>; | ||
647 | }; | ||
648 | }; | ||
649 | |||
650 | Board DTS: | ||
651 | |||
652 | pcie@10003000 { | ||
653 | status = "okay"; | ||
654 | |||
655 | dvdd-pex-supply = <&vdd_pex>; | ||
656 | hvdd-pex-pll-supply = <&vdd_1v8>; | ||
657 | hvdd-pex-supply = <&vdd_1v8>; | ||
658 | vddio-pexctl-aud-supply = <&vdd_1v8>; | ||
659 | |||
660 | pci@1,0 { | ||
661 | nvidia,num-lanes = <4>; | ||
662 | status = "okay"; | ||
663 | }; | ||
664 | |||
665 | pci@2,0 { | ||
666 | nvidia,num-lanes = <0>; | ||
667 | status = "disabled"; | ||
668 | }; | ||
669 | |||
670 | pci@3,0 { | ||
671 | nvidia,num-lanes = <1>; | ||
672 | status = "disabled"; | ||
673 | }; | ||
674 | }; | ||
diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c index 9c40da54f88a..8dd3b3f7d141 100644 --- a/drivers/pci/host/pci-tegra.c +++ b/drivers/pci/host/pci-tegra.c | |||
@@ -159,10 +159,13 @@ | |||
159 | #define AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_SINGLE (0x0 << 20) | 159 | #define AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_SINGLE (0x0 << 20) |
160 | #define AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_420 (0x0 << 20) | 160 | #define AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_420 (0x0 << 20) |
161 | #define AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_X2_X1 (0x0 << 20) | 161 | #define AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_X2_X1 (0x0 << 20) |
162 | #define AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_401 (0x0 << 20) | ||
162 | #define AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_DUAL (0x1 << 20) | 163 | #define AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_DUAL (0x1 << 20) |
163 | #define AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_222 (0x1 << 20) | 164 | #define AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_222 (0x1 << 20) |
164 | #define AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_X4_X1 (0x1 << 20) | 165 | #define AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_X4_X1 (0x1 << 20) |
166 | #define AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_211 (0x1 << 20) | ||
165 | #define AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_411 (0x2 << 20) | 167 | #define AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_411 (0x2 << 20) |
168 | #define AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_111 (0x2 << 20) | ||
166 | 169 | ||
167 | #define AFI_FUSE 0x104 | 170 | #define AFI_FUSE 0x104 |
168 | #define AFI_FUSE_PCIE_T0_GEN2_DIS (1 << 2) | 171 | #define AFI_FUSE_PCIE_T0_GEN2_DIS (1 << 2) |
@@ -252,6 +255,7 @@ struct tegra_pcie_soc { | |||
252 | bool has_cml_clk; | 255 | bool has_cml_clk; |
253 | bool has_gen2; | 256 | bool has_gen2; |
254 | bool force_pca_enable; | 257 | bool force_pca_enable; |
258 | bool program_uphy; | ||
255 | }; | 259 | }; |
256 | 260 | ||
257 | static inline struct tegra_msi *to_tegra_msi(struct msi_controller *chip) | 261 | static inline struct tegra_msi *to_tegra_msi(struct msi_controller *chip) |
@@ -491,12 +495,32 @@ static void __iomem *tegra_pcie_map_bus(struct pci_bus *bus, | |||
491 | return addr; | 495 | return addr; |
492 | } | 496 | } |
493 | 497 | ||
498 | static int tegra_pcie_config_read(struct pci_bus *bus, unsigned int devfn, | ||
499 | int where, int size, u32 *value) | ||
500 | { | ||
501 | if (bus->number == 0) | ||
502 | return pci_generic_config_read32(bus, devfn, where, size, | ||
503 | value); | ||
504 | |||
505 | return pci_generic_config_read(bus, devfn, where, size, value); | ||
506 | } | ||
507 | |||
508 | static int tegra_pcie_config_write(struct pci_bus *bus, unsigned int devfn, | ||
509 | int where, int size, u32 value) | ||
510 | { | ||
511 | if (bus->number == 0) | ||
512 | return pci_generic_config_write32(bus, devfn, where, size, | ||
513 | value); | ||
514 | |||
515 | return pci_generic_config_write(bus, devfn, where, size, value); | ||
516 | } | ||
517 | |||
494 | static struct pci_ops tegra_pcie_ops = { | 518 | static struct pci_ops tegra_pcie_ops = { |
495 | .add_bus = tegra_pcie_add_bus, | 519 | .add_bus = tegra_pcie_add_bus, |
496 | .remove_bus = tegra_pcie_remove_bus, | 520 | .remove_bus = tegra_pcie_remove_bus, |
497 | .map_bus = tegra_pcie_map_bus, | 521 | .map_bus = tegra_pcie_map_bus, |
498 | .read = pci_generic_config_read32, | 522 | .read = tegra_pcie_config_read, |
499 | .write = pci_generic_config_write32, | 523 | .write = tegra_pcie_config_write, |
500 | }; | 524 | }; |
501 | 525 | ||
502 | static unsigned long tegra_pcie_port_get_pex_ctrl(struct tegra_pcie_port *port) | 526 | static unsigned long tegra_pcie_port_get_pex_ctrl(struct tegra_pcie_port *port) |
@@ -1012,10 +1036,12 @@ static int tegra_pcie_enable_controller(struct tegra_pcie *pcie) | |||
1012 | afi_writel(pcie, value, AFI_FUSE); | 1036 | afi_writel(pcie, value, AFI_FUSE); |
1013 | } | 1037 | } |
1014 | 1038 | ||
1015 | err = tegra_pcie_phy_power_on(pcie); | 1039 | if (soc->program_uphy) { |
1016 | if (err < 0) { | 1040 | err = tegra_pcie_phy_power_on(pcie); |
1017 | dev_err(dev, "failed to power on PHY(s): %d\n", err); | 1041 | if (err < 0) { |
1018 | return err; | 1042 | dev_err(dev, "failed to power on PHY(s): %d\n", err); |
1043 | return err; | ||
1044 | } | ||
1019 | } | 1045 | } |
1020 | 1046 | ||
1021 | /* take the PCIe interface module out of reset */ | 1047 | /* take the PCIe interface module out of reset */ |
@@ -1048,19 +1074,23 @@ static int tegra_pcie_enable_controller(struct tegra_pcie *pcie) | |||
1048 | static void tegra_pcie_power_off(struct tegra_pcie *pcie) | 1074 | static void tegra_pcie_power_off(struct tegra_pcie *pcie) |
1049 | { | 1075 | { |
1050 | struct device *dev = pcie->dev; | 1076 | struct device *dev = pcie->dev; |
1077 | const struct tegra_pcie_soc *soc = pcie->soc; | ||
1051 | int err; | 1078 | int err; |
1052 | 1079 | ||
1053 | /* TODO: disable and unprepare clocks? */ | 1080 | /* TODO: disable and unprepare clocks? */ |
1054 | 1081 | ||
1055 | err = tegra_pcie_phy_power_off(pcie); | 1082 | if (soc->program_uphy) { |
1056 | if (err < 0) | 1083 | err = tegra_pcie_phy_power_off(pcie); |
1057 | dev_err(dev, "failed to power off PHY(s): %d\n", err); | 1084 | if (err < 0) |
1085 | dev_err(dev, "failed to power off PHY(s): %d\n", err); | ||
1086 | } | ||
1058 | 1087 | ||
1059 | reset_control_assert(pcie->pcie_xrst); | 1088 | reset_control_assert(pcie->pcie_xrst); |
1060 | reset_control_assert(pcie->afi_rst); | 1089 | reset_control_assert(pcie->afi_rst); |
1061 | reset_control_assert(pcie->pex_rst); | 1090 | reset_control_assert(pcie->pex_rst); |
1062 | 1091 | ||
1063 | tegra_powergate_power_off(TEGRA_POWERGATE_PCIE); | 1092 | if (!dev->pm_domain) |
1093 | tegra_powergate_power_off(TEGRA_POWERGATE_PCIE); | ||
1064 | 1094 | ||
1065 | err = regulator_bulk_disable(pcie->num_supplies, pcie->supplies); | 1095 | err = regulator_bulk_disable(pcie->num_supplies, pcie->supplies); |
1066 | if (err < 0) | 1096 | if (err < 0) |
@@ -1077,19 +1107,29 @@ static int tegra_pcie_power_on(struct tegra_pcie *pcie) | |||
1077 | reset_control_assert(pcie->afi_rst); | 1107 | reset_control_assert(pcie->afi_rst); |
1078 | reset_control_assert(pcie->pex_rst); | 1108 | reset_control_assert(pcie->pex_rst); |
1079 | 1109 | ||
1080 | tegra_powergate_power_off(TEGRA_POWERGATE_PCIE); | 1110 | if (!dev->pm_domain) |
1111 | tegra_powergate_power_off(TEGRA_POWERGATE_PCIE); | ||
1081 | 1112 | ||
1082 | /* enable regulators */ | 1113 | /* enable regulators */ |
1083 | err = regulator_bulk_enable(pcie->num_supplies, pcie->supplies); | 1114 | err = regulator_bulk_enable(pcie->num_supplies, pcie->supplies); |
1084 | if (err < 0) | 1115 | if (err < 0) |
1085 | dev_err(dev, "failed to enable regulators: %d\n", err); | 1116 | dev_err(dev, "failed to enable regulators: %d\n", err); |
1086 | 1117 | ||
1087 | err = tegra_powergate_sequence_power_up(TEGRA_POWERGATE_PCIE, | 1118 | if (dev->pm_domain) { |
1088 | pcie->pex_clk, | 1119 | err = clk_prepare_enable(pcie->pex_clk); |
1089 | pcie->pex_rst); | 1120 | if (err) { |
1090 | if (err) { | 1121 | dev_err(dev, "failed to enable PEX clock: %d\n", err); |
1091 | dev_err(dev, "powerup sequence failed: %d\n", err); | 1122 | return err; |
1092 | return err; | 1123 | } |
1124 | reset_control_deassert(pcie->pex_rst); | ||
1125 | } else { | ||
1126 | err = tegra_powergate_sequence_power_up(TEGRA_POWERGATE_PCIE, | ||
1127 | pcie->pex_clk, | ||
1128 | pcie->pex_rst); | ||
1129 | if (err) { | ||
1130 | dev_err(dev, "powerup sequence failed: %d\n", err); | ||
1131 | return err; | ||
1132 | } | ||
1093 | } | 1133 | } |
1094 | 1134 | ||
1095 | reset_control_deassert(pcie->afi_rst); | 1135 | reset_control_deassert(pcie->afi_rst); |
@@ -1262,6 +1302,7 @@ static int tegra_pcie_get_resources(struct tegra_pcie *pcie) | |||
1262 | struct device *dev = pcie->dev; | 1302 | struct device *dev = pcie->dev; |
1263 | struct platform_device *pdev = to_platform_device(dev); | 1303 | struct platform_device *pdev = to_platform_device(dev); |
1264 | struct resource *pads, *afi, *res; | 1304 | struct resource *pads, *afi, *res; |
1305 | const struct tegra_pcie_soc *soc = pcie->soc; | ||
1265 | int err; | 1306 | int err; |
1266 | 1307 | ||
1267 | err = tegra_pcie_clocks_get(pcie); | 1308 | err = tegra_pcie_clocks_get(pcie); |
@@ -1276,10 +1317,12 @@ static int tegra_pcie_get_resources(struct tegra_pcie *pcie) | |||
1276 | return err; | 1317 | return err; |
1277 | } | 1318 | } |
1278 | 1319 | ||
1279 | err = tegra_pcie_phys_get(pcie); | 1320 | if (soc->program_uphy) { |
1280 | if (err < 0) { | 1321 | err = tegra_pcie_phys_get(pcie); |
1281 | dev_err(dev, "failed to get PHYs: %d\n", err); | 1322 | if (err < 0) { |
1282 | return err; | 1323 | dev_err(dev, "failed to get PHYs: %d\n", err); |
1324 | return err; | ||
1325 | } | ||
1283 | } | 1326 | } |
1284 | 1327 | ||
1285 | err = tegra_pcie_power_on(pcie); | 1328 | err = tegra_pcie_power_on(pcie); |
@@ -1341,6 +1384,7 @@ poweroff: | |||
1341 | static int tegra_pcie_put_resources(struct tegra_pcie *pcie) | 1384 | static int tegra_pcie_put_resources(struct tegra_pcie *pcie) |
1342 | { | 1385 | { |
1343 | struct device *dev = pcie->dev; | 1386 | struct device *dev = pcie->dev; |
1387 | const struct tegra_pcie_soc *soc = pcie->soc; | ||
1344 | int err; | 1388 | int err; |
1345 | 1389 | ||
1346 | if (pcie->irq > 0) | 1390 | if (pcie->irq > 0) |
@@ -1348,9 +1392,11 @@ static int tegra_pcie_put_resources(struct tegra_pcie *pcie) | |||
1348 | 1392 | ||
1349 | tegra_pcie_power_off(pcie); | 1393 | tegra_pcie_power_off(pcie); |
1350 | 1394 | ||
1351 | err = phy_exit(pcie->phy); | 1395 | if (soc->program_uphy) { |
1352 | if (err < 0) | 1396 | err = phy_exit(pcie->phy); |
1353 | dev_err(dev, "failed to teardown PHY: %d\n", err); | 1397 | if (err < 0) |
1398 | dev_err(dev, "failed to teardown PHY: %d\n", err); | ||
1399 | } | ||
1354 | 1400 | ||
1355 | return 0; | 1401 | return 0; |
1356 | } | 1402 | } |
@@ -1616,8 +1662,32 @@ static int tegra_pcie_get_xbar_config(struct tegra_pcie *pcie, u32 lanes, | |||
1616 | struct device *dev = pcie->dev; | 1662 | struct device *dev = pcie->dev; |
1617 | struct device_node *np = dev->of_node; | 1663 | struct device_node *np = dev->of_node; |
1618 | 1664 | ||
1619 | if (of_device_is_compatible(np, "nvidia,tegra124-pcie") || | 1665 | if (of_device_is_compatible(np, "nvidia,tegra186-pcie")) { |
1620 | of_device_is_compatible(np, "nvidia,tegra210-pcie")) { | 1666 | switch (lanes) { |
1667 | case 0x010004: | ||
1668 | dev_info(dev, "4x1, 1x1 configuration\n"); | ||
1669 | *xbar = AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_401; | ||
1670 | return 0; | ||
1671 | |||
1672 | case 0x010102: | ||
1673 | dev_info(dev, "2x1, 1X1, 1x1 configuration\n"); | ||
1674 | *xbar = AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_211; | ||
1675 | return 0; | ||
1676 | |||
1677 | case 0x010101: | ||
1678 | dev_info(dev, "1x1, 1x1, 1x1 configuration\n"); | ||
1679 | *xbar = AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_111; | ||
1680 | return 0; | ||
1681 | |||
1682 | default: | ||
1683 | dev_info(dev, "wrong configuration updated in DT, " | ||
1684 | "switching to default 2x1, 1x1, 1x1 " | ||
1685 | "configuration\n"); | ||
1686 | *xbar = AFI_PCIE_CONFIG_SM2TMS0_XBAR_CONFIG_211; | ||
1687 | return 0; | ||
1688 | } | ||
1689 | } else if (of_device_is_compatible(np, "nvidia,tegra124-pcie") || | ||
1690 | of_device_is_compatible(np, "nvidia,tegra210-pcie")) { | ||
1621 | switch (lanes) { | 1691 | switch (lanes) { |
1622 | case 0x0000104: | 1692 | case 0x0000104: |
1623 | dev_info(dev, "4x1, 1x1 configuration\n"); | 1693 | dev_info(dev, "4x1, 1x1 configuration\n"); |
@@ -1737,7 +1807,20 @@ static int tegra_pcie_get_regulators(struct tegra_pcie *pcie, u32 lane_mask) | |||
1737 | struct device_node *np = dev->of_node; | 1807 | struct device_node *np = dev->of_node; |
1738 | unsigned int i = 0; | 1808 | unsigned int i = 0; |
1739 | 1809 | ||
1740 | if (of_device_is_compatible(np, "nvidia,tegra210-pcie")) { | 1810 | if (of_device_is_compatible(np, "nvidia,tegra186-pcie")) { |
1811 | pcie->num_supplies = 4; | ||
1812 | |||
1813 | pcie->supplies = devm_kcalloc(pcie->dev, pcie->num_supplies, | ||
1814 | sizeof(*pcie->supplies), | ||
1815 | GFP_KERNEL); | ||
1816 | if (!pcie->supplies) | ||
1817 | return -ENOMEM; | ||
1818 | |||
1819 | pcie->supplies[i++].supply = "dvdd-pex"; | ||
1820 | pcie->supplies[i++].supply = "hvdd-pex-pll"; | ||
1821 | pcie->supplies[i++].supply = "hvdd-pex"; | ||
1822 | pcie->supplies[i++].supply = "vddio-pexctl-aud"; | ||
1823 | } else if (of_device_is_compatible(np, "nvidia,tegra210-pcie")) { | ||
1741 | pcie->num_supplies = 6; | 1824 | pcie->num_supplies = 6; |
1742 | 1825 | ||
1743 | pcie->supplies = devm_kcalloc(pcie->dev, pcie->num_supplies, | 1826 | pcie->supplies = devm_kcalloc(pcie->dev, pcie->num_supplies, |
@@ -2076,6 +2159,7 @@ static const struct tegra_pcie_soc tegra20_pcie = { | |||
2076 | .has_cml_clk = false, | 2159 | .has_cml_clk = false, |
2077 | .has_gen2 = false, | 2160 | .has_gen2 = false, |
2078 | .force_pca_enable = false, | 2161 | .force_pca_enable = false, |
2162 | .program_uphy = true, | ||
2079 | }; | 2163 | }; |
2080 | 2164 | ||
2081 | static const struct tegra_pcie_soc tegra30_pcie = { | 2165 | static const struct tegra_pcie_soc tegra30_pcie = { |
@@ -2091,6 +2175,7 @@ static const struct tegra_pcie_soc tegra30_pcie = { | |||
2091 | .has_cml_clk = true, | 2175 | .has_cml_clk = true, |
2092 | .has_gen2 = false, | 2176 | .has_gen2 = false, |
2093 | .force_pca_enable = false, | 2177 | .force_pca_enable = false, |
2178 | .program_uphy = true, | ||
2094 | }; | 2179 | }; |
2095 | 2180 | ||
2096 | static const struct tegra_pcie_soc tegra124_pcie = { | 2181 | static const struct tegra_pcie_soc tegra124_pcie = { |
@@ -2105,6 +2190,7 @@ static const struct tegra_pcie_soc tegra124_pcie = { | |||
2105 | .has_cml_clk = true, | 2190 | .has_cml_clk = true, |
2106 | .has_gen2 = true, | 2191 | .has_gen2 = true, |
2107 | .force_pca_enable = false, | 2192 | .force_pca_enable = false, |
2193 | .program_uphy = true, | ||
2108 | }; | 2194 | }; |
2109 | 2195 | ||
2110 | static const struct tegra_pcie_soc tegra210_pcie = { | 2196 | static const struct tegra_pcie_soc tegra210_pcie = { |
@@ -2119,9 +2205,27 @@ static const struct tegra_pcie_soc tegra210_pcie = { | |||
2119 | .has_cml_clk = true, | 2205 | .has_cml_clk = true, |
2120 | .has_gen2 = true, | 2206 | .has_gen2 = true, |
2121 | .force_pca_enable = true, | 2207 | .force_pca_enable = true, |
2208 | .program_uphy = true, | ||
2209 | }; | ||
2210 | |||
2211 | static const struct tegra_pcie_soc tegra186_pcie = { | ||
2212 | .num_ports = 3, | ||
2213 | .msi_base_shift = 8, | ||
2214 | .pads_pll_ctl = PADS_PLL_CTL_TEGRA30, | ||
2215 | .tx_ref_sel = PADS_PLL_CTL_TXCLKREF_BUF_EN, | ||
2216 | .pads_refclk_cfg0 = 0x80b880b8, | ||
2217 | .pads_refclk_cfg1 = 0x000480b8, | ||
2218 | .has_pex_clkreq_en = true, | ||
2219 | .has_pex_bias_ctrl = true, | ||
2220 | .has_intr_prsnt_sense = true, | ||
2221 | .has_cml_clk = false, | ||
2222 | .has_gen2 = true, | ||
2223 | .force_pca_enable = false, | ||
2224 | .program_uphy = false, | ||
2122 | }; | 2225 | }; |
2123 | 2226 | ||
2124 | static const struct of_device_id tegra_pcie_of_match[] = { | 2227 | static const struct of_device_id tegra_pcie_of_match[] = { |
2228 | { .compatible = "nvidia,tegra186-pcie", .data = &tegra186_pcie }, | ||
2125 | { .compatible = "nvidia,tegra210-pcie", .data = &tegra210_pcie }, | 2229 | { .compatible = "nvidia,tegra210-pcie", .data = &tegra210_pcie }, |
2126 | { .compatible = "nvidia,tegra124-pcie", .data = &tegra124_pcie }, | 2230 | { .compatible = "nvidia,tegra124-pcie", .data = &tegra124_pcie }, |
2127 | { .compatible = "nvidia,tegra30-pcie", .data = &tegra30_pcie }, | 2231 | { .compatible = "nvidia,tegra30-pcie", .data = &tegra30_pcie }, |