All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Łukasz Majewski" <lukma@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2] sf: bar: Clean BA24 Bank Address Register bit after read/write/erase operation
Date: Tue, 26 Sep 2017 10:01:45 +0200	[thread overview]
Message-ID: <4d7c3a9d-204f-44ac-360c-09966f78bdc5@denx.de> (raw)
In-Reply-To: <1b652f54-0783-12bb-5d89-0038d2bdde0f@denx.de>

Hi Jagan,

> On 09/26/2017 07:40 AM, Jagan Teki wrote:
>> On Mon, Sep 25, 2017 at 4:10 PM, Lukasz Majewski <lukma@denx.de> wrote:
>>> The content of Bank Address Register (BAR) is volatile. It is cleared
>>> after power cycle or reset command (RESET F0h).
>>>
>>> Some memories (like e.g. s25fl256s) use it to access memory larger than
>>> 0x1000000 (16 MiB).
>>>
>>> The problem shows up when one:
>>>
>>> 1. Reads/writes/erases memory > 16 MiB
>>> 2. Calls "reset" u-boot command (which is not causing BAR to be cleared)
>>>
>>> In the above scenario, the SoC ROM sends 0x000000 address to read SPL.
>>> Unfortunately, the BA24 bit is still set and hence it receives content
>>> from 0x1000000 (16 MiB) memory address.
>>> As a result the SoC aborts and we hang. Only power cycle can take the
>>> SoC out of this state.
>>>
>>> How to reproduce/test:
>>>
>>> sf probe; sf erase 0x1200000 0x800000; reset
>>> sf probe; sf erase 0x1200000 0x800000; sf write 0x11000000 0x1200000 
>>> 0x800000; reset
>>> sf probe; sf read 0x11000000 0x1200000 0x800000; reset
>>
>> Sorry, I didn't follow this test.. are you writing on at 18MiB offset
>> and doing reset how it will reproduce? 
> 
> Please start with erase test case first.
> 
> The problem shows up when you try to access SPI-NOR memory > 16 MiB.
> It works with current code, since BAR is adjusted properly.
> 
> Then after this access (without removing power), please type 'reset' 
> command.
> 
> You will observe, that the board will not boot (if SPI-NOR is a booting 
> device).
> 
> The problem is that ROM bootloader tries to access 0x0 address, but BA24 
> (in the SPI-NOR controller)  is programmed from last operation (to 0x1). 
> Hence, the ROM Boot reads from 0x1000000 address.

And maybe some explanation why and how it was discovered.

I was storing in u-boot rootfs on SPI-NOR. This data crossed 16 MiB 
boundary on my Spansion memory.
After this operation I wanted to move forward with factory setup 
procedure and executed "reset".

The board hanged and I had to power cycle it to have it working again.

> 
> 
>> because we can write it 0x0 and
>> after reset the ROM look for 16MiB on this flash this is what you
>> concern about right?
> 
> The problem is with not clearing bit BA24 after each operation. This 
> causes hangs after "reset" command.
> 
> 
>>
>> thanks!
>>
> 
> 


-- 
Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de

  reply	other threads:[~2017-09-26  8:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-25 10:40 [U-Boot] [PATCH v2] sf: bar: Clean BA24 Bank Address Register bit after read/write/erase operation Lukasz Majewski
2017-09-26  5:40 ` Jagan Teki
2017-09-26  7:07   ` Łukasz Majewski
2017-09-26  8:01     ` Łukasz Majewski [this message]
2017-09-27  7:14     ` Jagan Teki
2017-09-27  7:54       ` Łukasz Majewski
2017-09-27  8:03         ` Jagan Teki
2017-09-27  8:04 ` Jagan Teki
2017-09-27  8:07   ` Łukasz Majewski

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=4d7c3a9d-204f-44ac-360c-09966f78bdc5@denx.de \
    --to=lukma@denx.de \
    --cc=u-boot@lists.denx.de \
    /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.