From: Manivannan Sadhasivam <mani@kernel.org>
To: Krishna chaitanya chundru <quic_krichai@quicinc.com>
Cc: manivannan.sadhasivam@linaro.org, helgaas@kernel.org,
linux-pci@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org, quic_vbadigan@quicinc.com,
quic_nitegupt@quicinc.com, quic_skananth@quicinc.com,
quic_ramkri@quicinc.com, krzysztof.kozlowski@linaro.org,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczyński" <kw@linux.com>,
"Rob Herring" <robh@kernel.org>,
"Bjorn Helgaas" <bhelgaas@google.com>
Subject: Re: [PATCH v2 6/8] PCI: qcom: ep: Add wake up host op to dw_pcie_ep_ops
Date: Fri, 7 Jul 2023 11:40:05 +0530 [thread overview]
Message-ID: <20230707061005.GE6001@thinkpad> (raw)
In-Reply-To: <1688122331-25478-7-git-send-email-quic_krichai@quicinc.com>
On Fri, Jun 30, 2023 at 04:22:09PM +0530, Krishna chaitanya chundru wrote:
Subject prefix should be "PCI: qcom-ep:"
> Add wakeup host op to dw_pcie_ep_ops to wake up host.
> If the EPF asks to send PME trigger the inband PME by writing
> into the parf registers otherwise toggle wake signal.
>
If the wakeup type is PME, then trigger inband PME by writing to the PARF
PARF_PM_CTRL register, otherwise toggle #WAKE.
> Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com>
> ---
> drivers/pci/controller/dwc/pcie-qcom-ep.c | 31 +++++++++++++++++++++++++++++++
> 1 file changed, 31 insertions(+)
>
> diff --git a/drivers/pci/controller/dwc/pcie-qcom-ep.c b/drivers/pci/controller/dwc/pcie-qcom-ep.c
> index e75aec4..e382b4b 100644
> --- a/drivers/pci/controller/dwc/pcie-qcom-ep.c
> +++ b/drivers/pci/controller/dwc/pcie-qcom-ep.c
> @@ -89,6 +89,7 @@
> /* PARF_PM_CTRL register fields */
> #define PARF_PM_CTRL_REQ_EXIT_L1 BIT(1)
> #define PARF_PM_CTRL_READY_ENTR_L23 BIT(2)
> +#define PARF_PM_CTRL_XMT_PME BIT(4)
> #define PARF_PM_CTRL_REQ_NOT_ENTR_L1 BIT(5)
>
> /* PARF_MHI_CLOCK_RESET_CTRL fields */
> @@ -729,10 +730,40 @@ static void qcom_pcie_ep_init(struct dw_pcie_ep *ep)
> dw_pcie_ep_reset_bar(pci, bar);
> }
>
> +static int qcom_pcie_ep_wakeup_host(struct dw_pcie_ep *ep, u8 func_no,
> + enum pci_epc_wakeup_host_type type)
> +{
> + struct dw_pcie *pci = to_dw_pcie_from_ep(ep);
> + struct qcom_pcie_ep *pcie_ep = to_pcie_ep(pci);
> + struct device *dev = pci->dev;
> + u32 val;
> +
> + if (type == PCI_WAKEUP_TOGGLE_WAKE) {
> + dev_dbg(dev, "Waking up the host by toggling WAKE#\n");
> + gpiod_set_value_cansleep(pcie_ep->wake, 1);
> + usleep_range(WAKE_DELAY_US, WAKE_DELAY_US + 500);
> + gpiod_set_value_cansleep(pcie_ep->wake, 0);
> + return 0;
> +
> + } else if (type == PCI_WAKEUP_SEND_PME) {
> + dev_dbg(dev, "Waking up the host using PME\n");
> + val = readl_relaxed(pcie_ep->parf + PARF_PM_CTRL);
> + val |= PARF_PM_CTRL_XMT_PME;
> + writel_relaxed(val, pcie_ep->parf + PARF_PM_CTRL);
> +
> + } else {
> + dev_err(dev, "Device is not in D3 state wakeup is not supported\n");
> + return -EOPNOTSUPP;
This is not needed if you use bool. And this debug message is wrong btw since
you are not checking whether the device is in D3 state or not.
- Mani
> + }
> +
> + return 0;
> +}
> +
> static const struct dw_pcie_ep_ops pci_ep_ops = {
> .ep_init = qcom_pcie_ep_init,
> .raise_irq = qcom_pcie_ep_raise_irq,
> .get_features = qcom_pcie_epc_get_features,
> + .wakeup_host = qcom_pcie_ep_wakeup_host,
> };
>
> static int qcom_pcie_ep_probe(struct platform_device *pdev)
> --
> 2.7.4
>
--
மணிவண்ணன் சதாசிவம்
next prev parent reply other threads:[~2023-07-07 6:10 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-30 10:52 [PATCH v2 0/8] PCCI: EPC: Add support to wake up host from D3 states Krishna chaitanya chundru
2023-06-30 10:52 ` [PATCH v2 1/8] PCI: endpoint: Add dstate change notifier support Krishna chaitanya chundru
2023-07-07 5:44 ` Manivannan Sadhasivam
2023-07-07 10:52 ` Krishna Chaitanya Chundru
2023-06-30 10:52 ` [PATCH v2 2/8] PCI: qcom-ep: Add support for D-state change notification Krishna chaitanya chundru
2023-07-07 5:51 ` Manivannan Sadhasivam
2023-07-07 10:54 ` Krishna Chaitanya Chundru
2023-07-13 20:04 ` kernel test robot
2023-06-30 10:52 ` [PATCH v2 3/8] PCI: epf-mhi: Add dtate change op Krishna chaitanya chundru
2023-07-07 5:59 ` Manivannan Sadhasivam
2023-07-07 10:55 ` Krishna Chaitanya Chundru
2023-06-30 10:52 ` [PATCH v2 4/8] PCI: endpoint: Add wakeup host API to EPC core Krishna chaitanya chundru
2023-07-07 6:04 ` Manivannan Sadhasivam
2023-07-07 10:57 ` Krishna Chaitanya Chundru
2023-06-30 10:52 ` [PATCH v2 5/8] pci: dwc: Add wakeup host op to pci_epc_ops Krishna chaitanya chundru
2023-06-30 10:52 ` [PATCH v2 6/8] PCI: qcom: ep: Add wake up host op to dw_pcie_ep_ops Krishna chaitanya chundru
2023-07-07 6:10 ` Manivannan Sadhasivam [this message]
2023-07-07 10:58 ` Krishna Chaitanya Chundru
2023-06-30 10:52 ` [PATCH v2 7/8] PCI: epf-mhi: Add wakeup host op Krishna chaitanya chundru
2023-07-07 6:14 ` Manivannan Sadhasivam
2023-07-07 11:00 ` Krishna Chaitanya Chundru
2023-06-30 10:52 ` [PATCH v2 8/8] bus: mhi: ep: wake up host is the MHI state is in M3 Krishna chaitanya chundru
2023-07-07 6:20 ` Manivannan Sadhasivam
2023-07-07 11:01 ` Krishna Chaitanya Chundru
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=20230707061005.GE6001@thinkpad \
--to=mani@kernel.org \
--cc=bhelgaas@google.com \
--cc=helgaas@kernel.org \
--cc=krzysztof.kozlowski@linaro.org \
--cc=kw@linux.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=manivannan.sadhasivam@linaro.org \
--cc=quic_krichai@quicinc.com \
--cc=quic_nitegupt@quicinc.com \
--cc=quic_ramkri@quicinc.com \
--cc=quic_skananth@quicinc.com \
--cc=quic_vbadigan@quicinc.com \
--cc=robh@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