public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Cyrille Pitchen <cyrille.pitchen@atmel.com>
To: Marek Vasut <marex@denx.de>
Cc: <nicolas.ferre@atmel.com>, <broonie@kernel.org>,
	<linux-spi@vger.kernel.org>, <dwmw2@infradead.org>,
	<computersforpeace@gmail.com>, <zajec5@gmail.com>,
	<beanhuo@micron.com>, <juhosg@openwrt.org>, <ben@decadent.org.uk>,
	<linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<devicetree@vger.kernel.org>, <robh+dt@kernel.org>,
	<pawel.moll@arm.com>, <mark.rutland@arm.com>,
	<ijc+devicetree@hellion.org.uk>, <galak@codeaurora.org>,
	<linux-mtd@lists.infradead.org>
Subject: Re: [PATCH linux-next v6 1/8] mtd: spi-nor: read JEDEC ID with multiple I/O protocols
Date: Wed, 9 Sep 2015 17:55:22 +0200	[thread overview]
Message-ID: <55F0566A.7060501@atmel.com> (raw)
In-Reply-To: <201509091559.40948.marex@denx.de>

Hi Marek,

Le 09/09/2015 15:59, Marek Vasut a écrit :
> On Wednesday, September 09, 2015 at 03:24:11 PM, Cyrille Pitchen wrote:
>> When their quad or dual I/O mode is enabled, Micron and Macronix spi-nor
>> memories don't reply to the regular Read ID (0x9f) command. Instead they
>> reply to a new dedicated command Read ID Multiple I/O (0xaf).
>>
>> If the Read ID (0x9f) command fails (the read ID is all 1's or all 0's),
>> then the Read ID Multiple I/O (0xaf) is used, first with SPI 4-4-4 protocol
>> (supported by both Micron and Macronix memories), lately with SPI-2-2-2
>> protocol (supported only by Micron memories).
>>
>> Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com>
>> ---
>>  drivers/mtd/spi-nor/spi-nor.c | 28 +++++++++++++++++++++++++++-
>>  include/linux/mtd/spi-nor.h   | 23 +++++++++++++++++++++--
>>  2 files changed, 48 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
>> index f59aedfe1462..80a0db078aaa 100644
>> --- a/drivers/mtd/spi-nor/spi-nor.c
>> +++ b/drivers/mtd/spi-nor/spi-nor.c
>> @@ -703,8 +703,9 @@ static const struct flash_info spi_nor_ids[] = {
>>
>>  static const struct flash_info *spi_nor_read_id(struct spi_nor *nor)
>>  {
>> -	int			tmp;
>> +	int			i, tmp;
>>  	u8			id[SPI_NOR_MAX_ID_LEN];
>> +	enum spi_protocol	proto[2] = {SPI_PROTO_4_4_4, SPI_PROTO_2_2_2};
>>  	const struct flash_info	*info;
>>
>>  	tmp = nor->read_reg(nor, SPINOR_OP_RDID, id, SPI_NOR_MAX_ID_LEN);
>> @@ -713,6 +714,25 @@ static const struct flash_info *spi_nor_read_id(struct
>> spi_nor *nor) return ERR_PTR(tmp);
>>  	}
>>
>> +	/* Special case for Micron/Macronix qspi nor. */
>> +	for (i = 0; i < ARRAY_SIZE(proto); ++i) {
>> +		if (!((id[0] == 0xff && id[1] == 0xff && id[2] == 0xff) ||
>> +		      (id[0] == 0x00 && id[1] == 0x00 && id[2] == 0x00)))
>> +			break;
>> +
>> +		nor->erase_proto = proto[i];
>> +		nor->read_proto = proto[i];
>> +		nor->write_proto = proto[i];
>> +		nor->reg_proto = proto[i];
>> +		tmp = nor->read_reg(nor, SPINOR_OP_MIO_RDID,
>> +				    id, SPI_NOR_MAX_ID_LEN);
>> +		if (tmp < 0) {
>> +			dev_dbg(nor->dev,
>> +				" error %d reading JEDEC ID (MULTI IO)\n", tmp);
> 
> Don't you have one space too much in front of the " error" ?
> 

Probably, I've just copied and pasted the dev_dbg() message few lines above when
the regular SPINOR_OP_RDID fails, then appended the "(MULTI IO)" string to make
think consistent but I don't mind removing the leading space.

	tmp = nor->read_reg(nor, SPINOR_OP_RDID, id, SPI_NOR_MAX_ID_LEN);
	if (tmp < 0) {
		dev_dbg(nor->dev, " error %d reading JEDEC ID\n", tmp);
		return ERR_PTR(tmp);
	}

>> +			return ERR_PTR(tmp);
>> +		}
>> +	}
>> +
>>  	for (tmp = 0; tmp < ARRAY_SIZE(spi_nor_ids) - 1; tmp++) {
>>  		info = &spi_nor_ids[tmp];
>>  		if (info->id_len) {
> 
> [...]
> 

Best Regards,

Cyrille

  reply	other threads:[~2015-09-09 15:55 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-09 13:24 [PATCH linux-next v6 0/8] add driver for Atmel QSPI controller Cyrille Pitchen
2015-09-09 13:24 ` [PATCH linux-next v6 1/8] mtd: spi-nor: read JEDEC ID with multiple I/O protocols Cyrille Pitchen
2015-09-09 13:59   ` Marek Vasut
2015-09-09 15:55     ` Cyrille Pitchen [this message]
2015-09-10 10:25   ` Jonas Gorski
2015-09-09 13:24 ` [PATCH linux-next v6 2/8] mtd: spi-nor: remove unused read_xfer/write_xfer hooks Cyrille Pitchen
2015-09-09 13:24 ` [PATCH linux-next v6 3/8] mtd: spi-nor: update the SPI protocol when enabling manufacturer Quad mode Cyrille Pitchen
2015-09-09 13:24 ` [PATCH linux-next v6 4/8] mtd: spi-nor: use optimized commands for read/write/erase operations Cyrille Pitchen
2015-09-10 10:28   ` Jonas Gorski
2015-09-09 13:24 ` [PATCH linux-next v6 5/8] Documentation: mtd: add a DT property to set the number of dummy cycles Cyrille Pitchen
2015-09-09 13:24 ` [PATCH linux-next v6 6/8] mtd: spi-nor: allow to tune " Cyrille Pitchen
2015-09-09 13:24 ` [PATCH linux-next v6 7/8] Documentation: atmel-quadspi: add binding file for Atmel QSPI driver Cyrille Pitchen
2015-09-09 13:24 ` [PATCH linux-next v6 8/8] mtd: atmel-quadspi: add driver for Atmel QSPI controller Cyrille Pitchen
2015-09-10 10:36 ` [PATCH linux-next v6 0/8] " Jonas Gorski

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=55F0566A.7060501@atmel.com \
    --to=cyrille.pitchen@atmel.com \
    --cc=beanhuo@micron.com \
    --cc=ben@decadent.org.uk \
    --cc=broonie@kernel.org \
    --cc=computersforpeace@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dwmw2@infradead.org \
    --cc=galak@codeaurora.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=juhosg@openwrt.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=marex@denx.de \
    --cc=mark.rutland@arm.com \
    --cc=nicolas.ferre@atmel.com \
    --cc=pawel.moll@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=zajec5@gmail.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