Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp8572496rwb; Thu, 24 Nov 2022 01:07:33 -0800 (PST) X-Google-Smtp-Source: AA0mqf4QpOXYW9vjzKn8+lmcybDxPZBmz4UPm0cBUvjI5B8gMUrDN7su0EoEQmJDoZ1cscgxm4/2 X-Received: by 2002:a17:906:a0d7:b0:7b2:7af0:c231 with SMTP id bh23-20020a170906a0d700b007b27af0c231mr26214280ejb.240.1669280853015; Thu, 24 Nov 2022 01:07:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669280853; cv=none; d=google.com; s=arc-20160816; b=enYWDZiJfW9AAvdX6MOJVP/rKPaayxBo+bUYI2D/5WoDpbI9UyD7R/+M7/+xGdaR6D ZSAyVzlZ2hJFgikmZwazmpJAnzYWJeRR7EPLNrBk/j2iT0hrR1UjO8r+DiN6UjY0XAwq LGgrqs+1LKMU+1AqXmxXnCaQc/ogqWTT9KB52iHQFdgo9SedPK4s+wD/3Niircp77MwR fvuD2csacM43olZmhVhdt2ihFAfVHVIPJXYEQ3Mc3K3iVIYLtOuwsekEO2e4jH5o2W9J t7VkGcN2iLW5RRLt6bq1oZkT97FeAfbOiQCTDrsEZgTJ28fC3bkQIsgBFRjtaiCGYBzD AUCw== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o14-20020a170906974e00b007ba9c086b05si567558ejy.497.2022.11.24.01.07.00; Thu, 24 Nov 2022 01:07:33 -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 + 87 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 ); 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 To: , , , , , , , , , , CC: , , , , Matt Ranostay 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: X-Mailing-List: linux-kernel@vger.kernel.org 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 Reviewed-by: Vignesh Raghavendra --- 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