Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp8533858rwb; Thu, 24 Nov 2022 00:25:01 -0800 (PST) X-Google-Smtp-Source: AA0mqf6f3cN6Dy/7lMmFuYS3Q7F69PR2/zFNDMIii79obDReHkH5gXFbhkO0N6r1tkD9LYfIpG7O X-Received: by 2002:a63:500b:0:b0:440:4ad7:cde9 with SMTP id e11-20020a63500b000000b004404ad7cde9mr10736274pgb.308.1669278301415; Thu, 24 Nov 2022 00:25:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669278301; cv=none; d=google.com; s=arc-20160816; b=gkWwPRQuqVV9t6lyw55SGZ2q8tYrltP6/I+ACeW8ZnPffZYTMKNIKRl3SMCsSj5vk+ rdqdwSvI5miU+PdVNVUJQOTMPcsjduEO2VEAiQmIGCjc2aq1J+Jxz9CpoctCH6/3oNwR cOR/0DpOk6dYklWkuLtBZbP32RR+ZBbGDS+QBd2dfMgWdvDs9Eh0NM5bLUTJiy8zkX+o IYwwJkCKY0T0x74uSFfaKoesdktWrfpO3r/1Yac6IYAT5bOVY0EUOCuycRgujN7H9Gz3 hC4gT8x/vBqH9a2vUWJqnX0el2tuA2hoWsL+tdKEKUI1Z6QBX7/YpsPw8/SJcm31Y9r/ 3CMw== 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=icwkXwdDLLRLIgqPgrJxrVgU12rVdFpd1ApN1dUhl/A=; b=dLkvpFMendgM7VtR8Pwwaf/1eG7Pr8baq9I/7DN2ayUgf+TFzU6V0qmyFM2HYbAnxs hNQJrpgi4lGjMAN62SWpM36dQ3krM8uMrGFWUasgEWxsogEC5LXIi1RUeMH04+cRg3t6 ZP7rUENd6MO3g8+CR8jW9nR9zn2YUDZus5J4R+JkFZd9PQYZcSkMwtgnHG9VbLqNyCMw 9cg9t5KrFu53DCS4mYON2Mirkyxvbc19VPiSxP+VpsHeeKQOERklZeWPY2qDNWXoJxoI eCMT4P6mogBeuzoD4dAqGTU5PzS+nruNlDfU7yma2CV8M9KguqBcbOJwnYb7SROKTFjj 8DzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=g9Q1l2nf; 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 u11-20020a056a00124b00b0056befaa95a1si596729pfi.50.2022.11.24.00.24.50; Thu, 24 Nov 2022 00:25:01 -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=g9Q1l2nf; 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 S229961AbiKXIOa (ORCPT + 87 others); Thu, 24 Nov 2022 03:14:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229954AbiKXINj (ORCPT ); Thu, 24 Nov 2022 03:13:39 -0500 Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 079D013E05; Thu, 24 Nov 2022 00:13:01 -0800 (PST) Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 2AO8CfWu048765; Thu, 24 Nov 2022 02:12:41 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1669277561; bh=icwkXwdDLLRLIgqPgrJxrVgU12rVdFpd1ApN1dUhl/A=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=g9Q1l2nf//4na4ZLYXBpFGW77gO+rNar66tacimwymwfmH/E0dqvELe3X8L4m52lt TITLcF0xjJvphkXSPKmwcMJswzCQLcgIt68CDuU3t34FTvxxKbn0n3AQ6RqqKDi2g7 orbQ/uEMe/ZBtwB995Rtdp01M/snHjPDaCpWSIaw= Received: from DFLE111.ent.ti.com (dfle111.ent.ti.com [10.64.6.32]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 2AO8Cflh036658 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 24 Nov 2022 02:12:41 -0600 Received: from DFLE113.ent.ti.com (10.64.6.34) by DFLE111.ent.ti.com (10.64.6.32) 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:41 -0600 Received: from fllv0039.itg.ti.com (10.64.41.19) by DFLE113.ent.ti.com (10.64.6.34) 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:41 -0600 Received: from localhost (ileaxei01-snat.itg.ti.com [10.180.69.5]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 2AO8CcRc022226; Thu, 24 Nov 2022 02:12:40 -0600 From: Matt Ranostay To: , , , , , , , , , , CC: , , , , Matt Ranostay Subject: [PATCH v7 2/5] PCI: j721e: Add per platform maximum lane settings Date: Thu, 24 Nov 2022 00:12:18 -0800 Message-ID: <20221124081221.1206167-3-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 Various platforms have different maximum amount of lanes that can be selected. Add max_lanes to struct j721e_pcie to allow for detection of this which is needed to calculate the needed bitmask size for the possible lane count. Signed-off-by: Matt Ranostay Signed-off-by: Vignesh Raghavendra --- drivers/pci/controller/cadence/pci-j721e.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/pci/controller/cadence/pci-j721e.c b/drivers/pci/controller/cadence/pci-j721e.c index cc83a8925ce0..8990f58d64d5 100644 --- a/drivers/pci/controller/cadence/pci-j721e.c +++ b/drivers/pci/controller/cadence/pci-j721e.c @@ -47,8 +47,6 @@ enum link_status { #define GENERATION_SEL_MASK GENMASK(1, 0) -#define MAX_LANES 2 - struct j721e_pcie { struct cdns_pcie *cdns_pcie; struct clk *refclk; @@ -71,6 +69,7 @@ struct j721e_pcie_data { unsigned int quirk_disable_flr:1; u32 linkdown_irq_regfield; unsigned int byte_access_allowed:1; + unsigned int max_lanes; }; static inline u32 j721e_pcie_user_readl(struct j721e_pcie *pcie, u32 offset) @@ -290,11 +289,13 @@ static const struct j721e_pcie_data j721e_pcie_rc_data = { .quirk_retrain_flag = true, .byte_access_allowed = false, .linkdown_irq_regfield = LINK_DOWN, + .max_lanes = 2, }; static const struct j721e_pcie_data j721e_pcie_ep_data = { .mode = PCI_MODE_EP, .linkdown_irq_regfield = LINK_DOWN, + .max_lanes = 2, }; static const struct j721e_pcie_data j7200_pcie_rc_data = { @@ -302,23 +303,27 @@ static const struct j721e_pcie_data j7200_pcie_rc_data = { .quirk_detect_quiet_flag = true, .linkdown_irq_regfield = J7200_LINK_DOWN, .byte_access_allowed = true, + .max_lanes = 2, }; static const struct j721e_pcie_data j7200_pcie_ep_data = { .mode = PCI_MODE_EP, .quirk_detect_quiet_flag = true, .quirk_disable_flr = true, + .max_lanes = 2, }; static const struct j721e_pcie_data am64_pcie_rc_data = { .mode = PCI_MODE_RC, .linkdown_irq_regfield = J7200_LINK_DOWN, .byte_access_allowed = true, + .max_lanes = 1, }; static const struct j721e_pcie_data am64_pcie_ep_data = { .mode = PCI_MODE_EP, .linkdown_irq_regfield = J7200_LINK_DOWN, + .max_lanes = 1, }; static const struct of_device_id of_j721e_pcie_match[] = { @@ -432,7 +437,7 @@ static int j721e_pcie_probe(struct platform_device *pdev) pcie->user_cfg_base = base; ret = of_property_read_u32(node, "num-lanes", &num_lanes); - if (ret || num_lanes > MAX_LANES) + if (ret || num_lanes > data->max_lanes) num_lanes = 1; pcie->num_lanes = num_lanes; -- 2.38.GIT