From patchwork Wed Jul 8 09:30:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kishon Vijay Abraham I X-Patchwork-Id: 235055 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp265175ilg; Wed, 8 Jul 2020 02:31:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwT53/ejTXbdUGDNbrFeamTOPUw73428d07dmcVo6OA+jRGQCKszRf9++YSqFc4Qa9EzWd7 X-Received: by 2002:a17:906:6dd7:: with SMTP id j23mr35118122ejt.529.1594200669451; Wed, 08 Jul 2020 02:31:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594200669; cv=none; d=google.com; s=arc-20160816; b=Z34MaBXYNxbt4peX5YDT50Ga90mC8utdcny6B1jnIhfsizHkD2H2e+g6JVZbJVMPdk fv2QnbUSGOoF/51nHt/AXU+g7Q3CUZJ3q6fHoduF/Oce7JitOAB8AkPFogjdi8k6fF0M UtcSKnqUMnfHO+FLHdO4+E1ivTbbA59APFgLZYiDVLF5srzQPAAjTk/LeZ5PYIUbU6sb W2oNrLC/BW3kgPQbuplhgPjI+2zNe8ISJRnRUff3SJs538WExAbx9lDreH0EO2nC3NnV mDtDBs4JaDK2WxjYwz/k5aiIm62ilLQP2yVJPTgCKQ1Pe1bE52n814cWXKw5G9U2P0Jr 18cA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=oDHixXQpSiTZez44a8+8lE4nJpgDYDjM303UR0TQSis=; b=NzGY5KiEvLinDrZ9f0LXHMBfepEYM7wG9SM9lB0JjaK8mu5e5wKhi0WbbNRDo60F9W 9va8ftOb+YdnTeZ941d5m10YWn9up4VBE3Ep9w07YlTGpIerDI9zQjGyAS7lhqIMdIdi M0AIfMcOpBl/AZ2HBiTT540zKPhO2nCb0Z3ygMU8Lb9fniJQRvn30H/2gisfBF6HJOXL rp5LexkIf1RJWXYiQWw/gn/X2W82biW6PqqXucUpr1bkJdC0Bm9PXDBJPsSwm0bWkGYC aSQ+OUs55bxa7d/Mh3k0SRpTfWbSDtfc7JSc+1a//xCHO7BsUrXS524S8E2hYgTwSVZ7 pc5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=UNExrCnR; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w9si17326727edr.171.2020.07.08.02.31.09; Wed, 08 Jul 2020 02:31:09 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=UNExrCnR; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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 S1728451AbgGHJbI (ORCPT + 6 others); Wed, 8 Jul 2020 05:31:08 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:39032 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726973AbgGHJbG (ORCPT ); Wed, 8 Jul 2020 05:31:06 -0400 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 0689Us6N109489; Wed, 8 Jul 2020 04:30:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1594200654; bh=oDHixXQpSiTZez44a8+8lE4nJpgDYDjM303UR0TQSis=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=UNExrCnRq/70xH4/LUjTSGYx9q5Y+kcahjQJgM8n5KhuRfU4Zjfo9MXZ4RNwN2PKK EiPf2bYV0LTYNj2WmjvT1CCX0UPZE8ApT8yibOqpv0SWm3Rasyrt4sENeTtkqGiQ5U GTdXky8D3oXLQStBbiQB8p6Vhq4IIJ60RZGTThkM= Received: from DFLE105.ent.ti.com (dfle105.ent.ti.com [10.64.6.26]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTP id 0689UsPa022079; Wed, 8 Jul 2020 04:30:54 -0500 Received: from DFLE112.ent.ti.com (10.64.6.33) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Wed, 8 Jul 2020 04:30:54 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DFLE112.ent.ti.com (10.64.6.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Wed, 8 Jul 2020 04:30:54 -0500 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 0689UJEP098512; Wed, 8 Jul 2020 04:30:51 -0500 From: Kishon Vijay Abraham I To: Tom Joseph , Bjorn Helgaas , Rob Herring , Kishon Vijay Abraham I , Lorenzo Pieralisi , Arnd Bergmann CC: Greg Kroah-Hartman , , , , , Subject: [PATCH v6 08/14] PCI: cadence: Fix updating Vendor ID and Subsystem Vendor ID register Date: Wed, 8 Jul 2020 15:00:12 +0530 Message-ID: <20200708093018.28474-9-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200708093018.28474-1-kishon@ti.com> References: <20200708093018.28474-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Commit 1b79c5284439 ("PCI: cadence: Add host driver for Cadence PCIe controller") in order to update Vendor ID, directly wrote to PCI_VENDOR_ID register. However PCI_VENDOR_ID in root port configuration space is read-only register and writing to it will have no effect. Use local management register to configure Vendor ID and Subsystem Vendor ID. Fixes: 1b79c5284439 ("PCI: cadence: Add host driver for Cadence PCIe controller") Reviewed-by: Rob Herring Signed-off-by: Kishon Vijay Abraham I --- drivers/pci/controller/cadence/pcie-cadence-host.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/drivers/pci/controller/cadence/pcie-cadence-host.c b/drivers/pci/controller/cadence/pcie-cadence-host.c index 10127ea71b83..8935f7a37e5a 100644 --- a/drivers/pci/controller/cadence/pcie-cadence-host.c +++ b/drivers/pci/controller/cadence/pcie-cadence-host.c @@ -82,6 +82,7 @@ static int cdns_pcie_host_init_root_port(struct cdns_pcie_rc *rc) { struct cdns_pcie *pcie = &rc->pcie; u32 value, ctrl; + u32 id; /* * Set the root complex BAR configuration register: @@ -101,8 +102,12 @@ static int cdns_pcie_host_init_root_port(struct cdns_pcie_rc *rc) cdns_pcie_writel(pcie, CDNS_PCIE_LM_RC_BAR_CFG, value); /* Set root port configuration space */ - if (rc->vendor_id != 0xffff) - cdns_pcie_rp_writew(pcie, PCI_VENDOR_ID, rc->vendor_id); + if (rc->vendor_id != 0xffff) { + id = CDNS_PCIE_LM_ID_VENDOR(rc->vendor_id) | + CDNS_PCIE_LM_ID_SUBSYS(rc->vendor_id); + cdns_pcie_writel(pcie, CDNS_PCIE_LM_ID, id); + } + if (rc->device_id != 0xffff) cdns_pcie_rp_writew(pcie, PCI_DEVICE_ID, rc->device_id);