From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-sn1nam02on0041.outbound.protection.outlook.com ([104.47.36.41]:22400 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751223AbdHCIkZ (ORCPT ); Thu, 3 Aug 2017 04:40:25 -0400 From: Zhiqiang Hou To: , , , CC: , , , Hou Zhiqiang Subject: [PATCHv2 2/6] PCI: designware: enable write permission before updating class code Date: Thu, 3 Aug 2017 16:23:36 +0800 Message-ID: <1501748620-42866-3-git-send-email-Zhiqiang.Hou@nxp.com> In-Reply-To: <1501748620-42866-1-git-send-email-Zhiqiang.Hou@nxp.com> References: <1501748620-42866-1-git-send-email-Zhiqiang.Hou@nxp.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-pci-owner@vger.kernel.org List-ID: From: Hou Zhiqiang The existing fix doesn't actually work because the Class register is read-only, so it must enable the write permission before write the correct value to this register. Signed-off-by: Hou Zhiqiang --- V2: - None drivers/pci/dwc/pcie-designware-host.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/pci/dwc/pcie-designware-host.c b/drivers/pci/dwc/pcie-designware-host.c index d29c020..6e10cda 100644 --- a/drivers/pci/dwc/pcie-designware-host.c +++ b/drivers/pci/dwc/pcie-designware-host.c @@ -634,8 +634,12 @@ void dw_pcie_setup_rc(struct pcie_port *pp) dw_pcie_wr_own_conf(pp, PCI_BASE_ADDRESS_0, 4, 0); + /* Enable write permission for the DBI read-only register */ + dw_pcie_dbi_ro_wr_en(pci); /* program correct class for RC */ dw_pcie_wr_own_conf(pp, PCI_CLASS_DEVICE, 2, PCI_CLASS_BRIDGE_PCI); + /* Better disable write permission right after the update */ + dw_pcie_dbi_ro_wr_dis(pci); dw_pcie_rd_own_conf(pp, PCIE_LINK_WIDTH_SPEED_CONTROL, 4, &val); val |= PORT_LOGIC_SPEED_CHANGE; -- 2.1.0.27.g96db324