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,
Jeffrey Hugo <quic_jhugo@quicinc.com>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Dan Carpenter <error27@gmail.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Bo Liu <liubo03@inspur.com>,
"open list:MHI BUS" <mhi@lists.linux.dev>
Subject: Re: [PATCH v2 8/8] bus: mhi: ep: wake up host is the MHI state is in M3
Date: Fri, 7 Jul 2023 11:50:31 +0530 [thread overview]
Message-ID: <20230707062031.GG6001@thinkpad> (raw)
In-Reply-To: <1688122331-25478-9-git-send-email-quic_krichai@quicinc.com>
On Fri, Jun 30, 2023 at 04:22:11PM +0530, Krishna chaitanya chundru wrote:
> If the MHI state is in M3 then the most probably the host kept the
> device in D3 hot or D3 cold, due to that endpoint transctions will not
> be read by the host, so endpoint needs to bring the host to D0 which
> eventually bring back the MHI state to M0.
>
Endpoint cannot bring the host to D0, it can only wake up the host and the host
will bring the device to D0.
> Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com>
> ---
> drivers/bus/mhi/ep/main.c | 16 +++++++++++++++-
> 1 file changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/bus/mhi/ep/main.c b/drivers/bus/mhi/ep/main.c
> index 6008818..42d3791 100644
> --- a/drivers/bus/mhi/ep/main.c
> +++ b/drivers/bus/mhi/ep/main.c
> @@ -451,12 +451,14 @@ int mhi_ep_queue_skb(struct mhi_ep_device *mhi_dev, struct sk_buff *skb)
> struct mhi_ep_cntrl *mhi_cntrl = mhi_dev->mhi_cntrl;
> struct mhi_ep_chan *mhi_chan = mhi_dev->dl_chan;
> struct device *dev = &mhi_chan->mhi_dev->dev;
> + u32 buf_left, read_offset, count = 0;
> struct mhi_ring_element *el;
> - u32 buf_left, read_offset;
> struct mhi_ep_ring *ring;
> enum mhi_ev_ccs code;
> + enum mhi_state state;
> void *read_addr;
> u64 write_addr;
> + bool mhi_reset;
> size_t tr_len;
> u32 tre_len;
> int ret;
> @@ -464,6 +466,18 @@ int mhi_ep_queue_skb(struct mhi_ep_device *mhi_dev, struct sk_buff *skb)
> buf_left = skb->len;
> ring = &mhi_cntrl->mhi_chan[mhi_chan->chan].ring;
>
> + if (mhi_cntrl->mhi_state == MHI_STATE_M3) {
> + dev_dbg(dev, "wake up by ch id %x\n", mhi_chan->chan);
This is not needed.
> + mhi_cntrl->wakeup_host(mhi_cntrl);
> + }
> +
> + /* Wait for Host to set the M0 state */
> + do {
> + msleep(M0_WAIT_DELAY_MS);
> + mhi_ep_mmio_get_mhi_state(mhi_cntrl, &state, &mhi_reset);
> + count++;
> + } while (state != MHI_STATE_M0 && count < M0_WAIT_COUNT);
> +
Move this change to a function like mhi_ep_wake_host().
- Mani
> mutex_lock(&mhi_chan->lock);
>
> do {
> --
> 2.7.4
>
--
மணிவண்ணன் சதாசிவம்
next prev parent reply other threads:[~2023-07-07 6:21 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
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 [this message]
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=20230707062031.GG6001@thinkpad \
--to=mani@kernel.org \
--cc=error27@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=helgaas@kernel.org \
--cc=krzysztof.kozlowski@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=liubo03@inspur.com \
--cc=manivannan.sadhasivam@linaro.org \
--cc=mhi@lists.linux.dev \
--cc=quic_jhugo@quicinc.com \
--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=rafael@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.