public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Marek Vasut <marek.vasut@gmail.com>
To: Alexander Amelkin <a.amelkin@yadro.com>, linux-mtd@lists.infradead.org
Cc: openbmc@lists.ozlabs.org, "Joel Stanley" <joel@jms.id.au>,
	"Cédric Le Goater" <clg@kaod.org>,
	leroi.lists@gmail.com
Subject: Re: [PATCH] mtd: spi-nor: fix options for mx66l51235f
Date: Tue, 28 Aug 2018 13:43:17 +0200	[thread overview]
Message-ID: <c02dc76b-adc7-4c6f-f3c1-3131ce86e0b0@gmail.com> (raw)
In-Reply-To: <286877dc-22fe-9f49-458a-6a6a0ce0b1c0@yadro.com>

On 08/28/2018 01:29 PM, Alexander Amelkin wrote:
> 27.08.2018 14:34, Marek Vasut wrote:

Hi,

>>>>> According to the datasheet for mx66l51235f, "The device default is in
>>>>> 24-bit address mode" (section 9-10). Having option SPI_NOR_4B_OPCODES
>>>>> makes the code act as if the device was already in 4B mode and didn't
>>>>> need the EN4B command. That prevents this chip from functioning on
>>>>> systems where the boot loader left the chip in 3B mode (e.g. if the
>>>>> chip wasn't used during the boot process).
>>>>>
>>>>> Hence, this commit removes the SPI_NOR_4B_OPCODES option for
>>>>> mx66l51235f (added previously by commit d342b6a973af).
>>>> Could it be there are two variants of the chip, one which supports the
>>>> 4B opcodes and one which does not ? Wouldn't be the first time I saw
>>>> this. If this chip supports the SFDP tables, you can check those.
>>> I was unable to find another variant of the chip. There is only one specified in the datasheet:
>>> http://www.macronix.com/Lists/Datasheet/Attachments/7401/MX66L51235F,%203V,%20512Mb,%20v1.1.pdf
>>> and it says that the device supports both 3B and 4B modes, but defaults to 3B (24-bit) mode.
>> So keep the 4B part in. Linux will just not reconfigure the device to 4B
>> mode using register write, but will instead issue the 4B opcode
>> directly, without any stateful change.
> Marek, thank you for asking all these questions. They made me conduct a deeper investigation than just finding the commit that broke it and reverting it. It appears that OpenPOWER P8's SBE code (the thing that P8 CPU runs first from its built-in memory) expects the PNOR flash chip to be in EN4B mode. It reads the rest of OpenPOWER Firmware using a usual READ (0x03) command with 4 bytes of address. Always. That's why, I believe, Roman's commit broke host booting for us.

Uh oh, I seem to remember some flashes had this weird quirk where they
were in EN4B mode by default, and if U-Boot/Linux reset the flash into
"sane default" state (3B addressing etc), some systems failed to boot.
Furthermore, this EN4B is non-volatile bit on this flash, right ? That
means it is retained across power-cycles, which sucks even more.

> Probably it would be best not to merge this patch into Linux kernel. I'll discuss it with colleagues from OpenPOWER community and we'll probably fix it on SBE side.

Can you fix the firmware ? If so, that'd be amazing.
But still, there can be a software which does rogue transmission on the
SPI bus and flips the flash into 3B mode before reset, so the system
will not boot anyway. Do you have a way to deal with that somehow ?

> As for renaming the chip, I can provide a patch just for that. Or we can leave it as is.

A patch would be nice, yes.

> Thanks.
> Alexander.
> 


-- 
Best regards,
Marek Vasut

  reply	other threads:[~2018-08-28 11:43 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-20 10:26 [PATCH] mtd: spi-nor: fix options for mx66l51235f Alexander Amelkin
2018-08-27 10:33 ` Marek Vasut
2018-08-27 11:24   ` Alexander Amelkin
2018-08-27 11:34     ` Marek Vasut
2018-08-28 11:29       ` Alexander Amelkin
2018-08-28 11:43         ` Marek Vasut [this message]
2018-08-28 15:54           ` Alexander Amelkin
2018-08-28 16:03             ` Marek Vasut
2018-08-29 11:00               ` Alexander Amelkin
2018-08-29 11:46                 ` Marek Vasut
2018-08-29 12:12                   ` Cédric Le Goater
2018-08-30 14:16                     ` Cyrille Pitchen
2018-08-30 14:17                       ` Marek Vasut
2018-08-29 12:05                 ` Cédric Le Goater
2018-08-29 21:16       ` Roman Yeryomin
2018-08-31  8:04         ` Cédric Le Goater

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=c02dc76b-adc7-4c6f-f3c1-3131ce86e0b0@gmail.com \
    --to=marek.vasut@gmail.com \
    --cc=a.amelkin@yadro.com \
    --cc=clg@kaod.org \
    --cc=joel@jms.id.au \
    --cc=leroi.lists@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=openbmc@lists.ozlabs.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox