Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp1171040imc; Mon, 11 Mar 2019 07:58:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqz/7sl4zMddzots2VDKZaY1sSrune7T50tbll0R5VUDTzQf+XpiK606L/9By8Su0DN2hAg2 X-Received: by 2002:a63:2224:: with SMTP id i36mr30228456pgi.169.1552316282398; Mon, 11 Mar 2019 07:58:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552316282; cv=none; d=google.com; s=arc-20160816; b=0CJYsOmzQA2T3h0paSs7NkrTnSGFiPqJEShn5WIFL3IW0HEfSgI652PUUChh8KX815 vgsnN0thdws96pzvdBVwARPnGQmJeHPQjTQuJn7GZ5gRdw2n+dModxKjJKun6Q56fII6 RNawhKKnm8k0ITA9DZyqhOTY+cwJ1IOZ+yqO6qo9qQwBZa976NTyS5K1CjRnYgYq4JLP mIikN38HoYxZ5maizAn7Mni6/5Eix6wTqG8E5dfESi4cbYSixbmcEij6OGYYmlIeLey0 XNs3phkKexgLm8MxPPGIaUwSXT+sWoT5I+LFPAKZ1ojqBiIk4I6DQmtb1MJ6UxRWGz6a i+Ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:mime-version:user-agent:date:message-id:subject :from:cc:to; bh=Ym5rWVxK5wBW7m9U4x3pDnNgY7XC1f/iexTxOazg2ws=; b=cLcw38ZaSYQ85/BZDSw3eID4+GhYZwsxc/pnV9lCxxhZuvWc3/B4ZhKLJdvcNelNqz nuq0etl62NH+OXfOaYXG1yyS3BCGcCmRqyjpJF3Mb1CA9a9C9G4SM/CY0rmVEHs1Hg53 pMjM+LZW93maq0rQMHgmVSsAO7NqRBSD2+iBZrfD/9YfxPizNWH8r6D8h8mCoxB+tRf2 vM0vWJjsvmRTI6zLS9rdlxaNo/fRpLid/kEJIg74kZ4NAgB0X80nO4Pl8/hdnPiK1Td3 Pnu6ZJm/TW1+5y84Gt79Ej7UFlvWszHGqOyjsBvPB8ST+MRcCDvHTszPuz2IP1r9dgF5 APUQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v14si5090429pgi.249.2019.03.11.07.57.46; Mon, 11 Mar 2019 07:58:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727852AbfCKO46 (ORCPT + 99 others); Mon, 11 Mar 2019 10:56:58 -0400 Received: from smtp3-g21.free.fr ([212.27.42.3]:48399 "EHLO smtp3-g21.free.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727320AbfCKO46 (ORCPT ); Mon, 11 Mar 2019 10:56:58 -0400 Received: from [192.168.108.8] (unknown [213.36.7.13]) (Authenticated sender: marc.w.gonzalez) by smtp3-g21.free.fr (Postfix) with ESMTPSA id C871713F895; Mon, 11 Mar 2019 15:56:36 +0100 (CET) To: Bjorn Helgaas Cc: Andy Gross , David Brown , Bjorn Andersson , Stanimir Varbanov , PCI , MSM , LKML , Jeffrey Hugo From: Marc Gonzalez Subject: [RFC PATCH v1] PCI: qcom: Use quirk to override incorrect device class Message-ID: <94bb3f22-c5a7-1891-9d89-42a520e9a592@free.fr> Date: Mon, 11 Mar 2019 15:56:36 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some chips report an incorrect device class. Override the incorrect value using a quirk, instead of code in the read function. Signed-off-by: Marc Gonzalez --- FWIW, this quirk is no longer required on recent chips: msm8996 (tested by Stanimir), msm8998 (tested by me), sdm845 (untested) are unaffected apq/ipq8064 is affected => what is the device ID for these chips? others? Stanimir added: "this will become a real problem (now we use the driver as RC) when someone decide to use it as an endpoint" --- drivers/pci/controller/dwc/pcie-qcom.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c index 3de5510fd3d5..94da2c9c2ad5 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -1136,17 +1136,15 @@ static int qcom_pcie_rd_own_conf(struct pcie_port *pp, int where, int size, { struct dw_pcie *pci = to_dw_pcie_from_pp(pp); - /* the device class is not reported correctly from the register */ - if (where == PCI_CLASS_REVISION && size == 4) { - *val = readl(pci->dbi_base + PCI_CLASS_REVISION); - *val &= 0xff; /* keep revision id */ - *val |= PCI_CLASS_BRIDGE_PCI << 16; - return PCIBIOS_SUCCESSFUL; - } - return dw_pcie_read(pci->dbi_base + where, size, val); } +static void qcom_fixup_class(struct pci_dev *dev) +{ + dev->class = PCI_CLASS_BRIDGE_PCI << 8; +} +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_QCOM, PCI_ANY_ID, qcom_fixup_class); + static const struct dw_pcie_host_ops qcom_pcie_dw_ops = { .host_init = qcom_pcie_host_init, .rd_own_conf = qcom_pcie_rd_own_conf, -- 2.17.1