From patchwork Thu Apr 30 22:06:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 11521739 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 36B0F912 for ; Thu, 30 Apr 2020 22:06:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1F032207DD for ; Thu, 30 Apr 2020 22:06:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bk6sNZJ8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727114AbgD3WGi (ORCPT ); Thu, 30 Apr 2020 18:06:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726447AbgD3WGi (ORCPT ); Thu, 30 Apr 2020 18:06:38 -0400 Received: from mail-ej1-x644.google.com (mail-ej1-x644.google.com [IPv6:2a00:1450:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C9BDC035494; Thu, 30 Apr 2020 15:06:36 -0700 (PDT) Received: by mail-ej1-x644.google.com with SMTP id q8so6016072eja.2; Thu, 30 Apr 2020 15:06:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OqdsL6oVEYDsaU2ajghqSTycB/dhWD7JVGPrizA/d1E=; b=bk6sNZJ87amcVdfIb232iw1yidtULT6ThRortjgOydN9S//dH/QOGsc0rHLvYSzQD7 J+KGwzZyTa6q4jZNBsXkewjvCDVpxxQvpmHIYL0tm7I65sBPrqgrNXf8VQ8sUJrJsLhO MyRbJklX6Y7xzb26M5+D1SGps/Y8DVEbqi+mbSDTjcL1zlV0wXovsOhHB9WWFGtYBeHh YyG6HD4myO1FCt9bA+cF1+D835PhXO0K1Uka11HdNR7/K2mQrP4rcCEUWxcgEcLks4En NTY4Gszr0e3RLDXPFJiTdMqibOKVl6Mm9Vbbx6DbjytMTBPZ3S2MDsXcUnqgYSSvKAhj 7HJw== 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=OqdsL6oVEYDsaU2ajghqSTycB/dhWD7JVGPrizA/d1E=; b=hVcrwZEEoEB2UFNVdm6dmi+7CdLGle2Ix7C0fI1oS4JWO9V1zgfNWBYuVv3LCnWqo3 Bm+CSOPQ1skTLbiVzwoloTPEKv3Lk9lwts1QtLq16bFVQ5ZmM/FBLJc9fIBuiUY4nyTo yxvDIhnZ2pT7lZeWd4d11MadKsRqrjdA/pxQH8kg5IHaKsXmNcAPwEap5TZQqmxRi0Vl /UqGbD99DjJ9z/oDAb7xcvB/SbNe3zJuftN+Z3QP0yAXJOPy7dRpZZkDOHfbbbGy40iP zLNHWS8bollmWos4Q3D+w9F2ur7RYTF6PegVR4MjnLE6Q1/4Vm3qgIUinEsudJzzz36R Qf4g== X-Gm-Message-State: AGi0PuaxAOSGpUi/nUbd6Tm031o0OeD2CCjgj9VRmPQGeNmUEWaT5iKW /IcgdXNc/cJinRZs3U7HK0M= X-Google-Smtp-Source: APiQypItPxjgwbSyRlXSixiFqHQbhHHGoPoMPlzjtd7ZlRMtNHvSfTkDOsdKKHiWxy7IK+enwCBH9w== X-Received: by 2002:a17:906:13d1:: with SMTP id g17mr596971ejc.162.1588284394952; Thu, 30 Apr 2020 15:06:34 -0700 (PDT) Received: from Ansuel-XPS.localdomain ([79.37.253.240]) by smtp.googlemail.com with ESMTPSA id t17sm54185edq.88.2020.04.30.15.06.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2020 15:06:34 -0700 (PDT) From: Ansuel Smith To: Bjorn Andersson Cc: Ansuel Smith , Sham Muthayyan , stable@vger.kernel.org, Andy Gross , Bjorn Helgaas , Rob Herring , Mark Rutland , Stanimir Varbanov , Lorenzo Pieralisi , Andrew Murray , Philipp Zabel , linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 01/11] PCI: qcom: add missing ipq806x clocks in PCIe driver Date: Fri, 1 May 2020 00:06:08 +0200 Message-Id: <20200430220619.3169-2-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200430220619.3169-1-ansuelsmth@gmail.com> References: <20200430220619.3169-1-ansuelsmth@gmail.com> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Aux and Ref clk are missing in PCIe qcom driver. Add support in the driver to fix PCIe initialization in ipq806x. Fixes: 82a823833f4e PCI: qcom: Add Qualcomm PCIe controller driver Signed-off-by: Sham Muthayyan Signed-off-by: Ansuel Smith Cc: stable@vger.kernel.org # v4.5+ --- drivers/pci/controller/dwc/pcie-qcom.c | 44 ++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c index 5ea527a6bd9f..2a39dfdccfc8 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -88,6 +88,8 @@ struct qcom_pcie_resources_2_1_0 { struct clk *iface_clk; struct clk *core_clk; struct clk *phy_clk; + struct clk *aux_clk; + struct clk *ref_clk; struct reset_control *pci_reset; struct reset_control *axi_reset; struct reset_control *ahb_reset; @@ -246,6 +248,14 @@ static int qcom_pcie_get_resources_2_1_0(struct qcom_pcie *pcie) if (IS_ERR(res->phy_clk)) return PTR_ERR(res->phy_clk); + res->aux_clk = devm_clk_get_optional(dev, "aux"); + if (IS_ERR(res->aux_clk)) + return PTR_ERR(res->aux_clk); + + res->ref_clk = devm_clk_get_optional(dev, "ref"); + if (IS_ERR(res->ref_clk)) + return PTR_ERR(res->ref_clk); + res->pci_reset = devm_reset_control_get_exclusive(dev, "pci"); if (IS_ERR(res->pci_reset)) return PTR_ERR(res->pci_reset); @@ -278,6 +288,8 @@ static void qcom_pcie_deinit_2_1_0(struct qcom_pcie *pcie) clk_disable_unprepare(res->iface_clk); clk_disable_unprepare(res->core_clk); clk_disable_unprepare(res->phy_clk); + clk_disable_unprepare(res->aux_clk); + clk_disable_unprepare(res->ref_clk); regulator_bulk_disable(ARRAY_SIZE(res->supplies), res->supplies); } @@ -307,16 +319,32 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie) goto err_assert_ahb; } + ret = clk_prepare_enable(res->core_clk); + if (ret) { + dev_err(dev, "cannot prepare/enable core clock\n"); + goto err_clk_core; + } + ret = clk_prepare_enable(res->phy_clk); if (ret) { dev_err(dev, "cannot prepare/enable phy clock\n"); goto err_clk_phy; } - ret = clk_prepare_enable(res->core_clk); - if (ret) { - dev_err(dev, "cannot prepare/enable core clock\n"); - goto err_clk_core; + if (res->aux_clk) { + ret = clk_prepare_enable(res->aux_clk); + if (ret) { + dev_err(dev, "cannot prepare/enable aux clock\n"); + goto err_clk_aux; + } + } + + if (res->ref_clk) { + ret = clk_prepare_enable(res->ref_clk); + if (ret) { + dev_err(dev, "cannot prepare/enable ref clock\n"); + goto err_clk_ref; + } } ret = reset_control_deassert(res->ahb_reset); @@ -372,10 +400,14 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie) return 0; err_deassert_ahb: - clk_disable_unprepare(res->core_clk); -err_clk_core: + clk_disable_unprepare(res->ref_clk); +err_clk_ref: + clk_disable_unprepare(res->aux_clk); +err_clk_aux: clk_disable_unprepare(res->phy_clk); err_clk_phy: + clk_disable_unprepare(res->core_clk); +err_clk_core: clk_disable_unprepare(res->iface_clk); err_assert_ahb: regulator_bulk_disable(ARRAY_SIZE(res->supplies), res->supplies); From patchwork Thu Apr 30 22:06:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 11521777 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EAFA6912 for ; Thu, 30 Apr 2020 22:07:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D44062173E for ; Thu, 30 Apr 2020 22:07:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KOgyeYgd" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726697AbgD3WGl (ORCPT ); Thu, 30 Apr 2020 18:06:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726447AbgD3WGk (ORCPT ); Thu, 30 Apr 2020 18:06:40 -0400 Received: from mail-ed1-x544.google.com (mail-ed1-x544.google.com [IPv6:2a00:1450:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25D12C035494; Thu, 30 Apr 2020 15:06:39 -0700 (PDT) Received: by mail-ed1-x544.google.com with SMTP id a8so5859923edv.2; Thu, 30 Apr 2020 15:06:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XIh4WZ/DzQGFNuZWC55hswdxMMaPYtsqIl+LPMHRbFE=; b=KOgyeYgd2UrMZzgUPPX0zevKc0K5HhCrApFGo/tkCjeVfJ7DEqRa7puz1/alxsxuWA FKk/ZjJBV/s84TOBaYX4XZzZHcs0VuxR4tjTjFUpXDvZzVr0oEhWdMPNymrtD7usoO7h l7SprQyUEmNTHb2fYlQpDNXxKepOJcc0mFaqetgcwID7Ff+M/XqfG06lYzsKOg1VT+dc R0dWKDFDC1nTqpetZi/u+0CJSoJcWUaNb9TQCBGBpEvitM4semj6cEQinV5qBQjvoWik xz1RYcwU6FtDsNzfshiPmAbGI3Ux/blsNLgitsahx3VcvVXwreyKde1uw8iCc9YKGvAf 9jNQ== 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=XIh4WZ/DzQGFNuZWC55hswdxMMaPYtsqIl+LPMHRbFE=; b=jVwcRzyqyQxu2iX3eE9BWhA3vvUnp/7EZy9TkuvJqBaFxFhFNRYtsXC7w7T6/7EbC/ AFSbry859/WFjCqTIThMSYTnDlkXB91fMulkGjr+bcgQ/nZN9CCgkdK2afE+Zg34uNKX TG/Yhzt7HPDBVFFnTpWrSdoVPPUkthCHoutYqqSKVbfAi/eo9W1VHwcgm1WKGSKabVUX jvI6AMWRJ/hZieLkJx2hE/xcWkOcD/TJwq/y9JMdoFDF/XqTsnobiu5dzf0RpudEfy1k 2/uoxXofY3lJsfnq9+Ak3OPykCg33vas/1oOqPXRKsDq93RIwdUOqB/GxkR/aGNO0XUo yLEg== X-Gm-Message-State: AGi0PuaAua2B0JaHsHNckRk7iYqoItPyj4ZroUcha/9wQonzmu/BVLRN tT6vcgS49onbDqX7UinztQk= X-Google-Smtp-Source: APiQypJe3oZqbiWz9ac5ISUi4os5aD4cY2cMgVvOHyjpiuLokM2LWzlQ5tP5a7iYAYa3J2msNFsS1w== X-Received: by 2002:a05:6402:1adc:: with SMTP id ba28mr1092884edb.336.1588284397811; Thu, 30 Apr 2020 15:06:37 -0700 (PDT) Received: from Ansuel-XPS.localdomain ([79.37.253.240]) by smtp.googlemail.com with ESMTPSA id t17sm54185edq.88.2020.04.30.15.06.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2020 15:06:37 -0700 (PDT) From: Ansuel Smith To: Bjorn Andersson Cc: Ansuel Smith , Rob Herring , Andy Gross , Bjorn Helgaas , Rob Herring , Mark Rutland , Stanimir Varbanov , Lorenzo Pieralisi , Andrew Murray , Philipp Zabel , linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 02/11] devicetree: bindings: pci: add missing clks to qcom,pcie Date: Fri, 1 May 2020 00:06:09 +0200 Message-Id: <20200430220619.3169-3-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200430220619.3169-1-ansuelsmth@gmail.com> References: <20200430220619.3169-1-ansuelsmth@gmail.com> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Document missing clks used in ipq8064 soc. Signed-off-by: Ansuel Smith Acked-by: Rob Herring --- Documentation/devicetree/bindings/pci/qcom,pcie.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/pci/qcom,pcie.txt b/Documentation/devicetree/bindings/pci/qcom,pcie.txt index 981b4de12807..becdbdc0fffa 100644 --- a/Documentation/devicetree/bindings/pci/qcom,pcie.txt +++ b/Documentation/devicetree/bindings/pci/qcom,pcie.txt @@ -90,6 +90,8 @@ Definition: Should contain the following entries - "core" Clocks the pcie hw block - "phy" Clocks the pcie PHY block + - "aux" Clocks the pcie AUX block + - "ref" Clocks the pcie ref block - clock-names: Usage: required for apq8084/ipq4019 Value type: @@ -277,8 +279,10 @@ <0 0 0 4 &intc 0 39 IRQ_TYPE_LEVEL_HIGH>; /* int_d */ clocks = <&gcc PCIE_A_CLK>, <&gcc PCIE_H_CLK>, - <&gcc PCIE_PHY_CLK>; - clock-names = "core", "iface", "phy"; + <&gcc PCIE_PHY_CLK>, + <&gcc PCIE_AUX_CLK>, + <&gcc PCIE_ALT_REF_CLK>; + clock-names = "core", "iface", "phy", "aux", "ref"; resets = <&gcc PCIE_ACLK_RESET>, <&gcc PCIE_HCLK_RESET>, <&gcc PCIE_POR_RESET>, From patchwork Thu Apr 30 22:06:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 11521741 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 39075913 for ; Thu, 30 Apr 2020 22:06:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 217A020836 for ; Thu, 30 Apr 2020 22:06:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="W9lUgU66" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726447AbgD3WGn (ORCPT ); Thu, 30 Apr 2020 18:06:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727879AbgD3WGm (ORCPT ); Thu, 30 Apr 2020 18:06:42 -0400 Received: from mail-ed1-x542.google.com (mail-ed1-x542.google.com [IPv6:2a00:1450:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 154B5C035494; Thu, 30 Apr 2020 15:06:42 -0700 (PDT) Received: by mail-ed1-x542.google.com with SMTP id d16so5842970edv.8; Thu, 30 Apr 2020 15:06:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CgTrzh3Tu5k7J4C6anuKQZFd/nJ6FehtS7rnu7w0aik=; b=W9lUgU66nDUDMQXEq+6WhaUSOwFR89PMCUiEzi9uQtlmrbT3JUKTTX8N/YvWpmGRZM bflOf5xiTdbtWJrHBNFVSeEm+ltIVGx/x7kqByJXaZjP5RSgebWF8zkpfKGiVBBrqo+T ulnFiY7CxTNRRJVS1U+SxBPB6cN2KjoeJv4TFmlMl0RcQgP8zt1Mw+q4KYnW8qbjribj cebgHLKEyWmZnHu7OovETEUUJJb+W+jfYrjGT4pL1C/FniBrTOWpRtNF9NWvapGi2zVC 3gRUTaf7+pzMeMkHewo63L90kIIiHdlTHSIb3lrak94otqyrmZYWcNxMj1JToDaELXRv HOuQ== 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=CgTrzh3Tu5k7J4C6anuKQZFd/nJ6FehtS7rnu7w0aik=; b=i6bZXrlmltDhgXTV5Vy/4J2iIoHJmytlZ14dOSVsgTsX883D/VbJZFkSJT51CcdUZO 72m7WiZQbKLzCjP6fi+zXSQG/y7h6e3Y8Y5+1zcI1bVY9LUES/IZrZa+3Y2YgN/IGGvX JH+oS3q5/0qVsvtXZqkerEefTIRaX0f409OJclmX0+fuJ7QVfpYOEiJg9vOhr9xildMY efa+rcg7kdEbdkU4tlA7zOKc2rjH/Z4nLWR3QED9y7CkH2u0PU/2Ow1zBwShKRO+9seG EE8KZwghfvCLIZaStCUH+sOw6cFi+ozZevuqX2vHwWQtQIfdla/zJEl2DwX2+UR23Jc1 +s5w== X-Gm-Message-State: AGi0PuaJ+/vu2EPYNKIjW652gg63xmA+SuZGyW0UDZ3LCWfwf2ok16u8 qAwsJ+s2JZ6RK6KCrnGvg2Q= X-Google-Smtp-Source: APiQypKAWtOnJY37BTq1roF1i90+nc9Z/fJC/RtNKvUzlpXZZWc8QxpkmmWxFQpUlmKLLpjH1nhY7g== X-Received: by 2002:a05:6402:95e:: with SMTP id h30mr1049680edz.117.1588284400719; Thu, 30 Apr 2020 15:06:40 -0700 (PDT) Received: from Ansuel-XPS.localdomain ([79.37.253.240]) by smtp.googlemail.com with ESMTPSA id t17sm54185edq.88.2020.04.30.15.06.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2020 15:06:40 -0700 (PDT) From: Ansuel Smith To: Bjorn Andersson Cc: Abhishek Sahu , Ansuel Smith , Andy Gross , Bjorn Helgaas , Rob Herring , Mark Rutland , Stanimir Varbanov , Lorenzo Pieralisi , Andrew Murray , Philipp Zabel , linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 03/11] PCI: qcom: change duplicate PCI reset to phy reset Date: Fri, 1 May 2020 00:06:10 +0200 Message-Id: <20200430220619.3169-4-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200430220619.3169-1-ansuelsmth@gmail.com> References: <20200430220619.3169-1-ansuelsmth@gmail.com> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Abhishek Sahu The deinit issues reset_control_assert for PCI twice and does not contain phy reset. Signed-off-by: Abhishek Sahu Signed-off-by: Ansuel Smith Reviewed-by: Rob Herring --- drivers/pci/controller/dwc/pcie-qcom.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c index 2a39dfdccfc8..7a8901efc031 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -280,14 +280,14 @@ static void qcom_pcie_deinit_2_1_0(struct qcom_pcie *pcie) { struct qcom_pcie_resources_2_1_0 *res = &pcie->res.v2_1_0; + clk_disable_unprepare(res->phy_clk); reset_control_assert(res->pci_reset); reset_control_assert(res->axi_reset); reset_control_assert(res->ahb_reset); reset_control_assert(res->por_reset); - reset_control_assert(res->pci_reset); + reset_control_assert(res->phy_reset); clk_disable_unprepare(res->iface_clk); clk_disable_unprepare(res->core_clk); - clk_disable_unprepare(res->phy_clk); clk_disable_unprepare(res->aux_clk); clk_disable_unprepare(res->ref_clk); regulator_bulk_disable(ARRAY_SIZE(res->supplies), res->supplies); @@ -325,12 +325,6 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie) goto err_clk_core; } - ret = clk_prepare_enable(res->phy_clk); - if (ret) { - dev_err(dev, "cannot prepare/enable phy clock\n"); - goto err_clk_phy; - } - if (res->aux_clk) { ret = clk_prepare_enable(res->aux_clk); if (ret) { @@ -387,6 +381,12 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie) return ret; } + ret = clk_prepare_enable(res->phy_clk); + if (ret) { + dev_err(dev, "cannot prepare/enable phy clock\n"); + goto err_deassert_ahb; + } + /* wait for clock acquisition */ usleep_range(1000, 1500); @@ -404,8 +404,6 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie) err_clk_ref: clk_disable_unprepare(res->aux_clk); err_clk_aux: - clk_disable_unprepare(res->phy_clk); -err_clk_phy: clk_disable_unprepare(res->core_clk); err_clk_core: clk_disable_unprepare(res->iface_clk); From patchwork Thu Apr 30 22:06:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 11521775 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C0906912 for ; Thu, 30 Apr 2020 22:07:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A76F724967 for ; Thu, 30 Apr 2020 22:07:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="tOwy44ai" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727895AbgD3WGq (ORCPT ); Thu, 30 Apr 2020 18:06:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727879AbgD3WGp (ORCPT ); Thu, 30 Apr 2020 18:06:45 -0400 Received: from mail-ej1-x641.google.com (mail-ej1-x641.google.com [IPv6:2a00:1450:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC38EC035494; Thu, 30 Apr 2020 15:06:44 -0700 (PDT) Received: by mail-ej1-x641.google.com with SMTP id n4so5986395ejs.11; Thu, 30 Apr 2020 15:06:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NTSEddZV2Ao05kNtBAJHES9gCGwIno9St6PsZ/GXLQk=; b=tOwy44aiA+CSH65BAPlP0tMBN460Wj4fc2E5Sa+lUWlcBHi/f8R1OUC26NbCYIPZXm AjNfsZdk6ULjoah7oE8V6RZgqHFrBifnbj2LvgNutQ+2YJ8RcmRiWxkw1Ht9RMm/xhdo r4DZ1MjSPXaDyJ1bC4xV2YkVpl5yxI1iBPnVLNxh2dt/Ttb6Wp8qnitP44gJ+TLN2ZY3 HD4Hrbqbv4cBvaXEPx3bH/7rio0lkJEH5r70sPs8Ckt2nwEt2vRZquap47FMGAnwhkp1 3ZAiwUeHc+ZlC9dWTMuGpxEUhr1bX4AiP9nSioSADZVnZDXHxrmof4XNlad3CLonrKf6 h1og== 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=NTSEddZV2Ao05kNtBAJHES9gCGwIno9St6PsZ/GXLQk=; b=PGP9tjFrt6YtQ7iud5iWbrRNFXww9oFQKyPH3oOuf6p5Mos+vXdUWz3aKKC4a850Pl 5h5GoWOJCMPFnK8eXiiFQEMU9vtxho+1s1DONNzSoahjiQJVRY8An5/CiUV6bFzDMKlE QFFvDKXnqpP0J6XbbeNwKzpWwdgsXXv34D87CqbjM2b/7Ff+C3U+bXewS7meFpvvpeer sVUIYhn7HeNQFnfO/fdWQuQBjYoc/LIl6mC4XON8JZy2cQH8BrYEedNUdVRetdyXqI8s GL1MYIYp0zLtHVa2ZqwMKVaUgByph7SvqGdxj8A2+fI6XLBct2Fvsz5EOxd7qMDVkC8X Bo2g== X-Gm-Message-State: AGi0Pua0hGUq/BFEWrbVgltIvtvQsKnymueuxuNkjbCfN2uJvCHm5VYx 24kIonsWXPlEGCkFTYfc25k= X-Google-Smtp-Source: APiQypKFfQymUajfbFD5KRjtUC9vrAeNBUfhZsLjaEQrJzlYX0PM4QcJDNjz0Hgzh5kGjrbanPpOjQ== X-Received: by 2002:a17:907:2101:: with SMTP id qn1mr567727ejb.207.1588284403507; Thu, 30 Apr 2020 15:06:43 -0700 (PDT) Received: from Ansuel-XPS.localdomain ([79.37.253.240]) by smtp.googlemail.com with ESMTPSA id t17sm54185edq.88.2020.04.30.15.06.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2020 15:06:42 -0700 (PDT) From: Ansuel Smith To: Bjorn Andersson Cc: Ansuel Smith , Sham Muthayyan , stable@vger.kernel.org, Andy Gross , Bjorn Helgaas , Rob Herring , Mark Rutland , Stanimir Varbanov , Lorenzo Pieralisi , Andrew Murray , Philipp Zabel , linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 04/11] PCI: qcom: add missing reset for ipq806x Date: Fri, 1 May 2020 00:06:11 +0200 Message-Id: <20200430220619.3169-5-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200430220619.3169-1-ansuelsmth@gmail.com> References: <20200430220619.3169-1-ansuelsmth@gmail.com> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Add missing ext reset used by ipq8064 SoC in PCIe qcom driver. Fixes: 82a823833f4e PCI: qcom: Add Qualcomm PCIe controller driver Signed-off-by: Sham Muthayyan Signed-off-by: Ansuel Smith Cc: stable@vger.kernel.org # v4.5+ Reviewed-by: Rob Herring Reviewed-by: Philipp Zabel --- drivers/pci/controller/dwc/pcie-qcom.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c index 7a8901efc031..921030a64bab 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -95,6 +95,7 @@ struct qcom_pcie_resources_2_1_0 { struct reset_control *ahb_reset; struct reset_control *por_reset; struct reset_control *phy_reset; + struct reset_control *ext_reset; struct regulator_bulk_data supplies[QCOM_PCIE_2_1_0_MAX_SUPPLY]; }; @@ -272,6 +273,10 @@ static int qcom_pcie_get_resources_2_1_0(struct qcom_pcie *pcie) if (IS_ERR(res->por_reset)) return PTR_ERR(res->por_reset); + res->ext_reset = devm_reset_control_get_optional_exclusive(dev, "ext"); + if (IS_ERR(res->ext_reset)) + return PTR_ERR(res->ext_reset); + res->phy_reset = devm_reset_control_get_exclusive(dev, "phy"); return PTR_ERR_OR_ZERO(res->phy_reset); } @@ -285,6 +290,7 @@ static void qcom_pcie_deinit_2_1_0(struct qcom_pcie *pcie) reset_control_assert(res->axi_reset); reset_control_assert(res->ahb_reset); reset_control_assert(res->por_reset); + reset_control_assert(res->ext_reset); reset_control_assert(res->phy_reset); clk_disable_unprepare(res->iface_clk); clk_disable_unprepare(res->core_clk); @@ -347,6 +353,12 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie) goto err_deassert_ahb; } + ret = reset_control_deassert(res->ext_reset); + if (ret) { + dev_err(dev, "cannot assert ext reset\n"); + goto err_deassert_ahb; + } + /* enable PCIe clocks and resets */ val = readl(pcie->parf + PCIE20_PARF_PHY_CTRL); val &= ~BIT(0); From patchwork Thu Apr 30 22:06:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 11521747 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8B942913 for ; Thu, 30 Apr 2020 22:06:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 72CFD214D8 for ; Thu, 30 Apr 2020 22:06:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="rVoqIolo" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727933AbgD3WGt (ORCPT ); Thu, 30 Apr 2020 18:06:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727879AbgD3WGs (ORCPT ); Thu, 30 Apr 2020 18:06:48 -0400 Received: from mail-ej1-x644.google.com (mail-ej1-x644.google.com [IPv6:2a00:1450:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DEC1CC035494; Thu, 30 Apr 2020 15:06:47 -0700 (PDT) Received: by mail-ej1-x644.google.com with SMTP id n4so5986508ejs.11; Thu, 30 Apr 2020 15:06:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ioo9tN1eVsbgycuXVtXW3j/mdJh9pHsUFw60B6xaAJg=; b=rVoqIolote4X9C1I0c6PNlb6gnRNhHFT8EXsdJeOL8ty8dDGcNTCPeougORtlm+mtz tHq9dQSO0ExlP4bsNWMzacBhOuyDw+VhSww6VJ0pQ32MN2VG8Acz9sYhyreFccaoZrZg Fo/5HADccKHjCAsV3z1hKzRQTBOWc2LgRqGU84EqcaQh/07d4vbFgWNoXEfP9N+3hzju /QaS0d2T/XUc1thWJUxEpbVOrjLhueopUkgPsh/SLnDzL34GdTl44CvHhtAeovyjKoTV Eummq0flBolE8DftniHk7tM/9+jvWzOJWe8PLS05+vK1Rz1ZHL19vo/uaHrDZRkUW8kI qEjg== 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=ioo9tN1eVsbgycuXVtXW3j/mdJh9pHsUFw60B6xaAJg=; b=AZ/JSeQS7wyl8l+ViTBkGTJwn05Qo5Trg0GwyDVKEz7zLOjPCTp1taAY+trnfIRuCW rdjMZ68eFq1Qpj0vTWMNHq3Wz6EOQ/VntMxvazpw+3wjgE+45C3iB7uVZh4qdZ0VeklW g4PT9tDyf5gaYXllHFDWhXkjSoT23BM+tLnF+ZynAsG6cF0quG4NMXnGepl46pBGpt3y C+OBSB5auIiDuW5JupChkwGdS6eTkudzoVJif57cLzO9EEORQJSA+DlOJdrhRXytz7G/ KzD4y2GVp7DV4AcIl9ljtqLkWGwXSnH0Wu6KEeXu14zSd3FkwDSfNIWzMgELj2W9xCqg MpRQ== X-Gm-Message-State: AGi0PuZ67GwODbcSYXEbzKY5nmZKh/WUutTMkMO/E4FC0B/QyiorQRGP 64fvoOz1orPuKNL3rTdcDFk= X-Google-Smtp-Source: APiQypI827LtyTZBLnMvq2Q58mux5B9U+d8uj0/ZYhol6Y3cmda7uE+aLFUtJAekXh85JuyJs3MzVA== X-Received: by 2002:a17:906:17c5:: with SMTP id u5mr540900eje.275.1588284406587; Thu, 30 Apr 2020 15:06:46 -0700 (PDT) Received: from Ansuel-XPS.localdomain ([79.37.253.240]) by smtp.googlemail.com with ESMTPSA id t17sm54185edq.88.2020.04.30.15.06.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2020 15:06:45 -0700 (PDT) From: Ansuel Smith To: Bjorn Andersson Cc: Ansuel Smith , Rob Herring , Andy Gross , Bjorn Helgaas , Rob Herring , Mark Rutland , Stanimir Varbanov , Lorenzo Pieralisi , Andrew Murray , Philipp Zabel , linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 05/11] devicetree: bindings: pci: add ext reset to qcom,pcie Date: Fri, 1 May 2020 00:06:12 +0200 Message-Id: <20200430220619.3169-6-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200430220619.3169-1-ansuelsmth@gmail.com> References: <20200430220619.3169-1-ansuelsmth@gmail.com> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Document ext reset used in ipq8064 SoC by qcom PCIe driver. Signed-off-by: Ansuel Smith Acked-by: Rob Herring --- Documentation/devicetree/bindings/pci/qcom,pcie.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/pci/qcom,pcie.txt b/Documentation/devicetree/bindings/pci/qcom,pcie.txt index becdbdc0fffa..6efcef040741 100644 --- a/Documentation/devicetree/bindings/pci/qcom,pcie.txt +++ b/Documentation/devicetree/bindings/pci/qcom,pcie.txt @@ -179,6 +179,7 @@ - "pwr" PWR reset - "ahb" AHB reset - "phy_ahb" PHY AHB reset + - "ext" EXT reset - reset-names: Usage: required for ipq8074 @@ -287,8 +288,9 @@ <&gcc PCIE_HCLK_RESET>, <&gcc PCIE_POR_RESET>, <&gcc PCIE_PCI_RESET>, - <&gcc PCIE_PHY_RESET>; - reset-names = "axi", "ahb", "por", "pci", "phy"; + <&gcc PCIE_PHY_RESET>, + <&gcc PCIE_EXT_RESET>; + reset-names = "axi", "ahb", "por", "pci", "phy", "ext"; pinctrl-0 = <&pcie_pins_default>; pinctrl-names = "default"; }; From patchwork Thu Apr 30 22:06:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 11521771 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0F219913 for ; Thu, 30 Apr 2020 22:07:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DE83020873 for ; Thu, 30 Apr 2020 22:07:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YAgKdCsB" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727970AbgD3WGw (ORCPT ); Thu, 30 Apr 2020 18:06:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727955AbgD3WGv (ORCPT ); Thu, 30 Apr 2020 18:06:51 -0400 Received: from mail-ej1-x644.google.com (mail-ej1-x644.google.com [IPv6:2a00:1450:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08295C035494; Thu, 30 Apr 2020 15:06:51 -0700 (PDT) Received: by mail-ej1-x644.google.com with SMTP id s9so6028433eju.1; Thu, 30 Apr 2020 15:06:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=T7fxTmFHD/7QIFtrzRSLVLRXMToDkzdfYoVrqZS2ee8=; b=YAgKdCsBI9EVHZ0rPbeQL9a8iOzCbMAEtAivW4tqMSnAzsxp06oNOsp/RZsYBzqXgm /0RFmx7pDFLpyjzOyshiLRRIqnQeCjKc//S6f5FdXNvUTkSJGAzF9Sj7ftU52+Ksw5dl etWKjYQcVrA7aa4jnRkFxKkU9EBu0EpyT7bC6jR0LzRLx/DLKnu/ww715dHEm1LpWQml SRrQJ6iXRc3bbCAk+LTQ54VQtrRDKOUCRTSRb6Vy0H0/kmWk2qJDMrsPH46452uK2f62 OGTRL0bRul2Y0USsJ5xnELbnfGhEpbtqb6XBmsqEG7v9lasiAy2Rl64t6WkXKCyXy0Jk W1kQ== 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=T7fxTmFHD/7QIFtrzRSLVLRXMToDkzdfYoVrqZS2ee8=; b=tiJWtzr5SKXZD+j0JdWkSXMC1kRyd/3RN4MJBIlNvijgnuzxC/eC2WGTOwiTeSDyjg 4vRQS9F5JYK2xQBJx3TukEar9gqu3URYKTNqv3v+Hly4LYyL6kPRkIRJ09FihjbLO1Ps 0wm+SHo9MZGHjtnlQkMeUf3wJKtNMLvAvnAa1YCqDjtP2ITzQoukjDfQa5NqbbVDuO2c Lxglp4krQhZAAXrKpHkJoJYabF/9oUFyXy5oy4cIG74USIagONXno8ANHpeLFM+tENER QxQJEsF8KF2jBcAuOk7QdLPWWzmochgxRR3XnD7OWrNdcWyAtw3gfGzqUCbMM0brcOYo +Lqw== X-Gm-Message-State: AGi0PuYom5D9RBKgpGEP/YgooyUDerSFarpwgScntulTqH9MDJPaRQFR eLSnt1zdqXs01vxZyjQTlmw= X-Google-Smtp-Source: APiQypIqSPFMQHiJV9RlWmmf6BGqJL0Xri2zN7mWx4whRpYlSTSCkS103E6lLBPhKiwa88tvlSgTUg== X-Received: by 2002:a17:906:72c8:: with SMTP id m8mr589017ejl.318.1588284409578; Thu, 30 Apr 2020 15:06:49 -0700 (PDT) Received: from Ansuel-XPS.localdomain ([79.37.253.240]) by smtp.googlemail.com with ESMTPSA id t17sm54185edq.88.2020.04.30.15.06.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2020 15:06:48 -0700 (PDT) From: Ansuel Smith To: Bjorn Andersson Cc: Ansuel Smith , Andy Gross , Bjorn Helgaas , Rob Herring , Mark Rutland , Stanimir Varbanov , Lorenzo Pieralisi , Andrew Murray , Philipp Zabel , linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 06/11] PCI: qcom: introduce qcom_clear_and_set_dword Date: Fri, 1 May 2020 00:06:13 +0200 Message-Id: <20200430220619.3169-7-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200430220619.3169-1-ansuelsmth@gmail.com> References: <20200430220619.3169-1-ansuelsmth@gmail.com> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use qcom_clear_and_set_dword instead of use the same code many times in the entire driver. Signed-off-by: Ansuel Smith --- drivers/pci/controller/dwc/pcie-qcom.c | 108 ++++++++++--------------- 1 file changed, 41 insertions(+), 67 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c index 921030a64bab..a4fd5baada34 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -184,6 +184,16 @@ struct qcom_pcie { #define to_qcom_pcie(x) dev_get_drvdata((x)->dev) +static void qcom_clear_and_set_dword(void __iomem *addr, u32 clear_mask, + u32 set_mask) +{ + u32 val = readl(addr); + + val &= ~clear_mask; + val |= set_mask; + writel(val, addr); +} + static void qcom_ep_reset_assert(struct qcom_pcie *pcie) { gpiod_set_value_cansleep(pcie->reset, 1); @@ -214,12 +224,9 @@ static int qcom_pcie_establish_link(struct qcom_pcie *pcie) static void qcom_pcie_2_1_0_ltssm_enable(struct qcom_pcie *pcie) { - u32 val; - /* enable link training */ - val = readl(pcie->elbi + PCIE20_ELBI_SYS_CTRL); - val |= PCIE20_ELBI_SYS_CTRL_LT_ENABLE; - writel(val, pcie->elbi + PCIE20_ELBI_SYS_CTRL); + qcom_clear_and_set_dword(pcie->elbi + PCIE20_ELBI_SYS_CTRL, 0, + PCIE20_ELBI_SYS_CTRL_LT_ENABLE); } static int qcom_pcie_get_resources_2_1_0(struct qcom_pcie *pcie) @@ -304,7 +311,6 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie) struct qcom_pcie_resources_2_1_0 *res = &pcie->res.v2_1_0; struct dw_pcie *pci = pcie->pci; struct device *dev = pci->dev; - u32 val; int ret; ret = regulator_bulk_enable(ARRAY_SIZE(res->supplies), res->supplies); @@ -360,14 +366,11 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie) } /* enable PCIe clocks and resets */ - val = readl(pcie->parf + PCIE20_PARF_PHY_CTRL); - val &= ~BIT(0); - writel(val, pcie->parf + PCIE20_PARF_PHY_CTRL); + qcom_clear_and_set_dword(pcie->parf + PCIE20_PARF_PHY_CTRL, BIT(0), 0); /* enable external reference clock */ - val = readl(pcie->parf + PCIE20_PARF_PHY_REFCLK); - val |= BIT(16); - writel(val, pcie->parf + PCIE20_PARF_PHY_REFCLK); + qcom_clear_and_set_dword(pcie->parf + PCIE20_PARF_PHY_REFCLK, 0, + BIT(16)); ret = reset_control_deassert(res->phy_reset); if (ret) { @@ -514,10 +517,9 @@ static int qcom_pcie_init_1_0_0(struct qcom_pcie *pcie) writel(0, pcie->parf + PCIE20_PARF_DBI_BASE_ADDR); if (IS_ENABLED(CONFIG_PCI_MSI)) { - u32 val = readl(pcie->parf + PCIE20_PARF_AXI_MSTR_WR_ADDR_HALT); - - val |= BIT(31); - writel(val, pcie->parf + PCIE20_PARF_AXI_MSTR_WR_ADDR_HALT); + qcom_clear_and_set_dword( + pcie->parf + PCIE20_PARF_AXI_MSTR_WR_ADDR_HALT, 0, + BIT(31)); } return 0; @@ -537,12 +539,8 @@ static int qcom_pcie_init_1_0_0(struct qcom_pcie *pcie) static void qcom_pcie_2_3_2_ltssm_enable(struct qcom_pcie *pcie) { - u32 val; - /* enable link training */ - val = readl(pcie->parf + PCIE20_PARF_LTSSM); - val |= BIT(8); - writel(val, pcie->parf + PCIE20_PARF_LTSSM); + qcom_clear_and_set_dword(pcie->parf + PCIE20_PARF_LTSSM, 0, BIT(8)); } static int qcom_pcie_get_resources_2_3_2(struct qcom_pcie *pcie) @@ -603,7 +601,6 @@ static int qcom_pcie_init_2_3_2(struct qcom_pcie *pcie) struct qcom_pcie_resources_2_3_2 *res = &pcie->res.v2_3_2; struct dw_pcie *pci = pcie->pci; struct device *dev = pci->dev; - u32 val; int ret; ret = regulator_bulk_enable(ARRAY_SIZE(res->supplies), res->supplies); @@ -637,25 +634,19 @@ static int qcom_pcie_init_2_3_2(struct qcom_pcie *pcie) } /* enable PCIe clocks and resets */ - val = readl(pcie->parf + PCIE20_PARF_PHY_CTRL); - val &= ~BIT(0); - writel(val, pcie->parf + PCIE20_PARF_PHY_CTRL); + qcom_clear_and_set_dword(pcie->parf + PCIE20_PARF_PHY_CTRL, BIT(0), 0); /* change DBI base address */ writel(0, pcie->parf + PCIE20_PARF_DBI_BASE_ADDR); /* MAC PHY_POWERDOWN MUX DISABLE */ - val = readl(pcie->parf + PCIE20_PARF_SYS_CTRL); - val &= ~BIT(29); - writel(val, pcie->parf + PCIE20_PARF_SYS_CTRL); + qcom_clear_and_set_dword(pcie->parf + PCIE20_PARF_SYS_CTRL, BIT(29), 0); - val = readl(pcie->parf + PCIE20_PARF_MHI_CLOCK_RESET_CTRL); - val |= BIT(4); - writel(val, pcie->parf + PCIE20_PARF_MHI_CLOCK_RESET_CTRL); + qcom_clear_and_set_dword(pcie->parf + PCIE20_PARF_MHI_CLOCK_RESET_CTRL, + 0, BIT(4)); - val = readl(pcie->parf + PCIE20_PARF_AXI_MSTR_WR_ADDR_HALT_V2); - val |= BIT(31); - writel(val, pcie->parf + PCIE20_PARF_AXI_MSTR_WR_ADDR_HALT_V2); + qcom_clear_and_set_dword( + pcie->parf + PCIE20_PARF_AXI_MSTR_WR_ADDR_HALT_V2, 0, BIT(31)); return 0; @@ -792,7 +783,6 @@ static int qcom_pcie_init_2_4_0(struct qcom_pcie *pcie) struct qcom_pcie_resources_2_4_0 *res = &pcie->res.v2_4_0; struct dw_pcie *pci = pcie->pci; struct device *dev = pci->dev; - u32 val; int ret; ret = reset_control_assert(res->axi_m_reset); @@ -918,25 +908,19 @@ static int qcom_pcie_init_2_4_0(struct qcom_pcie *pcie) goto err_clks; /* enable PCIe clocks and resets */ - val = readl(pcie->parf + PCIE20_PARF_PHY_CTRL); - val &= ~BIT(0); - writel(val, pcie->parf + PCIE20_PARF_PHY_CTRL); + qcom_clear_and_set_dword(pcie->parf + PCIE20_PARF_PHY_CTRL, BIT(0), 0); /* change DBI base address */ writel(0, pcie->parf + PCIE20_PARF_DBI_BASE_ADDR); /* MAC PHY_POWERDOWN MUX DISABLE */ - val = readl(pcie->parf + PCIE20_PARF_SYS_CTRL); - val &= ~BIT(29); - writel(val, pcie->parf + PCIE20_PARF_SYS_CTRL); + qcom_clear_and_set_dword(pcie->parf + PCIE20_PARF_SYS_CTRL, BIT(29), 0); - val = readl(pcie->parf + PCIE20_PARF_MHI_CLOCK_RESET_CTRL); - val |= BIT(4); - writel(val, pcie->parf + PCIE20_PARF_MHI_CLOCK_RESET_CTRL); + qcom_clear_and_set_dword(pcie->parf + PCIE20_PARF_MHI_CLOCK_RESET_CTRL, + 0, BIT(4)); - val = readl(pcie->parf + PCIE20_PARF_AXI_MSTR_WR_ADDR_HALT_V2); - val |= BIT(31); - writel(val, pcie->parf + PCIE20_PARF_AXI_MSTR_WR_ADDR_HALT_V2); + qcom_clear_and_set_dword( + pcie->parf + PCIE20_PARF_AXI_MSTR_WR_ADDR_HALT_V2, 0, BIT(31)); return 0; @@ -1017,7 +1001,6 @@ static int qcom_pcie_init_2_3_3(struct qcom_pcie *pcie) struct dw_pcie *pci = pcie->pci; struct device *dev = pci->dev; int i, ret; - u32 val; for (i = 0; i < ARRAY_SIZE(res->rst); i++) { ret = reset_control_assert(res->rst[i]); @@ -1077,9 +1060,7 @@ static int qcom_pcie_init_2_3_3(struct qcom_pcie *pcie) writel(SLV_ADDR_SPACE_SZ, pcie->parf + PCIE20_v3_PARF_SLV_ADDR_SPACE_SIZE); - val = readl(pcie->parf + PCIE20_PARF_PHY_CTRL); - val &= ~BIT(0); - writel(val, pcie->parf + PCIE20_PARF_PHY_CTRL); + qcom_clear_and_set_dword(pcie->parf + PCIE20_PARF_PHY_CTRL, BIT(0), 0); writel(0, pcie->parf + PCIE20_PARF_DBI_BASE_ADDR); @@ -1093,9 +1074,8 @@ static int qcom_pcie_init_2_3_3(struct qcom_pcie *pcie) writel(DBI_RO_WR_EN, pci->dbi_base + PCIE20_MISC_CONTROL_1_REG); writel(PCIE_CAP_LINK1_VAL, pci->dbi_base + PCIE20_CAP_LINK_1); - val = readl(pci->dbi_base + PCIE20_CAP_LINK_CAPABILITIES); - val &= ~PCIE20_CAP_ACTIVE_STATE_LINK_PM_SUPPORT; - writel(val, pci->dbi_base + PCIE20_CAP_LINK_CAPABILITIES); + qcom_clear_and_set_dword(pcie->dbi_base + PCIE20_CAP_LINK_CAPABILITIES, + PCIE20_CAP_ACTIVE_STATE_LINK_PM_SUPPORT, 0); writel(PCIE_CAP_CPL_TIMEOUT_DISABLE, pci->dbi_base + PCIE20_DEVICE_CONTROL2_STATUS2); @@ -1159,7 +1139,6 @@ static int qcom_pcie_init_2_7_0(struct qcom_pcie *pcie) struct qcom_pcie_resources_2_7_0 *res = &pcie->res.v2_7_0; struct dw_pcie *pci = pcie->pci; struct device *dev = pci->dev; - u32 val; int ret; ret = regulator_bulk_enable(ARRAY_SIZE(res->supplies), res->supplies); @@ -1196,26 +1175,21 @@ static int qcom_pcie_init_2_7_0(struct qcom_pcie *pcie) writel(DEVICE_TYPE_RC, pcie->parf + PCIE20_PARF_DEVICE_TYPE); /* enable PCIe clocks and resets */ - val = readl(pcie->parf + PCIE20_PARF_PHY_CTRL); - val &= ~BIT(0); - writel(val, pcie->parf + PCIE20_PARF_PHY_CTRL); + qcom_clear_and_set_dword(pcie->parf + PCIE20_PARF_PHY_CTRL, BIT(0), 0); /* change DBI base address */ writel(0, pcie->parf + PCIE20_PARF_DBI_BASE_ADDR); /* MAC PHY_POWERDOWN MUX DISABLE */ - val = readl(pcie->parf + PCIE20_PARF_SYS_CTRL); - val &= ~BIT(29); - writel(val, pcie->parf + PCIE20_PARF_SYS_CTRL); + qcom_clear_and_set_dword(pcie->parf + PCIE20_PARF_SYS_CTRL, BIT(29), 0); - val = readl(pcie->parf + PCIE20_PARF_MHI_CLOCK_RESET_CTRL); - val |= BIT(4); - writel(val, pcie->parf + PCIE20_PARF_MHI_CLOCK_RESET_CTRL); + qcom_clear_and_set_dword(pcie->parf + PCIE20_PARF_MHI_CLOCK_RESET_CTRL, + 0, BIT(4)); if (IS_ENABLED(CONFIG_PCI_MSI)) { - val = readl(pcie->parf + PCIE20_PARF_AXI_MSTR_WR_ADDR_HALT); - val |= BIT(31); - writel(val, pcie->parf + PCIE20_PARF_AXI_MSTR_WR_ADDR_HALT); + qcom_clear_and_set_dword( + pcie->parf + PCIE20_PARF_MHI_CLOCK_RESET_CTRL, 0, + BIT(31)); } return 0; From patchwork Thu Apr 30 22:06:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 11521767 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AD380913 for ; Thu, 30 Apr 2020 22:07:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8F3262495C for ; Thu, 30 Apr 2020 22:07:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="agIJz6xx" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727996AbgD3WGz (ORCPT ); Thu, 30 Apr 2020 18:06:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727955AbgD3WGy (ORCPT ); Thu, 30 Apr 2020 18:06:54 -0400 Received: from mail-ej1-x642.google.com (mail-ej1-x642.google.com [IPv6:2a00:1450:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB50BC035494; Thu, 30 Apr 2020 15:06:53 -0700 (PDT) Received: by mail-ej1-x642.google.com with SMTP id gr25so5993830ejb.10; Thu, 30 Apr 2020 15:06:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=W0fkUJMBdFal40rBs7rtc2OpGG15AYOz1Qr+RHMHFzg=; b=agIJz6xxdv5fpQ00hpqSrhBa7lz7Qbxc7OxLHBljF+YfHjZG3rFWohLZYgWLGtfa8C 6a7nOEDuectluGxfouvEMzv2UeStA8voJcIrYcQUMgqIaSdFW5Y/jaUWscafm32ZRvUw /bWgHYlytxX5Dnx636gCPtG4vnrzccV9MJIpbQqNlbh1ljyJ/0Vzmrz4orTflrq1pZcB j5Ml9F3x2QjOFMNSklEwxZUltVX7R30Ffz8m0+xlOcwTkT7EpPNk5qno9RxSb6CMnfN9 t/kt0dCXJ3wo1obDzZXSnGa7vHp74TBGJBMEpCD+wLIhIhSYCgbT+GltQmRaGCAy2U0m HrLQ== 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=W0fkUJMBdFal40rBs7rtc2OpGG15AYOz1Qr+RHMHFzg=; b=lxY4do22Zhs4nXXHuC4W4k4OILJUnctEUuecluRPgXyVct+EPdG/8V9gJTMe/+5oab AYYLnCKK5SU/686olb5XLwuU/Nz6s8+ovbtenJn7KV00uyV8o6csBVVVHqCuK2tZF5Vv 1j61UPUo5laDIlSb9TuWlWb2P+mPABWJMjmnmlw2Qjrbb1g+iO5qXoT5N8+4FYRjNdDd a0DdYG6ultICrr8oAN3ddswTEY5k7Ga0neqJxG9p/cWyogoXaZKyd/0GlitiT5CuJDU9 9mfFqFQfTDkqHnbWWZhHxg/mt9c/kPOgZtuRwOWNzxO658S1eXgELBOYHj4ZlgHXT8KW B38g== X-Gm-Message-State: AGi0PuY2sITru/kQHi44jYnEYBIoPpyssq42l5CiLDTmpjor/Fmh2l3t aqs17z9TwobWDUUmvA+/e3c= X-Google-Smtp-Source: APiQypLOXRJf5iIfx72iQWrXo/VOvuT8bdMzp9X2RxLhB5EEdcb3Ce3il0Zr0B6dBXKgsU+mWsrAfQ== X-Received: by 2002:a17:906:6411:: with SMTP id d17mr559183ejm.109.1588284412512; Thu, 30 Apr 2020 15:06:52 -0700 (PDT) Received: from Ansuel-XPS.localdomain ([79.37.253.240]) by smtp.googlemail.com with ESMTPSA id t17sm54185edq.88.2020.04.30.15.06.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2020 15:06:51 -0700 (PDT) From: Ansuel Smith To: Bjorn Andersson Cc: Ansuel Smith , stable@vger.kernel.org, Andy Gross , Bjorn Helgaas , Rob Herring , Mark Rutland , Stanimir Varbanov , Lorenzo Pieralisi , Andrew Murray , Philipp Zabel , linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 07/11] PCI: qcom: add support for defining some PARF params Date: Fri, 1 May 2020 00:06:14 +0200 Message-Id: <20200430220619.3169-8-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200430220619.3169-1-ansuelsmth@gmail.com> References: <20200430220619.3169-1-ansuelsmth@gmail.com> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Add support for Tx De-Emphasis, Tx Swing and Rx equalization definition needed on some ipq8064 based device (Netgear R7800 for example). This cause a total lock of the system on kernel load. Fixes: 82a823833f4e PCI: qcom: Add Qualcomm PCIe controller driver Signed-off-by: Ansuel Smith Cc: stable@vger.kernel.org # v4.5+ --- drivers/pci/controller/dwc/pcie-qcom.c | 47 ++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c index a4fd5baada34..da8058fd1925 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -46,6 +46,9 @@ #define PCIE20_PARF_PHY_CTRL 0x40 #define PCIE20_PARF_PHY_REFCLK 0x4C +#define PHY_REFCLK_SSP_EN BIT(16) +#define PHY_REFCLK_USE_PAD BIT(12) + #define PCIE20_PARF_DBI_BASE_ADDR 0x168 #define PCIE20_PARF_SLV_ADDR_SPACE_SIZE 0x16C #define PCIE20_PARF_MHI_CLOCK_RESET_CTRL 0x174 @@ -77,6 +80,18 @@ #define DBI_RO_WR_EN 1 #define PERST_DELAY_US 1000 +/* PARF registers */ +#define PCIE20_PARF_PCS_DEEMPH 0x34 +#define PCS_DEEMPH_TX_DEEMPH_GEN1(x) ((x) << 16) +#define PCS_DEEMPH_TX_DEEMPH_GEN2_3_5DB(x) ((x) << 8) +#define PCS_DEEMPH_TX_DEEMPH_GEN2_6DB(x) ((x) << 0) + +#define PCIE20_PARF_PCS_SWING 0x38 +#define PCS_SWING_TX_SWING_FULL(x) ((x) << 8) +#define PCS_SWING_TX_SWING_LOW(x) ((x) << 0) + +#define PCIE20_PARF_CONFIG_BITS 0x50 +#define PHY_RX0_EQ(x) ((x) << 24) #define PCIE20_v3_PARF_SLV_ADDR_SPACE_SIZE 0x358 #define SLV_ADDR_SPACE_SZ 0x10000000 @@ -97,6 +112,12 @@ struct qcom_pcie_resources_2_1_0 { struct reset_control *phy_reset; struct reset_control *ext_reset; struct regulator_bulk_data supplies[QCOM_PCIE_2_1_0_MAX_SUPPLY]; + u32 tx_deemph_gen1; + u32 tx_deemph_gen2_3p5db; + u32 tx_deemph_gen2_6db; + u32 tx_swing_full; + u32 tx_swing_low; + u32 rx0_eq; }; struct qcom_pcie_resources_1_0_0 { @@ -234,8 +255,21 @@ static int qcom_pcie_get_resources_2_1_0(struct qcom_pcie *pcie) struct qcom_pcie_resources_2_1_0 *res = &pcie->res.v2_1_0; struct dw_pcie *pci = pcie->pci; struct device *dev = pci->dev; + struct device_node *node = dev->of_node; int ret; + of_property_read_u32(node, "qcom,tx-deemph-gen1", + &res->tx_deemph_gen1); + of_property_read_u32(node, "qcom,tx-deemph-gen2-3p5db", + &res->tx_deemph_gen2_3p5db); + of_property_read_u32(node, "qcom,tx-deemph-gen2-6db", + &res->tx_deemph_gen2_6db); + of_property_read_u32(node, "qcom,tx-swing-full", + &res->tx_swing_full); + of_property_read_u32(node, "qcom,tx-swing-low", + &res->tx_swing_low); + of_property_read_u32(node, "qcom,rx0-eq", &res->rx0_eq); + res->supplies[0].supply = "vdda"; res->supplies[1].supply = "vdda_phy"; res->supplies[2].supply = "vdda_refclk"; @@ -368,9 +402,18 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie) /* enable PCIe clocks and resets */ qcom_clear_and_set_dword(pcie->parf + PCIE20_PARF_PHY_CTRL, BIT(0), 0); + writel(PCS_DEEMPH_TX_DEEMPH_GEN1(res->tx_deemph_gen1) | + PCS_DEEMPH_TX_DEEMPH_GEN2_3_5DB(res->tx_deemph_gen2_3p5db) | + PCS_DEEMPH_TX_DEEMPH_GEN2_6DB(res->tx_deemph_gen2_6db), + pcie->parf + PCIE20_PARF_PCS_DEEMPH); + writel(PCS_SWING_TX_SWING_FULL(res->tx_swing_full) | + PCS_SWING_TX_SWING_LOW(res->tx_swing_low), + pcie->parf + PCIE20_PARF_PCS_SWING); + writel(PHY_RX0_EQ(res->rx0_eq), pcie->parf + PCIE20_PARF_CONFIG_BITS); + /* enable external reference clock */ - qcom_clear_and_set_dword(pcie->parf + PCIE20_PARF_PHY_REFCLK, 0, - BIT(16)); + qcom_clear_and_set_dword(pcie->parf + PCIE20_PARF_PHY_REFCLK, + PHY_REFCLK_USE_PAD, PHY_REFCLK_SSP_EN; ret = reset_control_deassert(res->phy_reset); if (ret) { From patchwork Thu Apr 30 22:06:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 11521751 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7B652913 for ; Thu, 30 Apr 2020 22:07:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6413421775 for ; Thu, 30 Apr 2020 22:06:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="msohcg/+" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728023AbgD3WG6 (ORCPT ); Thu, 30 Apr 2020 18:06:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728003AbgD3WG4 (ORCPT ); Thu, 30 Apr 2020 18:06:56 -0400 Received: from mail-ej1-x644.google.com (mail-ej1-x644.google.com [IPv6:2a00:1450:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B1EAC035494; Thu, 30 Apr 2020 15:06:56 -0700 (PDT) Received: by mail-ej1-x644.google.com with SMTP id q8so6016743eja.2; Thu, 30 Apr 2020 15:06:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=w1PEB75T9vhNli8IGbA8jki4mGo4pTtbkW42Phxv8eA=; b=msohcg/+zvVBWBp/LV/9TYGzKCx1tBKTA3R8ykh2656KuiULAoYBq/qDQWNyhp7bUB vnKvsVh3EYMDBjtiVoXT20Qhqvq9OadqGjNJTqJqUPc4dpp9qUs5C/CSCeSs6C56gjGv g22quSEm9H3XO/Bq6DKicQF30fbP700QU60s7m0LKlPYw6J7q9sAzocqqPi47QDTLHq7 e+1bcU68cj6yWpQMSZBfRvVBqx/yPPhG0hjzgDJZyuzy1unoKkidIdl6XwZGvMvZWeTE kT2mB+eguVoUmDll/o3IOK0VN0eMfEHMKnIEkQJTnnsIBLZ6Yi+MJl9e4E6WllD2bcaQ uRlQ== 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=w1PEB75T9vhNli8IGbA8jki4mGo4pTtbkW42Phxv8eA=; b=FWaYOYcVrnjDKCbpyIs2CZMi5BmrYTdjJKPn1xrGJhX2UDK3a83qjinIW+mbSjqFs7 GOHJZy8e7yKtrJfq+bczpFyd3BXCvQp1/cF0AuEirFQ5FF000QTkFcaUe7AJnFrjIY1Y ZMUuohlzsK4cFHLV2hhLG19zDTq74XmzncgFtVHUYDviImrM05uuIUkKJ76EitpnWl95 +8w44zDbWvPB+RZA0ez8GWkS77oBx9BNk4Yx/cUdOEC7M7EBf2BqXgbmvzeWF9GlQgkU gZMlQGni8opMmrDEhTHU60R4fwZGXxo0QDJ0DXdIFHE0dlwrBduhbAZmdC1pq+wWRwPK TRxQ== X-Gm-Message-State: AGi0PubemePKCcSzq4ihBIp+xUgBClP6YndZZTM+/IDuiRGyCc3u6mm0 2X5ndtd4B5Fh1sUz7caarqI= X-Google-Smtp-Source: APiQypKuDx3EydaEc0EcG2mW6wzDegIebMGM0I462nb1cc/jtaFvAb/PfwIeFV24N7HZ4h6JEs6Plg== X-Received: by 2002:a17:906:4dc8:: with SMTP id f8mr573477ejw.23.1588284415074; Thu, 30 Apr 2020 15:06:55 -0700 (PDT) Received: from Ansuel-XPS.localdomain ([79.37.253.240]) by smtp.googlemail.com with ESMTPSA id t17sm54185edq.88.2020.04.30.15.06.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2020 15:06:54 -0700 (PDT) From: Ansuel Smith To: Bjorn Andersson Cc: Ansuel Smith , Andy Gross , Bjorn Helgaas , Rob Herring , Mark Rutland , Stanimir Varbanov , Lorenzo Pieralisi , Andrew Murray , Philipp Zabel , linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 08/11] devicetree: bindings: pci: document PARF params bindings Date: Fri, 1 May 2020 00:06:15 +0200 Message-Id: <20200430220619.3169-9-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200430220619.3169-1-ansuelsmth@gmail.com> References: <20200430220619.3169-1-ansuelsmth@gmail.com> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org It is now supported the editing of Tx De-Emphasis, Tx Swing and Rx equalization params on ipq8064. Document this new optional params. Signed-off-by: Ansuel Smith --- .../devicetree/bindings/pci/qcom,pcie.txt | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/Documentation/devicetree/bindings/pci/qcom,pcie.txt b/Documentation/devicetree/bindings/pci/qcom,pcie.txt index 6efcef040741..8cc5aea8a1da 100644 --- a/Documentation/devicetree/bindings/pci/qcom,pcie.txt +++ b/Documentation/devicetree/bindings/pci/qcom,pcie.txt @@ -254,6 +254,42 @@ - "perst-gpios" PCIe endpoint reset signal line - "wake-gpios" PCIe endpoint wake signal line +- qcom,tx-deemph-gen1: + Usage: optional (available for ipq/apq8064) + Value type: + Definition: Gen1 De-emphasis value. + For ipq806x should be set to 24. + +- qcom,tx-deemph-gen2-3p5db: + Usage: optional (available for ipq/apq8064) + Value type: + Definition: Gen2 (3.5db) De-emphasis value. + For ipq806x should be set to 24. + +- qcom,tx-deemph-gen2-6db: + Usage: optional (available for ipq/apq8064) + Value type: + Definition: Gen2 (6db) De-emphasis value. + For ipq806x should be set to 34. + +- qcom,tx-swing-full: + Usage: optional (available for ipq/apq8064) + Value type: + Definition: TX launch amplitude swing_full value. + For ipq806x should be set to 120. + +- qcom,tx-swing-low: + Usage: optional (available for ipq/apq8064) + Value type: + Definition: TX launch amplitude swing_low value. + For ipq806x should be set to 120. + +- qcom,rx0-eq: + Usage: optional (available for ipq/apq8064) + Value type: + Definition: RX0 equalization value. + For ipq806x should be set to 4. + * Example for ipq/apq8064 pcie@1b500000 { compatible = "qcom,pcie-apq8064", "qcom,pcie-ipq8064", "snps,dw-pcie"; From patchwork Thu Apr 30 22:06:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 11521763 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A520B912 for ; Thu, 30 Apr 2020 22:07:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8B7AC24955 for ; Thu, 30 Apr 2020 22:07:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="c5CYdiZZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728045AbgD3WHB (ORCPT ); Thu, 30 Apr 2020 18:07:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728039AbgD3WG7 (ORCPT ); Thu, 30 Apr 2020 18:06:59 -0400 Received: from mail-ej1-x642.google.com (mail-ej1-x642.google.com [IPv6:2a00:1450:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59429C035494; Thu, 30 Apr 2020 15:06:59 -0700 (PDT) Received: by mail-ej1-x642.google.com with SMTP id s3so6017667eji.6; Thu, 30 Apr 2020 15:06:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=p5qwOdOjBM0kR3h5Ux00+NLqsBpbJPVpfGyfoBvZ0KU=; b=c5CYdiZZeep2K6qtPUqzur442gkAeLpmaznc9LJNKtnDY06F+DPUTIgjpf+0VNDeEc WV41w4nGCCBTsAnaRozUjiWqtmYyufG1BADcu/c/Yoe3+5/2U44N87u+FghlfBGkkHML a2qc51oGITjmf5QQMmqZRip+7UdC5YyQhe2LxbBLesBgTLu73zkmd9sa2QHxriHG8+FP n54Cy99LdxFGl35iKumefOEkTEkIqK0AAiZ/Th664L7KXr7pcTYHVfjuZqye9s80VCnf TivfTQTuisO3pn4ncaCOJJRHM0pprwhqKohaCrE8fBqQWsFDQ7aajqDHyKSOttcKd2Dn Tvjg== 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=p5qwOdOjBM0kR3h5Ux00+NLqsBpbJPVpfGyfoBvZ0KU=; b=adpUytGkKUTV9V9xd46liMfPEQDMmPB5am+hoE22IvNOVxUNs5ZyShsQhCQUFzRxZ2 hgFuwhnb1Qfs1FuaZJBhVBA8m9tS3Wj6/GNPbYbZTEsMqeMHT0Ps744pEn3Ty3YaExuv LYrRExvNFeDf6LKYw0zOI9n7EVb1JxeBsgiMxjjztCCcqi7AgxwOV/XC7DuByoDhgTqQ u7mVW6sxuN1JFRWbhLtvdGYM/mToYHXeKmEPN9DzxFRELBTdzV8jlk9b96g8KoN5wvYR 8aRQPkLhBqVmTFvoXTgB8XPmeq2UtQGF6g5ehzLwP8JlGmCCwRiPcG2OdZ4jPZlToxAi 0dAA== X-Gm-Message-State: AGi0PuaOQWG9k7MqjUQzO5yAbmj+L3wR0HHtDbglMFpth5JFZaaH3A1p hLxL94zMT/Qcn/X0HthvMzA= X-Google-Smtp-Source: APiQypLsfhnbzhYBF4ojiBpUSjb/Wnjy30KMuPcOEgMymuyUa0nQMhfoim7Tbvd/6YROw9VY3sQqMA== X-Received: by 2002:a17:906:1199:: with SMTP id n25mr623646eja.30.1588284418018; Thu, 30 Apr 2020 15:06:58 -0700 (PDT) Received: from Ansuel-XPS.localdomain ([79.37.253.240]) by smtp.googlemail.com with ESMTPSA id t17sm54185edq.88.2020.04.30.15.06.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2020 15:06:57 -0700 (PDT) From: Ansuel Smith To: Bjorn Andersson Cc: Sham Muthayyan , Ansuel Smith , Andy Gross , Bjorn Helgaas , Rob Herring , Mark Rutland , Stanimir Varbanov , Lorenzo Pieralisi , Andrew Murray , Philipp Zabel , linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 09/11] PCI: qcom: add ipq8064 rev2 variant and set tx term offset Date: Fri, 1 May 2020 00:06:16 +0200 Message-Id: <20200430220619.3169-10-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200430220619.3169-1-ansuelsmth@gmail.com> References: <20200430220619.3169-1-ansuelsmth@gmail.com> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Sham Muthayyan Add tx term offset support to pcie qcom driver need in some revision of the ipq806x SoC. Ipq8064 have tx term offset set to 7. Ipq8064-v2 revision and ipq8065 have the tx term offset set to 0. Signed-off-by: Sham Muthayyan Signed-off-by: Ansuel Smith --- drivers/pci/controller/dwc/pcie-qcom.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c index da8058fd1925..372d2c8508b5 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -45,6 +45,9 @@ #define PCIE_CAP_CPL_TIMEOUT_DISABLE 0x10 #define PCIE20_PARF_PHY_CTRL 0x40 +#define PHY_CTRL_PHY_TX0_TERM_OFFSET_MASK GENMASK(12, 16) +#define PHY_CTRL_PHY_TX0_TERM_OFFSET(x) ((x) << 16) + #define PCIE20_PARF_PHY_REFCLK 0x4C #define PHY_REFCLK_SSP_EN BIT(16) #define PHY_REFCLK_USE_PAD BIT(12) @@ -118,6 +121,7 @@ struct qcom_pcie_resources_2_1_0 { u32 tx_swing_full; u32 tx_swing_low; u32 rx0_eq; + u8 phy_tx0_term_offset; }; struct qcom_pcie_resources_1_0_0 { @@ -318,6 +322,11 @@ static int qcom_pcie_get_resources_2_1_0(struct qcom_pcie *pcie) if (IS_ERR(res->ext_reset)) return PTR_ERR(res->ext_reset); + if (of_device_is_compatible(dev->of_node, "qcom,pcie-ipq8064")) + res->phy_tx0_term_offset = 7; + else + res->phy_tx0_term_offset = 0; + res->phy_reset = devm_reset_control_get_exclusive(dev, "phy"); return PTR_ERR_OR_ZERO(res->phy_reset); } @@ -402,6 +411,11 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie) /* enable PCIe clocks and resets */ qcom_clear_and_set_dword(pcie->parf + PCIE20_PARF_PHY_CTRL, BIT(0), 0); + /* set TX termination offset */ + qcom_clear_and_set_dword(pcie->parf + PCIE20_PARF_PHY_CTRL, + PHY_CTRL_PHY_TX0_TERM_OFFSET_MASK, + PHY_CTRL_PHY_TX0_TERM_OFFSET(res->phy_tx0_term_offset)); + writel(PCS_DEEMPH_TX_DEEMPH_GEN1(res->tx_deemph_gen1) | PCS_DEEMPH_TX_DEEMPH_GEN2_3_5DB(res->tx_deemph_gen2_3p5db) | PCS_DEEMPH_TX_DEEMPH_GEN2_6DB(res->tx_deemph_gen2_6db), @@ -1485,6 +1499,7 @@ static int qcom_pcie_probe(struct platform_device *pdev) static const struct of_device_id qcom_pcie_match[] = { { .compatible = "qcom,pcie-apq8084", .data = &ops_1_0_0 }, { .compatible = "qcom,pcie-ipq8064", .data = &ops_2_1_0 }, + { .compatible = "qcom,pcie-ipq8064-v2", .data = &ops_2_1_0 }, { .compatible = "qcom,pcie-apq8064", .data = &ops_2_1_0 }, { .compatible = "qcom,pcie-msm8996", .data = &ops_2_3_2 }, { .compatible = "qcom,pcie-ipq8074", .data = &ops_2_3_3 }, From patchwork Thu Apr 30 22:06:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 11521761 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 177F9912 for ; Thu, 30 Apr 2020 22:07:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F1C912495C for ; Thu, 30 Apr 2020 22:07:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dTiaPueO" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728068AbgD3WHE (ORCPT ); Thu, 30 Apr 2020 18:07:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728057AbgD3WHC (ORCPT ); Thu, 30 Apr 2020 18:07:02 -0400 Received: from mail-ed1-x542.google.com (mail-ed1-x542.google.com [IPv6:2a00:1450:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 444ABC035494; Thu, 30 Apr 2020 15:07:02 -0700 (PDT) Received: by mail-ed1-x542.google.com with SMTP id j20so5862341edj.0; Thu, 30 Apr 2020 15:07:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GGrIxEWXzwehaT8FT6nKgZsnpuz5Dtb8eh67YeQzlak=; b=dTiaPueOgnv9OLXqJI/ei6m0H+zbohSlQpPWh9F00TKRMLYRfVSL3OmhnS5opLb1gy wSmzPYcQURJuS1Izkj7IZNS3Ard3eB1+Zg48flNUz6BL1U9o0G4aZ6+j02CBbwC8R7Pt e5WxXfY9/I5mJdeRXCiFLlYVYUY5yZdLTw+9VkN/jYzTtAGjFOxJ2/+12WtkvmbbKlL4 mVi24cTsQuD0jQia5yduBtzwHXecH/h9IQZO0C8jDl3L5bfDE1DkdJFFFuL5/Hb/f33c wSb8mEZzAt3GgAFe8r78K9ReFW7jEBdr06TKMTpAIvPSoIavMyzJcRuxwg1JRX2RraOl SEvA== 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=GGrIxEWXzwehaT8FT6nKgZsnpuz5Dtb8eh67YeQzlak=; b=MYrAo9m5OMAcSJwEyZ5o//VD/Z/gnlD20X6vEOsXo1pyx7Jt0eKqqJCzRUQZ6RDuIp 43ZkSRvKnvDKNGtHT9I6bOPt3gl40IHzOLN4xO7opFuufUOGJ46/je8CreSqJfClbaRv ccoyYrGeWZ/MomZvu4qJ7zEmguen7AcnQg0Px14YU8BRReRAgbR845jQoJsITuh9ULiY AUvrsvNu0zN5oPB2cOzFXUyio49vDLRmC4XC7rcEpDW4Yy2zZgMjVl45rKzIFvjN5qVy MgFLXGoU+gtV4kL8PSLHNgNTsbUyQcGC0OCFj/ZcQkMF5SlODzZS2cQ4VvBOWQfSO+Yl 5D/A== X-Gm-Message-State: AGi0PuZoDW2bM7/PwvjawVC7iLaefIIyvYRAvMjxjDmkKl1VcXu9M6z+ 6+ArYlPfROorO3n38d+Jxus= X-Google-Smtp-Source: APiQypItUbxWgaRfatqnrsd/zwXmNIzwpBaKlQdKxT0/vx7UfHE9/vUciN0g9dr6vwxiR2AXULY1JA== X-Received: by 2002:a50:874b:: with SMTP id 11mr1047142edv.384.1588284420954; Thu, 30 Apr 2020 15:07:00 -0700 (PDT) Received: from Ansuel-XPS.localdomain ([79.37.253.240]) by smtp.googlemail.com with ESMTPSA id t17sm54185edq.88.2020.04.30.15.06.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2020 15:07:00 -0700 (PDT) From: Ansuel Smith To: Bjorn Andersson Cc: Ansuel Smith , Andy Gross , Bjorn Helgaas , Rob Herring , Mark Rutland , Stanimir Varbanov , Lorenzo Pieralisi , Andrew Murray , Philipp Zabel , linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 10/11] devicetree: bindings: pci: add ipq8064 rev 2 variant to qcom,pcie Date: Fri, 1 May 2020 00:06:17 +0200 Message-Id: <20200430220619.3169-11-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200430220619.3169-1-ansuelsmth@gmail.com> References: <20200430220619.3169-1-ansuelsmth@gmail.com> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Document qcom,pcie-ipq8064-v2 needed to use different phy_tx0_term_offset. In ipq8064 phy_tx0_term_offset is 7. In ipq8064 v2 other SoC it's set to 0 by default. Signed-off-by: Ansuel Smith Acked-by: Rob Herring --- Documentation/devicetree/bindings/pci/qcom,pcie.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/pci/qcom,pcie.txt b/Documentation/devicetree/bindings/pci/qcom,pcie.txt index 8cc5aea8a1da..c7102863d855 100644 --- a/Documentation/devicetree/bindings/pci/qcom,pcie.txt +++ b/Documentation/devicetree/bindings/pci/qcom,pcie.txt @@ -5,6 +5,7 @@ Value type: Definition: Value should contain - "qcom,pcie-ipq8064" for ipq8064 + - "qcom,pcie-ipq8064-v2" for ipq8064 rev 2 or ipq8065 - "qcom,pcie-apq8064" for apq8064 - "qcom,pcie-apq8084" for apq8084 - "qcom,pcie-msm8996" for msm8996 or apq8096 From patchwork Thu Apr 30 22:06:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 11521757 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 32CEF912 for ; Thu, 30 Apr 2020 22:07:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 191DD214D8 for ; Thu, 30 Apr 2020 22:07:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bhmK4NgX" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728083AbgD3WHG (ORCPT ); Thu, 30 Apr 2020 18:07:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728075AbgD3WHF (ORCPT ); Thu, 30 Apr 2020 18:07:05 -0400 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3432AC035494; Thu, 30 Apr 2020 15:07:05 -0700 (PDT) Received: by mail-ej1-x643.google.com with SMTP id gr25so5994238ejb.10; Thu, 30 Apr 2020 15:07:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=W5A/crgfZBL8YxYLkhsNHl2s+K8l8jm+GhQ951aW+/A=; b=bhmK4NgXPzg+9b2pTOX7XMP/8EMjfOr97em1PZUZZXthc6eMXBGfuItM+KkSQhVpcF W7IIcBrQYURVrkZG1CaFst8mjutMNOKwDPVEWr7ff2McocuUlPz2yyZ3BGOBVEUeK4/9 sBu0ua1seONVYb5fq93X6RP3WbVv6pImCErSiG6orXkOmFmTDepfVmQV9cfu0N2ULAMr dmNEVP7UhsFWNot3hmrq0G7sW+2+iczzDnEvMWAXbCFagqTe0GsYFM5f2RKgNC7MnZQV hAiOHn1Xkod++cixNMgfXyE8hCsfxYMDddOVCUrH623VmHeVXjseSc1nurTr/go0gnUk sbGQ== 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=W5A/crgfZBL8YxYLkhsNHl2s+K8l8jm+GhQ951aW+/A=; b=PzFAsfW4yyQ5chCFc4avwg/Ler6drwzaR1xnRqXzdd31MW6TtHfsO9aK+LzAOmFd9S t5qO3By8CSdShQ8enq8SNCssy4df2XgRpRSHf27pQeYImxbfN6qbB0hLbrd6NeS1tcHZ j900TyKIKo4pULSKNWhpt00LwJDzhk2VBNYBhz5hhmjat6UgWU4OvMGy35yo4uW+RB6H qb6OMdF5/h0XQP60UE/77vBCzlpGkff2pJCZSSVB/2+363Zam3v7HPf/MYtPQ8+JRTqm yMS56zDD/AOq2ioB6Me/bKHyuWHyZMX7dlQD/929PxhWPiLtOce19da0LNkfiGMeNGtm hKAg== X-Gm-Message-State: AGi0PuZidYlXaYBCg8apC0w9/Q7WvE04HVgImQo0x6/UStPrTt/qqpfn hNAzGPjIelcJbkoOf+Tg/sM= X-Google-Smtp-Source: APiQypLzZJfog1vNc6Uoeh95qV8hGH+RRLoLGbJzYGzYvuO7ke/M2nr92ZgUv1ctCRRYieb/Nvolig== X-Received: by 2002:a17:906:4e50:: with SMTP id g16mr570966ejw.338.1588284423757; Thu, 30 Apr 2020 15:07:03 -0700 (PDT) Received: from Ansuel-XPS.localdomain ([79.37.253.240]) by smtp.googlemail.com with ESMTPSA id t17sm54185edq.88.2020.04.30.15.07.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2020 15:07:03 -0700 (PDT) From: Ansuel Smith To: Bjorn Andersson Cc: Sham Muthayyan , Ansuel Smith , Andy Gross , Bjorn Helgaas , Rob Herring , Mark Rutland , Stanimir Varbanov , Lorenzo Pieralisi , Andrew Murray , Philipp Zabel , linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 11/11] PCI: qcom: add Force GEN1 support Date: Fri, 1 May 2020 00:06:18 +0200 Message-Id: <20200430220619.3169-12-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200430220619.3169-1-ansuelsmth@gmail.com> References: <20200430220619.3169-1-ansuelsmth@gmail.com> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Sham Muthayyan Add Force GEN1 support needed in some ipq8064 board that needs to limit some PCIe line to gen1 for some hardware limitation. This is set by the max-link-speed binding and needed by some soc based on ipq8064. (for example Netgear R7800 router) Signed-off-by: Sham Muthayyan Signed-off-by: Ansuel Smith --- drivers/pci/controller/dwc/pcie-qcom.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c index 372d2c8508b5..a568f28645e7 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -27,6 +27,7 @@ #include #include +#include "../../pci.h" #include "pcie-designware.h" #define PCIE20_PARF_SYS_CTRL 0x00 @@ -99,6 +100,8 @@ #define PCIE20_v3_PARF_SLV_ADDR_SPACE_SIZE 0x358 #define SLV_ADDR_SPACE_SZ 0x10000000 +#define PCIE20_LNK_CONTROL2_LINK_STATUS2 0xa0 + #define DEVICE_TYPE_RC 0x4 #define QCOM_PCIE_2_1_0_MAX_SUPPLY 3 @@ -205,6 +208,7 @@ struct qcom_pcie { struct phy *phy; struct gpio_desc *reset; const struct qcom_pcie_ops *ops; + int gen; }; #define to_qcom_pcie(x) dev_get_drvdata((x)->dev) @@ -462,6 +466,11 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie) /* wait for clock acquisition */ usleep_range(1000, 1500); + if (pcie->gen == 1) { + qcom_clear_and_set_dword(pci->dbi_base + + PCIE20_LNK_CONTROL2_LINK_STATUS2, 0, 1); + } + /* Set the Max TLP size to 2K, instead of using default of 4K */ writel(CFG_REMOTE_RD_REQ_BRIDGE_SIZE_2K, @@ -1431,6 +1440,10 @@ static int qcom_pcie_probe(struct platform_device *pdev) goto err_pm_runtime_put; } + pcie->gen = of_pci_get_max_link_speed(pdev->dev.of_node); + if (pcie->gen < 0) + pcie->gen = 2; + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "parf"); pcie->parf = devm_ioremap_resource(dev, res); if (IS_ERR(pcie->parf)) {