<div>just ignore the last incomplete mail, sorry for the inconvenience.</div>
<div> </div>
<div> </div>
<div>Hi,</div>
<div> </div>
<div> I'm porting u-boot-1.3.2 on my MPC8270 board and using FLASH_CFI_DRIVER.</div>
<div>The board has 4 x 28F256J3C using the same CS4, make up 64-bit wide 128MBytes flash memory at 0x10000000.</div>
<div> </div>
<div> I add flash write/read command in cmd_flash.c as bellow, and write the data as the following command:</div>
<div>U-boot-> flwrite 0x10000000 0x01 0x100 /*It's supposed to write 0x0102030405060708..... to the flash. */</div>
<div> </div>
<div>U-boot-> flread 0x10000000 0x100 /* strange byte order when read back*/<br>0x10000000: 01020304000f000f<br>0x10000008: 090a0b0c05060708<br>0x10000010: 111213140d0e0f10<br>0x10000018: 191a1b1c15161718<br>0x10000020: 212223241d1e1f20</div>
<div> </div>
<div>I wonder how the function flash_write64 in cfi_flash.c works to load 8bytes to 64bit wide 60x-bus?</div>
<div>Is there anyone have similar issue before? </div>
<div> </div>
<div>int do_flwrite ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])<br>{<br> ulong data_addr;<br> uchar data_data;<br> ulong data_count;<br> ulong data_increase;<br> ulong i,j,k; <br>
uchat data_buffer[128]; </div>
<div> if (argc < 3) {<br> printf ("Usage:\n%s\n", cmdtp->usage);<br> return 1;<br> } <br> <br> data_addr = simple_strtoul(argv[1], NULL, 16);<br>
if ((data_addr < CFG_FLASH1_BASE ) || (data_addr > (CFG_FLASH1_BASE + (CFG_FLASH1_SIZE<<20) - 1) )) {<br> printf ("Address is out of Bulk FLASH range, %x to %x supported\n",<br>
CFG_FLASH1_BASE, CFG_FLASH1_BASE + (CFG_FLASH1_SIZE<<20) -1);<br> return 1;<br> }</div>
<div> data_data = simple_strtoul(argv[2], NULL, 16);</div>
<div> if (argc == 3) {<br> data_count = 1;<br> }else{<br> data_count = simple_strtoul(argv[3], NULL, 16);<br> }<br> <br> if (argc == 4) {<br> data_increase = 1;<br>
}else{ <br> data_increase = 0;<br> }<br> <br> flash_info_t* info= &(flash_info[1]);</div>
<div> for(i=0;i<data_count;i+=128){<br> k=data_count-i;<br> for(j=0;j<128 && j<k;j++){<br> data_buffer[j] = data_data;<br> data_data += data_increase;<br>
}<br> switch( write_buff(info,data_buffer,data_addr+i,j) ){<br> case 0:<br> printf("Write successfully.\n");<br> break;<br>
case 1:<br> printf("Write timeout.\n");<br> break;<br> case 2:<br> printf("Flash not erased.\n");<br>
break;<br> }<br> }<br> return 0;<br>}<br></div>
<div>int do_flread ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])<br>{<br> ulong data_addr;<br> ulong data_count;<br> int i;</div>
<div> flash_info_t* info= &(flash_info[1]);</div>
<div> if (argc < 2 ) {<br> printf ("Usage:\n%s\n", cmdtp->usage);<br> return 1;<br> }</div>
<div> data_addr = simple_strtoul(argv[1], NULL, 16);<br> if ((data_addr < CFG_FLASH1_BASE ) || (data_addr > (CFG_FLASH1_BASE + (CFG_FLASH1_SIZE<<20) - 1) )) {<br> printf ("Address is out of Bulk FLASH range, %x to %x supported\n",<br>
CFG_FLASH1_BASE, CFG_FLASH1_BASE + (CFG_FLASH1_SIZE<<20) -1);<br> return 1;<br> }<br> data_addr &= ~(info->portwidth - 1);</div>
<div> if (argc == 2) <br> data_count = 1;<br> else<br> data_count = simple_strtoul(argv[2], NULL, 16);<br> <br> char str[17];<br> str[16]='\0';</div>
<div> for(i=0;i<data_count;i+=8){<br> flash_readll(str,data_addr+i);<br> printf ("0x%08X: %s\n",data_addr+i,str);<br> }<br> return 0;<br>}</div>
<div> </div>
<div>/*add flash_readll in cfi_flash.c*/<br>void flash_readll(char *str,void *addr)<br>{<br> print_longlong(str,flash_read64(addr));<br>}</div>
<div> <br clear="all"><br>-- <br>Best Regards,<br>Eagle DING </div>