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

--
Best Regards,
Eagle DING