[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220426160700.GA1731141@bhelgaas>
Date: Tue, 26 Apr 2022 11:07:00 -0500
From: Bjorn Helgaas <helgaas@...nel.org>
To: Frank Wunderlich <linux@...web.de>
Cc: linux-rockchip@...ts.infradead.org,
Frank Wunderlich <frank-w@...lic-files.de>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Heiko Stuebner <heiko@...ech.de>,
Kishon Vijay Abraham I <kishon@...com>,
Vinod Koul <vkoul@...nel.org>,
Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
Krzysztof WilczyĆski <kw@...ux.com>,
Philipp Zabel <p.zabel@...gutronix.de>,
Johan Jonker <jbx6244@...il.com>,
Peter Geis <pgwipeout@...il.com>,
Michael Riesch <michael.riesch@...fvision.net>,
linux-pci@...r.kernel.org, devicetree@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
linux-phy@...ts.infradead.org
Subject: Re: [RFC/RFT v2 10/11] PCI: rockchip: add a lane-map to rockchip
pcie driver
The subject line should be "PCI: rockchip-dwc: Add ..." so there's no
need to mention "rockchip" again. No need to mention "pcie driver"
either, because that's obvious from the context, so just something
like:
PCI: rockchip-dwc: Add lane-map support
On Tue, Apr 26, 2022 at 03:21:38PM +0200, Frank Wunderlich wrote:
> From: Frank Wunderlich <frank-w@...lic-files.de>
>
> Add a basic lane-map to define which PCIe lanes should be
> used with this controller.
>
> Rockchip driver uses this for bifurcation (true/false) based
> on lanes should be splitted across controllers or not.
>
> On rk3568 there are 2 PCIe Controllers which share PCIe lanes.
>
> pcie3x1: pcie@...70000 //lane1 when using 1+1
> pcie3x2: pcie@...80000 //lane0 when using 1+1
>
> This ends up in one Controller (pcie3x1) uses lane-map = <0 1>; and
> the other lane-map = <1 0>; (pcie3x2)
>
> This means there are 2 lanes (count of numbers), one (by position)
> is mapped to the first controller, the other one is used on the other
> controller.
>
> In this driver the lane-map is simply converted to the bifurcation
> bool instead of direct mapping a specific lane to a controller.
>
> Signed-off-by: Frank Wunderlich <frank-w@...lic-files.de>
> ---
> v2:
> - new patch
> ---
> drivers/pci/controller/dwc/pcie-dw-rockchip.c | 15 +++++++++++++--
> 1 file changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/controller/dwc/pcie-dw-rockchip.c b/drivers/pci/controller/dwc/pcie-dw-rockchip.c
> index 79e909df241c..21cb697a5be1 100644
> --- a/drivers/pci/controller/dwc/pcie-dw-rockchip.c
> +++ b/drivers/pci/controller/dwc/pcie-dw-rockchip.c
> @@ -60,6 +60,7 @@ struct rockchip_pcie {
> struct regulator *vpcie3v3;
> struct irq_domain *irq_domain;
> bool bifurcation;
> + u32 lane_map[2];
> };
>
> static int rockchip_pcie_readl_apb(struct rockchip_pcie *rockchip,
> @@ -293,8 +294,10 @@ static int rockchip_pcie_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
> struct rockchip_pcie *rockchip;
> + unsigned int lanecnt = 0;
> struct pcie_port *pp;
> int ret;
> + int len;
>
> rockchip = devm_kzalloc(dev, sizeof(*rockchip), GFP_KERNEL);
> if (!rockchip)
> @@ -327,8 +330,16 @@ static int rockchip_pcie_probe(struct platform_device *pdev)
> }
> }
>
> - if (device_property_read_bool(dev, "bifurcation"))
> - rockchip->bifurcation = true;
Skip adding the "bifurcation" DT support completely if you can.
> + len = of_property_read_variable_u32_array(dev->of_node, "lane-map", rockchip->lane_map,
> + 2, ARRAY_SIZE(rockchip->lane_map));
> +
> + for (int i = 0; i < len; i++)
> + if (rockchip->lane_map[i])
> + lanecnt++;
> +
> + rockchip->bifurcation = ((lanecnt > 0) && (lanecnt != len));
> +
> + dev_info(dev, "bifurcation: %s\n", rockchip->bifurcation ? "true" : "false");
>
> ret = rockchip_pcie_phy_init(rockchip);
> if (ret)
> --
> 2.25.1
>
>
> --
> linux-phy mailing list
> linux-phy@...ts.infradead.org
> https://lists.infradead.org/mailman/listinfo/linux-phy
Powered by blists - more mailing lists