Message ID | 20230803115016.4266-1-thippeswamy.havalige@amd.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp1117066vqx; Thu, 3 Aug 2023 05:36:27 -0700 (PDT) X-Google-Smtp-Source: APBJJlFgY7OZSukoWd+CnehX59iFeTgwRXL6kogLBOHoUu7r8j0+SsgkKepi/0S+4VLJsB2sWYFA X-Received: by 2002:a17:903:1cb:b0:1b8:9044:9ede with SMTP id e11-20020a17090301cb00b001b890449edemr20240035plh.62.1691066187057; Thu, 03 Aug 2023 05:36:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1691066187; cv=pass; d=google.com; s=arc-20160816; b=XSCs7ujzhm/0+HHNcuK2uR+SBY4ez1bFVJ3GwfsqAyavyXbYXyAXGXTsrx5cuwAQbw tclGHMFfpvGmNhs+g1ajoa8pmtc2Xy5uchAE51ykKUn6GYPWQIL22sRzsPPjyCY+uK6H Sd237hu0rIzmS47olTMU4+R7Nwwq9YMM7AvlWJb25Fn/VHgcAmaVjEv1Gxlb1jR5IDsV w3thRlnQfak/ptpQjuuTavJhUs95Efvy2bxawcC/F4slkJch95YU4MdoqJZyOwcalkKJ OLEtcgSW/uRQCcmPWueDkmZJowAsQHtcT4avAMAC7TeKYUG71mZsyFF6jGSP6FJjlpmi FpxA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=ByXv/8fNtwaQMvLzxFc2CJTJnn2cf+qKtiEZD+GH0Yg=; fh=znvNYZK9lFDwM50KthsO5dAxbXU2R8SEeWAa1QIOywc=; b=pbLgZLJCUZqS7ztTXgZKCdAhPOOzv/9N7pbrHercHyAv547aLb+GObdT3a2SztuaMQ a5TRMSQIozjmjlWjk59KTV2P85nQLmWcwXKZY9B7z+DVZhLBZhttJCUFmaCDMO47/S4G e+x7VFdMikVdcww/7Cq8tmY0FFi8iSR+FqL1R48PiXDV5eJy36Ozv3uoN9Os1XXkOnB8 vOF4dS4sZo6j7/XouTtMXdxIZlOujQLuErbLNs0xy02rvsJJzbnuGo1NB4LgxOKjNQyN iXC/PKEy1PlhNJD95iIK6uf94FzcerJ+R6PwtZ8GlQ5nEP7SwkOAPBi2nSZpHzJZsuji y1Jw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=VKcycxZn; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); 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=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v5-20020a170902b7c500b001b8a67f1c10si12319297plz.468.2023.08.03.05.36.12; Thu, 03 Aug 2023 05:36:27 -0700 (PDT) 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=@amd.com header.s=selector1 header.b=VKcycxZn; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); 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=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235291AbjHCLuj (ORCPT <rfc822;jeff.pang.chn@gmail.com> + 99 others); Thu, 3 Aug 2023 07:50:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233825AbjHCLue (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 3 Aug 2023 07:50:34 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2050.outbound.protection.outlook.com [40.107.223.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92BAB272A; Thu, 3 Aug 2023 04:50:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nACdV3RqJ0q5MmzoVmoxOnmSDvvMLlfS++TLEsThjpmDIXnJyLahI63ub1HiupNdE+YEuvIVZOrNU/5Bev4oJ/iV5bifT2JYbADg8kk2/Cahh7FIbQMhVmgzlLprxtwnOv+k9crvSkurBh41SI6oHbMMkEkBleRDhzudV0qOoG3Oo80qnovviXoPrbNNXcR1hfLp7BCMjrkO+R/USNKz2gYfc9WD1LB1ounOYxK12ASUai6YoQ7BrYHGAcYtYOHZB4YNVQEEardTJsHnhALc65gRtotqZ53jNiirslel/CUr/RGtvM4BBHuKwBLPhdfUfjSrlZSO8W/l9xD5e+m7Sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ByXv/8fNtwaQMvLzxFc2CJTJnn2cf+qKtiEZD+GH0Yg=; b=djZP4m31S1NLjwc1Mr7MHUXOTqSyRkXtlxeHz7oPew46HtxLWjbvLKPLR5sq8inUCiyHehFd8jsXf5dCMqSMAf8E7To53ob81VgIl+WO7PGX5ZyqEXbc0OtFwXrn16+tG58yGxMFpWGckEntVVWo9MEPADcBxd8WmEao7ISrhIrigvU+NuSui4f8ZZ7w8s6vPPNkDNuXAfZcOsPnvWHTFH0ioo9Ax3AFCbsyDOpKtbx+2DYKLK5Lmo/sGd+N2g3d7I2a8yeR5pZw9NeLg2BDR6LQccb7BN9d5/voTpHNgepGJdwlwxQXts3bCWbbzk6zSAJdKwqa8la5OIJIC2MJTA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ByXv/8fNtwaQMvLzxFc2CJTJnn2cf+qKtiEZD+GH0Yg=; b=VKcycxZnanvnOvuyWYMhaNAGQ/RgJevYBzao0LpQ1I7Z1cOZj2JWBYiROXCw+eYSrmmruQW1xw4+a+3GmB5uwvBh0WKjo4+kQxAJreyBwz5ytpMws5j/z46Ow+tJqydHjbgOwMVHbquqbidsApMpBcgRp3HkiXwv3pjXTvI+prM= Received: from CY5PR20CA0006.namprd20.prod.outlook.com (2603:10b6:930:3::30) by IA0PR12MB7698.namprd12.prod.outlook.com (2603:10b6:208:432::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.47; Thu, 3 Aug 2023 11:50:28 +0000 Received: from CY4PEPF0000E9DC.namprd05.prod.outlook.com (2603:10b6:930:3:cafe::88) by CY5PR20CA0006.outlook.office365.com (2603:10b6:930:3::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.20 via Frontend Transport; Thu, 3 Aug 2023 11:50:28 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by CY4PEPF0000E9DC.mail.protection.outlook.com (10.167.241.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6652.19 via Frontend Transport; Thu, 3 Aug 2023 11:50:27 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Thu, 3 Aug 2023 06:50:27 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB08.amd.com (10.181.40.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Thu, 3 Aug 2023 04:50:26 -0700 Received: from xhdthippesw40.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.27 via Frontend Transport; Thu, 3 Aug 2023 06:50:24 -0500 From: Thippeswamy Havalige <thippeswamy.havalige@amd.com> To: <linux-kernel@vger.kernel.org>, <robh+dt@kernel.org>, <bhelgaas@google.com>, <linux-pci@vger.kernel.org> CC: <krzysztof.kozlowski@linaro.org>, <lpieralisi@kernel.org>, <bharat.kumar.gogada@amd.com>, <michal.simek@amd.com>, <linux-arm-kernel@lists.infradead.org>, Thippeswamy Havalige <thippeswamy.havalige@amd.com> Subject: [PATCH] PCI: xilinx-nwl: Remove unnecessary code and updating ecam default value. Date: Thu, 3 Aug 2023 17:20:16 +0530 Message-ID: <20230803115016.4266-1-thippeswamy.havalige@amd.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9DC:EE_|IA0PR12MB7698:EE_ X-MS-Office365-Filtering-Correlation-Id: 9e53c711-81a1-4c21-d0a7-08db9417d4e0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2aWX0cktiEN21bPayGpqGrWPWuIUUJmYkEBNw+hSGwCE6uM6II3yJ36t2ICcfCdtT4pFM8gCOpfuox2zCT7CqjfmIEDPpeVKljqwfhekJPhnCUfKAKlM1B4BhV0BJ41cmQwaGX2hZa7czpthM3F3lZ8YYW5hYwiOZnxOXYUYH+rEKaU0i3x7pr+wu7aupLoPlqqcbQw3nAfKwxNV8kBiA1TgE3hCJPznu2MAbsF47n5xQEfEBXp2ymE8UZtd1FTFj9G7BoVAvEaS4RnEhw20mREwBFWHLItUE7KR0lUVoKWnvO50VhyY2a9b7VoOfUc6pWtF00Ks/J+vv4WdZZt+DSNxSaCaDsmtlZKQyZROMCl9u85n6ClAukQ+sEVwLU5rXjKm7ksZFLMXsLgpdA0+VBrxfn4nWigLRdT/MocNFy1g5n2LVu2m/Ixkwy9WkyPQyzr4VSDKKhZiy3vOHfAgegq99jekTW4iSkBzkuPmBeNiNX2lX/GIiTmr+dW4PQgX58rK+hyPNUDUklcGB6Mrh6nBSBDmx72nz4n+CuFi99yL+j+cWOqnc/wOwHADWuAkPG4ptYV/RS33gDZTR3LqsSb2k8ELX+SBkQuerpz/Fd5JXk9eEvvlAHlNKEkNhi9SzCbF02VIcorpSymx6tICyYHwct8jxL6llZEzR/iUVFM2iaOuUgXTfkhkTVDTSoxKhscpLFsyMw2qom3Cp/D7jVY4ZrdXQLetOyyu00e6udYyoUY+FlHlmCuZtjDm2E0jGmKPo5YzSR1ETTH5Qebqwg== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(136003)(396003)(346002)(376002)(39860400002)(451199021)(82310400008)(36840700001)(46966006)(40470700004)(41300700001)(40460700003)(8936002)(8676002)(36860700001)(83380400001)(47076005)(336012)(186003)(1076003)(26005)(86362001)(2616005)(426003)(81166007)(356005)(82740400003)(316002)(6666004)(40480700001)(110136005)(54906003)(478600001)(36756003)(4326008)(70586007)(70206006)(2906002)(5660300002)(44832011)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Aug 2023 11:50:27.8625 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9e53c711-81a1-4c21-d0a7-08db9417d4e0 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000E9DC.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB7698 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no 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: INBOX X-GMAIL-THRID: 1773211418366964904 X-GMAIL-MSGID: 1773211418366964904 |
Series |
PCI: xilinx-nwl: Remove unnecessary code and updating ecam default value.
|
|
Commit Message
Havalige, Thippeswamy
Aug. 3, 2023, 11:50 a.m. UTC
Remove reduntant code.
Change NWL_ECAM_VALUE_DEFAULT to 16 to support maximum 256 buses.
Signed-off-by: Thippeswamy Havalige <thippeswamy.havalige@amd.com>
---
drivers/pci/controller/pcie-xilinx-nwl.c | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
Comments
On Thu, Aug 03, 2023 at 05:20:16PM +0530, Thippeswamy Havalige wrote: > Remove reduntant code. > Change NWL_ECAM_VALUE_DEFAULT to 16 to support maximum 256 buses. Remove period from subject line. Please mention the most important part first in the subject -- the ECAM change sounds more important than removing redundant code. s/ecam/ECAM/ s/reduntant/redundant/ Please elaborate on why this code is redundant. What makes it redundant? Apparently the bus number registers default to the correct values or some other software programs them? I don't see the point of the struct nwl_pcie.ecam_value member. It is set once and never updated, so we could just use NWL_ECAM_VALUE_DEFAULT instead. "ECAM_VALUE" is not a very informative name. I don't know what an "ECAM value" would be. How is the value 16 related to a maximum of 256 buses? We only need 8 bits to address 256 buses, so it must be something else. The bus number appears at bits 20-27 (PCIE_ECAM_BUS_SHIFT) in a standard ECAM address, so probably not the bit location? Does this fix a problem? > Signed-off-by: Thippeswamy Havalige <thippeswamy.havalige@amd.com> > --- > drivers/pci/controller/pcie-xilinx-nwl.c | 11 +---------- > 1 file changed, 1 insertion(+), 10 deletions(-) > > diff --git a/drivers/pci/controller/pcie-xilinx-nwl.c b/drivers/pci/controller/pcie-xilinx-nwl.c > index 176686b..6d40543 100644 > --- a/drivers/pci/controller/pcie-xilinx-nwl.c > +++ b/drivers/pci/controller/pcie-xilinx-nwl.c > @@ -126,7 +126,7 @@ > #define E_ECAM_CR_ENABLE BIT(0) > #define E_ECAM_SIZE_LOC GENMASK(20, 16) > #define E_ECAM_SIZE_SHIFT 16 > -#define NWL_ECAM_VALUE_DEFAULT 12 > +#define NWL_ECAM_VALUE_DEFAULT 16 > > #define CFG_DMA_REG_BAR GENMASK(2, 0) > #define CFG_PCIE_CACHE GENMASK(7, 0) > @@ -683,15 +683,6 @@ static int nwl_pcie_bridge_init(struct nwl_pcie *pcie) > nwl_bridge_writel(pcie, upper_32_bits(pcie->phys_ecam_base), > E_ECAM_BASE_HI); > > - /* Get bus range */ > - ecam_val = nwl_bridge_readl(pcie, E_ECAM_CONTROL); > - pcie->last_busno = (ecam_val & E_ECAM_SIZE_LOC) >> E_ECAM_SIZE_SHIFT; > - /* Write primary, secondary and subordinate bus numbers */ > - ecam_val = first_busno; > - ecam_val |= (first_busno + 1) << 8; > - ecam_val |= (pcie->last_busno << E_ECAM_SIZE_SHIFT); > - writel(ecam_val, (pcie->ecam_base + PCI_PRIMARY_BUS)); "ecam_val" looks like it's supposed to be the 32-bit value containing PCI_PRIMARY_BUS (low 8 bits, from the pointless "first_busno" that is always 0), PCI_SECONDARY_BUS (bits 8-15, always bus 1), PCI_SUBORDINATE_BUS (bits 16-23, totally unrelated to E_ECAM_SIZE_SHIFT although E_ECAM_SIZE_SHIFT happens to be the correct value (16)), and PCI_SEC_LATENCY_TIMER (not applicable for PCIe). So I guess the assumption is that these registers already contain the correct values? It looks like previously PCI_SUBORDINATE_BUS (i.e., pcie->last_busno) was 12, since we wrote NWL_ECAM_VALUE_DEFAULT to E_ECAM_CONTROL and then read it back? And now pcie->last_busno is competely unused? This all seems not quite baked. Am I missing something? Bjorn
Hi Thippeswamy,
kernel test robot noticed the following build warnings:
[auto build test WARNING on pci/next]
[also build test WARNING on pci/for-linus linus/master v6.5-rc4 next-20230803]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Thippeswamy-Havalige/PCI-xilinx-nwl-Remove-unnecessary-code-and-updating-ecam-default-value/20230803-195228
base: https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git next
patch link: https://lore.kernel.org/r/20230803115016.4266-1-thippeswamy.havalige%40amd.com
patch subject: [PATCH] PCI: xilinx-nwl: Remove unnecessary code and updating ecam default value.
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20230804/202308040330.eMTjX3tF-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20230804/202308040330.eMTjX3tF-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202308040330.eMTjX3tF-lkp@intel.com/
All warnings (new ones prefixed by >>):
drivers/pci/controller/pcie-xilinx-nwl.c: In function 'nwl_pcie_bridge_init':
>> drivers/pci/controller/pcie-xilinx-nwl.c:628:33: warning: unused variable 'first_busno' [-Wunused-variable]
628 | u32 breg_val, ecam_val, first_busno = 0;
| ^~~~~~~~~~~
vim +/first_busno +628 drivers/pci/controller/pcie-xilinx-nwl.c
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 623
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 624 static int nwl_pcie_bridge_init(struct nwl_pcie *pcie)
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 625 {
adf9e284b4f76d drivers/pci/host/pcie-xilinx-nwl.c Bjorn Helgaas 2016-10-06 626 struct device *dev = pcie->dev;
adf9e284b4f76d drivers/pci/host/pcie-xilinx-nwl.c Bjorn Helgaas 2016-10-06 627 struct platform_device *pdev = to_platform_device(dev);
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 @628 u32 breg_val, ecam_val, first_busno = 0;
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 629 int err;
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 630
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 631 breg_val = nwl_bridge_readl(pcie, E_BREG_CAPABILITIES) & BREG_PRESENT;
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 632 if (!breg_val) {
adf9e284b4f76d drivers/pci/host/pcie-xilinx-nwl.c Bjorn Helgaas 2016-10-06 633 dev_err(dev, "BREG is not present\n");
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 634 return breg_val;
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 635 }
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 636
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 637 /* Write bridge_off to breg base */
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 638 nwl_bridge_writel(pcie, lower_32_bits(pcie->phys_breg_base),
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 639 E_BREG_BASE_LO);
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 640 nwl_bridge_writel(pcie, upper_32_bits(pcie->phys_breg_base),
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 641 E_BREG_BASE_HI);
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 642
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 643 /* Enable BREG */
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 644 nwl_bridge_writel(pcie, ~BREG_ENABLE_FORCE & BREG_ENABLE,
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 645 E_BREG_CONTROL);
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 646
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 647 /* Disable DMA channel registers */
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 648 nwl_bridge_writel(pcie, nwl_bridge_readl(pcie, BRCFG_PCIE_RX0) |
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 649 CFG_DMA_REG_BAR, BRCFG_PCIE_RX0);
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 650
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 651 /* Enable Ingress subtractive decode translation */
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 652 nwl_bridge_writel(pcie, SET_ISUB_CONTROL, I_ISUB_CONTROL);
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 653
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 654 /* Enable msg filtering details */
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 655 nwl_bridge_writel(pcie, CFG_ENABLE_MSG_FILTER_MASK,
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 656 BRCFG_PCIE_RX_MSG_FILTER);
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 657
213e1220523288 drivers/pci/controller/pcie-xilinx-nwl.c Bharat Kumar Gogada 2021-02-22 658 /* This routes the PCIe DMA traffic to go through CCI path */
213e1220523288 drivers/pci/controller/pcie-xilinx-nwl.c Bharat Kumar Gogada 2021-02-22 659 if (of_dma_is_coherent(dev->of_node))
213e1220523288 drivers/pci/controller/pcie-xilinx-nwl.c Bharat Kumar Gogada 2021-02-22 660 nwl_bridge_writel(pcie, nwl_bridge_readl(pcie, BRCFG_PCIE_RX1) |
213e1220523288 drivers/pci/controller/pcie-xilinx-nwl.c Bharat Kumar Gogada 2021-02-22 661 CFG_PCIE_CACHE, BRCFG_PCIE_RX1);
213e1220523288 drivers/pci/controller/pcie-xilinx-nwl.c Bharat Kumar Gogada 2021-02-22 662
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 663 err = nwl_wait_for_link(pcie);
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 664 if (err)
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 665 return err;
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 666
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 667 ecam_val = nwl_bridge_readl(pcie, E_ECAM_CAPABILITIES) & E_ECAM_PRESENT;
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 668 if (!ecam_val) {
adf9e284b4f76d drivers/pci/host/pcie-xilinx-nwl.c Bjorn Helgaas 2016-10-06 669 dev_err(dev, "ECAM is not present\n");
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 670 return ecam_val;
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 671 }
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 672
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 673 /* Enable ECAM */
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 674 nwl_bridge_writel(pcie, nwl_bridge_readl(pcie, E_ECAM_CONTROL) |
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 675 E_ECAM_CR_ENABLE, E_ECAM_CONTROL);
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 676
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 677 nwl_bridge_writel(pcie, nwl_bridge_readl(pcie, E_ECAM_CONTROL) |
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 678 (pcie->ecam_value << E_ECAM_SIZE_SHIFT),
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 679 E_ECAM_CONTROL);
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 680
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 681 nwl_bridge_writel(pcie, lower_32_bits(pcie->phys_ecam_base),
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 682 E_ECAM_BASE_LO);
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 683 nwl_bridge_writel(pcie, upper_32_bits(pcie->phys_ecam_base),
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 684 E_ECAM_BASE_HI);
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 685
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 686 if (nwl_pcie_link_up(pcie))
adf9e284b4f76d drivers/pci/host/pcie-xilinx-nwl.c Bjorn Helgaas 2016-10-06 687 dev_info(dev, "Link is UP\n");
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 688 else
adf9e284b4f76d drivers/pci/host/pcie-xilinx-nwl.c Bjorn Helgaas 2016-10-06 689 dev_info(dev, "Link is DOWN\n");
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 690
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 691 /* Get misc IRQ number */
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 692 pcie->irq_misc = platform_get_irq_byname(pdev, "misc");
caecb05c800081 drivers/pci/controller/pcie-xilinx-nwl.c Krzysztof WilczyĆski 2020-08-02 693 if (pcie->irq_misc < 0)
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 694 return -EINVAL;
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 695
adf9e284b4f76d drivers/pci/host/pcie-xilinx-nwl.c Bjorn Helgaas 2016-10-06 696 err = devm_request_irq(dev, pcie->irq_misc,
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 697 nwl_pcie_misc_handler, IRQF_SHARED,
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 698 "nwl_pcie:misc", pcie);
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 699 if (err) {
adf9e284b4f76d drivers/pci/host/pcie-xilinx-nwl.c Bjorn Helgaas 2016-10-06 700 dev_err(dev, "fail to register misc IRQ#%d\n",
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 701 pcie->irq_misc);
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 702 return err;
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 703 }
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 704
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 705 /* Disable all misc interrupts */
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 706 nwl_bridge_writel(pcie, (u32)~MSGF_MISC_SR_MASKALL, MSGF_MISC_MASK);
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 707
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 708 /* Clear pending misc interrupts */
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 709 nwl_bridge_writel(pcie, nwl_bridge_readl(pcie, MSGF_MISC_STATUS) &
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 710 MSGF_MISC_SR_MASKALL, MSGF_MISC_STATUS);
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 711
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 712 /* Enable all misc interrupts */
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 713 nwl_bridge_writel(pcie, MSGF_MISC_SR_MASKALL, MSGF_MISC_MASK);
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 714
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 715 /* Disable all legacy interrupts */
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 716 nwl_bridge_writel(pcie, (u32)~MSGF_LEG_SR_MASKALL, MSGF_LEG_MASK);
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 717
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 718 /* Clear pending legacy interrupts */
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 719 nwl_bridge_writel(pcie, nwl_bridge_readl(pcie, MSGF_LEG_STATUS) &
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 720 MSGF_LEG_SR_MASKALL, MSGF_LEG_STATUS);
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 721
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 722 /* Enable all legacy interrupts */
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 723 nwl_bridge_writel(pcie, MSGF_LEG_SR_MASKALL, MSGF_LEG_MASK);
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 724
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 725 /* Enable the bridge config interrupt */
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 726 nwl_bridge_writel(pcie, nwl_bridge_readl(pcie, BRCFG_INTERRUPT) |
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 727 BRCFG_INTERRUPT_MASK, BRCFG_INTERRUPT);
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 728
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 729 return 0;
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 730 }
ab597d35ef11d2 drivers/pci/host/pcie-xilinx-nwl.c Bharat Kumar Gogada 2016-03-06 731
Hi Bjorn, > -----Original Message----- > From: Bjorn Helgaas <helgaas@kernel.org> > Sent: Thursday, August 3, 2023 10:26 PM > To: Havalige, Thippeswamy <thippeswamy.havalige@amd.com> > Cc: linux-kernel@vger.kernel.org; robh+dt@kernel.org; > bhelgaas@google.com; linux-pci@vger.kernel.org; > krzysztof.kozlowski@linaro.org; lpieralisi@kernel.org; Gogada, Bharat Kumar > <bharat.kumar.gogada@amd.com>; Simek, Michal > <michal.simek@amd.com>; linux-arm-kernel@lists.infradead.org > Subject: Re: [PATCH] PCI: xilinx-nwl: Remove unnecessary code and updating > ecam default value. > > On Thu, Aug 03, 2023 at 05:20:16PM +0530, Thippeswamy Havalige wrote: > > Remove reduntant code. > > Change NWL_ECAM_VALUE_DEFAULT to 16 to support maximum 256 > buses. > > Remove period from subject line. > > Please mention the most important part first in the subject -- the > ECAM change sounds more important than removing redundant code. > > s/ecam/ECAM/ > s/reduntant/redundant/ > > Please elaborate on why this code is redundant. What makes it > redundant? Apparently the bus number registers default to the correct > values or some other software programs them? - Yes, The Primary,Secondary and sub-ordinate bus number registers are programmed/updated as part of linux enumeration so updating these registers are redundant. > I don't see the point of the struct nwl_pcie.ecam_value member. It is > set once and never updated, so we could just use > NWL_ECAM_VALUE_DEFAULT instead. -Agreed, I ll update it in next patch. > "ECAM_VALUE" is not a very informative name. I don't know what an > "ECAM value" would be. How is the value 16 related to a maximum of > 256 buses? We only need 8 bits to address 256 buses, so it must be > something else. The bus number appears at bits 20-27 > (PCIE_ECAM_BUS_SHIFT) in a standard ECAM address, so probably not the > bit location? Yes, Agreed I'll modify ECAM_VALUE as ECAM_SIZE here and it is not related to a maximum 256 buses. > Does this fix a problem? - Yes, It is fixing a problem. Our controller is expecting ECAM size to be programmed by software. By programming "NWL_ECAM_VALUE_DEFAULT 12" controller can access upto 16MB ECAM region which is used to detect 16 buses so by updating "NWL_ECAM_VALUE_DEFAULT " to 16 controller can access upto 256 Mb ECAM region to detect 256 buses. 2^(ecam_size_offset+ecam_size) Here (ecam_size_offset=12 and ecam_size=16) --> 256Mb > > Signed-off-by: Thippeswamy Havalige <thippeswamy.havalige@amd.com> > > --- > > drivers/pci/controller/pcie-xilinx-nwl.c | 11 +---------- > > 1 file changed, 1 insertion(+), 10 deletions(-) > > > > diff --git a/drivers/pci/controller/pcie-xilinx-nwl.c > b/drivers/pci/controller/pcie-xilinx-nwl.c > > index 176686b..6d40543 100644 > > --- a/drivers/pci/controller/pcie-xilinx-nwl.c > > +++ b/drivers/pci/controller/pcie-xilinx-nwl.c > > @@ -126,7 +126,7 @@ > > #define E_ECAM_CR_ENABLE BIT(0) > > #define E_ECAM_SIZE_LOC GENMASK(20, 16) > > #define E_ECAM_SIZE_SHIFT 16 > > -#define NWL_ECAM_VALUE_DEFAULT 12 > > +#define NWL_ECAM_VALUE_DEFAULT 16 > > > > #define CFG_DMA_REG_BAR GENMASK(2, 0) > > #define CFG_PCIE_CACHE GENMASK(7, 0) > > @@ -683,15 +683,6 @@ static int nwl_pcie_bridge_init(struct nwl_pcie > *pcie) > > nwl_bridge_writel(pcie, upper_32_bits(pcie->phys_ecam_base), > > E_ECAM_BASE_HI); > > > > - /* Get bus range */ > > - ecam_val = nwl_bridge_readl(pcie, E_ECAM_CONTROL); > > - pcie->last_busno = (ecam_val & E_ECAM_SIZE_LOC) >> > E_ECAM_SIZE_SHIFT; > > - /* Write primary, secondary and subordinate bus numbers */ > > - ecam_val = first_busno; > > - ecam_val |= (first_busno + 1) << 8; > > - ecam_val |= (pcie->last_busno << E_ECAM_SIZE_SHIFT); > > - writel(ecam_val, (pcie->ecam_base + PCI_PRIMARY_BUS)); > > "ecam_val" looks like it's supposed to be the 32-bit value containing > PCI_PRIMARY_BUS (low 8 bits, from the pointless "first_busno" that is > always 0), PCI_SECONDARY_BUS (bits 8-15, always bus 1), > PCI_SUBORDINATE_BUS (bits 16-23, totally unrelated to > E_ECAM_SIZE_SHIFT although E_ECAM_SIZE_SHIFT happens to be the correct > value (16)), and PCI_SEC_LATENCY_TIMER (not applicable for PCIe). > > So I guess the assumption is that these registers already contain the > correct values? > > It looks like previously PCI_SUBORDINATE_BUS (i.e., pcie->last_busno) > was 12, since we wrote NWL_ECAM_VALUE_DEFAULT to E_ECAM_CONTROL > and > then read it back? > > And now pcie->last_busno is competely unused? > > This all seems not quite baked. Am I missing something? > > Bjorn
On Fri, Aug 04, 2023 at 07:05:30PM +0000, Havalige, Thippeswamy wrote: > > -----Original Message----- > > From: Bjorn Helgaas <helgaas@kernel.org> > > On Thu, Aug 03, 2023 at 05:20:16PM +0530, Thippeswamy Havalige wrote: > > > Remove reduntant code. > > > Change NWL_ECAM_VALUE_DEFAULT to 16 to support maximum 256 > > > buses. > > > > Remove period from subject line. > > > > Please mention the most important part first in the subject -- the > > ECAM change sounds more important than removing redundant code. > > > > s/ecam/ECAM/ > > s/reduntant/redundant/ > > > > Please elaborate on why this code is redundant. What makes it > > redundant? Apparently the bus number registers default to the correct > > values or some other software programs them? > > - Yes, The Primary,Secondary and sub-ordinate bus number registers > are programmed/updated as part of linux enumeration so updating > these registers are redundant. Ah, so the Linux PCI core can handle updating these from whatever the power-up values are. Good material for the revised commit log. > > "ECAM_VALUE" is not a very informative name. I don't know what an > > "ECAM value" would be. How is the value 16 related to a maximum of > > 256 buses? We only need 8 bits to address 256 buses, so it must be > > something else. The bus number appears at bits 20-27 > > (PCIE_ECAM_BUS_SHIFT) in a standard ECAM address, so probably not the > > bit location? > > Yes, Agreed I'll modify ECAM_VALUE as ECAM_SIZE here and it is not > related to a maximum 256 buses. Well, it sounds like this value *does* determine the size of the ECAM region, which does constrain the number of buses you can address via ECAM. > > Does this fix a problem? > > - Yes, It is fixing a problem. Our controller is expecting ECAM size > to be programmed by software. By programming > "NWL_ECAM_VALUE_DEFAULT 12" controller can access upto 16MB ECAM > region which is used to detect 16 buses so by updating > "NWL_ECAM_VALUE_DEFAULT " to 16 controller can access upto 256 Mb > ECAM region to detect 256 buses. > > 2^(ecam_size_offset+ecam_size) > > Here (ecam_size_offset=12 and ecam_size=16) --> 256Mb More good material for the commit log. (1) Change in ECAM region size, (2) previously could only address 16 buses, now can address 256 buses. Is there any impact on DT from the address map change? Bjorn
Hi Bjorn, > -----Original Message----- > From: Bjorn Helgaas <helgaas@kernel.org> > Sent: Saturday, August 5, 2023 1:28 AM > To: Havalige, Thippeswamy <thippeswamy.havalige@amd.com> > Cc: linux-kernel@vger.kernel.org; robh+dt@kernel.org; > bhelgaas@google.com; linux-pci@vger.kernel.org; > krzysztof.kozlowski@linaro.org; lpieralisi@kernel.org; Gogada, Bharat Kumar > <bharat.kumar.gogada@amd.com>; Simek, Michal > <michal.simek@amd.com>; linux-arm-kernel@lists.infradead.org > Subject: Re: [PATCH] PCI: xilinx-nwl: Remove unnecessary code and updating > ecam default value. > > On Fri, Aug 04, 2023 at 07:05:30PM +0000, Havalige, Thippeswamy wrote: > > > -----Original Message----- > > > From: Bjorn Helgaas <helgaas@kernel.org> > > > On Thu, Aug 03, 2023 at 05:20:16PM +0530, Thippeswamy Havalige wrote: > > > > Remove reduntant code. > > > > Change NWL_ECAM_VALUE_DEFAULT to 16 to support maximum 256 > > > > buses. > > > > > > Remove period from subject line. > > > > > > Please mention the most important part first in the subject -- the > > > ECAM change sounds more important than removing redundant code. > > > > > > s/ecam/ECAM/ > > > s/reduntant/redundant/ > > > > > > Please elaborate on why this code is redundant. What makes it > > > redundant? Apparently the bus number registers default to the correct > > > values or some other software programs them? > > > > - Yes, The Primary,Secondary and sub-ordinate bus number registers > > are programmed/updated as part of linux enumeration so updating > > these registers are redundant. > > Ah, so the Linux PCI core can handle updating these from whatever the > power-up values are. Good material for the revised commit log. > > > > "ECAM_VALUE" is not a very informative name. I don't know what an > > > "ECAM value" would be. How is the value 16 related to a maximum of > > > 256 buses? We only need 8 bits to address 256 buses, so it must be > > > something else. The bus number appears at bits 20-27 > > > (PCIE_ECAM_BUS_SHIFT) in a standard ECAM address, so probably not > the > > > bit location? > > > > Yes, Agreed I'll modify ECAM_VALUE as ECAM_SIZE here and it is not > > related to a maximum 256 buses. > > Well, it sounds like this value *does* determine the size of the ECAM > region, which does constrain the number of buses you can address via > ECAM. > - Yes, This ecam_size does determine the number of buses can be addressed via ECAM. > > > Does this fix a problem? > > > > - Yes, It is fixing a problem. Our controller is expecting ECAM size > > to be programmed by software. By programming > > "NWL_ECAM_VALUE_DEFAULT 12" controller can access upto 16MB ECAM > > region which is used to detect 16 buses so by updating > > "NWL_ECAM_VALUE_DEFAULT " to 16 controller can access upto 256 Mb > > ECAM region to detect 256 buses. > > > > 2^(ecam_size_offset+ecam_size) > > > > Here (ecam_size_offset=12 and ecam_size=16) --> 256Mb > > More good material for the commit log. (1) Change in ECAM region > size, (2) previously could only address 16 buses, now can address 256 > buses. > > Is there any impact on DT from the address map change? > - Yes. Now device tree ECAM size needs to be modified to 256Mb. - I'll update device tree changes along with next patch. > Bjorn Regards, Thippeswamy H
diff --git a/drivers/pci/controller/pcie-xilinx-nwl.c b/drivers/pci/controller/pcie-xilinx-nwl.c index 176686b..6d40543 100644 --- a/drivers/pci/controller/pcie-xilinx-nwl.c +++ b/drivers/pci/controller/pcie-xilinx-nwl.c @@ -126,7 +126,7 @@ #define E_ECAM_CR_ENABLE BIT(0) #define E_ECAM_SIZE_LOC GENMASK(20, 16) #define E_ECAM_SIZE_SHIFT 16 -#define NWL_ECAM_VALUE_DEFAULT 12 +#define NWL_ECAM_VALUE_DEFAULT 16 #define CFG_DMA_REG_BAR GENMASK(2, 0) #define CFG_PCIE_CACHE GENMASK(7, 0) @@ -683,15 +683,6 @@ static int nwl_pcie_bridge_init(struct nwl_pcie *pcie) nwl_bridge_writel(pcie, upper_32_bits(pcie->phys_ecam_base), E_ECAM_BASE_HI); - /* Get bus range */ - ecam_val = nwl_bridge_readl(pcie, E_ECAM_CONTROL); - pcie->last_busno = (ecam_val & E_ECAM_SIZE_LOC) >> E_ECAM_SIZE_SHIFT; - /* Write primary, secondary and subordinate bus numbers */ - ecam_val = first_busno; - ecam_val |= (first_busno + 1) << 8; - ecam_val |= (pcie->last_busno << E_ECAM_SIZE_SHIFT); - writel(ecam_val, (pcie->ecam_base + PCI_PRIMARY_BUS)); - if (nwl_pcie_link_up(pcie)) dev_info(dev, "Link is UP\n"); else