Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp414864iog; Wed, 29 Jun 2022 02:55:55 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sbpbGgQ3Rsyb/ei2RIiL+5tEA3GxZYnP1I2n/UCQoDnc4q1pYSHq3hU78tvb2jS/vEtdqd X-Received: by 2002:a17:903:40cd:b0:16a:33e1:b52f with SMTP id t13-20020a17090340cd00b0016a33e1b52fmr8379300pld.58.1656496555624; Wed, 29 Jun 2022 02:55:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656496555; cv=none; d=google.com; s=arc-20160816; b=BVk8o5RxOFocive7lZzRalQlGinmM9yL96D3Zs9cjdEr3ZhNi/ibGJhHayeNhm1L6p 7btM8x6wp0m5+wcv5gl4dXL8i/vXmoeA//RcLNql0QUuMVEMcIA8jqeapzILF9qAQ5yC WDwb51PnXP8Gy4c8mOrhi2cGXVEjG6vg5tvt1WvVEEpaPzWI6iJKTF62EFFfcPE2NO2C VkYO1rU7te+SgT911e/0A8FJiuKgFWRhOtdnYoUBcUCxQEB7fr/KUsIwN+EBl4hn/z9i s8UNW/phXQlQT/JMMD8UxE6E3cszoxTQ0ZB7M8G1CmgSws3QzPk41q/s2aoiKGeCIw52 7W9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=xyKbiBGwe12VV4+hIYZhHutByUcZnqEu2BFeb6ToEVc=; b=QyK2AIL4cAH37fe7shEU9jcoEzVFC9NFVXBIdUzf8Ashf9FHtOeEu+BWrQAt9TndQx cgI4u9l6xUXaPR9I4rBM2c5TIRYjHOEHtYwf+GYDiOXcd/s4Bdp3RSW14ZpY/u2txiZt C/ydIUw3XYUEPUSTmm5pDHSBkAV3MsR5i4EkT5LQLPkackLh8xLoHy4PYSkHCT4VH7Md BVnhTNcn5rxozbc7HJLhLEFm6qJqA4tyJL16g5YlUCd1f9WUb0mvCblK0pxWLLfaddac a9zK+WtqYxkTUmvGPCN6q41yGjoeRsceTuJGIFyS5qaXQSJ8IeTbXlPmLiFUwffLOIqr Xl0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Ru4+mVFx; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c14-20020a170903234e00b00163ddc0d430si26241706plh.173.2022.06.29.02.55.42; Wed, 29 Jun 2022 02:55:55 -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=@gmail.com header.s=20210112 header.b=Ru4+mVFx; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232724AbiF2JV6 (ORCPT + 99 others); Wed, 29 Jun 2022 05:21:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232696AbiF2JVz (ORCPT ); Wed, 29 Jun 2022 05:21:55 -0400 Received: from mail-qk1-x72e.google.com (mail-qk1-x72e.google.com [IPv6:2607:f8b0:4864:20::72e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 665FE369D0; Wed, 29 Jun 2022 02:21:52 -0700 (PDT) Received: by mail-qk1-x72e.google.com with SMTP id n10so8124786qkn.10; Wed, 29 Jun 2022 02:21:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=xyKbiBGwe12VV4+hIYZhHutByUcZnqEu2BFeb6ToEVc=; b=Ru4+mVFxOSkJ7OAFQ3tloi+JJTVyK6/e8NHNSXgkYVnfAnpZbGlH720kSMNkKOVNoP 3Nf4ML7iI3+jAkW8vmuq23ATUDiO3PWYg/Vh23hSlsSHBeWY6MhQACDOkYrFr/lOW8Qj 7YqBUk5cH6Ml4/AkHJLtDBakAc9A9jIap8JlgdNpZPDxnzdalgk2PN5Wie44gGvUj3dD JhTuI+9FDaY/iuse7Xs07LBLHCDBSaFcvp5KhkqCJt/jwT1AhgO6PQ2oThQdwLEJN5ni +vSUgmu1TF/OarZedRIndxHmBWYxfjqyr9fnJnmS/ugldZU2Vl1lwGhWAUVl8C1rFhg4 KX6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=xyKbiBGwe12VV4+hIYZhHutByUcZnqEu2BFeb6ToEVc=; b=piDf4eSaRELe9V51n0kAbVRfEHfr3X9KYN3W8IkDrOU5SzP9ENRzrHqc1BXj10Q0Gm xITQ8wAWufpMfk+TubnZShMntDh14vm4cq3YFIRg8dEb2MgBEiudeUclCOQKSOvhd3MJ GcXnSdAfjMv/AyyqlwDzqQ8DfA70Hh5ckwCX/+so13DGRjLrGyrHYINK+EG0I+QtEQuf ji5A8AO/1fXY0a64RivKpkYXKxXZHhk/PYJX4XX7u5jtl35HDRKKN9nEYS7clRYLQkvx ZEdiSHrYGs+dYLBExU+qz81gagWTbq1e+BgEncVdyrATsJCSlUUCB9DpHI7gjBMRLOhC GYNg== X-Gm-Message-State: AJIora/DjjtyoENp4B7qhYqLela/4dAyceKaBI7Zl8xak7+valqLScb3 TwV4BUfMct2fO9H3sZWakipiI9Z92pDKpsS85m4= X-Received: by 2002:a05:620a:1a28:b0:6b1:4d4d:c7c3 with SMTP id bk40-20020a05620a1a2800b006b14d4dc7c3mr435716qkb.522.1656494511367; Wed, 29 Jun 2022 02:21:51 -0700 (PDT) MIME-Version: 1.0 References: <20220624104420.257368-1-robimarko@gmail.com> In-Reply-To: <20220624104420.257368-1-robimarko@gmail.com> From: Robert Marko Date: Wed, 29 Jun 2022 11:21:40 +0200 Message-ID: Subject: Re: [PATCH v4 1/2] PCI: qcom: Move IPQ8074 DBI register accesses after phy_power_on() To: Stanimir Varbanov , Andy Gross , Bjorn Andersson , lpieralisi@kernel.org, Rob Herring , kw@linux.com, Bjorn Helgaas , p.zabel@pengutronix.de, jingoohan1@gmail.com, linux-pci@vger.kernel.org, linux-arm-msm , open list , johan+linaro@kernel.org, Dmitry Baryshkov Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 On Fri, 24 Jun 2022 at 12:44, Robert Marko wrote: > > Currently the Gen2 port in IPQ8074 will cause the system to hang as it > accesses DBI registers in qcom_pcie_init_2_3_3(), and those are only > accesible after phy_power_on(). > > Move the DBI read/writes to a new qcom_pcie_post_init_2_3_3(), which is > executed after phy_power_on(). > > Fixes: a0fd361db8e5 ("PCI: dwc: Move "dbi", "dbi2", and "addr_space" resource setup into common code") > Signed-off-by: Robert Marko > Reviewed-by: Dmitry Baryshkov Hi, Bjorn, is there something else I need to fixup? Regards, Robert > --- > Changes in v4: > * Correct title and description > > Changes in v3: > * Make sure it applies onto 5.19-rc3 > * Update the commit description to make it clear this only affects the > Gen2 port > > Changes in v2: > * Rebase onto next-20220621 > --- > drivers/pci/controller/dwc/pcie-qcom.c | 48 +++++++++++++++----------- > 1 file changed, 28 insertions(+), 20 deletions(-) > > diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c > index a1f1aca2fb59..24708d5d817d 100644 > --- a/drivers/pci/controller/dwc/pcie-qcom.c > +++ b/drivers/pci/controller/dwc/pcie-qcom.c > @@ -1061,9 +1061,7 @@ static int qcom_pcie_init_2_3_3(struct qcom_pcie *pcie) > struct qcom_pcie_resources_2_3_3 *res = &pcie->res.v2_3_3; > struct dw_pcie *pci = pcie->pci; > struct device *dev = pci->dev; > - u16 offset = dw_pcie_find_capability(pci, PCI_CAP_ID_EXP); > int i, ret; > - u32 val; > > for (i = 0; i < ARRAY_SIZE(res->rst); i++) { > ret = reset_control_assert(res->rst[i]); > @@ -1120,6 +1118,33 @@ static int qcom_pcie_init_2_3_3(struct qcom_pcie *pcie) > goto err_clk_aux; > } > > + return 0; > + > +err_clk_aux: > + clk_disable_unprepare(res->ahb_clk); > +err_clk_ahb: > + clk_disable_unprepare(res->axi_s_clk); > +err_clk_axi_s: > + clk_disable_unprepare(res->axi_m_clk); > +err_clk_axi_m: > + clk_disable_unprepare(res->iface); > +err_clk_iface: > + /* > + * Not checking for failure, will anyway return > + * the original failure in 'ret'. > + */ > + for (i = 0; i < ARRAY_SIZE(res->rst); i++) > + reset_control_assert(res->rst[i]); > + > + return ret; > +} > + > +static int qcom_pcie_post_init_2_3_3(struct qcom_pcie *pcie) > +{ > + struct dw_pcie *pci = pcie->pci; > + u16 offset = dw_pcie_find_capability(pci, PCI_CAP_ID_EXP); > + u32 val; > + > writel(SLV_ADDR_SPACE_SZ, > pcie->parf + PCIE20_v3_PARF_SLV_ADDR_SPACE_SIZE); > > @@ -1147,24 +1172,6 @@ static int qcom_pcie_init_2_3_3(struct qcom_pcie *pcie) > PCI_EXP_DEVCTL2); > > return 0; > - > -err_clk_aux: > - clk_disable_unprepare(res->ahb_clk); > -err_clk_ahb: > - clk_disable_unprepare(res->axi_s_clk); > -err_clk_axi_s: > - clk_disable_unprepare(res->axi_m_clk); > -err_clk_axi_m: > - clk_disable_unprepare(res->iface); > -err_clk_iface: > - /* > - * Not checking for failure, will anyway return > - * the original failure in 'ret'. > - */ > - for (i = 0; i < ARRAY_SIZE(res->rst); i++) > - reset_control_assert(res->rst[i]); > - > - return ret; > } > > static int qcom_pcie_get_resources_2_7_0(struct qcom_pcie *pcie) > @@ -1596,6 +1603,7 @@ static const struct qcom_pcie_ops ops_2_4_0 = { > static const struct qcom_pcie_ops ops_2_3_3 = { > .get_resources = qcom_pcie_get_resources_2_3_3, > .init = qcom_pcie_init_2_3_3, > + .post_init = qcom_pcie_post_init_2_3_3, > .deinit = qcom_pcie_deinit_2_3_3, > .ltssm_enable = qcom_pcie_2_3_2_ltssm_enable, > }; > -- > 2.36.1 >