Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4186427ioa; Tue, 26 Apr 2022 20:03:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzzEEVduC4k/OGs0uLxR3LgRR99pkDxzms396W2RdxL9tqdJQejup8/3RHRl3jYlJpAQkdt X-Received: by 2002:a05:6402:c98:b0:425:d806:7e9d with SMTP id cm24-20020a0564020c9800b00425d8067e9dmr18829362edb.337.1651028600571; Tue, 26 Apr 2022 20:03:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651028600; cv=none; d=google.com; s=arc-20160816; b=mO1qY2KTTuawdeWAOjqGbFARBrmPrigjsOI6aCS4qf8xFdvmjdzNswas91XEWjhd0e mXopfawkxuA/4c9vgpgEF6mpQ3f+CZ3bnh7WM9Z+Xplau+EdiOZ2Cw9sUsiLqGDSTS3e Ec04wFHLcrat6pJx4gVurTgS19jpxi6uAHwi3lBYs+tXE09hSsXM9//QDPyOiWVHSuVE HlWaJK4E26sKLuWiqStJNRKYnXMCD5bnEHadXCQKdjsUQL8x/gLo298rIwnvOGHMzReP cIr5p2RAPWQKbeN71McvNFubyC7R3oQlyO1rSu3YOFS5h2ihsvjb9KknkXtPWF1wvO9B 2aBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :message-id:subject:cc:to:from:date:dkim-signature; bh=1B9E0OR7ZSKDHI5SxOp/I0JXkDbk8QhaOJJN8KUMH94=; b=UkE0b7gp5Q1feHEwb8zqexT0+xtP61uVe71qQQo91Q1WxTc5RJeTrFbZGW6AIzZtvP +YdYhnbekPmRrKSPWs8p1qoQ8NyLCaoUoWnHI20efbNJYh1cjPzPnYjjF5SJrlfa9nmf F4TcWnwbLld8PXiMpjS6GjgE9HLgBtQL/N//9eQgXkdNrQ0PIIceN774ef5ljmbRUtWQ b5X51pyeNdrTVtddoycaGl+h0ceKYHLQmYABNrsP9f1TN8dUGwPa7ncfeOQHQpOVXvqx 1o64/GntKTiaktb3DdW4R2NazE1xg+ciGIO3kO2QynFl/ZJ+ABYwqEtv2eakX2W/G8ly 0cUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="bDD8Qpj/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hs37-20020a1709073ea500b006e093565393si109594ejc.496.2022.04.26.20.02.56; Tue, 26 Apr 2022 20:03:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="bDD8Qpj/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352831AbiDZQKQ (ORCPT + 99 others); Tue, 26 Apr 2022 12:10:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352823AbiDZQKN (ORCPT ); Tue, 26 Apr 2022 12:10:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 617496471F; Tue, 26 Apr 2022 09:07:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 23501B82047; Tue, 26 Apr 2022 16:07:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F804C385AA; Tue, 26 Apr 2022 16:07:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1650989222; bh=SIWK/mgrwqvjb745XCumZL2zEALgs20U9FUZGDkZgPQ=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=bDD8Qpj/XMzt4mZm2S8D6NQD6THckGoxgByTgj3daSgFZVM4539iQYEwYMrK9dPlJ VzzeBe2gPmT/q0hqRxKMxeJPpG5HsJFHEG0ETh8C+WVHjSGYThzXg12HdWQFbGpsSZ r5j+rsaD2/QPUdXOcF5pTsoxNr9iJC72Nfv6cRtmBB+N9epJuH1TGMkD3Fia3caX03 12JNYyKQCSxnduaISxloJdlOLsUPJ4cTTTMCSwkq/DZPyerS49WLCDqOcHKaPzXG5N /PjXCP/1yBHKGVD3GTwpLffVDYC7u/tVov1UaoyVaBRRqPO+AnPMgWk2mdAWv3WFGB P+E8ag50dBtRw== Date: Tue, 26 Apr 2022 11:07:00 -0500 From: Bjorn Helgaas To: Frank Wunderlich Cc: linux-rockchip@lists.infradead.org, Frank Wunderlich , Bjorn Helgaas , Rob Herring , Krzysztof Kozlowski , Heiko Stuebner , Kishon Vijay Abraham I , Vinod Koul , Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Philipp Zabel , Johan Jonker , Peter Geis , Michael Riesch , linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org Subject: Re: [RFC/RFT v2 10/11] PCI: rockchip: add a lane-map to rockchip pcie driver Message-ID: <20220426160700.GA1731141@bhelgaas> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220426132139.26761-11-linux@fw-web.de> X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > > 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@fe270000 //lane1 when using 1+1 > pcie3x2: pcie@fe280000 //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 > --- > 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@lists.infradead.org > https://lists.infradead.org/mailman/listinfo/linux-phy