AnsweredAssumed Answered

SPI Flash parameters for U-boot

Question asked by GatsbyDSP on Aug 12, 2013
Latest reply on Aug 12, 2013 by Aaronwu

I'm having a few issues getting u-boot to work correctly on my custom BF537 with:

- SDRAM IS42S16400E (8MB)

- SPI Flash chip SST25VF032B (4MB)

 

I know the SPI flash chip is supported already and I'm following this document.http://docs.blackfin.uclinux.org/doku.php?id=bootloaders:u-boot:porting#board_directory  and I'm also using this to try and get u-boot to boot from flash. http://blackfin.uclinux.org/doku.php?id=bootloaders:u-boot:serial-flash

 

I am able to boot the latest u-boot from UART but I've not yet managed to get u-boot to boot directly from SPI flash. I believe the main issue is that I have not edited my board configuration file (include/configs/bf537-custom.h) file correctly. I've started with the bf537-stamp.h and edited it to suit my custom configuration.

 

Memory Settings:

#define CONFIG_MEM_ADD_WDTH 7

#define CONFIG_MEM_SIZE 8

#define CONFIG_EBIU_SDRRC_VAL 0x8B0     /*Most of this calculated using the spreadsheet*/

#define CONFIG_EBIU_SDGCTL_VAL 0x809199C9

#define CONFIG_EBIU_SDBCTL_VAL 0x1

#define CONFIG_EBIU_AMGCTL_VAL 0xFF

#define CONFIG_EBIU_AMBCTL0_VAL 0x7BB07BB0

#define CONFIG_EBIU_AMBCTL1_VAL 0xFFC27BB0

#define CONFIG_SYS_MONITOR_LEN (512 * 1024)     /*No idea what this*/

#define CONFIG_SYS_MALLOC_LEN (384 * 1024)     /*No idea what this*/

 

/*

* Flash Settings

*/

#define CONFIG_FLASH_CFI_DRIVER

#define CONFIG_SYS_FLASH_BASE                    0x20000000

#define CONFIG_SYS_FLASH_CFI

#define CONFIG_SYS_FLASH_PROTECTION

#define CONFIG_SYS_MAX_FLASH_BANKS          1

#define CONFIG_SYS_MAX_FLASH_SECT          1024 /*128 or 1024*/

/* I don't know how many blocks the SST25VF032B has */

 

How do I calculate the number of blocks or sectors? I'm guessing here.

 

/*

* SPI Settings

*/

#define CONFIG_BFIN_SPI           1

#define CONFIG_ENV_SPI_MAX_HZ          20000000

#define CONFIG_SF_DEFAULT_SPEED          20000000

Not sure about the speed. The datasheet specifies 18MHz but I think this is something different.

#define CONFIG_SPI_FLASH          1

#define CONFIG_SPI_FLASH_ALL

#define CONFIG_CMD_SF

#define CONFIG_SF_DEFAULT_MODE                     SPI_MODE_3

/*#define CONFIG_ENV_IS_IN_SPI_FLASH                    1*/

#define CONFIG_ENV_SPI_MODE                    SPI_MODE_3

#define CONFIG_ENV_SPI_BUS                    0

#define CONFIG_ENV_SPI_CS                    1

#define CONFIG_SPI_FLASH_SST

 

/*

* Env Storage Settings

*/

#if (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_SPI_MASTER)

#define CONFIG_ENV_IS_IN_SPI_FLASH

#define CONFIG_ENV_OFFSET          0x10000

#define CONFIG_ENV_SIZE                    0x2000

#define CONFIG_ENV_SECT_SIZE          0x10000

#else

#define CONFIG_ENV_IS_IN_FLASH

#define CONFIG_ENV_OFFSET          0x4000

#define CONFIG_ENV_ADDR                    (CONFIG_SYS_FLASH_BASE + CONFIG_ENV_OFFSET)

#define CONFIG_ENV_SIZE                    0x2000

#define CONFIG_ENV_SECT_SIZE          0x2000

#endif

 

Is there a document that explains these parameters in detail?


At the moment:

bfin> sf probe 1

SF: Detected SST25VF032B with page size 4 KiB, total 4 MiB

 

This does produce something useful although not like the example in the documentation:

bfin> sf probe 2

SF: Got idcode 20 20 15

2048 KiB M25P16 at 0:2 is now current device

 

When I give the command flinfo I get: Bank # 1: missing or unknown FLASH type

Is the flinfo command only for parallel flash?

 

Also, when I do a 'make' with the SPI BOOT parameter enabled, which file do I need to tftp to the board? The documentation appears to show a uImage file but this isn't created for me after compile. I do have: u-boot, .bin, .ldr, .lds, ,map, .srec

 

Any help is gratefully appreciated.

Outcomes