linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hemant Kumar <hemantk@codeaurora.org>
To: manivannan.sadhasivam@linaro.org
Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
	jhugo@codeaurora.org, bbhatt@codeaurora.org,
	loic.poulain@linaro.org, Hemant Kumar <hemantk@codeaurora.org>
Subject: [PATCH v1 1/2] bus: mhi: core: Count number of HW channels supported by controller
Date: Fri, 23 Oct 2020 19:00:42 -0700	[thread overview]
Message-ID: <1603504843-38557-2-git-send-email-hemantk@codeaurora.org> (raw)
In-Reply-To: <1603504843-38557-1-git-send-email-hemantk@codeaurora.org>

Device provides the total number of HW channels it supports using MHI
configuration register. Host supported HW channels shall not exceed
that value. In order to make this check, a counter is needed to store
total number of HW channels required by host.

Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
---
 drivers/bus/mhi/core/init.c     | 2 ++
 drivers/bus/mhi/core/internal.h | 1 +
 include/linux/mhi.h             | 1 +
 3 files changed, 4 insertions(+)

diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c
index 0ffdebd..70fd6af 100644
--- a/drivers/bus/mhi/core/init.c
+++ b/drivers/bus/mhi/core/init.c
@@ -725,6 +725,8 @@ static int parse_ch_cfg(struct mhi_controller *mhi_cntrl,
 		mhi_chan = &mhi_cntrl->mhi_chan[chan];
 		mhi_chan->name = ch_cfg->name;
 		mhi_chan->chan = chan;
+		if (chan >= MHI_HW_CHAN_START_IDX)
+			mhi_cntrl->hw_chan++;
 
 		mhi_chan->tre_ring.elements = ch_cfg->num_elements;
 		if (!mhi_chan->tre_ring.elements)
diff --git a/drivers/bus/mhi/core/internal.h b/drivers/bus/mhi/core/internal.h
index 7989269..3d8e480 100644
--- a/drivers/bus/mhi/core/internal.h
+++ b/drivers/bus/mhi/core/internal.h
@@ -454,6 +454,7 @@ enum mhi_pm_state {
 #define PRIMARY_CMD_RING		0
 #define MHI_DEV_WAKE_DB			127
 #define MHI_MAX_MTU			0xffff
+#define MHI_HW_CHAN_START_IDX		100
 #define MHI_RANDOM_U32_NONZERO(bmsk)	(prandom_u32_max(bmsk) + 1)
 
 enum mhi_er_type {
diff --git a/include/linux/mhi.h b/include/linux/mhi.h
index d4841e5..ea441d2 100644
--- a/include/linux/mhi.h
+++ b/include/linux/mhi.h
@@ -389,6 +389,7 @@ struct mhi_controller {
 	struct list_head lpm_chans;
 	int *irq;
 	u32 max_chan;
+	u32 hw_chan;
 	u32 total_ev_rings;
 	u32 hw_ev_rings;
 	u32 sw_ev_rings;
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


  reply	other threads:[~2020-10-24  2:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-24  2:00 [PATCH v1 0/2] Check for device supported event rings and channels Hemant Kumar
2020-10-24  2:00 ` Hemant Kumar [this message]
2020-11-06  8:00   ` [PATCH v1 1/2] bus: mhi: core: Count number of HW channels supported by controller Manivannan Sadhasivam
2020-10-24  2:00 ` [PATCH v1 2/2] bus: mhi: core: Check for device supported event rings and channels Hemant Kumar
2020-11-06  8:06   ` Manivannan Sadhasivam

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=1603504843-38557-2-git-send-email-hemantk@codeaurora.org \
    --to=hemantk@codeaurora.org \
    --cc=bbhatt@codeaurora.org \
    --cc=jhugo@codeaurora.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loic.poulain@linaro.org \
    --cc=manivannan.sadhasivam@linaro.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;
as well as URLs for NNTP newsgroup(s).