From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sebastian Hesselbarth Subject: [PATCH 2/5] PCI: mvebu: Count number of lanes Date: Sat, 20 Sep 2014 20:06:28 +0200 Message-ID: <1411236391-422-3-git-send-email-sebastian.hesselbarth@gmail.com> References: <1411236391-422-1-git-send-email-sebastian.hesselbarth@gmail.com> Return-path: In-Reply-To: <1411236391-422-1-git-send-email-sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Sender: devicetree-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Sebastian Hesselbarth Cc: Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , Bjorn Helgaas , Jason Cooper , Andrew Lunn , Gregory Clement , Thomas Petazzoni , devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org List-Id: devicetree@vger.kernel.org Some PCIe controllers found on Armada XP SoCs can be configured as either four single-lane x1 or one quad-lane x4 PCIe. Although we are not (yet) interested in the physical configuration of the PCIe controller, we will need it when proper PHY support for PCIe is added. Adapt the driver to the amended DT semantic and count the number of PCIe lanes. Signed-off-by: Sebastian Hesselbarth --- Cc: Rob Herring Cc: Pawel Moll Cc: Mark Rutland Cc: Ian Campbell Cc: Kumar Gala Cc: Bjorn Helgaas Cc: Jason Cooper Cc: Andrew Lunn Cc: Gregory Clement Cc: Thomas Petazzoni Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org --- drivers/pci/host/pci-mvebu.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c index a8c6f1a92e0f..0feee6cd395c 100644 --- a/drivers/pci/host/pci-mvebu.c +++ b/drivers/pci/host/pci-mvebu.c @@ -115,6 +115,7 @@ struct mvebu_pcie_port { void __iomem *base; u32 port; u32 lane; + int num_lanes; int devfn; unsigned int mem_target; unsigned int mem_attr; @@ -982,9 +983,17 @@ static int mvebu_pcie_probe(struct platform_device *pdev) continue; } - if (of_property_read_u32(child, "marvell,pcie-lane", - &port->lane)) + /* + * If there are multiple lanes, we are only interested in the + * number of the first lane and the lane count. + */ + if (of_property_read_u32_index(child, "marvell,pcie-lane", + 0, &port->lane)) port->lane = 0; + port->num_lanes = of_property_count_u32_elems(child, + "marvell,pcie-lane"); + if (!port->num_lanes) + port->num_lanes = 1; port->name = kasprintf(GFP_KERNEL, "pcie%d.%d", port->port, port->lane); -- 2.0.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html