All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Hauke Mehrtens <hauke@hauke-m.de>
Cc: computersforpeace@gmail.com, linux-mtd@lists.infradead.org,
	David.Woodhouse@intel.com, john@phrozen.org
Subject: Re: [PATCH 3/6] MTD: xway: the latched command should be persistent
Date: Tue, 7 Jun 2016 11:30:21 +0200	[thread overview]
Message-ID: <20160607113021.00998d8b@bbrezillon> (raw)
In-Reply-To: <1465161609-19303-4-git-send-email-hauke@hauke-m.de>

On Sun,  5 Jun 2016 23:20:06 +0200
Hauke Mehrtens <hauke@hauke-m.de> wrote:

> From: John Crispin <john@phrozen.org>
> 
> If they are not persistent a different address will be used and the
> controller will deactivate some pins.
> 
> Signed-off-by: John Crispin <john@phrozen.org>
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> ---
>  drivers/mtd/nand/xway_nand.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/mtd/nand/xway_nand.c b/drivers/mtd/nand/xway_nand.c
> index 0ab6e83..79fecc8 100644
> --- a/drivers/mtd/nand/xway_nand.c
> +++ b/drivers/mtd/nand/xway_nand.c
> @@ -64,6 +64,8 @@
>  #define NAND_CON_CSMUX		(1 << 1)
>  #define NAND_CON_NANDM		1
>  
> +static u32 xway_latchcmd;

Please avoid using global variables. This field should be part of your
private nand_chip struct.

> +
>  static void xway_reset_chip(struct nand_chip *chip)
>  {
>  	unsigned long nandaddr = (unsigned long) chip->IO_ADDR_W;
> @@ -104,17 +106,15 @@ static void xway_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
>  	unsigned long flags;
>  
>  	if (ctrl & NAND_CTRL_CHANGE) {
> -		nandaddr &= ~(NAND_WRITE_CMD | NAND_WRITE_ADDR);
>  		if (ctrl & NAND_CLE)
> -			nandaddr |= NAND_WRITE_CMD;
> -		else
> -			nandaddr |= NAND_WRITE_ADDR;
> -		this->IO_ADDR_W = (void __iomem *) nandaddr;
> +			xway_latchcmd = NAND_WRITE_CMD;
> +		else if (ctrl & NAND_ALE)
> +			xway_latchcmd = NAND_WRITE_ADDR;
>  	}
>  
>  	if (cmd != NAND_CMD_NONE) {
>  		spin_lock_irqsave(&ebu_lock, flags);
> -		writeb(cmd, this->IO_ADDR_W);
> +		writeb(cmd, (void __iomem *) (nandaddr | xway_latchcmd));
>  		while ((ltq_ebu_r32(EBU_NAND_WAIT) & NAND_WAIT_WR_C) == 0)
>  			;
>  		spin_unlock_irqrestore(&ebu_lock, flags);



-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

  reply	other threads:[~2016-06-07  9:30 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-05 21:20 [PATCH 0/6] MTD: xway: updates from OpenWrt/LEDE Hauke Mehrtens
2016-06-05 21:20 ` [PATCH 1/6] MTD: xway: add some more documentation Hauke Mehrtens
2016-06-05 21:20 ` [PATCH 2/6] MTD: xway: fix invalid operator Hauke Mehrtens
2016-06-07  9:28   ` Boris Brezillon
2016-06-07 17:40     ` Hauke Mehrtens
2016-06-07 19:04       ` Boris Brezillon
2016-06-05 21:20 ` [PATCH 3/6] MTD: xway: the latched command should be persistent Hauke Mehrtens
2016-06-07  9:30   ` Boris Brezillon [this message]
2016-06-05 21:20 ` [PATCH 4/6] MTD: xway: remove endless loop Hauke Mehrtens
2016-06-05 21:20 ` [PATCH 5/6] MTD: xway: add missing write_buf and read_buf to nand driver Hauke Mehrtens
2016-06-07  9:34   ` Boris Brezillon
2016-06-05 21:20 ` [PATCH 6/6] MTD: xway: fix nand locking Hauke Mehrtens
2016-06-07  9:24 ` [PATCH 0/6] MTD: xway: updates from OpenWrt/LEDE Boris Brezillon
2016-06-07 17:37   ` Hauke Mehrtens
2016-06-07  9:48 ` Boris Brezillon
2016-06-07 10:12   ` John Crispin
2016-06-07 17:36     ` Hauke Mehrtens
2016-06-07 19:01       ` Boris Brezillon
2016-06-07 19:10         ` 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=20160607113021.00998d8b@bbrezillon \
    --to=boris.brezillon@free-electrons.com \
    --cc=David.Woodhouse@intel.com \
    --cc=computersforpeace@gmail.com \
    --cc=hauke@hauke-m.de \
    --cc=john@phrozen.org \
    --cc=linux-mtd@lists.infradead.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.