Skip to contentSkip to conversation

DRA72/DRA74: Add 2 lane support

RFC PATCH Applied Kishon Vijay Abraham I 2 participants 7 messages Sep 28, 2015 – Oct 9, 2015

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover DRA72/DRA74: Add 2 lane support

Add driver modifications in pci-dra7xx to get x2 mode working in DRA72 and DRA74. Certain modifications is needed in PHY driver also which I'll send as a separate series.

Kishon Vijay Abraham I (2):
pci: host: pci-dra7xx: use "num-lanes" property to find phy count
pci: host: pci-dra7xx: Enable x2 mode support

 Documentation/devicetree/bindings/pci/ti-pci.txt |    7 +-
 drivers/pci/host/pci-dra7xx.c                    |  104 +++++++++++++++++++---
 2 files changed, 97 insertions(+), 14 deletions(-)
Signature · 6 lines
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#1 lore raw

RFC PATCH 1/2 pci: host: pci-dra7xx: use "num-lanes" property to find phy count

use "num-lanes" property to find phy count instead of the number phy-names property.

---
 drivers/pci/host/pci-dra7xx.c |   23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)
drivers/pci/host/pci-dra7xx.c +11 -12
index 199e29a..e15b2e2 100644
@@ -66,7 +66,7 @@
 struct dra7xx_pcie {
 	void __iomem		*base;
 	struct phy		**phy;
-	int			phy_count;
+	int			lanes;
 	struct device		*dev;
 	struct pcie_port	pp;
 };
@@ -328,7 +328,7 @@ static int __init dra7xx_pcie_probe(struct platform_device *pdev)
 	int ret;
 	int irq;
 	int i;
-	int phy_count;
+	u32 lanes;
 	struct phy **phy;
 	void __iomem *base;
 	struct resource *res;
@@ -362,17 +362,16 @@ static int __init dra7xx_pcie_probe(struct platform_device *pdev)
 	if (!base)
 		return -ENOMEM;
 
-	phy_count = of_property_count_strings(np, "phy-names");
-	if (phy_count < 0) {
-		dev_err(dev, "unable to find the strings\n");
-		return phy_count;
+	if (of_property_read_u32(np, "num-lanes", &lanes)) {
+		dev_err(dev, "Failed to parse the number of lanes\n");
+		return -EINVAL;
 	}
 
-	phy = devm_kzalloc(dev, sizeof(*phy) * phy_count, GFP_KERNEL);
+	phy = devm_kzalloc(dev, sizeof(*phy) * lanes, GFP_KERNEL);
 	if (!phy)
 		return -ENOMEM;
 
-	for (i = 0; i < phy_count; i++) {
+	for (i = 0; i < lanes; i++) {
 		snprintf(name, sizeof(name), "pcie-phy%d", i);
 		phy[i] = devm_phy_get(dev, name);
 		if (IS_ERR(phy[i]))
@@ -392,7 +391,7 @@ static int __init dra7xx_pcie_probe(struct platform_device *pdev)
 	dra7xx->base = base;
 	dra7xx->phy = phy;
 	dra7xx->dev = dev;
-	dra7xx->phy_count = phy_count;
+	dra7xx->lanes = lanes;
 
 	pm_runtime_enable(dev);
 	ret = pm_runtime_get_sync(dev);
@@ -449,7 +448,7 @@ static int __exit dra7xx_pcie_remove(struct platform_device *pdev)
 	struct dra7xx_pcie *dra7xx = platform_get_drvdata(pdev);
 	struct pcie_port *pp = &dra7xx->pp;
 	struct device *dev = &pdev->dev;
-	int count = dra7xx->phy_count;
+	int count = dra7xx->lanes;
 
 	if (pp->irq_domain)
 		irq_domain_remove(pp->irq_domain);
@@ -495,7 +494,7 @@ static int dra7xx_pcie_resume(struct device *dev)
 static int dra7xx_pcie_suspend_noirq(struct device *dev)
 {
 	struct dra7xx_pcie *dra7xx = dev_get_drvdata(dev);
-	int count = dra7xx->phy_count;
+	int count = dra7xx->lanes;
 
 	while (count--) {
 		phy_power_off(dra7xx->phy[count]);
@@ -508,7 +507,7 @@ static int dra7xx_pcie_suspend_noirq(struct device *dev)
 static int dra7xx_pcie_resume_noirq(struct device *dev)
 {
 	struct dra7xx_pcie *dra7xx = dev_get_drvdata(dev);
-	int phy_count = dra7xx->phy_count;
+	int phy_count = dra7xx->lanes;
 	int ret;
 	int i;
 
Signature · 1 line
1.7.9.5
#2 lore raw

RFC PATCH 2/2 pci: host: pci-dra7xx: Enable x2 mode support

In reply to Kishon Vijay Abraham I

Perform syscon configurations to get x2 mode to working in DRA74x and DRA72x. Also add a new compatible string to dfferentiate DRA72x and DRA74x, since b1c0 mask is different for both these platforms.

---
 Documentation/devicetree/bindings/pci/ti-pci.txt |    7 +-
 drivers/pci/host/pci-dra7xx.c                    |   81 +++++++++++++++++++++-
 2 files changed, 86 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/pci/ti-pci.txt +6 -1
index 60e2516..1ae1705 100644
@@ -1,7 +1,8 @@
 TI PCI Controllers
 
 PCIe Designware Controller
- - compatible: Should be "ti,dra7-pcie""
+ - compatible: Should be "ti,dra7-pcie" for DRA74x
+	       Should be "ti,dra72-pcie" for DRA72x
  - reg : Two register ranges as listed in the reg-names property
  - reg-names : The first entry must be "ti-conf" for the TI specific registers
 	       The second entry must be "rc-dbics" for the designware pcie
@@ -14,6 +15,10 @@ PCIe Designware Controller
 	       where <X> is the instance number of the pcie from the HW spec.
  - interrupts : Two interrupt entries must be specified. The first one is for
 		main interrupt line and the second for MSI interrupt line.
+ - syscon-lane-conf : phandle/offset pair. Phandle to the system control module and the
+   register offset to specify 1 lane or 2 lane.
+ - syscon-lane-sel : phandle/offset pair. Phandle to the system control module and the
+   register offset to specify lane selection.
  - #address-cells,
    #size-cells,
    #interrupt-cells,
drivers/pci/host/pci-dra7xx.c +80 -1

122 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#3 lore raw
In reply to Kishon Vijay Abraham I

[+cc Arnd, Rob]

Quoted 7 lines · Kishon Vijay Abraham I

Add driver modifications in pci-dra7xx to get x2 mode working in DRA72 and DRA74. Certain modifications is needed in PHY driver also which I'll send as a separate series.

Kishon Vijay Abraham I (2):
pci: host: pci-dra7xx: use "num-lanes" property to find phy count
pci: host: pci-dra7xx: Enable x2 mode support

Applied to pci/host-dra7xx for v4.4, thanks!

I adjusted the subject line capitalization & format to match the history.

Arnd, Rob, any comments on the DT updates or the "num-lanes" vs number of strings in "phy-names" changes?

Bjorn

#4 lore raw

Hi Bjorn,

Quoted 11 lines · Bjorn Helgaas

[+cc Arnd, Rob]

Quoted 7 lines · Kishon Vijay Abraham I

Add driver modifications in pci-dra7xx to get x2 mode working in DRA72 and DRA74. Certain modifications is needed in PHY driver also which I'll send as a separate series.

Kishon Vijay Abraham I (2):
pci: host: pci-dra7xx: use "num-lanes" property to find phy count
pci: host: pci-dra7xx: Enable x2 mode support

Quoted 6 lines

Applied to pci/host-dra7xx for v4.4, thanks!

I adjusted the subject line capitalization & format to match the history.

Arnd, Rob, any comments on the DT updates or the "num-lanes" vs number of strings in "phy-names" changes?

I sent it as RFC since I didn't have the board to test 2 lane mode with $patch. And just now I got a board to test x2 and I found a problem with the 2nd patch.

.b1co_mode_sel_mask = GENMASK(2, 3), in the patch should be replaced with .b1co_mode_sel_mask = GENMASK(3, 2).

I'll resend the patch fixing the above.

Thanks
Kishon

#5 lore raw

Hi,

Quoted 21 lines · Kishon Vijay Abraham I

Hi Bjorn,

Quoted 11 lines · Bjorn Helgaas

[+cc Arnd, Rob]

Quoted 7 lines · Kishon Vijay Abraham I

Add driver modifications in pci-dra7xx to get x2 mode working in DRA72 and DRA74. Certain modifications is needed in PHY driver also which I'll send as a separate series.

Kishon Vijay Abraham I (2):
pci: host: pci-dra7xx: use "num-lanes" property to find phy count
pci: host: pci-dra7xx: Enable x2 mode support

Quoted 6 lines

Applied to pci/host-dra7xx for v4.4, thanks!

I adjusted the subject line capitalization & format to match the history.

Arnd, Rob, any comments on the DT updates or the "num-lanes" vs number of strings in "phy-names" changes?

Quoted 8 lines

I sent it as RFC since I didn't have the board to test 2 lane mode with $patch. And just now I got a board to test x2 and I found a problem with the 2nd patch.

.b1co_mode_sel_mask = GENMASK(2, 3), in the patch should be replaced with .b1co_mode_sel_mask = GENMASK(3, 2).

I'll resend the patch fixing the above.

I'll resend after a couple of days to fix any comments from Arnd or Rob.

Thanks
Kishon

Quoted 8 lines

Thanks
Kishon
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#6 lore raw
In reply to Kishon Vijay Abraham I
Quoted 21 lines · Kishon Vijay Abraham I

Hi Bjorn,

Quoted 11 lines · Bjorn Helgaas

[+cc Arnd, Rob]

Quoted 7 lines · Kishon Vijay Abraham I

Add driver modifications in pci-dra7xx to get x2 mode working in DRA72 and DRA74. Certain modifications is needed in PHY driver also which I'll send as a separate series.

Kishon Vijay Abraham I (2):
pci: host: pci-dra7xx: use "num-lanes" property to find phy count
pci: host: pci-dra7xx: Enable x2 mode support

Quoted 6 lines

Applied to pci/host-dra7xx for v4.4, thanks!

I adjusted the subject line capitalization & format to match the history.

Arnd, Rob, any comments on the DT updates or the "num-lanes" vs number of strings in "phy-names" changes?

Quoted 8 lines

I sent it as RFC since I didn't have the board to test 2 lane mode with $patch. And just now I got a board to test x2 and I found a problem with the 2nd patch.

.b1co_mode_sel_mask = GENMASK(2, 3), in the patch should be replaced with .b1co_mode_sel_mask = GENMASK(3, 2).

I'll resend the patch fixing the above.

OK, I dropped these two patches. Thanks for letting me know.