Message ID | 20221124081221.1206167-4-mranostay@ti.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3259379wrr; Thu, 24 Nov 2022 00:16:16 -0800 (PST) X-Google-Smtp-Source: AA0mqf40/gaDH2MOExMmY0Zu7OLXcO6GvzWAqVhR434tSr8RjkOCivTUwCbYlUiFnSE2kuIq/0uo X-Received: by 2002:a17:902:d711:b0:188:c7b2:2dd with SMTP id w17-20020a170902d71100b00188c7b202ddmr14235159ply.88.1669277775788; Thu, 24 Nov 2022 00:16:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669277775; cv=none; d=google.com; s=arc-20160816; b=iMLmV23G5tJlnU7z5xBTB4I+O5j4lqyV+1To5YQ3FaaW33+hdQd/8th2ifiuenQNLI rp2o+AJpUQZMMVdnxVlv72oQO5T+v2aJw7FvAy9M9Pa0S1Os/Vh3ymtwbqKsQrTyQEoO eqqSUl5KosgPt//tL1bOQFAnLrFPf9nxgGl3RyMbBqWtwKStNMCjawgI+9eCPVWq/5k7 lnhXmSMbgXalNHyAmJS6L+8rN1FNQf+wBwC3E7m8hoBzdnjMRSIxyr1nVkM5qTCig11R ZcjHvSHymW4PbIlOLk32rHc/JUSRbBPU3N9PRrCHg0XWF+cjSBUFKOD0JPjKmHKZ4RCZ rgYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8t12a/i1HdTF340cTJEw4enSchYXbeF3/TOGg+nFG4o=; b=ucJUus2hJtU8eB4lIS2c9FZ6zOQyEgeIFQiULclOClq3uH0uM+tM3GTh2CLpLadWM7 D4Ez5p+FlaAwQ3FuahNHuuNS6hKI9aQTABLuEFLxi1AURhUP6Hv4u0HF06IHOeTf+YxZ vWi7hRJJLTBmd4PyLYVlLWLwa3R99fUgu5GQqA8riF8h3dnT0ZqCNN1Nnp0OfFf+6rL4 ZwbDG5fHYlXBIiZRloeq3KeIEQ/rCedBbo1iWwrYMUehMjreDxzso0A6wft5SYFVpJPh ThDi+T5LTw57ISsODURIcusWv+uT1++RkmnPW6wRBhoPo2v7rKR7FOoN/dGf4iy5OB/S NJBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=fERWTGWe; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w4-20020a170902904400b0017e20ec5490si410511plz.301.2022.11.24.00.16.01; Thu, 24 Nov 2022 00:16:15 -0800 (PST) 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=@ti.com header.s=ti-com-17Q1 header.b=fERWTGWe; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229766AbiKXIOV (ORCPT <rfc822;fengqi706@gmail.com> + 99 others); Thu, 24 Nov 2022 03:14:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229773AbiKXINQ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 24 Nov 2022 03:13:16 -0500 Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2BFF2CC8D; Thu, 24 Nov 2022 00:12:55 -0800 (PST) Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 2AO8ClDb130315; Thu, 24 Nov 2022 02:12:47 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1669277567; bh=8t12a/i1HdTF340cTJEw4enSchYXbeF3/TOGg+nFG4o=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=fERWTGWellBd0Op+pVspPHWs9kdJPaXuSFAbylagNqq3ektEbzcnMLhE32Qt7EvBM eH+LkvUz/WoabyLcZo+0mZQOUICr5TJotdn6z2OPJK8q7UURMo3Ymg2DOA9LBGyRAc 8M+C1tB+J9N1tcLh4nyGephAHSus5qQfOFY5jgF8= Received: from DFLE115.ent.ti.com (dfle115.ent.ti.com [10.64.6.36]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 2AO8ClE4064095 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 24 Nov 2022 02:12:47 -0600 Received: from DFLE102.ent.ti.com (10.64.6.23) by DFLE115.ent.ti.com (10.64.6.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.16; Thu, 24 Nov 2022 02:12:46 -0600 Received: from fllv0040.itg.ti.com (10.64.41.20) by DFLE102.ent.ti.com (10.64.6.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.16 via Frontend Transport; Thu, 24 Nov 2022 02:12:46 -0600 Received: from localhost (ileaxei01-snat.itg.ti.com [10.180.69.5]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 2AO8ChYt026061; Thu, 24 Nov 2022 02:12:45 -0600 From: Matt Ranostay <mranostay@ti.com> To: <rogerq@kernel.org>, <lpieralisi@kernel.org>, <robh@kernel.org>, <kw@linux.com>, <bhelgaas@google.com>, <krzysztof.kozlowski@linaro.org>, <vigneshr@ti.com>, <tjoseph@cadence.com>, <sergio.paracuellos@gmail.com>, <pthombar@cadence.com>, <linux-pci@vger.kernel.org> CC: <devicetree@vger.kernel.org>, <linux-arm-kernel@lists.infradead.org>, <linux-omap@vger.kernel.org>, <linux-kernel@vger.kernel.org>, Matt Ranostay <mranostay@ti.com> Subject: [PATCH v7 3/5] PCI: j721e: Add PCIe 4x lane selection support Date: Thu, 24 Nov 2022 00:12:19 -0800 Message-ID: <20221124081221.1206167-4-mranostay@ti.com> X-Mailer: git-send-email 2.38.GIT In-Reply-To: <20221124081221.1206167-1-mranostay@ti.com> References: <20221124081221.1206167-1-mranostay@ti.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750364613015980011?= X-GMAIL-MSGID: =?utf-8?q?1750364613015980011?= |
Series |
PCI: add 4x lane support for pci-j721e controllers
|
|
Commit Message
Matt Ranostay
Nov. 24, 2022, 8:12 a.m. UTC
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 <mranostay@ti.com> Reviewed-by: Vignesh Raghavendra <vigneshr@ti.com> --- drivers/pci/controller/cadence/pci-j721e.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
Comments
On 24/11/2022 10:12, 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 <mranostay@ti.com> > Reviewed-by: Vignesh Raghavendra <vigneshr@ti.com> > --- > drivers/pci/controller/cadence/pci-j721e.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/drivers/pci/controller/cadence/pci-j721e.c b/drivers/pci/controller/cadence/pci-j721e.c > index 8990f58d64d5..dab3db9be6d8 100644 > --- a/drivers/pci/controller/cadence/pci-j721e.c > +++ b/drivers/pci/controller/cadence/pci-j721e.c > @@ -42,7 +42,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) > @@ -52,6 +51,7 @@ struct j721e_pcie { > struct clk *refclk; > u32 mode; > u32 num_lanes; > + u32 max_lanes; > void __iomem *user_cfg_base; > void __iomem *intd_cfg_base; > u32 linkdown_irq_regfield; > @@ -205,11 +205,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 mask = BIT(8); > u32 val = 0; > int ret; > > + if (pcie->max_lanes == 4) > + mask = GENMASK(9, 8); > + > 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"); > > @@ -439,6 +443,8 @@ static int j721e_pcie_probe(struct platform_device *pdev) > ret = of_property_read_u32(node, "num-lanes", &num_lanes); > if (ret || num_lanes > data->max_lanes) > num_lanes = 1; > + > + pcie->max_lanes = data->max_lanes; > pcie->num_lanes = num_lanes; > > if (dma_set_mask_and_coherent(dev, DMA_BIT_MASK(48))) Reviewed-by: Roger Quadros <rogerq@kernel.org> cheers, -roger
Hi Rob, I think your comment: https://lore.kernel.org/linux-pci/CAL_JsqJ5cOLXhD-73esmhVwMEWGT+w3SJC14Z0jY4tQJQRA7iw@mail.gmail.com was related to the commit log wording and not necessarily the actual diff. Please let me know if you are happy with this change and I shall merge the series. Thanks, Lorenzo On Thu, Nov 24, 2022 at 12:12:19AM -0800, 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 <mranostay@ti.com> > Reviewed-by: Vignesh Raghavendra <vigneshr@ti.com> > --- > drivers/pci/controller/cadence/pci-j721e.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/drivers/pci/controller/cadence/pci-j721e.c b/drivers/pci/controller/cadence/pci-j721e.c > index 8990f58d64d5..dab3db9be6d8 100644 > --- a/drivers/pci/controller/cadence/pci-j721e.c > +++ b/drivers/pci/controller/cadence/pci-j721e.c > @@ -42,7 +42,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) > @@ -52,6 +51,7 @@ struct j721e_pcie { > struct clk *refclk; > u32 mode; > u32 num_lanes; > + u32 max_lanes; > void __iomem *user_cfg_base; > void __iomem *intd_cfg_base; > u32 linkdown_irq_regfield; > @@ -205,11 +205,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 (pcie->max_lanes == 4) > + mask = GENMASK(9, 8); > + > 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"); > > @@ -439,6 +443,8 @@ static int j721e_pcie_probe(struct platform_device *pdev) > ret = of_property_read_u32(node, "num-lanes", &num_lanes); > if (ret || num_lanes > data->max_lanes) > num_lanes = 1; > + > + pcie->max_lanes = data->max_lanes; > pcie->num_lanes = num_lanes; > > if (dma_set_mask_and_coherent(dev, DMA_BIT_MASK(48))) > -- > 2.38.GIT >
diff --git a/drivers/pci/controller/cadence/pci-j721e.c b/drivers/pci/controller/cadence/pci-j721e.c index 8990f58d64d5..dab3db9be6d8 100644 --- a/drivers/pci/controller/cadence/pci-j721e.c +++ b/drivers/pci/controller/cadence/pci-j721e.c @@ -42,7 +42,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) @@ -52,6 +51,7 @@ struct j721e_pcie { struct clk *refclk; u32 mode; u32 num_lanes; + u32 max_lanes; void __iomem *user_cfg_base; void __iomem *intd_cfg_base; u32 linkdown_irq_regfield; @@ -205,11 +205,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 (pcie->max_lanes == 4) + mask = GENMASK(9, 8); + 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"); @@ -439,6 +443,8 @@ static int j721e_pcie_probe(struct platform_device *pdev) ret = of_property_read_u32(node, "num-lanes", &num_lanes); if (ret || num_lanes > data->max_lanes) num_lanes = 1; + + pcie->max_lanes = data->max_lanes; pcie->num_lanes = num_lanes; if (dma_set_mask_and_coherent(dev, DMA_BIT_MASK(48)))