public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Aaron Williams <Aaron.Williams@caviumnetworks.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] CFI flash broken for 8-bit bus
Date: Thu, 17 Mar 2011 21:02:33 -0700	[thread overview]
Message-ID: <201103172102.33681.Aaron.Williams@caviumnetworks.com> (raw)

Hi,

I am running into issues in that the CFI code is broken for flash with an 8-
bit bus. The problem is that the CFI code uses the wrong addresses for 8-bits 
vs 16-bits.

The CFI function flash_map incorrectly calculates the byte offset with 
Spansion flash.

In our case, we have an 8-bit Spansion S29GL-N MirrorBit flash chip on an 8-
bit bus.

According to the data sheet, in 8-bit mode the first unlock address is 0xAAA 
and the second is 0x555. Basically all of the addresses are approximately 
double what they are in 16-bit mode.

Most of the addresses in the CFI code are wrong for 8-bit mode.

They should be as follows:
unlock1: 0xAAA
unlock2: 0x555
CFI Query: 0xAA

Offset Device ID: 0x02, 0x1c, 0x1e
Offset Silicon Sector Factory Protect: 0x6
Sector protect verify (sector address) + 4

The problem is that the dectection code detects (incorrectly) that we're an 8-
bit device on a 16-bit bus when in fact it's an 8-bit bus.

For 16-bits, it's:

unlock1: 0x555
unlock2: 0x2aa
CFI Query: 0x55
Offset Device ID: 0x1, 0x0e, 0x0f

Now, in 16-bit mode these addresses should be effectively doubled so they 
should look to be the same to software as I understand it.

This is all taken from the datasheet.

Note that the CFI code works fine with the flash hooked up as 16-bit on a 16-
bit bus.

If it's an 8-bit flash on a 16-bit bus then the addresses should be doubled.

flash detect cfi                                                                                         
fwc addr 1ec00000 cmd f0 f0 8bit x 8 bit                                                                 
fwc addr 1ec00000 cmd ff ff 8bit x 8 bit                                                                 
fwc addr 1ec00055 cmd 98 98 8bit x 8 bit   <== should be 0x1ec000AA
is= cmd 51(Q) addr 1ec00010 is= 0 51                                                                     
fwc addr 1ec00000 cmd f0 f0 8bit x 8 bit                                                                 
fwc addr 1ec00000 cmd ff ff 8bit x 8 bit                                                                 
fwc addr 1ec00555 cmd 98 98 8bit x 8 bit
is= cmd 51(Q) addr 1ec00010 is= 0 51                                                                     
fwc addr 1ec00000 cmd f0 f0f0 16bit x 8 bit                                                              
fwc addr 1ec00000 cmd ff ffff 16bit x 8 bit                                                              
fwc addr 1ec000aa cmd 98 9898 16bit x 8 bit                                                              
is= cmd 51(Q) addr 1ec00020 is= 5151 5151                                                                
is= cmd 52(R) addr 1ec00022 is= 5252 5252                                                                
is= cmd 59(Y) addr 1ec00024 is= 5959 5959                                                                
device interface is 2                                                                                    
found port 2 chip 1 port 16 bits chip 8 bits                                                             
00 : 51 52 59 02 00 40 00 00 00 00 00 27 36 00 00 06  QRY..@.....'6...                                   
10 : 06 09 13 03 05 03 02 18 02 00 06 00 01 7f 00 00  ................                                   
20 : 02 00 00 00 00 00 00 00 00 00 00 00 00 08 13 e8  ................                                   
fwc addr 1ec00000 cmd f0 f0f0 16bit x 8 bit                                                              
fwc addr 1ec01554 cmd aa aaaa 16bit x 8 bit                                                              
fwc addr 1ec00aaa cmd 55 5555 16bit x 8 bit                                                              
fwc addr 1ec01554 cmd 90 9090 16bit x 8 bit                                                              
fwc addr 1ec00000 cmd f0 f0f0 16bit x 8 bit                                                              
fwc addr 1ec000aa cmd 98 9898 16bit x 8 bit                                                              
manufacturer is 2                                                                                        
manufacturer id is 0x0                                                                                   
device id is 0x3f                                                                                        
device id2 is 0x0                                                                                        
cfi version is 0x3133                                                                                    
size_ratio 1 port 16 bits chip 8 bits                                                                    
found 1 erase regions                                                                                    
erase region 0: 0x0200007f                                                                               
erase_region_count = 128 erase_region_size = 131072                                                      
fwc addr 1ec00000 cmd f0 f0 8bit x 8 bit                                                                 
fwc addr 1fbe0000 cmd 70 70 8bit x 8 bit                                                                 
flash_is_busy: 0                                                                                         
Flash: 16 MiB                                                      

-Aaron

             reply	other threads:[~2011-03-18  4:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-18  4:02 Aaron Williams [this message]
2011-03-18  7:12 ` [U-Boot] CFI flash broken for 8-bit bus Rogan Dawes
2011-03-18  7:48   ` Aaron Williams
2011-03-24  3:07   ` Aaron Williams
2011-03-24  5:20     ` Stefan Roese
2011-03-24 16:59     ` Rogan Dawes
2011-03-26  6:32       ` Aaron Williams
2011-03-30  8:01         ` Rogan Dawes
2011-03-30 11:14           ` Albert ARIBAUD
2011-04-02  6:27           ` Aaron Williams
  -- strict thread matches above, loose matches on Subject: below --
2018-04-19 15:17 Radovan Prodanovic

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=201103172102.33681.Aaron.Williams@caviumnetworks.com \
    --to=aaron.williams@caviumnetworks.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox