From patchwork Thu Nov 24 08:12:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Ranostay X-Patchwork-Id: 25369 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3262245wrr; Thu, 24 Nov 2022 00:24:24 -0800 (PST) X-Google-Smtp-Source: AA0mqf4xQ+1LaUHyB7uXvXQiu8YQhzyK8oGuG8PdLCxnZyNKCxLkoW/E8jVv1A8cT+Ufw1QlHhrN X-Received: by 2002:a17:90b:804:b0:213:de70:9eb5 with SMTP id bk4-20020a17090b080400b00213de709eb5mr39965547pjb.145.1669278263789; Thu, 24 Nov 2022 00:24:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669278263; cv=none; d=google.com; s=arc-20160816; b=aKA5DURiRRVTqmirHvV/HSu5erDCRj3SJ/sU9NN5GMHXITC+HGaX7FE8aZIiiAG66C 7YWPAKV9DKm+1Be0HMM3ScJOHP4Nk9UNFDnbtXZweTp4FWA4imrgqQJDzjnrhnc8PVUv PLaWMy7dAJDLTePdMmZ81GQhDpZdaeWnaW4C42IE7SeV4c3Jcg3v8/7utvF5C8ko1oCj lFPCY6+p9G6KoFIc+FdDHoR9SGHCw6+m8He5HwZl/tL5NIsEiRVWFAmVO7Pu57ed7daJ 1ouvgPuTWGNk5TDcpa9fzdGFQeqM58WbJBNQjZqn4pBUQURYKFSsTd0v72zeVcj6bNAE nGDw== 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 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.10; Thu, 24 Nov 2022 00:24:23 -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 + 99 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750365124445154695?= X-GMAIL-MSGID: =?utf-8?q?1750365124445154695?= 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;