The first patch (support of long commands):
===================================================
diff -aupNr a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
--- a/drivers/mtd/cfi_flash.c 2008-04-21 02:39:38.000000000 +0400
+++ b/drivers/mtd/cfi_flash.c 2008-04-29 15:57:51.000000000 +0400
@@ -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:
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
U-Boot-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/u-boot-users