From: Qiang Yu <quic_qianyu@quicinc.com>
To: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>,
Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: <vkoul@kernel.org>, <kishon@kernel.org>, <robh@kernel.org>,
<andersson@kernel.org>, <konradybcio@kernel.org>,
<krzk+dt@kernel.org>, <conor+dt@kernel.org>,
<mturquette@baylibre.com>, <sboyd@kernel.org>,
<abel.vesa@linaro.org>, <quic_msarkar@quicinc.com>,
<quic_devipriy@quicinc.com>, <kw@linux.com>,
<lpieralisi@kernel.org>, <neil.armstrong@linaro.org>,
<linux-arm-msm@vger.kernel.org>, <linux-phy@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <linux-pci@vger.kernel.org>,
<devicetree@vger.kernel.org>, <linux-clk@vger.kernel.org>
Subject: Re: [PATCH 8/8] PCI: qcom: Add support to PCIe slot power supplies
Date: Wed, 11 Sep 2024 16:17:41 +0800 [thread overview]
Message-ID: <26f2845f-2e29-4887-9f33-0b5b2a06adb6@quicinc.com> (raw)
In-Reply-To: <20240827165826.moe6cnemeheos6jn@thinkpad>
On 8/28/2024 12:58 AM, Manivannan Sadhasivam wrote:
> On Tue, Aug 27, 2024 at 02:44:09PM +0300, Dmitry Baryshkov wrote:
>> On Tue, 27 Aug 2024 at 09:36, Qiang Yu <quic_qianyu@quicinc.com> wrote:
>>> On platform x1e80100 QCP, PCIe3 is a standard x8 form factor. Hence, add
>>> support to use 3.3v, 3.3v aux and 12v regulators.
>> First of all, I don't see corresponding bindings change.
>>
>> Second, these supplies power up the slot, not the host controller
>> itself. As such these supplies do not belong to the host controller
>> entry. Please consider using the pwrseq framework instead.
>>
> Indeed. For legacy reasons, slot power supplies were populated in the host
> bridge node itself until recently Rob started objecting it [1]. And it makes
> real sense to put these supplies in the root port node and handle them in the
> relevant driver.
>
> I'm still evaluating whether the handling should be done in the portdrv or
> pwrctl driver, but haven't reached the conclusion. Pwrctl seems to be the ideal
> choice, but I see a few issues related to handling the OF node for the root
> port.
>
> Hope I'll come to a conclusion in the next few days and will update this thread.
>
> - Mani
>
> [1] https://lore.kernel.org/lkml/20240604235806.GA1903493-robh@kernel.org/
Hi Mani, do you have any updates?
Thanks,
Qiang
>
>>> Signed-off-by: Qiang Yu <quic_qianyu@quicinc.com>
>>> ---
>>> drivers/pci/controller/dwc/pcie-qcom.c | 52 +++++++++++++++++++++++++-
>>> 1 file changed, 50 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
>>> index 6f953e32d990..59fb415dfeeb 100644
>>> --- a/drivers/pci/controller/dwc/pcie-qcom.c
>>> +++ b/drivers/pci/controller/dwc/pcie-qcom.c
>>> @@ -248,6 +248,8 @@ struct qcom_pcie_cfg {
>>> bool no_l0s;
>>> };
>>>
>>> +#define QCOM_PCIE_SLOT_MAX_SUPPLIES 3
>>> +
>>> struct qcom_pcie {
>>> struct dw_pcie *pci;
>>> void __iomem *parf; /* DT parf */
>>> @@ -260,6 +262,7 @@ struct qcom_pcie {
>>> struct icc_path *icc_cpu;
>>> const struct qcom_pcie_cfg *cfg;
>>> struct dentry *debugfs;
>>> + struct regulator_bulk_data slot_supplies[QCOM_PCIE_SLOT_MAX_SUPPLIES];
>>> bool suspended;
>>> bool use_pm_opp;
>>> };
>>> @@ -1174,6 +1177,41 @@ static int qcom_pcie_link_up(struct dw_pcie *pci)
>>> return !!(val & PCI_EXP_LNKSTA_DLLLA);
>>> }
>>>
>>> +static int qcom_pcie_enable_slot_supplies(struct qcom_pcie *pcie)
>>> +{
>>> + struct dw_pcie *pci = pcie->pci;
>>> + int ret;
>>> +
>>> + ret = regulator_bulk_enable(ARRAY_SIZE(pcie->slot_supplies),
>>> + pcie->slot_supplies);
>>> + if (ret < 0)
>>> + dev_err(pci->dev, "Failed to enable slot regulators\n");
>>> +
>>> + return ret;
>>> +}
>>> +
>>> +static void qcom_pcie_disable_slot_supplies(struct qcom_pcie *pcie)
>>> +{
>>> + regulator_bulk_disable(ARRAY_SIZE(pcie->slot_supplies),
>>> + pcie->slot_supplies);
>>> +}
>>> +
>>> +static int qcom_pcie_get_slot_supplies(struct qcom_pcie *pcie)
>>> +{
>>> + struct dw_pcie *pci = pcie->pci;
>>> + int ret;
>>> +
>>> + pcie->slot_supplies[0].supply = "vpcie12v";
>>> + pcie->slot_supplies[1].supply = "vpcie3v3";
>>> + pcie->slot_supplies[2].supply = "vpcie3v3aux";
>>> + ret = devm_regulator_bulk_get(pci->dev, ARRAY_SIZE(pcie->slot_supplies),
>>> + pcie->slot_supplies);
>>> + if (ret < 0)
>>> + dev_err(pci->dev, "Failed to get slot regulators\n");
>>> +
>>> + return ret;
>>> +}
>>> +
>>> static int qcom_pcie_host_init(struct dw_pcie_rp *pp)
>>> {
>>> struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
>>> @@ -1182,10 +1220,14 @@ static int qcom_pcie_host_init(struct dw_pcie_rp *pp)
>>>
>>> qcom_ep_reset_assert(pcie);
>>>
>>> - ret = pcie->cfg->ops->init(pcie);
>>> + ret = qcom_pcie_enable_slot_supplies(pcie);
>>> if (ret)
>>> return ret;
>>>
>>> + ret = pcie->cfg->ops->init(pcie);
>>> + if (ret)
>>> + goto err_disable_slot;
>>> +
>>> ret = phy_set_mode_ext(pcie->phy, PHY_MODE_PCIE, PHY_MODE_PCIE_RC);
>>> if (ret)
>>> goto err_deinit;
>>> @@ -1216,7 +1258,8 @@ static int qcom_pcie_host_init(struct dw_pcie_rp *pp)
>>> phy_power_off(pcie->phy);
>>> err_deinit:
>>> pcie->cfg->ops->deinit(pcie);
>>> -
>>> +err_disable_slot:
>>> + qcom_pcie_disable_slot_supplies(pcie);
>>> return ret;
>>> }
>>>
>>> @@ -1228,6 +1271,7 @@ static void qcom_pcie_host_deinit(struct dw_pcie_rp *pp)
>>> qcom_ep_reset_assert(pcie);
>>> phy_power_off(pcie->phy);
>>> pcie->cfg->ops->deinit(pcie);
>>> + qcom_pcie_disable_slot_supplies(pcie);
>>> }
>>>
>>> static void qcom_pcie_host_post_init(struct dw_pcie_rp *pp)
>>> @@ -1602,6 +1646,10 @@ static int qcom_pcie_probe(struct platform_device *pdev)
>>> goto err_pm_runtime_put;
>>> }
>>>
>>> + ret = qcom_pcie_get_slot_supplies(pcie);
>>> + if (ret)
>>> + goto err_pm_runtime_put;
>>> +
>>> ret = pcie->cfg->ops->get_resources(pcie);
>>> if (ret)
>>> goto err_pm_runtime_put;
>>> --
>>> 2.34.1
>>>
>>
>> --
>> With best wishes
>> Dmitry
next prev parent reply other threads:[~2024-09-11 8:18 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-27 6:36 [PATCH 0/8] Add support for PCIe3 on x1e80100 Qiang Yu
2024-08-27 6:36 ` [PATCH 1/8] phy: qcom-qmp: pcs-pcie: Add v6.30 register offsets Qiang Yu
2024-08-27 11:37 ` Krzysztof Kozlowski
2024-08-28 9:41 ` Qiang Yu
2024-08-27 6:36 ` [PATCH 2/8] phy: qcom-qmp: pcs: " Qiang Yu
2024-08-27 10:13 ` Konrad Dybcio
2024-08-27 6:36 ` [PATCH 3/8] phy: qcom: qmp: Add phy register and clk setting for x1e80100 PCIe3 Qiang Yu
2024-08-27 10:33 ` Konrad Dybcio
2024-08-28 9:47 ` Qiang Yu
2024-08-27 11:38 ` Krzysztof Kozlowski
2024-08-28 9:52 ` Qiang Yu
2024-08-27 6:36 ` [PATCH 4/8] arm64: dts: qcom: x1e80100: Add support for PCIe3 on x1e80100 Qiang Yu
2024-08-27 10:42 ` Konrad Dybcio
2024-08-28 13:36 ` Qiang Yu
2024-09-11 8:22 ` Qiang Yu
2024-08-27 11:39 ` Krzysztof Kozlowski
2024-08-27 6:36 ` [PATCH 5/8] dt-bindings: phy: qcom,sc8280xp-qmp-pcie-phy: Document the X1E80100 QMP PCIe PHY Gen4 x8 Qiang Yu
2024-08-27 11:36 ` Krzysztof Kozlowski
2024-08-27 6:36 ` [PATCH 6/8] clk: qcom: gcc-x1e80100: Fix halt_check for pipediv2 clocks Qiang Yu
2024-08-27 10:10 ` Konrad Dybcio
2024-08-27 6:36 ` [PATCH 7/8] arm64: dts: qcom: x1e80100-qcp: Add power supply and sideband signal for pcie3 Qiang Yu
2024-08-27 11:41 ` Krzysztof Kozlowski
2024-08-27 6:36 ` [PATCH 8/8] PCI: qcom: Add support to PCIe slot power supplies Qiang Yu
2024-08-27 11:02 ` Konrad Dybcio
2024-08-27 11:44 ` Dmitry Baryshkov
2024-08-27 16:58 ` Manivannan Sadhasivam
2024-09-11 8:17 ` Qiang Yu [this message]
2024-09-11 15:32 ` Manivannan Sadhasivam
2024-09-12 13:39 ` Qiang Yu
2024-09-12 14:15 ` Konrad Dybcio
2024-09-12 14:44 ` Manivannan Sadhasivam
2024-09-12 14:49 ` Dmitry Baryshkov
2024-09-13 8:41 ` Qiang Yu
2024-08-28 13:44 ` Qiang Yu
2024-08-27 12:31 ` [PATCH 0/8] Add support for PCIe3 on x1e80100 Rob Herring (Arm)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=26f2845f-2e29-4887-9f33-0b5b2a06adb6@quicinc.com \
--to=quic_qianyu@quicinc.com \
--cc=abel.vesa@linaro.org \
--cc=andersson@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.baryshkov@linaro.org \
--cc=kishon@kernel.org \
--cc=konradybcio@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=kw@linux.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=lpieralisi@kernel.org \
--cc=manivannan.sadhasivam@linaro.org \
--cc=mturquette@baylibre.com \
--cc=neil.armstrong@linaro.org \
--cc=quic_devipriy@quicinc.com \
--cc=quic_msarkar@quicinc.com \
--cc=robh@kernel.org \
--cc=sboyd@kernel.org \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox