Changeset 3398


Ignore:
Timestamp:
Oct 30, 2012, 8:41:57 AM (3 years ago)
Author:
quozl
Message:

spiflash - rework identification logic, verified against GD25Q16B W25Q16CVSSIG MX25L1635E MX25U1635E MX25E8035

File:
1 edited

Legend:

Unmodified
Added
Removed
  • dev/olpc/spiflash/spiflash.fth

    r3397 r3398  
    280280;
    281281
    282 : jedec-id  ( -- b3b2b1)
     282: jedec-id  ( -- b3b2b1 )
    283283   h# 9f spi-cmd spi-in spi-in spi-in  spi-cs-off  ( b1 b2 b3 )
    284284   0 bljoin
     
    302302
    3033030 value spi-id#
     3040 value jedec-id#
     3050 0 2value spi-id$
    304306: spi-identify  ( -- )
    305307   ab-id to spi-id#
     308   jedec-id to jedec-id#
     309   " Unknown" to spi-id$
    306310   spi-id# case
    307       \ ST, Spansion, and WinBond
    308       h# 13  of  ['] common-write  1mb-flash  endof
    309       h# 34  of  ['] common-write  1mb-flash
    310          \ jedec-id h# 3425c2 =  if  1mb-flash  then  \ MXIC 25E8035
     311      h# 13  of
     312         ['] common-write  1mb-flash
     313         " Spansion, Winbond, or ST" to spi-id$
     314      endof
     315      h# 14  of
     316         ['] common-write  1mb-flash
     317         jedec-id# h# 1520c2 =  if  2mb-flash  " MX25L1605D"   to spi-id$  then
     318         jedec-id# h# 1540c8 =  if  2mb-flash  " GD25Q16B"     to spi-id$  then
     319         jedec-id# h# 1540ef =  if  2mb-flash  " W25Q16CVSSIG" to spi-id$  then
     320      endof
     321      h# 25  of
     322         ['] common-write  1mb-flash
     323         jedec-id# h# 1525c2 =  if  2mb-flash  " MX25L1635E"   to spi-id$  then
     324      endof
     325      h# 34  of
     326         ['] common-write  1mb-flash
     327         " Macronyx" to spi-id$
     328         jedec-id# h# 3425c2 =  if  1mb-flash  " MX25E8035"    to spi-id$  then
     329      endof
     330      h# 35  of
     331         ['] common-write  2mb-flash
     332         jedec-id# h# 3525c2 =  if  2mb-flash  " MX25U1635E"    to spi-id$  then
    311333      endof
    312334      \ the SST part with its unique auto-increment address writing scheme
    313       h# bf  of  ['] sst-write     1mb-flash  endof
    314       h# 14  of  ['] common-write  1mb-flash
    315          jedec-id h# 1540c8 =  if  2mb-flash  then  \ XO-4 B1
    316       endof
    317       h# 25  of  ['] common-write  1mb-flash
    318          jedec-id h# 1525c2 =  if  2mb-flash  then  \ MX25L1635E
    319       endof
    320       h# 35  of  ['] common-write  2mb-flash  endof  \ W25Q16CV 3525c2
     335      h# bf  of
     336         ['] sst-write     1mb-flash
     337         " SST" to spi-id$
     338      endof
    321339      ( default )  ." Bad SPI FLASH ID " dup . cr  ['] null-write swap
    322340   endcase                                      ( writer )
     
    328346
    329347: .spi-id  ( -- )
    330    ." SPI FLASH is "
    331    ['] write-spi-flash behavior  ['] sst-write  =  if
    332       ." SST"
    333    else
    334       spi-id#  case
    335          h# 13  of  ." type 13 - Spansion, Winbond, or ST"  endof
    336          h# 14  of  ." type 14"  endof
    337          h# 25  of  ." type 25 - MX25L1635E"  endof
    338          h# 34  of  ." type 34 - Macronyx"  endof
    339          h# 35  of  ." type 35 - 2 MB"  endof
    340       endcase
    341    then
     348   ." SPI FLASH is type "
     349   spi-id# 2 .r [char] . emit jedec-id# 6 .r
     350   ." , " spi-id$ type
     351   ." , " /flash h# 100000 / .d ." MB."
    342352;
    343353
Note: See TracChangeset for help on using the changeset viewer.