All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: grmoore@altera.com
Cc: ggrahammoore@gmail.com,
	Artem Bityutskiy <artem.bityutskiy@linux.intel.com>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Jingoo Han <jg1.han@samsung.com>,
	Geert Uytterhoeven <geert+renesas@linux-m68k.org>,
	linux-kernel@vger.kernel.org,
	Yves Vandervennet <rocket.yvanderv@gmail.com>,
	linux-mtd@lists.infradead.org,
	Insop Song <insop.song@gainspeed.com>,
	Alan Tull <atull@altera.com>,
	Sourav Poddar <sourav.poddar@ti.com>,
	Brian Norris <computersforpeace@gmail.com>,
	David Woodhouse <dwmw2@infradead.org>,
	Dinh Nguyen <dinguyen@altera.com>
Subject: Re: [PATCH] Add support for flag status register on Micron chips.
Date: Wed, 9 Apr 2014 12:06:45 +0200	[thread overview]
Message-ID: <201404091206.45967.marex@denx.de> (raw)
In-Reply-To: <1396973570-13995-2-git-send-email-grmoore@altera.com>

On Tuesday, April 08, 2014 at 06:12:50 PM, grmoore@altera.com wrote:
> From: Graham Moore <grmoore@altera.com>
> 
> Some new Micron flash chips require reading the flag
> status register to determine when operations have completed.
> 
> Furthermore, chips with multi-die stacks of the 65nm 256Mb QSPI also
> require reading the status register before reading the flag status
> register.
> 
> This patch adds support for the flag status register in the n25q512a1 and
> n25q00 Micron QSPI flash chips.

[...]

> +static int read_fsr(struct m25p *flash)
> +{
> +	ssize_t retval;
> +	u8 code = OPCODE_RDFSR;
> +	u8 val;
> +
> +	retval = spi_write_then_read(flash->spi, &code, 1, &val, 1);
> +
> +	if (retval < 0) {
> +		dev_err(&flash->spi->dev, "error %d reading FSR\n",
> +				(int) retval);

Is the type-cast really needed here? Why ?

> +		return retval;
> +	}
> +
> +	return val;
> +}
> +/*
>   * Read configuration register, returning its value in the
>   * location. Return the configuration register value.
>   * Returns negative if error occured.
> @@ -233,7 +259,7 @@ static inline int set_4byte(struct m25p *flash, u32
> jedec_id, int enable) * Service routine to read status register until
> ready, or timeout occurs. * Returns non-zero if error.
>   */
> -static int wait_till_ready(struct m25p *flash)
> +static int _wait_till_ready(struct m25p *flash)

Please avoid using function names that start with underscore .
[...]

Thanks!

Best regards,
Marek Vasut

WARNING: multiple messages have this Message-ID (diff)
From: Marek Vasut <marex@denx.de>
To: grmoore@altera.com
Cc: ggrahammoore@gmail.com, David Woodhouse <dwmw2@infradead.org>,
	Brian Norris <computersforpeace@gmail.com>,
	Artem Bityutskiy <artem.bityutskiy@linux.intel.com>,
	Sourav Poddar <sourav.poddar@ti.com>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Geert Uytterhoeven <geert+renesas@linux-m68k.org>,
	Jingoo Han <jg1.han@samsung.com>,
	Insop Song <insop.song@gainspeed.com>,
	linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
	Alan Tull <atull@altera.com>, Dinh Nguyen <dinguyen@altera.com>,
	Yves Vandervennet <rocket.yvanderv@gmail.com>
Subject: Re: [PATCH] Add support for flag status register on Micron chips.
Date: Wed, 9 Apr 2014 12:06:45 +0200	[thread overview]
Message-ID: <201404091206.45967.marex@denx.de> (raw)
In-Reply-To: <1396973570-13995-2-git-send-email-grmoore@altera.com>

On Tuesday, April 08, 2014 at 06:12:50 PM, grmoore@altera.com wrote:
> From: Graham Moore <grmoore@altera.com>
> 
> Some new Micron flash chips require reading the flag
> status register to determine when operations have completed.
> 
> Furthermore, chips with multi-die stacks of the 65nm 256Mb QSPI also
> require reading the status register before reading the flag status
> register.
> 
> This patch adds support for the flag status register in the n25q512a1 and
> n25q00 Micron QSPI flash chips.

[...]

> +static int read_fsr(struct m25p *flash)
> +{
> +	ssize_t retval;
> +	u8 code = OPCODE_RDFSR;
> +	u8 val;
> +
> +	retval = spi_write_then_read(flash->spi, &code, 1, &val, 1);
> +
> +	if (retval < 0) {
> +		dev_err(&flash->spi->dev, "error %d reading FSR\n",
> +				(int) retval);

Is the type-cast really needed here? Why ?

> +		return retval;
> +	}
> +
> +	return val;
> +}
> +/*
>   * Read configuration register, returning its value in the
>   * location. Return the configuration register value.
>   * Returns negative if error occured.
> @@ -233,7 +259,7 @@ static inline int set_4byte(struct m25p *flash, u32
> jedec_id, int enable) * Service routine to read status register until
> ready, or timeout occurs. * Returns non-zero if error.
>   */
> -static int wait_till_ready(struct m25p *flash)
> +static int _wait_till_ready(struct m25p *flash)

Please avoid using function names that start with underscore .
[...]

Thanks!

Best regards,
Marek Vasut

  parent reply	other threads:[~2014-04-09 10:07 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-08 16:12 [PATCH] Add support for flag status register on Micron chips grmoore
2014-04-08 16:12 ` grmoore
2014-04-08 16:12 ` grmoore
2014-04-08 16:12   ` grmoore
2014-04-08 16:52   ` Insop Song
2014-04-08 16:52     ` Insop Song
2014-04-09 10:06   ` Marek Vasut [this message]
2014-04-09 10:06     ` Marek Vasut
2014-04-09 10:16     ` Jingoo Han
2014-04-09 10:16       ` Jingoo Han
2014-04-09 10:21       ` Jingoo Han
2014-04-09 10:21         ` Jingoo Han
2014-04-09 10:03 ` Marek Vasut
2014-04-09 10:03   ` Marek Vasut
2014-04-09 11:09   ` Gerhard Sittig
2014-04-09 11:09     ` Gerhard Sittig
2014-04-09 18:14     ` Graham Moore
2014-04-09 18:14       ` Graham Moore
2014-04-09 18:31       ` Marek Vasut
2014-04-09 18:31         ` Marek Vasut

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=201404091206.45967.marex@denx.de \
    --to=marex@denx.de \
    --cc=artem.bityutskiy@linux.intel.com \
    --cc=atull@altera.com \
    --cc=computersforpeace@gmail.com \
    --cc=dinguyen@altera.com \
    --cc=dwmw2@infradead.org \
    --cc=geert+renesas@linux-m68k.org \
    --cc=ggrahammoore@gmail.com \
    --cc=grmoore@altera.com \
    --cc=insop.song@gainspeed.com \
    --cc=jg1.han@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=rocket.yvanderv@gmail.com \
    --cc=s.hauer@pengutronix.de \
    --cc=sourav.poddar@ti.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 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.