From: Greg H. <gr...@sb...> - 2003-11-05 04:06:58
|
> I've got an idea, you could check. Flash driver computes always byte address > regardless bus is byte, half word or word wide, I think, but that flash is > half-word addressed. > The best place to fix address is function setup_address() which is called > form functions like _bus_write(), _bus_read(), _bus_read_start() and > _bus_read_next(). > > Here is my example: adr >>= (dbus_width == 8) ? 0 : ((dbus_width == 16) ? > 1 : 2); > > Then bus driver should start working with original cfi_detect() and amd.c. I > hope it will work, because symptom of odd half-word being not programmed is > very characteristic. > If you can prove this theory i would issue new patch. I'm able to flash the 29LV160 now in 16 bit mode!!! :) I can send the changes to the people that need it now to get them going. Its not ready for official sources yet until I get some issues figured out on what I changed. Keep in mind I program in Solder on my day time job and not C. (HW engineer) :) I looked at the function setup_address() but this would shift all address including the address to put in the different modes. i.e. 0x555, 0x2aa, 0xaaa etc. So I didn't want to touch that. I looked at the root function flashmem() in flash.c and made changes there in two spots, (program and verify sections of the function): adr += flash_driver->bus_width; to adr += 1; //flash_driver->bus_width; This is the spot of the double incrementing. Now, I also add to changed the following in amd.c: o = 1 to o = 0 in amd_flash_autodetect16(): ***************** static int amd_flash_autodetect16( cfi_array_t *cfi_array ) { if(cfi_array->bus_width != 2) return 0; o = 0; /* Heuristic */ return (cfi_array->cfi_chips[0]->cfi.identification_string.pri_id_code == CFI_VENDOR_AMD_SCS); } **************** I dont understand why this would be anything but 0 in the way it is used further down in amd_flash_program(). I dont know why anyone would want to rotate the address like this. That would change the values to the wrong address. I can see adding an offset to it to get to the next flash chip if multiple chips of the same bus width are used, one after the other. Any idea why? **************** static int amd_flash_program( cfi_array_t *cfi_array, uint32_t adr, uint32_t data ) { int status; bus_t *bus = cfi_array->bus; if (dbg) printf("\nflash_program 0x%08X = 0x%08X\n", adr, data); bus_write( bus, 0x0555 << o, 0x00aa00aa ); /* autoselect p29, program */ bus_write( bus, 0x02aa << o, 0x00550055 ); bus_write( bus, 0x0555 << o, 0x00A000A0 ); bus_write( bus, adr, data ); status = amdstatus( bus, adr, data ); /* amd_flash_read_array(ps); */ return !status; } ***************** I didnt have to change detectflash.c or cfi.c at all. I keep the ID select procedure the same as the 8 bit vendor metod and device detect the same. With all 16 bits connected you can still read 16 bit from the part with the 8 bit method. Stange but it works. Greg |