M18 flash (Sibley) support (attempt 2)
PATCH 1/1 M18 flash (Sibley) support (attempt 2)
Hi Wolfgang,
Quoted 2 lines
Your patch was corrupted by your mailer which wrapped long lines. It cannot be applied.
Thank you very much for your reply. Gmail wrapped long lines. So I changed mail box. This is the second attempt.
The patch was verified on different kinds of NOR using Mainstone II platform - no issues are found on u-boot (versions 1.3.0-rc1 and 1.3.0-rc2).
Any comments and suggestions are welcome.
Thanks,
====================================================
drivers/cfi_flash.c +23 -7
@@ -74,6 +74,7 @@#define FLASH_CMD_PROTECT_CLEAR 0xD0#define FLASH_CMD_CLEAR_STATUS 0x50#define FLASH_CMD_WRITE_TO_BUFFER 0xE8 +#define FLASH_CMD_WRITE_TO_BUFFER_EXT 0xE9#define FLASH_CMD_WRITE_BUFFER_CONFIRM 0xD0#define FLASH_STATUS_DONE 0x80
@@ -136,6 +137,7 @@#define CFI_CMDSET_MITSU_STANDARD 256#define CFI_CMDSET_MITSU_EXTENDED 257#define CFI_CMDSET_SST 258 +#define CFI_CMDSET_INTEL_PROG_REGIONS 512#ifdef CFG_FLASH_CFI_AMD_RESET /* needed for STM_ID_29W320DB on UC100 */ # undef FLASH_CMD_RESET
@@ -184,8 +186,8 @@ flash_info_t flash_info[CFG_MAX_FLASH_BAtypedef unsigned long flash_sect_t ;static void flash_add_byte (flash_info_t * info,cfiword_t * cword,uchar c); -static void flash_make_cmd (flash_info_t * info,uchar cmd,void *cmdbuf); -static void flash_write_cmd (flash_info_t * info,flash_sect_t sect,uint offset,uchar cmd); +static void flash_make_cmd (flash_info_t * info,ulong cmd,void *cmdbuf); +static void flash_write_cmd (flash_info_t * info,flash_sect_t sect,uint offset,ulong cmd);static void flash_unlock_seq (flash_info_t * info,flash_sect_t sect);static int flash_isequal (flash_info_t * info,flash_sect_t sect,uint offset,uchar cmd);static int flash_isset (flash_info_t * info,flash_sect_t sect,uint offset,uchar cmd);
@@ -474,6 +476,7 @@ int flash_erase (flash_info_t * info, infor (sect = s_first; sect <= s_last; sect++) {if (info->protect[sect] ==0 ) {/* not protected */ switch (info->vendor) { +case CFI_CMDSET_INTEL_PROG_REGIONS :case CFI_CMDSET_INTEL_STANDARD :case CFI_CMDSET_INTEL_EXTENDED :flash_write_cmd (info, sect,0 ,FLASH_CMD_CLEAR_STATUS );
@@ -522,6 +525,9 @@ void flash_print_info (flash_info_t * in info->size >> 20, info->sector_count);printf (" " );switch (info->vendor) { +case CFI_CMDSET_INTEL_PROG_REGIONS : +printf ("Intel Prog Regions" ); +break ;case CFI_CMDSET_INTEL_STANDARD :printf ("Intel Standard" );break ;
@@ -771,6 +777,7 @@ static int flash_is_busy (flash_info_t *int retval;switch (info->vendor) { +case CFI_CMDSET_INTEL_PROG_REGIONS :case CFI_CMDSET_INTEL_STANDARD :case CFI_CMDSET_INTEL_EXTENDED : retval = !flash_isset (info, sect,0 ,FLASH_STATUS_DONE );
@@ -825,6 +832,7 @@ static int flash_full_status_check (flas retcode =flash_status_check (info, sector, tout, prompt);switch (info->vendor) { +case CFI_CMDSET_INTEL_PROG_REGIONS :case CFI_CMDSET_INTEL_EXTENDED :case CFI_CMDSET_INTEL_STANDARD : if ((retcode == ERR_OK)
@@ -903,7 +911,7 @@ static void flash_add_byte (flash_info_t/*----------------------------------------------------------------------- * make a proper sized command based on the port and chip widths */ -static void flash_make_cmd (flash_info_t * info,uchar cmd,void *cmdbuf) +static void flash_make_cmd (flash_info_t * info,ulong cmd,void *cmdbuf) {int i;uchar *cp = (uchar *) cmdbuf;
@@ -913,13 +921,13 @@ static void flash_make_cmd (flash_info_t#else for (i = 1; i <= info->portwidth; i++)#endif - *cp++ = (i & (info->chipwidth -1 )) ?'\0' : cmd; + *cp++ = (i > info->chipwidth) ?'\0' : *((uchar *)&cmd + info->portwidth - i); }/* * Write a proper sized command to the correct address */ -static void flash_write_cmd (flash_info_t * info,flash_sect_t sect,uint offset,uchar cmd) +static void flash_write_cmd (flash_info_t * info,flash_sect_t sect,uint offset,ulong cmd) {volatile cfiptr_t addr;
@@ -1090,6 +1098,7 @@ static void flash_read_jedec_ids (flash_ info->device_id2 =0 ;switch (info->vendor) { +case CFI_CMDSET_INTEL_PROG_REGIONS :case CFI_CMDSET_INTEL_STANDARD :case CFI_CMDSET_INTEL_EXTENDED :flash_write_cmd (info,0 ,0 ,FLASH_CMD_RESET );
@@ -1209,6 +1218,7 @@ ulong flash_get_size (ulong base, int baflash_printqry (info,0 );#endif switch (info->vendor) { +case CFI_CMDSET_INTEL_PROG_REGIONS :case CFI_CMDSET_INTEL_STANDARD :case CFI_CMDSET_INTEL_EXTENDED :default :
@@ -1289,6 +1299,7 @@ ulong flash_get_size (ulong base, int ba* Only read protection status from supported devices (intel...) */ switch (info->vendor) { +case CFI_CMDSET_INTEL_PROG_REGIONS :case CFI_CMDSET_INTEL_EXTENDED :case CFI_CMDSET_INTEL_STANDARD : info->protect[sect_cnt] =
@@ -1377,6 +1388,7 @@ static int flash_write_cfiword (flash_in flag =disable_interrupts ();switch (info->vendor) { +case CFI_CMDSET_INTEL_PROG_REGIONS :case CFI_CMDSET_INTEL_EXTENDED :case CFI_CMDSET_INTEL_STANDARD :flash_write_cmd (info,0 ,0 ,FLASH_CMD_CLEAR_STATUS );
@@ -1422,15 +1434,19 @@ static int flash_write_cfibuffer (flash_int retcode;volatile cfiptr_t src;volatile cfiptr_t dst; +uchar write_cmd;switch (info->vendor) { +case CFI_CMDSET_INTEL_PROG_REGIONS :case CFI_CMDSET_INTEL_STANDARD :case CFI_CMDSET_INTEL_EXTENDED : src.cp = cp; dst.cp = (uchar *) dest; sector =find_sector (info, dest); + write_cmd = (info->vendor ==CFI_CMDSET_INTEL_PROG_REGIONS ) ? +FLASH_CMD_WRITE_TO_BUFFER_EXT :FLASH_CMD_WRITE_TO_BUFFER ;flash_write_cmd (info, sector,0 ,FLASH_CMD_CLEAR_STATUS ); -flash_write_cmd (info, sector,0 ,FLASH_CMD_WRITE_TO_BUFFER ); +flash_write_cmd (info, sector,0 , write_cmd);if ((retcode =flash_status_check (info, sector, info->buffer_write_tout,"write to buffer" )) ==ERR_OK ) {/* reduce the number of loops by the width of the port */
@@ -1451,7 +1467,7 @@ static int flash_write_cfibuffer (flash_return ERR_INVAL ;break ; } -flash_write_cmd (info, sector,0 , (uchar ) cnt -1 ); +flash_write_cmd (info, sector,0 , cnt -1 );while (cnt-- >0 ) {switch (info->portwidth) {case FLASH_CFI_8BIT :
PATCH 1/1 M18 flash (Sibley) support (attempt 2)
Dear Vasiliy,
Quoted 8 lines · in message <[email protected]> you wrote:
Quoted 3 lines
Your patch was corrupted by your mailer which wrapped long lines. It cannot be applied.
Thank you very much for your reply. Gmail wrapped long lines. So I changed mail box. This is the second attempt.
The patch was verified on different kinds of NOR using Mainstone II platform - no issues are found on u-boot (versions 1.3.0-rc1 and 1.3.0-rc2).
Any comments and suggestions are welcome.
I'm a bit scared about your patch. Which tools do you use to create it?
drivers/cfi_flash.c flash_info_t flash_info[CFG_MAX_FLASH_BA · line 193
Quoted 11 lines
drivers/cfi_flash.c +2
-2@@ -184,8 +186,8 @@ flash_info_t flash_info[CFG_MAX_FLASH_BAtypedef unsigned long flash_sect_t ;static void flash_add_byte (flash_info_t * info,cfiword_t * cword,uchar c); -static void flash_make_cmd (flash_info_t * info,uchar cmd,void *cmdbuf); -static void flash_write_cmd (flash_info_t * info,flash_sect_t sect,uint offset,uchar cmd); +static void flash_make_cmd (flash_info_t * info,ulong cmd,void *cmdbuf); +static void flash_write_cmd (flash_info_t * info,flash_sect_t sect,uint offset,ulong cmd);static void flash_unlock_seq (flash_info_t * info,flash_sect_t sect);static int flash_isequal (flash_info_t * info,flash_sect_t sect,uint offset,uchar cmd);static int flash_isset (flash_info_t * info,flash_sect_t sect,uint offset,uchar cmd);
I don't see any differences here. Why is this flagged as a change?
...
drivers/cfi_flash.c static void flash_add_byte (flash_info_t · line 917
Quoted 9 lines
drivers/cfi_flash.c +1
-1@@ -903,7 +911,7 @@ static void flash_add_byte (flash_info_t/*----------------------------------------------------------------------- * make a proper sized command based on the port and chip widths */ -static void flash_make_cmd (flash_info_t * info,uchar cmd,void *cmdbuf) +static void flash_make_cmd (flash_info_t * info,ulong cmd,void *cmdbuf) {int i;uchar *cp = (uchar *) cmdbuf;
Ditto.
Quoted 1 line
(quoted diff) +0
-0@@ -913,13 +921,13 @@ static void flash_make_cmd (flash_info_t
...
drivers/cfi_flash.c static void flash_make_cmd (flash_info_t · line 930
Quoted 6 lines
/*
* Write a proper sized command to the correct address */drivers/cfi_flash.c +1
-1-static void flash_write_cmd (flash_info_t * info,flash_sect_t sect,uint offset,uchar cmd) +static void flash_write_cmd (flash_info_t * info,flash_sect_t sect,uint offset,ulong cmd)
Ditto.
This smells somewhat fishy. Do you have an explanation what's going on here?
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel 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 2000 pounds of chinese soup = 1 Won Ton
PATCH 1/1 M18 flash (Sibley) support (attempt 2)
Hi Wolfgang
Quoted 2 lines
I'm a bit scared about your patch. Which tools do you use to create it?
Vasiliy used a "diff" tool.
Quoted 13 lines
drivers/cfi_flash.c flash_info_t flash_info[CFG_MAX_FLASH_BA · line 193
Quoted 11 lines
drivers/cfi_flash.c +2
-2@@ -184,8 +186,8 @@ flash_info_t flash_info[CFG_MAX_FLASH_BAtypedef unsigned long flash_sect_t ;static void flash_add_byte (flash_info_t * info,cfiword_t * cword,uchar c); -static void flash_make_cmd (flash_info_t * info,uchar cmd,void *cmdbuf); -static void flash_write_cmd (flash_info_t * info,flash_sect_t sect,uint offset,uchar cmd); +static void flash_make_cmd (flash_info_t * info,ulong cmd,void *cmdbuf); +static void flash_write_cmd (flash_info_t * info,flash_sect_t sect,uint offset,ulong cmd);static void flash_unlock_seq (flash_info_t * info,flash_sect_t sect);static int flash_isequal (flash_info_t * info,flash_sect_t sect,uint offset,uchar cmd);static int flash_isset (flash_info_t * info,flash_sect_t sect,uint offset,uchar cmd);I don't see any differences here. Why is this flagged as a change?
The difference is in type of "cmd" variable.
...
Quoted 2 lines
This smells somewhat fishy. Do you have an explanation what's going on here?
Let me explain.
M18 flash is a flash with programming regions.
It writes data by pages using buffered write method. According to the specification of buffered prog. for NOR chips. We should write CMD to start data write, length of buffer in words, buffer, and write confirm command.
Unlike other NOR chips M18 has large programming buffer. The buffer size for M18 is 1024bytes i.e. 512 word.
In existing code we transfer commands and buffer length using flash_write_cmd() and flash_make_cmd functions. The input type for cmd variable is uchar in these functions. If we want to write more than 255 words we will have write error.
To avoid these issues we extended these two functions little bit to deal with larger commands.
Kind regards,
Alexey
PATCH 1/1 M18 flash (Sibley) support (attempt 2)
Dear Alexey,
Quoted 5 lines · in message <[email protected]> you…
Quoted 5 lines
Quoted 5 lines
drivers/cfi_flash.c +2
-2-static void flash_make_cmd (flash_info_t * info,uchar cmd,void *cmdbuf); -static void flash_write_cmd (flash_info_t * info,flash_sect_t sect,uint offset,uchar cmd); +static void flash_make_cmd (flash_info_t * info,ulong cmd,void *cmdbuf); +static void flash_write_cmd (flash_info_t * info,flash_sect_t sect,uint offset,ulong cmd);
...
Quoted 2 lines
Quoted 1 line
I don't see any differences here. Why is this flagged as a change?
The difference is in type of "cmd" variable.
Argh. You are right. Sorry for the noise.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel 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 "To take a significant step forward, you must make a series of finite improvements." - Donald J. Atwood, General Motors
PATCH 1/1 M18 flash (Sibley) support (attempt 2)
In reply to Vasiliy LeoenenkoHi Vasily,
Quoted 11 lines · Vasiliy Leoenenko
Quoted 2 lines
Your patch was corrupted by your mailer which wrapped long lines. It cannot be applied.
Thank you very much for your reply. Gmail wrapped long lines. So I changed mail box. This is the second attempt.
The patch was verified on different kinds of NOR using Mainstone II platform - no issues are found on u-boot (versions 1.3.0-rc1 and 1.3.0-rc2).
Any comments and suggestions are welcome.
Sorry, but I really forgot about this patch. Could you please resend this patch against the current tot, since it doesn't apply cleanly anymore?
Thanks.
Best regards,
Stefan
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================
PATCH 1/1 M18 flash (Sibley) support (attempt 2)
Hi, Stefan
Quoted 2 lines
Sorry, but I really forgot about this patch. Could you please resend this patch against the current tot, since it doesn't apply cleanly anymore?
I prepared patch for u-boot version 1.3.2. Any comments and suggestions are welcome. Code(included below) was verified on Mainstone II board with M18 flash chip. Please don't forget to include it :)
Best regards,
Vasiliy
====================================================
drivers/mtd/cfi_flash.c +23 -5
@@ -77,6 +77,7 @@#define FLASH_CMD_PROTECT_CLEAR 0xD0#define FLASH_CMD_CLEAR_STATUS 0x50#define FLASH_CMD_WRITE_TO_BUFFER 0xE8 +#define FLASH_CMD_WRITE_BUFFER_PROG 0xE9#define FLASH_CMD_WRITE_BUFFER_CONFIRM 0xD0#define FLASH_STATUS_DONE 0x80
@@ -136,6 +137,7 @@#define CFI_CMDSET_MITSU_STANDARD 256#define CFI_CMDSET_MITSU_EXTENDED 257#define CFI_CMDSET_SST 258 +#define CFI_CMDSET_INTEL_PROG_REGIONS 512#ifdef CFG_FLASH_CFI_AMD_RESET /* needed for STM_ID_29W320DB on UC100 */ # undef FLASH_CMD_RESET
@@ -298,7 +300,7 @@ static inline void flash_unmap(flash_inf/*----------------------------------------------------------------------- * make a proper sized command based on the port and chip widths */ -static void flash_make_cmd (flash_info_t * info,uchar cmd,void *cmdbuf) +static void flash_make_cmd (flash_info_t * info,ulong cmd,void *cmdbuf) {int i;uchar *cp = (uchar *) cmdbuf;
@@ -308,7 +310,8 @@ static void flash_make_cmd (flash_info_t#else for (i = 1; i <= info->portwidth; i++)#endif - *cp++ = (i & (info->chipwidth -1 )) ?'\0' : cmd; + *cp++ = (i > info->chipwidth) ?'\0' : + *((uchar *)&cmd + info->portwidth - i); }#ifdef DEBUG
@@ -422,7 +425,7 @@ static ulong flash_read_long (flash_info* Write a proper sized command to the correct address */ static void flash_write_cmd (flash_info_t * info,flash_sect_t sect, -uint offset,uchar cmd) +uint offset,ulong cmd) {void *addr;
@@ -605,6 +608,7 @@ static int flash_is_busy (flash_info_t *int retval;switch (info->vendor) { +case CFI_CMDSET_INTEL_PROG_REGIONS :case CFI_CMDSET_INTEL_STANDARD :case CFI_CMDSET_INTEL_EXTENDED : retval = !flash_isset (info, sect,0 ,FLASH_STATUS_DONE );
@@ -664,6 +668,7 @@ static int flash_full_status_check (flas retcode =flash_status_check (info, sector, tout, prompt);switch (info->vendor) { +case CFI_CMDSET_INTEL_PROG_REGIONS :case CFI_CMDSET_INTEL_EXTENDED :case CFI_CMDSET_INTEL_STANDARD : if ((retcode == ERR_OK)
@@ -792,6 +797,7 @@ static int flash_write_cfiword (flash_in flag =disable_interrupts ();switch (info->vendor) { +case CFI_CMDSET_INTEL_PROG_REGIONS :case CFI_CMDSET_INTEL_EXTENDED :case CFI_CMDSET_INTEL_STANDARD :flash_write_cmd (info,0 ,0 ,FLASH_CMD_CLEAR_STATUS );
@@ -846,6 +852,7 @@ static int flash_write_cfibuffer (flash_int flag =0 ;uint offset =0 ;unsigned int shift; +uchar write_cmd;switch (info->portwidth) {case FLASH_CFI_8BIT :
@@ -900,10 +907,13 @@ static int flash_write_cfibuffer (flash_ sector =find_sector (info, dest);switch (info->vendor) { +case CFI_CMDSET_INTEL_PROG_REGIONS :case CFI_CMDSET_INTEL_STANDARD :case CFI_CMDSET_INTEL_EXTENDED : + write_cmd = (info->vendor ==CFI_CMDSET_INTEL_PROG_REGIONS ) ? +FLASH_CMD_WRITE_BUFFER_PROG :FLASH_CMD_WRITE_TO_BUFFER ;flash_write_cmd (info, sector,0 ,FLASH_CMD_CLEAR_STATUS ); -flash_write_cmd (info, sector,0 ,FLASH_CMD_WRITE_TO_BUFFER ); +flash_write_cmd (info, sector,0 , write_cmd); retcode =flash_status_check (info, sector, info->buffer_write_tout,"write to buffer" );
@@ -911,7 +921,7 @@ static int flash_write_cfibuffer (flash_/* reduce the number of loops by the width of * the port */ cnt = len >> shift; -flash_write_cmd (info, sector,0 , (uchar ) cnt -1 ); +flash_write_cmd (info, sector,0 , cnt -1 );while (cnt-- >0 ) {switch (info->portwidth) {case FLASH_CFI_8BIT :
@@ -1038,6 +1048,7 @@ int flash_erase (flash_info_t * info, infor (sect = s_first; sect <= s_last; sect++) {if (info->protect[sect] ==0 ) {/* not protected */ switch (info->vendor) { +case CFI_CMDSET_INTEL_PROG_REGIONS :case CFI_CMDSET_INTEL_STANDARD :case CFI_CMDSET_INTEL_EXTENDED : flash_write_cmd (info, sect, 0,
@@ -1106,6 +1117,9 @@ void flash_print_info (flash_info_t * in info->size >> 20, info->sector_count);printf (" " );switch (info->vendor) { +case CFI_CMDSET_INTEL_PROG_REGIONS : +printf ("Intel Prog Regions" ); +break ;case CFI_CMDSET_INTEL_STANDARD :printf ("Intel Standard" );break ;
@@ -1496,6 +1510,7 @@ static void flash_read_jedec_ids (flash_ info->device_id2 =0 ;switch (info->vendor) { +case CFI_CMDSET_INTEL_PROG_REGIONS :case CFI_CMDSET_INTEL_STANDARD :case CFI_CMDSET_INTEL_EXTENDED :cmdset_intel_read_jedec_ids (info);
@@ -1550,6 +1565,7 @@ static int flash_detect_legacy(ulong bas }switch (info->vendor) { +case CFI_CMDSET_INTEL_PROG_REGIONS :case CFI_CMDSET_INTEL_STANDARD :case CFI_CMDSET_INTEL_EXTENDED : info->cmd_reset =FLASH_CMD_RESET ;
@@ -1745,6 +1761,7 @@ ulong flash_get_size (ulong base, int ba#endif switch (info->vendor) { +case CFI_CMDSET_INTEL_PROG_REGIONS :case CFI_CMDSET_INTEL_STANDARD :case CFI_CMDSET_INTEL_EXTENDED :cmdset_intel_init (info, &qry);
@@ -1822,6 +1839,7 @@ ulong flash_get_size (ulong base, int ba* supported devices (intel...) */ switch (info->vendor) { +case CFI_CMDSET_INTEL_PROG_REGIONS :case CFI_CMDSET_INTEL_EXTENDED :case CFI_CMDSET_INTEL_STANDARD : info->protect[sect_cnt] =
PATCH 1/1 M18 flash (Sibley) support (attempt 2)
Hi Vasily,
Quoted 6 lines · Vasiliy Leoenenko
Quoted 2 lines
Sorry, but I really forgot about this patch. Could you please resend this patch against the current tot, since it doesn't apply cleanly anymore?
I prepared patch for u-boot version 1.3.2. Any comments and suggestions are welcome. Code(included below) was verified on Mainstone II board with M18 flash chip. Please don't forget to include it :)
Unfortunately this breaks CFI support for "normal" AMD/Spansion FLASH equipped boards. On Sequoia with Spansion GL512 I get this after applying your patch:
U-Boot 1.3.2-01356-g8fa1348 (Apr 24 2008 - 17:05:55)
CPU: AMCC PowerPC 440EPx Rev. A at 528 MHz (PLB=132, OPB=66, EBC=66 MHz)
Security/Kasumi support
Bootstrap Option H - Boot ROM Location I2C (Addr 0x52) Internal PCI arbiter enabled, PCI async ext clock used 32 kB I-Cache 32 kB D-Cache
Board: Sequoia - AMCC PPC440EPx Evaluation Board, Rev. F, PCI=66 MHz I2C: ready DTT: 1 is 29 C DRAM: 256 MB FLASH: CFI: Unknown command set 0x0
*** failed ***
### ERROR ### Please RESET the board ###
:-(
Please fix this and resubmit. Best would be if you could test it on a board with Spansion CFI FLASH's too.
Thanks.
Best regards,
Stefan
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================
PATCH 1/1 M18 flash (Sibley) support (attempt 2)
Hi Stefan
Quoted 5 lines
Unfortunately this breaks CFI support for "normal" AMD/Spansion FLASH equipped boards. On Sequoia with Spansion GL512 I get this after applying your patch:
Please fix this and resubmit. Best would be if you could test it on a board with Spansion CFI FLASH's too.
I investigated the reproted issue and I think I've corrected it. The issue caused by my incorect conversion of cmd value in flash_make_cmd function. So we improved the procedure of conversion. I think it will be better to sent two patches:
The first patch adds support of long commands and fixes conversion issues.
The second patch adds M18 family command set support.
Patches were tested on Mainstone II board and two flashes:
M18 portwidth=16 chipwidth=16
P30 portwidth=32 chipwidth=16
Also I tested in simulation the conversion algorithms to make sure that it works fine. Unforunately I have no abiliy to test my patch on different borads and width Spansion CFI flash.
The next two messages will contain patches.
Best regards
Vasiliy
PATCH 1/1 M18 flash (Sibley) support (attempt 2)
Quoted 14 lines · Vasiliy Leoenenko
Hi Stefan
Quoted 5 lines
Unfortunately this breaks CFI support for "normal" AMD/Spansion FLASH equipped boards. On Sequoia with Spansion GL512 I get this after applying your patch:
Please fix this and resubmit. Best would be if you could test it on a board with Spansion CFI FLASH's too.
I investigated the reproted issue and I think I've corrected it. The issue caused by my incorect conversion of cmd value in
flash_make_cmdfunction. So we improved the procedure of conversion. I think it will be better to sent two patches:
The first patch adds support of long commands and fixes conversion issues.
The second patch adds M18 family command set support.
Quoted 5 lines
Patches were tested on Mainstone II board and two flashes:
M18 portwidth=16 chipwidth=16
P30 portwidth=32 chipwidth=16
Also I tested in simulation the conversion algorithms to make sure that it works fine. Unforunately I have no abiliy to test my patch on different borads and width Spansion CFI flash.
You could test it on qemu_mips which use an amd cfi flash or with few modif in qemu an intel falsh
Best Regards,
J.
PATCH 1/1 M18 flash (Sibley) support (attempt 2)
In reply to Stefan RoeseThe first patch (support of long commands):
===================================================
drivers/mtd/cfi_flash.c +19 -7
@@ -298,17 +298,29 @@ static inline void flash_unmap(flash_inf/*----------------------------------------------------------------------- * make a proper sized command based on the port and chip widths */ -static void flash_make_cmd (flash_info_t * info,uchar cmd,void *cmdbuf) +static void flash_make_cmd (flash_info_t * info,ulong cmd,void *cmdbuf) {int i; +int cpofft;uchar *cp = (uchar *) cmdbuf; +uchar cp_val;#if defined(__LITTLE_ENDIAN) || defined(CFG_WRITE_SWAPPED_DATA ) -for (i = info->portwidth; i >0 ; i--) +for (i =sizeof (cfiword_t); i >0 ; i--) + { + cpofft=(i-1 );#else - for (i = 1; i <= info->portwidth; i++) -#endif - *cp++ = (i & (info->chipwidth -1 )) ?'\0' : cmd; +for (i =1 ; i <=sizeof (cfiword_t); i++) + { + cpofft=(sizeof (cfiword_t)-i); +#endif +if ( cpofft%info->chipwidth >=sizeof (ulong) || cpofft>=info->portwidth) + cp_val =0x00 ; +else + cp_val = *((uchar *)&cmd + cpofft%info->chipwidth); + + cp[i-1 ] = cp_val; + } }#ifdef DEBUG
@@ -422,7 +434,7 @@ static ulong flash_read_long (flash_info* Write a proper sized command to the correct address */ static void flash_write_cmd (flash_info_t * info,flash_sect_t sect, -uint offset,uchar cmd) +uint offset,ulong cmd) {void *addr;
@@ -911,7 +923,7 @@ static int flash_write_cfibuffer (flash_/* reduce the number of loops by the width of * the port */ cnt = len >> shift; -flash_write_cmd (info, sector,0 , (uchar ) cnt -1 ); +flash_write_cmd (info, sector,0 , cnt -1 );while (cnt-- >0 ) {switch (info->portwidth) {case FLASH_CFI_8BIT :
PATCH 1/1 M18 flash (Sibley) support (attempt 2)
Quoted 1 line · Vasiliy Leoenenko
The first patch (support of long commands):
I like the idea of splitting this patch up in two separate patches/emails. But please provide a descriptive subject and a short description that can will be added to the git repository as commit text for each patch. And don't forget your Signed-off-by line.
Please take a look at other patches on the list how this should be done. Best would be if you could use the git tools to create (and send) the patches.
Thanks.
Some further remarks below:
Quoted 10 lines
===================================================
diff -aupNra/drivers/mtd/cfi_flash.cb/drivers/mtd/cfi_flash.cdrivers/mtd/cfi_flash.c +1
-1@@ -298,17 +298,29 @@ static inline void flash_unmap(flash_inf/*----------------------------------------------------------------------- * make a proper sized command based on the port and chip widths */ -static void flash_make_cmd (flash_info_t * info,uchar cmd,void *cmdbuf) +static void flash_make_cmd (flash_info_t * info,ulong cmd,void *cmdbuf)
drivers/mtd/cfi_flash.c static inline void flash_unmap(flash_inf · line 310
Quoted 10 lines
drivers/mtd/cfi_flash.c +4
-1{int i; +int cpofft;uchar *cp = (uchar *) cmdbuf; +uchar cp_val;#if defined(__LITTLE_ENDIAN) || defined(CFG_WRITE_SWAPPED_DATA ) -for (i = info->portwidth; i >0 ; i--) +for (i =sizeof (cfiword_t); i >0 ; i--) + {
+ for (i = sizeof(cfiword_t); i > 0; i--) {
The code down below has some coding style issues too. Please
drivers/mtd/cfi_flash.c static inline void flash_unmap(flash_inf · line 311
Quoted 1 line
drivers/mtd/cfi_flash.c +1
-0+ cpofft=(i-1 );
+ cpofft = i - 1;
The code down below has some coding style issues too. Please try to be more careful here.
And the resulting code looks like this:
#if defined(__LITTLE_ENDIAN) || defined(CFG_WRITE_SWAPPED_DATA)
for (i = sizeof(cfiword_t); i > 0; i--)
{
cpofft=(i-1);
#else
for (i = 1; i <= sizeof(cfiword_t); i++)
{
cpofft=(sizeof(cfiword_t)-i);
#endif
if( cpofft%info->chipwidth >= sizeof(ulong) || cpofft>=info->portwidth)
cp_val = 0x00;
else
cp_val = *((uchar*)&cmd + cpofft%info->chipwidth);
cp[i-1] = cp_val;
}Apart from the coding-style issues, this is getting quite complex and unclear. At least to me. Are you sure that this can't be written differently to make it easier to understand?
Thanks.
Best regards,
Stefan
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================
PATCH 1/1 M18 flash (Sibley) support (attempt 2)
In reply to Vasiliy LeoenenkoQuoted 2 lines · In message <[email protected]> you wrote:
The first patch (support of long commands):
That's not exactly a good commit message.
And your signed-off-by line is missing.
And the coding style is broken. There are trailing white spaces, and...
drivers/mtd/cfi_flash.c static inline void flash_unmap(flash_inf · line 310
Quoted 4 lines
#if
defined(__LITTLE_ENDIAN)||defined(CFG_WRITE_SWAPPED_DATA)drivers/mtd/cfi_flash.c +2
-1-for (i = info->portwidth; i >0 ; i--) +for (i =sizeof (cfiword_t); i >0 ; i--) + {
... bad brace style here and elsewhere.
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
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
"You know, after a woman's raised a family and so on, she wants to
start living her own life." "Whose life she's _been_ living, then?"
- Terry Pratchett, _Witches Abroad_PATCH 1/1 M18 flash (Sibley) support (attempt 2)
Hi, Wolfgang
Sorry for codding-style issues in previous sent patches.
Next two messages will contain patches with corrected codding-style, descriptions and signed-off lines to commit.
Best regards
Vasiliy
PATCH 1/1 M18 flash (Sibley) support (attempt 2)
In reply to Wolfgang Denkcfi_flash: support of long cmd in U-boot.
Some NOR flash chips needs support of commands with length grether than max value size of uchar. For example all M18 family chips use 0x1ff command in buffered write mode as value of program loops count.
======================================================
drivers/mtd/cfi_flash.c +21 -6
@@ -298,17 +298,32 @@ static inline void flash_unmap(flash_inf/*----------------------------------------------------------------------- * make a proper sized command based on the port and chip widths */ -static void flash_make_cmd (flash_info_t * info,uchar cmd,void *cmdbuf) +static void flash_make_cmd (flash_info_t * info,ulong cmd,void *cmdbuf) {int i; +int cword_offset; +int perchip_offset;uchar *cp = (uchar *) cmdbuf; +uchar val;#if defined(__LITTLE_ENDIAN) || defined(CFG_WRITE_SWAPPED_DATA ) -for (i = info->portwidth; i >0 ; i--) +for (i =sizeof (cfiword_t); i >0 ; i--){ + cword_offset = i -1 ;#else - for (i = 1; i <= info->portwidth; i++) +for (i =1 ; i <=sizeof (cfiword_t); i++){ + cword_offset =sizeof (cfiword_t) - i;#endif - *cp++ = (i & (info->chipwidth -1 )) ?'\0' : cmd; + perchip_offset = cword_offset % info->chipwidth; + +/* If current offset inside one chip is over command size or +current offset is over portwidth fill data by 0x00 */ +if (perchip_offset >=sizeof (ulong) || cword_offset >= info->portwidth) + val =0x00 ; +else + val = *((uchar *)&cmd + perchip_offset); + + cp[i -1 ] = val; + } }#ifdef DEBUG
@@ -422,7 +437,7 @@ static ulong flash_read_long (flash_info* Write a proper sized command to the correct address */ static void flash_write_cmd (flash_info_t * info,flash_sect_t sect, -uint offset,uchar cmd) +uint offset,ulong cmd) {void *addr;
@@ -911,7 +926,7 @@ static int flash_write_cfibuffer (flash_/* reduce the number of loops by the width of * the port */ cnt = len >> shift; -flash_write_cmd (info, sector,0 , (uchar ) cnt -1 ); +flash_write_cmd (info, sector,0 , cnt -1 );while (cnt-- >0 ) {switch (info->portwidth) {case FLASH_CFI_8BIT :
PATCH 1/1 M18 flash (Sibley) support (attempt 2)
Hi Vasiliy,
Quoted 4 lines · Vasiliy Leoenenko
cfi_flash: support of long cmd in U-boot.Some NOR flash chips needs support of commands with length grether than max value size of uchar. For example all M18 family chips use
0x1ffcommand in buffered write mode as value of program loops count.
Unfortunately this patch still breaks CFI support on sequoia board:
U-Boot 1.3.3-rc1-00021-g0e715a7-dirty (Apr 29 2008 - 16:55:18)
CPU: AMCC PowerPC 440EPx Rev. A at 330 MHz (PLB=132, OPB=66, EBC=66 MHz)
Security/Kasumi support
Bootstrap Option B - Boot ROM Location EBC (16 bits) Internal PCI arbiter enabled, PCI async ext clock used 32 kB I-Cache 32 kB D-Cache
Board: Sequoia - AMCC PPC440EPx Evaluation Board, Rev. F, PCI=33 MHz I2C: ready DTT: 1 is 36 C DRAM: 256 MB FLASH: CFI: Unknown command set 0x0
*** failed ***
### ERROR ### Please RESET the board ###
Best regards,
Anatolij
Signature · 3 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
PATCH 1/1 M18 flash (Sibley) support (attempt 2)
Hi All
I corrected this issue with the help of Anatolij.
I checked this patches on Mainstone II board width Intel M18 chip(16x16) and P30 chip (32x16). Next two messages will contain corrected patches.
Best Regards
Vasiliy
PATCH 1/1 M18 flash (Sibley) support (attempt 2)
In reply to Anatolij Gustschincfi_flash: support of long cmd in U-boot.
Some NOR flash chips needs support of commands with length grether than max value size of uchar. For example all M18 family chips use 0x1ff command in buffered write mode as value of program loops count.
======================================================
drivers/mtd/cfi_flash.c +15 -7
@@ -298,17 +298,25 @@ static inline void flash_unmap(flash_inf/*----------------------------------------------------------------------- * make a proper sized command based on the port and chip widths */ -static void flash_make_cmd (flash_info_t * info,uchar cmd,void *cmdbuf) +static void flash_make_cmd (flash_info_t * info,ulong cmd,void *cmdbuf) {int i; +int cword_offset; +int cp_offset; +uchar val;uchar *cp = (uchar *) cmdbuf; +for (i = info->portwidth; i >0 ; i--){ + cword_offset = (info->portwidth-i)%info->chipwidth;#if defined(__LITTLE_ENDIAN) || defined(CFG_WRITE_SWAPPED_DATA ) -for (i = info->portwidth; i >0 ; i--) + cp_offset = info->portwidth - i; + val = *((uchar *)&cmd + cword_offset);#else - for (i = 1; i <= info->portwidth; i++) + cp_offset = i -1 ; + val = *((uchar *)&cmd +sizeof (ulong) - cword_offset -1 );#endif - *cp++ = (i & (info->chipwidth -1 )) ?'\0' : cmd; + cp[cp_offset] = (cword_offset >=sizeof (ulong)) ?0x00 : val; + } }#ifdef DEBUG
@@ -422,7 +430,7 @@ static ulong flash_read_long (flash_info* Write a proper sized command to the correct address */ static void flash_write_cmd (flash_info_t * info,flash_sect_t sect, -uint offset,uchar cmd) +uint offset,ulong cmd) {void *addr;
@@ -911,7 +919,7 @@ static int flash_write_cfibuffer (flash_/* reduce the number of loops by the width of * the port */ cnt = len >> shift; -flash_write_cmd (info, sector,0 , (uchar ) cnt -1 ); +flash_write_cmd (info, sector,0 , cnt -1 );while (cnt-- >0 ) {switch (info->portwidth) {case FLASH_CFI_8BIT :
@@ -953,7 +961,7 @@ static int flash_write_cfibuffer (flash_#endif flash_write_cmd (info, sector, offset,AMD_CMD_WRITE_TO_BUFFER ); cnt = len >> shift; -flash_write_cmd (info, sector, offset, (uchar )cnt -1 ); +flash_write_cmd (info, sector, offset, cnt -1 );switch (info->portwidth) {case FLASH_CFI_8BIT :
PATCH 1/1 M18 flash (Sibley) support (attempt 2)
Quoted 5 lines · Vasiliy Leoenenko
cfi_flash: support of long cmd in U-boot.Some NOR flash chips needs support of commands with length grether than max value size of uchar. For example all M18 family chips use
0x1ffcommand in buffered write mode as value of program loops count.
Applied to u-boot-cfi-flash. Thanks.
Best regards,
Stefan
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================
PATCH 1/1 M18 flash (Sibley) support (attempt 2)
In reply to Anatolij Gustschincfi_flash: enable M18 flash chips family support.
Added new command set ID. Buffered write command processing is changed in order to support M18 flash chips family.
==============================================================
drivers/mtd/cfi_flash.c +21 -2
@@ -76,7 +76,9 @@#define FLASH_CMD_PROTECT_SET 0x01#define FLASH_CMD_PROTECT_CLEAR 0xD0#define FLASH_CMD_CLEAR_STATUS 0x50 +#define FLASH_CMD_READ_STATUS 0x70#define FLASH_CMD_WRITE_TO_BUFFER 0xE8 +#define FLASH_CMD_WRITE_BUFFER_PROG 0xE9#define FLASH_CMD_WRITE_BUFFER_CONFIRM 0xD0#define FLASH_STATUS_DONE 0x80
@@ -136,6 +138,7 @@#define CFI_CMDSET_MITSU_STANDARD 256#define CFI_CMDSET_MITSU_EXTENDED 257#define CFI_CMDSET_SST 258 +#define CFI_CMDSET_INTEL_PROG_REGIONS 512#ifdef CFG_FLASH_CFI_AMD_RESET /* needed for STM_ID_29W320DB on UC100 */ # undef FLASH_CMD_RESET
@@ -613,6 +616,7 @@ static int flash_is_busy (flash_info_t *int retval;switch (info->vendor) { +case CFI_CMDSET_INTEL_PROG_REGIONS :case CFI_CMDSET_INTEL_STANDARD :case CFI_CMDSET_INTEL_EXTENDED : retval = !flash_isset (info, sect,0 ,FLASH_STATUS_DONE );
@@ -672,6 +676,7 @@ static int flash_full_status_check (flas retcode =flash_status_check (info, sector, tout, prompt);switch (info->vendor) { +case CFI_CMDSET_INTEL_PROG_REGIONS :case CFI_CMDSET_INTEL_EXTENDED :case CFI_CMDSET_INTEL_STANDARD : if ((retcode == ERR_OK)
@@ -800,6 +805,7 @@ static int flash_write_cfiword (flash_in flag =disable_interrupts ();switch (info->vendor) { +case CFI_CMDSET_INTEL_PROG_REGIONS :case CFI_CMDSET_INTEL_EXTENDED :case CFI_CMDSET_INTEL_STANDARD :flash_write_cmd (info,0 ,0 ,FLASH_CMD_CLEAR_STATUS );
@@ -854,6 +860,7 @@ static int flash_write_cfibuffer (flash_int flag =0 ;uint offset =0 ;unsigned int shift; +uchar write_cmd;switch (info->portwidth) {case FLASH_CFI_8BIT :
@@ -908,10 +915,14 @@ static int flash_write_cfibuffer (flash_ sector =find_sector (info, dest);switch (info->vendor) { +case CFI_CMDSET_INTEL_PROG_REGIONS :case CFI_CMDSET_INTEL_STANDARD :case CFI_CMDSET_INTEL_EXTENDED : + write_cmd = (info->vendor ==CFI_CMDSET_INTEL_PROG_REGIONS ) ? +FLASH_CMD_WRITE_BUFFER_PROG :FLASH_CMD_WRITE_TO_BUFFER ;flash_write_cmd (info, sector,0 ,FLASH_CMD_CLEAR_STATUS ); -flash_write_cmd (info, sector,0 ,FLASH_CMD_WRITE_TO_BUFFER ); +flash_write_cmd (info, sector,0 ,FLASH_CMD_READ_STATUS ); +flash_write_cmd (info, sector,0 , write_cmd); retcode =flash_status_check (info, sector, info->buffer_write_tout,"write to buffer" );
@@ -961,7 +972,7 @@ static int flash_write_cfibuffer (flash_#endif flash_write_cmd (info, sector, offset,AMD_CMD_WRITE_TO_BUFFER ); cnt = len >> shift; -flash_write_cmd (info, sector, offset, cnt -1 ); +flash_write_cmd (info, sector, offset, (uchar )cnt -1 );switch (info->portwidth) {case FLASH_CFI_8BIT :
@@ -1046,6 +1057,7 @@ int flash_erase (flash_info_t * info, infor (sect = s_first; sect <= s_last; sect++) {if (info->protect[sect] ==0 ) {/* not protected */ switch (info->vendor) { +case CFI_CMDSET_INTEL_PROG_REGIONS :case CFI_CMDSET_INTEL_STANDARD :case CFI_CMDSET_INTEL_EXTENDED : flash_write_cmd (info, sect, 0,
@@ -1114,6 +1126,9 @@ void flash_print_info (flash_info_t * in info->size >> 20, info->sector_count);printf (" " );switch (info->vendor) { +case CFI_CMDSET_INTEL_PROG_REGIONS : +printf ("Intel Prog Regions" ); +break ;case CFI_CMDSET_INTEL_STANDARD :printf ("Intel Standard" );break ;
@@ -1504,6 +1519,7 @@ static void flash_read_jedec_ids (flash_ info->device_id2 =0 ;switch (info->vendor) { +case CFI_CMDSET_INTEL_PROG_REGIONS :case CFI_CMDSET_INTEL_STANDARD :case CFI_CMDSET_INTEL_EXTENDED :cmdset_intel_read_jedec_ids (info);
@@ -1558,6 +1574,7 @@ static int flash_detect_legacy(ulong bas }switch (info->vendor) { +case CFI_CMDSET_INTEL_PROG_REGIONS :case CFI_CMDSET_INTEL_STANDARD :case CFI_CMDSET_INTEL_EXTENDED : info->cmd_reset =FLASH_CMD_RESET ;
@@ -1753,6 +1770,7 @@ ulong flash_get_size (ulong base, int ba#endif switch (info->vendor) { +case CFI_CMDSET_INTEL_PROG_REGIONS :case CFI_CMDSET_INTEL_STANDARD :case CFI_CMDSET_INTEL_EXTENDED :cmdset_intel_init (info, &qry);
@@ -1830,6 +1848,7 @@ ulong flash_get_size (ulong base, int ba* supported devices (intel...) */ switch (info->vendor) { +case CFI_CMDSET_INTEL_PROG_REGIONS :case CFI_CMDSET_INTEL_EXTENDED :case CFI_CMDSET_INTEL_STANDARD : info->protect[sect_cnt] =
PATCH 1/1 M18 flash (Sibley) support (attempt 2)
Quoted 4 lines · Vasiliy Leoenenko
cfi_flash: enable M18 flash chips family support.Added new command set ID. Buffered write command processing is changed in order to support M18 flash chips family.
Applied to u-boot-cfi-flash. Thanks.
Best regards,
Stefan
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================
PATCH 1/1 M18 flash (Sibley) support (attempt 2)
In reply to Anatolij Gustschincfi_flash: support of long cmd in U-boot.
Some NOR flash chips needs support of commands with length grether than max value size of uchar. For example all M18 family chips use 0x1ff command in buffered write mode as value of program loops count.
======================================================
drivers/mtd/cfi_flash.c +15 -7
@@ -298,17 +298,25 @@ static inline void flash_unmap(flash_inf/*----------------------------------------------------------------------- * make a proper sized command based on the port and chip widths */ -static void flash_make_cmd (flash_info_t * info,uchar cmd,void *cmdbuf) +static void flash_make_cmd (flash_info_t * info,ulong cmd,void *cmdbuf) {int i; +int cword_offset; +int cp_offset; +uchar val;uchar *cp = (uchar *) cmdbuf; +for (i = info->portwidth; i >0 ; i--){ + cword_offset = (info->portwidth-i)%info->chipwidth;#if defined(__LITTLE_ENDIAN) || defined(CFG_WRITE_SWAPPED_DATA ) -for (i = info->portwidth; i >0 ; i--) + cp_offset = info->portwidth - i; + val = *((uchar *)&cmd + cword_offset);#else - for (i = 1; i <= info->portwidth; i++) + cp_offset = i -1 ; + val = *((uchar *)&cmd +sizeof (ulong) - cword_offset -1 );#endif - *cp++ = (i & (info->chipwidth -1 )) ?'\0' : cmd; + cp[cp_offset] = (cword_offset >=sizeof (ulong)) ?0x00 : val; + } }#ifdef DEBUG
@@ -422,7 +430,7 @@ static ulong flash_read_long (flash_info* Write a proper sized command to the correct address */ static void flash_write_cmd (flash_info_t * info,flash_sect_t sect, -uint offset,uchar cmd) +uint offset,ulong cmd) {void *addr;
@@ -911,7 +919,7 @@ static int flash_write_cfibuffer (flash_/* reduce the number of loops by the width of * the port */ cnt = len >> shift; -flash_write_cmd (info, sector,0 , (uchar ) cnt -1 ); +flash_write_cmd (info, sector,0 , cnt -1 );while (cnt-- >0 ) {switch (info->portwidth) {case FLASH_CFI_8BIT :
@@ -953,7 +961,7 @@ static int flash_write_cfibuffer (flash_#endif flash_write_cmd (info, sector, offset,AMD_CMD_WRITE_TO_BUFFER ); cnt = len >> shift; -flash_write_cmd (info, sector, offset, (uchar )cnt -1 ); +flash_write_cmd (info, sector, offset, cnt -1 );switch (info->portwidth) {case FLASH_CFI_8BIT :
PATCH 1/1 M18 flash (Sibley) support (attempt 2)
Hi All
The last message with patch was sent by mistake.
Correct patches were sent in two messages before.
Best Regards
Vasiliy
PATCH 1/1 M18 flash (Sibley) support (attempt 2)
Quoted 2 lines · Vasiliy Leonenko
The last message with patch was sent by mistake.
Correct patches were sent in two messages before.
Understood. I'll recheck this patchset after 1.3.3 is released.
Thanks.
Best regards,
Stefan
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================
PATCH 1/1 M18 flash (Sibley) support (attempt 2)
In reply to Wolfgang Denkcfi_flash: enable M18 flash chips family support.
Added new command set ID. Buffered write command processing is changed in order to support M18 flash chips family.
==============================================================
drivers/mtd/cfi_flash.c +20 -1
@@ -76,7 +76,9 @@#define FLASH_CMD_PROTECT_SET 0x01#define FLASH_CMD_PROTECT_CLEAR 0xD0#define FLASH_CMD_CLEAR_STATUS 0x50 +#define FLASH_CMD_READ_STATUS 0x70#define FLASH_CMD_WRITE_TO_BUFFER 0xE8 +#define FLASH_CMD_WRITE_BUFFER_PROG 0xE9#define FLASH_CMD_WRITE_BUFFER_CONFIRM 0xD0#define FLASH_STATUS_DONE 0x80
@@ -136,6 +138,7 @@#define CFI_CMDSET_MITSU_STANDARD 256#define CFI_CMDSET_MITSU_EXTENDED 257#define CFI_CMDSET_SST 258 +#define CFI_CMDSET_INTEL_PROG_REGIONS 512#ifdef CFG_FLASH_CFI_AMD_RESET /* needed for STM_ID_29W320DB on UC100 */ # undef FLASH_CMD_RESET
@@ -620,6 +623,7 @@ static int flash_is_busy (flash_info_t *int retval;switch (info->vendor) { +case CFI_CMDSET_INTEL_PROG_REGIONS :case CFI_CMDSET_INTEL_STANDARD :case CFI_CMDSET_INTEL_EXTENDED : retval = !flash_isset (info, sect,0 ,FLASH_STATUS_DONE );
@@ -679,6 +683,7 @@ static int flash_full_status_check (flas retcode =flash_status_check (info, sector, tout, prompt);switch (info->vendor) { +case CFI_CMDSET_INTEL_PROG_REGIONS :case CFI_CMDSET_INTEL_EXTENDED :case CFI_CMDSET_INTEL_STANDARD : if ((retcode == ERR_OK)
@@ -807,6 +812,7 @@ static int flash_write_cfiword (flash_in flag =disable_interrupts ();switch (info->vendor) { +case CFI_CMDSET_INTEL_PROG_REGIONS :case CFI_CMDSET_INTEL_EXTENDED :case CFI_CMDSET_INTEL_STANDARD :flash_write_cmd (info,0 ,0 ,FLASH_CMD_CLEAR_STATUS );
@@ -861,6 +867,7 @@ static int flash_write_cfibuffer (flash_int flag =0 ;uint offset =0 ;unsigned int shift; +uchar write_cmd;switch (info->portwidth) {case FLASH_CFI_8BIT :
@@ -915,10 +922,14 @@ static int flash_write_cfibuffer (flash_ sector =find_sector (info, dest);switch (info->vendor) { +case CFI_CMDSET_INTEL_PROG_REGIONS :case CFI_CMDSET_INTEL_STANDARD :case CFI_CMDSET_INTEL_EXTENDED : + write_cmd = (info->vendor ==CFI_CMDSET_INTEL_PROG_REGIONS ) ? +FLASH_CMD_WRITE_BUFFER_PROG :FLASH_CMD_WRITE_TO_BUFFER ;flash_write_cmd (info, sector,0 ,FLASH_CMD_CLEAR_STATUS ); -flash_write_cmd (info, sector,0 ,FLASH_CMD_WRITE_TO_BUFFER ); +flash_write_cmd (info, sector,0 ,FLASH_CMD_READ_STATUS ); +flash_write_cmd (info, sector,0 , write_cmd); retcode =flash_status_check (info, sector, info->buffer_write_tout,"write to buffer" );
@@ -1053,6 +1064,7 @@ int flash_erase (flash_info_t * info, infor (sect = s_first; sect <= s_last; sect++) {if (info->protect[sect] ==0 ) {/* not protected */ switch (info->vendor) { +case CFI_CMDSET_INTEL_PROG_REGIONS :case CFI_CMDSET_INTEL_STANDARD :case CFI_CMDSET_INTEL_EXTENDED : flash_write_cmd (info, sect, 0,
@@ -1121,6 +1133,9 @@ void flash_print_info (flash_info_t * in info->size >> 20, info->sector_count);printf (" " );switch (info->vendor) { +case CFI_CMDSET_INTEL_PROG_REGIONS : +printf ("Intel Prog Regions" ); +break ;case CFI_CMDSET_INTEL_STANDARD :printf ("Intel Standard" );break ;
@@ -1511,6 +1526,7 @@ static void flash_read_jedec_ids (flash_ info->device_id2 =0 ;switch (info->vendor) { +case CFI_CMDSET_INTEL_PROG_REGIONS :case CFI_CMDSET_INTEL_STANDARD :case CFI_CMDSET_INTEL_EXTENDED :cmdset_intel_read_jedec_ids (info);
@@ -1565,6 +1581,7 @@ static int flash_detect_legacy(ulong bas }switch (info->vendor) { +case CFI_CMDSET_INTEL_PROG_REGIONS :case CFI_CMDSET_INTEL_STANDARD :case CFI_CMDSET_INTEL_EXTENDED : info->cmd_reset =FLASH_CMD_RESET ;
@@ -1760,6 +1777,7 @@ ulong flash_get_size (ulong base, int ba#endif switch (info->vendor) { +case CFI_CMDSET_INTEL_PROG_REGIONS :case CFI_CMDSET_INTEL_STANDARD :case CFI_CMDSET_INTEL_EXTENDED :cmdset_intel_init (info, &qry);
@@ -1837,6 +1855,7 @@ ulong flash_get_size (ulong base, int ba* supported devices (intel...) */ switch (info->vendor) { +case CFI_CMDSET_INTEL_PROG_REGIONS :case CFI_CMDSET_INTEL_EXTENDED :case CFI_CMDSET_INTEL_STANDARD : info->protect[sect_cnt] =
PATCH 1/1 M18 flash (Sibley) support (attempt 2)
In reply to Stefan RoeseThe second patch (M18 family command set support)
================================================================
drivers/mtd/cfi_flash.c +20 -1
@@ -76,7 +76,9 @@#define FLASH_CMD_PROTECT_SET 0x01#define FLASH_CMD_PROTECT_CLEAR 0xD0#define FLASH_CMD_CLEAR_STATUS 0x50 +#define FLASH_CMD_READ_STATUS 0x70#define FLASH_CMD_WRITE_TO_BUFFER 0xE8 +#define FLASH_CMD_WRITE_BUFFER_PROG 0xE9#define FLASH_CMD_WRITE_BUFFER_CONFIRM 0xD0#define FLASH_STATUS_DONE 0x80
@@ -136,6 +138,7 @@#define CFI_CMDSET_MITSU_STANDARD 256#define CFI_CMDSET_MITSU_EXTENDED 257#define CFI_CMDSET_SST 258 +#define CFI_CMDSET_INTEL_PROG_REGIONS 512#ifdef CFG_FLASH_CFI_AMD_RESET /* needed for STM_ID_29W320DB on UC100 */ # undef FLASH_CMD_RESET
@@ -617,6 +620,7 @@ static int flash_is_busy (flash_info_t *int retval;switch (info->vendor) { +case CFI_CMDSET_INTEL_PROG_REGIONS :case CFI_CMDSET_INTEL_STANDARD :case CFI_CMDSET_INTEL_EXTENDED : retval = !flash_isset (info, sect,0 ,FLASH_STATUS_DONE );
@@ -676,6 +680,7 @@ static int flash_full_status_check (flas retcode =flash_status_check (info, sector, tout, prompt);switch (info->vendor) { +case CFI_CMDSET_INTEL_PROG_REGIONS :case CFI_CMDSET_INTEL_EXTENDED :case CFI_CMDSET_INTEL_STANDARD : if ((retcode == ERR_OK)
@@ -804,6 +809,7 @@ static int flash_write_cfiword (flash_in flag =disable_interrupts ();switch (info->vendor) { +case CFI_CMDSET_INTEL_PROG_REGIONS :case CFI_CMDSET_INTEL_EXTENDED :case CFI_CMDSET_INTEL_STANDARD :flash_write_cmd (info,0 ,0 ,FLASH_CMD_CLEAR_STATUS );
@@ -858,6 +864,7 @@ static int flash_write_cfibuffer (flash_int flag =0 ;uint offset =0 ;unsigned int shift; +uchar write_cmd;switch (info->portwidth) {case FLASH_CFI_8BIT :
@@ -912,10 +919,14 @@ static int flash_write_cfibuffer (flash_ sector =find_sector (info, dest);switch (info->vendor) { +case CFI_CMDSET_INTEL_PROG_REGIONS :case CFI_CMDSET_INTEL_STANDARD :case CFI_CMDSET_INTEL_EXTENDED : + write_cmd = (info->vendor ==CFI_CMDSET_INTEL_PROG_REGIONS ) ? +FLASH_CMD_WRITE_BUFFER_PROG :FLASH_CMD_WRITE_TO_BUFFER ;flash_write_cmd (info, sector,0 ,FLASH_CMD_CLEAR_STATUS ); -flash_write_cmd (info, sector,0 ,FLASH_CMD_WRITE_TO_BUFFER ); +flash_write_cmd (info, sector,0 ,FLASH_CMD_READ_STATUS ); +flash_write_cmd (info, sector,0 , write_cmd); retcode =flash_status_check (info, sector, info->buffer_write_tout,"write to buffer" );
@@ -1050,6 +1061,7 @@ int flash_erase (flash_info_t * info, infor (sect = s_first; sect <= s_last; sect++) {if (info->protect[sect] ==0 ) {/* not protected */ switch (info->vendor) { +case CFI_CMDSET_INTEL_PROG_REGIONS :case CFI_CMDSET_INTEL_STANDARD :case CFI_CMDSET_INTEL_EXTENDED : flash_write_cmd (info, sect, 0,
@@ -1118,6 +1130,9 @@ void flash_print_info (flash_info_t * in info->size >> 20, info->sector_count);printf (" " );switch (info->vendor) { +case CFI_CMDSET_INTEL_PROG_REGIONS : +printf ("Intel Prog Regions" ); +break ;case CFI_CMDSET_INTEL_STANDARD :printf ("Intel Standard" );break ;
@@ -1508,6 +1523,7 @@ static void flash_read_jedec_ids (flash_ info->device_id2 =0 ;switch (info->vendor) { +case CFI_CMDSET_INTEL_PROG_REGIONS :case CFI_CMDSET_INTEL_STANDARD :case CFI_CMDSET_INTEL_EXTENDED :cmdset_intel_read_jedec_ids (info);
@@ -1562,6 +1578,7 @@ static int flash_detect_legacy(ulong bas }switch (info->vendor) { +case CFI_CMDSET_INTEL_PROG_REGIONS :case CFI_CMDSET_INTEL_STANDARD :case CFI_CMDSET_INTEL_EXTENDED : info->cmd_reset =FLASH_CMD_RESET ;
@@ -1757,6 +1774,7 @@ ulong flash_get_size (ulong base, int ba#endif switch (info->vendor) { +case CFI_CMDSET_INTEL_PROG_REGIONS :case CFI_CMDSET_INTEL_STANDARD :case CFI_CMDSET_INTEL_EXTENDED :cmdset_intel_init (info, &qry);
@@ -1834,6 +1852,7 @@ ulong flash_get_size (ulong base, int ba* supported devices (intel...) */ switch (info->vendor) { +case CFI_CMDSET_INTEL_PROG_REGIONS :case CFI_CMDSET_INTEL_EXTENDED :case CFI_CMDSET_INTEL_STANDARD : info->protect[sect_cnt] =