From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AF36CC38A2D for ; Tue, 25 Oct 2022 12:52:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:CC:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=1T/G+ZnLuwk98Y2rokT3LMG1bKV4KA2UgreEVWyGv/4=; b=NpflYMhZuarjhQ DjkTYXnXSezo0tUaSB7T4/rA812ZdRIHLSErrLIr+bMaED6MZ/nIGhTfZTrbB4utP+Ht81lanFfB4 SYhDVHkCGpHtmu1xp21KxjujN9GtjL4mrRvTKi6zBsroOAE3KB6E0dxdc5xwL9kUVmdHsMgfJpWHb f7WlGDpOYbyA4MOBPv9kZIVItFgEVzaxzStYvfEVXNZ3VQ03t3FhHFzswMyFwgZOC9h5Y9XyTrCTP z+WkWMV5AQo24GB2fQIOip0sdFpZSPiULR865R3fikKNpMcyyee+fCuvjkhZqgIKedu6X4tMmiHKl 1H2GTLliZ5+9ZCAMqEDA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1onJPM-005IHF-TA; Tue, 25 Oct 2022 12:51:52 +0000 Received: from lelv0142.ext.ti.com ([198.47.23.249]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1onJPI-005IDg-LF for linux-arm-kernel@lists.infradead.org; Tue, 25 Oct 2022 12:51:50 +0000 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 29PCpffT034240; Tue, 25 Oct 2022 07:51:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1666702301; bh=HgP27iUh3ikV8+Pj3Lp8cBDsKGF6jEt7/MSPqaVezi8=; h=Date:From:To:CC:Subject:References:In-Reply-To; b=EzAKrWMkkMtDLtQ4t3KQRhcOaIVwl/3c5JS3PK7onGnrlNrx6nmFCaUP1UvQ+zQCf GKJntwnQPQ/v2Wt5f6QZK1l6dpVQsDuiOG6N3GFO08w8/Ovr9pB+UDKCcD69oGo0a4 3a8TVW7/VwhWnv0k0nGY1tE1mL09OvmDudNDXKPA= Received: from DLEE115.ent.ti.com (dlee115.ent.ti.com [157.170.170.26]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 29PCpf6G110709 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 25 Oct 2022 07:51:41 -0500 Received: from DLEE107.ent.ti.com (157.170.170.37) by DLEE115.ent.ti.com (157.170.170.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.6; Tue, 25 Oct 2022 07:51:40 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE107.ent.ti.com (157.170.170.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.6 via Frontend Transport; Tue, 25 Oct 2022 07:51:40 -0500 Received: from ubuntu (ileaxei01-snat.itg.ti.com [10.180.69.5]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with SMTP id 29PCpXut112594; Tue, 25 Oct 2022 07:51:35 -0500 Date: Tue, 25 Oct 2022 05:51:31 -0700 From: Matt Ranostay To: Vignesh Raghavendra CC: , , , , , Subject: Re: [PATCH v3 1/3] PCI: j721e: Add PCIe 4x lane selection support Message-ID: References: <20221020012911.305139-1-mranostay@ti.com> <20221020012911.305139-2-mranostay@ti.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221025_055148_799703_46481B09 X-CRM114-Status: GOOD ( 22.06 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Oct 25, 2022 at 05:23:20PM +0530, Vignesh Raghavendra wrote: > Hi Matt, > > On 20/10/22 6:59 am, Matt Ranostay wrote: > > Add support for setting of two-bit field that allows selection of 4x > > lane PCIe which was previously limited to only 2x lanes. > > > > Signed-off-by: Matt Ranostay > > --- > > drivers/pci/controller/cadence/pci-j721e.c | 7 +++++-- > > 1 file changed, 5 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/pci/controller/cadence/pci-j721e.c b/drivers/pci/controller/cadence/pci-j721e.c > > index a82f845cc4b5..d9b1527421c3 100644 > > --- a/drivers/pci/controller/cadence/pci-j721e.c > > +++ b/drivers/pci/controller/cadence/pci-j721e.c > > @@ -43,7 +43,6 @@ enum link_status { > > }; > > > > #define J721E_MODE_RC BIT(7) > > -#define LANE_COUNT_MASK BIT(8) > > #define LANE_COUNT(n) ((n) << 8) > > > > #define GENERATION_SEL_MASK GENMASK(1, 0) > > @@ -207,11 +206,15 @@ static int j721e_pcie_set_lane_count(struct j721e_pcie *pcie, > > { > > struct device *dev = pcie->cdns_pcie->dev; > > u32 lanes = pcie->num_lanes; > > + u32 mask = GENMASK(8, 8); > > u32 val = 0; > > int ret; > > > > + if (lanes == 4) > > + mask = GENMASK(9, 8); > > > Shouldn't we decide "mask" based on max_lanes added in 2/3 (ie how many > lanes HW can support and thus width of this bit field) instead of > num_lanes? Hypothetically, what if bootloader / other entity has set MSb > but Linux is restricted to 2 lanes in DT? Ah yes that is a very good point, and the mask should be based on max_lanes. Will fix up in v4... - Matt > > > + > > val = LANE_COUNT(lanes - 1); > > - ret = regmap_update_bits(syscon, offset, LANE_COUNT_MASK, val); > > + ret = regmap_update_bits(syscon, offset, mask, val); > > if (ret) > > dev_err(dev, "failed to set link count\n"); > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel