Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp6519942rwd; Mon, 19 Jun 2023 08:21:54 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4EjhWuGmVYo7bKy6ajEp/CuUGxp67q5lZ43LzUasIQ7SRll12AmLosKenc8hp+9WDDeAd+ X-Received: by 2002:a05:6808:b13:b0:39a:7830:f251 with SMTP id s19-20020a0568080b1300b0039a7830f251mr7799463oij.1.1687188113757; Mon, 19 Jun 2023 08:21:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687188113; cv=none; d=google.com; s=arc-20160816; b=nj7AAIGqglslBrKyEd9kZ3bJBpHKn18IWUlh+/u9yqguT2ExEsFDbRCbYop+mwZB7D 1GMOv7MKrOz7W/+i2C32ZkSJ7VBRdG7Jq8Om8FJ0IbgagUB1vv6q8NS3j+A05xDyd2qG brCGTN7kjYL0txfxqHwpAFXD9t7zFzL21/4jPL66xG2EFF5kGBVj31SiZiHKjgKLeiD1 Htrewbi8SteQqfirFYSnwhr88PxSJzG3U0tjEuZILw3dWRQUI8revFABNYlBCpravkER dAiCH7t2Gp9D8bVteOCppUvY2yFJgfKQCoHShbzeOEHjO2AnG2fylb5e+OY3TkyKcuPZ PXGw== 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=B3Dy+kmf8ZISKkCa0j/2ldqP//6MEtxXXYzBp48Kt14=; b=BOAafEWEnuxE9zTBIpY802vEC5KcNRdFsWhCO7ykKm2dfQcA/UrzksQnD/5DzaMHs/ hS43w/p5EmjgTX3A2Drhgpf7fUL9dXerGy/UnZJUvWJqjNQr0Qrq4OFo6an3uWgvPSKn FMWHhPfcmW+Mz6USeqpOul6hRn5bTiU6l2pp7WScgodiov5xU7MhLLa1+YXN2eDJHv2s ommClKZMd0J2kaSkF6hQwugxWkIVshOU/o4nxfnc6TI2IUFc8A8uun3omD00NzSLS3oD AKEQLjLE7AmQK0o938d9VRYtjhIqyjqeYt+OIf45gqNXRnRiKWlD768c3+RaAiH7ef+M AQpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vtWdf8pU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e6-20020a17090301c600b001b176dc95d4si14710050plh.557.2023.06.19.08.21.38; Mon, 19 Jun 2023 08:21:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vtWdf8pU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-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 S229877AbjFSPFb (ORCPT + 99 others); Mon, 19 Jun 2023 11:05:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230110AbjFSPFL (ORCPT ); Mon, 19 Jun 2023 11:05:11 -0400 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B20CE10F9 for ; Mon, 19 Jun 2023 08:04:25 -0700 (PDT) Received: by mail-pj1-x1034.google.com with SMTP id 98e67ed59e1d1-25edb50c3acso1677307a91.1 for ; Mon, 19 Jun 2023 08:04:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1687187065; x=1689779065; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=B3Dy+kmf8ZISKkCa0j/2ldqP//6MEtxXXYzBp48Kt14=; b=vtWdf8pUd95J6h7vr8vtdO30v//wqJANxXMEAkrewzCtyzASzN6R1KCTHyzYqpE4XQ hT2kjH2LwEyWdUVa4l+QKByViVVB3fDKG589hDa2B/GS61bFgtH+ehQeoiGkasGegRpT YQx9WvmTyBkaBEXT8Br5Lw/JrB0Ls9D8M5+/Z7CN0NCZmzBFuhT9LpZE4Mfddpg8iiJB qYKTrgxOMkA5GiRUJ49ooaOW55zu4RQ+IbRQgq55Naz61UT/c70rzn9DvhG+UMzQVjsF jUk0ALOCs2vziKBb4OHIaKfoPmUib0Swi38K7NWzs4xSpQQxbr5Io76IuGCZcrAT2BCt ImLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687187065; x=1689779065; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=B3Dy+kmf8ZISKkCa0j/2ldqP//6MEtxXXYzBp48Kt14=; b=kus8bGHBWvk7Ec0RH2TJfx1wZrEMRpNwzmJmj5MHvEXcaYKlbl4QfjInBR1sTA6umk f/sVqefQzthRi/0WX8gUpkJzRiQDqAX2Ue4lqmvkUR4iXgZs6dvPQcpByen2wReman6r Jekj4szaMSwbWewi0J5qcBnKsyPxeWnSItjqawfCVjr7DOMhRzNC+DtTzWuSVDtlwKBU VDKdq8BVNJ1P1uxL82Yu0/K87G5qqaOqldHj6yHX9kR0uI/ybFTtqNlgNyMqII0mEJ+6 oFvALe3q1EK/fskliSL88u93xfuFaC4gQJWgud3miRgkYfn3v2SIpE/m+TLJgOJ/K16I SnXw== X-Gm-Message-State: AC+VfDw8xPmdSSNdgxT+iI7Z29OPbTNGuS+Qm2Ueqa78y5jzHAFLHXyW HLEHExRQC+x3cg002QqmoH2O X-Received: by 2002:a17:90a:e516:b0:25e:8f12:a74d with SMTP id t22-20020a17090ae51600b0025e8f12a74dmr9926485pjy.44.1687187065087; Mon, 19 Jun 2023 08:04:25 -0700 (PDT) Received: from localhost.localdomain ([117.217.183.37]) by smtp.gmail.com with ESMTPSA id 10-20020a17090a19ca00b0025efaf7a0d3sm2765480pjj.14.2023.06.19.08.04.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jun 2023 08:04:24 -0700 (PDT) From: Manivannan Sadhasivam To: lpieralisi@kernel.org, kw@linux.com, bhelgaas@google.com Cc: robh@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.org, linux-pci@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, steev@kali.org, quic_srichara@quicinc.com, Manivannan Sadhasivam , Dmitry Baryshkov Subject: [PATCH v4 2/9] PCI: qcom: Use DWC helpers for modifying the read-only DBI registers Date: Mon, 19 Jun 2023 20:34:01 +0530 Message-Id: <20230619150408.8468-3-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230619150408.8468-1-manivannan.sadhasivam@linaro.org> References: <20230619150408.8468-1-manivannan.sadhasivam@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org DWC core already exposes dw_pcie_dbi_ro_wr_{en/dis} helper APIs for enabling and disabling the write access to read only DBI registers. So let's use them instead of doing it manually. Also, the existing code doesn't disable the write access when it's done. This is also fixed now. Fixes: 5d76117f070d ("PCI: qcom: Add support for IPQ8074 PCIe controller") Reviewed-by: Dmitry Baryshkov Signed-off-by: Manivannan Sadhasivam --- drivers/pci/controller/dwc/pcie-qcom.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c index ef385d36d653..01795ee7ce45 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -61,7 +61,6 @@ /* DBI registers */ #define AXI_MSTR_RESP_COMP_CTRL0 0x818 #define AXI_MSTR_RESP_COMP_CTRL1 0x81c -#define MISC_CONTROL_1_REG 0x8bc /* MHI registers */ #define PARF_DEBUG_CNT_PM_LINKST_IN_L2 0xc04 @@ -132,9 +131,6 @@ /* AXI_MSTR_RESP_COMP_CTRL1 register fields */ #define CFG_BRIDGE_SB_INIT BIT(0) -/* MISC_CONTROL_1_REG register fields */ -#define DBI_RO_WR_EN 1 - /* PCI_EXP_SLTCAP register fields */ #define PCIE_CAP_SLOT_POWER_LIMIT_VAL FIELD_PREP(PCI_EXP_SLTCAP_SPLV, 250) #define PCIE_CAP_SLOT_POWER_LIMIT_SCALE FIELD_PREP(PCI_EXP_SLTCAP_SPLS, 1) @@ -826,7 +822,9 @@ static int qcom_pcie_post_init_2_3_3(struct qcom_pcie *pcie) writel(0, pcie->parf + PARF_Q2A_FLUSH); writel(PCI_COMMAND_MASTER, pci->dbi_base + PCI_COMMAND); - writel(DBI_RO_WR_EN, pci->dbi_base + MISC_CONTROL_1_REG); + + dw_pcie_dbi_ro_wr_en(pci); + writel(PCIE_CAP_SLOT_VAL, pci->dbi_base + offset + PCI_EXP_SLTCAP); val = readl(pci->dbi_base + offset + PCI_EXP_LNKCAP); -- 2.25.1