From patchwork Thu Jan 28 17:52:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 372616 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp1484404jam; Thu, 28 Jan 2021 09:54:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJw4XaY2ZPdsMvwVMxv9zIRgX1qZ58guNuG1D58u1cLhlMkDpZlDB8PGJraMEd2H85+n7JEf X-Received: by 2002:a05:6402:1a57:: with SMTP id bf23mr783853edb.183.1611856457477; Thu, 28 Jan 2021 09:54:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611856457; cv=none; d=google.com; s=arc-20160816; b=fnUXj/SylxyD65QFIQiKpSbjLFU1gUFWsoXESiP26jEswfluP0i9AQHu8R/+lZjXzA J/j7E6bEa/tmbpfnDjLD0VXCzq3mn9vHJ6nlL4bEbU/oN9I165a+s8HO6+ebjlNqNfcL K8NAX/kjam87gL1/UalPWcgfWjuQrjXSMfsAqAMUGwdg3i5u1CJNPRB4jUbRtljbNTOb 3+Lu9i8PyzIDbh8MaabwMXA8hZphMmZ+izwXa14lrWIQmue2BVN6CLnEb0maCCe8k7US sRbEUhlNoqYTaE80O39a/HNlkH+++/fD89HjSYJnbgmBaCgoxUWw9BMoYOOZgHRomz0F S/3w== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+h4iY3X8KWYJxdBXqwutJPnHSSsLNjVIGMbK8ENRaO4=; b=rWt7jn9kGVLbaVWZM4wwER0LQkf4XP8ToDIpWeCK8o7rNIfB46Pv9kKvYFcyRY9GaZ HG1AP0Dph/Rrbi1Z24T+QCYDwXA5npn3T72zqh1YHxwM+3d6yOlye6Szd3EKMGhr6XDi SVWCoeMvzprhwmuYG+DlQpFJJdGiEwr6pS5k7j7/Ecbf4AsPsn9GzFFlaZheBi9CDa+R TcjFcXcovltTqggTIKWnuYRFf9my57gm0cA83oUXeSxFc1zQGS1kvivaPXcGCxAp86x0 Adj391qiNl4ROHrU1ZM3xSe1LE9ekhJYFaDZMvJbpiwZV9cYIqPKsAXiF8StLmkLRqfj WPsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Xth5HkEy; 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=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 bs19si3370475edb.212.2021.01.28.09.54.17; Thu, 28 Jan 2021 09:54:17 -0800 (PST) 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=@linaro.org header.s=google header.b=Xth5HkEy; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231211AbhA1Rxv (ORCPT + 6 others); Thu, 28 Jan 2021 12:53:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231189AbhA1Rxn (ORCPT ); Thu, 28 Jan 2021 12:53:43 -0500 Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70442C061351 for ; Thu, 28 Jan 2021 09:52:38 -0800 (PST) Received: by mail-lj1-x22b.google.com with SMTP id v15so4412723ljk.13 for ; Thu, 28 Jan 2021 09:52:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+h4iY3X8KWYJxdBXqwutJPnHSSsLNjVIGMbK8ENRaO4=; b=Xth5HkEyru+I/oRftl/ZDJ9BqQGqc9PFbpXVMzQIqiTTVRZ+jKPaJfu0eeutGCPqFq Ux551LITZ4RfdT8b7yhUdO//5/rBe2o/7XpMvPbBCon1yCMjsEK8pgn0yrWo+Fv1CIJ0 9O1rjM4pky3dsuyVhSzEXGJIuPFNRDJMnSVV2Zh6XFXfaGNbgmkCAe6W/mQElPh/SMzd f52zcd2PK0kuChVNe4fmk/K/xGJmGWrX5479qcGUZ3ZDBAXWZ6dl16+Dc/L/ePNygrLC +bt67kayzncAC9A3x2kRVfNKB+uOVSetpWWq5VptLZ3NBuG10+jNYmnnJ0Dh4aCn6esd FM6Q== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=+h4iY3X8KWYJxdBXqwutJPnHSSsLNjVIGMbK8ENRaO4=; b=EnU3SnXx3GYCqdCENM4h8ukqpdmL8WzBYsfW8/Jw071Dz79VlpMghIDGRVsPvz/0AI u4n52ZcyPHwpz3/YH9hPqICYafjFeK4jsYz0OYNyqB1J6KCwLI6435nwF8+FJFG1iP8v wK09R9B/hZIrSpTMe867Vc4hfEEJFBBhACaz7Hhe3KcKSE3uLnQY3JE1wnF8qr1kgNoU EBhzEVguqH0QwYMVlbbaXVYt0lcFEyiR276Y/HtZy/SrC1O1Z+0Y+Lv1bKFobOoBgQnO wDrHTTcyYodns3BHyHwKLAnA4vK4g7uWZ0hSFKUHEJUN4QrLASrhD3sAykQ1qM/adfjq GkUQ== X-Gm-Message-State: AOAM531htchDqjzvk+yl/DGwGAEZttZTXZkQcsb6gh1Kn18jcilKyWgS z4H6ZYY3zAKAF+nFih1viPFFqA== X-Received: by 2002:a2e:9ed1:: with SMTP id h17mr240397ljk.160.1611856356937; Thu, 28 Jan 2021 09:52:36 -0800 (PST) Received: from eriador.lan ([94.25.229.83]) by smtp.gmail.com with ESMTPSA id w10sm2216119ljj.37.2021.01.28.09.52.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Jan 2021 09:52:36 -0800 (PST) From: Dmitry Baryshkov To: Andy Gross , Bjorn Andersson , Rob Herring , Arnd Bergmann , Greg Kroah-Hartman , Stanimir Varbanov , Lorenzo Pieralisi , Bjorn Helgaas Cc: linux-arm-msm@vger.kernel.org, Manivannan Sadhasivam , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Subject: [PATCH v2 3/5] pcie-qcom: provide a way to power up qca6390 chip on RB5 platform Date: Thu, 28 Jan 2021 20:52:23 +0300 Message-Id: <20210128175225.3102958-4-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210128175225.3102958-1-dmitry.baryshkov@linaro.org> References: <20210128175225.3102958-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Some Qualcomm platforms require to power up an external device before probing the PCI bus. E.g. on RB5 platform the QCA6390 WiFi/BT chip needs to be powered up before PCIe0 bus is probed. Add a quirk to the respective PCIe root bridge to attach to the power domain if one is required, so that the QCA chip is started before scanning the PCIe bus. Signed-off-by: Dmitry Baryshkov --- drivers/pci/controller/dwc/pcie-qcom.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) -- 2.29.2 diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c index ab21aa01c95d..eb73c8540d4d 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -1568,6 +1569,26 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_QCOM, 0x0302, qcom_fixup_class); DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_QCOM, 0x1000, qcom_fixup_class); DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_QCOM, 0x1001, qcom_fixup_class); +static void qcom_fixup_power(struct pci_dev *dev) +{ + int ret; + struct pcie_port *pp = dev->bus->sysdata; + struct dw_pcie *pci; + + if (!pci_is_root_bus(dev->bus)) + return; + + ret = dev_pm_domain_attach(&dev->dev, true); + if (ret < 0 || !dev->dev.pm_domain) + return; + + pci = to_dw_pcie_from_pp(pp); + dev_info(&dev->dev, "Bus powered up, waiting for link to come up\n"); + + dw_pcie_wait_for_link(pci); +} +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_QCOM, 0x010b, qcom_fixup_power); + static struct platform_driver qcom_pcie_driver = { .probe = qcom_pcie_probe, .driver = {