linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vinod Koul <vkoul@kernel.org>
To: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: linux-arm-msm@vger.kernel.org, Andy Gross <agross@kernel.org>,
	Matthias Kaehlcke <mka@chromium.org>,
	Douglas Anderson <dianders@chromium.org>,
	Sumit Semwal <sumit.semwal@linaro.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 3/3] soc: qcom: geni: Add support for gpi dma
Date: Tue, 22 Jun 2021 17:45:05 +0530	[thread overview]
Message-ID: <YNHUSVisKK6QnUX4@vkoul-mobl> (raw)
In-Reply-To: <YMzWpPnfczMBsZ2x@yoga>

On 18-06-21, 12:23, Bjorn Andersson wrote:
> On Fri 18 Jun 09:18 CDT 2021, Vinod Koul wrote:
> 
> > GPI DMA is one of the DMA modes supported on geni, this adds support to
> > enable that mode
> 
> I think you're missing an opportunity to describe what GPI DMA is.
> Perhaps something like:
> 
> In GPI DMA mode the serial engine uses the DMA controller found in the
> associated wrapper to perform its transaction, add support for enabling
> this mode in the engine.

Hmm looks like I did, I will update more kernel-doc style comments to
explain more details

> 
> > 
> > Signed-off-by: Vinod Koul <vkoul@kernel.org>
> > ---
> >  drivers/soc/qcom/qcom-geni-se.c | 32 +++++++++++++++++++++++++++++++-
> >  include/linux/qcom-geni-se.h    |  5 +++--
> >  2 files changed, 34 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/soc/qcom/qcom-geni-se.c b/drivers/soc/qcom/qcom-geni-se.c
> > index 08d645b90ed3..40a0a1f88070 100644
> > --- a/drivers/soc/qcom/qcom-geni-se.c
> > +++ b/drivers/soc/qcom/qcom-geni-se.c
> > @@ -307,6 +307,32 @@ static void geni_se_select_dma_mode(struct geni_se *se)
> >  		writel_relaxed(val, se->base + SE_GENI_DMA_MODE_EN);
> >  }
> >  
> > +static void geni_se_select_gpi_mode(struct geni_se *se)
> > +{
> > +	unsigned int gpi_event_en;
> > +	unsigned int m_irq_en;
> > +	unsigned int s_irq_en;
> 
> readl and writel operates on u32, so better to use that.

Yes

> 
> > +
> > +	geni_se_irq_clear(se);
> > +	writel(0, se->base + SE_IRQ_EN);
> > +
> > +	s_irq_en = readl_relaxed(se->base + SE_GENI_S_IRQ_EN);
> 
> I don't mind this being _relaxed if done on purpose, but as it's the
> only one (and there's no comment) I get the feeling that it's a mistake.

Yes it is a leftover, fixed now

> 
> > +	s_irq_en &= ~S_CMD_DONE_EN;
> > +	writel(s_irq_en, se->base + SE_GENI_S_IRQ_EN);
> 
> The use of 3 different variables (gpi_event_en, m_irq_en, s_irq_en)
> forced me to really look if the three sets of operations somehow reused
> previous results.
> 
> To clarify that this isn't the case I would suggest that you use a
> single variable ("val"?) instead.

Yes updated

> 
> > +
> > +	m_irq_en = readl(se->base + SE_GENI_M_IRQ_EN);
> > +	m_irq_en &= ~(M_CMD_DONE_EN | M_TX_FIFO_WATERMARK_EN |
> > +		      M_RX_FIFO_WATERMARK_EN | M_RX_FIFO_LAST_EN);
> > +	writel(m_irq_en, se->base + SE_GENI_M_IRQ_EN);
> > +
> > +	writel(GENI_DMA_MODE_EN, se->base + SE_GENI_DMA_MODE_EN);
> > +
> > +	gpi_event_en = readl(se->base + SE_GSI_EVENT_EN);
> > +	gpi_event_en |= (DMA_RX_EVENT_EN | DMA_TX_EVENT_EN |
> > +			 GENI_M_EVENT_EN | GENI_S_EVENT_EN);
> > +	writel(gpi_event_en, se->base + SE_GSI_EVENT_EN);
> > +}
> > +
> >  /**
> >   * geni_se_select_mode() - Select the serial engine transfer mode
> >   * @se:		Pointer to the concerned serial engine.
> > @@ -314,7 +340,8 @@ static void geni_se_select_dma_mode(struct geni_se *se)
> >   */
> >  void geni_se_select_mode(struct geni_se *se, enum geni_se_xfer_mode mode)
> >  {
> > -	WARN_ON(mode != GENI_SE_FIFO && mode != GENI_SE_DMA);
> > +	WARN_ON(mode != GENI_SE_FIFO && mode != GENI_SE_DMA &&
> > +		mode != GENI_GPI_DMA);
> 
> This line can be left unbroken.

yaay 100 chars :-) will do

> 
> >  
> >  	switch (mode) {
> >  	case GENI_SE_FIFO:
> > @@ -323,6 +350,9 @@ void geni_se_select_mode(struct geni_se *se, enum geni_se_xfer_mode mode)
> >  	case GENI_SE_DMA:
> >  		geni_se_select_dma_mode(se);
> >  		break;
> > +	case GENI_GPI_DMA:
> > +		geni_se_select_gpi_mode(se);
> > +		break;
> >  	case GENI_SE_INVALID:
> >  	default:
> >  		break;
> > diff --git a/include/linux/qcom-geni-se.h b/include/linux/qcom-geni-se.h
> > index 5fda675c5cfe..336b682392b1 100644
> > --- a/include/linux/qcom-geni-se.h
> > +++ b/include/linux/qcom-geni-se.h
> > @@ -11,8 +11,9 @@
> >  /* Transfer mode supported by GENI Serial Engines */
> >  enum geni_se_xfer_mode {
> >  	GENI_SE_INVALID,
> > -	GENI_SE_FIFO,
> > -	GENI_SE_DMA,
> 
> Is the order significant? Is there a reason why SE_DMA ended up last?

Nope not that I can tjing off.. I can add this as last!

-- 
~Vinod

  reply	other threads:[~2021-06-22 12:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-18 14:18 [PATCH v2 0/3] soc: qcom: geni: add support for gpi dma Vinod Koul
2021-06-18 14:18 ` [PATCH v2 1/3] soc: qcom: geni: move GENI_IF_DISABLE_RO to common header Vinod Koul
2021-06-18 17:03   ` Bjorn Andersson
2021-06-22 12:13     ` Vinod Koul
2021-06-18 14:18 ` [PATCH v2 2/3] soc: qcom: geni: move struct geni_wrapper to header Vinod Koul
2021-06-18 17:10   ` Bjorn Andersson
2021-06-18 14:18 ` [PATCH v2 3/3] soc: qcom: geni: Add support for gpi dma Vinod Koul
2021-06-18 17:23   ` Bjorn Andersson
2021-06-22 12:15     ` Vinod Koul [this message]
2021-06-18 16:59 ` [PATCH v2 0/3] soc: qcom: geni: add " Bjorn Andersson
2021-06-20 11:06   ` Vinod Koul

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=YNHUSVisKK6QnUX4@vkoul-mobl \
    --to=vkoul@kernel.org \
    --cc=agross@kernel.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=dianders@chromium.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mka@chromium.org \
    --cc=sumit.semwal@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).