From patchwork Mon Jul 13 11:01:35 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: 235381 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp2726423ilg; Mon, 13 Jul 2020 04:02:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwih+5VCZ6wBflItTdxhtYjJXMkUXwANNbkmfFLrO4tDQribkHfGQxJgrSSODPv1Q4FFUh2 X-Received: by 2002:a17:906:7855:: with SMTP id p21mr61990626ejm.492.1594638148945; Mon, 13 Jul 2020 04:02:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594638148; cv=none; d=google.com; s=arc-20160816; b=JfE8qao6a1iN86qztQySjtldCzRODQd2BTxbmcnS6gAqToVkTIo2SoZ8VepRfQ5bba U9iQFA3tvXPJvboHV8RFZwkFDfZ5HbLOrECZJyp/0/NqAUd0n+s1Ye2FkXcvhwH+3vGT QCKoW1tvAheDl2woCSninOoyjmijKIzcTMFcJBnI48qOPlFMgk/yfLT6/40EVi2qV/qp em3e9OstDosDIugyrgrforkfllQ4GR848/R201onLibLJ5aa+6a1yZeSgITPE2jUic+F a35eJt0L56p5zY+irfE7+5yIl1yW74ysyHL1TStQEwmlCARKfXA7ScSUh7n4YFaI6y/4 b60A== 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=Am6XrZRW70VTxHa0m9n3X9N6vaL4BwoGFW5IDC7XBTwSOpdrBRHx6S1u3CBUxQVATD BzEL95g0IeYkWUe4y05W5JzZ3n62L6MxX3OZSO6PPXdaeHnnDAD8e2g2yxVQpYN3vR6G MdDQTHNIqxaFoFYeO44/bAvLCysLQLf4InTzUGAGorDofknS/IBmhWCzGjZ+cmpnJQum oDQLWYhrLllWgdiSIv5Lyy8JgLyw8F/lgzJXff6D6V/Zfy7oIrQH+9N/jrZgYLwmBkVP y9kz90WjQdQ+4m9OlcsZZKiisiD8+RXBB+2o/dV5Mbq5xjTezvCmylHYgd7ScDMLh27Q FEjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=q8HrSlPo; spf=pass (google.com: domain of linux-omap-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-omap-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 fi17si8940039ejb.724.2020.07.13.04.02.28; Mon, 13 Jul 2020 04:02:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-omap-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=q8HrSlPo; spf=pass (google.com: domain of linux-omap-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-omap-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 S1729712AbgGMLC2 (ORCPT + 4 others); Mon, 13 Jul 2020 07:02:28 -0400 Received: from lelv0143.ext.ti.com ([198.47.23.248]:38274 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729637AbgGMLC0 (ORCPT ); Mon, 13 Jul 2020 07:02:26 -0400 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 06DB2GBQ056006; Mon, 13 Jul 2020 06:02:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1594638136; bh=oDHixXQpSiTZez44a8+8lE4nJpgDYDjM303UR0TQSis=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=q8HrSlPoGJ/sffUmOMgL+pDWEmXVsiOsdJ9wvTtMXf0oLNpP4ytncyWr8iKmdLCh0 0DNTDHkTvFZ+0XsmTNOKCE+BldVTWGf2TBixLFdzrfPSKIG6g9mjbzc6bf5MomrRqn Qe9STWgeFb0cm0RMB8LsnZqmx6xWhaoRNHHa1h5w= Received: from DLEE106.ent.ti.com (dlee106.ent.ti.com [157.170.170.36]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 06DB2GT7023159 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 13 Jul 2020 06:02:16 -0500 Received: from DLEE110.ent.ti.com (157.170.170.21) by DLEE106.ent.ti.com (157.170.170.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Mon, 13 Jul 2020 06:02:16 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DLEE110.ent.ti.com (157.170.170.21) 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; Mon, 13 Jul 2020 06:02:16 -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 06DB1gVi031460; Mon, 13 Jul 2020 06:02:12 -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 v7 08/14] PCI: cadence: Fix updating Vendor ID and Subsystem Vendor ID register Date: Mon, 13 Jul 2020 16:31:35 +0530 Message-ID: <20200713110141.13156-9-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200713110141.13156-1-kishon@ti.com> References: <20200713110141.13156-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@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);