From patchwork Wed Apr 7 13:12:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 416712 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp455875jai; Wed, 7 Apr 2021 06:13:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzx+7qYgj8YJWA7xX5F7E5iq22Rdgs50MpBFXnsvfcJQ6IzcQzqMeptw5e2YLyTB9Nwk/x3 X-Received: by 2002:a92:c566:: with SMTP id b6mr1739299ilj.162.1617801181668; Wed, 07 Apr 2021 06:13:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617801181; cv=none; d=google.com; s=arc-20160816; b=qKMCHwKj4ueLAhGC9qbPZkyFkQLn9xCHABXY8+Yaz8YNFT1Lf63384jUkbQeaOQCxc XGNGkBzeP8+aRXfkQEcr+ojZYWdAvkfOBLnXyvTVIWXz6A9xbQZZeUvPYe13tpt22mEE LtQW3HWxdNeI/XcM02br+hkBsHqxkr2KulTy4IZUyB5ld9HUvK50yYcc4r1eqKtutzCK o5is4esmQePYr5cOkJtUyz3h5Rj5z4c1d8qDTQTuAQK02HTRynmJDmyroaOmZIdF/6jz CfO5o8wX8bAdDc+rFiqtgp9EFJnCGPPWfTNFGNsCDhLteNRhH1ke7cAOz7ZKg40Vevd/ RY7g== ARC-Message-Signature: i=1; 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=Z5cqK4hvOZb7E6bD/AeT0kN1Xy5Qj2MXLt/K/loAd68=; b=USXVXy+7Jz/1cntHIQrIcL9ZFYd1YrZPILkXrn9V7BpPV2Bv1FXJpaDJfY8Trc0UyJ bqCrSZBC3pGIiWwEJwb6wnZOjGXXlrKlxQiRMY8fl442soJ9lZBRS663PeE15FCjxY3+ YZhaGa2X3Fn92HXHc8Tio+5WriW9mzzcIb82DJE2rcfZceWdDqdhmaNY1hl7r4ijP+qE CtdDsfeTmxS5RcpYHQToPve2x8RNd/g74Pn9EO0a5bNPHOHpP9VMcv/MJbyImrN9s3Rp zL1GyMQgWnDNXLZs/Y0XJBt3o3X04VUX2RAS9OpJMrcfwCbxx3a8n7nP56zagfmkONYv BTkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Jl+PCE4F; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h23si20352321iob.7.2021.04.07.06.13.01; Wed, 07 Apr 2021 06:13:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-msm-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=@linaro.org header.s=google header.b=Jl+PCE4F; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235572AbhDGNNJ (ORCPT + 17 others); Wed, 7 Apr 2021 09:13:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232797AbhDGNNJ (ORCPT ); Wed, 7 Apr 2021 09:13:09 -0400 Received: from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com [IPv6:2a00:1450:4864:20::22c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC160C06175F for ; Wed, 7 Apr 2021 06:12:57 -0700 (PDT) Received: by mail-lj1-x22c.google.com with SMTP id 184so20607123ljf.9 for ; Wed, 07 Apr 2021 06:12:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Z5cqK4hvOZb7E6bD/AeT0kN1Xy5Qj2MXLt/K/loAd68=; b=Jl+PCE4F8u0LgGQ0yRKsEzjmEl7P0KW5+FTCeO0qTbr05aQhxTRBN6pUbNrRYH39lT VcEam1jT8M+wuETXgtjaxqdSIayIdhHaIiFT08TJlgH7NZ8GHRvKeEYj/SliUcAvz8XT 14PU3dkcvy/RNkYRYHUWvU2CtmGYyaHyzduvo08fX0bQz6kAgC9lxAvLkmHZl4HhAsie 0Vitsx63bJ0Na1DeYIRebdWVNZNyEpy08KBuInb+7WzKScfqYmwa+u3nsYnSKBipDnQY 1WNkuR70SO59gE0ma3VtCRgWx9Ha0d6rQzXoZzCXm4PDa8p5ExVdSLspZR8MCOWRLbve w/rA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Z5cqK4hvOZb7E6bD/AeT0kN1Xy5Qj2MXLt/K/loAd68=; b=HWbQRsyqIVPO9EnmtcpAvDqcEGLVAbNV7tpSjxZHr5oZhvweNwmshG2ZZXYW9JuilQ Gl4bYS7leIuddcbLW7V6NGePdxfFTK89odJc0E3R/FUdYcs5duzrY8EoSJXA0+1/hwGw gMARz0XewUNpYvYaCYeo6OXM+GIgbp4+Cu5+OUB/ggFfj/43n4D1dIfrXljfBWK1KxLf kRUkuC2d6fQ2Xxlguoi+xoZD8sckYn2tP/x6mwKF5QFL1iN/Sr3BbgEH1APu3RoA9bn0 UJMcyfCzkHRMeDcDktHz5cGpydhczY5epO69K7L+V7WSoseRrMDTav748IyKAtPw+ful Mqsw== X-Gm-Message-State: AOAM530sNxwiIjx0TJhlpjKtPFmex06kC9abuJMbvlpEMyJgZgaFmEA2 PgNMyPpx/Tn8YJtJgmBlPjPx2Q== X-Received: by 2002:a2e:b811:: with SMTP id u17mr2141031ljo.324.1617801176361; Wed, 07 Apr 2021 06:12:56 -0700 (PDT) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id p13sm2572146ljc.72.2021.04.07.06.12.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Apr 2021 06:12:55 -0700 (PDT) From: Dmitry Baryshkov To: Andy Gross , Bjorn Andersson , Rob Herring , Lorenzo Pieralisi Cc: linux-arm-msm@vger.kernel.org, Manivannan Sadhasivam , linux-pci@vger.kernel.org, Hou Zhiqiang Subject: [PATCH] PCI: dwc: move dw_pcie_iatu_detect() after host_init callback Date: Wed, 7 Apr 2021 16:12:55 +0300 Message-Id: <20210407131255.702054-1-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The commit 9ea483375ded ("PCI: dwc: Move forward the iATU detection process") broke PCIe support on Qualcomm SM8250 (and maybe other platforms) since it moves the call to dw_pcie_iatu_detect() at the beginning of the dw_pcie_host_init(), before ops->host_init() callback. Accessing PCIe registers at this point causes the board to reboot since not all clocks are enabled, making PCIe registers unavailable. Move dw_pcie_iatu_detect() call after calling ops->host_init() callback, so that all register are accessible. Cc: Hou Zhiqiang Fixes: 9ea483375ded ("PCI: dwc: Move forward the iATU detection process") Signed-off-by: Dmitry Baryshkov --- drivers/pci/controller/dwc/pcie-designware-host.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.30.2 diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c index 52f6887179cd..24192b40e3a2 100644 --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c @@ -319,8 +319,6 @@ int dw_pcie_host_init(struct pcie_port *pp) return PTR_ERR(pci->dbi_base); } - dw_pcie_iatu_detect(pci); - bridge = devm_pci_alloc_host_bridge(dev, 0); if (!bridge) return -ENOMEM; @@ -400,6 +398,7 @@ int dw_pcie_host_init(struct pcie_port *pp) if (ret) goto err_free_msi; } + dw_pcie_iatu_detect(pci); dw_pcie_setup_rc(pp); dw_pcie_msi_init(pp);