public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@bootlin.com>
To: Sam Lefebvre <sam.lefebvre@essensium.com>
Cc: linux-mtd@lists.infradead.org,
	Arnout Vandecapelle <arnout@mind.be>,
	Dries Staelens <dries.staelens@barco.com>
Subject: Re: [PATCH 09/13] mtd: rawnand: gpmi: poll the BCH interrupt bit in start_dma_with_bch_irq()
Date: Thu, 26 Apr 2018 18:49:31 +0200	[thread overview]
Message-ID: <20180426184931.4f711654@bbrezillon> (raw)
In-Reply-To: <20180426154134.8270-10-sam.lefebvre@essensium.com>

On Thu, 26 Apr 2018 17:41:30 +0200
Sam Lefebvre <sam.lefebvre@essensium.com> wrote:

> To improve nand performance, the BCH interrupt bit must be polled
> before waiting for occurence. This avoids an unnecessary context switch.
> 
> Signed-off-by: Sam Lefebvre <sam.lefebvre@essensium.com>
> ---
>  drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 17 +++++++++++++++--
>  1 file changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
> index 60bc1bac7741..28a2cf106ddc 100644
> --- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
> +++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
> @@ -503,18 +503,31 @@ int start_dma_without_bch_irq(struct gpmi_nand_data *this,
>   * Actually, we must wait for two interrupts :
>   *	[1] firstly the DMA interrupt and
>   *	[2] secondly the BCH interrupt.
> + *	To improve performance, we first poll for the BCH
> + *	interrupt.
>   */
>  int start_dma_with_bch_irq(struct gpmi_nand_data *this,
>  			struct dma_async_tx_descriptor *desc)
>  {
>  	struct completion *bch_c = &this->bch_done;
> +	struct resources *r = &this->resources;
>  	unsigned long timeout;
>  
> -	/* Prepare to receive an interrupt from the BCH block. */
> -	init_completion(bch_c);
> +	/* Disable interrupt */
> +	writel(BM_BCH_CTRL_COMPLETE_IRQ_EN, r->bch_regs + HW_BCH_CTRL_CLR);

I'd prefer to have it disabled in the probe function.

>  
>  	/* start the DMA */
>  	start_dma_without_bch_irq(this, desc);
> +	if (readl(r->bch_regs + HW_BCH_CTRL) & BM_BCH_CTRL_COMPLETE_IRQ) {
> +		writel(BM_BCH_CTRL_COMPLETE_IRQ, r->bch_regs + HW_BCH_CTRL_CLR);
> +		return 0;
> +	}
> +
> +	/* Prepare to receive an interrupt from the BCH block. */
> +	init_completion(bch_c);
> +
> +	/* Re-enable interrupt */
> +	writel(BM_BCH_CTRL_COMPLETE_IRQ_EN, r->bch_regs + HW_BCH_CTRL_SET);
>  
>  	/* Wait for the interrupt from the BCH block. */
>  	timeout = wait_for_completion_timeout(bch_c, msecs_to_jiffies(1000));

And then you can disable it here, so that the interrupt is only active
when we need it.

  reply	other threads:[~2018-04-26 16:49 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-26 15:41 optimizing the nand read performance by reducing interrupts from 4 to 1 Sam Lefebvre
2018-04-26 15:41 ` [PATCH 01/13] mtd: nand: gpmi: drop dma_ops_type Sam Lefebvre
2018-04-26 15:41 ` [PATCH 02/13] mtd: nand: gpmi: pass buffer and len around Sam Lefebvre
2018-04-26 15:41 ` [PATCH 03/13] mtd: nand: gpmi: put only once used functions inline Sam Lefebvre
2018-04-26 15:41 ` [PATCH 04/13] mtd: nand: gpmi: remove direct_dma_map_ok from driver data struct Sam Lefebvre
2018-04-26 15:41 ` [PATCH 05/13] mtd: nand: gpmi: return valid value from bch_set_geometry() Sam Lefebvre
2018-04-26 15:41 ` [PATCH 06/13] mtd: nand: gpmi: remove unnecessary variables Sam Lefebvre
2018-04-26 15:41 ` [PATCH 07/13] mtd: rawnand: gpmi: set aggregate ready/busy signalling Sam Lefebvre
2018-06-18 15:00   ` Miquel Raynal
2018-04-26 15:41 ` [PATCH 08/13] mtd: rawnand: gpmi: return generated errors in gpmi_ecc_read_oob() Sam Lefebvre
2018-04-26 16:43   ` Boris Brezillon
2018-04-26 15:41 ` [PATCH 09/13] mtd: rawnand: gpmi: poll the BCH interrupt bit in start_dma_with_bch_irq() Sam Lefebvre
2018-04-26 16:49   ` Boris Brezillon [this message]
2018-04-26 15:41 ` [PATCH 10/13] mtd: rawnand: gpmi: instantiate cmdfunc Sam Lefebvre
2018-04-26 15:41 ` [PATCH 11/13] mtd: rawnand: gpmi: gpmi_nand_command(): simplification and formatting Sam Lefebvre
2018-04-26 15:41 ` [PATCH 12/13] mtd: rawnand: gpmi: issue two commands in a single DMA chain Sam Lefebvre
2018-04-26 15:41 ` [PATCH 13/13] mtd: rawnand: gmpi: chain gpmi_nand_command() with gpmi_ecc_read_page_data() Sam Lefebvre
2018-04-26 21:46   ` Boris Brezillon
2018-04-26 16:28 ` optimizing the nand read performance by reducing interrupts from 4 to 1 Boris Brezillon
2018-04-27 10:27   ` Sam Lefebvre
2018-04-27 12:09     ` Boris Brezillon
2018-04-26 20:07 ` Boris Brezillon

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=20180426184931.4f711654@bbrezillon \
    --to=boris.brezillon@bootlin.com \
    --cc=arnout@mind.be \
    --cc=dries.staelens@barco.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=sam.lefebvre@essensium.com \
    /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