public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Hauke Mehrtens <hauke@hauke-m.de>
Cc: richard@nod.at, dwmw2@infradead.org, computersforpeace@gmail.com,
	linux-mtd@lists.infradead.org, john@phrozen.org
Subject: Re: [PATCH v4 4/8] mtd: nand: xway: use generic reset function
Date: Mon, 20 Jun 2016 10:50:24 +0200	[thread overview]
Message-ID: <20160620105024.0f711aed@bbrezillon> (raw)
In-Reply-To: <1466355785-13689-5-git-send-email-hauke@hauke-m.de>

On Sun, 19 Jun 2016 19:03:01 +0200
Hauke Mehrtens <hauke@hauke-m.de> wrote:

> Instead of writing an own reset function use the generic NAND reset
> function. This way we can remove our own reset function.
> 
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> ---
>  drivers/mtd/nand/xway_nand.c | 23 +++--------------------
>  1 file changed, 3 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/mtd/nand/xway_nand.c b/drivers/mtd/nand/xway_nand.c
> index 6028edb..8a0019a 100644
> --- a/drivers/mtd/nand/xway_nand.c
> +++ b/drivers/mtd/nand/xway_nand.c
> @@ -35,7 +35,6 @@
>  #define NAND_CMD_CS		BIT(4) /* chip select */
>  #define NAND_CMD_SE		BIT(5) /* spare area access latch */
>  #define NAND_CMD_WP		BIT(6) /* write protect */
> -#define NAND_WRITE_CMD_RESET	0xff
>  #define NAND_WRITE_CMD		(NAND_CMD_CS | NAND_CMD_CLE)
>  #define NAND_WRITE_ADDR		(NAND_CMD_CS | NAND_CMD_ALE)
>  #define NAND_WRITE_DATA		(NAND_CMD_CS)
> @@ -68,22 +67,6 @@ struct xway_nand_data {
>  	struct nand_chip	chip;
>  };
>  
> -static void xway_reset_chip(struct nand_chip *chip)
> -{
> -	unsigned long nandaddr = (unsigned long) chip->IO_ADDR_W;
> -	unsigned long flags;
> -
> -	nandaddr &= ~NAND_WRITE_ADDR;
> -	nandaddr |= NAND_WRITE_CMD;
> -
> -	/* finish with a reset */
> -	spin_lock_irqsave(&ebu_lock, flags);
> -	writeb(NAND_WRITE_CMD_RESET, (void __iomem *) nandaddr);
> -	while ((ltq_ebu_r32(EBU_NAND_WAIT) & NAND_WAIT_WR_C) == 0)
> -		;
> -	spin_unlock_irqrestore(&ebu_lock, flags);
> -}
> -
>  static void xway_select_chip(struct mtd_info *mtd, int chip)
>  {
>  
> @@ -199,14 +182,14 @@ static int xway_nand_probe(struct platform_device *pdev)
>  		| NAND_CON_SE_P | NAND_CON_WP_P | NAND_CON_PRE_P
>  		| cs_flag, EBU_NAND_CON);
>  
> -	/* finish with a reset */
> -	xway_reset_chip(&data->chip);
> -
>  	/* Scan to find existence of the device */
>  	err = nand_scan(mtd, 1);
>  	if (err)
>  		return err;
>  
> +	/* finish with a reset */
> +	data->chip.cmdfunc(mtd, NAND_CMD_RESET, -1, -1);
> +

Hm, I wonder if this is really useful. The NAND chip is already reset
as part of the nand_scan() process. Are you sure you need to reset it
again here?

Can you test after dropping this reset operation?

  reply	other threads:[~2016-06-20  8:50 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-19 17:02 [PATCH v4 0/8] MTD: xway: fix driver Hauke Mehrtens
2016-06-19 17:02 ` [PATCH v4 1/8] mtd: nand: xway: add some more documentation Hauke Mehrtens
2016-06-19 17:02 ` [PATCH v4 2/8] mtd: nand: xway: convert to normal platform driver Hauke Mehrtens
2016-06-19 17:03 ` [PATCH v4 3/8] mtd: nand: xway: Avoid messing up with IO_ADDR_W in ->cmd_ctrl() Hauke Mehrtens
2016-06-19 17:03 ` [PATCH v4 4/8] mtd: nand: xway: use generic reset function Hauke Mehrtens
2016-06-20  8:50   ` Boris Brezillon [this message]
2016-06-20 21:19     ` Hauke Mehrtens
2016-06-19 17:03 ` [PATCH v4 5/8] mtd: nand: xway: fix nand locking Hauke Mehrtens
2016-06-19 17:03 ` [PATCH v4 6/8] mtd: nand: xway: extract read and write function Hauke Mehrtens
2016-06-19 17:03 ` [PATCH v4 7/8] mtd: nand: xway: add missing write_buf and read_buf to nand driver Hauke Mehrtens
2016-06-19 17:03 ` [PATCH v4 8/8] mtd: nand: xway: add nandaddr to own struct Hauke Mehrtens

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=20160620105024.0f711aed@bbrezillon \
    --to=boris.brezillon@free-electrons.com \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=hauke@hauke-m.de \
    --cc=john@phrozen.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=richard@nod.at \
    /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