From patchwork Fri Feb 4 14:46:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 12735147 X-Patchwork-Delegate: lorenzo.pieralisi@arm.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 563DBC4167D for ; Fri, 4 Feb 2022 14:46:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359400AbiBDOqu (ORCPT ); Fri, 4 Feb 2022 09:46:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359406AbiBDOqt (ORCPT ); Fri, 4 Feb 2022 09:46:49 -0500 Received: from mail-lj1-x234.google.com (mail-lj1-x234.google.com [IPv6:2a00:1450:4864:20::234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CD15C06173D for ; Fri, 4 Feb 2022 06:46:49 -0800 (PST) Received: by mail-lj1-x234.google.com with SMTP id z20so8833136ljo.6 for ; Fri, 04 Feb 2022 06:46:49 -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=rPkuuzEWFvZ+7dgk9RSn0ku3pRGEa9D7Qqz+AeteWoE=; b=o0+wFNvAqkVME/NNoGbBG+koZHoFJAo6KpsL0Pry9/W9mmuH9ydDbTopaaOMkLFvhX jSXlKNhOxMIcn1DLwYxR1bNZylCL3hFolh+cfybIES9AB6jEylsjGADe4F+dfUgEpeZI 7Zor5enMD0rHRP2eBPlYnImXEkLpF6ln7C0R8BbxjI3VYbjaXnSqV+GF3sjV1O2J5pKM OWJOnFiGT0FooU47Ns5KVhpyOp3B3AfAS5KZq3QFDBxWBAZx2B2CtJbZ2s8nuM5X78q9 8aD3c44ZJLWAwH29fWZDwC5jNFCfQxEPmSOFqWYxEgOISmu+LrWCdUok9xxAfADWUM1G psLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rPkuuzEWFvZ+7dgk9RSn0ku3pRGEa9D7Qqz+AeteWoE=; b=24hJEINhOF5BeO4i5DETYybcmCTdR7prxA402JbacvaZnYbJNMU+UX470M0JjInC7E uCuKS3l/Eo7LKVQk9UQz4HOyxTHeUY8pmwqyGlBufIN4zQkqDQX+TLEoOZqxGl1yI0y8 VwoYSVTEdXYw9Fw3YXmsUBH/OkSU0mCrNpxc5GckHbKlXyCEY25DQB9BsPlGPDWycwpP 4pw5SGEgAJgg2Mx0mTcsYwHk5Js24AFUDHQqV2oLfQntpOrH4bhaS5q/862NYuDhq/ge 5GwdEedJZAkzUKRcq182gHWoeS1otBrsRwdo5xX0ey3s793SluxcLiagZueTgdXC3VDi pYog== X-Gm-Message-State: AOAM533n4p6JWoUPCf0XhYHzqJW0xBgt1QwwpQvmvEZ8esTiKqr/3NiQ hc8vD6g5GLHglkd5MNp6BJSX2g== X-Google-Smtp-Source: ABdhPJyI52y6JCeoGwpRWzLaR3ogw2OKjlHYJLAxqhMrrL9Jsd86ueIxfVPjkzHz2V+eWSt9nobd/w== X-Received: by 2002:a2e:9f54:: with SMTP id v20mr2090108ljk.438.1643986007968; Fri, 04 Feb 2022 06:46:47 -0800 (PST) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id y23sm348222lfb.2.2022.02.04.06.46.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Feb 2022 06:46:47 -0800 (PST) From: Dmitry Baryshkov To: Andy Gross , Bjorn Andersson , Stanimir Varbanov , Lorenzo Pieralisi , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Michael Turquette , Stephen Boyd Cc: Bjorn Helgaas , Prasad Malisetty , Vinod Koul , linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v2 01/11] dt-bindings: pci: qcom,pcie: drop unused "pipe" clocks Date: Fri, 4 Feb 2022 17:46:35 +0300 Message-Id: <20220204144645.3016603-2-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220204144645.3016603-1-dmitry.baryshkov@linaro.org> References: <20220204144645.3016603-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org The "pipe" clock is now unused by the PCIe driver. Drop it from the bindings. Signed-off-by: Dmitry Baryshkov --- Documentation/devicetree/bindings/pci/qcom,pcie.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/Documentation/devicetree/bindings/pci/qcom,pcie.txt b/Documentation/devicetree/bindings/pci/qcom,pcie.txt index a0ae024c2d0c..da08f0f9de96 100644 --- a/Documentation/devicetree/bindings/pci/qcom,pcie.txt +++ b/Documentation/devicetree/bindings/pci/qcom,pcie.txt @@ -154,7 +154,6 @@ - "bus_slave" Slave AXI clock - "slave_q2a" Slave Q2A clock - "tbu" PCIe TBU clock - - "pipe" PIPE clock - clock-names: Usage: required for sc8180x and sm8250 @@ -167,7 +166,6 @@ - "slave_q2a" Slave Q2A clock - "tbu" PCIe TBU clock - "ddrss_sf_tbu" PCIe SF TBU clock - - "pipe" PIPE clock - resets: Usage: required From patchwork Fri Feb 4 14:46:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 12735148 X-Patchwork-Delegate: lorenzo.pieralisi@arm.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BDEC6C433EF for ; Fri, 4 Feb 2022 14:46:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359412AbiBDOqv (ORCPT ); Fri, 4 Feb 2022 09:46:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359407AbiBDOqv (ORCPT ); Fri, 4 Feb 2022 09:46:51 -0500 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B874DC061401 for ; Fri, 4 Feb 2022 06:46:50 -0800 (PST) Received: by mail-lf1-x12e.google.com with SMTP id l27so8310695lfe.1 for ; Fri, 04 Feb 2022 06:46:50 -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=MEdow9qddiDDi5ISDFCGH7oeKbC5mGu6c1RrTKNWX/Y=; b=pxis1hg/jlw5nQXur7Gh7MiTW2H9lfVjjHk8A47b24zGh1f7tHppvK+MIUPUY4OY8n Dx05ufn+XyCnJZbceeUFgovtuRPY2k1gDGOhq2ioYQHyomz3Rnp0h9kd5hKVSvBQzfPP PL3F0T6kZ2h58IXCz9UMvkAG7VlLVxmBXuQ1KfiIpmjj3DOuDJd9/C+fGcN1xkhG86Ai TViDoAn5mTZwF7UdV7ijPvQfKfKC3cSfVYeIiEeWyoHH5RSU23DC7rjz/r1XPqN+1QxX 8WTg7EHgjBkAbSs/ydMNae2elZdfh8ERGf9tdm9zE+8RPl2czDFrvQk3Ls7ik/DBEYu0 r/5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MEdow9qddiDDi5ISDFCGH7oeKbC5mGu6c1RrTKNWX/Y=; b=0cX1hbY2Y9d8koPLCT7XmzIDou0sd3YdERf721+q3yxwwoWeG3zkFXPGCgO2Z+U6RE j1Oa7up5LqM8PE62c8WRwVz+FcELwTRPJowIzoqwifwHBRrj7VwhOejbpESXfE9g6fCP eS34uC8YRNUkC+UFsWXjzyEXsCNgZVP/Q+c5CZsjQYqxGjkp9/Y+g5sOT/xCfFBNTUQ3 nn6S9vFvo931M67I1WM9bdFQSE/2t2tN/ip02ok1qtrSUC3aMKmEix67LLIAAgwjkzol +DD2KeV55FwN1xIlRYcAhTPOoYJvFvVnyB9sMnbhj3uMibdXftaqYb5PpXFe5MaimGPx JJOQ== X-Gm-Message-State: AOAM533pnnT3jWz4ZOaaT95sk2QnfD75vwXg9u0M9th6Nz27CKX/IX+5 HCPzV8vZqkSyv3c4XOs2Iapfk8PFoPWliw== X-Google-Smtp-Source: ABdhPJxuroIeSr4dcdPBz5jQ7IC0iZSdzhMqVc+7fGNygeMObTcH4hddM7moDZztQ897nFdhKsNRFw== X-Received: by 2002:ac2:5095:: with SMTP id f21mr2484888lfm.20.1643986008900; Fri, 04 Feb 2022 06:46:48 -0800 (PST) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id y23sm348222lfb.2.2022.02.04.06.46.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Feb 2022 06:46:48 -0800 (PST) From: Dmitry Baryshkov To: Andy Gross , Bjorn Andersson , Stanimir Varbanov , Lorenzo Pieralisi , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Michael Turquette , Stephen Boyd Cc: Bjorn Helgaas , Prasad Malisetty , Vinod Koul , linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, Rob Herring Subject: [PATCH v2 02/11] dt-bindings: pci: qcom: Document PCIe bindings for SM8450 Date: Fri, 4 Feb 2022 17:46:36 +0300 Message-Id: <20220204144645.3016603-3-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220204144645.3016603-1-dmitry.baryshkov@linaro.org> References: <20220204144645.3016603-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Document the PCIe DT bindings for SM8450 SoC. The PCIe IP is similar to the one used on SM8250, however unlike SM8250, PCIe0 and PCIe1 use different set of clocks, so two compatible entries are required. Reviewed-by: Rob Herring Reviewed-by: Bjorn Andersson Signed-off-by: Dmitry Baryshkov --- .../devicetree/bindings/pci/qcom,pcie.txt | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/pci/qcom,pcie.txt b/Documentation/devicetree/bindings/pci/qcom,pcie.txt index da08f0f9de96..65a1fa74e4eb 100644 --- a/Documentation/devicetree/bindings/pci/qcom,pcie.txt +++ b/Documentation/devicetree/bindings/pci/qcom,pcie.txt @@ -15,6 +15,8 @@ - "qcom,pcie-sc8180x" for sc8180x - "qcom,pcie-sdm845" for sdm845 - "qcom,pcie-sm8250" for sm8250 + - "qcom,pcie-sm8450-pcie0" for PCIe0 on sm8450 + - "qcom,pcie-sm8450-pcie1" for PCIe1 on sm8450 - "qcom,pcie-ipq6018" for ipq6018 - reg: @@ -167,6 +169,20 @@ - "tbu" PCIe TBU clock - "ddrss_sf_tbu" PCIe SF TBU clock +- clock-names: + Usage: required for sm8450-pcie0 and sm8450-pcie1 + Value type: + Definition: Should contain the following entries + - "aux" Auxiliary clock + - "cfg" Configuration clock + - "bus_master" Master AXI clock + - "bus_slave" Slave AXI clock + - "slave_q2a" Slave Q2A clock + - "tbu" PCIe TBU clock + - "ddrss_sf_tbu" PCIe SF TBU clock + - "aggre0" Aggre NoC PCIe0 AXI clock, only for sm8450-pcie0 + - "aggre1" Aggre NoC PCIe1 AXI clock + - resets: Usage: required Value type: @@ -244,7 +260,7 @@ - "ahb" AHB reset - reset-names: - Usage: required for sc8180x, sdm845 and sm8250 + Usage: required for sc8180x, sdm845, sm8250 and sm8450 Value type: Definition: Should contain the following entries - "pci" PCIe core reset From patchwork Fri Feb 4 14:46:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 12735149 X-Patchwork-Delegate: lorenzo.pieralisi@arm.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA3E2C3526C for ; Fri, 4 Feb 2022 14:46:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359416AbiBDOqx (ORCPT ); Fri, 4 Feb 2022 09:46:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359418AbiBDOqw (ORCPT ); Fri, 4 Feb 2022 09:46:52 -0500 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9763C061401 for ; Fri, 4 Feb 2022 06:46:51 -0800 (PST) Received: by mail-lf1-x129.google.com with SMTP id i34so13174744lfv.2 for ; Fri, 04 Feb 2022 06:46:51 -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=WzC5HpXXFvzcL5JJCV5CdUQEBghebML7Iv4KymTKhB8=; b=LlGIDny/EA55TFhTg851oaeX/Cc2rlp5sH8x5ErTrCVjkOoFnHprVQhSskyc0WsbP0 i3XSy8QyVmur4BxV5zsJUJvPXR/xxVl9dqgDr6wdVDeITooqBQ3qwiElkWdrPCWFwUth wxPPzIn7rZbppguWP8kSpVHvqiqI2zaSUM2PZFpmrjaIh1Tq9PzL7wGb5lkbpZgUmL8l rKU/fXTZqFRai9xvO1wsyo82Y60s9KFzJDoWvKkk9weK3YybJspeOoygJwTPMrO9fb6o /3BgI4swDEP49418dJGWI/MHb357wnFxTshltmkxLW3qXbK1QTBeXYd3/fuxCSDGL9Vg 1eRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WzC5HpXXFvzcL5JJCV5CdUQEBghebML7Iv4KymTKhB8=; b=Cnp7Lr689oCS5p9Zp/GaupPeoc13iV8QKKYPNsf1lI7Kpoex9PcCaXQPUmmaZlNoQO sV0euQBpZqNzmLljUV5k6ZvnBg234gp6Ey1JdjyLQJaq4KM49MJ2HbmQsTdxKWnH3bwh 2d3r925epgxVyggBEfJrNhQCVU5bewhy2ISq7WcQHkB8BsjEpqfpNp3WP8a8sEpG51ik 26K5B3TLyer23D9PCOuELlqmIZaRyH2fbmgcyNOM0QfDtk9fY8fAYdHo/aUj+C2aEl9e DX5c9FJ3WsQozaA2YhnLqvUUFy5/CbfeL9nrQjswtiqEbA2d57+zBt9aBWCEIFpSFJqY VX+A== X-Gm-Message-State: AOAM530GjffDFyPWC0X+ZLDYHuwCh3SRT+mg9AXBinI5Xjslpp0gyzKr NGtQLTKvfla7x9JlrSaF6p0eEsHHPrErsg== X-Google-Smtp-Source: ABdhPJwH85C7W5XjVCD0eFeRNuAE+QO5chgMKHD7xvdHOMn4osYv7rYh9XU/+jZdVfTNIPjqUskARA== X-Received: by 2002:a05:6512:308e:: with SMTP id z14mr2464804lfd.104.1643986009835; Fri, 04 Feb 2022 06:46:49 -0800 (PST) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id y23sm348222lfb.2.2022.02.04.06.46.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Feb 2022 06:46:49 -0800 (PST) From: Dmitry Baryshkov To: Andy Gross , Bjorn Andersson , Stanimir Varbanov , Lorenzo Pieralisi , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Michael Turquette , Stephen Boyd Cc: Bjorn Helgaas , Prasad Malisetty , Vinod Koul , linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v2 03/11] clk: qcom: gdsc: add support for clocks tied to the GDSC Date: Fri, 4 Feb 2022 17:46:37 +0300 Message-Id: <20220204144645.3016603-4-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220204144645.3016603-1-dmitry.baryshkov@linaro.org> References: <20220204144645.3016603-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org On newer Qualcomm platforms GCC_PCIE_n_PIPE_CLK_SRC should be controlled together with the PCIE_n_GDSC. The clock should be fed from the TCXO before switching the GDSC off and can be fed from PCIE_n_PIPE_CLK once the GDSC is on. Since commit aa9c0df98c29 ("PCI: qcom: Switch pcie_1_pipe_clk_src after PHY init in SC7280") PCIe controller driver tries to manage this on it's own, resulting in the non-optimal code. Furthermore, if the any of the drivers will have the same requirements, the code would have to be dupliacted there. Move handling of such clocks to the GDSC code, providing special GDSC type. Cc: Prasad Malisetty Signed-off-by: Dmitry Baryshkov --- drivers/clk/qcom/gdsc.c | 41 +++++++++++++++++++++++++++++++++++++++++ drivers/clk/qcom/gdsc.h | 14 ++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/drivers/clk/qcom/gdsc.c b/drivers/clk/qcom/gdsc.c index 7e1dd8ccfa38..9913d1b70947 100644 --- a/drivers/clk/qcom/gdsc.c +++ b/drivers/clk/qcom/gdsc.c @@ -45,6 +45,7 @@ #define TIMEOUT_US 500 #define domain_to_gdsc(domain) container_of(domain, struct gdsc, pd) +#define domain_to_pipe_clk_gdsc(domain) container_of(domain, struct pipe_clk_gdsc, base.pd) enum gdsc_status { GDSC_OFF, @@ -549,3 +550,43 @@ int gdsc_gx_do_nothing_enable(struct generic_pm_domain *domain) return 0; } EXPORT_SYMBOL_GPL(gdsc_gx_do_nothing_enable); + +/* + * Special operations for GDSCs with attached pipe clocks. + * The clock should be parked to safe source (tcxo) before turning off the GDSC + * and can be switched on as soon as the GDSC is on. + * + * We remove respective clock sources from clocks map and handle them manually. + */ +int gdsc_pipe_enable(struct generic_pm_domain *domain) +{ + struct pipe_clk_gdsc *sc = domain_to_pipe_clk_gdsc(domain); + int i, ret; + + ret = gdsc_enable(domain); + if (ret) + return ret; + + for (i = 0; i< sc->num_clocks; i++) + regmap_update_bits(sc->base.regmap, sc->clocks[i].reg, + BIT(sc->clocks[i].shift + sc->clocks[i].width) - BIT(sc->clocks[i].shift), + sc->clocks[i].on_value << sc->clocks[i].shift); + + return 0; +} +EXPORT_SYMBOL_GPL(gdsc_pipe_enable); + +int gdsc_pipe_disable(struct generic_pm_domain *domain) +{ + struct pipe_clk_gdsc *sc = domain_to_pipe_clk_gdsc(domain); + int i; + + for (i = sc->num_clocks - 1; i >= 0; i--) + regmap_update_bits(sc->base.regmap, sc->clocks[i].reg, + BIT(sc->clocks[i].shift + sc->clocks[i].width) - BIT(sc->clocks[i].shift), + sc->clocks[i].off_value << sc->clocks[i].shift); + + /* In case of an error do not try turning the clocks again. We can not be sure about the GDSC state. */ + return gdsc_disable(domain); +} +EXPORT_SYMBOL_GPL(gdsc_pipe_disable); diff --git a/drivers/clk/qcom/gdsc.h b/drivers/clk/qcom/gdsc.h index d7cc4c21a9d4..b1a2f0abe41c 100644 --- a/drivers/clk/qcom/gdsc.h +++ b/drivers/clk/qcom/gdsc.h @@ -68,11 +68,25 @@ struct gdsc_desc { size_t num; }; +struct pipe_clk_gdsc { + struct gdsc base; + int num_clocks; + struct { + u32 reg; + u32 shift; + u32 width; + u32 off_value; + u32 on_value; + } clocks[]; +}; + #ifdef CONFIG_QCOM_GDSC int gdsc_register(struct gdsc_desc *desc, struct reset_controller_dev *, struct regmap *); void gdsc_unregister(struct gdsc_desc *desc); int gdsc_gx_do_nothing_enable(struct generic_pm_domain *domain); +int gdsc_pipe_enable(struct generic_pm_domain *domain); +int gdsc_pipe_disable(struct generic_pm_domain *domain); #else static inline int gdsc_register(struct gdsc_desc *desc, struct reset_controller_dev *rcdev, From patchwork Fri Feb 4 14:46:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 12735150 X-Patchwork-Delegate: lorenzo.pieralisi@arm.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 523E8C4332F for ; Fri, 4 Feb 2022 14:46:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359430AbiBDOqx (ORCPT ); Fri, 4 Feb 2022 09:46:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359417AbiBDOqw (ORCPT ); Fri, 4 Feb 2022 09:46:52 -0500 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36258C061749 for ; Fri, 4 Feb 2022 06:46:52 -0800 (PST) Received: by mail-lf1-x12d.google.com with SMTP id n8so13126336lfq.4 for ; Fri, 04 Feb 2022 06:46:52 -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=4itJXUtYogtLjP/C5kuslRrxl4UhvqybVmRTOjqgGzk=; b=MHe9zlCFy+vkTW3PBcu6vL52zJprEi+YLERBnYbQKhGcQyBGJ/Pq8GfhJCt6Rx9dOA lxqnBlgHmrdy76qvZgMFaRbnkd/fjqyefS9sRQXkoSFfc2JtOH642XKXU313ThMzzdAw gGIMPTP3mQR0HRA6RdkXkRe8gzRThvh7RB/ODO0Wxw6gI84GSr6R2o2msPpgTtLyDAy8 dW6QhGmmiJ/toOFDCjuuuCQda1HsjY7vGXleRZ+PkTzeKAhliYR61kpU1WqjMVibRTC6 +dAeLqgHkrDTMTrB9mrvj/81rK5sMki13dH7CC7lb5uhKhfzZ1/s0stJCb9Lcvv9/dRx Xaug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4itJXUtYogtLjP/C5kuslRrxl4UhvqybVmRTOjqgGzk=; b=BP7BaFOY+nwetO3R5AQfFas1mpvajpt6LPoTKqbaw47DKF9BPeNm4sX6UMljh0byXu 7u8pa4gHZSX5MA6bsMMdX7BWqLjh7xIkTWfjaIXZThbG88i2p7J1TY2wiUiMfFEk3+nx LINIflkc/iZ5ZE4x3ar0XTdbZl+ltZ1HwKG44yFHGZFQ0qowOI6r1CehINShkNFgnnq7 APsBMge1D32rihhP/qoVAGqlKEFoY2cHm29X6gECZ4t+W0EMwdlVvoLmuqxcM30aH8Qp VZp6qMEwr5W/wP7cigBAcemHo2fC9/apWisJ2DSODv3ETu9HamiNEXlz3D5vlZ4QHQtP 6wmA== X-Gm-Message-State: AOAM530iO816qf36qvDcvXel7+JdRiSeOgZ+51IJbG9sgLW80sLIvHqM d2+TPkXCsE/cX16I65/o2aKC+w== X-Google-Smtp-Source: ABdhPJxP9osAP8Paagwb19g2FhSJKpP3HNDj150cw/KJOYE6z151czlCbpyDUrW8QSsUZ9Q0f4gKUg== X-Received: by 2002:a05:6512:33d2:: with SMTP id d18mr2596891lfg.370.1643986010575; Fri, 04 Feb 2022 06:46:50 -0800 (PST) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id y23sm348222lfb.2.2022.02.04.06.46.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Feb 2022 06:46:50 -0800 (PST) From: Dmitry Baryshkov To: Andy Gross , Bjorn Andersson , Stanimir Varbanov , Lorenzo Pieralisi , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Michael Turquette , Stephen Boyd Cc: Bjorn Helgaas , Prasad Malisetty , Vinod Koul , linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v2 04/11] clk: qcom: gcc-sc7280: switch PCIe GDSCs to pipe_clk_gdsc Date: Fri, 4 Feb 2022 17:46:38 +0300 Message-Id: <20220204144645.3016603-5-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220204144645.3016603-1-dmitry.baryshkov@linaro.org> References: <20220204144645.3016603-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Change sc7280's PCIe GDSCs to use new API for managing corresponding pipe clock sources. Signed-off-by: Dmitry Baryshkov --- drivers/clk/qcom/gcc-sc7280.c | 114 ++++++++++++---------------------- 1 file changed, 40 insertions(+), 74 deletions(-) diff --git a/drivers/clk/qcom/gcc-sc7280.c b/drivers/clk/qcom/gcc-sc7280.c index 423627d49719..e88a2a2416ff 100644 --- a/drivers/clk/qcom/gcc-sc7280.c +++ b/drivers/clk/qcom/gcc-sc7280.c @@ -255,26 +255,6 @@ static const struct clk_parent_data gcc_parent_data_5[] = { { .hw = &gcc_gpll0_out_even.clkr.hw }, }; -static const struct parent_map gcc_parent_map_6[] = { - { P_PCIE_0_PIPE_CLK, 0 }, - { P_BI_TCXO, 2 }, -}; - -static const struct clk_parent_data gcc_parent_data_6[] = { - { .fw_name = "pcie_0_pipe_clk", .name = "pcie_0_pipe_clk" }, - { .fw_name = "bi_tcxo" }, -}; - -static const struct parent_map gcc_parent_map_7[] = { - { P_PCIE_1_PIPE_CLK, 0 }, - { P_BI_TCXO, 2 }, -}; - -static const struct clk_parent_data gcc_parent_data_7[] = { - { .fw_name = "pcie_1_pipe_clk", .name = "pcie_1_pipe_clk" }, - { .fw_name = "bi_tcxo" }, -}; - static const struct parent_map gcc_parent_map_8[] = { { P_BI_TCXO, 0 }, { P_GCC_GPLL0_OUT_MAIN, 1 }, @@ -369,36 +349,6 @@ static const struct clk_parent_data gcc_parent_data_15[] = { { .hw = &gcc_mss_gpll0_main_div_clk_src.clkr.hw }, }; -static struct clk_regmap_mux gcc_pcie_0_pipe_clk_src = { - .reg = 0x6b054, - .shift = 0, - .width = 2, - .parent_map = gcc_parent_map_6, - .clkr = { - .hw.init = &(struct clk_init_data){ - .name = "gcc_pcie_0_pipe_clk_src", - .parent_data = gcc_parent_data_6, - .num_parents = ARRAY_SIZE(gcc_parent_data_6), - .ops = &clk_regmap_mux_closest_ops, - }, - }, -}; - -static struct clk_regmap_mux gcc_pcie_1_pipe_clk_src = { - .reg = 0x8d054, - .shift = 0, - .width = 2, - .parent_map = gcc_parent_map_7, - .clkr = { - .hw.init = &(struct clk_init_data){ - .name = "gcc_pcie_1_pipe_clk_src", - .parent_data = gcc_parent_data_7, - .num_parents = ARRAY_SIZE(gcc_parent_data_7), - .ops = &clk_regmap_mux_closest_ops, - }, - }, -}; - static struct clk_regmap_mux gcc_ufs_phy_rx_symbol_0_clk_src = { .reg = 0x77058, .shift = 0, @@ -1757,10 +1707,6 @@ static struct clk_branch gcc_pcie_0_pipe_clk = { .enable_mask = BIT(4), .hw.init = &(struct clk_init_data){ .name = "gcc_pcie_0_pipe_clk", - .parent_hws = (const struct clk_hw*[]){ - &gcc_pcie_0_pipe_clk_src.clkr.hw, - }, - .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, }, @@ -1847,10 +1793,6 @@ static struct clk_branch gcc_pcie_1_pipe_clk = { .enable_mask = BIT(30), .hw.init = &(struct clk_init_data){ .name = "gcc_pcie_1_pipe_clk", - .parent_hws = (const struct clk_hw*[]){ - &gcc_pcie_1_pipe_clk_src.clkr.hw, - }, - .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, }, @@ -3113,22 +3055,48 @@ static struct clk_branch gcc_wpss_rscp_clk = { }, }; -static struct gdsc gcc_pcie_0_gdsc = { - .gdscr = 0x6b004, - .pd = { - .name = "gcc_pcie_0_gdsc", +static struct pipe_clk_gdsc gcc_pcie_0_gdsc = { + .base = { + .gdscr = 0x6b004, + .pd = { + .name = "gcc_pcie_0_gdsc", + }, + .pwrsts = PWRSTS_OFF_ON, + .flags = VOTABLE, + }, + .num_clocks = 1, + .clocks = { + { + /* gcc_pcie_0_pipe_clk_src */ + .reg = 0x6b054, + .shift = 0, + .width = 2, + .on_value = 0, + .off_value = 2, + }, }, - .pwrsts = PWRSTS_OFF_ON, - .flags = VOTABLE, }; -static struct gdsc gcc_pcie_1_gdsc = { - .gdscr = 0x8d004, - .pd = { - .name = "gcc_pcie_1_gdsc", +static struct pipe_clk_gdsc gcc_pcie_1_gdsc = { + .base = { + .gdscr = 0x8d004, + .pd = { + .name = "gcc_pcie_1_gdsc", + }, + .pwrsts = PWRSTS_OFF_ON, + .flags = VOTABLE, + }, + .num_clocks = 1, + .clocks = { + { + /* gcc_pcie_1_pipe_clk_src */ + .reg = 0x8d054, + .shift = 0, + .width = 2, + .on_value = 0, + .off_value = 2, + }, }, - .pwrsts = PWRSTS_OFF_ON, - .flags = VOTABLE, }; static struct gdsc gcc_ufs_phy_gdsc = { @@ -3244,7 +3212,6 @@ static struct clk_regmap *gcc_sc7280_clocks[] = { [GCC_PCIE_0_MSTR_AXI_CLK] = &gcc_pcie_0_mstr_axi_clk.clkr, [GCC_PCIE_0_PHY_RCHNG_CLK_SRC] = &gcc_pcie_0_phy_rchng_clk_src.clkr, [GCC_PCIE_0_PIPE_CLK] = &gcc_pcie_0_pipe_clk.clkr, - [GCC_PCIE_0_PIPE_CLK_SRC] = &gcc_pcie_0_pipe_clk_src.clkr, [GCC_PCIE_0_SLV_AXI_CLK] = &gcc_pcie_0_slv_axi_clk.clkr, [GCC_PCIE_0_SLV_Q2A_AXI_CLK] = &gcc_pcie_0_slv_q2a_axi_clk.clkr, [GCC_PCIE_1_AUX_CLK] = &gcc_pcie_1_aux_clk.clkr, @@ -3253,7 +3220,6 @@ static struct clk_regmap *gcc_sc7280_clocks[] = { [GCC_PCIE_1_MSTR_AXI_CLK] = &gcc_pcie_1_mstr_axi_clk.clkr, [GCC_PCIE_1_PHY_RCHNG_CLK_SRC] = &gcc_pcie_1_phy_rchng_clk_src.clkr, [GCC_PCIE_1_PIPE_CLK] = &gcc_pcie_1_pipe_clk.clkr, - [GCC_PCIE_1_PIPE_CLK_SRC] = &gcc_pcie_1_pipe_clk_src.clkr, [GCC_PCIE_1_SLV_AXI_CLK] = &gcc_pcie_1_slv_axi_clk.clkr, [GCC_PCIE_1_SLV_Q2A_AXI_CLK] = &gcc_pcie_1_slv_q2a_axi_clk.clkr, [GCC_PCIE_THROTTLE_CORE_CLK] = &gcc_pcie_throttle_core_clk.clkr, @@ -3391,8 +3357,8 @@ static struct clk_regmap *gcc_sc7280_clocks[] = { }; static struct gdsc *gcc_sc7280_gdscs[] = { - [GCC_PCIE_0_GDSC] = &gcc_pcie_0_gdsc, - [GCC_PCIE_1_GDSC] = &gcc_pcie_1_gdsc, + [GCC_PCIE_0_GDSC] = &gcc_pcie_0_gdsc.base, + [GCC_PCIE_1_GDSC] = &gcc_pcie_1_gdsc.base, [GCC_UFS_PHY_GDSC] = &gcc_ufs_phy_gdsc, [GCC_USB30_PRIM_GDSC] = &gcc_usb30_prim_gdsc, [GCC_USB30_SEC_GDSC] = &gcc_usb30_sec_gdsc, From patchwork Fri Feb 4 14:46:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 12735151 X-Patchwork-Delegate: lorenzo.pieralisi@arm.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2F9DC43217 for ; Fri, 4 Feb 2022 14:46:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359414AbiBDOqy (ORCPT ); Fri, 4 Feb 2022 09:46:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359406AbiBDOqx (ORCPT ); Fri, 4 Feb 2022 09:46:53 -0500 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2256BC061744 for ; Fri, 4 Feb 2022 06:46:53 -0800 (PST) Received: by mail-lf1-x12f.google.com with SMTP id o12so13029281lfg.12 for ; Fri, 04 Feb 2022 06:46:53 -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=RA4FOAXJ6P+53lO4zwbKIwRpBbTm5dltdfGX+k3V2eE=; b=x5sfI3ozKAlxUhdelqK9eLiuzuEzlBqC0o3C7D+uw3opCEHasKnK00xbTkaWsXqjEb FcMF3obutzuWjjOzOqN0BZKG7IadtamfDcsblKoGCb/9dT6Q2bt2SrwL3RrSXem1d8XM vUrbOtmCY5SaBsbC9x9SDz06O+nH4W50XL3yjF2lww8dnZOmj5EWOI9b9BKjaeZiL643 NyTiUwO3LuynQ14Vr49g8lJSRYTpVwP2sGE0GaBdBWqz2tFyfTwweh5p7XMrbt3uMy1T x7HcMwKXzL/+ZDcx2lmYZik8Di6LF0Gklq8WIN+hMA48n6HWHLFG/5u0KWAEnbFSiGXn /dHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RA4FOAXJ6P+53lO4zwbKIwRpBbTm5dltdfGX+k3V2eE=; b=wcYMnav6lfoBfT5rP9QU1lQpTzQ9vPrhVemzIKDYL/ynRVQS7sP1kHdj314TIhE5F1 1LnuniH/ZLcqY5GkONgCMXEA+yjltq6ZtRnCfZPPj6tvh/IGO6oW71BzOtyIipZA7gsc rxDfhtTCUTbJ4sgjN5VWDQ4wBfPRHcD6x7fn7YrI5etLiwg5wVMDaCtHyRnIDbCdja2e KR3hoxbhVSDsQw+aUTOqiFCTM/qlyaBK+/xg5clnY9C4M7nVqHAmDIhqbs8yk0Sf7o8Z Ox2zLjhBmv3lNPx5F+/Dm1C9BonfYBGaY19k+CKeJF04+L3krIETM7A6XELHJj8nJ8Hx MODw== X-Gm-Message-State: AOAM531XrnlVTRZV817ADDSpYmxr9dJTYDYZ1u2NJmUULBgIeuurnk7Q G8/ysaZJs+7vN53uuWeCGzbuOA== X-Google-Smtp-Source: ABdhPJwYLirTRdiKsvsmvABqTI2YLEW3Ybf8arrEfYtsZBN5BpL7an6VetIuwMXWNwVI//tECbdxkQ== X-Received: by 2002:a05:6512:3d03:: with SMTP id d3mr2518225lfv.591.1643986011409; Fri, 04 Feb 2022 06:46:51 -0800 (PST) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id y23sm348222lfb.2.2022.02.04.06.46.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Feb 2022 06:46:50 -0800 (PST) From: Dmitry Baryshkov To: Andy Gross , Bjorn Andersson , Stanimir Varbanov , Lorenzo Pieralisi , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Michael Turquette , Stephen Boyd Cc: Bjorn Helgaas , Prasad Malisetty , Vinod Koul , linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v2 05/11] clk: qcom: gcc-sm8450: switch PCIe GDSCs to pipe_clk_gdsc Date: Fri, 4 Feb 2022 17:46:39 +0300 Message-Id: <20220204144645.3016603-6-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220204144645.3016603-1-dmitry.baryshkov@linaro.org> References: <20220204144645.3016603-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Change sm8450's PCIe GDSCs to use new API for managing corresponding pipe clock sources. Signed-off-by: Dmitry Baryshkov --- drivers/clk/qcom/gcc-sm8450.c | 104 ++++++++++++++-------------------- 1 file changed, 42 insertions(+), 62 deletions(-) diff --git a/drivers/clk/qcom/gcc-sm8450.c b/drivers/clk/qcom/gcc-sm8450.c index 593a195467ff..a81456598b28 100644 --- a/drivers/clk/qcom/gcc-sm8450.c +++ b/drivers/clk/qcom/gcc-sm8450.c @@ -153,16 +153,6 @@ static const struct clk_parent_data gcc_parent_data_3[] = { { .fw_name = "bi_tcxo" }, }; -static const struct parent_map gcc_parent_map_4[] = { - { P_PCIE_0_PIPE_CLK, 0 }, - { P_BI_TCXO, 2 }, -}; - -static const struct clk_parent_data gcc_parent_data_4[] = { - { .fw_name = "pcie_0_pipe_clk", }, - { .fw_name = "bi_tcxo", }, -}; - static const struct parent_map gcc_parent_map_5[] = { { P_PCIE_1_PHY_AUX_CLK, 0 }, { P_BI_TCXO, 2 }, @@ -239,21 +229,6 @@ static const struct clk_parent_data gcc_parent_data_11[] = { { .fw_name = "bi_tcxo" }, }; -static struct clk_regmap_mux gcc_pcie_0_pipe_clk_src = { - .reg = 0x7b060, - .shift = 0, - .width = 2, - .parent_map = gcc_parent_map_4, - .clkr = { - .hw.init = &(struct clk_init_data){ - .name = "gcc_pcie_0_pipe_clk_src", - .parent_data = gcc_parent_data_4, - .num_parents = ARRAY_SIZE(gcc_parent_data_4), - .ops = &clk_regmap_mux_closest_ops, - }, - }, -}; - static struct clk_regmap_mux gcc_pcie_1_phy_aux_clk_src = { .reg = 0x9d080, .shift = 0, @@ -269,21 +244,6 @@ static struct clk_regmap_mux gcc_pcie_1_phy_aux_clk_src = { }, }; -static struct clk_regmap_mux gcc_pcie_1_pipe_clk_src = { - .reg = 0x9d064, - .shift = 0, - .width = 2, - .parent_map = gcc_parent_map_6, - .clkr = { - .hw.init = &(struct clk_init_data){ - .name = "gcc_pcie_1_pipe_clk_src", - .parent_data = gcc_parent_data_6, - .num_parents = ARRAY_SIZE(gcc_parent_data_6), - .ops = &clk_regmap_mux_closest_ops, - }, - }, -}; - static struct clk_regmap_mux gcc_ufs_phy_rx_symbol_0_clk_src = { .reg = 0x87060, .shift = 0, @@ -1546,10 +1506,6 @@ static struct clk_branch gcc_pcie_0_pipe_clk = { .enable_mask = BIT(4), .hw.init = &(struct clk_init_data){ .name = "gcc_pcie_0_pipe_clk", - .parent_data = &(const struct clk_parent_data){ - .hw = &gcc_pcie_0_pipe_clk_src.clkr.hw, - }, - .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, }, @@ -1687,10 +1643,6 @@ static struct clk_branch gcc_pcie_1_pipe_clk = { .enable_mask = BIT(30), .hw.init = &(struct clk_init_data){ .name = "gcc_pcie_1_pipe_clk", - .parent_data = &(const struct clk_parent_data){ - .hw = &gcc_pcie_1_pipe_clk_src.clkr.hw, - }, - .num_parents = 1, .flags = CLK_SET_RATE_PARENT, .ops = &clk_branch2_ops, }, @@ -2952,20 +2904,50 @@ static struct clk_branch gcc_video_axi1_clk = { }, }; -static struct gdsc pcie_0_gdsc = { - .gdscr = 0x7b004, - .pd = { - .name = "pcie_0_gdsc", +static struct pipe_clk_gdsc pcie_0_gdsc = { + .base = { + .gdscr = 0x7b004, + .pd = { + .name = "pcie_0_gdsc", + .power_on = gdsc_pipe_enable, + .power_off = gdsc_pipe_disable, + }, + .pwrsts = PWRSTS_OFF_ON, + }, + .num_clocks = 1, + .clocks = { + { + /* gcc_pcie_0_pipe_clk_src */ + .reg = 0x7b060, + .shift = 0, + .width = 2, + .on_value = 0, + .off_value = 2, + }, }, - .pwrsts = PWRSTS_OFF_ON, }; -static struct gdsc pcie_1_gdsc = { - .gdscr = 0x9d004, - .pd = { - .name = "pcie_1_gdsc", +static struct pipe_clk_gdsc pcie_1_gdsc = { + .base = { + .gdscr = 0x9d004, + .pd = { + .name = "pcie_1_gdsc", + .power_on = gdsc_pipe_enable, + .power_off = gdsc_pipe_disable, + }, + .pwrsts = PWRSTS_OFF_ON, + }, + .num_clocks = 1, + .clocks = { + { + /* gcc_pcie_1_pipe_clk_src */ + .reg = 0x9d064, + .shift = 0, + .width = 2, + .on_value = 0, + .off_value = 2, + }, }, - .pwrsts = PWRSTS_OFF_ON, }; static struct gdsc ufs_phy_gdsc = { @@ -3022,7 +3004,6 @@ static struct clk_regmap *gcc_sm8450_clocks[] = { [GCC_PCIE_0_PHY_RCHNG_CLK] = &gcc_pcie_0_phy_rchng_clk.clkr, [GCC_PCIE_0_PHY_RCHNG_CLK_SRC] = &gcc_pcie_0_phy_rchng_clk_src.clkr, [GCC_PCIE_0_PIPE_CLK] = &gcc_pcie_0_pipe_clk.clkr, - [GCC_PCIE_0_PIPE_CLK_SRC] = &gcc_pcie_0_pipe_clk_src.clkr, [GCC_PCIE_0_SLV_AXI_CLK] = &gcc_pcie_0_slv_axi_clk.clkr, [GCC_PCIE_0_SLV_Q2A_AXI_CLK] = &gcc_pcie_0_slv_q2a_axi_clk.clkr, [GCC_PCIE_1_AUX_CLK] = &gcc_pcie_1_aux_clk.clkr, @@ -3035,7 +3016,6 @@ static struct clk_regmap *gcc_sm8450_clocks[] = { [GCC_PCIE_1_PHY_RCHNG_CLK] = &gcc_pcie_1_phy_rchng_clk.clkr, [GCC_PCIE_1_PHY_RCHNG_CLK_SRC] = &gcc_pcie_1_phy_rchng_clk_src.clkr, [GCC_PCIE_1_PIPE_CLK] = &gcc_pcie_1_pipe_clk.clkr, - [GCC_PCIE_1_PIPE_CLK_SRC] = &gcc_pcie_1_pipe_clk_src.clkr, [GCC_PCIE_1_SLV_AXI_CLK] = &gcc_pcie_1_slv_axi_clk.clkr, [GCC_PCIE_1_SLV_Q2A_AXI_CLK] = &gcc_pcie_1_slv_q2a_axi_clk.clkr, [GCC_PDM2_CLK] = &gcc_pdm2_clk.clkr, @@ -3216,8 +3196,8 @@ static const struct clk_rcg_dfs_data gcc_dfs_clocks[] = { }; static struct gdsc *gcc_sm8450_gdscs[] = { - [PCIE_0_GDSC] = &pcie_0_gdsc, - [PCIE_1_GDSC] = &pcie_1_gdsc, + [PCIE_0_GDSC] = &pcie_0_gdsc.base, + [PCIE_1_GDSC] = &pcie_1_gdsc.base, [UFS_PHY_GDSC] = &ufs_phy_gdsc, [USB30_PRIM_GDSC] = &usb30_prim_gdsc, }; From patchwork Fri Feb 4 14:46:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 12735152 X-Patchwork-Delegate: lorenzo.pieralisi@arm.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03D13C35272 for ; Fri, 4 Feb 2022 14:46:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359422AbiBDOqz (ORCPT ); Fri, 4 Feb 2022 09:46:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359425AbiBDOqy (ORCPT ); Fri, 4 Feb 2022 09:46:54 -0500 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C335DC06173D for ; Fri, 4 Feb 2022 06:46:53 -0800 (PST) Received: by mail-lf1-x12b.google.com with SMTP id a28so13053564lfl.7 for ; Fri, 04 Feb 2022 06:46:53 -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=dQskIWPtgp2J5yJOwdCR4mBsDP1w2VL2nYwAV+AoOmM=; b=WSAmXb5F0p6ou1ZHNI2DrVx5lvwbHHwMQMjKOZ4cLRuhjDRMUdZidwARuayPIzv7WS qeiMX7Uqh5uMnPv4a2r9IFwd369fpG1b6HVQrwtuLpVyanDPWns7CZBoXmliEY4nxFO4 p4kZihmAgfKszYRrYElizjI233FKZtlLZKbPmIorSEYhKi81v9Z/vvuCjjwzSSg6cwCt O8bEKZwJvQ4EkKsH54CtPQ5ZMoEuD7qvkjHcpD5hSVwOxG6gO5wINiNf86qnkFncqYbs JGdsoyiQLqTbCBQtU/K38C7xbp4yQzYYYg9AvGzCslN91Rx//JbIZPVnV3qIGjhTT83P HQCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dQskIWPtgp2J5yJOwdCR4mBsDP1w2VL2nYwAV+AoOmM=; b=tlXXhRqXAOByHCzbOlXczwE9zSDmQY846adfENUambPKg6Fzehtmr8KfBMLOaoxwm8 o0ydRnROtQAW6jVjbf0UKrni6j/x6GFocddGuZmUjqrmrkdj+T/68/smUovk+evuH+wc eUnw6YZVtxWYeNGlOL21sdGLdDcfBnMtXIs6d8ltRAjd1aFuNc7sxAkIcwkpHOlZtuRx dWYUh6z+a7P6bPHhwB0bgRez85BDSJVRxmC00pqKRFua7GCulvGu/9UfmOG0RjkUjM+/ 2Gxx4EY0QLp6ImZdyfGhhWaUMBvKBSP71Na8ZIRXyojHQd0oUS2C+J73O7ryoWDwhOiH AKXQ== X-Gm-Message-State: AOAM531HgltTeKzH2otUeMj1CKHSgIr3Zvh0OTud85eH4fmfECf1uMf4 gHUbX3pllJiOkFvqSi5WxWoVBNM3FLI2jw== X-Google-Smtp-Source: ABdhPJzZH3LUnkpEthSQS9GURctNxbyh2dNi9CcuZ5NiWTYdlJ/9UUv05scCKRvk4RNOBik3l/G2CQ== X-Received: by 2002:a05:6512:118e:: with SMTP id g14mr2493286lfr.541.1643986012179; Fri, 04 Feb 2022 06:46:52 -0800 (PST) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id y23sm348222lfb.2.2022.02.04.06.46.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Feb 2022 06:46:51 -0800 (PST) From: Dmitry Baryshkov To: Andy Gross , Bjorn Andersson , Stanimir Varbanov , Lorenzo Pieralisi , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Michael Turquette , Stephen Boyd Cc: Bjorn Helgaas , Prasad Malisetty , Vinod Koul , linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v2 06/11] PCI: qcom: Balance pm_runtime_foo() calls Date: Fri, 4 Feb 2022 17:46:40 +0300 Message-Id: <20220204144645.3016603-7-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220204144645.3016603-1-dmitry.baryshkov@linaro.org> References: <20220204144645.3016603-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Fix the error path in qcom_pcie_probe(): remove extra calls to pm_runtime_disable() (which will be called at the end of error path anyway). Replace a call to pm_runtime_get_sync() with pm_runtime_resume_and_get() to end up with cleaner code. Signed-off-by: Dmitry Baryshkov --- drivers/pci/controller/dwc/pcie-qcom.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c index c19cd506ed3f..85c2ad8c551c 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -1549,9 +1549,9 @@ static int qcom_pcie_probe(struct platform_device *pdev) return -ENOMEM; pm_runtime_enable(dev); - ret = pm_runtime_get_sync(dev); + ret = pm_runtime_resume_and_get(dev); if (ret < 0) - goto err_pm_runtime_put; + goto err_pm_runtime_disable; pci->dev = dev; pci->ops = &dw_pcie_ops; @@ -1594,7 +1594,6 @@ static int qcom_pcie_probe(struct platform_device *pdev) ret = phy_init(pcie->phy); if (ret) { - pm_runtime_disable(&pdev->dev); goto err_pm_runtime_put; } @@ -1603,7 +1602,6 @@ static int qcom_pcie_probe(struct platform_device *pdev) ret = dw_pcie_host_init(pp); if (ret) { dev_err(dev, "cannot initialize host\n"); - pm_runtime_disable(&pdev->dev); goto err_pm_runtime_put; } @@ -1611,6 +1609,7 @@ static int qcom_pcie_probe(struct platform_device *pdev) err_pm_runtime_put: pm_runtime_put(dev); +err_pm_runtime_disable: pm_runtime_disable(dev); return ret; From patchwork Fri Feb 4 14:46:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 12735153 X-Patchwork-Delegate: lorenzo.pieralisi@arm.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42CFBC4707E for ; Fri, 4 Feb 2022 14:46:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359452AbiBDOq4 (ORCPT ); Fri, 4 Feb 2022 09:46:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359439AbiBDOqz (ORCPT ); Fri, 4 Feb 2022 09:46:55 -0500 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9EADC061401 for ; Fri, 4 Feb 2022 06:46:54 -0800 (PST) Received: by mail-lf1-x131.google.com with SMTP id u14so13019159lfo.11 for ; Fri, 04 Feb 2022 06:46:54 -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=wBgyM0ueC3YQnagy7358MhVbMFS9K44N5LwppvV4cJw=; b=OLh/L8svS1wtY2uPkCq8tELru5lt+F0f9Kj/kX6QOEwPxStaNSpvpRSE9YYsxSn+CA xxeigfCNT1ToVG1kuj+3c1sDnZcKQebxTyepsFdG20Ac2CJJqupoV9idBaVNb3ozWi7x nO33GILp2bpuhzadvkjzP1m3nBjbQRXHheNFdLOXHDvQPoGMsratpvCM/WtzSDXjZcq/ l4HOjc3REjcRoLfZRJD/nL7EWASITs8V4JgMk0RU/aj/oFXF+gVNt26NQvx7VG/cCSwG AiQ04K9jDlztN9fP0j1dJApehPSBgrQcG8o3hpKBxFJUubRpV+jtCl+Cga1Au3WD8k6E MW0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wBgyM0ueC3YQnagy7358MhVbMFS9K44N5LwppvV4cJw=; b=e4nD59kUw0gvFQNyiwEo018RHn+8lM9pjA0+W0y9RQ4VlFUaRYR/3JvnZsglF6ZgEu kkLEyqOMvvNl0QBn5v3rv4JDJoel/Qo5e2L53zqkP+pKp1o4I3Isi5mFeY2YDhTQnW6t LnVt4vXks+c7TFBB17AEbyxW8glD/8eAyXc1kZaCZ4qVxjKbLUg61hdbZcUFPji8Q4Ed MjPEUCuP2WiexbWRdeHovrMY/bZvlxeZr2IZazl9y1lwpmZLk0V3UM5GE/H19Icx7BoQ EsGAfU7FEC2yvnWSa0shxXzq9BLmVGwjteIFJ6cYu8qdK0kU9dDtPevUrFdOpsmP3H4g KI8A== X-Gm-Message-State: AOAM531BXKb5E8ULwzLZ5fQvHZZNygCNqtpc+u6hUaVopydSoPhMmcij oVzx5B1L1YYoXktu61Uzick4vg== X-Google-Smtp-Source: ABdhPJxrukbQNC+FZLqa/yJD+BzXVfO3Qv1E7UOK7NVSNvEWx9z68+VVlS11SIFkcVYfjfbGW1NGQQ== X-Received: by 2002:ac2:44ac:: with SMTP id c12mr2590865lfm.589.1643986013185; Fri, 04 Feb 2022 06:46:53 -0800 (PST) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id y23sm348222lfb.2.2022.02.04.06.46.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Feb 2022 06:46:52 -0800 (PST) From: Dmitry Baryshkov To: Andy Gross , Bjorn Andersson , Stanimir Varbanov , Lorenzo Pieralisi , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Michael Turquette , Stephen Boyd Cc: Bjorn Helgaas , Prasad Malisetty , Vinod Koul , linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v2 07/11] PCI: qcom: Remove unnecessary pipe_clk handling Date: Fri, 4 Feb 2022 17:46:41 +0300 Message-Id: <20220204144645.3016603-8-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220204144645.3016603-1-dmitry.baryshkov@linaro.org> References: <20220204144645.3016603-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org QMP PHY driver already does clk_prepare_enable()/_disable() pipe_clk. Remove extra calls to enable/disable this clock from the PCIe driver, so that the PHY driver can manage the clock on its own. Fixes: aa9c0df98c29 ("PCI: qcom: Switch pcie_1_pipe_clk_src after PHY init in SC7280") Signed-off-by: Dmitry Baryshkov --- drivers/pci/controller/dwc/pcie-qcom.c | 53 ++------------------------ 1 file changed, 3 insertions(+), 50 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c index 85c2ad8c551c..85e84b621dbc 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -128,7 +128,6 @@ struct qcom_pcie_resources_2_3_2 { struct clk *master_clk; struct clk *slave_clk; struct clk *cfg_clk; - struct clk *pipe_clk; struct regulator_bulk_data supplies[QCOM_PCIE_2_3_2_MAX_SUPPLY]; }; @@ -165,7 +164,6 @@ struct qcom_pcie_resources_2_7_0 { int num_clks; struct regulator_bulk_data supplies[2]; struct reset_control *pci_reset; - struct clk *pipe_clk; struct clk *pipe_clk_src; struct clk *phy_pipe_clk; struct clk *ref_clk_src; @@ -591,11 +589,7 @@ static int qcom_pcie_get_resources_2_3_2(struct qcom_pcie *pcie) return PTR_ERR(res->master_clk); res->slave_clk = devm_clk_get(dev, "bus_slave"); - if (IS_ERR(res->slave_clk)) - return PTR_ERR(res->slave_clk); - - res->pipe_clk = devm_clk_get(dev, "pipe"); - return PTR_ERR_OR_ZERO(res->pipe_clk); + return PTR_ERR_OR_ZERO(res->slave_clk); } static void qcom_pcie_deinit_2_3_2(struct qcom_pcie *pcie) @@ -610,13 +604,6 @@ static void qcom_pcie_deinit_2_3_2(struct qcom_pcie *pcie) regulator_bulk_disable(ARRAY_SIZE(res->supplies), res->supplies); } -static void qcom_pcie_post_deinit_2_3_2(struct qcom_pcie *pcie) -{ - struct qcom_pcie_resources_2_3_2 *res = &pcie->res.v2_3_2; - - clk_disable_unprepare(res->pipe_clk); -} - 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; @@ -691,22 +678,6 @@ static int qcom_pcie_init_2_3_2(struct qcom_pcie *pcie) return ret; } -static int qcom_pcie_post_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; - int ret; - - ret = clk_prepare_enable(res->pipe_clk); - if (ret) { - dev_err(dev, "cannot prepare/enable pipe clock\n"); - return ret; - } - - return 0; -} - static int qcom_pcie_get_resources_2_4_0(struct qcom_pcie *pcie) { struct qcom_pcie_resources_2_4_0 *res = &pcie->res.v2_4_0; @@ -1190,8 +1161,7 @@ static int qcom_pcie_get_resources_2_7_0(struct qcom_pcie *pcie) return PTR_ERR(res->ref_clk_src); } - res->pipe_clk = devm_clk_get(dev, "pipe"); - return PTR_ERR_OR_ZERO(res->pipe_clk); + return 0; } static int qcom_pcie_init_2_7_0(struct qcom_pcie *pcie) @@ -1230,12 +1200,6 @@ static int qcom_pcie_init_2_7_0(struct qcom_pcie *pcie) goto err_disable_clocks; } - ret = clk_prepare_enable(res->pipe_clk); - if (ret) { - dev_err(dev, "cannot prepare/enable pipe clock\n"); - goto err_disable_clocks; - } - /* configure PCIe to RC mode */ writel(DEVICE_TYPE_RC, pcie->parf + PCIE20_PARF_DEVICE_TYPE); @@ -1287,14 +1251,7 @@ static int qcom_pcie_post_init_2_7_0(struct qcom_pcie *pcie) if (pcie->pipe_clk_need_muxing) clk_set_parent(res->pipe_clk_src, res->phy_pipe_clk); - return clk_prepare_enable(res->pipe_clk); -} - -static void qcom_pcie_post_deinit_2_7_0(struct qcom_pcie *pcie) -{ - struct qcom_pcie_resources_2_7_0 *res = &pcie->res.v2_7_0; - - clk_disable_unprepare(res->pipe_clk); + return 0; } static int qcom_pcie_link_up(struct dw_pcie *pci) @@ -1444,9 +1401,7 @@ static const struct qcom_pcie_ops ops_1_0_0 = { static const struct qcom_pcie_ops ops_2_3_2 = { .get_resources = qcom_pcie_get_resources_2_3_2, .init = qcom_pcie_init_2_3_2, - .post_init = qcom_pcie_post_init_2_3_2, .deinit = qcom_pcie_deinit_2_3_2, - .post_deinit = qcom_pcie_post_deinit_2_3_2, .ltssm_enable = qcom_pcie_2_3_2_ltssm_enable, }; @@ -1473,7 +1428,6 @@ static const struct qcom_pcie_ops ops_2_7_0 = { .deinit = qcom_pcie_deinit_2_7_0, .ltssm_enable = qcom_pcie_2_3_2_ltssm_enable, .post_init = qcom_pcie_post_init_2_7_0, - .post_deinit = qcom_pcie_post_deinit_2_7_0, }; /* Qcom IP rev.: 1.9.0 */ @@ -1483,7 +1437,6 @@ static const struct qcom_pcie_ops ops_1_9_0 = { .deinit = qcom_pcie_deinit_2_7_0, .ltssm_enable = qcom_pcie_2_3_2_ltssm_enable, .post_init = qcom_pcie_post_init_2_7_0, - .post_deinit = qcom_pcie_post_deinit_2_7_0, .config_sid = qcom_pcie_config_sid_sm8250, }; From patchwork Fri Feb 4 14:46:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 12735154 X-Patchwork-Delegate: lorenzo.pieralisi@arm.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA25BC2BA4C for ; Fri, 4 Feb 2022 14:46:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359449AbiBDOq5 (ORCPT ); Fri, 4 Feb 2022 09:46:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359451AbiBDOq4 (ORCPT ); Fri, 4 Feb 2022 09:46:56 -0500 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 989ECC061756 for ; Fri, 4 Feb 2022 06:46:55 -0800 (PST) Received: by mail-lf1-x12c.google.com with SMTP id i34so13175129lfv.2 for ; Fri, 04 Feb 2022 06:46:55 -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=834ZeSQv8JRt/AoDg49+kb7R02sAA8A0g9Z5La4Rnzg=; b=CyhYJKOVMc1esvIiUcWVd5WK2YZuhualCB6ZHsuAHJ6f8hAcxs6mnd16A964xpcIbm LM8xCIn5QyLW2g0AO9oHQbC+jZazXm8TIgY7hz6cw9SPfKas77V6DDaelGfFLVGqr4O5 MXsJDqW7mGhsYquwva0a69p4p5wKQt0LjG2rPRmUHCBDeVxX8I5QvTWQqg49rYJcWOGN j0WXI4D8ChzJnrxRD51XNZk3DTkFlHA2hEHE+DCB/7e0W5aHS1+kOFPkfA9XdRvOL92W VP73gg8kQDnQIExZEH8cY++tvXzdSr8og/TWM4REA/Y3Oqfc178iE1eI1Jt9+iAHkYpA AGCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=834ZeSQv8JRt/AoDg49+kb7R02sAA8A0g9Z5La4Rnzg=; b=LJxbCupVJUals0Q7H9knv0ti8SdDblImKOfYLaCPNVkt+aEUau9qA2FMa26CSsUIuR neF8QxfB6pkYMjeHyPPWDJiilqyGoECj3ZBhZVd9mUxLTUR/LdlrutUj0tui1jZVl580 N27Iu6ICz6akqSkMoNZ27+Xp5RTxNWEFZ7XDS8r0Bybgb3nAwwwRsIap/oR47/P7fbAR 7M6CujVczuGNWqlNrYAWrjIbFZ0hqPUutviDbrvBct+uemC4GiMTb1rcGKTLTNGIJ9WY NfGKVWLp0niSSgekYvd1F5o+F3dC6mxSef2xkXlqkfPCaz0G46VMwUVsJCHsv3UhKGev hQUQ== X-Gm-Message-State: AOAM532+R+nCvwtyFauoWujyMvzGVIUvVkTxklv1btb4eA6GIRXUfeGP W3RgUgFWfdiyT6l8hcaq93UO+w== X-Google-Smtp-Source: ABdhPJx4sRd11IQeo9M/dqAxTE76YJ5x7QE8Rs6t0Opx5T30kV8t1z5SL1VMXhhmPmB12DTQgQm11Q== X-Received: by 2002:a05:6512:2215:: with SMTP id h21mr2514037lfu.570.1643986013961; Fri, 04 Feb 2022 06:46:53 -0800 (PST) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id y23sm348222lfb.2.2022.02.04.06.46.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Feb 2022 06:46:53 -0800 (PST) From: Dmitry Baryshkov To: Andy Gross , Bjorn Andersson , Stanimir Varbanov , Lorenzo Pieralisi , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Michael Turquette , Stephen Boyd Cc: Bjorn Helgaas , Prasad Malisetty , Vinod Koul , linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v2 08/11] PCI: qcom: Remove pipe_clk_src reparenting Date: Fri, 4 Feb 2022 17:46:42 +0300 Message-Id: <20220204144645.3016603-9-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220204144645.3016603-1-dmitry.baryshkov@linaro.org> References: <20220204144645.3016603-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org The SC7280 platform has switched to using GDSC wrapper for setting pipe_clk_src parent clock. Remove supporting code from the pcie-qcom driver. Cc: Prasad Malisetty Cc: Stephen Boyd Signed-off-by: Dmitry Baryshkov --- drivers/pci/controller/dwc/pcie-qcom.c | 38 -------------------------- 1 file changed, 38 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c index 85e84b621dbc..7df8632a21a8 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -164,9 +164,6 @@ struct qcom_pcie_resources_2_7_0 { int num_clks; struct regulator_bulk_data supplies[2]; struct reset_control *pci_reset; - struct clk *pipe_clk_src; - struct clk *phy_pipe_clk; - struct clk *ref_clk_src; }; union qcom_pcie_resources { @@ -192,7 +189,6 @@ struct qcom_pcie_ops { struct qcom_pcie_cfg { const struct qcom_pcie_ops *ops; - unsigned int pipe_clk_need_muxing:1; }; struct qcom_pcie { @@ -203,7 +199,6 @@ struct qcom_pcie { struct phy *phy; struct gpio_desc *reset; const struct qcom_pcie_ops *ops; - unsigned int pipe_clk_need_muxing:1; }; #define to_qcom_pcie(x) dev_get_drvdata((x)->dev) @@ -1147,20 +1142,6 @@ static int qcom_pcie_get_resources_2_7_0(struct qcom_pcie *pcie) if (ret < 0) return ret; - if (pcie->pipe_clk_need_muxing) { - res->pipe_clk_src = devm_clk_get(dev, "pipe_mux"); - if (IS_ERR(res->pipe_clk_src)) - return PTR_ERR(res->pipe_clk_src); - - res->phy_pipe_clk = devm_clk_get(dev, "phy_pipe"); - if (IS_ERR(res->phy_pipe_clk)) - return PTR_ERR(res->phy_pipe_clk); - - res->ref_clk_src = devm_clk_get(dev, "ref"); - if (IS_ERR(res->ref_clk_src)) - return PTR_ERR(res->ref_clk_src); - } - return 0; } @@ -1178,10 +1159,6 @@ static int qcom_pcie_init_2_7_0(struct qcom_pcie *pcie) return ret; } - /* Set TCXO as clock source for pcie_pipe_clk_src */ - if (pcie->pipe_clk_need_muxing) - clk_set_parent(res->pipe_clk_src, res->ref_clk_src); - ret = clk_bulk_prepare_enable(res->num_clks, res->clks); if (ret < 0) goto err_disable_regulators; @@ -1243,17 +1220,6 @@ static void qcom_pcie_deinit_2_7_0(struct qcom_pcie *pcie) regulator_bulk_disable(ARRAY_SIZE(res->supplies), res->supplies); } -static int qcom_pcie_post_init_2_7_0(struct qcom_pcie *pcie) -{ - struct qcom_pcie_resources_2_7_0 *res = &pcie->res.v2_7_0; - - /* Set pipe clock as clock source for pcie_pipe_clk_src */ - if (pcie->pipe_clk_need_muxing) - clk_set_parent(res->pipe_clk_src, res->phy_pipe_clk); - - return 0; -} - static int qcom_pcie_link_up(struct dw_pcie *pci) { u16 offset = dw_pcie_find_capability(pci, PCI_CAP_ID_EXP); @@ -1427,7 +1393,6 @@ static const struct qcom_pcie_ops ops_2_7_0 = { .init = qcom_pcie_init_2_7_0, .deinit = qcom_pcie_deinit_2_7_0, .ltssm_enable = qcom_pcie_2_3_2_ltssm_enable, - .post_init = qcom_pcie_post_init_2_7_0, }; /* Qcom IP rev.: 1.9.0 */ @@ -1436,7 +1401,6 @@ static const struct qcom_pcie_ops ops_1_9_0 = { .init = qcom_pcie_init_2_7_0, .deinit = qcom_pcie_deinit_2_7_0, .ltssm_enable = qcom_pcie_2_3_2_ltssm_enable, - .post_init = qcom_pcie_post_init_2_7_0, .config_sid = qcom_pcie_config_sid_sm8250, }; @@ -1470,7 +1434,6 @@ static const struct qcom_pcie_cfg sm8250_cfg = { static const struct qcom_pcie_cfg sc7280_cfg = { .ops = &ops_1_9_0, - .pipe_clk_need_muxing = true, }; static const struct dw_pcie_ops dw_pcie_ops = { @@ -1513,7 +1476,6 @@ static int qcom_pcie_probe(struct platform_device *pdev) pcie->pci = pci; pcie->ops = pcie_cfg->ops; - pcie->pipe_clk_need_muxing = pcie_cfg->pipe_clk_need_muxing; pcie->reset = devm_gpiod_get_optional(dev, "perst", GPIOD_OUT_HIGH); if (IS_ERR(pcie->reset)) { From patchwork Fri Feb 4 14:46:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 12735156 X-Patchwork-Delegate: lorenzo.pieralisi@arm.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5CEDBC433F5 for ; Fri, 4 Feb 2022 14:47:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359455AbiBDOq7 (ORCPT ); Fri, 4 Feb 2022 09:46:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359441AbiBDOq4 (ORCPT ); Fri, 4 Feb 2022 09:46:56 -0500 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63B7EC061759 for ; Fri, 4 Feb 2022 06:46:56 -0800 (PST) Received: by mail-lf1-x131.google.com with SMTP id u6so13046042lfm.10 for ; Fri, 04 Feb 2022 06:46:56 -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=HPUGyE4Nk9oPo2Yg3WSJOeaAAEN9ud1SRrakuqfnozg=; b=mmaPvAcJDueGpIgs4jA53BCLqQvurzMx/Nyn17E0TVVfou3e3M8hc52onWApdPEghB XcUBHryIUEEJ/0UIrMOF7Q7Ihd0pv0Tfo1fLYVncJb9DzNOcLu5+dA2WaRoh5/42hO1R ZSqCfpw5nYull3ABCNL89WBAVAuBXVUOpmZ8cG5K5ab4oQbgU8y8ZuP7RaZnP8GGyIBD O51c7j4r9JZWdmksJEkkBxYAxQAoiF2Y/Zx1mejMToFNY3qx38gkRDEP8IXytv/vD+LT 2wDRuJObV6fpfHSqWx006vS6l6Oez+mfqKuke3Qz8sgqpWiS7CaHoMYO0Ob8riodefHu BVaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HPUGyE4Nk9oPo2Yg3WSJOeaAAEN9ud1SRrakuqfnozg=; b=ft40KpNtp9TkbCePEs+ko7oVASJcXEiqtXgvV+mVrSeIOgvXeQ30eZXOcHiODoOxuW UI8TX36xApi6/2SabxnyvqRpfo8ADS2KsKIV9A/0nwVSqPIW0lDhmgmpyQBM7HqPR0/4 HJLhqsikHLEMZnPuRHCAihQPgMiSj424e5h1rGwNrIHySStYHjektOItf75fyHXgFVng AeT73lqtlhZFX8r+pzSNIUgR9H6YeE+nngewBl2lXQ9AT9FNNCZYMn+YADpfEY3cwEL2 zeS/DT7wJRPcMvC9MhVmEAH+vhCvshNprYASgGEuTjG0ldAoRqXAECxTaeZkb8CIDKUY DWhA== X-Gm-Message-State: AOAM530A8c9Ye/P/w1mWJ07uAHT5BDiTsIi0F+hnq9sO8Qfmnlo57krd 9+IqPp9U/Y2mVrERWBIJOmTTIQ== X-Google-Smtp-Source: ABdhPJzGLjwztb/DqyhxaopwJIiTqXpIZdMeMY4lS9a85hecKhebwgns9Mu3IyMUWsIbMHhtvX0dhw== X-Received: by 2002:a05:6512:22c9:: with SMTP id g9mr2563230lfu.148.1643986014780; Fri, 04 Feb 2022 06:46:54 -0800 (PST) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id y23sm348222lfb.2.2022.02.04.06.46.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Feb 2022 06:46:54 -0800 (PST) From: Dmitry Baryshkov To: Andy Gross , Bjorn Andersson , Stanimir Varbanov , Lorenzo Pieralisi , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Michael Turquette , Stephen Boyd Cc: Bjorn Helgaas , Prasad Malisetty , Vinod Koul , linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v2 09/11] PCI: qcom: Remove redundancy between qcom_pcie and qcom_pcie_cfg Date: Fri, 4 Feb 2022 17:46:43 +0300 Message-Id: <20220204144645.3016603-10-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220204144645.3016603-1-dmitry.baryshkov@linaro.org> References: <20220204144645.3016603-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org In preparation to adding more flags to configuration data, use pointer to struct qcom_pcie_cfg directly inside struct qcom_pcie, rather than duplicating all its fields. This would save us from the boilerplate code that just copies flag values from one struct to another one. Reviewed-by: Bjorn Andersson Signed-off-by: Dmitry Baryshkov --- drivers/pci/controller/dwc/pcie-qcom.c | 37 ++++++++++++-------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c index 7df8632a21a8..3a0da577b75d 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -198,7 +198,7 @@ struct qcom_pcie { union qcom_pcie_resources res; struct phy *phy; struct gpio_desc *reset; - const struct qcom_pcie_ops *ops; + const struct qcom_pcie_cfg *cfg; }; #define to_qcom_pcie(x) dev_get_drvdata((x)->dev) @@ -222,8 +222,8 @@ static int qcom_pcie_start_link(struct dw_pcie *pci) struct qcom_pcie *pcie = to_qcom_pcie(pci); /* Enable Link Training state machine */ - if (pcie->ops->ltssm_enable) - pcie->ops->ltssm_enable(pcie); + if (pcie->cfg->ops->ltssm_enable) + pcie->cfg->ops->ltssm_enable(pcie); return 0; } @@ -1307,7 +1307,7 @@ static int qcom_pcie_host_init(struct pcie_port *pp) qcom_ep_reset_assert(pcie); - ret = pcie->ops->init(pcie); + ret = pcie->cfg->ops->init(pcie); if (ret) return ret; @@ -1315,16 +1315,16 @@ static int qcom_pcie_host_init(struct pcie_port *pp) if (ret) goto err_deinit; - if (pcie->ops->post_init) { - ret = pcie->ops->post_init(pcie); + if (pcie->cfg->ops->post_init) { + ret = pcie->cfg->ops->post_init(pcie); if (ret) goto err_disable_phy; } qcom_ep_reset_deassert(pcie); - if (pcie->ops->config_sid) { - ret = pcie->ops->config_sid(pcie); + if (pcie->cfg->ops->config_sid) { + ret = pcie->cfg->ops->config_sid(pcie); if (ret) goto err; } @@ -1333,12 +1333,12 @@ static int qcom_pcie_host_init(struct pcie_port *pp) err: qcom_ep_reset_assert(pcie); - if (pcie->ops->post_deinit) - pcie->ops->post_deinit(pcie); + if (pcie->cfg->ops->post_deinit) + pcie->cfg->ops->post_deinit(pcie); err_disable_phy: phy_power_off(pcie->phy); err_deinit: - pcie->ops->deinit(pcie); + pcie->cfg->ops->deinit(pcie); return ret; } @@ -1447,15 +1447,8 @@ static int qcom_pcie_probe(struct platform_device *pdev) struct pcie_port *pp; struct dw_pcie *pci; struct qcom_pcie *pcie; - const struct qcom_pcie_cfg *pcie_cfg; int ret; - pcie_cfg = of_device_get_match_data(dev); - if (!pcie_cfg || !pcie_cfg->ops) { - dev_err(dev, "Invalid platform data\n"); - return -EINVAL; - } - pcie = devm_kzalloc(dev, sizeof(*pcie), GFP_KERNEL); if (!pcie) return -ENOMEM; @@ -1475,7 +1468,11 @@ static int qcom_pcie_probe(struct platform_device *pdev) pcie->pci = pci; - pcie->ops = pcie_cfg->ops; + pcie->cfg = of_device_get_match_data(dev); + if (!pcie->cfg || !pcie->cfg->ops) { + dev_err(dev, "Invalid platform data\n"); + return -EINVAL; + } pcie->reset = devm_gpiod_get_optional(dev, "perst", GPIOD_OUT_HIGH); if (IS_ERR(pcie->reset)) { @@ -1501,7 +1498,7 @@ static int qcom_pcie_probe(struct platform_device *pdev) goto err_pm_runtime_put; } - ret = pcie->ops->get_resources(pcie); + ret = pcie->cfg->ops->get_resources(pcie); if (ret) goto err_pm_runtime_put; From patchwork Fri Feb 4 14:46:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 12735155 X-Patchwork-Delegate: lorenzo.pieralisi@arm.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5C67C433EF for ; Fri, 4 Feb 2022 14:46:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359431AbiBDOq6 (ORCPT ); Fri, 4 Feb 2022 09:46:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359455AbiBDOq5 (ORCPT ); Fri, 4 Feb 2022 09:46:57 -0500 Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72368C06173D for ; Fri, 4 Feb 2022 06:46:57 -0800 (PST) Received: by mail-lj1-x22f.google.com with SMTP id c7so8781841ljr.13 for ; Fri, 04 Feb 2022 06:46:57 -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=F1j2Q5XxkmWrr7M0KKFyu0KiO6cRW71BJZcx3JxtL2w=; b=ainVI4CEOf94KXd/b/UCZEE37fzAFUz1AZzfVMkBnGgoZHbUymgeaxSRzyCcxG5nDb UN5XgQKg2B4g2HqN4QarLWhRANAwDlykcN0GPZtnGqDBDHYAAGTviJwjoKwHih6z7xI2 rYpGN7LZcJUJgzazbG2AmjAe8LF1p10BHor/FMQATYHuH9bUVGHxAYK4KnXBRZozarga Kp8Wp6odpsE3YuFip7M0GfnRyYdxzeeo/rvQkmJPo+fffzn9n9tc0s+of2qLUHwiChFt gsBfbNn8zU93mNengHYaFFqWEO/1Uxn371gPQXNZWfK3vezeupVaFabvWVeI9pwkFjjm cIRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=F1j2Q5XxkmWrr7M0KKFyu0KiO6cRW71BJZcx3JxtL2w=; b=Avd5rc3vr48m3tTfli+RfbB92u7qo3Qn+oXDR+NBxXaGfNbg3CFYGsWhvxkXhZVutP gN1IunokBtCaInC8S31F2n2OOwNKW7NCT3vZuKjA/BtT0Kfj+lVLbHJ7lhyPpNQSAIww /UuG5UbOW3GzeIonlYOjOjv9QZuW2dBJUqPEy80fMsvzr2tt6bc3n1R8gj1xVbEG0nME GA/Xode9W3fKk/UVN+vDT80C27vH7UCeQwFpYB+izRJMN+MZsNi2Oeyp66WSlhF7lfjA 70lhVYpl1GpI9p0F+zA2pU94VzKjArIE7TpnQVI9RElZF88E8ytidGlSu7xwqQ/T+sNF yo6g== X-Gm-Message-State: AOAM530KmOagpq5kIM/iFruLIXt9EgRQWna15/zymn9DUHSeYo1Lf+4W PzAIVVtTlFw5PYbF0F50+JeyNQ== X-Google-Smtp-Source: ABdhPJzWW0z3SGSltZDbb869075XfBoW6NZXPOlLdEedYo2bmbGY5Ciuvlpil0HmrpQtyXso5PJS9w== X-Received: by 2002:a2e:96c6:: with SMTP id d6mr1961399ljj.215.1643986015812; Fri, 04 Feb 2022 06:46:55 -0800 (PST) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id y23sm348222lfb.2.2022.02.04.06.46.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Feb 2022 06:46:55 -0800 (PST) From: Dmitry Baryshkov To: Andy Gross , Bjorn Andersson , Stanimir Varbanov , Lorenzo Pieralisi , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Michael Turquette , Stephen Boyd Cc: Bjorn Helgaas , Prasad Malisetty , Vinod Koul , linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v2 10/11] PCI: qcom: Add ddrss_sf_tbu flag Date: Fri, 4 Feb 2022 17:46:44 +0300 Message-Id: <20220204144645.3016603-11-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220204144645.3016603-1-dmitry.baryshkov@linaro.org> References: <20220204144645.3016603-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Qualcomm PCIe driver uses compatible string to check if the ddrss_sf_tbu clock should be used. Since sc7280 support has added flags, switch to the new mechanism to check if this clock should be used. Reviewed-by: Bjorn Andersson Signed-off-by: Dmitry Baryshkov --- drivers/pci/controller/dwc/pcie-qcom.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c index 3a0da577b75d..6034a933814d 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -189,6 +189,7 @@ struct qcom_pcie_ops { struct qcom_pcie_cfg { const struct qcom_pcie_ops *ops; + bool has_ddrss_sf_tbu_clk; }; struct qcom_pcie { @@ -1131,7 +1132,7 @@ static int qcom_pcie_get_resources_2_7_0(struct qcom_pcie *pcie) res->clks[3].id = "bus_slave"; res->clks[4].id = "slave_q2a"; res->clks[5].id = "tbu"; - if (of_device_is_compatible(dev->of_node, "qcom,pcie-sm8250")) { + if (pcie->cfg->has_ddrss_sf_tbu_clk) { res->clks[6].id = "ddrss_sf_tbu"; res->num_clks = 7; } else { @@ -1430,6 +1431,7 @@ static const struct qcom_pcie_cfg sdm845_cfg = { static const struct qcom_pcie_cfg sm8250_cfg = { .ops = &ops_1_9_0, + .has_ddrss_sf_tbu_clk = true, }; static const struct qcom_pcie_cfg sc7280_cfg = { From patchwork Fri Feb 4 14:46:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 12735157 X-Patchwork-Delegate: lorenzo.pieralisi@arm.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B137BC3527C for ; Fri, 4 Feb 2022 14:47:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359448AbiBDOq7 (ORCPT ); Fri, 4 Feb 2022 09:46:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359456AbiBDOq6 (ORCPT ); Fri, 4 Feb 2022 09:46:58 -0500 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EAE0C06173D for ; Fri, 4 Feb 2022 06:46:58 -0800 (PST) Received: by mail-lf1-x130.google.com with SMTP id k13so13073961lfg.9 for ; Fri, 04 Feb 2022 06:46:58 -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=NscpyK0buF1esZkGVw7YGC7D0IZRioFEiEIVQa9+trk=; b=wbrZgVCHOlYdehazV9tmDN39xAHuYi+3rNFSrkcCq9VN01OvR2OTPSZPG8CyIiKA8G DSNHTLRYtsQvq+cXV+9v4ApX5ffBBzhqWhIG9g0JMz3ekQsAPADL5OifjqkIiA4DVIHN JhJZ0MNFw7g4ChZDDTvbhYvB1wi0/gGciHVY6fUDT/u0J1oAH1IsL+jMy62Zs986z7gq dlS4joOzvAE6h+xri4w9QS2H2/ss2fX1tYkn7aBHojoI0UE/29KAsRa54ZIw2ikpcyJS ySjHb2XHrYO/qSNK0lm01Hi/DYNWQDFBAnb4HJvCO67EuObEL1GumW+C0dnOVfeYW7j6 Roiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NscpyK0buF1esZkGVw7YGC7D0IZRioFEiEIVQa9+trk=; b=qZBdnQMdbMElVlERA2P6oBwl/KYWBuM3dVKYH2CuX1P788cemuGrOuQFNvup0PifM7 mnJ221M0pS0my1GVsiFN1qjKh1xKUh/YhFzqFvDvszEgkV/bgnNFiZSP+p7KZhPFe2pf vKPgT66FU2I1QnYzwtAl57GZUP0II7k2nOCAf35R+Myy/XYnCaZ8mqyYJfQ3/7owIrAh JVqryae/KlNKX6dodw8IlJKV74rj+ZbJgFXAV7dbvclE8hgs2H/HXBukJtj2F/A7y61a 0J7foH7nES0u4DnySLAH/XTwYZwbvyG4o3WcwOyltr61kl3DVt4HQL7D2J5RL0A2A1Yk a5xw== X-Gm-Message-State: AOAM530wNrxHJ1FTxE7XiWMsc6z/VBYzklMOWuWPpMIMtoHeUzcgboZb aL4t7cHNfgqkh2doGkVhiUYhRA== X-Google-Smtp-Source: ABdhPJxS9geMjJJ4T0bw6fthvvK2zsIEnWkglafbati+yS00A5lLdU81L665O92HzIUDSHK+IBye+w== X-Received: by 2002:a05:6512:2804:: with SMTP id cf4mr2498975lfb.412.1643986016828; Fri, 04 Feb 2022 06:46:56 -0800 (PST) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id y23sm348222lfb.2.2022.02.04.06.46.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Feb 2022 06:46:56 -0800 (PST) From: Dmitry Baryshkov To: Andy Gross , Bjorn Andersson , Stanimir Varbanov , Lorenzo Pieralisi , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Michael Turquette , Stephen Boyd Cc: Bjorn Helgaas , Prasad Malisetty , Vinod Koul , linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v2 11/11] PCI: qcom: Add SM8450 PCIe support Date: Fri, 4 Feb 2022 17:46:45 +0300 Message-Id: <20220204144645.3016603-12-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220204144645.3016603-1-dmitry.baryshkov@linaro.org> References: <20220204144645.3016603-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org On SM8450 platform PCIe hosts do not use all the clocks (and add several additional clocks), so expand the driver to handle these requirements. PCIe0 and PCIe1 hosts use different sets of clocks, so separate entries are required. Reviewed-by: Bjorn Andersson Signed-off-by: Dmitry Baryshkov --- drivers/pci/controller/dwc/pcie-qcom.c | 55 ++++++++++++++++++++------ 1 file changed, 42 insertions(+), 13 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c index 6034a933814d..174a650ffbbb 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -160,7 +160,7 @@ struct qcom_pcie_resources_2_3_3 { /* 6 clocks typically, 7 for sm8250 */ struct qcom_pcie_resources_2_7_0 { - struct clk_bulk_data clks[7]; + struct clk_bulk_data clks[9]; int num_clks; struct regulator_bulk_data supplies[2]; struct reset_control *pci_reset; @@ -189,7 +189,10 @@ struct qcom_pcie_ops { struct qcom_pcie_cfg { const struct qcom_pcie_ops *ops; + bool has_tbu_clk; bool has_ddrss_sf_tbu_clk; + bool has_aggre0_clk; + bool has_aggre1_clk; }; struct qcom_pcie { @@ -1113,6 +1116,7 @@ static int qcom_pcie_get_resources_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; + unsigned int idx; int ret; res->pci_reset = devm_reset_control_get_exclusive(dev, "pci"); @@ -1126,18 +1130,22 @@ static int qcom_pcie_get_resources_2_7_0(struct qcom_pcie *pcie) if (ret) return ret; - res->clks[0].id = "aux"; - res->clks[1].id = "cfg"; - res->clks[2].id = "bus_master"; - res->clks[3].id = "bus_slave"; - res->clks[4].id = "slave_q2a"; - res->clks[5].id = "tbu"; - if (pcie->cfg->has_ddrss_sf_tbu_clk) { - res->clks[6].id = "ddrss_sf_tbu"; - res->num_clks = 7; - } else { - res->num_clks = 6; - } + idx = 0; + res->clks[idx++].id = "aux"; + res->clks[idx++].id = "cfg"; + res->clks[idx++].id = "bus_master"; + res->clks[idx++].id = "bus_slave"; + res->clks[idx++].id = "slave_q2a"; + if (pcie->cfg->has_tbu_clk) + res->clks[idx++].id = "tbu"; + if (pcie->cfg->has_ddrss_sf_tbu_clk) + res->clks[idx++].id = "ddrss_sf_tbu"; + if (pcie->cfg->has_aggre0_clk) + res->clks[idx++].id = "aggre0"; + if (pcie->cfg->has_aggre1_clk) + res->clks[idx++].id = "aggre1"; + + res->num_clks = idx; ret = devm_clk_bulk_get(dev, res->num_clks, res->clks); if (ret < 0) @@ -1178,6 +1186,9 @@ static int qcom_pcie_init_2_7_0(struct qcom_pcie *pcie) goto err_disable_clocks; } + /* Wait for reset to complete, required on SM8450 */ + usleep_range(1000, 1500); + /* configure PCIe to RC mode */ writel(DEVICE_TYPE_RC, pcie->parf + PCIE20_PARF_DEVICE_TYPE); @@ -1427,15 +1438,31 @@ static const struct qcom_pcie_cfg ipq4019_cfg = { static const struct qcom_pcie_cfg sdm845_cfg = { .ops = &ops_2_7_0, + .has_tbu_clk = true, }; static const struct qcom_pcie_cfg sm8250_cfg = { + .ops = &ops_1_9_0, + .has_tbu_clk = true, + .has_ddrss_sf_tbu_clk = true, +}; + +static const struct qcom_pcie_cfg sm8450_pcie0_cfg = { + .ops = &ops_1_9_0, + .has_ddrss_sf_tbu_clk = true, + .has_aggre0_clk = true, + .has_aggre1_clk = true, +}; + +static const struct qcom_pcie_cfg sm8450_pcie1_cfg = { .ops = &ops_1_9_0, .has_ddrss_sf_tbu_clk = true, + .has_aggre1_clk = true, }; static const struct qcom_pcie_cfg sc7280_cfg = { .ops = &ops_1_9_0, + .has_tbu_clk = true, }; static const struct dw_pcie_ops dw_pcie_ops = { @@ -1541,6 +1568,8 @@ static const struct of_device_id qcom_pcie_match[] = { { .compatible = "qcom,pcie-sdm845", .data = &sdm845_cfg }, { .compatible = "qcom,pcie-sm8250", .data = &sm8250_cfg }, { .compatible = "qcom,pcie-sc8180x", .data = &sm8250_cfg }, + { .compatible = "qcom,pcie-sm8450-pcie0", .data = &sm8450_pcie0_cfg }, + { .compatible = "qcom,pcie-sm8450-pcie1", .data = &sm8450_pcie1_cfg }, { .compatible = "qcom,pcie-sc7280", .data = &sc7280_cfg }, { } };